diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..9473a1acc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Build Release Artifacts + +on: + release: + types: [created] + +jobs: + build-sdz: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: FranzDiebold/github-env-vars-action@v2.3.0 + - run: sudo apt install -y zip + - run: zip -r repo.sdz * -x .git @ + - uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./repo.sdz + asset_name: ${{ env.CI_REPOSITORY_NAME }}-${{ env.CI_REF_NAME }}.sdz + asset_content_type: application/zip diff --git a/CC-BY-SA-4.0.txt b/CC-BY-SA-4.0.txt new file mode 100644 index 000000000..3b7b82d0d --- /dev/null +++ b/CC-BY-SA-4.0.txt @@ -0,0 +1,427 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.� The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git "a/Creative Commons \342\200\224 Attribution-ShareAlike 4.0 International \342\200\224 CC BY-SA 4.pdf" "b/Creative Commons \342\200\224 Attribution-ShareAlike 4.0 International \342\200\224 CC BY-SA 4.pdf" deleted file mode 100644 index 55dc821f9..000000000 Binary files "a/Creative Commons \342\200\224 Attribution-ShareAlike 4.0 International \342\200\224 CC BY-SA 4.pdf" and /dev/null differ diff --git a/DummyCommit.txt b/DummyCommit.txt index f2fb61a1c..bdbe4075c 100644 --- a/DummyCommit.txt +++ b/DummyCommit.txt @@ -1 +1 @@ -VERSION{v11.10} \ No newline at end of file +VERSION{v15.01} \ No newline at end of file diff --git a/Features/All Worlds/treedefs.lua b/Features/All Worlds/treedefs.lua index 15c570834..270a1bb91 100644 --- a/Features/All Worlds/treedefs.lua +++ b/Features/All Worlds/treedefs.lua @@ -17,7 +17,7 @@ local function CreateTreeDef(type) damage = 5, metal = 0, - object ="features/0ad/ad0_pine_3_xl.s3o", + object ="features/enginetreereplacement/enginetreereplacement.s3o", reclaimTime = 25, mass = 5, diff --git a/GPL-2.0.txt b/GPL-2.0.txt new file mode 100644 index 000000000..d159169d1 --- /dev/null +++ b/GPL-2.0.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Gamedata/alldefs_post.lua b/Gamedata/alldefs_post.lua index 017a00465..d698a7574 100644 --- a/Gamedata/alldefs_post.lua +++ b/Gamedata/alldefs_post.lua @@ -18,6 +18,17 @@ -- The widget to do so can be found in 'etc/Lua/bake_unitdefs_post' SaveDefsToCustomParams = false +------------------------- +-- Process relevant modoptions and gamewide features first +------------------------- +unitHealthModifier = tonumber(Spring.GetModOptions().unithealthmodifier) +if unitHealthModifier == nil then + unitHealthModifier = 500 +end + +unitHealthModifier = unitHealthModifier * 0.01 + +canAnyUnitsReclaim = false ------------------------- -- DEFS POST PROCESSING @@ -77,7 +88,10 @@ function UnitDef_Post(name, uDef) -- Allow all unit to see planes high above -- This ties in with the global Cylinder Targetting -- Default airsightdistance is sightdistance * 1.5 - uDef.airsightdistance = uDef.sightdistance * 2 + --uDef.airsightdistance = uDef.sightdistance * 2 --No longer needed + if uDef.airsightdistance == uDef.sightdistance * 1.5 then + uDef.airsightdistance = uDef.sightdistance + end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -114,7 +128,7 @@ function UnitDef_Post(name, uDef) -- if uDef.builder == true and uDef.sounds then - uDef.sounds.build = "miscfx/buildstart.wav" + uDef.sounds.build = "miscfx/buildstart-nano.wav" end -------------------------------------------------------------------------------- @@ -129,6 +143,8 @@ function UnitDef_Post(name, uDef) local radius = 8 * sqrt((fx * fx) + (fz * fz)) if uDef.customparams and uDef.customparams.decloakradiusmodifier then uDef.mincloakdistance = (radius * uDef.customparams.decloakradiusmodifier) + elseif uDef.customparams and uDef.customparams.decloakradiushalved then + uDef.mincloakdistance = (radius * 3) else uDef.mincloakdistance = (radius * 6) end @@ -148,8 +164,24 @@ function UnitDef_Post(name, uDef) end --Override groundplate used - if uDef.usegrounddecal == true then - uDef.buildinggrounddecaltype = "groundplate.dds" + if uDef.usegrounddecal == true and uDef.customparams and uDef.customparams.customgrounddecal ~= true then + if uDef.customparams and uDef.customparams.factionname == "ateran" then + uDef.buildinggrounddecaltype = "groundplate.dds" + --Make decals sizing easy + if uDef.footprintx ~= nil and uDef.footprintz ~= nil then + uDef.buildinggrounddecalsizex = uDef.footprintx + 2 + uDef.buildinggrounddecalsizey = uDef.footprintz + 2 + uDef.buildinggrounddecaldecayspeed = 0.9 + else + Spring.Echo("[AllDefsPost] " .. uDef.name .. " Does not have it's footprint defined") + end + end + if uDef.customparams and uDef.customparams.factionname == "zaal" then + uDef.buildinggrounddecaltype = "zgroundtexture2.dds" + end + if uDef.customparams and uDef.customparams.factionname == "pattern" then + uDef.buildinggrounddecaltype = "groundplate.dds" + end end -------------------------------------------------------------------------------- @@ -159,12 +191,33 @@ function UnitDef_Post(name, uDef) uDef.shownanospray = false end + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- Make units unable to be built in the water + if uDef.maxwaterdepth then + uDef.maxwaterdepth = 25 + end + if uDef.floater then + uDef.floater = false + end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Turn off Chicken Egg drops if uDef.corpse == "chicken_egg" then uDef.corpse = "" end + + if string.find(name, '_scav') then + VFS.Include("gamedata/scavengers/unitdef_post.lua") + uDef = scav_Udef_Post(name, uDef) + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Use per piece collision volumes + -- !Potentially very expensive! + -- I'm using this to save myself a boatload of time + uDef.usePieceCollisionVolumes = false + end -------------------------------------------------------------------------------- @@ -172,8 +225,11 @@ end -- process weapondef function WeaponDef_Post(name, wDef) - -- Cylinder Targeting for everything - wDef.cylindertargeting = 128 + -- Cylinder Targeting and infinite vertical range for everything + --wDef.cylindertargeting = 128 + --wDef.heightmod = 1 + + wDef.name = wDef.weapontype --Use targetborderoverride in weapondef customparams to override this global setting --Controls whether the weapon aims for the center or the edge of its target's collision volume. Clamped between -1.0 - target the far border, and 1.0 - target the near border. @@ -183,7 +239,7 @@ function WeaponDef_Post(name, wDef) wDef.targetborder = tonumber(wDef.customparams.targetborderoverride) end - -- weapon reloadTime and stockpileTime were seperated in 77b1 + -- weapon reloadTime and stockpileTime were separated in 77b1 if (tobool(wDef.stockpile) and (wDef.stockpiletime==nil)) then wDef.stockpiletime = wDef.reloadtime --wDef.reloadtime = 2 -- 2 seconds @@ -193,6 +249,24 @@ function WeaponDef_Post(name, wDef) wDef.gravityaffected = true end + --Potentially fix times when weapons explode without doing damage + if tonumber(wDef.areaofeffect) ~= nil and tonumber(wDef.areaofeffect) <= 25 then + if wDef.customparams and wDef.customparams.aoeoverride == true then + wDef.areaofeffect = wDef.areaofeffect + else + wDef.areaofeffect = 25 + end + end + if tonumber(wDef.areaofeffect) ~= nil and tonumber(wDef.areaofeffect) <= 25 then + if wDef.customparams and wDef.customparams.edgeeffectiveness == true then + wDef.edgeeffectiveness = wDef.edgeeffectiveness + else + wDef.edgeeffectiveness = 1 + end + end + + --Override map gravity for all weapons + wDef.mygravity = 0.14 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Set up params for Point Defense turrets @@ -233,6 +307,24 @@ function WeaponDef_Post(name, wDef) wDef.damage.default = 6.25 wDef.energypershot = math.floor(wDef.damage.default * 0.05 * wDef.projectiles * ((wDef.areaofeffect * 0.001) + 1) * wDef.range^0.25 * 0.5 * 10 + 0.5) * 0.1 end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- Turn off waterweapons + if wDef.waterweapon then + wDef.waterweapon = false + end + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Disable Friendly Fire Completely + if wDef.customparams and wDef.customparams.friendlyfireexception == nil then + wDef.customparams.nofriendlyfire = 1 + end + + if string.find(name, '_scav') then + VFS.Include("gamedata/scavengers/weapondef_post.lua") + wDef = scav_Wdef_Post(name, wDef) + end + end @@ -253,31 +345,66 @@ function ModOptions_Post (UnitDefs, WeaponDefs) -- unitDef.corpse = "ammobox" -- end - --Shield handling - if unitDef.weapondefs then - for _, weaponDef in pairs(unitDef.weapondefs) do - if weaponDef.weapontype == "Shield" then - unitDef.customparams.shield_radius = weaponDef.shieldradius - unitDef.customparams.shield_power = weaponDef.shieldpower - unitDef.customparams.shield_rate = (weaponDef.customparams or {}).shield_rate or weaponDef.shieldpowerregen - break + --Shield handling + if unitDef.weapondefs then + for _, weaponDef in pairs(unitDef.weapondefs) do + if weaponDef.weapontype == "Shield" then + unitDef.customparams.shield_radius = weaponDef.shieldradius + unitDef.customparams.shield_power = weaponDef.shieldpower + unitDef.customparams.shield_rate = (weaponDef.customparams or {}).shield_rate or weaponDef.shieldpowerregen + break + end end - end - end + end - -- Set building Hitpoints - if unitDef.customparams then - if unitDef.customparams.unittype == "building" then - unitDef.maxdamage = unitDef.buildcostmetal * 5 - end - if unitDef.customparams.unittype == "turret" then - unitDef.maxdamage = unitDef.buildcostmetal * 5 + -- Set building Hitpoints + -- Ateran + if unitDef.customparams and unitDef.customparams.factionname == "ateran" + or unitDef.customparams and unitDef.customparams.factionname == "Federation of Kala" + or unitDef.customparams and unitDef.customparams.factionname == "Loz Alliance" then + if unitDef.customparams then + if unitDef.customparams.unittype == "building" then + unitDef.maxdamage = unitDef.buildcostmetal * 5 + end + if unitDef.customparams.unittype == "factory" then + unitDef.maxdamage = unitDef.buildcostmetal * 30 + end + if unitDef.customparams.unittype == "turret" then + unitDef.maxdamage = unitDef.buildcostmetal * 5 + end + if unitDef.customparams.unittype == "shield" then + unitDef.maxdamage = unitDef.buildcostmetal * 5 + end end - if unitDef.customparams.unittype == "shield" then - unitDef.maxdamage = unitDef.buildcostmetal * 5 + end + -- Zaal + if unitDef.customparams and unitDef.customparams.factionname == "zaal" then + if unitDef.customparams then + if unitDef.customparams.unittype == "building" then + unitDef.maxdamage = unitDef.buildcostmetal * 10 + end end end + + -- Add a modifier for unit HP + if unitDef.maxdamage then + --Spring.Echo(uDef.name) + --Spring.Echo(uDef.maxdamage) + unitDef.maxdamage = unitDef.maxdamage * unitHealthModifier --Look in the top of this file for default health modifier + --Spring.Echo(uDef.name) + --Spring.Echo(uDef.maxdamage) + end end + + -- Make sure that land based defense weapons and turrets are scaled up to match + -- for id,wDef in pairs(WeaponDefs) do + -- if wDef.customparams and wDef.customparams.effectedbyunithealthmodifier == true then + -- if wDef.damage.default then + -- wDef.damage.default = wDef.damage.default * (unitHealthModifier * 0.33) + -- end + -- --Spring.Echo(wDef.damage.default) + -- end + -- end -------------------------------------------------------------------------------- -- Process Upgrades -- @@ -303,6 +430,12 @@ function ModOptions_Post (UnitDefs, WeaponDefs) uDef.maxvelocity = uDef.maxvelocity * 0.85 end end + if uDef.customparams and uDef.customparams.isupgraded == "boss" then + uDef.maxdamage = uDef.maxdamage * 2.50 + if uDef.maxvelocity then + uDef.maxvelocity = uDef.maxvelocity * 0.75 + end + end end for id,wDef in pairs(WeaponDefs) do @@ -328,6 +461,13 @@ function ModOptions_Post (UnitDefs, WeaponDefs) wDef.shieldpower = wDef.shieldpower * 1.50 end end + if wDef.customparams and wDef.customparams.isupgraded == "boss" then + wDef.reloadtime = wDef.reloadtime * 0.5 + wDef.damage.default = wDef.damage.default * 10 + if wDef.exteriorshield == true and wDef.shieldpower < 0 then + wDef.shieldpower = wDef.shieldpower * 2.50 + end + end --Handle Shields if wDef.customparams and wDef.customparams.isshieldupgraded == "1" then @@ -345,6 +485,11 @@ function ModOptions_Post (UnitDefs, WeaponDefs) wDef.shieldpower = wDef.shieldpower * 1.50 end end + if wDef.customparams and wDef.customparams.isshieldupgraded == "boss" then + if wDef.exteriorshield == true then + wDef.shieldpower = wDef.shieldpower * 2.50 + end + end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -390,43 +535,104 @@ function ModOptions_Post (UnitDefs, WeaponDefs) local weaponAreaOfEffect = wDef.areaofeffect or 0 local weaponRange = wDef.range or 0 local weaponProjectiles = wDef.projectiles or 1 + local weaponBurst = wDef.burst or 1 if wDef.customparams and wDef.customparams.nocosttofire == true then wDef.energypershot = 0 - elseif wDef.customparams and wDef.customparams.oldcosttofireforumula == true then + else + wDef.energypershot = 0 + end + + --Here is the rest of the function for units using energy to fire their weapons +--[[ elseif wDef.customparams and wDef.customparams.oldcosttofireforumula == true then local energycosttofire = math.floor(weaponDefaultDamage * 0.1 * weaponProjectiles * ((weaponAreaOfEffect * 0.001) + 1)*10 + 0.5)*0.1 - wDef.energypershot = energycosttofire + wDef.energypershot = energycosttofire * weaponBurst else --energycosttofire = weaponDefaultDamage * 0.05 * weaponProjectiles * ((weaponAreaOfEffect * 0.001) + 1) * weaponRange^0.5 * 0.1 local energycosttofire = math.floor(weaponDefaultDamage * 0.05 * weaponProjectiles * ((weaponAreaOfEffect * 0.001) + 1) * weaponRange^0.25 * 0.5*10 + 0.5)*0.1 - wDef.energypershot = energycosttofire + wDef.energypershot = energycosttofire * weaponBurst end - +]]-- --Set shield energy cost to recharge - if wDef.exteriorshield == true then +--[[ if wDef.exteriorshield == true then if wDef.customparams and wDef.customparams.nocosttofire == true then wDef.shieldpowerregenenergy = 0 else - wDef.shieldpowerregenenergy = math.floor(wDef.shieldpowerregen * 0.05 * wDef.shieldradius^0.25 * 0.5 * 10 + 0.5) * 0.1 + --wDef.shieldpowerregenenergy = math.floor(wDef.shieldpowerregen * 0.05 * wDef.shieldradius^0.25 * 0.5 * 10 + 0.5) * 0.1 --Spring.Echo("Energy usage is " .. wDef.shieldpowerregenenergy) + wDef.shieldpowerregenenergy = wDef.shieldpowerregen / 10 end end - end - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - - for id,unitDef in pairs(UnitDefs) do - for id,weaponDef in pairs(WeaponDefs) do - weaponDef.name = unitDef.name .. [[ Weapon]] - --Spring.Echo(weaponDef.name) - end +]]-- end -------------------------------------------------------------------------------- - -- Gameplay Speed (Classic RTS Mode) -- + -- Gameplay Costs -- -------------------------------------------------------------------------------- for id,unitDef in pairs(UnitDefs) do - unitDef.buildtime = unitDef.buildcostmetal / 4 + + if unitDef.customparams and unitDef.customparams.unitdefbuildtime == nil then + -- Set Rules for Ateran race + if unitDef.customparams and unitDef.customparams.factionname == "ateran" then + unitDef.buildtime = unitDef.buildcostmetal / 4 + unitDef.buildcostenergy = unitDef.buildcostmetal * 1.5 + if unitDef.customparams and unitDef.customparams.requiretech == "tech1" or unitDef.customparams and unitDef.customparams.isupgraded == "1" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 3 + end + if unitDef.customparams and unitDef.customparams.requiretech == "tech2" or unitDef.customparams and unitDef.customparams.isupgraded == "2" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 6 + end + if unitDef.customparams and unitDef.customparams.requiretech == "tech3" or unitDef.customparams and unitDef.customparams.isupgraded == "3" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 12 + end + if unitDef.customparams and unitDef.customparams.noenergycost == true then + unitDef.buildcostenergy = 0 + end + if unitDef.customparams and unitDef.customparams.buildcostenergyoverride ~= nil then + unitDef.buildcostenergy = unitDef.customparams.buildcostenergyoverride + end + end + + -- Set Rules for Zaal race + if unitDef.customparams and unitDef.customparams.factionname == "zaal" then + unitDef.buildtime = unitDef.buildcostmetal / 4 + unitDef.buildcostenergy = unitDef.buildcostmetal * 5 + if unitDef.customparams and unitDef.customparams.requiretech == "tech1" or unitDef.customparams and unitDef.customparams.isupgraded == "1" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 7.5 + end + if unitDef.customparams and unitDef.customparams.requiretech == "tech2" or unitDef.customparams and unitDef.customparams.isupgraded == "2" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 10 + end + if unitDef.customparams and unitDef.customparams.requiretech == "tech3" or unitDef.customparams and unitDef.customparams.isupgraded == "3" then + unitDef.buildcostenergy = unitDef.buildcostmetal * 12.5 + end + if unitDef.customparams and unitDef.customparams.noenergycost == true then + unitDef.buildcostenergy = 0 + end + if unitDef.customparams and unitDef.customparams.buildcostenergyoverride ~= nil then + unitDef.buildcostenergy = unitDef.customparams.buildcostenergyoverride + end + end + + -- This is a catchall for units that don't have a factionname declared + if unitDef.customparams and unitDef.customparams.factionname == nil then + unitDef.buildtime = unitDef.buildcostmetal / 4 + unitDef.buildcostenergy = unitDef.buildcostmetal * 0.25 + end + end + + -- Set maximum possible workertime to 8 + if unitDef.workertime and unitDef.workertime >= 8 then + unitDef.workertime = 8 + end + -- Set reclaimspeed to be a multiple of workertime. This relies on max defaults set in featuredefs post. Without some max defaults there, this will be a funny result. + unitDef.reclaimspeed = unitDef.workertime + + if canAnyUnitsReclaim == false then + if unitDef.canreclaim == true then + unitDef.canreclaim = false + end + end end end end \ No newline at end of file diff --git a/Gamedata/configs/damageTypes.lua b/Gamedata/configs/damageTypes.lua index 13dfa8fd4..2028a90c3 100644 --- a/Gamedata/configs/damageTypes.lua +++ b/Gamedata/configs/damageTypes.lua @@ -4,329 +4,106 @@ local damageClasses = { -- classes with armor classes for weapons damageTypes = { - nonexistent = { - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 0.1, - }, - - pdlaser = { + -- + light = { -- These values should always mirror antilight and vice versa + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, - }, - ---------------------------------------------------------------------------- - -- Overseers with weapons - ecommanderbattle = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, + BUILDING = 1, + AIR = 1, }, - - -- Start H-Bots - ehbotpeewee = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - ehbotthud = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - ehbotsniper = { + antilight = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, + BUILDING = 1, + AIR = 1, }, - ehbotrocko = { + -- + turretantilight = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, + BUILDING = 0.1, + AIR = 1, }, - ehbotkarganneth = { - ARMORED = 1, + turretantiarmored = { LIGHT = 1, - BUILDING = 1, - }, - - -- Start Hovers - eaatank = { - ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, + ARMORED = 1.5, + BUILDING = 0.1, + AIR = 1, }, - eartytank = { - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - ebomb = { - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - efatso = { - ARMORED = 0.125, - LIGHT = 0.125, - BUILDING = 1, - }, - eflametank = { - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - elighttank3 = { - ARMORED = 0.60, - LIGHT = 0.60, - BUILDING = 1, - }, - eheavytank3 = { - ARMORED = 1, + antiarmored = { LIGHT = 1, - BUILDING = 0.33, - }, - emediumtank3 = { - ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.5, - }, - emissiletank = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1, }, - eriottank2 = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eriottank2shotgun = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.25, - }, - elacerator = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 1, - }, - -- End Hovers - - -- Start All Terrains - eallterrheavy = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, - }, - eallterrlight = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eallterrmed = { - ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.5, - }, - eallterraa = { - ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, - }, - eallterrriot = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eallterrriotshotgun = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.25, - }, - eallterrassault = { - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - eallterranarchid = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 1, - }, - eallterranarchidflame = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 1, - }, - -- End All Terrains - - -- Start Amphibs - eamphibbuggy = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 1, - }, - eamphibriot = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibneedle = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibriotshotgun = { - ARMORED = 0.5, + antibuilding = { LIGHT = 1, - BUILDING = 0.25, - }, - eamphibaa = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibmedtank = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibrock = { ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.5, + BUILDING = 1.5, + AIR = 1, }, - eamphibarty = { - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - eamphibleveler = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 1, - }, - -- End Amphibs - - -- Start Aircraft - edrone = { - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - eraider = { - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - efighter = { + antibuildingarty = { + LIGHT = 0.25, ARMORED = 0.25, - LIGHT = 1, - BUILDING = 0.25, + BUILDING = 1.5, + AIR = 0.25, }, - egunship2 = { - ARMORED = 1, + antiair = { LIGHT = 1, - BUILDING = 0.25, - }, - egunship2torpedo = { ARMORED = 1, - LIGHT = 1, - BUILDING = 0.25, - }, - ebomber = { - ARMORED = 0.33, - LIGHT = 0.33, - BUILDING = 1, + BUILDING = 1, + AIR = 1.5, }, - ekrow = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 1, + antilightarmored = { + LIGHT = 1.5, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1, }, - -- End Aircraft - - -- Start Experimentals - eexkrabgroth = { - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 1, - }, - eextankdestroyer = { + antilightbuilding = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.1, - }, - eexnukearty = { - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, + BUILDING = 1.5, + AIR = 1, }, - -- End Experimentals - - -- Start Buildings - elightturret2 = { - ARMORED = 0.5, + antiarmoredbuilding = { LIGHT = 1, - BUILDING = 0.1, + ARMORED = 1.5, + BUILDING = 1.5, + AIR = 1, }, - eheavyturret2 = { - ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.1, - }, - eaaturret = { + antibuildingair = { + LIGHT = 1, ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, - }, - elrpc = { - ARMORED = 0.25, - LIGHT = 0.25, - BUILDING = 1, + BUILDING = 1.5, + AIR = 1.5, }, - euwturret = { - ARMORED = 1, + antiarmoredair = { LIGHT = 1, - BUILDING = 0.1, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1.5, }, - emine = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0, + turretantilightarmored = { + LIGHT = 1.5, + ARMORED = 1.5, + BUILDING = 0.1, + AIR = 1, }, - -- End Buildings - - -- Start Miscellaneous - queenbeam = { - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 1, - }, - queenflames = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.1, - }, - queencannon = { - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.1, - }, - -- End Miscellaneous default = { - ARMORED = 1, LIGHT = 1, - BUILDING = 1, + ARMORED = 1, + BUILDING = 1, + AIR = 1, }, }, armorDefs = { - "LIGHT", + "LIGHT", "ARMORED", - "BUILDING", + "BUILDING", + "AIR", }, } return damageClasses; \ No newline at end of file diff --git a/Gamedata/explosions/Steam.lua b/Gamedata/explosions/Steam.lua index a61df2f6b..720b86f49 100644 --- a/Gamedata/explosions/Steam.lua +++ b/Gamedata/explosions/Steam.lua @@ -28,7 +28,6 @@ return { sizemod = 0.9, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, }, diff --git a/Gamedata/explosions/artyshot2.lua b/Gamedata/explosions/artyshot2.lua index b70ec8328..420ca07f5 100644 --- a/Gamedata/explosions/artyshot2.lua +++ b/Gamedata/explosions/artyshot2.lua @@ -1,4 +1,5 @@ -- artyshot2 +-- artyshot3 return { ["artyshot2"] = { @@ -32,6 +33,38 @@ return { }, }, }, + + ["artyshot3"] = { + smokeandfire = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.70, + alwaysvisible = true, + colormap = [[0.9 0.25 0.0 0.05 0.25 0.25 0.25 0.05 0 0 0 0.01]], + directional = true, + emitrot = 90, + emitrotspread = 0, + emitvector = [[0.0, 1, 0.0]], + gravity = [[0.0, 0.0, 0.0]], + numparticles = 2, + particlelife = 10, + particlelifespread = 4, + particlesize = 1, + particlesizespread = 15, + particlespeed = 1, + particlespeedspread = 1, + pos = [[0.0, 1, 0.0]], + sizegrowth = -0.1, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + }, } diff --git a/Gamedata/explosions/blacksmoke.lua b/Gamedata/explosions/blacksmoke.lua index ed051b9c0..b00fdb24f 100644 --- a/Gamedata/explosions/blacksmoke.lua +++ b/Gamedata/explosions/blacksmoke.lua @@ -29,7 +29,6 @@ return { sizemod = 0.9, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, @@ -60,7 +59,6 @@ return { sizemod = 0.9, texture = [[randdots]], useairlos = false, - colorchange = "stuffs", }, }, }, diff --git a/Gamedata/explosions/dirt.lua b/Gamedata/explosions/dirt.lua index 17ab06bda..64f96b44e 100644 --- a/Gamedata/explosions/dirt.lua +++ b/Gamedata/explosions/dirt.lua @@ -2,6 +2,38 @@ return { ["dirt"] = { + dirtg = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.7, + --alwaysvisible = true, + colormap = [[0.25 0.20 0.10 1.0 0 0 0 0.0]], + directional = true, + emitrot = 90, + emitrotspread = 0, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.3 r0.3, 0]], + numparticles = 0, + particlelife = 15, + particlelifespread = 20, + particlesize = [[12 r4]], + particlesizespread = 10, + particlespeed = 1, + particlespeedspread = 6, + pos = [[r-0.5 r0.5, 1 r2, r-0.5 r0.5]], + sizegrowth = 1.2, + sizemod = 1.0, + texture = [[new_dirta]], + useairlos = false, + }, + }, + }, + + + ["dirtoriginal"] = { dirtg = { air = true, class = [[CSimpleParticleSystem]], @@ -28,7 +60,6 @@ return { sizemod = 1.0, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, dirtw = { @@ -57,7 +88,6 @@ return { sizemod = 1.0, texture = [[randdots]], useairlos = false, - colorchange = "stuffs", }, }, }, @@ -90,7 +120,6 @@ return { sizemod = 1.0, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, dirtw = { diff --git a/Gamedata/explosions/empty.lua b/Gamedata/explosions/empty.lua index 2ae84af9d..cd82d4c29 100644 --- a/Gamedata/explosions/empty.lua +++ b/Gamedata/explosions/empty.lua @@ -30,6 +30,36 @@ return { }, }, }, + + ["emptydirt"] = { + empty = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.97, + colormap = [[1 1 1 1 1 1 1 1]], + directional = true, + emitrot = 0, + emitrotspread = 0, + emitvector = [[dir]], + gravity = [[0, -0.5, 0]], + numparticles = 0, + particlelife = 0, + particlelifespread = 0, + particlesize = 0, + particlesizespread = 0, + particlespeed = 0, + particlespeedspread = 0, + pos = [[0, 0, 0]], + sizegrowth = 0, + sizemod = 0, + texture = [[shell]], + }, + }, + }, } diff --git a/Gamedata/explosions/fusionreaction.lua b/Gamedata/explosions/fusionreaction.lua index 2bb67e8b4..eb26133d0 100644 --- a/Gamedata/explosions/fusionreaction.lua +++ b/Gamedata/explosions/fusionreaction.lua @@ -217,64 +217,6 @@ return { }, ["fusionreactionnuclear"] = { - electricarcs1 = { - air = true, - class = [[CSimpleParticleSystem]], - count = 1, - ground = true, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.02, 0]], - numparticles = 2, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 1.2, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, - underwater_electricarcs1 = { - class = [[CSimpleParticleSystem]], - count = 1, - underwater = 1, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.02, 0]], - numparticles = 2, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 1.2, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, - }, - - ["fusionreactionnuclearorange"] = { electricarcs1 = { air = true, class = [[CSimpleParticleSystem]], @@ -305,106 +247,7 @@ return { useairlos = false, }, }, - }, - - ["fusionreactionnuclearblue"] = { - electricarcs1 = { - air = true, - class = [[CSimpleParticleSystem]], - count = 1, - ground = true, - water = true, - underwater = true, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.02, 0]], - numparticles = 2, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 1.2, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, - }, - - ["fusionreactionnuclearpurple"] = { - electricarcs1 = { - air = true, - class = [[CSimpleParticleSystem]], - count = 1, - ground = true, - water = true, - underwater = true, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0.6 0 0.6 0.01 0.3 0 0.6 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.02, 0]], - numparticles = 2, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 1.2, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, - }, - - ["fusionreactionnucleargreen"] = { - electricarcs1 = { - air = true, - class = [[CSimpleParticleSystem]], - count = 1, - ground = true, - water = true, - underwater = true, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0 0.5 0 0.01 0 0.8 0.2 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.02, 0]], - numparticles = 2, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 1.2, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, - }, + }, ["fusionreactiongeo"] = { electricarcs1 = { @@ -412,6 +255,8 @@ return { class = [[CSimpleParticleSystem]], count = 1, ground = true, + water = true, + underwater = true, properties = { airdrag = 0.8, --alwaysvisible = true, @@ -435,33 +280,6 @@ return { useairlos = false, }, }, - underwater_electricarcs1 = { - class = [[CSimpleParticleSystem]], - count = 1, - underwater = 1, - properties = { - airdrag = 0.8, - --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], - directional = true, - emitrot = 45, - emitrotspread = 15, - emitvector = [[0, 1, 0]], - gravity = [[0, -0.05, 0]], - numparticles = 8, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 2, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 0.3, - sizemod = 1.0, - texture = [[plasmaball]], - useairlos = false, - }, - }, }, ["fusionreactionmex"] = { @@ -553,23 +371,25 @@ return { }, }, }, - - ["fusionreactionmakernew"] = { + + ["fusionreactionstoragenew"] = { electricarcs1 = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, + water = true, + underwater = true, properties = { airdrag = 1, --alwaysvisible = true, - colormap = [[1.0 1.0 1.0 0.04 0.2 0.5 0.9 0.01 0.1 0.5 0.7 0.01 0 0 0 0.01]], + colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], directional = true, emitrot = 0, - emitrotspread = 30, + emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], - numparticles = 4, + numparticles = 1, particlelife = 70, particlelifespread = 1, particlesize = 1, @@ -577,16 +397,22 @@ return { particlespeed = 0.2, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.4, + sizegrowth = 0.6, sizemod = 1, texture = [[plasmaball]], useairlos = false, }, }, - underwater_electricarcs1 = { + }, + + ["fusionreactionstoragenew-blue"] = { + electricarcs1 = { + air = true, class = [[CSimpleParticleSystem]], count = 1, - underwater = 1, + ground = true, + water = true, + underwater = true, properties = { airdrag = 1, --alwaysvisible = true, @@ -596,7 +422,7 @@ return { emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], - numparticles = 4, + numparticles = 1, particlelife = 70, particlelifespread = 1, particlesize = 1, @@ -604,20 +430,22 @@ return { particlespeed = 0.2, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.2, + sizegrowth = 0.6, sizemod = 1, texture = [[plasmaball]], useairlos = false, }, }, }, - - ["fusionreactionstoragenew"] = { + + ["fusionreactionstoragenew-small"] = { electricarcs1 = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, + water = true, + underwater = true, properties = { airdrag = 1, --alwaysvisible = true, @@ -630,21 +458,27 @@ return { numparticles = 1, particlelife = 70, particlelifespread = 1, - particlesize = 1, + particlesize = 0.5, particlesizespread = 0, - particlespeed = 0.2, - particlespeedspread = 1, + particlespeed = 0.1, + particlespeedspread = 0.5, pos = [[0, 2, 0]], - sizegrowth = 0.6, + sizegrowth = 0.3, sizemod = 1, texture = [[plasmaball]], useairlos = false, }, }, - underwater_electricarcs1 = { + }, + + ["fusionreactionstoragenew-blue-small"] = { + electricarcs1 = { + air = true, class = [[CSimpleParticleSystem]], count = 1, - underwater = 1, + ground = true, + water = true, + underwater = true, properties = { airdrag = 1, --alwaysvisible = true, @@ -657,12 +491,12 @@ return { numparticles = 1, particlelife = 70, particlelifespread = 1, - particlesize = 1, + particlesize = 0.5, particlesizespread = 0, - particlespeed = 0.2, - particlespeedspread = 1, + particlespeed = 0.1, + particlespeedspread = 0.5, pos = [[0, 2, 0]], - sizegrowth = 0.6, + sizegrowth = 0.3, sizemod = 1, texture = [[plasmaball]], useairlos = false, @@ -727,6 +561,992 @@ return { }, }, }, + +---------------------------------------------------------- +-- Begin fusionreactionnuclear-small +---------------------------------------------------------- + + ["fusionreactionnuclear-small-1color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclear-small-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-small-2color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclear-small-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-small-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-small-3color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclear-small-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-small-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclear-small-purple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-small-4color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclear-small-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-small-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclear-small-purple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors3 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r120]], + explosiongenerator = [[custom:fusionreactionnuclear-small-green]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-small-orange"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 0.9, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-small-blue"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 0.9, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-small-purple"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.6 0 0.6 0.01 0.3 0 0.6 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 0.9, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-small-green"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0.5 0 0.01 0 0.8 0.2 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 0.9, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + +---------------------------------------------------------- +-- End fusionreactionnuclear-small +---------------------------------------------------------- + +---------------------------------------------------------- +-- Begin fusionreactionnuclear +---------------------------------------------------------- + + ["fusionreactionnuclear-1color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclearorange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-2color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclearorange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclearblue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-3color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclearorange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclearblue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclearpurple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-4color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r500]], + explosiongenerator = [[custom:fusionreactionnuclearorange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclearblue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclearpurple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors3 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r120]], + explosiongenerator = [[custom:fusionreactionnucleargreen]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclearorange"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclearblue"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclearpurple"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.6 0 0.6 0.01 0.3 0 0.6 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnucleargreen"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0.5 0 0.01 0 0.8 0.2 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.2, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + +---------------------------------------------------------- +-- End fusionreactionnuclear +---------------------------------------------------------- + +---------------------------------------------------------- +-- Begin fusionreactionnuclear-huge +---------------------------------------------------------- + + ["fusionreactionnuclear-huge-1color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r30]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-huge-2color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r30]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-huge-3color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r30]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-purple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-huge-4color"] = { + othercolors = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + --delay = [[10 r30]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-orange]], + --pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors1 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r60]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-blue]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors2 = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r90]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-purple]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + othercolors3 = { + air = true, + class = [[CExpGenSpawner]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r120]], + explosiongenerator = [[custom:fusionreactionnuclear-huge-green]], + pos = [[0 r15, 1, 0 r15]], + }, + }, + }, + + ["fusionreactionnuclear-huge-orange"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.5, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-huge-blue"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0 0.5 0.01 0 0.5 0.8 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.5, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-huge-purple"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.6 0 0.6 0.01 0.3 0 0.6 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.5, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionnuclear-huge-green"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0.5 0 0.01 0 0.8 0.2 0.01 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 15, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + numparticles = 1, + particlelife = 45, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 1.5, + sizemod = 1.0, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + +---------------------------------------------------------- +-- End fusionreactionnuclear-huge +---------------------------------------------------------- + +---------------------------------------------------------- +-- Begin fusionreactionmaker +---------------------------------------------------------- + + ["fusionreactionmaker-orange"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0 0 0.01 0.8 0.5 0 0.01 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 30, + emitvector = [[dir]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 70, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 0.2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.6, + sizemod = 1, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionmaker-blue"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.2 0.5 0.9 0.01 0.1 0.5 0.7 0.01 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 30, + emitvector = [[dir]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 70, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 0.2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.6, + sizemod = 1, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionmaker-purple"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.6 0 0.6 0.01 0.3 0 0.6 0.01 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 30, + emitvector = [[dir]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 70, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 0.2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.6, + sizemod = 1, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + + ["fusionreactionmaker-green"] = { + electricarcs1 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + --alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0 0.5 0 0.01 0 0.8 0.2 0.01 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 30, + emitvector = [[dir]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 70, + particlelifespread = 1, + particlesize = 1, + particlesizespread = 0, + particlespeed = 0.2, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.6, + sizemod = 1, + texture = [[plasmaball]], + useairlos = false, + }, + }, + }, + +---------------------------------------------------------- +-- end fusionreactionmaker +---------------------------------------------------------- } diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua index e87a2f747..837b40390 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua @@ -101,7 +101,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -314,7 +313,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -528,7 +526,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -742,7 +739,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua index bfdffeae1..0b64209be 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua index a630078be..b0021bae4 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua index f3da1b99f..d9380448e 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua index 05324c58a..ccd79ad5f 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua index b2a6b9b89..5730f2c42 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua index ba024d61c..083be0290 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua @@ -87,7 +87,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], startsize = 10, }, @@ -312,7 +311,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r2, 0.1 r1, r-3 r2]], startsize = 10, }, @@ -537,7 +535,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r1, 0.1 r1, r-3 r1]], startsize = 10, }, @@ -762,7 +759,6 @@ return { pos = [[r-60 r60, 24, r-60 r60]], size = 10, sizeexpansion = 0.6, - sizegrowth = 15, speed = [[r-3 r3, 0.1 r1, r-3 r3]], startsize = 10, }, diff --git a/Gamedata/explosions/generic-projectile-cegs/generic-projectile-cegs.lua b/Gamedata/explosions/generic-projectile-cegs/generic-projectile-cegs.lua index 16e821fd8..e4c5ae0d2 100644 --- a/Gamedata/explosions/generic-projectile-cegs/generic-projectile-cegs.lua +++ b/Gamedata/explosions/generic-projectile-cegs/generic-projectile-cegs.lua @@ -42,7 +42,7 @@ return { maxheat = 5, pos = [[r-2 r2, 5, r-2 r2]], size = 1, - sizegrowth = 20, + sizegrowth = 10, speed = [[0, 0, 0]], texture = [[starexplo]], }, diff --git a/Gamedata/explosions/lootboxes.lua b/Gamedata/explosions/lootboxes.lua new file mode 100644 index 000000000..2ac058d4e --- /dev/null +++ b/Gamedata/explosions/lootboxes.lua @@ -0,0 +1,101 @@ +-- lootbox beacons + +return { + ["LootboxBeaconBronze"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx0]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconSilver"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx1]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconGold"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx2]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconPlatinum"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.8 1 1 1 0.7 1 1 1 0.3 0 0 0 0.01]], + size = 38, + ttl = 54, + sizegrowth = 0.4, + texture = [[circlefx3]], + alwaysvisible = true, + }, + }, + }, + ["LootboxLightGold"] = { + useAirLos = false, + usedefaultexplosions = false, + ["heatcloud"] = { + air = true, + water = true, + ground = true, + unit = true, + count = 3, + properties = { + --alwaysVisible = true, + heat = 30, + texture = [[glow2]], + maxheat = 30, + heatFalloff = 1.4, + size = [[4.0 r0.4]], + sizeGrowth = [[-0.02 r0.02]], + sizemod = 0, + sizemodmod = 0, + speed = [[0.05 r-0.05, 0.05 r-0.05, 0.05 r-0.05]], + pos = [[0, 0.0, 0]], + useAirLos = false, + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/lootboxes/lootbox-trail.lua b/Gamedata/explosions/lootboxes/lootbox-trail.lua new file mode 100644 index 000000000..9bffbc172 --- /dev/null +++ b/Gamedata/explosions/lootboxes/lootbox-trail.lua @@ -0,0 +1,208 @@ +-- Spawntrail for Lootbox Drops + +return { + ["lootbox-trail"] = { + usedefaultexplosions = false, + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[1 0.75 0.1 0.01 0.9 0.55 0.08 0.01 0.8 0.35 0.05 0.01 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = [[-15 r3.5]], + sidetexture = [[muzzleside]], + size = 15.5, + sizegrowth = [[0.2 r0.9]], + ttl = 1, + }, + }, + fireglow = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 1, + colormap = [[0.95 0.75 0 0.01 0 0 0 0.01]], + directional = false, + emitrot = 0, + emitrotspread = 0, + emitvector = [[0.0, 0.0, 0.0]], + gravity = [[0.0, 0.1, 0.0]], + numparticles = 1, + particlelife = 2, + particlelifespread = 1, + particlesize = 40, + particlesizespread = 12, + particlespeed = 0, + particlespeedspread = 0, + pos = [[0.0, 0, 0.0]], + sizegrowth = -0.5, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + exhale = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.95 0.75 0 0.1 0.45 0.32 0 0.1 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.2, 0]], + numparticles = 1, + particlelife = 40, + particlelifespread = 15, + particlesize = 19, + particlesizespread = 6, + particlespeed = 0.25, + particlespeedspread = 1.2, + pos = [[0, 1, 0]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + exhale2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.8 0.6 0 0.15 0.55 0.40 0 0.1 0.028 0.020 0 0.15 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.65, 0]], + numparticles = 2, + particlelife = 30, + particlelifespread = 15, + particlesize = 7, + particlesizespread = 6, + particlespeed = 0.25, + particlespeedspread = 1.9, + pos = [[0, 1, 0]], + sizegrowth = -0.07, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + trail = { + + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[0 0 0 0.01 0.035 0.025 0.015 0.10 0.035 0.025 0.015 0.08 0.035 0.025 0.015 0.05 0.035 0.025 0.015 0.04 0.035 0.025 0.015 0.02 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[trans]], + length = -20, + sidetexture = [[smoketrail]], + size = 2.0, + sizegrowth = 0.05, + ttl = 40, + }, + }, + smoke = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.92, + colormap = [[0.006 0.006 0.006 0.05 0.05 0.04 0.033 0.66 0.04 0.038 0.034 0.56 0.04 0.036 0.032 0.44 0.025 0.025 0.025 0.28 0.014 0.014 0.014 0.13 0.006 0.006 0.006 0.05 0 0 0 0.01]], + directional = true, + emitrot = -180, + emitrotspread = 7, + emitvector = [[dir]], + gravity = [[0.0, -0.02, 0.0]], + numparticles = [[1.5 r1]], + particlelife = 15, + particlelifespread = 40, + particlesize = 4.6, + particlesizespread = 6.2, + particlespeed = 1.5, + particlespeedspread = 2.5, + pos = [[-15 r30, -15 r30, -15 r30]], + sizegrowth = 0.32, + sizemod = 1, + texture = [[smoke]], + useairlos = true, + }, + }, + dustparticles = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + underwater = true, + water = true, + properties = { + airdrag = 0.77, + colormap = [[0.9 0.66 0.4 0.8 1 0.74 0.48 0.9 0.75 0.45 0.25 0.5 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 15, + emitvector = [[dir]], + gravity = [[0, -0.011, 0]], + numparticles = 1, + particlelife = 9, + particlelifespread = 6, + particlesize = 4, + particlesizespread = 0.8, + particlespeed = 0.05, + particlespeedspread = 0.6, + pos = [[0, 0, 0]], + sizegrowth = 0.03, + sizemod = 1.0, + texture = [[randomdots]], + }, + }, + spikes = { + air = true, + class = [[explspike]], + count = 2, + ground = true, + water = true, + properties = { + alpha = 0.6, + alphadecay = 0.08, + color = [[1.0, 0.5, 0.2]], + dir = [[-10 r20,-10 r20,-10 r20]], + length = 2, + width = 9, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/lootboxes/lootboxes.lua b/Gamedata/explosions/lootboxes/lootboxes.lua new file mode 100644 index 000000000..2ac058d4e --- /dev/null +++ b/Gamedata/explosions/lootboxes/lootboxes.lua @@ -0,0 +1,101 @@ +-- lootbox beacons + +return { + ["LootboxBeaconBronze"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx0]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconSilver"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx1]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconGold"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.6 1 1 1 0.3 0 0 0 0.01]], + size = 36, + ttl = 46, + sizegrowth = 0.4, + texture = [[circlefx2]], + alwaysvisible = true, + }, + }, + }, + ["LootboxBeaconPlatinum"] = { + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = true, + underwater = true, + properties = { + colormap = [[0 0 0 0.01 1 1 1 0.9 1 1 1 0.8 1 1 1 0.7 1 1 1 0.3 0 0 0 0.01]], + size = 38, + ttl = 54, + sizegrowth = 0.4, + texture = [[circlefx3]], + alwaysvisible = true, + }, + }, + }, + ["LootboxLightGold"] = { + useAirLos = false, + usedefaultexplosions = false, + ["heatcloud"] = { + air = true, + water = true, + ground = true, + unit = true, + count = 3, + properties = { + --alwaysVisible = true, + heat = 30, + texture = [[glow2]], + maxheat = 30, + heatFalloff = 1.4, + size = [[4.0 r0.4]], + sizeGrowth = [[-0.02 r0.02]], + sizemod = 0, + sizemodmod = 0, + speed = [[0.05 r-0.05, 0.05 r-0.05, 0.05 r-0.05]], + pos = [[0, 0.0, 0]], + useAirLos = false, + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/meteortrail.lua b/Gamedata/explosions/meteortrail.lua new file mode 100644 index 000000000..a164b3205 --- /dev/null +++ b/Gamedata/explosions/meteortrail.lua @@ -0,0 +1,36 @@ +-- meteortrail + +return { + ["meteortrail"] = { + usedefaultexplosions = false, + exhale = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.87, + colormap = [[0.0 0.0 0.0 0.1 0.7 0.5 0.2 0.1 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.01]], + directional = false, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 1, 0]], + numparticles = 4, + particlelife = 200, + particlelifespread = 15, + particlesize = 50, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 50, + pos = [[0, 1, 0]], + sizegrowth = -1, + sizemod = 1.0, + texture = [[smoke]], + }, + }, + }, + +} + diff --git a/Gamedata/explosions/missiletrail-optimized.lua b/Gamedata/explosions/missiletrail-optimized.lua new file mode 100644 index 000000000..02c3796a1 --- /dev/null +++ b/Gamedata/explosions/missiletrail-optimized.lua @@ -0,0 +1,294 @@ +return { +--hover + ["emissiletanktrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 15, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 31, + sidetexture = [[flashside2-red]], + size = 5, + sizegrowth = 0, + ttl = 40, + }, + }, + }, + +--hbot + ["ehbotrocko-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 15, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 31, + sidetexture = [[flashside2-purple]], + size = 5, + sizegrowth = 0, + ttl = 40, + }, + }, + }, + +--amphibs + ["amphibrocktrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 15, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 30, + sidetexture = [[flashside2-orange]], + size = 5, + sizegrowth = 0, + ttl = 30, + }, + }, + }, + + +--aircraft + ["gunshiptrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 32, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 31, + sidetexture = [[flashside2]], + size = 5, + sizegrowth = 0, + ttl = 20, + }, + }, + }, + + + ["bombertrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 32, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 31, + sidetexture = [[flashside2-red]], + size = 10, + sizegrowth = 0, + ttl = 20, + }, + }, + }, + ["emptrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 60, + sidetexture = [[sparkexplo]], + size = 5, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 60, + sidetexture = [[flashside2-blue]], + size = 15, + sizegrowth = 0, + ttl = 20, + }, + }, + }, + +--Zaal + ["zaalspiketrail-optimized"] = { + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[1 0.73 0.4 0.01 1 0.64 0.25 0.01 1.0 0.4 0.12 0.01 0.5 0.22 0.03 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 4, + sidetexture = [[sparkexplo]], + size = 3, + sizegrowth = 1, + ttl = 3, + }, + }, + trail = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + colormap = [[0.70 0.70 0.70 0.025 0.05 0.05 0.05 0.025 0 0 0 0.01 0 0 0 0.0]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = 5, + sidetexture = [[flashside2-orange]], + size = 1, + sizegrowth = 0, + ttl = 30, + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/railgun.lua b/Gamedata/explosions/railgun.lua index a144963b2..87e26e98d 100644 --- a/Gamedata/explosions/railgun.lua +++ b/Gamedata/explosions/railgun.lua @@ -26,7 +26,6 @@ return { sizemod = 1.0, texture = [[Lightring]], useairlos = false, - colorchange = "stuffs", }, }, }, diff --git a/Gamedata/explosions/scavengers/generic-scavenger-explosion-purple.lua b/Gamedata/explosions/scavengers/generic-scavenger-explosion-purple.lua new file mode 100644 index 000000000..580393fd4 --- /dev/null +++ b/Gamedata/explosions/scavengers/generic-scavenger-explosion-purple.lua @@ -0,0 +1,960 @@ +-- genericscavengerbuildingexplosion-small-purple +-- genericscavengerbuildingexplosion-large-purple +-- genericscavengerbuildingexplosion-medium-purple +-- genericscavengerbuildingexplosion-huge-purple + +return { + ["genericscavengerbuildingexplosion-small-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 5, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:scavenger_lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[200]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 0.5, + flashalpha = 0.6, + flashsize = 200, + ground = true, + ttl = 200, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + + smoke = { + air = true, + count = 8, + ground = true, + water = true, + underwater = true, + properties = { + agespeed = 0.01, + alwaysvisible = true, + color = 0.1, + pos = [[r-60 r60, 24, r-60 r60]], + size = 10, + sizeexpansion = 0.6, + speed = [[r-3 r0.5, 0.1 r1, r-3 r0.5]], + startsize = 10, + }, + }, + + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.25 0.25 0.5 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 30, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 30, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 16, + particlelife = 10, + particlelife = 10, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 12, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 10, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + unitpoofs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.2, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.11 0 0.29 0.01 0.1 0.1 0.1 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.05, 0]], + numparticles = 8, + particlelife = 5, + particlelifespread = 16, + particlesize = 20, + particlesizespread = 0, + particlespeed = 48, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.8, + sizemod = 1, + texture = [[randomdots]], + useairlos = false, + }, + }, + }, + + ["genericscavengerbuildingexplosion-large-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 12, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:scavenger_lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[200]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 2, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 2, + flashalpha = 0.6, + flashsize = 600, + ground = true, + ttl = 200, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + + smoke = { + air = true, + count = 8, + ground = true, + water = true, + underwater = true, + properties = { + agespeed = 0.01, + alwaysvisible = true, + color = 0.1, + pos = [[r-60 r60, 24, r-60 r60]], + size = 10, + sizeexpansion = 0.6, + speed = [[r-3 r2, 0.1 r1, r-3 r2]], + startsize = 10, + }, + }, + + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.25 0.25 0.5 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 120, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 10, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 120, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 10, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 16, + particlelife = 10, + particlelife = 10, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 20, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 30, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + unitpoofs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.2, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.11 0 0.29 0.01 0.1 0.1 0.1 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.05, 0]], + numparticles = 8, + particlelife = 5, + particlelifespread = 16, + particlesize = 20, + particlesizespread = 0, + particlespeed = 48, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.8, + sizemod = 1, + texture = [[randomdots]], + useairlos = false, + }, + }, + }, + + ["genericscavengerbuildingexplosion-medium-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 8, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:scavenger_lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[200]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 1, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 1, + flashalpha = 0.6, + flashsize = 400, + ground = true, + ttl = 200, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + + smoke = { + air = true, + count = 8, + ground = true, + water = true, + underwater = true, + properties = { + agespeed = 0.01, + alwaysvisible = true, + color = 0.1, + pos = [[r-60 r60, 24, r-60 r60]], + size = 10, + sizeexpansion = 0.6, + speed = [[r-3 r1, 0.1 r1, r-3 r1]], + startsize = 10, + }, + }, + + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.25 0.25 0.5 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 60, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 5, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 60, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 5, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 16, + particlelife = 10, + particlelife = 10, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 16, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 15, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + unitpoofs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.2, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.11 0 0.29 0.01 0.1 0.1 0.1 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.05, 0]], + numparticles = 8, + particlelife = 5, + particlelifespread = 16, + particlesize = 20, + particlesizespread = 0, + particlespeed = 48, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.8, + sizemod = 1, + texture = [[randomdots]], + useairlos = false, + }, + }, + }, + + ["genericscavengerbuildingexplosion-huge-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 18, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:scavenger_lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[200]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 3, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 3, + flashalpha = 0.6, + flashsize = 800, + ground = true, + ttl = 200, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + + smoke = { + air = true, + count = 8, + ground = true, + water = true, + underwater = true, + properties = { + agespeed = 0.01, + alwaysvisible = true, + color = 0.1, + pos = [[r-60 r60, 24, r-60 r60]], + size = 10, + sizeexpansion = 0.6, + speed = [[r-3 r3, 0.1 r1, r-3 r3]], + startsize = 10, + }, + }, + + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.25 0.25 0.5 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 160, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 14, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 160, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 14, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 16, + particlelife = 10, + particlelife = 10, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 26, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 40, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + unitpoofs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.2, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.11 0 0.29 0.01 0.1 0.1 0.1 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.05, 0]], + numparticles = 8, + particlelife = 5, + particlelifespread = 16, + particlesize = 20, + particlesizespread = 0, + particlespeed = 48, + particlespeedspread = 1, + pos = [[0, 2, 0]], + sizegrowth = 0.8, + sizemod = 1, + texture = [[randomdots]], + useairlos = false, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/scavengers/generic-scavenger-helper-explosions.lua b/Gamedata/explosions/scavengers/generic-scavenger-helper-explosions.lua new file mode 100644 index 000000000..5c71e3a7e --- /dev/null +++ b/Gamedata/explosions/scavengers/generic-scavenger-helper-explosions.lua @@ -0,0 +1,47 @@ +-- scavenger_lightning_stormbolt + +return { + ["scavenger_lightning_stormbolt"] = { + groundflash = { + circlealpha = 1, + circlegrowth = 0, + flashalpha = 0.3, + flashsize = 46, + ttl = 3, + color = { + [1] = 1, + [2] = 1, + [3] = 1, + }, + }, + lightningballs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + colormap = [[0 0 0 0.01 1 1 1 0.01 0.5 0 0.5 0.01 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 0, + emitvector = [[0, 1, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 3, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 20, + particlespeed = 0.01, + particlespeedspread = 0, + pos = [[-10 r10, 1.0, -10 r10]], + sizegrowth = 0, + sizemod = 1.0, + texture = [[lightbw]], + }, + }, + }, +} + diff --git a/Gamedata/explosions/scavengers/generic-scavenger-projectile-cegs.lua b/Gamedata/explosions/scavengers/generic-scavenger-projectile-cegs.lua new file mode 100644 index 000000000..48b553551 --- /dev/null +++ b/Gamedata/explosions/scavengers/generic-scavenger-projectile-cegs.lua @@ -0,0 +1,33 @@ +return { + ["scavengercegtag"] = { + smokeandfire = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.70, + alwaysvisible = true, + colormap = [[0.5 0.25 0.5 0.05 0.25 0.25 0.25 0.05 0 0 0 0.01]], + directional = true, + emitrot = 90, + emitrotspread = 0, + emitvector = [[0.0, 1, 0.0]], + gravity = [[0.0, 0.0, 0.0]], + numparticles = 2, + particlelife = 10, + particlelifespread = 4, + particlesize = 1, + particlesizespread = 15, + particlespeed = 1, + particlespeedspread = 1, + pos = [[0.0, 1, 0.0]], + sizegrowth = -0.1, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-lightning.lua b/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-lightning.lua new file mode 100644 index 000000000..05e49a2e5 --- /dev/null +++ b/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-lightning.lua @@ -0,0 +1,397 @@ +-- genericscavengershellexplosion-medium-lightning +-- genericscavengershellexplosion-small-lightning +-- genericscavengershellexplosion-large-lightning + +return { + ["genericscavengershellexplosion-medium-lightning"] = { + blueelectricityspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.03 0.5 0.5 0.9 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 10, + particlesizespread = 0, + particlespeed = 8, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[whitelightb]], + useairlos = false, + }, + }, + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 8, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 6, + flashalpha = 0.9, + flashsize = 100, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0, + [2] = 0.5, + [3] = 1, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[1 1 1 0.05 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 10, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[whitelightb]], + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 15, + speed = [[0, 1 0, 0]], + texture = [[brightblueexplo]], + }, + }, + }, + + ["genericscavengershellexplosion-small-lightning"] = { + blueelectricityspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.03 0.5 0.5 0.9 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 10, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[whitelightb]], + useairlos = false, + }, + }, + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 5, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 3, + flashalpha = 0.9, + flashsize = 50, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0, + [2] = 0.5, + [3] = 1, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[1 1 1 0.05 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 5, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[whitelightb]], + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 10, + speed = [[0, 1 0, 0]], + texture = [[brightblueexplo]], + }, + }, + }, + + ["genericscavengershellexplosion-large-lightning"] = { + blueelectricityspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.03 0.5 0.5 0.9 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 10, + particlesizespread = 0, + particlespeed = 12, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[whitelightb]], + useairlos = false, + }, + }, + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 12, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 10, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:lightning_stormbolt]], + pos = [[-100 r200, 1, -100 r200]], + }, + }, + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 12, + flashalpha = 0.9, + flashsize = 150, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0, + [2] = 0.5, + [3] = 1, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[1 1 1 0.05 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 20, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[whitelightb]], + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 30, + speed = [[0, 1 0, 0]], + texture = [[brightblueexplo]], + }, + }, + }, + +} + diff --git a/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-purple.lua b/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-purple.lua new file mode 100644 index 000000000..5ed7fc8f4 --- /dev/null +++ b/Gamedata/explosions/scavengers/generic-scavenger-shell-explosion-purple.lua @@ -0,0 +1,529 @@ +-- genericscavengershellexplosion-medium-purple +-- genericscavengershellexplosion-small-purple +-- genericscavengershellexplosion-large-purple + +return { + ["genericscavengershellexplosion-medium-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 8, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[20]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 4, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 6, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 6, + flashalpha = 0.9, + flashsize = 100, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.20 0.10 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 60, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 5, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 60, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 5, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 8, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 15, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + }, + + ["genericscavengershellexplosion-small-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 5, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[20]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 2, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 3, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 3, + flashalpha = 0.9, + flashsize = 50, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.20 0.10 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 30, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 30, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 10, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + }, + + ["genericscavengershellexplosion-large-purple"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 12, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + + -- put this next to groundflash + explosionwave = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.10999999940395 0 0.28999999165535 0.05 0 0 0 0.0]], -- same as groundflash colors + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 0, 0]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = [[20]], -- same as groundflash ttl + particlelifespread = 0, + particlesize = 6, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesizespread = 1, + particlespeed = [[8]], + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 12, -- same as groundflash circlegrowth + sizemod = 1.0, + texture = [[explosionwave]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + circlealpha = 0.6, + circlegrowth = 12, + flashalpha = 0.9, + flashsize = 150, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 0.50999999940395, + [2] = 0, + [3] = 0.68999999165535, + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.25 0.20 0.10 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 120, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 10, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + kickedupwater = { + class = [[CSimpleParticleSystem]], + count = 1, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.7 0.7 0.9 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 120, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 10, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 1.0, + texture = [[wake]], + }, + }, + orangeexplosionspikes = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.9 0.5 0.2 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 8, + particlelifespread = 0, + particlesize = 1, + particlesizespread = 0, + particlespeed = 12, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 2, + ground = true, + water = true, + underwater = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.1, + maxheat = 20, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 30, + speed = [[0, 1 0, 0]], + texture = [[purplenovaexplo]], + }, + }, + }, + +} + diff --git a/Gamedata/explosions/scavengers/scaspawn-greentrail.lua b/Gamedata/explosions/scavengers/scaspawn-greentrail.lua new file mode 100644 index 000000000..89e0dbeb2 --- /dev/null +++ b/Gamedata/explosions/scavengers/scaspawn-greentrail.lua @@ -0,0 +1,207 @@ +-- Spawntrail for Scavenger Droppods + +return { + ["scaspawn-greentrail"] = { + usedefaultexplosions = false, + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[0.00 1.00 0.00 0.01 0.00 1.00 0.00 0.01 0.00 1.00 0.00 0.01 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = [[-15 r3.5]], + sidetexture = [[muzzleside]], + size = 15.5, + sizegrowth = [[0.2 r0.3]], + ttl = 1, + }, + }, + fireglow = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 1, + colormap = [[0.00 1.00 0.00 0.01 0 0 0 0.01]], + directional = false, + emitrot = 0, + emitrotspread = 0, + emitvector = [[0.0, 0.0, 0.0]], + gravity = [[0.0, 0.1, 0.0]], + numparticles = 1, + particlelife = 2, + particlelifespread = 1, + particlesize = 40, + particlesizespread = 12, + particlespeed = 0, + particlespeedspread = 0, + pos = [[0.0, 0, 0.0]], + sizegrowth = -0.5, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + exhale = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.00 0.80 0.00 0.1 0.00 0.50 0.00 0.05 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.2, 0]], + numparticles = 1, + particlelife = 40, + particlelifespread = 15, + particlesize = 15, + particlesizespread = 12, + particlespeed = 0.25, + particlespeedspread = 1.3, + pos = [[0, 1, 0]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + exhale2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.00 1.00 0.00 0.15 0.00 1.00 0.00 0.1 0.00 1.00 0.00 0.15 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.75, 0]], + numparticles = 2, + particlelife = 30, + particlelifespread = 15, + particlesize = 4, + particlesizespread = 6, + particlespeed = 0.4, + particlespeedspread = 3, + pos = [[0, 1, 0]], + sizegrowth = -0.07, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + trail = { + + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[0 0 0 0.01 0.00 0.70 0.00 0.10 0.00 0.60 0.00 0.08 0.00 0.50 0.00 0.05 0.00 0.40 0.00 0.04 0.00 0.15 0.00 0.02 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[trans]], + length = -20, + sidetexture = [[smoketrail]], + size = 2.0, + sizegrowth = 0.05, + ttl = 40, + }, + }, + smoke = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.92, + colormap = [[0.00 1.00 0.00 0.05 0.00 0.90 0.00 0.66 0.00 0.75 0.00 0.56 0.00 0.60 0.00 0.44 0.00 0.45 0.00 0.28 0.00 0.30 0.00 0.13 0.00 0.15 0.00 0.05 0 0 0 0.01]], + directional = true, + emitrot = -180, + emitrotspread = 7, + emitvector = [[dir]], + gravity = [[0.0, -0.06, 0.0]], + numparticles = [[1.5 r1]], + particlelife = 15, + particlelifespread = 40, + particlesize = 4.6, + particlesizespread = 6.2, + particlespeed = 1.5, + particlespeedspread = 2.5, + pos = [[-15 r30, -15 r30, -15 r30]], + sizegrowth = 0.32, + sizemod = 1, + texture = [[smoke]], + useairlos = true, + }, + }, + dustparticles = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + underwater = true, + water = true, + properties = { + airdrag = 0.77, + colormap = [[0.00 1.00 0.00 0.8 0.00 1.00 0.00 0.9 0.00 1.00 0.00 0.5 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 15, + emitvector = [[dir]], + gravity = [[0, -0.011, 0]], + numparticles = 1, + particlelife = 9, + particlelifespread = 6, + particlesize = 4, + particlesizespread = 0.8, + particlespeed = 0.05, + particlespeedspread = 0.6, + pos = [[0, 0, 0]], + sizegrowth = 0.03, + sizemod = 1.0, + texture = [[randomdots]], + }, + }, + spikes = { + air = true, + class = [[explspike]], + count = 2, + ground = true, + water = true, + properties = { + alpha = 0.6, + alphadecay = 0.08, + color = [[0.00 1.00 0.00]], + dir = [[-10 r20,-10 r20,-10 r20]], + length = 2, + width = 9, + }, + }, + }, + +} diff --git a/Gamedata/explosions/scavengers/scaspawn-trail.lua b/Gamedata/explosions/scavengers/scaspawn-trail.lua new file mode 100644 index 000000000..8b93b6890 --- /dev/null +++ b/Gamedata/explosions/scavengers/scaspawn-trail.lua @@ -0,0 +1,207 @@ +-- Spawntrail for Scavenger Droppods + +return { + ["scaspawn-trail"] = { + usedefaultexplosions = false, + engine = { + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[1 0.7 0.4 0.01 1.0 0.6 0.2 0.01 1.0 0.4 0.1 0.01 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[none]], + length = [[-15 r3.5]], + sidetexture = [[muzzleside]], + size = 15.5, + sizegrowth = [[0.2 r0.3]], + ttl = 1, + }, + }, + fireglow = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 1, + colormap = [[0.85 0.05 1.0 0.01 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 0, + emitvector = [[0.0, 0.0, 0.0]], + gravity = [[0.0, 0, 0.0]], + numparticles = 1, + particlelife = 2, + particlelifespread = 1, + particlesize = 40, + particlesizespread = 12, + particlespeed = 0, + particlespeedspread = 0, + pos = [[0.0, 20, 0.0]], + sizegrowth = -0.5, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + exhale = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.75 0.08 1.0 0.1 0.45 0.04 0.6 0.1 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.2, 0]], + numparticles = 2, + particlelife = 40, + particlelifespread = 15, + particlesize = 19, + particlesizespread = 14, + particlespeed = 0.25, + particlespeedspread = 1.2, + pos = [[0, 1, 0]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + exhale2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.8 0.1 1.0 0.15 0.55 0.06 0.7 0.1 0.028 0.005 0.04 0.15 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.8, 0]], + numparticles = 2, + particlelife = 30, + particlelifespread = 15, + particlesize = 7, + particlesizespread = 6, + particlespeed = 0.25, + particlespeedspread = 1.9, + pos = [[0, 1, 0]], + sizegrowth = -0.07, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + trail = { + + air = true, + class = [[CBitmapMuzzleFlame]], + count = 1, + ground = true, + underwater = 1, + water = true, + properties = { + alwaysVisible = true, + colormap = [[0 0 0 0.01 0.035 0.025 0.015 0.10 0.035 0.025 0.015 0.08 0.035 0.025 0.015 0.05 0.035 0.025 0.015 0.04 0.035 0.025 0.015 0.02 0 0 0 0.01]], + dir = [[dir]], + frontoffset = 0, + fronttexture = [[trans]], + length = -20, + sidetexture = [[smoketrail]], + size = 2.0, + sizegrowth = 0.05, + ttl = 40, + }, + }, + smoke = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.92, + colormap = [[0.006 0.006 0.006 0.05 0.05 0.04 0.033 0.66 0.04 0.038 0.034 0.56 0.04 0.036 0.032 0.44 0.025 0.025 0.025 0.28 0.014 0.014 0.014 0.13 0.006 0.006 0.006 0.05 0 0 0 0.01]], + directional = true, + emitrot = -180, + emitrotspread = 7, + emitvector = [[dir]], + gravity = [[0.0, -0.02, 0.0]], + numparticles = [[1.5 r1]], + particlelife = 15, + particlelifespread = 40, + particlesize = 4.6, + particlesizespread = 6.2, + particlespeed = 1.5, + particlespeedspread = 2.5, + pos = [[-15 r30, -15 r30, -15 r30]], + sizegrowth = 0.32, + sizemod = 1, + texture = [[smoke]], + useairlos = true, + }, + }, + dustparticles = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + underwater = true, + water = true, + properties = { + airdrag = 0.77, + colormap = [[0.85 0.66 0.4 0.8 1 0.74 0.48 0.9 0.75 0.45 0.25 0.5 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 15, + emitvector = [[dir]], + gravity = [[0, -0.011, 0]], + numparticles = 1, + particlelife = 9, + particlelifespread = 6, + particlesize = 4, + particlesizespread = 0.8, + particlespeed = 0.05, + particlespeedspread = 0.6, + pos = [[0, 0, 0]], + sizegrowth = 0.03, + sizemod = 1.0, + texture = [[randomdots]], + }, + }, + spikes = { + air = true, + class = [[explspike]], + count = 2, + ground = true, + water = true, + properties = { + alpha = 0.6, + alphadecay = 0.08, + color = [[1.0, 0.5, 0.2]], + dir = [[-10 r20,-10 r20,-10 r20]], + length = 2, + width = 9, + }, + }, + }, + +} \ No newline at end of file diff --git a/Gamedata/explosions/scavengers/scav-effects.lua b/Gamedata/explosions/scavengers/scav-effects.lua new file mode 100644 index 000000000..b53813763 --- /dev/null +++ b/Gamedata/explosions/scavengers/scav-effects.lua @@ -0,0 +1,812 @@ +-- Effects for Scavengers + +return { + ["scavradiation"] = { + usedefaultexplosions = false, + grounddust = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + unit = false, + properties = { + airdrag = 0.96, + colormap = [[0 0 0 0.0 0.30 0.016 0.6 0.18 0.14 0.007 0.37 0.09 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 60, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.035, 0]], + numparticles = 6, + particlelife = 180, + particlelifespread = 120, + particlesize = 150, + particlesizespread = 450, + particlespeed = 6.5, + particlespeedspread = 4.5, + pos = [[-200 r900, -50 r50, -200 r900]], + sizegrowth = 0.3, + sizemod = 1, + texture = [[smoke_puff]], + alwaysvisible = true, + }, + }, + }, + ["scav_commander_explosion"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + heat = 10, + heatfalloff = 1.2, + maxheat = 14, + pos = [[r-2 r2, 10, r-2 r2]], + size = 4.8, + sizegrowth = 14, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + groundflash_small = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = false, + underwater = false, + properties = { + colormap = [[0.6 0.15 1 0.4 0 0 0 0.01]], + size = 200, + sizegrowth = -1.5, + ttl = 26, + texture = [[groundflash]], + }, + }, + groundflash_large = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = false, + underwater = false, + properties = { + colormap = [[0.6 0.15 1 0.175 0 0 0 0.01]], + size = 250, + sizegrowth = -1.5, + ttl = 26, + texture = [[groundflash]], + }, + }, + groundflash_white = { + class = [[CSimpleGroundFlash]], + count = 1, + air = true, + ground = true, + water = false, + underwater = false, + properties = { + colormap = [[0.6 0.15 1 0.77 0 0 0 0.01]], + size = 190, + sizegrowth = 0, + ttl = 7, + texture = [[groundflash]], + }, + }, + pop1 = { + class=[[explo]], + air=1, + water=1, + ground=1, + count=2, + properties ={ + alwaysVisible=1, + texture=[[explo]], + heat = 10, + maxheat = 10, + heatFalloff = 1.1, + size = 18, + sizeGrowth = 20, + pos = [[r-10 r10, 20, r-10 r10]], + speed=[[0, 0, 0]], + }, + }, + explosion = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.87, + colormap = [[0.6 0.15 1 0.11 0.5 0.12 0.9 0.08 0.35 0.05 0.66 0.033 0.27 0.03 0.55 0.011 0 0 0 0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1.1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 15, + particlelife = 2.3, + particlelifespread = 15, + particlesize = 16.5, + particlesizespread = 16, + particlespeed = 6.8, + particlespeedspread = 5.3, + pos = [[0, 2, 0]], + sizegrowth = 0.4, + sizemod = 1, + texture = [[flashside2]], + useairlos = false, + }, + }, + dustparticles = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + underwater = true, + water = true, + properties = { + airdrag = 0.88, + colormap = [[1 0.85 0.6 0.22 1 0.63 0.3 0.12 1 0.52 0.2 0.06 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0.5, 1, 0.5]], + gravity = [[0, -0.011, 0]], + numparticles = 5, + particlelife = 11.6, + particlelifespread = 4.5, + particlesize = 6.5, + particlesizespread = 1.6, + particlespeed = 4.75, + particlespeedspread = 0.8, + pos = [[0, 0, 0]], + sizegrowth = 2.2, + sizemod = 1.0, + texture = [[randomdots]], + }, + }, + innersmoke = { + class = [[CSimpleParticleSystem]], + water=0, + air=1, + ground=1, + count=1, + properties = { + airdrag=0.80, + alwaysVisible = 0, + sizeGrowth = 0.66, + sizeMod = 1, + pos = [[r-1 r2, 0, r-1 r2]], + emitRot=33, + emitRotSpread=50, + emitVector = [[0, 1, 0]], + gravity = [[0, 0.02, 0]], + colormap=[[1 0.66 0.4 0.45 0.3 0.2 0.13 0.4 0.18 0.15 0.11 0.35 0.13 0.12 0.1 0.32 0.11 0.1 0.093 0.25 0.063 0.062 0.058 0.17 0 0 0 0.01]], + Texture=[[graysmoke]], + particleLife=35, + particleLifeSpread=80, + numparticles=7, + particleSpeed=7, + particleSpeedSpread=9, + particleSize=14, + particleSizeSpread=23, + directional=0, + }, + }, + outersmoke = { + class = [[CSimpleParticleSystem]], + water=0, + air=1, + ground=1, + count=1, + properties = { + airdrag=0.7, + alwaysVisible = 0, + sizeGrowth = 0.35, + sizeMod = 1, + pos = [[r-1 r2, 0, r-1 r2]], + emitRot=33, + emitRotSpread=50, + emitVector = [[0, 1, 0]], + gravity = [[0, -0.02, 0]], + colormap=[[1 0.66 0.4 0.45 0.3 0.2 0.13 0.4 0.18 0.15 0.11 0.35 0.13 0.12 0.1 0.32 0.11 0.1 0.093 0.25 0.063 0.062 0.058 0.17 0 0 0 0.01]], + Texture=[[graysmoke]], + particleLife=25, + particleLifeSpread=60, + numparticles=4, + particleSpeed=5, + particleSpeedSpread=8, + particleSize=31, + particleSizeSpread=23, + directional=0, + }, + }, + sparks = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.85, + colormap = [[0.6 0.15 1 0.017 0.4 0.05 0.8 0.011 0 0 0 0]], + directional = true, + emitrot = 30, + emitrotspread = 40, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.05, 0]], + numparticles = 7, + particlelife = 14, + particlelifespread = 18, + particlesize = 44, + particlesizespread = 38, + particlespeed = 19.5, + particlespeedspread = 11.4, + pos = [[0, 4, 0]], + sizegrowth = 1, + sizemod = 0.78, + texture = [[gunshotxl]], + useairlos = false, + }, + }, + shockwave = { + class = [[CSpherePartSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + air = true, + properties = { + alpha = 0.6, + ttl = 11, + expansionSpeed = 12, + color = [[0.6, 0.15, 1]], + --alwaysvisible = true, + }, + }, + dirt = { + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + unit = false, + water = false, + air = false, + underwater = false, + properties = { + airdrag = 1, + colormap = [[0.04 0.03 0.01 0 0.1 0.07 0.033 0.66 0.1 0.07 0.033 0.58 0.1 0.07 0.033 0.5 0.1 0.07 0.033 0.4 0 0 0 0 ]], + directional = true, + emitrot = 15, + emitrotspread = 36, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.33, 0]], + numparticles = 9, + particlelife = 32, + particlelifespread = 7, + particlesize = 1.95, + particlesizespread = -1.4, + particlespeed = 3.3, + particlespeedspread = 3, + pos = [[0, 6, 0]], + sizegrowth = -0.01, + sizemod = 1, + texture = [[bigexplosmoke]], + useairlos = false, + }, + }, + dirt2 = { + class = [[CSimpleParticleSystem]], + count = 1, + ground = false, + unit = false, + nounit = true, + water = false, + air = false, + underwater = false, + properties = { + airdrag = 1, + colormap = [[0.04 0.03 0.01 0 0.1 0.07 0.033 0.66 0.1 0.07 0.033 0.58 0.1 0.07 0.033 0.5 0.1 0.07 0.033 0.4 0 0 0 0 ]], + directional = true, + emitrot = 1, + emitrotspread = 13, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.33, 0]], + numparticles = 5, + particlelife = 35, + particlelifespread = 8, + particlesize = 1.9, + particlesizespread = -1.4, + particlespeed = 3.6, + particlespeedspread = 3.4, + pos = [[0, 6, 0]], + sizegrowth = -0.01, + sizemod = 1, + texture = [[bigexplosmoke]], + useairlos = false, + }, + }, + shard1 = { + class = [[CSimpleParticleSystem]], + count = 1, + unit = true, + nounit = false, + underwater = false, + properties = { + airdrag = 0.93, + colormap = [[1 0.55 0.45 1 0.55 0.44 0.38 1 0.36 0.34 0.33 1 0 0 0 0.01]], + directional = true, + emitrot = 35, + emitrotspread = 30, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.3, 0]], + numparticles = [[1 r2]], + particlelife = 36, + particlelifespread = 0, + particlesize = 2.0, + particlesizespread = 2.3, + particlespeed = 2.5, + particlespeedspread = 4, + pos = [[0, 2, 0]], + sizegrowth = 0, + sizemod = 1, + texture = [[shard1]], + useairlos = false, + }, + }, + shard2 = { + class = [[CSimpleParticleSystem]], + count = 1, + unit = true, + nounit = false, + underwater = false, + properties = { + airdrag = 0.93, + colormap = [[1 0.55 0.45 1 0.55 0.44 0.38 1 0.36 0.34 0.33 1 0 0 0 0.01]], + directional = true, + emitrot = 35, + emitrotspread = 30, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.3, 0]], + numparticles = [[1 r2]], + particlelife = 36, + particlelifespread = 0, + particlesize = 2, + particlesizespread = 2.35, + particlespeed = 2.5, + particlespeedspread = 4, + pos = [[0, 2, 0]], + sizegrowth = 0, + sizemod = 1, + texture = [[shard2]], + useairlos = false, + }, + }, + shard3 = { + class = [[CSimpleParticleSystem]], + count = 1, + unit = true, + nounit = false, + underwater = false, + properties = { + airdrag = 0.93, + colormap = [[1 0.55 0.45 1 0.55 0.44 0.38 1 0.36 0.34 0.33 1 0 0 0 0.01]], + directional = true, + emitrot = 35, + emitrotspread = 30, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.3, 0]], + numparticles = [[1 r1.5]], + particlelife = 36, + particlelifespread = 0, + particlesize = 2, + particlesizespread = 2.35, + particlespeed = 2.5, + particlespeedspread = 4, + pos = [[0, 2, 0]], + sizegrowth = 0, + sizemod = 1, + texture = [[shard3]], + useairlos = false, + }, + }, + clouddust = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.92, + colormap = [[0 0 0 0.01 0.025 0.02 0.02 0.033 0.06 0.055 0.055 0.072 0.043 0.04 0.04 0.055 0.0238 0.022 0.022 0.03 0 0 0 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 4, + emitvector = [[0.5, 1, 0.5]], + gravity = [[0, 0.025, 0]], + numparticles = 2, + particlelife = 75, + particlelifespread = 120, + particlesize = 66, + particlesizespread = 44, + particlespeed = 1.2, + particlespeedspread = 2.5, + pos = [[0, 4, 0]], + sizegrowth = 0.18, + sizemod = 1.0, + texture = [[bigexplosmoke]], + }, + }, + outerflash = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + heat = 14, + heatfalloff = 1.1, + maxheat = 40, + pos = [[r-2 r2, 4, r-2 r2]], + size = 17, + sizegrowth = 1.1, + speed = [[0, 1 0, 0]], + texture = [[orangenovaexplo]], + }, + }, + }, + ["scavradiation-beacon"] = { + usedefaultexplosions = false, + grounddust = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + unit = false, + properties = { + airdrag = 0.95, + colormap = [[0 0 0 0.0 0.40 0.020 0.8 0.18 0.14 0.007 0.37 0.09 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 60, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.035, 0]], + numparticles = 3, + particlelife = 140, + particlelifespread = 100, + particlesize = 50, + particlesizespread = 125, + particlespeed = 4.5, + particlespeedspread = 3.5, + pos = [[0 r150, 100 r50, 0 r150]], + sizegrowth = 0.3, + sizemod = 1, + texture = [[smoke_puff]], + useairlos = true, + --alwaysvisible = true, + }, + }, + }, + ["scavradiation-lightning"] = { + usedefaultexplosions = false, + electricstorm = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + delay = [[10 r200]], + explosiongenerator = [[custom:lightning_storm_scav]], + pos = [[-50 r100, 20, -50 r100]], + }, + }, + electricstormxl = { + air = true, + class = [[CExpGenSpawner]], + count = 1, + ground = true, + water = false, + underwater = false, + properties = { + delay = [[50 r120]], + explosiongenerator = [[custom:lightning_stormflares_scav]], + pos = [[-50 r250, 50 r25, -50 r250]], + }, + }, + }, + ["lightning_storm_scav"] = { + groundflash = { + circlealpha = 1, + circlegrowth = 0, + flashalpha = 0.17, + flashsize = 40, + ttl = 3, + color = { + [1] = 0.66, + [2] = 0.66, + [3] = 1, + }, + alwaysvisible = true, + }, + lightningballs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + colormap = [[0 0 0 0.01 0.66 0.66 1 0.05 0.66 0.66 1 0.01 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 120, + emitvector = [[1, 1, 1]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 2, + particlelifespread = 5, + particlesize = 96, + particlesizespread = 100, + particlespeed = 0.06, + particlespeedspread = 0, + pos = [[-10 r10, 1.0, -10 r10]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[whitelightb]], + alwaysvisible = true, + }, + }, + }, + ["lightning_stormflares_scav"] = { + groundflash = { + circlealpha = 0.9, + circlegrowth = -0.05, + flashalpha = 0.80, + flashsize = 300, + ttl = 80, + color = { + [1] = 0.4, + [2] = 0.1, + [3] = 0.8, + }, + alwaysvisible = true, + }, + lightningballs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 0.92, + colormap = [[0 0 0 0.01 0.3 0.05 0.6 0.025 0.45 0.1 0.8 0.01 0.3 0.05 0.6 0.005 0 0 0 0.01]], + directional = false, + emitrot = 80, + emitrotspread = 120, + emitvector = [[1, 1, 1]], + gravity = [[0, 0.4, 0]], + numparticles = 2, + particlelife = 33, + particlelifespread = 45, + particlesize = 16, + particlesizespread = 200, + particlespeed = 0.12, + particlespeedspread = 0.32, + pos = [[-10 r25, 1.0, -10 r25]], + sizegrowth = -0.4, + sizemod = 1.0, + texture = [[flare1]], + alwaysvisible = true, + }, + }, + }, + ["scav-damage"] = { + usedefaultexplosions = false, + -- engine = { + -- air = true, + -- class = [[CBitmapMuzzleFlame]], + -- count = 1, + -- ground = true, + -- underwater = 1, + -- water = true, + -- properties = { + -- alwaysVisible = true, + -- colormap = [[1 0.7 0.4 0.01 1.0 0.6 0.2 0.01 1.0 0.4 0.1 0.01 0 0 0 0.01]], + -- dir = [[dir]], + -- frontoffset = 0, + -- fronttexture = [[none]], + -- length = [[-15 r3.5]], + -- sidetexture = [[muzzleside]], + -- size = 15.5, + -- sizegrowth = [[0.2 r0.3]], + -- ttl = 1, + -- }, + -- }, + lightningballs = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + underwater = true, + properties = { + airdrag = 1, + colormap = [[0 0 0 0.01 0.66 0.66 1 0.10 0.66 0.66 1 0.01 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 120, + emitvector = [[1, 1, 1]], + gravity = [[0, 0, 0]], + numparticles = 1, + particlelife = 3, + particlelifespread = 5, + particlesize = 13, + particlesizespread = 40, + particlespeed = 0.04, + particlespeedspread = 0, + pos = [[-10 r10, -25, -10 r10]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[whitelightb]], + }, + }, + fireglow = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 1, + colormap = [[0.9 0.15 1.0 0.5 0 0 0 0.01]], + directional = true, + emitrot = 0, + emitrotspread = 0, + emitvector = [[0.0, 0.0, 0.0]], + gravity = [[0.0, 0, 0.0]], + numparticles = 1, + particlelife = 2, + particlelifespread = 1, + particlesize = 20, + particlesizespread = 12, + particlespeed = 0, + particlespeedspread = 0, + pos = [[0.0, 0, 0.0]], + sizegrowth = -0.5, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + exhale = { + + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.8 0.15 1.0 0.3 0.6 0.06 0.8 0.2 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.2, 0]], + numparticles = 2, + particlelife = 40, + particlelifespread = 15, + particlesize = 11, + particlesizespread = 14, + particlespeed = 0.25, + particlespeedspread = 1.2, + pos = [[0, 1, 0]], + sizegrowth = -0.2, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + exhale2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + alwaysVisible = true, + airdrag = 0.87, + colormap = [[0.8 0.1 1.0 0.25 0.55 0.06 0.7 0.1 0.028 0.005 0.04 0.25 0.0 0.0 0.0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 2, + particlelife = 30, + particlelifespread = 15, + particlesize = 6, + particlesizespread = 6, + particlespeed = 0.25, + particlespeedspread = 1.9, + pos = [[0, 1, 0]], + sizegrowth = -0.07, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + smoke = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.92, + colormap = [[0.012 0.012 0.012 0.05 0.10 0.08 0.066 0.66 0.08 0.076 0.086 0.56 0.08 0.076 0.084 0.44 0.05 0.05 0.05 0.28 0.028 0.028 0.028 0.13 0.012 0.012 0.012 0.05 0 0 0 0.01]], + directional = true, + emitrot = -180, + emitrotspread = 7, + emitvector = [[dir]], + gravity = [[0.0, 0.02, 0.0]], + numparticles = [[1.5 r1]], + particlelife = 15, + particlelifespread = 40, + particlesize = 4.6, + particlesizespread = 6.2, + particlespeed = 1.5, + particlespeedspread = 2.5, + pos = [[-15 r30, -15 r30, -15 r30]], + sizegrowth = 0.32, + sizemod = 1, + texture = [[smoke]], + useairlos = true, + }, + }, + dustparticles = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + underwater = true, + water = true, + properties = { + airdrag = 0.77, + colormap = [[0.85 0.66 0.4 0.8 1 0.74 0.48 0.9 0.75 0.45 0.25 0.5 0 0 0 0.01]], + directional = true, + emitrot = 80, + emitrotspread = 15, + emitvector = [[dir]], + gravity = [[0, -0.011, 0]], + numparticles = 1, + particlelife = 9, + particlelifespread = 6, + particlesize = 4, + particlesizespread = 0.8, + particlespeed = 0.05, + particlespeedspread = 0.6, + pos = [[0, 0, 0]], + sizegrowth = 0.06, + sizemod = 1.0, + texture = [[randomdots]], + }, + }, + }, + +} \ No newline at end of file diff --git a/Gamedata/featuredefs_post.lua b/Gamedata/featuredefs_post.lua index 0afcd710d..d2617896d 100644 --- a/Gamedata/featuredefs_post.lua +++ b/Gamedata/featuredefs_post.lua @@ -19,35 +19,61 @@ local function istable(x) return (type(x) == 'table') end local function isnumber(x) return (type(x) == 'number') end local function isstring(x) return (type(x) == 'string') end local spGetModOptions = Spring.GetModOptions - -------------------------------------------------------------------------------- if spGetModOptions then for name, fd in pairs(FeatureDefs) do - if( - ( - tonumber(fd["footprintz"]) <= 8 + + if fd["footprintz"] == 0 or fd["footprintz"] == nil then + fd["footprintz"] = 1 + end + if fd["footprintx"] == 0 or fd["footprintx"] == nil then + fd["footprintx"] = 1 + end + + if fd["footprintz"] ~= nil and fd["footprintx"] ~= nil then + if tonumber(fd["footprintz"]) <= 8 or tonumber(fd["footprintx"]) <= 8 or string.lower(fd["category"]) == "vegitation" - or string.lower(fd["category"]) == "vegetation" - ) - and (not fd["name"] or string.lower(fd["name"]) ~= "ammobox") - ) then - fd["blocking"] = false - if (not fd.customparams) then - fd.customparams = {} + or string.lower(fd["category"]) == "vegetation" then + + fd["blocking"] = false + if (not fd.customparams) then + fd.customparams = {} + end + + -- if (not fd.customparams.provide_cover) then + -- fd.customparams.provide_cover = 1 + -- end end - if (not fd.customparams.provide_cover) then - fd.customparams.provide_cover = 1 --- Spring.Echo("Feature["..name.."] is providing cover!") - end end -end - -for name, fd in pairs(FeatureDefs) do - fd.metal = 0 - fd.energy = 0 + + -- Set Reclaimtime that isn't insane. Default engine reclaimtime is (m+e) * 6 which is arbitrary as all hell. + if tonumber(fd["metal"]) == nil or tonumber(fd["metal"]) == 0 then + fd.metal = 1 + end + if tonumber(fd["energy"]) == nil or tonumber(fd["energy"]) == 0 then + fd.energy = 1 + end + + local reclaimvalue = (tonumber(fd["metal"]) + tonumber(fd["energy"])) / 4 + + fd.reclaimtime = reclaimvalue + + -- Reset maximum feature values + -- if tonumber(fd["metal"]) == nil or tonumber(fd["metal"]) == 0 then + -- fd.metal = 100 + -- end + -- if tonumber(fd["metal"]) > 100 then + -- fd.metal = 100 + -- end + -- if tonumber(fd["energy"]) == nil or tonumber(fd["energy"]) == 0 then + -- fd.energy = 100 + -- end + -- if tonumber(fd["energy"]) > 1 then + -- fd.energy = 100 + -- end end diff --git a/Gamedata/icontypes.lua b/Gamedata/icontypes.lua index 1bb70aab4..c84db57cc 100644 --- a/Gamedata/icontypes.lua +++ b/Gamedata/icontypes.lua @@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- --- file: icontypes.lua +-- file: icontypes.lua -- brief: icontypes definitions -- -------------------------------------------------------------------------------- @@ -11,320 +11,399 @@ local icontypes = { default = { bitmap='icons/default.png', - size=1, - radiusadjust=3, - }, + size=1, + radiusadjust=3, + }, -- modifications by dmdr start here - - engineer = { - bitmap='icons/dmdr_engi.png', - size=3, - radiusadjust=0, - }, + + engineer = { + bitmap='icons/dmdr_engi.png', + size=3, + radiusadjust=0, + }, orb = { - bitmap='icons/dmdr_orb.png', - size=3, - radiusadjust=0, - }, - - box = { - bitmap='icons/dmdr_box.png', - size=2, - radiusadjust=0, - }, - - raider = { - bitmap='icons/dmdr_raider.png', - size=1.5, - radiusadjust=0, - }, - - krow = { - bitmap='icons/dmdr_end_krow.png', - size=3, - radiusadjust=0, - }, - - leveller = { - bitmap='icons/dmdr_end_lvlr.png', - size=3, - radiusadjust=0, - }, - - lacerator = { - bitmap='icons/dmdr_end_lacr.png', - size=3, - radiusadjust=0, - }, - - anarchid = { - bitmap='icons/dmdr_end_nrkd2.png', - size=3, - radiusadjust=0, - }, - - shield_lit = { - bitmap='icons/dmdr_shield_mobile.png', - size=2.5, - radiusadjust=0, - }, - - - riot_lit = { - bitmap='icons/dmdr_riot_lit.png', - size=2.2, - radiusadjust=0, - }, - - riot_arm = { - bitmap='icons/dmdr_riot_arm.png', - size=2.2, - radiusadjust=0, - }, - - arty_lit = { - bitmap='icons/dmdr_arty_lit.png', - size=2.2, - radiusadjust=0, - }, - - arty_arm = { - bitmap='icons/dmdr_arty_arm.png', - size=2.2, - radiusadjust=0, - }, - - td_arm_all = { - bitmap='icons/dmdr_td_ab.png', - size=2.2, - radiusadjust=0, - }, - - td_arm_lit = { - bitmap='icons/dmdr_td_al.png', - size=2.2, - radiusadjust=0, - }, - - td_arm_arm = { - bitmap='icons/dmdr_td_aa.png', - size=2.2, - radiusadjust=0, - }, - - td_lit_all = { - bitmap='icons/dmdr_td_lb.png', - size=2.2, - radiusadjust=0, - }, - - td_lit_lit = { - bitmap='icons/dmdr_td_ll.png', - size=2.2, - radiusadjust=0, - }, - - td_lit_arm = { - bitmap='icons/dmdr_td_la.png', - size=2.2, - radiusadjust=0, - }, - - mtd_lit_arm = { - bitmap='icons/dmdr_mtd_la.png', - size=2.2, - radiusadjust=0, - }, - - mtd_lit_all = { - bitmap='icons/dmdr_mtd_lb.png', - size=2.2, - radiusadjust=0, - }, - - mtd_arm_arm = { - bitmap='icons/dmdr_mtd_aa.png', - size=2.2, - radiusadjust=0, - }, - - scout = { - bitmap='icons/dmdr_air_sct.png', - size=1.5, - radiusadjust=0, - }, - - etransport = { - bitmap='icons/dmdr_tport.png', - size=2.5, - radiusadjust=0, - }, - - air_lit = { - bitmap='icons/dmdr_air_lit.png', - size=2.2, - radiusadjust=0, - }, - - air_arm = { - bitmap='icons/dmdr_air_arm.png', - size=2.2, - radiusadjust=0, - }, - - air_bomb = { - bitmap='icons/dmdr_air_bmb.png', - size=2.2, - radiusadjust=0, - }, - - drone = { - bitmap='icons/dmdr_air_all.png', - size=1, - radiusadjust=0, - }, - - turret_lit = { - bitmap='icons/defense.png', - size=2.2, - radiusadjust=0, - }, - - turret_arm = { - bitmap='icons/defense.png', - size=3, - radiusadjust=0, - }, - - turret_arty = { - bitmap='icons/trt_art.png', - size=3, - radiusadjust=0, - }, + bitmap='icons/dmdr_orb.png', + size=3, + radiusadjust=0, + }, + + box = { + bitmap='icons/dmdr_box.png', + size=2, + radiusadjust=0, + }, + + boxsmall = { + bitmap='icons/dmdr_box.png', + size=1, + radiusadjust=0, + }, + + raider = { + bitmap='icons/dmdr_raider.png', + size=1.5, + radiusadjust=0, + }, + + krow = { + bitmap='icons/dmdr_end_krow.png', + size=3, + radiusadjust=0, + }, + + leveller = { + bitmap='icons/dmdr_end_lvlr.png', + size=3, + radiusadjust=0, + }, + + lacerator = { + bitmap='icons/dmdr_end_lacr.png', + size=3, + radiusadjust=0, + }, + + anarchid = { + bitmap='icons/dmdr_end_nrkd2.png', + size=3, + radiusadjust=0, + }, + + shield_lit = { + bitmap='icons/dmdr_shield_mobile.png', + size=2.5, + radiusadjust=0, + }, + + + riot_lit = { + bitmap='icons/dmdr_riot_lit.png', + size=2.2, + radiusadjust=0, + }, + + riot_arm = { + bitmap='icons/dmdr_riot_arm.png', + size=2.2, + radiusadjust=0, + }, + + arty_lit = { + bitmap='icons/dmdr_arty_lit.png', + size=2.2, + radiusadjust=0, + }, + + arty_arm = { + bitmap='icons/dmdr_arty_arm.png', + size=2.2, + radiusadjust=0, + }, + + td_arm_all = { + bitmap='icons/dmdr_td_ab.png', + size=2.2, + radiusadjust=0, + }, + + td_arm_lit = { + bitmap='icons/dmdr_td_al.png', + size=2.2, + radiusadjust=0, + }, + + td_arm_arm = { + bitmap='icons/dmdr_td_aa.png', + size=2.2, + radiusadjust=0, + }, + + td_lit_all = { + bitmap='icons/dmdr_td_lb.png', + size=2.2, + radiusadjust=0, + }, + + td_lit_lit = { + bitmap='icons/dmdr_td_ll.png', + size=2.2, + radiusadjust=0, + }, + + td_lit_arm = { + bitmap='icons/dmdr_td_la.png', + size=2.2, + radiusadjust=0, + }, + + mtd_lit_arm = { + bitmap='icons/dmdr_mtd_la.png', + size=2.2, + radiusadjust=0, + }, + + mtd_lit_all = { + bitmap='icons/dmdr_mtd_lb.png', + size=2.2, + radiusadjust=0, + }, + + mtd_arm_arm = { + bitmap='icons/dmdr_mtd_aa.png', + size=2.2, + radiusadjust=0, + }, + + scout = { + bitmap='icons/dmdr_air_sct.png', + size=1.5, + radiusadjust=0, + }, + + etransport = { + bitmap='icons/dmdr_tport.png', + size=2.5, + radiusadjust=0, + }, + + air_lit = { + bitmap='icons/dmdr_air_lit.png', + size=2.2, + radiusadjust=0, + }, + + air_arm = { + bitmap='icons/dmdr_air_arm.png', + size=2.2, + radiusadjust=0, + }, + + air_bomb = { + bitmap='icons/dmdr_air_bmb.png', + size=2.2, + radiusadjust=0, + }, + + drone = { + bitmap='icons/dmdr_air_all.png', + size=1, + radiusadjust=0, + }, + + turret_lit = { + bitmap='icons/defense.png', + size=2.2, + radiusadjust=0, + }, + + turret_arm = { + bitmap='icons/defense.png', + size=3, + radiusadjust=0, + }, + + turret_arty = { + bitmap='icons/trt_art.png', + size=3, + radiusadjust=0, + }, - esilo = { - bitmap='icons/dmdr_nuke.png', - size=4, - radiusadjust=0, - }, + esilo = { + bitmap='icons/dmdr_nuke.png', + size=4, + radiusadjust=0, + }, - radar = { - bitmap='icons/radar.png', - size=3.5, - radiusadjust=0, - }, - - radarjam = { - bitmap='icons/radarjam.png', - size=3.5, - radiusadjust=0, - }, - - storage = { - bitmap='icons/support.png', - size=1, - radiusadjust=3, - }, - - energy = { - bitmap='icons/dmdr_tech.png', - size=3, - radiusadjust=0, - }, - - generator = { - bitmap='icons/dmdr_energy.png', - size=2, - radiusadjust=3, - }, - - baseshield = { - bitmap='icons/dmdr_buckler.png', - size=3.5, - radiusadjust=0, - }, - - nukeshield = { - bitmap='icons/dmdr_shield_nuke.png', - size=3.5, - radiusadjust=0, - }, + radar = { + bitmap='icons/radar.png', + size=1, + radiusadjust=0, + }, + + radarjam = { + bitmap='icons/radarjam.png', + size=1, + radiusadjust=0, + }, + + storage = { + bitmap='icons/support.png', + size=1, + radiusadjust=3, + }, + + energy = { + bitmap='icons/dmdr_tech.png', + size=3, + radiusadjust=0, + }, + + generator = { + bitmap='icons/dmdr_energy.png', + size=2, + radiusadjust=3, + }, + + baseshield = { + bitmap='icons/dmdr_buckler.png', + size=3.5, + radiusadjust=0, + }, + + nukeshield = { + bitmap='icons/dmdr_shield_nuke.png', + size=3.5, + radiusadjust=0, + }, -- and end here eco = { - bitmap='icons/eco.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/eco.png', + size=1, + radiusadjust=3, + }, air = { - bitmap='icons/air.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/air.png', + size=1, + radiusadjust=3, + }, factory = { - bitmap='icons/factory.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/factory.png', + size=1, + radiusadjust=3, + }, barricade = { - bitmap='icons/barricade.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/barricade.png', + size=1, + radiusadjust=3, + }, support = { - bitmap='icons/support.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/support.png', + size=1, + radiusadjust=3, + }, commander = { - bitmap='icons/commander.png', - size=3, - radiusadjust=3, - }, + bitmap='icons/commander.png', + size=1, + radiusadjust=3, + }, ORB = { - bitmap='icons/orb.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/orb.png', + size=1, + radiusadjust=3, + }, - + --------Zaals--------- + + -- land + zlightswarm = { + bitmap='icons/z/zswarm.png', + size=2.5, + radiusadjust=0 + }, + + zmedswarm = { + bitmap='icons/z/zmedswarm.png', + size=3, + radiusadjust=0 + }, + + zskirmisher = { + bitmap='icons/z/zskirmisher.png', + size=3, + radiusadjust=0 + }, + + zassault = { + bitmap='icons/z/zassault.png', + size=3.5, + radiusadjust=0 + }, + + zpyro = { + bitmap='icons/z/zpyro.png', + size=3, + radiusadjust=0 + }, + + zarty = { + bitmap='icons/z/zarty.png', + size=3.5, + radiusadjust=0 + }, + + zqueen = { + bitmap='icons/z/zqueen.png', + size=8, + radiusadjust=0 + }, + + -- air + zairscout = { + bitmap='icons/z/zairscout.png', + size=2, + radiusadjust=0 + }, + + zairtoairfighter = { + bitmap='icons/z/zairtoairfighter.png', + size=3.5, + radiusadjust=0 + }, + + zairtogroundfighter = { + bitmap='icons/z/zairtogroundfighter.png', + size=3.5, + radiusadjust=0 + }, + + zbomber = { + bitmap='icons/z/zbomber.png', + size=4, + radiusadjust=0 + }, + -- buildings + + + ---------------------- + chicken = { bitmap="icons/chicken.png", size=1.4, - }, + }, chickena = { bitmap="icons/chickena.png", size=1.6, - }, + }, chickenf = { bitmap="icons/chickenf.png", size=1.6, - }, + }, chickens = { bitmap="icons/chickens.png", size=1.5, - }, + }, chickenr = { bitmap="icons/chickenr.png", size=1.6, - }, + }, chickenq = { bitmap="icons/chickenq.png", size=3, - }, + }, chikenqueen = { bitmap='icons/dmdr_end_nrkd2.png', size=8, @@ -336,150 +415,150 @@ local icontypes = { --[[ all this stuff is redundant now, so for legibility I'm commenting it out (dmdr 271216) - tankdestroyer = { - bitmap='icons/tankdestroyer.png', - size=1, - radiusadjust=3, - }, + tankdestroyer = { + bitmap='icons/tankdestroyer.png', + size=1, + radiusadjust=3, + }, assault = { - bitmap='icons/assault.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/assault.png', + size=1, + radiusadjust=3, + }, aa = { - bitmap='icons/aa.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/aa.png', + size=1, + radiusadjust=3, + }, - etransport = { - bitmap='icons/support.png', - size=2.2, - radiusadjust=3, - }, + etransport = { + bitmap='icons/support.png', + size=2.2, + radiusadjust=3, + }, esilo = { - bitmap='icons/esilo.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/esilo.png', + size=1, + radiusadjust=3, + }, elrpc = { - bitmap='icons/elrpc.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/elrpc.png', + size=1, + radiusadjust=3, + }, hover = { - bitmap='icons/hover.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/hover.png', + size=1, + radiusadjust=3, + }, hoverraider = { - bitmap='icons/hoverraider.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/hoverraider.png', + size=1, + radiusadjust=3, + }, hovertankdestroyer = { - bitmap='icons/hovertankdestroyer.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/hovertankdestroyer.png', + size=1, + radiusadjust=3, + }, hoverassault = { - bitmap='icons/hoverassault.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/hoverassault.png', + size=1, + radiusadjust=3, + }, hoveraa = { - bitmap='icons/hoveraa.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/hoveraa.png', + size=1, + radiusadjust=3, + }, amphib = { - bitmap='icons/amphib.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/amphib.png', + size=1, + radiusadjust=3, + }, amphibraider = { - bitmap='icons/amphibraider.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/amphibraider.png', + size=1, + radiusadjust=3, + }, amphibtankdestroyer = { - bitmap='icons/amphibtankdestroyer.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/amphibtankdestroyer.png', + size=1, + radiusadjust=3, + }, amphibassault = { - bitmap='icons/amphibassault.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/amphibassault.png', + size=1, + radiusadjust=3, + }, amphibaa = { - bitmap='icons/amphibaa.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/amphibaa.png', + size=1, + radiusadjust=3, + }, allterr = { - bitmap='icons/allterr.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/allterr.png', + size=1, + radiusadjust=3, + }, allterrraider = { - bitmap='icons/raider.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/raider.png', + size=1, + radiusadjust=3, + }, allterrtankdestroyer = { - bitmap='icons/allterrtankdestroyer.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/allterrtankdestroyer.png', + size=1, + radiusadjust=3, + }, allterrassault = { - bitmap='icons/allterrassault.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/allterrassault.png', + size=1, + radiusadjust=3, + }, allterraa = { - bitmap='icons/allterraa.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/allterraa.png', + size=1, + radiusadjust=3, + }, sub = { - bitmap='icons/sub.png', - size=1, - radiusadjust=3, - }, - - defense = { - bitmap='icons/defense.png', - size=1, - radiusadjust=3, - }, - - storage = { - bitmap='icons/storage.png', - size=1, - radiusadjust=3, - }, + bitmap='icons/sub.png', + size=1, + radiusadjust=3, + }, + + defense = { + bitmap='icons/defense.png', + size=1, + radiusadjust=3, + }, + + storage = { + bitmap='icons/storage.png', + size=1, + radiusadjust=3, + }, ]]-- diff --git a/Gamedata/modrules.lua b/Gamedata/modrules.lua index a82aef793..9f1da3641 100644 --- a/Gamedata/modrules.lua +++ b/Gamedata/modrules.lua @@ -15,13 +15,13 @@ local modrules = { -- }, movement = { - allowAirPlanesToLeaveMap = false, -- defaults to true + allowAirPlanesToLeaveMap = true, -- defaults to true allowAircraftToHitGround = false, allowPushingEnemyUnits = true, -- defaults to false allowCrushingAlliedUnits = false, -- defaults to false allowUnitCollisionDamage = false, -- defaults to false allowUnitCollisionOverlap = true, -- defaults to true -- this lets units clump close together when moving, after which they are pushed apart - allowGroundUnitGravity = false, + allowGroundUnitGravity = false, }, construction = { @@ -32,12 +32,12 @@ local modrules = { reclaim = { - multiReclaim = 1, -- defaults to 0 + multiReclaim = 0, -- defaults to 0 reclaimMethod = 0, -- defaults to 1 unitMethod = 0, -- defaults to 1 unitEnergyCostFactor = 0, -- defaults to 0 - unitEfficiency = 0, -- defaults to 1 + unitEfficiency = 1, -- defaults to 1 featureEnergyCostFactor = 0, -- defaults to 0 allowEnemies = false, -- defaults to true @@ -64,8 +64,9 @@ local modrules = { requireSonarUnderWater = false, -- defaults to true los = { - losMipLevel = 3, -- defaults to 1 - airMipLevel = 4, -- defaults to 2 + losMipLevel = 1, -- defaults to 1 + airMipLevel = 1, -- defaults to 2 + radarMipLevel = 2, }, }, diff --git a/Gamedata/morph_defs.lua b/Gamedata/morph_defs.lua new file mode 100644 index 000000000..a888e8c9f --- /dev/null +++ b/Gamedata/morph_defs.lua @@ -0,0 +1,1050 @@ +--[[ Morph Definition File + +Morph parameters description +local morphDefs = { --beginig of morphDefs + unitname = { --unit being morphed + into = 'newunitname', --unit in that will morphing unit morph into + time = 12, --time required to complete morph process (in seconds) + --require = 'requnitname', --unit requnitname must be present in team for morphing to be enabled + energy = 10, --required metal for morphing process note: if you ommit M and/or E costs, morph costs the + energy = 10, --required energy for morphing process difference in costs between unitname and newunitname + xp = 0.07, --required experience for morphing process (will be deduced from unit xp after morph, default=0) + rank = 1, --required unit rank for morphing to be enabled, if ommited, morph doesn't require rank + tech = 2, --required tech level of a team for morphing to be enabled (1,2,3), if ommited, morph doesn't require tech + cmdname = 'Ascend', --if ommited will default to "Upgrade" + texture = 'MyIcon.dds', --if ommited will default to [newunitname] buildpic, textures should be in "LuaRules/Images/Morph" + text = 'Description', --if ommited will default to "Upgrade into a [newunitname]", else it's "Description" + --you may use "$$unitname" and "$$into" in 'text', both will be replaced with human readable unit names + }, +} --end of morphDefs +--]] +-------------------------------------------------------------------------------- + + +local devolution = (-1 > 0) + +local energyCost_ecommander = 100 +local timeToBuild_ecommander = energyCost_ecommander * 0.10 + +local energyCost_ecommanderhealer = 100 +local timeToBuild_ecommanderhealer = energyCost_ecommanderhealer * 0.10 + +local energyCost_ecommandercloak = 100 +local timeToBuild_ecommandercloak = energyCost_ecommandercloak * 0.10 + +local energyCost_ecommandershield = 100 +local timeToBuild_ecommandershield = energyCost_ecommandershield * 0.10 + +local energyCost_ecommanderbuild = 100 +local timeToBuild_ecommanderbuild = energyCost_ecommanderbuild * 0.10 + +local energyCost_ecommanderfactory = 100 +local timeToBuild_ecommanderfactory = energyCost_ecommanderfactory * 0.10 + +local energyCost_ecommanderbattle = 3000 +local timeToBuild_ecommanderbattle = energyCost_ecommanderbattle * 0.10 + +local energyCost_ecommandermeteor = 6000 +local timeToBuild_ecommandermeteor = energyCost_ecommandermeteor * 0.10 + +local energyCost_eradar2_up1 = 450 +local timeToBuild_eradar2_up1 = energyCost_eradar2_up1 * 0.10 + +local energyCost_factory_up1 = 600 +local timeToBuild_factory_up1 = energyCost_factory_up1 * 0.10 + +local energyCost_etech2 = 600 +local timeToBuild_etech2 = energyCost_etech2 * 0.10 + +local energyCost_etech3 = 2000 +local timeToBuild_etech3 = energyCost_etech3 * 0.10 + +local energyCost_zarmtech1 = 300 +local timeToBuild_zarmtech1 = energyCost_zarmtech1 * 0.10 + +local energyCost_zarmtech2 = 600 +local timeToBuild_zarmtech2 = energyCost_zarmtech2 * 0.10 + +local energyCost_zarmtech3 = 2000 +local timeToBuild_zarmtech3 = energyCost_zarmtech3 * 0.10 + +local energyCost_zespire4 = 200 +local timeToBuild_zespire4 = energyCost_zespire4 * 0.10 + +local energyCost_zespire5 = 200 +local timeToBuild_zespire5 = energyCost_zespire5 * 0.10 + +local energyCost_elightturret2 = 75 +local timeToBuild_elightturret2 = energyCost_elightturret2 * 0.10 + +local energyCost_eheavyturret2 = 125 +local timeToBuild_eheavyturret2 = energyCost_eheavyturret2 * 0.10 + +local energyCost_euwturret = 50 +local timeToBuild_euwturret = energyCost_euwturret * 0.10 + +local energyCost_eflakturret = 60 * 10 +local timeToBuild_eflakturret = energyCost_eflakturret / 10 + +-- energycost = time * rate +-- time = energycost / rate + +--Loz Commander Upgrades + +local energyCost_lozcommander_up1 = 60 * 10 +local timeToBuild_lozcommander_up1 = energyCost_lozcommander_up1 / 10 + +local energyCost_lozcommander_up2 = 180 * 25 +local timeToBuild_lozcommander_up2 = energyCost_lozcommander_up2 / 25 + +local energyCost_lozcommander_up3 = 300 * 50 +local timeToBuild_lozcommander_up3 = energyCost_lozcommander_up3 / 50 + +local energyCost_lozcommander_up4 = 480 * 100 +local timeToBuild_lozcommander_up4 = energyCost_lozcommander_up4 / 100 + +-- + +local energyCost_emetalextractor_up1 = 60 * 2 +local timeToBuild_emetalextractor_up1 = energyCost_emetalextractor_up1 / 2 + +local energyCost_emetalextractor_up2 = 300 * 25 +local timeToBuild_emetalextractor_up2 = energyCost_emetalextractor_up2 / 25 + +local energyCost_emetalextractor_up3 = 480 * 50 +local timeToBuild_emetalextractor_up3 = energyCost_emetalextractor_up3 / 50 + +local energyCost_zmex_up1 = 1200 +local timeToBuild_zmex_up1 = energyCost_zmex_up1 * 0.10 + +local energyCost_xmetalextractor = 1200 +local timeToBuild_xmetalextractor = energyCost_xmetalextractor * 0.10 + +local energyCost_eorb = 150 +local timeToBuild_eorb = energyCost_eorb * 0.10 + +local energyCost_eartyturret = 400 +local timeToBuild_eartyturret = energyCost_eartyturret * 0.10 + +local energyCost_ehbotturret = 0 +local timeToBuild_ehbotturret = 2 + +local energyCost_ehbot = 0 +local timeToBuild_ehbot = 10 + +local energyCost_eartytanksauration = 150 +local timeToBuild_eartytanksauration = energyCost_eartytanksauration * 0.10 + +local energyCost_kargannethturret = 0 +local timeToBuild_kargannethturret = 2 + +local energyCost_karganneth = 0 +local timeToBuild_karganneth = 10 + +local morphDefs = { + +--lozcommander + + lozcommander = { + { + into = 'lozcommander_up1', + time = timeToBuild_lozcommander_up1, + cmdname = [[Tech 1]], + energy = energyCost_lozcommander_up1, + metal = 0, + text = 'Evolve Tech 1 with upgraded weapons and armor', + }, + }, + + lozcommander_up1 = { + { + into = 'lozcommander_up2', + time = timeToBuild_lozcommander_up2, + cmdname = [[Tech 2]], + energy = energyCost_lozcommander_up2, + metal = 0, + text = 'Evolve Tech 2 with upgraded weapons and armor', + require = [[tech1]], + }, + }, + + lozcommander_up2 = { + { + into = 'lozcommander_up3', + time = timeToBuild_lozcommander_up3, + cmdname = [[Tech 3]], + energy = energyCost_lozcommander_up3, + metal = 0, + text = 'Evolve Tech 3 with upgraded weapons and armor', + require = [[tech2]], + }, + }, + + lozcommander_up3 = { + { + into = 'lozcommander_up4', + time = timeToBuild_lozcommander_up4, + cmdname = [[Tech 3 + BattleMech]], + energy = energyCost_lozcommander_up4, + metal = 0, + text = 'Evolve into a BattleMech with Devestating weapons and armor', + require = [[tech3]], + }, + }, + +-- + + + + + + ecommander = { + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer +Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + require = [[tech2]], + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + require = [[tech2]], + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + require = [[tech2]], + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower and larger build radius.', + require = [[tech2]], + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- require = [[tech2]], + -- }, + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded machinegun that does heavy damage to Light Units. No longer grants supply.', + require = [[tech2]], + }, + }, + + ecommandercloak = { + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer + Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower and larger build radius.', + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- }, + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded Beam Laser that does heavy damage to Light and Armored units. No longer grants supply.', + }, + }, + + ecommandershield = { + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer +Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower and larger build radius.', + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- }, + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded Beam Laser that does heavy damage to Light and Armored units. No longer grants supply.', + }, + }, + + ecommanderbuild = { + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer + Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- }, + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded Beam Laser that does heavy damage to Light and Armored units. No longer grants supply.', + }, + }, + + ecommanderfactory = { + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer + Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower and larger build radius.', + }, + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded Beam Laser that does heavy damage to Light and Armored units. No longer grants supply.', + }, + }, + ecommanderbattle = { + { + into = 'ecommandermeteor', + time = timeToBuild_ecommandermeteor, + cmdname = [[Meteor +Overseer]], + energy = energyCost_ecommandermeteor, + metal = 0, + text = 'Evolve into Meteor Overseer: Overseer can call down devastating meteor showers. !THIS CHANGE IS PERMANENT!', + require = [[tech3]], + }, + { + into = 'ecommanderhealer', + time = timeToBuild_ecommanderhealer, + cmdname = [[Healer +Overseer]], + energy = energyCost_ecommanderhealer, + metal = 0, + text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower.', + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- }, + }, + + ecommanderhealer = { + { + into = 'ecommanderbattle', + time = timeToBuild_ecommanderbattle, + cmdname = [[Battle +Overseer]], + energy = energyCost_ecommanderbattle, + metal = 0, + text = 'Evolve into Battle Overseer: Upgraded Beam Laser that does heavy damage to Light and Armored units. No longer grants supply.', + require = [[tech2]], + }, + { + into = 'ecommandercloak', + time = timeToBuild_ecommandercloak, + cmdname = [[Cloaking +Overseer]], + energy = energyCost_ecommandercloak, + metal = 0, + text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', + }, + { + into = 'ecommandershield', + time = timeToBuild_ecommandershield, + cmdname = [[Shield +Overseer]], + energy = energyCost_ecommandershield, + metal = 0, + text = 'Evolve into Shielded Overseer: Gains a large shield which recharges quickly.', + }, + { + into = 'ecommanderbuild', + time = timeToBuild_ecommanderbuild, + cmdname = [[Builder +Overseer]], + energy = energyCost_ecommanderbuild, + metal = 0, + text = 'Evolve into Builder Overseer: Gains 16x buildpower.', + }, + -- { + -- into = 'ecommanderfactory', + -- time = timeToBuild_ecommanderfactory, + -- cmdname = [[Factory +-- Overseer]], + -- energy = energyCost_ecommanderfactory, + -- metal = 0, + -- text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 8x buildpower.', + -- }, + }, + + +---------------------------------------------------------- +---------------------------------------------------------- +--Radar + eradar2 = { + { + into = 'eradar2_up1', + --require = 'etech2', + time = timeToBuild_eradar2_up1, + cmdname = [[Evolve to Tech2]], + energy = energyCost_eradar2_up1, + metal = 0, + text = [[Increases Radar/Sensing Range]], + require = [[tech2]], + }, + }, + +---------------------------------------------------------- +---------------------------------------------------------- +--Economy + emetalextractor = { + { + into = 'emetalextractor_up1', + --require = 'etech2', + time = timeToBuild_emetalextractor_up1, + cmdname = [[Evolve 2x Income]], + energy = energyCost_emetalextractor_up1, + metal = 0, + text = [[x2 Metal Extraction rate]], + require = [[tech1]], + }, + }, + emetalextractor_up1 = { + { + into = 'emetalextractor_up2', + --require = 'etech2', + time = timeToBuild_emetalextractor_up2, + cmdname = [[Evolve 4x Income]], + energy = energyCost_emetalextractor_up2, + metal = 0, + text = [[x4 Metal Extraction rate]], + require = [[tech2]], + }, + }, + emetalextractor_up2 = { + { + into = 'emetalextractor_up3', + --require = 'etech2', + time = timeToBuild_emetalextractor_up3, + cmdname = [[Evolve 8x Income]], + energy = energyCost_emetalextractor_up3, + metal = 0, + text = [[x8 Metal Extraction rate]], + require = [[tech3]], + }, + }, + zmex = { + { + into = 'zmex_up3', + --require = 'etech2', + time = timeToBuild_zmex_up1, + cmdname = [[Evolve 2x Income]], + energy = energyCost_zmex_up1, + metal = 0, + text = [[x2 Metal Extraction rate]], + require = [[tech2]], + }, + }, +---------------------------------------------------------- +---------------------------------------------------------- +--Factories + +---------------------------------------------------------- +---------------------------------------------------------- + + elaserbattery = { + { + into = 'eflakturret', + time = timeToBuild_eflakturret, + cmdname = [[Evolve Flak Turret]], + energy = energyCost_eflakturret, + metal = 0, + text = [[Evolve Projectile Based Flak with more Range and AOE Damage]], + require = [[tech2]], + }, + }, + + -- elightturret2 = { + -- { + -- into = 'elightturret2_up1', + -- time = timeToBuild_elightturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_elightturret2, + -- metal = 0, + -- text = [[+20% damage/hp buff, +15% faster reload]], + -- require = [[tech1]], + -- }, + -- }, + -- elightturret2_up1 = { + -- { + -- into = 'elightturret2_up2', + -- time = timeToBuild_elightturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_elightturret2, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech2]], + -- }, + -- }, + -- elightturret2_up2 = { + -- { + -- into = 'elightturret2_up3', + -- time = timeToBuild_elightturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_elightturret2, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech3]], + -- }, + -- }, + + -- eheavyturret2 = { + -- { + -- into = 'eheavyturret2_up1', + -- time = timeToBuild_eheavyturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_eheavyturret2, + -- metal = 0, + -- text = [[+20% damage/hp buff, +15% faster reload]], + -- require = [[tech1]], + -- }, + -- }, + -- eheavyturret2_up1 = { + -- { + -- into = 'eheavyturret2_up2', + -- time = timeToBuild_eheavyturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_eheavyturret2, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech2]], + -- }, + -- }, + -- eheavyturret2_up2 = { + -- { + -- into = 'eheavyturret2_up3', + -- time = timeToBuild_eheavyturret2, + -- cmdname = [[Evolve]], + -- energy = energyCost_eheavyturret2, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech3]], + -- }, + -- }, + + -- euwturret = { + -- { + -- into = 'euwturret_up1', + -- time = timeToBuild_euwturret, + -- cmdname = [[Evolve]], + -- energy = energyCost_euwturret, + -- metal = 0, + -- text = [[+20% damage/hp buff, +15% faster reload]], + -- require = [[tech1]], + -- }, + -- }, + -- euwturret_up1 = { + -- { + -- into = 'euwturret_up2', + -- time = timeToBuild_euwturret, + -- cmdname = [[Evolve]], + -- energy = energyCost_euwturret, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech2]], + -- }, + -- }, + -- euwturret_up2 = { + -- { + -- into = 'euwturret_up3', + -- time = timeToBuild_euwturret, + -- cmdname = [[Evolve]], + -- energy = energyCost_euwturret, + -- metal = 0, + -- text = [[+15% damage/hp buff, +15% faster reload]], + -- require = [[tech3]], + -- }, + -- }, + +---------------------------------------------------------- +---------------------------------------------------------- + + ehbotengineer = { + { + into = 'ehbotengineer_turret', + time = timeToBuild_ehbotturret, + cmdname = [[Deploy]], + energy = energyCost_ehbotturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, + ehbotpeewee = { + { + into = 'ehbotpeewee_turret', + time = timeToBuild_ehbotturret, + cmdname = [[Deploy]], + energy = energyCost_ehbotturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, + ehbotthud = { + { + into = 'ehbotthud_turret', + time = timeToBuild_ehbotturret, + cmdname = [[Deploy]], + energy = energyCost_ehbotturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, + ehbotsniper = { + { + into = 'ehbotsniper_turret', + time = timeToBuild_ehbotturret, + cmdname = [[Deploy]], + energy = energyCost_ehbotturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, + ehbotrocko = { + { + into = 'ehbotrocko_turret', + time = timeToBuild_ehbotturret, + cmdname = [[Deploy]], + energy = energyCost_ehbotturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, + ehbotkarganneth = { + { + into = 'ehbotkarganneth_turret', + time = timeToBuild_kargannethturret, + cmdname = [[Deploy]], + energy = energyCost_kargannethturret, + metal = 0, + text = 'Evolve into a stationary turret that gains 25% range.', + }, + }, +-- And back again + ehbotengineer_turret = { + { + into = 'ehbotengineer', + time = timeToBuild_ehbot, + cmdname = [[Retract]], + energy = energyCost_ehbot, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + ehbotpeewee_turret = { + { + into = 'ehbotpeewee', + time = timeToBuild_ehbot, + cmdname = [[Retract]], + energy = energyCost_ehbot, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + ehbotthud_turret = { + { + into = 'ehbotthud', + time = timeToBuild_ehbot, + cmdname = [[Retract]], + energy = energyCost_ehbot, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + ehbotsniper_turret = { + { + into = 'ehbotsniper', + time = timeToBuild_ehbot, + cmdname = [[Retract]], + energy = energyCost_ehbot, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + ehbotrocko_turret = { + { + into = 'ehbotrocko', + time = timeToBuild_ehbot, + cmdname = [[Retract]], + energy = energyCost_ehbot, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + ehbotkarganneth_turret = { + { + into = 'ehbotkarganneth', + time = timeToBuild_karganneth, + cmdname = [[Retract]], + energy = energyCost_karganneth, + metal = 0, + text = 'Retract to mobile state.', + }, + }, + +---------------------------------------------------------- +---------------------------------------------------------- + + etech1 = { + { + into = 'etech2', + time = timeToBuild_etech2, + cmdname = [[Tech 2 +Evolution]], + energy = energyCost_etech2, + metal = 0, + text = 'Evolve into a Tech Level 2 Facility.', + }, + }, + etech2 = { + { + into = 'etech3', + time = timeToBuild_etech3, + cmdname = [[Tech 3 +Evolution]], + energy = energyCost_etech3, + metal = 0, + text = 'Evolve into a Tech Level 3 Facility.', + }, + }, + +---------------------------------------------------------- +---------------------------------------------------------- + + zarm = { + { + into = 'zarm_up1', + time = timeToBuild_zarmtech1, + cmdname = [[Evolve Tech 1]], + energy = energyCost_zarmtech1, + metal = 0, + text = 'Evolve Tech 1', + }, + }, + zarm_up1 = { + { + into = 'zarm_up2', + time = timeToBuild_zarmtech2, + cmdname = [[Evolve Tech 2]], + energy = energyCost_zarmtech2, + metal = 0, + text = 'Evolve Tech 2', + }, + }, + zarm_up2 = { + { + into = 'zarm_up3', + time = timeToBuild_zarmtech3, + cmdname = [[Evolve Tech 3]], + energy = energyCost_zarmtech3, + metal = 0, + text = 'Evolve Tech 3', + }, + }, +---------------------------------------------------------- +---------------------------------------------------------- + + zespire1 = { + { + into = 'zespire4', + time = timeToBuild_zespire4, + cmdname = [[Evolve]], + energy = energyCost_zespire4, + metal = 0, + require = [[tech2]], + text = 'Evolve into a Budding Energy Spire.', + }, + }, + zespire4 = { + { + into = 'zespire5', + time = timeToBuild_zespire5, + cmdname = [[Evolve]], + energy = energyCost_zespire5, + metal = 0, + require = [[tech3]], + text = 'Evolve into a Mature Energy Spire.', + }, + }, + +---------------------------------------------------------- +---------------------------------------------------------- + +---------------------------------------------------------- +---------------------------------------------------------- + + eartytank = { + { + into = 'eartytank_saturation', + --require = 'etech1', + time = timeToBuild_eartytanksauration, + cmdname = [[Evolve]], + energy = energyCost_eartytanksauration, + metal = 0, + text = [[HellFury Long-Range Saturation Artillery]], + require = [[tech2]], + }, + }, + +---------------------------------------------------------- +--Shotguns +---------------------------------------------------------- + + eriottank2 = { + { + into = 'eriottank2_shotgun', + --require = 'etech1', + time = 2, + cmdname = [[Evolve + Shotgun]], + energy = 0, + metal = 0, + text = [[Shotgun]], + require = [[tech1]], + }, + }, + + eallterrriot = { + { + into = 'eallterrriot_shotgun', + --require = 'etech1', + time = 2, + cmdname = [[Evolve + Shotgun]], + energy = 0, + metal = 0, + text = [[Shotgun]], + require = [[tech1]], + }, + }, + + eamphibriot = { + { + into = 'eamphibriot_shotgun', + --require = 'etech1', + time = 2, + cmdname = [[Evolve + Shotgun]], + energy = 0, + metal = 0, + text = [[Shotgun]], + require = [[tech1]], + }, + }, +} + +-- +-- Here's an example of why active configuration +-- scripts are better then static TDF files... +-- + +-- +-- devolution, babe (useful for testing) +-- +if (devolution) then + local devoDefs = {} + for src,data in pairs(morphDefs) do + devoDefs[data.into] = { into = src, time = 10, energy = 1, energy = 1 } + end + for src,data in pairs(devoDefs) do + morphDefs[src] = data + end +end + + +return morphDefs + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/Gamedata/movedefs_classes.lua b/Gamedata/movedefs_classes.lua index ca78d2d00..6d483ccab 100644 --- a/Gamedata/movedefs_classes.lua +++ b/Gamedata/movedefs_classes.lua @@ -1,497 +1,432 @@ if Spring.GetModOptions and Spring.GetModOptions().unitheat ~= nil then - unitHeat = Spring.GetModOptions().unitheat * 0.0001 + unitHeat = Spring.GetModOptions().unitheat * 0.0042 else unitHeat = 0.0042 end +flowMappingToggle = true + +local genericDepthmodParams = { + minHeight = 0, + maxHeight = 25, + maxScale = 2, + quadraticCoeff = 0, + linearCoeff = 0, -- deprecates "depthMod" + constantCoeff = 2, +} + +local amphibDepthmodParams = { + minHeight = 0, + maxHeight = 25, + maxScale = 2, + quadraticCoeff = 0, + linearCoeff = 0, -- deprecates "depthMod" + constantCoeff = 2, +} + local moveDefs = { - TANK1 = { - footprintx=1, - footprintz=1, +--Hover-- + + HOVERTANK2 = { + footprintx=2, + footprintz=2, maxslope=30, - maxwaterdepth=5000, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, - crushstrength=0, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + crushstrength=20, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK2 = { - footprintx=2, - footprintz=2, + HOVERTANK3 = { + footprintx=3, + footprintz=3, maxslope=30, - maxwaterdepth=10, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - NORMALTANK2 = { - footprintx=2, - footprintz=2, + + HOVERTANK4 = { + footprintx=4, + footprintz=4, maxslope=30, - maxwaterdepth=10, - maxwaterslope=26, - badwaterslope=26, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK2 = { - footprintx=2, - footprintz=2, + HOVERTANK5 = { + footprintx=5, + footprintz=5, maxslope=30, - maxwaterdepth=5000, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - HOVERTANK3 = { - footprintx=3, - footprintz=3, + + HOVERTANK6 = { + footprintx=6, + footprintz=6, maxslope=30, - maxwaterdepth=10, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, + ORBHOVERTANK6 = { + footprintx=6, + footprintz=6, + maxslope=47, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + +--End Hover-- + + +--hBot-- + + HOVERHBOT2 = { + footprintx=2, + footprintz=2, + maxslope=47, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + HOVERHBOT3 = { footprintx=3, footprintz=3, - maxslope=90, - maxwaterdepth=10, + maxslope=47, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 0, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=2, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERHBOT4 = { footprintx=4, footprintz=4, - maxslope=90, - maxwaterdepth=10, + maxslope=47, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 0, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=2, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERHBOT5 = { footprintx=5, footprintz=5, - maxslope=90, - maxwaterdepth=10, + maxslope=47, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 0, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=2, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERHBOT6 = { footprintx=6, footprintz=6, - maxslope=90, - maxwaterdepth=10, + maxslope=47, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 0, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=2, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERHBOT8 = { footprintx=8, footprintz=8, - maxslope=90, - maxwaterdepth=10, + maxslope=47, + maxwaterdepth=25, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 0, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=2, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK3 = { - footprintx=3, - footprintz=3, - maxslope=30, - maxwaterdepth=5000, - maxwaterslope=255, - badwaterslope=255, +--End hBot-- + + +--All Terrain-- + + ALLTERRTANK2 = { + footprintx=2, + footprintz=2, + maxslope=47, + maxwaterdepth=30, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - + ALLTERRTANK3 = { footprintx=3, footprintz=3, - maxslope=90, + maxslope=47, maxwaterdepth=30, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK4 = { + ALLTERRTANK4 = { footprintx=4, footprintz=4, - maxslope=30, - maxwaterdepth=10, - maxwaterslope=255, - badwaterslope=255, + maxslope=47, + maxwaterdepth=30, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK4 = { - footprintx=4, - footprintz=4, - maxslope=30, - maxwaterdepth=5000, - maxwaterslope=255, - badwaterslope=255, + ALLTERRTANK5 = { + footprintx=5, + footprintz=5, + maxslope=47, + maxwaterdepth=30, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ALLTERRTANK4 = { - footprintx=4, - footprintz=4, - maxslope=90, + + ALLTERRTANK6 = { + footprintx=6, + footprintz=6, + maxslope=47, maxwaterdepth=30, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, - minwaterdepth=10, - heatmod=unitHeat, - slopemod=4, - }, - UBOAT4 = { - footprintx = 4, - footprintz = 4, - maxslope=60, - minwaterdepth = 30, - crushstrength = 20, - subMarine = 1, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK5 = { - footprintx=5, - footprintz=5, +--End All Terrain-- + + +--Amphibious-- + TANK1 = { + footprintx=1, + footprintz=1, maxslope=30, - maxwaterdepth=10, + maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + crushstrength=0, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=4, + slopemod=2, + depthMod=0, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ALLTERRTANK5 = { - footprintx=5, - footprintz=5, - maxslope=90, - maxwaterdepth=30, + NORMALTANK2 = { + footprintx=2, + footprintz=2, + maxslope=30, + maxwaterdepth=25, + maxwaterslope=26, + badwaterslope=26, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK6 = { - footprintx=6, - footprintz=6, + + TANK2 = { + footprintx=2, + footprintz=2, maxslope=30, maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=4, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK6 = { - footprintx=6, - footprintz=6, + + TANK3 = { + footprintx=3, + footprintz=3, maxslope=30, - maxwaterdepth=10, + maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=4, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ORBHOVERTANK6 = { - footprintx=6, - footprintz=6, + + TANK4 = { + footprintx=4, + footprintz=4, maxslope=30, maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=4, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ALLTERRTANK6 = { + + TANK6 = { footprintx=6, footprintz=6, - maxslope=90, - maxwaterdepth=30, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, - minwaterdepth=10, - heatmod=unitHeat, - slopemod=4, - }, - COMMANDERTANK4 = { - footprintx=4, - footprintz=4, - maxslope=90, - crushstrength=20, + maxslope=30, maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + crushstrength=20, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, - slopemod=4, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - COMMANDERTANKAI4 = { - footprintx=4, - footprintz=4, - maxslope=30, - crushstrength=20, - maxwaterdepth=10, - maxwaterslope=255, - badwaterslope=255, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + + +--End Amphibious-- + + +--UBoat-- + + UBOAT4 = { + footprintx = 4, + footprintz = 4, + maxslope=60, + minwaterdepth = 30, + crushstrength = 20, + subMarine = 1, + depthModParams = amphibDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, + +--End UBoat-- + + +--Endbringers-- + EXPERIMENTALTANK10 = { footprintx=12, footprintz=12, @@ -500,17 +435,12 @@ local moveDefs = { maxwaterslope=255, badwaterslope=255, crushstrength=100, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERTANKEXPERIMENTAL9 = { footprintx=9, @@ -518,101 +448,224 @@ local moveDefs = { maxslope=30, maxwaterdepth=30, crushstrength=100, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, EXPERIMENTALTANK12 = { footprintx=12, footprintz=12, - maxslope=90, + maxslope=47, maxwaterdepth=80, crushstrength=100, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + +--End Endbringers-- + + +--Commanders-- + + COMMANDERTANK4 = { + footprintx=4, + footprintz=4, + maxslope=47, + crushstrength=20, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + COMMANDERTANK6 = { + footprintx=6, + footprintz=6, + maxslope=47, + crushstrength=20, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + COMMANDERTANKAI4 = { + footprintx=4, + footprintz=4, + maxslope=30, + crushstrength=20, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, + depthModParams = genericDepthmodParams, minwaterdepth=10, heatmod=unitHeat, slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, + +--End Commanders-- + + +--ZAAL-- - CHICKENNANO = { - crushstrength = 0, - footprintx = 3, - footprintz = 3, - maxslope = 18, - maxwaterdepth = 0, - }, - CHICKQUEEN = { + ZAALQUEEN3 = { footprintx=3, footprintz=3, - maxwaterdepth=72, - maxslope=40, - crushstrength=15000, - avoidMobilesOnPath=false, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT1 = { + ZAALKBOT1 = { footprintx=1, footprintz=1, - maxwaterdepth=22, - maxslope=36, - crushstrength=1400, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT2 = { + ZAALKBOT2 = { footprintx=2, footprintz=2, - maxwaterdepth=22, - maxslope=36, - crushstrength=1400, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT3 = { - footprintx=3, - footprintz=3, - maxwaterdepth=22, - maxslope=36, - crushstrength=1400, + ZAALKBOT3 = { + footprintx=3, + footprintz=3, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT4 = { + ZAALKBOT4 = { footprintx=4, footprintz=4, - maxwaterdepth=22, - maxslope=36, - crushstrength=11000, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT5 = { + ZAALKBOT5 = { footprintx=5, - footprintz=5, - maxwaterdepth=22, - maxslope=36, - crushstrength=11000, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHKBOT6 = { + ZAALKBOT6 = { footprintx=6, footprintz=6, - maxwaterdepth=22, - maxslope=36, - crushstrength=11000, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + +--End ZAAL-- + +--Pattern-- + + PATTERNKBOT2 = { + footprintx=2, + footprintz=2, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - CHICKENHOVERDODO = { - footprintx = 1, - footprintz = 1, - maxslope = 30, - maxwaterslope = 255, + + PATTERNKBOT3 = { + footprintx=3, + footprintz=3, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - + } -------------------------------------------------------------------------------- diff --git a/Gamedata/scavengers/unitdef_changes.lua b/Gamedata/scavengers/unitdef_changes.lua new file mode 100644 index 000000000..5e1bb7081 --- /dev/null +++ b/Gamedata/scavengers/unitdef_changes.lua @@ -0,0 +1,924 @@ +-- (note that alldefs_post.lua is still ran afterwards if you change anything there) + +-- Special rules: +-- you only need to put the things you want changed in comparison with the regular unitdef. (use the same table structure) +-- since you cant actually remove parameters normally, it will do it when you set string: 'nil' as value +-- normally an empty table as value will be ignored when merging, but not here, it will overwrite what it had with an empty table + +customDefs = {} + + +local scavUnit = {} +for name,uDef in pairs(UnitDefs) do + scavUnit[#scavUnit+1] = name..'_scav' +end + +-- Use this commented out BAR part as example + + customDefs.ecommander = { + buildoptions = scavUnit, + workertime = 10, + repairspeed = 10, + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + customparams = { + providetech = [[tech0, tech1, tech2, tech3]], + }, + } + + customDefs.eamphibbuggybig = { + maxdamage = 2500, + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + weapondefs = { + lightbeamlaser = { + thickness = 20, + }, + }, + } + + + customDefs.eallterranarchid = { + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + } + + customDefs.eamphibleveler = { + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + } + + customDefs.ehbotkarganneth = { + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + } + + customDefs.ekrow = { + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + } + + customDefs.elacerator = { + explodeas = "mediumScavengerExplosionNuke", + selfdestructas = "mediumScavengerExplosionNuke", + } + + customDefs.eallterranarchidboss = { + explodeas = "bossScavengerExplosionNuke", + selfdestructas = "bossScavengerExplosionNuke", + } + + customDefs.eamphiblevelerboss = { + explodeas = "bossScavengerExplosionNuke", + selfdestructas = "bossScavengerExplosionNuke", + } + + customDefs.ehbotkargannethboss = { + explodeas = "bossScavengerExplosionNuke", + selfdestructas = "bossScavengerExplosionNuke", + } + + customDefs.ekrowboss = { + explodeas = "bossScavengerExplosionNuke", + selfdestructas = "bossScavengerExplosionNuke", + } + + customDefs.elaceratorboss = { + explodeas = "bossScavengerExplosionNuke", + selfdestructas = "bossScavengerExplosionNuke", + } + + + + + + + + + +-- Scav Commanders + +-- customDefs.corcom = { + -- autoheal = 15, + -- buildoptions = scavUnit, + -- builddistance = 1000, + -- cloakcost = 50, + -- cloakcostmoving = 100, + -- collisionvolumescales = "64 52 64", + -- explodeas = "bantha", + -- footprintx = 4, + -- footprintz = 4, + -- hidedamage = true, + -- idleautoheal = 20, + -- maxdamage = 4500, + -- maxvelocity = 2, + -- mincloakdistance = 20, + -- movementclass = "SCAVCOMMANDERKBOT", + -- showplayername = false, + -- stealth = false, + -- workertime = 1000, -- can get multiplied in unitdef_post + -- customparams = { + -- iscommander = 'nil', -- since you cant actually remove parameters normally, it will do it when you set string: 'nil' as value + -- }, + -- featuredefs = { + -- dead = { + -- resurrectable = 0, + -- metal = 1500, + -- }, + -- heap = { + -- resurrectable = 0, + -- metal = 750, + -- }, + -- }, + -- weapondefs = { + -- disintegrator = { + -- commandfire = false, + -- reloadtime = 10, + -- weaponvelocity = 350, + -- damage = { + -- default = 2250, + -- commanders = 225, + -- }, + -- }, + -- }, + -- -- Extra Shield + -- -- weapons = { + -- -- [4] = { + -- -- def = "REPULSOR1", + -- -- }, + -- -- }, +-- } + +-- customDefs.armcom = { + -- autoheal = 15, + -- buildoptions = scavUnit, + -- builddistance = 1000, + -- cloakcost = 50, + -- cloakcostmoving = 100, + -- collisionvolumescales = "64 52 64", + -- explodeas = "bantha", + -- footprintx = 4, + -- footprintz = 4, + -- hidedamage = true, + -- idleautoheal = 20, + -- maxdamage = 4500, + -- maxvelocity = 2, + -- mincloakdistance = 20, + -- movementclass = "SCAVCOMMANDERKBOT", + -- showplayername = false, + -- stealth = false, + -- workertime = 900, -- can get multiplied in unitdef_post + -- customparams = { + -- iscommander = 'nil', -- since you cant actually remove parameters normally, it will do it when you set string: 'nil' as value + -- }, + -- featuredefs = { + -- dead = { + -- resurrectable = 0, + -- metal = 1500, + -- }, + -- heap = { + -- resurrectable = 0, + -- metal = 750, + -- }, + -- }, + -- weapondefs = { + -- disintegrator = { + -- commandfire = false, + -- reloadtime = 10, + -- weaponvelocity = 350, + -- damage = { + -- default = 2250, + -- commanders = 225, + -- }, + -- }, + -- }, + -- -- Extra Shield + -- --weapons = { + -- -- [4] = { + -- -- def = "REPULSOR1", + -- -- }, + -- -- }, +-- } + +-- -- M/E storages T1 give rewarding amounts of metal / energy for reclaim + +-- customDefs.armmstor = { + -- explodeas = "decoycommander", + -- --buildcostmetal = 1500, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "3000 Metal Lootbox", + -- damage = 3000, + -- metal = 3000, --50% reduction for being scav? + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "1500 Metal Lootbox (Damaged)", + -- damage = 1500, + -- metal = 1500, --50% reduction for being scav? + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + +-- customDefs.armestor = { + -- explodeas = "decoycommander", + -- --buildcostenergy = 3000, + -- featuredefs = { + -- dead = { + -- category = "corpses", + -- collisionvolumescales = "26 26 26", + -- description = "6000 Energy Lootbox", + -- damage = 3000, + -- energy = 6000, --50% reduction for being scav? + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- -- customparams = { + -- -- normaltex = "unittextures/Core_normal.dds", + -- -- }, + -- }, + -- heap = { + -- category = "corpses", + -- collisionvolumescales = "26 26 26", + -- description = "3000 Energy Lootbox Damaged", + -- damage = 1500, + -- energy = 3000, --50% reduction for being scav? + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- -- customparams = { + -- -- normaltex = "unittextures/Core_normal.dds", + -- -- }, + -- }, + -- }, +-- } + +-- customDefs.cormstor = { + -- explodeas = "decoycommander", + -- --buildcostmetal = 1500, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "3000 Metal Lootbox", + -- damage = 3000, + -- metal = 3000, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "1500 Metal Lootbox Damaged", + -- damage = 1500, + -- metal = 1500, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + +-- customDefs.corestor = { + -- explodeas = "decoycommander", + -- --buildcostenergy = 3000, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "6000 Energy Lootbox", + -- damage = 3000, + -- energy = 6000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "3000 Energy Lootbox Damaged", + -- damage = 1500, + -- energy = 3000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- }, + -- }, +-- } + +-- -- M/E storages T2 give rewarding amounts of metal / energy for reclaim + +-- customDefs.armuwadvms = { + -- explodeas = "decoycommander", + -- --buildcostmetal = 5000, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "Big 10000 Metal Lootbox", + -- damage = 4500, + -- metal = 10000, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "Big 5000 Metal Lootbox Damaged", + -- damage = 2250, + -- metal = 5000, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + +-- customDefs.armuwadves = { + -- explodeas = "decoycommander", + -- --buildcostenergy = 20000, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "Big 10000 Energy Lootbox", + -- damage = 4500, + -- energy = 10000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "Big 5000 Energy Lootbox Damaged", + -- damage = 2250, + -- energy = 5000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + +-- customDefs.coruwadvms = { + -- explodeas = "decoycommander", + -- --buildcostmetal = 5000, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "Big 10000 Metal Lootbox", + -- damage = 4500, + -- metal = 10000, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "Big 5000 Metal Lootbox Damaged", + -- damage = 2250, + -- metal = 5000, --50% reduction for being scav + -- energy = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + +-- customDefs.coruwadves = { + -- explodeas = "decoycommander", + -- --buildcostenergy = 20000, + -- featuredefs = { + -- dead = { + -- category = "loot", + -- description = "Big 10000 Energy Lootbox", + -- damage = 4500, + -- energy = 10000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- heap = { + -- category = "loot", + -- description = "Big 5000 Energy Lootbox Damaged", + -- damage = 2250, + -- energy = 5000, --50% reduction for being scav + -- metal = 0, + -- object = "scavs/scavcrate.s3o", + -- resurrectable = 0, + -- smokeTime = 0, + -- }, + -- }, +-- } + + +-- ----CUSTOM UNITS--- + +-- -- Bladewing do damage instead of paralyzer +-- customDefs.corbw = { + -- weapondefs = { + -- bladewing_lyzer = { + -- paralyzer = false, + -- reloadtime = 0.1, + -- damage = { + -- default = 3, + -- }, + -- }, + -- }, +-- } + +-- -- Faster rockets with Accel - Lower DMG - higher pitched sound +-- customDefs.corstorm = { + -- weapondefs = { + -- core_kbot_rocket = { + -- soundstart = "rocklit1scav", + -- startvelocity = 64, + -- weaponacceleration = 480, + -- weaponvelocity = 380, + -- damage = { + -- default = 105, + -- subs = 5, + -- }, + -- }, + -- }, +-- } + +-- -- Faster rockets with Accel - Lower DMG - higher pitched sound +-- customDefs.armrock = { + -- weapondefs = { + -- arm_kbot_rocket = { + -- soundstart = "rocklit1scav", + -- startvelocity = 64, + -- weaponacceleration = 480, + -- weaponvelocity = 380, + -- damage = { + -- default = 105, + -- subs = 5, + -- }, + -- }, + -- }, +-- } + +-- -- Rapid Fire AK + Cloak +-- customDefs.corak = { + -- cloakcost = 3, + -- mincloakdistance = 144, + -- maxvelocity = 3, + -- weapondefs = { + -- gator_laser = { + -- beamtime = 0.13, + -- beamttl = 0, + -- reloadtime = 0.2, + -- soundstart = "lasrlit3scav", + -- damage = { + -- bombers = 1.6, + -- default = 20, + -- fighters = 1.6, + -- subs = 0.4, + -- vtol = 1.6, + -- }, + -- }, + -- }, +-- } + +-- -- Heavy Slow Fire Warrior + Cloak +-- customDefs.armwar = { + -- cloakcost = 3, + -- mincloakdistance = 144, + -- script = "scavs/ARMWARSCAV.cob", + -- weapondefs = { + -- armwar_laser = { + -- beamtime = 0.23, + -- energypershot = 60, + -- laserflaresize = 9.2, + -- reloadtime = 1.2, + -- soundstart = "lasrfir4scav", + -- targetborder = 0.2, + -- thickness = 2.5, + -- damage = { + -- bombers = 36, + -- default = 242, + -- fighters = 36, + -- subs = 48, + -- vtol = 36, + -- }, + -- }, + -- }, +-- } + +-- -- Cloaked Radar + +-- customDefs.armrad = { + -- cloakcost = 6, + -- mincloakdistance = 144, +-- } + +-- customDefs.armarad = { + -- cloakcost = 12, + -- mincloakdistance = 144, +-- } + +-- customDefs.corrad = { + -- cloakcost = 6, + -- mincloakdistance = 144, +-- } + +-- customDefs.corarad = { + -- cloakcost = 12, + -- mincloakdistance = 144, +-- } + + +-- -- Cloaked Jammers + +-- customDefs.armjamt = { + -- cloakcost = 10, + -- mincloakdistance = 144, +-- -- radardistancejam = 700, + -- sightdistance = 250, +-- } + +-- customDefs.armveil = { + -- cloakcost = 25, + -- mincloakdistance = 288, +-- -- radardistancejam = 900, + -- sightdistance = 310, +-- } + +-- customDefs.corjamt = { + -- cloakcost = 10, + -- mincloakdistance = 144, +-- -- radardistancejam = 700, + -- sightdistance = 250, +-- } + +-- customDefs.corshroud = { + -- cloakcost = 25, + -- mincloakdistance = 288, +-- -- radardistancejam = 900, + -- sightdistance = 310, +-- } + +-- -- Cloaked Constructors + +-- customDefs.correcl = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armrecl = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corck = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corcv = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.cormuskrat = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corack = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.coracv = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corca = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.coraca = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armck = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armcv = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armbeaver = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armack = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armacv = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armca = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armaca = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- -- Cloaked Radar/Jammer Units + +-- customDefs.armaser = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armmark = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armjam = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armseer = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corspec = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corvoyr = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.coreter = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corvrad = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + + +-- -- Cloaked Combat Units + +-- customDefs.corcrash = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.coraak = { + -- cloakcost = 6, + -- mincloakdistance = 144, +-- } + +-- customDefs.armjeth = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armaak = { + -- cloakcost = 6, + -- mincloakdistance = 144, +-- } + +-- customDefs.corgator = { + -- cloakcost = 6, + -- mincloakdistance = 144, +-- } + +-- customDefs.cortermite = { + -- cloakcost = 12, + -- mincloakdistance = 144, +-- } + +-- customDefs.cormando = { + -- cloakcost = 12, + -- mincloakdistance = 144, +-- } + +-- customDefs.corhrk = { + -- cloakcost = 12, + -- mincloakdistance = 160, +-- } + +-- customDefs.armzeus = { + -- cloakcost = 12, + -- mincloakdistance = 144, +-- } + +-- customDefs.corroach = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.armvader = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- -- Cloaked + Stealh Units + +-- customDefs.corkarg = { + -- cloakcost = 24, + -- stealth = true, + -- mincloakdistance = 144, +-- } + +-- customDefs.corroach = { + -- cloakcost = 3, + -- mincloakdistance = 144, +-- } + +-- customDefs.corsktl = { + -- cloakcost = 6, + -- stealth = true, + -- mincloakdistance = 144, +-- } + +-- -- Cloaked Defenses + +-- -- Faster LLT - unique sound - shorter beamtime +-- customDefs.corllt = { + -- cloakcost = 6, + -- mincloakdistance = 144, + -- weapondefs = { + -- core_lightlaser = { + -- beamtime = 0.08, + -- energypershot = 10, + -- reloadtime = 0.36, + -- soundstart = "lasrfir3scav", + -- damage = { + -- bombers = 3.75, + -- default = 105, + -- fighters = 3.75, + -- subs = 1.5, + -- vtol = 3.75, + -- }, + -- }, + -- }, +-- } + +-- -- Custom HLLT - low laser = faster - high laser is slower - unique sounds +-- customDefs.corhllt = { + -- cloakcost = 9, + -- mincloakdistance = 144, + -- weapondefs = { + -- hllt_bottom = { + -- beamtime = 0.07, + -- energypershot = 7.5, + -- reloadtime = 0.24, + -- soundstart = "lasrfir3scav", + -- damage = { + -- bombers = 2.5, + -- default = 70, + -- fighters = 2.5, + -- subs = 1, + -- vtol = 2.5, + -- }, + -- }, + -- hllt_top = { + -- beamtime = 0.28, + -- energypershot = 30, + -- reloadtime = 1.92, + -- soundstart = "lasrfir4scav", + -- thickness = 3, + -- damage = { + -- bombers = 20, + -- commanders = 400, + -- default = 300, + -- fighters = 20, + -- subs = 12, + -- vtol = 20, + -- }, + -- }, + -- }, + -- } + +-- customDefs.corhlt = { + -- cloakcost = 18, + -- mincloakdistance = 288, +-- } + +-- customDefs.armhlt = { + -- cloakcost = 18, + -- mincloakdistance = 288, +-- } + +-- -- Faster LLT - unique sound - shorter beamtime +-- customDefs.armllt = { + -- cloakcost = 6, + -- mincloakdistance = 144, + -- weapondefs = { + -- arm_lightlaser = { + -- beamtime = 0.08, + -- energypershot = 10, + -- reloadtime = 0.36, + -- soundstart = "lasrfir3scav", + -- damage = { + -- bombers = 3.75, + -- default = 105, + -- fighters = 3.75, + -- subs = 1.5, + -- vtol = 3.75, + -- }, + -- }, + + -- }, +-- } + +-- --Custom Nanoturrets - 25% more range +-- customDefs.armnanotc = { + -- cloakcost = 6, + -- mincloakdistance = 144, + -- builddistance = 500, +-- } + +-- customDefs.cornanotc = { + -- cloakcost = 6, + -- mincloakdistance = 144, + -- builddistance = 500, +-- } + +-- customDefs.corsilo = { + -- cloakcost = 100, + -- mincloakdistance = 144, +-- } + +-- customDefs.armsilo = { + -- cloakcost = 100, + -- mincloakdistance = 144, +-- } + +-- -- customDefs.armbeamer = { +-- -- cloakcost = 6, +-- -- mincloakdistance = 144, +-- -- } + +-- customDefs.corvipe = { + -- cloakcost = 20, + -- mincloakdistance = 288, +-- } + +-- customDefs.cortoast = { + -- cloakcost = 20, + -- mincloakdistance = 288, +-- } + +-- customDefs.corint = { + -- cloakcost = 75, + -- mincloakdistance = 432, +-- } + +-- customDefs.cordoom = { + -- cloakcost = 50, + -- mincloakdistance = 432, +-- } + +-- customDefs.armrectr = { + -- workertime = 400, -- can get multiplied in unitdef_post +-- } + +-- customDefs.cornecro = { + -- workertime = 400, -- can get multiplied in unitdef_post +-- } diff --git a/Gamedata/scavengers/unitdef_post.lua b/Gamedata/scavengers/unitdef_post.lua new file mode 100644 index 000000000..800a32600 --- /dev/null +++ b/Gamedata/scavengers/unitdef_post.lua @@ -0,0 +1,173 @@ +-- this file gets included in alldefs_post.lua + +local scavUnit = {} +for name,uDef in pairs(UnitDefs) do + scavUnit[#scavUnit+1] = name..'_scav' +end + +local rana = math.random(3,1000) +local ranb = math.random(2,a) +local ranc = math.random(1,b) + + + +function scav_Udef_Post(name, uDef) + if not uDef.customparams then + uDef.customparams = {} + end + + if not uDef.customParams then + uDef.customParams = {} + end + ----------------- EVO stuff + + if uDef.customParams then + --uDef.customParams.ProvideTech = [[tech0, tech1, tech2, tech3]] + uDef.customparams.supply_granted = 1 + uDef.customparams.supply_cost = 0 + end + ----------------- End of EVO stuff + + + + -- add unit category + uDef.category = uDef.category..' SCAVENGER' + + -- add model vertex displacement + + --local udefVertDisp = uDef.customparams.vertdisp1 or 0 + --uDef.customparams.vertdisp = 2.0 * udefVertDisp + uDef.customparams.healthlookmod = 0.40 + + -- make barrelshot purple + + if uDef.sfxtypes then + -- make barrelshot purple + -- if uDef.sfxtypes.explosiongenerators then + -- for k,v in pairs(uDef.sfxtypes.explosiongenerators) do + -- if string.find(v, 'barrelshot') then + -- uDef.sfxtypes.explosiongenerators[k] = v..'-purple' + -- end + -- end + -- end + -- make deathcegs purple + -- if uDef.sfxtypes.pieceexplosiongenerators then + -- for k,v in pairs(uDef.sfxtypes.pieceexplosiongenerators) do + -- if string.find(v, 'deathceg') then + -- uDef.sfxtypes.pieceexplosiongenerators[k] = v..'-purple' + -- end + -- end + -- end + end + -- make unit explosion purple + if uDef.explodeas and uDef.explodeas ~= "bossScavengerExplosionNuke" and uDef.explodeas ~= "mediumScavengerExplosionNuke" then + uDef.explodeas = "mediumScavengerExplosionGeneric" + end + if uDef.selfdestructas and uDef.selfdestructas ~= "bossScavengerExplosionNuke" and uDef.selfdestructas ~= "mediumScavengerExplosionNuke" then + uDef.selfdestructas = "mediumScavengerExplosionGeneric" + end + + -- replace buillists with _scav units + if uDef.buildoptions then + for k, v in pairs(uDef.buildoptions) do + if UnitDefs[v..'_scav'] then + uDef.buildoptions[k] = v..'_scav' + end + end + end + + -- add Scavenger name prefix to wrecks + if uDef.featuredefs then + if uDef.featuredefs.dead then + if uDef.featuredefs.dead.description then + uDef.featuredefs.dead.description = "Scavenger "..uDef.featuredefs.dead.description + end + -- if uDef.featuredefs.dead.metal then + -- uDef.featuredefs.dead.metal = math.ceil(uDef.featuredefs.dead.metal*0.5) + -- end + end + if uDef.featuredefs.heap then + if uDef.featuredefs.heap.description then + uDef.featuredefs.heap.description = "Scavenger "..uDef.featuredefs.heap.description + end + -- if uDef.featuredefs.heap.metal then + -- uDef.featuredefs.heap.metal = math.ceil(uDef.featuredefs.heap.metal*0.5) + -- end + end + end + + -- add Scavenger name prefix to units + if uDef.name then + uDef.name = "Scavenger "..uDef.name + end + + + + if uDef.buildcostenergy then + uDef.buildcostenergy = math.ceil(uDef.buildcostenergy*2) + end + + if uDef.buildcostmetal then + uDef.buildcostmetal = math.ceil(uDef.buildcostmetal*2) + end + + if uDef.energymake then + uDef.energymake = math.ceil(uDef.energymake*2) + end + + if uDef.metalmake then + uDef.metalmake = math.ceil(uDef.metalmake*2) + end + + if uDef.maxdamage then + uDef.maxdamage = math.ceil(uDef.maxdamage*1) + end + + if uDef.maxvelocity then + uDef.maxvelocity = uDef.maxvelocity*0.5 + end + + if uDef.maxreversevelocity then + uDef.maxreversevelocity = uDef.maxreversevelocity*0.1 + end + + if uDef.sightdistance then + uDef.sightdistance = math.ceil(uDef.sightdistance*1.5) + end + + if uDef.radardistancejam then + uDef.radardistancejam = math.ceil(uDef.radardistancejam*1.5) + end + + if uDef.maxdamage then + uDef.autoheal = math.ceil(math.sqrt(uDef.maxdamage/60)) + uDef.idleautoheal = math.ceil(math.sqrt(uDef.maxdamage/60)) + else + uDef.autoheal = 3 + uDef.idleautoheal = 3 + end + + if uDef.turnrate then + uDef.turnrate = uDef.turnrate*0.1 + end + + if uDef.turninplaceanglelimit then + uDef.turninplaceanglelimit = 360 + end + + -- don't let players get scav constructors + if uDef.buildoptions then + uDef.capturable = false + if uDef.featuredefs then + if uDef.featuredefs.dead then + uDef.featuredefs.dead.resurrectable = 0 + end + if uDef.featuredefs.heap then + uDef.featuredefs.heap.resurrectable = 0 + end + end + end + + return uDef + +end diff --git a/Gamedata/scavengers/weapondef_post.lua b/Gamedata/scavengers/weapondef_post.lua new file mode 100644 index 000000000..60444f7b4 --- /dev/null +++ b/Gamedata/scavengers/weapondef_post.lua @@ -0,0 +1,60 @@ +-- this file gets included in alldefs_post.lua +function convertToPurple(value) + value = string.gsub(value, '-red', '-purple') + value = string.gsub(value, '-green', '-purple') + value = string.gsub(value, '-blue', '-purple') + value = string.gsub(value, '-yellow', '-purple') + return value +end + +local function split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + return results +end + +function scav_Wdef_Post(name, wDef) + if wDef.weapontype == "Cannon" then + --Spring.Echo(wDef.name,wDef.weapontype) + wDef.rgbcolor = {0.96, 0.42, 1} + if wDef.explosiongenerator then + --wDef.explosiongenerator = "custom:genericscavengershellexplosion-medium-purple" + end + if wDef.cegtag then + wDef.cegtag = "scavengercegtag" + end + elseif wDef.weapontype == "MissileLauncher" or wDef.weapontype == "StarburstLauncher" then + if wDef.explosiongenerator then + --wDef.explosiongenerator = "custom:genericscavengershellexplosion-medium-purple" + end + if wDef.cegtag then + wDef.cegtag = "scavengercegtag" + end + elseif wDef.weapontype == "LightningCannon" then + wDef.rgbcolor = {0.95, 0.32, 1} + wDef.customparams.expl_light_color = {0.95, 0.32, 1} + wDef.customparams.light_color = {0.95, 0.32, 1} + --wDef.rgbcolor = {0.95, 0.0, 1} Damgam Candy mode + --wDef.customparams.expl_light_color = {0.95, 0.0, 1} Damgam Candy mode + --wDef.customparams.light_color = {0.95, 0.0, 1} Damgam Candy mode + --wDef.explosiongenerator = "custom:genericscavengershellexplosion-medium-lightning" + elseif wDef.weapontype == "BeamLaser" or wDef.weapontype == "LaserCannon" or wDef.weapontype == "DGun" then + wDef.rgbcolor = {0.95, 0.32, 1} + --wDef.rgbcolor = {0.95, 0.0, 1} Damgam Candy mode + wDef.rgbcolor2 = {1, 0.8, 1} + end + -- make lighting purple (sort of: by switching around the rgb values) + if wDef.customparams then + for k, v in pairs(wDef.customparams) do + if type(v) == 'string' and string.find(k, 'light_color') then + local colors = split(v, ' ') + if colors[1] and colors[3] and colors[1] == '1' then + wDef.customparams[k] = colors[2]..' '..colors[3]..' '..colors[1] + end + end + end + end + return wDef +end diff --git a/Gamedata/sidedata.lua b/Gamedata/sidedata.lua index 43a0728f6..e4d29534e 100644 --- a/Gamedata/sidedata.lua +++ b/Gamedata/sidedata.lua @@ -1,8 +1,49 @@ local sideData = { + -- [1] = { + -- name = 'Ateran', + -- startunit = 'ecommander', + -- startunitai = 'ecommanderai', + -- uiSets = { + -- Main = {0.40, 0.20, 0.70, 1}, + -- Trim = {1.00, 0.80, 0.00, 1}, + -- Rank = {1.00, 0.90, 0.50, 1}, + -- }, + -- }, + -- [2] = { + -- name = 'Zaal', + -- startunit = 'zarm', + -- startunitai = 'zarm', + -- uiSets = { + -- Main = {0.40, 0.20, 0.70, 1}, + -- Trim = {1.00, 0.80, 0.00, 1}, + -- Rank = {1.00, 0.90, 0.50, 1}, + -- }, + -- }, + -- [3] = { + -- name = 'Pattern', + -- startunit = 'xcommander', + -- startunitai = 'xcommander', + -- uiSets = { + -- Main = {0.40, 0.20, 0.70, 1}, + -- Trim = {1.00, 0.80, 0.00, 1}, + -- Rank = {1.00, 0.90, 0.50, 1}, + -- }, + -- }, + [1] = { - name = 'Outer_Colonies', - startunit = 'ecommander', - startunitai = 'ecommanderai', + name = 'Federation of Kala', + startunit = 'fedcommander', + startunitai = 'fedcommanderai', + uiSets = { + Main = {0.40, 0.20, 0.70, 1}, + Trim = {1.00, 0.80, 0.00, 1}, + Rank = {1.00, 0.90, 0.50, 1}, + }, + }, + [2] = { + name = 'Loz Alliance', + startunit = 'fedcommander', + startunitai = 'fedcommanderai', uiSets = { Main = {0.40, 0.20, 0.70, 1}, Trim = {1.00, 0.80, 0.00, 1}, diff --git a/Gamedata/sounds.lua b/Gamedata/sounds.lua index 0f71612ee..9a3f5ba0f 100644 --- a/Gamedata/sounds.lua +++ b/Gamedata/sounds.lua @@ -13,6 +13,26 @@ local Sounds = { in3d = true, maxconcurrent = 1, }, + buildmechanical = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/miscfx/buildstart-mechanical.wav", + --gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 1, + }, + buildmechanical1 = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/miscfx/buildstart-nano.wav", + --gainmod = 0.35, + --pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 1, + }, airraider = { --- new since 89.0 @@ -88,6 +108,15 @@ local Sounds = { gainmod = 0, pitchmod = 0, }, + + dothis = { + --- always play on the front speaker(s) + file = "sounds/acknowledgements/dothis.wav", + in3d = true, + maxconcurrent = 1, + gainmod = 0, + pitchmod = 0, + }, IncomingChat = { --- always play on the front speaker(s) @@ -96,6 +125,10 @@ local Sounds = { maxconcurrent = 1, }, +--------------------------------------------------- +--Unit Selections---------------------------------- +--------------------------------------------------- + UnitSelect = { --- always play on the front speaker(s) file = "sounds/miscfx/unitselect.wav", @@ -103,6 +136,22 @@ local Sounds = { maxconcurrent = 1, }, + EngineIdle = { + --- always play on the front speaker(s) + file = "sounds/unitselections/engineidle.wav", + in3d = true, + maxconcurrent = 1, + }, + + + + BugSelect = { + --- always play on the front speaker(s) + file = "sounds/ui/zaal/bugselect.wav", + in3d = true, + maxconcurrent = 1, + }, + MultiSelect = { --- always play on the front speaker(s) file = "sounds/ui/button9.wav", @@ -162,7 +211,7 @@ local Sounds = { maxconcurrent = 1, }, - turret = { + healing = { --- always play on the front speaker(s) file = "sounds/miscfx/heal.wav", in3d = "true", @@ -225,50 +274,65 @@ local Sounds = { }, } -local files = VFS.DirList("sounds/deathsounds/generic/") -local t = Sounds.SoundItems -for i=1,#files do - local fileName = files[i] - t[fileName] = { - file = fileName; - pitchmod = 0.3; - --gainmod = 0.2; - maxconcurrent = 16; - rolloff = 2, - dopplerscale = 2, - in3d = true, - } -end +-- local files = VFS.DirList("sounds/deathsounds/generic/") +-- local t = Sounds.SoundItems +-- for i=1,#files do + -- local fileName = files[i] + -- t[fileName] = { + -- file = fileName; + -- pitchmod = 0.3; + ----gainmod = 0.2; + -- maxconcurrent = 16; + -- rolloff = 2, + -- dopplerscale = 2, + -- in3d = true, + -- } +-- end -local files = VFS.DirList("sounds/deathsounds/nuke/") -local t = Sounds.SoundItems -for i=1,#files do - local fileName = files[i] - t[fileName] = { - file = fileName; - pitchmod = 0.3; - --gainmod = 0.2; - maxconcurrent = 16; - rolloff = 2, - dopplerscale = 2, - in3d = true, - } -end +-- local files = VFS.DirList("sounds/explosions/") +-- local t = Sounds.SoundItems +-- for i=1,#files do + -- local fileName = files[i] + -- t[fileName] = { + -- file = fileName; + -- pitchmod = 0.3; + ----gainmod = 0.2; + -- maxconcurrent = 16; + -- rolloff = 2, + -- dopplerscale = 2, + -- in3d = true, + -- } +-- end -local files = VFS.DirList("sounds/weapons/") -local t = Sounds.SoundItems -for i=1,#files do - local fileName = files[i] - t[fileName] = { - file = fileName; - pitchmod = 0.2; - --gainmod = 0.2; - maxconcurrent = 32; - rolloff = 2, - dopplerscale = 1.5, - in3d = true, - } -end +-- local files = VFS.DirList("sounds/deathsounds/nuke/") +-- local t = Sounds.SoundItems +-- for i=1,#files do + -- local fileName = files[i] + -- t[fileName] = { + -- file = fileName; + -- pitchmod = 0.3; + ----gainmod = 0.2; + -- maxconcurrent = 16; + -- rolloff = 2, + -- dopplerscale = 2, + -- in3d = true, + -- } +-- end + +-- local files = VFS.DirList("sounds/weapons/") +-- local t = Sounds.SoundItems +-- for i=1,#files do + -- local fileName = files[i] + -- t[fileName] = { + -- file = fileName; + -- pitchmod = 0.2; + ----gainmod = 0.2; + -- maxconcurrent = 16; + -- rolloff = 2, + -- dopplerscale = 1.5, + -- in3d = true, + -- } +-- end local files = VFS.DirList("sounds/selfdcountdown/") local t = Sounds.SoundItems diff --git a/Gamedata/taptools.lua b/Gamedata/taptools.lua new file mode 100644 index 000000000..a89b06333 --- /dev/null +++ b/Gamedata/taptools.lua @@ -0,0 +1,688 @@ +--============================== +--== TAPrime HELPER FUNCTIONS == +--============================== +--shard_include("luarules/gadgets/ai/ba/commonfunctions.lua") -- doesn' work here +VFS.Include("LuaRules/colors.h.lua") + +local spFindUnitCmdDesc = Spring.FindUnitCmdDesc +local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc +local spEditUnitCmdDesc = Spring.EditUnitCmdDesc +local spGetUnitPosition = Spring.GetUnitPosition +local spMarkerAddPoint = Spring.MarkerAddPoint +local spMarkerErasePosition = Spring.MarkerErasePosition + +function isbool(x) return (type(x) == 'boolean') end +function istable(x) return (type(x) == 'table') end +function isnumber(x) return (type(x) == 'number') end +function isstring(x) return (type(x) == 'string') end + +function sqrDistance(x1,z1,x2,z2) + local dx,dz = x1-x2,z1-z2 + return (dx*dx)+(dz*dz) +end + +function tobool(val) + local t = type(val) + if (t == 'nil') then + return false + elseif (t == 'boolean') then + return val + elseif (t == 'number') then + return (val ~= 0) + elseif (t == 'string') then + return ((val ~= '0') and (val ~= 'false')) + end + return false +end + +-- Counts how many fields (not elements, use # for that) are there in table T +function tablelength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + +-- Fast/Concise Remove from ipairs: (http://lua-users.org/lists/lua-l/2013-11/msg00031.html) +function ipairs_remove(t, value) + if not t or not value then + return end + local index = 1 + local size = #t + while index <= size do + if t[index] == value then -- if found searched value + t[index] = t[size] -- replace it with last item + t[size] = nil -- then remove last item. #count still works properly. + size = size - 1 + else + index = index + 1 end + end +end + +function ipairs_removeIdx(t, index) + local size = #t + t[index] = t[size] -- replace it with last item + t[size] = nil -- then remove last item. #count still works properly. +end + +-- Used to remove an element from an itable where the inner param 'element' equals to a certain value +function ipairs_removeByElement(table, elementId, value) + for _, v in ipairs(table) do + if v[elementId] == value then + ipairs_remove(table, v) + end + end +end + +-- Returns the index (if found) or nil if not found +function ipairs_containsElement(table, elementId, value) + for k, v in ipairs(table) do + if v[elementId] == value then + return k + end + end + return nil +end + +-- Returns the key (if found) or nil if not found +function pairs_containsElement(table, elementId, value) + for k, v in pairs(table) do + if v[elementId] == value then + return k + end + end + return nil +end + +function ipairs_len(table) + local numItems = 0 + for k, v in ipairs(table) do + numItems = numItems + 1 + end + return numItems +end + +function pairs_len(table) + -- Alert: Line below prevent errors, but it won't be obvious to the caller if the table is nil + if table == nil or not istable(table) then + return 0 end + local numItems = 0 + for _, v in pairs(table) do + if v then + numItems = numItems + 1 + end + end + return numItems +end + +-- Debug function to list all keys in a given table +function DebugTableKeys(table) + local keys = "" + for key, _ in pairs(table) do + keys = keys .. key .. " " + end + Spring.Echo("Table keys: " .. keys) +end + +-- Debug table keys and values, up to three nested levels +function DebugTable(tbl) + --Spring.Echo(" Debug Table: ") + for k, v in pairsByKeys(tbl) do + local str + if type(v) == "table" then + str = "{" + for k2, v2 in pairsByKeys(v) do + str = str .. k2 + if type(v2) == "table" then + str = str .. "{" + for k3, v3 in pairsByKeys(v2) do + if type(v3) == "table" then + str = str .. k3 .. "={}, " + else + str = str .. k3 .. "=" .. tostring(v3) .. ", " + end + end + str = str .. "}" + else + str = str .. tostring(v2) + end + end + str = str .. "}" + else + str = tostring(v) + end + Spring.Echo(tostring(k), str) + end +end + +-- Debug ipairs containing table keys and values, up to three nested levels +function DebugiTable(tbl) + --Spring.Echo("Debugitable") + if type(tbl) == 'table' then + local s = '{ ' + for k,v in pairs(tbl) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. '['..k..'] = ' .. DebugiTable(v) .. ',' + end + return s .. '} ' + else + return tostring(tbl) + end +end + +-- Returns true if a table (tab) contains a certain value (searchVal) +function ipairs_contains (tab, searchVal) + for _,value in ipairs(tab) do + if value == searchVal then + return true + end + end + return false +end + +-- Returns a key-sorted iterator which may be traversed by, eg: +-- for name, line in pairsByKeys(lines) do print(name, line) end +-- takes: table, order function; returns: iterator +function pairsByKeys (t, f) + local iter = function () end + if not t then + return iter end + local a = {} + for n in pairs(t) do + table.insert(a, n) end + table.sort(a, f) + local i = 0 -- iterator variable + iter = function () -- iterator function + i = i + 1 + if a[i] == nil then + return nil + else + return a[i], t[a[i]] end + end + return iter +end + +-- Returns a key-sorted iterator which may be traversed by, eg: +-- for name, line in pairsByKeys(lines) do print(name, line) end +-- takes: table, order function; returns: iterator +function ipairsByKeys (t, f) + local iter = function () end + if not t then + return iter end + local a = {} + for n in ipairs(t) do + table.insert(a, n) end + table.sort(a, f) + local i = 0 -- iterator variable + iter = function () -- iterator function + i = i + 1 + if a[i] == nil then + return nil + else + return a[i], t[a[i]] end + end + return iter +end + +local newlineChar = "\b" --was: \011 (FF) - "vertical tab" char, to allow proper parsing from spreadsheets +local tabChar = "\t" --This can be replaced by another tabulation char if desired + +-- Returns a string from any value, including tables +-- takes: type (any), strings (separator, newline, original text, open sign, close sign), int (indentLevel); +-- returns: string +function tostringplus(t, indent, sep, nl, text, osign, csign) + if t == nil then + return "" + end + if indent == nil then + indent = "" + end + if sep == nil then + sep = "=" + end + if nl == nil then + nl = ","..newlineChar + end + if text == nil then + text = "" + end + if osign == nil then + osign = "{"..newlineChar + end + if csign == nil then + csign = "}" -- comma is added automatically by the overarching routine + end + + if type(t) == "string" then + text = '"'..t..'"' + else + if type(t) == "table" then + local outerind = indent + text = text..osign + + indent = indent .. tabChar + for k,v in pairs(t) do + if type(k) == "number" then + --iPairs don't need the explicit index + text = text..indent..tostringplus(v, indent) --, sep, nl, text, osign, csign, indent) + .. nl + else + text = text..indent..tostring(k, indent) --, sep, nl, text, osign, csign, indent) + -- TODO: the first 'sep' below shouldn't be added after a 'close sign' + .. sep ..tostringplus(v, indent) --, sep, nl, text, osign, csign, indent) + .. nl + end + end + + text = text..outerind..csign + else + text = text..tostring(t) + end + end + + return text +end + +--// Converters a quotes-enclosed table into a lua table. Used for customParams encoded tables +--function str2table(s) +-- local exps, res = {}, {} +-- local function save(v) +-- exps[#exps + 1] = v +-- return ('\0'):rep(#exps) +-- end +-- s = s:gsub('%b{}', function(s) return save{str2table(s:sub(2, -2))} end) -- arrays +-- s = s:gsub('"(.-)"', save) -- strings +-- s = s:gsub('%-?%d+', function(s) return save(tonumber(s)) end) -- integer numbers +-- for k in s:gmatch'%z+' do +-- res[#res + 1] = exps[#k] +-- end +-- return (table.unpack or unpack)(res) +--end + +-- [WIP], doesn't work with backspace chars properly +function str2table(input) + local function is_digit(c) + return c >= '0' and c <= '9' + end + --input = tostring(input) + if not input then + return end + if isstring(input) then + input = string.gsub(input, "%[%[", "'") + input = string.gsub(input, "%]%]", "'") + input = string.gsub(input, "\"", "'") + input = string.gsub(input, "\b", "") --backspace char, used in the data spreadsheet + --Spring.Echo("Formatted string: "..input) + end + if type(input) == 'string' then + local data = input + local pos = 0 + function input(undo) + if undo then + pos = pos - 1 + else + pos = pos + 1 + return string.sub(data, pos, pos) + end + end + end + local c + repeat + c = input() + until c ~= ' ' and c ~= ',' + if c == "'" then + local s = '' + repeat + c = input() + if c == "'" then + return s + end + s = s..c + until c == '' + elseif c == '-' or is_digit(c) then + local s = c + repeat + c = input() + local d = is_digit(c) + if d then + s = s..c + end + until not d + input(true) + return tonumber(s) + elseif c == '{' then + local arr = {} + local elem + repeat + elem = str2table(input) + table.insert(arr, elem) + until not elem + return arr + end +end + +--//////////////////////// +--// MATH FUNCTIONS +--//////////////////////// + +function inverselerp(a, b, t) + --return t / (a + b) || deprecated, was used by los scaler + + return (t - a) / (b - a) +end + +function lerp(a, b, t) + return a + (b - a) * t +end + +function minmax(n, min, max) + if n > max then + n = max end + if n < min then + n = min end + return n +end + +--//////////////////////// +--// UPGRADE FUNCTIONS +--//////////////////////// + +function HasTech(prereq, teamID) + if prereq == "" or prereq == nil then + return true end + return GG.TechCheck(prereq, teamID) +end + +--//////////////////////// +--// LUA UI FUNCTIONS +--//////////////////////// + +--Adds or updates the command-button +function AddUpdateCommand(unitID, cmdDesc, block) + local CurrentCmdDescId = spFindUnitCmdDesc(unitID, cmdDesc.id) + cmdDesc.disabled = block or false + + if not CurrentCmdDescId then + spInsertUnitCmdDesc(unitID, cmdDesc.id, cmdDesc) + else + spEditUnitCmdDesc(unitID, cmdDesc.id, cmdDesc) + end +end + +-- BlockCmdID(.., ..) or BlockCmdID(.., .., false) +function SetCmdIDEnable(unitID, cmdID, block, orgTooltip, suffix) + if not isnumber(cmdID) then + return + end + local cmdDescId = spFindUnitCmdDesc(unitID, cmdID) + if not cmdDescId then + return end + + local disable = (block == true or block == nil) -- default: disabled (blocked) + local cmdArray = { disabled = disable } + + if disable and suffix then + cmdArray.tooltip = orgTooltip.."\n\n"..RedStr..suffix + else + cmdArray.tooltip = orgTooltip + end + + --Spring.Echo(cmdID.." Disabled: "..tostring(disable)) + spEditUnitCmdDesc(unitID, cmdDescId, cmdArray) +end + +function BlockCmdID(unitID, cmdID, orgTooltip, suffix) + SetCmdIDEnable(unitID, cmdID, true, orgTooltip, suffix) +end + +function UnblockCmdID(unitID, cmdID, orgTooltip, suffix) + SetCmdIDEnable(unitID, cmdID, false, orgTooltip) +end + + +function LocalAlert(unitID, msg) + local x, y, z = spGetUnitPosition(unitID) --x and z on map floor, y is height + spMarkerAddPoint(x,y,z,msg,true) + spMarkerErasePosition(x,y,z) +end + +function IsValidUnit(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + if unitDefID and Spring.ValidUnitID(unitID) then + return true + end + return false +end + +function DistanceToPoint(unitID, px,py,pz) + if not Spring.ValidUnitID(unitID) then return end + if not px or not pz then return end + + local ux, uy, uz = spGetUnitPosition(unitID) + local dx, dy ,dz = ux - px, uy - py, uz - pz + local dist = dx * dx + dy * dy + dz * dz + return dist +end + + +function Distance2D(unitID, px, pz) + if not Spring.ValidUnitID(unitID) then + return end + if not px or not pz then + Spring.Echo(" Invalid px or pz") + return end + + local ux, _, uz = spGetUnitPosition(unitID) + local dx, dz = ux - px, uz - pz + local dist = dx * dx + dz * dz + return dist +end + +--function indent(i, str) +-- local result = "" +-- if str == nil then +-- str = "\t" +-- end +-- if i == 0 then +-- result = "" +-- else +-- for i = 1, i do +-- result = result .. str +-- end +-- end +-- return result +--end + +------------------------------------------------------------------------------------- +--- ZeroK Utilities +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +--local buildTimes = {} +--local variableCostUnit = { +-- [UnitDefNames["terraunit"].id] = true +--} +--local isCommander = {} +-- +--for i = 1, #UnitDefs do +-- local ud = UnitDefs[i] +-- buildTimes[i] = ud.buildTime +-- if ud.customParams.level or ud.customParams.dynamic_comm then +-- variableCostUnit[i] = true +-- isCommander[i] = true +-- end +--end +-- +--------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------- +--local function GetGridTooltip(unitID) +-- local gridCurrent = Spring.GetUnitRulesParam(unitID, "OD_gridCurrent") +-- if not gridCurrent then return end +-- +-- local windStr = "" +-- local minWind = Spring.GetUnitRulesParam(unitID, "minWind") +-- if minWind then +-- windStr = "\n" .. WG.Translate("interface", "wind_range") .. " " .. math.round(minWind, 1) .. " - " .. math.round(Spring.GetGameRulesParam("WindMax") or 2.5, 1) +-- end +-- +-- if gridCurrent < 0 then +-- return WG.Translate("interface", "disabled_no_grid") .. windStr +-- end +-- local gridMaximum = Spring.GetUnitRulesParam(unitID, "OD_gridMaximum") or 0 +-- local gridMetal = Spring.GetUnitRulesParam(unitID, "OD_gridMetal") or 0 +-- +-- return WG.Translate("interface", "grid") .. ": " .. math.round(gridCurrent,2) .. "/" .. math.round(gridMaximum,2) .. " E => " .. math.round(gridMetal,2) .. " M " .. windStr +--end +-- +--local function GetMexTooltip(unitID) +-- local metalMult = Spring.GetUnitRulesParam(unitID, "overdrive_proportion") +-- if not metalMult then return end +-- +-- local currentIncome = Spring.GetUnitRulesParam(unitID, "current_metalIncome") +-- local mexIncome = Spring.GetUnitRulesParam(unitID, "mexIncome") or 0 +-- local baseFactor = Spring.GetUnitRulesParam(unitID, "resourceGenerationFactor") or 1 +-- +-- if currentIncome == 0 then +-- return WG.Translate("interface", "disabled_base_metal") .. ": " .. math.round(mexIncome,2) +-- end +-- +-- return WG.Translate("interface", "income") .. ": " .. math.round(mexIncome*baseFactor,2) .. " + " .. math.round(metalMult*100) .. "% " .. WG.Translate("interface", "overdrive") +--end +-- +--local function GetTerraformTooltip(unitID) +-- local spent = Spring.GetUnitRulesParam(unitID, "terraform_spent") +-- if not spent then return end +-- +-- return WG.Translate("interface", "terraform") .. " - " .. WG.Translate("interface", "estimated_cost") .. ": " .. math.floor(spent) .. " / " .. math.floor(Spring.GetUnitRulesParam(unitID, "terraform_estimate") or 0) +--end +-- +--local function GetZenithTooltip (unitID) +-- local meteorsControlled = Spring.GetUnitRulesParam(unitID, "meteorsControlled") +-- if not meteorsControlled then return end +-- +-- return (WG.Translate("units", "zenith.description") or "Meteor Controller") .. " - " .. (WG.Translate("interface", "meteors_controlled") or "Meteors controlled") .. " " .. (meteorsControlled or "0") .. "/500" +--end +-- +--local function GetAvatarTooltip(unitID) +-- local commOwner = Spring.GetUnitRulesParam(unitID, "commander_owner") +-- if not commOwner then return end +-- return commOwner or "" +--end +-- +--local function GetCustomTooltip (unitID) +-- return GetGridTooltip(unitID) +-- or GetMexTooltip(unitID) +-- or GetTerraformTooltip(unitID) +-- or GetZenithTooltip(unitID) +-- or GetAvatarTooltip(unitID) +--end +-- +--function Spring.Utilities.GetHumanName(ud, unitID) +-- if not ud then +-- return "" +-- end +-- +-- if unitID then +-- local name = Spring.GetUnitRulesParam(unitID, "comm_name") +-- if name then +-- local level = Spring.GetUnitRulesParam(unitID, "comm_level") +-- if level then +-- return name .. " " .. WG.Translate("interface", "lvl") .. " " .. (level + 1) +-- else +-- return name +-- end +-- end +-- end +-- +-- local name_override = ud.customParams.statsname or ud.name +-- return WG.Translate ("units", name_override .. ".name") or ud.humanName +--end +-- +--function Spring.Utilities.GetDescription(ud, unitID) +-- if not ud then +-- return "" +-- end +-- +-- local name_override = ud.customParams.statsname or ud.name +-- local desc = WG.Translate ("units", name_override .. ".description") or ud.tooltip +-- if Spring.ValidUnitID(unitID) then +-- local customTooltip = GetCustomTooltip(unitID) +-- if customTooltip then +-- return customTooltip +-- end +-- +-- local buildPower = Spring.GetUnitRulesParam(unitID, "buildpower_mult") +-- if buildPower then +-- buildPower = buildPower*10 +-- desc = desc .. ", " .. WG.Translate("interface", "builds_at") .. " " .. buildPower .. " m/s" +-- end +-- end +-- return desc +--end +-- +--function Spring.Utilities.GetHelptext(ud, unitID) +-- local name_override = ud.customParams.statsname or ud.name +-- return WG.Translate ("units", name_override .. ".helptext") or WG.Translate("interface", "no_helptext") +--end +-- +--function Spring.Utilities.GetUnitHeight(ud) +-- local customHeight = ud.customParams.custom_height +-- return (customHeight and tonumber(customHeight)) or ud.height +--end +-- +--------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------- +-- +--function Spring.Utilities.GetUnitCost(unitID, unitDefID) +-- unitDefID = unitDefID or Spring.GetUnitDefID(unitID) +-- if unitID and variableCostUnit[unitDefID] then +-- local realCost = Spring.GetUnitRulesParam(unitID, "comm_cost") or Spring.GetUnitRulesParam(unitID, "terraform_estimate") +-- if realCost then +-- return realCost +-- end +-- end +-- if unitDefID and buildTimes[unitDefID] then +-- return buildTimes[unitDefID] +-- end +-- return 50 +--end +-- +--function Spring.Utilities.GetUnitCanBuild(unitID, unitDefID) +-- unitDefID = unitDefID or Spring.GetUnitDefID(unitID) +-- if not unitDefID then +-- return 0 +-- end +-- local ud = UnitDefs[unitDefID] +-- local buildPower = (ud and ((ud.customParams.nobuildpower and 0) or ud.buildSpeed)) or 0 +-- return buildPower > 0 +--end +-- +--function Spring.Utilities.GetUnitBuildSpeed(unitID, unitDefID) +-- unitDefID = unitDefID or Spring.GetUnitDefID(unitID) +-- if not unitDefID then +-- return 0 +-- end +-- local ud = UnitDefs[unitDefID] +-- local buildPower = (ud and ((ud.customParams.nobuildpower and 0) or ud.buildSpeed)) or 0 +-- if unitID then +-- local mult = Spring.GetUnitRulesParam(unitID, "buildpower_mult") +-- if mult then +-- return mult * buildPower +-- end +-- end +-- return buildPower +--end +-- +--function Spring.Utilities.UnitEcho(unitID, st) +-- st = st or unitID +-- if Spring.ValidUnitID(unitID) then +-- local x,y,z = Spring.GetUnitPosition(unitID) +-- Spring.MarkerAddPoint(x,y,z, st) +-- else +-- Spring.Echo("Invalid unitID") +-- Spring.Echo(unitID) +-- Spring.Echo(st) +-- end +--end + +--local a = { "armflash", { name = "Flash", side = "Arm", description = "Fast Assault Tank", acceleration = 0.06, activatewhenbuilt = false, airsightdistance = 0, airstrafe = false, autoheal = 0, bankscale = 0, blocking = false, bmcode = 0, brakerate = 0.1, buildangle = 0, buildcostmetal = 250, buildcostenergy = 5000, builddistance = 0, builder = false, buildinggrounddecaldecayspeed = 0, buildinggrounddecalsizex = 0, buildinggrounddecalsizey = 0, buildoptions = {}, buildpic = "ARMFLASH.DDS", buildtime = 7500, canassist = false, canattack = false, canbeassisted = true, cancapture = false, cancloak = false, candgun = false, canfly = false, canguard = false, canmanualfire = false, canmove = true, canpatrol = false, canreclaim = false, canrepair = false, canrepeat = false, canrestore = false, canresurrect = false, canstop = 0, cansubmerge = false, cantbetransported = false, capturable = true, capturespeed = 0, category = "ALL TANK MOBILE WEAPON NOTSUB NOTSHIP NOTAIR SURFACE", cloakcost = 0, cloakcostmoving = 0, collide = false, collision = false, collisionvolumeoffsets = "0 0 -1", collisionvolumescales = "24 9 31", collisionvolumetype = "Box", commander = false, corpse = "armflash_dead", cruisealt = 0, crushresistance = 300, damagemodifier = 0, energymake = 0, energypershot = 0, energystorage = 0, energyuse = 0, explodeas = "BIG_UNITEX", extractsmetal = 0, featuredefs = { heap = { footprintx = 2, description = "Flash Heap", resurrectable = 0, hitdensity = 100, blocking = false, collisionvolumescales = "35.0 4.0 6.0", damage = 193, featurereclamate = "SMUDGE01", seqnamereclamate = "TREE1RECLAMATE", collisionvolumetype = "cylY", reclaimable = true, world = "All Worlds", footprintz = 2, object = "2X2C", height = 4, category = "heaps", energy = 0, metal = 28, }, dead = { footprintx = 2, description = "Flash Wreckage", featuredead = "armflash_heap", hitdensity = 100, blocking = true, collisionvolumescales = "20.3918304443 9.5 30.2260284424", damage = 396, featurereclamate = "SMUDGE01", seqnamereclamate = "TREE1RECLAMATE", collisionvolumetype = "Box", world = "All Worlds", reclaimable = true, object = "ARMFLASH_DEAD", footprintz = 2, collisionvolumeoffsets = "0.0750198364258 0.20984 -0.70206451416", height = 20, category = "corpses", energy = 0, metal = 71, }, }, floater = false, footprintx = 3, footprintz = 3, hidedamage = false, hightrajectory = 0, hoverattack = false, idleautoheal = 5, idletime = 1800, initcloaked = false, isairbase = false, isfeature = false, istargetingupgrade = false, leavetracks = true, levelground = false, loadingradius = 0, mass = 1500, maxdamage = 598, maxpitch = 0, maxrepairspeed = 0, maxslope = 10, maxvelocity = 5.8, maxwaterdepth = 12, metalmake = 0, metalstorage = 0, mincloakdistance = 0, minwaterdepth = 0, movementclass = "TANK3", mygravity = 0, noautofire = 0, nochasecategory = "VTOL", norestrict = 0, objectname = "ARMFLASH", onoffable = false, pushresistant = false, radardistance = 0, radardistancejam = 0, radius = 0, reclaimable = false, releaseheld = false, repairable = false, seismicdistance = 0, seismicsignature = 0, selfdestructas = "BIG_UNIT", sfxtypes = {}, showplayername = false, sightdistance = 508, smoothanim = 0, sonardistance = 0, sonarstealth = false, sounds = { ok = { "tarmmove", }, count = { "count6", "count5", "count4", "count3", "count2", "count1", }, canceldestruct = "cancel2", cant = { "cantdo4", }, select = { "tarmsel", }, underattack = "warning1", }, stealth = false, terraformspeed = 0, tidalgenerator = 0, trackoffset = 5, trackstrength = 4, trackstretch = 0, tracktype = "StdTank", trackwidth = 22, transportbyenemy = false, transportcapacity = 0, transportmass = 0, transportsize = 0, transportunloadmethod = 0, turninplace = 0, turninplaceanglelimit = 140, turninplacespeedlimit = 2.37599993, turnrate = 592, unloadspread = 0, upright = false, usebuildinggrounddecal = false, usepiececollisionvolumes = 0, waterline = 0, weapondefs = { emgx = { rgbcolor = "1 1 1", impulsefactor = 0.123, areaofeffect = 8, explosiongenerator = "custom:EMG_HIT", avoidfeature = false, intensity = 0.8, thickness = 1.5, corethickness = 0.7, duration = 0.03, size = 2.25, weaponvelocity = 1000, cratermult = 0, craterareaofeffect = 0, craterboost = 0, soundhitwetvolume = 0.5, soundstart = "flashemg", turret = true, tolerance = 5000, weapontype = "LaserCannon", name = "flash", sprayangle = 10, accuracy = 0, burst = 3, burstrate = 0.1, range = 430, damage = { default = 20, }, reloadtime = 0.4, predictboost = 3, weapontimer = 0.1, soundhitwet = "splshbig", noselfdamage = true, impulseboost = 0.123, }, emgxaa = { rgbcolor = "1 1 1", impulsefactor = 0.123, areaofeffect = 8, explosiongenerator = "custom:EMG_HIT", avoidfeature = false, intensity = 0.8, thickness = 1.5, corethickness = 0.7, duration = 0.03, size = 2.25, weaponvelocity = 1000, cratermult = 0, craterareaofeffect = 0, craterboost = 0, soundhitwetvolume = 0.5, soundstart = "flashemg", turret = true, tolerance = 5000, weapontype = "LaserCannon", name = "flashaa", sprayangle = 10, accuracy = 0, burst = 3, burstrate = 0.1, range = 480, damage = { default = 12, }, reloadtime = 0.4, predictboost = 3, weapontimer = 0.1, soundhitwet = "splshbig", noselfdamage = true, impulseboost = 0.123, cylindertargeting = 0.5, targetMoveError = 0.1,}, }, weapons ={ { onlytargetcategory = "SURFACE", badtargetcategory = "TANK", name ="armflash_emgx", },{ onlytargetcategory = "VTOL", badtargetcategory = "SCOUT", name ="armflash_emgxaa", },}, windgenerator = 0, workertime = 0, reclaimspeed= 0, customparams ={tier = 0, tedclass = "vehicle", func ="aiv", requiretech = "KbotLab", morphdef ={ into = 'armyork', cmdname = [[Panther]], text = 'Morph to Phalanx', require = 'Tech2',}, maxrange = 420, }, }} + diff --git a/Gamedata/unitdefs_post.lua b/Gamedata/unitdefs_post.lua index ac3d98c44..ffca6f5f4 100644 --- a/Gamedata/unitdefs_post.lua +++ b/Gamedata/unitdefs_post.lua @@ -8,6 +8,62 @@ VFS.Include("gamedata/alldefs_post.lua") -- load functionality for saving to custom params VFS.Include("gamedata/post_save_to_customparams.lua") +function deepcopy(orig) + local orig_type = type(orig) + local copy + if orig_type == 'table' then + copy = {} + for orig_key, orig_value in next, orig, nil do + copy[deepcopy(orig_key)] = deepcopy(orig_value) + end + setmetatable(copy, deepcopy(getmetatable(orig))) + else -- number, string, boolean, etc + copy = orig + end + return copy +end + +-- special tablemerge: +-- converts value string 'nil' to an actual nil +-- normally an empty table as value will be ignored when merging, but not here, it will overwrite what it had with an empty table +function tableMergeSpecial(t1, t2) + for k,v in pairs(t2) do + if type(v) == "table" then + if next(v) == nil then + t1[k] = v + else + if type(t1[k] or false) == "table" then + tableMergeSpecial(t1[k] or {}, t2[k] or {}) + else + t1[k] = v + end + end + else + t1[k] = v + end + end + return t1 +end + + +-- create scavenger units +VFS.Include("gamedata/scavengers/unitdef_changes.lua") +local scavengerUnitDefs = {} + +for name,uDef in pairs(UnitDefs) do + local faction = string.sub(name, 1, 3) + if not string.find(name, '_scav') then + if customDefs[name] ~= nil then + scavengerUnitDefs[name..'_scav'] = tableMergeSpecial(deepcopy(uDef), deepcopy(customDefs[name])) + else + scavengerUnitDefs[name..'_scav'] = deepcopy(uDef) + end + end +end +for name,ud in pairs(scavengerUnitDefs) do + UnitDefs[name] = ud +end + -- handle unitdefs and the weapons they contain for name,ud in pairs(UnitDefs) do UnitDef_Post(name,ud) diff --git a/Gamedata/unitdefs_pre.lua b/Gamedata/unitdefs_pre.lua index e50fcf840..523989096 100644 --- a/Gamedata/unitdefs_pre.lua +++ b/Gamedata/unitdefs_pre.lua @@ -13,17 +13,154 @@ Shared.buildList = { [[eradar2]], [[ejammer2]], [[ekmar]], + [[emine]], + [[elightturret2]], + [[eheavyturret2]], + [[elaserbattery]], + [[eartyturret]], + -- [[euwturret]], + [[eshieldgen]], + [[esilo]], + [[escoutdrone]], + [[ehbotengineer]], + [[eorb]], + [[eamphibleveler]], + [[ehbotkarganneth]], + [[eallterranarchid]], + [[elacerator]], + [[ekrow]], + -- [[ecommander]], +} + +Shared.buildListFed = { + [[f1landfac]], + [[eairplant]], + [[etech1]], + [[emetalextractor]], + [[esolar2]], + [[egeothermal]], + [[efusion2]], + [[estorage]], + [[eradar2]], + [[ejammer2]], + [[ekmar]], + [[emine]], [[elightturret2]], [[eheavyturret2]], + [[elaserbattery]], [[eartyturret]], - [[euwturret]], + -- [[euwturret]], [[eshieldgen]], [[esilo]], + [[escoutdrone]], + [[fedengineer]], + [[fedorb]], + [[ehbotkarganneth]], + [[eallterranarchid]], + [[ekrow]], + -- [[ecommander]], +} + +Shared.buildListLoz = { + [[f2landfac]], + [[eairplant]], + [[etech1]], + [[emetalextractor]], + [[esolar2]], + [[egeothermal]], + [[efusion2]], + [[estorage]], + [[eradar2]], + [[ejammer2]], + [[ekmar]], [[emine]], + [[elightturret2]], + [[eheavyturret2]], + [[elaserbattery]], + [[eartyturret]], + -- [[euwturret]], + [[eshieldgen]], + [[esilo]], + [[escoutdrone]], + [[lozengineer]], + [[lozorb]], + [[eamphibleveler]], + [[elacerator]], + [[ekrow]], + -- [[ecommander]], +} + +Shared.fedOrb = { + [[fedorb]], + [[fedengineer]], +} + +Shared.lozOrb = { + [[lozorb]], + [[lozengineer]], +} + +Shared.buildListeCommanderFactory = { [[ehbotengineer]], [[eorb]], + [[escoutdrone]], [[ebox]], - [[ecommander]], + [[ehbotfac]], + [[eminifac]], + [[ebasefactory]], + [[eamphibfac]], + [[eairplant]], + [[ehbotpeewee]], + [[ehbotthud]], + [[ehbotsniper]], + [[eallterrlight]], + [[eallterrriot_shotgun]], + [[eallterrheavy]], + [[elighttank3]], + [[eriottank2_shotgun]], + [[eheavytank3]], + [[eamphibbuggy]], + [[eamphibriot_shotgun]], + [[eamphibmedtank]], + [[efighter]], + [[egunship2]], + [[ebomber]], + [[eamphibleveler]], + [[ehbotkarganneth]], + [[eallterranarchid]], + [[elacerator]], + [[ekrow]], +} + +Shared.buildListZaal = { + [[zlightswarm]], + [[zmedswarm]], + [[zskirmisher]], + [[zpyro]], + [[zassault]], + [[zarty]], + [[zqueen]], + [[zairscout]], + [[zairtoairfighter]], + [[zairtogroundfighter]], + [[zairbomber]], +} + +Shared.buildListZaalConstructor = { + [[zconstructor]], + [[ztenticle]], + [[zhatch]], + [[zmex]], + [[zespire1]], + [[ztiberium]], +} + +Shared.buildListZaalArm = { + [[zconstructor]], +} + +Shared.buildListZaalTumor = { + [[ztumor]], } local turrets = { @@ -51,17 +188,22 @@ local factory = { [[ehbotthud]], [[ehbotsniper]], [[eallterrlight]], - [[eallterrriot]], + [[eallterrriot_shotgun]], [[eallterrheavy]], [[elighttank3]], - [[eriottank2]], + [[eriottank2_shotgun]], [[eheavytank3]], [[eamphibbuggy]], - [[eamphibriot]], + [[eamphibriot_shotgun]], [[eamphibmedtank]], - [[edrone]], - [[eraider]], + [[efighter]], [[egunship2]], + [[ebomber]], + [[eamphibleveler]], + [[ehbotkarganneth]], + [[eallterranarchid]], + [[elacerator]], + [[ekrow]], } Shared.buildListFactory = {} @@ -72,256 +214,75 @@ for i = 1, #factory do Shared.buildListFactory[#Shared.buildListFactory + 1] = factory[i] end -Shared.buildListAIOverseer = { - ------------- Basic - [[ejammerai]], - [[eorb_up1]], - [[eorb_up2]], - [[eorb_up3]], - [[etech1ai]], - [[etech2ai]], - [[etech3ai]], - [[emetalextractor_up1]], - [[emetalextractor_up2]], - [[emetalextractor_up3]], - [[eunitfactoryai]], - [[eantinukeai]], - [[elobberai]], - [[esiloai]], - [[eturretheavyai]], - [[eturretheavyai_up3]], - [[eturretlightai]], - [[eturretlightai_up3]], - [[emetalextractor]], - [[elifterai]], - [[eaiturret]], - [[ehbotfac]], - [[eminifac]], - [[ebasefactory]], - [[eamphibfac]], - [[eairplant]], - [[etech1]], - [[esolar2]], - [[egeothermal]], - [[efusion2]], - [[estorage]], - [[eradar2]], - [[ejammer2]], - [[ekmar]], - [[elightturret2]], - [[eheavyturret2]], - [[eartyturret]], - [[euwturret]], - [[eshieldgen]], - [[esilo]], - [[emine]], - [[ehbotengineer]], - [[eorb]], - [[ebox]], - [[ehbotfac]], - [[eminifac]], - [[ebasefactory]], - [[eamphibfac]], - [[eairplant]], - ----------------- Upgrade 0 - [[eraider]], - [[edrone]], - [[elighttank3]], - [[eriottank2]], - [[eheavytank3]], - [[emissiletank]], - [[eartytank]], - [[elacerator]], - [[eamphibbuggy]], - [[eamphibriot]], - [[eamphibneedle]], - [[eamphibmedtank]], - [[eamphibrock]], - [[eamphibarty]], - [[eamphibleveler]], +-- Shared.buildListAIOverseer = { + -- ------------- Basic + -- [[ehbotfac]], + -- [[eminifac]], + -- [[ebasefactory]], + -- [[eamphibfac]], + -- [[eairplant]], + -- [[etech1]], + -- [[emetalextractor]], + -- [[esolar2]], + -- [[egeothermal]], + -- [[efusion2]], + -- [[estorage]], + -- [[eradar2]], + -- [[ejammer2]], + -- [[ekmar]], + -- [[emine]], + -- [[elightturret2]], + -- [[eheavyturret2]], + -- [[elaserbattery]], + -- [[eartyturret]], + -- -- [[euwturret]], + -- [[eshieldgen]], + -- [[esilo]], + -- [[escoutdrone]], + -- [[ebox]], + -- [[ehbotengineer]], + -- [[eorb]], + -- -- [[ecommander]], +-- } + +----------------------------- +----------------------------- +--Buildlists for factories + +Shared.buildListf1landfac = { [[eallterrlight]], - [[eallterrriot]], - [[eallterrmed]], - [[eallterrheavy]], - [[eallterrassault]], - [[eallterranarchid]], - [[eallterrshield]], - [[escout]], - [[efighter]], - [[egunship2]], - [[ebomber]], - [[etransport]], [[ehbotpeewee]], + [[eallterrriot_shotgun]], [[ehbotthud]], + [[eallterrassault]], + [[eallterrshield]], + [[eallterrmed]], [[ehbotsniper]], + [[eallterrheavy]], [[ehbotrocko]], - [[eorbai]], - [[ekrow]], - [[edrone]], - [[ehbotkarganneth]], - ----------------- Upgrade 1 - [[eraider_up1]], - [[edrone_up1]], - [[elighttank3_up1]], - [[eriottank2_up1]], - [[eheavytank3_up1]], - [[emissiletank_up1]], - [[eartytank_up1]], - [[elacerator_up1]], - [[eamphibbuggy_up1]], - [[eamphibriot_up1]], - [[eamphibneedle_up1]], - [[eamphibmedtank_up1]], - [[eamphibrock_up1]], - [[eamphibarty_up1]], - [[eamphibleveler_up1]], - [[eallterrlight_up1]], - [[eallterrriot_up1]], - [[eallterrmed_up1]], - [[eallterrheavy_up1]], - [[eallterrassault_up1]], - [[eallterranarchid_up1]], - [[eallterrshield_up1]], - [[escout_up1]], - [[efighter_up1]], - [[egunship2_up1]], - [[ebomber_up1]], - [[etransport_up1]], - [[ehbotpeewee_up1]], - [[ehbotthud_up1]], - [[ehbotsniper_up1]], - [[ehbotrocko_up1]], - [[ekrow_up1]], - [[ehbotkarganneth_up1]], - ----------------- Upgrade 2 - [[eraider_up2]], - [[edrone_up2]], - [[elighttank3_up2]], - [[eriottank2_up2]], - [[eheavytank3_up2]], - [[emissiletank_up2]], - [[eartytank_up2]], - [[elacerator_up2]], - [[eamphibbuggy_up2]], - [[eamphibriot_up2]], - [[eamphibneedle_up2]], - [[eamphibmedtank_up2]], - [[eamphibrock_up2]], - [[eamphibarty_up2]], - [[eamphibleveler_up2]], - [[eallterrlight_up2]], - [[eallterrriot_up2]], - [[eallterrmed_up2]], - [[eallterrheavy_up2]], - [[eallterrassault_up2]], - [[eallterranarchid_up2]], - [[eallterrshield_up2]], - [[escout_up2]], - [[efighter_up2]], - [[egunship2_up2]], - [[ebomber_up2]], - [[etransport_up2]], - [[ehbotpeewee_up2]], - [[ehbotthud_up2]], - [[ehbotsniper_up2]], - [[ehbotrocko_up2]], - [[ekrow_up2]], - [[ehbotkarganneth_up2]], - ----------------- Upgrade 3 - [[eraider_up3]], - [[edrone_up3]], - [[elighttank3_up3]], - [[eriottank2_up3]], - [[eheavytank3_up3]], - [[emissiletank_up3]], - [[eartytank_up3]], - [[elacerator_up3]], - [[eamphibbuggy_up3]], - [[eamphibriot_up3]], - [[eamphibneedle_up3]], - [[eamphibmedtank_up3]], - [[eamphibrock_up3]], - [[eamphibarty_up3]], - [[eamphibleveler_up3]], - [[eallterrlight_up3]], - [[eallterrriot_up3]], - [[eallterrmed_up3]], - [[eallterrheavy_up3]], - [[eallterrassault_up3]], - [[eallterranarchid_up3]], - [[eallterrshield_up3]], - [[escout_up3]], - [[efighter_up3]], - [[egunship2_up3]], - [[ebomber_up3]], - [[etransport_up3]], - [[ehbotpeewee_up3]], - [[ehbotthud_up3]], - [[ehbotsniper_up3]], - [[ehbotrocko_up3]], - [[ekrow_up3]], - [[ehbotkarganneth_up3]], - ----------------- Chickens - [[chickeneco]], - [[chicken_dodo1]], - [[chicken_dodo2]], - [[chicken1]], - [[chicken1b]], - [[chicken1c]], - [[chicken1d]], - [[chicken1x]], - [[chicken1y]], - [[chicken1z]], - [[chicken2]], - [[chicken2b]], - [[chickena1]], - [[chickena1b]], - [[chickena1c]], - [[chickena2]], - [[chickena2b]], - [[chickenc1]], - [[chickenc2]], - [[chickenc3]], - [[chickenc3b]], - [[chickenc3c]], - [[chickend1]], - [[chickenf1]], - [[chickenf1b]], - [[chickenf2]], - [[chickenh1]], - [[chickenh1b]], - [[chickenh2]], - [[chickenh3]], - [[chickenh4]], - [[chickenh5]], - [[chickenp1]], - [[chickenr1]], - [[chickenr2]], - [[chickenr3]], - [[chickens1]], - [[chickens2]], - [[chickens3]], - [[chickenw1]], - [[chickenw1b]], - [[chickenw1c]], - [[chickenw1d]], - [[chickenw2]], - [[e_chickenq]], - [[epic_chickenq]], - [[h_chickenq]], - [[n_chickenq]], - [[ve_chickenq]], - [[vh_chickenq]], - [[roost]], + [[fedengineer]], + [[eorb]], + } ------------------------------ ------------------------------ ---Buildlists for factories +Shared.buildListf2landfac = { + [[eamphibbuggy]], + [[elighttank3]], + [[eriottank2_shotgun]], + [[eamphibneedle]], + [[eartytank]], + [[ebox]], + [[eamphibmedtank]], + [[eheavytank3]], + [[eamphibrock]], + [[emissiletank]], + [[lozengineer]], + [[eorb]], +} Shared.buildListHoverFactory = { [[elighttank3]], - [[eriottank2]], + [[eriottank2_shotgun]], [[eheavytank3]], [[emissiletank]], [[eartytank]], @@ -360,7 +321,7 @@ Shared.buildListHoverFactory_up3 = { Shared.buildListAmphibFactory = { [[eamphibbuggy]], - [[eamphibriot]], + [[eamphibriot_shotgun]], [[eamphibneedle]], [[eamphibmedtank]], [[eamphibrock]], @@ -403,12 +364,12 @@ Shared.buildListAmphibFactory_up3 = { Shared.buildListAllTerrainFactory = { [[eallterrlight]], - [[eallterrriot]], + [[eallterrriot_shotgun]], [[eallterrmed]], [[eallterrheavy]], [[eallterrassault]], - [[eallterranarchid]], [[eallterrshield]], + [[eallterranarchid]], } Shared.buildListAllTerrainFactory_up1 = { @@ -417,8 +378,8 @@ Shared.buildListAllTerrainFactory_up1 = { [[eallterrmed_up1]], [[eallterrheavy_up1]], [[eallterrassault_up1]], - [[eallterranarchid_up1]], [[eallterrshield_up1]], + [[eallterranarchid_up1]], } Shared.buildListAllTerrainFactory_up2 = { @@ -427,8 +388,8 @@ Shared.buildListAllTerrainFactory_up2 = { [[eallterrmed_up2]], [[eallterrheavy_up2]], [[eallterrassault_up2]], - [[eallterranarchid_up2]], [[eallterrshield_up2]], + [[eallterranarchid_up2]], } Shared.buildListAllTerrainFactory_up3 = { @@ -437,46 +398,46 @@ Shared.buildListAllTerrainFactory_up3 = { [[eallterrmed_up3]], [[eallterrheavy_up3]], [[eallterrassault_up3]], - [[eallterranarchid_up3]], [[eallterrshield_up3]], + [[eallterranarchid_up3]], } -- -- Shared.buildListAirPlant = { - [[edrone]], - [[eraider]], + -- [[edrone]], [[efighter]], [[egunship2]], [[ebomber]], - [[ekrow]], + [[eairemp]], [[etransport]], + [[ekrow]], } Shared.buildListAirPlant_up1 = { - [[edrone_up1]], - [[eraider_up1]], + -- [[edrone_up1]], [[efighter_up1]], [[egunship2_up1]], [[ebomber_up1]], - [[ekrow_up1]], + [[eairemp_up1]], [[etransport_up1]], + [[ekrow_up1]], } Shared.buildListAirPlant_up2 = { - [[edrone_up2]], - [[eraider_up2]], + -- [[edrone_up2]], [[efighter_up2]], [[egunship2_up2]], [[ebomber_up2]], - [[ekrow_up2]], + [[eairemp_up2]], [[etransport_up2]], + [[ekrow_up2]], } Shared.buildListAirPlant_up3 = { - [[edrone_up3]], - [[eraider_up3]], + -- [[edrone_up3]], [[efighter_up3]], [[egunship2_up3]], [[ebomber_up3]], - [[ekrow_up3]], + [[eairemp_up3]], [[etransport_up3]], + [[ekrow_up3]], } -- -- @@ -508,3 +469,15 @@ Shared.buildListHbotFactory_up3 = { [[ehbotrocko_up3]], [[ehbotkarganneth_up3]], } + +----------------------------- +----------------------------- +--Buildlists for T3/Experimentals + +Shared.buildListT3 = { + [[eamphibleveler]], + [[ehbotkarganneth]], + [[eallterranarchid]], + [[elacerator]], + [[ekrow]], +} \ No newline at end of file diff --git a/LGPL-3.0.txt b/LGPL-3.0.txt new file mode 100644 index 000000000..0a041280b --- /dev/null +++ b/LGPL-3.0.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LuaAI.lua b/LuaAI.lua index 93e20c4d7..1fedaf087 100644 --- a/LuaAI.lua +++ b/LuaAI.lua @@ -8,64 +8,34 @@ -- return { - { - name = 'ShardLua', - desc = 'Shard by AF for Spring Lua', - }, - - { - name = 'Chicken: Very Easy', - desc = 'Trivial Games' - }, - { - name = 'Chicken: Easy', - desc = 'Normal Games' - }, - { - name = 'Chicken: Normal', - desc = 'Average Games' - }, - { - name = 'Chicken: Hard', - desc = 'Large Games' - }, - { - name = 'Chicken: Very Hard', - desc = 'Hardcore Games' - }, - { - name = 'Chicken: Epic!', - desc = 'Extreme Survival Games' - }, - { - name = 'Chicken: Custom', - desc = 'Settings in ModOptions' - }, - { - name = 'Chicken: Survival', - desc = 'Infinite Games' - }, - ---[[ { - name = 'Survival Spawner: Very Easy', - desc = 'Beginner Games' - }, - { - name = 'Survival Spawner: Easy', - desc = 'Normal Games' - }, - { - name = 'Survival Spawner: Normal', - desc = 'Average Games' - }, - { - name = 'Survival Spawner: Hard', - desc = 'Large Games' - }, - { - name = 'Survival Spawner: Very Hard', - desc = 'Hardcore Games' - }, ]]-- + -- { + -- name = 'DAI', + -- desc = 'Shard by AF for Spring Lua', + -- }, + { + name = 'ScavengersAI', + desc = 'scavs', + }, + { + name = 'Sandbox', + desc = 'Does absolutely Nothing', + }, + { + name = 'SimpleAI', + desc = 'EasyAI (Simple)', + }, + { + name = 'SimpleCheaterAI', + desc = 'EasyAI (Cheater)', + }, + { + name = 'SimpleDefenderAI', + desc = 'EasyAI (Defender)', + }, + { + name = 'SimpleConstructorAI', + desc = 'EasyAI (Constructor)', + }, } diff --git a/LuaIntro/Addons/bg_logo.lua b/LuaIntro/Addons/bg_logo.lua index 3378c4066..394904bc0 100644 --- a/LuaIntro/Addons/bg_logo.lua +++ b/LuaIntro/Addons/bg_logo.lua @@ -118,7 +118,7 @@ local shader = gl.CreateShader({ ]], }) -Spring.Echo(gl.GetShaderLog()) +--Spring.Echo(gl.GetShaderLog()) diff --git a/LuaIntro/Addons/main.lua b/LuaIntro/Addons/main.lua index a5d387e8c..93ce6e62c 100644 --- a/LuaIntro/Addons/main.lua +++ b/LuaIntro/Addons/main.lua @@ -12,8 +12,25 @@ if addon.InGetInfo then } end +local defaultFont = 'JosefinSans-SemiBold.ttf' +local fontfile = 'luaui/fonts/'..Spring.GetConfigString("ui_font", defaultFont) +if not VFS.FileExists(fontfile) then + Spring.SetConfigString('ui_font', defaultFont) + fontfile = 'luaui/fonts/'..defaultFont +end +local defaultFont2 = 'JosefinSans-Bold.ttf' +local fontfile2 = 'luaui/fonts/'..Spring.GetConfigString("ui_font2", defaultFont2) +if not VFS.FileExists(fontfile2) then + Spring.SetConfigString('ui_font2', defaultFont2) + fontfile2 = 'luaui/fonts/'..defaultFont2 +end ------------------------------------------ +local showTips = true +if (Spring.GetConfigInt("LoadscreenTips",1) or 1) == 0 then + showTips = false +end + local lastLoadMessage = "" function addon.LoadProgress(message, replaceLastLine) @@ -22,28 +39,131 @@ end ------------------------------------------ -local font = gl.LoadFont("FreeSansBold.otf", 70, 22, 1.15) +-- Random tips we can show +local titleColor = "\255\215\255\215" +local contentColor = "\255\255\255\255" +local tips = { + + -- Zopto + "loadingpics/theenigmatng.png "..titleColor.."The Enigma TNG\n"..contentColor.."He is the creator of most of the music in the game, so go check him out!", + + -- Suppy Boi + + + -- Damgam + "loadingpics/dreamstatelogic.png "..titleColor.."Dreamstate Logic\n"..contentColor.."Composer of a many ambient tracks used ingame, check out his music on Soundcloud!", + "Press Enter to Chat, Use Alt+Enter to Team Chat, Use Ctrl+Enter to Global Chat", + + -- Koyote + +} + +-- Random unit descriptions we can show +local titleColor = "\255\215\255\215" +local contentColor = "\255\255\255\255" +local unit_descs = { + + "elightturret2.png "..titleColor.."Pincushion\n"..contentColor.."Only you can prevent tech rushes (by building a Pincushion in your base)!", + "ehbotpeewee.png "..titleColor.."A.K. (H-Bot Raider)\n"..contentColor.."H-Bots can traverse any terrain, but they have two giant weaknesses... They are terrible in close quarter combat, and they are extremely vulnerable to artillery. Use cloaked All-Terrains to get in close, or use artillery to zone them out.", + "elighttank3.png "..titleColor.."Kite (Hovertank Raider)\n"..contentColor.."Hovertanks are all around good units with a lot of excellent variety, however, they lack some of the more specialized abilities of the other techs.", + "eallterrlight.png "..titleColor.."Recluse (All-Terrain Raider)\n"..contentColor.."All-Terrains have some of the most specialized units in the game. All All-Terrain units can cloak. Cloaking is ESSENTIAL to ensure that your units get the first shot. This can be the difference between winning or losing a battle.", + "eamphibbuggy.png "..titleColor.."Snake (Amphibious Raider\n"..contentColor.."Amphibious units are fast (even faster underwater!), extremely high damage, but suffer in terms of armor and range. Use them to hit fast and hard. Then back away before your opponent can do any real damage and hit is undefended flank!", + "emetalextractor.png "..titleColor.."Metal Extractor\n"..contentColor.."Make sure to evolve your Metal Extractors so that you can continually increase your income", + "esolar2.png "..titleColor.."Fission Energy Generator\n"..contentColor.."Make sure to keep building energy production as your tech progresses. At each tech, the energy cost for units and buildings increases.", + + -- Zopto + "ecommander.png "..titleColor.."Overseer\n"..contentColor.."Don't forget to evolve your overseer, different upgrades can be helpful!", + "ehbotpeewee.png "..titleColor.."H-Bots\n"..contentColor.."While h-bots have long range, no h-bot units are armored.", + "eallterrlight.png "..titleColor.."All Terrain Units\n"..contentColor.."Despite the designation 'All-terrain', All-Terrain units cannot traverse deep water.", + "emetalextractor.png "..titleColor.."Metal\n"..contentColor.."Don't forget to evolve your metal extractors to get more metal!", + "estorage.png "..titleColor.."Supply\n"..contentColor.."In order to increase your army supply cap, build more supply depots.", + "ehbotengineer.png "..titleColor.."Lifter\n"..contentColor.."Just like normal h-bots, the lifter can deploy as well.", + "eorb.png "..titleColor.."O.R.B.\n"..contentColor.."If you have a surplus of metal and can't find a way to use it, evolve your orbs or build more of them.", + "ebasefactory.png "..titleColor.."Factories\n"..contentColor.."Evolve your factories, upgraded units will give you the upper hand in battle.", + "ekrow.png "..titleColor.."Endbringers\n"..contentColor.."While Endbringers are strong, don't send them out on their own to fight entire armies.", + "eartyturret.png "..titleColor.."Lobster\n"..contentColor.."If you really want to make your opponent hate you, evolve the lobster.", + "eallterrshield.png "..titleColor.."Widow\n"..contentColor.."Even though widows have a shield, don't expect them to soak up all the damage for you.", + "emine.png "..titleColor.."Mines\n"..contentColor.."In the early game, mines can be used as a simple and cheap defense.", + "eshieldgen.png "..titleColor.."Anti-Nuke\n"..contentColor.."Don't forget to build an anti-nuke platform before it's too late.", + "esilo.png "..titleColor.."Nuke Silo\n"..contentColor.."Remember that if a nuclear missile silo is destroyed, the nuclear core inside it will detonate as well. Take care to place them well away from anything important.", + + -- Suppy Boi + "eartytank.png "..titleColor.."Artillery\n"..contentColor.."Always try to include some of artillery units into your army. The sight distance can be a huge help.", + "eartytank.png "..titleColor.."Artillery\n"..contentColor.."Try to keep your artillery behind your main battle tanks.", + "emetalextractor.png "..titleColor.."Metal\n"..contentColor.."Evolved metal extractors use energy, so when evolving to a higher tier, be sure to plan ahead for the increased energy consumption.", + "eamphibmedtank.png "..titleColor.."Amphibious Units\n"..contentColor.."While Amphibious units are fast, nimble, and deal great damage, this comes at the cost of having little to no armor.", +} + +local quotes = { + {"Zopto is to lol as carbon is to life", "Dr.Hamster"}, + {"Build 1 more Mex than the other guy.", "KoyoteKamper"}, + {"...As Chobby will come after Half Life 3...", "Damgam"}, + {"Damgam: Can you remind me why we disabled Communism?\n Forboding Angel: Because people don't like to share? lol xD\n Damgam: Tfw my question and your answer works for both ingame communism and real communism", "Damgam & Forboding Angel"}, + +} -function DrawRectRound(px,py,sx,sy,cs) - local csx = cs - local csy = cs - if sx-px < (cs*2) then - csx = (sx-px)/2 - if csx < 0 then csx = 0 end +-- Since math.random is not random and always the same, we save a counter to a file and use that. +filename = "LuaUI/Config/randomseed.data" +k = os.time() % 1500 +if VFS.FileExists(filename) then + k = VFS.LoadFile(filename) +end +k = tonumber(k) + 1 +local file = assert(io.open(filename,'w'), "Unable to save latest randomseed from "..filename) + file:write(k) + file:close() +file = nil + +local random_tip_or_desc = unit_descs[((k/2) % #unit_descs) + 1] +if k%2 == 1 then + random_tip_or_desc = tips[((math.ceil(k/2)) % #tips) + 1] +elseif k%3 == 2 then + random_tip_or_desc = quotes[((math.ceil(k/3)) % #quotes) + 1] +end + +local loadedFontSize = 70 +local font = gl.LoadFont(fontfile, 70, 22, 1.15) + +local engineVersion = 100 -- just filled this in here incorrectly but old engines arent used anyway +if Engine and Engine.version then + local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + return results end - if sy-py < (cs*2) then - csy = (sy-py)/2 - if csy < 0 then csy = 0 end + engineVersion = Split(Engine.version, '-') + if engineVersion[2] ~= nil and engineVersion[3] ~= nil then + engineVersion = tonumber(string.gsub(engineVersion[1], '%.', '')..engineVersion[2]) + else + engineVersion = tonumber(Engine.version) end - cs = math.min(csx, csy) +elseif Game and Game.version then + engineVersion = tonumber(Game.version) +end + +function DrawRectRound(px,py,sx,sy,cs) + + --local csx = cs + --local csy = cs + --if sx-px < (cs*2) then + -- csx = (sx-px)/2 + -- if csx < 0 then csx = 0 end + --end + --if sy-py < (cs*2) then + -- csy = (sy-py)/2 + -- if csy < 0 then csy = 0 end + --end + --cs = math.min(cs, csy) gl.TexCoord(0.8,0.8) gl.Vertex(px+cs, py, 0) gl.Vertex(sx-cs, py, 0) gl.Vertex(sx-cs, sy, 0) gl.Vertex(px+cs, sy, 0) - + gl.Vertex(px, py+cs, 0) gl.Vertex(px+cs, py+cs, 0) gl.Vertex(px+cs, sy-cs, 0) @@ -103,6 +223,7 @@ function RectRound(px,py,sx,sy,cs) --local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) gl.Texture(":n:luaui/Images/bgcorner.png") + --gl.Texture(":n:luaui/Images/bgcorner.png") gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) gl.Texture(false) end @@ -116,63 +237,152 @@ function gradienth(px,py,sx,sy, c1,c2) gl.Vertex(px, sy, 0) end + +local lastLoadMessage = "" +local lastProgress = {0, 0} + +local progressByLastLine = { + ["Parsing Map Information"] = {0, 20}, + ["Loading Weapon Definitions"] = {10, 50}, + ["Loading LuaRules"] = {40, 80}, + ["Loading LuaUI"] = {70, 95}, + ["Finalizing"] = {100, 100} +} +for name,val in pairs(progressByLastLine) do + progressByLastLine[name] = {val[1]*0.01, val[2]*0.01} +end + +function addon.LoadProgress(message, replaceLastLine) + lastLoadMessage = message + if message:find("Path") then -- pathing has no rigid messages so cant use the table + lastProgress = {0.8, 1.0} + end + lastProgress = progressByLastLine[message] or lastProgress +end + function addon.DrawLoadScreen() local loadProgress = SG.GetLoadProgress() + if loadProgress == 0 then + loadProgress = lastProgress[1] + else + loadProgress = math.min(math.max(loadProgress, lastProgress[1]), lastProgress[2]) + end local vsx, vsy = gl.GetViewSizes() - + -- draw progressbar local hbw = 3.5/vsx local vbw = 3.5/vsy local hsw = 0.2 local vsw = 0.2 - + local yPos = 0.125 --0.054 + local yPosTips = yPos + 0.1245 local loadvalue = 0.2 + (math.max(0, loadProgress) * 0.6) - + + if not showTips then + yPos = 0.165 + yPosTips = yPos + end + --bar bg local paddingH = 0.004 local paddingW = paddingH * (vsy/vsx) - gl.Color(0.06,0.06,0.06,0.8) - RectRound(0.2-paddingW,0.1-paddingH,0.8+paddingW,0.15+paddingH,0.007) - - -- loadvalue - gl.Color(0.4-(loadProgress/7),loadProgress*0.4,0,0.4) - RectRound(0.2,0.1,loadvalue,0.15,0.0055) - - -- loadvalue gradient - gl.Texture(false) - gl.BeginEnd(GL.QUADS, gradienth, 0.2,0.1,loadvalue,0.15, {1-(loadProgress/3)+0.2,loadProgress+0.2,0+0.08,0.14}, {0,0,0,0.14}) - - -- loadvalue inner glow - gl.Color(1-(loadProgress/3.5)+0.15,loadProgress+0.15,0+0.05,0.085) - gl.Texture(":n:luaui/Images/barglow-center.dds") - gl.TexRect(0.2,0.1,loadvalue,0.15) - - -- loadvalue glow - local glowSize = 0.045 - gl.Color(1-(loadProgress/3)+0.15,loadProgress+0.15,0+0.05,0.07) - gl.Texture(":n:luaui/Images/barglow-center.dds") - gl.TexRect(0.2, 0.1-glowSize, loadvalue, 0.15+glowSize) - - gl.Texture(":n:luaui/Images/barglow-edge.dds") - gl.TexRect(0.2-(glowSize*1.3), 0.1-glowSize, 0.2, 0.15+glowSize) - gl.TexRect(loadvalue+(glowSize*1.3), 0.1-glowSize, loadvalue, 0.15+glowSize) - + gl.Color(0.085,0.085,0.085,0.925) + RectRound(0.2-paddingW,yPos-0.05-paddingH,0.8+paddingW,yPosTips+paddingH,0.007) + + gl.Color(0,0,0,0.75) + RectRound(0.2-paddingW,yPos-0.05-paddingH,0.8+paddingW,yPos+paddingH,0.007) + + if loadvalue > 0.215 then + -- loadvalue + gl.Color(0.4-(loadProgress/7),loadProgress*0.4,0,0.4) + RectRound(0.2,yPos-0.05,loadvalue,yPos,0.0055) + + -- loadvalue gradient + gl.Texture(false) + gl.BeginEnd(GL.QUADS, gradienth, 0.2,yPos-0.05,loadvalue,yPos, {1-(loadProgress/3)+0.2,loadProgress+0.2,0+0.08,0.14}, {0,0,0,0.14}) + + -- loadvalue inner glow + gl.Color(1-(loadProgress/3.5)+0.15,loadProgress+0.15,0+0.05,0.04) + gl.Texture(":n:luaui/Images/barglow-center.png") + gl.TexRect(0.2,yPos-0.05,loadvalue,yPos) + + -- loadvalue glow + local glowSize = 0.06 + gl.Color(1-(loadProgress/3)+0.15,loadProgress+0.15,0+0.05,0.1) + gl.Texture(":n:luaui/Images/barglow-center.png") + gl.TexRect(0.2, yPos-0.05-glowSize, loadvalue, yPos+glowSize) + + gl.Texture(":n:luaui/Images/barglow-edge.png") + gl.TexRect(0.2-(glowSize*1.3), yPos-0.05-glowSize, 0.2, yPos+glowSize) + gl.TexRect(loadvalue+(glowSize*1.3), yPos-0.05-glowSize, loadvalue, yPos+glowSize) + end + -- progressbar text gl.PushMatrix() - gl.Scale(1/vsx,1/vsy,1) + gl.Scale(1/vsx,1/vsy,1) local barTextSize = vsy * 0.026 --font:Print(lastLoadMessage, vsx * 0.5, vsy * 0.3, 50, "sc") --font:Print(Game.gameName, vsx * 0.5, vsy * 0.95, vsy * 0.07, "sca") - font:Print(lastLoadMessage, vsx * 0.21, vsy * 0.133, barTextSize * 0.67, "oa") + font:Print(lastLoadMessage, vsx * 0.21, vsy * (yPos-0.017), barTextSize * 0.67, "oa") if loadProgress>0 then - font:Print(("%.0f%%"):format(loadProgress * 100), vsx * 0.5, vsy * 0.1175, barTextSize, "oc") + font:Print(("%.0f%%"):format(loadProgress * 100), vsx * 0.5, vsy * (yPos-0.0325), barTextSize, "oc") else - font:Print("Loading...", vsx * 0.5, vsy * 0.165, barTextSize, "oc") + font:Print("Loading...", vsx * 0.5, vsy * (yPos-0.031), barTextSize, "oc") end - gl.PopMatrix() + + + if showTips then + -- In this format, there can be an optional image before the tip/description. + -- Any image ends in .dss, so if such a text piece is found, we extract that and show it as an image. + local text_to_show = random_tip_or_desc + yPos = yPosTips + if random_tip_or_desc[2] then + text_to_show = random_tip_or_desc[1] + else + i, j = string.find(random_tip_or_desc, ".png") + end + local numLines = 1 + local image_text = nil + local fontSize = barTextSize * 0.77 + local image_size = 0.0485 + local height = 0.123 + + if i ~= nil then + text_to_show = string.sub(text_to_show, j+2) + local maxWidth = ((0.58-image_size-0.012) * vsx) * (loadedFontSize/fontSize) + text_to_show, numLines = font:WrapText(text_to_show, maxWidth) + else + local maxWidth = (0.585 * vsx) * (loadedFontSize/fontSize) + text_to_show, numLines = font:WrapText(text_to_show, maxWidth) + end + + -- Tip/unit description + -- Background + --gl.Color(1,1,1,0.033) + --RectRound(0.2,yPos-height,0.8,yPos,0.005) + + -- Text + gl.PushMatrix() + gl.Scale(1/vsx,1/vsy,1) + + if i ~= nil then + image_text = string.sub(random_tip_or_desc, 0, j) + gl.Texture(":n:unitpics/" .. image_text) + gl.Color(1.0,1.0,1.0,0.8) + gl.TexRect(vsx * 0.21, (vsy*(yPos-0.015))-(vsx*image_size), vsx*(0.21+image_size), vsy*(yPos-0.015),false,false) + font:Print(text_to_show, vsx * (0.21+image_size+0.012) , vsy * (yPos-0.0175), fontSize, "oa") + else + font:Print(text_to_show, vsx * 0.21, vsy * (yPos-0.0175), fontSize, "oa") + end + + if random_tip_or_desc[2] then + font:Print('\255\255\222\155'..random_tip_or_desc[2], vsx * 0.79, (vsy * ((yPos-0.0175)-height)) +(fontSize*2.66) , fontSize, "oar") + end + gl.PopMatrix() + end end @@ -183,4 +393,4 @@ end function addon.Shutdown() gl.DeleteFont(font) -end +end \ No newline at end of file diff --git a/LuaIntro/Addons/music.lua b/LuaIntro/Addons/music.lua index acb4724db..3fd5cf5fb 100644 --- a/LuaIntro/Addons/music.lua +++ b/LuaIntro/Addons/music.lua @@ -13,28 +13,30 @@ if addon.InGetInfo then end ------------------------------------------ +math.randomseed( os.time() - os.clock() * 1000 ) +math.random() math.random() math.random() +local music_volume_set = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 or 0.2 +Spring.SetSoundStreamVolume(music_volume_set) +local r = math.random(0,2) + +if r == 0 then + musicfiles = VFS.DirList("LuaUI/Widgets_Evo/Music/loading", "*.ogg") +else + musicfiles = VFS.DirList("LuaUI/Widgets_Evo/Music/war", "*.ogg") +end -Spring.SetSoundStreamVolume(0.5) -local musicfiles = VFS.DirList("LuaUI/Widgets_Evo/Music/peace", "*.ogg") if (#musicfiles > 0) then - Spring.PlaySoundStream(musicfiles[ math.random(#musicfiles) ], 0.5) - Spring.SetSoundStreamVolume(0.5) + Spring.PlaySoundStream(musicfiles[math.random(1,#musicfiles)], music_volume_set) + Spring.SetSoundStreamVolume(music_volume_set) end -function addon.DrawLoadScreen() - --local loadProgress = SG.GetLoadProgress() - - -- fade in & out music with progress - --if (loadProgress < 0.9) then - -- Spring.SetSoundStreamVolume(loadProgress) - --else - -- Spring.SetSoundStreamVolume(0.9 + ((0.9 - loadProgress) * 9)) - --end -end +--function addon.DrawLoadScreen() + --Spring.SetSoundStreamVolume(100) +--end function addon.Shutdown() - Spring.StopSoundStream() - Spring.SetSoundStreamVolume(0.5) + --Spring.StopSoundStream() + --Spring.SetSoundStreamVolume(0.5) end diff --git a/LuaIntro/config.lua b/LuaIntro/config.lua index ca6a142e2..d0bbda505 100644 --- a/LuaIntro/config.lua +++ b/LuaIntro/config.lua @@ -35,7 +35,7 @@ if LUA_NAME == "LuaUI" then ADDON_DIRS = { LUA_DIRNAME .. 'Addons/'; - LUA_DIRNAME .. 'Widgets/'; + LUA_DIRNAME .. 'Widgets_Evo/'; LUA_DIRNAME .. 'SystemAddons/'; LUA_DIRNAME .. 'SystemWidgets/'; LUA_DIRNAME .. 'chili/'; diff --git a/LuaIntro/main.lua b/LuaIntro/main.lua index a48e40ffe..10f074ff0 100644 --- a/LuaIntro/main.lua +++ b/LuaIntro/main.lua @@ -35,7 +35,7 @@ else Spring.Log = function(name, level, ...) if (type(level) == "string")and(level == "info") then - Spring.Echo(("[%s]"):format(name), ...) + --Spring.Echo(("[%s]"):format(name), ...) else origSpringLog(name, level, ...) end diff --git a/LuaRules/Configs/MetalSpots/Altair_Crossing-V1.lua b/LuaRules/Configs/MetalSpots/Altair_Crossing-V1.lua deleted file mode 100644 index 371157d4e..000000000 --- a/LuaRules/Configs/MetalSpots/Altair_Crossing-V1.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - spots = { - {x = 3864, z = 2136, metal = 2.2}, - {x = 888, z = 4024, metal = 1}, - {x = 3944, z = 184, metal = 1}, - {x = 568, z = 1928, metal = 2.2}, - {x = 1528, z = 1560, metal = 2.6}, - {x = 3640, z = 2056, metal = 2.2}, - {x = 568, z = 3144, metal = 2.2}, - {x = 1912, z = 4040, metal = 2.6}, - {x = 1592, z = 4024, metal = 1}, - {x = 360, z = 1800, metal = 2.2}, - {x = 3240, z = 3992, metal = 1}, - {x = 120, z = 3992, metal = 1}, - {x = 3720, z = 904, metal = 2.2}, - {x = 552, z = 872, metal = 2.2}, - {x = 2360, z = 4024, metal = 1}, - {x = 1784, z = 184, metal = 1}, - {x = 2392, z = 152, metal = 1}, - {x = 3736, z = 3096, metal = 2.2}, - {x = 360, z = 3016, metal = 2.2}, - {x = 1992, z = 120, metal = 2.6}, - {x = 88, z = 152, metal = 1}, - {x = 2392, z = 2376, metal = 2.6}, - {x = 360, z = 2024, metal = 2.2}, - {x = 936, z = 280, metal = 1}, - {x = 3960, z = 3992, metal = 1}, - {x = 376, z = 968, metal = 2.2}, - {x = 3096, z = 152, metal = 1}, - {x = 3544, z = 3288, metal = 2.2}, - {x = 3800, z = 1848, metal = 2.2}, - {x = 3528, z = 776, metal = 2.2}, - } -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/Archers Battlefield - v05.lua b/LuaRules/Configs/MetalSpots/Archers Battlefield - v05.lua deleted file mode 100644 index 219b24139..000000000 --- a/LuaRules/Configs/MetalSpots/Archers Battlefield - v05.lua +++ /dev/null @@ -1,48 +0,0 @@ -local spots = { - {x = 1090, z = 5671, metal = 2}, - {x = 1056, z = 6485, metal = 2}, - {x = 932, z = 7237, metal = 2}, - {x = 5767, z = 7440, metal = 2}, - {x = 6558, z = 7277, metal = 2}, - {x = 7362, z = 7375, metal = 2}, - {x = 7354, z = 733, metal = 2}, - {x = 7242, z = 1898, metal = 2}, - {x = 7434, z = 2954, metal = 2}, - {x = 511, z = 727, metal = 2}, - {x = 1321, z = 741, metal = 2}, - {x = 2231, z = 776, metal = 2}, - {x = 900, z = 4049, metal = 2}, - {x = 1123, z = 2933, metal = 2}, - {x = 1503, z = 2278, metal = 2}, - {x = 7150, z = 5682, metal = 2}, - {x = 6526, z = 5174, metal = 2}, - {x = 7386, z = 4514, metal = 2}, - {x = 3856, z = 6248, metal = 2}, - {x = 2280, z = 5728, metal = 2}, - {x = 5127, z = 5736, metal = 2}, - {x = 5150, z = 2913, metal = 2}, - {x = 3708, z = 2513, metal = 2}, - {x = 2866, z = 3386, metal = 2}, - {x = 3949, z = 764, metal = 2}, - {x = 4992, z = 1411, metal = 2}, - {x = 5630, z = 926, metal = 2}, - {x = 5675, z = 4358, metal = 2}, - {x = 2301, z = 3741, metal = 2}, - {x = 4667, z = 3515, metal = 2}, - {x = 3668, z = 4620, metal = 2}, - {x = 6325, z = 3668, metal = 2}, - {x = 2425, z = 4685, metal = 2}, - {x = 3215, z = 1958, metal = 2}, - {x = 5140, z = 6740, metal = 2}, - {x = 2667, z = 7390, metal = 2}, - {x = 3404, z = 7089, metal = 2}, - {x = 4098, z = 7521, metal = 2}, - {x = 3886, z = 3123, metal = 2}, - {x = 3955, z = 3387, metal = 2}, - {x = 4319, z = 4175, metal = 2}, - {x = 4168, z = 4360, metal = 2}, -} - -return { - spots = spots, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/BlackStar.lua b/LuaRules/Configs/MetalSpots/BlackStar.lua deleted file mode 100644 index 90a9f1212..000000000 --- a/LuaRules/Configs/MetalSpots/BlackStar.lua +++ /dev/null @@ -1,54 +0,0 @@ -return { - spots = { - [1] = {x = 4365, z = 1180, metal = 2.0}, - [2] = {x = 4160, z = 950, metal = 2.0}, - [3] = {x = 3982, z = 1270, metal = 2.0}, - [4] = {x = 7195, z = 3418, metal = 2.0}, - [5] = {x = 6913, z = 3153, metal = 2.0}, - [6] = {x = 6941, z = 3528, metal = 2.0}, - [7] = {x = 5665, z = 6307, metal = 2.0}, - [8] = {x = 5708, z = 6642, metal = 2.0}, - [9] = {x = 5991, z = 6545, metal = 2.0}, - [10] = {x = 2119, z = 6294, metal = 2.0}, - [11] = {x = 2396, z = 6563, metal = 2.0}, - [12] = {x = 2105, z = 6637, metal = 2.0}, - [13] = {x = 828, z = 3198, metal = 2.0}, - [14] = {x = 911, z = 3553, metal = 2.0}, - [15] = {x = 1118, z = 3309, metal = 2.0}, - [16] = {x = 1685, z = 1304, metal = 2.0}, - [17] = {x = 1958, z = 1081, metal = 2.0}, - [18] = {x = 6047, z = 1164, metal = 2.0}, - [19] = {x = 6447, z = 1490, metal = 2.0}, - [20] = {x = 7617, z = 4822, metal = 2.0}, - [21] = {x = 7404, z = 5422, metal = 2.0}, - [22] = {x = 4344, z = 7450, metal = 2.0}, - [23] = {x = 3725, z = 7494, metal = 2.0}, - [24] = {x = 716, z = 5422, metal = 2.0}, - [25] = {x = 543, z = 4955, metal = 2.0}, - [26] = {x = 3146, z = 3026, metal = 2.0}, - [27] = {x = 3574, z = 2758, metal = 2.0}, - [28] = {x = 4757, z = 3021, metal = 2.0}, - [29] = {x = 5036, z = 3221, metal = 2.0}, - [30] = {x = 2763, z = 4258, metal = 2.0}, - [31] = {x = 2847, z = 4517, metal = 2.0}, - [32] = {x = 3853, z = 5325, metal = 2.0}, - [33] = {x = 4283, z = 5329, metal = 2.0}, - [34] = {x = 5235, z = 4658, metal = 2.0}, - [35] = {x = 5442, z = 4191, metal = 2.0}, - [36] = {x = 4678, z = 4884, metal = 2.0}, - [37] = {x = 4670, z = 4675, metal = 2.0}, - [38] = {x = 4526, z = 4855, metal = 2.0}, - [39] = {x = 3581, z = 4901, metal = 2.0}, - [40] = {x = 3412, z = 4917, metal = 2.0}, - [41] = {x = 3429, z = 4738, metal = 2.0}, - [42] = {x = 3090, z = 3855, metal = 2.0}, - [43] = {x = 3007, z = 3716, metal = 2.0}, - [44] = {x = 3176, z = 3620, metal = 2.0}, - [45] = {x = 4884, z = 3655, metal = 2.0}, - [46] = {x = 5038, z = 3716, metal = 2.0}, - [47] = {x = 4954, z = 3889, metal = 2.0}, - [48] = {x = 4186, z = 3246, metal = 2.0}, - [49] = {x = 3907, z = 3176, metal = 2.0}, - [50] = {x = 4075, z = 3054, metal = 2.0}, - }, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/EvoRTS - Altored Divide - v10.lua b/LuaRules/Configs/MetalSpots/EvoRTS - Altored Divide - v10.lua deleted file mode 100644 index 9dfea8d3f..000000000 --- a/LuaRules/Configs/MetalSpots/EvoRTS - Altored Divide - v10.lua +++ /dev/null @@ -1,93 +0,0 @@ -return { - spots = { - {x = 855, z = 977, metal = 2.0}, - {x = 1044, z = 937, metal = 2.0}, - {x = 1128, z = 1135, metal = 2.0}, - {x = 857, z = 1218, metal = 2.0}, - {x = 984, z = 1679, metal = 2.0}, - {x = 2413, z = 713, metal = 2.0}, - {x = 2222, z = 960, metal = 2.0}, - {x = 2443, z = 1146, metal = 2.0}, - {x = 2681, z = 896, metal = 2.0}, - {x = 3985, z = 663, metal = 2.0}, - {x = 4271, z = 552, metal = 2.0}, - {x = 4390, z = 890, metal = 2.0}, - {x = 4005, z = 1011, metal = 2.0}, - {x = 5930, z = 495, metal = 2.0}, - {x = 6241, z = 567, metal = 2.0}, - {x = 6070, z = 772, metal = 2.0}, - {x = 5583, z = 856, metal = 2.0}, - {x = 4967, z = 1647, metal = 2.0}, - {x = 3107, z = 2360, metal = 2.0}, - {x = 2359, z = 2408, metal = 2.0}, - {x = 7122, z = 866, metal = 2.0}, - {x = 7390, z = 813, metal = 2.0}, - {x = 7543, z = 977, metal = 2.0}, - {x = 7421, z = 1202, metal = 2.0}, - {x = 6469, z = 1703, metal = 2.0}, - {x = 7962, z = 2170, metal = 2.0}, - {x = 6404, z = 2801, metal = 2.0}, - {x = 6634, z = 3047, metal = 2.0}, - {x = 5939, z = 3101, metal = 2.0}, - {x = 6088, z = 3077, metal = 2.0}, - {x = 5600, z = 2780, metal = 2.0}, - {x = 4740, z = 2807, metal = 2.0}, - {x = 4188, z = 2989, metal = 2.0}, - {x = 4016, z = 3106, metal = 2.0}, - {x = 98, z = 2867, metal = 2.0}, - {x = 383, z = 2941, metal = 2.0}, - {x = 1212, z = 3434, metal = 2.0}, - {x = 1891, z = 3723, metal = 2.0}, - {x = 430, z = 3761, metal = 2.0}, - {x = 968, z = 4325, metal = 2.0}, - {x = 1337, z = 4513, metal = 2.0}, - {x = 1511, z = 4449, metal = 2.0}, - {x = 2779, z = 3825, metal = 2.0}, - {x = 3128, z = 3966, metal = 2.0}, - {x = 3206, z = 4148, metal = 2.0}, - {x = 4573, z = 4138, metal = 2.0}, - {x = 4618, z = 4368, metal = 2.0}, - {x = 4831, z = 4402, metal = 2.0}, - {x = 7637, z = 3833, metal = 2.0}, - {x = 7515, z = 4053, metal = 2.0}, - {x = 7480, z = 4358, metal = 2.0}, - {x = 6628, z = 4239, metal = 2.0}, - {x = 6413, z = 4146, metal = 2.0}, - {x = 6266, z = 4332, metal = 2.0}, - {x = 7438, z = 4908, metal = 2.0}, - {x = 7019, z = 5031, metal = 2.0}, - {x = 7759, z = 5357, metal = 2.0}, - {x = 3907, z = 5163, metal = 2.0}, - {x = 3598, z = 5221, metal = 2.0}, - {x = 3254, z = 5268, metal = 2.0}, - {x = 2697, z = 5192, metal = 2.0}, - {x = 2210, z = 4740, metal = 2.0}, - {x = 2229, z = 4569, metal = 2.0}, - {x = 1703, z = 6499, metal = 2.0}, - {x = 404, z = 5887, metal = 2.0}, - {x = 422, z = 7014, metal = 2.0}, - {x = 173, z = 7317, metal = 2.0}, - {x = 832, z = 7091, metal = 2.0}, - {x = 763, z = 7393, metal = 2.0}, - {x = 1879, z = 7118, metal = 2.0}, - {x = 2200, z = 7170, metal = 2.0}, - {x = 2257, z = 7441, metal = 2.0}, - {x = 1738, z = 7434, metal = 2.0}, - {x = 3838, z = 6456, metal = 2.0}, - {x = 3978, z = 7331, metal = 2.0}, - {x = 3773, z = 7568, metal = 2.0}, - {x = 4150, z = 7851, metal = 2.0}, - {x = 4458, z = 7249, metal = 2.0}, - {x = 5381, z = 7000, metal = 2.0}, - {x = 5204, z = 7488, metal = 2.0}, - {x = 5786, z = 6932, metal = 2.0}, - {x = 5934, z = 7329, metal = 2.0}, - {x = 5150, z = 5925, metal = 2.0}, - {x = 5838, z = 5883, metal = 2.0}, - {x = 7950, z = 6495, metal = 2.0}, - {x = 7782, z = 7202, metal = 2.0}, - {x = 7339, z = 7235, metal = 2.0}, - {x = 7119, z = 7132, metal = 2.0}, - {x = 7135, z = 6799, metal = 2.0}, - }, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/EvoRTS - Glacier Pass - v12.lua b/LuaRules/Configs/MetalSpots/EvoRTS - Glacier Pass - v12.lua deleted file mode 100644 index 524bf43eb..000000000 --- a/LuaRules/Configs/MetalSpots/EvoRTS - Glacier Pass - v12.lua +++ /dev/null @@ -1,53 +0,0 @@ -return { - spots = { - [1] = {x = 566, z = 373, metal = 2.0}, - [2] = {x = 941, z = 379, metal = 2.0}, - [3] = {x = 736, z = 669, metal = 2.0}, - [4] = {x = 2709, z = 1234, metal = 2.0}, - [5] = {x = 628, z = 1758, metal = 2.0}, - [6] = {x = 619, z = 2707, metal = 2.0}, - [7] = {x = 192, z = 3036, metal = 2.0}, - [8] = {x = 688, z = 3393, metal = 2.0}, - [9] = {x = 2293, z = 2797, metal = 2.0}, - [10] = {x = 3267, z = 3213, metal = 2.0}, - [11] = {x = 3086, z = 4223, metal = 2.0}, - [12] = {x = 4177, z = 319, metal = 2.0}, - [13] = {x = 4712, z = 1475, metal = 2.0}, - [14] = {x = 5252, z = 1495, metal = 2.0}, - [15] = {x = 5026, z = 1904, metal = 2.0}, - [16] = {x = 5485, z = 373, metal = 2.0}, - [17] = {x = 6405, z = 190, metal = 2.0}, - [18] = {x = 6865, z = 224, metal = 2.0}, - [19] = {x = 6610, z = 492, metal = 2.0}, - [20] = {x = 7824, z = 382, metal = 2.0}, - [21] = {x = 6980, z = 1958, metal = 2.0}, - [22] = {x = 6663, z = 2819, metal = 2.0}, - [23] = {x = 7813, z = 2422, metal = 2.0}, - [24] = {x = 7458, z = 3051, metal = 2.0}, - [25] = {x = 4732, z = 3495, metal = 2.0}, - [26] = {x = 4838, z = 4383, metal = 2.0}, - [27] = {x = 5208, z = 5314, metal = 2.0}, - [28] = {x = 507, z = 4557, metal = 2.0}, - [29] = {x = 1233, z = 4807, metal = 2.0}, - [30] = {x = 2180, z = 4961, metal = 2.0}, - [31] = {x = 1994, z = 6424, metal = 2.0}, - [32] = {x = 259, z = 6481, metal = 2.0}, - [33] = {x = 121, z = 5340, metal = 2.0}, - [34] = {x = 737, z = 7673, metal = 2.0}, - [35] = {x = 489, z = 8021, metal = 2.0}, - [36] = {x = 1054, z = 7969, metal = 2.0}, - [37] = {x = 2322, z = 7900, metal = 2.0}, - [38] = {x = 3389, z = 7877, metal = 2.0}, - [39] = {x = 4449, z = 6196, metal = 2.0}, - [40] = {x = 4067, z = 6762, metal = 2.0}, - [41] = {x = 4726, z = 6777, metal = 2.0}, - [42] = {x = 5781, z = 7156, metal = 2.0}, - [43] = {x = 6287, z = 7761, metal = 2.0}, - [44] = {x = 5987, z = 8042, metal = 2.0}, - [45] = {x = 6486, z = 8083, metal = 2.0}, - [46] = {x = 7077, z = 6904, metal = 2.0}, - [47] = {x = 7623, z = 5538, metal = 2.0}, - [48] = {x = 6992, z = 5154, metal = 2.0}, - [49] = {x = 8048, z = 4972, metal = 2.0}, - }, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/Fetid Marsh - v07.lua b/LuaRules/Configs/MetalSpots/Fetid Marsh - v07.lua deleted file mode 100644 index 2eb01434c..000000000 --- a/LuaRules/Configs/MetalSpots/Fetid Marsh - v07.lua +++ /dev/null @@ -1,36 +0,0 @@ -local spots = { - {x = 956, z = 946, metal = 2}, - {x = 2122, z = 960, metal = 2}, - {x = 1219, z = 2052, metal = 2}, - {x = 5801, z = 959, metal = 2}, - {x = 7024, z = 1332, metal = 2}, - {x = 6960, z = 2470, metal = 2}, - {x = 948, z = 5812, metal = 2}, - {x = 1263, z = 7104, metal = 2}, - {x = 2354, z = 6996, metal = 2}, - {x = 2849, z = 4497, metal = 2}, - {x = 3568, z = 5330, metal = 2}, - {x = 4363, z = 2803, metal = 2}, - {x = 5325, z = 3896, metal = 2}, - {x = 3513, z = 987, metal = 2}, - {x = 4483, z = 1032, metal = 2}, - {x = 1210, z = 2944, metal = 2}, - {x = 1209, z = 4325, metal = 2}, - {x = 3644, z = 7232, metal = 2}, - {x = 4665, z = 7248, metal = 2}, - {x = 7216, z = 3541, metal = 2}, - {x = 7109, z = 4744, metal = 2}, - {x = 4170, z = 6290, metal = 2}, - {x = 6243, z = 4283, metal = 2}, - {x = 4059, z = 1949, metal = 2}, - {x = 2191, z = 3764, metal = 2}, - {x = 6140, z = 7286, metal = 2}, - {x = 7247, z = 7239, metal = 2}, - {x = 7179, z = 5873, metal = 2}, - {x = 6286, z = 6075, metal = 2}, - {x = 2121, z = 2016, metal = 2}, -} - -return { - spots = spots, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/HighGround - v03.lua b/LuaRules/Configs/MetalSpots/HighGround - v03.lua deleted file mode 100644 index 7a481d655..000000000 --- a/LuaRules/Configs/MetalSpots/HighGround - v03.lua +++ /dev/null @@ -1,84 +0,0 @@ -local spots = { - {x = 375, z = 378, metal = 2}, - {x = 392, z = 1401, metal = 2}, - {x = 1421, z = 1405, metal = 2}, - {x = 1417, z = 401, metal = 2}, - {x = 7824, z = 383, metal = 2}, - {x = 7799, z = 1409, metal = 2}, - {x = 6780, z = 1416, metal = 2}, - {x = 6781, z = 387, metal = 2}, - {x = 7817, z = 7803, metal = 2}, - {x = 6786, z = 7806, metal = 2}, - {x = 6797, z = 6791, metal = 2}, - {x = 7831, z = 6779, metal = 2}, - {x = 388, z = 6779, metal = 2}, - {x = 1414, z = 6787, metal = 2}, - {x = 1413, z = 7804, metal = 2}, - {x = 375, z = 7804, metal = 2}, - {x = 2163, z = 6913, metal = 2}, - {x = 2195, z = 7942, metal = 2}, - {x = 1279, z = 5991, metal = 2}, - {x = 276, z = 6018, metal = 2}, - {x = 239, z = 2119, metal = 2}, - {x = 1280, z = 2139, metal = 2}, - {x = 2137, z = 1301, metal = 2}, - {x = 2127, z = 249, metal = 2}, - {x = 6115, z = 215, metal = 2}, - {x = 6069, z = 1293, metal = 2}, - {x = 6902, z = 2139, metal = 2}, - {x = 7946, z = 2117, metal = 2}, - {x = 7949, z = 6068, metal = 2}, - {x = 6906, z = 6081, metal = 2}, - {x = 6025, z = 6031, metal = 2}, - {x = 5494, z = 5513, metal = 2}, - {x = 6003, z = 2184, metal = 2}, - {x = 5507, z = 2693, metal = 2}, - {x = 2172, z = 2178, metal = 2}, - {x = 2700, z = 2701, metal = 2}, - {x = 2171, z = 6019, metal = 2}, - {x = 2690, z = 5507, metal = 2}, - {x = 4477, z = 4737, metal = 2}, - {x = 3721, z = 4739, metal = 2}, - {x = 3719, z = 3455, metal = 2}, - {x = 4482, z = 3461, metal = 2}, - {x = 4984, z = 3711, metal = 2}, - {x = 4967, z = 4491, metal = 2}, - {x = 3229, z = 3714, metal = 2}, - {x = 3212, z = 4469, metal = 2}, - {x = 607, z = 3915, metal = 2}, - {x = 580, z = 4257, metal = 2}, - {x = 1133, z = 4661, metal = 2}, - {x = 1340, z = 4434, metal = 2}, - {x = 1018, z = 3953, metal = 2}, - {x = 1562, z = 3935, metal = 2}, - {x = 4189, z = 7656, metal = 2}, - {x = 3763, z = 7661, metal = 2}, - {x = 3759, z = 7223, metal = 2}, - {x = 3987, z = 6926, metal = 2}, - {x = 4623, z = 6768, metal = 2}, - {x = 4621, z = 7306, metal = 2}, - {x = 7764, z = 4395, metal = 2}, - {x = 7735, z = 3832, metal = 2}, - {x = 7213, z = 4370, metal = 2}, - {x = 7208, z = 3827, metal = 2}, - {x = 7069, z = 4601, metal = 2}, - {x = 6795, z = 3915, metal = 2}, - {x = 4135, z = 948, metal = 2}, - {x = 3720, z = 923, metal = 2}, - {x = 4515, z = 935, metal = 2}, - {x = 4481, z = 1483, metal = 2}, - {x = 4133, z = 1459, metal = 2}, - {x = 3852, z = 1459, metal = 2}, - {x = 3205, z = 2486, metal = 2}, - {x = 5004, z = 2501, metal = 2}, - {x = 5679, z = 3192, metal = 2}, - {x = 5644, z = 5011, metal = 2}, - {x = 4995, z = 5667, metal = 2}, - {x = 3188, z = 5667, metal = 2}, - {x = 2533, z = 4974, metal = 2}, - {x = 2551, z = 3197, metal = 2}, -} - -return { - spots = spots, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/Volcanic Basin - v04.lua b/LuaRules/Configs/MetalSpots/Volcanic Basin - v04.lua deleted file mode 100644 index b9f3fc995..000000000 --- a/LuaRules/Configs/MetalSpots/Volcanic Basin - v04.lua +++ /dev/null @@ -1,68 +0,0 @@ -local spots = { - {x = 895, z = 1162, metal = 2}, - {x = 1499, z = 1059, metal = 2}, - {x = 1066, z = 1738, metal = 2}, - {x = 623, z = 3806, metal = 2}, - {x = 214, z = 4319, metal = 2}, - {x = 850, z = 4611, metal = 2}, - {x = 1535, z = 6681, metal = 2}, - {x = 746, z = 6841, metal = 2}, - {x = 1439, z = 7432, metal = 2}, - {x = 4077, z = 7520, metal = 2}, - {x = 3605, z = 7936, metal = 2}, - {x = 4541, z = 7968, metal = 2}, - {x = 7380, z = 6829, metal = 2}, - {x = 6802, z = 7466, metal = 2}, - {x = 6668, z = 6757, metal = 2}, - {x = 7482, z = 4091, metal = 2}, - {x = 7776, z = 3513, metal = 2}, - {x = 7929, z = 4440, metal = 2}, - {x = 6937, z = 744, metal = 2}, - {x = 7505, z = 1331, metal = 2}, - {x = 6807, z = 1621, metal = 2}, - {x = 3578, z = 118, metal = 2}, - {x = 4392, z = 140, metal = 2}, - {x = 3978, z = 579, metal = 2}, - {x = 3601, z = 1582, metal = 2}, - {x = 4474, z = 1571, metal = 2}, - {x = 2857, z = 1987, metal = 2}, - {x = 1996, z = 2848, metal = 2}, - {x = 1635, z = 3581, metal = 2}, - {x = 1633, z = 4533, metal = 2}, - {x = 2059, z = 5309, metal = 2}, - {x = 2820, z = 5999, metal = 2}, - {x = 3479, z = 6507, metal = 2}, - {x = 4518, z = 6545, metal = 2}, - {x = 5349, z = 6172, metal = 2}, - {x = 6091, z = 5388, metal = 2}, - {x = 6604, z = 4523, metal = 2}, - {x = 6605, z = 3548, metal = 2}, - {x = 6293, z = 2830, metal = 2}, - {x = 5566, z = 2201, metal = 2}, - {x = 2828, z = 973, metal = 2}, - {x = 5364, z = 978, metal = 2}, - {x = 7268, z = 2756, metal = 2}, - {x = 7278, z = 5433, metal = 2}, - {x = 5383, z = 7229, metal = 2}, - {x = 2801, z = 7241, metal = 2}, - {x = 930, z = 5404, metal = 2}, - {x = 908, z = 2735, metal = 2}, - {x = 307, z = 2029, metal = 2}, - {x = 323, z = 3262, metal = 2}, - {x = 266, z = 5043, metal = 2}, - {x = 410, z = 6236, metal = 2}, - {x = 1879, z = 7790, metal = 2}, - {x = 2874, z = 7944, metal = 2}, - {x = 5301, z = 7894, metal = 2}, - {x = 6169, z = 7652, metal = 2}, - {x = 7918, z = 6060, metal = 2}, - {x = 7889, z = 5120, metal = 2}, - {x = 7981, z = 2938, metal = 2}, - {x = 7753, z = 2142, metal = 2}, - {x = 6014, z = 366, metal = 2}, - {x = 5054, z = 222, metal = 2}, -} - -return { - spots = spots, -} \ No newline at end of file diff --git a/LuaRules/Configs/MetalSpots/defaultLayout.lua b/LuaRules/Configs/MetalSpots/defaultLayout.lua new file mode 100644 index 000000000..283af030a --- /dev/null +++ b/LuaRules/Configs/MetalSpots/defaultLayout.lua @@ -0,0 +1,362 @@ +--math.randomseed(Game.GameID) -- This only works in 104+ +math.random(); math.random(); math.random() +local mapx, mapz = Game.mapSizeX * 0.5, Game.mapSizeZ * 0.5 + +-- Lets sq root the map size into a digestable number for later. We're doing some math here to account for the fact that spring does not work with add numbers. Only even ones. So, for that reason we cant to get the square root in numbers that comport to how we normally thing about maps. For example, a 16 x 16 map sqrt is 256, so that is our basis. + +local mapWidthX = (Game.mapSizeX * 2) / 1024 +local mapLengthZ = (Game.mapSizeZ * 2) / 1024 +local mapSQRT = mapWidthX * mapLengthZ + +-- Params +local size = math.max(mapx, mapz) + +-- +Spring.Echo("[Default Mex Layout] Map size is: " .. size) +Spring.Echo("[Default Mex Layout] Map square root size is: " .. mapSQRT) +local count = #Spring.GetTeamList() - 1 +local allycount = #Spring.GetAllyTeamList() - 1 +-- for i = 1, #players do + -- local playerID = players[i] + -- if not select(3, Spring.GetPlayerInfo(playerID)) then + -- count = count + 1 + -- end +-- end +Spring.SetGameRulesParam("peopleCount", count) + +teamIDCount = Spring.GetGameRulesParam("peopleCount") + +Spring.Echo("[Default Mex Layout] Number of teamIDs in this match: " .. teamIDCount) +-- + +local placeMexesInWater = Spring.GetModOptions().allowmexesinwater or "disabled" +local maxMexElevationDiff = tonumber(Spring.GetModOptions().maximummexelevationdifference) or 50 +local mexSpotsPerSideMultiplier = tonumber(Spring.GetModOptions().mexspotspersidemultiplier) or 100 +local mexRandomLayout = Spring.GetModOptions().mexrandomlayout or "standard" + if allycount > 2 then + mexRandomLayout = "legacy1" + end +local dynamicMexOutput = Spring.GetModOptions().dynamicmexoutput or "disabled" + +if placeMexesInWater == "enabled" or placeMexesInWater == "" or placeMexesInWater == nil then -- This is just an oshitifukedup protection + allowMexesInWater = true +elseif placeMexesInWater == "disabled" then + allowMexesInWater = false +end + +if maxMexElevationDiff == nil then -- This is just an oshitifukedup protection + maxMexElevationDiff = 50 +end + +if mexSpotsPerSideMultiplier == nil then -- This is just an oshitifukedup protection + mexSpotsPerSideMultiplier = 100 +end + +if mexRandomLayout == "" or mexRandomLayout == nil then -- This is just an oshitifukedup protection + mexRandomLayout = "standard" +end + +if dynamicMexOutput == "" or dynamicMexOutput == nil then -- This is just an oshitifukedup protection + dynamicMexOutput = "disabled" +end + +Spring.Echo("[Default Mex Layout] Can we put mexes in water?") +Spring.Echo(allowMexesInWater) + +local sGetGroundHeight = Spring.GetGroundHeight +local mexSideHalved = 70 -- mex is a square of side 140 units +local slopeCheckMinDistance = 35 +local function checkSlope(x, z, tolerance, allowWater) + local heightMap = {} + local leng = 0 + for i = -mexSideHalved, mexSideHalved, slopeCheckMinDistance do + for j = -mexSideHalved, mexSideHalved, slopeCheckMinDistance do + leng = leng + 1 + heightMap[leng] = sGetGroundHeight(x + i, z + j) + end + end + local highest = math.max(unpack(heightMap)) + local lowest = math.min(unpack(heightMap)) + local result = highest - lowest + return result <= tolerance and (allowWater or lowest > 0) +end + +local function mathRound(x) + return math.floor(x + 0.5) +end +local function f(x) + result = 0 + if x < 0.6 then result = 0.5 + math.pow((0.6 - x) / 0.6, 2) * 1.5 + elseif x < 0.8 then result = (x - 0.6) / 0.4 + 0.5 + elseif x <= 1 then result = 1 end + if dynamicMexOutput == "disabled" then + return 1 + else + return mathRound(result / 0.05) * 0.05 + end +end +local function makePositionsRandomMirrored(sizeX, sizeY, padding, pointRadius, extraSeparationBetweenPoints, howManyTriesBeforeGiveUp, numPointsPerSide, includeCentre, method, allowWater) + --[[ + method 1: object rotated 180 degrees around centre to produce image + method 2: object mirrored around horizontal line passing through centre to produce image + method 3: object mirrored around vertical line passing through centre to produce image + method 4: object mirrored around diagonal line going from NE to SW to produce image + method 5: object mirrored around diagonal line going from NW to SE to produce image + ]] + local positions = {} + --positions[1] = {x = padding, z = padding} + --positions[2] = {x = sizeX - padding, z = sizeY - padding} + if includeCentre then positions[#positions + 1] = {x = sizeX * 0.5, z = sizeY * 0.5} end + for i = 1, numPointsPerSide do + local newPoint = {0, 0} + local done = false + local numIterations = 0 + local minSeparation = pointRadius * 2 + extraSeparationBetweenPoints + while not done and numIterations < howManyTriesBeforeGiveUp do + numIterations = numIterations + 1 + done = true + if method == 6 then + newPoint[1] = padding + math.random() * (sizeX *0.5 - padding * 2) + newPoint[2] = padding + math.random() * (sizeY *0.5 - padding * 2) + else + newPoint[1] = padding + math.random() * (sizeX - padding * 2) + newPoint[2] = padding + math.random() * (sizeY - padding * 2) + end + if method == 1 then + newPoint[3] = sizeX - newPoint[1] + newPoint[4] = sizeY - newPoint[2] + elseif method == 2 then + newPoint[3] = newPoint[1] + newPoint[4] = sizeY - newPoint[2] + elseif method == 3 then + newPoint[3] = sizeX - newPoint[1] + newPoint[4] = newPoint[2] + elseif method == 4 then + newPoint[3] = sizeX - newPoint[2] + newPoint[4] = sizeY - newPoint[1] + elseif method == 5 then + newPoint[3] = newPoint[2] + newPoint[4] = newPoint[1] + elseif method == 6 then + newPoint[3] = newPoint[1] + newPoint[4] = sizeY - newPoint[2] + newPoint[5] = sizeX - newPoint[1] + newPoint[6] = newPoint[2] + newPoint[7] = sizeX - newPoint[1] + newPoint[8] = sizeY - newPoint[2] + end + -- check slope of new point and mirror + done = checkSlope(newPoint[1], newPoint[2], maxMexElevationDiff, allowWater) + done = done and checkSlope(newPoint[3], newPoint[4], maxMexElevationDiff, allowWater) + for j = 1, #positions do + -- check new point vs existing points + local dx = newPoint[1] - positions[j].x + local dy = newPoint[2] - positions[j].z + if dx * dx + dy * dy < minSeparation * minSeparation then + done = false + --positions[j][4], positions[j][5], logCollisions = positions[j][4] - 48, positions[j][5] - 48, logCollisions + 1 + break + end + -- check mirror of new point vs existing points + dx = newPoint[3] - positions[j].x + dy = newPoint[4] - positions[j].z + if dx * dx + dy * dy < minSeparation * minSeparation then + done = false + --positions[j][4], positions[j][5], logCollisions = positions[j][4] - 48, positions[j][5] - 48, logCollisions + 1 + break + end + end + -- check new point vs mirror of new point + local dx = newPoint[1] - newPoint[3] + local dy = newPoint[2] - newPoint[4] + if dx * dx + dy * dy < minSeparation * minSeparation then + done = false + --logCollisions = logCollisions + 1 + end + end + if numIterations == howManyTriesBeforeGiveUp then logFailures = logFailures + 1 end + positions[#positions + 1] = {x = newPoint[1], z = newPoint[2]} + positions[#positions + 1] = {x = newPoint[3], z = newPoint[4]} + if newPoint[5] then + positions[#positions + 1] = {x = newPoint[5], z = newPoint[6]} + end + if newPoint[7] then + positions[#positions + 1] = {x = newPoint[7], z = newPoint[8]} + end + end + --table.remove(positions, 1) + --table.remove(positions, 1) + + local ratioX, ratioY = 1, 1 + if sizeX > sizeY then ratioY = sizeX / sizeY + elseif sizeY > sizeX then ratioX = sizeY / sizeX end + local sizeMax = math.max(sizeX, sizeY) + if teamIDCount < 2 then + metalMultiplier = 2 + elseif teamIDCount > 8 then + metalMultiplier = 8 + else + metalMultiplier = teamIDCount + end + for i = 1, #positions do + local dx = sizeMax * 0.5 - positions[i].x * ratioX + local dy = sizeMax * 0.5 - positions[i].z * ratioY + local r = math.sqrt(dx * dx + dy * dy) + positions[i].metal = f(r / (sizeX * math.sqrt(2) * (metalMultiplier * 0.5))) + end + + return positions +end + +if mexRandomLayout == "legacy1" then + -- most normal layout + -- max metal ~49.1 + -- Max spots 56 + randomMirrored = false + r = {0.25, 0.5, 0.75, 0.95} + pointsPerLayer = {10, 11, 15, 20} + angleOffset = {math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4} + pointsBetweenVertices = {0, 0, 0, 0} + --m = {2, 1.66, 1.33, 1.5} +end + +if mexRandomLayout == "legacy2" then +-- Bit more random/clustered +-- max metal ~50 +-- Max spots 56 + randomMirrored = false + r = {0.15, 0.33, 0.5, 0.75, 0.85, 0.95} + pointsPerLayer = {3, 6, 8, 10, 14, 15} + angleOffset = {math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4} + pointsBetweenVertices = {0, 0, 0, 0, 0, 0} + --m = {2, 1.75, 1.50, 1.33, 1.25, 2} +end + +if mexRandomLayout == "legacy3" then +-- The Pitchfork +-- max metal ~51.1 +-- Max spots 94 + randomMirrored = false + r = {0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95} + pointsPerLayer = {3,5,3,9,3,11,13,7,19,21} + angleOffset = {math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4, math.pi / 4} + pointsBetweenVertices = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + --m = {2, 1.9, 1.7, 1.5, 1.4, 1, 1.1, 1.25, 1.4, 1.5} +end + +if mexRandomLayout == "legacy4" then + randomMirrored = false + r = {0.25, 0.5, 0.85} + pointsPerLayer = {3, 4, 8} + angleOffset = {-math.pi / 2, 0, math.pi / 8} + pointsBetweenVertices = {1, 0, 2} + --m = {1, 1, 1} +end + +if mexRandomLayout == "standard" then + + mexSpotsPerSide = 12 + + if mapSQRT <= 144 then -- An exception for 12x12 and smaller maps + mexSpotsPerSide = mexSpotsPerSide * 0.5 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + if mapSQRT > 144 and mapSQRT <= 196 then -- An exception for 14x14 maps + mexSpotsPerSide = mexSpotsPerSide * 0.75 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + if mapSQRT > 196 and mapSQRT <= 256 then -- An exception for 16x16 maps + mexSpotsPerSide = mexSpotsPerSide * 1 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + if mapSQRT > 256 and mapSQRT <= 400 then -- An exception for 20x20 maps + mexSpotsPerSide = mexSpotsPerSide * 1.5 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + if mapSQRT > 400 and mapSQRT <= 576 then -- An exception for 24x24 maps + mexSpotsPerSide = mexSpotsPerSide * 1.75 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + if mapSQRT > 576 then -- An exception for 28x28 maps + mexSpotsPerSide = mexSpotsPerSide * 2 + Spring.Echo("[Default Mex Layout] Map Square Root size is " .. mapSQRT .. " with a teamIDCount of " .. teamIDCount.. ". Placing " .. mexSpotsPerSide .. " mex points per quadrant (This is usually rounded up to the next whole number).") + end + + randomMirrored = true + padding = 100 + pointRadius = 100 -- TODO: change this into how big a metal circle is + extraSeparationBetweenPoints = 50 + howManyTriesBeforeGiveUp = 100 + numPointsPerSide = mexSpotsPerSide * (mexSpotsPerSideMultiplier * 0.01) + includeCentre = false + method = 6 + allowWater = allowMexesInWater + --metalPerPoint = 1 +end + +if mexRandomLayout == "ffa" then + local numVertices = teamIDCount + if teamIDCount <= 2 then numVertices = 3 end -- can't have a polygon with less than 3 sides + randomMirrored = false + r = {0.12, 0.25, 0.50, 0.75, 0.88, 0.88, 0.88} + pointsPerLayer = {numVertices, numVertices, numVertices, numVertices, numVertices, numVertices, numVertices} + local theta = -math.pi / 2 + local offset = math.pi / 14 + angleOffset = {theta, theta, theta, theta, theta, theta - offset, theta + offset} + pointsBetweenVertices = {0, 0, 1, 0, 0, 0, 0} + --m = {2, 1.66, 1.33, 1.25, 1, 1.5, 2} +end + +if r and not m then + m = {} + for i = 1, #r do + m[i] = f(r[i]) + end +end + +-- +local results = {} +if not randomMirrored then + local lengResults = 1 + local ratioX, ratioZ = 1, 1 + if mapx > mapz then + ratioZ = mapz / mapx + elseif mapz > mapx then + ratioX = mapx / mapz + end + for i = 1, #pointsPerLayer do + + local angle = angleOffset[i] + math.pi * 2 * 1 / pointsPerLayer[i] + local currX, currZ = mapx + r[i] * math.cos(angle) * size * ratioX, mapz + r[i] * math.sin(angle) * size * ratioZ + + for j = 2, pointsPerLayer[i] + 1 do + results[lengResults] = {x = currX, z = currZ, metal = m[i]} + lengResults = lengResults + 1 + + angle = angleOffset[i] + math.pi * 2 * j / pointsPerLayer[i] + nextX, nextZ = mapx + r[i] * math.cos(angle) * size * ratioX, mapz + r[i] * math.sin(angle) * size * ratioZ + + local numParts = pointsBetweenVertices[i] + 1 + for k = 1, pointsBetweenVertices[i] do + results[lengResults] = { + x = currX * (numParts - k) / numParts + nextX * k / numParts, + z = currZ * (numParts - k) / numParts + nextZ * k / numParts, + metal = m[i] + } + lengResults = lengResults + 1 + end + currX, currZ = nextX, nextZ + end + end +else + results = makePositionsRandomMirrored(Game.mapSizeX, Game.mapSizeZ, padding, pointRadius, extraSeparationBetweenPoints, howManyTriesBeforeGiveUp, numPointsPerSide, includeCentre, method, allowWater) +end + +return { + spots = results, +} diff --git a/LuaRules/Configs/UnitMaterials/0_flags.lua b/LuaRules/Configs/UnitMaterials/0_flags.lua deleted file mode 100644 index 5d21bba75..000000000 --- a/LuaRules/Configs/UnitMaterials/0_flags.lua +++ /dev/null @@ -1,110 +0,0 @@ --- $Id$ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local GADGET_DIR = "LuaRules/Configs/" - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local pieceDLs = {} - -local function UnitCreated(unitID, material, materialID) - local pieceMap = Spring.GetUnitPieceMap(unitID) - local flagPieces = {"gbrflag", "gerflag", "usflag", "rusflag"} - - for i=1,#flagPieces do - local pieceID = pieceMap[ flagPieces[i] ] - if (pieceID) then - local dl = pieceDLs[i] - if (not dl) then - dl = gl.CreateList(function() - gl.MultiTexCoord(4,100) - gl.UnitPiece(unitID, pieceID) - gl.MultiTexCoord(4,0) - end) - pieceDLs[i] = dl - end - Spring.UnitRendering.SetPieceList(unitID,materialID,pieceID,dl) - end - end -end - - -local function DrawUnit(unitID, material) - gl.Uniform(material.frameLoc, (Spring.GetGameFrame() + Spring.GetFrameTimeOffset())/10) - - --// engine should still draw it (we just set the uniforms for the shader) - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local materials = { - flagShader = { - shaderDefinitions = { - "#define use_perspective_correct_shadows", - "#define use_normalmapping", - }, - shaderPlugins = { - VERTEX_GLOBAL_NAMESPACE = [[ - uniform float frame2; - ]], - VERTEX_PRE_TRANSFORM = [[ - if (gl_MultiTexCoord4.x > 10.0) { - float a; - vec3 n = vec3(0.0); - - a = (vertex.x * 0.5 + frame2); - vertex.z += 1.35 * sin(a) * max(vertex.x, -1.0); - n += vec3(-1.0, 0.0, cos(a)) * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - a = (vertex.x * 0.5 + frame2 + vertex.y * 0.5); - vertex.z += 0.2 * sin(a) * max(vertex.x, -1.0); - n += vec3(-1.0, 0.0, cos(a)) * 0.13 * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - a = (vertex.x * 0.5 + frame2 - 0.33); - vertex.y += 0.8 * sin(a) * max(vertex.x, -1.0); - n += vec3(0.0, cos(a), -1.0) * 0.8 * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - normal = normalize(mix(normal,n,0.65)); - } - ]], - }, - shader = include(GADGET_DIR .. "UnitMaterials/Shaders/default.lua"), - force = true, - usecamera = false, - culling = GL.BACK, - texunits = { - [0] = '%%UNITDEFID:0', - [1] = '%%UNITDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - [5] = 'unittextures/Flags_normals.dds', - }, - UnitCreated = UnitCreated, - DrawUnit = DrawUnit, - }, -} - - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- affected unitdefs - -local unitMaterials = {} - -unitMaterials.flag = { - "flagShader", -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -return materials, unitMaterials - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaRules/Configs/UnitMaterials/1_normalmapping.lua b/LuaRules/Configs/UnitMaterials/1_normalmapping.lua deleted file mode 100644 index b70439933..000000000 --- a/LuaRules/Configs/UnitMaterials/1_normalmapping.lua +++ /dev/null @@ -1,153 +0,0 @@ --- $Id$ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -local GetGameFrame=Spring.GetGameFrame -local GetUnitHealth=Spring.GetUnitHealth -local modulo=math.fmod -local glUniform=gl.Uniform -local sine =math.sin -local maximum=math.max - -local GADGET_DIR = "LuaRules/Configs/" -local function DrawUnit(unitID, material) - glUniform(material.frameLoc, maximum(0,sine(modulo(unitID,10)+GetGameFrame()/(modulo(unitID,7)+6)))) - health,maxhealth=GetUnitHealth(unitID) - glUniform(material.healthLoc, 2*maximum(0, (-2*health)/(maxhealth)+1) )--inverse of health, 0 if health is 100%-50%, goes to 1 by 0 health - - - --// engine should still draw it (we just set the uniforms for the shader) - return false -end -local materials = { - normalMappedS3o = { - shaderDefinitions = { - "#define use_perspective_correct_shadows", - "#define use_normalmapping", - --"#define flip_normalmap", - }, - shader = include(GADGET_DIR .. "UnitMaterials/Shaders/default.lua"), - usecamera = false, - culling = GL.BACK, - texunits = { - [0] = '%%UNITDEFID:0', - [1] = '%%UNITDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - [5] = '%normalstex', - }, - DrawUnit = DrawUnit, - }, -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Automated normalmap detection - -local unitMaterials = {} - - - -local function FindNormalmap(tex1, tex2) - local normalstex - - --// check if there is a corresponding _normals.dds file - if (VFS.FileExists(tex1)) then - local basefilename = tex1:gsub("%....","") - --[[if (tonumber(basefilename:sub(-1,-1))) then - basefilename = basefilename:sub(1,-2) - end]]-- -- This code removes trailing numbers, but many S44 units end in a number, e.g. SU-76 - if (basefilename:sub(-1,-1) == "_") then - basefilename = basefilename:sub(1,-2) - end - normalstex = basefilename .. "_normals.dds" - if (not VFS.FileExists(normalstex)) then - normalstex = nil - end - end --if FileExists - - --[[if (not normalstex) and tex2 and (VFS.FileExists(tex2)) then - local basefilename = tex2:gsub("%....","") - if (tonumber(basefilename:sub(-1,-1))) then - basefilename = basefilename:sub(1,-2) - end - if (basefilename:sub(-1,-1) == "_") then - basefilename = basefilename:sub(1,-2) - end - normalstex = basefilename .. "_normals.dds" - if (not VFS.FileExists(normalstex)) then - normalstex = nil - end - end --if FileExists ]] -- disable tex2 detection for S44 - - return normalstex -end - - - -for i=1,#UnitDefs do - local udef = UnitDefs[i] - - if (udef.customParams.normalstex and VFS.FileExists(udef.customParams.normalstex)) then - unitMaterials[udef.name] = {"normalMappedS3o", normalstex = udef.customParams.normalstex} - - elseif (udef.model.type == "s3o") then - local modelpath = udef.model.path - if (modelpath) then - --// udef.model.textures is empty at gamestart, so read the texture filenames from the s3o directly - - local rawstr = VFS.LoadFile(modelpath) - local header = rawstr:sub(1,60) - local texPtrs = VFS.UnpackU32(header, 45, 2) - local tex1,tex2 - if (texPtrs[2] > 0) - then tex2 = "unittextures/" .. rawstr:sub(texPtrs[2]+1, rawstr:len()-1) - else texPtrs[2] = rawstr:len() end - if (texPtrs[1] > 0) - then tex1 = "unittextures/" .. rawstr:sub(texPtrs[1]+1, texPtrs[2]-1) end - - -- output units without tex2 - --[[if not tex2 then - Spring.Echo("CustomUnitShaders: " .. udef.name .. " no tex2") - end]] - - local normalstex = FindNormalmap(tex1,tex2) - if (normalstex and not unitMaterials[udef.name]) then - unitMaterials[udef.name] = {"normalMappedS3o", normalstex = normalstex} - end - end --if model - - elseif (udef.model.type == "obj") then - local modelinfopath = udef.model.path - if (modelinfopath) then - modelinfopath = modelinfopath .. ".lua" - - if (VFS.FileExists(modelinfopath)) then - local infoTbl = Include(modelinfopath) - if (infoTbl) then - local tex1 = "unittextures/" .. (infoTbl.tex1 or "") - local tex2 = "unittextures/" .. (infoTbl.tex2 or "") - - -- output units without tex2 - --[[if not tex2 then - Spring.Echo("CustomUnitShaders: " .. udef.name .. " no tex2") - end]] - - local normalstex = FindNormalmap(tex1,tex2) - if (normalstex and not unitMaterials[udef.name]) then - unitMaterials[udef.name] = {"normalMappedS3o", normalstex = normalstex} - end - end - end - end - - end --elseif -end --for - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -return materials, unitMaterials - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaRules/Configs/UnitMaterials/Shaders/default.lua b/LuaRules/Configs/UnitMaterials/Shaders/default.lua deleted file mode 100644 index cc921f7be..000000000 --- a/LuaRules/Configs/UnitMaterials/Shaders/default.lua +++ /dev/null @@ -1,186 +0,0 @@ -return { - vertex = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows - - %%VERTEX_GLOBAL_NAMESPACE%% - - uniform mat4 camera; //ViewMatrix (gl_ModelViewMatrix is ModelMatrix!) - //uniform mat4 cameraInv; - uniform vec3 cameraPos; - uniform vec3 sunPos; - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - //uniform float frameLoc; - #ifdef use_shadows - uniform mat4 shadowMatrix; - varying vec4 shadowpos; - #ifndef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - #endif - - varying vec3 cameraDir; - varying vec3 teamColor; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - #else - varying vec3 normalv; - #endif - - void main(void) - { - vec4 vertex = gl_Vertex; - vec3 normal = gl_Normal; - // vertex.xyz+=normal*40*frameLoc; - - %%VERTEX_PRE_TRANSFORM%% - - #ifdef use_normalmapping - vec3 tangent = gl_MultiTexCoord5.xyz; - vec3 bitangent = gl_MultiTexCoord6.xyz; - t = gl_NormalMatrix * tangent; - b = gl_NormalMatrix * bitangent; - n = gl_NormalMatrix * normal; - #else - normalv = gl_NormalMatrix * normal; - #endif - - vec4 worldPos = gl_ModelViewMatrix * vertex; - gl_Position = gl_ProjectionMatrix * (camera * worldPos); - cameraDir = worldPos.xyz - cameraPos; - - #ifdef use_shadows - shadowpos = shadowMatrix * worldPos; - #ifndef use_perspective_correct_shadows - shadowpos.st = shadowpos.st * (inversesqrt(abs(shadowpos.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - #endif - - gl_TexCoord[0].st = gl_MultiTexCoord0.st; - teamColor = gl_TextureEnvColor[0].rgb; - - //float fogCoord = length(gl_Position.xyz); - //fogFactor = (gl_Fog.end - fogCoord) * gl_Fog.scale; //gl_Fog.scale := 1.0 / (gl_Fog.end - gl_Fog.start) - //fogFactor = clamp(fogFactor, 0.0, 1.0); - - %%VERTEX_POST_TRANSFORM%% - } - ]], - fragment = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows - - %%FRAGMENT_GLOBAL_NAMESPACE%% - - uniform sampler2D textureS3o1; - uniform sampler2D textureS3o2; - uniform samplerCube specularTex; - uniform samplerCube reflectTex; - - uniform vec3 sunPos; // is sunDir! - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - uniform float frameLoc; - uniform float healthLoc; - - #ifdef use_shadows - #ifdef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - varying vec4 shadowpos; - uniform sampler2DShadow shadowTex; - uniform float shadowDensity; - #endif - - varying vec3 teamColor; - varying vec3 cameraDir; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - uniform sampler2D normalMap; - #else - varying vec3 normalv; - #endif - - void main(void) - { - %%FRAGMENT_PRE_SHADING%% - - #ifdef use_normalmapping - vec2 tc = gl_TexCoord[0].st; - #ifdef flip_normalmap - tc.t = 1.0 - tc.t; - #endif - vec4 normaltex=texture2D(normalMap, tc); - vec3 nvTS = normalize(normaltex.xyz - 0.5); - vec3 normal = normalize(mat3(t,b,n) * nvTS); - #else - vec3 normal = normalize(normalv); - #endif - float a = max( dot(normal, sunPos), 0.0); - vec3 light = a * sunDiffuse + sunAmbient; - - vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - - vec3 reflectDir = reflect(cameraDir, normal); - vec3 specular = textureCube(specularTex, reflectDir).rgb * extraColor.b * 4.0; - vec3 reflection = textureCube(reflectTex, reflectDir).rgb; - - #ifdef use_shadows - vec4 shadowTC = shadowpos; - #ifdef use_perspective_correct_shadows - shadowTC.st = shadowTC.st * (inversesqrt( abs(shadowTC.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - float shadow = shadow2DProj(shadowTex, shadowTC).r; - shadow = 1.0 - (1.0 - shadow) * shadowDensity; - light = mix(sunAmbient, light, shadow); - specular *= shadow; - #endif - - reflection = mix(light, reflection, extraColor.g); // reflection - reflection += extraColor.rrr*frameLoc; // self-illum - - gl_FragColor = texture2D(textureS3o1, gl_TexCoord[0].st); - gl_FragColor.rgb = mix(gl_FragColor.rgb, teamColor.rgb, gl_FragColor.a); // teamcolor - gl_FragColor.rgb = gl_FragColor.rgb * reflection + specular; - gl_FragColor.a = extraColor.a; - gl_FragColor.rgb = gl_FragColor.rgb +gl_FragColor.rgb*(normaltex.a-0.5)*healthLoc; - //gl_FragColor.rgb = mix(gl_Fog.color.rgb, gl_FragColor.rgb, fogFactor); // fog - //gl_FragColor.a = teamColor.a; // far fading - //gl_FragColor.rgb = normal; - //gl_FragColor.g=frameLoc; - %%FRAGMENT_POST_SHADING%% - } - ]], - uniformInt = { - textureS3o1 = 0, - textureS3o2 = 1, - shadowTex = 2, - specularTex = 3, - reflectTex = 4, - normalMap = 5, - --detailMap = 6, - }, - uniform = { - sunPos = {gl.GetSun("pos")}, - sunAmbient = {gl.GetSun("ambient" ,"unit")}, - sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, - shadowDensity = {gl.GetSun("shadowDensity" ,"unit")}, - shadowParams = {gl.GetShadowMapParams()}, - -- frameLoc = {math.random()}, --!bingo! - frameLoc = {math.sin(Spring.GetGameFrame()/3.0)}, - }, - uniformMatrix = { - shadowMatrix = {gl.GetMatrixData("shadow")}, - }, -} diff --git a/LuaRules/Configs/cob_buttons.lua b/LuaRules/Configs/cob_buttons.lua deleted file mode 100644 index 98b2c29d9..000000000 --- a/LuaRules/Configs/cob_buttons.lua +++ /dev/null @@ -1,237 +0,0 @@ -return { ---[[ - eriottank2 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - eriottank2_up1 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - eriottank2_up2 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - eriottank2_up3 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eamphibriot = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eamphibriot_up1 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eamphibriot_up2 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eamphibriot_up3 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eallterrriot = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eallterrriot_up1 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eallterrriot_up2 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eallterrriot_up3 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -EMP]], [[Activate -Shotgun]]}, - }, - }, - - eamphibrock = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Missile]], [[Activate -Salvo]]}, - }, - }, - - eamphibrock_up1 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Missile]], [[Activate -Salvo]]}, - }, - }, - - eamphibrock_up2 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Missile]], [[Activate -Salvo]]}, - }, - }, - - eamphibrock_up3 = { - { - name = "Weapon type", - tooltip = "Switch between EMP cannon and Shotgun Blast", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Missile]], [[Activate -Salvo]]}, - }, - }, - - eartytank = { - { - name = "Weapon type", - tooltip = "Switch between Normal and Saturation Artillery", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Shot]], [[Activate -Saturation]]}, - }, - }, - eartytank_up1 = { - { - name = "Weapon type", - tooltip = "Switch between Normal and Saturation Artillery", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Shot]], [[Activate -Saturation]]}, - }, - }, - eartytank_up2 = { - { - name = "Weapon type", - tooltip = "Switch between Normal and Saturation Artillery", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Shot]], [[Activate -Saturation]]}, - }, - }, - eartytank_up3 = { - { - name = "Weapon type", - tooltip = "Switch between Normal and Saturation Artillery", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', [[Activate -Single Shot]], [[Activate -Saturation]]}, - }, - }, -]]-- -} \ No newline at end of file diff --git a/LuaRules/Configs/lups_shield_fxs.lua b/LuaRules/Configs/lups_shield_fxs.lua index 00670c7b0..7629edfea 100644 --- a/LuaRules/Configs/lups_shield_fxs.lua +++ b/LuaRules/Configs/lups_shield_fxs.lua @@ -3,7 +3,7 @@ local ShieldSphereBase = { life = 10000, size = 350, radius = 350, - colormap1 = {{0.1, 0.1, 1, 0.2}, {1, 0.1, 0.1, 0.05}}, + colormap1 = {{0.1, 0.1, 1, 0.1}, {1, 0.1, 0.1, 0.05}}, colormap2 = {{0.2, 0.9, 1, 0.0}, {1, 0.9, 0.2, 0.0}}, repeatEffect = true, drawBack = 0.7, @@ -57,7 +57,7 @@ for unitDefID = 1, #UnitDefs do myShield.drawBackMargin = 3 myShield.margin = 1.35 myShield.hitResposeMult = 0.6 - myShield.colormap1[1][4] = 0.22 + myShield.colormap1[1][4] = 0.1 myShield.colormap1[2][4] = 0.1 else myShield.shieldSize = "small" diff --git a/LuaRules/Configs/morph_defs.lua b/LuaRules/Configs/morph_defs.lua deleted file mode 100644 index 752f2378b..000000000 --- a/LuaRules/Configs/morph_defs.lua +++ /dev/null @@ -1,1252 +0,0 @@ ---[[ Morph Definition File - -Morph parameters description -local morphDefs = { --beginig of morphDefs - unitname = { --unit being morphed - into = 'newunitname', --unit in that will morphing unit morph into - time = 12, --time required to complete morph process (in seconds) - --require = 'requnitname', --unit requnitname must be present in team for morphing to be enabled - energy = 10, --required metal for morphing process note: if you ommit M and/or E costs, morph costs the - energy = 10, --required energy for morphing process difference in costs between unitname and newunitname - xp = 0.07, --required experience for morphing process (will be deduced from unit xp after morph, default=0) - rank = 1, --required unit rank for morphing to be enabled, if ommited, morph doesn't require rank - tech = 2, --required tech level of a team for morphing to be enabled (1,2,3), if ommited, morph doesn't require tech - cmdname = 'Ascend', --if ommited will default to "Upgrade" - texture = 'MyIcon.dds', --if ommited will default to [newunitname] buildpic, textures should be in "LuaRules/Images/Morph" - text = 'Description', --if ommited will default to "Upgrade into a [newunitname]", else it's "Description" - --you may use "$$unitname" and "$$into" in 'text', both will be replaced with human readable unit names - }, -} --end of morphDefs ---]] --------------------------------------------------------------------------------- - - -local devolution = (-1 > 0) - -local energyCost_ecommander = 200 -local timeToBuild_ecommander = energyCost_ecommander * 0.10 - -local energyCost_ecommandercloak = 200 -local timeToBuild_ecommandercloak = energyCost_ecommandercloak * 0.10 - -local energyCost_ecommandershield = 200 -local timeToBuild_ecommandershield = energyCost_ecommandershield * 0.10 - -local energyCost_ecommanderbuild = 200 -local timeToBuild_ecommanderbuild = energyCost_ecommanderbuild * 0.10 - -local energyCost_ecommanderfactory = 200 -local timeToBuild_ecommanderfactory = energyCost_ecommanderfactory * 0.10 - -local energyCost_ecommanderbattle = 200 -local timeToBuild_ecommanderbattle = energyCost_ecommanderbattle * 0.10 - -local energyCost_factory_up1 = 1200 -local timeToBuild_factory_up1 = energyCost_factory_up1 * 0.10 - -local energyCost_etech2 = 1200 -local timeToBuild_etech2 = energyCost_etech2 * 0.10 - -local energyCost_etech3 = 4000 -local timeToBuild_etech3 = energyCost_etech3 * 0.10 - -local energyCost_elightturret2 = 150 -local timeToBuild_elightturret2 = energyCost_elightturret2 * 0.10 - -local energyCost_eheavyturret2 = 250 -local timeToBuild_eheavyturret2 = energyCost_eheavyturret2 * 0.10 - -local energyCost_euwturret = 100 -local timeToBuild_euwturret = energyCost_euwturret * 0.10 - -local energyCost_emetalextractor_up1 = 400 -local timeToBuild_emetalextractor_up1 = energyCost_emetalextractor_up1 * 0.10 - -local energyCost_eorb = 300 -local timeToBuild_eorb = energyCost_eorb * 0.10 - -local energyCost_eartyturret = 800 -local timeToBuild_eartyturret = energyCost_eartyturret * 0.10 - - -local morphDefs = { - ecommander = { - { - into = 'ecommandercloak', - time = timeToBuild_ecommandercloak, - cmdname = [[Cloaking -Overseer]], - energy = energyCost_ecommandercloak, - metal = 0, - text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', - require = [[tech1]], - }, - { - into = 'ecommandershield', - time = timeToBuild_ecommandershield, - cmdname = [[Shield -Overseer]], - energy = energyCost_ecommandershield, - metal = 0, - text = 'Evolve into Shielded Overseer: Gains a large shield which does not cost energy to maintain.', - require = [[tech1]], - }, - { - into = 'ecommanderbuild', - time = timeToBuild_ecommanderbuild, - cmdname = [[Builder -Overseer]], - energy = energyCost_ecommanderbuild, - metal = 0, - text = 'Evolve into Builder Overseer: Stun ability AOE halved, Stun recharge halved, gains x3 buildpower.', - require = [[tech1]], - }, - { - into = 'ecommanderfactory', - time = timeToBuild_ecommanderfactory, - cmdname = [[Factory -Overseer]], - energy = energyCost_ecommanderfactory, - metal = 0, - text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 3x buildpower.', - require = [[tech1]], - }, - { - into = 'ecommanderbattle', - time = timeToBuild_ecommanderbattle, - cmdname = [[Battle -Overseer]], - energy = energyCost_ecommanderbattle, - metal = 0, - text = 'Evolve into Battle Overseer: Loses EMP ability, gains a machinegun that does heavy damage to Light units and Buildings. No longer grants supply.', - require = [[tech1]], - }, - }, - - ecommandercloak = { - { - into = 'ecommander', - time = timeToBuild_ecommander, - cmdname = [[Healer -Overseer]], - energy = energyCost_ecommander, - metal = 0, - text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', - }, - { - into = 'ecommandershield', - time = timeToBuild_ecommandershield, - cmdname = [[Shield -Overseer]], - energy = energyCost_ecommandershield, - metal = 0, - text = 'Evolve into Shielded Overseer: Gains a large shield which does not cost energy to maintain.', - }, - { - into = 'ecommanderbuild', - time = timeToBuild_ecommanderbuild, - cmdname = [[Builder -Overseer]], - energy = energyCost_ecommanderbuild, - metal = 0, - text = 'Evolve into Builder Overseer: Stun ability AOE halved, Stun recharge halved, gains x3 buildpower.', - }, - { - into = 'ecommanderfactory', - time = timeToBuild_ecommanderfactory, - cmdname = [[Factory -Overseer]], - energy = energyCost_ecommanderfactory, - metal = 0, - text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 3x buildpower.', - }, - { - into = 'ecommanderbattle', - time = timeToBuild_ecommanderbattle, - cmdname = [[Battle -Overseer]], - energy = energyCost_ecommanderbattle, - metal = 0, - text = 'Evolve into Battle Overseer: Loses EMP ability, gains a machinegun that does heavy damage to Light units and Buildings. No longer grants supply.', - require = [[tech1]], - }, - }, - - ecommandershield = { - { - into = 'ecommander', - time = timeToBuild_ecommander, - cmdname = [[Healer -Overseer]], - energy = energyCost_ecommander, - metal = 0, - text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', - }, - { - into = 'ecommandercloak', - time = timeToBuild_ecommandercloak, - cmdname = [[Cloaking -Overseer]], - energy = energyCost_ecommandercloak, - metal = 0, - text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', - }, - { - into = 'ecommanderbuild', - time = timeToBuild_ecommanderbuild, - cmdname = [[Builder -Overseer]], - energy = energyCost_ecommanderbuild, - metal = 0, - text = 'Evolve into Builder Overseer: Stun ability AOE halved, Stun recharge halved, gains x3 buildpower.', - }, - { - into = 'ecommanderfactory', - time = timeToBuild_ecommanderfactory, - cmdname = [[Factory -Overseer]], - energy = energyCost_ecommanderfactory, - metal = 0, - text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 3x buildpower.', - }, - { - into = 'ecommanderbattle', - time = timeToBuild_ecommanderbattle, - cmdname = [[Battle -Overseer]], - energy = energyCost_ecommanderbattle, - metal = 0, - text = 'Evolve into Battle Overseer: Loses EMP ability, gains a machinegun that does heavy damage to Light units and Buildings. No longer grants supply.', - require = [[tech1]], - }, - }, - - ecommanderbuild = { - { - into = 'ecommander', - time = timeToBuild_ecommander, - cmdname = [[Healer -Overseer]], - energy = energyCost_ecommander, - metal = 0, - text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', - }, - { - into = 'ecommandercloak', - time = timeToBuild_ecommandercloak, - cmdname = [[Cloaking -Overseer]], - energy = energyCost_ecommandercloak, - metal = 0, - text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', - }, - { - into = 'ecommandershield', - time = timeToBuild_ecommandershield, - cmdname = [[Shield -Overseer]], - energy = energyCost_ecommandershield, - metal = 0, - text = 'Evolve into Shielded Overseer: Gains a large shield which does not cost energy to maintain.', - }, - { - into = 'ecommanderfactory', - time = timeToBuild_ecommanderfactory, - cmdname = [[Factory -Overseer]], - energy = energyCost_ecommanderfactory, - metal = 0, - text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 3x buildpower.', - }, - { - into = 'ecommanderbattle', - time = timeToBuild_ecommanderbattle, - cmdname = [[Battle -Overseer]], - energy = energyCost_ecommanderbattle, - metal = 0, - text = 'Evolve into Battle Overseer: Loses EMP ability, gains a machinegun that does heavy damage to Light units and Buildings. No longer grants supply.', - require = [[tech1]], - }, - }, - - ecommanderfactory = { - { - into = 'ecommander', - time = timeToBuild_ecommander, - cmdname = [[Healer -Overseer]], - energy = energyCost_ecommander, - metal = 0, - text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', - }, - { - into = 'ecommandercloak', - time = timeToBuild_ecommandercloak, - cmdname = [[Cloaking -Overseer]], - energy = energyCost_ecommandercloak, - metal = 0, - text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', - }, - { - into = 'ecommandershield', - time = timeToBuild_ecommandershield, - cmdname = [[Shield -Overseer]], - energy = energyCost_ecommandershield, - metal = 0, - text = 'Evolve into Shielded Overseer: Gains a large shield which does not cost energy to maintain.', - }, - { - into = 'ecommanderbuild', - time = timeToBuild_ecommanderbuild, - cmdname = [[Builder -Overseer]], - energy = energyCost_ecommanderbuild, - metal = 0, - text = 'Evolve into Builder Overseer: Stun ability AOE halved, Stun recharge halved, gains x3 buildpower.', - }, - { - into = 'ecommanderbattle', - time = timeToBuild_ecommanderbattle, - cmdname = [[Battle -Overseer]], - energy = energyCost_ecommanderbattle, - metal = 0, - text = 'Evolve into Battle Overseer: Loses EMP ability, gains a machinegun that does heavy damage to Light units and Buildings. No longer grants supply.', - require = [[tech1]], - }, - }, - ecommanderbattle = { - { - into = 'ecommander', - time = timeToBuild_ecommander, - cmdname = [[Healer -Overseer]], - energy = energyCost_ecommander, - metal = 0, - text = 'Evolve into Healer Overseer: Overseer has a very strong AOE heal in it\'s immediate vicinity.', - }, - { - into = 'ecommandercloak', - time = timeToBuild_ecommandercloak, - cmdname = [[Cloaking -Overseer]], - energy = energyCost_ecommandercloak, - metal = 0, - text = 'Evolve into Cloaking Overseer: Gains a large cloaking field which also cloaks the Overseer.', - }, - { - into = 'ecommandershield', - time = timeToBuild_ecommandershield, - cmdname = [[Shield -Overseer]], - energy = energyCost_ecommandershield, - metal = 0, - text = 'Evolve into Shielded Overseer: Gains a large shield which does not cost energy to maintain.', - }, - { - into = 'ecommanderbuild', - time = timeToBuild_ecommanderbuild, - cmdname = [[Builder -Overseer]], - energy = energyCost_ecommanderbuild, - metal = 0, - text = 'Evolve into Builder Overseer: Stun ability AOE halved, Stun recharge halved, gains x3 buildpower.', - }, - { - into = 'ecommanderfactory', - time = timeToBuild_ecommanderfactory, - cmdname = [[Factory -Overseer]], - energy = energyCost_ecommanderfactory, - metal = 0, - text = 'Evolve into Factory Overseer: Gains the ability to build all raider, riot, and MBTs anywhere, gains 3x buildpower.', - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- ---Economy - emetalextractor = { - { - into = 'emetalextractor_up1', - --require = 'etech2', - time = timeToBuild_emetalextractor_up1, - cmdname = [[Evolve]], - energy = energyCost_emetalextractor_up1, - metal = 0, - text = [[x2 Metal Extraction rate]], - require = [[tech1]], - }, - }, - emetalextractor_up1 = { - { - into = 'emetalextractor_up2', - --require = 'etech2', - time = timeToBuild_emetalextractor_up1, - cmdname = [[Evolve]], - energy = energyCost_emetalextractor_up1, - metal = 0, - text = [[x3 Metal Extraction rate]], - require = [[tech2]], - }, - }, - emetalextractor_up2 = { - { - into = 'emetalextractor_up3', - --require = 'etech2', - time = timeToBuild_emetalextractor_up1, - cmdname = [[Evolve]], - energy = energyCost_emetalextractor_up1, - metal = 0, - text = [[x4 Metal Extraction rate]], - require = [[tech3]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- ---Factories - ebasefactory = { - { - into = 'ebasefactory_up1', - --require = 'etech1', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech1]], - }, - }, - ebasefactory_up1 = { - { - into = 'ebasefactory_up2', - --require = 'etech2', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech2]], - }, - }, - ebasefactory_up2 = { - { - into = 'ebasefactory_up3', - --require = 'etech3', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech3]], - }, - }, - - eminifac = { - { - into = 'eminifac_up1', - --require = 'etech1', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech1]], - }, - }, - eminifac_up1 = { - { - into = 'eminifac_up2', - --require = 'etech2', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech2]], - }, - }, - eminifac_up2 = { - { - into = 'eminifac_up3', - --require = 'etech3', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech3]], - }, - }, - - eamphibfac = { - { - into = 'eamphibfac_up1', - --require = 'etech1', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech1]], - }, - }, - eamphibfac_up1 = { - { - into = 'eamphibfac_up2', - --require = 'etech2', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech2]], - }, - }, - eamphibfac_up2 = { - { - into = 'eamphibfac_up3', - --require = 'etech3', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech3]], - }, - }, - - eairplant = { - { - into = 'eairplant_up1', - --require = 'etech1', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech1]], - }, - }, - eairplant_up1 = { - { - into = 'eairplant_up2', - --require = 'etech2', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech2]], - }, - }, - eairplant_up2 = { - { - into = 'eairplant_up3', - --require = 'etech3', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech3]], - }, - }, - - ehbotfac = { - { - into = 'ehbotfac_up1', - --require = 'etech1', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech1]], - }, - }, - ehbotfac_up1 = { - { - into = 'ehbotfac_up2', - --require = 'etech2', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech2]], - }, - }, - ehbotfac_up2 = { - { - into = 'ehbotfac_up3', - --require = 'etech3', - time = timeToBuild_factory_up1, - cmdname = [[Evolve]], - energy = energyCost_factory_up1, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload, -5% speed]], - require = [[tech3]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - elightturret2 = { - { - into = 'elightturret2_up1', - --require = 'etech1', - time = timeToBuild_elightturret2, - cmdname = [[Evolve]], - energy = energyCost_elightturret2, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - elightturret2_up1 = { - { - into = 'elightturret2_up2', - --require = 'etech2', - time = timeToBuild_elightturret2, - cmdname = [[Evolve]], - energy = energyCost_elightturret2, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - elightturret2_up2 = { - { - into = 'elightturret2_up3', - --require = 'etech3', - time = timeToBuild_elightturret2, - cmdname = [[Evolve]], - energy = energyCost_elightturret2, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - - eheavyturret2 = { - { - into = 'eheavyturret2_up1', - --require = 'etech1', - time = timeToBuild_eheavyturret2, - cmdname = [[Evolve]], - energy = energyCost_eheavyturret2, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - eheavyturret2_up1 = { - { - into = 'eheavyturret2_up2', - --require = 'etech2', - time = timeToBuild_eheavyturret2, - cmdname = [[Evolve]], - energy = energyCost_eheavyturret2, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - eheavyturret2_up2 = { - { - into = 'eheavyturret2_up3', - --require = 'etech3', - time = timeToBuild_eheavyturret2, - cmdname = [[Evolve]], - energy = energyCost_eheavyturret2, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - - euwturret = { - { - into = 'euwturret_up1', - --require = 'etech1', - time = timeToBuild_euwturret, - cmdname = [[Evolve]], - energy = energyCost_euwturret, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - euwturret_up1 = { - { - into = 'euwturret_up2', - --require = 'etech2', - time = timeToBuild_euwturret, - cmdname = [[Evolve]], - energy = energyCost_euwturret, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - euwturret_up2 = { - { - into = 'euwturret_up3', - --require = 'etech3', - time = timeToBuild_euwturret, - cmdname = [[Evolve]], - energy = energyCost_euwturret, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - eartyturret = { - { - into = 'eartyturret_up1', - --require = 'etech1', - time = timeToBuild_eartyturret, - cmdname = [[Evolve]], - energy = energyCost_eartyturret, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, Increased AOE]], - require = [[tech3]], - }, - }, - eartyturret_up1 = { - { - into = 'eartyturret_up2', - --require = 'etech2', - time = timeToBuild_eartyturret, - cmdname = [[Evolve]], - energy = energyCost_eartyturret, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, Increased AOE]], - require = [[tech3]], - }, - }, - eartyturret_up2 = { - { - into = 'eartyturret_up3', - --require = 'etech3', - time = timeToBuild_eartyturret, - cmdname = [[Evolve]], - energy = energyCost_eartyturret, - metal = 0, - text = [[+20% damage/hp buff, +15% faster reload, Increased AOE]], - require = [[tech3]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotengineer = { - { - into = 'ehbotengineer_turret', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotpeewee = { - { - into = 'ehbotpeewee_turret', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotthud = { - { - into = 'ehbotthud_turret', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotsniper = { - { - into = 'ehbotsniper_turret', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotrocko = { - { - into = 'ehbotrocko_turret', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotkarganneth = { - { - into = 'ehbotkarganneth_turret', - time = 40, - cmdname = [[Deploy]], - energy = 400, - metal = 0, - text = 'Evolve into a stationary turret that gains 2x health.', - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_up1 = { - { - into = 'ehbotpeewee_turret_up1', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotthud_up1 = { - { - into = 'ehbotthud_turret_up1', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotsniper_up1 = { - { - into = 'ehbotsniper_turret_up1', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotrocko_up1 = { - { - into = 'ehbotrocko_turret_up1', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotkarganneth_up1 = { - { - into = 'ehbotkarganneth_turret_up1', - time = 40, - cmdname = [[Deploy]], - energy = 400, - metal = 0, - text = 'Evolve into a stationary turret that gains 2x health.', - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_up2 = { - { - into = 'ehbotpeewee_turret_up2', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotthud_up2 = { - { - into = 'ehbotthud_turret_up2', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotsniper_up2 = { - { - into = 'ehbotsniper_turret_up2', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotrocko_up2 = { - { - into = 'ehbotrocko_turret_up2', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotkarganneth_up2 = { - { - into = 'ehbotkarganneth_turret_up2', - time = 40, - cmdname = [[Deploy]], - energy = 400, - metal = 0, - text = 'Evolve into a stationary turret that gains 2x health.', - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_up3 = { - { - into = 'ehbotpeewee_turret_up3', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotthud_up3 = { - { - into = 'ehbotthud_turret_up3', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotsniper_up3 = { - { - into = 'ehbotsniper_turret_up3', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotrocko_up3 = { - { - into = 'ehbotrocko_turret_up3', - time = 12.5, - cmdname = [[Deploy]], - energy = 50, - metal = 0, - text = 'Evolve into a stationary turret that gains 4x health.', - }, - }, - ehbotkarganneth_up3 = { - { - into = 'ehbotkarganneth_turret_up3', - time = 40, - cmdname = [[Deploy]], - energy = 400, - metal = 0, - text = 'Evolve into a stationary turret that gains 2x health.', - }, - }, - - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_turret = { - { - into = 'ehbotpeewee_turret_up1', - --require = 'etech1', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - ehbotthud_turret = { - { - into = 'ehbotthud_turret_up1', - --require = 'etech1', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - ehbotsniper_turret = { - { - into = 'ehbotsniper_turret_up1', - --require = 'etech1', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - ehbotrocko_turret = { - { - into = 'ehbotrocko_turret_up1', - --require = 'etech1', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech1]], - }, - }, - ehbotkarganneth_turret = { - { - into = 'ehbotkarganneth_turret_up1', - time = 80, - cmdname = [[Evolve]], - energy = 800, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[endbringer]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_turret_up1 = { - { - into = 'ehbotpeewee_turret_up2', - --require = 'etech2', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - ehbotthud_turret_up1 = { - { - into = 'ehbotthud_turret_up2', - --require = 'etech2', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - ehbotsniper_turret_up1 = { - { - into = 'ehbotsniper_turret_up2', - --require = 'etech2', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - ehbotrocko_turret_up1 = { - { - into = 'ehbotrocko_turret_up2', - --require = 'etech2', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech2]], - }, - }, - ehbotkarganneth_turret_up1 = { - { - into = 'ehbotkarganneth_turret_up2', - time = 80, - cmdname = [[Evolve]], - energy = 800, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[endbringer]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - ehbotpeewee_turret_up2 = { - { - into = 'ehbotpeewee_turret_up3', - --require = 'etech3', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - ehbotthud_turret_up2 = { - { - into = 'ehbotthud_turret_up3', - --require = 'etech3', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - ehbotsniper_turret_up2 = { - { - into = 'ehbotsniper_turret_up3', - --require = 'etech3', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - ehbotrocko_turret_up2 = { - { - into = 'ehbotrocko_turret_up3', - --require = 'etech3', - time = 12.5, - cmdname = [[Evolve]], - energy = 50, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[tech3]], - }, - }, - ehbotkarganneth_turret_up2 = { - { - into = 'ehbotkarganneth_turret_up3', - time = 80, - cmdname = [[Evolve]], - energy = 800, - metal = 0, - text = [[+15% damage/hp buff, +15% faster reload]], - require = [[endbringer]], - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - etech1 = { - { - into = 'etech2', - time = timeToBuild_etech2, - cmdname = [[Tech 2 -Evolution]], - energy = energyCost_etech2, - metal = 0, - text = 'Evolve into a Tech Level 2 Facility.', - }, - }, - etech2 = { - { - into = 'etech3', - time = timeToBuild_etech3, - cmdname = [[Tech 3 -Evolution]], - energy = energyCost_etech3, - metal = 0, - text = 'Evolve into a Tech Level 3 Facility.', - }, - }, - ----------------------------------------------------------- ----------------------------------------------------------- - - eorb = { - { - into = 'eorb_up1', - --require = 'etech1', - time = timeToBuild_eorb, - cmdname = [[Evolve]], - energy = energyCost_eorb, - metal = 0, - text = [[+15% hp buff, 2x Buildspeed, 2x Healing Rate, Larger BuildRange/HealRange]], - require = [[tech1]], - }, - }, - eorb_up1 = { - { - into = 'eorb_up2', - --require = 'etech1', - time = timeToBuild_eorb, - cmdname = [[Evolve]], - energy = energyCost_eorb, - metal = 0, - text = [[+15% hp buff, 2x Buildspeed, 2x Healing Rate, Larger BuildRange/HealRange]], - require = [[tech2]], - }, - }, - eorb_up2 = { - { - into = 'eorb_up3', - --require = 'etech1', - time = timeToBuild_eorb, - cmdname = [[Evolve]], - energy = energyCost_eorb, - metal = 0, - text = [[+15% hp buff, 2x Buildspeed, 2x Healing Rate, Larger BuildRange/HealRange]], - require = [[tech3]], - }, - }, - -} - --- --- Here's an example of why active configuration --- scripts are better then static TDF files... --- - --- --- devolution, babe (useful for testing) --- -if (devolution) then - local devoDefs = {} - for src,data in pairs(morphDefs) do - devoDefs[data.into] = { into = src, time = 10, energy = 1, energy = 1 } - end - for src,data in pairs(devoDefs) do - morphDefs[src] = data - end -end - - -return morphDefs - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/AILoader.lua b/LuaRules/Gadgets/AILoader.lua index c1a20ea0f..59f450da4 100644 --- a/LuaRules/Gadgets/AILoader.lua +++ b/LuaRules/Gadgets/AILoader.lua @@ -4,18 +4,37 @@ function gadget:GetInfo() desc = "Shard by AF for Spring Lua", author = "eronoobos, based on gadget by raaar, and original AI by AF", date = "April 2016", - license = "whatever", + license = "GPL", layer = 999999, enabled = true, } end +local teams = Spring.GetTeamList() +for i =1, #teams do + local luaAI = Spring.GetTeamLuaAI(teams[i]) + if luaAI ~= "" then + if luaAI == "DAI" then + shardEnabled = true + end + end +end + +if shardEnabled == true then + Spring.Echo("[AI Loader] ShardLua bot Activated!") +else + Spring.Echo("[AI Loader] ShardLua bot Deactivated!") + return false +end + +local teams = Spring.GetTeamList() + -- globals ShardSpringLua = true -- this is the AI Boot gadget, so we're in Spring Lua -VFS.Include("luarules/gadgets/ai/preload/globals.lua") +VFS.Include("luarules/gadgets/ai/boot.lua") -- fake os object -os = shard_include("spring_lua/fakeos") +--os = shard_include("spring_lua/fakeos") -- missing math function function math.mod(number1, number2) @@ -23,11 +42,6 @@ function math.mod(number1, number2) end math.fmod = math.mod -shard_include("behaviourfactory") -shard_include("unit") -shard_include("module") -shard_include("modules") - -- Shard object Shard = shard_include("spring_lua/shard") Shard.AIs = {} @@ -35,7 +49,7 @@ Shard.AIsByTeamID = {} local AIs = Shard.AIs -- fake api object -api = shard_include("spring_lua/fakeapi") +--api = shard_include("spring_lua/fakeapi") -- localization local spEcho = Spring.Echo @@ -59,24 +73,27 @@ end if (gadgetHandler:IsSyncedCode()) then function gadget:Initialize() - + GG.AiHelpers.Start() local numberOfmFAITeams = 0 local teamList = spGetTeamList() + spEcho( "k9: ailoader gadget go!") for i=1,#teamList do local id = teamList[i] local _,_,_,isAI,side,allyId = spGetTeamInfo(id) - + --spEcho("Player " .. teamList[i] .. " is " .. side .. " AI=" .. tostring(isAI)) ---- adding AI + spEcho( "K9: Is AI?") if (isAI) then + spEcho( "K9: IT IS AI") local aiInfo = spGetTeamLuaAI(id) - if (string.sub(aiInfo,1,8) == "ShardLua") then + if (type(aiInfo) == "string") and (string.sub(aiInfo,1,8) == "DAI") then numberOfmFAITeams = numberOfmFAITeams + 1 - spEcho("Player " .. teamList[i] .. " is " .. aiInfo) + spEcho("Moomin Player " .. teamList[i] .. " is " .. aiInfo) -- add AI object - thisAI = VFS.Include("LuaRules/Gadgets/ai/AI.lua") + thisAI = ShardAI() thisAI.id = id thisAI.allyId = allyId -- thisAI:Init() @@ -85,6 +102,8 @@ function gadget:Initialize() else spEcho("Player " .. teamList[i] .. " is another type of lua AI!") end + else + spEcho( "K9: IS NOT AI!?") end end @@ -102,6 +121,10 @@ function gadget:Initialize() -- spEcho("AI "..thisAI.id.." : allies="..#alliedTeamIds.." enemies="..#enemyTeamIds) thisAI.alliedTeamIds = alliedTeamIds thisAI.enemyTeamIds = enemyTeamIds + thisAI.ownUnitIds = thisAI.ownUnitIds or {} + thisAI.friendlyUnitIds = thisAI.friendlyUnitIds or {} + thisAI.alliedUnitIds = thisAI.alliedUnitIds or {} + thisAI.enemyUnitIds = thisAI.enemyUnitIds or {} end -- catch up to started game @@ -115,7 +138,7 @@ function gadget:Initialize() end end -function gadget:GameStart() +function gadget:GameStart() -- Initialise AIs for _,thisAI in ipairs(AIs) do local _,_,_,isAI,side = spGetTeamInfo(thisAI.id) @@ -127,29 +150,12 @@ function gadget:GameStart() end -function gadget:GameFrame(n) +function gadget:GameFrame(n) -- for each AI... for _,thisAI in ipairs(AIs) do - + -- update sets of unit ids : own, friendlies, enemies - thisAI.ownUnitIds = {} - thisAI.friendlyUnitIds = {} - thisAI.alliedUnitIds = {} - thisAI.enemyUnitIds = {} - - for _,uId in ipairs(spGetAllUnits()) do - if (spGetUnitTeam(uId) == thisAI.id) then - thisAI.ownUnitIds[uId] = true - thisAI.friendlyUnitIds[uId] = true - elseif (thisAI.alliedTeamIds[spGetUnitTeam(uId)] or spGetUnitTeam(uId) == thisAI.id) then - thisAI.alliedUnitIds[uId] = true - thisAI.friendlyUnitIds[uId] = true - else - thisAI.enemyUnitIds[uId] = true - end - end - -- run AI game frame update handlers prepareTheAI(thisAI) thisAI:Update() @@ -157,10 +163,20 @@ function gadget:GameFrame(n) end -function gadget:UnitCreated(unitId, unitDefId, teamId, builderId) +function gadget:UnitCreated(unitId, unitDefId, teamId, builderId) -- for each AI... local unit = Shard:shardify_unit(unitId) for _,thisAI in ipairs(AIs) do + if (spGetUnitTeam(unitId) == thisAI.id) then + thisAI.ownUnitIds[unitId] = true + thisAI.friendlyUnitIds[unitId] = true + elseif (thisAI.alliedTeamIds[spGetUnitTeam(unitId)] or spGetUnitTeam(unitId) == thisAI.id) then + thisAI.alliedUnitIds[unitId] = true + thisAI.friendlyUnitIds[unitId] = true + else + thisAI.enemyUnitIds[unitId] = true + end + if Spring.GetUnitTeam(unitId) == thisAI.id then prepareTheAI(thisAI) thisAI:UnitCreated(unit) @@ -169,13 +185,17 @@ function gadget:UnitCreated(unitId, unitDefId, teamId, builderId) end end -function gadget:UnitDestroyed(unitId, unitDefId, teamId, attackerId, attackerDefId, attackerTeamId) +function gadget:UnitDestroyed(unitId, unitDefId, teamId, attackerId, attackerDefId, attackerTeamId) -- for each AI... local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) thisAI:UnitDead(unit) + thisAI.ownUnitIds[unitId] = nil + thisAI.friendlyUnitIds[unitId] = nil + thisAI.alliedUnitIds[unitId] = nil + thisAI.enemyUnitIds[unitId] = nil -- thisAI:UnitDestroyed(unitId, unitDefId, teamId, attackerId, attackerDefId, attackerTeamId) end Shard:unshardify_unit(self.engineUnit) @@ -193,11 +213,11 @@ function gadget:UnitDamaged(unitId, unitDefId, unitTeamId, damage, paralyzer, we prepareTheAI(thisAI) thisAI:UnitDamaged(unit, attackerUnit, damageObj) -- thisAI:UnitDamaged(unitId, unitDefId, unitTeamId, attackerId, attackerDefId, attackerTeamId) - end + end end end -function gadget:UnitIdle(unitId, unitDefId, teamId) +function gadget:UnitIdle(unitId, unitDefId, teamId) -- for each AI... local unit = Shard:shardify_unit(unitId) if unit then @@ -210,7 +230,7 @@ function gadget:UnitIdle(unitId, unitDefId, teamId) end -function gadget:UnitFinished(unitId, unitDefId, teamId) +function gadget:UnitFinished(unitId, unitDefId, teamId) -- for each AI... local unit = Shard:shardify_unit(unitId) if unit then @@ -222,18 +242,18 @@ function gadget:UnitFinished(unitId, unitDefId, teamId) end end -function gadget:UnitTaken(unitId, unitDefId, teamId, newTeamId) +function gadget:UnitTaken(unitId, unitDefId, teamId, newTeamId) local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) -- thisAI:UnitTaken(unitId, unitDefId, teamId, newTeamId) - -- thisAI:UnitDead(unit) + thisAI:UnitDead(unit) end end end -function gadget:UnitGiven(unitId, unitDefId, teamId, oldTeamId) +function gadget:UnitGiven(unitId, unitDefId, teamId, oldTeamId) local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do @@ -266,10 +286,23 @@ end --UNSYNCED CODE else + function gadget:Initialize() + Spring.Echo("Shard AI unsync gadget init") + gadgetHandler:AddSyncAction("shard_debug_position", handleShardDebugPosEvent) + end + function gadget:Shutdown() + Spring.Echo("Shard AI unsync gadget shutdown") + gadgetHandler:RemoveSyncAction("shard_debug_position") + end - + function handleShardDebugPosEvent(_,x,z,col) + -- Spring.Echo("handleShardDebugPosEvent 1") + if Script.LuaUI("shard_debug_position") then + Spring.Echo("handleShardDebugPosEvent 2") + Script.LuaUI.shard_debug_position(x,z,col) + Spring.Echo("handleShardDebugPosEvent 3") + end + end end - - diff --git a/LuaRules/Gadgets/GRTS_repair.locals.lua b/LuaRules/Gadgets/GRTS_repair.locals.lua index a1e41b3ca..a9d68122d 100644 --- a/LuaRules/Gadgets/GRTS_repair.locals.lua +++ b/LuaRules/Gadgets/GRTS_repair.locals.lua @@ -14,7 +14,7 @@ local spGetUnitHealth = Spring.GetUnitHealth local spGetUnitHeight = Spring.GetUnitHeight local spGetUnitPosition = Spring.GetUnitPosition local spGetUnitTeam = Spring.GetUnitTeam -local spGetUnitsInSphere = Spring.GetUnitsInSphere +local spGetUnitsInCylinder = Spring.GetUnitsInCylinder local spSetUnitHealth = Spring.SetUnitHealth -------------------------------------------------------------------------------- @@ -33,13 +33,19 @@ function gadget:GetInfo() end local repairUnits= { - [UnitDefNames.eorb.id] = {radius=500,strength=1.0}, - [UnitDefNames.eorb_up1.id] = {radius=650,strength=2.0}, - [UnitDefNames.eorb_up2.id] = {radius=800,strength=3.0}, + [UnitDefNames.eorb.id] = {radius=1000,strength=1.0}, + [UnitDefNames.eorb_up1.id] = {radius=1000,strength=2.0}, + [UnitDefNames.eorb_up2.id] = {radius=1000,strength=3.0}, [UnitDefNames.eorb_up3.id] = {radius=1000,strength=4.0}, [UnitDefNames.ehbotengineer_turret.id] = {radius=1000,strength=2.0}, - [UnitDefNames.ecommander.id] = {radius=300,strength=4.0}, - [UnitDefNames.ecommanderbattleai.id] = {radius=1000,strength=10.0}, + [UnitDefNames.ecommanderhealer.id] = {radius=1000,strength=10.0}, + [UnitDefNames.ecommanderbattleai.id] = {radius=1000,strength=5.0}, + [UnitDefNames.ecommanderhealerai.id] = {radius=1000,strength=50.0}, + [UnitDefNames.ecommandershieldai.id] = {radius=1000,strength=10.0}, + [UnitDefNames.ecommandercloakai.id] = {radius=1000,strength=10.0}, + [UnitDefNames.ecommanderbuildai.id] = {radius=1000,strength=20.0}, + [UnitDefNames.ecommanderfactoryai.id] = {radius=1000,strength=20.0}, + [UnitDefNames.zarm.id] = {radius=1000,strength=10.0}, } local delayAfterHit=150 --Frames after a hit that no repairs will take place in @@ -62,7 +68,7 @@ local GetGameFrame=spGetGameFrame local GetUnitPosition=spGetUnitPosition local GetUnitTeam=spGetUnitTeam local GetUnitAllyTeam=spGetUnitAllyTeam -local GetUnitsInSphere=spGetUnitsInSphere +local GetUnitsInCylinder=spGetUnitsInCylinder local GetUnitHealth = spGetUnitHealth local SetUnitHealth = spSetUnitHealth local GetUnitDefID = spGetUnitDefID @@ -116,7 +122,7 @@ function gadget:GameFrame(f) local held = d.holding local strength = d.strength - for uis,t in ipairs(GetUnitsInSphere(x,y,z,d.radius)) do + for uis,t in ipairs(GetUnitsInCylinder(x,z,d.radius)) do local ud = GetUnitDefID(t) if t ~= held and t ~= u then @@ -135,7 +141,7 @@ function gadget:GameFrame(f) if x then local h = spGetUnitHeight(t) Spring.SpawnCEG("heal", x, y+h, z) - Spring.PlaySoundFile("sounds/miscfx/heal.wav", 0.2, x, y, z) + -- Spring.PlaySoundFile("sounds/miscfx/heal.wav", 0.2, x, y, z) -- Spring.AddTeamResource(UnitTeam,"e",-5) end end diff --git a/LuaRules/Gadgets/GreenBean_sell.locals.lua b/LuaRules/Gadgets/GreenBean_sell.locals.lua index 4cfb5f55b..377acdce6 100644 --- a/LuaRules/Gadgets/GreenBean_sell.locals.lua +++ b/LuaRules/Gadgets/GreenBean_sell.locals.lua @@ -27,7 +27,7 @@ function gadget:GetInfo() date = "2008-06-12", license = "Public Domain", layer = 300, - enabled = true + enabled = false } end diff --git a/LuaRules/Gadgets/activity_broadcast.lua b/LuaRules/Gadgets/activity_broadcast.lua new file mode 100644 index 000000000..6c9c9ee8c --- /dev/null +++ b/LuaRules/Gadgets/activity_broadcast.lua @@ -0,0 +1,108 @@ + +function gadget:GetInfo() + return { + name = "Activity Broadcast", + desc = "Checks if there is keyboard/mouse activity or camera changes", + author = "Floris", + date = "July,2016", + layer = 0, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-- config +-------------------------------------------------------------------------------- + +local sendPacketEvery = 2 + +-------------------------------------------------------------------------------- +-- synced +-------------------------------------------------------------------------------- +if gadgetHandler:IsSyncedCode() then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + + local validation = randomString(2) + _G.validationActivity = validation + + function gadget:RecvLuaMsg(msg, playerID) + if msg:sub(1,1)=="^" and msg:sub(2,3)==validation then + SendToUnsynced("activityBroadcast",playerID) + return true + end + end + +else + -------------------------------------------------------------------------------- + -- unsynced + -------------------------------------------------------------------------------- + + local GetMouseState = Spring.GetMouseState + local GetLastUpdateSeconds = Spring.GetLastUpdateSeconds + local SendLuaRulesMsg = Spring.SendLuaRulesMsg + local GetCameraState = Spring.GetCameraState + + local activity = false + local old_mx,old_my = 0,0 + local updateTimer = 0 + local prevCameraState = GetCameraState() + local validation = SYNCED.validationActivity + + function gadget:Initialize() + gadgetHandler:AddSyncAction("activityBroadcast", handleActivityEvent) + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("activityBroadcast") + end + + function handleActivityEvent(_,playerID) + if Script.LuaUI("ActivityEvent") then + Script.LuaUI.ActivityEvent(playerID) + end + end + + function gadget:Update() + updateTimer = updateTimer + GetLastUpdateSeconds() + if updateTimer > sendPacketEvery then + -- mouse + local mx,my = GetMouseState() + if mx ~= old_mx or my ~= old_my then + old_mx,old_my = mx,my + activity = true + end + -- camera + local cameraState = GetCameraState() + if not activity then + for i,stateindex in pairs(cameraState) do + if stateindex ~= prevCameraState[i] then + activity = true + break + end + end + end + prevCameraState = cameraState + + if activity then + SendLuaRulesMsg("^"..validation) + end + activity = false + updateTimer = 0 + end + end + + function gadget:KeyPress(key, mods, isRepeat) + activity = true + end + +end + diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/attackerbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackerbehaviour.lua new file mode 100644 index 000000000..661697139 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackerbehaviour.lua @@ -0,0 +1,167 @@ +shard_include( "attackers" ) + +local SpGetUnitNearestEnemy = Spring.GetUnitNearestEnemy + +function IsAttacker(unit) + for i,name in ipairs(attackerlist) do + if name == unit:Internal():Name() then + return true + end + end + return false +end + +AttackerBehaviour = class(Behaviour) + +function AttackerBehaviour:Init() + --self.ai.game:SendToConsole("attacker!") + --self.game:AddMarker({ x = startPosx, y = startPosy, z = startPosz }, "my start position") + CMD.MOVE_STATE = 50 +end + +function AttackerBehaviour:Update() + local unitID = self.unit:Internal().id + -- Spring.Echo(unitID) + local myRange = Spring.GetUnitMaxRange(unitID) + local closestUnit = Spring.GetUnitNearestEnemy(unitID, myRange) + local allyTeamID = self.ai.allyId + if Spring.GetGameFrame() % 15 == 4 then + if closestUnit and (Spring.IsUnitInLos(closestUnit, allyTeamID)) then + local enemyRange = Spring.GetUnitMaxRange(closestUnit) + if myRange > enemyRange then + local ex,ey,ez = Spring.GetUnitPosition(closestUnit) + local ux,uy,uz = Spring.GetUnitPosition(unitID) + local pointDis = Spring.GetUnitSeparation(unitID,closestUnit) + local dis = 120 + local f = dis/pointDis + if (pointDis+dis > Spring.GetUnitMaxRange(unitID)) then + f = (Spring.GetUnitMaxRange(unitID)-pointDis)/pointDis + end + local cx = ux+(ux-ex)*f + local cy = uy + local cz = uz+(uz-ez)*f + self.unit:Internal():ExecuteCustomCommand(CMD.MOVE, {cx, cy, cz}) + end + end + end +end + +function AttackerBehaviour:OwnerBuilt() + self.ai.attackhandler:AddRecruit(self) + self.unit:Internal():ExecuteCustomCommand(CMD.MOVE_STATE, { 2 }, {}) + self.attacking = true + self.active = true +end + + +function AttackerBehaviour:OwnerDead() + self.ai.attackhandler:RemoveRecruit(self) +end + +function AttackerBehaviour:OwnerIdle() + self.attacking = true + self.active = true + self.ai.attackhandler:AddRecruit(self) +end + +function AttackerBehaviour:AttackCell(cell) + local unit = self.unit:Internal() + local unitID = unit.id + local teamID = ai.id + local r = math.random(0,1000) + if r == 0 then + local ec = Spring.GetTeamResources(ai.id, "energy") + if ec > 100 then + Spring.GiveOrderToUnit(unitID, 31337, {}, {}) + end + end + --attack + if unitID%60 == Spring.GetGameFrame()%60 then + local currenthealth = unit:GetHealth() + local maxhealth = unit:GetMaxHealth() + local startPosx, startPosy, startPosz = Spring.GetTeamStartPosition(self.ai.id) + local startBoxMinX, startBoxMinZ, startBoxMaxX, startBoxMaxZ = Spring.GetAllyTeamStartBox(self.ai.allyId) + local ec, es = Spring.GetTeamResources(ai.id, "energy") + local closestUnit = Spring.GetUnitNearestEnemy(unitID, 50000, false) + local ex,ey,ez = Spring.GetUnitPosition(closestUnit) + local enemyDis = Spring.GetUnitSeparation(unitID,closestUnit) + if (currenthealth >= maxhealth or currenthealth > 3000) and closestUnit then + if enemyDis < 1500 then + Spring.GiveOrderToUnit(unitID, CMD.CLOAK, { 1 }, {}) + else + Spring.GiveOrderToUnit(unitID, CMD.CLOAK, { 0 }, {}) + end + + p = api.Position() + p.x = ex + p.z = ez + p.y = ey + self.target = p + self.attacking = true + self.ai.attackhandler:AddRecruit(self) + if self.active then + self.unit:Internal():MoveAndFire(self.target) + else + self.unit:ElectBehaviour() + end + --retreat + else + local nanotcx, nanotcy, nanotcz = GG.GetClosestNanoTC(unitID) + if enemyDis < 1500 then + Spring.GiveOrderToUnit(unitID, CMD.CLOAK, { 1 }, {}) + else + Spring.GiveOrderToUnit(unitID, CMD.CLOAK, { 0 }, {}) + end + if nanotcx and nanotcy and nanotcz then + p = api.Position() + p.x, p.y, p.z = nanotcx, nanotcy, nanotcz + elseif startBoxMinX == 0 and startBoxMinZ == 0 and startBoxMaxZ == Game.mapSizeZ and startBoxMaxX == Game.mapSizeX then + p = api.Position() + p.x = startPosx + p.z = startPosz + p.y = 0 + else + p = api.Position() + p.x = math.random(startBoxMinX, startBoxMaxX) + p.z = math.random(startBoxMinZ, startBoxMaxZ) + p.y = 0 + end + + self.target = p + self.attacking = false + self.ai.attackhandler:AddRecruit(self) + if self.active then + self.unit:Internal():Move(self.target) + else + self.unit:ElectBehaviour() + end + end + end +end + +function AttackerBehaviour:Priority() + if not self.attacking then + return 0 + else + return 100 + end +end + +function AttackerBehaviour:Activate() + self.active = true + if self.target then + self.unit:Internal():MoveAndFire(self.target) + self.target = nil + self.ai.attackhandler:AddRecruit(self) + else + self.ai.attackhandler:AddRecruit(self) + end +end + + +function AttackerBehaviour:OwnerDied() + self.ai.attackhandler:RemoveRecruit(self) + self.attacking = nil + self.active = nil + self.unit = nil +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/attackers.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackers.lua new file mode 100644 index 000000000..fb7e301b1 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackers.lua @@ -0,0 +1,253 @@ +--[[ +Attackers! +]]-- + +attackerlist = { + ------------- Morphs + ---Buildings, just to make them upgrade + "emetalextractor", + "emetalextractor_up1", + "emetalextractor_up2", + "etech1", + "etech2", + ---Amphibs + "eamphibriot_shotgun", + "eamphibriot_shotgun_up1", + "eamphibriot_shotgun_up2", + "eamphibriot_shotgun_up3", + ---AllTerr + "eallterrriot_shotgun", + "eallterrriot_shotgun_up1", + "eallterrriot_shotgun_up2", + "eallterrriot_shotgun_up3", + ---Hbots + "ehbotpeewee_turret", + "ehbotpeewee_turret_up1", + "ehbotpeewee_turret_up2", + "ehbotpeewee_turret_up3", + "ehbotrocko_turret", + "ehbotrocko_turret_up1", + "ehbotrocko_turret_up2", + "ehbotrocko_turret_up3", + "ehbotsniper_turret", + "ehbotsniper_turret_up1", + "ehbotsniper_turret_up2", + "ehbotsniper_turret_up3", + "ehbotthud_turret", + "ehbotthud_turret_up1", + "ehbotthud_turret_up2", + "ehbotthud_turret_up3", + "ehbotkarganneth_turret", + "ehbotkarganneth_turret_up1", + "ehbotkarganneth_turret_up2", + "ehbotkarganneth_turret_up3", + ---Hover + "eriottank2_shotgun", + "eriottank2_shotgun_up1", + "eriottank2_shotgun_up2", + "eriottank2_shotgun_up3", + "eartytank_saturation", + "eartytank_saturation_up1", + "eartytank_saturation_up2", + "eartytank_saturation_up3", + + ------------- Endbringers + "eallterranarchid", + "eallterranarchid_up1", + "eallterranarchid_up2", + "eallterranarchid_up3", + "eamphibleveler", + "eamphibleveler_up1", + "eamphibleveler_up2", + "eamphibleveler_up3", + "elacerator", + "elacerator_up1", + "elacerator_up2", + "elacerator_up3", + "ekrow", + "ekrow_up1", + "ekrow_up2", + "ekrow_up3", + "ehbotkarganneth", + "ehbotkarganneth_up1", + "ehbotkarganneth_up2", + "ehbotkarganneth_up3", + + ------------- Basic + "escoutdrone", + "eairemp", + "eraider", + "edrone", + "elighttank3", + "eamphibbuggy", + "eallterrlight", + "efighter", + "ebomber", + "egunship2", + "emissiletank", + "eartytank", + "eamphibrock", + "eamphibarty", + "eamphibneedle", + "emediumtank3", + "eheavytank3", + "eamphibmedtank", + "eallterrmed", + "eallterrheavy", + "eallterrassault", + "eriottank2", + "eamphibriot", + "eallterrriot", + "edrone", + "ehbotpeewee", + "ehbotrocko", + "ehbotsniper", + "ehbotthud", + "ebox", + "eorbai", + "eaimexer", + "escout", + "eallterrshield", + + -------------- Upgrade 1 + "eraider_up1", + "eairemp_up1", + "edrone_up1", + "elighttank3_up1", + "eamphibbuggy_up1", + "eallterrlight_up1", + "efighter_up1", + "ebomber_up1", + "egunship2_up1", + "emissiletank_up1", + "eartytank_up1", + "eamphibrock_up1", + "eamphibarty_up1", + "eamphibneedle_up1", + "emediumtank3_up1", + "eheavytank3_up1", + "eamphibmedtank_up1", + "eallterrmed_up1", + "eallterrheavy_up1", + "eallterrassault_up1", + "eriottank2_up1", + "eamphibriot_up1", + "eallterrriot_up1", + "ehbotpeewee_up1", + "ehbotrocko_up1", + "ehbotsniper_up1", + "ehbotthud_up1", + "escout_up1", + "eallterrshield_up1", + + --------------- Upgrade 2 + "eraider_up2", + "eairemp_up2", + "edrone_up2", + "elighttank3_up2", + "eamphibbuggy_up2", + "eallterrlight_up2", + "efighter_up2", + "ebomber_up2", + "egunship2_up2", + "emissiletank_up2", + "eartytank_up2", + "eamphibrock_up2", + "eamphibarty_up2", + "eamphibneedle_up2", + "emediumtank3_up2", + "eheavytank3_up2", + "eamphibmedtank_up2", + "eallterrmed_up2", + "eallterrheavy_up2", + "eallterrassault_up2", + "eriottank2_up2", + "eamphibriot_up2", + "eallterrriot_up2", + "ehbotpeewee_up2", + "ehbotrocko_up2", + "ehbotsniper_up2", + "ehbotthud_up2", + "escout_up2", + "eallterrshield_up2", + + ----------------------------- Upgrade 3 + "eraider_up3", + "eairemp_up3", + "edrone_up3", + "elighttank3_up3", + "eamphibbuggy_up3", + "eallterrlight_up3", + "efighter_up3", + "ebomber_up3", + "egunship2_up3", + "emissiletank_up3", + "eartytank_up3", + "eamphibrock_up3", + "eamphibarty_up3", + "eamphibneedle_up3", + "emediumtank3_up3", + "eheavytank3_up3", + "eamphibmedtank_up3", + "eallterrmed_up3", + "eallterrheavy_up3", + "eallterrassault_up3", + "eriottank2_up3", + "eamphibriot_up3", + "eallterrriot_up3", + "ehbotpeewee_up3", + "ehbotrocko_up3", + "ehbotsniper_up3", + "ehbotthud_up3", + "escout_up3", + "eallterrshield_up3", + + ---------------------------- Chickens + "chicken_dodo1", + "chicken_dodo2", + "chicken1", + "chicken1b", + "chicken1c", + "chicken1x", + "chicken1y", + "chicken1z", + "chicken2", + "chicken2b", + "chickena1", + "chickena1b", + "chickena1c", + "chickena2", + "chickena2b", + "chickenc1", + "chickenc2", + "chickenc3", + "chickenc3b", + "chickenc3c", + "chickenf1", + "chickenf1b", + "chickenh1", + "chickenh1b", + "chickenh2", + "chickenh3", + "chickenh4", + "chickenh5", + "chickenp1", + "chickenr1", + "chickenr2", + "chickenr3", + "chickens1", + "chickens2", + "chickens3", + "chickenw1", + "chickenw1b", + "chickenw1c", + "chickenw1d", + "chickenw2", + "e_chickenq", + "epic_chickenq", + "h_chickenq", + "n_chickenq", + "ve_chickenq", + "vh_chickenq", + "roost", +} diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/attackhandler.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackhandler.lua new file mode 100644 index 000000000..d20a82abf --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/attackhandler.lua @@ -0,0 +1,183 @@ +AttackHandler = class(Module) + +function AttackHandler:Name() + return "AttackHandler" +end + +function AttackHandler:internalName() + return "attackhandler" +end + +function AttackHandler:Init() + self.recruits = {} + self.counter = 1 +end + +function AttackHandler:Update() +-- stagger targetting if multiple shards are in the game + local f = self.game:Frame() + self.game:GetTeamID() + if math.mod(f,1) == 0 then + self:DoTargetting() + end +end + +function AttackHandler:UnitDead(engineunit) + if engineunit:Team() == self.game:GetTeamID() then + --self.counter = self.counter - 0.2 + --self.counter = math.max(self.counter,8) + -- try and clean up dead recruits where possible + for i,v in ipairs(self.recruits) do + if v.engineID == engineunit:ID() then + table.remove(self.recruits,i) + break + end + end + end +end + +function AttackHandler:DoTargetting() + if #self.recruits > self.counter then + for i,recruit in ipairs(self.recruits) do + recruit:AttackCell(bestCell) + end + --[[ try and catch invalid recruits and remove them, then reevaluate + local nrecruits = {} + for i,v in ipairs(self.recruits) do + if v.unit ~= nil then + table.insert(nrecruits,v) + break + end + end + self.recruits = nrecruits + if #nrecruits > self.counter then + + else + return + end + + -- find somewhere to attack + local cells = {} + local celllist = {} + local mapdimensions = self.game.map:MapDimensions() + --enemies = game:GetEnemies() + local enemies = self.game:GetEnemies() + + if enemies and #enemies > 0 then + -- figure out where all the enemies are! + for i=1,#enemies do + local e = enemies[i] + + if e ~= nil then + pos = e:GetPosition() + px = pos.x - math.fmod(pos.x,400) + pz = pos.z - math.fmod(pos.z,400) + px = px/400 + pz = pz/400 + if cells[px] == nil then + cells[px] = {} + end + if cells[px][pz] == nil then + local newcell = { count = 0, posx = 0,posz=0,} + cells[px][pz] = newcell + table.insert(celllist,newcell) + end + cell = cells[px][pz] + cell.count = cell.count + self:ScoreUnit(e) + + -- we dont want to target the center of the cell encase its a ledge with nothing + -- on it etc so target this units position instead + cell.posx = pos.x + cell.posz = pos.z + + -- @TODO: The unit chosen may not be the best unit to target, ideally pick the + -- one closest to the average location of all units in that grid + end + + end + + local bestCell = nil + -- now find the smallest nonvacant cell to go lynch! + for i=1,#celllist do + local cell = celllist[i] + if bestCell == nil then + bestCell = cell + else + if cell.count < bestCell.count then + bestCell = cell + end + end + end + + -- if we have a cell then lets go attack it! + if bestCell ~= nil then + for i,recruit in ipairs(self.recruits) do + recruit:AttackCell(bestCell) + end + + --self.counter = self.counter + 0.2 + --self.counter = math.min(self.counter,20) + + -- remove all our recruits! + --self.recruits = {} + end + end + ]]-- + -- cleanup + cellist = nil + cells = nil + mapdimensions = nil + + end + +end + +function AttackHandler:IsRecruit(attkbehaviour) + for i,v in ipairs(self.recruits) do + if v.engineID == attkbehaviour.engineID then + return true + end + end + return false +end + +function AttackHandler:AddRecruit(attkbehaviour) + if attkbehaviour.unit == nil then + self.game:SendToConsole( "null unit in attack beh found ") + return + end + if not self:IsRecruit(attkbehaviour) then + table.insert(self.recruits,attkbehaviour) + end +end + +function AttackHandler:RemoveRecruit(attkbehaviour) + for i,v in ipairs(self.recruits) do + if v.engineID == attkbehaviour.engineID then + table.remove(self.recruits,i) + return true + end + end + return false +end + +-- How much is this unit worth? +-- +-- Idea: add a table with hardcoded values, +-- and use said values if a units found in +-- that table to highlight strategic value +function AttackHandler:ScoreUnit(unit) + local value = 1 + --[[ + if unit:CanMove() then + if unit:CanBuild() then + value = value + 1 + end + else + value = value + 2 + if unit:CanBuild() then + value = value + 2 + end + end + --]] + return value +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/autoreclaimbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/autoreclaimbehaviour.lua similarity index 79% rename from LuaRules/Gadgets/ai/EvoRTS/autoreclaimbehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/autoreclaimbehaviour.lua index 496df6a4e..566f37476 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/autoreclaimbehaviour.lua +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/autoreclaimbehaviour.lua @@ -18,12 +18,12 @@ function AutoReclaimBehaviour:UnitIdle(unit) end function AutoReclaimBehaviour:Update() - --game:GetMapFeatures() + --self.game:GetMapFeatures() end function AutoReclaimBehaviour:Activate() self.active = true - local fcount = game.map:GetMapFeatures(self.unit:Internal():GetPosition(),200) + local fcount = self.game.map:GetMapFeatures(self.unit:Internal():GetPosition(),200) self.unit:Internal():AreaReclaim(self.unit:Internal():GetPosition(),500) end @@ -36,7 +36,7 @@ function AutoReclaimBehaviour:Priority() -- return 100 --end --return 0 - return 49 + game.map:GetMapFeatures(self.unit:Internal():GetPosition(),500) + return 49 + self.game.map:GetMapFeatures(self.unit:Internal():GetPosition(),500) end function AutoReclaimBehaviour:UnitDead(unit) diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/behaviours.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/behaviours.lua new file mode 100644 index 000000000..138a84cd9 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/behaviours.lua @@ -0,0 +1,127 @@ + +controlPoints = Spring.GetModOptions().scoremode + +if controlPoints == nil then + controlPoints = "disabled" +end + +if controlPoints == "disabled" then + shard_include( "taskqueues" ) + shard_include( "taskqueuebehaviour" ) + shard_include( "attackerbehaviour" ) + shard_include( "bootbehaviour" ) + --shard_include( "morphbehaviour" ) + --shard_include( "engineerturretbehaviour" ) + else + shard_include( "taskqueues" ) + shard_include( "taskqueuebehaviour" ) + shard_include( "attackerbehaviour" ) + shard_include( "bootbehaviour" ) + shard_include( "capturerbehaviour" ) + --shard_include( "morphbehaviour" ) + --shard_include( "engineerturretbehaviour" ) +end + +--shard_include "capturerbehaviour" +--require "missingfactorybehaviour" +--require "autoreclaimbehaviour" +--shard_include "lowenergybehaviour" +--require "factoryregisterbehaviour" + +behaviours = { + eorb = { + TaskQueueBehaviour, + }, + eorb_up1 = { + TaskQueueBehaviour, + }, + eorb_up2 = { + TaskQueueBehaviour, + }, + eorb_up3 = { + TaskQueueBehaviour, + }, + ebasefactory = { + TaskQueueBehaviour, + --FactoryRegisterBehaviour, + }, + eairplant = { + TaskQueueBehaviour, + --FactoryRegisterBehaviour, + }, + eamphibfac = { + TaskQueueBehaviour, + --FactoryRegisterBehaviour, + }, + eminifac = { + TaskQueueBehaviour, + --FactoryRegisterBehaviour, + }, + ecommanderbattleai = { + TaskQueueBehaviour, + --LowEnergyBehaviour, + --EngineerTurretBehaviour, + }, + eengineer5 = { + TaskQueueBehaviour, + --MissingFactoryBehaviour, + --EngineerTurretBehaviour, + --LowEnergyBehaviour, + }, + eamphibengineer = { + TaskQueueBehaviour, + --MissingFactoryBehaviour, + --EngineerTurretBehaviour, + --LowEnergyBehaviour, + }, + eairengineer = { + TaskQueueBehaviour, + --MissingFactoryBehaviour, + --EngineerTurretBehaviour, + --LowEnergyBehaviour, + }, + eallterrengineer = { + TaskQueueBehaviour, + --MissingFactoryBehaviour, + --EngineerTurretBehaviour, + --LowEnergyBehaviour, + }, + --eaimexer = { + --EngineerTurretBehaviour, + --}, +} + +function defaultBehaviours(unit) + b = {} + + u = unit:Internal() + --table.insert(b,MorphBehaviour) + if u:CanBuild() then + table.insert(b,TaskQueueBehaviour) + if u:CanMove() then + local utype = game:GetTypeByName("ebasefactory") + if u:CanBuild(utype) then + table.insert(b,MissingFactoryBehaviour) + end + utype = game:GetTypeByName("elightturret2") + if u:CanBuild(utype) then + table.insert(b,EngineerTurretBehaviour) + end + end + else + if controlPoints == "disabled" then + if IsAttacker(unit) then + table.insert(b,AttackerBehaviour) + end + else + if IsAttacker(unit) then + table.insert(b,AttackerBehaviour) + end + if IsCapturer(unit) then + table.insert(b,CapturerBehaviour) + end + end + end + + return b +end diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/capturerbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/capturerbehaviour.lua new file mode 100644 index 000000000..91d11b0d3 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/capturerbehaviour.lua @@ -0,0 +1,76 @@ +function IsCapturer(unit) + local noncapturelist = {} + if ShardSpringLua then + if Script.LuaRules('NonCapturingUnits') then + noncapturelist = Script.LuaRules.NonCapturingUnits() or {} + end + end + for i = 1, #noncapturelist do + local name = noncapturelist[i] + if name == unit:Internal():Name() then + return false + end + end + return true +end + +CapturerBehaviour = class(Behaviour) + +local function RandomAway(pos, dist, angle) + angle = angle or math.random() * math.pi * 2 + local away = api.Position() + away.x = pos.x + dist * math.cos(angle) + away.z = pos.z - dist * math.sin(angle) + away.y = pos.y + 0 + return away +end + +function CapturerBehaviour:Init() + self.arePoints = self.ai.controlpointhandler:ArePoints() + if self.ai.controlpointhandler:CaptureRadius() == nil then + return false + end + self.maxDist = math.ceil( self.ai.controlpointhandler:CaptureRadius() * 0.9 ) + self.minDist = math.ceil( self.maxDist / 3 ) +end + +function CapturerBehaviour:UnitIdle(unit) + if not self.active then return end + if unit.engineID == self.unit.engineID then + self:GoForth() + end +end + +function CapturerBehaviour:Update() + if not self.active then return end + if not self.nextCheck or self.game:Frame() == self.nextCheck then + self:GoForth() + end +end + +function CapturerBehaviour:Priority() + if self.arePoints then + return 40 + else + return 0 + end +end + +function CapturerBehaviour:Activate() + self.active = true +end + +function CapturerBehaviour:Deactivate() + self.active = false +end + +function CapturerBehaviour:GoForth() + local upos = self.unit:Internal():GetPosition() + local point = self.ai.controlpointhandler:ClosestUncapturedPoint(upos) + if point and point ~= self.currentPoint then + local movePos = RandomAway( point, math.random(self.minDist,self.maxDist) ) + self.unit:Internal():Move(movePos) + self.currentPoint = point + end + self.nextCheck = self.game:Frame() + math.random(60, 90) +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/engineerturretbehaviour.lua similarity index 89% rename from LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/engineerturretbehaviour.lua index fda75a841..35fbc4bbc 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/engineerturretbehaviour.lua @@ -25,7 +25,7 @@ end function EngineerTurretBehaviour:Activate() self.underfire = false - local s = self.unit:Internal():Build("emetalextractor") + local s = self.unit:Internal():Build("emine") if s then self.active = true else @@ -36,7 +36,7 @@ end function EngineerTurretBehaviour:Deactivate() self.underfire = false - local s = self.unit:Internal():Build("emetalextractor") + local s = self.unit:Internal():Build("emine") if s then self.active = true else @@ -46,7 +46,7 @@ end function EngineerTurretBehaviour:Priority() if self.underfire == true then - return 110 + return 150 end return 0 end diff --git a/LuaRules/Gadgets/ai/EvoRTS/factoryregisterbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/factoryregisterbehaviour.lua similarity index 100% rename from LuaRules/Gadgets/ai/EvoRTS/factoryregisterbehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/factoryregisterbehaviour.lua diff --git a/LuaRules/Gadgets/ai/EvoRTS/lowenergybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/lowenergybehaviour.lua similarity index 100% rename from LuaRules/Gadgets/ai/EvoRTS/lowenergybehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/lowenergybehaviour.lua diff --git a/LuaRules/Gadgets/ai/EvoRTS/missingfactorybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/missingfactorybehaviour.lua similarity index 100% rename from LuaRules/Gadgets/ai/EvoRTS/missingfactorybehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/missingfactorybehaviour.lua diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/modules.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/modules.lua new file mode 100644 index 000000000..9494de96b --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/modules.lua @@ -0,0 +1,35 @@ + +controlPoints = Spring.GetModOptions().scoremode + +if controlPoints == nil then + controlPoints = "disabled" +end + +if controlPoints == "disabled" then + shard_include( "spothandler" ) + shard_include( "unithandler" ) + shard_include( "attackhandler" ) + shard_include( "placementhandler" ) + shard_include( "sleep" ) + + modules = { UnitHandler, AttackHandler, MetalSpotHandler, PlacementHandler, Sleep } +else + shard_include( "spothandler" ) + shard_include( "controlpointhandler" ) + shard_include( "unithandler" ) + shard_include( "attackhandler" ) + shard_include( "placementhandler" ) + shard_include( "sleep" ) + + modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, PlacementHandler, Sleep } +end + + +--shard_include( "spothandler" ) +--shard_include( "controlpointhandler" ) +--shard_include( "unithandler" ) +--shard_include( "attackhandler" ) +--shard_include( "sleep" ) + +--modules = { UnitHandler, AttackHandler, MetalSpotHandler, Sleep } +--modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, Sleep } diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/placementhandler.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/placementhandler.lua new file mode 100644 index 000000000..db85fd6c3 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/placementhandler.lua @@ -0,0 +1,300 @@ +PlacementHandler = class(Module) + +function PlacementHandler:Name() + return "PlacementHandler" +end + +function PlacementHandler:internalName() + return "placementhandler" +end + +function PlacementHandler:Init() + self.jobs = {} + self.spacing_spiral = self:GenerateSpiral( 5, 5 ) +end + +--[[ +Usage: + +function onSuccess( job, pos ) + -- build something I guess +end +function onFail( job ) + -- nowhere to place it, do something else then? +end +local unittype = ... +local job = { + start_position=[1,2,3], + max_radius=500, + onSuccess=onSuccess, + onFail=onFail, + unittype=unittype, + cleanup_on_unit_death=builderID +} +local success = ai.placementhandler.NewJob( job ) +if success then + -- the job has been schedule, do whatever else we need to do in parallel + -- when a position has been found, it will call the callback function we passed it + -- in the future a promise will be returned letting us define what happens +else + -- there was something wrong with our job and the system rejected it + -- the programmer should probably check all the values that went into the job were set and valid +end + +]] + + +function PlacementHandler:NewJob( details ) + --[[ + local default = { + start_position, + unittype, + placement_tests: [], + max_radius=, + onSuccess=onSuccess, + onFail=onFail, + increment=8 + cleanup_on_unit_death + } + ]]-- + if details["start_position"] == nil then + return false + end + if details["unittype"] == nil then + return false + end + if details["max_radius"] == nil then + details.max_radius = 1500 + end + if details["increment"] == nil then + details.increment = 16 + end + if details.increment < 16 then + details.increment = 16 + end + details.status = 'new' + details.step = 1 + + -- figure out the spiral search pattern necessary + local max_width = details.max_radius * 2 + local spiral_width = max_width/details.increment + details.spiral = self:GenerateSpiral(spiral_width, spiral_width ) + + table.insert( self.jobs, details ) + + -- for now it's using a completion handler, which is a function + -- passed along that it will call when it's finished, but tbh I'd + -- prefer to return some sort of promise structure + return true +end + + +function PlacementHandler:Update() + --[[ + + We need to run through our jobs, but we also need to make sure of several things: + + - when a placement job finishes, we stop processing until the next frame + - that each job only gets a limited amount of time to run + - that the algorithm can run bit by bit over several frames + + To this end, each iteration of the search is self contained. This way we can + progress 5 or 6 steps along the algorithm for each job, making sure we don't + spend too long searching and lag the game out. + + As a bonus, this opens up the future for scheduling and collaborative searches. + It also allows us to cancel and pause searches. + + For our situation, we're going to allot a time budget for each job, and a + time budget for each frame. During this time, we can only work on a job for + so long. If it's a fast CPU we can do more iterations in that time. It also + means we can only work on so many jobs per frame. This way we get the top + of the queue done sooner, so we don't get bogged down in an ever growing queue. + + A bonus of this, is that quick jobs will finish earlier, allowing work to be + done on an extra job. Another side of this is that if the cpu is busy with + stuff, we might have to finish early. I envisage Shard should take time + measurements for the entire frame to make sure that modules such as this + one can give themselves smaller budgets when under load + ]] + + -- exit early if there are no jobs + if #self.jobs == 0 then + return + end + + self:RunIterations() + self:CleanupJobs() +end + +function PlacementHandler:RunIterations() + for i,j in ipairs(self.jobs) do + if j.status ~= 'cleanup' then + local job = self.jobs[i] + self:RunJobIterations( job ) + end + end +end + +function PlacementHandler:RunJobIterations( job ) + local stillGotTime = 4 --500 + -- given this particular job, lets give it a time budget and do as many + -- iterations as we can + while ( stillGotTime > 0 ) and ( job.status ~= 'cleanup' ) do + self:IterateJob( job ) + stillGotTime = stillGotTime - 1 + end +end + +function PlacementHandler:IterateJob( job ) + -- setup this run + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + return + end + job.status = 'running' + local step = job.step + local spos = job.spiral[step] + local pos = { + x=spos.x * job.increment + job.start_position.x, + y=job.start_position.y, + z=spos.y * job.increment + job.start_position.z + } + + -- test this particular step of the spiral + local buildable = self:CanBuildAt(job.unittype, pos ) + if buildable then + -- we found a place! + job.result = pos + job.status = 'cleanup' + SendToUnsynced("shard_debug_position",pos.x,pos.z,"final_choice") + job.onSuccess( job, pos ) + end + + job.step = job.step + 1 + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + end +end + +function PlacementHandler:CanBuildAt( unittype, pos ) + local buildable = self.ai.map:CanBuildHere( unittype, pos ) + if not buildable then + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_bad") + return false + end + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_good") + + + local fixed_spacing = 48 + + --avoiding metal spots( Work in Progress ) + --[[ + local spotPositions = self.game.map:GetMetalSpots() + local spotCount = self.game.map:SpotCount() + for i = 1,spotCount do + metalspot = spotPositions[i] + end + --]] + + --checking for unit positions + local spGetUnitsInRectangle = Spring.GetUnitsInRectangle + local radius = 125 + local units_found = spGetUnitsInRectangle(pos.x - radius, pos.z - radius, pos.x + radius, pos.z + radius) + if #units_found > 0 then + --for i = 1,#units_found do + --local unitID = units_found[i] + --if not UnitDefs[Spring.GetUnitDefID(unitID)].canmove then + --end + --end + return false + end + + -- check spacing + -- we're going to do this in a hacky way for now until a blocking + -- map and footprints are added to the shard API, but on the other + -- hand it's simple + + -- what we're going to do is enforce a standardised minimum + -- spacing, and check above below left and right of the position + -- to check, by shifting the position by a set amount and checking + -- that position + + for i,j in ipairs(self.spacing_spiral) do + testpos = { x=pos.x + ( j.x * fixed_spacing ), y=pos.y, z= pos.z + ( j.x * fixed_spacing ) } + if not self:CanBuildHere( unittype, testpos ) then + return false + end + end + + return true +end + +function PlacementHandler:CanBuildHere(unittype, testpos ) + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + return true +end + +function PlacementHandler:CleanupJobs() + -- try and clean up dead recruits where possible + for i,j in ipairs(self.jobs) do + if j.status == 'cleanup' then + local job = self.jobs[i] + table.remove( self.jobs, i ) + return + end + end +end + +--[[ +Some jobs are tied to units being alive. This could be because +it's the building the job was intended for. Eitherway, if that +unit dies then the associated job is unnecessary, and needs to +be cleaned up to save cpu +]] +function PlacementHandler:UnitDead(engineunit) + for i,j in ipairs(self.jobs) do + if j['cleanup_on_unit_death'] ~= nil then + if j.cleanup_on_unit_death == engineunit:ID() then + j.status = 'cleanup' + end + end + end +end + + +function PlacementHandler:GenerateSpiral( width, height) + local x = 0 + local y = 0 + local dx = 0 + local dy = -1 + local t = math.max(width,height) + local maxI = t*t; + local result = {} + for i=0, maxI do + if ((-width/2 <= x) and (x <= width/2) and (-height/2 <= y) and (y <= height/2)) then + table.insert( result, {x=x,y=y} ) + end + if ( ( x == y ) or ( ( x < 0 ) and ( x == -y ) ) or ( (x > 0) and ( x == 1-y ) ) ) then + t = dx + dx = dy * -1 + dy = t + end + x = x + dx + y = y + dy + end + return result +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/spothandler.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/spothandler.lua new file mode 100644 index 000000000..6305a1fe4 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/spothandler.lua @@ -0,0 +1,40 @@ +MetalSpotHandler = class(Module) + + +function MetalSpotHandler:Name() + return "MetalSpotHandler" +end + +function MetalSpotHandler:internalName() + return "metalspothandler" +end + +function MetalSpotHandler:Init() + --self.spots = game.map:GetMetalSpots() + self.spots = GG.metalSpots +end + +function distance(pos1,pos2) + local xd = pos1.x-pos2.x + local yd = pos1.z-pos2.z + dist = math.sqrt(xd*xd + yd*yd) + return dist +end + +function MetalSpotHandler:ClosestFreeSpot(unittype,position) + local pos = nil + local bestDistance = 50000 + + spotCount = self.game.map:SpotCount() + for i,v in ipairs(self.spots) do + local p = v + local dist = distance(position,p) + if dist < bestDistance then + if self.game.map:CanBuildHere(unittype,p) then + bestDistance = dist + pos = p + end + end + end + return pos +end diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/taskqueues.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/taskqueues.lua new file mode 100644 index 000000000..431cf1baf --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/taskqueues.lua @@ -0,0 +1,934 @@ +--[[ +Task Queues! +]]-- + +math.randomseed( os.time() ) +math.random(); math.random(); math.random() + +--------------------------------------------- Functions for AI +local aiDifficulty = Spring.GetModOptions().aidifficulty +local aiUnits = Spring.GetModOptions().aiunits +local aiNukes = Spring.GetModOptions().ainukes +local aiDebug = Spring.GetModOptions().aidebug +local spGetTeamUnitsSorted = Spring.GetTeamUnitsSorted +local spGetUnitDefID = Spring.GetUnitDefID +local spGetTeamResources = Spring.GetTeamResources +local spGetTeamUnitDefCount = Spring.GetTeamUnitDefCount +local spGetTeamInfo = Spring.GetTeamInfo +local spGetTeamStartPosition = Spring.GetTeamStartPosition +local spGetAllyTeamStartBox = Spring.GetAllyTeamStartBox +local liftersqueued = 0 +--Spring.GetGameSeconds() -- checking gametime + +if aiDebug == nil then + aiDebug = "enabled" +end + +if aiUnits == nil then + aiUnits = "enabled" +end + +if aiUnits == nil then + aiUnits = "enabled" +end + +if aiNukes == nil then + aiNukes = "enabled" +end + +if aiDifficulty == nil then + aiDifficulty = "easy" +end + +local WaitRNG = math.random(0,500) +---------------------------------------------------------------- LIFTER QUEUES + + --function MoveToStartLocation( taskqueuebehaviour ) + + --local startxmin, startzmin, startxmax, startzmax = spGetAllyTeamStartBox(ai.allyId) + --local px = math.random(startxmin, startxmax) + --local pz = math.random(startzmin, startzmax) + --local py = 0 + + --Spring.Echo([[AI startxmin ]] .. startxmin .. [[ ]]) + --Spring.Echo([[AI startzmin ]] .. startzmin .. [[ ]]) + --Spring.Echo([[AI startxmax ]] .. startxmax .. [[ ]]) + --Spring.Echo([[AI startzmax ]] .. startzmax .. [[ ]]) + + --local spawnposx, _, spawnposz = spGetTeamStartPosition(ai.id) + --local sx = spawnposx + --local sz = spawnposz + + --Spring.Echo([[AI spawnx ]] .. sx .. [[ ]]) + --Spring.Echo([[AI spawnz ]] .. sz .. [[ ]]) + + --mx = sx - px + --mz = sz - pz + --my = 0 + + --local x = px + --local z = pz + --local y = py + + --Spring.Echo([[AI startlocationx ]] .. mx .. [[ ]]) + --Spring.Echo([[AI startlocationz ]] .. mz .. [[ ]]) + + --Spring.Echo([[AI ID ]] .. ai.id .. [[ ]]) + --Spring.Echo([[AI allyID ]] .. ai.allyId .. [[ ]]) + --return action = "move", position = {x = px, y = py, z = pz}, +--end + + function BuildMex() + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local aimexamount = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.emetalextractor.id) + if mc >= ms - ms*0.10 then + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up1" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up2" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then + return "eorb_up3" + end + end + else + if aimexamount * 15 <= Spring.GetGameSeconds() then + return "emetalextractor" + else + return "ebomb" + end + end +end + + + function RandomLift() + --Locals + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es = Spring.GetTeamResources(ai.id, "energy") + local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") + local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") + local unitcount = Spring.GetTeamUnitCount(ai.id) + + --DEBUG LOG + if aiDebug == "enabled" then + Spring.Echo([[Shard Debug Log]]) + Spring.Echo([[--Units:]]) + Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) + Spring.Echo([[--Resources:]]) + Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) + Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) + Spring.Echo([[AI Metal Income is ]] .. mi.. [[ / -]] .. me ) + Spring.Echo(GG.TechCheck("endbringer", ai.id) ) + else + end + --Spring.SendMessageToPlayer(0, "Hello World!") + ------- Tech 0 - Very Early Game + + if ec <= 50 and GG.TechCheck("tech1", ai.id) == true then + if GG.TechCheck("tech3", ai.id) == true then + return "efusion2" + elseif GG.TechCheck("tech2", ai.id) == true then + return "egeothermal" + else + return "esolar2" + end + elseif mc >= ms - ms*0.10 then + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up1" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up2" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then + return "eorb_up3" + end + end + elseif es < Spring.GetGameSeconds()*0.5 then + return "estorage" + elseif su >= sm-20 and sm ~= 400 then + return "estorage" + + elseif GG.TechCheck("tech1", ai.id) == false and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.etech1.id) == 0 then + return "etech1" + + else + if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + local r = math.random(0,1) + if r == 0 then + return "emine" + else + return "eturretlightai" + end + + ------- Reached Tech 1 + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + if ec <= 50 then + return "esolar2" + else + local r = math.random(0,2) + local aar = math.random(0,5) + if aar > 0 then + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai" + end + else + return "elaserbattery" + end + end + + ------- Reached Tech 2 MK 2 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + if ec <= 50 then + return "egeothermal" + else + local r2 = math.random(0,20) + local aar = math.random(0,5) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai" + elseif r == 3 then + return "eturretheavyai" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,1) + if r == 0 then + return "eshieldgen" + else + return "ekmar" + end + else + return "elaserbattery" + end + end + + ------- Reached Tech 3 MK 3 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1500 then + if ec <= 50 then + return "efusion2" + else + local r2 = math.random(0,10) + local aar = math.random(0,5) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai" + elseif r == 3 then + return "eturretheavyai" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,3) + if r == 0 then + return "eshieldgen" + elseif r == 1 then + return "eartyturret_up3" + elseif r == 2 then + return "esiloai" + elseif r == 3 then + return "ekmar" + end + else + return "elaserbattery" + end + end + + ------- Reached MK 4 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1500 then + if ec <= 50 then + return "efusion2" + else + local r2 = math.random(0,5) + local aar = math.random(0,10) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai_up3" + elseif r == 3 then + return "eturretheavyai_up3" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,3) + if r == 0 then + return "eshieldgen" + elseif r == 1 then + return "eartyturret_up3" + elseif r == 2 then + return "esiloai" + elseif r == 3 then + return "ekmar" + end + else + return "elaserbattery" + end + end + end + end +end + +function RandomOverseer() + --Locals + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es = Spring.GetTeamResources(ai.id, "energy") + local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") + local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") + local unitcount = Spring.GetTeamUnitCount(ai.id) + + --DEBUG LOG + if aiDebug == "enabled" then + Spring.Echo([[Shard Debug Log]]) + Spring.Echo([[--Units:]]) + Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) + Spring.Echo([[--Resources:]]) + Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) + Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) + else + end + + + + ------- Tech 0 - Very Early Game + if ec <= 50 and GG.TechCheck("tech1", ai.id) == true then + if GG.TechCheck("tech3", ai.id) == true then + return "efusion2" + elseif GG.TechCheck("tech2", ai.id) == true then + return "egeothermal" + else + return "esolar2" + end + elseif mc >= ms - ms*0.20 then + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up1" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up2" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then + return "eorb_up3" + end + end + elseif GG.TechCheck("tech1", ai.id) == false and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.etech1.id) == 0 then + return "etech1" + + elseif es < Spring.GetGameSeconds()*0.5 then + return "estorage" + else + if Spring.GetGameSeconds() <= 90 then + local r = math.random(0,1) + if mc <= 10 or mi*2 <= me then + return "emetalextractor" + elseif r == 0 then + return "emine" + else + return "eturretlightai" + end + + ------- Reached Tech 1 + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + if ec <= 50 then + return "esolar2" + else + local r = math.random(0,2) + local aar = math.random(0,10) + if aar > 0 then + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai" + end + else + return "elaserbattery" + end + end + + ------- Reached Tech 2 MK 2 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + if ec <= 50 then + return "egeothermal" + else + local r2 = math.random(0,20) + local aar = math.random(0,10) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai" + elseif r == 3 then + return "eturretheavyai" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,1) + if r == 0 then + return "eshieldgen" + else + return "ekmar" + end + else + return "elaserbattery" + end + end + + ------- Reached Tech 3 MK 3 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1500 then + if ec <= 50 then + return "efusion2" + else + local r2 = math.random(0,15) + local aar = math.random(0,10) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai_up3" + elseif r == 3 then + return "eturretheavyai_up3" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,3) + if r == 0 then + return "eshieldgen" + elseif r == 1 then + return "eartyturret_up3" + elseif r == 2 then + return "esiloai" + elseif r == 3 then + return "ekmar" + end + else + return "elaserbattery" + end + end + + ------- Reached MK 4 + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1500 then + if ec <= 50 then + return "efusion2" + else + local r2 = math.random(0,5) + local aar = math.random(0,10) + if r2 > 0 and aar > 0 then + local r = math.random(0,4) + if r == 0 then + return "emine" + elseif r == 1 then + return "eradar2" + elseif r == 2 then + return "eturretlightai_up3" + elseif r == 3 then + return "eturretheavyai_up3" + elseif r == 4 then + return "ejammerai" + end + elseif r2 == 0 then + local r = math.random(0,3) + if r == 0 then + return "eshieldgen" + elseif r == 1 then + return "eartyturret_up3" + elseif r == 2 then + return "esiloai" + elseif r == 3 then + return "ekmar" + end + else + return "elaserbattery" + end + end + end + end +end + +function RandomUnit() + --Locals + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es = Spring.GetTeamResources(ai.id, "energy") + local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") + local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") + local unitcount = Spring.GetTeamUnitCount(ai.id) + + --DEBUG LOG + if aiDebug == "enabled" then + Spring.Echo([[Shard Debug Log]]) + Spring.Echo([[--Units:]]) + Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) + Spring.Echo([[--Resources:]]) + Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) + Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) + else + end + + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id) < 4 then + return "elifterai" + elseif su <= sm-20 and GG.TechCheck("tech1", ai.id) == true then + + if GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then ------- Reached Tech 1 + + local r = math.random(0,12) + if r == 0 then + return "eallterrlight" + elseif r == 1 then + return "eallterrassault" + elseif r == 2 then + return "elighttank3" + elseif r == 3 then + return "eartytank" + elseif r == 4 then + return "escoutdrone" + elseif r == 5 then + return "eamphibarty" + elseif r == 6 then + return "eamphibriot" + elseif r == 7 then + return "eamphibbuggy" + elseif r == 8 then + return "ehbotpeewee" + elseif r == 9 then + return "eriottank2" + elseif r == 10 then + return "eamphibneedle" + elseif r == 11 then + return "eallterrriot" + elseif r == 12 then + return "ehbotthud" + end + + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then ------- Reached Tech 2 MK 2 + + local r = math.random(0,9) + if r == 0 then + return "eheavytank3_up1" + elseif r == 1 then + return "ehbotrocko_up1" + elseif r == 2 then + return "eallterrmed_up1" + elseif r == 3 then + return "eallterrheavy_up1" + elseif r == 4 then + return "egunship2_up1" + elseif r == 5 then + return "ebomber_up1" + elseif r == 6 then + return "efighter_up1" + elseif r == 7 then + return "eamphibrock_up1" + elseif r == 8 then + return "emissiletank_up1" + elseif r == 9 then + return "eamphibmedtank_up1" + end + + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1300 then ------- Reached Tech 3 MK 3 + local r2 = math.random(0,50) + if r2 ~= 0 then + local r = math.random(0,10) + if r == 0 then + return "eheavytank3_up2" + elseif r == 1 then + return "ehbotrocko_up2" + elseif r == 2 then + return "eallterrmed_up2" + elseif r == 3 then + return "eallterrheavy_up2" + elseif r == 4 then + return "egunship2_up2" + elseif r == 5 then + return "ebomber_up2" + elseif r == 6 then + return "efighter_up2" + elseif r == 7 then + return "eairemp_up2" + elseif r == 8 then + return "eamphibrock_up2" + elseif r == 9 then + return "emissiletank_up2" + elseif r == 10 then + return "eamphibmedtank_up2" + end + elseif r2 == 0 then + if GG.TechCheck("endbringer", ai.id) == true then + local r = math.random(0,4) + if r == 0 then + return "eamphibleveler_up2" + elseif r == 1 then + return "eallterranarchid_up2" + elseif r == 2 then + return "elacerator_up2" + elseif r == 3 then + return "ekrow_up2" + elseif r == 4 then + return "ehbotkarganneth_up2" + end + else + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + return "eorb_up2" + end + end + end + + elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1300 then ------- Reached MK 4 + + local r2 = math.random(0,50) + if r2 ~= 0 then + local r = math.random(0,8) + if r == 0 then + return "eheavytank3_up3" + elseif r == 1 then + return "ehbotrocko_up3" + elseif r == 2 then + return "eallterrmed_up3" + elseif r == 3 then + return "eallterrheavy_up3" + elseif r == 4 then + return "egunship2_up3" + elseif r == 5 then + return "eairemp_up3" + elseif r == 6 then + return "eamphibrock_up3" + elseif r == 7 then + return "emissiletank_up3" + elseif r == 8 then + return "eamphibmedtank_up3" + end + elseif r2 == 0 then + if GG.TechCheck("endbringer", ai.id) == true then + local r = math.random(0,4) + if r == 0 then + return "eamphibleveler_up3" + elseif r == 1 then + return "eallterranarchid_up3" + elseif r == 2 then + return "elacerator_up3" + elseif r == 3 then + return "ekrow_up3" + elseif r == 4 then + return "ehbotkarganneth_up3" + end + else + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + return "eorb_up3" + end + end + end + end + else + if es < Spring.GetGameSeconds()*0.5 then + return "estorage" + elseif mc >= ms - ms*0.20 then + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elifterai.id)*60 < Spring.GetGameSeconds() then + return "elifterai" + else + if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up1" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then + return "eorb_up2" + elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then + return "eorb_up3" + end + end + elseif Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.emine.id) > Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretlightai.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretlightai_up3.id) and GG.TechCheck("tech1", ai.id) then + if Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretlightai.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretlightai_up3.id) > Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretheavyai.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eturretheavyai_up3.id) and GG.TechCheck("tech2", ai.id) then + if GG.TechCheck("tech3", ai.id) then + return "eturretheavyai_up3" + else + return "eturretheavyai" + end + else + if GG.TechCheck("tech3", ai.id) then + return "eturretlightai_up3" + else + return "eturretlightai" + end + end + else + local r = math.random(0,5) + if r == 0 then + return "emine" + elseif r == 1 then + return "escoutdrone" + else + return "ebomb" + end + end + end + end + +function BuildTechLab() + if not GG.TechCheck("tech1", ai.id) and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.etech1.id) == 0 then + return "etech1" + else + return "emine" + end +end + + + +---------------------------------------------------------------- QUEUES + + + +local idlelist = { + { action = "wait", frames = 3000}, +} + +local assistqueue = { + { action = "patrolrelative", position = {x = 100, y = 0, z = 100} }, +} + +local overseerlistfirst = { + "emetalextractor", + "emetalextractor", + "emetalextractor", + "elifterai", + "eorb", + "elifterai", + "eorb", + "elifterai", + "eorb", + "eturretlightai", + "elifterai", + "eturretlightai", + BuildTechLab, + "elifterai", + "eorb", + "eorb", + "eturretlightai", + "elifterai", +} + +local overseerorders = { + RandomOverseer, + RandomOverseer, + RandomOverseer, + RandomOverseer, + BuildTechLab, + "elifterai", +} + +local lifterlist = { + RandomUnit, + RandomUnit, + RandomUnit, + BuildMex, + RandomLift, +} + +local lifterareamex = { + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", + "emetalextractor", +} + +local unitsqueue = { + RandomUnit, +} +----------------------------------------------------- +--local factory = { +--} + +--local airplant = { +--} + +--local amphibfactory = { +--} + +--local allterrfactory = { +-- + +--local orbs = { + --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, + --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, + --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, + --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, +--} + + +local function overseerqueue() + if ai.engineerfirst == true then + return overseerorders + else + ai.engineerfirst = true + return overseerlistfirst + end +end + +local function lifterqueue() + if liftersqueued > 2 then + liftersqueued = liftersqueued - 0.02 + return lifterlist + else + liftersqueued = liftersqueued + 1 + return lifterareamex + end +end + +taskqueues = { + --builders + ecommanderbattleai = overseerqueue, + elifterai = lifterqueue, + eunitfactoryai = unitsqueue, + eorb = assistqueue, + eorb_up1 = assistqueue, + eorb_up2 = assistqueue, + eorb_up3 = assistqueue, +} +---------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/aimodehandler.lua b/LuaRules/Gadgets/ai/EvoRTS/aimodehandler.lua new file mode 100644 index 000000000..76c69f276 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/aimodehandler.lua @@ -0,0 +1,76 @@ +AiModeHandler = class(Module) + +function AiModeHandler:Name() + return "AiModeHandler" +end + +function AiModeHandler:internalName() + return "aimodehandler" +end + +local UDC = function(teamID, DefID) + return #Spring.GetTeamUnitsByDefs(ai.id, DefID) +end +local UDN = UnitDefNames +--local advBuilders = {UDN.armacv.id, UDN.armack.id, UDN.armaca.id, UDN.coracv.id, UDN.corack.id, UDN.coraca.id} +local modenames = {"balanced", "t1", "tech"} +function AiModeHandler:Init() + self.resources = {metal = {}, energy = {}} + for res, tab in pairs(self.resources) do + local c, s, p, i, e = Spring.GetTeamResources(self.ai.id, res) + self.resources[res] = {c = c, s = s, p = p, i = i, e = e} + end + math.randomseed( os.time() + self.ai.id ) + math.random(); math.random(); math.random() + --self:PickASide(math.random(1,6)) + --self:CreateWantedTechTree(math.random(1,12),math.random(1,12)) + --local count = #Spring.GetTeamList(self.ai.allyId) + --if count and count > 1 then + --self:Mode(math.random(1,count)%3 + 1) + --else + self:Mode(1) + --end +end + +function AiModeHandler:Update() + local frame = Spring.GetGameFrame() + if frame%15 == self.ai.id%15 then + for res, tab in pairs(self.resources) do + local c, s, p, i, e = Spring.GetTeamResources(self.ai.id, res) + if Spring.GetTeamRulesParam(self.ai.id,'mmUse') and tonumber(Spring.GetTeamRulesParam(self.ai.id,'mmUse')) then + e = e - tonumber(Spring.GetTeamRulesParam(self.ai.id,'mmUse')) + end + self.resources[res] = {c = c, s = s, p = p, i = i, e = e} + end + end +end + + +function AiModeHandler:Mode(i) + self.perraider = 30 + self.perskirmer = 40 + self.nodefenderscounter = math.random(1200,2400) + self.noregroupcounter = self.nodefenderscounter + math.random(600,1200) +end + +-- function AiModeHandler:PickASide(i) + -- if i == 1 then + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommanderbattleai.id) + -- self.faction = "OC" + -- elseif i == 2 then + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommanderbuildai.id) + -- self.faction = "OC" + -- elseif i == 3 then + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommandercloakai.id) + -- self.faction = "OC" + -- elseif i == 4 then + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommanderfactoryai.id) + -- self.faction = "OC" + -- elseif i == 5 then + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommandershieldai.id) + -- self.faction = "OC" + -- else + -- Spring.SetTeamRulesParam(self.ai.id, "startUnit", UnitDefNames.ecommanderhealerai.id) + -- self.faction = "OC" + -- end +-- end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/attackerbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/attackerbehaviour.lua new file mode 100644 index 000000000..10e0b8fec --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/attackerbehaviour.lua @@ -0,0 +1,315 @@ +shard_include( "attackers" ) + + +-- speedups +local SpGetGameFrame = Spring.GetGameFrame +local SpGetUnitPosition = Spring.GetUnitPosition +local SpGetUnitSeparation = Spring.GetUnitSeparation +local SpGetUnitVelocity = Spring.GetUnitVelocity +local SpGetUnitMaxRange = Spring.GetUnitMaxRange +local SpValidUnitID = Spring.ValidUnitID +local SpGetUnitCurrentBuildPower = Spring.GetUnitCurrentBuildPower +local SpGetUnitNearestEnemy = Spring.GetUnitNearestEnemy +local Echo = Spring.Echo +------ + + +function IsAttacker(unit) + for i,name in ipairs(attackerlist) do + if name == unit:Internal():Name() then + return true + end + end + return false +end + +AttackerBehaviour = class(Behaviour) + +function AttackerBehaviour:Init() + --self.ai.game:SendToConsole("attacker!") + --self.game:AddMarker({ x = startPosx, y = startPosy, z = startPosz }, "my start position") + CMD.MOVE_STATE = 50 + CMD.FIRE_STATE = 45 +end + +local function Distance(x1,z1, x2,z2) + local vectx = x2 - x1 + local vectz = z2 - z1 + local dis = math.sqrt(vectx^2+vectz^2) + return dis +end + +function AttackerBehaviour:Update() + if not self.active then -- do not even attempt anything if the unit is inactive... + return + end + if not self.unitID then + self.unitID = self.unit:Internal().id + end + if not self.AggFactor then + self.AggFactor = self.ai.attackhandler:GetAggressiveness(self) + end + if not self.type then + self.type = self.ai.attackhandler:GetRole(self) + end + local frame = SpGetGameFrame() + if (frame%450 == self.unitID%450) or self.myRange == nil then --refresh "myRange" casually because it can change with experience + local unitID = self.unit:Internal().id + local unitDefID = Spring.GetUnitDefID(unitID) + if UnitDefs[unitDefID].customParams.retreatrangedai then + --Spring.Echo("ORB RANGE!") + self.myRange = tonumber(UnitDefs[unitDefID].customParams.retreatrangedai) + else + --Spring.Echo("NORMAL RANGE!") + self.myRange = SpGetUnitMaxRange(self.unitID) + end + end + if (frame%90 == self.unitID%90) then -- a unit on map stays 'visible' for max 3s, this also reduces lag + local nearestVisibleAcrossMap = SpGetUnitNearestEnemy(self.unitID, self.AggFactor*self.myRange) + if nearestVisibleAcrossMap and (GG.AiHelpers.VisibilityCheck.IsUnitVisible(nearestVisibleAcrossMap, self.ai.id)) then + self.nearestVisibleAcrossMap = nearestVisibleAcrossMap + end + end + if (frame%45 == self.unitID%45) then -- a unit in range stays 'visible' for max 1.5s, this also reduces lag + local nearestVisibleInRange = SpGetUnitNearestEnemy(self.unitID, 2*self.myRange) + local closestVisible = nearestVisibleInRange and GG.AiHelpers.VisibilityCheck.IsUnitVisible(nearestVisibleInRange, self.ai.id) + if nearestVisibleInRange and closestVisible then + self.nearestVisibleInRange = nearestVisibleInRange + self.enemyRange = SpGetUnitMaxRange(nearestVisibleInRange) + end + end + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + local distance = (nearestEnemy and SpGetUnitSeparation(self.unitID, nearestEnemy)) or 300 + local refreshRate = math.max(math.floor(((distance*0.5 or 250)/10)),10) + if self.unitID%refreshRate == frame%refreshRate then + self:AttackCell(self.type, self.nearestVisibleAcrossMap, self.nearestVisibleInRange, self.enemyRange) + end +end + +function AttackerBehaviour:OwnerBuilt() + --Echo("registered unit construction") + self.unit:Internal():ExecuteCustomCommand(CMD.MOVE_STATE, { 2 }, {}) + self.unit:Internal():ExecuteCustomCommand(CMD.FIRE_STATE, { 2 }, {}) + self.unit:Internal():ExecuteCustomCommand(37382, { 1 }, {}) + self.unit:Internal():ExecuteCustomCommand(34569, { 1 }, {}) + self.attacking = true + self.active = true + self.unitID = self.unit:Internal().id + self.AggFactor = self.ai.attackhandler:GetAggressiveness(self) + self.type = self.ai.attackhandler:GetRole(self) + self.repairThisUnit = false +end + +function AttackerBehaviour:OwnerDead() +end + +function AttackerBehaviour:OwnerIdle() + self.attacking = true + self.active = true +end + +function AttackerBehaviour:AttackCell(type, nearestVisibleAcrossMap, nearestVisibleInRange, enemyRange) + --Echo("trying to get attack position") + local p + local unit = self.unit:Internal() + local unitID = unit.id + local teamID = ai.id + local unitDefID = Spring.GetUnitDefID(unitID) + --local unitCanMove = UnitDefs[unitDefID].canMove + local mc, ms = Spring.GetTeamResources(teamID, "metal") + local ec, es = Spring.GetTeamResources(teamID, "energy") + local r = math.random(0,20) + local currenthealth = unit:GetHealth() + local maxhealth = unit:GetMaxHealth() + if currenthealth < maxhealth*0.99 and currenthealth < 5000 then + self.repairThisUnit = true + elseif currenthealth >= maxhealth*0.99 then + self.repairThisUnit = false + end + if r == 0 and string.find(UnitDefs[unitDefID].name, "eartytank") then + self.unit:Internal():EZMorph() + elseif r == 0 and string.find(UnitDefs[unitDefID].name, "riot") then + self.unit:Internal():EZMorph() + elseif r < 10 and string.find(UnitDefs[unitDefID].name, "eartyturret") then + self.unit:Internal():EZMorph() + return + elseif string.find(UnitDefs[unitDefID].name, "ehbot") and not string.find(UnitDefs[unitDefID].name, "turret") then + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + local EnemyDefID = Spring.GetUnitDefID(nearestEnemy) + local nearestEnemyDistance = SpGetUnitSeparation(self.unitID,nearestEnemy) + if nearestEnemyDistance < self.myRange*1.30 and self.repairThisUnit == false then + if UnitDefs[EnemyDefID].customParams and UnitDefs[EnemyDefID].customParams.armortype ~= "building" then + self.unit:Internal():EZMorph() + end + end + elseif string.find(UnitDefs[unitDefID].name, "ehbot") and string.find(UnitDefs[unitDefID].name, "turret") then + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + local EnemyDefID = Spring.GetUnitDefID(nearestEnemy) + local nearestEnemyDistance = SpGetUnitSeparation(self.unitID,nearestEnemy) + if nearestEnemyDistance >= self.myRange+50 or self.repairThisUnit == true or (UnitDefs[EnemyDefID].customParams and UnitDefs[EnemyDefID].customParams.armortype == "building") then + self.unit:Internal():EZMorph() + end + elseif (UnitDefs[unitDefID].name == "etech1" or UnitDefs[unitDefID].name == "etech2") then + self.unit:Internal():EZMorph() + return + elseif string.find(UnitDefs[unitDefID].name, "eorb") and ec > es*0.98 then + self.unit:Internal():EZMorph() + elseif (string.find(UnitDefs[unitDefID].name, "emetalextractor") or string.find(UnitDefs[unitDefID].name, "xmetalextractor")) and ec > es*0.98 then + self.unit:Internal():EZMorph() + return + end + if string.find(UnitDefs[unitDefID].name, "eallterr") then + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + local nearestEnemyDistance = SpGetUnitSeparation(self.unitID,nearestEnemy) + if nearestEnemyDistance < 2000 then + self.unit:Internal():ExecuteCustomCommand(37382, { 1 }, {}) + else + self.unit:Internal():ExecuteCustomCommand(37382, { 0 }, {}) + end + end + -- Retreating so we have less data process/only what matters + if self.repairThisUnit then + --Echo("trying to retreat") + local nanotcx, nanotcy, nanotcz = GG.AiHelpers.NanoTC.GetClosestNanoTC(self.unitID) + if nanotcx and nanotcy and nanotcz then + p = api.Position() + p.x, p.y, p.z = nanotcx, nanotcy, nanotcz + else + p = self.ai.attackhandler.commpos + end + self.target = p + self.attacking = false + if self.active and self.target then + self.unit:Internal():Move(self.target) + return + else + self.repairThisUnit = false + end + end + + local utype = self.game:GetTypeByName(unit:Name()) + local attacker = (type == "attacker") + + -- nil/invalid checks + if nearestVisibleInRange and (not SpValidUnitID(nearestVisibleInRange)) then + nearestVisibleInRange = nil + self.nearestVisibleInRange = nil + end + if nearestVisibleAcrossMap and (not SpValidUnitID(nearestVisibleAcrossMap)) then + nearestVisibleAcrossMap = nil + self.nearestVisibleAcrossMap = nil + end + + if not self.repairThisUnit and nearestVisibleInRange and (not utype:CanFly() == true) then -- process cases where there isn't any visible nearestVisibleInRange first + --Echo("trying to attack nearby enemy") + local ex,ey,ez = SpGetUnitPosition(nearestVisibleInRange) + local ux,uy,uz = SpGetUnitPosition(self.unitID) + local pointDis = SpGetUnitSeparation(self.unitID,nearestVisibleInRange) + local dis = 120 + local f = dis/pointDis + local wantedRange + if self.myRange and enemyRange and self.myRange >= enemyRange and enemyRange > 50 then -- we skirm here + wantedRange = self.myRange + else -- randomize wantedRange between 25-75% of myRange + wantedRange = math.random(self.myRange*0.70, self.myRange*0.80) + end + -- offset upos randomly so it moves a bit while keeping distance + local dx, _, dz, dw = SpGetUnitVelocity(self.unitID) -- attempt to not always queue awful turns + local modifier = "ctrl" + ux = ux + math.random (-80,80) + uy = uy + uz = uz + math.random (-80,80) + if wantedRange <= pointDis then + modifier = nil -- Do not try to move backwards if attempting to get closer to target + end + -- here we find the goal position + if (pointDis+dis > wantedRange) then + f = (wantedRange-pointDis)/pointDis + end + local cx = ux+(ux-ex)*f + local cy = uy + local cz = uz+(uz-ez)*f + if unit:Name() == "eorb" or unit:Name() == "eorb_up1" or unit:Name() == "eorb_up2" or unit:Name() == "eorb_up3" then + if SpGetUnitCurrentBuildPower(unit.id) == 0 then -- if currently IDLE + self.unit:Internal():ExecuteCustomCommand(CMD.FIGHT, {cx, cy, cz}, {modifier}) + end + else + --Echo("attacking nearby enemy") + self.unit:Internal():ExecuteCustomCommand(CMD.MOVE, {cx, cy, cz}, {modifier}) + end + return + end + + -- We have processed units that had to retreat and units that had visible enemies within 2* their range + -- what are left are units with no visible enemies within 2*maxRange (no radar/los/prevLOS buildings) + local enemyposx, enemyposy, enemyposz + if not self.repairThisUnit and nearestVisibleAcrossMap then + --Echo("Attacking nearest enemy on map") + enemyposx, enemyposy, enemyposz = SpGetUnitPosition(nearestVisibleAcrossMap) -- visible on map + elseif not self.repairThisUnit then + --Echo("IDFK what i'm doing with my life") + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + if nearestEnemy then + enemyposx, enemyposy, enemyposz = SpGetUnitPosition(nearestEnemy) + end + --local cms = self.ai.attackhandler.targetMexes[(self.unitID%5)+1] + --if cms then -- there is an enemy metal spot + --enemyposx, enemyposy, enemyposz = cms.x, cms.y, cms.z + --else -- there is nothing to target + --return + --end + end + + p = api.Position() + if p == nil then + return + end + p.x = enemyposx + math.random(-math.sqrt(2)/2*self.myRange*0.90, math.sqrt(2)/2*self.myRange*0.90) or 0 + p.z = enemyposz + math.random(-math.sqrt(2)/2*self.myRange*0.90, math.sqrt(2)/2*self.myRange*0.90) or 0 + p.y = enemyposy or 0 + self.target = p + self.attacking = true + if unit:Name() == "eorb" or unit:Name() == "eorb_up1" or unit:Name() == "eorb_up2" or unit:Name() == "eorb_up3" then + if SpGetUnitCurrentBuildPower(unit.id) == 0 then -- if currently IDLE then + unit:MoveAndPatrol(self.target) + end + return + else + if (utype:CanFly() == true) and not (unit:Name() ~= "escoutdrone" or unit:Name() ~= "zairscout") then + local nearestEnemy = SpGetUnitNearestEnemy(self.unitID, 30000, false) + if nearestEnemy then + --Echo("I'm battle aircraft and i'm attacking") + unit:Attack(nearestEnemy) + end + else + --Echo("I'm anything else and i'm attacking") + unit:MoveAndFire(self.target) + end + return + end +end + + +function AttackerBehaviour:Priority() + if not self.attacking then + return 0 + else + return 100 + end +end + +function AttackerBehaviour:Activate() + self.active = true + if self.target then + self.unit:Internal():MoveAndFire(self.target) + self.target = nil + else + end +end + + +function AttackerBehaviour:OwnerDied() + self.attacking = nil + self.active = nil + self.unit = nil +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/attackers.lua b/LuaRules/Gadgets/ai/EvoRTS/attackers.lua index b40e24faf..03e7ac25a 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/attackers.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/attackers.lua @@ -3,7 +3,55 @@ Attackers! ]]-- attackerlist = { - ------------- Endbringers + ------------- Morphs + ---Buildings, just to make them upgrade + "emetalextractor", + "emetalextractor_up1", + "emetalextractor_up2", + "etech1", + "etech2", + ---Amphibs + "eamphibriot_shotgun", + "eamphibriot_shotgun_up1", + "eamphibriot_shotgun_up2", + "eamphibriot_shotgun_up3", + ---AllTerr + "eallterrriot_shotgun", + "eallterrriot_shotgun_up1", + "eallterrriot_shotgun_up2", + "eallterrriot_shotgun_up3", + ---Hbots + "ehbotpeewee_turret", + "ehbotpeewee_turret_up1", + "ehbotpeewee_turret_up2", + "ehbotpeewee_turret_up3", + "ehbotrocko_turret", + "ehbotrocko_turret_up1", + "ehbotrocko_turret_up2", + "ehbotrocko_turret_up3", + "ehbotsniper_turret", + "ehbotsniper_turret_up1", + "ehbotsniper_turret_up2", + "ehbotsniper_turret_up3", + "ehbotthud_turret", + "ehbotthud_turret_up1", + "ehbotthud_turret_up2", + "ehbotthud_turret_up3", + "ehbotkarganneth_turret", + "ehbotkarganneth_turret_up1", + "ehbotkarganneth_turret_up2", + "ehbotkarganneth_turret_up3", + ---Hover + "eriottank2_shotgun", + "eriottank2_shotgun_up1", + "eriottank2_shotgun_up2", + "eriottank2_shotgun_up3", + "eartytank_saturation", + "eartytank_saturation_up1", + "eartytank_saturation_up2", + "eartytank_saturation_up3", + + ------------- Endbringers "eallterranarchid", "eallterranarchid_up1", "eallterranarchid_up2", @@ -20,7 +68,14 @@ attackerlist = { "ekrow_up1", "ekrow_up2", "ekrow_up3", + "ehbotkarganneth", + "ehbotkarganneth_up1", + "ehbotkarganneth_up2", + "ehbotkarganneth_up3", + ------------- Basic + "escoutdrone", + "eairemp", "eraider", "edrone", "elighttank3", @@ -43,10 +98,6 @@ attackerlist = { "eriottank2", "eamphibriot", "eallterrriot", - "eorb", - "eorb_up1", - "eorb_up2", - "eorb_up3", "edrone", "ehbotpeewee", "ehbotrocko", @@ -57,8 +108,10 @@ attackerlist = { "eaimexer", "escout", "eallterrshield", + -------------- Upgrade 1 "eraider_up1", + "eairemp_up1", "edrone_up1", "elighttank3_up1", "eamphibbuggy_up1", @@ -86,8 +139,10 @@ attackerlist = { "ehbotthud_up1", "escout_up1", "eallterrshield_up1", + --------------- Upgrade 2 "eraider_up2", + "eairemp_up2", "edrone_up2", "elighttank3_up2", "eamphibbuggy_up2", @@ -115,8 +170,10 @@ attackerlist = { "ehbotthud_up2", "escout_up2", "eallterrshield_up2", + ----------------------------- Upgrade 3 "eraider_up3", + "eairemp_up3", "edrone_up3", "elighttank3_up3", "eamphibbuggy_up3", @@ -144,6 +201,7 @@ attackerlist = { "ehbotthud_up3", "escout_up3", "eallterrshield_up3", + ---------------------------- Chickens "chicken_dodo1", "chicken_dodo2", @@ -192,4 +250,27 @@ attackerlist = { "ve_chickenq", "vh_chickenq", "roost", + --------------------- Zaals + "zairscout", + "zairtoairfighter", + "zairtogroundfighter", + "zarty", + "zkamikaze", + "zlightswarm", + "zmedswarm", + "zpyro", + "zqueen", + "zskirmisher", + "zassault", + "zairbomber", + + -------------------- Pattern + "xmetalextractor", + "xcrasher", + "xflea", + "xhammer", + "xrocko", + "xskulk", + "xwarrior", + } diff --git a/LuaRules/Gadgets/ai/EvoRTS/attackhandler.lua b/LuaRules/Gadgets/ai/EvoRTS/attackhandler.lua new file mode 100644 index 000000000..eadc3b7c3 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/attackhandler.lua @@ -0,0 +1,94 @@ +AttackHandler = class(Module) + +function AttackHandler:Name() + return "AttackHandler" +end + +function AttackHandler:internalName() + return "attackhandler" +end + +function AttackHandler:Init() + self.recruits = {attackers = {}, defenders = {}} + self.counter = 1 + self.ratio = 10 +end + +function AttackHandler:Update() + local frame = Spring.GetGameFrame() + if frame%30 == 0 then -- Refresh commander position + local x,y,z + local comms = Spring.GetTeamUnitsByDefs(self.ai.id, {UnitDefNames.ecommanderbattleai.id}) + if comms[1] then + x,y,z = Spring.GetUnitPosition(comms[1]) + self.commpos = {x = x, y = y, z = z} + end + end + if frame%3000 == 0 then -- Generate random mexpositions + local positions = self:PickRandomPositionsOnMap() + local targets = {} + for ct, position in pairs(positions) do + targets[ct] = self.ai.metalspothandler:ClosestEnemySpot(self.game:GetTypeByName("eorb") , {x = position[1], y = Spring.GetGroundHeight(position[1], position[2]),z = position[2]} ) + end + self.targetMexes = targets + end + +end + +function AttackHandler:GetAggressiveness(atkbehaviour) + return (math.random(2, 5)) +end + +function AttackHandler:GetRole(atkbehaviour) + return ("attacker") +end + +function AttackHandler:PickRandomPositionsOnMap() + local pos = {{math.random(0,Game.mapSizeX), math.random(0,Game.mapSizeZ)},{math.random(0,Game.mapSizeX), math.random(0,Game.mapSizeZ)},{math.random(0,Game.mapSizeX), math.random(0,Game.mapSizeZ)},{math.random(0,Game.mapSizeX), math.random(0,Game.mapSizeZ)},{math.random(0,Game.mapSizeX), math.random(0,Game.mapSizeZ)}} + return pos +end + +function AttackHandler:UnitDead(engineunit) + +end + +function AttackHandler:DoTargetting() +end + +function AttackHandler:DoTargettingOld() + +end + +function AttackHandler:IsRecruit(attkbehaviour) + +end + +function AttackHandler:AddRecruit(attkbehaviour) + +end + +function AttackHandler:RemoveRecruit(attkbehaviour) + +end + +-- How much is this unit worth? +-- +-- Idea: add a table with hardcoded values, +-- and use said values if a units found in +-- that table to highlight strategic value +function AttackHandler:ScoreUnit(unit) + local value = 1 + --[[ + if unit:CanMove() then + if unit:CanBuild() then + value = value + 1 + end + else + value = value + 2 + if unit:CanBuild() then + value = value + 2 + end + end + --]] + return value +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua b/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua index ce216f7b3..983f5fdf4 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua @@ -10,21 +10,39 @@ if controlPoints == "disabled" then shard_include( "taskqueuebehaviour" ) shard_include( "attackerbehaviour" ) shard_include( "bootbehaviour" ) + shard_include( "nukebehaviour" ) + --shard_include( "morphbehaviour" ) + --shard_include( "engineerturretbehaviour" ) else shard_include( "taskqueues" ) shard_include( "taskqueuebehaviour" ) shard_include( "attackerbehaviour" ) shard_include( "bootbehaviour" ) shard_include( "capturerbehaviour" ) + shard_include( "nukebehaviour" ) + --shard_include( "morphbehaviour" ) + --shard_include( "engineerturretbehaviour" ) end ---shard_include "capturerbehaviour" ---require "missingfactorybehaviour" ---require "autoreclaimbehaviour" ---shard_include "lowenergybehaviour" ---require "factoryregisterbehaviour" - behaviours = { + xklab = { + TaskQueueBehaviour, + }, + zarm = { + TaskQueueBehaviour, + }, + zespire1 = { + TaskQueueBehaviour, + }, + zespire4 = { + TaskQueueBehaviour, + }, + zhive = { + TaskQueueBehaviour, + }, + esilo = { + NukeBehaviour, + }, eorb = { AttackerBehaviour, }, @@ -37,60 +55,117 @@ behaviours = { eorb_up3 = { AttackerBehaviour, }, + ebasefactory = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eairplant = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eamphibfac = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eminifac = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, + ehbotfac = { + TaskQueueBehaviour, + }, + ebasefactory_up1 = { + TaskQueueBehaviour, + }, + eairplant_up1 = { + TaskQueueBehaviour, + }, + eamphibfac_up1 = { + TaskQueueBehaviour, + }, + eminifac_up1 = { + TaskQueueBehaviour, + }, + ehbotfac_up1 = { + TaskQueueBehaviour, + }, + ebasefactory_up2 = { + TaskQueueBehaviour, + }, + eairplant_up2 = { + TaskQueueBehaviour, + }, + eamphibfac_up2 = { + TaskQueueBehaviour, + }, + eminifac_up2 = { + TaskQueueBehaviour, + }, + ehbotfac_up2 = { + TaskQueueBehaviour, + }, + ebasefactory_up3 = { + TaskQueueBehaviour, + }, + eairplant_up3 = { + TaskQueueBehaviour, + }, + eamphibfac_up3 = { + TaskQueueBehaviour, + }, + eminifac_up3 = { + TaskQueueBehaviour, + }, + ehbotfac_up3 = { + TaskQueueBehaviour, + }, + + eartyturret = { + AttackerBehaviour, + }, + eartyturret_up1 = { + AttackerBehaviour, + }, + eartyturret_up2 = { + AttackerBehaviour, + }, + eartyturret_up3 = { + AttackerBehaviour, + }, + ecommanderbattleai = { TaskQueueBehaviour, - --LowEnergyBehaviour, - --EngineerTurretBehaviour, }, + eengineer5 = { TaskQueueBehaviour, - --MissingFactoryBehaviour, - --EngineerTurretBehaviour, - --LowEnergyBehaviour, }, + eamphibengineer = { TaskQueueBehaviour, - --MissingFactoryBehaviour, - --EngineerTurretBehaviour, - --LowEnergyBehaviour, }, + eairengineer = { TaskQueueBehaviour, - --MissingFactoryBehaviour, - --EngineerTurretBehaviour, - --LowEnergyBehaviour, }, + eallterrengineer = { TaskQueueBehaviour, - --MissingFactoryBehaviour, - --EngineerTurretBehaviour, - --LowEnergyBehaviour, }, --eaimexer = { --EngineerTurretBehaviour, --}, + + -- zlightswarm = { + -- AttackerBehaviour, + -- }, + -- zairscout = { + -- AttackerBehaviour, + -- }, } function defaultBehaviours(unit) b = {} u = unit:Internal() + --table.insert(b,MorphBehaviour) if u:CanBuild() then table.insert(b,TaskQueueBehaviour) if u:CanMove() then @@ -119,4 +194,4 @@ function defaultBehaviours(unit) end return b -end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/geohandler.lua b/LuaRules/Gadgets/ai/EvoRTS/geohandler.lua new file mode 100644 index 000000000..136fe2246 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/geohandler.lua @@ -0,0 +1,48 @@ +GeoSpotHandler = class(Module) + + +function GeoSpotHandler:Name() + return "GeoSpotHandler" +end + +function GeoSpotHandler:internalName() + return "geospothandler" +end + +function GeoSpotHandler:Init() + self.geos = self.game.map:GetGeoSpots() +end + +function distance(pos1,pos2) + local xd = pos1.x-pos2.x + local zd = pos1.z-pos2.z + local yd = pos1.y-pos2.y + if yd < 0 then + yd = -yd + end + dist = math.sqrt(xd*xd + zd*zd + yd*yd*yd) + return dist +end + +function GeoSpotHandler:ClosestFreeGeo(unittype,position, maxdis) + local pos = nil + local bestDistance = maxdis or 10000 + geoCount = self.game.map:GeoCount() + for i,v in ipairs(self.geos) do + local p = v + local dist = distance(position,p) + if dist < bestDistance then + if self.game.map:CanBuildHere(unittype,p) then + --checking for unit positions + local spGetUnitsInRectangle = Spring.GetUnitsInRectangle + local radius = 100 + local units_found = spGetUnitsInRectangle(p.x - radius, p.z - radius, p.x + radius, p.z + radius) + if #units_found == 0 then + bestDistance = dist + pos = p + end + end + end + end + return pos +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/modules.lua b/LuaRules/Gadgets/ai/EvoRTS/modules.lua new file mode 100644 index 000000000..3a0c12216 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/modules.lua @@ -0,0 +1,13 @@ +shard_include( "spothandler" ) +shard_include( "controlpointhandler" ) +shard_include( "unithandler" ) +shard_include( "attackhandler" ) +shard_include( "geohandler" ) +-- shard_include( "placementhandler" ) +shard_include( "newplacementhandler" ) +shard_include( "requestshandler" ) +shard_include( "sleep" ) +shard_include( "triggerhandler" ) +shard_include( "aimodehandler" ) + +modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, GeoSpotHandler, NewPlacementHandler, RequestsHandler, Sleep, TriggerHandler, AiModeHandler, } diff --git a/LuaRules/Gadgets/ai/EvoRTS/newplacementhandler.lua b/LuaRules/Gadgets/ai/EvoRTS/newplacementhandler.lua new file mode 100644 index 000000000..e252261d8 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/newplacementhandler.lua @@ -0,0 +1,285 @@ +NewPlacementHandler = class(Module) + +function NewPlacementHandler:Name() + return "NewPlacementHandler" +end + +function NewPlacementHandler:internalName() + return "newplacementhandler" +end + +function NewPlacementHandler:GetIDBuildable(id, cellsize, buildtype) + return GG.AiHelpers.NewPlacementHandler.GetIDBuildable(id,cellsize,buildtype) +end + +function NewPlacementHandler:GetPosFromID(id) + return GG.AiHelpers.NewPlacementHandler.GetPosFromID(id) +end + +function NewPlacementHandler:GetIDFromPos(x, z, cellsize) + return GG.AiHelpers.NewPlacementHandler.GetIDFromPos(x,z,cellsize) +end + +function NewPlacementHandler:ClosePosition(x,z, cellsize,spacing) + GG.AiHelpers.NewPlacementHandler.ClosePosition(x,z, cellsize, spacing) +end + +function NewPlacementHandler:FreePosition(x,z,cellsize,spacing) + GG.AiHelpers.NewPlacementHandler.FreePosition(x,z,cellsize,spacing) +end + +function generateSpiral() + local retTable = {} + local attempt = 0 + local ct = 0 + while attempt < 50 do + attempt = attempt + 1 + for v = -attempt, attempt do + for h = -attempt, attempt do + if math.abs(v) == attempt or math.abs(h) == attempt then + ct = ct + 1 + retTable[ct] = {v, h} + end + end + end + end + return retTable +end + +function NewPlacementHandler:UnitIdle(unit) + local unitDefID = UnitDefNames[unit:Name()].id + local defs = UnitDefs[unitDefID] + if defs then + if defs.canBuild == true then + local unitID = unit.id + if self.plansbyunitID[unitID] then + for planID, plan in pairs(self.plansbyunitID[unitID]) do + self:ClearPlan(planID) + local pos = self:GetPosFromID(planID) + local spacing = self:GetMinimalSpacing(self.game:GetTypeByName(def.name)) + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + self:FreePosition(pos.x, pos.z, cellsize, spacing) + end + end + end + end +end + +function NewPlacementHandler:Init() + self.plans = {} + self.plansbyunitID = {} + self.plansbyunitDefID = {} + mapwidth = math.max(Game.mapSizeX, Game.mapSizeZ) + if not spiral then + spiral = generateSpiral() + end + for i, spot in pairs(self.ai.metalspothandler.spots) do + self:ClosePosition(spot.x, spot.z, 32, 80) -- close mex positions (they might get freed during a scan though) + end +end + +function NewPlacementHandler:GetClosestBuildPosition(x, z, cellsize, buildtype) + local ID = self:GetIDFromPos(x, z, cellsize) + local POS = self:GetPosFromID(ID) + local x, z = POS.x, POS.z + local attempt = 0 + local pos + buildable = self:GetIDBuildable(ID, cellsize, buildtype) + if buildable == true then bestID = ID end + while buildable ~= true and attempt <= 10000 do + attempt = attempt + 1 + v = spiral[attempt][1] + h = spiral[attempt][2] + local id = ID + (v*cellsize*mapwidth) + (h*cellsize) + if self:GetIDBuildable(id, cellsize, buildtype) == true then + buildable = true + bestID = id + end + end + if bestID then + pos = NewPlacementHandler:GetPosFromID(bestID, cellsize) + pos.x = pos.x + cellsize/2 + pos.z = pos.z + cellsize/2 + pos.y = Spring.GetGroundHeight(pos.x, pos.z) + end + return pos +end + +function NewPlacementHandler:UnitDead(unit) + local unitDefID = UnitDefNames[unit:Name()].id + local defs = UnitDefs[unitDefID] + if defs then + if defs.isBuilding or string.find(defs.name, "nanotc") or string.find(defs.name, "zarm") then + local pos = unit:GetPosition() + local spacing = self:GetMinimalSpacing(unit:Type()) + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + self:FreePosition(pos.x, pos.z, cellsize, spacing) + elseif defs.canBuild == true then + local unitID = unit.id + if self.plansbyunitID[unitID] then + for planID, plan in pairs(self.plansbyunitID[unitID]) do + self:ClearPlan(planID) + local pos = self:GetPosFromID(planID) + local spacing = self:GetMinimalSpacing(self.game:GetTypeByName(def.name)) + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + self:FreePosition(pos.x, pos.z, cellsize, spacing) + end + end + end + end +end + +function NewPlacementHandler:UnitCreated(unit) -- Clear plan but leave position closed, unitDead will clear it + local unitDefID = UnitDefNames[unit:Name()].id + local defs = UnitDefs[unitDefID] + if defs then + if defs.isBuilding or string.find(defs.name, "nanotc") or string.find(defs.name, "zarm") then + local pos = unit:GetPosition() + local spacing = self:GetMinimalSpacing(unit:Type()) + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + local planID = self:GetIDFromPos(pos.x, pos.z, cellsize) + self:ClearPlan(planID) + end + end +end + +function NewPlacementHandler:ClearPlan(planID) + if self.plans[planID] then + local unitID = self.plans[planID].unitID + local unitDefID = self.plans[planID].unitDefID + self.plans[planID] = nil + self.plansbyunitDefID[unitDefID][planID] = nil + self.plansbyunitID[unitID][planID] = nil + end +end + +function NewPlacementHandler:CreateNewPlan(unit, utype, p) + local defs = UnitDefs[utype.id] + local Building = (defs.isBuilding == true or string.find(defs.name, "nanotc") or string.find(defs.name, "zarm")) + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + local buildtype = "ground" + p = self:GetClosestBuildPosition(p.x, p.z, cellsize, buildtype) + if p and p.x and p.y and p.z then + local facing = self:GetFacing(p) + if facing == 0 or facing == 2 then + p.x = p.x - (p.x%16) + (defs.xsize*4 % 16) + p.z = p.z - (p.z%16) + (defs.zsize*4 % 16) + else + p.x = p.x - (p.x%16) + (defs.zsize*4 % 16) + p.z = p.z - (p.z%16) + (defs.xsize*4 % 16) + end + if Spring.TestBuildOrder(utype.id, p.x,p.y,p.z, "s") == 0 then + return + end + if Building then -- filter out mobile units built from mobile engineers, these will only need a buildposition, no planning + self:ClosePosition(p.x, p.z, cellsize, self:GetMinimalSpacing(utype)) + local newplan = {unitID = unit.id, unitDefID = utype.id, p = { x= p.x, y = p.y, z = p.z}} + local planID = self:GetIDFromPos(p.x, p.z, cellsize) + newplan["planID"] = planID + self.plans[planID] = newplan + self.plansbyunitID[unit.id] = self.plansbyunitID[unit.id] or {} + self.plansbyunitID[unit.id][planID] = newplan + self.plansbyunitDefID[utype.id] = self.plansbyunitDefID[utype.id] or {} + self.plansbyunitDefID[utype.id][planID] = newplan + end + return p, facing + end + return +end + +function NewPlacementHandler:CreateNewPlanNoSearch(unit, utype, p) + local defs = UnitDefs[utype.id] + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + local buildtype = "ground" + if p and p.x and p.y and p.z then + local facing = self:GetFacing(p) + if facing == 0 or facing == 2 then + p.x = p.x - (p.x%16) + (defs.xsize*4 % 16) + p.z = p.z - (p.z%16) + (defs.zsize*4 % 16) + else + p.x = p.x - (p.x%16) + (defs.zsize*4 % 16) + p.z = p.z - (p.z%16) + (defs.xsize*4 % 16) + end + self:ClosePosition(p.x, p.z, cellsize, self:GetMinimalSpacing(utype)) + local newplan = {unitID = unit.id, unitDefID = utype.id, p = { x= p.x, y = p.y, z = p.z}} + local planID = self:GetIDFromPos(p.x, p.z, cellsize) + newplan["planID"] = planID + self.plans[planID] = newplan + self.plansbyunitID[unit.id] = self.plansbyunitID[unit.id] or {} + self.plansbyunitID[unit.id][planID] = newplan + self.plansbyunitDefID[utype.id] = self.plansbyunitDefID[utype.id] or {} + self.plansbyunitDefID[utype.id][planID] = newplan + return p, facing + end + return +end + +function NewPlacementHandler:GetFacing(p) + local x = p.x + local z = p.z + if math.abs(Game.mapSizeX - 2*x) > math.abs(Game.mapSizeZ - 2*z) then + if (2*x>Game.mapSizeX) then + facing=3 + else + facing=1 + end + else + if (2*z>Game.mapSizeZ) then + facing=2 + else + facing=0 + end + end + return facing +end + +function NewPlacementHandler:GetExistingPlansByUType(utype) + local planned = {} + if self.plansbyunitDefID[utype.id] then + local planned = {} + for planID, plan in pairs(self.plansbyunitDefID[utype.id]) do + planned[planID] = plan + end + end + return planned +end + +function NewPlacementHandler:GetExistingPlansByUnitDefID(unitDefID) + local planned = {} + if self.plansbyunitDefID[unitDefID] then + for planID, plan in pairs(self.plansbyunitDefID[unitDefID]) do + planned[planID] = plan + end + end + return planned +end + +function NewPlacementHandler:GetExistingPlansByUnit(unit) + local planned = {} + if self.plansbyunitID[unit.id] then + local planned = {} + for planID, plan in pairs(self.plansbyunitDefID[unit.id]) do + planned[planID] = plan + end + end + return planned +end + +function NewPlacementHandler:GetMinimalSpacing(utype) + if string.find(UnitDefs[utype.id].name, "zarm") then + return 300 + elseif string.find(UnitDefs[utype.id].name, "zhive") then + return 0 + elseif string.find(UnitDefs[utype.id].name, "zespire") then + local r = math.random(10,80) + return r + elseif string.find(UnitDefs[utype.id].name, "emine") then + return 0 + elseif string.find(UnitDefs[utype.id].name, "eminifac") or string.find(UnitDefs[utype.id].name, "eamphibfac") or string.find(UnitDefs[utype.id].name, "ehbotfac") or string.find(UnitDefs[utype.id].name, "ebasefactory") then + return 120 + elseif UnitDefs[utype.id].canMove == true then + return 0 + else + return 40 + end +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/nukebehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/nukebehaviour.lua new file mode 100644 index 000000000..ad862cda8 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/nukebehaviour.lua @@ -0,0 +1,44 @@ + +NukeBehaviour = class(Behaviour) + +function NukeBehaviour:Init() +end + +function NukeBehaviour:Update() + if Spring.GetGameFrame() % 120 == 0 then + if not self.target then + self.target = GG.AiHelpers.TargetsOfInterest.Nuke(self.ai.id) + end + if self.target then + if not Spring.ValidUnitID(self.target) then + self.target = nil + self.unit:Internal():ExecuteCustomCommand(CMD.STOP, {}, {}) + else + local x,y,z = Spring.GetUnitPosition(self.target) + self.unit:Internal():ExecuteCustomCommand(CMD.ATTACK, {x,y,z}, {}) + end + end + end +end + +function NukeBehaviour:OwnerBuilt() + +end + +function NukeBehaviour:OwnerDead() + +end + +function NukeBehaviour:Priority() + return 100 +end + +function NukeBehaviour:Activate() + self.active = true +end + + +function NukeBehaviour:OwnerDied() + self.active = nil + self.unit = nil +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/placementhandler.lua b/LuaRules/Gadgets/ai/EvoRTS/placementhandler.lua new file mode 100644 index 000000000..db85fd6c3 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/placementhandler.lua @@ -0,0 +1,300 @@ +PlacementHandler = class(Module) + +function PlacementHandler:Name() + return "PlacementHandler" +end + +function PlacementHandler:internalName() + return "placementhandler" +end + +function PlacementHandler:Init() + self.jobs = {} + self.spacing_spiral = self:GenerateSpiral( 5, 5 ) +end + +--[[ +Usage: + +function onSuccess( job, pos ) + -- build something I guess +end +function onFail( job ) + -- nowhere to place it, do something else then? +end +local unittype = ... +local job = { + start_position=[1,2,3], + max_radius=500, + onSuccess=onSuccess, + onFail=onFail, + unittype=unittype, + cleanup_on_unit_death=builderID +} +local success = ai.placementhandler.NewJob( job ) +if success then + -- the job has been schedule, do whatever else we need to do in parallel + -- when a position has been found, it will call the callback function we passed it + -- in the future a promise will be returned letting us define what happens +else + -- there was something wrong with our job and the system rejected it + -- the programmer should probably check all the values that went into the job were set and valid +end + +]] + + +function PlacementHandler:NewJob( details ) + --[[ + local default = { + start_position, + unittype, + placement_tests: [], + max_radius=, + onSuccess=onSuccess, + onFail=onFail, + increment=8 + cleanup_on_unit_death + } + ]]-- + if details["start_position"] == nil then + return false + end + if details["unittype"] == nil then + return false + end + if details["max_radius"] == nil then + details.max_radius = 1500 + end + if details["increment"] == nil then + details.increment = 16 + end + if details.increment < 16 then + details.increment = 16 + end + details.status = 'new' + details.step = 1 + + -- figure out the spiral search pattern necessary + local max_width = details.max_radius * 2 + local spiral_width = max_width/details.increment + details.spiral = self:GenerateSpiral(spiral_width, spiral_width ) + + table.insert( self.jobs, details ) + + -- for now it's using a completion handler, which is a function + -- passed along that it will call when it's finished, but tbh I'd + -- prefer to return some sort of promise structure + return true +end + + +function PlacementHandler:Update() + --[[ + + We need to run through our jobs, but we also need to make sure of several things: + + - when a placement job finishes, we stop processing until the next frame + - that each job only gets a limited amount of time to run + - that the algorithm can run bit by bit over several frames + + To this end, each iteration of the search is self contained. This way we can + progress 5 or 6 steps along the algorithm for each job, making sure we don't + spend too long searching and lag the game out. + + As a bonus, this opens up the future for scheduling and collaborative searches. + It also allows us to cancel and pause searches. + + For our situation, we're going to allot a time budget for each job, and a + time budget for each frame. During this time, we can only work on a job for + so long. If it's a fast CPU we can do more iterations in that time. It also + means we can only work on so many jobs per frame. This way we get the top + of the queue done sooner, so we don't get bogged down in an ever growing queue. + + A bonus of this, is that quick jobs will finish earlier, allowing work to be + done on an extra job. Another side of this is that if the cpu is busy with + stuff, we might have to finish early. I envisage Shard should take time + measurements for the entire frame to make sure that modules such as this + one can give themselves smaller budgets when under load + ]] + + -- exit early if there are no jobs + if #self.jobs == 0 then + return + end + + self:RunIterations() + self:CleanupJobs() +end + +function PlacementHandler:RunIterations() + for i,j in ipairs(self.jobs) do + if j.status ~= 'cleanup' then + local job = self.jobs[i] + self:RunJobIterations( job ) + end + end +end + +function PlacementHandler:RunJobIterations( job ) + local stillGotTime = 4 --500 + -- given this particular job, lets give it a time budget and do as many + -- iterations as we can + while ( stillGotTime > 0 ) and ( job.status ~= 'cleanup' ) do + self:IterateJob( job ) + stillGotTime = stillGotTime - 1 + end +end + +function PlacementHandler:IterateJob( job ) + -- setup this run + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + return + end + job.status = 'running' + local step = job.step + local spos = job.spiral[step] + local pos = { + x=spos.x * job.increment + job.start_position.x, + y=job.start_position.y, + z=spos.y * job.increment + job.start_position.z + } + + -- test this particular step of the spiral + local buildable = self:CanBuildAt(job.unittype, pos ) + if buildable then + -- we found a place! + job.result = pos + job.status = 'cleanup' + SendToUnsynced("shard_debug_position",pos.x,pos.z,"final_choice") + job.onSuccess( job, pos ) + end + + job.step = job.step + 1 + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + end +end + +function PlacementHandler:CanBuildAt( unittype, pos ) + local buildable = self.ai.map:CanBuildHere( unittype, pos ) + if not buildable then + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_bad") + return false + end + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_good") + + + local fixed_spacing = 48 + + --avoiding metal spots( Work in Progress ) + --[[ + local spotPositions = self.game.map:GetMetalSpots() + local spotCount = self.game.map:SpotCount() + for i = 1,spotCount do + metalspot = spotPositions[i] + end + --]] + + --checking for unit positions + local spGetUnitsInRectangle = Spring.GetUnitsInRectangle + local radius = 125 + local units_found = spGetUnitsInRectangle(pos.x - radius, pos.z - radius, pos.x + radius, pos.z + radius) + if #units_found > 0 then + --for i = 1,#units_found do + --local unitID = units_found[i] + --if not UnitDefs[Spring.GetUnitDefID(unitID)].canmove then + --end + --end + return false + end + + -- check spacing + -- we're going to do this in a hacky way for now until a blocking + -- map and footprints are added to the shard API, but on the other + -- hand it's simple + + -- what we're going to do is enforce a standardised minimum + -- spacing, and check above below left and right of the position + -- to check, by shifting the position by a set amount and checking + -- that position + + for i,j in ipairs(self.spacing_spiral) do + testpos = { x=pos.x + ( j.x * fixed_spacing ), y=pos.y, z= pos.z + ( j.x * fixed_spacing ) } + if not self:CanBuildHere( unittype, testpos ) then + return false + end + end + + return true +end + +function PlacementHandler:CanBuildHere(unittype, testpos ) + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + return true +end + +function PlacementHandler:CleanupJobs() + -- try and clean up dead recruits where possible + for i,j in ipairs(self.jobs) do + if j.status == 'cleanup' then + local job = self.jobs[i] + table.remove( self.jobs, i ) + return + end + end +end + +--[[ +Some jobs are tied to units being alive. This could be because +it's the building the job was intended for. Eitherway, if that +unit dies then the associated job is unnecessary, and needs to +be cleaned up to save cpu +]] +function PlacementHandler:UnitDead(engineunit) + for i,j in ipairs(self.jobs) do + if j['cleanup_on_unit_death'] ~= nil then + if j.cleanup_on_unit_death == engineunit:ID() then + j.status = 'cleanup' + end + end + end +end + + +function PlacementHandler:GenerateSpiral( width, height) + local x = 0 + local y = 0 + local dx = 0 + local dy = -1 + local t = math.max(width,height) + local maxI = t*t; + local result = {} + for i=0, maxI do + if ((-width/2 <= x) and (x <= width/2) and (-height/2 <= y) and (y <= height/2)) then + table.insert( result, {x=x,y=y} ) + end + if ( ( x == y ) or ( ( x < 0 ) and ( x == -y ) ) or ( (x > 0) and ( x == 1-y ) ) ) then + t = dx + dx = dy * -1 + dy = t + end + x = x + dx + y = y + dy + end + return result +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/requestshandler.lua b/LuaRules/Gadgets/ai/EvoRTS/requestshandler.lua new file mode 100644 index 000000000..5d4957b40 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/requestshandler.lua @@ -0,0 +1,66 @@ +RequestsHandler = class(Module) + +function RequestsHandler:Name() + return "RequestsHandler" +end + +function RequestsHandler:internalName() + return "requestshandler" +end + +function RequestsHandler:Init() + self.requests = {} +end + +local UDC = Spring.GetTeamUnitDefCount +local UDN = UnitDefNames + +function RequestsHandler:Update() + +end + +function RequestsHandler:AddRequest(priority, requestedTask, commrequired) + if commrequired == true then + requestedTask.needCom = true + end + if not self.requests[1] then + self.requests[1] = requestedTask + return + end + if priority == true then + for i = #self.requests,1, -1 do + if self.requests[i] then + self.requests[i + 1] = self.requests[i] + end + end + self.requests[1] = requestedTask + else + self.requests[#self.requests+1] = requestedTask + end + -- if priority == true and commrequired == true then + -- local comms = Spring.GetTeamUnitsByDefs(self.ai.id, {UnitDefNames.ecommanderbattleai.id}) + -- for ct, unitID in pairs(comms) do + -- Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, {}) + -- end + -- end +end + +function RequestsHandler:RemoveRequest(n) + for i = n, #self.requests - 1 do + self.requests[i] = self.requests[i + 1] + end + self.requests[#self.requests] = nil +end + +function RequestsHandler:GetRequestedTask(unit) + if self.requests[1] then + if self.requests[1].needCom == true and (not (unit:Name() == "ecommanderbattleai")) then + return {action = "nexttask"} + end + local task = self.requests[1] + self:RemoveRequest(1) + return task + else + return {action = "nexttask"} + end +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/spothandler.lua b/LuaRules/Gadgets/ai/EvoRTS/spothandler.lua new file mode 100644 index 000000000..e447a6d54 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/spothandler.lua @@ -0,0 +1,228 @@ +MetalSpotHandler = class(Module) + + +function MetalSpotHandler:Name() + return "MetalSpotHandler" +end + +function MetalSpotHandler:internalName() + return "metalspothandler" +end + +function MetalSpotHandler:Init() + self.spots = self.game.map:GetMetalSpots() +end + +------------------------------------------------------------ +-- Config +------------------------------------------------------------ +local gridSize = 16 -- Resolution of metal map +local buildGridSize = 8 -- Resolution of build positions + +------------------------------------------------------------ +-- Speedups +------------------------------------------------------------ +local min, max = math.min, math.max +local floor, ceil = math.floor, math.ceil +local sqrt = math.sqrt +local huge = math.huge + +local spGetGroundInfo = Spring.GetGroundInfo +local spGetGroundHeight = Spring.GetGroundHeight +local spTestBuildOrder = Spring.TestBuildOrder +local spGetUnitsInCylinder = Spring.GetUnitsInCylinder +local extractorRadius = Game.extractorRadius +local extractorRadiusSqr = extractorRadius * extractorRadius + +local buildmapSizeX = Game.mapSizeX - buildGridSize +local buildmapSizeZ = Game.mapSizeZ - buildGridSize +local buildmapStartX = buildGridSize +local buildmapStartZ = buildGridSize + +local metalmapSizeX = Game.mapSizeX - 1.5 * gridSize +local metalmapSizeZ = Game.mapSizeZ - 1.5 * gridSize +local metalmapStartX = 1.5 * gridSize +local metalmapStartZ = 1.5 * gridSize + + +function GetMexPositions(spot, uDefID, facing, testBuild) + + local positions = {} + + local xoff, zoff + local uDef = UnitDefs[uDefID] + if facing == 0 or facing == 2 then + xoff = (4 * uDef.xsize) % 16 + zoff = (4 * uDef.zsize) % 16 + else + xoff = (4 * uDef.zsize) % 16 + zoff = (4 * uDef.xsize) % 16 + end + + if not spot.validLeft then + GetValidStrips(spot) + end + + local validLeft = spot.validLeft + local validRight = spot.validRight + for z, vLeft in pairs(validLeft) do + if z % 16 == zoff then + for x = gridSize * ceil((vLeft + xoff) / gridSize) - xoff, + gridSize * floor((validRight[z] + xoff) / gridSize) - xoff, + gridSize do + local y = spGetGroundHeight(x, z) + if not (testBuild and spTestBuildOrder(uDefID, x, y, z, facing) == 0) then + positions[#positions + 1] = {x, y, z} + end + end + end + end + + return positions +end + +function GetValidStrips(spot) + spot.left = {} + spot.right = {} + spot.minX = spot.x - 16 + spot.minZ = spot.z - 16 + spot.maxX = spot.x + 16 + spot.maxZ = spot.z + 16 + + for iz = spot.minZ, spot.maxZ do + spot.left[iz] = spot.minX + spot.right[iz] = spot.maxX + end + + + local sMinZ, sMaxZ = spot.minZ, spot.maxZ + local sLeft, sRight = spot.left, spot.right + + local validLeft = {} + local validRight = {} + + local maxZOffset = buildGridSize * ceil(extractorRadius / buildGridSize - 1) + for mz = max(sMaxZ - maxZOffset, buildmapStartZ), min(sMinZ + maxZOffset, buildmapSizeZ), buildGridSize do + local vLeft, vRight = buildmapStartX, buildmapSizeX + for sz = sMinZ, sMaxZ, gridSize do + local dz = sz - mz + local maxXOffset = buildGridSize * ceil(sqrt(extractorRadiusSqr - dz * dz) / buildGridSize - 1) -- Test for metal being included is dist < extractorRadius + local left, right = sRight[sz] - maxXOffset, sLeft[sz] + maxXOffset + if left > vLeft then vLeft = left end + if right < vRight then vRight = right end + end + validLeft[mz] = vLeft + validRight[mz] = vRight + end + + spot.validLeft = validLeft + spot.validRight = validRight +end + +function IsMexPositionValid(spot, x, z) + + if z <= spot.maxZ - extractorRadius or + z >= spot.minZ + extractorRadius then -- Test for metal being included is dist < extractorRadius + return false + end + + local sLeft, sRight = spot.left, spot.right + for sz = spot.minZ, spot.maxZ, gridSize do + local dz = sz - z + local maxXOffset = sqrt(extractorRadiusSqr - dz * dz) -- Test for metal being included is dist < extractorRadius + if x <= sRight[sz] - maxXOffset or + x >= sLeft[sz] + maxXOffset then + return false + end + end + + return true +end + + +function distance(pos1,pos2) + local xd = pos1.x-pos2.x + local zd = pos1.z-pos2.z + local yd = 0 + if yd < 0 then + yd = -yd + end + dist = math.sqrt(xd*xd + zd*zd + yd*yd*yd) + return dist +end + +function NoMex(x,z, batchextracts,teamID) -- Is there any better mex at this location (returns false if there is) + local mexesatspot = Spring.GetUnitsInCylinder(x,z,128) + for ct, uid in pairs(mexesatspot) do + if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "xmetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zmex")) and (teamID and Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then + return false + end + end + return true +end + +function EnemyMex(x,z, batchextracts,teamID) -- Is there any better mex at this location (returns false if there is) + local mexesatspot = Spring.GetUnitsInCylinder(x,z,128) + for ct, uid in pairs(mexesatspot) do + if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "xmetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zmex")) and (teamID and not Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then + return true + end + end + return false +end + +function MetalSpotHandler:ClosestFreeSpot(unittype,position,maxdis) + local pos = nil + local bestDistance = maxdis or 100000 + spotCount = self.game.map:SpotCount() + local teamID = self.ai.id + for i,v in ipairs(self.spots) do + local p = v + local dist = distance(position,p) + if NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "xmetalextractor"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhatch"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zlair"), teamID) then + if EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "xmetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zmex"), teamID) == false then + if dist < bestDistance then + bestDistance = dist + pos = p + end + end + end + end + return pos +end + +function MetalSpotHandler:ClosestEnemySpot(unittype,position) + local pos = nil + local bestDistance = 100000 + spotCount = self.game.map:SpotCount() + local teamID = self.ai.id + for i,v in ipairs(self.spots) do + local p = v + local dist = distance(position,p) + if EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "xmetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhatch"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zlair"), teamID) then + if dist < bestDistance then + bestDistance = dist + pos = p + end + end + end + return pos +end + +function MetalSpotHandler:GetClosestMexPosition(spot, x, z, uDefID, facing) + x, z = spot.x, spot.z + local bestPos + local bestDist = math.huge + local positions = GetMexPositions(spot, uDefID, facing, true) + for i = 1, #positions do + local pos = positions[i] + local dx, dz = x - pos[1], z - pos[3] + local dist = dx*dx + dz*dz + if dist < bestDist then + bestPos = pos + bestDist = dist + end + end + if bestPos then bestPos = {x = bestPos[1], y = bestPos[2], z = bestPos[3]} end + return bestPos +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/taskqueuebehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/taskqueuebehaviour.lua new file mode 100644 index 000000000..26c4a7301 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/taskqueuebehaviour.lua @@ -0,0 +1,436 @@ +TaskQueueBehaviour = class(Behaviour) + +function TaskQueueBehaviour:Init() + self.active = false + u = self.unit + u = u:Internal() + self.name = u:Name() + self.countdown = 0 + if self:HasQueues() then + self.queue = self:GetQueue() + end + + self.waiting = {} + self:OnToNextTask() + self.ImBusy = 0 +end + +function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then + k = '"'..k..'"' + end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end + +function TaskQueueBehaviour:HasQueues() + return (taskqueues[self.name] ~= nil) +end + +function TaskQueueBehaviour:OwnerBuilt(unit) + if not self:IsActive() then + return + end + self:OnToNextTask() +end + +function TaskQueueBehaviour:OwnerIdle(unit) + if not self:IsActive() then + return + end + self.countdown = 0 + self:OnToNextTask() +end + +function TaskQueueBehaviour:OwnerMoveFailed(unit) + if not self:IsActive() then + return + end + self:OwnerIdle(unit) +end + +function TaskQueueBehaviour:OwnerDead() + if self.waiting ~= nil then + for k,v in pairs(self.waiting) do + self.ai.modules.sleep.Kill(self.waiting[k]) + end + end + self.waiting = nil + self.unit = nil +end + +function TaskQueueBehaviour:GetQueue() + q = taskqueues[self.name] + if type(q) == "function" then + q = q(self, self.ai, self.unit) + end + return q +end +function TaskQueueBehaviour:CanQueueNextTask() + local unitID = self.unit:Internal().id + --- must: already have 1 queue (not override default behaviour) + --- Have less than 2 queues (not cancel the next buildings + --- Have "secured" the cur spot it has to build on (not cancel 1st in queue to start 2nd in queue == is currently building + --- We check curqueuelength == 1 + --- Unit is not a factory + local notfactory = self.unit:Internal():Type():IsFactory() ~= true + local notprogressing = self.progress ~= true -- Not already progressing in queue + local curqueuelength = #(Spring.GetCommandQueue(unitID,2)) + local building = Spring.GetUnitIsBuilding(unitID) + -- we check cur buildspeed/power ~= 0 + if curqueuelength <= 0 and building and notprogressing and notfactory then + return true + else + return + end +end + +function TaskQueueBehaviour:IsRunningAQueue() + if Spring.GetCommandQueue(self.unit:Internal().id,0) > 0 then + return true + else + return false + end +end + +function TaskQueueBehaviour:IsBusy() + if Spring.GetUnitCurrentBuildPower(self.unit:Internal().id) == 0 then + return false + else + return true + end +end + +function TaskQueueBehaviour:CompareWithOldPos() + local result = false + local x,y,z = Spring.GetUnitPosition(self.unit:Internal().id) + if self.oldPos then + if math.sqrt((x-self.oldPos.x)^2+(y-self.oldPos.y)^2+(z-self.oldPos.z)^2) < 16 then + result = true + else + result = false + end + end + self.oldPos = {x = x, y = y, z = z} + return result +end + +function TaskQueueBehaviour:Update() + if Spring.GetGameFrame()%30 and Spring.GetGameFrame() > 30 then + if self:IsBusy() then + self.ImBusy = 15 + elseif not self:IsBusy() and self.ImBusy > 0 then + self.ImBusy = self.ImBusy - 1 + end + end + if Spring.GetGameFrame()%600 == self.unit:Internal().id%600 and Spring.GetGameFrame() > 600 then + if (not self.unit:Internal():Type():IsFactory()) then + if self:IsRunningAQueue() and (not self:IsBusy()) and self.ImBusy == 0 and self:CompareWithOldPos() then -- check stucked cons + --self.ai.newplacementhandler:UnitIdle(self.unit:Internal()) + self.unit:Internal():ExecuteCustomCommand(CMD.STOP, {}, {}) --> Triggers UnitIdle -> Next Task + elseif (not self:IsRunningAQueue()) and (not self:IsBusy()) and self.ImBusy == 0 then + --self.ai.newplacementhandler:UnitIdle(self.unit:Internal()) + self.unit:Internal():ExecuteCustomCommand(CMD.STOP, {}, {}) --> Triggers UnitIdle -> Next Task + self:CompareWithOldPos() + else + self:CompareWithOldPos() -- still register current position + end + end + end + if not self:IsActive() then + self:DebugPoint("nothing") + return + end + local f = self.game:Frame() + if f%15 == self.unit:Internal().id%15 then + if self:CanQueueNextTask() then + self.progress = true + end + end + if self.progress == true then + if self.countdown > 14 then + self:ProgressQueue() + else + if self.countdown == nil then + self.countdown = 1 + else + self.countdown = self.countdown + 1 + end + end + end +end + +TaskQueueWakeup = class(function(a,tqb) + a.tqb = tqb +end) +function TaskQueueWakeup:wakeup() + self.tqb:ProgressQueue() +end + +function TaskQueueBehaviour:ProgressQueue() + unit = self.unit:Internal() + if self:IsWaitingForPosition() then + self:DebugPoint("waiting") + return + end + if self.queue == nil then + if self:HasQueues() then + self.queue = self:GetQueue() + else + self:DebugPoint("nothing") + return + end + end + self.countdown = 0 + self.progress = false + + if self.queue == nil then + self.game:SendToConsole("Warning: A "..self.name.." unit, has an empty task queue") + self:OnToNextTask() + self:DebugPoint("nothing") + return + end + local idx, val = next(self.queue,self.idx) + self.idx = idx + if idx == nil then + self:DebugPoint("nothing") + self.queue = self:GetQueue(name) + self:OnToNextTask() + return + end + + local utype = nil + local value = val + if type(val) == "function" then + value = val(self, self.ai, unit) + end + if value == "next" then + self:DebugPoint("nothing") + self:OnToNextTask() + return + end + if type(val) == "table" then + self:HandleActionTask( value ) + return + end + if type(value) == "table" then + self:HandleActionTask( value ) + return + end + + success = self:TryToBuild( value ) + if success ~= true then + self:DebugPoint("nothing") + self:OnToNextTask() + return + end +end + +function TaskQueueBehaviour:TryToBuild( unit_name, pos ) + --Spring.Echo(unit_name) + utype = self.game:GetTypeByName(unit_name) + if not utype then + self.game:SendToConsole("Cannot build:"..unit_name..", could not grab the unit type from the engine") + return false + end + if unit:CanBuild(utype) ~= true then + return false + end + local success = false + if utype:Extractor() then + success = self:BuildExtractor(utype) + elseif utype:Geothermal() then + success = self:BuildGeo(utype) + elseif unit:Type():IsFactory() then + success = self.unit:Internal():Build(utype) + else + success = self:BuildOnMap(utype,pos) + end + return success +end + +function TaskQueueBehaviour:HandleActionTask( task ) + local action = task.action + if action == "nexttask" then + self:OnToNextTask() + elseif action == "ezmorph" then + --Spring.Echo("Trying to EZMorph "..self.unit:Internal().id) + self.unit:Internal():EZMorph() + self:OnToNextTask() + elseif action == "wait" then + if task.frames == "infinite" then + return + end + t = TaskQueueWakeup(self) + tqb = self + local wakeup = function() + tqb:ProgressQueue() + end + self.ai.sleep:Wait( wakeup, task.frames) + elseif action == "command" then + if task.params then + self.unit:Internal():ExecuteCustomCommand(task.params.cmdID, task.params.cmdParams, task.params.cmdOptions) + end + elseif UnitDefNames[action] and task.pos then + if not task.pos.x then + task.pos = nil + end + self:TryToBuild(action, task.pos) + elseif action == "move" then + self.unit:Internal():Move(task.position) + elseif action == "moverelative" then + local upos = unit:GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():Move(newpos) + elseif action == "fight" then + self.unit:Internal():MoveAndFire(task.position) + elseif action == "fightrelative" then + local upos = self.unit:Internal():GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():MoveAndFire(newpos) + elseif action == "patrol" then + self.unit:Internal():MoveAndPatrol(task.position) + elseif action == "patrolrelative" then + local upos = self.unit:Internal():GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():MoveAndPatrol(newpos) + else + self.game:SendToConsole("Error: Unknown action task "..value.." given to a "..self.name) + self:DebugPoint("nothing") + self:OnToNextTask() + end +end + +function onsuccess( job, pos ) + job.tqb:OnBuildingPlacementSuccess( job, pos ) +end + +function onfail( job ) + job.tqb:OnBuildingPlacementFailure( job ) +end + +function TaskQueueBehaviour:IsWaitingForPosition() + return self.placementInProgress +end + + +function TaskQueueBehaviour:BeginWaitingForPosition() + self.placementInProgress = true +end + +function TaskQueueBehaviour:StopWaitingForPosition() + self.placementInProgress = false +end + +function TaskQueueBehaviour:BuildOnMap(utype,pos) + unit = self.unit:Internal() + local facing = 0 + if pos then + pos, facing = self.ai.newplacementhandler:CreateNewPlan(unit, utype, pos) + else + pos = unit:GetPosition() + pos, facing = self.ai.newplacementhandler:CreateNewPlan(unit, utype, pos) + end + job = { + start_position=pos, + max_radius=1500, + onSuccess=onsuccess, + onFail=onfail, + unittype=utype, + cleanup_on_unit_death=self.unit.engineID, + tqb=self + } + if pos then + self:OnBuildingPlacementSuccess( job, pos, facing ) + return true + else + self:OnBuildingPlacementFailure( job, pos ) + return false + end +end + +function TaskQueueBehaviour:BuildGeo(utype) + -- find a free spot! + unit = self.unit:Internal() + local facing = 0 + p = unit:GetPosition() + p = self.ai.geospothandler:ClosestFreeGeo(utype,p,2500) + if p == nil or self.game.map:CanBuildHere(utype,p) ~= true then + self:OnToNextTask() + return false + end + p, facing = self.ai.newplacementhandler:CreateNewPlanNoSearch(unit,utype,p) + return self.unit:Internal():Build(utype,p,facing,{"shift"}) +end + +function TaskQueueBehaviour:BuildExtractor(utype) + -- find a free spot! + unit = self.unit:Internal() + local p = unit:GetPosition() + local up = p + local facing = 0 + p = self.ai.metalspothandler:ClosestFreeSpot(utype,p) + if not p then + self:OnToNextTask() + return false + end + p, facing = self.ai.newplacementhandler:CreateNewPlanNoSearch(unit,utype,p) + return self.unit:Internal():Build(utype,p,facing,{"shift"}) +end + +function TaskQueueBehaviour:OnToNextTask() + self.progress = true +end + +function TaskQueueBehaviour:IsDoingSomething() + return ( self.progress == false ) +end + +function TaskQueueBehaviour:OnBuildingPlacementSuccess( job, pos, facing ) + self:StopWaitingForPosition() + local p = dump( pos ) + local success self.unit:Internal():Build( job.unittype, pos, facing,{"shift"}) + --if success == false then + --self:OnToNextTask() + --end +end + +function TaskQueueBehaviour:OnBuildingPlacementFailure( job ) + self:StopWaitingForPosition() + self:OnToNextTask() +end + +function TaskQueueBehaviour:Activate() + self.progress = true + self.active = true +end + +function TaskQueueBehaviour:Deactivate() + self.active = false +end + +function TaskQueueBehaviour:Priority() + return 50 +end + +function TaskQueueBehaviour:DebugPoint( type ) + local unit = self.unit:Internal() + local p = unit:GetPosition() + SendToUnsynced("shard_debug_position",p.x,p.z,type) +end diff --git a/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua b/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua index b27bd2b41..427ba18c5 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua @@ -6,9 +6,6 @@ math.randomseed( os.time() ) math.random(); math.random(); math.random() --------------------------------------------- Functions for AI -local aiDifficulty = Spring.GetModOptions().aidifficulty -local aiUnits = Spring.GetModOptions().aiunits -local aiNukes = Spring.GetModOptions().ainukes local aiDebug = Spring.GetModOptions().aidebug local spGetTeamUnitsSorted = Spring.GetTeamUnitsSorted local spGetUnitDefID = Spring.GetUnitDefID @@ -17,709 +14,1363 @@ local spGetTeamUnitDefCount = Spring.GetTeamUnitDefCount local spGetTeamInfo = Spring.GetTeamInfo local spGetTeamStartPosition = Spring.GetTeamStartPosition local spGetAllyTeamStartBox = Spring.GetAllyTeamStartBox +local liftersqueued = 0 +local skip = {action = "nexttask"} +local MaximumSupply = tonumber(Spring.GetModOptions().supplycap) +if MaximumSupply == nil then + MaximumSupply = 400 +end --Spring.GetGameSeconds() -- checking gametime -if aiDebug == nil then - aiDebug = "enabled" +local UDC = Spring.GetTeamUnitDefCount +local UDN = UnitDefNames +---------------------------------------------------------------------- + +local unitoptions = {} +local options = {} +local skip = {action = "nexttask"} +local assistaround = { action = "fightrelative", position = {x = 0, y = 0, z = 0} } +local patrolaround = { action = "patrolrelative", position = {x = 1, y = 0, z = 1} } +local ezMorph = {action = "ezmorph"} + +-------------------------------------------------------------------------------------------- +--------------------------------------- Main Functions ------------------------------------- +-------------------------------------------------------------------------------------------- + +---- UNIT COUNTS --- + +function GetArtileryUnits(tqb,ai,unit) + local list = { + UDN.eartytank.id, UDN.eartytank_up1.id, UDN.eartytank_up2.id, UDN.eartytank_up3.id, + UDN.eartytank_saturation.id, UDN.eartytank_saturation_up1.id, UDN.eartytank_saturation_up2.id, UDN.eartytank_saturation_up3.id, + UDN.eamphibarty.id, UDN.eamphibarty_up1.id, UDN.eamphibarty_up2.id, UDN.eamphibarty_up3.id, + UDN.eallterrassault.id, UDN.eallterrassault_up1.id, UDN.eallterrassault_up2.id, UDN.eallterrassault_up3.id, + UDN.xklab.id, + } + local units = Spring.GetTeamUnitsByDefs(ai.id, list) + return #units end -if aiUnits == nil then - aiUnits = "enabled" +function GetFacs(tqb,ai,unit) + local list = { + UDN.eairplant.id, UDN.eairplant_up1.id, UDN.eairplant_up2.id, UDN.eairplant_up3.id, + UDN.eminifac.id, UDN.eminifac_up1.id, UDN.eminifac_up2.id, UDN.eminifac_up3.id, + UDN.eamphibfac.id, UDN.eamphibfac_up1.id, UDN.eamphibfac_up2.id, UDN.eamphibfac_up3.id, + UDN.ehbotfac.id, UDN.ehbotfac_up1.id, UDN.ehbotfac_up2.id, UDN.ehbotfac_up3.id, + UDN.ebasefactory.id, UDN.ebasefactory_up1.id, UDN.ebasefactory_up2.id, UDN.ebasefactory_up3.id, + UDN.xklab.id, + } + local units = Spring.GetTeamUnitsByDefs(ai.id, list) + return #units end -if aiUnits == nil then - aiUnits = "enabled" +function GetPlannedFacs(tqb, ai, unit) + local list = { + UDN.eairplant.id, UDN.eairplant_up1.id, UDN.eairplant_up2.id, UDN.eairplant_up3.id, + UDN.eminifac.id, UDN.eminifac_up1.id, UDN.eminifac_up2.id, UDN.eminifac_up3.id, + UDN.eamphibfac.id, UDN.eamphibfac_up1.id, UDN.eamphibfac_up2.id, UDN.eamphibfac_up3.id, + UDN.ehbotfac.id, UDN.ehbotfac_up1.id, UDN.ehbotfac_up2.id, UDN.ehbotfac_up3.id, + UDN.ebasefactory.id, UDN.ebasefactory_up1.id, UDN.ebasefactory_up2.id, UDN.ebasefactory_up3.id, + UDN.xklab.id, + } + local total = 0 + for ct, unitDefID in pairs(list) do + local planned = ai.newplacementhandler:GetExistingPlansByUnitDefID(unitDefID) + for planID, plan in pairs(planned) do + total = total + 1 + end + end + return total end -if aiNukes == nil then - aiNukes = "enabled" +function GetPlannedAndUnfinishedFacs(tqb,ai,unit) + local list = { + UDN.eairplant.id, UDN.eairplant_up1.id, UDN.eairplant_up2.id, UDN.eairplant_up3.id, + UDN.eminifac.id, UDN.eminifac_up1.id, UDN.eminifac_up2.id, UDN.eminifac_up3.id, + UDN.eamphibfac.id, UDN.eamphibfac_up1.id, UDN.eamphibfac_up2.id, UDN.eamphibfac_up3.id, + UDN.ehbotfac.id, UDN.ehbotfac_up1.id, UDN.ehbotfac_up2.id, UDN.ehbotfac_up3.id, + UDN.ebasefactory.id, UDN.ebasefactory_up1.id, UDN.ebasefactory_up2.id, UDN.ebasefactory_up3.id, + UDN.xklab.id, + } + local count = 0 + for ct, unitDefID in pairs(list) do + count = count + UUDC(UnitDefs[unitDefID].name, ai.id) + end + count = count + GetPlannedFacs(tqb, ai, unit) + return count end -if aiDifficulty == nil then - aiDifficulty = "easy" +function AllFacs(tqb, ai, unit) + return GetFacs(tqb,ai,unit) + GetPlannedFacs(tqb, ai, unit) end -local WaitRNG = math.random(0,500) ----------------------------------------------------------------- LIFTER QUEUES - - --function MoveToStartLocation() - - --local startxmin, startzmin, startxmax, startzmax = spGetAllyTeamStartBox(ai.allyId) - --local px = math.random(startxmin, startxmax) - --local pz = math.random(startzmin, startzmax) - --local py = 0 - - --Spring.Echo([[AI startxmin ]] .. startxmin .. [[ ]]) - --Spring.Echo([[AI startzmin ]] .. startzmin .. [[ ]]) - --Spring.Echo([[AI startxmax ]] .. startxmax .. [[ ]]) - --Spring.Echo([[AI startzmax ]] .. startzmax .. [[ ]]) - - --local spawnposx, _, spawnposz = spGetTeamStartPosition(ai.id) - --local sx = spawnposx - --local sz = spawnposz - - --Spring.Echo([[AI spawnx ]] .. sx .. [[ ]]) - --Spring.Echo([[AI spawnz ]] .. sz .. [[ ]]) - - --mx = sx - px - --mz = sz - pz - --my = 0 - --local x = mx - --local y = my - --local z = mz - - --Spring.Echo([[AI startlocationx ]] .. mx .. [[ ]]) - --Spring.Echo([[AI startlocationz ]] .. mz .. [[ ]]) - - --Spring.Echo([[AI ID ]] .. ai.id .. [[ ]]) - --Spring.Echo([[AI allyID ]] .. ai.allyId .. [[ ]]) +function GetType(tqb,ai,unit,list) + local units = Spring.GetTeamUnitsByDefs(ai.id, list) + return #units +end + +function GetPlannedType(tqb, ai, unit,list) + local total = 0 + for ct, unitDefID in pairs(list) do + local planned = ai.newplacementhandler:GetExistingPlansByUnitDefID(unitDefID) + for planID, plan in pairs(planned) do + total = total + 1 + end + end + return total +end + +function GetPlannedAndUnfinishedType(tqb,ai,unit,list) + local count = 0 + for ct, unitDefID in pairs(list) do + count = count + UUDC(UnitDefs[unitDefID].name, ai.id) + end + count = count + GetPlannedType(tqb, ai, unit,list) + return count +end + +function AllType(tqb, ai, unit, list) + return GetType(tqb,ai,unit,list) + GetPlannedType(tqb, ai, unit, list) +end ---end - function BuildMex() +function UUDC(unitName, teamID) -- Unfinished UnitDef Count + local count = 0 + if UnitDefNames[unitName] then + local tableUnits = Spring.GetTeamUnitsByDefs(teamID, UnitDefNames[unitName].id) + for k, v in pairs(tableUnits) do + local _,_,_,_,bp = Spring.GetUnitHealth(v) + if bp < 1 then + count = count + 1 + end + end + end + return count +end + +function MoveToRandomStartBoxLocation(tqb, ai, unit) + local _,_,_,_,_,MyAllyTeam = Spring.GetTeamInfo(ai.id) + local startxmin, startzmin, startxmax, startzmax = spGetAllyTeamStartBox(MyAllyTeam) + local mx = Game.mapSizeX + local mz = Game.mapSizeZ + if startxmax == mx and startzmax == mz and startxmin == 0 and startzmin == 0 then + return skip + else + px = math.random(startxmin, startxmax) + pz = math.random(startzmin, startzmax) + py = Spring.GetGroundHeight(px, pz) + end + if py <= 0 then + return skip + end + return {action = "move", position = {x = px, y = py, z = pz}} +end + +---- FIND BEST --- +function FindBest(unitoptions,ai) + if unitoptions and unitoptions[1] then + local effect = {} + local randomization = 1 + local randomunit = {} + for n, unitName in pairs(unitoptions) do + local cost = UnitDefs[UnitDefNames[unitName].id].energyCost + UnitDefs[UnitDefNames[unitName].id].metalCost + local avgkilled_cost = GG.AiHelpers.UnitInfo(ai.id, UnitDefNames[unitName].id) and GG.AiHelpers.UnitInfo(ai.id, UnitDefNames[unitName].id).avgkilled_cost or 200 --start at 200 so that costly units aren't made from the start + effect[unitName] = math.max(math.floor((avgkilled_cost/cost)^4*10),1) + for i = randomization, randomization + effect[unitName] do + randomunit[i] = unitName + end + randomization = randomization + effect[unitName] + end + if randomization < 1 then + return skip + end + return randomunit[math.random(1,randomization)] + else + return unitoptions[math.random(1,#unitoptions)] + end +end +--------------- + +---------------------------------------------------------------- BUILD FUNCTIONS +--------------------------------------STRUCTURES + +function BuildTechFacility(tqb, ai, unit) + --Spring.Echo([[Build Tech Facility]]) + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + elseif not GG.TechCheck("tech1", ai.id) and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.etech1.id) == 0 then + return "etech1" + else + return skip + end +end + +function BuildFactory(tqb, ai, unit) + --Spring.Echo([[Build Factory]]) + local count = GetFacs(tqb,ai,unit) local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") - if mc <= ms*0.5 then + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + elseif count < Spring.GetGameSeconds()*0.00332 then + if count > 0 and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up1.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up2.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up3.id) < 1 then + return "eairplant" + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"eairplant", "eminifac", "eamphibfac", "ehbotfac", "ebasefactory",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eminifac", "eamphibfac", "ehbotfac", "ebasefactory",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildMex(tqb, ai, unit) + --Spring.Echo([[Build Mex]]) + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + else return "emetalextractor" + end +end + +function BuildEnergy(tqb, ai, unit) + --Spring.Echo([[Build Energy]]) + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" else - return + local r = math.random(0,20) + if ei <= ee or r == 0 then + if GG.TechCheck("tech3", ai.id) then + return "efusion2" + elseif GG.TechCheck("tech2", ai.id) then + return "egeothermal" + elseif GG.TechCheck("tech1", ai.id) then + return "esolar2" + elseif GG.TechCheck("tech0", ai.id) then + return "esolar2" + end + else + return skip + end end end - - - function RandomLift() - --Locals + +function BuildSupply(tqb, ai, unit) + --Spring.Echo([[Build Supply]]) local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") - local ec, es = Spring.GetTeamResources(ai.id, "energy") + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") - local unitcount = Spring.GetTeamUnitCount(ai.id) - - --DEBUG LOG - if aiDebug == "enabled" then - Spring.Echo([[Shard Debug Log]]) - Spring.Echo([[--Units:]]) - Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) - Spring.Echo([[--Resources:]]) - Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) - Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) - Spring.Echo([[AI Metal Income is ]] .. mi.. [[ / -]] .. me ) - Spring.Echo(GG.TechCheck("endbringer", ai.id) ) - else - end - --Spring.SendMessageToPlayer(0, "Hello World!") - ------- Tech 0 - Very Early Game - if mc >= ms - ms*0.10 then - local r = math.random(0,5) - if r == 0 then - return "elifterai" - else - if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up1" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up2" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then - return "eorb_up3" - end - end - elseif es < Spring.GetGameSeconds()*0.5 then + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + elseif su < sm - 20 and sm ~= MaximumSupply then return "estorage" - elseif su >= sm-20 and sm ~= 400 then + elseif ms < Spring.GetGameSeconds() and ms < 1000 then return "estorage" - - elseif GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech0ai", ai.id) == true then - return "etech1ai" - elseif GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech1ai", ai.id) == true and GG.TechCheck("tech0ai", ai.id) == false then - return "etech2ai" - elseif GG.TechCheck("tech3", ai.id) == false and GG.TechCheck("tech2ai", ai.id) == true and GG.TechCheck("tech0ai", ai.id) == false and GG.TechCheck("tech1ai", ai.id) == false then - return "etech3ai" - else - if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - if ec <= 50 then - return "esolar2" - else - return "emine" - end - - ------- Reached Tech 1 - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - if ec <= 50 then - return "esolar2" + return skip + end +end + +function BuildTurret(tqb, ai, unit) + --Spring.Echo([[Build Turret]]) + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + local r = math.random(0,1) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + elseif r == 0 then + local LT = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elightturret2.id) + local AAT = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.elaserbattery.id) + if GG.TechCheck("tech2", ai.id) then + local HT = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eheavyturret2.id) + if AAT*5 < LT and AAT*5 < HT then + return "elaserbattery" + elseif HT < LT then + return "eheavyturret2" else - local r = math.random(0,2) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - end + return "elightturret2" end - - ------- Reached Tech 2 MK 2 - elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then - if ec <= 50 then - return "efusion2" + elseif AAT*10 < LT and GG.TechCheck("tech1", ai.id) then + return "elaserbattery" + else + return "elightturret2" + end + else + return skip + end +end + +function BuildEngineers(tqb, ai, unit) + --Spring.Echo([[Build Engineers]]) + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + else + local GetORBs = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eorb.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eorb_up1.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eorb_up2.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eorb_up3.id) + 1 + local rORB = math.random(0, GetORBs) + if rORB == 0 then + return "eorb" + else + return skip + end + end +end + +function BuildSupport(tqb, ai, unit) + --Spring.Echo([[Build Support]]) + local GetLifters = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.ehbotengineer.id) + 1 + local rLifter = math.random(0, GetLifters*2) + if GetLifters < 4 or rLifter == 0 then + return "ehbotengineer" + else + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,20) + if r == 0 then + local unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2", "eshieldgen", "ekmar", "esilo", "eartyturret",} + return unitoptions[math.random(1,#unitoptions)] else - local r = math.random(0,5) - local r2 = math.random(0,30) - if r2 ~= 0 then - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - elseif r == 3 then - return "eturretheavyai" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end - else - return "eshieldgen" - end + local unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2",} + return unitoptions[math.random(1,#unitoptions)] end - - ------- Reached Tech 3 MK 3 - elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1500 then - if ec <= 50 then - return "efusion2" + elseif GG.TechCheck("tech2", ai.id) then + local r = math.random(0,30) + if r == 0 then + local unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2", "eshieldgen", "ekmar",} + return unitoptions[math.random(1,#unitoptions)] else - local r2 = math.random(0,15) - if r2 ~= 0 then - local r = math.random(0,5) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - elseif r == 3 then - return "eturretheavyai" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end - elseif r2 == 0 then - local r = math.random(0,2) - if r == 0 then - return "eshieldgen" - elseif r == 1 then - return "elobberai" - elseif r == 2 then - return "esiloai" - end - end + local unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2",} + return unitoptions[math.random(1,#unitoptions)] end - - ------- Reached MK 4 - elseif GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1500 then - if ec <= 50 then - return "efusion2" + elseif GG.TechCheck("tech1", ai.id) then + local unitoptions = {"emine", "escoutdrone", "eradar2", "ebox",} + return unitoptions[math.random(1,#unitoptions)] + else + local unitoptions = {"emine", "escoutdrone",} + return unitoptions[math.random(1,#unitoptions)] + end + end +end + +--------------------------------------------UNITS +---Air +function BuildAirUP0(tqb, ai, unit) + if GG.TechCheck("tech3", ai.id) then + local unitoptions = {"efighter", "egunship2", "ebomber", "eairemp",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"efighter", "egunship2", "ebomber",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildAirUP1(tqb, ai, unit) + if GG.TechCheck("tech3", ai.id) then + local unitoptions = {"efighter_up1", "egunship2_up1", "ebomber_up1", "eairemp_up1",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"efighter_up1", "egunship2_up1", "ebomber_up1",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildAirUP2(tqb, ai, unit) + if GG.TechCheck("tech3", ai.id) then + local unitoptions = {"efighter_up2", "egunship2_up2", "ebomber_up2", "eairemp_up2",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"efighter_up2", "egunship2_up2", "ebomber_up2",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildAirUP3(tqb, ai, unit) + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,100) + if r == 0 then + return "ekrow_up3" else - local r2 = math.random(0,5) - if r2 ~= 0 then - local r = math.random(0,5) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai_up3" - elseif r == 3 then - return "eturretheavyai_up3" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end - elseif r2 == 0 then - local r = math.random(0,2) - if r == 0 then - return "eshieldgen" - elseif r == 1 then - return "elobberai" - elseif r == 2 then - return "esiloai" - end - end + local unitoptions = {"efighter_up3", "egunship2_up3", "ebomber_up3", "eairemp_up3",} + return FindBest(unitoptions, ai) end + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"efighter_up3", "egunship2_up3", "ebomber_up3",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +----AllTer + +function BuildAllTerUP0(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault", "eallterrheavy", "eallterrlight", "eallterrmed", "eallterrriot", "eallterrshield",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrheavy", "eallterrlight", "eallterrmed", "eallterrriot", "eallterrshield",} + return FindBest(unitoptions, ai) end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault", "eallterrlight", "eallterrriot", "eallterrshield",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrlight", "eallterrriot", "eallterrshield",} + return FindBest(unitoptions, ai) + end + else + return skip end end -function RandomOverseer() - --Locals - local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") - local ec, es = Spring.GetTeamResources(ai.id, "energy") - local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") - local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") - local unitcount = Spring.GetTeamUnitCount(ai.id) - - --DEBUG LOG - if aiDebug == "enabled" then - Spring.Echo([[Shard Debug Log]]) - Spring.Echo([[--Units:]]) - Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) - Spring.Echo([[--Resources:]]) - Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) - Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) +function BuildAllTerUP1(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up1", "eallterrheavy_up1", "eallterrlight_up1", "eallterrmed_up1", "eallterrriot_up1", "eallterrshield_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrheavy_up1", "eallterrlight_up1", "eallterrmed_up1", "eallterrriot_up1", "eallterrshield_up1",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up1", "eallterrlight_up1", "eallterrriot_up1", "eallterrshield_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrlight_up1", "eallterrriot_up1", "eallterrshield_up1",} + return FindBest(unitoptions, ai) + end else + return skip end - - - - ------- Tech 0 - Very Early Game - if mc >= ms - ms*0.20 then - local r = math.random(0,5) - if r == 0 then - return "elifterai" - else - if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up1" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up2" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then - return "eorb_up3" - end +end + +function BuildAllTerUP2(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up2", "eallterrheavy_up2", "eallterrlight_up2", "eallterrmed_up2", "eallterrriot_up2", "eallterrshield_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrheavy_up2", "eallterrlight_up2", "eallterrmed_up2", "eallterrriot_up2", "eallterrshield_up2",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up2", "eallterrlight_up2", "eallterrriot_up2", "eallterrshield_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrlight_up2", "eallterrriot_up2", "eallterrshield_up2",} + return FindBest(unitoptions, ai) end - elseif GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech0ai", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "etech1ai" - elseif GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech1ai", ai.id) == true and GG.TechCheck("tech0ai", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "etech2ai" - elseif GG.TechCheck("tech3", ai.id) == false and GG.TechCheck("tech2ai", ai.id) == true and GG.TechCheck("tech0ai", ai.id) == false and GG.TechCheck("tech1ai", ai.id) == false and GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true then - return "etech3ai" - - elseif es < Spring.GetGameSeconds()*0.5 then - return "estorage" else - if Spring.GetGameSeconds() <= 200 then - if mc <= 10 or mi*2 <= me then - return "emetalextractor" - elseif ec <= 50 then - return "esolar2" - else - return "emine" - end - - ------- Reached Tech 1 - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - if ec <= 50 then - return "esolar2" - else - local r = math.random(0,2) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - end - end - - ------- Reached Tech 2 MK 2 - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then - if ec <= 50 then - return "efusion2" + return skip + end +end + +function BuildAllTerUP3(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,100) + if r == 0 then + return "eallterranarchid_up3" else - local r = math.random(0,5) - local r2 = math.random(0,50) - if r2 ~= 0 then - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - elseif r == 3 then - return "eturretheavyai" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up3", "eallterrheavy_up3", "eallterrlight_up3", "eallterrmed_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) else - return "eshieldgen" + local unitoptions = {"eallterrheavy_up3", "eallterrlight_up3", "eallterrmed_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) end end - - ------- Reached Tech 3 MK 3 - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1500 then - if ec <= 50 then - return "efusion2" + elseif GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up3", "eallterrheavy_up3", "eallterrlight_up3", "eallterrmed_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrheavy_up3", "eallterrlight_up3", "eallterrmed_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eallterrassault_up3", "eallterrlight_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eallterrlight_up3", "eallterrriot_up3", "eallterrshield_up3",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +----Amphib + +function BuildAmphibUP0(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty", "eamphibbuggy", "eamphibmedtank", "eamphibneedle", "eamphibrock",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy", "eamphibmedtank", "eamphibneedle", "eamphibrock",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty", "eamphibbuggy", "eamphibneedle",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy", "eamphibneedle",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildAmphibUP1(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up1", "eamphibbuggy_up1", "eamphibmedtank_up1", "eamphibneedle_up1", "eamphibrock_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up1", "eamphibmedtank_up1", "eamphibneedle_up1", "eamphibrock_up1",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up1", "eamphibbuggy_up1", "eamphibneedle_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up1", "eamphibneedle_up1",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildAmphibUP2(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up2", "eamphibbuggy_up2", "eamphibmedtank_up2", "eamphibneedle_up2", "eamphibrock_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up2", "eamphibmedtank_up2", "eamphibneedle_up2", "eamphibrock_up2",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up2", "eamphibbuggy_up2", "eamphibneedle_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up2", "eamphibneedle_up2",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildAmphibUP3(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,100) + if r == 0 then + return "eamphibleveler_up3" else - local r2 = math.random(0,40) - if r2 ~= 0 then - local r = math.random(0,5) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai" - elseif r == 3 then - return "eturretheavyai" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end - elseif r2 == 0 then - local r = math.random(0,2) - if r == 0 then - return "eshieldgen" - elseif r == 1 then - return "elobberai" - elseif r == 2 then - return "esiloai" - end + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up3", "eamphibbuggy_up3", "eamphibmedtank_up3", "eamphibneedle_up3", "eamphibrock_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up3", "eamphibmedtank_up3", "eamphibneedle_up3", "eamphibrock_up3",} + return FindBest(unitoptions, ai) end end - ------- Reached MK 4 - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1500 then - if ec <= 50 then - return "efusion2" + elseif GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up3", "eamphibbuggy_up3", "eamphibmedtank_up3", "eamphibneedle_up3", "eamphibrock_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up3", "eamphibmedtank_up3", "eamphibneedle_up3", "eamphibrock_up3",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eamphibarty_up3", "eamphibbuggy_up3", "eamphibneedle_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eamphibbuggy_up3", "eamphibneedle_up3",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +----Hbot + +function BuildHbotUP0(tqb, ai, unit) + if GG.TechCheck("tech2", ai.id) then + local unitoptions = {"ehbotpeewee", "ehbotrocko", "ehbotsniper", "ehbotthud",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech1", ai.id) then + local unitoptions = {"ehbotpeewee", "ehbotthud",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildHbotUP1(tqb, ai, unit) + if GG.TechCheck("tech2", ai.id) then + local unitoptions = {"ehbotpeewee_up1", "ehbotrocko_up1", "ehbotsniper_up1", "ehbotthud_up1",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech1", ai.id) then + local unitoptions = {"ehbotpeewee_up1", "ehbotthud_up1",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildHbotUP2(tqb, ai, unit) + if GG.TechCheck("tech2", ai.id) then + local unitoptions = {"ehbotpeewee_up2", "ehbotrocko_up2", "ehbotsniper_up2", "ehbotthud_up2",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech1", ai.id) then + local unitoptions = {"ehbotpeewee_up2", "ehbotthud_up2",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +function BuildHbotUP3(tqb, ai, unit) + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,100) + if r == 0 then + return "ehbotkarganneth_up3" else - local r2 = math.random(0,30) - if r2 ~= 0 then - local r = math.random(0,5) - if r == 0 then - return "emine" - elseif r == 1 then - return "eradar2" - elseif r == 2 then - return "eturretlightai_up3" - elseif r == 3 then - return "eturretheavyai_up3" - elseif r == 4 then - return "ejammerai" - elseif r == 5 then - return "ekmar" - end - elseif r2 == 0 then - local r = math.random(0,2) - if r == 0 then - return "eshieldgen" - elseif r == 1 then - return "elobberai" - elseif r == 2 then - return "esiloai" - end - end + local unitoptions = {"ehbotpeewee_up3", "ehbotrocko_up3", "ehbotsniper_up3", "ehbotthud_up3",} + return FindBest(unitoptions, ai) end + elseif GG.TechCheck("tech2", ai.id) then + local unitoptions = {"ehbotpeewee_up3", "ehbotrocko_up3", "ehbotsniper_up3", "ehbotthud_up3",} + return FindBest(unitoptions, ai) + elseif GG.TechCheck("tech1", ai.id) then + local unitoptions = {"ehbotpeewee_up3", "ehbotthud_up3",} + return FindBest(unitoptions, ai) + else + return skip + end +end + +----Hover + +function BuildHoverUP0(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank", "eheavytank3", "elighttank3", "emissiletank", "eriottank2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eheavytank3", "elighttank3", "emissiletank", "eriottank2",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank", "elighttank3", "eriottank2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"elighttank3", "eriottank2",} + return FindBest(unitoptions, ai) end + else + return skip end end -function RandomUnit() - --Locals - local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") - local ec, es = Spring.GetTeamResources(ai.id, "energy") - local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") - local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") - local unitcount = Spring.GetTeamUnitCount(ai.id) - - --DEBUG LOG - if aiDebug == "enabled" then - Spring.Echo([[Shard Debug Log]]) - Spring.Echo([[--Units:]]) - Spring.Echo([[AI have ]] .. unitcount .. [[ units!]]) - Spring.Echo([[--Resources:]]) - Spring.Echo([[AI is using ]] .. su ..[[/]] .. sm .. [[ supply!]]) - Spring.Echo([[AI have ]] .. math.ceil(mc) ..[[/]] .. ms .. [[ metal and ]] .. math.ceil(ec) .. [[/]] .. es .. [[ energy!]]) - else - end - - if mc >= ms - ms*0.20 then - local r = math.random(0,5) - if r == 0 then - return "elifterai" - else - if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up1" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then - return "eorb_up2" - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true then - return "eorb_up3" - end +function BuildHoverUP1(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up1", "eheavytank3_up1", "elighttank3_up1", "emissiletank_up1", "eriottank2_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eheavytank3_up1", "elighttank3_up1", "emissiletank_up1", "eriottank2_up1",} + return FindBest(unitoptions, ai) end - elseif su <= sm-20 then - if GG.TechCheck("tech1", ai.id) == false and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then ------- Tech 0 - Very Early Game - local r = math.random(0,8) - if r == 0 then - return "eallterrlight" - elseif r == 1 then - return "eallterrassault" - elseif r == 2 then - return "elighttank3" - elseif r == 3 then - return "eartytank" - elseif r == 4 then - return "edrone" - elseif r == 5 then - return "eamphibarty" - elseif r == 6 then - return "eamphibriot" - elseif r == 7 then - return "eamphibbuggy" - elseif r == 8 then - return "ehbotpeewee" - end - - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == false and GG.TechCheck("tech3", ai.id) == false then ------- Reached Tech 1 - - local r = math.random(0,16) - if r == 0 then - return "eallterrlight" - elseif r == 1 then - return "eallterrassault" - elseif r == 2 then - return "elighttank3" - elseif r == 3 then - return "eartytank" - elseif r == 4 then - return "efighter" - elseif r == 5 then - return "edrone" - elseif r == 6 then - return "eamphibarty" - elseif r == 7 then - return "eamphibriot" - elseif r == 8 then - return "eamphibbuggy" - elseif r == 9 then - return "ehbotpeewee" - elseif r == 10 then - return "ebomber" - elseif r == 11 then - return "eriottank2" - elseif r == 12 then - return "eamphibneedle" - elseif r == 13 then - return "eallterrshield" - elseif r == 14 then - return "eallterrriot" - elseif r == 15 then - return "ehbotthud" - elseif r == 16 then - return "eraider" + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up1", "elighttank3_up1", "eriottank2_up1",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"elighttank3_up1", "eriottank2_up1",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildHoverUP2(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up2", "eheavytank3_up2", "elighttank3_up2", "emissiletank_up2", "eriottank2_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eheavytank3_up2", "elighttank3_up2", "emissiletank_up2", "eriottank2_up2",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up2", "elighttank3_up2", "eriottank2_up2",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"elighttank3_up2", "eriottank2_up2",} + return FindBest(unitoptions, ai) + end + else + return skip + end +end + +function BuildHoverUP3(tqb, ai, unit) + local ArtyCount = GetArtileryUnits(tqb,ai,unit) + if GG.TechCheck("tech3", ai.id) then + local r = math.random(0,100) + if r == 0 then + return "elacerator_up3" + else + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up3", "eheavytank3_up3", "elighttank3_up3", "emissiletank_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"eheavytank3_up3", "elighttank3_up3", "emissiletank_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) end - - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == false then ------- Reached Tech 2 MK 2 - - local r = math.random(0,8) - if r == 0 then - return "eheavytank3_up1" - elseif r == 1 then - return "ehbotrocko_up1" - elseif r == 2 then - return "eallterrmed_up1" - elseif r == 3 then - return "eallterrheavy_up1" - elseif r == 4 then - return "egunship2_up1" - elseif r == 5 then - return "eraider_up1" - elseif r == 6 then - return "eamphibrock_up1" - elseif r == 7 then - return "emissiletank_up1" - elseif r == 8 then - return "eamphibmedtank_up1" - end - - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() <= 1300 then ------- Reached Tech 3 MK 3 - - - local r2 = math.random(0,50) - if r2 ~= 0 then - local r = math.random(0,8) - if r == 0 then - return "eheavytank3_up2" - elseif r == 1 then - return "ehbotrocko_up2" - elseif r == 2 then - return "eallterrmed_up2" - elseif r == 3 then - return "eallterrheavy_up2" - elseif r == 4 then - return "egunship2_up2" - elseif r == 5 then - return "eraider_up2" - elseif r == 6 then - return "eamphibrock_up2" - elseif r == 7 then - return "emissiletank_up2" - elseif r == 8 then - return "eamphibmedtank_up2" - end - elseif r2 == 0 then - if GG.TechCheck("endbringer", ai.id) == true then - local r = math.random(0,4) - if r == 0 then - return "eamphibleveler_up2" - elseif r == 1 then - return "eallterranarchid_up2" - elseif r == 2 then - return "elacerator_up2" - elseif r == 3 then - return "ekrow_up2" - elseif r == 4 then - return "ehbotkarganneth_up2" - end - else - return "eorb_up2" - end - end - - elseif GG.TechCheck("tech1", ai.id) == true and GG.TechCheck("tech2", ai.id) == true and GG.TechCheck("tech3", ai.id) == true and Spring.GetGameSeconds() > 1300 then ------- Reached MK 4 - - local r2 = math.random(0,50) - if r2 ~= 0 then - local r = math.random(0,8) - if r == 0 then - return "eheavytank3_up3" - elseif r == 1 then - return "ehbotrocko_up3" - elseif r == 2 then - return "eallterrmed_up3" - elseif r == 3 then - return "eallterrheavy_up3" - elseif r == 4 then - return "egunship2_up3" - elseif r == 5 then - return "eraider_up3" - elseif r == 6 then - return "eamphibrock_up3" - elseif r == 7 then - return "emissiletank_up3" - elseif r == 8 then - return "eamphibmedtank_up3" - end - elseif r2 == 0 then - if GG.TechCheck("endbringer", ai.id) == true then - local r = math.random(0,4) - if r == 0 then - return "eamphibleveler_up3" - elseif r == 1 then - return "eallterranarchid_up3" - elseif r == 2 then - return "elacerator_up3" - elseif r == 3 then - return "ekrow_up3" - elseif r == 4 then - return "ehbotkarganneth_up3" - end - else - return "eorb_up3" - end - end - end + end + elseif GG.TechCheck("tech2", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up3", "eheavytank3_up3", "elighttank3_up3", "emissiletank_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) else - return "eorb" + local unitoptions = {"eheavytank3_up3", "elighttank3_up3", "emissiletank_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) + end + elseif GG.TechCheck("tech1", ai.id) then + local rArty = math.random(0, ArtyCount + 1) + if rArty <= 5 then + local unitoptions = {"eartytank_up3", "elighttank3_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) + else + local unitoptions = {"elighttank3_up3", "eriottank2_up3",} + return FindBest(unitoptions, ai) end + else + return skip end +end + ---------------------------------------------------------------- QUEUES +---Air +local AirFactoryQueueUP0 = { + ezMorph, + BuildAirUP0, +} + +-- local AirFactoryQueueUP1 = { + -- ezMorph, + -- BuildAirUP1, +-- } +-- local AirFactoryQueueUP2 = { + -- ezMorph, + -- BuildAirUP2, +-- } +-- local AirFactoryQueueUP3 = { + -- ezMorph, + -- BuildAirUP3, +-- } -local idlelist = { - { action = "wait", frames = 3000}, +---AllTer +local AllTerFactoryQueueUP0 = { + ezMorph, + BuildAllTerUP0, } +-- local AllTerFactoryQueueUP1 = { + -- ezMorph, + -- BuildAllTerUP1, +-- } + +-- local AllTerFactoryQueueUP2 = { + -- ezMorph, + -- BuildAllTerUP2, +-- } + +-- local AllTerFactoryQueueUP3 = { + -- ezMorph, + -- BuildAllTerUP3, +-- } + +---Amphib +local AmphibFactoryQueueUP0 = { + ezMorph, + BuildAmphibUP0, +} + +-- local AmphibFactoryQueueUP1 = { + -- ezMorph, + -- BuildAmphibUP1, +-- } + +-- local AmphibFactoryQueueUP2 = { + -- ezMorph, + -- BuildAmphibUP2, +-- } + +-- local AmphibFactoryQueueUP3 = { + -- ezMorph, + -- BuildAmphibUP3, +-- } + +---Hbot +local HbotFactoryQueueUP0 = { + ezMorph, + BuildHbotUP0, +} + +-- local HbotFactoryQueueUP1 = { + -- ezMorph, + -- BuildHbotUP1, +-- } + +-- local HbotFactoryQueueUP2 = { + -- ezMorph, + -- BuildHbotUP2, +-- } + +-- local HbotFactoryQueueUP3 = { + -- ezMorph, + -- BuildHbotUP3, +-- } + +---Hover +local HoverFactoryQueueUP0 = { + ezMorph, + BuildHoverUP0, +} + +-- local HoverFactoryQueueUP1 = { + -- ezMorph, + -- BuildHoverUP1, +-- } + +-- local HoverFactoryQueueUP2 = { + -- ezMorph, + -- BuildHoverUP2, +-- } + +-- local HoverFactoryQueueUP3 = { + -- ezMorph, + -- BuildHoverUP3, +-- } + local overseerlistfirst = { - --{ action = "moverelative", position = {x = mx, y = my, z = mz} }, - "emetalextractor", - "emetalextractor", - "emetalextractor", - "elifterai", - "emetalextractor", - "elifterai", - "elifterai", - "elifterai", - "emine", - "elifterai", - "emine", - "esolar2", - "emine", - "emine", - "elifterai", - "emine", - "elifterai", - "emine", - "elifterai", - "emine", - "esolar2", - "emine", - "esolar2", - "emine", - "emine", + BuildEngineers, + BuildTurret, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildTurret, } local overseerorders = { - RandomOverseer, - RandomOverseer, - RandomOverseer, - RandomOverseer, - "emine", + BuildFactory, + BuildTechFacility, + BuildEnergy, + BuildTurret, + MoveToRandomStartBoxLocation, } local lifterlist = { - RandomLift, - RandomUnit, - "emine", + BuildFactory, + BuildMex, + BuildTurret, + MoveToRandomStartBoxLocation, + BuildFactory, + BuildEnergy, + BuildSupply, + BuildTurret, + BuildEngineers, + BuildSupport, BuildMex, + BuildTurret, + BuildEnergy, + BuildSupply, + BuildEngineers, + BuildSupport, } -local unitsqueue = { - RandomUnit, +local lifterareamex = { + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + "emetalextractor", + BuildTurret, + MoveToRandomStartBoxLocation, } + ----------------------------------------------------- ---local factory = { ---} ---local airplant = { ---} +local function overseerqueue() + if ai.engineerfirst == true then + return overseerorders + else + ai.engineerfirst = true + return overseerlistfirst + end +end + +local function lifterqueue() + if liftersqueued > 2 then + liftersqueued = liftersqueued - 0.30 + return lifterlist + else + liftersqueued = liftersqueued + 1 + return lifterareamex + end +end ---local amphibfactory = { ---} +------------------------------------------------- ZAAAAAAAAAAAAAALS +function GetZaalSpawners(tqb,ai,unit) + local list = { + UDN.zhatch.id, UDN.zhatch_up1.id, UDN.zhatch_up2.id + } + local units = Spring.GetTeamUnitsByDefs(ai.id, list) + return #units +end ---local allterrfactory = { --- +local function ZaalMorph(tqb, ai, unit) + return ezMorph +end ---local orbs = { - --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, - --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, - --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, - --{ action = "moverelative", position = {x = math.random(-200, 200), y = math.random(-200, 200), z = math.random(-200, 200)} }, ---} +local function ZaalUnitLists(tqb, ai, unit) + local r = math.random(0,10) + local scouts = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.zairscout.id) + local r2 = math.random(0,scouts + 1) -local function overseerqueue() + if r2 == 0 then + return "zairscout" + end + + if GG.TechCheck("tech3", ai.id) then + local queens = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.zqueen.id) + if queens == 0 then + return "zqueen" + end + + if r <= 3 then + return "zlightswarm" + else + local options = {"zlightswarm", "zmedswarm", "zairtoairfighter", "zpyro","zairbomber", "zairtogroundfighter", "zarty", "zassault", "zkamikaze", "zskirmisher",} + return FindBest(options, ai) + end + + elseif GG.TechCheck("tech2", ai.id) then + + if r <= 6 then + return "zlightswarm" + else + local options = {"zlightswarm", "zmedswarm", "zairtoairfighter", "zpyro", "zairbomber", "zskirmisher",} + return FindBest(options, ai) + end + + elseif GG.TechCheck("tech1", ai.id) then + + if r <= 9 then + return "zlightswarm" + else + local options = {"zlightswarm", "zpyro", "zmedswarm",} + return FindBest(options, ai) + end + + end +end + + +-- local function ZaalBuild(tqb, ai, unit) + -- local SpawnerCount = GetZaalSpawners(tqb,ai,unit) + -- --local r = math.random(0,SpawnerCount + 1) + -- local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + -- local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") or 0 + -- local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") or 0 + -- if SpawnerCount < 1 then + -- return "zhatch" + -- elseif ec <= es*0.5 and GG.TechCheck("tech1", ai.id) then + -- return "zespire1" + -- elseif su > sm - 20 and sm ~= MaximumSupply then + -- return "ztiberium" + -- else + -- return "zhatch" + -- end +-- end + +local function ZaalBuildHatch(tqb, ai, unit) + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + local SpawnerCount = GetZaalSpawners(tqb,ai,unit) + Spring.Echo("Hatchtime!") + if ei <= 20 then + Spring.Echo("Hatchtime: Energy is less than 20!") + return "zespire1" + elseif SpawnerCount < 1 then + Spring.Echo("Hatchtime: Spawnercount is less than 1!") + return "zhatch" + elseif mi >= mp then + Spring.Echo("Hatchtime: Metalincome amount is greater than metal pull!") + return "ztenticle" + else + Spring.Echo("Hatchtime: Fuckit, let's build a mex!") + return "zmex" + end +end + +local function ZaalBuildMetal(tqb, ai, unit) + Spring.Echo("Metaltime!") + Spring.Echo("Metaltime: Let's make a mex!") + return "zmex" +end + +local function ZaalBuildEnergy(tqb, ai, unit) + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + local SpawnerCount = GetZaalSpawners(tqb,ai,unit) + Spring.Echo("Energytime!") + if ei <= 20 then + Spring.Echo("Energytime: Energy is less than 20!") + return "zespire1" + elseif ec <= es*0.7 then + Spring.Echo("Energytime: Energy current is less than or equal to 70% of energy storage!") + return "zespire1" + elseif ec <= es*0.8 and mc <= ms*0.8 then + Spring.Echo("Energytime: Energy current is less than or equal to 80% of energy storage and metal current is less than or equal to 80% of metal storage!") + if SpawnerCount < 1 then + Spring.Echo("Energytime: Spawnercount is less than 1!") + return "zhatch" + else + Spring.Echo("Energytime: Fuckit, let's make a tenticle!") + return "ztenticle" + end + elseif mi >= mp then + Spring.Echo("Hatchtime: Metalincome amount is greater than metal pull!") + return "ztenticle" + else + Spring.Echo("Energytime: Fuckit, let's make a mex!") + return "zmex" + end +end + +local function ZaalBuildSupply(tqb, ai, unit) + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + local su = Spring.GetTeamRulesParam(ai.id, "supplyUsed") or 0 + local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") or 0 + Spring.Echo("Supplytime!") + local SpawnerCount = GetZaalSpawners(tqb,ai,unit) + if ei <= 20 then + Spring.Echo("Supplytime: Energy income is less than 20!") + return "zespire1" + elseif SpawnerCount < 1 then + Spring.Echo("Supplytime: Spawner count is less than 1!") + return "zhatch" + elseif su > sm - 35 and sm ~= MaximumSupply then + Spring.Echo("Supplytime: Supply used is greater than supply max - 35 and supplymax is not equal to maximum supply!") + return "ztiberium" + elseif mi >= mp then + Spring.Echo("Hatchtime: Metalincome amount is greater than metal pull!") + return "ztenticle" + else + Spring.Echo("Supplytime: Fuckit, let's make a mex!") + return "zmex" + end +end + +local ZaalHive1 = { + ZaalUnitLists, + ZaalMorph, +} + +local ZaalHive2 = { + ZaalUnitLists, + ZaalMorph, +} + +local ZaalHive3 = { + ZaalUnitLists, +} + +local ZaalArm = { + "ztenticle", + ZaalBuildMetal, + ZaalBuildSupply, + ZaalBuildEnergy, + ZaalBuildHatch, + ZaalBuildMetal, + ZaalBuildSupply, + ZaalBuildEnergy, + ZaalBuildMetal, + ZaalBuildSupply, + ZaalBuildEnergy, + ZaalBuildMetal, + ZaalBuildSupply, + ZaalBuildEnergy, + ZaalBuildMetal, + ZaalBuildSupply, + ZaalBuildEnergy, + ZaalBuildMetal, +} + +local ZaalEspire = { + ZaalMorph, +} + +local ZaalTenticle = { + assistaround, +} + +-- Pattern + +local function PatternNeedFactory(tqb, ai, unit) + local count = GetFacs(tqb,ai,unit) + local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal") + if count < Spring.GetGameSeconds()*0.00332 then + -- if count > 0 and Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up1.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up2.id) + Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.eairplant_up3.id) < 1 then + -- return "eairplant" + -- if GG.TechCheck("tech2", ai.id) then + -- local unitoptions = {"eairplant", "eminifac", "eamphibfac", "ehbotfac", "ebasefactory",} + -- return FindBest(unitoptions, ai) + return "xklab" + -- else + -- local unitoptions = {"eminifac", "eamphibfac", "ehbotfac", "ebasefactory",} + -- return FindBest(unitoptions, ai) + -- end + else + return skip + end +end + +local function PatternNeedEnergy(tqb, ai, unit) + local GetConstructors = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.xkconstructor.id) + 1 + local rConstructors = math.random(0, GetConstructors*2) + if GetConstructors < 4 or rConstructors == 0 then + return "xkconstructor" + end + local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy") + if ei <= ee then + return "xsolar" + else + return skip + end +end + +local function PatternKLabOrder(tqb, ai, unit) + local options = {"xcrasher","xflea","xhammer","xrocko","xskulk","xwarrior",} + return FindBest(options, ai) +end + + + +local PatternCommanderFirst = { + "xmetalextractor", + "xsolar", + "xklab", +} + +local PatternCommander = { + PatternNeedFactory, + PatternNeedEnergy, + "xllt", + MoveToRandomStartBoxLocation, +} + +local PatternMexer = { + "xmetalextractor", + "xmetalextractor", + "xmetalextractor", + "xllt", + MoveToRandomStartBoxLocation, +} + +local PatternEco = { + "xsolar", + "xsolar", + PatternNeedEnergy, + PatternNeedEnergy, + "xstorage", + PatternNeedFactory, + "xllt", + MoveToRandomStartBoxLocation, +} + +local PatternKLab = { + PatternKLabOrder, +} + + + + +local function xcommanderqueue() if ai.engineerfirst == true then - return overseerorders + return PatternCommander else ai.engineerfirst = true - return overseerlistfirst + return PatternCommanderFirst + end +end + +local function xk1constructor() + if ai.xengineersqueued == nil then + ai.xengineersqueued = 0 + end + if ai.xengineersqueued > 2 then + ai.xengineersqueued = ai.xengineersqueued - 0.5 + return PatternEco + else + ai.xengineersqueued = ai.xengineersqueued + 1 + return PatternMexer end end + taskqueues = { --builders ecommanderbattleai = overseerqueue, - elifterai = lifterlist, - eunitfactoryai = unitsqueue, - + ecommanderbuildai = overseerqueue, + ecommandercloakai = overseerqueue, + ecommanderfactoryai = overseerqueue, + ecommanderhealerai = overseerqueue, + ecommandershieldai = overseerqueue, + ehbotengineer = lifterqueue, + eairplant = AirFactoryQueueUP0, + eairplant_up1 = AirFactoryQueueUP1, + eairplant_up2 = AirFactoryQueueUP2, + eairplant_up3 = AirFactoryQueueUP3, + eminifac = AllTerFactoryQueueUP0, + eminifac_up1 = AllTerFactoryQueueUP1, + eminifac_up2 = AllTerFactoryQueueUP2, + eminifac_up3 = AllTerFactoryQueueUP3, + eamphibfac = AmphibFactoryQueueUP0, + eamphibfac_up1 = AmphibFactoryQueueUP1, + eamphibfac_up2 = AmphibFactoryQueueUP2, + eamphibfac_up3 = AmphibFactoryQueueUP3, + ehbotfac = HbotFactoryQueueUP0, + ehbotfac_up1 = HbotFactoryQueueUP1, + ehbotfac_up2 = HbotFactoryQueueUP2, + ehbotfac_up3 = HbotFactoryQueueUP3, + ebasefactory = HoverFactoryQueueUP0, + ebasefactory_up1 = HoverFactoryQueueUP1, + ebasefactory_up2 = HoverFactoryQueueUP2, + ebasefactory_up3 = HoverFactoryQueueUP3, + zarm = ZaalArm, + zhatch_up2 = ZaalHive3, + zhatch = ZaalHive1, + zhatch_up1 = ZaalHive2, + zmex = ZaalEspire, + zmex_up1 = ZaalEspire, + zmex_up2 = ZaalEspire, + zespire1 = ZaalEspire, + zespire4 = ZaalEspire, + xcommander = xcommanderqueue, + xkconstructor = xk1constructor, + xklab = PatternKLab, + ztenticle = ZaalTenticle, } ----------------------------------------------------------- \ No newline at end of file +---------------------------------------------------------- diff --git a/LuaRules/Gadgets/ai/EvoRTS/triggerhandler.lua b/LuaRules/Gadgets/ai/EvoRTS/triggerhandler.lua new file mode 100644 index 000000000..da06c904d --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS/triggerhandler.lua @@ -0,0 +1,40 @@ +TriggerHandler = class(Module) + +function TriggerHandler:Name() + return "TriggerHandler" +end + +function TriggerHandler:internalName() + return "triggerhandler" +end + +function TriggerHandler:Init() + +end + +function TriggerHandler:Update() + local frame = Spring.GetGameFrame() + if frame%300 == (self.ai.id*15) then + local x,y,z + local comms = Spring.GetTeamUnitsByDefs(self.ai.id, {UnitDefNames.zarm.id, UnitDefNames.ecommanderbattleai.id, UnitDefNames.ecommanderhealerai.id, UnitDefNames.ecommanderbuildai.id, UnitDefNames.ecommandershieldai.id, UnitDefNames.ecommandercloakai.id, UnitDefNames.ecommanderfactoryai.id }) + if comms[1] then + x,y,z = Spring.GetUnitPosition(comms[1]) + self.commpos = {x = x, y = y, z = z} + local CommSurrounding = Spring.GetUnitsInCylinder(self.commpos.x, self.commpos.z, 1200) + for ct, uid in pairs(CommSurrounding) do + if not Spring.GetUnitNeutral(uid) and not Spring.GetUnitIsBuilding(uid) and not Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), self.ai.id) then + ax,ay,az = Spring.GetUnitPosition(uid) + self.CommAttackerPos = {x = ax, y = ay, z = az} + self.CommInDanger = true + break + else + self.CommAttackerPos = nil + self.CommInDanger = false + end + end + else + self.CommAttackerPos = nil + self.CommInDanger = false + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/ai.lua b/LuaRules/Gadgets/ai/ai.lua index 5cae0bcff..fae4edccd 100644 --- a/LuaRules/Gadgets/ai/ai.lua +++ b/LuaRules/Gadgets/ai/ai.lua @@ -1,29 +1,17 @@ -if not ShardSpringLua then - -- globals - require("preload/globals") -end -local AI = class(AIBase) +ShardAI = class(AIBase) -function AI:Init() - ai = self +function ShardAI:Init() self.api = shard_include("preload/api") self.game = self.api.game self.map = self.api.map self.game.ai = self self.map.ai = self self.game.map = self.map - self.game:SendToConsole("Shard by AF - playing:"..self.game:GameName().." on:"..self.map:MapName()) - - ai = self - game = self.game - map = self.map + self.game:SendToConsole("Shard by AF - playing: "..self.game:GameName().." on: "..self.map:MapName()) - if not ShardSpringLua then - shard_include("behaviourfactory") - shard_include("unit") - shard_include("module") - shard_include("modules") - end + shard_include("behaviourfactory") + shard_include("unit") + shard_include("modules") self.modules = {} if next(modules) ~= nil then @@ -39,7 +27,7 @@ function AI:Init() end end -function AI:Update() +function ShardAI:Update() if self.gameend == true then return end @@ -52,7 +40,7 @@ function AI:Update() end end -function AI:GameMessage(text) +function ShardAI:GameMessage(text) if self.gameend == true then return end @@ -65,7 +53,7 @@ function AI:GameMessage(text) end end -function AI:UnitCreated(engineunit) +function ShardAI:UnitCreated(engineunit) if self.gameend == true then return end @@ -78,7 +66,7 @@ function AI:UnitCreated(engineunit) end end -function AI:UnitBuilt(engineunit) +function ShardAI:UnitBuilt(engineunit) if self.gameend == true then return end @@ -91,7 +79,7 @@ function AI:UnitBuilt(engineunit) end end -function AI:UnitDead(engineunit) +function ShardAI:UnitDead(engineunit) if self.gameend == true then return end @@ -103,7 +91,7 @@ function AI:UnitDead(engineunit) end end -function AI:UnitIdle(engineunit) +function ShardAI:UnitIdle(engineunit) if self.gameend == true then return end @@ -117,7 +105,7 @@ function AI:UnitIdle(engineunit) end end -function AI:UnitDamaged(engineunit,engineattacker,enginedamage) +function ShardAI:UnitDamaged(engineunit,engineattacker,enginedamage) if self.gameend == true then return end @@ -130,7 +118,7 @@ function AI:UnitDamaged(engineunit,engineattacker,enginedamage) end end -function AI:UnitMoveFailed(engineunit) +function ShardAI:UnitMoveFailed(engineunit) if self.gameend == true then return end @@ -142,23 +130,16 @@ function AI:UnitMoveFailed(engineunit) end end -function AI:GameEnd() +function ShardAI:GameEnd() self.gameend = true for i,m in ipairs(self.modules) do m:GameEnd() end end -function AI:AddModule( newmodule ) +function ShardAI:AddModule( newmodule ) local internalname = newmodule:internalName() self[internalname] = newmodule table.insert(self.modules,newmodule) newmodule:Init() end - --- create and use an AI -if ShardSpringLua then - return AI() -else - ai = AI() -end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/attackerbehaviour.lua b/LuaRules/Gadgets/ai/attackerbehaviour.lua index d630530c1..f86d00d2d 100644 --- a/LuaRules/Gadgets/ai/attackerbehaviour.lua +++ b/LuaRules/Gadgets/ai/attackerbehaviour.lua @@ -12,28 +12,22 @@ end AttackerBehaviour = class(Behaviour) function AttackerBehaviour:Init() - --game:SendToConsole("attacker!") + --self.ai.game:SendToConsole("attacker!") end -function AttackerBehaviour:UnitBuilt(unit) - if unit.engineID == self.unit.engineID then - self.attacking = false - ai.attackhandler:AddRecruit(self) - end +function AttackerBehaviour:OwnerBuilt() + self.attacking = false + self.ai.attackhandler:AddRecruit(self) end -function AttackerBehaviour:UnitDead(unit) - if unit.engineID == self.unit.engineID then - ai.attackhandler:RemoveRecruit(self) - end +function AttackerBehaviour:OwnerDead() + self.ai.attackhandler:RemoveRecruit(self) end -function AttackerBehaviour:UnitIdle(unit) - if unit.engineID == self.unit.engineID then - self.attacking = false - ai.attackhandler:AddRecruit(self) - end +function AttackerBehaviour:OwnerIdle() + self.attacking = false + self.ai.attackhandler:AddRecruit(self) end function AttackerBehaviour:AttackCell(cell) @@ -64,14 +58,14 @@ function AttackerBehaviour:Activate() self.unit:Internal():MoveAndFire(self.target) self.target = nil else - ai.attackhandler:AddRecruit(self) + self.ai.attackhandler:AddRecruit(self) end end function AttackerBehaviour:OwnerDied() - ai.attackhandler:RemoveRecruit(self) + self.ai.attackhandler:RemoveRecruit(self) self.attacking = nil self.active = nil self.unit = nil -end \ No newline at end of file +end diff --git a/LuaRules/Gadgets/ai/attackhandler.lua b/LuaRules/Gadgets/ai/attackhandler.lua index ff00d3691..0b5a874a4 100644 --- a/LuaRules/Gadgets/ai/attackhandler.lua +++ b/LuaRules/Gadgets/ai/attackhandler.lua @@ -15,14 +15,14 @@ end function AttackHandler:Update() -- stagger targetting if multiple shards are in the game - local f = game:Frame() + game:GetTeamID() - if math.mod(f,15) == 0 then + local f = self.game:Frame() + self.game:GetTeamID() + if math.fmod(f,15) == 0 then self:DoTargetting() end end function AttackHandler:UnitDead(engineunit) - if engineunit:Team() == game:GetTeamID() then + if engineunit:Team() == self.game:GetTeamID() then self.counter = self.counter - 0.2 self.counter = math.max(self.counter,8) -- try and clean up dead recruits where possible @@ -56,9 +56,9 @@ function AttackHandler:DoTargetting() -- find somewhere to attack local cells = {} local celllist = {} - local mapdimensions = game.map:MapDimensions() + local mapdimensions = self.game.map:MapDimensions() --enemies = game:GetEnemies() - local enemies = game:GetEnemies() + local enemies = self.game:GetEnemies() if enemies and #enemies > 0 then -- figure out where all the enemies are! @@ -139,7 +139,7 @@ end function AttackHandler:AddRecruit(attkbehaviour) if attkbehaviour.unit == nil then - game:SendToConsole( "null unit in attack beh found ") + self.game:SendToConsole( "null unit in attack beh found ") return end if not self:IsRecruit(attkbehaviour) then diff --git a/LuaRules/Gadgets/ai/behaviour.lua b/LuaRules/Gadgets/ai/behaviour.lua index a8362f924..e87a93468 100644 --- a/LuaRules/Gadgets/ai/behaviour.lua +++ b/LuaRules/Gadgets/ai/behaviour.lua @@ -1,5 +1,10 @@ Behaviour = class(AIBase) +function Behaviour:init() + self.active = false + self.priority = 0 +end + function Behaviour:Init() end @@ -15,15 +20,35 @@ end function Behaviour:UnitBuilt(unit) end +function Behaviour:OwnerBuilt() +end + function Behaviour:UnitDead(unit) end +function Behaviour:OwnerDead() +end + function Behaviour:UnitDamaged(unit,attacker,damage) end +function Behaviour:OwnerDamaged(attacker,damage) +end + function Behaviour:UnitIdle(unit) end +function Behaviour:OwnerIdle() +end + +function Behaviour:UnitMoveFailed(unit) + self:UnitIdle(unit) +end + +function Behaviour:OwnerMoveFailed() + self:OwnerIdle() +end + function Behaviour:SetUnit(unit) self.unit = unit self.engineID = unit.engineID @@ -40,26 +65,52 @@ function Behaviour:IsActive() return self.active end +-- yields control of the unit, note that this may not result in deactivation, +-- there may be no other behaviours to take control +function Behaviour:YieldControlOfUnit() + self.unit:ElectBehaviour() +end + +function Behaviour:RequestControlOfUnit() + self.unit:ElectBehaviour() +end + +function Behaviour:SetPriority(new_priority) + self.priority = new_priority +end + +function Behaviour:PreActivate() + self.active = true +end + function Behaviour:Activate() - -- +end + +function Behaviour:PreDeactivate() + self.active = false end function Behaviour:Deactivate() - -- end function Behaviour:Priority() - return 0 + return self.priority end -function Behaviour:Passive() - return false +function Behaviour:RecalculatePriority() + self:SetPriority(0) end -function Behaviour:UnitMoveFailed(unit) - self:UnitIdle(unit) +function Behaviour:IsActive() + return self.active +end + +function Behaviour:Name() + return 'Behaviour' end -function Behaviour:OwnerDied() - return -end \ No newline at end of file +function Behaviour:EchoDebug(...) + if self.DebugEnabled then + self.game:SendToConsole(self.game:GetTeamID(), self:Name(), self.unit:Internal():Name(), self.unit:Internal():ID(), ...) + end +end diff --git a/LuaRules/Gadgets/ai/behaviourfactory.lua b/LuaRules/Gadgets/ai/behaviourfactory.lua index 54f904dae..a22b55e0b 100644 --- a/LuaRules/Gadgets/ai/behaviourfactory.lua +++ b/LuaRules/Gadgets/ai/behaviourfactory.lua @@ -6,8 +6,9 @@ function BehaviourFactory:Init() -- end -function BehaviourFactory:AddBehaviours(unit, ai) +function BehaviourFactory:AddBehaviours(unit) if unit == nil then + self.game:SendToConsole("Warning: Shard BehaviourFactory:AddBehaviours was asked to provide behaviours to a nil unit") return end -- add behaviours here @@ -18,8 +19,8 @@ function BehaviourFactory:AddBehaviours(unit, ai) end for i,behaviour in ipairs(b) do t = behaviour() - t:SetUnit(unit) t:SetAI(ai) + t:SetUnit(unit) t:Init() unit:AddBehaviour(t) end diff --git a/LuaRules/Gadgets/ai/behaviours.lua b/LuaRules/Gadgets/ai/behaviours.lua index 1937bb708..898237c35 100644 --- a/LuaRules/Gadgets/ai/behaviours.lua +++ b/LuaRules/Gadgets/ai/behaviours.lua @@ -1,43 +1,27 @@ -controlPoints = Spring.GetModOptions().scoremode - -if controlPoints == nil then - controlPoints = "disabled" -end - -if controlPoints == "disabled" then - shard_include( "taskqueues" ) - shard_include( "taskqueuebehaviour" ) - shard_include( "attackerbehaviour" ) - shard_include( "bootbehaviour" ) - else - shard_include( "taskqueues" ) - shard_include( "taskqueuebehaviour" ) - shard_include( "attackerbehaviour" ) - shard_include( "bootbehaviour" ) - shard_include( "capturerbehaviour" ) -end +shard_include( "taskqueues" ) +shard_include( "taskqueuebehaviour" ) +shard_include( "attackerbehaviour" ) +shard_include( "pointcapturerbehaviour" ) +shard_include( "bootbehaviour" ) behaviours = { } -function defaultBehaviours(unit) +function defaultBehaviours(unit, ai) b = {} + if unit == nil then + return b + end u = unit:Internal() table.insert(b, BootBehaviour ) if u:CanBuild() then table.insert(b,TaskQueueBehaviour) else - if controlPoints == "disabled" then - if IsAttacker(unit) then - table.insert(b,AttackerBehaviour) - end - else - if IsAttacker(unit) then - table.insert(b,AttackerBehaviour) - end - if IsCapturer(unit) then - table.insert(b,CapturerBehaviour) - end + if IsPointCapturer(unit, ai) then + table.insert(b,PointCapturerBehaviour) + end + if IsAttacker(unit) then + table.insert(b,AttackerBehaviour) end end return b diff --git a/LuaRules/Gadgets/ai/boot.lua b/LuaRules/Gadgets/ai/boot.lua new file mode 100644 index 000000000..8440516dd --- /dev/null +++ b/LuaRules/Gadgets/ai/boot.lua @@ -0,0 +1,21 @@ +-- @TODO: Move top level logic out of ai.lua into here, and then make it load environment specific boot.lua files + +if ShardSpringLua then + VFS.Include( "luarules/gadgets/ai/preload/spring_lua/boot.lua" ) +elseif game_engine then + require "spring_cpp/boot" +else + require "preload/shard_null/boot" +end + +shard_include( "ai" ) + +-- create and use an AI +if ShardSpringLua then + return ShardAI() +elseif game_engine then + ai = ShardAI() +else + ai = ShardAI() + ai:Init() +end diff --git a/LuaRules/Gadgets/ai/bootbehaviour.lua b/LuaRules/Gadgets/ai/bootbehaviour.lua index b782352c6..ac6c2568f 100644 --- a/LuaRules/Gadgets/ai/bootbehaviour.lua +++ b/LuaRules/Gadgets/ai/bootbehaviour.lua @@ -13,17 +13,20 @@ local MOVESTATE_HOLDPOS = 0 function BootBehaviour:Init() self.waiting = true - self.id = self.unit:Internal():ID() - self.name = self.unit:Internal():Name() + local u = self.unit:Internal() + self.id = u:ID() + self.name = u:Name() + self.canmove = u:CanMove() self.finished = false - self.count = 150 - self.unit:ElectBehaviour() + if u:Type():IsFactory() then + self.count = 0 + else + self.count = 150 + end end -function BootBehaviour:UnitBuilt(unit) - if unit.engineID == self.unit.engineID then - self.finished = true - end +function BootBehaviour:OwnerBuilt() + self.finished = true end function BootBehaviour:Update() @@ -49,12 +52,12 @@ end function BootBehaviour:Priority() -- don't apply to starting units - if game:Frame() < 5 then + if self.game:Frame() < 10 then return 0 end -- don't apply to structures - if self.unit:Internal():CanMove() == false then + if self.canmove == false then return 0 end if self.waiting then diff --git a/LuaRules/Gadgets/ai/capturerbehaviour.lua b/LuaRules/Gadgets/ai/capturerbehaviour.lua index 91d11b0d3..196d8840f 100644 --- a/LuaRules/Gadgets/ai/capturerbehaviour.lua +++ b/LuaRules/Gadgets/ai/capturerbehaviour.lua @@ -1,10 +1,5 @@ -function IsCapturer(unit) - local noncapturelist = {} - if ShardSpringLua then - if Script.LuaRules('NonCapturingUnits') then - noncapturelist = Script.LuaRules.NonCapturingUnits() or {} - end - end +function IsCapturer(unit, ai) + local noncapturelist = ai.game:NonCapturingUnits() for i = 1, #noncapturelist do local name = noncapturelist[i] if name == unit:Internal():Name() then @@ -26,11 +21,8 @@ local function RandomAway(pos, dist, angle) end function CapturerBehaviour:Init() - self.arePoints = self.ai.controlpointhandler:ArePoints() - if self.ai.controlpointhandler:CaptureRadius() == nil then - return false - end - self.maxDist = math.ceil( self.ai.controlpointhandler:CaptureRadius() * 0.9 ) + self.arePoints = self.map:AreControlPoints() + self.maxDist = math.ceil( self.game:CaptureRadius() * 0.9 ) self.minDist = math.ceil( self.maxDist / 3 ) end diff --git a/LuaRules/Gadgets/ai/controlpointhandler.lua b/LuaRules/Gadgets/ai/controlpointhandler.lua index df562760b..553d235c4 100644 --- a/LuaRules/Gadgets/ai/controlpointhandler.lua +++ b/LuaRules/Gadgets/ai/controlpointhandler.lua @@ -19,37 +19,19 @@ function ControlPointHandler:Init() self.ally = self.ai.allyId end -function ControlPointHandler:Points() - if ShardSpringLua then - return Script.LuaRules.ControlPoints() or {} - end - return {} -end - -function ControlPointHandler:CaptureRadius() - if ShardSpringLua then - return Script.LuaRules.CaptureRadius() - end - return 500 -end - -function ControlPointHandler:ArePoints() - local points = self:Points() - return #points > 0 -end - function ControlPointHandler:ClosestUncapturedPoint(position) local pos local bestDistance - local points = self:Points() + local points = self.map:GetControlPoints() for i = 1, #points do local point = points[i] - local pointAlly = point.owner + local pointAlly = point:GetOwner() if pointAlly ~= self.ally then - local dist = distance(position, point) + local pointPos = point:GetPosition() + local dist = distance(position, pointPos) if not bestDistance or dist < bestDistance then bestDistance = dist - pos = point + pos = pointPos end end end diff --git a/LuaRules/Gadgets/ai/modules.lua b/LuaRules/Gadgets/ai/modules.lua index 67cd12fb9..247804c70 100644 --- a/LuaRules/Gadgets/ai/modules.lua +++ b/LuaRules/Gadgets/ai/modules.lua @@ -1,33 +1,8 @@ - -controlPoints = Spring.GetModOptions().scoremode - -if controlPoints == nil then - controlPoints = "disabled" -end - -if controlPoints == "disabled" then - shard_include( "spothandler" ) - shard_include( "unithandler" ) - shard_include( "attackhandler" ) - shard_include( "sleep" ) - - modules = { UnitHandler, AttackHandler, MetalSpotHandler, Sleep } -else - shard_include( "spothandler" ) - shard_include( "controlpointhandler" ) - shard_include( "unithandler" ) - shard_include( "attackhandler" ) - shard_include( "sleep" ) - - modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, Sleep } -end - - ---shard_include( "spothandler" ) ---shard_include( "controlpointhandler" ) ---shard_include( "unithandler" ) ---shard_include( "attackhandler" ) ---shard_include( "sleep" ) - ---modules = { UnitHandler, AttackHandler, MetalSpotHandler, Sleep } ---modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, Sleep } +shard_include( "spothandler" ) +shard_include( "controlpointhandler" ) +shard_include( "unithandler" ) +shard_include( "attackhandler" ) +shard_include( "placementhandler" ) +shard_include( "sleep" ) + +modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, PlacementHandler, Sleep } diff --git a/LuaRules/Gadgets/ai/nullbehaviour.lua b/LuaRules/Gadgets/ai/nullbehaviour.lua new file mode 100644 index 000000000..f826fb52a --- /dev/null +++ b/LuaRules/Gadgets/ai/nullbehaviour.lua @@ -0,0 +1,22 @@ +NullBehaviour = class(Behaviour) + +-- this gets called when the unit is idle, which means we finished our +-- stop command, yield control. This probably won't work though because +-- it's a stop command +function NullBehaviour:OwnerIdle() + if self:IsActive() then + self:YieldControl() + end +end + +function NullBehaviour:Priority() + return 0 +end + +function NullBehaviour:Activate() + -- normally we would issue a command here, then when finished, + -- the behaviour would give up control of the unit + + -- but this is a null behaviour, we'll just tell the unit to stop + self.unit:Internal():Stop() +end diff --git a/LuaRules/Gadgets/ai/nullmodule.lua b/LuaRules/Gadgets/ai/nullmodule.lua new file mode 100644 index 000000000..754aaa3b2 --- /dev/null +++ b/LuaRules/Gadgets/ai/nullmodule.lua @@ -0,0 +1,17 @@ +NullModule = class(Module) + +function NullModule:Name() + return "Null Module" -- a nice developer friendly response +end + +function NullModule:internalName() + return "nullmodule" -- ai.nullmodule +end + +function NullModule:Init() + -- we should setup some variables here +end + +function NullModule:Update() + -- nothing much to do is there +end diff --git a/LuaRules/Gadgets/ai/placementhandler.lua b/LuaRules/Gadgets/ai/placementhandler.lua new file mode 100644 index 000000000..ce89da9fa --- /dev/null +++ b/LuaRules/Gadgets/ai/placementhandler.lua @@ -0,0 +1,371 @@ +PlacementHandler = class(Module) + +function PlacementHandler:Name() + return "PlacementHandler" +end + +function PlacementHandler:internalName() + return "placementhandler" +end + +function PlacementHandler:Init() + self.jobs = {} +end + +function snap_to_grid( pos , gridsize ) + pos.x = pos.x - (pos.x % gridsize ) + pos.z = pos.z - (pos.z % gridsize ) + return pos +end + +--[[ +Usage: + +function onSuccess( job, pos ) + -- build something I guess +end +function onFail( job ) + -- nowhere to place it, do something else then? +end +local unittype = ... +local job = { + start_position=[1,2,3], + max_radius=500, + onSuccess=onSuccess, + onFail=onFail, + unittype=unittype, + cleanup_on_unit_death=builderID +} +local success = ai.placementhandler.NewJob( job ) +if success then + -- the job has been schedule, do whatever else we need to do in parallel + -- when a position has been found, it will call the callback function we passed it + -- in the future a promise will be returned letting us define what happens +else + -- there was something wrong with our job and the system rejected it + -- the programmer should probably check all the values that went into the job were set and valid +end + +]] + + +function PlacementHandler:NewJob( details ) + --[[ + local default = { + start_position, + unittype, + placement_tests: [], + max_radius=, + onSuccess=onSuccess, + onFail=onFail, + increment=8 + cleanup_on_unit_death + } + ]]-- + if details["start_position"] == nil then + return false + end + if details["unittype"] == nil then + return false + end + if details["max_radius"] == nil then + details.max_radius = 1500 + end + if details["increment"] == nil then + details.increment = 16 + end + if details.increment < 16 then + details.increment = 16 + end + details.status = 'new' + details.step = 1 + + -- snap the position to a 16x16 grid for consistency + details.start_position = snap_to_grid( start_position, 16 ) + + -- figure out the spiral search pattern necessary + local max_width = details.max_radius * 2 + local spiral_width = max_width/details.increment + details.spiral = self:GenerateSpiral(spiral_width, spiral_width ) + + table.insert( self.jobs, details ) + + -- for now it's using a completion handler, which is a function + -- passed along that it will call when it's finished, but tbh I'd + -- prefer to return some sort of promise structure + return true +end + + +function PlacementHandler:Update() + --[[ + + We need to run through our jobs, but we also need to make sure of several things: + + - when a placement job finishes, we stop processing until the next frame + - that each job only gets a limited amount of time to run + - that the algorithm can run bit by bit over several frames + + To this end, each iteration of the search is self contained. This way we can + progress 5 or 6 steps along the algorithm for each job, making sure we don't + spend too long searching and lag the game out. + + As a bonus, this opens up the future for scheduling and collaborative searches. + It also allows us to cancel and pause searches. + + For our situation, we're going to allot a time budget for each job, and a + time budget for each frame. During this time, we can only work on a job for + so long. If it's a fast CPU we can do more iterations in that time. It also + means we can only work on so many jobs per frame. This way we get the top + of the queue done sooner, so we don't get bogged down in an ever growing queue. + + A bonus of this, is that quick jobs will finish earlier, allowing work to be + done on an extra job. Another side of this is that if the cpu is busy with + stuff, we might have to finish early. I envisage Shard should take time + measurements for the entire frame to make sure that modules such as this + one can give themselves smaller budgets when under load + ]] + + -- exit early if there are no jobs + if #self.jobs == 0 then + return + end + + self:RunIterations() + self:CleanupJobs() +end + +function PlacementHandler:RunIterations() + for i,j in ipairs(self.jobs) do + if j.status ~= 'cleanup' then + local job = self.jobs[i] + self:RunJobIterations( job ) + end + end +end + +function PlacementHandler:RunJobIterations( job ) + local stillGotTime = 4 --500 + -- given this particular job, lets give it a time budget and do as many + -- iterations as we can + while ( stillGotTime > 0 ) and ( job.status ~= 'cleanup' ) do + self:IterateJob( job ) + stillGotTime = stillGotTime - 1 + end +end + +function PlacementHandler:IterateJob( job ) + -- setup this run + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + return + end + job.status = 'running' + local step = job.step + local spos = job.spiral[step] + local pos = { x=0,y=0,z=0} + pos.x = spos.x * job.increment + job.start_position.x + pos.z = spos.y * job.increment + job.start_position.z + pos.y = job.start_position.y + + -- test this particular step of the spiral + local buildable = self:CanBuildAt(job.unittype, pos ) + if buildable then + -- we found a place! + job.result = pos + job.status = 'cleanup' + SendToUnsynced("shard_debug_position",pos.x,pos.z,"final_choice") + job.onSuccess( job, pos ) + end + + job.step = job.step + 1 + if job.step > #job.spiral then + -- we reached the end of the search pattern, we failed to + -- find a location, tell the requested and end the job + job.onFail( job ) + job.status = 'cleanup' + job.result = false + end +end + +function PlacementHandler:CanBuildAt( unittype, pos ) + local buildable = self.ai.map:CanBuildHere( unittype, pos ) + if not buildable then + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_bad") + return false + end + SendToUnsynced("shard_debug_position",pos.x,pos.z,"main_good") + + -- check spacing + -- we're going to do this in a hacky way for now until a blocking + -- map and footprints are added to the shard API, but on the other + -- hand it's simple + + -- what we're going to do is enforce a standardised minimum + -- spacing, and check above below left and right of the position + -- to check, by shifting the position by a set amount and checking + -- that position + + local fixed_spacing = 80 + + -- North + local testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z - fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if false == buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- North East + local testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z - fixed_spacing + testpos.x = testpos.x + fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if false == buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- North West + local testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z - fixed_spacing + testpos.x = testpos.x - fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if false == buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- South + testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z + fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- South East + testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z + fixed_spacing + testpos.x = testpos.x + fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- South West + testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.z = testpos.z + fixed_spacing + testpos.x = testpos.x - fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- East + testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.x = testpos.x + fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + -- West + testpos = { x=pos.x, y=pos.y, z= pos.z } + testpos.x = testpos.x - fixed_spacing + buildable = self.ai.map:CanBuildHere( unittype, testpos ) + if not buildable then + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_bad") + return false + end + SendToUnsynced("shard_debug_position",testpos.x,testpos.z,"secondary_good") + + return true +end + +function is_not_cleanup( job ) + if job.status ~= 'cleanup' then + return true + end + return false +end + +-- filter(function, table) +-- e.g: filter(is_even, {1,2,3,4}) -> {2,4} +function filter(func, tbl) + local newtbl= {} + for i,v in pairs(tbl) do + if func(v) then + newtbl[i]=v + end + end + return newtbl +end + +function PlacementHandler:CleanupJobs() + -- try and clean up dead recruits where possible + --self.jobs = filter( is_not_cleanup, self.jobs ) + for i,j in ipairs(self.jobs) do + if j.status == 'cleanup' then + local job = self.jobs[i] + table.remove( self.jobs, i ) + return + end + end +end + +--[[ +Some jobs are tied to units being alive. This could be because +it's the building the job was intended for. Eitherway, if that +unit dies then the associated job is unnecessary, and needs to +be cleaned up to save cpu +]] +function PlacementHandler:UnitDead(engineunit) + for i,j in ipairs(self.jobs) do + if j['cleanup_on_unit_death'] ~= nil then + if j.cleanup_on_unit_death == engineunit:ID() then + j.status = 'cleanup' + end + end + end +end + + +function PlacementHandler:GenerateSpiral( width, height) + local x = 0 + local y = 0 + local dx = 0 + local dy = -1 + local t = math.max(width,height) + local maxI = t*t; + local result = {} + for i=0, maxI do + if ((-width/2 <= x) and (x <= width/2) and (-height/2 <= y) and (y <= height/2)) then + table.insert( result, {x=x,y=y} ) + end + if ( ( x == y ) or ( ( x < 0 ) and ( x == -y ) ) or ( (x > 0) and ( x == 1-y ) ) ) then + t = dx + dx = dy * -1 + dy = t + end + x = x + dx + y = y + dy + end + return result +end diff --git a/LuaRules/Gadgets/ai/pointcapturerbehaviour.lua b/LuaRules/Gadgets/ai/pointcapturerbehaviour.lua new file mode 100644 index 000000000..6b2c6883e --- /dev/null +++ b/LuaRules/Gadgets/ai/pointcapturerbehaviour.lua @@ -0,0 +1,68 @@ +function IsPointCapturer(unit, ai) + local noncapturelist = ai.game:ControlPointNonCapturingUnits() + for i = 1, #noncapturelist do + local name = noncapturelist[i] + if name == unit:Internal():Name() then + return false + end + end + return true +end + +PointCapturerBehaviour = class(Behaviour) + +local function RandomAway(pos, dist, angle) + angle = angle or math.random() * math.pi * 2 + local away = api.Position() + away.x = pos.x + dist * math.cos(angle) + away.z = pos.z - dist * math.sin(angle) + away.y = pos.y + 0 + return away +end + +function PointCapturerBehaviour:Init() + self.arePoints = self.game:UsesControlPoints() + self.maxDist = math.ceil( self.game:ControlPointCaptureRadius() * 0.9 ) + self.minDist = math.ceil( self.maxDist / 3 ) +end + +function PointCapturerBehaviour:UnitIdle(unit) + if not self.active then return end + if unit.engineID == self.unit.engineID then + self:GoForth() + end +end + +function PointCapturerBehaviour:Update() + if not self.active then return end + if not self.nextCheck or self.game:Frame() == self.nextCheck then + self:GoForth() + end +end + +function PointCapturerBehaviour:Priority() + if self.arePoints then + return 40 + else + return 0 + end +end + +function PointCapturerBehaviour:Activate() + self.active = true +end + +function PointCapturerBehaviour:Deactivate() + self.active = false +end + +function PointCapturerBehaviour:GoForth() + local upos = self.unit:Internal():GetPosition() + local point = self.ai.controlpointhandler:ClosestUncapturedPoint(upos) + if point and point ~= self.currentPoint then + local movePos = RandomAway( point, math.random(self.minDist,self.maxDist) ) + self.unit:Internal():Move(movePos) + self.currentPoint = point + end + self.nextCheck = self.game:Frame() + math.random(60, 90) +end diff --git a/LuaRules/Gadgets/ai/preload/aibase.lua b/LuaRules/Gadgets/ai/preload/aibase.lua index 34f52264f..4633b714d 100644 --- a/LuaRules/Gadgets/ai/preload/aibase.lua +++ b/LuaRules/Gadgets/ai/preload/aibase.lua @@ -38,3 +38,9 @@ function AIBase:UnitDamaged(engineunit,enginedamage) end function AIBase:UnitMoveFailed(engineunit) end + +function AIBase:SetAI(ai) + self.ai = ai + self.game = ai.game + self.map = ai.map +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/api.lua b/LuaRules/Gadgets/ai/preload/api.lua index 0d362b6af..ab647139b 100644 --- a/LuaRules/Gadgets/ai/preload/api.lua +++ b/LuaRules/Gadgets/ai/preload/api.lua @@ -2,13 +2,20 @@ -- Created by Tom J Nowell 2010 -- Shard AI +-- currently included from inside the main AI object during initialisation local api = {} if ShardSpringLua then + -- it's a LuaAI inside a game archive! api.game = shard_include "spring_lua/game" api.map = shard_include "spring_lua/map" +elseif game_engine then + -- it's a native AI! + api.game = shard_include "spring_cpp/game" + api.map = shard_include "spring_cpp/map" else - api.game = shard_include "spring_native/game" - api.map = shard_include "spring_native/map" + -- who knows! Load a Null non-op API + api.game = shard_include "preload/shard_null/game" + api.map = shard_include "preload/shard_null/map" end return api diff --git a/LuaRules/Gadgets/ai/preload/globals.lua b/LuaRules/Gadgets/ai/preload/globals.lua deleted file mode 100644 index 79b229047..000000000 --- a/LuaRules/Gadgets/ai/preload/globals.lua +++ /dev/null @@ -1,54 +0,0 @@ --- Created by Tom J Nowell 2010 --- Shard AI -if ShardSpringLua then - function shard_include( file ) - if type(file) ~= 'string' then - return nil - end - local gameFile = "luarules/gadgets/ai/" .. Game.gameShortName .. "/" .. file .. ".lua" - local baseFile = "luarules/gadgets/ai/" .. file .. ".lua" - local preloadFile = "luarules/gadgets/ai/preload/" .. file .. ".lua" - if VFS.FileExists(gameFile) then - -- Spring.Echo("got gameFile", gameFile) - return VFS.Include(gameFile) - elseif VFS.FileExists(baseFile) then - -- Spring.Echo("got baseFile", baseFile) - return VFS.Include(baseFile) - elseif VFS.FileExists(preloadFile) then - -- Spring.Echo("got preloadFile", preloadFile) - return VFS.Include(preloadFile) - end - end -else - function shard_include( file ) - if type(file) ~= 'string' then - return nil - end - local ok1, mod1 = pcall( require, game_engine:GameName().."/"..file ) - if ok1 then - return mod1 - else - local ok2, mod2 = pcall( require, file ) - if ok2 then - return mod2 - else - game_engine:SendToConsole("require can't load " .. game_engine:GameName().."/"..file .. " error: " .. mod1) - game_engine:SendToConsole("require can't load " .. file .. " error: " .. mod2) - end - end - end -end - -shard_include "hooks" -shard_include "class" -shard_include "aibase" - -if ShardSpringLua then - shard_include "spring_lua/unit" - shard_include "spring_lua/unittype" - shard_include "spring_lua/damage" - shard_include "spring_lua/feature" -else - shard_include "spring_native/unit" - shard_include "spring_lua/unittype" -end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/module.lua b/LuaRules/Gadgets/ai/preload/module.lua index b252efeb1..ffd0b9651 100644 --- a/LuaRules/Gadgets/ai/preload/module.lua +++ b/LuaRules/Gadgets/ai/preload/module.lua @@ -8,8 +8,8 @@ function Module:internalName() return "module" end -function Module:SetAI(ai) - self.ai = ai - self.game = ai.game - self.map = ai.map -end \ No newline at end of file +function Module:EchoDebug(...) + if self.DebugEnabled then + self.game:SendToConsole(self.game:GetTeamID(), self:Name(), ...) + end +end diff --git a/LuaRules/Gadgets/ai/preload/shard_null/boot.lua b/LuaRules/Gadgets/ai/preload/shard_null/boot.lua new file mode 100644 index 000000000..288485b22 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/shard_null/boot.lua @@ -0,0 +1,16 @@ + + +function shard_include( file ) + if type(file) ~= 'string' then + return nil + end + return require( file ) +end + +-- load null objects +require "preload/hooks" +require "preload/class" +require "preload/aibase" +require "preload/module" +shard_include "preload/shard_null/unit" +shard_include "preload/shard_null/unittype" \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/shard_null/game.lua b/LuaRules/Gadgets/ai/preload/shard_null/game.lua new file mode 100644 index 000000000..11e96aa46 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/shard_null/game.lua @@ -0,0 +1,100 @@ +local game = {} +--game_engine + +-- prints 'message' to ingame chat console +function game:SendToConsole(...) + print( ... ) + return true +end + +function game:Frame() -- returns int/game frame number + return 0 +end + +function game:Test() -- debug + print( "Testing API" ) + return true +end + +function game:IsPaused() -- if the game is paused, returns true + return true +end + +function game:GetTypeByName(typename) -- returns unittype + return nil +end + +function game:ConfigFolderPath() -- returns string with path to the folder + return "luarules/gadgets/ai/" .. self:GameName() .. "/" + -- return game_engine:ConfigFolderPath() +end + +function game:ReadFile(filename) -- returns string with file contents + return '' -- @TODO: Implement core lua IO +end + +function game:FileExists(filename) -- returns boolean + return false -- @TODO: Implement core lua IO +end + +function game:GetTeamID() + return 0 +end + +function game:GetEnemies() + return {} +end + +function game:GetUnits() + return {} +end + +function game:GetFriendlies() + return {} +end + +function game:GameName() -- returns the shortname of this game + return "nullgame" +end + +function game:AddMarker(position,label) -- adds a marker + return false +end + +function game:SendToContent(stringvar) -- returns a string passed from any lua gadgets + return false +end + +function game:GetResource(idx) -- returns a Resource object + return Shard:shardify_resource({currentLevel=0, storage=0, pull=0, income=0, expense=0, share=0, sent=0, received=0}) +end + +function game:GetResourceCount() -- return the number of resources + return 0 +end + +function game:GetResourceByName(name) -- returns a Resource object, takes the name of the resource + return Shard:shardify_resource({currentLevel=0, storage=0, pull=0, income=0, expense=0, share=0, sent=0, received=0}) +end + +function game:GetUnitByID( unit_id ) -- returns a Shard unit when given an engine unit ID number + return +end + +function game:GetResources() -- returns a table of Resource objects, takes the name of the resource + return {} +end + +function game:UsesControlPoints() + return false +end + +function game:ControlPointCaptureRadius() + return 0 +end + +function game:ControlPointNonCapturingUnits() + return {} +end + +return game diff --git a/LuaRules/Gadgets/ai/preload/shard_null/map.lua b/LuaRules/Gadgets/ai/preload/shard_null/map.lua new file mode 100644 index 000000000..488c69026 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/shard_null/map.lua @@ -0,0 +1,168 @@ +local map = {} + + -- function map:FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) + -- function map:CanBuildHere(unittype,position) + -- function map:GetMapFeatures() + -- function map:GetMapFeaturesAt(position,radius) + -- function map:SpotCount() + -- function map:GetSpot(idx) + -- function map:GetMetalSpots() + -- function map:MapDimensions() + -- function map:MapName() + -- function map:AverageWind() + -- function map:MinimumWindSpeed() + -- function map:MaximumWindSpeed() + -- function map:TidalStrength() + -- function map:MaximumHeight() + -- function map:MinimumHeight() + +-- ################### + +function map:FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) -- returns Position + return false +end + +function map:CanBuildHere(unittype,position) -- returns boolean + return false +end + +function map:GetMapFeatures() + + return {} +end + +function map:GetMapFeaturesAt(position,radius) + return {} +end + +function map:SpotCount() -- returns the nubmer of metal spots + return 0 +end + +function map:GetSpot(idx) -- returns a Position for the given spot + return nil +end + +function map:GetMetalSpots() -- returns a table of spot positions + -- + return {} +end + +function map:GeoCount() -- returns the nubmer of metal spots + return 0 +end + +function map:GetGeo(idx) -- returns a Position for the given spot + return nil +end + +function map:GetGeoSpots() -- returns a table of spot positions + -- + return {} +end + +function map:GetControlPoints() + -- not sure this can be implemented in the Spring C++ AI interface + return {} +end + +function map:AreControlPoints() + -- not sure this can be implemented in the Spring C++ AI interface + return false +end + +function map:MapDimensions() -- returns a Position holding the dimensions of the map + local m = game_engine:Map() + return m:MapDimensions() +end + +function map:MapName() -- returns the name of this map + return "None" +end + +function map:AverageWind() -- returns (minwind+maxwind)/2 + return 1 +end + + +function map:MinimumWindSpeed() -- returns minimum windspeed + return 0 +end + +function map:MaximumWindSpeed() -- returns maximum wind speed + return 1 +end + +function map:MaximumHeight() -- returns maximum map height + return 1 +end + +function map:MinimumHeight() -- returns minimum map height + return 0 +end + +function map:TidalStrength() -- returns tidal strength + return 0 +end + +-- DRAWING FUNCTIONS + +local function dataToString(...) + local data = {...} + local str = '' + for i = 1, #data do + local d = data[i] + str = str .. '|' .. tostring(d) + end + return str +end + +local function SendToUnsynced(command, ...) + -- +end + +function map:DrawRectangle(pos1, pos2, color, label, filled, channel) + -- +end + +function map:EraseRectangle(pos1, pos2, color, label, filled, channel) + -- +end + +function map:DrawCircle(pos, radius, color, label, filled, channel) + -- +end + +function map:EraseCircle(pos, radius, color, label, filled, channel) + -- +end + +function map:DrawLine(pos1, pos2, color, label, arrow, channel) + -- +end + +function map:EraseLine(pos1, pos2, color, label, arrow, channel) + -- +end + +function map:DrawPoint(pos, color, label, channel) + -- +end + +function map:ErasePoint(pos, color, label, channel) + -- +end + +function map:EraseAll(channel) + -- +end + +function map:DisplayDrawings(onOff) + -- +end + +-- END DRAWING FUNCTIONS + + -- game.map = map + +return map \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/shard_null/unit.lua b/LuaRules/Gadgets/ai/preload/shard_null/unit.lua new file mode 100644 index 000000000..f2f2d8c7b --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/shard_null/unit.lua @@ -0,0 +1,324 @@ + +ShardUnit = class(function(a, id) + a.id = id + a.className = "unit" + a.type = nil +end) + +function ShardUnit:Unit_to_id( unit ) + local gid = unit + if type( unit ) == 'table' then + if unit['id'] ~= nil then + gid = unit.id + else + -- error! + return false + end + end + return gid +end + +function ShardUnit:ID() + return self.id +end + +function ShardUnit:Team() + return 1 +end + +function ShardUnit:Radius() + return 10 +end + +function ShardUnit:AllyTeam() + return 1 +end + +function ShardUnit:Neutral() + return false +end + +function ShardUnit:Stunned() + return false +end + +function ShardUnit:Name() + return 'nullunit' +end + + +function ShardUnit:IsAlive() + return true +end + + +function ShardUnit:IsCloaked() + return self:Cloaked() +end + +function ShardUnit:Cloaked() + return false +end + + +function ShardUnit:CurrentStockpile() + return 0 +end + + +function ShardUnit:Type() + return nil +end + + +function ShardUnit:CanMove() + return self:Type():CanMove() +end + + +function ShardUnit:CanDeploy() + return self:Type():CanDeploy() +end + +function ShardUnit:CanMorph() + return self:Type():CanMorph() +end + +function ShardUnit:IsBeingBuilt() + return false +end + +function ShardUnit:IsMorphing() + return false +end + + +function ShardUnit:CanAssistBuilding( unit )-- IUnit* unit) -- the unit that is under construction to help with + return true -- not sure when this would not be true in Spring + -- return false +end + + +function ShardUnit:CanMoveWhenDeployed() + -- what does deployed mean in the case of Spring? + return false +end + + +function ShardUnit:CanFireWhenDeployed() + return false +end + +function ShardUnit:CanMorphWhenDeployed() + return false +end + +function ShardUnit:CanBuildWhenDeployed() + return false +end + + +function ShardUnit:CanBuildWhenNotDeployed() + return false +end + +function ShardUnit:Stop() + return true +end + +function ShardUnit:Stockpile() + return true +end + +function ShardUnit:SelfDestruct() + return true +end + +function ShardUnit:Cloak() + return true +end + +function ShardUnit:UnCloak() + return true +end + +function ShardUnit:TurnOn() + return true +end + +function ShardUnit:TurnOff() + return true +end + +function ShardUnit:Guard( unit ) + return true +end + +function ShardUnit:Repair( unit ) + return true +end + +function ShardUnit:DGun(p) + return self:AltAttack( p ) +end + +function ShardUnit:ManualFire(p) + return true +end + +function ShardUnit:Move(p) + return true +end + +function ShardUnit:AttackMove(p) + return self:MoveAndFire(p) +end + +function ShardUnit:MoveAndFire(p) + return true +end + +function ShardUnit:Patrol(p) + return self:MoveAndPatrol(p) +end + +function ShardUnit:MoveAndPatrol(p) + return true +end + +function ShardUnit:Build(t, p) + return true +end + + +function ShardUnit:Reclaim( thing ) + return true +end + +function ShardUnit:AreaReclaim( p, radius ) + return true +end + + +function ShardUnit:Ressurect( thing ) + return true +end + +function ShardUnit:AreaResurrect( p, radius ) + return true +end + +function ShardUnit:Attack( unit ) + return true +end + +function ShardUnit:AreaAttack(p,radius) + return true +end + +function ShardUnit:Repair( unit ) + return true +end + +function ShardUnit:AreaRepair( p, radius ) + return true +end + +function ShardUnit:RestoreTerrain( p, radius ) + return true +end + +function ShardUnit:Capture( unit ) + return true +end + +function ShardUnit:AreaCapture( p, radius ) + return true +end + +function ShardUnit:MorphInto( type ) + return true +end + +function ShardUnit:HoldFire() + return true +end + +function ShardUnit:ReturnFire() + return true +end + +function ShardUnit:FireAtWill() + return true +end + +function ShardUnit:HoldPosition() + return true +end + +function ShardUnit:Manoeuvre() + return true +end + +function ShardUnit:Roam() + return true +end + +function ShardUnit:GetPosition() + return nil +end + + +function ShardUnit:GetHealth() + return 1 +end + + +function ShardUnit:GetMaxHealth() + return 1 +end + +function ShardUnit:ParalysisDamage() + return 0 +end + +function ShardUnit:CaptureProgress() + return 0 +end + +function ShardUnit:BuildProgress() + return 0 +end + + +function ShardUnit:WeaponCount() + return 0 +end + + +function ShardUnit:MaxWeaponsRange() + return 0 +end + + +function ShardUnit:CanBuild( type ) + return false +end + + +function ShardUnit:GetResourceUsage( idx ) + return nil +end + + +function ShardUnit:ExecuteCustomCommand( cmdId, params_list, options, timeOut ) + return nil +end + +function ShardUnit:DrawHighlight( color, label, channel ) + return nil +end + +function ShardUnit:EraseHighlight( color, label, channel ) + return nil +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/shard_null/unittype.lua b/LuaRules/Gadgets/ai/preload/shard_null/unittype.lua new file mode 100644 index 000000000..973259a7b --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/shard_null/unittype.lua @@ -0,0 +1,8 @@ +ShardUnitType = class(function(a, id) + a.id = id + a.def = { id=id} +end) + +function ShardUnitType:ID() + return self.id +end diff --git a/LuaRules/Gadgets/ai/preload/spring_cpp/boot.lua b/LuaRules/Gadgets/ai/preload/spring_cpp/boot.lua new file mode 100644 index 000000000..777c0ac00 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_cpp/boot.lua @@ -0,0 +1,34 @@ +-- initial setup of things + +function shard_include( file ) + if type(file) ~= 'string' then + return nil + end + local gameName = game_engine:GameName() + local ok1 + local mod1 + if gameName == 'BAR' then + ok1, mod1 = pcall( require, "BA/"..file ) + else + ok1, mod1 = pcall( require, gameName.."/"..file ) + end + if ok1 then + return mod1 + else + local ok2, mod2 = pcall( require, file ) + if ok2 then + return mod2 + else + game_engine:SendToConsole("require can't load " .. game_engine:GameName().."/"..file .. " error: " .. mod1) + game_engine:SendToConsole("require can't load " .. file .. " error: " .. mod2) + end + end +end + +shard_include "hooks" +shard_include "class" +shard_include "aibase" +shard_include "module" + +shard_include "preload/spring_cpp/unit" +shard_include "preload/spring_cpp/unittype" \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_cpp/game.lua b/LuaRules/Gadgets/ai/preload/spring_cpp/game.lua new file mode 100644 index 000000000..7454160e7 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_cpp/game.lua @@ -0,0 +1,162 @@ +local game = {} + --game_engine + + -- prints 'message' to ingame chat console + function game:SendToConsole(...) + local str = "" + local parts = {...} + for i = 1, #parts do + local part = parts[i] + str = str .. tostring(part) + if i < #parts then str = str .. ", " end + end + return game_engine:SendToConsole(str) + end + + function game:Frame() -- returns int/game frame number + return game_engine:Frame() -- Shard AI API + end + + function game:Test() -- debug + return game_engine:Test() + end + + function game:IsPaused() -- if the game is paused, returns true + -- + return game_engine:IsPaused() + end + + function game:GetTypeByName(typename) -- returns unittype + -- + return game_engine:GetTypeByName(typename) + end + + + function game:ConfigFolderPath() -- returns string with path to the folder + -- + return game_engine:ConfigFolderPath() + end + + function game:ReadFile(filename) -- returns string with file contents + -- + return game_engine:ReadFile(filename) + end + + function game:FileExists(filename) -- returns boolean + -- + return game_engine:FileExists(filename) + end + + function game:GetTeamID() -- returns boolean + -- + return game_engine:GetTeamID() + end + + function game:GetEnemies() + local has_enemies = game_engine:HasEnemies() + if has_enemies ~= true then + return nil + else + local ev = game_engine:GetEnemies() + local e = {} + local i = 0 + while i < ev:size() do + table.insert(e,ev[i]) + i = i + 1 + end + ev = nil + return e + end + end + + function game:GetUnits() + local fv = game_engine:GetUnits() + local f = {} + local i = 0 + while i < fv:size() do + table.insert(f,fv[i]) + i = i + 1 + end + fv = nil + return f + end + + function game:GetFriendlies() + local has_friendlies = game_engine:HasFriendlies() + if has_friendlies ~= true then + return nil + else + local fv = game_engine:GetFriendlies() + local f = {} + local i = 0 + while i < fv:size() do + table.insert(f,fv[i]) + i = i + 1 + end + fv = nil + return f + end + end + + function game:GameName() -- returns the shortname of this game + -- + return game_engine:GameName() + end + + function game:AddMarker(position,label) -- adds a marker + -- + return game_engine:AddMarker(position,label) + end + + function game:SendToContent(stringvar) -- returns a string passed from any lua gadgets + -- + return game_engine:SendToContent(stringvar) + end + + function game:GetResource(idx) -- returns a Resource object + return game_engine:GetResource(idx) + end + + function game:GetResourceCount() -- return the number of resources + return game_engine:GetResourceCount() + end + + function game:GetResourceByName(name) -- returns a Resource object, takes the name of the resource + return game_engine:GetResourceByName(name) + end + + function game:GetUnitByID( unit_id ) -- returns a Shard unit when given an engine unit ID number + return game_engine:getUnitByID( unit_id ) + end + + function game:GetResources() -- returns a table of Resource objects, takes the name of the resource + local rcount = game_engine:GetResourceCount() + if(rcount > 0) then + + local resources = {} + + for i = 0,rcount do + local res = game:GetResource(i) + if res.name ~= "" then + resources[res.name] = res + end + end + return resources + else + return nil + end + end + + function game:UsesControlPoints() + return map:AreControlPoints() + end + + function game:ControlPointCaptureRadius() + return 500 + end + + function game:ControlPointNonCapturingUnits() + return {} + end + +return game \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_cpp/map.lua b/LuaRules/Gadgets/ai/preload/spring_cpp/map.lua new file mode 100644 index 000000000..9f37a92fd --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_cpp/map.lua @@ -0,0 +1,240 @@ +local map = {} + + -- function map:FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) + -- function map:CanBuildHere(unittype,position) + -- function map:GetMapFeatures() + -- function map:GetMapFeaturesAt(position,radius) + -- function map:SpotCount() + -- function map:GetSpot(idx) + -- function map:GetMetalSpots() + -- function map:MapDimensions() + -- function map:MapName() + -- function map:AverageWind() + -- function map:MinimumWindSpeed() + -- function map:MaximumWindSpeed() + -- function map:TidalStrength() + -- function map:MaximumHeight() + -- function map:MinimumHeight() + +-- ################### + +function map:FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) -- returns Position + -- + return game_engine:Map():FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) +end + +function map:CanBuildHere(unittype,position) -- returns boolean + -- + return game_engine:Map():CanBuildHere(unittype,position) +end + +function map:GetMapFeatures() + local fv = game_engine:Map():GetMapFeatures() + local f = {} + local i = 0 + while i < fv:size() do + table.insert(f,fv[i]) + i = i + 1 + end + fv = nil + return f +end + +function map:GetMapFeaturesAt(position,radius) + local m = game_engine:Map() + local fv = m:GetMapFeaturesAt(position,radius) + local f = {} + local i = 0 + while i < fv:size() do + table.insert(f,fv[i]) + i = i + 1 + end + fv = nil + return f +end + +function map:SpotCount() -- returns the nubmer of metal spots + local m = game_engine:Map() + return m:SpotCount() +end + +function map:GetSpot(idx) -- returns a Position for the given spot + local m = game_engine:Map() + return m:GetSpot(idx) +end + +function map:GetMetalSpots() -- returns a table of spot positions + -- + local m = game_engine:Map() + local fv = game_engine:Map():GetMetalSpots() + local count = m:SpotCount() + local f = {} + local i = 0 + while i < count do + table.insert( f, m:GetSpot(i) ) + i = i + 1 + end + --fv = nil + return f +end + +function map:GeoCount() -- returns the nubmer of metal spots + local m = game_engine:Map() + return m:GeoCount() +end + +function map:GetGeo(idx) -- returns a Position for the given spot + local m = game_engine:Map() + return m:GetGeo(idx) +end + +function map:GetMetalSpots() -- returns a table of spot positions + -- + local m = game_engine:Map() + local fv = game_engine:Map():GetGeoSpots() + local count = m:GeoCount() + local f = {} + local i = 0 + while i < count do + table.insert( f, m:GetGeo(i) ) + i = i + 1 + end + --fv = nil + return f +end + +function map:GetControlPoints() + -- not sure this can be implemented in the Spring C++ AI interface + return {} +end + +function map:AreControlPoints() + -- not sure this can be implemented in the Spring C++ AI interface + return false +end + +function map:MapDimensions() -- returns a Position holding the dimensions of the map + local m = game_engine:Map() + return m:MapDimensions() +end + +function map:MapName() -- returns the name of this map + local m = game_engine:Map() + return m:MapName() +end + +function map:AverageWind() -- returns (minwind+maxwind)/2 + local m = game_engine:Map() + return m:AverageWind() +end + + +function map:MinimumWindSpeed() -- returns minimum windspeed + local m = game_engine:Map() + return m:MinimumWindSpeed() +end + +function map:MaximumWindSpeed() -- returns maximum wind speed + local m = game_engine:Map() + return m:MaximumWindSpeed() +end + +function map:MaximumHeight() -- returns maximum map height + local m = game_engine:Map() + return m:MaximumHeight() +end + +function map:MinimumHeight() -- returns minimum map height + local m = game_engine:Map() + return m:MinimumHeight() +end + +function map:TidalStrength() -- returns tidal strength + local m = game_engine:Map() + return m:TidalStrength() +end + +-- DRAWING FUNCTIONS + +local function dataToString(...) + local data = {...} + local str = '' + for i = 1, #data do + local d = data[i] + str = str .. '|' .. tostring(d) + end + return str +end + +local function SendToUnsynced(command, ...) + -- game_engine:SendToContent(command .. dataToString(...)) + local buff = io.open('sharddrawbuffer', 'a') + if buff then + buff:write(command .. dataToString(...) .. "\n") + buff:close() + end +end + +function map:DrawRectangle(pos1, pos2, color, label, filled, channel) + channel = channel or 1 + color = color or {} + -- game:SendToContent('ShardDrawAddRectangle' .. dataToString(pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel)) + SendToUnsynced('ShardDrawAddRectangle', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:EraseRectangle(pos1, pos2, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseRectangle', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:DrawCircle(pos, radius, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddCircle', pos.x, pos.z, radius, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:EraseCircle(pos, radius, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseCircle', pos.x, pos.z, radius, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:DrawLine(pos1, pos2, color, label, arrow, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddLine', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, arrow, self.ai.game:GetTeamID(), channel) +end + +function map:EraseLine(pos1, pos2, color, label, arrow, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseLine', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, arrow, self.ai.game:GetTeamID(), channel) +end + +function map:DrawPoint(pos, color, label, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddPoint', pos.x, pos.z, color[1], color[2], color[3], color[4], label, self.ai.game:GetTeamID(), channel) +end + +function map:ErasePoint(pos, color, label, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawErasePoint', pos.x, pos.z, color[1], color[2], color[3], color[4], label, self.ai.game:GetTeamID(), channel) +end + +function map:EraseAll(channel) + channel = channel or 1 + SendToUnsynced('ShardDrawClearShapes', self.ai.game:GetTeamID(), channel) +end + +function map:DisplayDrawings(onOff) + SendToUnsynced('ShardDrawDisplay', onOff) +end + +-- END DRAWING FUNCTIONS + + -- game.map = map + +return map \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_cpp/unit.lua b/LuaRules/Gadgets/ai/preload/spring_cpp/unit.lua new file mode 100644 index 000000000..935075459 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_cpp/unit.lua @@ -0,0 +1,3 @@ +function shardify_unit( unit ) + return unit +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_cpp/unittype.lua b/LuaRules/Gadgets/ai/preload/spring_cpp/unittype.lua new file mode 100644 index 000000000..6307c474b --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_cpp/unittype.lua @@ -0,0 +1,3 @@ +function shardify_unittype( unittype ) + return unittype +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/.directory b/LuaRules/Gadgets/ai/preload/spring_lua/.directory new file mode 100644 index 000000000..d692d9f1f --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_lua/.directory @@ -0,0 +1,6 @@ +[Dolphin] +Timestamp=2017,5,10,23,26,28 +Version=3 + +[Settings] +HiddenFilesShown=true diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/boot.lua b/LuaRules/Gadgets/ai/preload/spring_lua/boot.lua new file mode 100644 index 000000000..1b14cc033 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_lua/boot.lua @@ -0,0 +1,39 @@ +-- initial setup of things + +function shard_include( file ) + if type(file) ~= 'string' then + return nil + end + subdir = Game.gameShortName + if Game.gameShortName == "BAR" then + -- AI for BA / BAR is (atm) the same + subdir = "BA" + end + + local gameFile = "luarules/gadgets/ai/" .. subdir .. "/" .. file .. ".lua" + local baseFile = "luarules/gadgets/ai/" .. file .. ".lua" + local preloadFile = "luarules/gadgets/ai/preload/" .. file .. ".lua" + if VFS.FileExists(gameFile) then + -- Spring.Echo("got gameFile", gameFile) + return VFS.Include(gameFile) + elseif VFS.FileExists(baseFile) then + -- Spring.Echo("got baseFile", baseFile) + return VFS.Include(baseFile) + elseif VFS.FileExists(preloadFile) then + -- Spring.Echo("got preloadFile", preloadFile) + return VFS.Include(preloadFile) + end +end + +shard_include "preload/spring_lua/shard" +os = shard_include "preload/spring_lua/fakeos" +api = shard_include "preload/spring_lua/fakeapi" +shard_include "preload/hooks" +shard_include "preload/class" +shard_include "preload/aibase" +shard_include "preload/module" +shard_include "preload/spring_lua/unit" +shard_include "preload/spring_lua/unittype" +shard_include "preload/spring_lua/damage" +shard_include "preload/spring_lua/feature" +shard_include "preload/spring_lua/controlpoint" diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/controlpoint.lua b/LuaRules/Gadgets/ai/preload/spring_lua/controlpoint.lua new file mode 100644 index 000000000..28a62d427 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_lua/controlpoint.lua @@ -0,0 +1,29 @@ + +ShardSpringControlPoint = class(function(a) + -- +end) + + +function ShardSpringControlPoint:Init( rawPoint, id ) + self.rawPoint = rawPoint + self.position = {x=rawPoint.x, y=rawPoint.y, z=rawPoint.z} + self.id = id +end + +function ShardSpringControlPoint:ID() + return self.id +end + +function ShardSpringControlPoint:GetPosition() + return self.position +end + +function ShardSpringControlPoint:GetOwner() + return self.rawPoint.owner + -- local rawPoints = {} + -- if Script.LuaRules('ControlPoints') then + -- rawPoints = Script.LuaRules.ControlPoints() or {} + -- end + -- local rawPoint = rawPoints[self.id] + -- return rawPoint.owner +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/damage.lua b/LuaRules/Gadgets/ai/preload/spring_lua/damage.lua index 28f4f9316..6d6aca004 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/damage.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/damage.lua @@ -2,14 +2,45 @@ ShardSpringDamage = class(function(a) -- end) - -function ShardSpringDamage:Init( damage, weaponDefId, paralyzer ) +local spGetGameFrame = Spring.GetGameFrame +local spGetProjectileDirection = Spring.GetProjectileDirection + +function ShardSpringDamage:Init( damage, weaponDefID, paralyzer, projectileID, engineAttacker ) self.damage = damage - self.weaponDefId = weaponDefId + self.weaponDefID = weaponDefID self.paralyzer = paralyzer - self.gameframe = Spring.GetGameFrame() + self.projectileID = projectileID + self.attacker = engineAttacker + self.gameframe = spGetGameFrame() + if projectileID then + local dx, dy, dz = spGetProjectileDirection(projectileID) + self.direction = {x=dx, y=dy, z=dz} + end + self.damageType = weaponDefID + if weaponDefID then + local weaponDef = WeaponDefs[weaponDefID] + if weaponDef then + self.weaponType = weaponDef.name + end + end end function ShardSpringDamage:Damage() return self.damage -end \ No newline at end of file +end + +function ShardSpringDamage:Attacker() + return self.attacker +end + +function ShardSpringDamage:Direction() + return self.direction +end + +function ShardSpringDamage:DamageType() + return self.damageType +end + +function ShardSpringDamage:WeaponType() + return self.weaponType +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/game.lua b/LuaRules/Gadgets/ai/preload/spring_lua/game.lua index 5ba131eb0..f097d302f 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/game.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/game.lua @@ -22,8 +22,12 @@ local game = {} end function game:GetTypeByName(typename) -- returns unittype - if not UnitDefNames[typename] then return end - return Shard:shardify_unittype(UnitDefNames[typename].id) + if not UnitDefNames[typename] then + Spring.Echo( 'shard: debug: could not find "'..typename..'" in UnitDefNames' ) + return nil + end + local def = UnitDefNames[typename] + return Shard:shardify_unittype(def.id) end @@ -128,4 +132,22 @@ local game = {} end]]-- end + function game:UsesControlPoints() + return self.ai.map:AreControlPoints() + end + + function game:ControlPointCaptureRadius() + if Script.LuaRules('CaptureRadius') then + return Script.LuaRules.CaptureRadius() or 500 + end + return 500 + end + + function game:ControlPointNonCapturingUnits() + if Script.LuaRules('NonCapturingUnits') then + return Script.LuaRules.NonCapturingUnits() or {} + end + return {} + end + return game \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/geo.lua b/LuaRules/Gadgets/ai/preload/spring_lua/geo.lua new file mode 100644 index 000000000..89910e9a9 --- /dev/null +++ b/LuaRules/Gadgets/ai/preload/spring_lua/geo.lua @@ -0,0 +1,18 @@ +local function GetGeos() + local geos = {} + local i = 1 + for ct, featureID in pairs(Spring.GetAllFeatures()) do + local featureDefID = Spring.GetFeatureDefID(featureID) + if FeatureDefs[featureDefID].geoThermal == true then + local x, y, z = Spring.GetFeaturePosition(featureID) + local spot = {x = x, z = z, y = Spring.GetGroundHeight(x,z)} + geos[i] = spot + i = i + 1 + end + end + return geos +end + +local spots = GetGeos() + +return spots diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/map.lua b/LuaRules/Gadgets/ai/preload/spring_lua/map.lua index 81205b70c..0bea72ed4 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/map.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/map.lua @@ -1,6 +1,6 @@ local map = {} map.spots = shard_include("spring_lua/metal") - +map.geos = shard_include("spring_lua/geo") -- function map:FindClosestBuildSite(unittype,builderpos, searchradius, minimumdistance) -- function map:CanBuildHere(unittype,position) -- function map:GetMapFeatures() @@ -100,6 +100,46 @@ function map:GetMetalSpots() -- returns a table of spot positions return f end +function map:GeoCount() -- returns the nubmer of metal spots + return #self.geos +end + +function map:GetGeo(idx) + return self.geos[idx] +end + +function map:GetGeoSpots() -- returns a table of spot positions + local fv = self.geos + local count = self:GeoCount() + local f = {} + local i = 0 + while i < count do + table.insert( f, fv[i] ) + i = i + 1 + end + return f +end + +function map:GetControlPoints() + if self.controlPoints then return self.controlPoints end + self.controlPoints = {} + if Script.LuaRules('ControlPoints') then + local rawPoints = Script.LuaRules.ControlPoints() or {} + for id = 1, #rawPoints do + local rawPoint = rawPoints[id] + local cp = ShardSpringControlPoint() + cp:Init(rawPoint, id) + self.controlPoints[id] = cp + end + end + return self.controlPoints +end + +function map:AreControlPoints() + local points = self:GetControlPoints() + return #points > 0 +end + function map:MapDimensions() -- returns a Position holding the dimensions of the map return { x = Game.mapSizeX / 8, @@ -140,5 +180,66 @@ function map:TidalStrength() -- returns tidal strength return Game.tidal end +-- DRAWING FUNCTIONS + +function map:DrawRectangle(pos1, pos2, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddRectangle', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:EraseRectangle(pos1, pos2, color, label, filled, channel) + channel = channel or 1 + color = color or {} + return SendToUnsynced('ShardDrawEraseRectangle', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:DrawCircle(pos, radius, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddCircle', pos.x, pos.z, radius, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:EraseCircle(pos, radius, color, label, filled, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseCircle', pos.x, pos.z, radius, color[1], color[2], color[3], color[4], label, filled, self.ai.game:GetTeamID(), channel) +end + +function map:DrawLine(pos1, pos2, color, label, arrow, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddLine', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, arrow, self.ai.game:GetTeamID(), channel) +end + +function map:EraseLine(pos1, pos2, color, label, arrow, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseLine', pos1.x, pos1.z, pos2.x, pos2.z, color[1], color[2], color[3], color[4], label, arrow, self.ai.game:GetTeamID(), channel) +end + +function map:DrawPoint(pos, color, label, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddPoint', pos.x, pos.z, color[1], color[2], color[3], color[4], label, self.ai.game:GetTeamID(), channel) +end + +function map:ErasePoint(pos, color, label, channel) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawErasePoint', pos.x, pos.z, color[1], color[2], color[3], color[4], label, self.ai.game:GetTeamID(), channel) +end + +function map:EraseAll(channel) + channel = channel or 1 + SendToUnsynced('ShardDrawClearShapes', self.ai.game:GetTeamID(), channel) +end + +function map:DisplayDrawings(onOff) + SendToUnsynced('ShardDrawDisplay', onOff) +end + +-- END DRAWING FUNCTIONS + -- game.map = map return map \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/metal.lua b/LuaRules/Gadgets/ai/preload/spring_lua/metal.lua index 763db00f6..f64fc745d 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/metal.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/metal.lua @@ -1,240 +1,5 @@ -local elmosPerMetal = 16 -local metalmapSizeX = Game.mapSizeX / elmosPerMetal -local metalmapSizeZ = Game.mapSizeZ / elmosPerMetal -local extractorRadiusMetal = math.ceil( Game.extractorRadius / elmosPerMetal ) -local maxSpotArea = math.ceil( (extractorRadiusMetal*extractorRadiusMetal) * 2 * math.pi ) -local minSpotArea = math.ceil( maxSpotArea * 0.25 ) -local sqRootThree = math.sqrt(3) -local halfHexHeight = math.ceil( (sqRootThree * extractorRadiusMetal) / 2 ) -local halfExtractorRadiusMetal = math.ceil( extractorRadiusMetal / 2 ) - -Spring.Echo(metalmapSizeX, metalmapSizeZ, metalmapSizeX*metalmapSizeZ, extractorRadiusMetal, maxSpotArea, minSpotArea, halfHexHeight, halfExtractorRadiusMetal) - -local mCeil = math.ceil - -local spGetMetalAmount = Spring.GetMetalAmount -local spGetGroundHeight = Spring.GetGroundHeight - -local isInBlob = {} -local blobs = {} -local hexes = {} -local spotsInBlob = {} - -local function Flood4Metal(x, z, id) - if x > metalmapSizeX or x < 1 or z > metalmapSizeZ or z < 1 then return end - if isInBlob[x] and isInBlob[x][z] then return end - local metalAmount = spGetMetalAmount(x, z) - if metalAmount and metalAmount > 0 then - if not isInBlob[x] then isInBlob[x] = {} end - if not blobs[id] then blobs[id] = {} end - blobs[id][#blobs[id]+1] = {x=x, z=z} - isInBlob[x][z] = id - Flood4Metal(x+1,z,id) - Flood4Metal(x-1,z,id) - Flood4Metal(x,z+1,id) - Flood4Metal(x,z-1,id) - return true - end -end - -local function Flood1Metal(x, z, id) - if x > metalmapSizeX or x < 1 or z > metalmapSizeZ or z < 1 then return end - if isInBlob[x] and isInBlob[x][z] then return end - local metalAmount = spGetMetalAmount(x, z) - if metalAmount and metalAmount > 0 then - if not isInBlob[x] then isInBlob[x] = {} end - if not blobs[id] then blobs[id] = {} end - blobs[id][#blobs[id]+1] = {x=x, z=z} - isInBlob[x][z] = id - return true - end -end - -local function FloodBufferMetal(x, z, id) - local buffer = { {x=x, z=z} } - local firstokay = false - repeat - local newBuff = {} - for i = 1, #buffer do - local buff = buffer[i] - local bx, bz = buff.x, buff.z - if Flood1Metal(bx, bz, id) then - firstokay = true - newBuff[#newBuff+1] = {x=bx+1, z=bz} - newBuff[#newBuff+1] = {x=bx-1, z=bz} - newBuff[#newBuff+1] = {x=bx, z=bz+1} - newBuff[#newBuff+1] = {x=bx, z=bz-1} - end - end - buffer = newBuff - until #buffer == 0 - return firstokay -end - -local function CheckHorizontalLineBlob(x, z, tx, id) - local area = 0 - for ix = x, tx do - if isInBlob[x] and isInBlob[x][z] == id then - -- if spGetMetalAmount(x, z) > 0 then - area = area + 1 - end - end - return area -end - -local function Check4Blob(cx, cz, x, z, id) - local area = 0 - area = area + CheckHorizontalLineBlob(cx - x, cz + z, cx + x, id) - if x ~= 0 and z ~= 0 then - area = area + CheckHorizontalLineBlob(cx - x, cz - z, cx + x, id) - end - return area -end - -local function CheckCircle(cx, cz, radius, id) - local area = 0 - if radius > 0 then - local err = -radius - local x = radius - local z = 0 - while x >= z do - local lastZ = z - err = err + z - z = z + 1 - err = err + z - area = area + Check4Blob(cx, cz, x, lastZ, id) - if err >= 0 then - if x ~= lastZ then - area = area + Check4Blob(cx, cz, lastZ, x, id) - end - err = err - x - x = x - 1 - err = err - x - end - end - end - return area -end - -local function FloodHexBlob(x, z, id) - if x > metalmapSizeX or x < 1 or z > metalmapSizeZ or z < 1 then return end - if not hexes[id] then hexes[id] = {} end - if not hexes[id][x] then hexes[id][x] = {} end - -- if hexes[id][x][z] or spGetMetalAmount(x,z) == 0 then return end - if hexes[id][x][z] or not isInBlob[x] or isInBlob[x][z] ~= id then return end - local blobArea = CheckCircle(x, z, extractorRadiusMetal, id) - -- Spring.Echo(x, z, id, blobArea, minSpotArea) - if blobArea > minSpotArea then - local sx = x*elmosPerMetal - local sz = z*elmosPerMetal - spotsInBlob[id][#spotsInBlob[id]+1] = {x=sx, z=sz, y=spGetGroundHeight(sx,sz)} - hexes[id][x][z] = true - FloodHexBlob(x + extractorRadiusMetal, z, id) - FloodHexBlob(x + halfExtractorRadiusMetal, z - halfHexHeight, id) - FloodHexBlob(x - halfExtractorRadiusMetal, z - halfHexHeight, id) - FloodHexBlob(x - extractorRadiusMetal, z, id) - FloodHexBlob(x - halfExtractorRadiusMetal, z + halfHexHeight, id) - FloodHexBlob(x + halfExtractorRadiusMetal, z + halfHexHeight, id) - return true - end -end - -local function Flood1HexBlob(x, z, id) - if x > metalmapSizeX or x < 1 or z > metalmapSizeZ or z < 1 then return end - if not hexes[id] then hexes[id] = {} end - if not hexes[id][x] then hexes[id][x] = {} end - if hexes[id][x][z] or spGetMetalAmount(x,z) == 0 then return end - local blobArea = CheckCircle(x, z, extractorRadiusMetal, id) - -- Spring.Echo(x, z, id, blobArea, minSpotArea) - if blobArea > minSpotArea then - local sx = x*elmosPerMetal - local sz = z*elmosPerMetal - spotsInBlob[id][#spotsInBlob[id]+1] = {x=sx, z=sz, y=spGetGroundHeight(sx,sz)} - hexes[id][x][z] = true - return true - end -end - -local function FloodBufferHexBlob(x, z, id) - local hhh = halfHexHeight - local erm = extractorRadiusMetal - local herm = halfExtractorRadiusMetal - local buffer = { {x=x, z=z} } - local firstokay = false - repeat - local newBuff = {} - for i = 1, #buffer do - local buff = buffer[i] - local bx, bz = buff.x, buff.z - if Flood1HexBlob(bx, bz, id) then - firstokay = true - newBuff[#newBuff+1] = { x = bx + extractorRadiusMetal, z = bz } - newBuff[#newBuff+1] = { x = bx + halfExtractorRadiusMetal, z = bz - halfHexHeight } - newBuff[#newBuff+1] = { x = bx - halfExtractorRadiusMetal, z = bz - halfHexHeight } - newBuff[#newBuff+1] = { x = bx - extractorRadiusMetal, z = bz } - newBuff[#newBuff+1] = { x = bx - halfExtractorRadiusMetal, z = bz + halfHexHeight } - newBuff[#newBuff+1] = { x = bx + halfExtractorRadiusMetal, z = bz + halfHexHeight } - end - end - buffer = newBuff - until #buffer == 0 - return firstokay -end - -local function CirclePack(x, z, id) - spotsInBlob[id] = {} - FloodBufferHexBlob(x, z, id) - hexes[id] = nil -end - local function GetSpots() - local id = 1 - for x = 1, metalmapSizeX do - for z = 1, metalmapSizeZ do - local tharBeMetal = FloodBufferMetal(x, z, id) - if tharBeMetal then id = id + 1 end - end - end - Spring.Echo(#blobs, "blobs") - -- isInBlob = {} - local spots = {} - for id = 1, #blobs do - local blob = blobs[id] - local x, z = 0, 0 - for p = 1, #blob do - local pixel = blob[p] - x = x + pixel.x - z = z + pixel.z - end - x = x / #blob - z = z / #blob - local blobArea = #blob - blob = nil - blobs[id] = nil - if blobArea < maxSpotArea then - local sx = x * elmosPerMetal - local sz = z * elmosPerMetal - spots[#spots+1] = {x=sx, z=sz, y=spGetGroundHeight(sx,sz)} - else - x = mCeil(x) - z = mCeil(z) - CirclePack(x, z, id) - local blobSpots = spotsInBlob[id] - Spring.Echo(#blobSpots, "spots in blob", id) - for i = 1, #blobSpots do - local spot = blobSpots[i] - spots[#spots+1] = spot - end - spotsInBlob[id] = nil - end - end - -- for i = 1, #spots do - -- local spot = spots[i] - -- if not spot.y then - -- Spring.MarkerAddPoint(spot.x, spGetGroundHeight(spot.x, spot.z), spot.z, "bad") - -- end - -- end - return spots + return GG.metalSpots end local spots = GetSpots() diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/shard.lua b/LuaRules/Gadgets/ai/preload/spring_lua/shard.lua index ce693486b..40985b988 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/shard.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/shard.lua @@ -22,8 +22,7 @@ end function Shard:shardify_unit( unitID ) if not unitID then return end if not self.unitsByID[unitID] then - local unit = ShardSpringUnit() - unit:Init(unitID) + local unit = ShardUnit( unitID ) self.unitsByID[unitID] = unit end return self.unitsByID[unitID] @@ -35,19 +34,21 @@ function Shard:unshardify_unit( unitID ) end function Shard:shardify_unittype( unitDefID ) - if not unitDefID then return end + if not unitDefID then + Spring.Echo( 'shard: error: shardify_unittype recieved "'..unitDefID..'" of type "'.. type(unitDefID).. '" ' ) + return nil + end if not self.unittypesByID[unitDefID] then - local unittype = ShardSpringUnitType() - unittype:Init(unitDefID) + local unittype = ShardUnitType(unitDefID) self.unittypesByID[unitDefID] = unittype end return self.unittypesByID[unitDefID] end -function Shard:shardify_damage( damage, weaponDefId, paralyzer ) - local sharddamage = ShardSpringDamage() - sharddamage:Init(damage, weaponDefId, paralyzer) - return sharddamage +function Shard:shardify_damage( damage, weaponDefID, paralyzer, projectileID, engineAttacker ) + local sharddamage = ShardSpringDamage() + sharddamage:Init(damage, weaponDefID, paralyzer, projectileID, engineAttacker) + return sharddamage end function Shard:shardify_feature( featureID ) diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/unit.lua b/LuaRules/Gadgets/ai/preload/spring_lua/unit.lua index c6ecfcc2e..862a64f97 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/unit.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/unit.lua @@ -1,166 +1,339 @@ -ShardSpringUnit = class(function(a) - -- +ShardUnit = class(function(a, id) + a.id = id + a.className = "unit" + local udefid = Spring.GetUnitDefID(id) + a.type = ShardUnitType(udefid) end) -function ShardSpringUnit:Init( id ) - self.id = id - self.className = "unit" +function ShardUnit:Unit_to_id( unit ) + local gid = unit + if type( unit ) == 'table' then + if unit['id'] ~= nil then + gid = unit.id + else + -- error! + return false + end + end + return gid end -function ShardSpringUnit:ID() +function ShardUnit:ID() return self.id end -function ShardSpringUnit:Team() +function ShardUnit:Team() return Spring.GetUnitTeam(self.id) end +function ShardUnit:Radius() + return Spring.GetUnitRadius(self.id) +end -function ShardSpringUnit:Name() - if not self.name then - self.name = UnitDefs[Spring.GetUnitDefID(self.id)].name - end - return self.name +function ShardUnit:AllyTeam() + return Spring.GetUnitAllyTeam(self.id) +end + +function ShardUnit:Neutral() + return Spring.GetUnitNeutral(self.id) end +function ShardUnit:Stunned() + local stunned_or_inbuild, stunned, inbuild = Spring.GetUnitIsStunned(self.id) + return stunned +end -function ShardSpringUnit:IsAlive() - return not Spring.GetUnitIsDead(self.id) +function ShardUnit:Name() + return self.type:Name() end -function ShardSpringUnit:IsCloaked() - return Spring.GetUnitIsCloaked(self.id) +function ShardUnit:IsAlive() + return not Spring.GetUnitIsDead(self.id) end -function ShardSpringUnit:Forget() - return 0 +function ShardUnit:IsCloaked() + return self:Cloaked() end +function ShardUnit:Cloaked() + return Spring.GetUnitIsCloaked(self.id) +end -function ShardSpringUnit:Forgotten() - return false + +function ShardUnit:CurrentStockpile() + local numStockpiled, numStockpileQued, buildPercent = Spring.GetUnitStockpile(self.id) + return numStockpiled end -function ShardSpringUnit:Type() - if not self.type then - -- local ai = Shard.AIs[1] - -- self.type = ai.game:GetTypeByName( self:Name() ) - self.type = game:GetTypeByName( self:Name() ) - end +function ShardUnit:Type() return self.type end -function ShardSpringUnit:CanMove() +function ShardUnit:CanMove() return self:Type():CanMove() end -function ShardSpringUnit:CanDeploy() +function ShardUnit:CanDeploy() return self:Type():CanDeploy() end -function ShardSpringUnit:IsBeingBuilt() +function ShardUnit:CanMorph() + return self:Type():CanMorph() +end + +function ShardUnit:IsBeingBuilt() local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) return buildProgress < 1 end +function ShardUnit:IsMorphing() + return false +end + -function ShardSpringUnit:CanAssistBuilding( unit )-- IUnit* unit) -- the unit that is under construction to help with +function ShardUnit:CanAssistBuilding( unit )-- IUnit* unit) -- the unit that is under construction to help with return true -- not sure when this would not be true in Spring -- return false end -function ShardSpringUnit:CanMoveWhenDeployed() +function ShardUnit:CanMoveWhenDeployed() -- what does deployed mean in the case of Spring? return false end -function ShardSpringUnit:CanFireWhenDeployed() +function ShardUnit:CanFireWhenDeployed() return false end +function ShardUnit:CanMorphWhenDeployed() + return false +end -function ShardSpringUnit:CanBuildWhenDeployed() +function ShardUnit:CanBuildWhenDeployed() return false end -function ShardSpringUnit:CanBuildWhenNotDeployed() +function ShardUnit:CanBuildWhenNotDeployed() return false end - -function ShardSpringUnit:Stop() +function ShardUnit:Stop() Spring.GiveOrderToUnit( self.id, CMD.STOP, {}, {} ) return true end +function ShardUnit:Stockpile() + Spring.GiveOrderToUnit( self.id, CMD.STOCKPILE, {}, {} ) + return true +end -function ShardSpringUnit:Move(p) +function ShardUnit:SelfDestruct() + Spring.GiveOrderToUnit( self.id, CMD.SELFD, {}, {} ) + return true +end + +function ShardUnit:Cloak() + Spring.GiveOrderToUnit( self.id, CMD.CLOAK, { 1 }, {} ) + return true +end + +function ShardUnit:UnCloak() + Spring.GiveOrderToUnit( self.id, CMD.CLOAK, { 0 }, {} ) + return true +end + +function ShardUnit:TurnOn() + Spring.GiveOrderToUnit( self.id, CMD.ONOFF, { 1 }, {} ) + return true +end + +function ShardUnit:TurnOff() + Spring.GiveOrderToUnit( self.id, CMD.ONOFF, { 0 }, {} ) + return true +end + +function ShardUnit:Guard( unit ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.GUARD, { gid }, {} ) + return true +end + +function ShardUnit:Repair( unit ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.REPAIR, { gid }, {} ) + return true +end + +function ShardUnit:DGun(p) + return self:AltAttack( p ) +end + +function ShardUnit:ManualFire(p) + Spring.GiveOrderToUnit( self.id, CMD.DGUN, { p.x, p.y, p.z }, {} ) + return true +end + +function ShardUnit:Move(p) Spring.GiveOrderToUnit( self.id, CMD.MOVE, { p.x, p.y, p.z }, {} ) return true end +function ShardUnit:AttackMove(p) + return self:MoveAndFire(p) +end -function ShardSpringUnit:MoveAndFire(p) +function ShardUnit:MoveAndFire(p) Spring.GiveOrderToUnit( self.id, CMD.FIGHT, { p.x, p.y, p.z }, {} ) return true end +function ShardUnit:Patrol(p) + return self:MoveAndPatrol(p) +end -function ShardSpringUnit:Build(t, p) -- IUnitType* +function ShardUnit:MoveAndPatrol(p) + Spring.GiveOrderToUnit( self.id, CMD.PATROL, { p.x, p.y, p.z }, {} ) + return true +end + +function ShardUnit:Build(t, p, f, opts) -- IUnitType* if type(t) == "string" then -- local ai = Shard.AIs[1] -- t = ai.game:GetTypeByName(t) t = game:GetTypeByName(t) end + opts = opts or {} + f = f or 0 if not p then p = self:GetPosition() end - Spring.GiveOrderToUnit( self.id, -t:ID(), { p.x, p.y, p.z }, {} ) + Spring.GiveOrderToUnit( self.id, -t:ID(), { p.x, p.y, p.z, f}, opts ) return true end -function ShardSpringUnit:AreaReclaim( p, radius )--Position p, double radius) + +function ShardUnit:Reclaim( thing )--IMapFeature* mapFeature) + if not thing then return end + local gid = self:Unit_to_id( unit ) + if thing.className == "feature" then + Spring.GiveOrderToUnit( self.id, CMD.RECLAIM, { gid + Game.maxUnits }, {} ) + elseif thing.className == "unit" then + Spring.GiveOrderToUnit( self.id, CMD.RECLAIM, { gid }, {} ) + end + return true +end + +function ShardUnit:AreaReclaim( p, radius )--Position p, double radius) Spring.GiveOrderToUnit( self.id, CMD.RECLAIM, { p.x, p.y, p.z, radius }, {} ) return true end -function ShardSpringUnit:Reclaim( thing )--IMapFeature* mapFeature) +function ShardUnit:Ressurect( thing )--IMapFeature* mapFeature) if not thing then return end + local gid = self:Unit_to_id( unit ) if thing.className == "feature" then - Spring.GiveOrderToUnit( self.id, CMD.RECLAIM, { thing:ID() + Game.maxUnits }, {} ) + Spring.GiveOrderToUnit( self.id, CMD.RESURRECT, { gid + Game.maxUnits }, {} ) elseif thing.className == "unit" then - Spring.GiveOrderToUnit( self.id, CMD.RECLAIM, { thing:ID() }, {} ) + Spring.GiveOrderToUnit( self.id, CMD.RESURRECT, { gid }, {} ) end return true end -function ShardSpringUnit:Attack( unit ) - Spring.GiveOrderToUnit( self.id, CMD.ATTACK, { unit:ID() }, {} ) +function ShardUnit:AreaRESURRECT( p, radius )--Position p, double radius) + Spring.GiveOrderToUnit( self.id, CMD.RESURRECT, { p.x, p.y, p.z, radius }, {} ) return true end +function ShardUnit:Attack( unit ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.ATTACK, { gid }, {} ) + return true +end -function ShardSpringUnit:Repair( unit ) - Spring.GiveOrderToUnit( self.id, CMD.REPAIR, { unit:ID() }, {} ) +function ShardUnit:AreaAttack(p,radius) + Spring.GiveOrderToUnit( self.id, CMD.AREA_ATTACK, { p.x, p.y, p.z, radius }, {} ) return true end +function ShardUnit:Repair( unit ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.REPAIR, { gid }, {} ) + return true +end -function ShardSpringUnit:MorphInto( type ) - -- how? - return false +function ShardUnit:AreaRepair( p, radius ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.REPAIR, { p.x, p.y, p.z, radius }, {} ) + return true +end + +function ShardUnit:RestoreTerrain( p, radius ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.RESTORE, { p.x, p.y, p.z, radius }, {} ) + return true +end + +function ShardUnit:Capture( unit ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.CAPTURE, { gid }, {} ) + return true +end + +function ShardUnit:AreaCapture( p, radius ) + local gid = self:Unit_to_id( unit ) + Spring.GiveOrderToUnit( self.id, CMD.CAPTURE, { p.x, p.y, p.z, radius }, {} ) + return true +end + +function ShardUnit:MorphInto( type ) + Spring.GiveOrderToUnit( self.id, CMD.MORPH, { self.id }, {} ) + return true +end + +function ShardUnit:EZMorph() + Spring.GiveOrderToUnit( self.id, 31337, {}, {} ) + return true +end + +function ShardUnit:HoldFire() + Spring.GiveOrderToUnit( self.id, CMD.FIRE_STATE, { 0 }, {} ) + return true +end + +function ShardUnit:ReturnFire() + Spring.GiveOrderToUnit( self.id, CMD.FIRE_STATE, { 1 }, {} ) + return true end +function ShardUnit:FireAtWill() + Spring.GiveOrderToUnit( self.id, CMD.FIRE_STATE, { 2 }, {} ) + return true +end + +function ShardUnit:HoldPosition() + Spring.GiveOrderToUnit( self.id, CMD.MOVE_STATE, { 0 }, {} ) + return true +end + +function ShardUnit:Manoeuvre() + Spring.GiveOrderToUnit( self.id, CMD.MOVE_STATE, { 1 }, {} ) + return true +end + +function ShardUnit:Roam() + Spring.GiveOrderToUnit( self.id, CMD.MOVE_STATE, { 2 }, {} ) + return true +end -function ShardSpringUnit:GetPosition() +function ShardUnit:GetPosition() local bpx, bpy, bpz = Spring.GetUnitPosition(self.id) if not bpx then Spring.Echo(self:Name(), self.id, "nil position") @@ -174,34 +347,49 @@ function ShardSpringUnit:GetPosition() end -function ShardSpringUnit:GetHealth() +function ShardUnit:GetHealth() local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) return health end -function ShardSpringUnit:GetMaxHealth() +function ShardUnit:GetMaxHealth() local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) return maxHealth end +function ShardUnit:ParalysisDamage() + local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) + return paralyzeDamage +end + +function ShardUnit:CaptureProgress() + local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) + return captureProgress +end + +function ShardUnit:BuildProgress() + local health, maxHealth, paralyzeDamage, captureProgress, buildProgress = Spring.GetUnitHealth( self.id ) + return buildProgress +end + -function ShardSpringUnit:WeaponCount() +function ShardUnit:WeaponCount() return self:Type():WeaponCount() end -function ShardSpringUnit:MaxWeaponsRange() +function ShardUnit:MaxWeaponsRange() return Spring.GetUnitMaxRange(self.id) end -function ShardSpringUnit:CanBuild( type ) +function ShardUnit:CanBuild( type ) return self:Type():CanBuild(type) end -function ShardSpringUnit:GetResourceUsage( idx ) +function ShardUnit:GetResourceUsage( idx ) local metalMake, metalUse, energyMake, energyUse = Spring.GetUnitResources(self.id) local SResourceTransfer = { gameframe = Spring.GameFrame(), rate = 1 } if Shard.resourceIds[idx] == "metal" then @@ -215,7 +403,7 @@ function ShardSpringUnit:GetResourceUsage( idx ) end -function ShardSpringUnit:ExecuteCustomCommand( cmdId, params_list, options, timeOut ) +function ShardUnit:ExecuteCustomCommand( cmdId, params_list, options, timeOut ) params_list = params_list or {} options = options or {} if params_list and params_list.push_back then @@ -225,6 +413,19 @@ function ShardSpringUnit:ExecuteCustomCommand( cmdId, params_list, options, tim Spring.GiveOrderToUnit(self.id, cmdId, params_list, options) return 0 end + +function ShardUnit:DrawHighlight( color, label, channel ) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawAddUnit', self.id, color[1], color[2], color[3], color[4], label, ai.game:GetTeamID(), channel) +end + +function ShardUnit:EraseHighlight( color, label, channel ) + channel = channel or 1 + color = color or {} + SendToUnsynced('ShardDrawEraseUnit', self.id, color[1], color[2], color[3], color[4], label, ai.game:GetTeamID(), channel) +end + --[[ IUnit/ engine unit objects int ID() @@ -280,4 +481,4 @@ IUnit/ engine unit objects SResourceTransfer GetResourceUsage(int idx) void ExecuteCustomCommand(int cmdId, std::vector params_list, short options = 0, int timeOut = INT_MAX) ---]] \ No newline at end of file +--]] diff --git a/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua b/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua index d5cd02402..5421ccdbe 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua @@ -1,33 +1,60 @@ -ShardSpringUnitType = class(function(a) - -- +ShardUnitType = class(function(a, id) + a.id = id + a.def = UnitDefs[id] end) +function ShardUnitType:ID() + return self.id +end -function ShardSpringUnitType:Init( id ) - self.id = id - self.def = UnitDefs[id] +function ShardUnitType:Name() + return self.def.name end -function ShardSpringUnitType:ID() - return self.id +function ShardUnitType:HumanName() + return self.def.humanName end -function ShardSpringUnitType:Name() - return self.def.name +function ShardUnitType:Description() + return self.def.tooltip +end + +function ShardUnitType:Source() + return self.def +end + +function ShardUnitType:IsBuilder() + return self.def.isBuilder end -function ShardSpringUnitType:CanMove() +function ShardUnitType:BuildRange() + return self.def.buildDistance +end + +function ShardUnitType:CanMove() return self.def.canMove end -function ShardSpringUnitType:CanDeploy() +function ShardUnitType:CanDeploy() + -- what does deploy mean for Spring? + return false +end + +function ShardUnitType:CanMorph() -- what does deploy mean for Spring? return false end -function ShardSpringUnitType:CanBuild(type) - if not type then return self.def.isBuilder end +function ShardUnitType:IsFactory() + -- what does deploy mean for Spring? + return self.def.isFactory +end + +function ShardUnitType:CanBuild(type) + if not type then + return self.def.buildOptions and #self.def.buildOptions > 0 + end -- Spring.Echo(self.def.name, "can build?", type, type:Name()) if not self.canBuildType then self.canBuildType = {} @@ -39,11 +66,231 @@ function ShardSpringUnitType:CanBuild(type) return self.canBuildType[type:ID()] end -function ShardSpringUnitType:WeaponCount() +function ShardUnitType:WeaponCount() return #self.def.weapons -- test this. not sure the weapons table will give its length by the # operator end -function ShardSpringUnitType:Extractor() - --return self.def.extractsMetal > 0 - return self.def.customParams.metal_extractor -end \ No newline at end of file +function ShardUnitType:Extractor() + if self.def.name == "xmetalextractor" or self.def.name == "xmetalextractormoho" or string.find(self.def.name, "zmex") then + return true + elseif self.def.customParams.metal_extractor then + return true + end +end + +function ShardUnitType:Geothermal() + return self.def.needGeo +end + +function ShardUnitType:ExtractorEfficiency() + return self.def.extractsMetal +end + + +function ShardUnitType:CanAttack() + return self.def.canAttack +end + +function ShardUnitType:CanCloak() + return self.def.canCloak +end + +function ShardUnitType:CanAttackMove() + return self:CanFight() +end + +function ShardUnitType:CanFight() + return self.def.canFight +end + +function ShardUnitType:CanPatrol() + return self.def.canPatrol +end + +function ShardUnitType:CanGuard() + return self.def.canGuard +end + +function ShardUnitType:CanCloak() + return self.def.canCloak +end + +function ShardUnitType:CanSelfDestruct() + return self.def.canSelfDestruct +end + +function ShardUnitType:CanCloak() + return self.def.canCloak +end + +function ShardUnitType:CanRestore() + return self.def.canRestore +end + +function ShardUnitType:CanRepair() + return self.def.canCloak +end + +function ShardUnitType:CanReclaim() + return self.def.canReclaim +end + +function ShardUnitType:CanResurrect() + return self.def.canResurrect +end + +function ShardUnitType:CanCapture() + return self.def.canCloak +end + +function ShardUnitType:CanAssist() + return self.def.canAssist +end + +function ShardUnitType:CanBeAssisted() + return self.def.canBeAssisted +end + +function ShardUnitType:CanSelfRepair() + return self.def.canSelfRepair +end + +function ShardUnitType:IsAirbase() + return self.def.isAirbase +end + +function ShardUnitType:CanHover() + return self.def.canHover +end + +function ShardUnitType:CanFly() + return self.def.canFly +end + +function ShardUnitType:CanSubmerge() + return self.def.canSubmerge +end + +function ShardUnitType:CanBeTransported() + return not self.def.cantBeTransported +end + +function ShardUnitType:CanKamikaze() + return self.def.canKamikaze +end + +function ShardUnitType:OnOffable() + return self.def.onOffable +end + +function ShardUnitType:HasStealth() + return self.def.stealth +end + +function ShardUnitType:HasSonarStealth() + return self.def.sonarStealth +end + +function ShardUnitType:LosRadius() + return self.def.losRadius +end + +function ShardUnitType:RadarRadius() + return self.def.radarRadius +end + +function ShardUnitType:SonarRadius() + return self.def.sonarDistance +end + +function ShardUnitType:SeismicRadius() + return self.def.seismicRadius +end + +function ShardUnitType:CanManualFire() + return self.def.canManualFire +end + +function ShardUnitType:isFeatureOnBuilt() + return self.def.isFeature +end + +function ShardUnitType:TargetingPriority() + return self.def.power -- buildCostMetal + (buildCostEnergy / 60.0) in spring engine +end + +function ShardUnitType:BuildOptionsByName() + return self.def.buildOptions +end + +function ShardUnitType:Repairable() + return self.def.repairable +end + +function ShardUnitType:Capturable() + return self.def.capturable +end + +function ShardUnitType:ReclaimSpeed() + return self.def.reclaimSpeed +end + +function ShardUnitType:RepairSpeed() + return self.def.repairSpeed +end + +function ShardUnitType:MaxRepairSpeed() + return self.def.maxRepairSpeed +end + +function ShardUnitType:ResurrectSpeed() + return self.def.resurrectSpeed +end + +function ShardUnitType:CaptureSpeed() + return self.def.captureSpeed +end + +function ShardUnitType:TerraformSpeed() + return self.def.terraformSpeed +end + +function ShardUnitType:FootprintX() + return self.def.footprintX +end + +function ShardUnitType:FootprintZ() + return self.def.footprintZ +end + +function ShardUnitType:maxVelocity() + return self.def.speed +end + +function ShardUnitType:MaxAcceleration() + return self.def.maxAcc +end + +function ShardUnitType:MaxDeceleration() + return self.def.maxDec +end + +function ShardUnitType:BuildSpeed() + return self.def.buildSpeed -- Time to build = (buildTime / buildspeed) * 32 +end + +function ShardUnitType:BuildTime() + return self.def.buildTime -- Time to build = (buildTime / buildspeed) * 32 +end + +function ShardUnitType:BuildCostMetal() + return self.def.buildCostMetal +end + +function ShardUnitType:BuildCostEnergy() + return self.def.buildCostEnergy +end + +function ShardUnitType:Health() + return self.def.health +end diff --git a/LuaRules/Gadgets/ai/sleep.lua b/LuaRules/Gadgets/ai/sleep.lua index e2cafbed9..890542a70 100644 --- a/LuaRules/Gadgets/ai/sleep.lua +++ b/LuaRules/Gadgets/ai/sleep.lua @@ -51,7 +51,7 @@ end -- there may be minor delays of several frames function Sleep:Wait(functor, frames) if functor == nil then - game:SendToConsole("error: functor == nil in Sleep:Wait ") + self.game:SendToConsole("error: functor == nil in Sleep:Wait ") else local sleeper = self:GetSleeper(functor) sleeper.frames = frames @@ -60,7 +60,7 @@ end function Sleep:Wakeup(sleeper) if sleeper == nil then - game:SendToConsole("key == nil in Sleep:Wakeup()") + self.game:SendToConsole("key == nil in Sleep:Wakeup()") return end local key = sleeper.key @@ -68,7 +68,7 @@ function Sleep:Wakeup(sleeper) if key.wakeup ~= nil then key:wakeup() else - game:SendToConsole("key:wakeup == nil in Sleep:Wakeup") + self.game:SendToConsole("key:wakeup == nil in Sleep:Wakeup") end else key() diff --git a/LuaRules/Gadgets/ai/spothandler.lua b/LuaRules/Gadgets/ai/spothandler.lua index dcabd076c..8ece7162e 100644 --- a/LuaRules/Gadgets/ai/spothandler.lua +++ b/LuaRules/Gadgets/ai/spothandler.lua @@ -10,8 +10,7 @@ function MetalSpotHandler:internalName() end function MetalSpotHandler:Init() - --self.spots = game.map:GetMetalSpots() - self.spots = GG.metalSpots + self.spots = self.game.map:GetMetalSpots() end function distance(pos1,pos2) @@ -23,18 +22,18 @@ end function MetalSpotHandler:ClosestFreeSpot(unittype,position) local pos = nil - local bestDistance = 50000 + local bestDistance = 10000 - spotCount = game.map:SpotCount() + spotCount = self.game.map:SpotCount() for i,v in ipairs(self.spots) do local p = v local dist = distance(position,p) if dist < bestDistance then - if game.map:CanBuildHere(unittype,p) then + if self.game.map:CanBuildHere(unittype,p) then bestDistance = dist pos = p end end end return pos -end \ No newline at end of file +end diff --git a/LuaRules/Gadgets/ai/taskqueuebehaviour.lua b/LuaRules/Gadgets/ai/taskqueuebehaviour.lua index 16930c9f4..44944cc3c 100644 --- a/LuaRules/Gadgets/ai/taskqueuebehaviour.lua +++ b/LuaRules/Gadgets/ai/taskqueuebehaviour.lua @@ -9,60 +9,66 @@ function TaskQueueBehaviour:Init() if self:HasQueues() then self.queue = self:GetQueue() end - + self.waiting = {} - + self:OnToNextTask() + +end + +function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then + k = '"'..k..'"' + end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end end function TaskQueueBehaviour:HasQueues() return (taskqueues[self.name] ~= nil) end -function TaskQueueBehaviour:UnitBuilt(unit) +function TaskQueueBehaviour:OwnerBuilt(unit) if not self:IsActive() then return end - if unit.engineID == self.unit.engineID then - self.progress = true - end + self:OnToNextTask() end -function TaskQueueBehaviour:UnitIdle(unit) +function TaskQueueBehaviour:OwnerIdle(unit) if not self:IsActive() then return end - if unit.engineID == self.unit.engineID then - self.progress = true - self.countdown = 0 - --self.unit:ElectBehaviour() - end + self.countdown = 0 + self:OnToNextTask() end -function TaskQueueBehaviour:UnitMoveFailed(unit) +function TaskQueueBehaviour:OwnerMoveFailed(unit) if not self:IsActive() then return end - self:UnitIdle(unit) + self:OwnerIdle(unit) end -function TaskQueueBehaviour:UnitDead(unit) - if self.unit ~= nil then - if unit.engineID == self.unit.engineID then - if self.waiting ~= nil then - for k,v in pairs(self.waiting) do - ai.modules.sleep.Kill(self.waiting[k]) - end - end - self.waiting = nil - self.unit = nil +function TaskQueueBehaviour:OwnerDead() + if self.waiting ~= nil then + for k,v in pairs(self.waiting) do + self.ai.modules.sleep.Kill(self.waiting[k]) end end + self.waiting = nil + self.unit = nil end function TaskQueueBehaviour:GetQueue() q = taskqueues[self.name] if type(q) == "function" then - --game:SendToConsole("function table found!") q = q(self) end return q @@ -70,15 +76,12 @@ end function TaskQueueBehaviour:Update() if not self:IsActive() then + self:DebugPoint("nothing") return end - local f = game:Frame() - local s = self.countdown + local f = self.game:Frame() if self.progress == true then - --if math.mod(f,3) == 0 then - if (ai.tqblastframe ~= f) or (ai.tqblastframe == nil) or (self.countdown == 15) then - self.countdown = 0 - ai.tqblastframe = f + if self.countdown > 14 then self:ProgressQueue() else if self.countdown == nil then @@ -89,82 +92,206 @@ function TaskQueueBehaviour:Update() end end end + TaskQueueWakeup = class(function(a,tqb) a.tqb = tqb end) function TaskQueueWakeup:wakeup() - game:sendtoconsole("advancing queue from sleep1") self.tqb:ProgressQueue() end + function TaskQueueBehaviour:ProgressQueue() - self.progress = false - if self.queue ~= nil then - local idx, val = next(self.queue,self.idx) - self.idx = idx - if idx == nil then - self.queue = self:GetQueue(name) - self.progress = true - return - end - - local utype = nil - local value = val - if type(val) == "table" then - local action = value.action - if action == "wait" then - t = TaskQueueWakeup(self) - tqb = self - ai.sleep:Wait({ wakeup = function() tqb:ProgressQueue() end, },value.frames) - return - elseif action == "move" then - self.unit:Internal():Move(value.position) - self.progress = false - elseif action == "moverelative" then - local upos = self.unit:Internal():GetPosition() - local newpos = api.Position() - newpos.x = upos.x + value.position.x - newpos.y = upos.y + value.position.y - newpos.z = upos.z + value.position.z - self.unit:Internal():Move(newpos) - self.progress = false - end + unit = self.unit:Internal() + if self:IsWaitingForPosition() then + self:DebugPoint("waiting") + return + end + if self.queue == nil then + if self:HasQueues() then + self.queue = self:GetQueue() else - if type(val) == "function" then - value = val(self) - end - if utype ~= "next" then - utype = game:GetTypeByName(value) - if utype ~= nil then - unit = self.unit:Internal() - if unit:CanBuild(utype) then - if utype:Extractor() then - -- find a free spot! - - p = unit:GetPosition() - p = ai.metalspothandler:ClosestFreeSpot(utype,p) - if p ~= nil then - success = self.unit:Internal():Build(utype,p) - self.progress = not success - else - self.progress = true - end - else - p = self.map:FindClosestBuildSite(utype, unit:GetPosition()) - self.progress = not self.unit:Internal():Build(utype,p) - end - else - self.progress = true - end - else - --throws an error, commenting out until i figure out what's wrong-- - --game:SendToConsole("Cannot build:"..value..", couldnt grab the unit type from the engine") - self.progress = true - end - else - self.progress = true - end + self:DebugPoint("nothing") + return end end + self.countdown = 0 + self.progress = false + + if self.queue == nil then + self.game:SendToConsole("Warning: A "..self.name.." unit, has an empty task queue") + self:OnToNextTask() + self:DebugPoint("nothing") + return + end + local idx, val = next(self.queue,self.idx) + self.idx = idx + if idx == nil then + self:DebugPoint("nothing") + self.queue = self:GetQueue(name) + self:OnToNextTask() + return + end + + local utype = nil + local value = val + if type(val) == "function" then + value = val(self, self.ai, unit) + end + if value == "next" then + self:DebugPoint("nothing") + self:OnToNextTask() + return + end + if type(val) == "table" then + self:HandleActionTask( value ) + return + end + + success = self:TryToBuild( value ) + if success ~= true then + self:DebugPoint("nothing") + self:OnToNextTask() + return + end +end + +function TaskQueueBehaviour:TryToBuild( unit_name ) + utype = self.game:GetTypeByName(unit_name) + if not utype then + self.game:SendToConsole("Cannot build:"..unit_name..", could not grab the unit type from the engine") + return false + end + if unit:CanBuild(utype) ~= true then + return false + end + local success = false + if utype:Extractor() then + success = self:BuildExtractor(utype) + elseif utype:Geothermal() then + success = self:BuildGeothermal(utype) + elseif unit:Type():IsFactory() then + success = self.unit:Internal():Build(utype) + else + success = self:BuildOnMap(utype) + end + return success +end + +function TaskQueueBehaviour:HandleActionTask( task ) + local action = task.action + if action == "wait" then + t = TaskQueueWakeup(self) + tqb = self + self.ai.sleep:Wait({ wakeup = function() tqb:ProgressQueue() end, },task.frames) + elseif action == "move" then + self.unit:Internal():Move(task.position) + elseif action == "moverelative" then + local upos = unit:GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():Move(newpos) + elseif action == "fight" then + self.unit:Internal():MoveAndFire(task.position) + elseif action == "fightrelative" then + local upos = self.unit:Internal():GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():MoveAndFire(newpos) + elseif action == "patrol" then + self.unit:Internal():MoveAndPatrol(task.position) + elseif action == "patrolrelative" then + local upos = self.unit:Internal():GetPosition() + local newpos = api.Position() + newpos.x = upos.x + task.position.x + newpos.y = upos.y + task.position.y + newpos.z = upos.z + task.position.z + self.unit:Internal():MoveAndPatrol(newpos) + else + self.game:SendToConsole("Error: Unknown action task "..value.." given to a "..self.name) + self:DebugPoint("nothing") + self:OnToNextTask() + end +end + +function onsuccess( job, pos ) + job.tqb:OnBuildingPlacementSuccess( job, pos ) +end + +function onfail( job ) + job.tqb:OnBuildingPlacementFailure( job ) +end + +function TaskQueueBehaviour:IsWaitingForPosition() + return self.placementInProgress +end + + +function TaskQueueBehaviour:BeginWaitingForPosition() + self.placementInProgress = true +end + +function TaskQueueBehaviour:StopWaitingForPosition() + self.placementInProgress = false +end + +function TaskQueueBehaviour:BuildOnMap(utype) + --p = self.map:FindClosestBuildSite(utype, unit:GetPosition()) + --self.progress = not self.unit:Internal():Build(utype,p) + unit = self.unit:Internal() + + local job = { + start_position=unit:GetPosition(), + max_radius=1500, + onSuccess=onsuccess, + onFail=onfail, + unittype=utype, + cleanup_on_unit_death=self.unit.engineID, + tqb=self + } + local success = self.ai.placementhandler:NewJob( job ) + if success ~= true then + self:StopWaitingForPosition() + return false + end + self:BeginWaitingForPosition() + return true +end + +function TaskQueueBehaviour:BuildExtractor(utype) + -- find a free spot! + unit = self.unit:Internal() + p = unit:GetPosition() + p = self.ai.metalspothandler:ClosestFreeSpot(utype,p) + if p == nil then + return false + end + return self.unit:Internal():Build(utype,p) +end + +function TaskQueueBehaviour:OnToNextTask() + self.progress = true +end + +function TaskQueueBehaviour:IsDoingSomething() + return ( self.progress == false ) +end + +function TaskQueueBehaviour:OnBuildingPlacementSuccess( job, pos ) + self:StopWaitingForPosition() + local p = dump( pos ) + local success self.unit:Internal():Build( job.unittype, pos ) + if success == false then + self:OnToNextTask() + end +end + +function TaskQueueBehaviour:OnBuildingPlacementFailure( job ) + self:StopWaitingForPosition() + self:OnToNextTask() end function TaskQueueBehaviour:Activate() @@ -179,3 +306,9 @@ end function TaskQueueBehaviour:Priority() return 50 end + +function TaskQueueBehaviour:DebugPoint( type ) + local unit = self.unit:Internal() + local p = unit:GetPosition() + SendToUnsynced("shard_debug_position",p.x,p.z,type) +end diff --git a/LuaRules/Gadgets/ai/taskqueues.lua b/LuaRules/Gadgets/ai/taskqueues.lua index c7ca656b4..e39bcee03 100644 --- a/LuaRules/Gadgets/ai/taskqueues.lua +++ b/LuaRules/Gadgets/ai/taskqueues.lua @@ -5,14 +5,14 @@ math.randomseed( os.time() ) math.random(); math.random(); math.random() -function CoreWindSolar() - if game:AverageWind() > 10 then +function CoreWindSolar( taskqueuebehaviour ) + if taskqueuebehaviour.ai.map:AverageWind() > 10 then return "corwind" else return "corsolar" end end -function randomLab() +function randomLab( taskqueuebehaviour ) local r = math.random(0,2) if r == 0 then return "corlab" diff --git a/LuaRules/Gadgets/ai/test.lua b/LuaRules/Gadgets/ai/test.lua new file mode 100644 index 000000000..5b1c42ade --- /dev/null +++ b/LuaRules/Gadgets/ai/test.lua @@ -0,0 +1,19 @@ +function dump(o) + if type(o) == 'table' then + local s = '{ ' + for k,v in pairs(o) do + if type(k) ~= 'number' then k = '"'..k..'"' end + s = s .. '['..k..'] = ' .. dump(v) .. ',' + end + return s .. '} ' + else + return tostring(o) + end +end +require "boot" +shard_include "ai" +ai = ShardAI() +ai:Init() +u = UnitHandler() + +u:SetAI(ai) \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/unit.lua b/LuaRules/Gadgets/ai/unit.lua index 64780f06d..a00946134 100644 --- a/LuaRules/Gadgets/ai/unit.lua +++ b/LuaRules/Gadgets/ai/unit.lua @@ -11,10 +11,9 @@ end function Unit:Init() if self.engineUnit == nil then - game:SendToConsole("nil engineUnit?!") + self.game:SendToConsole("Warning: Shard Unit:Init nil engineUnit?!") end self.behaviours = {} - self.behaviourvalues = {} end function Unit:Update() @@ -33,51 +32,80 @@ function Unit:GameEnd() end function Unit:UnitCreated(unit) + if unit.engineID == self.engineID then + return + end for k,v in pairs(self.behaviours) do v:UnitCreated(unit) end end function Unit:UnitBuilt(unit) - self:ElectBehaviour() - for k,v in pairs(self.behaviours) do - v:UnitBuilt(unit) - end + if unit.engineID == self.engineID then + self:ElectBehaviour() + for k,v in pairs(self.behaviours) do + v:OwnerBuilt() + end + else + for k,v in pairs(self.behaviours) do + v:UnitBuilt(unit) + end + end end function Unit:UnitDead(unit) - for k,v in pairs(self.behaviours) do - v:UnitDead(unit) - end + if unit.engineID == self.engineID then if self.behaviours then -- game:SendToConsole("unit died, removing behaviours", self.engineID, self:Internal():Name()) for k,v in pairs(self.behaviours) do - self.behaviours[k]:OwnerDied() + self.behaviours[k]:OwnerDead() self.behaviours[k] = nil end self.behaviours = nil end self.engineUnit = nil + else + for k,v in pairs(self.behaviours) do + v:UnitDead(unit) + end end end function Unit:UnitDamaged(unit,attacker,damage) - for k,v in pairs(self.behaviours) do - v:UnitDamaged(unit,attacker,damage) + if unit.engineID == self.engineID then + for k,v in pairs(self.behaviours) do + v:OwnerDamaged(attacker,damage) + end + else + for k,v in pairs(self.behaviours) do + v:UnitDamaged(unit,attacker,damage) + end end end function Unit:UnitIdle(unit) - for k,v in pairs(self.behaviours) do - v:UnitIdle(unit) + if unit.engineID == self.engineID then + for k,v in pairs(self.behaviours) do + v:OwnerIdle() + end + else + for k,v in pairs(self.behaviours) do + v:UnitIdle(unit) + end end end function Unit:UnitMoveFailed(unit) - for k,v in pairs(self.behaviours) do - v:UnitMoveFailed(unit) + if unit.engineID == self.engineID then + for k,v in pairs(self.behaviours) do + v:OwnerMoveFailed() + end + else + for k,v in pairs(self.behaviours) do + v:UnitMoveFailed(unit) + end end end @@ -111,9 +139,11 @@ function Unit:ElectBehaviour() if self.activebeh ~= bestbeh then if self.activebeh ~= nil then + self.activebeh:PreDeactivate() self.activebeh:Deactivate() end self.activebeh = bestbeh + self.activebeh:PreActivate() self.activebeh:Activate() end end diff --git a/LuaRules/Gadgets/ai/unithandler.lua b/LuaRules/Gadgets/ai/unithandler.lua index 1d6e97e4e..7ce3e7496 100644 --- a/LuaRules/Gadgets/ai/unithandler.lua +++ b/LuaRules/Gadgets/ai/unithandler.lua @@ -1,5 +1,21 @@ UnitHandler = class(Module) +local inactive = { + estorage = true, + emine = true, + efusion2 = true, + egeothermal = true, + eheavyturret2 = true, + ejammer2 = true, + ekmar = true, + elaserbattery = true, + elightturret2 = true, + emediumgen = true, + eradar2 = true, + eshieldgen = true, + esolar2 = true, +} + function UnitHandler:Name() return "UnitHandler" end @@ -10,19 +26,21 @@ end function UnitHandler:Init() self.units = {} - self.myUnits = {} + self.myActiveUnits = {} + self.myInactiveUnits = {} self.reallyActuallyDead = {} self.behaviourFactory = BehaviourFactory() + self.behaviourFactory:SetAI(self.ai) self.behaviourFactory:Init() end function UnitHandler:Update() - for k,v in pairs(self.myUnits) do + for k,v in pairs(self.myActiveUnits) do if ShardSpringLua then local ux, uy, uz = Spring.GetUnitPosition(v:Internal():ID()) if not ux then -- game:SendToConsole(self.ai.id, "nil unit position", v:Internal():ID(), v:Internal():Name(), k) - self.myUnits[k] = nil + self.myActiveUnits[k] = nil v = nil end end @@ -38,14 +56,14 @@ function UnitHandler:Update() end function UnitHandler:GameEnd() - for k,v in pairs(self.myUnits) do + for k,v in pairs(self.myActiveUnits) do v:GameEnd() end end function UnitHandler:UnitCreated(engineUnit) local u = self:AIRepresentation(engineUnit) - for k,v in pairs(self.myUnits) do + for k,v in pairs(self.myActiveUnits) do v:UnitCreated(u) end end @@ -53,7 +71,7 @@ end function UnitHandler:UnitBuilt(engineUnit) local u = self:AIRepresentation(engineUnit) if u ~= nil then - for k,v in pairs(self.myUnits) do + for k,v in pairs(self.myActiveUnits) do v:UnitBuilt(u) end end @@ -62,21 +80,22 @@ end function UnitHandler:UnitDead(engineUnit) local u = self:AIRepresentation(engineUnit) if u ~= nil then - for k,v in pairs(self.myUnits) do + for k,v in pairs(self.myActiveUnits) do v:UnitDead(u) end end -- game:SendToConsole(self.ai.id, "removing unit from unithandler tables", engineUnit:ID(), engineUnit:Name()) self.units[engineUnit:ID()] = nil - self.myUnits[engineUnit:ID()] = nil + self.myActiveUnits[engineUnit:ID()] = nil + self.myInactiveUnits[engineUnit:ID()] = nil self.reallyActuallyDead[engineUnit:ID()] = self.game:Frame() end -function UnitHandler:UnitDamaged(engineUnit,attacker,damage) +function UnitHandler:UnitDamaged(engineUnit,engineAttacker,damage) local u = self:AIRepresentation(engineUnit) - --local a -- = self:AIRepresentation(attacker) - for k,v in pairs(self.myUnits) do - v:UnitDamaged(u,a,damage) + -- local a = self:AIRepresentation(engineAttacker) + for k,v in pairs(self.myActiveUnits) do + v:UnitDamaged(u,engineAttacker,damage) end end @@ -85,27 +104,32 @@ function UnitHandler:AIRepresentation(engineUnit) return nil end if self.reallyActuallyDead[engineUnit:ID()] then - -- game:SendToConsole(self.ai.id, "unit already died, not representing unit", engineUnit:ID(), engineUnit:Name()) + -- self.game:SendToConsole(self.ai.id, "unit already died, not representing unit", engineUnit:ID(), engineUnit:Name()) return nil end local ux, uy, uz = engineUnit:GetPosition() if not ux then - -- game:SendToConsole(self.ai.id, "nil engineUnit position, not representing unit", engineUnit:ID(), engineUnit:Name()) + -- self.game:SendToConsole(self.ai.id, "nil engineUnit position, not representing unit", engineUnit:ID(), engineUnit:Name()) return nil end local unittable = self.units local u = unittable[engineUnit:ID()] if u == nil then - -- game:SendToConsole(self.ai.id, "adding unit to unithandler tables", engineUnit:ID(), engineUnit:Name()) + -- self.game:SendToConsole(self.ai.id, "adding unit to unithandler tables", engineUnit:ID(), engineUnit:Name()) u = Unit() + u:SetAI( self.ai ) self.units[engineUnit:ID()] = u u:SetEngineRepresentation(engineUnit) u:Init() if engineUnit:Team() == self.game:GetTeamID() then - -- game:SendToConsole(self.ai.id, "giving my unit behaviours", engineUnit:ID(), engineUnit:Name()) - self.behaviourFactory:AddBehaviours(u, self.ai) - self.myUnits[engineUnit:ID()] = u + if inactive[engineUnit:Name()] then + self.myInactiveUnits[engineUnit:ID()] = u + else + -- game:SendToConsole(self.ai.id, "giving my unit behaviours", engineUnit:ID(), engineUnit:Name()) + self.behaviourFactory:AddBehaviours(u) + self.myActiveUnits[engineUnit:ID()] = u + end end end return u diff --git a/LuaRules/Gadgets/ai_helpers.lua b/LuaRules/Gadgets/ai_helpers.lua new file mode 100644 index 000000000..0a3c38f7c --- /dev/null +++ b/LuaRules/Gadgets/ai_helpers.lua @@ -0,0 +1,468 @@ +function gadget:GetInfo() + return { + name = "Ai Helpers", + desc = "Used for AI scripts", + author = "Doo", + date = "August 2018", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } +end + +if gadgetHandler:IsSyncedCode() then + +GG.AiHelpers = {} + +-------------------------------- +-- NewPlacementHandler Helper -- +-------------------------------- +GG.AiHelpers.NewPlacementHandler = {} + +GG.AiHelpers.Start = function() + enabled = true + gadget:Initialize() +end + +local mapwidth = math.max(Game.mapSizeX, Game.mapSizeZ) +local celltoscan = celltoscan or {} +local defidpersizetype = defidpersizetype or {} +local cells = cells or {} + +GG.AiHelpers.NewPlacementHandler.GetPosFromID = function(id) + local z = id%mapwidth + local x = (id - z)/mapwidth + return {x = x, z = z} +end + +GG.AiHelpers.NewPlacementHandler.GetIDFromPos = function(x, z, cellsize) + return (x - x%cellsize) * mapwidth + (z - z%cellsize) +end + +GG.AiHelpers.NewPlacementHandler.GetIDBuildable = function(id, cellsize, buildtype) + if cellsize == 112 then cellsize = 128 end + return cells[cellsize][buildtype][id] +end + +GG.AiHelpers.NewPlacementHandler.ClosePosition = function(x,z, cellsize,spacing) + local id1 = GG.AiHelpers.NewPlacementHandler.GetIDFromPos(x,z,cellsize) + local pos = GG.AiHelpers.NewPlacementHandler.GetPosFromID(id1) + local x, z = pos.x, pos.z + for v = x-spacing, x+spacing+cellsize-1, 8 do + for h = z-spacing, z+spacing+cellsize-1, 8 do + for size, cell in pairs(cells) do + local id = GG.AiHelpers.NewPlacementHandler.GetIDFromPos(v,h,size) + gadget:SetCellValue(id, size, "ground", false) + end + end + end +end + +GG.AiHelpers.NewPlacementHandler.FreePosition = function(x,z,cellsize,spacing) + local id1 = GG.AiHelpers.NewPlacementHandler.GetIDFromPos(x,z,cellsize) + local pos = GG.AiHelpers.NewPlacementHandler.GetPosFromID(id1) + local x, z = pos.x, pos.z + for v = x - spacing, x + spacing + cellsize-1, 8 do + for h = z - spacing, z + spacing + cellsize - 1 ,8 do + gadget:ScanCell(GG.AiHelpers.NewPlacementHandler.GetIDFromPos(x,z,8)) + end + end +end + +---------------------------- +--Retreat Positions Helper-- +---------------------------- +GG.AiHelpers.NanoTC = {} +local isNanoTC = {} +local NanoTC = {} +local ClosestNanoTC = {} + +for unitDefID, defs in pairs(UnitDefs) do + if string.find(defs.name, "ecommander") or string.find(defs.name, "zarm") then + isNanoTC[unitDefID] = true + end +end + +GG.AiHelpers.NanoTC.GetClosestNanoTC = function (unitID) + local bestx, besty, bestz + local teamID = Spring.GetUnitTeam(unitID) + local ux, uy, uz = Spring.GetUnitPosition(unitID) + local bestID + local mindis = math.huge + local x, y, z = math.floor(ux/256), math.floor(uy/256), math.floor(uz/256) + if ClosestNanoTC and ClosestNanoTC[teamID] and ClosestNanoTC[teamID][x] and ClosestNanoTC[teamID][x][z] and Spring.ValidUnitID(ClosestNanoTC[teamID][x][z]) then + bestID = ClosestNanoTC[teamID][x][z] + elseif NanoTC and NanoTC[teamID] then + for uid, pos in pairs (NanoTC[teamID]) do + local gx, gy, gz = pos[1], pos[2], pos[3] + local dis = gadget:Distance(ux, uz, gx, gz) + if dis< mindis then + mindis = dis + bestID = uid + if not ClosestNanoTC then ClosestNanoTC = {} end + if not ClosestNanoTC[teamID] then ClosestNanoTC[teamID] = {} end + if not ClosestNanoTC[teamID][x] then ClosestNanoTC[teamID][x] = {} end + ClosestNanoTC[teamID][x][z] = uid + end + end + end + if bestID then + bestx, besty, bestz = Spring.GetUnitPosition(bestID) + end + return bestx, besty, bestz +end +------------- +--Unit Info-- +------------- + +GG.AiHelpers.UnitInfo = {} +local info = {} + +GG.AiHelpers.UnitInfo = function(teamID, unitDefID) + return info[teamID] and info[teamID][unitDefID] or nil +end + +-------------------------- +--Unit Visibility Checks-- +-------------------------- +GG.AiHelpers.VisibilityCheck = {} +local SeenBuildings = {} + +GG.AiHelpers.VisibilityCheck.IsUnitVisible = function(unitID, teamID) + local _,_,_,_,_,allyTeamID = Spring.GetTeamInfo(teamID) + if SeenBuildings[teamID] and SeenBuildings[teamID][unitID] then + return true + elseif Spring.IsUnitInLos(unitID, allyTeamID) or Spring.IsUnitInRadar(unitID, allyTeamID) then + return true + end + return false +end + +----------------------- +--Targets Of Interest-- +----------------------- + +local Interest = { + ecommander = true, + ecommanderbattle = true, + ecommanderbuild = true, + ecommandercloak = true, + ecommanderfactory = true, + ecommandermeteor = true, + ecommandershield = true, + ecommanderhealerai = true, + ecommanderbattleai = true, + ecommanderbuildai = true, + ecommandercloakai = true, + ecommanderfactoryai = true, + ecommandermeteorai = true, + ecommandershieldai = true, + eairplant = true, + eairplant_up1 = true, + eairplant_up2 = true, + eairplant_up3 = true, + eminifac = true, + eminifac_up1 = true, + eminifac_up2 = true, + eminifac_up3 = true, + eamphibfac = true, + eamphibfac_up1 = true, + eamphibfac_up2 = true, + eamphibfac_up3 = true, + ehbotfac = true, + ehbotfac_up1 = true, + ehbotfac_up2 = true, + ehbotfac_up3 = true, + efusion2 = true, + esilo = true, + etech1 = true, + etech2 = true, + etech3 = true, + eartyturret = true, + eartyturret_up1 = true, + eartyturret_up2 = true, + eartyturret_up3 = true, + ekmar = true, + zarm = true, +} + +GG.AiHelpers.TargetsOfInterest = {} +local TargetsOfInterest = {} +local function IsAntiNukeCovered(unitID, attackerTeamID) + local x,y,z = Spring.GetUnitPosition(unitID) + if not x and z then + TargetsOfInterest[attackerTeamID][unitID] = nil + return true + end + local unitsNear = Spring.GetUnitsInCylinder(x,z,2000) + for ct, id in pairs(unitsNear) do + if (UnitDefs[Spring.GetUnitDefID(id)].name == "eshieldgen") and (not Spring.AreTeamsAllied(Spring.GetUnitTeam(id), attackerTeamID)) then + if SeenBuildings[attackerTeamID][unitID] then + return true + end + end + end + return false +end + +local function IsInAttackRange(unitID, attackerID) + local weapons = UnitDefs[Spring.GetUnitDefID(attackerID)].weapons + local x, y, z = Spring.GetUnitPosition(unitID) + for i,_ in pairs(weapons) do + if (Spring.GetUnitWeaponTestTarget(attackerID, i, x, y, z) and Spring.GetUnitWeaponTestRange(attackerID, i, x, y, z) and Spring.GetUnitWeaponHaveFreeLineOfFire(attackerID, i, x, y, z)) then + return true + end + end + return false +end + + +GG.AiHelpers.TargetsOfInterest.BombingRun = function(teamID) + if not TargetsOfInterest[teamID] then return end + local target + for unitID, isTarget in pairs(TargetsOfInterest[teamID]) do + target = unitID + break + end + if target then + return target + else + return nil + end +end + +GG.AiHelpers.TargetsOfInterest.Nuke = function(teamID) + if not TargetsOfInterest[teamID] then return end + local target + for unitID, isTarget in pairs(TargetsOfInterest[teamID]) do + if (not IsAntiNukeCovered(unitID, teamID)) then + target = unitID + break + end + end + if target then + return target + else + for unitID, isTarget in pairs(TargetsOfInterest[teamID]) do + if math.random(1,30) == 1 then + target = unitID + break + end + end + end + if target then + return target + else + return nil + end +end + +GG.AiHelpers.TargetsOfInterest.LongRangeWeapon = function(attackerID, teamID) + if not TargetsOfInterest[teamID] then return end + local target + local targetpos + local ct = 0 + for unitID, isTarget in pairs(TargetsOfInterest[teamID]) do + if (IsInAttackRange(unitID, attackerID)) then + target = unitID + break + end + end + if target then + return target + else + return nil + end +end + +GG.AiHelpers.TargetsOfInterest.GetTarget = function(teamID) + if not TargetsOfInterest[teamID] then return end + local target + local targetpos + local ct = 0 + for unitID, isTarget in pairs(TargetsOfInterest[teamID]) do + if math.random(1,20) == 1 then + target = unitID + break + end + end + if target then + local x, y, z = Spring.GetUnitPosition(target) + targetpos = {x = x, y = y, z = z} + end + return targetpos +end + + + +------------------------- +--Gadget Core Functions-- +------------------------- + + function gadget:Distance(x1,z1, x2,z2) + local vectx = x2 - x1 + local vectz = z2 - z1 + local dis = math.sqrt(vectx^2+vectz^2) + return dis + end + + function gadget:Initialize() + if enabled ~= true then return end + for unitDefID, defs in pairs(UnitDefs) do + if defs.isBuilding or string.find(defs.name, "eorb") then + local cellsize = math.max(defs.xsize, defs.zsize) * 8 + local buildtype = (defs.maxWaterDepth >= 0) and "ground" or "water" + if not cells[cellsize] then + cells[cellsize] = {} + defidpersizetype[cellsize] = {} + end + if not cells[cellsize][buildtype] then + defidpersizetype[cellsize][buildtype] = unitDefID + cells[cellsize][buildtype] = {} + for x = 0, Game.mapSizeX-1, cellsize do + for z = 0, Game.mapSizeZ-1, cellsize do + gadget:SetCellValue(GG.AiHelpers.NewPlacementHandler.GetIDFromPos(x, z, cellsize), cellsize, buildtype, (Spring.TestBuildOrder(unitDefID, x + cellsize/2, Spring.GetGroundHeight(x + cellsize/2, z+cellsize/2), z+cellsize/2, "s") >= 1 and Spring.TestBuildOrder(unitDefID, x + cellsize/2, Spring.GetGroundHeight(x + cellsize/2, z+cellsize/2), z+cellsize/2, "e") >= 1)) + end + end + end + end + end + + for ct, unitID in pairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + local unitTeam = Spring.GetUnitTeam(unitID) + gadget:UnitFinished(unitID, unitDefID, unitTeam) + end + end + + function gadget:UnitCreated(unitID, unitDefID, teamID, builderID) + if enabled ~= true then return end + info[teamID] = info[teamID] or {} + info[teamID][unitDefID] = info[teamID][unitDefID] or {killed_cost=0,n=0, avgkilled_cost=0} + info[teamID][unitDefID].n = info[teamID][unitDefID].n + 1 + if info[teamID][unitDefID].n > 80 then + info[teamID][unitDefID].n = info[teamID][unitDefID].n - 1 + info[teamID][unitDefID].killed_cost = info[teamID][unitDefID].killed_cost - info[teamID][unitDefID].avgkilled_cost + if info[teamID][unitDefID].killed_cost <= 0 then info[teamID][unitDefID].killed_cost = 0 end + info[teamID][unitDefID].avgkilled_cost = info[teamID][unitDefID].killed_cost / info[teamID][unitDefID].n + end + end + + function gadget:UnitEnteredRadar(unitID, unitTeam, allyTeam, unitDefID) + if enabled ~= true then return end + local defs = UnitDefs[unitDefID] + if defs.isBuilding or string.find(defs.name, "eorb") then + for ct, id in pairs (Spring.GetTeamList(allyTeam)) do + if Interest[defs.name] == true and (not Spring.AreTeamsAllied(id, allyTeam)) then + TargetsOfInterest[id] = TargetsOfInterest[id] or {} + TargetsOfInterest[id][unitID] = true + end + SeenBuildings[id] = SeenBuildings[id] or {} + SeenBuildings[id][unitID] = true + end + end + end + + function gadget:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID) + if enabled ~= true then return end + local defs = UnitDefs[unitDefID] + if defs.isBuilding or string.find(defs.name, "eorb") then + for ct, id in pairs (Spring.GetTeamList(allyTeam)) do + if Interest[defs.name] == true and (not Spring.AreTeamsAllied(id, unitTeam)) then + TargetsOfInterest[id] = TargetsOfInterest[id] or {} + TargetsOfInterest[id][unitID] = true + end + SeenBuildings[id] = SeenBuildings[id] or {} + SeenBuildings[id][unitID] = true + end + end + end + + function gadget:UnitFinished(unitID, unitDefID, unitTeam) + if enabled ~= true then return end + if isNanoTC[unitDefID] then + if not NanoTC[unitTeam] then NanoTC[unitTeam] = {} end + NanoTC[unitTeam][unitID] = {Spring.GetUnitPosition(unitID)} + gadget:UpdateClosestNanoTCTable(unitTeam) + end + end + + function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam) + if enabled ~= true then return end + if not attackerDefID then return end + if not unitDefID then return end + if not info[attackerTeam] then return end + if not info[attackerTeam][attackerDefID] then return end + if not info[unitTeam] then return end + if not info[unitTeam][unitDefID] then return end + if Spring.AreTeamsAllied(unitTeam,attackerTeam) then return end + local h,maxh,_ = Spring.GetUnitHealth(unitID) + damage = math.min(h,damage) + if paralyzer then damage = damage * 0.2 end + if attackerDefID and attackerTeam then + local count = Spring.GetTeamUnitDefCount(attackerTeam, attackerDefID) + if count > 0 then + ratio2 = 30/count + else + ratio2 = 30 + end + end + local ratio = damage/maxh + local killed_m = UnitDefs[unitDefID].metalCost * ratio + local killed_e = UnitDefs[unitDefID].energyCost * ratio + info[attackerTeam][attackerDefID].killed_cost = info[attackerTeam][attackerDefID].killed_cost + killed_m + killed_e/60 + info[attackerTeam][attackerDefID].avgkilled_cost = info[attackerTeam][attackerDefID].killed_cost / info[attackerTeam][attackerDefID].n + end + + function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + if enabled ~= true then return end + if not NanoTC[unitTeam] then NanoTC[unitTeam] = {} end + NanoTC[unitTeam][unitID] = nil + gadget:UpdateClosestNanoTCTable(unitTeam) + for ct, id in pairs(Spring.GetTeamList()) do + if SeenBuildings[id] then + SeenBuildings[id][unitID] = nil + end + if TargetsOfInterest[id] then + TargetsOfInterest[id][unitID] = nil + end + end + end + + function gadget:UnitTaken(unitID, unitDefID, oldTeam, newTeam) + if enabled ~= true then return end + gadget:UnitDestroyed(unitID, unitDefID, oldTeam) + gadget:UnitFinished(unitID, unitDefID, newTeam) + end + + + function gadget:GameFrame(f) + if enabled ~= true then return end + for id, cell in pairs(celltoscan) do + if f%300 == id%300 then + for size, metatable in pairs(defidpersizetype) do + local pos = GG.AiHelpers.NewPlacementHandler.GetPosFromID(id) + for buildtype, unitDefID in pairs(metatable) do + gadget:SetCellValue(GG.AiHelpers.NewPlacementHandler.GetIDFromPos(pos.x, pos.z, size), size, buildtype,(Spring.TestBuildOrder(unitDefID, pos.x + size/2, Spring.GetGroundHeight(pos.x + size/2, pos.z+size/2), pos.z+size/2, "s") >= 1 and Spring.TestBuildOrder(unitDefID, pos.x + size/2, Spring.GetGroundHeight(pos.x + size/2, pos.z+size/2), pos.z+size/2, "e") >= 1)) + celltoscan[id] = nil + end + end + end + end + end + + function gadget:SetCellValue(id, size, buildtype, value) + cells[size][buildtype][id] = value + end + + function gadget:ScanCell(id) + celltoscan[id] = true + end + + function gadget:UpdateClosestNanoTCTable(teamID) + if teamID then + ClosestNanoTC[teamID] = nil + end + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai_namer.lua b/LuaRules/Gadgets/ai_namer.lua new file mode 100644 index 000000000..ae7d6dd96 --- /dev/null +++ b/LuaRules/Gadgets/ai_namer.lua @@ -0,0 +1,399 @@ + + +function gadget:GetInfo() + return { + name = "AI namer", + desc = "Assignes names to AI teams", + author = "Floris", + date = "May 2018", + layer = 0, + enabled = true, + } +end + + +if gadgetHandler:IsSyncedCode() then + + local namelist = { +'Killertrainz', +'CRAZY POOCHES', +'Crazy Anti', +'Moon Man06Ox', +'FuckoffCupid', +'Anheuser', +'Jolly Roger', +'BelchMerchant', +'Leonidas', +'BigMacSandWitch', +'ZombiesChef', +'MasterKeef', +'Boomhauer', +'BigAssKiller', +'MustacheMopol', +'Captain Crunch', +'AncientPablo', +'Chewbacca', +'KingPopeye', +'ChubsChubs', +'PorkChopChop', +'ChumTheReaper', +'RufioRoofie', +'Rumplestiltskin', +'MexicanDjango', +'SpiderPig', +'FlandersFlannels', +'ShePoopie', +'FrodoSaggins', +'Frogger', +'GoochieGoonie', +'HilariousVader', +'ItalianGump', +'Weinerstein', +'HomerPoopson', +'WillyWizzer', +'AwesomeHobo', +'WarningLowBattery', +'Granny4theWIN', +'PookieChips', +'TheMustardCat', +'DnknDonuts', +'EdgarAllenPoo', +'PickingBoogers', +'BeanieWeenees', +'YOURnameHERE', +'MouseRatRockBand', +'TickleMeElmo', +'EatingHawaiianPizza', +'UnzippedStraw', +'VaguelyCynical', +'PervertPeewee', +'TubbyCandyHoarder', +'GotASegway', +'LookWhatICanDo', +'IPlayFarmHeroes', +'TwoandTwomakes5', +'TheBraveChicken', +'OneLoneClone', +'OneSmugPug', +'WindyGod', +'ElactixNova', +'ToxicCharger', +'SwiftSpeed', +'SwiftFox', +'MindBuggle', +'IonicHound', +'Global meltdown', +'LeSpank', +'Oceanstar11', +'Snowman', +'SinRostro', +'AfricaGalactic', +'TheDestroyer', +'MindController', +'ImagineYOU', +'SkyxQueen', +'Chadkitten', +'Stripyrex', +'TheNastyPasty', +'MurderSheWrote', +'Excalibur101', +'Jaredboom', +'Trickordie', +'Quickandsilver', +'Bangarmor', +'Need4andre', +'Jedterminator', +'Koolstack', +'Smartplatypus', +'TornadoSonic', +'VolcanicEruption', +'ApocalypseMan', +'SupraNova', +'Zombiesareback', +'GunDown', +'Bloodofraven', +'KnivesUinBack', +'Swords4aSAMURAI', +'Beastkiller', +'Naturalbornwinner', +'ChampOnTheGo', +'IamRage', +'ChaosMourn', +'RawrGuard', +'Angel123', +'CrazedMaaana', +'EraZorA', +'ManOntheJungle', +'FruzzerTrooper', +'FlominateDominion', +'MagicKen', +'FreeaakShow', +'TheIllusion', +'SniperGotYou', +'IAMTHEREAPER', +'RapidCrocs', +'Recoilboomerang0101', +'UnderMeYourDead', +'Dodger2point0', +'ChromeIsHere', +'RockYourDead', +'UnDeadAlive', +'PushingHeaven19', +'CreekSalvatore', +'IntoTheAbyss', +'Fighter0Jack', +'TheGreatAlex', +'ParanoiaSyndicate', +'TrumpOnTwos', +'WitchingHour', +'MondayGUNS', +'NinjaTrick', +'ShaolinKingFu', +'TheORacle', +'KitEnchanted', +'NoNoob', +'BeatMEdead', +'HelloCREEP', +'DieOrBye', +'Orbit1567', +'THEsun20', +'BlueTears', +'GameTruce76', +'Iamchaakra', +'BorgCollective', +'CullingCard', +'TheFinalCountdown', +'SeekNDstroy', +'Bulletz4Breakfast', +'BigDamnHero', +'LaidtoRest', +'IronMAN77', +'Xenomorphing', +'TylerDurden', +'PennywiseTheClown', +'BluntMachete', +'SniperLyfe', +'SilentWraith', +'BloodyAssault', +'FightClubAlum', +'KillSwitch', +'ExecuteElectrocute', +'BadBaneCat', +'IndominusRexxx', +'AzogtheDefiler', +'ALeperMessiah', +'ALtEREvil', +'AnimeReaper05', +'Apocalypse3434', +'ArcticBlade', +'AssassinReject', +'AtomicKnuckles', +'atomsmasher13', +'BaseKillerWolf', +'Beasthunt', +'BestGamerPeriod', +'BigBlueCheese', +'BigMastadon', +'BoooDave', +'BrooklynSpartan', +'Brownstone80', +'BulletStormSunday', +'Chuckatommy', +'ColdSystem', +'ComeSweetDeath', +'ConmanCometh', +'CosmicFunkSquad', +'CuddlyPervert', +'CunningLynguist', +'Daemonocracy', +'DeadMonkeyz', +'Devilsreject7', +'Easy R1der', +'EliteCommandoV3', +'ElitistBastard', +'EvilTrance', +'FarewellToKings', +'FearlessScorpio', +'FutureZombie', +'Hardly Danger', +'HomelessPower', +'IceColdCash', +'IllegalPete', +'SoulessImperator', +'JediAnnihilator', +'KindaHomicidal', +'KlownFaceKilla', +'kronosaurus', +'LawOfTheStreets', +'LtCommanderWorf', +'MaliciousMutant', +'ManBEarPiG1019', +'MassiveVoid', +'MortalMonkey', +'MostHaunted', +'MrVengeance81', +'Nanosoldier123', +'NeptunePirate', +'PFCbulletsponge', +'PheonixAlcander', +'PiddleMinger', +'PocketMobsters', +'ProteusZero', +'RainbowSeven', +'Reanimator', +'RecoveryShinobi', +'Red Testament', +'Savage Palooka', +'Secret System', +'SweDishMaid', +'ThePenetrator', +'TheGreatWisecow', +'TheJDM Monkey', +'TheNameless24', +'ThePhoenix1906', +'TheRealSkywolf', +'TheSwissNavy', +'Combustion', +'SerratedHeadJuicer', +'DemonDean', +'BadCastiel', +'SabertoothHook', +'UnanimousSniper', +'UnseenWarfare', +'Ninjasharkman', +'ShittinBullets89', +'TornadoArtillery', +'TheRedShadow', +'RedAllegiance', +'SLEEPING GlANT', +'SeeUInTheFuture', +'SereneSavage', +'Shadowkiller98', +'ShOcKw4vE', +'SONOFJIGSAW', +'Spawn99', +'SnappingCobra', +'SomewhatDamaged', +'SweetAngryJesus', +'Time2KillSum1', +'HellTransporter', +'LucifersVeins', +'FlameThrower', +'PoisonMarket', +'Popups4Life', +'PornoDetective', +'SavageStreak', +'Saves7heDay', +'ArtilleryHotline', +'TheDreamingVoid', +'Redviper101', +'Sarcasticfolly', +'RandomPolishGuy', +'TheGamingGod1', +'PortableRedRhinoArtillery', +'ZombiesNightOut', +'IFillCoffins', +'StinkpotForHire', +'HarmonicDeath', +'RedLiquidShrapnel', +'DesertHope', +'HurtSlinger', +'TriggermanJoe', +'ExplodingArtillery', +'DeathGiveaway', +'ExplodingSpleen', +'BrutalHopeShooter', +'OmegaFirearm', +'SilverStoneGunner', +'CaptainRedWater', +'RodOfMoses', +'SolarPhantom', +'NoBodyWho', +'WhoWasThat', +'NoEscape', +'Alpha007', +'FearMe0917', +'MasterBeast', +'CableNutx', +'PonyCloud', +'Unicorns25', +'xOGirlmania', +'GirlClubs', +'ShotHottie', +'MsPiggysRevenge', +'CutiePatootie', +'BlueberryMuffins', +'SexyShooter', +'LadyStepMurder', +'IKissedCupid', +'RomanticTorpedo', +'HottieHottieMuffins', +'PinkPristineArtillery', +'MadBabyMaker', +'PistolPrincess', +'SuperGurl3000', +'GlitterGunner', +'PurpleBunnySlippers', +'ImTheBirthdayGirl', +'SmittenKitten66', +'SniperPrincess', +'TiaraONtop', +'GunnerrGurrl', +'SevenofNine', +'CandyStripper', +'SmokinHotChick', +'BitchWhoDontMiss', +'LilianaVess', +'Forboding Angel', +'Unforboding Angel', +'notDamgam', +'YourMom', +'Boi', +'Uncommon Player', +'Random Bot 1', +'RoboDestroyer69', +'Hi', +'YouAreDead', +'Scary le Poo', +'DooDoo', +'Zoptop', +'LeaveBAAloneNoob', +'BattleRoyalePro', +'SuppyBoi', +'HungryHamster', +'Nani', +'Hello World', + } + local namelistChicken = namelist + + local takenNames = {} + local takenNamesChicken = {} + + function getName(teamID, chicken) + local aiName + if chicken then + aiName = namelistChicken[math.random(1,#namelistChicken)] + else + aiName = namelist[math.random(1,#namelist)] + end + if chicken and takenNamesChicken[aiName] == nil then + takenNamesChicken[aiName] = teamID + return aiName + elseif not chicken and takenNames[aiName] == nil then + takenNames[aiName] = teamID + return aiName + else + return getName(teamID, chicken) + end + end + + function gadget:Initialize() + local t = Spring.GetTeamList() + for _,teamID in ipairs(t) do + if select(4,Spring.GetTeamInfo(teamID)) then -- is AI? + Spring.SetGameRulesParam('ainame_'..teamID, getName(teamID, string.find(Spring.GetTeamLuaAI(teamID) or '', "Chicken:"))) + end + end + gadgetHandler:RemoveGadget(self) + end +end diff --git a/LuaRules/Gadgets/ai_resource_multiplier.lua b/LuaRules/Gadgets/ai_resource_multiplier.lua new file mode 100644 index 000000000..9bde753eb --- /dev/null +++ b/LuaRules/Gadgets/ai_resource_multiplier.lua @@ -0,0 +1,173 @@ +function gadget:GetInfo() + return { + name = "AI Resource Multiplier", -- reclaim excluded + given units excluded + filters units with insignificant production + emp'd units still included + desc = "", + author = "Floris", + date = "September 2018", + license = "GPL", + layer = 1, + enabled = false + } +end + +local timedResBonusMultiplier = 0.00020 +local timedResBonusMultiplierMax = 2 + + +if (not gadgetHandler:IsSyncedCode()) then + return -- No Unsynced +end + +local aiResourceMultiplier = tonumber(Spring.GetModOptions().ai_incomemultiplier) or 1 + +if timedResBonusMultiplier == 0 and aiResourceMultiplier == 1 then + return +end + +local aiTeams = {} +local aiCount = 0 +for _,teamID in ipairs(Spring.GetTeamList()) do + if select(4,Spring.GetTeamInfo(teamID,false)) then -- is AI? + aiCount = aiCount + 1 + aiTeams[teamID] = { energy = 0, metal = 0, winds = 0, mexes = {} } + --aiCountEResMultiplier = aiCount*0.2 + 0.8 + --aiCountMResMultiplier = aiCount*0.1 + 0.9 + end +end +if aiCount == 0 then + return +end + +local ecoUnitsDefs = {} +local energyUnitDefs = {} +local windUnitDefs = {} +local metalUnitDefs = {} +local mexUnitDefs = {} +local aiGiftedUnits = {} +local newMexes = {} + +local spGetUnitResources = Spring.GetUnitResources + +function gadget:UnitGiven(uID, uDefID, uTeam) + if aiTeams[uTeam] and ecoUnitsDefs[uDefID] then + aiGiftedUnits[uID] = true + end +end + +function gadget:UnitFinished(uID, uDefID, uTeam, builderID) + if aiTeams[uTeam] and ecoUnitsDefs[uDefID] and not aiGiftedUnits[uID] then + if windUnitDefs[uDefID] then + aiTeams[uTeam].winds = aiTeams[uTeam].winds + 1 + end + if mexUnitDefs[uDefID] then + newMexes[uID] = {Spring.GetGameFrame() + 30, uTeam} -- unfortunately mex produces nothing yet so we have to scedule it + end + if energyUnitDefs[uDefID] then + aiTeams[uTeam].energy = aiTeams[uTeam].energy + energyUnitDefs[uDefID] + end + if metalUnitDefs[uDefID] then + aiTeams[uTeam].metal = aiTeams[uTeam].metal + metalUnitDefs[uDefID] + end + end +end + +function gadget:UnitDestroyed(uID, uDefID, uTeam) + if aiTeams[uTeam] and ecoUnitsDefs[uDefID] then + if aiGiftedUnits[uID] then + aiGiftedUnits[uID] = nil + else + if newMexes[uID] then + newMexes[uID] = nil + end + if windUnitDefs[uDefID] then + aiTeams[uTeam].winds = aiTeams[uTeam].winds - 1 + end + if mexUnitDefs[uDefID] and aiTeams[uTeam].mexes[uID] then + aiTeams[uTeam].metal = aiTeams[uTeam].metal - aiTeams[uTeam].mexes[uID] + aiTeams[uTeam].mexes[uID] = nil + end + if energyUnitDefs[uDefID] then + aiTeams[uTeam].energy = aiTeams[uTeam].energy - energyUnitDefs[uDefID] + end + if metalUnitDefs[uDefID] then + aiTeams[uTeam].metal = aiTeams[uTeam].metal - metalUnitDefs[uDefID] + end + end + end +end + +function gadget:Initialize() + for uDefID,def in ipairs(UnitDefs) do + if def.energyMake >= 10 then -- filter insignificant production to save some performance + energyUnitDefs[uDefID] = def.energyMake + ecoUnitsDefs[uDefID] = true + end + if def.energyUpkeep < 0 then + energyUnitDefs[uDefID] = -def.energyUpkeep + ecoUnitsDefs[uDefID] = true + end + if def.windGenerator > 0 then + windUnitDefs[uDefID] = true + ecoUnitsDefs[uDefID] = true + end + if def.metalMake >= 0.1 then -- filter insignificant production to save some performance + metalUnitDefs[uDefID] = def.metalMake + ecoUnitsDefs[uDefID] = true + end + if def.extractsMetal > 0 then + mexUnitDefs[uDefID] = def.extractsMetal + ecoUnitsDefs[uDefID] = true + end + if ecoUnitsDefs[uDefID] then + for teamID,_ in pairs(aiTeams) do + aiTeams[teamID][uDefID] = 0 + end + end + end + if Spring.GetGameFrame() > 0 then -- in case of a luarules reload + for teamID,_ in pairs(aiTeams) do + local teamUnits = Spring.GetTeamUnitsSorted(teamID) + for uDefID, units in pairs(teamUnits) do + if type(units) == 'table' then + for _, unitID in pairs(units) do + if select(5,Spring.GetUnitHealth(unitID)) >= 1 then + gadget:UnitFinished(unitID, uDefID, teamID) + end + end + end + end + end + end +end + + +function gadget:GameFrame(n) + + if n % 30 == 1 then + + -- a just finished mex doesnt produce metal yet so we sceduled it + for uID,params in pairs(newMexes) do + if n > params[1] then + aiTeams[params[2]].mexes[uID] = select(1,spGetUnitResources(uID)) + aiTeams[params[2]].metal = aiTeams[params[2]].metal + aiTeams[params[2]].mexes[uID] + newMexes[uID] = nil + end + end + + local timedResBonus = (n / 30) * timedResBonusMultiplier + if timedResBonus > timedResBonusMultiplierMax then + timedResBonus = timedResBonusMultiplierMax + end + + local currentWind = string.format('%.1f', select(4,Spring.GetWind())) + for TeamID, aiRes in pairs(aiTeams) do + local totalEnergy = aiRes.energy + (aiRes.winds * currentWind) + local totalMetal = aiRes.metal + + --Spring.Echo(totalEnergy..' + '..((totalEnergy * (aiResourceMultiplier + timedResBonus)) - totalEnergy)) + --Spring.Echo(totalMetal..' + '..((totalMetal * (aiResourceMultiplier + timedResBonus)) - totalMetal)) + Spring.AddTeamResource(TeamID,"e", (totalEnergy * (aiResourceMultiplier + timedResBonus)) - totalEnergy) + Spring.AddTeamResource(TeamID,"m", (totalMetal * (aiResourceMultiplier + timedResBonus)) - totalMetal) + end + end +end diff --git a/LuaRules/Gadgets/ai_scav_blueprint_generator.lua b/LuaRules/Gadgets/ai_scav_blueprint_generator.lua new file mode 100644 index 000000000..cfa2cc11b --- /dev/null +++ b/LuaRules/Gadgets/ai_scav_blueprint_generator.lua @@ -0,0 +1,92 @@ +function gadget:GetInfo() + return { + name = "Scavenger Blueprint Generator", + desc = "AAA", + author = "Damgam", + date = "2020", + license = "who cares?", + layer = 0, + enabled = true, --enabled by default + } +end + +centerposx = {} +centerposz = {} +centerposy = {} +blueprintposx = 0 +blueprintposz = 0 + +if gadgetHandler:IsSyncedCode() then + -- do gadgetry here + +else + function gadget:GotChatMsg(msg, playerID) + if msg == "scavblp" then + local selectedunits = Spring.GetSelectedUnits() + GetBlueprintCenter() + Spring.Echo(" ") + Spring.Echo("Constructor Blueprint: ") + for i = 1,#selectedunits do + GenerateBlueprint1(selectedunits[i]) + --Spring.Echo("UnitID"..i..": "..selectedunits[i]) + end + Spring.Echo(" ") + Spring.Echo("Spawner Blueprint: ") + for i = 1,#selectedunits do + GenerateBlueprint2(selectedunits[i]) + --Spring.Echo("UnitID"..i..": "..selectedunits[i]) + end + Spring.Echo(" ") + Spring.Echo("Useless Echos to make sure whole thing land in infolog: ") + Spring.Echo("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + Spring.Echo("i think that's enough... Blueprint Created") + ClearValues() + end + end + + function GenerateBlueprint1(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + local unitDefName = UnitDefs[unitDefID].name + local unitIDFacing = Spring.GetUnitBuildFacing(unitID) + local posx = math.ceil(centerposx[unitID]-blpcenterpositionx) + local posz = math.ceil(centerposz[unitID]-blpcenterpositionz) + local queuethisshit = [["shift"]] + + -- Spring.GiveOrderToUnit(scav, -(UDN.cornanotc_scav.id), {posx-96, posy, posz-48, 0}, {"shift"}) + Spring.Echo("Spring.GiveOrderToUnit(scav, -(UDN."..unitDefName.."_scav.id), {posx+("..posx.."), posy, posz+("..posz.."), "..unitIDFacing.."}, {"..queuethisshit.."})") + + end + function GenerateBlueprint2(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + local unitDefName = UnitDefs[unitDefID].name + local unitIDFacing = Spring.GetUnitBuildFacing(unitID) + local posx = math.ceil(centerposx[unitID]-blpcenterpositionx) + local posz = math.ceil(centerposz[unitID]-blpcenterpositionz) + local unitDefNameString = [["]] + + -- Spring.CreateUnit("corrad"..nameSuffix, posx, posy, posz, math.random(0,3),GaiaTeamID) + Spring.Echo("Spring.CreateUnit("..unitDefNameString..unitDefName..unitDefNameString.."..nameSuffix, posx+("..posx.."), posy, posz+("..posz.."), "..unitIDFacing..",GaiaTeamID)") + + end + + function GetBlueprintCenter() + local selectedunits = Spring.GetSelectedUnits() + for i = 1,#selectedunits do + local unit = selectedunits[i] + centerposx[unit], centerposy[unit], centerposz[unit] = Spring.GetUnitPosition(unit) + blueprintposx = blueprintposx + centerposx[unit] + blueprintposz = blueprintposz + centerposz[unit] + end + blpcenterpositionx = blueprintposx/#selectedunits + blpcenterpositionz = blueprintposz/#selectedunits + end + + function ClearValues() + blueprintposx = 0 + blueprintposz = 0 + centerposx = {} + centerposy = {} + centerposz = {} + end +end + diff --git a/LuaRules/Gadgets/ai_scav_loader.lua b/LuaRules/Gadgets/ai_scav_loader.lua new file mode 100644 index 000000000..a7644d947 --- /dev/null +++ b/LuaRules/Gadgets/ai_scav_loader.lua @@ -0,0 +1,130 @@ +local enabled = false +local scavengersEnabled = false +local teams = Spring.GetTeamList() +for i = 1,#teams do + local luaAI = Spring.GetTeamLuaAI(teams[i]) + if luaAI and luaAI ~= "" and string.sub(luaAI, 1, 12) == 'ScavengersAI' then + scavengersAIEnabled = true + scavengerAITeamID = i - 1 + break + end +end +if scavengersAIEnabled or (Spring.GetModOptions and (tonumber(Spring.GetModOptions().scavengers) or 0) ~= 0) then + enabled = true +end + +function gadget:GetInfo() + return { + name = "loader for Scavenger mod", + desc = "123", + author = "Damgam", + date = "2019", + layer = -100, + enabled = enabled, + } +end + + +function gadget:GameOver() + gadgetHandler:RemoveGadget(self) +end + +if not gadgetHandler:IsSyncedCode() then + + local isSpec = Spring.GetSpectatingState() + local myTeamID = Spring.GetMyTeamID() + local myPlayerID = Spring.GetMyPlayerID() + local myAllyTeamID = Spring.GetMyAllyTeamID() + function gadget:PlayerChanged(playerID) + isSpec = Spring.GetSpectatingState() + myTeamID = Spring.GetMyTeamID() + myPlayerID = Spring.GetMyPlayerID() + myAllyTeamID = Spring.GetMyAllyTeamID() + end + + function SendMessage(_,msg) + if tonumber(Spring.GetConfigInt("scavmessages",1) or 1) == 1 then + if Script.LuaUI("GadgetAddMessage") then + Script.LuaUI.GadgetAddMessage(msg) + end + end + end + function SendNotification(_,msg) + if tonumber(Spring.GetConfigInt("scavmessages",1) or 1) == 1 then + if Script.LuaUI("EventBroadcast") then + Script.LuaUI.EventBroadcast("SoundEvents "..msg.." "..myPlayerID) + end + end + end + + local addedNotifications = false + function addNotifications() + if Script.LuaUI("AddNotification") then + addedNotifications = true + local unlisted = true -- prevent these notifications showing in the game settings notifications tab + + -- ID, file.wav, timeout time, exact duration of the .wav, written message, is unlisted? + Script.LuaUI.AddNotification('scav_scavcomdetected', 'scavengers/scavcomdetected.wav', 20, 1.87, "Scavenger commander detected.", unlisted) + Script.LuaUI.AddNotification('scav_unidentifiedObjectsDetected', 'scavengers/unidentifiedObjectsDetected.wav', 999999, 3.7, "Unidentified objects have been detected in the vicinity...", unlisted) + Script.LuaUI.AddNotification('scav_classifiedAsScavengers', 'scavengers/classifiedAsScavengers.wav', 999999, 3.87, "Unidentified objects are now classified as Scavengers.", unlisted) + Script.LuaUI.AddNotification('scav_scavadditionalcomdetected', 'scavengers/scavadditionalcomdetected.wav', 20, 3.14, "An additional Scavenger Commander detected.", unlisted) + Script.LuaUI.AddNotification('scav_scavanotherscavcomdetected', 'scavengers/scavanotherscavcomdetected.wav', 20, 3.3, "Another Scavenger Commander detected in the area.", unlisted) + Script.LuaUI.AddNotification('scav_scavnewcomentered', 'scavengers/scavnewcomentered.wav', 20, 2.94, "New Scavenger Commander entered this location.", unlisted) + Script.LuaUI.AddNotification('scav_scavcomspotted', 'scavengers/scavcomspotted.wav', 20, 2.82, "An extra Scavenger Commander has been spotted.", unlisted) + Script.LuaUI.AddNotification('scav_scavcomnewdetect', 'scavengers/scavcomnewdetect.wav', 20, 1.89, "New Scav Commander detected.", unlisted) + Script.LuaUI.AddNotification('scav_droppodsDetectedInArea', 'scavengers/droppodsDetectedInArea.wav', 20, 1.43, "Scavenger Droppods detected in the area.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinalattack', 'scavengers/scavfinalattack.wav', 20, 4.8, "Scavengers are unleashing all they have. Their final assault has started.", unlisted) + Script.LuaUI.AddNotification('scav_droppingUnits', 'scavengers/droppingUnits.wav', 20, 3.31, "Scavengers are dropping units in our area.", unlisted) + + Script.LuaUI.AddNotification('scav_scavfinalvictory', 'scavengers/scavfinalvictory.wav', 20, 10.5, "Good work commander. You survived all scavenger attacks. You are victorius! Celebrate and then try and annihilate them on the next map.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal12remain', 'scavengers/scavfinal12remain.wav', 20, 3.93, "12.5 minutes remaining. Still a long fight ahead.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal10remain', 'scavengers/scavfinal10remain.wav', 20, 1.49, "10 minutes remaining.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal09remain', 'scavengers/scavfinal09remain.wav', 20, 2.7, "9 minutes remaining. Hold your line.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal08remain', 'scavengers/scavfinal08remain.wav', 20, 1.43, "8 minutes remaining.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal07remain', 'scavengers/scavfinal07remain.wav', 20, 3.6, "Still 7 minutes remaining. Fight your way through them.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal06remain', 'scavengers/scavfinal06remain.wav', 20, 1.67, "6 minutes remaining.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal05remain', 'scavengers/scavfinal05remain.wav', 20, 1.47, "5 minutes remaining. You are almost there.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal04remain', 'scavengers/scavfinal04remain.wav', 20, 1.44, "Only 4 minutes remaining.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal03remain', 'scavengers/scavfinal03remain.wav', 20, 1.44, "3 minute mark.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal02remain', 'scavengers/scavfinal02remain.wav', 20, 1.82, "Only 2 minutes remaining.", unlisted) + Script.LuaUI.AddNotification('scav_scavfinal01remain', 'scavengers/scavfinal01remain.wav', 20, 1.43, "1 minute remaining.", unlisted) + + Script.LuaUI.AddNotification('scav_scavheavyairdetected', 'scavengers/scavheavyairdetected.wav', 20, 3, "", unlisted) -- "Danger... high tech aircraft detected." + Script.LuaUI.AddNotification('scav_scavbossdetected', 'scavengers/scavbossdetected.wav', 20, 8.45, "Critical danger! Scavengers have dropped a highly lethal boss unit in the area, destroy it before it reaches your base.", unlisted) + Script.LuaUI.AddNotification('scav_scavtech3', 'scavengers/scavtech3.wav', 20, 5.34, "", unlisted) + Script.LuaUI.AddNotification('scav_scavtech3b', 'scavengers/scavtech3b.wav', 20, 5.2, "", unlisted) + Script.LuaUI.AddNotification('scav_scavtech3c', 'scavengers/scavtech3c.wav', 20, 5.14, "", unlisted) + Script.LuaUI.AddNotification('scav_scavtech3d', 'scavengers/scavtech3d.wav', 20, 4.67, "", unlisted) + Script.LuaUI.AddNotification('scav_scavtech3e', 'scavengers/scavtech3e.wav', 20, 3.18, "", unlisted) + Script.LuaUI.AddNotification('scav_scavheavyshipsdetected', 'scavengers/scavheavyshipsdetected.wav', 20, 3.28, "Alert. Heavy ships detected in the area.", unlisted) + --Script.LuaUI.AddNotification('scav_', 'scavengers/.wav', 20, 3, "", unlisted) + + end + end + + function gadget:Initialize() + gadgetHandler:AddSyncAction("SendMessage", SendMessage) + gadgetHandler:AddSyncAction("SendNotification", SendNotification) + + addNotifications() + end + + function gadget:Update() + if not addedNotifications then + addNotifications() + end + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("SendMessage") + gadgetHandler:RemoveSyncAction("SendNotification") + end + + +else + + if enabled then + VFS.Include('luarules/gadgets/scavengers/boot.lua') + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai_simpleai.lua b/LuaRules/Gadgets/ai_simpleai.lua new file mode 100644 index 000000000..7ab3bca34 --- /dev/null +++ b/LuaRules/Gadgets/ai_simpleai.lua @@ -0,0 +1,670 @@ +local enabled = false +local teams = Spring.GetTeamList() +local SimpleAITeamIDs = {} +local SimpleAITeamIDsCount = 0 +local SimpleCheaterAITeamIDs = {} +local SimpleCheaterAITeamIDsCount = 0 +local UDN = UnitDefNames +local wind = Game.windMax +local mapsizeX = Game.mapSizeX +local mapsizeZ = Game.mapSizeZ + +local gameShortName = Game.gameShortName + +-- team locals +SimpleFactoriesCount = {} +SimpleFactories = {} +SimpleT1Mexes = {} +SimpleFactoryDelay = {} + +for i = 1, #teams do + local teamID = teams[i] + local luaAI = Spring.GetTeamLuaAI(teamID) + if luaAI and luaAI ~= "" and (string.sub(luaAI, 1, 8) == 'SimpleAI' or string.sub(luaAI, 1, 15) == 'SimpleCheaterAI' or string.sub(luaAI, 1, 16) == 'SimpleDefenderAI' or string.sub(luaAI, 1, 19) == 'SimpleConstructorAI') then + enabled = true + SimpleAITeamIDsCount = SimpleAITeamIDsCount + 1 + SimpleAITeamIDs[SimpleAITeamIDsCount] = teamID + + SimpleFactoriesCount[teamID] = 0 + SimpleFactories[teamID] = {} + SimpleT1Mexes[teamID] = 0 + SimpleFactoryDelay[teamID] = 0 + + if string.sub(luaAI, 1, 15) == 'SimpleCheaterAI' or string.sub(luaAI, 1, 16) == 'SimpleDefenderAI' or string.sub(luaAI, 1, 19) == 'SimpleConstructorAI' then + SimpleCheaterAITeamIDsCount = SimpleCheaterAITeamIDsCount + 1 + SimpleCheaterAITeamIDs[SimpleCheaterAITeamIDsCount] = teamID + end + end +end + +function gadget:GetInfo() + return { + name = "SimpleAI", + desc = "123", + author = "Damgam", + date = "2020", + layer = -100, + enabled = enabled, + } +end + +-------- lists +BadUnitsList = {} +if gameShortName == "BYAR" then + BadUnitsList = { + -- transports + "armthovr", + "corthovr", + "armatlas", + "armtship", + "corvalk", + "cortship", + "armdfly", + "corseah", + "corint", + + -- stockpilers + "armscab", + "armemp", + "armjuno", + "armamd", + "armmercury", + "armsilo", + "armcarry", + "corfmd", + "corjuno", + "corscreamer", + "corsilo", + "cortron", + "corcarry", + "cormabm", + + -- minelayers + "armmlv", + "cormlv", + + -- depth charge launchers + "armdl", + "cordl", + + -- walls + "armdrag", + "cordrag", + } +end + +if gameShortName == "EvoRTS" then + BadUnitsList = {} +end + +local BadUnitDefs = {} +local SimpleCommanderDefs = {} +local SimpleFactoriesDefs = {} +local SimpleConstructorDefs = {} +local SimpleExtractorDefs = {} +local SimpleGeneratorDefs = {} +local SimpleConverterDefs = {} +local SimpleTurretDefs = {} +local SimpleUndefinedBuildingDefs = {} +local SimpleUndefinedUnitDefs = {} + +for unitDefID, unitDef in pairs(UnitDefs) do + BadUnitDef = false + for a = 1,#BadUnitsList do + if BadUnitsList[a] == unitDef.name then + BadUnitDef = true + break + else + BadUnitDef = false + end + end + if BadUnitDef == false then + if unitDef.name == "armcom" or unitDef.name == "corcom" or unitDef.name == "armdecom" or unitDef.name == "cordecom" then + SimpleCommanderDefs[#SimpleCommanderDefs + 1] = unitDefID + elseif unitDef.isFactory and #unitDef.buildOptions > 0 then + SimpleFactoriesDefs[#SimpleFactoriesDefs + 1] = unitDefID + elseif unitDef.canMove and unitDef.isBuilder and #unitDef.buildOptions > 0 then + SimpleConstructorDefs[#SimpleConstructorDefs + 1] = unitDefID + elseif unitDef.extractsMetal > 0 or (unitDef.customParams and unitDef.customParams.metal_extractor) then + SimpleExtractorDefs[#SimpleExtractorDefs + 1] = unitDefID + elseif (unitDef.energyMake > 19 and (not unitDef.energyUpkeep or unitDef.energyUpkeep < 10)) or (unitDef.windGenerator > 0 and wind > 10) or unitDef.tidalGenerator > 0 or (unitDef.customParams and unitDef.customParams.solar) then + SimpleGeneratorDefs[#SimpleGeneratorDefs + 1] = unitDefID + elseif unitDef.customParams and unitDef.customParams.energyconv_capacity and unitDef.customParams.energyconv_efficiency then + SimpleConverterDefs[#SimpleConverterDefs + 1] = unitDefID + elseif unitDef.isBuilding and #unitDef.weapons > 0 then + SimpleTurretDefs[#SimpleTurretDefs + 1] = unitDefID + + + elseif not unitDef.canMove then + SimpleUndefinedBuildingDefs[#SimpleUndefinedBuildingDefs + 1] = unitDefID + else + SimpleUndefinedUnitDefs[#SimpleUndefinedUnitDefs + 1] = unitDefID + end + end +end + +-------- functions + +local function SimpleGetClosestMexSpot(x, z) + local bestSpot + local bestDist = math.huge + local metalSpots = GG.metalSpots + if metalSpots then + for i = 1, #metalSpots do + local spot = metalSpots[i] + local dx, dz = x - spot.x, z - spot.z + local dist = dx * dx + dz * dz + local units = Spring.GetUnitsInCylinder(spot.x, spot.z, 128) + --local height = Spring.GetGroundHeight(spot.x, spot.z) + if dist < bestDist and #units == 0 then + --and height > 0 then + bestSpot = spot + bestDist = dist + end + end + end + return bestSpot +end + +local function SimpleBuildOrder(cUnitID, building) + searchRange = 0 + for b2 = 1,20 do + searchRange = searchRange + 300 + local team = Spring.GetUnitTeam(cUnitID) + local cunitposx, _, cunitposz = Spring.GetUnitPosition(cUnitID) + local units = Spring.GetUnitsInCylinder(cunitposx, cunitposz, searchRange, team) + if #units > 1 then + local buildnear = units[math.random(1, #units)] + local refDefID = Spring.GetUnitDefID(buildnear) + local isBuilding = UnitDefs[refDefID].isBuilding + local isCommander = (UnitDefs[refDefID].name == "armcom" or UnitDefs[refDefID].name == "corcom") + local isExtractor = UnitDefs[refDefID].extractsMetal > 0 + if (isBuilding or isCommander) then-- and not isExtractor then + local refx, refy, refz = Spring.GetUnitPosition(buildnear) + local reffootx = UnitDefs[refDefID].xsize * 8 + local reffootz = UnitDefs[refDefID].zsize * 8 + local spacing = math.random(64, 128) + local testspacing = spacing * 0.75 + local buildingDefID = building + local r = math.random(0, 3) + if r == 0 then + local bposx = refx + local bposz = refz + reffootz + spacing + local bposy = Spring.GetGroundHeight(bposx, bposz)--+100 + local testpos = Spring.TestBuildOrder(buildingDefID, bposx, bposy, bposz, r) + local nearbyunits = Spring.GetUnitsInRectangle(bposx - testspacing, bposz - testspacing, bposx + testspacing, bposz + testspacing) + if testpos == 2 and #nearbyunits <= 0 then + Spring.GiveOrderToUnit(cUnitID, -buildingDefID, { bposx, bposy, bposz, r }, { "shift" }) + break + end + elseif r == 1 then + local bposx = refx + reffootx + spacing + local bposz = refz + local bposy = Spring.GetGroundHeight(bposx, bposz)--+100 + local testpos = Spring.TestBuildOrder(buildingDefID, bposx, bposy, bposz, r) + local nearbyunits = Spring.GetUnitsInRectangle(bposx - testspacing, bposz - testspacing, bposx + testspacing, bposz + testspacing) + if testpos == 2 and #nearbyunits <= 0 then + Spring.GiveOrderToUnit(cUnitID, -buildingDefID, { bposx, bposy, bposz, r }, { "shift" }) + break + end + elseif r == 2 then + local bposx = refx + local bposz = refz - reffootz - spacing + local bposy = Spring.GetGroundHeight(bposx, bposz)--+100 + local testpos = Spring.TestBuildOrder(buildingDefID, bposx, bposy, bposz, r) + local nearbyunits = Spring.GetUnitsInRectangle(bposx - testspacing, bposz - testspacing, bposx + testspacing, bposz + testspacing) + if testpos == 2 and #nearbyunits <= 0 then + Spring.GiveOrderToUnit(cUnitID, -buildingDefID, { bposx, bposy, bposz, r }, { "shift" }) + break + end + elseif r == 3 then + local bposx = refx - reffootx - spacing + local bposz = refz + local bposy = Spring.GetGroundHeight(bposx, bposz)--+100 + local testpos = Spring.TestBuildOrder(buildingDefID, bposx, bposy, bposz, r) + local nearbyunits = Spring.GetUnitsInRectangle(bposx - testspacing, bposz - testspacing, bposx + testspacing, bposz + testspacing) + if testpos == 2 and #nearbyunits <= 0 then + Spring.GiveOrderToUnit(cUnitID, -buildingDefID, { bposx, bposy, bposz, r }, { "shift" }) + break + end + end + end + --local buildingDefID = UnitDefNames.building.id + --local testpos = Spring.TestBuildOrder(buildingDefID, bposx, bposy, bposz, facing) + end + end +end + +local function SimpleConstructionProjectSelection(unitID, unitDefID, unitName, unitTeam, allyTeamID, units, allunits, type) + success = false + + local mcurrent, mstorage, _, mincome, mexpense = Spring.GetTeamResources(unitTeam, "metal") + local ecurrent, estorage, _, eincome, eexpense = Spring.GetTeamResources(unitTeam, "energy") + local unitposx, unitposy, unitposz = Spring.GetUnitPosition(unitID) + + local unitCommands = Spring.GetCommandQueue(unitID, 0) + local buildOptions = UnitDefs[unitDefID].buildOptions + -- Builders + for b1 = 1,10 do + if type == "Builder" or type == "Commander" then + SimpleFactoryDelay[unitTeam] = SimpleFactoryDelay[unitTeam]-1 + local r = math.random(0, 20) + local mexspotpos = SimpleGetClosestMexSpot(unitposx, unitposz) + if (mexspotpos and SimpleT1Mexes[unitTeam] < 3) and type == "Commander" then + local project = SimpleExtractorDefs[math.random(1, #SimpleExtractorDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + Spring.GiveOrderToUnit(unitID, -project, { mexspotpos.x, mexspotpos.y, mexspotpos.z, 0 }, { "shift" }) + --Spring.Echo("Success! Project Type: Extractor.") + success = true + break + end + end + elseif ecurrent < estorage * 0.75 or r == 0 then + local project = SimpleGeneratorDefs[math.random(1, #SimpleGeneratorDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + SimpleBuildOrder(unitID, project) + --Spring.Echo("Success! Project Type: Generator.") + success = true + break + end + end + + elseif mcurrent < mstorage * 0.30 or r == 1 then + -- if type == "Commander" then + -- for t = 1,10 do + -- local targetUnit = units[math.random(1,#units)] + -- if UnitDefs[Spring.GetUnitDefID(targetUnit)].isBuilding == true then + -- local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + -- Spring.GiveOrderToUnit(unitID, CMD.MOVE, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, { "shift", "alt", "ctrl" }) + -- success = true + -- break + -- end + -- end + -- elseif + if (not mexspotpos) and (ecurrent > estorage * 0.85 or r == 1) then + local project = SimpleConverterDefs[math.random(1, #SimpleConverterDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + SimpleBuildOrder(unitID, project) + --Spring.Echo("Success! Project Type: Converter.") + success = true + break + end + end + elseif mexspotpos then + local project = SimpleExtractorDefs[math.random(1, #SimpleExtractorDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + Spring.GiveOrderToUnit(unitID, -project, { mexspotpos.x, mexspotpos.y, mexspotpos.z, 0 }, { "shift" }) + --Spring.Echo("Success! Project Type: Extractor.") + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x+100, mexspotpos.y, mexspotpos.z, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x-100, mexspotpos.y, mexspotpos.z, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x, mexspotpos.y, mexspotpos.z-100, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x, mexspotpos.y, mexspotpos.z-100, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x+100, mexspotpos.y, mexspotpos.z+100, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x-100, mexspotpos.y, mexspotpos.z+100, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x+100, mexspotpos.y, mexspotpos.z-100, math.random(0,3) }, { "shift" }) + break + end + end + for i3 = 1,50 do + local projectturret = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + if buildOptions[i3] == projectturret then + Spring.GiveOrderToUnit(unitID, -projectturret, { mexspotpos.x-100, mexspotpos.y, mexspotpos.z-100, math.random(0,3) }, { "shift" }) + break + end + end + success = true + break + end + end + + end + elseif r == 2 or r == 3 or r == 4 or r == 5 then + local project = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + SimpleBuildOrder(unitID, project) + --Spring.Echo("Success! Project Type: Turret.") + success = true + break + end + end + elseif SimpleFactoriesCount[unitTeam] < 1 or ((mcurrent > mstorage * 0.75 and ecurrent > estorage * 0.75) and SimpleFactoryDelay[unitTeam] <= 0) then + local project = SimpleFactoriesDefs[math.random(1, #SimpleFactoriesDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project and (not SimpleFactories[unitTeam][project]) then + SimpleBuildOrder(unitID, project) + SimpleFactoryDelay[unitTeam] = 30 + --Spring.Echo("Success! Project Type: Factory.") + success = true + break + end + end + elseif r == 11 then + for t = 1,10 do + local targetUnit = units[math.random(1,#units)] + if UnitDefs[Spring.GetUnitDefID(targetUnit)].isBuilding == true then + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + Spring.GiveOrderToUnit(unitID, CMD.MOVE, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, { "shift", "alt", "ctrl" }) + success = true + break + end + end + elseif r == 12 and type ~= "Commander" then + local mapcenterX = mapsizeX/2 + local mapcenterZ = mapsizeZ/2 + local mapcenterY = Spring.GetGroundHeight(mapcenterX, mapcenterZ) + local mapdiagonal = math.ceil(math.sqrt((mapsizeX*mapsizeX)+(mapsizeZ*mapsizeZ))) + Spring.GiveOrderToUnit(unitID, CMD.RECLAIM,{mapcenterX+math.random(-100,100),mapcenterY,mapcenterZ+math.random(-100,100),mapdiagonal}, 0) + success = true + elseif r == 13 and type ~= "Commander" then + local mapcenterX = mapsizeX/2 + local mapcenterZ = mapsizeZ/2 + local mapcenterY = Spring.GetGroundHeight(mapcenterX, mapcenterZ) + local mapdiagonal = math.ceil(math.sqrt((mapsizeX*mapsizeX)+(mapsizeZ*mapsizeZ))) + Spring.GiveOrderToUnit(unitID, CMD.REPAIR,{mapcenterX+math.random(-100,100),mapcenterY,mapcenterZ+math.random(-100,100),mapdiagonal}, 0) + success = true + else + local r2 = math.random(0, 1) + if r2 == 0 then + local project = SimpleUndefinedBuildingDefs[math.random(1, #SimpleUndefinedBuildingDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + SimpleBuildOrder(unitID, project) + --Spring.Echo("Success! Project Type: Other.") + success = true + break + end + end + else + local project = SimpleTurretDefs[math.random(1, #SimpleTurretDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + SimpleBuildOrder(unitID, project) + --Spring.Echo("Success! Project Type: Turret.") + success = true + break + end + end + end + end + elseif type == "Factory" then + if #Spring.GetFullBuildQueue(unitID, 0) < 5 then + local r = math.random(0, 5) + local luaAI = Spring.GetTeamLuaAI(unitTeam) + if r == 0 or string.sub(luaAI, 1, 19) == 'SimpleConstructorAI' then + local project = SimpleConstructorDefs[math.random(1, #SimpleConstructorDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + local x, y, z = Spring.GetUnitPosition(unitID) + Spring.GiveOrderToUnit(unitID, -project, { x, y, z, 0 }, 0) + --Spring.Echo("Success! Project Type: Constructor.") + success = true + break + end + end + else + local project = SimpleUndefinedUnitDefs[math.random(1, #SimpleUndefinedUnitDefs)] + for i2 = 1,#buildOptions do + if buildOptions[i2] == project then + local x, y, z = Spring.GetUnitPosition(unitID) + Spring.GiveOrderToUnit(unitID, -project, { x, y, z, 0 }, 0) + --Spring.Echo("Success! Project Type: Unit.") + success = true + break + end + end + end + else + success = true + end + end + if success == true then + break + end + end +end + +function gadget:GameOver() + gadgetHandler:RemoveGadget(self) +end + +if gadgetHandler:IsSyncedCode() then + + function gadget:GameFrame(n) + if n % 15 == 0 then + for i = 1, SimpleAITeamIDsCount do + if n%(15*SimpleAITeamIDsCount) == 15*(i-1) then + local teamID = SimpleAITeamIDs[i] + local _, _, isDead, _, faction, allyTeamID = Spring.GetTeamInfo(teamID) + local mcurrent, mstorage, _, mincome, mexpense = Spring.GetTeamResources(teamID, "metal") + local ecurrent, estorage, _, eincome, eexpense = Spring.GetTeamResources(teamID, "energy") + for j = 1, #SimpleCheaterAITeamIDs do + if teamID == SimpleCheaterAITeamIDs[j] then + -- --cheats + if mcurrent < mstorage * 0.20 then + Spring.SetTeamResource(teamID, "m", mstorage * 0.25) + end + if ecurrent < estorage * 0.20 then + Spring.SetTeamResource(teamID, "e", estorage * 0.25) + end + end + end + + local units = Spring.GetTeamUnits(teamID) + local allunits = Spring.GetAllUnits() + for k = 1, #units do + local unitID = units[k] + local unitDefID = Spring.GetUnitDefID(unitID) + local unitName = UnitDefs[unitDefID].name + local unitTeam = teamID + local unitHealth, unitMaxHealth, _, _, unitBuildProgress = Spring.GetUnitHealth(unitID) + local unitMaxRange = Spring.GetUnitMaxRange(unitID) + local unitCommands = Spring.GetCommandQueue(unitID, 0) + local unitposx, unitposy, unitposz = Spring.GetUnitPosition(unitID) + --Spring.Echo(faction) + + --if faction == "arm" then + + -- builders + for u = 1, #SimpleCommanderDefs do + if unitDefID == SimpleCommanderDefs[u] then + local nearestEnemyCloak = Spring.GetUnitNearestEnemy(unitID, 2000, false) + if nearestEnemyCloak and ecurrent > 1000 then + Spring.GiveOrderToUnit(unitID, 37382, {1}, 0) + else + Spring.GiveOrderToUnit(unitID, 37382, {0}, 0) + end + + + local nearestEnemy = Spring.GetUnitNearestEnemy(unitID, 250, true) + local unitHealthPercentage = (unitHealth/unitMaxHealth)*100 + + if nearestEnemy and unitHealthPercentage > 30 then + if ecurrent < estorage*0.9 then + Spring.SetTeamResource(teamID, "e", estorage*0.9) + end + Spring.GiveOrderToUnit(unitID, CMD.DGUN, {nearestEnemy}, 0) + local nearestEnemies = Spring.GetUnitsInCylinder(unitposx, unitposz, 300) + for x = 1,#nearestEnemies do + local enemy = nearestEnemies[x] + if Spring.GetUnitTeam(enemy) == Spring.GetUnitTeam(nearestEnemy) and enemy ~= nearestEnemy then + Spring.GiveOrderToUnit(unitID, CMD.DGUN, {enemy}, {"shift"}) + end + end + Spring.GiveOrderToUnit(unitID, CMD.MOVE, {unitposx, unitposy, unitposz}, {"shift"}) + elseif nearestEnemy then + for x = 1,10 do + local targetUnit = units[math.random(1,#units)] + if UnitDefs[Spring.GetUnitDefID(targetUnit)].isBuilding == true then + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + Spring.GiveOrderToUnit(unitID, CMD.MOVE, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, 0) + break + end + end + end + end + end + + for u = 1, #SimpleConstructorDefs do + if unitDefID == SimpleConstructorDefs[u] then + local unitHealthPercentage = (unitHealth/unitMaxHealth)*100 + local nearestEnemy = Spring.GetUnitNearestEnemy(unitID, 500, true) + if nearestEnemy and unitHealthPercentage > 90 then + Spring.GiveOrderToUnit(unitID, CMD.RECLAIM, {nearestEnemy}, 0) + elseif nearestEnemy then + for x = 1,100 do + local targetUnit = units[math.random(1,#units)] + if UnitDefs[Spring.GetUnitDefID(targetUnit)].isBuilding == true then + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + Spring.GiveOrderToUnit(unitID, CMD.MOVE, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, 0) + break + end + end + end + end + end + + if unitCommands == 0 then + for u = 1, #SimpleConstructorDefs do + if unitDefID == SimpleConstructorDefs[u] then + SimpleConstructionProjectSelection(unitID, unitDefID, unitName, unitTeam, allyTeamID, units, allunits, "Builder") + break + end + end + for u = 1, #SimpleCommanderDefs do + if unitDefID == SimpleCommanderDefs[u] then + SimpleConstructionProjectSelection(unitID, unitDefID, unitName, unitTeam, allyTeamID, units, allunits, "Commander") + break + end + end + + for u = 1, #SimpleFactoriesDefs do + if unitDefID == SimpleFactoriesDefs[u] then + SimpleConstructionProjectSelection(unitID, unitDefID, unitName, unitTeam, allyTeamID, units, allunits, "Factory") + break + end + end + + -- army + + for u = 1, #SimpleUndefinedUnitDefs do + + if unitDefID == SimpleUndefinedUnitDefs[u] then + local luaAI = Spring.GetTeamLuaAI(teamID) + if string.sub(luaAI, 1, 16) == 'SimpleDefenderAI' then + for t = 1,10 do + local targetUnit = allunits[math.random(1,#allunits)] + if Spring.GetUnitAllyTeam(targetUnit) == allyTeamID then + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, { "shift", "alt", "ctrl" }) + break + end + end + else + local targetUnitNear = Spring.GetUnitNearestEnemy(unitID, 2000, false) + if targetUnitNear then + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnitNear) + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, { "shift", "alt", "ctrl" }) + elseif n%3600 <= 15*SimpleAITeamIDsCount then + local targetUnit = Spring.GetUnitNearestEnemy(unitID, 999999, false) + local tUnitX, tUnitY, tUnitZ = Spring.GetUnitPosition(targetUnit) + Spring.GiveOrderToUnit(unitID, CMD.FIGHT, { tUnitX + math.random(-100, 100), tUnitY, tUnitZ + math.random(-100, 100) }, { "shift", "alt", "ctrl" }) + end + break + end + end + end + end + end + end + end + end + end + + function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID) + local unitName = UnitDefs[unitDefID].name + for i = 1, SimpleAITeamIDsCount do + if SimpleAITeamIDs[i] == unitTeam then + for u = 1, #SimpleFactoriesDefs do + if unitDefID == SimpleFactoriesDefs[u] then + SimpleFactoriesCount[unitTeam] = SimpleFactoriesCount[unitTeam] + 1 + SimpleFactories[unitTeam][unitDefID] = true + break + end + end + for u = 1, #SimpleExtractorDefs do + if unitDefID == SimpleExtractorDefs[u] then + SimpleT1Mexes[unitTeam] = SimpleT1Mexes[unitTeam] + 1 + break + end + end + end + end + end + + function gadget:UnitDestroyed(unitID, unitDefID, unitTeam, attackerID, attackerDefID, attackerTeam) + local unitName = UnitDefs[unitDefID].name + for i = 1, SimpleAITeamIDsCount do + if SimpleAITeamIDs[i] == unitTeam then + for u = 1, #SimpleFactoriesDefs do + if unitDefID == SimpleFactoriesDefs[u] then + SimpleFactoriesCount[unitTeam] = SimpleFactoriesCount[unitTeam] - 1 + SimpleFactories[unitTeam][unitDefID] = nil + break + end + end + for u = 1, #SimpleExtractorDefs do + if unitDefID == SimpleExtractorDefs[u] then + SimpleT1Mexes[unitTeam] = SimpleT1Mexes[unitTeam] - 1 + break + end + end + end + end + end + + +end diff --git a/LuaRules/Gadgets/ai_supply_drops.lua b/LuaRules/Gadgets/ai_supply_drops.lua new file mode 100644 index 000000000..93f31f854 --- /dev/null +++ b/LuaRules/Gadgets/ai_supply_drops.lua @@ -0,0 +1,216 @@ +lootBoxSpawns = tonumber(Spring.GetModOptions().lootboxes) +if Spring.GetModOptions then + if lootBoxSpawns == nil or lootBoxSpawns == 1 then + lootboxSpawnEnabled = true + Spring.Echo("[Scavengers] Lootbox Spawns are Enabled") + elseif lootBoxSpawns == 0 then + lootboxSpawnEnabled = false + Spring.Echo("[Scavengers] Lootbox Spawns are Disabled") + end +else + lootboxSpawnEnabled = true + Spring.Echo("[Scavengers] Lootbox Spawns are Enabled") +end + +function gadget:GetInfo() + return { + name = "supply drops", + desc = "123", + author = "Damgam", + date = "2020", + layer = -100, + enabled = true, + } +end + +if (not gadgetHandler:IsSyncedCode()) then + return false +end + +local lootboxesListLow = { + "lootboxbronze", + "lootboxbronze", +} + +local lootboxesListMid = { + "lootboxbronze", + "lootboxbronze", + "lootboxsilver", +} + +local lootboxesListHigh = { + "lootboxbronze", + "lootboxbronze", + "lootboxbronze", + "lootboxsilver", + "lootboxsilver", + "lootboxsilver", + "lootboxgold", +} + +local lootboxesListTop = { + "lootboxsilver", + "lootboxsilver", + "lootboxsilver", + "lootboxsilver", + "lootboxsilver", + "lootboxgold", + "lootboxgold", + "lootboxgold", + "lootboxgold", + "lootboxplatinum", +} + + + + + + + +-- locals +local spGetUnitTeam = Spring.GetUnitTeam +local spNearestEnemy = Spring.GetUnitNearestEnemy +local spNearestAlly = Spring.GetUnitNearestAlly +local spSeparation = Spring.GetUnitSeparation +local spPosition = Spring.GetUnitPosition +local spTransfer = Spring.TransferUnit +local mapsizeX = Game.mapSizeX +local mapsizeZ = Game.mapSizeZ +local xBorder = math.floor(mapsizeX/5) +local zBorder = math.floor(mapsizeZ/5) +local math_random = math.random +local spGroundHeight = Spring.GetGroundHeight +local spGaiaTeam = Spring.GetGaiaTeamID() +local spCreateUnit = Spring.CreateUnit +local spGetCylinder = Spring.GetUnitsInCylinder + +local aliveLootboxes = {} +local aliveLootboxesCount = 0 + +local QueuedSpawns = {} +local QueuedSpawnsFrames = {} + + + + + + +-- functions + +local function QueueSpawn(unitName, posx, posy, posz, facing, team, frame) + local QueueSpawnCommand = {unitName, posx, posy, posz, facing, team} + local QueueFrame = frame + if #QueuedSpawnsFrames > 0 then + for i = 1, #QueuedSpawnsFrames do + local CurrentQueueFrame = QueuedSpawnsFrames[i] + if (not(CurrentQueueFrame < QueueFrame)) or i == #QueuedSpawnsFrames then + table.insert(QueuedSpawns, i, QueueSpawnCommand) + table.insert(QueuedSpawnsFrames, i, QueueFrame) + break + end + end + else + table.insert(QueuedSpawns, QueueSpawnCommand) + table.insert(QueuedSpawnsFrames, QueueFrame) + end +end + +local function SpawnFromQueue(n) + local QueuedSpawnsForNow = #QueuedSpawns + if QueuedSpawnsForNow > 0 then + for i = 1,QueuedSpawnsForNow do + if n == QueuedSpawnsFrames[1] then + local createSpawnCommand = QueuedSpawns[1] + spCreateUnit(QueuedSpawns[1][1],QueuedSpawns[1][2],QueuedSpawns[1][3],QueuedSpawns[1][4],QueuedSpawns[1][5],QueuedSpawns[1][6]) + table.remove(QueuedSpawns, 1) + table.remove(QueuedSpawnsFrames, 1) + else + break + end + end + end +end + + + + + + +-- callins + +function gadget:GameFrame(n) + if n > 1 then + SpawnFromQueue(n) + end + + if n%30 == 0 and n > 2 then + + if #aliveLootboxes > 0 then + for j = 1,#aliveLootboxes do + local unitID = aliveLootboxes[j] + local unitTeam = spGetUnitTeam(unitID) + local unitEnemy = spNearestEnemy(unitID, 384, false) + if unitEnemy then + local enemyTeam = spGetUnitTeam(unitEnemy) + --if enemyTeam ~= spGaiaTeam then + local posx, posy, posz = spPosition(unitID) + Spring.MarkerErasePosition(posx, posy, posz) + spTransfer(unitID, enemyTeam, false) + Spring.SetUnitNeutral(unitID, true) + --end + end + end + end + if math_random(0,300) == 0 and lootboxSpawnEnabled then + for k = 1,1000 do + local posx = math.floor(math_random(xBorder,mapsizeX-xBorder)/16)*16 + local posz = math.floor(math_random(zBorder,mapsizeZ-zBorder)/16)*16 + local posy = spGroundHeight(posx, posz) + local unitsCyl = spGetCylinder(posx, posz, 384) + if #unitsCyl == 0 then + --QueueSpawn("lootdroppod_gold", posx, posy, posz, math_random(0,3),spGaiaTeam, n) + --QueueSpawn(lootboxesList[math_random(1,#lootboxesList)], posx, posy, posz, math_random(0,3),spGaiaTeam, n+600) + if aliveLootboxesCount < 2 then + spCreateUnit(lootboxesListLow[math_random(1,#lootboxesListLow)], posx, posy, posz, math_random(0,3), spGaiaTeam) + --Spring.MarkerAddPoint(posx, posy, posz, "Resource Generator Detected", true) + elseif aliveLootboxesCount < 4 then + spCreateUnit(lootboxesListMid[math_random(1,#lootboxesListMid)], posx, posy, posz, math_random(0,3), spGaiaTeam) + --Spring.MarkerAddPoint(posx, posy, posz, "Resource Generator Detected", true) + elseif aliveLootboxesCount < 6 then + spCreateUnit(lootboxesListHigh[math_random(1,#lootboxesListHigh)], posx, posy, posz, math_random(0,3), spGaiaTeam) + --Spring.MarkerAddPoint(posx, posy, posz, "Resource Generator Detected", true) + else + spCreateUnit(lootboxesListTop[math_random(1,#lootboxesListTop)], posx, posy, posz, math_random(0,3), spGaiaTeam) + --Spring.MarkerAddPoint(posx, posy, posz, "Resource Generator Detected", true) + end + + break + end + end + end + end +end + + +function gadget:UnitCreated(unitID, unitDefID, unitTeam) + local unitName = UnitDefs[unitDefID].name + if string.find(unitName, "lootbox") then + table.insert(aliveLootboxes,unitID) + aliveLootboxesCount = aliveLootboxesCount + 1 + Spring.SetUnitNeutral(unitID, true) + end +end + + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + local unitName = UnitDefs[unitDefID].name + if string.find(unitName, "lootbox") then + for i = 1,#aliveLootboxes do + if unitID == aliveLootboxes[i] then + aliveLootboxesCount = aliveLootboxesCount - 1 + table.remove(aliveLootboxes,i) + break + end + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/api_custom_unit_shaders.lua b/LuaRules/Gadgets/api_custom_unit_shaders.lua index b16226889..7d8bfd450 100644 --- a/LuaRules/Gadgets/api_custom_unit_shaders.lua +++ b/LuaRules/Gadgets/api_custom_unit_shaders.lua @@ -18,14 +18,10 @@ function gadget:GetInfo() date = "2008,2009,2010,2016", license = "GNU GPL, v2 or later", layer = 1, - enabled = Spring.Utilities.IsCurrentVersionNewerThan(100, 0) -- loaded by default? + enabled = true -- loaded by default? } end -if not Spring.Utilities.IsCurrentVersionNewerThan(100, 0) then - return -end - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Synced @@ -50,14 +46,25 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -VFS.Include("luarules/utilities/unitrendering.lua", nil, VFS.MOD .. VFS.BASE) +VFS.Include("luarules/utilities/unitrendering.lua", nil, VFS.ZIP) + +local LuaShader = VFS.Include("LuaRules/Gadgets/Include/LuaShader.lua") + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local MATERIALS_DIR = "ModelMaterials/" -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local shadows = false local advShading = false -local normalmapping = false +local normalmapping = (tonumber(Spring.GetConfigInt("NormalMapping",1) or 1) == 1) +local treewind = tonumber(Spring.GetConfigInt("TreeWind",1) or 1) == 1 +local sunChanged = false + +local idToDefID = {} local unitRendering = { drawList = {}, @@ -66,6 +73,8 @@ local unitRendering = { materialDefs = {}, loadedTextures = {}, + ObjectDefNames = UnitDefNames, + spGetAllObjects = Spring.GetAllUnits, spGetObjectPieceList = Spring.GetUnitPieceList, @@ -89,6 +98,8 @@ local featureRendering = { materialDefs = {}, loadedTextures = {}, + ObjectDefNames = FeatureDefNames, + spGetAllObjects = Spring.GetAllFeatures, spGetObjectPieceList = Spring.GetFeaturePieceList, @@ -114,7 +125,7 @@ local function InsertPlugin(str) return (_plugins and _plugins[str]) or "" end -local function CompileShader(shader, definitions, plugins) +local function CompileShader(shader, definitions, plugins, addName) shader.vertexOrig = shader.vertex shader.fragmentOrig = shader.fragment shader.geometryOrig = shader.geometry @@ -145,7 +156,7 @@ local function CompileShader(shader, definitions, plugins) hasVersion = hasVersion or string.sub(def,1,string.len("#version")) == "#version" end if not hasVersion then - table.insert(definitions, 1, "#version 130") + table.insert(definitions, 1, "#version 150 compatibility") end if (shadows) then table.insert(definitions, "#define use_shadows") @@ -159,67 +170,82 @@ local function CompileShader(shader, definitions, plugins) then shader.geometry = definitions .. shader.geometry; end end - local GLSLshader = gl.CreateShader(shader) - local errorLog = gl.GetShaderLog() - if (errorLog and errorLog~= "") then - Spring.Echo("Custom Unit Shaders:", errorLog) - end + local luaShader = LuaShader(shader, "Custom Unit Shaders. " .. addName) + luaShader:Initialize() shader.vertex = shader.vertexOrig shader.fragment = shader.fragmentOrig shader.geometry = shader.geometryOrig - return GLSLshader + return luaShader end local function _CompileMaterialShaders(rendering) - for _,mat_src in pairs(rendering.materialDefs) do - if (mat_src.shaderSource) then - local GLSLshader = CompileShader(mat_src.shaderSource, mat_src.shaderDefinitions, mat_src.shaderPlugins) - - if (GLSLshader) then - if (mat_src.standardShader) then - gl.DeleteShader(mat_src.standardShader) - end - mat_src.standardShader = GLSLshader - mat_src.standardUniforms = { - cameraloc = gl.GetUniformLocation(GLSLshader, "camera"), - camerainvloc = gl.GetUniformLocation(GLSLshader, "cameraInv"), - cameraposloc = gl.GetUniformLocation(GLSLshader, "cameraPos"), - shadowmatrixloc = gl.GetUniformLocation(GLSLshader, "shadowMatrix"), - shadowparamsloc = gl.GetUniformLocation(GLSLshader, "shadowParams"), - sunposloc = gl.GetUniformLocation(GLSLshader, "sunPos"), - simframeloc = gl.GetUniformLocation(GLSLshader, "simFrame"), - } - end - end - - if (mat_src.deferredSource) then - local GLSLshader = CompileShader(mat_src.deferredSource, mat_src.deferredDefinitions, mat_src.deferredPlugins) - - if (GLSLshader) then - if (mat_src.deferredShader) then - gl.DeleteShader(mat_src.deferredShader) - end - mat_src.deferredShader = GLSLshader - mat_src.deferredUniforms = { - cameraloc = gl.GetUniformLocation(GLSLshader, "camera"), - camerainvloc = gl.GetUniformLocation(GLSLshader, "cameraInv"), - cameraposloc = gl.GetUniformLocation(GLSLshader, "cameraPos"), - shadowmatrixloc = gl.GetUniformLocation(GLSLshader, "shadowMatrix"), - shadowparamsloc = gl.GetUniformLocation(GLSLshader, "shadowParams"), - sunposloc = gl.GetUniformLocation(GLSLshader, "sunPos"), - simframeloc = gl.GetUniformLocation(GLSLshader, "simFrame"), - } - end - end - end + for matName, mat_src in pairs(rendering.materialDefs) do + if mat_src.shaderSource then + local luaShader = CompileShader(mat_src.shaderSource, mat_src.shaderDefinitions, mat_src.shaderPlugins, string.format("MatName: \"%s\"(%s)", matName, "Standard")) + + if luaShader then + if mat_src.standardShader then + if mat_src.standardShaderObj then + mat_src.standardShaderObj:Finalize() + else + gl.DeleteShader(mat_src.standardShader) + end + end + mat_src.standardShaderObj = luaShader + mat_src.standardShader = luaShader:GetHandle() + luaShader:SetUnknownUniformIgnore(true) + luaShader:ActivateWith( function() + mat_src.standardUniforms = { + cameraloc = luaShader:GetUniformLocation("camera"), + camerainvloc = luaShader:GetUniformLocation("cameraInv"), + cameraposloc = luaShader:GetUniformLocation("cameraPos"), + shadowmatrixloc = luaShader:GetUniformLocation("shadowMatrix"), + shadowparamsloc = luaShader:GetUniformLocation("shadowParams"), + sunposloc = luaShader:GetUniformLocation("sunPos"), + simframeloc = luaShader:GetUniformLocation("simFrame"), + } + end) + luaShader:SetActiveStateIgnore(true) + end + end + + if (mat_src.deferredSource) then + local luaShader = CompileShader(mat_src.deferredSource, mat_src.deferredDefinitions, mat_src.deferredPlugins, string.format("MatName: \"%s\"(%s)", matName, "Deferred")) + + if luaShader then + if mat_src.deferredShader then + if mat_src.deferredShaderObj then + mat_src.deferredShaderObj:Finalize() + else + gl.DeleteShader(mat_src.deferredShader) + end + end + mat_src.deferredShaderObj = luaShader + mat_src.deferredShader = luaShader:GetHandle() + luaShader:SetUnknownUniformIgnore(true) + luaShader:ActivateWith( function() + mat_src.deferredUniforms = { + cameraloc = luaShader:GetUniformLocation("camera"), + camerainvloc = luaShader:GetUniformLocation("cameraInv"), + cameraposloc = luaShader:GetUniformLocation("cameraPos"), + shadowmatrixloc = luaShader:GetUniformLocation("shadowMatrix"), + shadowparamsloc = luaShader:GetUniformLocation("shadowParams"), + sunposloc = luaShader:GetUniformLocation("sunPos"), + simframeloc = luaShader:GetUniformLocation("simFrame"), + } + end) + luaShader:SetActiveStateIgnore(true) + end + end + end end local function CompileMaterialShaders() - _CompileMaterialShaders(unitRendering) - _CompileMaterialShaders(featureRendering) + _CompileMaterialShaders(unitRendering) + _CompileMaterialShaders(featureRendering) end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -349,63 +375,22 @@ local function ToggleAdvShading() end -function ToggleNormalmapping(_,newSetting,_, playerID) - if (playerID ~= Spring.GetMyPlayerID()) then - return - end - - if newSetting and newSetting~="" then - normalmapping = (newSetting=="1") - elseif not newSetting or newSetting=="" then - normalmapping = not normalmapping - end - - Spring.SetConfigInt("NormalMapping", (normalmapping and 1) or 0) - Spring.Echo("normalmapping is " .. (normalmapping and "enabled" or "disabled")) - - if (not normalmapping) then - --// unload normalmapped materials - local units = Spring.GetAllUnits() - for _,unitID in pairs(units) do - local unitDefID = Spring.GetUnitDefID(unitID) - local unitMat = unitRendering.materialInfos[unitDefID] - if (unitMat) then - local mat = unitRendering.materialDefs[unitMat[1]] - if (not mat.force) then - gadget:RenderUnitDestroyed(unitID, unitDefID) - end - end - end - - local features = Spring.GetAllFeatures() - for _,featureID in pairs(features) do - local featureDefID = Spring.GetFeatureDefID(featureID) - local featureMat = featureRendering.materialInfos[featureDefID] - if (featureMat) then - local mat = featureRendering.materialDefs[featureMat[1]] - if (not mat.force) then - gadget:FeatureDestroyed(featureID,featureDefID) - end - end - end - elseif (advShading) then - --// reinitializes all shaders - ToggleShadows() - end -end - - local n = -1 function gadget:Update() - if (n 1000 then + Spring.Echo("TreeWind is " .. (treewind and "enabled" or "disabled")) + end + + --// unload normalmapped materials + local features = Spring.GetAllFeatures() + for _,featureID in pairs(features) do + local featureDefID = Spring.GetFeatureDefID(featureID) + local featureMat = featureRendering.materialInfos[featureDefID] + if (featureMat) then + gadget:FeatureDestroyed(featureID,featureDefID) + end + end + + -- reset + featureRendering.drawList = {} + featureRendering.materialInfos = {} + featureRendering.bufMaterials = {} + featureRendering.materialDefs = {} + featureRendering.loadedTextures = {} + + --// load the materials config files + local unitMaterialDefs, featureMaterialDefs = _LoadMaterialConfigFiles(MATERIALS_DIR) + _ProcessMaterials(featureRendering, featureMaterialDefs) + + local features = Spring.GetAllFeatures() + for _,featureID in pairs(features) do + local featureDefID = Spring.GetFeatureDefID(featureID) + local featureMat = featureRendering.materialInfos[featureDefID] + if (featureMat) then + gadget:FeatureCreated(featureID,featureDefID) + end + end +end + + +function ToggleNormalmapping(_,newSetting,_, playerID) + if (playerID ~= Spring.GetMyPlayerID()) then + return + end + + if newSetting and newSetting~="" then + normalmapping = (newSetting=="1") + elseif not newSetting or newSetting=="" then + normalmapping = not normalmapping + end + + Spring.SetConfigInt("NormalMapping", (normalmapping and 1) or 0) + Spring.Echo("normalmapping is " .. (normalmapping and "enabled" or "disabled")) + + --// unload normalmapped materials + local features = Spring.GetAllFeatures() + for _,featureID in pairs(features) do + local featureDefID = Spring.GetFeatureDefID(featureID) + local featureMat = featureRendering.materialInfos[featureDefID] + if (featureMat) then + local mat = featureRendering.materialDefs[featureMat[1]] + if (not mat.force) then + gadget:FeatureDestroyed(featureID,featureDefID) + end + end + end + --// unload normalmapped materials + local units = Spring.GetAllUnits() + for _,unitID in pairs(units) do + local unitDefID = Spring.GetUnitDefID(unitID) + local unitMat = unitRendering.materialInfos[unitDefID] + if (unitMat) then + local mat = unitRendering.materialDefs[unitMat[1]] + if (not mat.force) then + gadget:RenderUnitDestroyed(unitID,unitDefID) + end + end + end + + -- reset + unitRendering.drawList = {} + unitRendering.materialInfos = {} + unitRendering.bufMaterials = {} + unitRendering.materialDefs = {} + unitRendering.loadedTextures = {} + featureRendering.drawList = {} + featureRendering.materialInfos = {} + featureRendering.bufMaterials = {} + featureRendering.materialDefs = {} + featureRendering.loadedTextures = {} + + --// load the materials config files + local unitMaterialDefs, featureMaterialDefs = _LoadMaterialConfigFiles(MATERIALS_DIR) + _ProcessMaterials(unitRendering, unitMaterialDefs) + _ProcessMaterials(featureRendering, featureMaterialDefs) + + local features = Spring.GetAllFeatures() + for _,featureID in pairs(features) do + local featureDefID = Spring.GetFeatureDefID(featureID) + local featureMat = featureRendering.materialInfos[featureDefID] + if (featureMat) then + local mat = featureRendering.materialDefs[featureMat[1]] + if (not mat.force) then + gadget:FeatureCreated(featureID,featureDefID) + end + end + end + --// load normalmapped materials + local units = Spring.GetAllUnits() + for _,unitID in pairs(units) do + local unitDefID = Spring.GetUnitDefID(unitID) + local unitMat = unitRendering.materialInfos[unitDefID] + if (unitMat) then + local mat = unitRendering.materialDefs[unitMat[1]] + if (not mat.force) then + gadget:UnitFinished(unitID,unitDefID) + end + end end end + function gadget:Initialize() --// check user configs shadows = Spring.HaveShadows() advShading = Spring.HaveAdvShading() - normalmapping = (Spring.GetConfigInt("NormalMapping", 1)>0) --// load the materials config files - local MATERIALS_DIR = "ModelMaterials/" - if not Spring.Utilities.IsCurrentVersionNewerThan(103, 0) then - MATERIALS_DIR = "ModelMaterials_103/" - end local unitMaterialDefs, featureMaterialDefs = _LoadMaterialConfigFiles(MATERIALS_DIR) + -- Spring.Echo('unitMaterialDefs',to_string(unitMaterialDefs)) + -- Spring.Echo('featureMaterialDefs',to_string(featureMaterialDefs)) --// process the materials (compile shaders, load textures, ...) _ProcessMaterials(unitRendering, unitMaterialDefs) _ProcessMaterials(featureRendering, featureMaterialDefs) @@ -631,4 +803,45 @@ function gadget:Initialize() gadgetHandler:AddSyncAction("unitshaders_reverse", UnitReverseBuilt) gadgetHandler:AddChatAction("normalmapping", ToggleNormalmapping) + gadgetHandler:AddChatAction("treewind", ToggleTreeWind) +end + +function to_string(data, indent) + local str = "" + + if(indent == nil) then + indent = 0 + end + + -- Check the type + if(type(data) == "string") then + str = str .. (" "):rep(indent) .. data .. "\n" + elseif(type(data) == "number") then + str = str .. (" "):rep(indent) .. data .. "\n" + elseif(type(data) == "boolean") then + if(data == true) then + str = str .. "true" + else + str = str .. "false" + end + elseif(type(data) == "table") then + local i, v + for i, v in pairs(data) do + -- Check for a table in a table + if(type(v) == "table") then + str = str .. (" "):rep(indent) .. i .. ":\n" + str = str .. to_string(v, indent + 2) + else + str = str .. (" "):rep(indent) .. i .. ": " .. to_string(v, 0) + end + end + elseif (data ==nil) then + str=str..'nil' + else + --print_debug(1, "Error: unknown data type: %s", type(data)) + str=str.. "Error: unknown data type:" .. type(data) + Spring.Echo('X data type') + end + + return str end \ No newline at end of file diff --git a/LuaRules/Gadgets/camera_lockcamera.lua b/LuaRules/Gadgets/camera_lockcamera.lua index 7665bf06d..1f7573d65 100644 --- a/LuaRules/Gadgets/camera_lockcamera.lua +++ b/LuaRules/Gadgets/camera_lockcamera.lua @@ -18,7 +18,8 @@ end ------------------------------------------------ --broadcast -local broadcastPeriod = 1 --will send packet in this interval (s) + +local broadcastPeriod = 0.0833 --will send packet in this interval (s) ------------------------------------------------ --speedups @@ -54,20 +55,34 @@ local vfsPackU8 = VFS.PackU8 local vfsPackF32 = VFS.PackF32 local vfsUnpackU8 = VFS.UnpackU8 local vfsUnpackF32 = VFS.UnpackF32 +local allowBroadcast = true ------------------------------------------------ --const ------------------------------------------------ local PACKET_HEADER = "=" local PACKET_HEADER_LENGTH = strLen(PACKET_HEADER) +if gadgetHandler:IsSyncedCode() then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end -if gadgetHandler:IsSyncedCode() then + local validation = randomString(2) + _G.validationCam = validation function gadget:RecvLuaMsg(msg, playerID) - if strSub(msg, 1, PACKET_HEADER_LENGTH) ~= PACKET_HEADER then + if strSub(msg, 1, PACKET_HEADER_LENGTH) ~= PACKET_HEADER or strSub(msg, 1+PACKET_HEADER_LENGTH, 1+PACKET_HEADER_LENGTH+1) ~= validation then return end + SendToUnsynced("cameraBroadcast",playerID,msg) return true end @@ -80,6 +95,9 @@ else local CAMERA_IDS = GetCameraNames() local CAMERA_NAMES = {} local CAMERA_STATE_FORMATS = {} + + local validation = SYNCED.validationCam + ------------------------------------------------ --H4X ------------------------------------------------ @@ -191,8 +209,7 @@ else local cameraID = CAMERA_IDS[name] if not stateFormat or not cameraID then return nil end - - local result = PACKET_HEADER .. CustomPackU8(cameraID) .. CustomPackU8(s.mode) + local result = PACKET_HEADER .. validation .. CustomPackU8(cameraID) .. CustomPackU8(s.mode) for i=1, #stateFormat do local num = s[stateFormat[i]] @@ -204,7 +221,7 @@ else end local function PacketToCameraState(p) - local offset = PACKET_HEADER_LENGTH + 1 + local offset = PACKET_HEADER_LENGTH + 1 + 2 local cameraID = CustomUnpackU8(p, offset) local mode = CustomUnpackU8(p, offset + 1) local name = CAMERA_NAMES[cameraID] @@ -212,7 +229,6 @@ else if not (cameraID and mode and name and stateFormat) then return nil end - local result = { name = name, mode = mode, @@ -260,7 +276,7 @@ else function gadget:Initialize() gadgetHandler:AddSyncAction("cameraBroadcast", handleCameraBroadcastEvent) end - + function gadget:Shutdown() SendLuaRulesMsg(PACKET_HEADER) gadgetHandler:RemoveSyncAction("cameraBroadcast") @@ -276,10 +292,10 @@ else return end end - local myPlayerID = GetMyPlayerID() - if myPlayerID == playerID then - --return - end + --local myPlayerID = GetMyPlayerID() + --if myPlayerID == playerID then + -- return + --end local spec, fullView = GetSpectatingState() if not spec or not fullView then local _,_,targetSpec,_,allyTeamID = GetPlayerInfo(playerID) @@ -293,6 +309,10 @@ else end function gadget:Update() + if Spring.GetGameFrame() == 0 then + return + end + local dt = GetLastUpdateSeconds() totalTime = totalTime + dt timeSinceBroadcast = timeSinceBroadcast + dt diff --git a/LuaRules/Gadgets/chicken_overseer.lua b/LuaRules/Gadgets/chicken_overseer.lua deleted file mode 100644 index 87300afcc..000000000 --- a/LuaRules/Gadgets/chicken_overseer.lua +++ /dev/null @@ -1,102 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "Chicken Overseer", - desc = "Chicken Overseer", - author = "TheFatController", - date = "Sep 01, 2013", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true - } -end - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: Chicken Overseer] Activated!") -else - Spring.Echo("[ChickenDefense: Chicken Overseer] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (not gadgetHandler:IsSyncedCode()) then - return false -end - -local OVERSEER = UnitDefNames["chickenh5"].id -local RAGE_BLOB = WeaponDefNames['chickenh5_controlblob'].id -local controlled = {} -local controllers = {} - -function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, projectileID, attackerID, attackerDefID, attackerTeam) - if (weaponID == RAGE_BLOB) and (attackerID) and (not controllers[attackerID]) and (attackerTeam) and (unitTeam) and (not Spring.AreTeamsAllied(attackerTeam,unitTeam)) then - controllers[attackerID] = Spring.GetGameFrame() + 210 - local x,_,z = Spring.GetUnitPosition(unitID) - if (x and z) then - local nearchicks = Spring.GetUnitsInCylinder(x,z,390,attackerTeam) - for i=1, #nearchicks, 1 do - if (nearchicks[i] ~= attackerID) then - Spring.GiveOrderToUnit(nearchicks[i], CMD.ATTACK, {unitID}, {}) - controlled[nearchicks[i]] = attackerID - end - end - local x,_,z = Spring.GetUnitPosition(attackerID) - if (x and z) then - local nearchicks = Spring.GetUnitsInCylinder(x,z,620,attackerTeam) - for i=1, #nearchicks, 1 do - if (nearchicks[i] ~= attackerID) then - Spring.GiveOrderToUnit(nearchicks[i], CMD.ATTACK, {unitID}, {}) - controlled[nearchicks[i]] = attackerID - end - end - end - end - end - return damage,1 -end - -function gadget:GameFrame(n) - for id,t in pairs(controllers) do - if (n > t) then - controlled[id] = nil - controllers[id] = nil - end - end -end - -function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) - if (controllers[unitID]) then - for id,c in pairs(controlled) do - if (c == unitID) and Spring.ValidUnitID(id) then - Spring.GiveOrderToUnit(id, CMD.STOP, {}, {}) - end - end - controllers[unitID] = nil - end - controlled[unitID] = nil -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/chicken_progenitor.lua b/LuaRules/Gadgets/chicken_progenitor.lua deleted file mode 100644 index a33dab258..000000000 --- a/LuaRules/Gadgets/chicken_progenitor.lua +++ /dev/null @@ -1,118 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "ProgenitorSpawner", - desc = "Manages Splitting Chickens", - author = "TheFatController", - date = "05 November, 2008", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: ProgenitorSpawner] Activated!") -else - Spring.Echo("[ChickenDefense: ProgenitorSpawner] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (gadgetHandler:IsSyncedCode()) then - -local GetGameRulesParam = Spring.GetGameRulesParam -local GetUnitPosition = Spring.GetUnitPosition -local TestBuildOrder = Spring.TestBuildOrder -local GetGroundBlocked = Spring.GetGroundBlocked -local CreateUnit = Spring.CreateUnit -local GiveOrderToUnit = Spring.GiveOrderToUnit -local BOSS_WHITE1 = UnitDefNames["chickenh2"].id -local BOSS_WHITE2 = UnitDefNames["chickenh3"].id -local SMALLUNIT = UnitDefNames["chicken1"].id -local progList = {} - -local function getChickenSpawnLoc(unitID) - local x, z - local bx, by, bz = GetUnitPosition(unitID) - if (not bx or not by or not bz) then - return false - end - - local tries = 0 - local s = 64 - - repeat - x = math.random(bx - s, bx + s) - z = math.random(bz - s, bz + s) - s = s + 4 - tries = tries + 1 - until ((TestBuildOrder(SMALLUNIT, x, by, z, 1) == 2) and (not GetGroundBlocked(x, z))) - or (tries > 10) - - return x, by, z - -end - -local function spawnChicken(number, ownerID, unitName, unitTeam) - for i = 1,number,1 do - local x, y, z = getChickenSpawnLoc(ownerID) - if x then - local newChicken = CreateUnit(unitName, x,y,z, "n", unitTeam) - GiveOrderToUnit(newChicken, CMD.STOP, {}, {}) - end - end -end - -function gadget:GameFrame(n) - if n%350 == 0 then - for unitID, count in pairs(progList) do - if Spring.ValidUnitID(unitID) and (count > 0) then - spawnChicken(1, unitID, "chickenh3", Spring.GetUnitTeam(unitID)) - progList[unitID] = (count - 1) - else - progList[unitID] = nil - end - end - end -end - -function gadget:UnitCreated(unitID, unitDefID, unitTeam) - if (unitDefID == BOSS_WHITE1) then - progList[unitID] = 6 - end -end - -function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) - if (unitDefID == BOSS_WHITE1) then - progList[unitID] = nil - Spring.SetUnitBlocking(unitID, false, false) - spawnChicken(2, unitID, "chickenh3", unitTeam) - elseif (unitDefID == BOSS_WHITE2) then - Spring.SetUnitBlocking(unitID, false, false) - spawnChicken(2, unitID, "chickenh4", unitTeam) - end -end - -end \ No newline at end of file diff --git a/LuaRules/Gadgets/chicken_spawner_defense.lua b/LuaRules/Gadgets/chicken_spawner_defense.lua deleted file mode 100644 index d45c2f06d..000000000 --- a/LuaRules/Gadgets/chicken_spawner_defense.lua +++ /dev/null @@ -1,1637 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "Chicken Defense Spawner", - desc = "Spawns burrows and chickens", - author = "TheFatController/quantum", - date = "27 February, 2012", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: Chicken Defense Spawner] Activated!") -else - Spring.Echo("[ChickenDefense: Chicken Defense Spawner] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -if (gadgetHandler:IsSyncedCode()) then --- BEGIN SYNCED --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Speed-ups --- - -local GetUnitHeading = Spring.GetUnitHeading -local ValidUnitID = Spring.ValidUnitID -local GetUnitNeutral = Spring.GetUnitNeutral -local GetTeamList = Spring.GetTeamList -local GetTeamLuaAI = Spring.GetTeamLuaAI -local GetGaiaTeamID = Spring.GetGaiaTeamID -local SetGameRulesParam = Spring.SetGameRulesParam -local GetGameRulesParam = Spring.GetGameRulesParam -local GetTeamUnitsCounts = Spring.GetTeamUnitsCounts -local GetTeamUnitCount = Spring.GetTeamUnitCount -local GetGameFrame = Spring.GetGameFrame -local GetPlayerList = Spring.GetPlayerList -local GetPlayerInfo = Spring.GetPlayerInfo -local GetGameSeconds = Spring.GetGameSeconds -local DestroyUnit = Spring.DestroyUnit -local GetTeamUnits = Spring.GetTeamUnits -local GetUnitsInCylinder = Spring.GetUnitsInCylinder -local GetUnitNearestEnemy = Spring.GetUnitNearestEnemy -local GetUnitPosition = Spring.GetUnitPosition -local GiveOrderToUnit = Spring.GiveOrderToUnit -local TestBuildOrder = Spring.TestBuildOrder -local GetGroundBlocked = Spring.GetGroundBlocked -local CreateUnit = Spring.CreateUnit -local SetUnitBlocking = Spring.SetUnitBlocking -local GetGroundHeight = Spring.GetGroundHeight -local GetUnitTeam = Spring.GetUnitTeam -local GetUnitHealth = Spring.GetUnitHealth -local GetUnitCommands = Spring.GetUnitCommands -local SetUnitExperience = Spring.SetUnitExperience -local GetUnitDefID = Spring.GetUnitDefID -local SetUnitHealth = Spring.SetUnitHealth -local GetUnitIsDead = Spring.GetUnitIsDead -local GetCommandQueue = Spring.GetCommandQueue -local GetUnitDirection = Spring.GetUnitDirection - -local mRandom = math.random -local math = math -local Game = Game -local table = table -local ipairs = ipairs -local pairs = pairs - -local MAPSIZEX = Game.mapSizeX -local MAPSIZEZ = Game.mapSizeZ -local DMAREA = 160 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local survivalQueenMod = 0.8 -local queenLifePercent = 100 -local maxTries = 30 -local oldMaxChicken = 0 -local oldDamageMod = 1 -local currentWave = 1 -local lastWave = 1 -local targetCache = 1 -local minBurrows = 1 -local timeOfLastSpawn = 0 -local timeOfLastFakeSpawn = 0 -local timeOfLastWave = 0 -local expMod = 0 -local burrowTarget = 0 -local qDamage = 0 -local lastTeamID = 0 -local targetCacheCount = 0 -local nextSquadSize = 0 -local chickenCount = 0 -local t = 0 -- game time in seconds -local timeCounter = 0 -local queenAnger = 0 -local burrowSpawnProgress = 0 -local queenMaxHP = 0 -local chickenDebtCount = 0 -local burrowAnger = 0 -local firstSpawn = true -local gameOver = nil -local qMove = false -local warningMessage = false -local ascendingQueen = false -local nextQueenSpawn = nil -local computerTeams = {} -local humanTeams = {} -local disabledUnits = {} -local spawnQueue = {} -local deathQueue = {} -local idleOrderQueue = {} -local queenResistance = {} -local stunList = {} -local queenID -local chickenTeamID -local luaAI -local lsx1,lsz1,lsx2,lsz2 -local turrets = {} -local chickenBirths = {} -local failChickens = {} -local chickenTargets = {} -local burrows = {} -local failBurrows = {} -local heroChicken = {} -local defenseMap = {} - -do -- load config file - local CONFIG_FILE = "LuaRules/Configs/spawn_defs.lua" - local VFSMODE = VFS.RAW_FIRST - local s = assert(VFS.LoadFile(CONFIG_FILE, VFSMODE)) - local chunk = assert(loadstring(s, file)) - setfenv(chunk, gadget) - chunk() -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Teams --- - -local modes = { - [1] = VERYEASY, - [2] = EASY, - [3] = NORMAL, - [4] = HARD, - [5] = VERYHARD, - [6] = EPIC, - [7] = CUSTOM, - [8] = SURVIVAL, -} - -local function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',\n' - end - return s .. '} ' - else - return tostring(o) - end -end ---Spring.Echo(VERYEASY) - -for i, v in ipairs(modes) do -- make it bi-directional - modes[v] = i -end - -local teams = GetTeamList() -local highestLevel = 0 -for _, teamID in ipairs(teams) do - local teamLuaAI = GetTeamLuaAI(teamID) - if (teamLuaAI and teamLuaAI ~= "") then - luaAI = teamLuaAI - if (modes[teamLuaAI] > highestLevel) then -- get chicken ai with highest level - highestLevel = modes[teamLuaAI] - end - chickenTeamID = teamID - computerTeams[teamID] = true - else - humanTeams[teamID] = true - end -end - -luaAI = modes[highestLevel] - -local gaiaTeamID = GetGaiaTeamID() -if not chickenTeamID then - chickenTeamID = gaiaTeamID - - warningMessage = true -else - computerTeams[gaiaTeamID] = nil -end - -humanTeams[gaiaTeamID] = nil - -if (modes[highestLevel] and luaAI == 0) then - return false -end - -SetGameRulesParam("chickenTeamID", chickenTeamID) --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Utility --- - -local function SetToList(set) - local list = {} - for k in pairs(set) do - table.insert(list, k) - end - return list -end - - -local function SetCount(set) - local count = 0 - for k in pairs(set) do - count = count + 1 - end - return count -end - -local function getSqrDistance(x1,z1,x2,z2) - local dx,dz = x1-x2,z1-z2 - return (dx*dx)+(dz*dz) -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Difficulty --- - -local function SetGlobals(difficulty) - for key, value in pairs(gadget.difficulties[difficulty]) do - gadget[key] = value - end - gadget.difficulties = nil -end - -SetGlobals(luaAI or "Chicken: Normal") -- set difficulty - -if (queenName == "asc") then - queenName = "ve_chickenq" - ascendingQueen = true -end - -local expIncrement = ((SetCount(humanTeams) * expStep) / queenTime) -if expStep < 0 then expIncrement = ((expStep * -1) / queenTime) end -local nextWave = ((queenTime / 10) / 60) -local gracePenalty = math.max(math.floor(((gracePeriod - 270) / burrowSpawnRate) + 0.5), 0) -chickensPerPlayer = (chickensPerPlayer * SetCount(humanTeams)) -maxBurrows = maxBurrows + math.floor(SetCount(humanTeams) * 1.334) -queenTime = (queenTime + gracePeriod) -chickenDebtCount = math.ceil((math.max((gracePeriod - 270),0) / 3)) --- eggChance scales - 20% at 0-300 grace, 10% at 400 grace, 0% at 500+ grace -local eggChance = 0.20 * math.max(0, math.min(1, (500-gracePeriod)/200)) -local bonusEggs = math.ceil(24 * math.max(0, math.min(1, (500-gracePeriod)/200))) - -if (modes[highestLevel] == EPIC) then - gracePenalty = gracePenalty + 15 - maxBurrows = math.max(maxBurrows * 1.5, 50) - chickenDebtCount = math.max(chickenDebtCount, 150) - expMod = 1 -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Game Rules --- - -local UPDATE = 16 - -local unitCounts = {} - -local chickenDefTypes = {} -for unitName in pairs(chickenTypes) do - chickenDefTypes[UnitDefNames[unitName].id] = unitName - unitCounts[string.sub(unitName,1,-2)] = {count = 0, lastCount = 0} -end - -local defendersDefs = {} -for unitName in pairs(defenders) do - defendersDefs[UnitDefNames[unitName].id] = unitName -end - -local function SetupUnit(unitName) - SetGameRulesParam(unitName.."Count", 0) - SetGameRulesParam(unitName.."Kills", 0) -end - -SetGameRulesParam("queenTime", queenTime) -SetGameRulesParam("queenLife", queenLifePercent) -SetGameRulesParam("queenAnger", queenAnger) -SetGameRulesParam("gracePeriod", gracePeriod) - -for unitName in pairs(chickenTypes) do - SetupUnit(string.sub(unitName,1,-2)) -end - -for unitName in pairs(defenders) do - SetupUnit(string.sub(unitName,1,-2)) -end - -SetupUnit(burrowName) - -local difficulty = modes[luaAI] or 3 -SetGameRulesParam("difficulty", difficulty) - -local function UpdateUnitCount() - local teamUnitCounts = GetTeamUnitsCounts(chickenTeamID) - local total = 0 - - for shortName in pairs(unitCounts) do - unitCounts[shortName].count = 0 - end - - for unitDefID, number in pairs(teamUnitCounts) do - if UnitDefs[unitDefID] then - local shortName = string.match(UnitDefs[unitDefID].name,"%D*") - if unitCounts[shortName] then - unitCounts[shortName].count = unitCounts[shortName].count + number - end - end - end - - for shortName, counts in pairs(unitCounts) do - if (counts.count ~= counts.lastCount) then - SetGameRulesParam(shortName.."Count", counts.count) - counts.lastCount = counts.count - end - total = total + counts.count - end - - return total -end - -local EMP_GOO = {} -EMP_GOO[WeaponDefNames['chickenr1_goolauncher'].id] = WeaponDefNames['chickenr1_goolauncher'].damages[1] -EMP_GOO[WeaponDefNames['weaver_death'].id] = WeaponDefNames['weaver_death'].damages[1] -local LOBBER = UnitDefNames["chickenr1"].id -local SKIRMISH = { - [UnitDefNames["chickens1"].id] = { distance = 270, chance = 0.33 }, - [UnitDefNames["chickens2"].id] = { distance = 620, chance = 0.5 }, - [UnitDefNames["chickenf2"].id] = { distance = 2000, chance = 0.5 }, - [UnitDefNames["chickenw1b"].id] = { distance = 900, chance = 0.33 }, - [UnitDefNames["chickens3"].id] = { distance = 440, chance = 0.1 }, - [UnitDefNames["chickenh5"].id] = { distance = 300, chance = 0.5 } -} -local COWARD = { - [UnitDefNames["chickenh1"].id] = { distance = 300, chance = 0.5 }, - [UnitDefNames["chickenh1b"].id] = { distance = 15, chance = 0.1 }, - [UnitDefNames["chickenr1"].id] = { distance = 300, chance = 0.33 }, - [UnitDefNames["chickenw1c"].id] = { distance = 900, chance = 0.33 }, - [UnitDefNames["chickenh5"].id] = { distance = 600, chance = 0.5 } -} -local EGG_DROPPER = { - [UnitDefNames["chicken1"].id] = "chicken_egg", - [UnitDefNames["chicken1b"].id] = "chicken_eggb", - [UnitDefNames["chicken1c"].id] = "chicken_eggc", - [UnitDefNames["chicken1d"].id] = "chicken_eggd", -} -local OVERSEER_ID = UnitDefNames["chickenh5"].id -local SMALL_UNIT = UnitDefNames["chicken1"].id -local MEDIUM_UNIT = UnitDefNames["chicken1"].id -local LARGE_UNIT = UnitDefNames["chicken1"].id - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Clean up --- - -local function KillOldChicken() - for unitID, defs in pairs(chickenBirths) do - if (t > defs.deathDate) then - if (unitID ~= queenID) then - deathQueue[unitID] = { selfd = false, reclaimed = false } - chickenCount = chickenCount - 1 - chickenDebtCount = chickenDebtCount + 1 - local failCount = failBurrows[defs.burrowID] - if (failBurrows[defs.burrowID] == nil) then - failBurrows[defs.burrowID] = 5 - else - failBurrows[defs.burrowID] = failCount + 5 - end - end - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Game End Stuff --- - -local function KillAllChicken() - local chickenUnits = GetTeamUnits(chickenTeamID) - for _, unitID in pairs(chickenUnits) do - if disabledUnits[unitID] then - DestroyUnit(unitID, false, true) - else - DestroyUnit(unitID, true) - end - end -end - - -local function KillAllComputerUnits() - for teamID in pairs(computerTeams) do - local teamUnits = GetTeamUnits(teamID) - for _, unitID in pairs(teamUnits) do - if disabledUnits[unitID] then - DestroyUnit(unitID, false, true) - else - DestroyUnit(unitID, true) - end - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Spawn Dynamics --- - -local function addChickenTarget(chickenID, targetID) - if (not targetID) or (GetUnitTeam(targetID) == chickenTeamID) or (GetUnitTeam(chickenID) ~= chickenTeamID) then return end - --debug--Spring.Echo(t .. " addChickenTarget " .. chickenID .. "," .. targetID) - if chickenTargets[chickenID] and chickenTargets[chickenTargets[chickenID]] then - chickenTargets[chickenTargets[chickenID]][chickenID] = nil - end - if (chickenTargets[targetID] == nil) then - chickenTargets[targetID] = {} - chickenTargets[targetID][chickenID] = targetID - chickenTargets[chickenID] = targetID - else - chickenTargets[targetID][chickenID] = targetID - chickenTargets[chickenID] = targetID - end -end - -local function AttackNearestEnemy(unitID, unitDefID, unitTeam) - local targetID = GetUnitNearestEnemy(unitID) - if (targetID) and (not GetUnitIsDead(targetID)) and (not GetUnitNeutral(targetID)) then - local defID = GetUnitDefID(targetID) - local myDefID = GetUnitDefID(unitID) - if UnitDefs[defID] and UnitDefs[myDefID] and (UnitDefs[myDefID].speed < (UnitDefs[defID].speed * 1.15)) then - return false - end - local x,y,z = GetUnitPosition(targetID) - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = {x,y,z}, opts = {}} - addChickenTarget(unitID, targetID) - return true - else - return false - end -end - --- returns a random map position -local function getRandomMapPos() - local x = math.random(MAPSIZEX-16) - local z = math.random(MAPSIZEZ-16) - local y = GetGroundHeight(x, z) - return {x, y, z} -end - --- selects a enemy target -local function ChooseTarget() - local humanTeamList = SetToList(humanTeams) - if (#humanTeamList == 0) or gameOver then - return getRandomMapPos() - end - if targetCache and ((targetCacheCount >= nextSquadSize) or GetUnitIsDead(targetCache)) then - local tries = 0 - repeat - local teamID = humanTeamList[mRandom(#humanTeamList)] - if (teamID == lastTeamID) then - teamID = humanTeamList[mRandom(#humanTeamList)] - end - lastTeamID = teamID - local units = GetTeamUnits(teamID) - if units[2] then - targetCache = units[mRandom(1,#units)] - else - targetCache = units[1] - end - local slowunit = true - if targetCache and tries < 5 then - local defID = GetUnitDefID(targetCache) - if UnitDefs[defID] and (UnitDefs[defID].speed > 75) then - slowunit = false - end - end - tries = (tries + 1) - until (targetCache and (not GetUnitIsDead(targetCache)) and (not GetUnitNeutral(targetCache)) and slowunit) or (tries > maxTries) - targetCacheCount = 0 - nextSquadSize = 6 + mRandom(0,4) - else - targetCacheCount = targetCacheCount + 1 - end - if not targetCache then -- no target could be found, use random map pos - return getRandomMapPos() - end - if (mRandom(100) < 50) then - local angle = math.rad(mRandom(1,360)) --- Spring.Echo(targetCache) - local x,y,z = GetUnitPosition(targetCache) - if not x or not y or not z then - Spring.Echo("Invalid pos in GetUnitPosition: " .. tostring(targetCache)) - return getRandomMapPos() - end - local distance = mRandom(50,900) - x = math.min(math.max(x - (math.sin(angle) * distance),16),MAPSIZEX-16) - z = math.min(math.max(z - (math.cos(angle) * distance),16),MAPSIZEZ-16) - return {x,y,z} - else - return {GetUnitPosition(targetCache)} - end -end - -local function getChickenSpawnLoc(burrowID, size) - local x, y, z - local bx, by, bz = GetUnitPosition(burrowID) - if (not bx or not bz) then - return false - end - - local tries = 0 - local s = spawnSquare - - repeat - x = mRandom(bx - s, bx + s) - z = mRandom(bz - s, bz + s) - s = s + spawnSquareIncrement - tries = tries + 1 - if (x >= MAPSIZEX) then x = (MAPSIZEX - mRandom(1,40)) elseif (x <= 0) then x = mRandom(1,40) end - if (z >= MAPSIZEZ) then z = (MAPSIZEZ - mRandom(1,40)) elseif (z <= 0) then z = mRandom(1,40) end - until ((TestBuildOrder(size, x, by, z, 1) == 2) and (not GetGroundBlocked(x, z))) or (tries > maxTries) - - y = GetGroundHeight(x,z) - return x, y, z - -end - - -local function SpawnTurret(burrowID, turret) - - if (mRandom() > defenderChance) or (not turret) or (burrows[burrowID] >= maxTurrets) then - return - end - - local x, y, z - local bx, by, bz = GetUnitPosition(burrowID) - if (not bx) then - return - end - local tries = 0 - local s = spawnSquare - - repeat - x = mRandom(bx - s, bx + s) - z = mRandom(bz - s, bz + s) - s = s + spawnSquareIncrement - tries = tries + 1 - if (x >= MAPSIZEX) then x = (MAPSIZEX - mRandom(1,40)) elseif (x <= 0) then x = mRandom(1,40) end - if (z >= MAPSIZEZ) then z = (MAPSIZEZ - mRandom(1,40)) elseif (z <= 0) then z = mRandom(1,40) end - until (not GetGroundBlocked(x, z) or tries > maxTries) - - y = GetGroundHeight(x,z) - local unitID = CreateUnit(turret, x, y, z, "n", chickenTeamID) - if unitID then - idleOrderQueue[unitID] = {cmd = CMD.PATROL, params = {bx, by, bz}, opts = { "meta" }} - SetUnitBlocking(unitID, false, false) - SetUnitExperience(unitID, mRandom() * expMod) - turrets[unitID] = {burrowID, t} - burrows[burrowID] = burrows[burrowID] + 1 - end - -end - - -local function SpawnBurrow(number) - - if (queenID) then -- don't spawn new burrows when queen is there - return - end - - local unitDefID = UnitDefNames[burrowName].id - - for i=1, (number or 1) do - local x, z, y - local tries = 0 - repeat - if (burrowSpawnType == "initialbox") then - x = mRandom(lsx1, lsx2) - z = mRandom(lsz1, lsz2) - elseif ((burrowSpawnType == "alwaysbox") and (tries < maxTries)) then - x = mRandom(lsx1, lsx2) - z = mRandom(lsz1, lsz2) - elseif (burrowSpawnType == "initialbox_post") then - lsx1 = math.max(lsx1 * 0.975, spawnSquare) - lsz1 = math.max(lsz1 * 0.975, spawnSquare) - lsx2 = math.min(lsx2 * 1.025, MAPSIZEX - spawnSquare) - lsz2 = math.min(lsz2 * 1.025, MAPSIZEZ - spawnSquare) - x = mRandom(lsx1, lsx2) - z = mRandom(lsz1, lsz2) - else - x = mRandom(spawnSquare, MAPSIZEX - spawnSquare) - z = mRandom(spawnSquare, MAPSIZEZ - spawnSquare) - end - - y = GetGroundHeight(x, z) - tries = tries + 1 - local blocking = TestBuildOrder(MEDIUM_UNIT, x, y, z, 1) - if (blocking == 2) and ((burrowSpawnType == "avoid") or (burrowSpawnType == "initialbox_post")) then - local proximity = GetUnitsInCylinder(x, z, minBaseDistance) - local vicinity = GetUnitsInCylinder(x, z, maxBaseDistance) - local humanUnitsInVicinity = false - local humanUnitsInProximity = false - for i=1, #vicinity, 1 do - if (GetUnitTeam(vicinity[i]) ~= chickenTeamID) then - humanUnitsInVicinity = true - break - end - end - - for i=1, #proximity ,1 do - if (GetUnitTeam(proximity[i]) ~= chickenTeamID) then - humanUnitsInProximity = true - break - end - end - - if (humanUnitsInProximity or not humanUnitsInVicinity) then - blocking = 1 - end - end - until (blocking == 2 or tries > (maxTries * 2)) - - local unitID = CreateUnit(burrowName, x, y, z, "n", chickenTeamID) - if (unitID) then - burrows[unitID] = 0 - SetUnitBlocking(unitID, false, false) - SetUnitExperience(unitID, mRandom() * expMod) - end - end - -end - -local function updateQueenLife() - if not queenID then - return - end - local curH, maxH = GetUnitHealth(queenID) - local lifeCheck = math.ceil(((curH/maxH)*100)-0.5) - if queenLifePercent ~= lifeCheck then -- health changed since last update, update it - queenLifePercent = lifeCheck - SetGameRulesParam("queenLife", queenLifePercent) - end -end - -local function stunUnit(unitID, seconds) - local f = GetGameFrame() - seconds = f + (seconds * 30) - if stunList[unitID] then seconds = math.max(stunList[unitID], seconds) end - stunList[unitID] = seconds - SetUnitHealth(unitID, {paralyze=99999999}) -end - -local function SpawnQueen() - - if (nextQueenSpawn ~= nil) then - return CreateUnit(queenName, nextQueenSpawn.x, nextQueenSpawn.y, nextQueenSpawn.z, "n", chickenTeamID) - end - - local bestScore = 0 - local sx,sy,sz - for burrowID, turretCount in pairs(burrows) do - -- Try to spawn the queen at the 'best' burrow - local x,y,z = GetUnitPosition(burrowID) - if x and y and z then - local score = 0 - score = score + (mRandom() * turretCount) - if failBurrows[burrowID] then - score = score - (failBurrows[burrowID] * 5) - end - if (score>bestScore) then - bestScore = score - sx = x - sy = y - sz = z - end - end - end - - if sx and sy and sz then - return CreateUnit(queenName, sx, sy, sz, "n", chickenTeamID) - end - - local x, y, z - local tries = 0 - - repeat - x = mRandom(1, (MAPSIZEX-1)) - z = mRandom(1, (MAPSIZEZ-1)) - y = GetGroundHeight(x, z) - tries = tries + 1 - local blocking = TestBuildOrder(LARGE_UNIT, x, y, z, 1) - - local proximity = GetUnitsInCylinder(x, z, minBaseDistance) - local vicinity = GetUnitsInCylinder(x, z, maxBaseDistance) - local humanUnitsInVicinity = false - local humanUnitsInProximity = false - - for i=1, #vicinity, 1 do - if (GetUnitTeam(vicinity[i]) ~= chickenTeamID) then - humanUnitsInVicinity = true - break - end - end - - for i=1, #proximity,1 do - if (GetUnitTeam(proximity[i]) ~= chickenTeamID) then - humanUnitsInProximity = true - break - end - end - - if (humanUnitsInProximity or not humanUnitsInVicinity) then - blocking = 1 - end - - until (blocking == 2 or tries > (maxTries * 3)) - - return CreateUnit(queenName, x, y, z, "n", chickenTeamID) - -end - - -local function Wave() - --debug--Spring.Echo(t .. "Wave()") - - if gameOver then return end - - currentWave = math.min(math.ceil((((t-gracePeriod) / 60) / nextWave)), 10) - - if currentWave > #waves then currentWave = #waves end - - if (currentWave == 10) then - COWARD[UnitDefNames["chickenc1"].id] = { distance = 700, chance = 0.1 } - end - - local cCount = 0 - - if queenID then -- spawn units from queen - if queenSpawnMult > 0 then - for i = 1,queenSpawnMult,1 do - local squad = waves[9][mRandom(1,#waves[9])] - for i,sString in pairs(squad) do - local nEnd,_ = string.find(sString, " ") - local unitNumber = string.sub(sString,1,(nEnd-1)) - local chickenName = string.sub(sString,(nEnd+1)) - for i = 1,unitNumber,1 do - table.insert(spawnQueue, {burrow = queenID, unitName = chickenName, team = chickenTeamID}) - end - cCount = cCount + unitNumber - end - end - end - return cCount - end - - for burrowID in pairs(burrows) do - if (t > (queenTime * 0.15)) then SpawnTurret(burrowID, bonusTurret) end - local squad = waves[currentWave][mRandom(1,#waves[currentWave])] - if ((lastWave ~= currentWave) and (newWaveSquad[currentWave])) then - squad = newWaveSquad[currentWave] - lastWave = currentWave - end - for i,sString in pairs(squad) do - local skipSpawn = false - if (cCount > chickensPerPlayer) and (mRandom() > spawnChance) then skipSpawn = true end - if skipSpawn and (chickenDebtCount > 0) and (mRandom() > spawnChance) then - chickenDebtCount = (chickenDebtCount - 1) - skipSpawn = false - end - if not skipSpawn then - local nEnd,_ = string.find(sString, " ") - local unitNumber = string.sub(sString,1,(nEnd-1)) - local chickenName = string.sub(sString,(nEnd+1)) - for i = 1,unitNumber,1 do - table.insert(spawnQueue, {burrow = burrowID, unitName = chickenName, team = chickenTeamID}) - end - cCount = cCount + unitNumber - end - end - end - return cCount -end - - -function removeFailChickens() - for unitID, failCount in pairs(failBurrows) do - if (failCount > 30) then - deathQueue[unitID] = { selfd = false, reclaimed = false } - burrows[unitID] = nil - failBurrows[unitID] = nil - for i,defs in pairs(spawnQueue) do - if (defs.burrow == unitID) then - spawnQueue[i] = nil - end - end - SpawnBurrow() - end - end - for unitID, failCount in pairs(failChickens) do - local checkedForDT = false - if (unitID ~= queenID) or (GetUnitTeam(unitID) ~= chickenTeamID) then - if (failCount > 5) then - local x,y,z = GetUnitPosition(unitID) - local yh = GetGroundHeight(x,z) - if y and yh and (y < (yh+1)) then - deathQueue[unitID] = { selfd = false, reclaimed = true } - chickenCount = chickenCount - 1 - chickenDebtCount = chickenDebtCount + 1 - if chickenBirths[unitID] then - local burrowFailCount = failBurrows[chickenBirths[unitID].burrowID] - if (burrowFailCount == nil) then - failBurrows[chickenBirths[unitID].burrowID] = 1 - else - failBurrows[chickenBirths[unitID].burrowID] = burrowFailCount + 1 - end - end - end - elseif (failCount > 2) then - local x,y,z = GetUnitPosition(unitID) - local attackingFeature = false - if (not checkedForDT) then - checkedForDT = true - local nearFeatures = Spring.GetFeaturesInSphere(x,y,z,70) - for i,featureID in ipairs(nearFeatures) do - local featureDefID = Spring.GetFeatureDefID(featureID) - if (featureDefID) and (FeatureDefs[featureDefID].metal > 0) and (not FeatureDefs[featureDefID].autoReclaimable) then - local fx,fy,fz = Spring.GetFeaturePosition(featureID) - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {fx,fy,fz}, opts = {}} - attackingFeature = true - break - end - end - end - if (not attackingFeature) then - local dx,_,dz = GetUnitDirection(unitID) - local angle = math.atan2(dx,dz) - Spring.SpawnCEG("blood_trail",x,y,z,0,0,0) - if (y < -15) then - deathQueue[unitID] = { selfd = false, reclaimed = false } - chickenCount = chickenCount - 1 - chickenDebtCount = chickenDebtCount + 1 - if chickenBirths[unitID] then - local burrowFailCount = failBurrows[chickenBirths[unitID].burrowID] - if (burrowFailCount == nil) then - failBurrows[chickenBirths[unitID].burrowID] = 3 - else - failBurrows[chickenBirths[unitID].burrowID] = burrowFailCount + 3 - end - end - end - Spring.AddUnitImpulse(unitID, math.sin(angle) * 2, 2.5, math.cos(angle) * 2, 100) - end - end - end - failChickens = {} - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Get rid of the AI --- - -local function DisableUnit(unitID) - Spring.MoveCtrl.Enable(unitID) - Spring.MoveCtrl.SetNoBlocking(unitID, true) - Spring.MoveCtrl.SetPosition(unitID, Game.mapSizeX+500, 2000, Game.mapSizeZ+500) --don't move too far out or prevent_aicraft_hax will explode it! - --Spring.SetUnitCloak(unitID, true) - Spring.SetUnitHealth(unitID, {paralyze=99999999}) - Spring.SetUnitNoDraw(unitID, true) - Spring.SetUnitStealth(unitID, true) - Spring.SetUnitNoSelect(unitID, true) - Spring.SetUnitNoMinimap(unitID, true) - Spring.GiveOrderToUnit(unitID, CMD.MOVE_STATE, { 0 }, {}) - Spring.GiveOrderToUnit(unitID, CMD.FIRE_STATE, { 0 }, {}) - disabledUnits[unitID] = true -end - -local function DisableComputerUnits() - for teamID in pairs(computerTeams) do - local teamUnits = GetTeamUnits(teamID) - for _, unitID in ipairs(teamUnits) do - DisableUnit(unitID) - end - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Call-ins --- - -function gadget:UnitIdle(unitID, unitDefID, unitTeam) - if (unitTeam ~= chickenTeamID) or (not chickenDefTypes[unitDefID]) then -- filter out non chicken units - return - end - local failCount = failChickens[unitID] - if (failCount == nil) then - if (unitID ~= queenID) then - failChickens[unitID] = 1 - end - else - failChickens[unitID] = failCount + 1 - end - -- Spring.Echo(t .. " unitIdle " .. unitID) - if AttackNearestEnemy(unitID, unitDefID, unitTeam) then - return - end - local chickenParams = ChooseTarget() - if targetCache then - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = chickenParams, opts = {}} - if GetUnitNeutral(targetCache) then - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {targetCache}, opts = {}} - end - addChickenTarget(unitID, targetCache) - end -end - -function gadget:UnitCreated(unitID, unitDefID, unitTeam) - if (unitTeam == chickenTeamID) or (chickenDefTypes[unitDefID]) then -- filter out chicken units - return - end - if chickenTargets[unitID] then - chickenTargets[unitID] = nil - end -end - -function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, - weaponID, projectileID, attackerID, attackerDefID, attackerTeam) - - if disabledUnits[unitID] then - return 0,0 - end - - if (attackerTeam == chickenTeamID) then - return (damage * damageMod) - end - - if (heroChicken[unitID]) then - damage = (damage * heroChicken[unitID]) - local x,y,z = GetUnitPosition(unitID) - Spring.SpawnCEG("CHICKENHERO", x,y,z,0,0,0) - end - - if (unitID == queenID) then -- special case queen - if (weaponID == -1) and (damage > 25000) then - return 25000 - end - if attackerDefID then - if not queenResistance[weaponID] then - queenResistance[weaponID] = {} - queenResistance[weaponID].damage = damage - queenResistance[weaponID].notify = 0 - end - local resistPercent = (math.min(queenResistance[weaponID].damage/queenMaxHP, 0.75) + 0.2) - if resistPercent > 0.35 then - if queenResistance[weaponID].notify == 0 then - --Bruh, just because you call a variable "WeaponName" doesn't mean that it magically goes and gets the weaponname from the def - --local weaponName - Spring.Echo("The Queen is becoming resistant to " .. UnitDefs[attackerDefID].humanName .. "'s attacks!") - queenResistance[weaponID].notify = 1 - for i = 1,12,1 do - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenw2", team = chickenTeamID}) - end - for i = 1,4,1 do - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh1", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh1b", team = chickenTeamID}) - end - end - damage = damage - (damage * resistPercent) - end - queenResistance[weaponID].damage = queenResistance[weaponID].damage + damage - return damage - end - end - return damage -end - -function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, - weaponID, projectileID, attackerID, attackerDefID, attackerTeam) - - if EMP_GOO[weaponID] and (unitTeam ~= chickenTeamID) and (lobberEMPTime > 0) then - stunUnit(unitID, ((damage / EMP_GOO[weaponID]) * lobberEMPTime)) - end - - if chickenBirths[attackerID] then chickenBirths[attackerID].deathDate = (t + maxAge) end - if failChickens[attackerID] then failChickens[attackerID] = nil end - if failChickens[unitID] then failChickens[unitID] = nil end - - if SKIRMISH[attackerDefID] and (unitTeam ~= chickenTeamID) and attackerID and (mRandom() < SKIRMISH[attackerDefID].chance) then - local ux,_,uz = GetUnitPosition(unitID) - local x,y,z = GetUnitPosition(attackerID) - if x and ux then - local angle = math.atan2(ux-x,uz-z) - idleOrderQueue[attackerID] = {cmd = CMD.MOVE, params = {x - (math.sin(angle) * SKIRMISH[attackerDefID].distance),y,z - (math.cos(angle) * SKIRMISH[attackerDefID].distance)}, opts = {}} - end - elseif COWARD[unitDefID] and (not idleOrderQueue[unitID]) and (unitTeam == chickenTeamID) and attackerID and (mRandom() < COWARD[unitDefID].chance) then - local curH, maxH = GetUnitHealth(unitID) - if curH and maxH and curH < (maxH * 0.8) then - local ax,_,az = GetUnitPosition(attackerID) - local x,y,z = GetUnitPosition(unitID) - if x and ax then - local angle = math.atan2(ax-x,az-z) - idleOrderQueue[unitID] = {cmd = CMD.MOVE, params = {x - (math.sin(angle) * COWARD[unitDefID].distance),y,z - (math.cos(angle) * COWARD[unitDefID].distance)}, opts = {}} - end - end - end - - if (unitDefID == LOBBER) then - local nSpawn = false - if ((GetUnitHealth(unitID) < 2475) and (damage < (2000 + mRandom(1,500)))) then nSpawn = true end - if nSpawn then - local bx, by, bz = GetUnitPosition(unitID) - local h = GetUnitHeading(unitID) - SetUnitBlocking(unitID, false, false) - local newUnitID = CreateUnit("chickenr2", bx, by, bz, "n", unitTeam) - Spring.SetUnitNoDraw(newUnitID,true) - Spring.MoveCtrl.Enable(newUnitID) - Spring.MoveCtrl.SetHeading(newUnitID, h) - Spring.MoveCtrl.Disable(newUnitID) - SetUnitExperience(newUnitID, mRandom() * expMod) - Spring.SetUnitNoDraw(newUnitID,false) - deathQueue[unitID] = { selfd = false, reclaimed = true } - idleOrderQueue[newUnitID] = {cmd = CMD.STOP, params = {}, opts = {}} - return - end - elseif (unitID == queenID) then - if paralyzer then - SetUnitHealth(unitID, {paralyze=0}) - return - end - qDamage = (qDamage + damage) - if (qDamage > (queenMaxHP/10)) then - if qMove then - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qMove = false - qDamage = 0 - mRandom(0,100000) - else - local cC = ChooseTarget() - local xQ, _, zQ = GetUnitPosition(queenID) - if cC then - local angle = math.atan2((cC[1]-xQ), (cC[3]-zQ)) - local dist = math.sqrt(((cC[1]-xQ)*(cC[1]-xQ))+((cC[3]-zQ)*(cC[3]-zQ))) * 0.75 - if (dist < 1700) then - GiveOrderToUnit(queenID, CMD.MOVE, {(xQ + (math.sin(angle) * dist)), cC[2], (zQ + (math.cos(angle) * dist))}, {}) - GiveOrderToUnit(queenID, CMD.FIGHT, cC, {"shift"}) - if targetCache then addChickenTarget(queenID, targetCache) end - qDamage = 0 - mRandom(50000,250000) - Wave() - qMove = true - else - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qDamage = 0 - Wave() - end - for i = 1,5,1 do - SpawnTurret(queenID, bonusTurret) - end - else - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qDamage = 0 - end - end - end - end -end - -function gadget:GameStart() - if warningMessage then - Spring.Echo("Warning: No Chicken team available, add a Chicken bot") - Spring.Echo("(Assigning Chicken Team to Gaia - AI: Custom)") - end - if (burrowSpawnType == "initialbox") or (burrowSpawnType == "alwaysbox") then - local _,_,_,_,_,luaAllyID = Spring.GetTeamInfo(chickenTeamID) - if luaAllyID then - lsx1,lsz1,lsx2,lsz2 = Spring.GetAllyTeamStartBox(luaAllyID) - if (not lsx1) or (not lsz1) or (not lsx2) or (not lsz2) then - burrowSpawnType = "avoid" - Spring.Echo("No Chicken start box available, Burrow Placement set to 'Avoid Players'") - elseif (lsx1 == 0) and (lsz1 == 0) and (lsx2 == Game.mapSizeX) and (lsz2 == Game.mapSizeX) then - burrowSpawnType = "avoid" - Spring.Echo("No Chicken start box available, Burrow Placement set to 'Avoid Players'") - end - end - end -end - - -local function SpawnChickens() - local i,defs = next(spawnQueue) - if not i or not defs then - return - end - local x,y,z - if (queenID) then - x, y, z = getChickenSpawnLoc(defs.burrow, MEDIUM_UNIT) - else - x, y, z = getChickenSpawnLoc(defs.burrow, SMALL_UNIT) - end - if not x or not y or not z then - spawnQueue[i] = nil - return - end - local unitID = CreateUnit(defs.unitName, x,y,z, "n", defs.team) - if unitID then - SetUnitExperience(unitID, mRandom() * expMod) - if (mRandom() < 0.1) then - local mod = 0.75 - (mRandom() * 0.25) - if (mRandom() < 0.1) then - mod = mod - (mRandom() * 0.2) - if (mRandom() < 0.1) then - mod = mod - (mRandom() * 0.2) - end - end - heroChicken[unitID] = mod - end - - if UnitDefs[GetUnitDefID(unitID)].canFly then - GiveOrderToUnit(unitID, CMD.IDLEMODE, { 0 }, { "shift" }) - end - - if (queenID) then - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = getRandomMapPos(), opts = {}} - else - local chickenParams = ChooseTarget() - if targetCache and (unitID ~= queenID) and (mRandom(1,15) == 5) then - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {targetCache}, opts = {}} - else - if (mRandom(100) > 20) then - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = chickenParams, opts = {}} - else - idleOrderQueue[unitID] = {cmd = CMD.MOVE, params = chickenParams, opts = {}} - end - end - if targetCache then - if GetUnitNeutral(targetCache) then - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {targetCache}, opts = {}} - end - addChickenTarget(unitID, targetCache) - end - chickenBirths[unitID] = { deathDate = t + (maxAges[defs.unitName] or maxAge), burrowID = defs.burrow } - chickenCount = chickenCount + 1 - end - end - spawnQueue[i] = nil -end - -local function chickenEvent(type, num, tech) - SendToUnsynced("ChickenEvent", type, num, tech) -end - -local function getMostDefendedArea() - table.sort(defenseMap, function(u1,u2) return u1 < u2; end) - local k = next(defenseMap) - if k then - local x,z = string.match(k, "(%d+),(%d+)") - x = x * DMAREA - z = z * DMAREA - local y = GetGroundHeight(x,z) - return x,y,z - else - return nil,nil,nil - end -end - -local function updateSpawnQueen() - if (not queenID) and (not gameOver) then -- spawn queen if not exists - queenID = SpawnQueen() - local x,y,z = getMostDefendedArea() - if x and y and z then - idleOrderQueue[queenID] = {cmd = CMD.MOVE, params = {x,y,z}, opts = {}} - else - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - end - burrows[queenID] = 0 - spawnQueue = {} - oldMaxChicken = maxChicken - oldDamageMod = damageMod - maxChicken = 75 - chickenEvent("queen") -- notify unsynced about queen spawn - _,queenMaxHP = GetUnitHealth(queenID) - SetUnitExperience(queenID, expMod) - timeOfLastWave = t - SKIRMISH[UnitDefNames["chickenc1"].id] = { distance = 150, chance = 0.5 } - SKIRMISH[UnitDefNames["chickenf1"].id] = { distance = 1200, chance = 0.25 } - SKIRMISH[UnitDefNames["chickenw1"].id] = { distance = 1800, chance = 0.5 } - COWARD[UnitDefNames["chicken_dodo1"].id] = { distance = 1100, chance = 0.33 } - - local chickenUnits = GetTeamUnits(chickenTeamID) - for _, unitID in pairs(chickenUnits) do - if (GetUnitDefID(unitID) == OVERSEER_ID) then - deathQueue[unitID] = { selfd = false, reclaimed = false } - end - end - - if (modes[highestLevel] == EPIC) then - table.insert(spawnQueue, {burrow = queenID, unitName = "ve_chickenq", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "ve_chickenq", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "ve_chickenq", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "ve_chickenq", team = chickenTeamID}) - end - - if (queenName == "epic_chickenq") then - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenr3", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenr3", team = chickenTeamID}) - end - for i = 1,150,1 do - if (mRandom() < spawnChance) then - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh4", team = chickenTeamID}) - end - end - for i = 1,10,1 do - if (mRandom() < spawnChance) then - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh1", team = chickenTeamID}) - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh1b", team = chickenTeamID}) - end - end - else - if (mRandom() < (spawnChance/7.5)) then - for i = 1,mRandom(1,3),1 do - table.insert(spawnQueue, {burrow = queenID, unitName = "chickenh4", team = chickenTeamID}) - end - end - end -end - -function gadget:GameFrame(n) - - if gameOver then - chickenCount = UpdateUnitCount() - if (n > gameOver) then - Spring.KillTeam(chickenTeamID) - end - return - end - - if n == 15 then - DisableComputerUnits() - end - - if ((n % 90) == 0) then - removeFailChickens() - if (queenAnger >= 100) then - damageMod = (damageMod + 0.005) - end - end - - if (chickenCount < maxChicken) then - SpawnChickens() - end - - for unitID in pairs(stunList) do - if (n > stunList[unitID]) then - SetUnitHealth(unitID, {paralyze=0}) - stunList[unitID] = nil - end - end - - for unitID, defs in pairs(deathQueue) do - if ValidUnitID(unitID) and not GetUnitIsDead(unitID) then - DestroyUnit(unitID, defs.selfd or false, defs.reclaimed or false) - end - end - - if (n >= timeCounter) then - timeCounter = (n + UPDATE) - t = GetGameSeconds() - if not queenID then - if t < gracePeriod then - queenAnger = 0 - else - queenAnger = math.ceil(math.min((t - gracePeriod) / (queenTime - gracePeriod) * 100 % 100) + burrowAnger, 100) - end - SetGameRulesParam("queenAnger", queenAnger) - end - KillOldChicken() - - if (t < gracePeriod) then -- do nothing in the grace period - return - end - - expMod = (expMod + expIncrement) -- increment expierence - - if next(idleOrderQueue) then - local processOrderQueue = {} - for unitID,order in pairs(idleOrderQueue) do - if GetUnitDefID(unitID) then - processOrderQueue[unitID] = order - end - end - idleOrderQueue = {} - for unitID,order in pairs(processOrderQueue) do - GiveOrderToUnit(unitID, order.cmd, order.params, order.opts) - GiveOrderToUnit(unitID, CMD.MOVE_STATE, { mRandom(0,2) }, { "shift" }) - if UnitDefs[GetUnitDefID(unitID)].canFly then - GiveOrderToUnit(unitID, CMD.AUTOREPAIRLEVEL, { mRandom(0,3) }, { "shift" }) - end - end - end - - if queenAnger >= 100 then -- check if the queen should be alive - updateSpawnQueen() - updateQueenLife() - end - - local quicken = 0 - local burrowCount = SetCount(burrows) - - if (burrowSpawnRate < (t - timeOfLastFakeSpawn) and burrowTarget < maxBurrows) then - -- This block is all about setting the correct burrow target - if firstSpawn then - minBurrows = SetCount(humanTeams) - local hteamID = next(humanTeams) - local ranCount = GetTeamUnitCount(hteamID) - for i = 1,ranCount,1 do - mRandom() - end - burrowTarget = math.max(math.min(math.ceil(minBurrows * 1.5) + gracePenalty, 40), 1) - else - burrowTarget = burrowTarget + 1 - end - timeOfLastFakeSpawn = t - end - - if (burrowTarget > 0) and (burrowTarget ~= burrowCount) then - quicken = (burrowSpawnRate * (1 - (burrowCount / burrowTarget))) - end - - if (burrowTarget > 0) and ((burrowCount / burrowTarget) < 0.40) then - -- less than 40% of desired burrows, spawn one right away - quicken = burrowSpawnRate - end - - local burrowSpawnTime = (burrowSpawnRate - quicken) - - if (burrowCount < minBurrows) or (burrowSpawnTime < (t - timeOfLastSpawn) and burrowCount < maxBurrows) then - if firstSpawn then - for i = 1,math.min(math.ceil((SetCount(humanTeams) * 1.5)) + gracePenalty, 40),1 do - SpawnBurrow() - end - timeOfLastWave = (t - (chickenSpawnRate - 6)) - firstSpawn = false - if (burrowSpawnType == "initialbox") then - burrowSpawnType = "initialbox_post" - end - else - SpawnBurrow() - end - if (burrowCount >= minBurrows) then timeOfLastSpawn = t end - chickenEvent("burrowSpawn") - SetGameRulesParam("roostCount", SetCount(burrows)) - end - - if (burrowCount > 0) and (chickenSpawnRate < (t - timeOfLastWave)) then - local cCount = Wave() - if cCount and cCount > 0 and (not queenID) then - chickenEvent("wave", cCount, currentWave) - end - timeOfLastWave = t - end - chickenCount = UpdateUnitCount() - end -end - -function gadget:UnitDestroyed(unitID, unitDefID, unitTeam, attackerID) - - if (eggChance > 0) and ((bonusEggs > 0) or (EGG_DROPPER[unitDefID] and (mRandom() < eggChance))) then - local x,y,z = GetUnitPosition(unitID) - if x then - local h = GetUnitHeading(unitID) - if h then - Spring.CreateFeature(EGG_DROPPER[unitDefID],x,y,z,h) - bonusEggs = bonusEggs - 1 - end - end - end - - if heroChicken[unitID] then heroChicken[unitID] = nil end - if stunList[unitID] then stunList[unitID] = nil end - if chickenBirths[unitID] then chickenBirths[unitID] = nil end - if turrets[unitID] then turrets[unitID] = nil end - if idleOrderQueue[unitID] then idleOrderQueue[unitID] = nil end - if failChickens[unitID] then failChickens[unitID] = nil end - if failBurrows[unitID] then - failBurrows[unitID] = nil - return - end - - if chickenTargets[unitID] then - if (unitTeam ~= chickenTeamID) then - --debug--Spring.Echo(t .. " chickenTargets " .. unitID) - for chickenID in pairs(chickenTargets[unitID]) do - --debug--Spring.Echo(t .. " stopChicken " .. chickenID) - if GetUnitDefID(chickenID) then - idleOrderQueue[chickenID] = {cmd = CMD.STOP, params = {}, opts = {}} - end - end - elseif chickenTargets[chickenTargets[unitID]] then - chickenTargets[chickenTargets[unitID]][unitID] = nil - end - chickenTargets[unitID] = nil - end - - if (unitID == targetCache) then - targetCache = 1 - targetCacheCount = math.huge - end - - if (unitTeam == chickenTeamID) and chickenDefTypes[unitDefID] then - local name = UnitDefs[unitDefID].name - if unitDefID ~= burrowDef then name = string.sub(name,1,-2) end - local kills = GetGameRulesParam(name.."Kills") - SetGameRulesParam(name.."Kills", kills + 1) - chickenCount = chickenCount - 1 - if (attackerID) then - local x,_,z = GetUnitPosition(attackerID) - if x and z then - local area = math.floor(x/DMAREA) .. "," .. math.floor(z/DMAREA) - if defenseMap[area] == nil then - defenseMap[area] = 1 - else - defenseMap[area] = defenseMap[area] + 1 - end - end - end - end - - if (unitID == queenID) then -- queen destroyed - queenID = nil - maxChicken = oldMaxChicken - damageMod = oldDamageMod - queenResistance = {} - if (ascendingQueen == true) then - local x,y,z = GetUnitPosition(unitID) - nextQueenSpawn = {x = x, y = y, z = z} - if (queenName == "ve_chickenq") then - queenName = "e_chickenq" - elseif (queenName == "e_chickenq") then - queenName = "n_chickenq" - elseif (queenName == "n_chickenq") then - queenName = "h_chickenq" - elseif (queenName == "h_chickenq") then - queenName = "vh_chickenq" - elseif (queenName == "vh_chickenq") then - queenName = "epic_chickenq" - ascendingQueen = false - nextQueenSpawn = nil - end - updateSpawnQueen() - else - if modes[highestLevel] == SURVIVAL then - queenTime = t + (((Spring.GetModOptions().mo_queentime or 40) * 60) * survivalQueenMod) - survivalQueenMod = survivalQueenMod * 0.8 - queenAnger = 0 -- reenable chicken spawning - burrowAnger = 0 - SetGameRulesParam("queenAnger", queenAnger) - SpawnBurrow() - SpawnChickens() -- spawn new chickens (because queen could be the last one) - else - gameOver = GetGameFrame() + 120 - spawnQueue = {} - KillAllComputerUnits() - KillAllChicken() - end - end - end - - if (unitDefID == burrowDef) and (not gameOver) then - - local kills = GetGameRulesParam(burrowName.."Kills") - SetGameRulesParam(burrowName.."Kills", kills + 1) - - burrows[unitID] = nil - if (addQueenAnger == 1) then - burrowAnger = (burrowAnger + angerBonus) - expMod = (expMod + angerBonus) - end - - for turretID,v in pairs(turrets) do - if (v[1] == unitID) then - local x,y,z = GetUnitPosition(turretID) - if x and y and z then - Spring.SpawnCEG("blood_explode", x,y,z,0,0,0) - local h = Spring.GetUnitHealth(turretID) - if h then - Spring.SetUnitHealth(turretID, h * 0.333) - end - end - idleOrderQueue[turretID] = {cmd = CMD.STOP, params = {}, opts = {}} - turrets[turretID] = nil - end - end - - for burrowID in pairs(burrows) do - SpawnTurret(burrowID, bonusTurret) - end - - for i,defs in pairs(spawnQueue) do - if (defs.burrow == unitID) then - spawnQueue[i] = nil - end - end - - SetGameRulesParam("roostCount", SetCount(burrows)) - end - -end - -function gadget:TeamDied(teamID) - if humanTeams[teamID] then - if (minBurrows > 1) then minBurrows = (minBurrows - 1) end - end - humanTeams[teamID] = nil - computerTeams[teamID] = nil -end - -function gadget:UnitTaken(unitID, unitDefID, oldTeam, newTeam) - if (oldTeam == chickenTeamID) then - DestroyUnit(unitID, true) - end -end - -function gadget:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) - if (newTeam == chickenTeamID) then - return false - else - return true - end -end - -function gadget:GameOver() - if modes[highestLevel] ~= SURVIVAL then -- don't end game in survival mode --- Spring.Echo("Set Gameover") - gameOver=GetGameFrame() - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -else --- END SYNCED --- BEGIN UNSYNCED --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Script = Script -local hasChickenEvent = false - -local function HasChickenEvent(ce) - hasChickenEvent = (ec ~= "0") -end - -function WrapToLuaUI(_, type, num, tech) - if hasChickenEvent then - local chickenEventArgs = {} - if type ~= nil then - chickenEventArgs["type"] = type - end - if num ~= nil then - chickenEventArgs["number"] = num - end - if tech ~= nil then - chickenEventArgs["tech"] = tech - end - Script.LuaUI.ChickenEvent(chickenEventArgs) - end -end - -function gadget:Initialize() - gadgetHandler:AddSyncAction('ChickenEvent', WrapToLuaUI) - gadgetHandler:AddChatAction("HasChickenEvent", HasChickenEvent, "toggles hasChickenEvent setting") -end - -function gadget:Shutdown() - gadgetHandler:RemoveChatAction("HasChickenEvent") -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -end --- END UNSYNCED --------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/chicken_special_damage.lua b/LuaRules/Gadgets/chicken_special_damage.lua deleted file mode 100644 index aca991c63..000000000 --- a/LuaRules/Gadgets/chicken_special_damage.lua +++ /dev/null @@ -1,121 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "Chicken Special Damage", - desc = "Nerfs some weapons vs Chickens", - author = "TheFatController", - date = "Aug 31, 2013", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: Chicken Special Damage] Activated!") -else - Spring.Echo("[ChickenDefense: Chicken Special Damage] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---There are some *A-isms in here, but they don't cause any issues, so I don't see the point in removing them and making some poor sap recreate them for his game. - -if (not gadgetHandler:IsSyncedCode()) then - return false -- silent removal -end - -local DAMAGE_LIMITS = { - -- [WeaponDefNames['cordecom_decoy_disintegrator'].id] = 10, - -- [WeaponDefNames['armdecom_decoy_disintegrator'].id] = 10 -} - -local DGUN = { - -- [WeaponDefNames['corcom_arm_disintegrator'].id] = 15000, - -- [WeaponDefNames['armcom_arm_disintegrator'].id] = 15000 -} - -local CHICKEN_RESISTS = { - -- [UnitDefNames['chickenp1'].id] = { - -- [WeaponDefNames['cormaw_dmaw'].id] = 0.4, - -- [WeaponDefNames['corpyro_flamethrower'].id] = 0.4, - -- [WeaponDefNames['corhurc_coradvbomb'].id] = 0.75, - -- [WeaponDefNames['cortermite_core_termite_laser'].id] = 0.75, - -- [WeaponDefNames['corkrog_corkrog_laser'].id] = 0.75, - -- }, - -- [UnitDefNames['chickenc1'].id] = { - -- [WeaponDefNames['armclaw_dclaw'].id] = 0.6, - -- [WeaponDefNames['armzeus_lightning'].id] = 0.6, - -- [WeaponDefNames['armlatnk_armlatnk_weapon'].id] = 0.6, - -- [WeaponDefNames['armbanth_armbantha_fire'].id] = 0.6, - -- }, - -- [UnitDefNames['chickenc3'].id] = { - -- [WeaponDefNames['armclaw_dclaw'].id] = 0.5, - -- [WeaponDefNames['armzeus_lightning'].id] = 0.5, - -- [WeaponDefNames['armlatnk_armlatnk_weapon'].id] = 0.5, - -- [WeaponDefNames['armbanth_armbantha_fire'].id] = 0.5, - -- }, - -- [UnitDefNames['chickenc3b'].id] = { - -- [WeaponDefNames['armclaw_dclaw'].id] = 0.5, - -- [WeaponDefNames['armzeus_lightning'].id] = 0.5, - -- [WeaponDefNames['armlatnk_armlatnk_weapon'].id] = 0.5, - -- [WeaponDefNames['armbanth_armbantha_fire'].id] = 0.5, - -- }, - -- [UnitDefNames['chickenc3b'].id] = { - -- [WeaponDefNames['armclaw_dclaw'].id] = 0.5, - -- [WeaponDefNames['armzeus_lightning'].id] = 0.5, - -- [WeaponDefNames['armlatnk_armlatnk_weapon'].id] = 0.5, - -- [WeaponDefNames['armbanth_armbantha_fire'].id] = 0.5, - -- }, - -- [UnitDefNames['chickenh5'].id] = { - -- [WeaponDefNames['corvipe_vipersabot'].id] = 0.5, - -- [WeaponDefNames['armpb_armpb_weapon'].id] = 0.5, - -- }, - -- [UnitDefNames['chicken2b'].id] = { - -- [WeaponDefNames['cordoom_atadr'].id] = 0.666, - -- [WeaponDefNames['armanni_ata'].id] = 0.666, - -- }, -} - -function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, - weaponID, projectileID, attackerID, attackerDefID, attackerTeam) - - if CHICKEN_RESISTS[unitDefID] and CHICKEN_RESISTS[unitDefID][weaponID] then - return damage * CHICKEN_RESISTS[unitDefID][weaponID], CHICKEN_RESISTS[unitDefID][weaponID] - end - - if DAMAGE_LIMITS[weaponID] then - return math.min(DAMAGE_LIMITS[weaponID],damage),1 - elseif (DGUN[weaponID] and (string.find(UnitDefs[unitDefID].name, "chickenq") ~= nil)) then - return math.min(DGUN[weaponID],damage),1 - elseif ((damage > 50000) and (string.find(UnitDefs[unitDefID].name, "chickenq") ~= nil)) then - return math.min(50000,damage),1 - else - return damage,1 - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/cmd_get_player_data.lua b/LuaRules/Gadgets/cmd_get_player_data.lua new file mode 100644 index 000000000..b80bf1f3d --- /dev/null +++ b/LuaRules/Gadgets/cmd_get_player_data.lua @@ -0,0 +1,218 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Get Player Data", + desc = "", + author = "Floris", + date = "July 2018", + license = "GNU GPL, v2 or later", + layer = -math.huge, + enabled = true + } +end + +local authorized = { + ['[Evo]Forboding_Angel'] = true, + ["[teh]Flow"] = true, + ['Player'] = true, +} + +if (gadgetHandler:IsSyncedCode()) then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + local validation = randomString(2) + _G.validationPlayerData = validation + + function gadget:RecvLuaMsg(msg, player) + if msg:sub(1,2)=="pd" and msg:sub(3,4)==validation then + local name = Spring.GetPlayerInfo(player) + local data = string.sub(msg, 6) + local playerallowed = string.sub(msg, 5, 5) + + SendToUnsynced("SendToWG", playerallowed..name..";"..data) + return true + end + end + +else + + local validation = SYNCED.validationPlayerData + + function gadget:Initialize() + gadgetHandler:AddSyncAction("SendToWG", SendToWG) + end + + function lines(str) + local t = {} + local function helper(line) table.insert(t, line) return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t + end + + function gadget:GotChatMsg(msg, player) + local myPlayerName,_,mySpec = Spring.GetPlayerInfo(player) + if not authorized[myPlayerName] then + return + end + if string.sub(msg,1,9) == "getconfig" then + local playerName = string.sub(msg, 11) + if playerName == select(1, Spring.GetPlayerInfo(Spring.GetMyPlayerID())) then + local data = VFS.LoadFile("LuaUI/Config/BA.lua") + if data then + data = string.sub(data, 1, 200000) + local sendtoauthedplayer = '1' + Spring.SendLuaRulesMsg('pd'..validation..sendtoauthedplayer..'config;'..player..';'..VFS.ZlibCompress(data)) + end + end + elseif string.sub(msg,1,10) == "getinfolog" then + local playerName = string.sub(msg, 12) + if playerName == select(1, Spring.GetPlayerInfo(Spring.GetMyPlayerID())) then + local userconfig + local data = '' + local skipline = false + local fileLines = lines(VFS.LoadFile("infolog.txt")) + for i, line in ipairs(fileLines) do + if not userconfig and string.find(line, '============== ==============') then + userconfig = '' + end + if not userconfigComplete then + if userconfig then + if string.find(line, '============== ==============') then + userconfig = userconfig .. '============== ==============\n' + userconfigComplete = true + else + userconfig = userconfig .. line .. '\n' + end + end + else + skipline = false + -- filter paths for privacy reasons + if string.find(line, 'Using read-') or + string.find(line, 'Scanning: ') or + string.find(line, 'Recording demo to: ') or + string.find(line, 'Loading StartScript from: ') or + string.find(line, 'Writing demo: ') or + string.find(line, 'command-line args: ') or + string.find(line, 'Using configuration source: ') + then + skipline = true + end + if not skipline then + data = data .. line .. '\n' + end + end + end + data = userconfig .. data + if data then + data = string.sub(data, 1, 250000) + local sendtoauthedplayer = '1' + Spring.SendLuaRulesMsg('pd'..validation..sendtoauthedplayer..'infolog;'..player..';'..VFS.ZlibCompress(data)) + end + end + elseif string.sub(msg,1,13) == 'getscreenshot' then + if not mySpec and myPlayerName ~= 'Player' then + Spring.SendMessageToPlayer(player, 'Taking screenshots is disabled when you are a player') + return + end + queueScreenShotWidth = 200 + queueScreenShotHeightBatch = 4 + + local playerName = string.sub(msg, 15) + if string.sub(msg,1,15) == 'getscreenshothq' then + queueScreenShotWidth = 300 + queueScreenShotHeightBatch = 3 + playerName = string.sub(msg, 17) + end + if string.sub(msg,1,15) == 'getscreenshotlq' then + queueScreenShotWidth = 140 + queueScreenShotHeightBatch = 5 + playerName = string.sub(msg, 17) + end + if playerName == select(1, Spring.GetPlayerInfo(Spring.GetMyPlayerID())) then + local vsx, vsy = Spring.GetViewGeometry() + queueScreenshot = true + queueScreenshotGameframe = Spring.GetGameFrame() + queueScreenShotHeight = math.floor(queueScreenShotWidth*(vsy/vsx)) + queueScreenShotStep = vsx/queueScreenShotWidth + queueScreenShotH = 0 + queueScreenShotHmax = queueScreenShotH + queueScreenShotHeightBatch + queueScreenShotPixels = {} + --queueScreenShotBroadcastDelay = 1 + queueScreenShotBroadcastChars = 0 + queueScreenShotCharsPerBroadcast = 7500 -- in practice this will be a bit higher because it finishes adding a whole row of pixels + end + end + end + + local sec = 0 + function gadget:Update(dt) + if queueScreenshot then + sec = sec + Spring.GetLastUpdateSeconds() + if sec > 0.03 then + sec = 0 + local r,g,b + while queueScreenShotH < queueScreenShotHmax do + queueScreenShotH = queueScreenShotH + 1 + for w=1, queueScreenShotWidth do + r,g,b = gl.ReadPixels(math.floor(queueScreenShotStep*(w-0.5)),math.floor(queueScreenShotStep*(queueScreenShotH-0.5)),1,1) + queueScreenShotBroadcastChars = queueScreenShotBroadcastChars + 3 + queueScreenShotPixels[#queueScreenShotPixels+1] = DEC_CHAR(r*94)..DEC_CHAR(g*94)..DEC_CHAR(b*94) + end + end + + queueScreenShotHmax = queueScreenShotHmax + queueScreenShotHeightBatch + if queueScreenShotHmax > queueScreenShotHeight then + queueScreenShotHmax = queueScreenShotHeight + end + if queueScreenShotBroadcastChars >= queueScreenShotCharsPerBroadcast or queueScreenShotH >= queueScreenShotHeight then + local finished = '0' + if queueScreenShotH >= queueScreenShotHeight then + finished = '1' + end + local data = finished .. ';' .. queueScreenShotWidth .. ';' .. queueScreenShotHeight .. ';' .. queueScreenshotGameframe .. ';' .. table.concat(queueScreenShotPixels) + local sendtoauthedplayer = '0' + Spring.SendLuaRulesMsg('pd'..validation..sendtoauthedplayer..'screenshot;'..VFS.ZlibCompress(data)) + queueScreenShotBroadcastChars = 0 + queueScreenShotPixels = {} + pixels = nil + data = nil + if finished == '1' then + queueScreenshot = nil + end + end + end + end + end + + function DEC_CHAR(IN) + local B,K,OUT,I,D=95,"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !@#$%^&*()_+-=[]{};:,./<>?~|`'\"\\","",0 + while IN>0 do + I=I+1 + IN,D=math.floor(IN/B),math.modf(IN,B)+1 + OUT=string.sub(K,D,D)..OUT + end + if OUT == '' then OUT = '0' end -- somehow sometimes its empty + return OUT + end + + function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY + end + + function SendToWG(_,msg) + local myPlayerName,_,mySpec = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) + if Script.LuaUI("PlayerDataBroadcast") and (mySpec or myPlayerName == 'Player' or string.sub(msg,1,1) == '1') and authorized[myPlayerName] then + Script.LuaUI.PlayerDataBroadcast(myPlayerName, string.sub(msg, 2)) + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/cmd_mouse_pos_broadcast.lua b/LuaRules/Gadgets/cmd_mouse_pos_broadcast.lua new file mode 100644 index 000000000..021d811a8 --- /dev/null +++ b/LuaRules/Gadgets/cmd_mouse_pos_broadcast.lua @@ -0,0 +1,197 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Cursor Broadcast", + desc = "Shows the mouse pos of allied players", + author = "jK,TheFatController", + date = "Apr,2009", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- configs + +local sendPacketEvery = 0.8 +local numMousePos = 2 --//num mouse pos in 1 packet + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- locals + +local GetMouseState = Spring.GetMouseState +local TraceScreenRay = Spring.TraceScreenRay +local SendLuaRulesMsg = Spring.SendLuaRulesMsg +local GetMyPlayerID = Spring.GetMyPlayerID +local GetSpectatingState= Spring.GetSpectatingState +local GetPlayerInfo = Spring.GetPlayerInfo +local GetLastUpdateSeconds= Spring.GetLastUpdateSeconds + + +local PackU16 = VFS.PackU16 +local UnpackU16 = VFS.UnpackU16 + +local floor = math.floor +local tanh = math.tanh +local abs = math.abs + + +-------------------------------------------------------------------------------- + +local updateTimer = 0 +local poshistory = {} + +local saveEach = sendPacketEvery/numMousePos +local updateTick = saveEach + + +local lastx,lastz = 0,0 +local n = 0 +local lastclick = 0 + +if gadgetHandler:IsSyncedCode() then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + + local validation = randomString(2) + _G.validationMouse = validation + + function gadget:RecvLuaMsg(msg, playerID) + if msg:sub(1,2)=="£" and msg:sub(3,4)==validation then + local xz = msg:sub(6) + local l = xz:len()*0.25 + if l == numMousePos then + for i=0,numMousePos-1 do + local x = UnpackU16(xz:sub(i*4+1,i*4+2)) + local z = UnpackU16(xz:sub(i*4+3,i*4+4)) + local click = msg:sub(4,4) == "1" + SendToUnsynced("mouseBroadcast",playerID,x,z,click) + end + end + return true + end + end +else + +-------------------------------------------------------------------------------- + +local myPlayerID = GetMyPlayerID() +local validation = SYNCED.validationMouse + +function gadget:Initialize() + gadgetHandler:AddSyncAction("mouseBroadcast", handleMousePosEvent) +end + +function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("mouseBroadcast") +end + +function handleMousePosEvent(_,playerID,x,z,click) + --here we receive mouse pos from other players and dispatch to luaui + local spec, fullView = GetSpectatingState() + if not spec or not fullView then + local _,_,_,_,myAllyTeamID = GetPlayerInfo(myPlayerID) + local _,_,targetSpec,_,allyTeamID = GetPlayerInfo(playerID) + if targetSpec or allyTeamID ~= myAllyTeamID then + return + end + end + if Script.LuaUI("MouseCursorEvent") then + Script.LuaUI.MouseCursorEvent(playerID,x,z,click) + end +end + +function gadget:Update() + updateTimer = updateTimer + GetLastUpdateSeconds() + + if updateTimer > updateTick then + local mx,my = GetMouseState() + local _,pos = TraceScreenRay(mx,my,true) + + if pos then + poshistory[n*2] = PackU16(floor(pos[1])) + poshistory[n*2+1] = PackU16(floor(pos[3])) + if n == numMousePos then + lastx,lastz = pos[1],pos[3] + end + n = n + 1 + end + + updateTick = updateTimer + saveEach + end + + if n > numMousePos then + n = 0 + updateTimer = 0 + updateTick = saveEach + + local posStr = "0" + + for i=numMousePos,1,-1 do + local xStr = poshistory[i*2] + local zStr = poshistory[i*2+1] + if xStr and zStr then + posStr = posStr .. xStr .. zStr + end + end + SendLuaRulesMsg("£" .. validation .. posStr) + + end +end + + +function gadget:MousePress(x,y,button) + if button == 2 then + return + end + local mx,my = GetMouseState() + local _,pos = TraceScreenRay(mx,my,true) + + if not pos then + return + end + if abs(pos[1] - lastx) > 300 or abs(pos[3] - lastz) > 300 then + for i=0,5 do + local posindex = i%2 == 0 and 1 or 3 + poshistory[i] = PackU16(floor(pos[posindex])) + end + lastx,lastz = pos[1],pos[3] + updateTick = saveEach + updateTimer = 0 + n = 0 + local posStr = "0" + for i=numMousePos,1,-1 do + local xStr = poshistory[i*2] + local zStr = poshistory[i*2+1] + if xStr and zStr then + posStr = posStr .. xStr .. zStr + end + end + SendLuaRulesMsg("£" .. validation .. posStr) + end +end + +end + diff --git a/LuaRules/Gadgets/cmd_transports_instaload.lua b/LuaRules/Gadgets/cmd_transports_instaload.lua new file mode 100644 index 000000000..a9311ec69 --- /dev/null +++ b/LuaRules/Gadgets/cmd_transports_instaload.lua @@ -0,0 +1,555 @@ +function gadget:GetInfo() + return { + name = "Instant Unload", + desc = "Allows Flood load & unload", + author = "aZaremoth, unload support added by MaDDoX", + date = "March, 2015", + license = "Public Domain, or the least-restrictive license your country allows.", + layer = 1, + enabled = true, + } +end +------------------------------------------------------------------------ +include("LuaRules/Configs/customcmds.h.lua") +--- [Deprecated] new lua core is added) +--VFS.Include("LuaRules/Utilities/utilities_emul.lua") +--VFS.Include("LuaRules/Utilities/ClampPosition.lua") +VFS.Include("gamedata/taptools.lua") + + +if gadgetHandler:IsSyncedCode() then + +-------------------------------------------------------------------------------- +--region SYNCED +-------------------------------------------------------------------------------- + +--local GiveClampedOrderToUnit = Spring.Utilities.GiveClampedOrderToUnit +local CMD_INSERT = CMD.INSERT +local CMD_MOVE = CMD.MOVE +local CMD_REMOVE = CMD.REMOVE +local CMD_WAIT = CMD.WAIT +local CMD_STOP = CMD.STOP +local CMD_GUARD = CMD.GUARD +local CMD_LOAD_ONTO = CMD.LOAD_ONTO +local CMD_SET_WANTED_MAX_SPEED = CMD.SET_WANTED_MAX_SPEED -- 70 +local CMD_UNLOAD_UNIT = 81 --CMD.UNLOAD_UNIT --81 +local CMD_UNLOAD_UNITS = 80 --CMD.UNLOAD_UNITS --80 +local CMD_LOAD_UNITS = CMD.LOAD_UNITS +local CMD_OPT_INTERNAL = CMD.OPT_INTERNAL +local CMD_OPT_SHIFT = CMD.OPT_SHIFT + +local loadtheseunits = {} --// { [passengerUnitID] = transportID, ... } + --- Whenever an unload is registered, this table holds which transports are moving towards unload range +local transportstounload = {} --// { [transportID]={ x, y, z, r }, ... } || r == nil => unload click +local passengermovingtoload = {} +local transportmovingtoload = {} --// { [transportID]={{x, y, z, r, f}, ...} || f = frame after when it should be tracked + --- 'Assignable' changes after a load command is registered, transportcapacity only changes after actual loading +local currentassignablecapacity = {} --// { [transportID] = number, ...} should be made global in Initialize() +local currenttransportcapacity = {} +local unitisintransport = {} +local passengers = {} --// [transportID]={ passengerUID1 = true, passengerUID2 = true, ... } +local queueMovePassengers = {} --// { [unitID] = frame, ... } +local queuedMoveCommands = {} --// { unitID=unitID, shift=shift, pos={x,y,z}} + +local spGetAllUnits = Spring.GetAllUnits +local spGetGameFrame = Spring.GetGameFrame +local spGetUnitPosition = Spring.GetUnitPosition +local spGetUnitDefID = Spring.GetUnitDefID +local spGetUnitTeam = Spring.GetUnitTeam +local spGetUnitMoveTypeData = Spring.GetUnitMoveTypeData +local spGetUnitsInCylinder = Spring.GetUnitsInCylinder +local spUnitAttach = Spring.UnitAttach +local spUnitDetach = Spring.UnitDetach +local spUnitDetachFromAir = Spring.UnitDetachFromAir +local spSetUnitLoadingTransport = Spring.SetUnitLoadingTransport +local spGiveOrderToUnit = Spring.GiveOrderToUnit +local spGetUnitsInCylinder = Spring.GetUnitsInCylinder + +local mcSetPosition = Spring.MoveCtrl.SetPosition +--local mcSetRotation = Spring.MoveCtrl.SetRotation +local mcDisable = Spring.MoveCtrl.Disable +local mcEnable = Spring.MoveCtrl.Enable + +local rand = math.random +local unloadScatterDist = 80 -- Max scatter move distance after unit is unloaded + +local function sqr (x) + return math.pow(x, 2) +end + +function gadget:Initialize() + _G.currentassignablecapacity = currentassignablecapacity --// making it global for unsynced access via SYNCED table + local allUnits = spGetAllUnits() + for i = 1, #allUnits do + local unitID = allUnits[i] + local unitDefID = spGetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end +end + +function gadget:UnitCreated(unitID, unitDefID) --, team, builderID + unitisintransport[unitID] = false + passengermovingtoload[unitID] = false + if not UnitDefs[unitDefID].isTransport then + --Spring.Echo(" Not a transport! ") + return end + local transportcapacity = tonumber(UnitDefs[unitDefID].transportCapacity) + if transportcapacity == nil then + transportcapacity = 0 + end + currenttransportcapacity[unitID] = transportcapacity + currentassignablecapacity[unitID] = transportcapacity + --_G.currentassignablecapacity = currentassignablecapacity + --Spring.Echo("Assignable capacity table count: "..pairs_len(currentassignablecapacity)) + transportmovingtoload[unitID] = nil +end + +-- Can this unit be transported? +local function canBeTransported(unitDefID) + return tobool(UnitDefs[unitDefID].cantBeTransported) == false +end + +-- Does this unit has available transport capacity? +local function hasAssignableCapacity(unitID) + --Spring.Echo("Current assignable capacity: ",tostring(currentassignablecapacity[unitID])) + return currentassignablecapacity[unitID] and tonumber(currentassignablecapacity[unitID]) > 0 +end + +local function hasCurrentCapacity(unitID) + return currenttransportcapacity[unitID] and tonumber(currenttransportcapacity[unitID]) > 0 +end + +local function CancelLoad(unitID) + for pUnitID, transporterID in pairs(loadtheseunits) do + if pUnitID == unitID -- passenger received STOP/MOVE + or transporterID == unitID then -- transporter received STOP/MOVE + currentassignablecapacity[transporterID] = currentassignablecapacity[transporterID] + 1 + -- Spring.Echo(currentassignablecapacity[transporterID]) + loadtheseunits[pUnitID] = nil + end + end +end + +function gadget:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions) + local ud = UnitDefs[unitDefID] + local transportcapacity = ud.transportCapacity or 0 + local loadingradius = ud.loadingRadius + + --Spring.Echo("CMD ID: "..cmdID.." for unit: "..unitID) + + if transportstounload[unitID] ~= nil + and cmdID ~= CMD_SET_WANTED_MAX_SPEED and cmdID ~= 1 then -- 1 == CMD_INSERT (+others) + --Spring.Echo("Unload canceled by cmdID: "..cmdID) + transportstounload[unitID] = nil + --currentassignablecapacity[unitID] = currentassignablecapacity[unitID] + 1 + end + + --if cmdID ~= CMD_SET_WANTED_MAX_SPEED and cmdID ~= 1 then -- 1 == CMD_INSERT (+others) then + -- If transporter or unit to be loaded is moved or stop, cancel load + if cmdID == CMD_MOVE or cmdID == CMD_STOP then + --TODO: Fix this. It's a mess.. + --if loadtheseunits[unitID] ~= nil then + -- --Spring.Echo("Canceling passenger load of "..unitID) + -- CancelLoad(unitID) + --end + --if transportmovingtoload[unitID] then + -- if spGetGameFrame() > transportmovingtoload[unitID] then + -- --Spring.Echo("Canceling transporter load of "..unitID) + -- transportmovingtoload[unitID] = loadingradius --TODO: test; was nil + -- CancelLoad(unitID) + -- end + --end + end + + if cmdID == CMD_UNLOAD_UNITS or cmdID == CMD_UNLOAD_UNIT then + --Spring.Echo(DebugiTable(cmdParams)) + local x, y, z = cmdParams[1], cmdParams[2], cmdParams[3] -- x, y, z position of click + -- Set radius when cmdID == UNLOAD_UNITS (area unload) + transportstounload[unitID] = { x = x, y = y, z = z, r = (cmdID == CMD_UNLOAD_UNITS and cmdParams[4] or nil) } + --Spring.Echo("Added ttu: "..unitID) + return true + -- Any command issued between issue-unload and actual unload has to update currentassignablecapacity + end + + if cmdID == CMD_LOAD_ONTO then -- (76) LOAD ONTO a TRANSPORT, checks if can be transported + local transportID = cmdParams[1] --Spring.Echo("load command registered") + + if canBeTransported(unitDefID) and hasAssignableCapacity(transportID) + and not unitisintransport[unitID] and not loadtheseunits[unitID] then + Spring.GiveOrderToUnit(unitID, CMD_GUARD, {transportID}, {}) + loadtheseunits[unitID] = transportID + currentassignablecapacity[transportID] = currentassignablecapacity[transportID] - 1 + --Spring.Echo("Current assignable capacity: "..currentassignablecapacity[transportID]) + passengermovingtoload[unitID] = true + else + return false + end + end + + -- LOAD UNITS // check if it's a transporter + if cmdID == CMD_LOAD_UNITS and transportcapacity > 0 then --(75) + if hasCurrentCapacity(unitID) and hasAssignableCapacity(unitID) then + local MyTeam = spGetUnitTeam(unitID) + local movetype = (spGetUnitMoveTypeData(unitID)).name + local tx, ty, tz = spGetUnitPosition(unitID) -- transport position + local x = cmdParams[1] -- x is passenger's unitID if only oneclicked, or the x-position of center of the load circle + local y = cmdParams[2] -- y-position of center of the load circle + local z = cmdParams[3] -- z-position of center of the load circle + local r = cmdParams[4] -- radius of the load circle + --Spring.Echo("Load | Move Type: "..movetype) + ------------------------------------BUNKER---------------------------------------------------- + if movetype == [[static]] then --is it a bunker? + if (r == nil) then -------- load a single unit + local xUnitDefID = spGetUnitDefID(x) + local xTeam = spGetUnitTeam(x) + if canBeTransported(xUnitDefID) and xTeam == MyTeam + and currentassignablecapacity[unitID] > 0 and (unitisintransport[x] == false) + and (loadtheseunits[x] == nil) then + loadtheseunits[x] = unitID + currentassignablecapacity[unitID] = (currentassignablecapacity[unitID] - 1) + -- Spring.Echo(currentassigablecapacity[unitID]) + passengermovingtoload[x] = true + spGiveOrderToUnit(x, CMD_MOVE, {tx,ty,tz}, {}) + end + else -------- load multiple units + local UnitsAroundCommand = Spring.GetUnitsInCylinder(x,z,r) + for _,cUnitID in ipairs(UnitsAroundCommand) do -- check all units in transport pick-up >c 0) + and (unitisintransport[cUnitID] == false) + and (loadtheseunits[cUnitID] == nil) then + loadtheseunits[cUnitID] = unitID + currentassignablecapacity[unitID] = (currentassignablecapacity[unitID] - 1) + -- Spring.Echo(currentassigablecapacity[unitID]) + passengermovingtoload[cUnitID] = true + spGiveOrderToUnit(cUnitID, CMD_MOVE, {tx,ty,tz}, {}) + -- Spring.GiveOrderToUnit(unitID, CMD_WAIT, {}, {}) + end + end + end + end + ------------------------------------MOBILE---------------------------------------------------- + else + transportmovingtoload[unitID] = { x = x, y = y, z = z, r = r, f = spGetGameFrame()+1 } -- start tracking it in f frames + -- load single unit + if r == nil then + local xUnitDefID = spGetUnitDefID(x) + local xTeam = spGetUnitTeam(x) + if canBeTransported(xUnitDefID) + and xTeam == MyTeam and currentassignablecapacity[unitID] > 0 + and not unitisintransport[x] and loadtheseunits[x] == nil then + loadtheseunits[x] = unitID + currentassignablecapacity[unitID] = currentassignablecapacity[unitID] - 1 + --Spring.Echo("New current assignablecapacity: "..currentassignablecapacity[unitID]) + passengermovingtoload[x] = true + local px, py, pz = spGetUnitPosition(x) -- passenger position + queuedMoveCommands[#queuedMoveCommands+1] = { unitID=unitID, + shift=cmdOptions.shift, + pos={x=px,y=py,z=pz} + } + --if cmdOptions.shift then + -- spGiveOrderToUnit(unitID, CMD_INSERT, {-1, CMD_MOVE, CMD_OPT_INTERNAL, px,py,pz }, {"alt"} ) + --else + -- spGiveOrderToUnit(unitID, CMD_MOVE, {px,py,pz}, {}) + --end + end + else + -- load multiple units + local UnitsAroundCommand = spGetUnitsInCylinder(x,z,r) + --GiveOrderToUnit(unitID,CMD_INSERT,{-1,CMD_CAPTURE,CMD_OPT_INTERNAL+1,unitID2},{"alt"}); + --GiveOrderToUnit(unitID,CMD_INSERT,{cmd.tag,CMD_CAPTURE,CMD_OPT_INTERNAL+1,unitID2},{}); + --GiveOrderToUnit(unitID,CMD_INSERT,{0,CMD_STOP,0},{"alt"}); + queuedMoveCommands[#queuedMoveCommands+1] = { unitID=unitID, + --shift=cmdOptions.shift, + pos={x=x,y=y,z=z} + } + for _,cUnitID in ipairs(UnitsAroundCommand) do -- check all units in transport pick-up >c 0 + and not unitisintransport[cUnitID] + and not loadtheseunits[cUnitID] then + loadtheseunits[cUnitID] = unitID + currentassignablecapacity[unitID] = currentassignablecapacity[unitID] - 1 + -- Spring.Echo(currentassigablecapacity[unitID]) + passengermovingtoload[cUnitID] = true + spGiveOrderToUnit(unitID, CMD_REMOVE, {CMD_MOVE}, {"alt"}) + spGiveOrderToUnit(cUnitID, CMD_MOVE, {x,y,z}, {}) + end + end + end + end + end + return true + else + return false end + end + + return true + +end + +function gadget:UnitIdle(unitID, unitDefID, unitTeam) + for mpUnitID, _ in pairs(passengermovingtoload) do -- remove arrived passengers + if (unitID == mpUnitID) then + passengermovingtoload[mpUnitID] = false -- passenger arrived at pick-up point or was stopped + end + end + --local unloadData = transportstounload[unitID] -- = data.x, .y, .z + --if unloadData then + -- local sqrDistanceFromTarget = Distance2D(unitID, unloadData.x, unloadData.z) + -- Spring.Echo("Stuck transport dist from target: "..sqrDistanceFromTarget) + --end +end + +function gadget:UnitDestroyed(unitID, unitDefID, team, attacker) + local transporterID = loadtheseunits[unitID] + if transporterID then + currentassignablecapacity[transporterID] = (currentassignablecapacity[transporterID] + 1) -- remove dead unit from assigned units list + end + loadtheseunits[unitID] = nil + transportstounload[unitID] = nil + passengermovingtoload[unitID] = nil + for pUnitID, tunitID in pairs(loadtheseunits) do -- check if transporter was killed + if (unitID == tunitID) then + loadtheseunits[pUnitID] = nil + transportmovingtoload[unitID] = nil + end + end +end + +local function ShowUnit (unitID, enable) + Spring.SetUnitNoDraw (unitID, not enable) + Spring.SetUnitNoSelect (unitID, not enable) + Spring.SetUnitNoMinimap (unitID, not enable) + return +end + +function gadget:UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) + ---- Let's ignore naval transports + --local transportuDef = UnitDefs[transportID] + --local minUnloadDistance = tonumber(transportuDef.customParams.minunloaddistance) + --if not minUnloadDistance or minUnloadDistance < 1 then + -- return + --end + unitisintransport[unitID] = true + if passengers[transportID] == nil then + passengers[transportID] = {} + end + passengers[transportID][unitID] = true + if currenttransportcapacity[transportID] then + currenttransportcapacity[transportID] = currenttransportcapacity[transportID] - 1 + else + --Spring.Echo("current transport capacity not initialized for "..transportID) + end +end + +function gadget:UnitUnloaded(unitID, unitDefID, unitTeam, transportID, transportTeam) + unitisintransport[unitID] = false + if passengers[transportID] then + passengers[transportID][unitID] = nil + end + --Spring.Echo("New count after unload: "..pairs_len(passengers[transportID]) or "nil") + if not currenttransportcapacity[transportID] or not currentassignablecapacity[transportID] then + return + end + currenttransportcapacity[transportID] = (currenttransportcapacity[transportID] + 1) + currentassignablecapacity[transportID] = (currentassignablecapacity[transportID] + 1) + + + local transportToUnload = transportstounload[transportID] --transport to unload + + if transportToUnload == nil then + return end + + --Spring.SetUnitPosition ( unitID, ttu.x, ttu.z ) + --Spring.Echo("Unload registered, assignable capacity: "..currentassignablecapacity[transportID]) + ShowUnit(unitID, false) + -- We have to punt the move control by 10 frames after unload, or else it twitches and fails. + -- PS.: This was found by shameless trial and error. No idea if it's an engine bug or expected behavior. + queueMovePassengers[#queueMovePassengers +1]={ unitID = unitID, frame = spGetGameFrame()+10, + clickPos = { x = transportToUnload.x, y = transportToUnload.y, z = transportToUnload.z, r = transportToUnload.r }} + -- If transport is empty now, nil it from table + if pairs_len(passengers[transportID]) <= 0 then + transportstounload[transportID] = nil end +end + +function gadget:GameFrame(f) + for i, data in ipairs(queueMovePassengers) do + local unitID = tonumber(data.unitID) + local frame = tonumber(data.frame) + local clickPos = data.clickPos + if f >= frame and IsValidUnit(unitID) then + local px, py, pz = spGetUnitPosition(unitID) + if px ~= nil and py ~= nil and pz ~= nil then + mcEnable(unitID) + -- Issue a move command instead of setting offset position directly (or units might get stuck) + mcSetPosition( unitID, px, clickPos.y, pz) -- clickPos.y || px + mcDisable(unitID) + spGiveOrderToUnit(unitID, CMD_MOVE, { px+ rand (-unloadScatterDist,unloadScatterDist), py, + pz + rand (-unloadScatterDist,unloadScatterDist) }, {}) + ShowUnit(unitID, true) + table.remove(queueMovePassengers, i) + end + end + end + -- Process Transports to Unload + if f % 2 < .1 then + --for unitID, data in pairs(transportstounload) do -- remove arrived passengers + -- local sqrDistanceFromTarget = Distance2D(unitID, data.x, data.z) + -- Spring.Echo("Distance 2D: "..tostring(sqrDistanceFromTarget) or "nil") + -- if (unitID == unitID and isnumber(sqrDistanceFromTarget) and sqrDistanceFromTarget < 160000) then + -- Spring.Echo("Transport "..mtUnitID.." arrived") + -- transportmovingtoload[mtUnitID] = nil -- transport arrived at pick-up point or was stopped + -- end + --end + for transpUID, data in pairs(transportstounload) do + local tx, ty, tz = spGetUnitPosition(transpUID) + local transportuDef = UnitDefs[spGetUnitDefID(transpUID)] + local sqrDistToTarget = Distance2D(transpUID, data.x, data.z) + --Spring.Echo("Distance 2D: "..tostring(sqrDistToTarget) or "nil") + if sqrDistToTarget < 6000 then + -- Re-issue unload command here, to prevent air transports getting stuck + spGiveOrderToUnit(transpUID, CMD_UNLOAD_UNIT, { data.x, data.y, data.z }, {}) + --local minUnloadDistance = tonumber(transportuDef.loadingRadius) / 2 or 150 + local minUnloadDistance = transportuDef.customParams.minunloaddistance + if (minUnloadDistance) then + local distance = math.sqrt(sqr(tx- data.x) + sqr(ty- data.y) + sqr(tz- data.z)) + --Spring.Echo("current/min: "..distance.." / "..minUnloadDistance) + if distance <= tonumber(minUnloadDistance) then + -- actually unload all (for now) units + if passengers[transpUID] and pairs_len(passengers[transpUID])>0 then + --table.insert(passengers[transportID], unitID) + for passengerUID in pairs(passengers[transpUID]) do + spSetUnitLoadingTransport(passengerUID, transpUID) --disable collision temporarily + if transportuDef.isAirUnit then + spUnitDetachFromAir(passengerUID) + else + spUnitDetach(passengerUID) + end + end + end + end + end + end + end + end + -- Process Units to be Loaded + if f % 32 > .1 then + for passengerUID, transpUID in pairs(loadtheseunits) do ----// { [passengerUnitID] = transportID, ... } + local x, y, z = spGetUnitPosition(transpUID) -- transport position + local transportuDef = UnitDefs[spGetUnitDefID(transpUID)] + --local transportcapacity = transportuDef.transportCapacity + local loadingradius = tonumber(transportuDef.loadingRadius) or 300 + local UnitsAroundTransport = spGetUnitsInCylinder(x,z,loadingradius) + for _, thisuID in ipairs(UnitsAroundTransport) do + local thisUDID = spGetUnitDefID(thisuID) + if thisuID == passengerUID and canBeTransported(thisUDID) then + -- Actually "load" the unit: + spSetUnitLoadingTransport(transpUID, thisuID) + spUnitAttach(transpUID, passengerUID, 0) -- Currently only attach to the 'root' object + loadtheseunits[passengerUID] = nil + local p_uID = UnitDefs[spGetUnitDefID(passengerUID)] + if (p_uID.repairSpeed > 0) then -- builder units will automatically repair the transport / bunker + spGiveOrderToUnit(passengerUID, CMD_GUARD, { transpUID }, {}) + end + end + end + -- check if passengers AND transport are still on the run, if not remove from pick-up list + local transporterID = loadtheseunits[passengerUID] + local assignablecapacity = currentassignablecapacity[transporterID] + if not passengermovingtoload[passengerUID] + and not transportmovingtoload[transporterID] + and assignablecapacity then + currentassignablecapacity[transporterID] = assignablecapacity + 1 + loadtheseunits[passengerUID] = nil + end + end + end + -- Process queued MoveCommands + for i, data in ipairs(queuedMoveCommands) do + local unitID = tonumber(data.unitID) + local shift = data.shift + local x,y,z = tonumber(data.pos.x), tonumber(data.pos.y), tonumber(data.pos.z) + if shift then + spGiveOrderToUnit(unitID, CMD_INSERT, {-1, CMD_MOVE, CMD_OPT_INTERNAL, x,y,z }, {"alt"} ) + else + spGiveOrderToUnit(unitID, CMD_MOVE, {x,y,z}, {}) + end + table.remove(queuedMoveCommands, i) + end +end + +-------------------------------------------------------------------------------- +--endregion END SYNCED +-------------------------------------------------------------------------------- +else +-------------------------------------------------------------------------------- +--region UNSYNCED +-------------------------------------------------------------------------------- + +local morphUnits + +local spGetGameFrame = Spring.GetGameFrame +local glBlending = gl.Blending +local glDepthTest = gl.DepthTest +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glTranslate = gl.Translate +local glBlending = gl.Blending +local glDepthTest = gl.DepthTest +local glBillboard = gl.Billboard +local glColor = gl.Color +local glText = gl.Text +local GL_LEQUAL = GL.LEQUAL +local GL_ONE = GL.ONE +local GL_SRC_ALPHA = GL.SRC_ALPHA +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local spGetLocalTeamID = Spring.GetLocalTeamID +local spGetUnitTeam = Spring.GetUnitTeam +local GetSpectatingState = Spring.GetSpectatingState +local spGetUnitViewPosition = Spring.GetUnitViewPosition +local spIsUnitInView = Spring.IsUnitInView +local UItextColor = {1.0, 1.0, 0.6, 1.0} +local UItextSize = 14.0 + +local snext = snext + +--function gadget:DrawWorld() +-- if not snext(SYNCED.currentassignablecapacity) then +-- return --//no transports to draw +-- end +-- +-- glBlending(GL_SRC_ALPHA, GL_ONE) +-- glDepthTest(GL_LEQUAL) +-- +-- --- [BEGIN] Draw Transports current assignable capacity +-- --Spring.Echo("Len: "..pairs_len(SYNCED.currentassignablecapacity)) +-- local localTeam = spGetLocalTeamID() +-- for unitID, capacity in pairsByKeys(SYNCED.currentassignablecapacity) do +-- --local capacity = SYNCED.currentassignablecapacity[unitID] +-- if spIsUnitInView(unitID) and spGetUnitTeam(unitID) == localTeam then +-- local ux, uy, uz = spGetUnitViewPosition(unitID) +-- glPushMatrix() +-- glTranslate(ux, uy, uz) +-- glBillboard() +-- glColor(UItextColor) +-- glText("<" .. capacity..">", 20.0, -15.0, UItextSize, "cno") +-- glPopMatrix() +-- end +-- end +-- --- [END] Draw Transports current assignable capacity +-- +-- glDepthTest(false) +-- glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) +--end + +-------------------------------------------------------------------------------- +--endregion END UNSYNCED +-------------------------------------------------------------------------------- +end \ No newline at end of file diff --git a/LuaRules/Gadgets/dbg_gadget_profiler.lua b/LuaRules/Gadgets/dbg_gadget_profiler.lua new file mode 100644 index 000000000..3618d34e2 --- /dev/null +++ b/LuaRules/Gadgets/dbg_gadget_profiler.lua @@ -0,0 +1,609 @@ +function gadget:GetInfo() +return { + name = "Gadget Profiler", + desc = "", + author = "jK, Bluestone", + date = "2007+", + license = "GNU GPL, v2 or later", + layer = math.huge, + handler = true, + enabled = true, +} +end + +-- use 'luarules profile' to switch on the profiler +-- future use of 'luarules profile' acts as a toggle to show/hide the on-screen profiling data (without touching the hooks) +-- use 'luarules kill_profiler' to switch off the profiler for *everyone* currently using it (and remove the hooks) + +-- the DrawScreen call of this profiler has a performance impact, but note that this profiler does not profile its own time/allocation loads + +-- if switched on during a multi-player game, and included within the game archive, the profiler will (also) have a very small performance impact on *all* players (-> synced callin hooks run in synced code!) +-- nobody will notice, but don't profile if you don't need too + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local usePrefixedNames = true + +local prefixedGnames = {} +local function ConstructPrefixedName (ghInfo) + local gadgetName = ghInfo.name + local baseName = ghInfo.basename + local _pos = baseName:find("_", 1) + local prefix = ((_pos and usePrefixedNames) and (baseName:sub(1, _pos-1)..": ") or "") + local prefixedGadgetName = "\255\200\200\200" .. prefix .. "\255\255\255\255" .. gadgetName + + prefixedGnames[gadgetName] = prefixedGadgetName + return prefixedGnames[gadgetName] +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local callinStats = {} +local callinStatsSYNCED = {} + +local spGetTimer = Spring.GetTimer +local spDiffTimers = Spring.DiffTimers +local spGetLuaMemUsage = Spring.GetLuaMemUsage +if spGetLuaMemUsage == nil then + spGetLuaMemUsage = function() return 0,0,0,0,0,0,0,0 end +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function ArrayInsert(t, f, g) + if (f) then + local layer = g.ghInfo.layer + local index = 1 + for i,v in ipairs(t) do + if (v == g) then + return -- already in the table + end + if (layer >= v.ghInfo.layer) then + index = i + 1 + end + end + table.insert(t, index, g) + end +end + +local function ArrayRemove(t, g) + for k,v in ipairs(t) do + if (v == g) then + table.remove(t, k) + -- break + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local Hook = function(g,name) return function(...) return g[name](...) end end -- place-holder +local oldUpdateGadgetCallIn + +local inHook = false +local listOfHooks = {} +setmetatable(listOfHooks, { __mode = 'k' }) + +local function IsHook(func) + return listOfHooks[func] +end + +if (gadgetHandler:IsSyncedCode()) then + Hook = function (g,name) + local gadgetName = g.ghInfo.name + local realFunc = g[name] + g['_old'..name] = realFunc + + if (gadgetName=="Gadget Profiler") then + return realFunc -- don't profile the profilers callins within synced (nothing to profile!) + end + + local hook_func = function(...) + if (inHook) then + return realFunc(...) + end + + local gname = prefixedGnames[gadgetName] or ConstructPrefixedName(g.ghInfo) + + inHook = true + SendToUnsynced("prf_started_from_synced", gname, name) + local results = {realFunc(...)} + SendToUnsynced("prf_finished_from_synced", gname, name) + inHook = false + return unpack(results) + end + + listOfHooks[hook_func] = true -- !!!note: using functions as keys is unsafe in synced code!!! + + return hook_func + end +else + Hook = function (g,name) + local gadgetName = g.ghInfo.name + local realFunc = g[name] + g['_old'..name] = realFunc + + if (gadgetName=="Gadget Profiler") then + return g['_old'..name] -- don't profile the profilers callins (it works, but it is better that our DrawScreen call is unoptimized and expensive anyway!) + end + + local gname = prefixedGnames[gadgetName] or ConstructPrefixedName(g.ghInfo) + + local gadgetCallinStats = callinStats[gname] or {} + callinStats[gname] = gadgetCallinStats + gadgetCallinStats[name] = gadgetCallinStats[name] or {0,0,0,0} + local c = gadgetCallinStats[name] + + local t,s + + local helper_func = function(...) + local dt = spDiffTimers(spGetTimer(),t) + local local_s,_,new_s,_ = spGetLuaMemUsage() + --Spring.Echo(gadgetName,name,"after",local_s,new_s, collectgarbage("count")) + local ds = new_s - s + c[1] = c[1] + dt + c[2] = c[2] + dt + c[3] = c[3] + ds + c[4] = c[4] + ds + inHook = nil + return ... + end + + local hook_func = function(...) + if (inHook) then + return realFunc(...) + end + + inHook = true + t = spGetTimer() + local local_s,_,new_s,_ = spGetLuaMemUsage() + s = new_s + --Spring.Echo(gadgetName,name,"before",local_s,new_s, collectgarbage("count")) + return helper_func(realFunc(...)) + end + + listOfHooks[hook_func] = true + + return hook_func + end +end + +local hookset = false + +local function StartHook(a,b,c,d) + if (hookset) then return false end + + hookset = true + Spring.Echo("start profiling (" .. (SendToUnsynced~=nil and "synced" or "unsynced") .. ")") + + local gh = gadgetHandler + + local CallInsList = {} + for name,e in pairs(gh) do + local i = name:find("List") + if (i)and(type(e)=="table") then + CallInsList[#CallInsList+1] = name:sub(1,i-1) + end + end + + --// hook all existing callins + for _,callin in ipairs(CallInsList) do + local callinGadgets = gh[callin .. "List"] + for _,g in ipairs(callinGadgets or {}) do + g[callin] = Hook(g,callin) + end + end + + Spring.Echo("hooked all callins") + + --// hook the UpdateCallin function + oldUpdateGadgetCallIn = gh.UpdateGadgetCallIn + gh.UpdateGadgetCallIn = function(self,name,g) + local listName = name .. 'List' + local ciList = self[listName] + if (ciList) then + local func = g[name] + if (type(func) == 'function') then + if (not IsHook(func)) then + g[name] = Hook(g,name) + end + ArrayInsert(ciList, func, g) + else + ArrayRemove(ciList, g) + end + self:UpdateCallIn(name) + else + print('UpdateGadgetCallIn: bad name: ' .. name) + end + end + + Spring.Echo("hooked UpdateCallin") + + if SendToUnsynced then + --Spring.Echo("sending start command to unsynced") + SendToUnsynced("Start_from_synced") + end + + return false -- allow the unsynced chataction to execute too +end + +function KillHook() + if not (hookset) then return true end + + Spring.Echo("stop profiling (" .. (SendToUnsynced~=nil and "synced" or "unsynced") .. ")") + + local gh = gadgetHandler + + local CallInsList = {} + for name,e in pairs(gh) do + local i = name:find("List") + if (i)and(type(e)=="table") then + CallInsList[#CallInsList+1] = name:sub(1,i-1) + end + end + + --// unhook all existing callins + for _,callin in ipairs(CallInsList) do + local callinGadgets = gh[callin .. "List"] + for _,g in ipairs(callinGadgets or {}) do + if (g["_old" .. callin]) then + g[callin] = g["_old" .. callin] + end + end + end + + Spring.Echo("unhooked all callins") + + --// unhook the UpdateCallin function + gh.UpdateGadgetCallIn = oldUpdateGadgetCallIn + + Spring.Echo("unhooked UpdateCallin") + + hookset = false + return false -- allow the unsynced chataction to execute too +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if (gadgetHandler:IsSyncedCode()) then +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:Initialize() + gadgetHandler.actionHandler.AddChatAction(gadget, 'profile', StartHook, " : starts the gadget profiler" ) -- first hook the synced callins, then synced will come back and tell us to (really) start + gadgetHandler.actionHandler.AddChatAction(gadget, 'kill_profiler', KillHook, " : kills the gadget profiler" ) -- removes the profiler for everyone currently running it +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +else +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local show = false +local startedProfiler = false +local validated = false + +local timersSynced = {} +local startTickTimer +local memUsageSynced = {} + +local function StartDrawCallin() -- when the profiler isn't running, the profiler gadget should have *no* draw callin + gadget.DrawScreen = gadget.DrawScreen_ + gadgetHandler:UpdateGadgetCallIn("DrawScreen", gadget) +end + +local function KillDrawCallin() + gadget.DrawScreen_ = gadget.DrawScreen + gadget.DrawScreen = nil + gadgetHandler:UpdateGadgetCallIn("DrawScreen", gadget) +end + +function SyncedCallinStarted(_,gname,cname) + timersSynced[#timersSynced+1] = spGetTimer() -- callins may call each other -> we need a FIFO queue + local _,_,s,_ = spGetLuaMemUsage() + memUsageSynced[#memUsageSynced+1] = s +end + +function SyncedCallinFinished(_,gname,cname) + local dt = spDiffTimers(spGetTimer(),timersSynced[#timersSynced]) + timersSynced[#timersSynced] = nil + local _,_,new_s,_ = spGetLuaMemUsage() + local ds = new_s - memUsageSynced[#memUsageSynced] + memUsageSynced[#memUsageSynced] = nil + + local gadgetCallinStats = callinStatsSYNCED[gname] or {} + callinStatsSYNCED[gname] = gadgetCallinStats + gadgetCallinStats[cname] = gadgetCallinStats[cname] or {0,0,0,0} + local c = gadgetCallinStats[cname] + + c[1] = c[1] + dt + c[2] = c[2] + dt + c[3] = c[3] + ds + c[4] = c[4] + ds +end + +function Start (_,_,_,pID,_) + if pID==Spring.GetMyPlayerID() or validated then + validated = true + + StartHook() -- the unsynced one! + startTickTimer = Spring.GetTimer() + + StartDrawCallin() + show = not show + + Spring.Echo("luarules profiler started (player " .. pID .. ")") + end +end + +function Kill (_,_,_,pID,_) + if validated then + KillDrawCallin() + KillHook() + + show = false + validated = false + + startTickTimer = nil + timersSynced = {} + memUsageSynced = {} + + Spring.Echo("luarules profiler killed (player " .. pID .. ")") + end +end + +function gadget:Initialize() + gadgetHandler.actionHandler.AddChatAction(gadget, "profile", Start) + gadgetHandler.actionHandler.AddChatAction(gadget, "kill_profiler", Kill) + + gadgetHandler.actionHandler.AddSyncAction(gadget, "prf_started_from_synced",SyncedCallinStarted) -- internal, not meant to be called by user + gadgetHandler.actionHandler.AddSyncAction(gadget, "prf_finished_from_synced",SyncedCallinFinished) -- internal, not meant to be called by user +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local tick = 0.2 +local averageTime = 2 + +local timeLoadAverages = {} +local spaceLoadAverages = {} +local redStrength = {} +local timeLoadAveragesSYNCED = {} +local spaceLoadAveragesSYNCED = {} +local redStrengthSYNCED = {} + +local lm,_,gm,_,um,_,sm,_ = spGetLuaMemUsage() + +local function CalcLoad(old_load, new_load, t) + return old_load*math.exp(-tick/t) + new_load*(1 - math.exp(-tick/t)) +end + +local totalLoads = {} +local allOverTimeSec = 0 -- currently unused + +local sortedList = {} +local sortedListSYNCED = {} +local function SortFunc(a,b) + return a.plainname < b.plainname +end + +local minPerc = 0.005 -- above this value, we fade in how red we mark a widget (/gadget) +local maxPerc = 0.02 -- above this value, we mark a widget as red +local minSpace = 10 -- Kb +local maxSpace = 100 + +local title_colour = "\255\160\255\160" +local totals_colour = "\255\200\200\255" + +local function ColourString(R,G,B) + R255 = math.floor(R*255) + G255 = math.floor(G*255) + B255 = math.floor(B*255) + if (R255%10 == 0) then R255 = R255+1 end + if (G255%10 == 0) then G255 = G255+1 end + if (B255%10 == 0) then B255 = B255+1 end + return "\255"..string.char(R255)..string.char(G255)..string.char(B255) +end + +function GetRedColourStrings(tTime, sLoad, name, redStr, deltaTime) + local u = math.exp(-deltaTime/5) --magic colour changing rate + + if tTime>maxPerc then tTime = maxPerc end + if tTimecmax_t) then + cmax_t = c[2] + cmaxname_t = cname + end + c[1] = 0 + + space = space + c[3] + if (c[4]>cmax_space) then + cmax_space = c[4] + cmaxname_space = cname + end + c[3] = 0 + end + + local relTime = 100 * t / deltaTime + timeLoadAvgs[gname] = CalcLoad(timeLoadAvgs[gname] or relTime, relTime, averageTime) + + local relSpace = space / deltaTime + spaceloadAvgs[gname] = CalcLoad(spaceloadAvgs[gname] or relSpace, relSpace, averageTime) + + allOverTimeSec = allOverTimeSec + t + + local tLoad = timeLoadAvgs[gname] + local sLoad = spaceloadAvgs[gname] + local tTime = t/deltaTime + + local tColourString, sColourString = GetRedColourStrings(tTime, sLoad, gname, redStr, deltaTime) + + sorted[n] = {plainname=gname, fullname=gname..' \255\200\200\200('..cmaxname_t..','..cmaxname_space..')', tLoad=tLoad, sLoad=sLoad, tTime=tTime, tColourString=tColourString, sColourString=sColourString} + allOverTime = allOverTime + tLoad + allOverSpace = allOverSpace + sLoad + + n = n + 1 + end + + table.sort(sorted,SortFunc) + + sorted.allOverTime = allOverTime + sorted.allOverSpace = allOverSpace + + return sorted +end + +local function DrawSortedList(list, name, x,y,j, fontSize,lineSpace,maxLines,colWidth,dataColWidth) + if #list==0 then return 0,0 end + + if j>=maxLines-5 then x = x - colWidth; j = 0; end + j = j + 1 + gl.Text(title_colour..name, x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + j = j + 2 + + for i=1,#list do + if j>=maxLines then x = x - colWidth; j = 0; end + local v = list[i] + local name = v.plainname + local gname = v.fullname + local tTime = v.tTime + local tLoad = v.tLoad + local sLoad = v.sLoad + local tColour = v.tColourString + local sColour = v.sColourString + + gl.Text(tColour .. ('%.2f%%'):format(tLoad), x, y-lineSpace*j, fontSize, "no") + gl.Text(sColour .. ('%.0f'):format(sLoad) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + gl.Text(gname, x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + + j = j + 1 + end + + gl.Text(totals_colour..('%.2f%%'):format(list.allOverTime), x, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.0f'):format(list.allOverSpace) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour.."totals ("..string.lower(name)..")", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + j = j + 1 + + return x,j +end + +function gadget:DrawScreen_() + if not (validated and show) then return end + + if not (next(callinStats)) and not (next(callinStatsSYNCED)) then + Spring.Echo("no data in profiler!") + return + end + + local deltaTime = Spring.DiffTimers(Spring.GetTimer(),startTickTimer) + if (deltaTime>=tick) then + startTickTimer = Spring.GetTimer() + + sortedList = ProcessCallinStats(callinStats, timeLoadAverages, spaceLoadAverages, redStrength, deltaTime) + sortedListSYNCED = ProcessCallinStats(callinStatsSYNCED, timeLoadAveragesSYNCED, spaceLoadAveragesSYNCED, redStrengthSYNCED, deltaTime) + + lm,_,gm,_,um,_,sm,_ = spGetLuaMemUsage() + end + + local vsx, vsy = gl.GetViewSizes() + + local fontSize = math.max(11,math.floor(vsy/90)) + local lineSpace = fontSize + 2 + + local dataColWidth = fontSize*5 + local colWidth = vsx*0.98/4 + + local x,y = vsx-colWidth, vsy*0.77 -- initial coord for writing + local maxLines = math.max(20,math.floor(y/lineSpace)-3) + local j = -1 --line number + + gl.Color(1,1,1,1) + gl.BeginText() + + x,j = DrawSortedList(sortedList, "UNSYNCED", x,y,j, fontSize,lineSpace,maxLines,colWidth,dataColWidth) + + if j>=maxLines-15 then x = x - colWidth; j = -1; end + + x,j = DrawSortedList(sortedListSYNCED, "SYNCED", x,y,j, fontSize,lineSpace,maxLines,colWidth,dataColWidth) + + if j>=maxLines-15 then x = x - colWidth; j = -1; end + + j = j + 1 + gl.Text(title_colour.."ALL", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + j = j + 1 + + j = j + 1 + gl.Text(totals_colour.."total percentage of running time spent in luarules callins", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.1f%%'):format((sortedList.allOverTime or 0)+(sortedListSYNCED.allOverTime or 0)), x+dataColWidth, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour.."total rate of mem allocation by luarules callins", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.0f'):format((sortedList.allOverSpace or 0)+(sortedListSYNCED.allOverSpace or 0)) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + + j = j + 2 + gl.Text(totals_colour..'total lua memory usage is '.. ('%.0f'):format(gm/1000) .. 'MB, of which:', x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*lm/gm) .. '% is from unsynced luarules', x, y-lineSpace*j, fontSize, "no") + --note: it's not currently possible to callout the footprint of (specifically) synced luarules + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*um/gm) .. '% is from unsynced states (luarules+luagaia+luaui)', x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*sm/gm) .. '% is from synced states (luarules+luagaia)', x, y-lineSpace*j, fontSize, "no") + + + j = j + 2 + gl.Text(title_colour.."All data excludes load from garbage collection & executing GL calls", x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(title_colour.."Callins in brackets are heaviest per gadget for (time,allocs)", x, y-lineSpace*j, fontSize, "no") + + j = j + 2 + gl.Text(title_colour.."Tick time: " .. tick .. "s", x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(title_colour.."Smoothing time: " .. averageTime .. "s", x, y-lineSpace*j, fontSize, "no") + + gl.EndText() +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +end diff --git a/LuaRules/Gadgets/dbg_profiler.lua b/LuaRules/Gadgets/dbg_profiler.lua deleted file mode 100644 index 5736c4ed0..000000000 --- a/LuaRules/Gadgets/dbg_profiler.lua +++ /dev/null @@ -1,471 +0,0 @@ --- $Id: dbg_profiler.lua 3171 2008-11-06 09:06:29Z det $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "Profiler", - desc = "", - author = "jK", - date = "2007,2008,2009", - license = "GNU GPL, v2 or later", - layer = math.huge, - handler = true, - enabled = true, -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local callinTimes = {} -local callinTimesSYNCED = {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local SCRIPT_DIR = Script.GetName() .. '/' - -local Hook = function(g,name) return function(...) return g[name](...) end end --//place holder - -local inHook = false -local listOfHooks = {} -setmetatable(listOfHooks, { __mode = 'k' }) - -local function IsHook(func) - return listOfHooks[func] -end - -if (gadgetHandler:IsSyncedCode()) then - Hook = function (g,name) - local origFunc = g[name] - - local hook_func = function(...) - if (inHook) then - return origFunc(...) - end - - inHook = true - SendToUnsynced("prf_started", g.ghInfo.name, name) - local results = {origFunc(...)} - SendToUnsynced("prf_finished", g.ghInfo.name, name) - inHook = false - return unpack(results) - end - - listOfHooks[hook_func] = true --note: using function in keys is unsafe in synced code!!! - - return hook_func - end -else - Hook = function (g,name) - local spGetTimer = Spring.GetTimer - local spDiffTimers = Spring.DiffTimers - local gadgetName = g.ghInfo.name - - local realFunc = g[name] - - if (gadgetName=="Profiler") then - return realFunc - end - local gadgetCallinTime = callinTimes[gadgetName] or {} - callinTimes[gadgetName] = gadgetCallinTime - gadgetCallinTime[name] = gadgetCallinTime[name] or {0,0} - local timeStats = gadgetCallinTime[name] - - local t - - local helper_func = function(...) - local dt = spDiffTimers(spGetTimer(),t) - timeStats[1] = timeStats[1] + dt - timeStats[2] = timeStats[2] + dt - inHook = nil - return ... - end - - local hook_func = function(...) - if (inHook) then - return realFunc(...) - end - - inHook = true - t = spGetTimer() - return helper_func(realFunc(...)) - end - - listOfHooks[hook_func] = true - - return hook_func - end -end - -local function ArrayInsert(t, f, g) - if (f) then - local layer = g.ghInfo.layer - local index = 1 - for i,v in ipairs(t) do - if (v == g) then - return -- already in the table - end - if (layer >= v.ghInfo.layer) then - index = i + 1 - end - end - table.insert(t, index, g) - end -end - - -local function ArrayRemove(t, g) - for k,v in ipairs(t) do - if (v == g) then - table.remove(t, k) - -- break - end - end -end - -local hookset = false - -local function StartHook() - if (hookset) then return end - hookset = true - Spring.Echo("start profiling") - - local gh = gadgetHandler - - local CallInsList = {} - for name,e in pairs(gh) do - local i = name:find("List") - if (i)and(type(e)=="table") then - CallInsList[#CallInsList+1] = name:sub(1,i-1) - end - end - - --// hook all existing callins - for _,callin in ipairs(CallInsList) do - local callinGadgets = gh[callin .. "List"] - for _,g in ipairs(callinGadgets or {}) do - g[callin] = Hook(g,callin) - end - end - - Spring.Echo("hooked all callins: OK") - - oldUpdateGadgetCallIn = gh.UpdateGadgetCallIn - gh.UpdateGadgetCallIn = function(self,name,g) - local listName = name .. 'List' - local ciList = self[listName] - if (ciList) then - local func = g[name] - if (type(func) == 'function') then - if (not IsHook(func)) then - g[name] = Hook(g,name) - end - ArrayInsert(ciList, func, g) - else - ArrayRemove(ciList, g) - end - self:UpdateCallIn(name) - else - print('UpdateGadgetCallIn: bad name: ' .. name) - end - end - - Spring.Echo("hooked UpdateCallin: OK") - return true -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (gadgetHandler:IsSyncedCode()) then - - function gadget:Initialize() - gadgetHandler.actionHandler.AddChatAction(gadget, 'profile', StartHook, - " : starts the gadget profiler (for debugging issues)" - ) - --StartHook() - end - - --function gadget:Shutdown() - --end - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -else - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - - local startTimer - local startTimerSYNCED - local profile_unsynced = false - local profile_synced = false - - local function UpdateDrawCallin() - gadget.DrawScreen = gadget.DrawScreen_ - gadgetHandler:UpdateGadgetCallIn("DrawScreen", gadget) - end - - local function Start(cmd, msg, words, playerID) - if (Spring.GetLocalPlayerID() ~= playerID) then - return - end - - if (not profile_unsynced) then - UpdateDrawCallin() - --UpdateDrawCallin() -- not sure why they added this line a 2nd time - startTimer = Spring.GetTimer() - StartHook() - profile_unsynced = true - end - end - local function StartSYNCED(cmd, msg, words, playerID) - show = true - if (Spring.GetLocalPlayerID() ~= playerID) then - return - end - - if (not profile_synced) then - startTimerSYNCED = Spring.GetTimer() - profile_synced = true - UpdateDrawCallin() - --UpdateDrawCallin() -- not sure why they added this line a 2nd time - end - end - local show = true - local function StartBoth(cmd, msg, words, playerID) - show = true - Start(cmd, msg, words, playerID) - StartSYNCED(cmd, msg, words, playerID) - end - - local function Hide(cmd, msg, words, playerID) - show = false - end - local function Show(cmd, msg, words, playerID) - show = true - end - - - local timers = {} - function SyncedCallinStarted(_,gname,cname) - local t = Spring.GetTimer() - timers[#timers+1] = t - end - - function SyncedCallinFinished(_,gname,cname) - local dt = Spring.DiffTimers(Spring.GetTimer(),timers[#timers]) - timers[#timers]=nil - - local gadgetCallinTime = callinTimesSYNCED[gname] or {} - callinTimesSYNCED[gname] = gadgetCallinTime - gadgetCallinTime[cname] = gadgetCallinTime[cname] or {0,0} - local timeStats = gadgetCallinTime[cname] - - timeStats[1] = timeStats[1] + dt - timeStats[2] = timeStats[2] + dt - end - - function gadget:Initialize() - gadgetHandler.actionHandler.AddSyncAction(gadget, "prf_started",SyncedCallinStarted) - gadgetHandler.actionHandler.AddSyncAction(gadget, "prf_finished",SyncedCallinFinished) - - gadgetHandler.actionHandler.AddChatAction(gadget, 'uprofile', Start, - " : starts the gadget profiler (for debugging issues)" - ) - gadgetHandler.actionHandler.AddChatAction(gadget, 'profile', StartSYNCED,"") - gadgetHandler.actionHandler.AddChatAction(gadget, 'ap', StartBoth,"") - gadgetHandler.actionHandler.AddChatAction(gadget, 'hideprofile', Hide,"") - gadgetHandler.actionHandler.AddChatAction(gadget, 'showprofile', Show,"") - --StartHook() - end - -local tick = 0.1 -local averageTime = 5 -local loadAverages = {} - -local function CalcLoad(old_load, new_load, t) - return old_load*math.exp(-tick/t) + new_load*(1 - math.exp(-tick/t)) - --return (old_load-new_load)*math.exp(-tick/t) + new_load -end - -local maximum = 0 -local maximumSYNCED = 0 -local totalLoads = {} -local allOverTime = 0 -local allOverTimeSYNCED = 0 -local allOverTimeSec = 0 - -local sortedList = {} -local sortedListSYNCED = {} -local function SortFunc(a,b) - --if (a[2]==b[2]) then - return a[1]b[2] - --end -end - - function gadget:DrawScreen_() - if not show then return end - if not (next(callinTimes)) then - --Spring.Echo("no callin times in profiler!") - return --// nothing to do - end - - if (profile_unsynced) then - local deltaTime = Spring.DiffTimers(Spring.GetTimer(),startTimer) - if (deltaTime>=tick) then - startTimer = Spring.GetTimer() - - totalLoads = {} - maximum = 0 - allOverTime = 0 - local n = 1 - for wname,callins in pairs(callinTimes) do - local total = 0 - local cmax = 0 - local cmaxname = "" - for cname,timeStats in pairs(callins) do - total = total + timeStats[1] - if (timeStats[2]>cmax) then - cmax = timeStats[2] - cmaxname = cname - end - timeStats[1] = 0 - end - - local load = 100*total/deltaTime - loadAverages[wname] = CalcLoad(loadAverages[wname] or load, load, averageTime) - - allOverTimeSec = allOverTimeSec + total - - local tLoad = loadAverages[wname] - sortedList[n] = {wname..'('..cmaxname..')',tLoad} - allOverTime = allOverTime + tLoad - if (maximum=tick) then - startTimerSYNCED = Spring.GetTimer() - - totalLoads = {} - maximumSYNCED = 0 - allOverTimeSYNCED = 0 - local n = 1 - for wname,callins in pairs(callinTimesSYNCED) do - local total = 0 - local cmax = 0 - local cmaxname = "" - for cname,timeStats in pairs(callins) do - total = total + timeStats[1] - if (timeStats[2]>cmax) then - cmax = timeStats[2] - cmaxname = cname - end - timeStats[1] = 0 - end - - local load = 100*total/deltaTimeSYNCED - loadAverages[wname] = CalcLoad(loadAverages[wname] or load, load, averageTime) - - allOverTimeSec = allOverTimeSec + total - - local tLoad = loadAverages[wname] - sortedListSYNCED[n] = {wname..'('..cmaxname..')',tLoad} - allOverTimeSYNCED = allOverTimeSYNCED + tLoad - if (maximumSYNCED maximum) and (maximumSYNCED) or (maximum) - - gl.Color(1,1,1,1) - gl.BeginText() - - if (profile_unsynced) then - y = y - 24 - gl.Text("UNSYNCED", x+115, y-3, 12, "noc") - y = y - 5 - - for i=1,#sortedList do - local v = sortedList[i] - local wname = v[1] - local tLoad = v[2] - if maximum > 0 then - gl.Rect(x+100-tLoad/maximum_*100, y+1-(12)*i, x+100, y+9-(12)*i) - end - gl.Text(wname, x+150, y+1-(12)*i, 10, "o") - gl.Text(('%.3f%%'):format(tLoad), x+105, y+1-(12)*i, 10, "o") - end - end - local j = 0 - if (profile_synced) then - x = x - 300 - - --gl.Rect(x, y+5-(12)*j, x+230, y+4-(12)*j) - gl.Color(1,0,0) - y = y - 8 - gl.Text("SYNCED", x+115, y-3-(12)*j, 12, "noc") - gl.Color(1,1,1,1) - j = j - y = y - 5 - - for i=1,#sortedListSYNCED do - local v = sortedListSYNCED[i] - local wname = v[1] - local tLoad = v[2] - if maximum > 0 then - gl.Rect(x+100-tLoad/maximum_*100, y+1-(12)*(j+i), x+100, y+9-(12)*(j+i)) - end - gl.Text(wname, x+150, y+1-(12)*(j+i), 10, "o") - gl.Text(('%.3f%%'):format(tLoad), x+105, y+1-(12)*(j+i), 10, "o") - - if i==50 then - x = x - 300 - j = j - 50 --offset - end - end - end - --local i = #sortedList + #sortedListSYNCED + 2 - local i = #sortedListSYNCED + 1 - gl.Text("\255\255\064\064total time", x-110, y-1-(12)*(i+j), 10, "o") - gl.Text("\255\255\064\064"..('%.3fs'):format(allOverTimeSec), x-10, y-1-(12)*(i+j), 10, "o") - i = i+1 - gl.Text("\255\255\064\064total FPS cost", x-110, y-1-(12)*(i+j), 10, "o") - gl.Text("\255\255\064\064"..('%.1f%%'):format(allOverTime+allOverTimeSYNCED), x-10, y-1-(12)*(i+j), 10, "o") - gl.EndText() - - gl.PopMatrix() - end - -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/fps_broadcast.lua b/LuaRules/Gadgets/fps_broadcast.lua index 4712c5b5b..f7128e6db 100644 --- a/LuaRules/Gadgets/fps_broadcast.lua +++ b/LuaRules/Gadgets/fps_broadcast.lua @@ -5,7 +5,6 @@ function gadget:GetInfo() desc = "Broadcasts FramesPerSecond", author = "Floris", date = "July,2016", - license = "GNU GPL, v2 or later", layer = 0, enabled = true, } @@ -22,9 +21,23 @@ local sendPacketEvery = 2 -------------------------------------------------------------------------------- if gadgetHandler:IsSyncedCode() then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + + local validation = randomString(2) + _G.validationFps = validation + function gadget:RecvLuaMsg(msg, playerID) - if msg:sub(1,1)=="@" then - SendToUnsynced("fpsBroadcast",playerID,tonumber(msg:sub(2))) + if msg:sub(1,1)=="@" and msg:sub(2,3)==validation then + SendToUnsynced("fpsBroadcast",playerID,tonumber(msg:sub(4))) return true end end @@ -41,7 +54,8 @@ else local updateTimer = 0 local avgFps = GetFPS() local numframes = 0 - + local validation = SYNCED.validationFps + function gadget:Initialize() gadgetHandler:AddSyncAction("fpsBroadcast", handleFpsEvent) end @@ -51,9 +65,9 @@ else end function handleFpsEvent(_,playerID,fps) - if Script.LuaUI("FpsEvent") then - Script.LuaUI.FpsEvent(playerID,fps) - end + if Script.LuaUI("FpsEvent") then + Script.LuaUI.FpsEvent(playerID,fps) + end end function gadget:Update() @@ -62,7 +76,7 @@ else numFrames = numFrames + 1 avgFps = ((avgFps*(numFrames-1))+GetFPS()) / numFrames if updateTimer > sendPacketEvery then - SendLuaRulesMsg("@"..math.floor(avgFps+0.5)) + SendLuaRulesMsg("@"..validation..math.floor(avgFps+0.5)) updateTimer = 0 avgFps = 0 numFrames = 0 diff --git a/LuaRules/Gadgets/game_autocolors.lua b/LuaRules/Gadgets/game_autocolors.lua new file mode 100644 index 000000000..e6f74ec65 --- /dev/null +++ b/LuaRules/Gadgets/game_autocolors.lua @@ -0,0 +1,372 @@ +if gadgetHandler:IsSyncedCode() then + return +end + +function gadget:GetInfo() + return { + name = "AutoColorPicker", + desc = "Automatically assigns colors to teams", + author = "Damgam", + date = "2021", + layer = -100, + enabled = true, + } +end + +local spGetTeamInfo = Spring.GetTeamInfo +local spGetTeamList = Spring.GetTeamList +local spGetAllyTeamList= Spring.GetAllyTeamList +local spGetMyTeamID = Spring.GetMyTeamID +local spGetMyAllyTeamID = Spring.GetMyAllyTeamID +local spSetTeamColor = Spring.SetTeamColor +local spGetTeamLuaAI = Spring.GetTeamLuaAI +local spGetGaiaTeamID = Spring.GetGaiaTeamID +local spGetSpectatingState = Spring.GetSpectatingState +local spGetConfigInt = Spring.GetConfigInt +local spGetLastUpdateSeconds = Spring.GetLastUpdateSeconds + +local myPlayerID = Spring.GetMyPlayerID() + + + +local ffaCounter = 0 +local allyCounter = 0 +local enemyCounter = 0 +local simpleColorsUpdateCounter = 0 + +SimpleColorsEnabled = Spring.GetConfigInt("simple_auto_colors", 0) -- Floris plz add option here +local DynamicTeamColorsEnabledModoption = (Spring.GetModOptions and Spring.GetModOptions().teamcolors_dynamic) or "enabled" +if DynamicTeamColorsEnabledModoption == "enabled" then + DynamicTeamColorsEnabled = true +else + DynamicTeamColorsEnabled = false +end +local AnonymousModeEnabledModoption = (Spring.GetModOptions and Spring.GetModOptions().teamcolors_anonymous_mode) or "disabled" +if AnonymousModeEnabledModoption == "enabled" then + AnonymousModeEnabled = true +else + AnonymousModeEnabled = false +end +local IconDevModeEnabledModoption = (Spring.GetModOptions and Spring.GetModOptions().teamcolors_icon_dev_mode) or "disabled" +if IconDevModeEnabledModoption == "disabled" then + IconDevModeEnabled = false +else + if IconDevModeEnabledModoption == "armblue" then + IconDevModeColor = {0, 80, 255} + elseif IconDevModeEnabledModoption == "corred" then + IconDevModeColor = {255, 16, 5} + elseif IconDevModeEnabledModoption == "scavpurp" then + IconDevModeColor = {97, 36, 97} + elseif IconDevModeEnabledModoption == "chickenorange" then + IconDevModeColor = {255, 125, 32} + elseif IconDevModeEnabledModoption == "gaiagray" then + IconDevModeColor = {127, 127, 127} + end + IconDevModeEnabled = true +end + +SimplePlayerColor = {0, 80, 255} -- Armada Blue +SimpleAllyColor = {0,255,0} -- Full Green +SimpleEnemyColor = {255, 16, 5} -- Cortex Red + +-- FFA +FFAColors = { + [1] = {82, 151, 255 }, -- Blue + [2] = {255, 0, 0 }, -- Red + [3] = {10, 232, 18 }, -- Green + [4] = {255, 232, 22 }, -- Yellow + [5] = {94, 9, 178 }, -- Purple + [6] = {255, 125, 32 }, -- Orange + [7] = {47, 66, 238 }, -- Darker Blue + [8] = {229, 18, 120 }, -- Pink + [9] = {191, 169, 255 }, -- Lavender + [10] ={255, 243, 135 }, -- Bleached Yellow + [11] ={0, 170, 99 }, -- Grass + [12] ={166, 14, 5 }, -- Blood + [13] ={178, 255, 227 }, -- Aqua + [14] ={251, 167, 120 }, -- Skin? lol + [15] ={8, 37, 190 }, -- Dark Blue + [16] ={118, 39, 6 }, -- Brown +} + + +AllyColors = { + [2] = { -- Two Teams + [1] = {0, 80, 255 }, -- Armada Blue + [2] = {10, 232, 18 }, -- Green + [3] = {147, 226, 251 }, -- Light Blue + [4] = {82, 151, 255 }, -- Darker Blue + [5] = {191, 169, 255 }, -- Lavender + [6] = {0, 170, 99 }, -- Grass + [7] = {117, 253, 147 }, -- Aqua Green + [8] = {8, 37, 190 }, -- Dark Blue + }, + [3] = { -- Three Teams + [1] = {82, 151, 255 }, + [2] = {47, 66, 238 }, + [3] = {147, 226, 251 }, + [4] = {8, 37, 190 }, + [5] = {35, 11, 129 }, + }, + [4] = { -- Four Teams + [1] = {82, 151, 255 }, + [2] = {47, 66, 238 }, + [3] = {147, 226, 251 }, + [4] = {8, 37, 190 }, + }, + [5] = { -- Five Teams + [1] = {82, 151, 255 }, + [2] = {47, 66, 238 }, + [3] = {147, 226, 251 }, + }, + [6] = { -- Six Teams + [1] = {82, 151, 255 }, + [2] = {47, 66, 238 }, + }, +} + +EnemyColors = { + [2] = { -- Two Teams + [1] = { + [1] = {200, 16, 5 }, -- Cortex Red + [2] = {255, 232, 22 }, -- Yellow + [3] = {255, 125, 32 }, -- Orange + [4] = {229, 18, 120 }, -- Pink + [5] = {255, 243, 135 }, -- Bleached Yellow + [6] = {166, 14, 5 }, -- Blood + [7] = {251, 167, 120 }, -- Skin? lol + [8] = {118, 39, 6 }, -- Brown + }, + }, + [3] = { -- Three Teams + [1] = { -- First Enemy Team + [1] = {231, 0, 0 }, + [2] = {255, 125, 32 }, + [3] = {255, 232, 22 }, + [4] = {166, 14, 5 }, + [5] = {118, 39, 6 }, + }, + [2] = { -- Second Enemy Team + [1] = {10, 232, 32 }, + [2] = {10, 142, 7 }, + [3] = {117, 253, 147 }, + [4] = {5, 84, 13 }, + [5] = {45, 57, 9 }, + }, + }, + [4] = { -- Four Teams + [1] = { -- First Enemy Team + [1] = {231, 0, 0 }, + [2] = {255, 125, 32 }, + [3] = {255, 232, 22 }, + [4] = {166, 14, 5 }, + }, + [2] = { -- Second Enemy Team + [1] = {10, 232, 32 }, + [2] = {10, 142, 7 }, + [3] = {117, 253, 147 }, + [4] = {5, 84, 13 }, + }, + [3] = { -- Third Enemy Team + [1] = {200, 102, 246 }, + [2] = {134, 10, 232 }, + [3] = {191, 169, 255 }, + [4] = {94, 9, 178 }, + }, + }, + [5] = { -- Five Teams + [1] = { -- First Enemy Team + [1] = {231, 0, 0 }, + [2] = {255, 125, 32 }, + [3] = {166, 14, 5 }, + }, + [2] = { -- Second Enemy Team + [1] = {10, 232, 32 }, + [2] = {10, 142, 7 }, + [3] = {117, 253, 147 }, + }, + [3] = { -- Third Enemy Team + [1] = {200, 102, 246 }, + [2] = {134, 10, 232 }, + [3] = {191, 169, 255 }, + }, + [4] = { -- Fourth Enemy Team + [1] = {255, 232, 22 }, + [2] = {191, 151, 8 }, + [3] = {255, 243, 135 }, + }, + }, + [6] = { -- Six Teams + [1] = { -- First Enemy Team + [1] = {231, 0, 0 }, + [2] = {166, 14, 5 }, + }, + [2] = { -- Second Enemy Team + [1] = {10, 232, 32 }, + [2] = {10, 142, 7 }, + }, + [3] = { -- Third Enemy Team + [1] = {200, 102, 246 }, + [2] = {134, 10, 232 }, + }, + [4] = { -- Fourth Enemy Team + [1] = {255, 232, 22 }, + [2] = {191, 151, 8 }, + }, + [5] = { -- Fifth Enemy Team + [1] = {255, 161, 73 }, + [2] = {222, 93, 0 }, + }, + }, +} + +ScavColor = {97, 36, 97} +GaiaColor = {127, 127, 127} + +local function MissingColorHandler(teamID, allyTeam) + local myTeam = spGetMyTeamID() + local myAllyTeam = spGetMyAllyTeamID() + if teamID == myTeam then + spSetTeamColor(teamID, SimplePlayerColor[1]/255, SimplePlayerColor[2]/255, SimplePlayerColor[3]/255) + elseif allyTeam == myAllyTeam then + spSetTeamColor(teamID, SimpleAllyColor[1]/255, SimpleAllyColor[2]/255, SimpleAllyColor[3]/255) + else + spSetTeamColor(teamID, SimpleEnemyColor[1]/255, SimpleEnemyColor[2]/255, SimpleEnemyColor[3]/255) + end +end + +local function EnemyColorHandler(teamID, allyTeam, allyTeamCount, myTeam, myAllyTeam) + if not EATeams[allyTeam] then + EATeams[allyTeam] = true + if EACountNumber then + EACount[allyTeam] = EACountNumber + 1 + EACountNumber = EACountNumber + 1 + else + EACount[allyTeam] = 1 + EACountNumber = 1 + end + EATeamsCount[allyTeam] = 0 + end + EATeamsCount[allyTeam] = EATeamsCount[allyTeam] + 1 + --Spring.Echo("allyTeamCount "..allyTeamCount) + --Spring.Echo("EACount[allyTeam] "..EACount[allyTeam]) + --Spring.Echo("EATeams[allyTeam] "..EATeams[allyTeam]) + --Spring.Echo("EATeamsCount[allyTeam] "..EATeamsCount[allyTeam]) + if EnemyColors[allyTeamCount] then + if EnemyColors[allyTeamCount][EACount[allyTeam]] then + if EnemyColors[allyTeamCount][EACount[allyTeam]][EATeamsCount[allyTeam]] then + spSetTeamColor( + teamID, + EnemyColors[allyTeamCount][EACount[allyTeam]][EATeamsCount[allyTeam]][1] /255, + EnemyColors[allyTeamCount][EACount[allyTeam]][EATeamsCount[allyTeam]][2] /255, + EnemyColors[allyTeamCount][EACount[allyTeam]][EATeamsCount[allyTeam]][3] /255 + ) + else + MissingColorHandler(teamID, allyTeam) + end + else + MissingColorHandler(teamID, allyTeam) + end + else + MissingColorHandler(teamID, allyTeam) + end + -- planned +end + +local function UpdatePlayerColors() + local teams = spGetTeamList() + local allyteams = spGetAllyTeamList() + local myTeam = spGetMyTeamID() + local myAllyTeam = spGetMyAllyTeamID() + local spectator = spGetSpectatingState() + EATeams = {} + EACount = {} + EATeamsCount = {} + for i = 1,#teams do + local teamID = teams[i] + local _, leader, isDead, isAiTeam, side, allyTeam, incomeMultiplier, customTeamKeys = spGetTeamInfo(teamID) + local luaAI = spGetTeamLuaAI(teamID) + if isAiTeam and (luaAI and (string.find(luaAI, "Scavenger"))) then + if string.find(luaAI, "Scavenger") then + spSetTeamColor(teamID, ScavColor[1]/255, ScavColor[2]/255, ScavColor[3]/255) + end + elseif spGetGaiaTeamID() == teamID then + spSetTeamColor(teamID, GaiaColor[1]/255, GaiaColor[2]/255, GaiaColor[3]/255) + else + if SimpleColorsEnabled == 1 then -- SimpleColors + MissingColorHandler(teamID, allyTeam) + elseif (AnonymousModeEnabled and allyTeam ~= myAllyTeam) and (not spectator) then + spSetTeamColor(teamID, SimpleEnemyColor[1]/255, SimpleEnemyColor[2]/255, SimpleEnemyColor[3]/255) + elseif #teams == #allyteams then -- FFA + ffaCounter = ffaCounter+1 + if AnonymousModeEnabled and teamID == myTeam and (not spectator) then + spSetTeamColor(teamID, SimplePlayerColor[1]/255, SimplePlayerColor[2]/255, SimplePlayerColor[3]/255) + elseif FFAColors[ffaCounter] then + spSetTeamColor(teamID, FFAColors[ffaCounter][1] /255, FFAColors[ffaCounter][2] /255, FFAColors[ffaCounter][3] /255) + else + MissingColorHandler(teamID, allyTeam) + end + else + if spectator or (not AnonymousModeEnabled and (not DynamicTeamColorsEnabled)) then + myTeam = 0 + myAllyTeam = 0 + end + if allyTeam == myAllyTeam then + allyCounter = allyCounter+1 + if AllyColors[#allyteams-1] then + if AllyColors[#allyteams-1][allyCounter] then + spSetTeamColor(teamID, AllyColors[#allyteams-1][allyCounter][1] /255, AllyColors[#allyteams-1][allyCounter][2] /255, AllyColors[#allyteams-1][allyCounter][3] /255) + else + MissingColorHandler(teamID, allyTeam) + end + else + MissingColorHandler(teamID, allyTeam) + end + else + EnemyColorHandler(teamID, allyTeam, #allyteams-1, myTeam, myAllyTeam) + end + end + end + if IconDevModeEnabled == true then + spSetTeamColor(teamID, IconDevModeColor[1] /255, IconDevModeColor[2] /255, IconDevModeColor[3] /255) + end + end + myTeam = nil + myAllyTeam = nil + ffaCounter = 0 + allyCounter = 0 + EATeams = nil + EACount = nil + EATeamsCount = nil + EACountNumber = nil +end + +function gadget:Initialize() + UpdatePlayerColors() +end + +function gadget:PlayerChanged(playerID) + if playerID == myPlayerID then + UpdatePlayerColors() + end +end + +function gadget:Update() + simpleColorsUpdateCounter = simpleColorsUpdateCounter + spGetLastUpdateSeconds() + if simpleColorsUpdateCounter > 1 then + simpleColorsUpdateCounter = 0 + local PreviousSimpleColorsEnabled = SimpleColorsEnabled + SimpleColorsEnabled = spGetConfigInt("simple_auto_colors", 0) + if PreviousSimpleColorsEnabled ~= SimpleColorsEnabled then + UpdatePlayerColors() + end + end + + if math.random(0,60) == 0 then + UpdatePlayerColors() + end +end + + + + diff --git a/LuaRules/Gadgets/game_controlVictory.lua b/LuaRules/Gadgets/game_controlVictory.lua index def3a1852..ac25a436f 100644 --- a/LuaRules/Gadgets/game_controlVictory.lua +++ b/LuaRules/Gadgets/game_controlVictory.lua @@ -899,7 +899,7 @@ else -- UNSYNCED local screenX = (vsx*0.5) - (screenWidth/2) local screenY = (vsy*0.5) + (screenHeight/2) local loadedFontSize = 32 - local font = gl.LoadFont("luaui/Fonts/FreeSansBold.otf", loadedFontSize, 16,2) + local font = gl.LoadFont("luaui/Fonts/JosefinSans-SemiBold.ttf", loadedFontSize, 16,2) local Text = gl.Text local Color = gl.Color diff --git a/LuaRules/Gadgets/game_end_over.lua b/LuaRules/Gadgets/game_end_over.lua new file mode 100644 index 000000000..ca5bf9aba --- /dev/null +++ b/LuaRules/Gadgets/game_end_over.lua @@ -0,0 +1,450 @@ +function gadget:GetInfo() + return { + name = "Game Over", + desc = "GAME OVER!! (handles conditions thereof)", + author = "SirMaverick, Google Frog, KDR_11k, CarRepairer (unified by KingRaptor)", + date = "2009", + license = "GPL", + layer = 1, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-- End game if only one allyteam with players AND units is left. +-- An allyteam is counted as dead if none of +-- its active players have units left. +-------------------------------------------------------------------------------- + +if (gadgetHandler:IsSyncedCode()) then + +--if Spring.GetModOption("zkmode",false,nil) == nil then +-- Spring.Echo(" Testing mode. Gadget removed.") +-- return +--end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local spGetTeamInfo = Spring.GetTeamInfo +local spGetTeamList = Spring.GetTeamList +local spGetTeamUnits = Spring.GetTeamUnits +local spDestroyUnit = Spring.DestroyUnit +local spGetAllUnits = Spring.GetAllUnits +local spGetAllyTeamList = Spring.GetAllyTeamList +local spGetPlayerInfo = Spring.GetPlayerInfo +local spGetPlayerList = Spring.GetPlayerList +local spAreTeamsAllied = Spring.AreTeamsAllied +local spGetUnitTeam = Spring.GetUnitTeam +local spGetUnitDefID = Spring.GetUnitDefID +local spGetUnitIsStunned= Spring.GetUnitIsStunned +local spGetUnitHealth = Spring.GetUnitHealth +local spGetUnitAllyTeam = Spring.GetUnitAllyTeam +local spTransferUnit = Spring.TransferUnit +local spKillTeam = Spring.KillTeam +local spGameOver = Spring.GameOver + +local COMM_VALUE = 500 +local ECON_SUPREMACY_MULT = 25 + +-------------------------------------------------------------------------------- +-- vars +-------------------------------------------------------------------------------- +local gaiaTeamID = Spring.GetGaiaTeamID() +local gaiaAllyTeamID = select(6, Spring.GetTeamInfo(gaiaTeamID)) +local chickenAllyTeamID + +local aliveCount = {} +local aliveValue = {} +local destroyedAlliances = {} +local allianceToReveal + +local finishedUnits = {} -- this stores a list of all units that have ever been completed, so it can distinguish between incomplete and partly reclaimed units +local toDestroy = {} + +local modOptions = Spring.GetModOptions() or {} +local destroy_type = modOptions.defeatmode or 'destroy' +local commends = tobool(modOptions.commends) +local noElo = tobool(modOptions.noelo) + +local revealed = false +local gameover = false + +local nilUnitDef = {id=-1} +local function GetUnitDefIdByName(defName) + return (UnitDefNames[defName] or nilUnitDef).id +end + +local doesNotCountList = { + [GetUnitDefIdByName("emine")] = true, + [GetUnitDefIdByName("emineai")] = true, + [GetUnitDefIdByName("edrone")] = true, +} + +-- auto detection of doesnotcount units +for name, ud in pairs(UnitDefs) do + if (ud.customParams.dontcount) then + doesNotCountList[ud.id] = true + elseif (ud.isFeature) then + doesNotCountList[ud.id] = true + elseif (not ud.canAttack) and (not ud.speed) and (not ud.isFactory) then + doesNotCountList[ud.id] = true + end +end + +local commsAlive = {} +local allyTeams = spGetAllyTeamList() +for i=1,#allyTeams do + commsAlive[allyTeams[i]] = {} +end + +-------------------------------------------------------------------------------- +-- local funcs +-------------------------------------------------------------------------------- +local function GetTeamIsChicken(teamID) + local luaAI = Spring.GetTeamLuaAI(teamID) + if luaAI and string.find(string.lower(luaAI), "chicken") then + return true + end + return false +end + +local function CountAllianceUnits(allianceID) + local teamlist = spGetTeamList(allianceID) or {} + local count = 0 + for i=1,#teamlist do + local teamID = teamlist[i] + count = count + (aliveCount[teamID] or 0) + if (GG.waitingForComm or {})[teamID] then + count = count + 1 + end + end + return count +end + +local function CountAllianceValue(allianceID) + local teamlist = spGetTeamList(allianceID) or {} + local value = 0 + for i=1,#teamlist do + local teamID = teamlist[i] + value = value + (aliveValue[teamID] or 0) + if (GG.waitingForComm or {})[teamID] then + value = value + COMM_VALUE + end + end + return value +end + +local function HasNoComms(allianceID) + for unitID in pairs(commsAlive[allianceID]) do + return false + end + return true +end + +local function UnitWithinBounds(unitID) + local x, y, z = Spring.GetUnitPosition(unitID) + return (x > -500) and (x < Game.mapSizeX + 500) and (y > -1000) and (z > -500) and (z < Game.mapSizeZ + 500) +end + +-- if only one allyteam left, declare it the victor +local function CheckForVictory() + local allylist = spGetAllyTeamList() + local count = 0 + local lastAllyTeam + for _,a in pairs(allylist) do + if not destroyedAlliances[a] and (a ~= gaiaAllyTeamID) then + --Spring.Echo("Alliance " .. a .. " remains in the running") + count = count + 1 + lastAllyTeam = a + end + end + if count < 2 then + Spring.Echo(( (lastAllyTeam and ("Team " .. lastAllyTeam)) or "Nobody") .. " wins!") + spGameOver({lastAllyTeam}) + end +end + +local function RevealAllianceUnits(allianceID) + allianceToReveal = allianceID + local teamList = spGetTeamList(allianceID) + for i=1,#teamList do + local t = teamList[i] + local teamUnits = spGetTeamUnits(t) + for j=1,#teamUnits do + local u = teamUnits[j] + -- purge extra-map units + if not UnitWithinBounds(u) then + Spring.DestroyUnit(u) + else + Spring.SetUnitAlwaysVisible(u, true) + end + end + end +end + +-- purge the alliance! +local function DestroyAlliance(allianceID) + if not destroyedAlliances[allianceID] then + destroyedAlliances[allianceID] = true + local teamList = spGetTeamList(allianceID) + if teamList == nil then return end -- empty allyteam, don't bother + + if destroy_type == 'debug' then + Spring.Echo("Game Over: DEBUG") + Spring.Echo("Game Over: Allyteam " .. allianceID .. " has met the game over conditions.") + Spring.Echo("Game Over: If this is true, then please resign.") + return -- don't perform victory check + elseif destroy_type == 'destroy' then -- kaboom + Spring.Echo("Game Over: Destroying alliance " .. allianceID) + for i=1,#teamList do + local t = teamList[i] + local teamUnits = spGetTeamUnits(t) + for j=1,#teamUnits do + local u = teamUnits[j] + local pwUnits = (GG.PlanetWars or {}).unitsByID + if pwUnits and pwUnits[u] then + spTransferUnit(u, gaiaTeamID, true) -- don't blow up PW buildings + else + toDestroy[u] = true + end + end + spKillTeam(t) + end + elseif destroy_type == 'losecontrol' then -- no orders can be issued to team + Spring.Echo("Game Over: Destroying alliance " .. allianceID) + for i=1,#teamList do + spKillTeam(teamList[i]) + end + end + end + CheckForVictory() +end +GG.DestroyAlliance = DestroyAlliance + +local function AddAllianceUnit(u, ud, teamID) + local _, _, _, _, _, allianceID = spGetTeamInfo(teamID) + aliveCount[teamID] = aliveCount[teamID] + 1 + + aliveValue[teamID] = aliveValue[teamID] + UnitDefs[ud].metalCost + + --Spring.Echo("added alliance=" .. teamID, 'count='..aliveCount[allianceID]) + if UnitDefs[ud].customParams.commtype then + commsAlive[allianceID][u] = true + end +end + +local function RemoveAllianceUnit(u, ud, teamID) + local _, _, _, _, _, allianceID = spGetTeamInfo(teamID) + aliveCount[teamID] = aliveCount[teamID] - 1 + + aliveValue[teamID] = aliveValue[teamID] - UnitDefs[ud].metalCost + if aliveValue[teamID] < 0 then + aliveValue[teamID] = 0 + end + + --Spring.Echo("removed alliance=" .. teamID, 'count='..aliveCount[allianceID]) + if UnitDefs[ud].customParams.commtype then + commsAlive[allianceID][u] = nil + end + if ((CountAllianceUnits(allianceID) <= 0) or (commends and HasNoComms(allianceID))) and (allianceID ~= chickenAllyTeamID) then + Spring.Log(gadget:GetInfo().name, LOG.INFO, " Purging allyTeam " .. allianceID) + DestroyAlliance(allianceID) + end +end + +local function CompareArmyValues(ally1, ally2) + local value1, value2 = CountAllianceValue(ally1), CountAllianceValue(ally2) + if value1 > ECON_SUPREMACY_MULT*value2 then + return ally1 + elseif value2 > ECON_SUPREMACY_MULT*value1 then + return ally2 + end + return nil +end + +-- used during initialization +local function CheckAllUnits() + aliveCount = {} + local teams = spGetTeamList() + for i=1,#teams do + local teamID = teams[i] + if teamID ~= gaiaTeamID then + aliveCount[teamID] = 0 + end + end + local units = spGetAllUnits() + for i=1,#units do + local unitID = units[i] + local teamID = spGetUnitTeam(unitID) + local unitDefID = spGetUnitDefID(unitID) + gadget:UnitFinished(unitID, unitDefID, teamID) + end +end + +-- check for active players +local function ProcessLastAlly() + if Spring.IsCheatingEnabled() or destroy_type == 'debug' then + return + end + local allylist = spGetAllyTeamList() + local activeAllies = {} + local lastActive = nil + for i=1,#allylist do + repeat + local a = allylist[i] + if (a == gaiaAllyTeamID) then break end -- continue + if (destroyedAlliances[a]) then break end -- continue + local teamlist = spGetTeamList(a) + if (not teamlist) then break end -- continue + local activeTeams = 0 + for i=1,#teamlist do + local t = teamlist[i] + -- any team without units is dead to us; so only teams who are active AND have units matter + -- except chicken, who are alive even without units + local numAlive = aliveCount[t] + if #(Spring.GetTeamUnits(t)) == 0 then numAlive = 0 end + if (numAlive > 0) or (GG.waitingForComm or {})[t] or (GetTeamIsChicken(t)) then + local playerlist = spGetPlayerList(t, true) -- active players + if playerlist then + for j=1,#playerlist do + local _,active,spec = spGetPlayerInfo(playerlist[j]) + if active and not spec then + activeTeams = activeTeams + 1 + end + end + end + -- count AI teams as active + local _,_,_,isAiTeam = spGetTeamInfo(t) + if isAiTeam then + activeTeams = activeTeams + 1 + end + end + end + if activeTeams > 0 then + activeAllies[#activeAllies+1] = a + lastActive = a + end + until true + end -- for + + if #activeAllies == 2 then + if revealed then return end + if activeAllies[1] == chickenAllyTeamID or activeAllies[2] == chickenAllyTeamID then + return + end + -- run value comparison + local supreme = CompareArmyValues(activeAllies[1], activeAllies[2]) + if supreme then + Spring.Echo("AllyTeam " .. supreme .. " has an overwhelming numerical advantage!") + for i=1, #allylist do + local a = allylist[i] + if (a ~= supreme) and (a ~= gaiaAllyTeamID) then + RevealAllianceUnits(a) + revealed = true + end + end + end + elseif #activeAllies < 2 then + -- remove every unit except for last active alliance + for i=1, #allylist do + local a = allylist[i] + if (a ~= lastActive)and(a ~= gaiaAllyTeamID) then + DestroyAlliance(a) + end + end + end +end + +-------------------------------------------------------------------------------- +-- callins +-------------------------------------------------------------------------------- + +function gadget:UnitFinished(u, ud, team) + if (team ~= gaiaTeamID) + and(not doesNotCountList[ud]) + and(not finishedUnits[u]) + then + finishedUnits[u] = true + AddAllianceUnit(u, ud, team) + end +end + +function gadget:UnitCreated(u, ud, team) + if revealed then + local allyTeam = select(6, spGetTeamInfo(team)) + if allyTeam == allianceToReveal then + Spring.SetUnitAlwaysVisible(u, true) + end + end +end + +function gadget:UnitDestroyed(u, ud, team) + if (team ~= gaiaTeamID) + and(not doesNotCountList[ud]) + and finishedUnits[u] + then + finishedUnits[u] = nil + RemoveAllianceUnit(u, ud, team) + end + toDestroy[u] = nil +end + +-- note: Taken comes before Given +function gadget:UnitGiven(u, ud, newTeam, oldTeam) + if (newTeam ~= gaiaTeamID) + and(not doesNotCountList[ud]) + and(not select(3,spGetUnitIsStunned(u))) + then + AddAllianceUnit(u, ud, newTeam) + end +end + +function gadget:UnitTaken(u, ud, oldTeam, newTeam) + if (oldTeam ~= gaiaTeamID) + and(not doesNotCountList[ud]) + and(select(5,spGetUnitHealth(u))>=1) + then + RemoveAllianceUnit(u, ud, oldTeam) + end +end + +function gadget:Initialize() + local teams = spGetTeamList() + for i=1,#teams do + aliveValue[teams[i]] = 0 + if GetTeamIsChicken(teams[i]) then + Spring.Log(gadget:GetInfo().name, LOG.INFO, " Chicken team found") + chickenAllyTeamID = select(6, Spring.GetTeamInfo(teams[i])) + --break + end + end + + CheckAllUnits() + + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Game Over initialized") +end + +function gadget:GameFrame(n) + -- check for last ally: + -- end condition: only 1 ally with human players, no AIs in other ones + if (n % 45 == 0) then + for u in pairs(toDestroy) do + spDestroyUnit(u, true) + end + toDestroy = {} + if not gameover then + ProcessLastAlly() + end + end +end + +function gadget:GameOver() + gameover = true + if noElo then + Spring.SendCommands("wbynum 255 SPRINGIE:noElo") + end + Spring.Log(gadget:GetInfo().name, LOG.INFO, "GAME OVER!!") +end + +else -- UNSYNCED + +end diff --git a/LuaRules/Gadgets/game_end_team_com_ends.lua b/LuaRules/Gadgets/game_end_team_com_ends.lua new file mode 100644 index 000000000..20261a4f9 --- /dev/null +++ b/LuaRules/Gadgets/game_end_team_com_ends.lua @@ -0,0 +1,173 @@ +function gadget:GetInfo() + return { + name = "Team Com Ends", + desc = "Implements com ends for allyteams", + author = "KDR_11k (David Becker)", + date = "2008-02-04", + license = "Public domain", + layer = 1, + enabled = true + } +end + +-- this acts just like Com Ends except instead of killing a player's units when +-- his com dies it acts on an allyteam level, if all coms in an allyteam are dead +-- the allyteam is out + +deathMode = tonumber(Spring.GetModOptions().deathmode) -- Radius around a point in which to capture it +if deathMode == nil then + deathMode = "com" +end + +-- the deathmode modoption must be set to one of the following to enable this +local endmodes = { + com=true, +} + +if (gadgetHandler:IsSyncedCode()) then + +--SYNCED + +---STUFF FOR DEATH SOUNDS +local DeathSounds = VFS.DirList('sounds/deathsounds/generic', '*.wav') +------------------------- + +local destroyQueue = {} + +local destroyUnitQueue = {} + +local aliveCount = {} + +local isAlive = {} + +local GetTeamList=Spring.GetTeamList +local GetTeamUnits = Spring.GetTeamUnits +local GetUnitAllyTeam = Spring.GetUnitAllyTeam +local DestroyUnit=Spring.DestroyUnit +local GetUnitPosition = Spring.GetUnitPosition +local SpawnCEG = Spring.SpawnCEG + +local DISTANCE_LIMIT = (math.max(Game.mapSizeX,Game.mapSizeZ) * math.max(Game.mapSizeX,Game.mapSizeZ)) +local min = math.min +local deathWave = false +local deathTimeBoost = 1 + +local function getSqrDistance(x1,z1,x2,z2) + local dx,dz = x1-x2,z1-z2 + return (dx*dx)+(dz*dz) +end + +function gadget:Initialize() + --Spring.Echo("Deathmode is " .. deathMode) + if not endmodes[deathMode] then + gadgetHandler:RemoveGadget(self) -- in particular, this gadget is removed if deathmode is "killall" or "none" + end + for _,t in ipairs(Spring.GetAllyTeamList()) do + aliveCount[t] = 0 + end +end + +function gadget:GameFrame(t) + --Spring.Echo("Deathmode is " .. deathMode) + if t % 15 < 1 then + for at,defs in pairs(destroyQueue) do + if aliveCount[at] <= 0 then --safety check, triggers on transferring the last com otherwise + for _,team in ipairs(GetTeamList(at)) do + for _,unitID in ipairs(GetTeamUnits(team)) do + local x,y,z = GetUnitPosition(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + local deathTime = ((getSqrDistance(x,z,defs.x,defs.z) / DISTANCE_LIMIT) * 250) + if (destroyUnitQueue[unitID] == nil) then + destroyUnitQueue[unitID] = { + time = t + deathTime, + x = x, + y = y, + z = z, + spark = false + } + end + end + end + deathWave = true + end + --destroyQueue[at]=nil + end + end + + if (deathWave) and next(destroyUnitQueue) then + local dt = (t + deathTimeBoost) + for unitID, defs in pairs(destroyUnitQueue) do + if ((dt > (defs.time - 15)) and (defs.spark == false)) then + SpawnCEG("genericshellexplosion-huge-sparks-burn",defs.x,defs.y,defs.z,0,0,0) + destroyUnitQueue[unitID].spark = true + end + if (dt > defs.time) then + DestroyUnit(unitID, true) + destroyUnitQueue[unitID] = nil + local deathsound = DeathSounds[math.random(1, #DeathSounds)] + Spring.PlaySoundFile(deathsound, math.random(1,7), defs.x, defs.y, defs.z) + end + end + deathTimeBoost = deathTimeBoost * 1.01 + end + +end + +function gadget:UnitCreated(u, ud, team) + isAlive[u] = true + if UnitDefs[ud].customParams.iscommander then + local allyTeam = GetUnitAllyTeam(u) + aliveCount[allyTeam] = aliveCount[allyTeam] + 1 + end +end + +function gadget:UnitGiven(u, ud, team) + if UnitDefs[ud].customParams.iscommander then + local allyTeam = GetUnitAllyTeam(u) + aliveCount[allyTeam] = aliveCount[allyTeam] + 1 + end +end + +function gadget:UnitDestroyed(u, ud, team) + isAlive[u] = nil + if UnitDefs[ud].customParams.iscommander then + local allyTeam = GetUnitAllyTeam(u) + aliveCount[allyTeam] = aliveCount[allyTeam] - 1 + if aliveCount[allyTeam] <= 0 then + local x,y,z = Spring.GetUnitPosition(u) + destroyQueue[allyTeam] = {x = x, y = y, z = z} + end + end +end + +function gadget:UnitTaken(u, ud, team) + if isAlive[u] and UnitDefs[ud].customParams.iscommander then + local allyTeam = GetUnitAllyTeam(u) + aliveCount[allyTeam] = aliveCount[allyTeam] - 1 + if aliveCount[allyTeam] <= 0 then + local x,y,z = Spring.GetUnitPosition(u) + destroyQueue[allyTeam] = {x = x, y = y, z = z} + end + end +end + +function gadget:TeamDied(team) + local _,_,_,_,_,allyTeam = Spring.GetTeamInfo(team) + for _,unitID in ipairs(GetTeamUnits(team)) do + local unitDefID = Spring.GetUnitDefID(unitID) + if isAlive[unitID] and UnitDefs[unitDefID].customParams.iscommander then + local x,y,z = GetUnitPosition(unitID) + local deathsound = "sounds/explosions/explosion_enormous.wav" + Spring.PlaySoundFile(deathsound, 7, x, y, z) + DestroyUnit(unitID, true) + end + end +end + +else + +--UNSYNCED + +return false + +end diff --git a/LuaRules/Gadgets/game_featureReclaim.lua b/LuaRules/Gadgets/game_featureReclaim.lua index 6856a1930..89fef9e13 100644 --- a/LuaRules/Gadgets/game_featureReclaim.lua +++ b/LuaRules/Gadgets/game_featureReclaim.lua @@ -6,7 +6,7 @@ function gadget:GetInfo() date = "December, 2008", license = "public domain", layer = 0, - enabled = true -- loaded by default? + enabled = false -- loaded by default? } end @@ -26,10 +26,10 @@ if gadgetHandler:IsSyncedCode() then reclaimLeft[featureID] = (reclaimLeft[featureID] or 0.1) + part if (reclaimLeft[featureID] <= 0) then Spring.DestroyFeature(featureID) - Spring.AddTeamResource(builderTeam, "e", 10) + --Spring.AddTeamResource(builderTeam, "e", 1) local fx, fy, fz = GetFeaturePosition(featureID) - Spring.PlaySoundFile("sounds/miscfx/reclaimed.wav", 1, fx, fy, fz) - SpawnCEG("sparklegreenplus10energy", fx, fy, fz) + Spring.PlaySoundFile("sounds/miscfx/reclaimed.wav", 0.5, fx, fy, fz) + SpawnCEG("sparklegreen", fx, fy, fz) end return false end diff --git a/LuaRules/Gadgets/game_linearEdgeEffectiveness.lua b/LuaRules/Gadgets/game_linearEdgeEffectiveness.lua new file mode 100644 index 000000000..2a8a353f9 --- /dev/null +++ b/LuaRules/Gadgets/game_linearEdgeEffectiveness.lua @@ -0,0 +1,39 @@ +function gadget:GetInfo() + return { + name = "Linear EdgeEffectiveness", + desc = "Makes AOE damage fall off linearly between 0 and 1", + author = "Sprung", + date = "Does it matter?", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = false -- loaded by default? + } +end +--[[ +function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID) + if weaponDefID <= 0 then + return damage -- environmental damage, no weapondef entry + end + + local weaponDef = WeaponDefs[weaponDefID] + local ee = weaponDef.edgeEffectiveness + if ee == 1 then + return damage -- already desired behaviour and would else crash due to div0 + end + + local baseDamage = weaponDef.damages[UnitDefs[unitDefID].armorType] + + local isArmored, armorMult = Spring.GetUnitArmored(unitID) + if isArmored then + if armorMult == 0 then + return 0 + end + baseDamage = baseDamage * armorMult + end + + local fraction = damage / baseDamage + local distance = (1 - fraction) / (1 - fraction*ee) + + return baseDamage * (1 - distance*(1 - ee)) +end +]]-- \ No newline at end of file diff --git a/LuaRules/Gadgets/game_over.lua b/LuaRules/Gadgets/game_over.lua deleted file mode 100644 index de6c66b9d..000000000 --- a/LuaRules/Gadgets/game_over.lua +++ /dev/null @@ -1,450 +0,0 @@ -function gadget:GetInfo() - return { - name = "Game Over", - desc = "GAME OVER!! (handles conditions thereof)", - author = "SirMaverick, Google Frog, KDR_11k, CarRepairer (unified by KingRaptor)", - date = "2009", - license = "GPL", - layer = 1, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --- End game if only one allyteam with players AND units is left. --- An allyteam is counted as dead if none of --- its active players have units left. --------------------------------------------------------------------------------- - -if (gadgetHandler:IsSyncedCode()) then - ---if Spring.GetModOption("zkmode",false,nil) == nil then --- Spring.Echo(" Testing mode. Gadget removed.") --- return ---end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -local spGetTeamInfo = Spring.GetTeamInfo -local spGetTeamList = Spring.GetTeamList -local spGetTeamUnits = Spring.GetTeamUnits -local spDestroyUnit = Spring.DestroyUnit -local spGetAllUnits = Spring.GetAllUnits -local spGetAllyTeamList = Spring.GetAllyTeamList -local spGetPlayerInfo = Spring.GetPlayerInfo -local spGetPlayerList = Spring.GetPlayerList -local spAreTeamsAllied = Spring.AreTeamsAllied -local spGetUnitTeam = Spring.GetUnitTeam -local spGetUnitDefID = Spring.GetUnitDefID -local spGetUnitIsStunned= Spring.GetUnitIsStunned -local spGetUnitHealth = Spring.GetUnitHealth -local spGetUnitAllyTeam = Spring.GetUnitAllyTeam -local spTransferUnit = Spring.TransferUnit -local spKillTeam = Spring.KillTeam -local spGameOver = Spring.GameOver - -local COMM_VALUE = UnitDefNames.ecommander.metalCost or 500 -local ECON_SUPREMACY_MULT = 25 - --------------------------------------------------------------------------------- --- vars --------------------------------------------------------------------------------- -local gaiaTeamID = Spring.GetGaiaTeamID() -local gaiaAllyTeamID = select(6, Spring.GetTeamInfo(gaiaTeamID)) -local chickenAllyTeamID - -local aliveCount = {} -local aliveValue = {} -local destroyedAlliances = {} -local allianceToReveal - -local finishedUnits = {} -- this stores a list of all units that have ever been completed, so it can distinguish between incomplete and partly reclaimed units -local toDestroy = {} - -local modOptions = Spring.GetModOptions() or {} -local destroy_type = modOptions.defeatmode or 'destroy' -local commends = tobool(modOptions.commends) -local noElo = tobool(modOptions.noelo) - -local revealed = false -local gameover = false - -local nilUnitDef = {id=-1} -local function GetUnitDefIdByName(defName) - return (UnitDefNames[defName] or nilUnitDef).id -end - -local doesNotCountList = { - [GetUnitDefIdByName("emine")] = true, - [GetUnitDefIdByName("emineai")] = true, - [GetUnitDefIdByName("edrone")] = true, -} - --- auto detection of doesnotcount units -for name, ud in pairs(UnitDefs) do - if (ud.customParams.dontcount) then - doesNotCountList[ud.id] = true - elseif (ud.isFeature) then - doesNotCountList[ud.id] = true - elseif (not ud.canAttack) and (not ud.speed) and (not ud.isFactory) then - doesNotCountList[ud.id] = true - end -end - -local commsAlive = {} -local allyTeams = spGetAllyTeamList() -for i=1,#allyTeams do - commsAlive[allyTeams[i]] = {} -end - --------------------------------------------------------------------------------- --- local funcs --------------------------------------------------------------------------------- -local function GetTeamIsChicken(teamID) - local luaAI = Spring.GetTeamLuaAI(teamID) - if luaAI and string.find(string.lower(luaAI), "chicken") then - return true - end - return false -end - -local function CountAllianceUnits(allianceID) - local teamlist = spGetTeamList(allianceID) or {} - local count = 0 - for i=1,#teamlist do - local teamID = teamlist[i] - count = count + (aliveCount[teamID] or 0) - if (GG.waitingForComm or {})[teamID] then - count = count + 1 - end - end - return count -end - -local function CountAllianceValue(allianceID) - local teamlist = spGetTeamList(allianceID) or {} - local value = 0 - for i=1,#teamlist do - local teamID = teamlist[i] - value = value + (aliveValue[teamID] or 0) - if (GG.waitingForComm or {})[teamID] then - value = value + COMM_VALUE - end - end - return value -end - -local function HasNoComms(allianceID) - for unitID in pairs(commsAlive[allianceID]) do - return false - end - return true -end - -local function UnitWithinBounds(unitID) - local x, y, z = Spring.GetUnitPosition(unitID) - return (x > -500) and (x < Game.mapSizeX + 500) and (y > -1000) and (z > -500) and (z < Game.mapSizeZ + 500) -end - --- if only one allyteam left, declare it the victor -local function CheckForVictory() - local allylist = spGetAllyTeamList() - local count = 0 - local lastAllyTeam - for _,a in pairs(allylist) do - if not destroyedAlliances[a] and (a ~= gaiaAllyTeamID) then - --Spring.Echo("Alliance " .. a .. " remains in the running") - count = count + 1 - lastAllyTeam = a - end - end - if count < 2 then - Spring.Echo(( (lastAllyTeam and ("Team " .. lastAllyTeam)) or "Nobody") .. " wins!") - spGameOver({lastAllyTeam}) - end -end - -local function RevealAllianceUnits(allianceID) - allianceToReveal = allianceID - local teamList = spGetTeamList(allianceID) - for i=1,#teamList do - local t = teamList[i] - local teamUnits = spGetTeamUnits(t) - for j=1,#teamUnits do - local u = teamUnits[j] - -- purge extra-map units - if not UnitWithinBounds(u) then - Spring.DestroyUnit(u) - else - Spring.SetUnitAlwaysVisible(u, true) - end - end - end -end - --- purge the alliance! -local function DestroyAlliance(allianceID) - if not destroyedAlliances[allianceID] then - destroyedAlliances[allianceID] = true - local teamList = spGetTeamList(allianceID) - if teamList == nil then return end -- empty allyteam, don't bother - - if destroy_type == 'debug' then - Spring.Echo("Game Over: DEBUG") - Spring.Echo("Game Over: Allyteam " .. allianceID .. " has met the game over conditions.") - Spring.Echo("Game Over: If this is true, then please resign.") - return -- don't perform victory check - elseif destroy_type == 'destroy' then -- kaboom - Spring.Echo("Game Over: Destroying alliance " .. allianceID) - for i=1,#teamList do - local t = teamList[i] - local teamUnits = spGetTeamUnits(t) - for j=1,#teamUnits do - local u = teamUnits[j] - local pwUnits = (GG.PlanetWars or {}).unitsByID - if pwUnits and pwUnits[u] then - spTransferUnit(u, gaiaTeamID, true) -- don't blow up PW buildings - else - toDestroy[u] = true - end - end - spKillTeam(t) - end - elseif destroy_type == 'losecontrol' then -- no orders can be issued to team - Spring.Echo("Game Over: Destroying alliance " .. allianceID) - for i=1,#teamList do - spKillTeam(teamList[i]) - end - end - end - CheckForVictory() -end -GG.DestroyAlliance = DestroyAlliance - -local function AddAllianceUnit(u, ud, teamID) - local _, _, _, _, _, allianceID = spGetTeamInfo(teamID) - aliveCount[teamID] = aliveCount[teamID] + 1 - - aliveValue[teamID] = aliveValue[teamID] + UnitDefs[ud].metalCost - - --Spring.Echo("added alliance=" .. teamID, 'count='..aliveCount[allianceID]) - if UnitDefs[ud].customParams.commtype then - commsAlive[allianceID][u] = true - end -end - -local function RemoveAllianceUnit(u, ud, teamID) - local _, _, _, _, _, allianceID = spGetTeamInfo(teamID) - aliveCount[teamID] = aliveCount[teamID] - 1 - - aliveValue[teamID] = aliveValue[teamID] - UnitDefs[ud].metalCost - if aliveValue[teamID] < 0 then - aliveValue[teamID] = 0 - end - - --Spring.Echo("removed alliance=" .. teamID, 'count='..aliveCount[allianceID]) - if UnitDefs[ud].customParams.commtype then - commsAlive[allianceID][u] = nil - end - if ((CountAllianceUnits(allianceID) <= 0) or (commends and HasNoComms(allianceID))) and (allianceID ~= chickenAllyTeamID) then - Spring.Log(gadget:GetInfo().name, LOG.INFO, " Purging allyTeam " .. allianceID) - DestroyAlliance(allianceID) - end -end - -local function CompareArmyValues(ally1, ally2) - local value1, value2 = CountAllianceValue(ally1), CountAllianceValue(ally2) - if value1 > ECON_SUPREMACY_MULT*value2 then - return ally1 - elseif value2 > ECON_SUPREMACY_MULT*value1 then - return ally2 - end - return nil -end - --- used during initialization -local function CheckAllUnits() - aliveCount = {} - local teams = spGetTeamList() - for i=1,#teams do - local teamID = teams[i] - if teamID ~= gaiaTeamID then - aliveCount[teamID] = 0 - end - end - local units = spGetAllUnits() - for i=1,#units do - local unitID = units[i] - local teamID = spGetUnitTeam(unitID) - local unitDefID = spGetUnitDefID(unitID) - gadget:UnitFinished(unitID, unitDefID, teamID) - end -end - --- check for active players -local function ProcessLastAlly() - if Spring.IsCheatingEnabled() or destroy_type == 'debug' then - return - end - local allylist = spGetAllyTeamList() - local activeAllies = {} - local lastActive = nil - for i=1,#allylist do - repeat - local a = allylist[i] - if (a == gaiaAllyTeamID) then break end -- continue - if (destroyedAlliances[a]) then break end -- continue - local teamlist = spGetTeamList(a) - if (not teamlist) then break end -- continue - local activeTeams = 0 - for i=1,#teamlist do - local t = teamlist[i] - -- any team without units is dead to us; so only teams who are active AND have units matter - -- except chicken, who are alive even without units - local numAlive = aliveCount[t] - if #(Spring.GetTeamUnits(t)) == 0 then numAlive = 0 end - if (numAlive > 0) or (GG.waitingForComm or {})[t] or (GetTeamIsChicken(t)) then - local playerlist = spGetPlayerList(t, true) -- active players - if playerlist then - for j=1,#playerlist do - local _,active,spec = spGetPlayerInfo(playerlist[j]) - if active and not spec then - activeTeams = activeTeams + 1 - end - end - end - -- count AI teams as active - local _,_,_,isAiTeam = spGetTeamInfo(t) - if isAiTeam then - activeTeams = activeTeams + 1 - end - end - end - if activeTeams > 0 then - activeAllies[#activeAllies+1] = a - lastActive = a - end - until true - end -- for - - if #activeAllies == 2 then - if revealed then return end - if activeAllies[1] == chickenAllyTeamID or activeAllies[2] == chickenAllyTeamID then - return - end - -- run value comparison - local supreme = CompareArmyValues(activeAllies[1], activeAllies[2]) - if supreme then - Spring.Echo("AllyTeam " .. supreme .. " has an overwhelming numerical advantage!") - for i=1, #allylist do - local a = allylist[i] - if (a ~= supreme) and (a ~= gaiaAllyTeamID) then - RevealAllianceUnits(a) - revealed = true - end - end - end - elseif #activeAllies < 2 then - -- remove every unit except for last active alliance - for i=1, #allylist do - local a = allylist[i] - if (a ~= lastActive)and(a ~= gaiaAllyTeamID) then - DestroyAlliance(a) - end - end - end -end - --------------------------------------------------------------------------------- --- callins --------------------------------------------------------------------------------- - -function gadget:UnitFinished(u, ud, team) - if (team ~= gaiaTeamID) - and(not doesNotCountList[ud]) - and(not finishedUnits[u]) - then - finishedUnits[u] = true - AddAllianceUnit(u, ud, team) - end -end - -function gadget:UnitCreated(u, ud, team) - if revealed then - local allyTeam = select(6, spGetTeamInfo(team)) - if allyTeam == allianceToReveal then - Spring.SetUnitAlwaysVisible(u, true) - end - end -end - -function gadget:UnitDestroyed(u, ud, team) - if (team ~= gaiaTeamID) - and(not doesNotCountList[ud]) - and finishedUnits[u] - then - finishedUnits[u] = nil - RemoveAllianceUnit(u, ud, team) - end - toDestroy[u] = nil -end - --- note: Taken comes before Given -function gadget:UnitGiven(u, ud, newTeam, oldTeam) - if (newTeam ~= gaiaTeamID) - and(not doesNotCountList[ud]) - and(not select(3,spGetUnitIsStunned(u))) - then - AddAllianceUnit(u, ud, newTeam) - end -end - -function gadget:UnitTaken(u, ud, oldTeam, newTeam) - if (oldTeam ~= gaiaTeamID) - and(not doesNotCountList[ud]) - and(select(5,spGetUnitHealth(u))>=1) - then - RemoveAllianceUnit(u, ud, oldTeam) - end -end - -function gadget:Initialize() - local teams = spGetTeamList() - for i=1,#teams do - aliveValue[teams[i]] = 0 - if GetTeamIsChicken(teams[i]) then - Spring.Log(gadget:GetInfo().name, LOG.INFO, " Chicken team found") - chickenAllyTeamID = select(6, Spring.GetTeamInfo(teams[i])) - --break - end - end - - CheckAllUnits() - - Spring.Log(gadget:GetInfo().name, LOG.INFO, "Game Over initialized") -end - -function gadget:GameFrame(n) - -- check for last ally: - -- end condition: only 1 ally with human players, no AIs in other ones - if (n % 45 == 0) then - for u in pairs(toDestroy) do - spDestroyUnit(u, true) - end - toDestroy = {} - if not gameover then - ProcessLastAlly() - end - end -end - -function gadget:GameOver() - gameover = true - if noElo then - Spring.SendCommands("wbynum 255 SPRINGIE:noElo") - end - Spring.Log(gadget:GetInfo().name, LOG.INFO, "GAME OVER!!") -end - -else -- UNSYNCED - -end diff --git a/LuaRules/Gadgets/game_prevent_excessive_share.lua b/LuaRules/Gadgets/game_prevent_excessive_share.lua new file mode 100644 index 000000000..0a0eb036e --- /dev/null +++ b/LuaRules/Gadgets/game_prevent_excessive_share.lua @@ -0,0 +1,52 @@ + +function gadget:GetInfo() + return { + name = 'Prevent Excessive Share', + desc = 'Prevents sharing more resources than the receiver can hold', + author = 'Niobium', + date = 'April 2012', + license = 'GNU GPL, v2 or later', + layer = 0, + enabled = true + } +end + +---------------------------------------------------------------- +-- Synced only +---------------------------------------------------------------- +if not gadgetHandler:IsSyncedCode() then + return false +end + +---------------------------------------------------------------- +-- Callins +---------------------------------------------------------------- +function gadget:AllowResourceTransfer(senderTeamId, receiverTeamId, resourceType, amount) + + -- Spring uses 'm' and 'e' instead of the full names that we need, so we need to convert the resourceType + -- We also check for 'metal' or 'energy' incase Spring decides to use those in a later version + local resourceName + if (resourceType == 'm') or (resourceType == 'metal') then + resourceName = 'metal' + elseif (resourceType == 'e') or (resourceType == 'energy') then + resourceName = 'energy' + else + -- We don't handle whatever this resource is, allow it + return true + end + + -- Calculate the maximum amount the receiver can receive + local rCur, rStor, rPull, rInc, rExp, rShare = Spring.GetTeamResources(receiverTeamId, resourceName) + local maxShare = rStor * rShare - rCur + + -- Is the sender trying to send more than the maximum? Block it, possibly sending a reduced amount instead + if amount > maxShare then + if maxShare > 0 then + Spring.ShareTeamResource(senderTeamId, receiverTeamId, resourceName, maxShare) + end + return false + end + + -- Allow anything we don't explictly block + return true +end diff --git a/LuaRules/Gadgets/game_resourceGifts.lua b/LuaRules/Gadgets/game_resourceGifts.lua index 4d3d11084..215cb4ac1 100644 --- a/LuaRules/Gadgets/game_resourceGifts.lua +++ b/LuaRules/Gadgets/game_resourceGifts.lua @@ -10,12 +10,12 @@ function gadget:GetInfo() } end -local MEX_INCOME = 0.5 -- income of each mex +local MEX_INCOME = 1 -- income of each mex local modOptions = Spring.GetModOptions(); -- Give resources to teams -local baseIncome = 0 -local baseIncomeIncrease = Spring.GetModOptions().basicincome or 1 -- add this each 1cycle +local baseIncome = Spring.GetModOptions().basicincome or 1 +local baseIncomeIncrease = Spring.GetModOptions().basicincomeincrease or 1 -- add this each 1cycle if Spring.GetModOptions().basicincomeinterval ~= nil then baseIncomeIncreasePeriod = Spring.GetModOptions().basicincomeinterval*60*30 @@ -23,23 +23,7 @@ else baseIncomeIncreasePeriod = 2.5*60*30 -- x min * 60 s/min * 30 frame/s end -local maximumBaseIncome = Spring.GetModOptions().maxbasicincome or 5 - -local aiCheatHandicapMetal = { - --["veryeasy"] = 0, - ["easy"] = 0, - --["medium"] = 0, - ["hard"] = 0, - --["insane"] = 25, -} - -local aiCheatHandicapEnergy = { - --["veryeasy"] = 10, - ["easy"] = 0, - --["medium"] = 30, - ["hard"] = 0, - --["insane"] = 50, -} +local maximumBaseIncome = Spring.GetModOptions().maxbasicincome or 10 if (not gadgetHandler:IsSyncedCode()) then return -- No Unsynced @@ -150,10 +134,9 @@ function gadget:GameFrame(n) for _,i in ipairs(Spring.GetTeamList()) do local _,_,_,_,_,allyTeamID = Spring.GetTeamInfo(i) - --if i ~= Spring.GetGaiaTeamID() then -- don't give free stuff to GAIA - -- Spring.AddTeamResource(i,"e",1) - --Spring.Echo("maxbaseincome is:" .. maximumBaseIncome) - --Spring.Echo("base income increase period is: " .. baseIncomeIncreasePeriod) + if i ~= Spring.GetGaiaTeamID() then -- don't give free stuff to GAIA + Spring.AddTeamResource(i,"e",10) + end if not (baseIncome >= tonumber(maximumBaseIncome)) then Spring.AddTeamResource(i,"m",baseIncome + mexIncome[allyTeamID]) else @@ -166,44 +149,6 @@ function gadget:GameFrame(n) end end end - - --Give free resources to AI - Necessary for AI's to properly function - if n%30 == 4 then - for _,TeamID in ipairs(Spring.GetTeamList()) do - local isAiTeam = select(4, Spring.GetTeamInfo(TeamID)) - if isAiTeam then - Spring.AddTeamResource(TeamID,"e", aiCheatHandicapEnergy[modOptions.aidifficulty or "easy"]) - end - end - end - - -- Give free unlimited power to AI - if n==60 and GG.TechGrant then - for _,TeamID in ipairs(Spring.GetTeamList()) do - local teamNum,leader,isDead,isAiTeam,side,allyTeam,teamCustomOptions = Spring.GetTeamInfo(TeamID) - if isAiTeam then - GG.TechGrant("tech0",TeamID) - end - end - end - - --Give the AI resources according to it's difficulty Setting - if n%30 == 1 then - for _,TeamID in ipairs(Spring.GetTeamList()) do - local isAiTeam = select(4, Spring.GetTeamInfo(TeamID)) - if isAiTeam then - local aimexamount = Spring.GetTeamUnitDefCount(TeamID, UnitDefNames.emetalextractor.id) - if GG.TechCheck("tech3", TeamID) == true then - Spring.AddTeamResource(TeamID,"m", aimexamount*3) - elseif GG.TechCheck("tech2", TeamID) == true then - Spring.AddTeamResource(TeamID,"m", aimexamount*2) - elseif GG.TechCheck("tech1", TeamID) == true then - Spring.AddTeamResource(TeamID,"m", aimexamount) - end - Spring.AddTeamResource(TeamID,"m", aiCheatHandicapMetal[modOptions.aidifficulty or "easy"]) - end - end - end end function gadget:UnitCreated(unitID, unitDefID, unitTeam) diff --git a/LuaRules/Gadgets/game_spawn.lua b/LuaRules/Gadgets/game_spawn.lua index 1eff65ab5..5c3bcbeed 100644 --- a/LuaRules/Gadgets/game_spawn.lua +++ b/LuaRules/Gadgets/game_spawn.lua @@ -34,44 +34,131 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local aiStartUnits = { + ["fedcommander"] = { + "ecommanderbattleai", + -- "ecommanderbuildai", + -- "ecommandercloakai", + -- "ecommanderfactoryai", + -- "ecommandershieldai", + -- "ecommanderhealerai", + }, + ["lozcommander"] = { + "ecommanderbattleai", + -- "ecommanderbuildai", + -- "ecommandercloakai", + -- "ecommanderfactoryai", + -- "ecommandershieldai", + -- "ecommanderhealerai", + }, +} + +local factionDefComms = { + --[0] = "ecommander", + --[1] = "zarm", + --[2] = "xcommander",\ + + [0] = "fedcommander", + [1] = "lozcommander", +} + +local validStartComm = { + --[UnitDefNames["ecommander"].id] = true, + --[UnitDefNames["zarm"].id] = true, + --[UnitDefNames["xcommander"].id] = true, + [UnitDefNames["fedcommander"].id] = true, + [UnitDefNames["lozcommander"].id] = true, +} + +local ACCESS_LEVEL = { + -- pick one of the two below choose whether enemies can see faction choice + private = true, + -- public = true, +} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + local modOptions = Spring.GetModOptions() - + function IsTeamAI(teamID) - teamID,leader,isDead,isAiTeam=Spring.GetTeamInfo(teamID) + _, _, _, isAiTeam=Spring.GetTeamInfo(teamID) return isAiTeam end - + local function GetStartUnit(teamID) - -- get the team startup info - local side = select(5, Spring.GetTeamInfo(teamID)) - local startUnit - - boolIsAI= IsTeamAI(teamID) - - if boolIsAI==true then - Spring.Echo ("Enemy is an AI so it gets an AI Specific Overseer!") - local sidedata = Spring.GetSideData() - startUnit = "ecommanderbattleai" - return startUnit - end - - if (side == "") then - -- startscript didn't specify a side for this team - local sidedata = Spring.GetSideData() - if (sidedata and #sidedata > 0) then - startUnit = sidedata[1 + teamID % #sidedata].startUnit - end - else - startUnit = Spring.GetSideData(side) - end - return startUnit + local reqStartUnit = Spring.GetTeamRulesParam(teamID, "startUnit") + if reqStartUnit then + return UnitDefs[reqStartUnit].name + end + + -- get the team startup info + local side = select(5, Spring.GetTeamInfo(teamID)) + local startUnit + + if IsTeamAI(teamID) then + Spring.Echo ("Enemy is an AI so it gets an AI Specific Overseer!") + --local factionrandom = math.random(0,1) + math.random(); math.random(); math.random() + local sidedata = factionDefComms[math.random(0,1)] + if sidedata == nil then + Spring.Echo("[Game Spawn] AI Faction: nil") + else + Spring.Echo("[Game Spawn] AI Faction: " .. sidedata) + end + + local aiCommData = aiStartUnits[sidedata] or {} + local aiCommIndex = math.random(1, #aiCommData) + startUnit = aiCommData[aiCommIndex] + else + -- If a side isn't selected, flip a coin + if (side == "") then + local factionIndex = math.random(0, 1) + startUnit = factionDefComms[factionIndex] + else + startUnit = Spring.GetSideData(side) + end + end + + return startUnit end local function SpawnStartUnit(teamID) local startUnit = GetStartUnit(teamID) + if (startUnit and startUnit ~= "") then + + if startUnit == "fedcommander" then + playerFaction = "Federation of Kala" + elseif startUnit == "lozcommander" then + playerFaction = "Loz Alliance" + --elseif startUnit == "xcommander" then + -- playerFaction = "pattern" + elseif startUnit == nil then + playerFaction = "Script is Fucked" + else + playerFaction = startUnit + Spring.Echo("[Game Spawn] If you're seeing this message that means that the code which sets the player's faction is absolutely fucked somewhere. On the next line I will echo the playerFaction variable. If it says anything other than the factions listed above, at least it will provide a clue.") + Spring.Echo(playerFaction) + end + + + Spring.Echo("[Game Spawn] My starting faction is " .. playerFaction) + Spring.SetTeamRulesParam(teamID, "faction", playerFaction) + -- spawn the specified start unit local x,y,z = Spring.GetTeamStartPosition(teamID) + if IsTeamAI(teamID) then + local _,_,_,_,_,allyID = Spring.GetTeamInfo(teamID) + local startBoxXmin, startBoxZmin, startBoxXmax, startBoxZmax = Spring.GetAllyTeamStartBox(allyID) + local mx = Game.mapSizeX + local mz = Game.mapSizeZ + if not (startBoxXmin == 0 and startBoxZmin == 0 and startBoxXmax == mx and startBoxZmax == mz) then + math.random(); math.random(); math.random() + x = math.random(startBoxXmin, startBoxXmax) + z = math.random(startBoxZmin, startBoxZmax) + end + end -- snap to 16x16 grid x, z = 16*math.floor((x+8)/16), 16*math.floor((z+8)/16) y = Spring.GetGroundHeight(x, z) @@ -80,15 +167,21 @@ local function SpawnStartUnit(teamID) and ((x>Game.mapSizeX/2) and "west" or "east") or ((z>Game.mapSizeZ/2) and "north" or "south") local unitID = Spring.CreateUnit(startUnit, x, y, z, facing, teamID) --- Fun times --- if startUnit == "ecommanderai" then --- id1=Spring.CreateUnit("eorb", x+100, y+200, z, facing, teamID) --- Spring.GiveOrderToUnit(id1,CMD.GUARD,{unitID}, {"shift"}) --- end +-- Fun times + if startUnit == "ecommander" then + --id1=Spring.CreateUnit("eorb", x+100, y+200, z, facing, teamID) + --id1=Spring.CreateUnit("eorb", x-100, y-200, z, facing, teamID) + --Spring.GiveOrderToUnit(id1,CMD.GUARD,{unitID}, {"shift"}) + end + if startUnit == "zarm" then + id1=Spring.CreateUnit("ztumor", x+100, y+200, z, facing, teamID) + id1=Spring.CreateUnit("ztumor", x-100, y-200, z, facing, teamID) + --Spring.GiveOrderToUnit(id1,CMD.GUARD,{unitID}, {"shift"}) + end end -- set start resources, either from mod options or custom team keys - local teamOptions = select(7, Spring.GetTeamInfo(teamID)) + local teamOptions = select(8, Spring.GetTeamInfo(teamID)) local m = teamOptions.startmetal or modOptions.startmetal or 100 local e = teamOptions.startenergy or modOptions.startenergy or 100 @@ -109,7 +202,22 @@ local function SpawnStartUnit(teamID) Spring.SetTeamResource(teamID, "es", tonumber(e)) --Use tonumber(e) to have it match the startenergy amounts Spring.SetTeamResource(teamID, "e", 0) Spring.AddTeamResource(teamID, "e", tonumber(e)) + end +end + +function gadget:RecvLuaMsg(msg, playerID) + if msg:find("\138") ~= 1 then + return end + + local requestedCommDefID = tonumber(msg:sub(2) or "-1") + if not validStartComm[requestedCommDefID] then + return + end + + local teamID = select(4, Spring.GetPlayerInfo(playerID, false)) + --Spring.Echo("Setting start unit for team", teamID, " to ", requestedCommDefID) + Spring.SetTeamRulesParam(teamID, "startUnit", requestedCommDefID, ACCESS_LEVEL) end diff --git a/LuaRules/Gadgets/game_team_com_ends.lua b/LuaRules/Gadgets/game_team_com_ends.lua deleted file mode 100644 index 8aec370c8..000000000 --- a/LuaRules/Gadgets/game_team_com_ends.lua +++ /dev/null @@ -1,153 +0,0 @@ -function gadget:GetInfo() - return { - name = "Team Com Ends", - desc = "Implements com ends for allyteams", - author = "KDR_11k (David Becker)", - date = "2008-02-04", - license = "Public domain", - layer = 1, - enabled = true - } -end - --- this acts just like Com Ends except instead of killing a player's units when --- his com dies it acts on an allyteam level, if all coms in an allyteam are dead --- the allyteam is out - -deathMode = tonumber(Spring.GetModOptions().deathmode) -- Radius around a point in which to capture it -if deathMode == nil then - deathMode = "com" -end - --- the deathmode modoption must be set to one of the following to enable this -local endmodes = { - com=true, -} - -if (gadgetHandler:IsSyncedCode()) then - ---SYNCED - -local destroyQueue = {} - -local destroyUnitQueue = {} - -local aliveCount = {} - -local isAlive = {} - -local GetTeamList=Spring.GetTeamList -local GetTeamUnits = Spring.GetTeamUnits -local GetUnitAllyTeam = Spring.GetUnitAllyTeam -local DestroyUnit=Spring.DestroyUnit -local GetUnitPosition = Spring.GetUnitPosition -local SpawnCEG = Spring.SpawnCEG - -local DISTANCE_LIMIT = (math.max(Game.mapSizeX,Game.mapSizeZ) * math.max(Game.mapSizeX,Game.mapSizeZ)) -local min = math.min -local deathWave = false -local deathTimeBoost = 1 - -local function getSqrDistance(x1,z1,x2,z2) - local dx,dz = x1-x2,z1-z2 - return (dx*dx)+(dz*dz) -end - -function gadget:Initialize() - --Spring.Echo("Deathmode is " .. deathMode) - if not endmodes[deathMode] then - gadgetHandler:RemoveGadget(self) -- in particular, this gadget is removed if deathmode is "killall" or "none" - end - for _,t in ipairs(Spring.GetAllyTeamList()) do - aliveCount[t] = 0 - end -end - -function gadget:GameFrame(t) - --Spring.Echo("Deathmode is " .. deathMode) - if t % 15 < .1 then - for at,defs in pairs(destroyQueue) do - if aliveCount[at] <= 0 then --safety check, triggers on transferring the last com otherwise - for _,team in ipairs(GetTeamList(at)) do - for _,unitID in ipairs(GetTeamUnits(team)) do - local x,y,z = GetUnitPosition(unitID) - local deathTime = min(((getSqrDistance(x,z,defs.x,defs.z) / DISTANCE_LIMIT) * 250), 250) - if (destroyUnitQueue[unitID] == nil) then - destroyUnitQueue[unitID] = { - time = t + deathTime + math.random(0,5), - x = x, - y = y, - z = z, - spark = false - } - end - end - end - deathWave = true - end - destroyQueue[at]=nil - end - end - - if (deathWave) and next(destroyUnitQueue) then - local dt = (t + deathTimeBoost) - for unitID, defs in pairs(destroyUnitQueue) do - if ((dt > (defs.time - 15)) and (defs.spark == false)) then - SpawnCEG("genericshellexplosion-huge-sparks-burn",defs.x,defs.y,defs.z,0,0,0) - destroyUnitQueue[unitID].spark = true - end - if (dt > defs.time) then - DestroyUnit(unitID, true) - destroyUnitQueue[unitID] = nil - end - end - deathTimeBoost = math.min(deathTimeBoost * 1.125, 250) - end - -end - -function gadget:UnitCreated(u, ud, team) - isAlive[u] = true - if UnitDefs[ud].customParams.iscommander then - local allyTeam = GetUnitAllyTeam(u) - aliveCount[allyTeam] = aliveCount[allyTeam] + 1 - end -end - -function gadget:UnitGiven(u, ud, team) - if UnitDefs[ud].customParams.iscommander then - local allyTeam = GetUnitAllyTeam(u) - aliveCount[allyTeam] = aliveCount[allyTeam] + 1 - end -end - -function gadget:UnitDestroyed(u, ud, team) - isAlive[u] = nil - if UnitDefs[ud].customParams.iscommander then - local allyTeam = GetUnitAllyTeam(u) - aliveCount[allyTeam] = aliveCount[allyTeam] - 1 - if aliveCount[allyTeam] <= 0 then - local x,y,z = Spring.GetUnitPosition(u) - destroyQueue[allyTeam] = {x = x, y = y, z = z} - end - end -end - -function gadget:UnitTaken(u, ud, team) - if isAlive[u] and UnitDefs[ud].customParams.iscommander then - local allyTeam = GetUnitAllyTeam(u) - aliveCount[allyTeam] = aliveCount[allyTeam] - 1 - if aliveCount[allyTeam] <= 0 then - local x,y,z = Spring.GetUnitPosition(u) - destroyQueue[allyTeam] = {x = x, y = y, z = z} - end - end -end - -else - ---UNSYNCED - -return false - -end diff --git a/LuaRules/Gadgets/geo_placement.xlua b/LuaRules/Gadgets/geo_placement.xlua new file mode 100644 index 000000000..a69bbb6ce --- /dev/null +++ b/LuaRules/Gadgets/geo_placement.xlua @@ -0,0 +1,62 @@ +function gadget:GetInfo() + return { + name = "LuaGeo", + desc = "Spawns GeoVents randomly on the map", + author = "Stowtemid, Forboding Angel", + date = "", + license = "PD", + layer = 0, + enabled = false -- loaded by default? + } +end + +if (Spring.GetGameFrame() >= 1) then + return false +end + +--math.randomseed(Game.GameID) -- This only works in 104+ +math.random(); math.random(); math.random() +local mapxFull, mapzFull = Game.mapSizeX, Game.mapSizeZ +local mapx, mapz = Game.mapSizeX, Game.mapSizeZ * 0.5 +local size = math.max(mapx, mapz) + +local numPointsPerSide = 8 +local rotation = 2 + +function makePositionsForGeoSpots(mapx, mapz, numPointsPerSide, rotation) + -- Constants + local distanceFromCorner = 0.15 + local width = 0.25 + local length = 0.6 + + local positions = {} + for i = 1, numPointsPerSide do + local x = (i - 1) / (numPointsPerSide - 1) -- if numPointsPerSide = 4, then x = 0, 0.33, 0.67, 1 + local newPoint = {0, 0} + if rotation < 2 then -- 0 or 1 + newPoint[1] = mapxFull * (distanceFromCorner + width * x * x) + newPoint[2] = mapzFull * (distanceFromCorner + length * x) + else -- 2 or 3 + newPoint[1] = mapxFull * (distanceFromCorner + length * x) + newPoint[2] = mapzFull * (distanceFromCorner + width * x * x) + end + if rotation % 2 == 1 then newPoint[2] = mapzFull - newPoint[2] end -- 1 or 3 + positions[#positions + 1] = {x = newPoint[1], z = newPoint[2]} + positions[#positions + 1] = {x = mapxFull - newPoint[1], z = mapzFull - newPoint[2]} + end + return positions +end + +local positions = makePositionsForGeoSpots(mapx, mapz, numPointsPerSide, rotation) + +if ( positions ) then + local gaiaID = Spring.GetGaiaTeamID() + Spring.Echo("[LuaGeo] I found positions for geovent feature placement!") + local length = #positions + for i = 1, length do + Spring.Echo("[LuaGeo] I'm trying to create a geovent feature at:") + Spring.Echo("[LuaGeo] x = " .. positions[i].x) + Spring.Echo("[LuaGeo] z = " .. positions[i].z) + Spring.CreateFeature('geovent', positions[i].x, Spring.GetGroundHeight(positions[i].x,positions[i].z)+5, positions[i].z, 1, gaiaID) + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/gfx_explosion_lights.lua b/LuaRules/Gadgets/gfx_explosion_lights.lua index c5476aa7a..88dad6971 100644 --- a/LuaRules/Gadgets/gfx_explosion_lights.lua +++ b/LuaRules/Gadgets/gfx_explosion_lights.lua @@ -49,11 +49,19 @@ end ------------------------------------------------------------------------------- if (gadgetHandler:IsSyncedCode()) then - + + function gadget:Initialize() + for wdid, wd in pairs(WeaponDefs) do + if wd.type == "Flame" then + Script.SetWatchWeapon(wdid, true) -- watch weapon so explosion gets called for flame weapons + end + end + end + function gadget:Explosion(weaponID, px, py, pz, ownerID) SendToUnsynced("explosion_light", px, py, pz, weaponID, ownerID) end - + else ------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/gpumem_broadcast.lua b/LuaRules/Gadgets/gpumem_broadcast.lua new file mode 100644 index 000000000..7a6bd98e2 --- /dev/null +++ b/LuaRules/Gadgets/gpumem_broadcast.lua @@ -0,0 +1,101 @@ +local engineVersion = 100 -- just filled this in here incorrectly but old engines arent used anyway +if Engine and Engine.version then + local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + return results + end + engineVersion = Split(Engine.version, '-') + if engineVersion[2] ~= nil and engineVersion[3] ~= nil then + engineVersion = tonumber(string.gsub(engineVersion[1], '%.', '')..engineVersion[2]) + else + engineVersion = tonumber(Engine.version) + end +elseif Game and Game.version then + engineVersion = tonumber(Game.version) +end + +if (engineVersion < 1000 and engineVersion >= 105) or engineVersion >= 10401138 then + + function gadget:GetInfo() + return { + name = "GPU mem Broadcast", + desc = "Broadcasts GPU mem usage", + author = "Floris", + date = "May 2018", + layer = 0, + enabled = true, + } + end + + -------------------------------------------------------------------------------- + -- config + -------------------------------------------------------------------------------- + + local sendPacketEvery = 15 + + -------------------------------------------------------------------------------- + -- synced + -------------------------------------------------------------------------------- + if gadgetHandler:IsSyncedCode() then + + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + + local validation = randomString(2) + _G.validationGpuMem = validation + + function gadget:RecvLuaMsg(msg, playerID) + if msg:sub(1,1)=="@" and msg:sub(2,3)==validation then + SendToUnsynced("gpumemBroadcast",playerID,tonumber(msg:sub(4))) + return true + end + end + + else + -------------------------------------------------------------------------------- + -- unsynced + -------------------------------------------------------------------------------- + + local GetLastUpdateSeconds = Spring.GetLastUpdateSeconds + local SendLuaRulesMsg = Spring.SendLuaRulesMsg + local validation = SYNCED.validationGpuMem + local updateTimer = 0 + + function gadget:Initialize() + gadgetHandler:AddSyncAction("gpumemBroadcast", handleEvent) + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("gpumemBroadcast") + end + + function handleEvent(_,playerID,mem) + if Script.LuaUI("GpuMemEvent") then + Script.LuaUI.GpuMemEvent(playerID,mem) + end + end + + function gadget:Update() + updateTimer = updateTimer + GetLastUpdateSeconds() + if updateTimer > sendPacketEvery then + local used, max = Spring.GetVidMemUsage() + if type(used) == 'number' and used > 0 then + SendLuaRulesMsg("@"..validation..math.ceil((used/max)*100)) + updateTimer = 0 + end + end + end + + end +end diff --git a/LuaRules/Gadgets/include/LuaShader.lua b/LuaRules/Gadgets/include/LuaShader.lua new file mode 100644 index 000000000..1501a513c --- /dev/null +++ b/LuaRules/Gadgets/include/LuaShader.lua @@ -0,0 +1,468 @@ +local UNIFORM_TYPE_MIXED = 0 -- includes arrays; float or int +local UNIFORM_TYPE_INT = 1 -- includes arrays +local UNIFORM_TYPE_FLOAT = 2 -- includes arrays +local UNIFORM_TYPE_FLOAT_MATRIX = 3 + +local glGetUniformLocation = gl.GetUniformLocation +local glUseShader = gl.UseShader +local glActiveShader = gl.ActiveShader +local glUniform = gl.Uniform +local glUniformInt = gl.UniformInt +local glUniformMatrix = gl.UniformMatrix +local glUniformArray = gl.UniformArray + +local function new(class, shaderParams, shaderName, logEntries) + local logEntriesSanitized + if type(logEntries) == "number" then + logEntriesSanitized = logEntries + else + logEntriesSanitized = 1 + end + + return setmetatable( + { + shaderName = shaderName or "Unnamed Shader", + shaderParams = shaderParams or {}, + logEntries = logEntriesSanitized, + logHash = {}, + shaderObj = nil, + active = false, + ignoreActive = false, + ignoreUnkUniform = false, + uniforms = {}, + }, class) +end + +local function IsGeometryShaderSupported() + return gl.HasExtension("GL_ARB_geometry_shader4") and (gl.SetShaderParameter ~= nil or gl.SetGeometryShaderParameter ~= nil) +end + +local function IsTesselationShaderSupported() + return gl.HasExtension("GL_ARB_tessellation_shader") and (gl.SetTesselationShaderParameter ~= nil) +end + +local function IsDeferredShadingEnabled() + return (Spring.GetConfigInt("AllowDeferredMapRendering") == 1) and (Spring.GetConfigInt("AllowDeferredModelRendering") == 1) and (Spring.GetConfigInt("AdvMapShading") == 1) +end + +local function GetAdvShadingActive() + local advUnitShading, advMapShading = Spring.HaveAdvShading() + if advMapShading == nil then + advMapShading = true + end --old engine + return advUnitShading and advMapShading +end + + +local LuaShader = setmetatable({}, { + __call = function(self, ...) return new(self, ...) end, + }) +LuaShader.__index = LuaShader +LuaShader.isGeometryShaderSupported = IsGeometryShaderSupported() +LuaShader.isTesselationShaderSupported = IsTesselationShaderSupported() +LuaShader.isDeferredShadingEnabled = IsDeferredShadingEnabled() +LuaShader.GetAdvShadingActive = GetAdvShadingActive + +-----------------============ Warnings & Error Gandling ============----------------- +function LuaShader:OutputLogEntry(text, isError) + local message + + local warnErr = (isError and "error") or "warning" + + message = string.format("LuaShader: [%s] shader %s(s):\n%s", self.shaderName, warnErr, text) + + if self.logHash[message] == nil then + self.logHash[message] = 0 + end + + if self.logHash[message] <= self.logEntries then + local newCnt = self.logHash[message] + 1 + self.logHash[message] = newCnt + if (newCnt == self.logEntries) then + message = message .. string.format("\nSupressing further %s of the same kind", warnErr) + end + Spring.Echo(message) + end +end + +function LuaShader:ShowWarning(text) + self:OutputLogEntry(text, false) +end + +function LuaShader:ShowError(text) + self:OutputLogEntry(text, true) +end + +-----------------============ Handle Ghetto Include<> ==============----------------- +local includeRegexps = { + '.-#include <(.-)>.-', + '.-#include \"(.-)\".-', + '.-#pragma(%s+)include <(.-)>.-', + '.-#pragma(%s+)include \"(.-)\".-', +} + +function LuaShader:HandleIncludes(shaderCode, shaderName) + local incFiles = {} + local t1 = Spring.GetTimer() + repeat + local incFile + local regEx + for _, rx in ipairs(includeRegexps) do + _, _, incFile = string.find(shaderCode, rx) + if incFile then + regEx = rx + break + end + end + + Spring.Echo(shaderName, incFile) + + if incFile then + shaderCode = string.gsub(shaderCode, regEx, '', 1) + table.insert(incFiles, incFile) + end + until (incFile == nil) + local t2 = Spring.GetTimer() + Spring.Echo(Spring.DiffTimers(t2, t1, true)) + + local includeText = "" + for _, incFile in ipairs(incFiles) do + if VFS.FileExists(incFile) then + includeText = includeText .. VFS.LoadFile(incFile) .. "\n" + else + self:ShowError(string.format("Attempt to execute %s with file that does not exist in VFS", incFile)) + return false + end + end + + if includeText ~= "" then + return includeText .. shaderCode + else + return shaderCode + end +end + +-----------------========= End of Handle Ghetto Include<> ==========----------------- + +-----------------============ General LuaShader methods ============----------------- +function LuaShader:Compile() + if not gl.CreateShader then + self:ShowError("GLSL Shaders are not supported by hardware or drivers") + return false + end + +-- LuaShader:HandleIncludes is too slow. Figure out faster way. +--[[ + for _, shaderType in ipairs({"vertex", "tcs", "tes", "geometry", "fragment"}) do + if self.shaderParams[shaderType] then + local newShaderCode = LuaShader:HandleIncludes(self.shaderParams[shaderType], self.shaderName) + if newShaderCode then + self.shaderParams[shaderType] = newShaderCode + end + end + end +]]-- + + self.shaderObj = gl.CreateShader(self.shaderParams) + local shaderObj = self.shaderObj + + local shLog = gl.GetShaderLog() or "" + + if not shaderObj then + self:ShowError(shLog) + return false + elseif (shLog ~= "") then + self:ShowWarning(shLog) + end + + local uniforms = self.uniforms + for idx, info in ipairs(gl.GetActiveUniforms(shaderObj)) do + local uniName = string.gsub(info.name, "%[0%]", "") -- change array[0] to array + uniforms[uniName] = { + location = glGetUniformLocation(shaderObj, uniName), + --type = info.type, + --size = info.size, + values = {}, + } + --Spring.Echo(uniName, uniforms[uniName].location, uniforms[uniName].type, uniforms[uniName].size) + --Spring.Echo(uniName, uniforms[uniName].location) + end + return true +end + +LuaShader.Initialize = LuaShader.Compile + +function LuaShader:GetHandle() + if self.shaderObj ~= nil then + return self.shaderObj + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()?", funcName)) + end +end + +function LuaShader:Delete() + if self.shaderObj ~= nil then + gl.DeleteShader(self.shaderObj) + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + end +end + +LuaShader.Finalize = LuaShader.Delete + +function LuaShader:Activate() + if self.shaderObj ~= nil then + self.active = true + return glUseShader(self.shaderObj) + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + return false + end +end + +function LuaShader:SetActiveStateIgnore(flag) + self.ignoreActive = flag +end + +function LuaShader:SetUnknownUniformIgnore(flag) + self.ignoreUnkUniform = flag +end + + +function LuaShader:ActivateWith(func, ...) + if self.shaderObj ~= nil then + self.active = true + glActiveShader(self.shaderObj, func, ...) + self.active = false + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + end +end + +function LuaShader:Deactivate() + self.active = false + glUseShader(0) +end +-----------------============ End of general LuaShader methods ============----------------- + + +-----------------============ Friend LuaShader functions ============----------------- +local function getUniformImpl(self, name) + local uniform = self.uniforms[name] + + if uniform and type(uniform) == "table" then + return uniform + elseif uniform == nil then --used for indexed elements. nil means not queried for location yet + local location = glGetUniformLocation(self.shaderObj, name) + if location and location > -1 then + self.uniforms[name] = { + location = location, + values = {}, + } + return self.uniforms[name] + else + self.uniforms[name] = false --checked dynamic uniform name and didn't find it + end + end + + -- (uniform == false) + return nil +end + +local function getUniform(self, name) + if not (self.active or self.ignoreActive) then + self:ShowError(string.format("Trying to set uniform [%s] on inactive shader object. Did you use :Activate() or :ActivateWith()?", name)) + return nil + end + local uniform = getUniformImpl(self, name) + if not (uniform ~= nil or self.ignoreUnkUniform) then + self:ShowWarning(string.format("Attempt to set uniform [%s], which does not exist in the compiled shader", name)) + return nil + end + return uniform +end + +local function isUpdateRequired(uniform, tbl) + if (#tbl == 1) and (type(tbl[1]) == "string") then --named matrix + return true --no need to update cache + end + + local update = false + local cachedValues = uniform.values + for i, val in ipairs(tbl) do + if cachedValues[i] ~= val then + cachedValues[i] = val --update cache + update = true + end + end + + return update +end +-----------------============ End of friend LuaShader functions ============----------------- + + +-----------------============ LuaShader uniform manipulation functions ============----------------- +-- TODO: do it safely with types, len, size check + +function LuaShader:GetUniformLocation(name) + return (getUniform(self, name) or {}).location or -1 +end + +--FLOAT UNIFORMS +local function setUniformAlwaysImpl(uniform, ...) + glUniform(uniform.location, ...) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformAlwaysImpl(uniform, ...) +end + +local function setUniformImpl(uniform, ...) + if isUpdateRequired(uniform, {...}) then + return setUniformAlwaysImpl(uniform, ...) + end + return true +end + +function LuaShader:SetUniform(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformImpl(uniform, ...) +end + +LuaShader.SetUniformFloat = LuaShader.SetUniform +LuaShader.SetUniformFloatAlways = LuaShader.SetUniformAlways + + +--INTEGER UNIFORMS +local function setUniformIntAlwaysImpl(uniform, ...) + glUniformInt(uniform.location, ...) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformIntAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntAlwaysImpl(uniform, ...) +end + +local function setUniformIntImpl(uniform, ...) + if isUpdateRequired(uniform, {...}) then + return setUniformIntAlwaysImpl(uniform, ...) + end + return true +end + +function LuaShader:SetUniformInt(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntImpl(uniform, ...) +end + + +--FLOAT ARRAY UNIFORMS +local function setUniformFloatArrayAlwaysImpl(uniform, tbl) + glUniformArray(uniform.location, UNIFORM_TYPE_FLOAT, tbl) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformFloatArrayAlways(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformFloatArrayAlwaysImpl(uniform, tbl) +end + +local function setUniformFloatArrayImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformFloatArrayAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformFloatArray(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformFloatArrayImpl(uniform, tbl) +end + + +--INT ARRAY UNIFORMS +local function setUniformIntArrayAlwaysImpl(uniform, tbl) + glUniformArray(uniform.location, UNIFORM_TYPE_INT, tbl) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformIntArrayAlways(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntArrayAlwaysImpl(uniform, tbl) +end + +local function setUniformIntArrayImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformIntArrayAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformIntArray(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntArrayImpl(uniform, tbl) +end + + +--MATRIX UNIFORMS +local function setUniformMatrixAlwaysImpl(uniform, tbl) + glUniformMatrix(uniform.location, unpack(tbl)) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformMatrixAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformMatrixAlwaysImpl(uniform, {...}) +end + +local function setUniformMatrixImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformMatrixAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformMatrix(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformMatrixImpl(uniform, {...}) +end +-----------------============ End of LuaShader uniform manipulation functions ============----------------- + +return LuaShader \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_cloak_fx.lua b/LuaRules/Gadgets/lups_cloak_fx.lua index befd44e3e..f557a5209 100644 --- a/LuaRules/Gadgets/lups_cloak_fx.lua +++ b/LuaRules/Gadgets/lups_cloak_fx.lua @@ -79,21 +79,21 @@ local CloakedHitEffect = { class='UnitJitter',options={ life=50, pos={0,0,0}, en local CloakEffect = { { class='UnitCloaker',options={ life=50 } }, { class='UnitJitter',options={ delay=24, life=math.huge } }, - { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.9 } }, + { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.25 } }, } local EnemyCloakEffect = { { class='UnitCloaker',options={ life=20 } }, - { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.9 } }, + { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.25 } }, } local DecloakEffect = { { class='UnitCloaker',options={ inverse=true, life=50 } }, { class='UnitJitter',options={ life=24 } }, - { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.9 } }, + { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.25 } }, } local EnemyDecloakEffect = { { class='UnitCloaker',options={ inverse=true, life=60 } }, - { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.9 } }, + { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.25 } }, } --[[ Units are actually decloaked when damaged so this part is not required diff --git a/LuaRules/Gadgets/lups_nano_spray.lua b/LuaRules/Gadgets/lups_nano_spray.lua index 52def4d46..479fdbd02 100644 --- a/LuaRules/Gadgets/lups_nano_spray.lua +++ b/LuaRules/Gadgets/lups_nano_spray.lua @@ -192,7 +192,7 @@ end -- local nanoParticles = {} -local maxEngineParticles = Spring.GetConfigInt("MaxNanoParticles", 10000) +local maxEngineParticles = Spring.GetConfigInt("MaxNanoParticles", 25000) local function GetFaction(udid) --local udef_factions = UnitDefs[udid].factions or {} @@ -210,17 +210,27 @@ local factionsNanoFx = { streamSpeed = "limcount*0.05", }, ["default_high_quality"] = { - fxtype = "NanoParticles", - alpha = 0.27, - size = 6, - sizeSpread = 6, - sizeGrowth = 0.75, - rotSpeed = 0.1, - rotSpread = 360, - texture = "bitmaps/Other/Poof.png", - particles = 0.5, + fxtype = "NanoLasers", + alpha = "0.001", + corealpha = "0.2", + corethickness = "0.25", + streamThickness = "1", + streamSpeed = "1", }, - --[[arm = { + + -- ["default_high_quality"] = { + -- fxtype = "NanoParticles", + -- alpha = 0.50, + -- size = 6, + -- sizeSpread = 6, + -- sizeGrowth = 0.75, + -- rotSpeed = 0.1, + -- rotSpread = 360, + -- texture = "bitmaps/default/randdots.tga", + -- particles = 0.5, + -- }, + + arm = { fxtype = "NanoParticles", delaySpread = 30, size = 3, @@ -254,7 +264,7 @@ local factionsNanoFx = { corethickness = "limcount", streamThickness = "0.5+5*limcount", streamSpeed = "limcount*0.05", - },]]-- + }, } ------------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/mex_spot_finder.lua b/LuaRules/Gadgets/mex_spot_finder.lua index d1357d6e0..488496047 100644 --- a/LuaRules/Gadgets/mex_spot_finder.lua +++ b/LuaRules/Gadgets/mex_spot_finder.lua @@ -18,7 +18,12 @@ end -- Config ------------------------------------------------------------ local MAPSIDE_METALMAP = "mapconfig/map_metal_layout.lua" -local GAMESIDE_METALMAP = "LuaRules/Configs/MetalSpots/" .. (Game.mapName or "") .. ".lua" +local defaultMexMap = Spring.GetModOptions().mexlayout or "enabled" +if defaultMexMap == "enabled" then + GAMESIDE_METALMAP = "LuaRules/Configs/MetalSpots/" .. ("defaultLayout") .. ".lua" +else + GAMESIDE_METALMAP = "LuaRules/Configs/MetalSpots/" .. (Game.mapName or "") .. ".lua" +end local DEFAULT_MEX_INCOME = 2 local MINIMUN_MEX_INCOME = 0.2 @@ -184,7 +189,10 @@ function IntegrateMetal(x, z, radius) local dist = sqrt(dx * dx + dz * dz) if (dist < radius) then - local _, metal = spGetGroundInfo(cx, cz) + local _, metal,metal2 = spGetGroundInfo(cx, cz) + if type(metal) == 'string' then -- Spring > v104 + metal = metal2 + end result = result + metal end end diff --git a/LuaRules/Gadgets/scavengers/API/api.lua b/LuaRules/Gadgets/scavengers/API/api.lua new file mode 100644 index 000000000..9b97abca2 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/API/api.lua @@ -0,0 +1,280 @@ +Spring.Echo("[Scavengers] API initialized") + +math_random = math.random +-- variables +mapsizeX = Game.mapSizeX +mapsizeZ = Game.mapSizeZ +GaiaTeamID = Spring.GetGaiaTeamID() +ScavengerStartboxXMin = mapsizeX + 1 +ScavengerStartboxZMin = mapsizeZ + 1 +ScavengerStartboxXMax = mapsizeX + 1 +ScavengerStartboxZMax = mapsizeZ + 1 +ScavengerStartboxExists = false +spawnmultiplier = tonumber(Spring.GetModOptions().scavengers) or 1 +scavTechDifficulty = Spring.GetModOptions().scavengerstech or "adaptive" +if scavengersAIEnabled then + if spawnmultiplier == 0 then + spawnmultiplier = 0.5 + end + GaiaTeamID = scavengerAITeamID + _,_,_,_,_,GaiaAllyTeamID = Spring.GetTeamInfo(GaiaTeamID) + ScavengerStartboxXMin, ScavengerStartboxZMin, ScavengerStartboxXMax, ScavengerStartboxZMax = Spring.GetAllyTeamStartBox(GaiaAllyTeamID) + if ScavengerStartboxXMin == 0 and ScavengerStartboxZMin == 0 and ScavengerStartboxXMax == mapsizeX and ScavengerStartboxZMax == mapsizeZ then + ScavengerStartboxExists = false + else + ScavengerStartboxExists = true + end +else + _,_,_,_,_,GaiaAllyTeamID = Spring.GetTeamInfo(GaiaTeamID) + ScavengerStartboxExists = false +end +teamcount = #Spring.GetTeamList() - 1 +allyteamcount = #Spring.GetAllyTeamList() - 1 + +BossWaveStarted = false +selfdx = {} +selfdy = {} +selfdz = {} +oldselfdx = {} +oldselfdy = {} +oldselfdz = {} +scavNoSelfD = {} +UDC = Spring.GetTeamUnitDefCount +UDN = UnitDefNames +scavStructure = {} +scavConstructor = {} +scavAssistant = {} +scavResurrector = {} +scavFactory = {} +scavCollector = {} +scavReclaimer = {} +scavSpawnBeacon = {} +scavStockpiler = {} +scavNuke = {} +UnitSuffixLenght = {} +numOfSpawnBeacons = 0 +numOfSpawnBeaconsTeams = {} +scavMaxUnits = 2000 +scavengerSoundPath = "Sounds/voice/scavengers/" +killedscavengers = 0 +QueuedSpawns = {} +QueuedSpawnsFrames = {} +ConstructorNumberOfRetries = {} +CaptureProgressForBeacons = {} +AliveEnemyCommanders = {} +AliveEnemyCommandersCount = 0 +FinalBossKilled = false +bosshealthmultiplier = 5--teamcount*spawnmultiplier + +if Spring.GetModOptions() and Spring.GetModOptions().maxunits then + scavMaxUnits = tonumber(Spring.GetModOptions().maxunits) +end +if GaiaTeamID == Spring.GetGaiaTeamID() then + scavMaxUnits = 10000 +end +TierSpawnChances = { + T0 = 100, + T1 = 0, + T2 = 0, + T3 = 0, + T4 = 0, +} + +-- check for solo play +if teamcount <= 0 then + teamcount = 1 +end + if allyteamcount <= 0 then + allyteamcount = 1 +end + +-- Check height diffrences +function posCheck(posx, posy, posz, posradius) + -- if true then can spawn + local testpos1 = Spring.GetGroundHeight((posx + posradius), (posz + posradius) ) + local testpos2 = Spring.GetGroundHeight((posx + posradius), (posz - posradius) ) + local testpos3 = Spring.GetGroundHeight((posx - posradius), (posz + posradius) ) + local testpos4 = Spring.GetGroundHeight((posx - posradius), (posz - posradius) ) + local testpos5 = Spring.GetGroundHeight((posx + posradius), posz ) + local testpos6 = Spring.GetGroundHeight(posx, (posz + posradius) ) + local testpos7 = Spring.GetGroundHeight((posx - posradius), posz ) + local testpos8 = Spring.GetGroundHeight(posx, (posz - posradius) ) + local deathwater = Game.waterDamage + local heighttollerance = scavconfig.other.heighttolerance + if scavconfig.other.noheightchecksforwater and (not deathwater or deathwater == 0) and posy <= 0 then + return true + elseif deathwater > 0 and posy <= 0 then + return false + elseif testpos1 < posy - heighttollerance or testpos1 > posy + heighttollerance then + return false + elseif testpos2 < posy - heighttollerance or testpos2 > posy + heighttollerance then + return false + elseif testpos3 < posy - heighttollerance or testpos3 > posy + heighttollerance then + return false + elseif testpos4 < posy - heighttollerance or testpos4 > posy + heighttollerance then + return false + elseif testpos5 < posy - heighttollerance or testpos5 > posy + heighttollerance then + return false + elseif testpos6 < posy - heighttollerance or testpos6 > posy + heighttollerance then + return false + elseif testpos7 < posy - heighttollerance or testpos7 > posy + heighttollerance then + return false + elseif testpos8 < posy - heighttollerance or testpos8 > posy + heighttollerance then + return false + else + return true + end +end + +-- Check if area is occupied +function posOccupied(posx, posy, posz, posradius) + -- if true then can spawn + local unitcount = #Spring.GetUnitsInRectangle(posx-posradius, posz-posradius, posx+posradius, posz+posradius) + if unitcount > 0 then + return false + else + return true + end +end + +-- Check if area is visible for any player +function posLosCheck(posx, posy, posz, posradius) + -- if true then can spawn + for _,allyTeamID in ipairs(Spring.GetAllyTeamList()) do + if allyTeamID ~= GaiaAllyTeamID then + if Spring.IsPosInLos(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInRadar(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInRadar(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInRadar(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInRadar(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInRadar(posx - posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInAirLos(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx - posradius, posy, posz - posradius, allyTeamID) == true then + return false + end + end + end + return true +end + +function posFriendlyCheckOnlyLos(posx, posy, posz, allyTeamID) + return Spring.IsPosInLos(posx, posy, posz, allyTeamID) +end + +function posLosCheckNoRadar(posx, posy, posz, posradius) + -- if true then can spawn + for _,allyTeamID in ipairs(Spring.GetAllyTeamList()) do + if allyTeamID ~= GaiaAllyTeamID then + if Spring.IsPosInLos(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInAirLos(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInAirLos(posx - posradius, posy, posz - posradius, allyTeamID) == true then + return false + end + end + end + return true +end + +function posLosCheckOnlyLOS(posx, posy, posz, posradius) + -- if true then can spawn + for _,allyTeamID in ipairs(Spring.GetAllyTeamList()) do + if allyTeamID ~= GaiaAllyTeamID then + if Spring.IsPosInLos(posx, posy, posz, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx + posradius, posy, posz - posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz + posradius, allyTeamID) == true or + Spring.IsPosInLos(posx - posradius, posy, posz - posradius, allyTeamID) == true then + return false + end + end + end + return true +end + +function posStartboxCheck(posx, posy, posz, posradius) + if ScavengerStartboxExists and posx <= ScavengerStartboxXMax and posx >= ScavengerStartboxXMin and posz >= ScavengerStartboxZMin and posz <= ScavengerStartboxZMax then + return false + else + return true + end +end + +function posMapsizeCheck(posx, posy, posz, posradius) + if posx + posradius >= mapsizeX or posx - posradius <= 0 or posz - posradius <= 0 or posz + posradius >= mapsizeZ then + return false + else + return true + end +end + + +function teamsCheck() + + bestTeamScore = 0 + bestTeam = 0 + if scavTechDifficulty == "adaptive" or globalScore == nil then + globalScore = 0 + end + nonFinalGlobalScore = 0 + scoreTeamCount = 0 + scorePerTeam = {} + for _,teamID in ipairs(Spring.GetTeamList()) do + if teamID ~= GaiaTeamID and teamID ~= Spring.GetGaiaTeamID() then + if not numOfSpawnBeaconsTeams[teamID] then + numOfSpawnBeaconsTeams[teamID] = 0 + end + local i = teamID + local _,_,teamisDead = Spring.GetTeamInfo(i) + local unitCount = Spring.GetTeamUnitCount(i) + if (not teamisDead) or unitCount > 0 then + scoreTeamCount = scoreTeamCount + 1 + local _,_,_,mi = Spring.GetTeamResources(i, "metal") + local _,_,_,ei = Spring.GetTeamResources(i, "energy") + local resourceScoreM = mi*scavconfig.scoreConfig.scorePerMetal + local resourceScoreE = ei*scavconfig.scoreConfig.scorePerEnergy + local unitScore = unitCount*scavconfig.scoreConfig.scorePerOwnedUnit + local finalScore = resourceScoreM + resourceScoreE + unitScore + + nonFinalGlobalScore = nonFinalGlobalScore + finalScore + + scorePerTeam[teamID] = finalScore + + if finalScore > bestTeamScore then + bestTeamScore = finalScore + bestTeam = i + end + end + end + end + if not killedscavengers then + killedscavengers = 0 + end + local timeScore = Spring.GetGameSeconds()*scavconfig.scoreConfig.scorePerSecond + if scavTechDifficulty == "adaptive" then + globalScore = math.ceil((nonFinalGlobalScore/scoreTeamCount) + killedscavengers + timeScore) + elseif scavTechDifficulty == "easy" then + globalScore = math.ceil(globalScore + 10*scavconfig.difficulty.easy*(Spring.GetGameSeconds()/60)) + elseif scavTechDifficulty == "medium" then + globalScore = math.ceil(globalScore + 10*scavconfig.difficulty.medium*(Spring.GetGameSeconds()/60)) + elseif scavTechDifficulty == "hard" then + globalScore = math.ceil(globalScore + 10*scavconfig.difficulty.hard*(Spring.GetGameSeconds()/60)) + elseif scavTechDifficulty == "brutal" then + globalScore = math.ceil(globalScore + 10*scavconfig.difficulty.brutal*(Spring.GetGameSeconds()/60)) + end + nonFinalGlobalScore = nil + scoreTeamCount = nil +end \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Constructor/placeholder.lua b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Constructor/placeholder.lua new file mode 100644 index 000000000..ad839becd --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Constructor/placeholder.lua @@ -0,0 +1,550 @@ + +-- table.insert(ScavengerBlueprintsT0,FunctionName) +-- table.insert(ScavengerBlueprintsT1,FunctionName) +-- table.insert(ScavengerBlueprintsT2,FunctionName) +-- table.insert(ScavengerBlueprintsT3,FunctionName) + +-- example blueprint: +-- local function a(posx, posy, posz, GaiaTeamID, radiusCheck) +-- local posradius = 120 + -- if radiusCheck then + -- return posradius + -- else + -- Spring.CreateUnit("unitname", posx, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx-100, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx+100, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx, posy, posz-100, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx, posy, posz+100, math.random(0,3),GaiaTeamID) + -- end +-- end +-- table.insert(ScavengerBlueprintsT1,a) + +local UDN = UnitDefNames + +local function placeholderradar1(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx-200, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+200, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx, posy, posz-200, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx, posy, posz+200, 0}, {"shift"}) + end +end +table.insert(ScavengerConstructorBlueprintsT0,placeholderradar1) +table.insert(ScavengerConstructorBlueprintsT1,placeholderradar1) +table.insert(ScavengerConstructorBlueprintsT2,placeholderradar1) +table.insert(ScavengerConstructorBlueprintsT3,placeholderradar1) + +local function placeholderradar2(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_up1_scav.id), {posx, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx-200, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+200, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx, posy, posz-200, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx, posy, posz+200, 0}, {"shift"}) + end +end +table.insert(ScavengerConstructorBlueprintsT2,placeholderradar2) +table.insert(ScavengerConstructorBlueprintsT3,placeholderradar2) + +local function emines(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + Spring.GiveOrderToUnit(scav, -(UDN.emine.id), {posx, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine.id), {posx-100, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine.id), {posx+100, posy, posz, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine.id), {posx, posy, posz-100, 0}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine.id), {posx, posy, posz+100, 0}, {"shift"}) + end +end + +table.insert(ScavengerConstructorBlueprintsT0,emines) +table.insert(ScavengerConstructorBlueprintsT1,emines) +table.insert(ScavengerConstructorBlueprintsT2,emines) +table.insert(ScavengerConstructorBlueprintsT3,emines) + +local function defenseoutpost(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(4), posy, posz+(-245), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-12), posy, posz+(219), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-380), posy, posz+(11), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(244), posy, posz+(171), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(276), posy, posz+(283), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-324), posy, posz+(147), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(116), posy, posz+(-405), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(236), posy, posz+(-253), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-108), posy, posz+(-405), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-172), posy, posz+(-101), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(468), posy, posz+(-197), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(252), posy, posz+(3), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(20), posy, posz+(459), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-404), posy, posz+(51), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-444), posy, posz+(-149), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-460), posy, posz+(91), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(220), posy, posz+(259), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-156), posy, posz+(-197), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-220), posy, posz+(-469), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(348), posy, posz+(131), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(20), posy, posz+(-5), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ekmar_scav.id), {posx+(20), posy, posz+(-85), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(516), posy, posz+(-5), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-396), posy, posz+(-261), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-212), posy, posz+(-317), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-124), posy, posz+(379), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-316), posy, posz+(331), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-4), posy, posz+(-269), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(28), posy, posz+(323), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(324), posy, posz+(-5), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(404), posy, posz+(59), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(12), posy, posz+(179), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(228), posy, posz+(123), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eshieldgen_scav.id), {posx+(12), posy, posz+(-157), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(372), posy, posz+(-245), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(388), posy, posz+(267), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(364), posy, posz+(-77), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(12), posy, posz+(-349), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-292), posy, posz+(3), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-268), posy, posz+(139), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-212), posy, posz+(259), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-340), posy, posz+(-173), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(276), posy, posz+(-133), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-92), posy, posz+(59), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(20), posy, posz+(363), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-156), posy, posz+(-5), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(244), posy, posz+(-149), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-156), posy, posz+(171), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(164), posy, posz+(395), 1}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-332), posy, posz+(-197), 1}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,defenseoutpost) +table.insert(ScavengerConstructorBlueprintsT3,defenseoutpost) + + +local function basehbot(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-239), posy, posz+(-184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(313), posy, posz+(144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(161), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-295), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-359), posy, posz+(-80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(217), posy, posz+(64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(185), posy, posz+(-192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-15), posy, posz+(312), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-135), posy, posz+(-112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-215), posy, posz+(160), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(353), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-279), posy, posz+(-384), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ehbotfac_scav.id), {posx+(25), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(73), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.etech1_scav.id), {posx+(-295), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(249), posy, posz+(-144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.efusion2_scav.id), {posx+(201), posy, posz+(272), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-127), posy, posz+(-24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(89), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(0), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(201), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-128), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(9), posy, posz+(-336), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(137), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(25), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-447), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-87), posy, posz+(80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-96), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(128), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,basehbot) +table.insert(ScavengerConstructorBlueprintsT3,basehbot) + + +local function basehover(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-239), posy, posz+(-184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(313), posy, posz+(144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(161), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-295), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-359), posy, posz+(-80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(217), posy, posz+(64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(185), posy, posz+(-192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-15), posy, posz+(312), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-135), posy, posz+(-112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-215), posy, posz+(160), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(353), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-279), posy, posz+(-384), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ebasefactory_scav.id), {posx+(25), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(73), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.etech1_scav.id), {posx+(-295), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(249), posy, posz+(-144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.efusion2_scav.id), {posx+(201), posy, posz+(272), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-127), posy, posz+(-24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(89), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(0), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(201), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-128), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(9), posy, posz+(-336), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(137), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(25), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-447), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-87), posy, posz+(80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-96), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(128), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,basehover) +table.insert(ScavengerConstructorBlueprintsT3,basehover) + + +local function baseallterr(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-239), posy, posz+(-184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(313), posy, posz+(144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(161), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-295), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-359), posy, posz+(-80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(217), posy, posz+(64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(185), posy, posz+(-192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-15), posy, posz+(312), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-135), posy, posz+(-112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-215), posy, posz+(160), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(353), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-279), posy, posz+(-384), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eallterrfac_scav.id), {posx+(25), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(73), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.etech1_scav.id), {posx+(-295), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(249), posy, posz+(-144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.efusion2_scav.id), {posx+(201), posy, posz+(272), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-127), posy, posz+(-24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(89), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(0), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(201), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-128), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(9), posy, posz+(-336), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(137), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(25), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-447), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-87), posy, posz+(80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-96), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(128), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,baseallterr) +table.insert(ScavengerConstructorBlueprintsT3,baseallterr) + + +local function baseamphib(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-239), posy, posz+(-184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(313), posy, posz+(144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(161), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-295), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-359), posy, posz+(-80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(217), posy, posz+(64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(185), posy, posz+(-192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-15), posy, posz+(312), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-135), posy, posz+(-112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-215), posy, posz+(160), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(353), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-279), posy, posz+(-384), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eamphibfac_scav.id), {posx+(25), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(73), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.etech1_scav.id), {posx+(-295), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(249), posy, posz+(-144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.efusion2_scav.id), {posx+(201), posy, posz+(272), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-127), posy, posz+(-24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(89), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(0), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(201), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-128), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(9), posy, posz+(-336), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(137), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(25), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-447), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-87), posy, posz+(80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-96), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(128), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,baseallterr) +table.insert(ScavengerConstructorBlueprintsT3,baseallterr) + + +local function baseair(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-239), posy, posz+(-184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(313), posy, posz+(144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(161), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-295), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-359), posy, posz+(-80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(217), posy, posz+(64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(185), posy, posz+(-192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-32), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-15), posy, posz+(312), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-87), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-135), posy, posz+(-112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-215), posy, posz+(160), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(425), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(353), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-279), posy, posz+(-384), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eairplant_scav.id), {posx+(25), posy, posz+(-64), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(73), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-183), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(176), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.etech1_scav.id), {posx+(-295), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(-215), posy, posz+(-48), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(249), posy, posz+(-144), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.efusion2_scav.id), {posx+(201), posy, posz+(272), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(192), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-127), posy, posz+(-24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(89), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.estorage_scav.id), {posx+(393), posy, posz+(112), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(0), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(201), posy, posz+(-288), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-128), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(9), posy, posz+(-336), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(137), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(25), posy, posz+(240), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-447), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-87), posy, posz+(80), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esolar2_scav.id), {posx+(-71), posy, posz+(-96), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.egeothermal_scav.id), {posx+(-23), posy, posz+(128), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT2,baseair) +table.insert(ScavengerConstructorBlueprintsT3,baseair) + + + +local function antinuke(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(422), posy, posz+(-59), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(326), posy, posz+(101), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eshieldgen_scav.id), {posx+(62), posy, posz+(-99), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-490), posy, posz+(-123), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-298), posy, posz+(-267), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(86), posy, posz+(453), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(30), posy, posz+(-259), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(94), posy, posz+(269), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(342), posy, posz+(-283), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(486), posy, posz+(-235), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(406), posy, posz+(261), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ekmar_scav.id), {posx+(-74), posy, posz+(-27), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-234), posy, posz+(101), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-82), posy, posz+(365), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-226), posy, posz+(-83), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-426), posy, posz+(-251), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(270), posy, posz+(205), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-218), posy, posz+(341), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(278), posy, posz+(-315), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(422), posy, posz+(117), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-98), posy, posz+(-147), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(214), posy, posz+(341), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-282), posy, posz+(437), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-258), posy, posz+(125), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-58), posy, posz+(-363), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(238), posy, posz+(109), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(54), posy, posz+(53), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-410), posy, posz+(165), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-26), posy, posz+(-443), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-226), posy, posz+(29), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-394), posy, posz+(-59), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(166), posy, posz+(-251), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-410), posy, posz+(117), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(318), posy, posz+(-83), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ekmar_scav.id), {posx+(166), posy, posz+(-27), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-170), posy, posz+(-187), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT3,antinuke) + + +local function antinuke(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(422), posy, posz+(-59), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(326), posy, posz+(101), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eshieldgen_scav.id), {posx+(62), posy, posz+(-99), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-490), posy, posz+(-123), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-298), posy, posz+(-267), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(86), posy, posz+(453), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(30), posy, posz+(-259), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(94), posy, posz+(269), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(342), posy, posz+(-283), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(486), posy, posz+(-235), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(406), posy, posz+(261), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ekmar_scav.id), {posx+(-74), posy, posz+(-27), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-234), posy, posz+(101), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-82), posy, posz+(365), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-226), posy, posz+(-83), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-426), posy, posz+(-251), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(270), posy, posz+(205), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-218), posy, posz+(341), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(278), posy, posz+(-315), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(422), posy, posz+(117), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-98), posy, posz+(-147), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(214), posy, posz+(341), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-282), posy, posz+(437), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-258), posy, posz+(125), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-58), posy, posz+(-363), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(238), posy, posz+(109), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eradar2_scav.id), {posx+(54), posy, posz+(53), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-410), posy, posz+(165), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-26), posy, posz+(-443), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elaserbattery_scav.id), {posx+(-226), posy, posz+(29), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-394), posy, posz+(-59), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(166), posy, posz+(-251), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-410), posy, posz+(117), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(318), posy, posz+(-83), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ekmar_scav.id), {posx+(166), posy, posz+(-27), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-170), posy, posz+(-187), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT3,antinuke) + + +local function nuke(scav, posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 150 + if radiusCheck then + return posradius + else + + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(92), posy, posz+(184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-164), posy, posz+(-168), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ejammer2_scav.id), {posx+(156), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(204), posy, posz+(104), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(204), posy, posz+(24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-28), posy, posz+(224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(92), posy, posz+(-168), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.esilo_scav.id), {posx+(-4), posy, posz+(24), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(268), posy, posz+(200), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(204), posy, posz+(-152), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-308), posy, posz+(-232), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(4), posy, posz+(-224), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-100), posy, posz+(184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(276), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(204), posy, posz+(-56), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(-276), posy, posz+(184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.ejammer2_scav.id), {posx+(-164), posy, posz+(8), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.eheavyturret2_scav.id), {posx+(-252), posy, posz+(16), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-36), posy, posz+(-152), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.elightturret2_scav.id), {posx+(252), posy, posz+(-216), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-212), posy, posz+(184), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-212), posy, posz+(-72), 2}, {"shift"}) + Spring.GiveOrderToUnit(scav, -(UDN.emine_scav.id), {posx+(-196), posy, posz+(88), 2}, {"shift"}) + + end +end + +table.insert(ScavengerConstructorBlueprintsT3,nuke) \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/placeholder.lua b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/placeholder.lua new file mode 100644 index 000000000..dafe8d79c --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/placeholder.lua @@ -0,0 +1,33 @@ + +-- table.insert(ScavengerBlueprintsT0,FunctionName) +-- table.insert(ScavengerBlueprintsT1,FunctionName) +-- table.insert(ScavengerBlueprintsT2,FunctionName) +-- table.insert(ScavengerBlueprintsT3,FunctionName) + +-- example blueprint: +-- local function a(posx, posy, posz, GaiaTeamID, radiusCheck) +-- local posradius = 120 + -- if radiusCheck then + -- return posradius + -- else + -- Spring.CreateUnit("unitname", posx, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx-100, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx+100, posy, posz, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx, posy, posz-100, math.random(0,3),GaiaTeamID) + -- Spring.CreateUnit("unitname", posx, posy, posz+100, math.random(0,3),GaiaTeamID) + -- end +-- end +-- table.insert(ScavengerBlueprintsT1,a) + +local function placeholderradar(posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 30 + if radiusCheck then + return posradius + else + Spring.CreateUnit("eradar2_scav", posx, posy, posz, math.random(0,3),GaiaTeamID) + end +end +table.insert(ScavengerBlueprintsT0,placeholderradar) +table.insert(ScavengerBlueprintsT1,placeholderradar) +table.insert(ScavengerBlueprintsT2,placeholderradar) +table.insert(ScavengerBlueprintsT3,placeholderradar) \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/simblebases.lua b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/simblebases.lua new file mode 100644 index 000000000..f935d6fb1 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Blueprints/EvoRTS/Spawner/simblebases.lua @@ -0,0 +1,95 @@ +nameSuffix = "_scav" + +local function simplebasehover(posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 500 + if radiusCheck then + return posradius + else + Spring.CreateUnit("estorage"..nameSuffix, posx+(-286), posy, posz+(31), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(-302), posy, posz+(-385), 0,GaiaTeamID) + Spring.CreateUnit("elightturret2"..nameSuffix, posx+(306), posy, posz+(-305), 0,GaiaTeamID) + Spring.CreateUnit("esolar2"..nameSuffix, posx+(370), posy, posz+(-65), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-222), posy, posz+(31), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-286), posy, posz+(-97), 0,GaiaTeamID) + Spring.CreateUnit("ebasefactory"..nameSuffix, posx+(82), posy, posz+(47), 0,GaiaTeamID) + Spring.CreateUnit("esolar2"..nameSuffix, posx+(370), posy, posz+(31), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(-302), posy, posz+(335), 0,GaiaTeamID) + Spring.CreateUnit("etech1"..nameSuffix, posx+(50), posy, posz+(-289), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-222), posy, posz+(-97), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(386), posy, posz+(303), 0,GaiaTeamID) + Spring.CreateUnit("elightturret2"..nameSuffix, posx+(66), posy, posz+(463), 0,GaiaTeamID) + end +end +table.insert(ScavengerBlueprintsT0,simplebasehover) +table.insert(ScavengerBlueprintsT1,simplebasehover) +table.insert(ScavengerBlueprintsT2,simplebasehover) +table.insert(ScavengerBlueprintsT3,simplebasehover) + +local function simplebasehbot(posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 500 + if radiusCheck then + return posradius + else + Spring.CreateUnit("elightturret2"..nameSuffix, posx+(-208), posy, posz+(-350), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-272), posy, posz+(-174), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(32), posy, posz+(450), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(288), posy, posz+(290), 0,GaiaTeamID) + Spring.CreateUnit("etech1"..nameSuffix, posx+(48), posy, posz+(-270), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(320), posy, posz+(98), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(448), posy, posz+(274), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(288), posy, posz+(-350), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-144), posy, posz+(-174), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(208), posy, posz+(-158), 0,GaiaTeamID) + --Spring.CreateUnit("elightturret2"..nameSuffix, posx+(-288), posy, posz+(274), 0,GaiaTeamID) + Spring.CreateUnit("ehbotfac"..nameSuffix, posx+(48), posy, posz+(18), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-272), posy, posz+(-46), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-336), posy, posz+(-46), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-176), posy, posz+(98), 0,GaiaTeamID) + Spring.CreateUnit("estorage"..nameSuffix, posx+(-336), posy, posz+(-174), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-128), posy, posz+(322), 0,GaiaTeamID) + Spring.CreateUnit("elightturret2"..nameSuffix, posx+(480), posy, posz+(-78), 0,GaiaTeamID) + end +end +table.insert(ScavengerBlueprintsT0,simplebasehbot) +table.insert(ScavengerBlueprintsT1,simplebasehbot) +table.insert(ScavengerBlueprintsT2,simplebasehbot) +table.insert(ScavengerBlueprintsT3,simplebasehbot) + +local function simplebaseair(posx, posy, posz, GaiaTeamID, radiusCheck) +local posradius = 500 + if radiusCheck then + return posradius + else + Spring.CreateUnit("emine"..nameSuffix, posx+(-520), posy, posz+(-253), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-472), posy, posz+(291), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(392), posy, posz+(131), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(600), posy, posz+(-221), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-152), posy, posz+(-493), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(40), posy, posz+(-285), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-280), posy, posz+(-317), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(104), posy, posz+(-541), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(216), posy, posz+(307), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(296), posy, posz+(-189), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(232), posy, posz+(563), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(504), posy, posz+(323), 0,GaiaTeamID) + Spring.CreateUnit("elaserbattery"..nameSuffix, posx+(-360), posy, posz+(-45), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-344), posy, posz+(-477), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-168), posy, posz+(579), 0,GaiaTeamID) + Spring.CreateUnit("eairplant"..nameSuffix, posx+(8), posy, posz+(-13), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-312), posy, posz+(323), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-56), posy, posz+(403), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-232), posy, posz+(-141), 0,GaiaTeamID) + Spring.CreateUnit("elaserbattery"..nameSuffix, posx+(504), posy, posz+(3), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-456), posy, posz+(163), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-296), posy, posz+(51), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(424), posy, posz+(-381), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(664), posy, posz+(3), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(360), posy, posz+(19), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-200), posy, posz+(211), 0,GaiaTeamID) + Spring.CreateUnit("emine"..nameSuffix, posx+(-488), posy, posz+(3), 0,GaiaTeamID) + end +end +table.insert(ScavengerBlueprintsT0,simplebaseair) +table.insert(ScavengerBlueprintsT1,simplebaseair) +table.insert(ScavengerBlueprintsT2,simplebaseair) +table.insert(ScavengerBlueprintsT3,simplebaseair) \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Blueprints/readme.txt b/LuaRules/Gadgets/scavengers/Blueprints/readme.txt new file mode 100644 index 000000000..178ced66d --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Blueprints/readme.txt @@ -0,0 +1,4 @@ +You can add more files with blueprints into those folders. Script will automatically load all of them + +Spawner folder is for buildingSpawnerModule +Constructor folder is for constructor blueprints \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/air.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/air.lua new file mode 100644 index 000000000..51b7945e0 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/air.lua @@ -0,0 +1,32 @@ +T0AirUnits = { + "escoutdrone", + "zairscout", +} + +T1AirUnits = { + "efighter", + "zairtoairfighter", +} + +T2AirUnits = { + "efighter", + "zairtoairfighter", + "egunship2", + "ebomber", + "zairtogroundfighter", + "zairbomber", +} + +T3AirUnits = { + "efighter", + "zairtoairfighter", + "egunship2", + "ebomber", + "zairtogroundfighter", + "zairbomber", +} + +T4AirUnits = { + "ekrow", + "ekrow", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/boss.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/boss.lua new file mode 100644 index 000000000..79d3208dc --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/boss.lua @@ -0,0 +1,7 @@ +BossUnits = { +"ekrowboss_scav", +"eallterranarchidboss_scav", +"eamphiblevelerboss_scav", +"ehbotkargannethboss_scav", +"elaceratorboss_scav", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/constructors.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/constructors.lua new file mode 100644 index 000000000..66d507103 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/constructors.lua @@ -0,0 +1,44 @@ +ConstructorsList = { + "ecommander", + --"xcommander", +} + +-- put ALL commander units from your game here +CommandersList = { + "ecommander", + "ecommanderbattle", + "ecommanderbuild", + "ecommandercloak", + "ecommanderfactory", + "ecommandermeteor", + "ecommandershield", + "zarm", + --"xcommander", +} + +ConstructorsCounter = { + UDN.ecommander.id, + --UDN.xcommander.id, +} + +AssistUnits = { + "eorb", + "zconstructor", + "ztenticle", + "zarm", +} + +Resurrectors = { +"placeholder", +"placeholder", +} + +ResurrectorsSea = { +"placeholder", +"placeholder", +} + +Collectors = { +"placeholder", +"placeholder", +} \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/factories.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/factories.lua new file mode 100644 index 000000000..4717da4e3 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/factories.lua @@ -0,0 +1,13 @@ +Factories = { + "ebasefactory", + "eminifac", + "eamphibfac", + "ehbotfac", + "eairplant", + "zhatch", +} + +FactoriesExcludedUnits = { +"placeholder", +"placeholder", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/land.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/land.lua new file mode 100644 index 000000000..d9a2059ba --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/land.lua @@ -0,0 +1,65 @@ +T0LandUnits = { + "eallterrlight", + "eamphibbuggy", + "ehbotpeewee", + "elighttank3", + "zlightswarm", +} + +T1LandUnits = { + "eallterrlight", + "eamphibbuggy", + "ehbotpeewee", + "elighttank3", + "zlightswarm", + "eallterrriot", + "eallterrriot_shotgun", + "eallterrmed", + "eamphibneedle", + "eamphibriot", + "eamphibriot_shotgun", + "ehbotthud", + "eriottank2", + "eriottank2_shotgun", + "eallterrassault", + "eamphibarty", + "eartytank", + "eartytank_saturation", + "zmedswarm", + "zpyro", +} + +T2LandUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T3LandUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T4LandUnits = { + "eallterranarchid", + "eamphibleveler", + "ehbotkarganneth", + "elacerator", + "zqueen", + "eamphibbuggybig", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/reinforcements.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/reinforcements.lua new file mode 100644 index 000000000..9f6df4f8e --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/reinforcements.lua @@ -0,0 +1,136 @@ +T1ReinforcementLandUnits = { + "eallterrlight", + "eamphibbuggy", + "ehbotpeewee", + "elighttank3", + "zlightswarm", + "eallterrriot", + "eallterrriot_shotgun", + "eallterrmed", + "eamphibneedle", + "eamphibriot", + "eamphibriot_shotgun", + "ehbotthud", + "eriottank2", + "eriottank2_shotgun", + "eallterrassault", + "eamphibarty", + "eartytank", + "eartytank_saturation", + "zmedswarm", + "zpyro", +} + +T2ReinforcementLandUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T3ReinforcementLandUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T4ReinforcementLandUnits = { + "eallterranarchid", + "eamphibleveler", + "ehbotkarganneth", + "elacerator", + "zqueen", +} + +T1ReinforcementAirUnits = { + "efighter", + "zairtoairfighter", +} + +T2ReinforcementAirUnits = { + "egunship2", + "ebomber", + "zairtogroundfighter", + "zairbomber", +} + +T3ReinforcementAirUnits = { + "egunship2", + "ebomber", + "zairbomber", +} + +T4ReinforcementAirUnits = { + "ekrow", + "ekrow", +} + +T1ReinforcementSeaUnits = { + "eallterrlight", + "eamphibbuggy", + "ehbotpeewee", + "elighttank3", + "zlightswarm", + "eallterrriot", + "eallterrriot_shotgun", + "eallterrmed", + "eamphibneedle", + "eamphibriot", + "eamphibriot_shotgun", + "ehbotthud", + "eriottank2", + "eriottank2_shotgun", + "eallterrassault", + "eamphibarty", + "eartytank", + "eartytank_saturation", + "zmedswarm", + "zpyro", +} + +T2ReinforcementSeaUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T3ReinforcementSeaUnits = { + "eallterrheavy", + "eallterrshield", + "eamphibmedtank", + "eamphibrock", + "ehbotrocko", + "ehbotsniper", + "eheavytank3", + "emissiletank", + "zskirmisher", + "zassault", +} + +T4ReinforcementSeaUnits = { + "eallterranarchid", + "eamphibleveler", + "ehbotkarganneth", + "elacerator", + "zqueen", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/sea.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/sea.lua new file mode 100644 index 000000000..a71c39397 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/sea.lua @@ -0,0 +1,14 @@ +T0SeaUnits = { +} + +T1SeaUnits = { +} + +T2SeaUnits = { +} + +T3SeaUnits = { +} + +T4SeaUnits = { +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/staticunits.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/staticunits.lua new file mode 100644 index 000000000..bd4a2b03d --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/UnitLists/staticunits.lua @@ -0,0 +1,144 @@ +NoSelfdList = { + "ehbotkarganneth_turret", + "ehbotpeewee_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", + "zarm", + "ztenticle", + "ztumor", + "lootboxbronze", + "lootboxsilver", + "lootboxgold", + "lootboxplatinum", +} + +StockpilingUnitNames = { + "placeholder", + "placeholder", +} + +NukingUnitNames = { + "esilo", +} + +BeaconCaptureExcludedUnits = { + "fuck", + "this", +} + +BeaconDefenceStructuresT0 = { + "elightturret2", + "elightturret2", + "ehbotpeewee_turret", +} + +BeaconDefenceStructuresT1 = { + "elightturret2", + "eheavyturret2", + "ehbotpeewee_turret", + "ehbotthud_turret", +} + +BeaconDefenceStructuresT2 = { + "eheavyturret2", + "elaserbattery", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + +BeaconDefenceStructuresT3 = { + "eheavyturret2", + "elaserbattery", + "eartyturret", + "ehbotkarganneth_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + + + +StartboxDefenceStructuresT0 = { + "elightturret2", + "elightturret2", + "ehbotpeewee_turret", +} + +StartboxDefenceStructuresT1 = { + "elightturret2", + "eheavyturret2", + "ehbotpeewee_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT2 = { + "eheavyturret2", + "elaserbattery", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT3 = { + "eheavyturret2", + "elaserbattery", + "eartyturret", + "ehbotkarganneth_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT4 = { + "eheavyturret2", + "elaserbattery", + "eartyturret", + "ehbotkarganneth_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + + +StartboxDefenceStructuresT0Sea = { + "elightturret2", + "elightturret2", + "ehbotpeewee_turret", +} + +StartboxDefenceStructuresT1Sea = { + "elightturret2", + "eheavyturret2", + "ehbotpeewee_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT2Sea = { + "eheavyturret2", + "elaserbattery", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT3Sea = { + "eheavyturret2", + "elaserbattery", + "eartyturret", + "ehbotkarganneth_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} + +StartboxDefenceStructuresT4Sea = { + "eheavyturret2", + "elaserbattery", + "eartyturret", + "ehbotkarganneth_turret", + "ehbotrocko_turret", + "ehbotsniper_turret", + "ehbotthud_turret", +} diff --git a/LuaRules/Gadgets/scavengers/Configs/EvoRTS/config.lua b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/config.lua new file mode 100644 index 000000000..ff3ab9957 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Configs/EvoRTS/config.lua @@ -0,0 +1,259 @@ +Spring.Echo("[Scavengers] Config initialized") + +adder = 300 +multiplier = 0.5 +-- Config for Scavengers Survival AI + +scavconfig = { + difficulty = { + easy = 1, + medium = 2, + hard = 3, + brutal = 5, + }, + unitnamesuffix = "_scav", + messenger = true, -- BYAR specific thing, don't enable otherwise (or get gui_messages.lua from BYAR) + modules = { + buildingSpawnerModule = true, --building spawner spawns random blueprints around map + constructorControllerModule = true, --constructor controller is for units that build blueprints + factoryControllerModule = true, --factory controller is to give orders to factories + unitSpawnerModule = true, --spawns units + startBoxProtection = true, --spawns turrets around the startboxes (if you are using startboxes) and damages units inside of it + reinforcementsModule = false, --reinforcements adds beacon capturing and friendly drops + stockpilers = false, --stockpilers adds controller for units with stockpile mechanic + nukes = true, --nukes gives orders to nuke units + }, + + scoreConfig = { + -- set to 0 to disable + scorePerMetal = 1, -- thisvalue*metalproduction + scorePerEnergy = 1, -- thisvalue*energyproduction + scorePerSecond = 1, -- thisvalue*secondspassed + scorePerOwnedUnit = 1, -- thisvalue*countofunits + ----------------------------------------- + baseScorePerKill = 1, -- How much score EVERY KILL and CAPTURE adds + -- Additional score for specific unit types, use -baseScorePerKill(default 1) to make it have no effect on score, use values lower than baseScorePerKill to reduce score + scorePerKilledBuilding = 4, + scorePerKilledConstructor = 99, + scorePerKilledSpawner = 49, + scorePerCapturedSpawner = -51, -- this doesn't care about baseScorePerKill + }, + + timers = { + -- globalScore values + T0start = 1, + T1start = 150+adder*multiplier, + T1low = 300+adder*multiplier, + T1med = 450+adder*multiplier, + T1high = 600+adder*multiplier, + T1top = 750+adder*multiplier, + T2start = 900+adder*multiplier, + T2low = 1050+adder*multiplier, + T2med = 1200+adder*multiplier, + T2high = 1350+adder*multiplier, + T2top = 1500+adder*multiplier, + T3start = 1750+adder*multiplier, + T3low = 2000+adder*multiplier, + T3med = 2250+adder*multiplier, + T3high = 2500+adder*multiplier, + T3top = 2750+adder*multiplier, + T4start = 3000+adder*multiplier, + T4low = 3250+adder*multiplier, + T4med = 3500+adder*multiplier, + T4high = 3750+adder*multiplier, + T4top = 4000+adder*multiplier, + BossFight = 4001+adder*multiplier, + -- don't delete + NoRadar = 1200, --Under this score beacons don't spawn in radar covered area. Above this score they can spawn in radar but not in LoS. + }, + other = { + heighttolerance = 30, -- higher = allow higher height diffrences + noheightchecksforwater = true, + } +} + + +-- Modules configs +buildingSpawnerModuleConfig = { + spawnchance = 90, +} + +unitSpawnerModuleConfig = { + bossFightEnabled = true, + FinalBossUnit = true, + FinalBossHealth = 1500000, -- this*teamcount*difficulty + FinalBossMinionsPassive = 1000, -- this/(teamcount*difficulty), how often does boss spawn minions passively, frames. + FinalBossMinionsActive = 150, -- this/(teamcount*difficulty), how often does boss spawn minions when taking damage, frames. + BossWaveTimeLeft = 480, + aircraftchance = 8, -- higher number = lower chance + globalscoreperoneunit = 200, + spawnchance = 120, + beaconspawnchance = 120, + minimumspawnbeacons = 2, + landmultiplier = 0.75, + airmultiplier = 2, + seamultiplier = 0.2, + chanceforaircraftonsea = 2, -- higher number = lower chance + + t0multiplier = 1.5, + t1multiplier = 1.25, + t2multiplier = 1, + t3multiplier = 0.75, + t4multiplier = 0.1, +} + +constructorControllerModuleConfig = { + constructortimerstart = 120, -- ammount of seconds it skips from constructortimer for the first spawn (make first spawn earlier - this timer starts on timer-Timer1) + constructortimer = 220, -- time in seconds between commander/constructor spawns + constructortimerreductionframes = 36000, + minimumconstructors = 5, + useresurrectors = false, + searesurrectors = false, + useconstructors = true, + usecollectors = false, +} + +unitControllerModuleConfig = { + minimumrangeforfight = 650, +} + +spawnProtectionConfig = { + spread = 192, +} + + +-- Functions which you can configure +function CountScavConstructors() + return UDC(GaiaTeamID, UDN.ecommander.id) + UDC(GaiaTeamID, UDN.ecommanderbattle.id) +end + +function UpdateTierChances(n) + -- Must be 100 in total + if globalScore > scavconfig.timers.T4top then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 10 + TierSpawnChances.T3 = 30 + TierSpawnChances.T4 = 60 + elseif globalScore > scavconfig.timers.T4high then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 20 + TierSpawnChances.T3 = 50 + TierSpawnChances.T4 = 30 + elseif globalScore > scavconfig.timers.T4med then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 30 + TierSpawnChances.T3 = 50 + TierSpawnChances.T4 = 20 + elseif globalScore > scavconfig.timers.T4low then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 40 + TierSpawnChances.T3 = 50 + TierSpawnChances.T4 = 10 + elseif globalScore > scavconfig.timers.T4start then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 40 + TierSpawnChances.T3 = 55 + TierSpawnChances.T4 = 5 + elseif globalScore > scavconfig.timers.T3top then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 20 + TierSpawnChances.T3 = 70 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T3high then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 50 + TierSpawnChances.T3 = 40 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T3med then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 60 + TierSpawnChances.T3 = 30 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T3low then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 65 + TierSpawnChances.T3 = 25 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T3start then + TierSpawnChances.T0 = 0 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 70 + TierSpawnChances.T3 = 10 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T2top then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 80 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T2high then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 30 + TierSpawnChances.T2 = 60 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T2med then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 40 + TierSpawnChances.T2 = 50 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T2low then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 60 + TierSpawnChances.T2 = 30 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T2start then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 70 + TierSpawnChances.T2 = 20 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T1top then + TierSpawnChances.T0 = 10 + TierSpawnChances.T1 = 90 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T1high then + TierSpawnChances.T0 = 40 + TierSpawnChances.T1 = 60 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T1med then + TierSpawnChances.T0 = 60 + TierSpawnChances.T1 = 40 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T1low then + TierSpawnChances.T0 = 80 + TierSpawnChances.T1 = 20 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + elseif globalScore > scavconfig.timers.T1start then + TierSpawnChances.T0 = 90 + TierSpawnChances.T1 = 10 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + else + TierSpawnChances.T0 = 100 + TierSpawnChances.T1 = 0 + TierSpawnChances.T2 = 0 + TierSpawnChances.T3 = 0 + TierSpawnChances.T4 = 0 + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Modules/building_spawner.lua b/LuaRules/Gadgets/scavengers/Modules/building_spawner.lua new file mode 100644 index 000000000..016deb16b --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/building_spawner.lua @@ -0,0 +1,71 @@ + +Spring.Echo("[Scavengers] Building spawner initialized") + +BlueprintsList = VFS.DirList('luarules/gadgets/scavengers/Blueprints/'..GameShortName..'/Spawner/','*.lua') +for i = 1,#BlueprintsList do + VFS.Include(BlueprintsList[i]) + Spring.Echo("Scav Blueprints Directory: " ..BlueprintsList[i]) +end + +function SpawnBlueprint(n) + if n > 9000 then + local gaiaUnitCount = Spring.GetTeamUnitCount(GaiaTeamID) + local spawnchance = math_random(0,buildingSpawnerModuleConfig.spawnchance) + if spawnchance == 0 or canBuildHere == false then + posx = math_random(200,mapsizeX-200) + posz = math_random(200,mapsizeZ-200) + posy = Spring.GetGroundHeight(posx, posz) + local spawnTier = math_random(1,100) + if posy > 0 then + if spawnTier <= TierSpawnChances.T0 then + blueprint = ScavengerBlueprintsT0[math_random(1,#ScavengerBlueprintsT0)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + blueprint = ScavengerBlueprintsT1[math_random(1,#ScavengerBlueprintsT1)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + blueprint = ScavengerBlueprintsT2[math_random(1,#ScavengerBlueprintsT2)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + blueprint = ScavengerBlueprintsT3[math_random(1,#ScavengerBlueprintsT3)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + blueprint = ScavengerBlueprintsT3[math_random(1,#ScavengerBlueprintsT3)] + else + blueprint = ScavengerBlueprintsT0[math_random(1,#ScavengerBlueprintsT0)] + end + elseif posy <= 0 then + if spawnTier <= TierSpawnChances.T0 then + blueprint = ScavengerBlueprintsT0Sea[math_random(1,#ScavengerBlueprintsT0Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + blueprint = ScavengerBlueprintsT1Sea[math_random(1,#ScavengerBlueprintsT1Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + blueprint = ScavengerBlueprintsT2Sea[math_random(1,#ScavengerBlueprintsT2Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + blueprint = ScavengerBlueprintsT3Sea[math_random(1,#ScavengerBlueprintsT3Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + blueprint = ScavengerBlueprintsT4Sea[math_random(1,#ScavengerBlueprintsT4Sea)] + else + blueprint = ScavengerBlueprintsT0Sea[math_random(1,#ScavengerBlueprintsT0Sea)] + end + end + posradius = blueprint(posx, posy, posz, GaiaTeamID, true) + canBuildHere = posLosCheck(posx, posy, posz, posradius) + if canBuildHere then + canBuildHere = posOccupied(posx, posy, posz, posradius) + end + if canBuildHere then + canBuildHere = posCheck(posx, posy, posz, posradius) + end + + if canBuildHere then + -- let's do this shit + blueprint(posx, posy, posz, GaiaTeamID, false) + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz-posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz-posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz-posradius, math_random(0,3),GaiaTeamID) + end + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Modules/constructor_controller.lua b/LuaRules/Gadgets/scavengers/Modules/constructor_controller.lua new file mode 100644 index 000000000..6772d5c69 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/constructor_controller.lua @@ -0,0 +1,240 @@ +Spring.Echo("[Scavengers] Constructor Controller initialized") + +VFS.Include("luarules/gadgets/scavengers/Configs/"..GameShortName.."/UnitLists/constructors.lua") +Blueprints2List = VFS.DirList('luarules/gadgets/scavengers/Blueprints/'..GameShortName..'/Constructor/','*.lua') +for i = 1,#Blueprints2List do + VFS.Include(Blueprints2List[i]) + Spring.Echo("Scav Blueprints Directory: " ..Blueprints2List[i]) +end +local constructortimer = constructorControllerModuleConfig.constructortimerstart + +scavvoicenotif = 2 + +function AssistantOrders(n, scav) + local x,y,z = Spring.GetUnitPosition(scav) + Spring.GiveOrderToUnit(scav, CMD.PATROL,{x-100,y,z}, {"shift"}) + Spring.GiveOrderToUnit(scav, CMD.PATROL,{x+100,y,z}, {"shift"}) + Spring.GiveOrderToUnit(scav, CMD.PATROL,{x,y,z-100}, {"shift"}) + Spring.GiveOrderToUnit(scav, CMD.PATROL,{x,y,z+100}, {"shift"}) +end + +function ResurrectorOrders(n, scav) + local mapcenterX = mapsizeX/2 + local mapcenterZ = mapsizeZ/2 + local mapcenterY = Spring.GetGroundHeight(mapcenterX, mapcenterZ) + local mapdiagonal = math.ceil(math.sqrt((mapsizeX*mapsizeX)+(mapsizeZ*mapsizeZ))) + Spring.GiveOrderToUnit(scav, CMD.RESURRECT,{mapcenterX+math_random(-100,100),mapcenterY,mapcenterZ+math_random(-100,100),mapdiagonal}, 0) +end + +function CollectorOrders(n, scav) + local mapcenterX = mapsizeX/2 + local mapcenterZ = mapsizeZ/2 + local mapcenterY = Spring.GetGroundHeight(mapcenterX, mapcenterZ) + local mapdiagonal = math.ceil(math.sqrt((mapsizeX*mapsizeX)+(mapsizeZ*mapsizeZ))) + Spring.GiveOrderToUnit(scav, CMD.RECLAIM,{mapcenterX+math_random(-100,100),mapcenterY,mapcenterZ+math_random(-100,100),mapdiagonal}, 0) +end + +function ReclaimerOrders(n, scav) + local nearestenemy = Spring.GetUnitNearestEnemy(scav, 999999, false) + Spring.GiveOrderToUnit(scav, CMD.RECLAIM,{nearestenemy}, 0) + local x,y,z = Spring.GetUnitPosition(nearestenemy) + Spring.GiveOrderToUnit(scav, CMD.FIGHT,{x,y,z}, {"meta", "shift", "alt"}) +end + +function SpawnConstructor(n) + if (constructortimer > constructorControllerModuleConfig.constructortimer or CountScavConstructors() < constructorControllerModuleConfig.minimumconstructors ) and numOfSpawnBeacons > 0 and constructortimer > 4 then + local scavengerunits = Spring.GetTeamUnits(GaiaTeamID) + SpawnBeacons = {} + for i = 1,#scavengerunits do + local scav = scavengerunits[i] + local scavDef = Spring.GetUnitDefID(scav) + if scavSpawnBeacon[scav] then + table.insert(SpawnBeacons,scav) + end + end + for b = 1,10 do + local pickedBeaconTest = SpawnBeacons[math_random(1,#SpawnBeacons)] + local _,_,_,pickedBeaconCaptureProgress = Spring.GetUnitHealth(pickedBeaconTest) + if pickedBeaconCaptureProgress == 0 then + pickedBeacon = pickedBeaconTest + break + else + pickedBeacon = 1234567890 + end + end + if pickedBeacon == 1234567890 then + return + end + posx,posy,posz = Spring.GetUnitPosition(pickedBeacon) + local nearestEnemy = Spring.GetUnitNearestEnemy(pickedBeacon, 99999, false) + local nearestEnemyTeam = Spring.GetUnitTeam(nearestEnemy) + if nearestEnemyTeam == bestTeam then + canSpawnCommanderHere = true + else + local r = math_random(0,4) + if r == 0 then + canSpawnCommanderHere = true + else + canSpawnCommanderHere = false + end + end + if canSpawnCommanderHere then + posradius = 48 + --Spring.GiveOrderToUnit(pickedBeacon, CMD.SELFD,{}, {"shift"}) + if not anothercommander then + ScavSendNotification("scav_scavcomdetected") + anothercommander = true + else + local s = math_random(0,scavvoicenotif) + if s == 0 then + ScavSendNotification("scav_scavadditionalcomdetected") + elseif s == 1 then + ScavSendNotification("scav_scavanotherscavcomdetected") + elseif s == 2 then + ScavSendNotification("scav_scavnewcomentered") + elseif s == 3 then + ScavSendNotification("scav_scavcomspotted") + elseif s == 4 then + ScavSendNotification("scav_scavcomnewdetect") + else + ScavSendMessage("A Scavenger Commander detected") + end + if scavvoicenotif < 20 then + scavvoicenotif = scavvoicenotif + 1 + end + end + SpawnBeacon(n) + constructortimer = constructortimer - constructorControllerModuleConfig.constructortimer + local r = ConstructorsList[math_random(1,#ConstructorsList)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID,n+90) + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID) + if constructorControllerModuleConfig.useresurrectors then + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz-posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz+posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx-posradius, posy, posz-posradius, math_random(0,3),GaiaTeamID) + Spring.CreateUnit("scavengerdroppod_scav", posx+posradius, posy, posz-posradius, math_random(0,3),GaiaTeamID) + if posy > 0 then + local r2 = Resurrectors[math_random(1,#Resurrectors)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx+32, posy, posz, math_random(0,3),GaiaTeamID,n+90+1) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx-32, posy, posz, math_random(0,3),GaiaTeamID,n+90+2) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz+32, math_random(0,3),GaiaTeamID,n+90+3) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz-32, math_random(0,3),GaiaTeamID,n+90+4) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx+32, posy, posz+32, math_random(0,3),GaiaTeamID,n+90+5) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx-32, posy, posz-32, math_random(0,3),GaiaTeamID,n+90+6) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx-32, posy, posz+32, math_random(0,3),GaiaTeamID,n+90+7) + QueueSpawn(r2..scavconfig.unitnamesuffix, posx+32, posy, posz-32, math_random(0,3),GaiaTeamID,n+90+8) + elseif constructorControllerModuleConfig.searesurrectors == true then + local r3 = ResurrectorsSea[math_random(1,#ResurrectorsSea)] + QueueSpawn(r3..scavconfig.unitnamesuffix, posx+32, posy, posz+32, math_random(0,3),GaiaTeamID,n+90+1) + QueueSpawn(r3..scavconfig.unitnamesuffix, posx-32, posy, posz-32, math_random(0,3),GaiaTeamID,n+90+2) + QueueSpawn(r3..scavconfig.unitnamesuffix, posx-32, posy, posz+32, math_random(0,3),GaiaTeamID,n+90+3) + QueueSpawn(r3..scavconfig.unitnamesuffix, posx+32, posy, posz-32, math_random(0,3),GaiaTeamID,n+90+4) + end + end + else + constructortimer = constructortimer + math.ceil(n/constructorControllerModuleConfig.constructortimerreductionframes) + end + else + constructortimer = constructortimer + math.ceil(n/constructorControllerModuleConfig.constructortimerreductionframes) + end +end + +ConstructorNumberOfRetries = {} +function ConstructNewBlueprint(n, scav) + if not ConstructorNumberOfRetries[scav] then + ConstructorNumberOfRetries[scav] = 0 + end + ConstructorNumberOfRetries[scav] = ConstructorNumberOfRetries[scav] + 1 + local x,y,z = Spring.GetUnitPosition(scav) + local posx = math_random(x-(50*ConstructorNumberOfRetries[scav]),x+(50*ConstructorNumberOfRetries[scav])) + local posz = math_random(z-(50*ConstructorNumberOfRetries[scav]),z+(50*ConstructorNumberOfRetries[scav])) + local posy = Spring.GetGroundHeight(posx, posz) + local spawnTier = math_random(1,100) + local unitCount = Spring.GetTeamUnitCount(GaiaTeamID) + if unitCount + 200 < scavMaxUnits then + if posy > 0 then + if spawnTier <= TierSpawnChances.T0 then + blueprint = ScavengerConstructorBlueprintsT0[math_random(1,#ScavengerConstructorBlueprintsT0)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + blueprint = ScavengerConstructorBlueprintsT1[math_random(1,#ScavengerConstructorBlueprintsT1)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + blueprint = ScavengerConstructorBlueprintsT2[math_random(1,#ScavengerConstructorBlueprintsT2)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + blueprint = ScavengerConstructorBlueprintsT3[math_random(1,#ScavengerConstructorBlueprintsT3)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + blueprint = ScavengerConstructorBlueprintsT3[math_random(1,#ScavengerConstructorBlueprintsT3)] + else + blueprint = ScavengerConstructorBlueprintsT0[math_random(1,#ScavengerConstructorBlueprintsT0)] + end + elseif posy <= 0 then + if spawnTier <= TierSpawnChances.T0 then + blueprint = ScavengerConstructorBlueprintsT0Sea[math_random(1,#ScavengerConstructorBlueprintsT0Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + blueprint = ScavengerConstructorBlueprintsT1Sea[math_random(1,#ScavengerConstructorBlueprintsT1Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + blueprint = ScavengerConstructorBlueprintsT2Sea[math_random(1,#ScavengerConstructorBlueprintsT2Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + blueprint = ScavengerConstructorBlueprintsT3Sea[math_random(1,#ScavengerConstructorBlueprintsT3Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + blueprint = ScavengerConstructorBlueprintsT3Sea[math_random(1,#ScavengerConstructorBlueprintsT3Sea)] + else + blueprint = ScavengerConstructorBlueprintsT0Sea[math_random(1,#ScavengerConstructorBlueprintsT0Sea)] + end + end + else + local mapcenterX = mapsizeX/2 + local mapcenterZ = mapsizeZ/2 + local mapcenterY = Spring.GetGroundHeight(mapcenterX, mapcenterZ) + local mapdiagonal = math.ceil(math.sqrt((mapsizeX*mapsizeX)+(mapsizeZ*mapsizeZ))) + Spring.GiveOrderToUnit(scav, CMD.RECLAIM,{mapcenterX+math_random(-100,100),mapcenterY,mapcenterZ+math_random(-100,100),mapdiagonal}, 0) + Spring.GiveOrderToUnit(scav, CMD.RECLAIM,{mapcenterX+math_random(-100,100),mapcenterY,mapcenterZ+math_random(-100,100),mapdiagonal}, {"shift"}) + end + + posradius = blueprint(scav, posx, posy, posz, GaiaTeamID, true) + canConstructHere = posOccupied(posx, posy, posz, posradius) + if canConstructHere then + canConstructHere = posCheck(posx, posy, posz, posradius) + end + if canConstructHere then + canConstructHere = posStartboxCheck(posx, posy, posz, posradius) + end + if canConstructHere then + canConstructHere = posMapsizeCheck(posx, posy, posz, posradius) + end + + if canConstructHere then + -- let's do this shit + Spring.GiveOrderToUnit(scav, CMD.MOVE,{posx+math.random(-posradius,posradius),posy+500,posz+math.random(-posradius,posradius)}, {"shift"}) + blueprint(scav, posx, posy, posz, GaiaTeamID, false) + ConstructorNumberOfRetries[scav] = 0 + else + return + end + -- if canConstructHere then + -- -- let's do this shit + -- blueprint(scav, posx, posy, posz, GaiaTeamID, false) + -- local x = math_random(x-1000,x+1000) + -- local z = math_random(z-1000,z+1000) + -- local y = Spring.GetGroundHeight(x,z) + -- Spring.GiveOrderToUnit(scav, CMD.MOVE,{x,y,z}, {"shift"}) + -- local x = math_random(x-100,x+100) + -- local z = math_random(z-100,z+100) + -- local y = Spring.GetGroundHeight(x,z) + -- Spring.GiveOrderToUnit(scav, CMD.MOVE,{x,y,z}, {"shift"}) + -- else + -- local x,y,z = Spring.GetUnitPosition(scav) + -- local x = math_random(x-500,x+500) + -- local z = math_random(z-500,z+500) + -- local y = Spring.GetGroundHeight(x,z) + -- Spring.GiveOrderToUnit(scav, CMD.MOVE,{x,y,z}, {"shift"}) + -- local x,y,z = Spring.GetUnitPosition(scav) + -- local x = math_random(x-100,x+100) + -- local z = math_random(z-100,z+100) + -- local y = Spring.GetGroundHeight(x,z) + -- Spring.GiveOrderToUnit(scav, CMD.MOVE,{x,y,z}, {"shift"}) + -- end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/scavengers/Modules/factory_controller.lua b/LuaRules/Gadgets/scavengers/Modules/factory_controller.lua new file mode 100644 index 000000000..cee9a6888 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/factory_controller.lua @@ -0,0 +1,21 @@ +VFS.Include("luarules/gadgets/scavengers/Configs/"..GameShortName.."/UnitLists/factories.lua") + +function FactoryProduction(n, scav, scavDef) + local buildOptions = UnitDefs[scavDef].buildOptions + local buildUnit = buildOptions[math_random(1,#buildOptions)] + local buildName = UnitDefs[buildUnit].name + isExcluded = {} + for i = 1,#FactoriesExcludedUnits do + if string.find(buildName..scavconfig.unitnamesuffix, FactoriesExcludedUnits[i]) then + isExcluded[scavDef] = true + end + end + if not isExcluded[scavDef] then + local x,y,z = Spring.GetUnitPosition(scav) + local a = math_random(3,10) + for a = 1,a do + Spring.GiveOrderToUnit(scav, -buildUnit, {x, y, z, 0}, 0) + end + end + isExcluded[scavDef] = nil +end diff --git a/LuaRules/Gadgets/scavengers/Modules/messenger.lua b/LuaRules/Gadgets/scavengers/Modules/messenger.lua new file mode 100644 index 000000000..c6fbf93d6 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/messenger.lua @@ -0,0 +1,140 @@ + +--ScavSendMessage("addmessage Global score: "..globalScore) + +function pregameMessages(n) + if n == 1800 then + ScavSendMessage("WARNING") + ScavSendVoiceMessage(scavengerSoundPath.."warning.wav") + end + + if n == 1830 then + ScavSendNotification("scav_unidentifiedObjectsDetected") + end + + if n == 2100 then + ScavSendMessage("... waiting for further data ... ") + ScavSendVoiceMessage(scavengerSoundPath.."waitingForIntel.wav") + end + + if n == 3900 then + ScavSendNotification("scav_classifiedAsScavengers") + end + + if n == 6300 then + ScavSendMessage("WARNING") + ScavSendVoiceMessage(scavengerSoundPath.."warning.wav") + end + + if n == 6330 then + ScavSendMessage("Scavenger Droppods detected nearby") + ScavSendVoiceMessage(scavengerSoundPath.."droppodsDetectedNearby.wav") + end + + if n == 7200 then + ScavSendMessage("WARNING") + ScavSendVoiceMessage(scavengerSoundPath.."warning.wav") + end + + if n == 7230 then + ScavSendNotification("scav_droppodsDetectedInArea") + end + + if n == 9000 then + ScavSendMessage("WARNING") + ScavSendVoiceMessage(scavengerSoundPath.."warning.wav") + end + + if n == 9030 then + ScavSendNotification("scav_droppingUnits") + end + +end + +function BossFightMessages(BossWaveTimeLeft) + if not BossWaveFirstMessage then + ScavSendNotification("scav_scavfinalattack") + BossWaveFirstMessage = true + end + + if BossWaveTimeLeft == 750 then + ScavSendNotification("scav_scavfinal12remain") + end + + if BossWaveTimeLeft == 600 then + ScavSendNotification("scav_scavfinal10remain") + end + + if BossWaveTimeLeft == 540 then + ScavSendNotification("scav_scavfinal09remain") + end + + if BossWaveTimeLeft == 480 then + ScavSendNotification("scav_scavfinal08remain") + end + + if BossWaveTimeLeft == 420 then + ScavSendNotification("scav_scavfinal07remain") + end + + if BossWaveTimeLeft == 360 then + ScavSendNotification("scav_scavfinal06remain") + end + + if BossWaveTimeLeft == 300 then + ScavSendNotification("scav_scavfinal05remain") + end + + if BossWaveTimeLeft == 240 then + ScavSendNotification("scav_scavfinal04remain") + end + + if BossWaveTimeLeft == 180 then + ScavSendNotification("scav_scavfinal03remain") + end + + if BossWaveTimeLeft == 120 then + ScavSendNotification("scav_scavfinal02remain") + end + + if BossWaveTimeLeft == 60 then + ScavSendNotification("scav_scavfinal01remain") + end + + if BossWaveTimeLeft == 10 then + -- since ScavSendNotification would put this in a queue, we cant use that method for this message + ScavSendVoiceMessage(scavengerSoundPath.."scavfinalcountdown.wav") + ScavSendMessage("10") + end + + if BossWaveTimeLeft == 9 then + ScavSendMessage("9") + end + if BossWaveTimeLeft == 8 then + ScavSendMessage("8") + end + if BossWaveTimeLeft == 7 then + ScavSendMessage("7") + end + if BossWaveTimeLeft == 6 then + ScavSendMessage("6") + end + if BossWaveTimeLeft == 5 then + ScavSendMessage("5") + end + if BossWaveTimeLeft == 4 then + ScavSendMessage("4") + end + if BossWaveTimeLeft == 3 then + ScavSendMessage("3") + end + if BossWaveTimeLeft == 2 then + ScavSendMessage("2") + end + if BossWaveTimeLeft == 1 then + ScavSendMessage("1") + end + + if BossWaveTimeLeft == 0 then + ScavSendNotification("scav_scavfinalvictory") + end +end diff --git a/LuaRules/Gadgets/scavengers/Modules/nuke_controller.lua b/LuaRules/Gadgets/scavengers/Modules/nuke_controller.lua new file mode 100644 index 000000000..7104375be --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/nuke_controller.lua @@ -0,0 +1,24 @@ + +function SendRandomNukeOrder(n, scav) + local unitDefID = Spring.GetUnitDefID(scav) + local unitRange = Spring.GetUnitMaxRange(scav) + if unitRange and unitRange > 0 then + local posx, posy, posz = Spring.GetUnitPosition(scav) + local possibleTargets = Spring.GetUnitsInCylinder(posx, posz, unitRange) + local targetnum = #possibleTargets + if targetnum and targetnum > 1 then + local r = math_random(1,targetnum) + local targetID = possibleTargets[r] + local targetTeam = Spring.GetUnitTeam(targetID) + local targetNeutral = Spring.GetUnitNeutral(targetID) + if targetTeam ~= GaiaTeamID and targetNeutral == false then + local targetDefID = Spring.GetUnitDefID(targetID) + local targetCanFly = UnitDefs[targetDefID].canFly + if targetCanFly == false then + local tx, ty, tz = Spring.GetUnitPosition(targetID) + Spring.GiveOrderToUnit(scav, CMD.ATTACK,{tx,ty,tz}, {}) + end + end + end + end +end diff --git a/LuaRules/Gadgets/scavengers/Modules/reinforcements_module.lua b/LuaRules/Gadgets/scavengers/Modules/reinforcements_module.lua new file mode 100644 index 000000000..992c514c5 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/reinforcements_module.lua @@ -0,0 +1,366 @@ +local ReinforcementsCountPerTeam = {} +local TryingToSpawnReinforcements = {} +local ReinforcementsFaction = {} +local ReinforcementsChancePerTeam = {} +local numOfSpawnBeaconsTeamsForSpawn = {} +local CaptureProgressForBeacons = {} + +function CaptureBeacons(n) + local scavengerunits = Spring.GetTeamUnits(GaiaTeamID) + local spGetUnitTeam = Spring.GetUnitTeam + + for i = 1,#scavengerunits do + local scav = scavengerunits[i] + local scavDef = Spring.GetUnitDefID(scav) + if scavSpawnBeacon[scav] then + if not CaptureProgressForBeacons[scav] then + CaptureProgressForBeacons[scav] = 0 + Spring.SetUnitHealth(scav, {capture = CaptureProgressForBeacons[scav]}) + end + local posx,posy,posz = Spring.GetUnitPosition(scav) + --Spring.Echo("posx "..posx) + --Spring.Echo("posz "..posz) + unitsAround = Spring.GetUnitsInCylinder(posx, posz, 256) + --Spring.Echo("#unitsAround "..#unitsAround) + CapturingUnits = {} + CapturingUnitsTeam = {} + CapturingUnitsTeamTest = {} + local TeamsCapturing = 0 + CapturingUnits[scav] = 0 + + for j = 1,#unitsAround do + local unitID = unitsAround[j] + local unitTeamID = spGetUnitTeam(unitID) + local unitAllyTeam = Spring.GetUnitAllyTeam(unitID) + local LuaAI = Spring.GetTeamLuaAI(unitTeamID) + local _,_,_,isAI,_,_ = Spring.GetTeamInfo(unitTeamID) + if (not LuaAI) and unitTeamID ~= GaiaTeamID and unitTeamID ~= Spring.GetGaiaTeamID() and (not isAI) then + captureraiTeam = false + else + captureraiTeam = false -- true + end + if not CapturingUnitsTeamTest[unitAllyTeam] then + CapturingUnitsTeamTest[unitAllyTeam] = true + if unitTeamID ~= GaiaTeamID and captureraiTeam == false then + TeamsCapturing = TeamsCapturing + 1 + if TeamsCapturing > 1 then + break + end + end + end + captureraiTeam = nil + end + + for j = 1,#unitsAround do + local unitID = unitsAround[j] + local unitTeamID = spGetUnitTeam(unitID) + if not CapturingUnitsTeam[unitTeamID] then + CapturingUnitsTeam[unitTeamID] = 0 + end + local unitDefID = Spring.GetUnitDefID(unitID) + local LuaAI = Spring.GetTeamLuaAI(unitTeamID) + local _,_,_,isAI,_,_ = Spring.GetTeamInfo(unitTeamID) + + if (not LuaAI) and unitTeamID ~= GaiaTeamID and unitTeamID ~= Spring.GetGaiaTeamID() and (not isAI) then + captureraiTeam = false + else + captureraiTeam = false -- true + end + + if not CapturingUnitsTeam[unitTeamID] then + CapturingUnitsTeam[unitTeamID] = 0 + end + + for k = 1,#BeaconCaptureExcludedUnits do + if UnitDefs[unitDefID].name == BeaconCaptureExcludedUnits[k] then + IsUnitExcluded = true + break + else + IsUnitExcluded = false + end + end + + if unitDefID == scavDef then + CaptureProgressForBeacons[scav] = CaptureProgressForBeacons[scav] - 0.0005 + --Spring.Echo("uncapturing myself") + elseif unitTeamID == GaiaTeamID and (not unitDefID == scavDef) then + CaptureProgressForBeacons[scav] = CaptureProgressForBeacons[scav] - 1 + --Spring.Echo("uncapturing our beacon") + elseif captureraiTeam == false and unitTeamID ~= GaiaTeamID and unitTeamID ~= Spring.GetGaiaTeamID() and IsUnitExcluded == false and (not UnitDefs[unitDefID].canFly) then + CaptureProgressForBeacons[scav] = CaptureProgressForBeacons[scav] + 0.001 + CapturingUnitsTeam[unitTeamID] = CapturingUnitsTeam[unitTeamID] + 1 + --Spring.Echo("capturing scav beacon") + end + if CaptureProgressForBeacons[scav] < 0 then + CaptureProgressForBeacons[scav] = 0 + --Spring.Echo("capture below 0") + end + if CaptureProgressForBeacons[scav] > 1 then + CaptureProgressForBeacons[scav] = 1 + --Spring.Echo("capture above 1") + end + Spring.SetUnitHealth(scav, {capture = CaptureProgressForBeacons[scav]}) + + if TeamsCapturing < 2 and captureraiTeam == false and CaptureProgressForBeacons[scav] >= 1 then + CaptureProgressForBeacons[scav] = 0 + Spring.SetUnitHealth(scav, {capture = 0}) + Spring.TransferUnit(scav, unitTeamID, true) + captureraiTeam = nil + break + end + captureraiTeam = nil + IsUnitExcluded = nil + end + CapturingUnits = nil + CapturingUnitsTeam = nil + unitsAround = nil + end + end +end + +function SetBeaconsResourceProduction(n) + if globalScore then + local units = Spring.GetAllUnits() + local minutes = math.ceil(Spring.GetGameSeconds()/300) + local beaconmetalproduction = minutes + local beaconenergyproduction = beaconmetalproduction*20 + for i = 1,#units do + local unitID = units[i] + local unitDefID = Spring.GetUnitDefID(unitID) + local name = UnitDefs[unitDefID].name + if name == "scavengerdroppodbeacon_scav" then + --Spring.AddUnitResource(unitID, "m", beaconmetalproduction) + Spring.AddUnitResource(unitID, "e", beaconenergyproduction) + end + end + end +end + +-- function SpawnDefencesAfterCapture(unitID, teamID) + -- local spawnTier = math_random(1,100) + -- if spawnTier <= TierSpawnChances.T0 then + -- grouptier = BeaconDefenceStructuresT0 + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + -- grouptier = BeaconDefenceStructuresT1 + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + -- grouptier = BeaconDefenceStructuresT2 + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + -- grouptier = BeaconDefenceStructuresT3 + -- end + -- if spawnTier <= TierSpawnChances.T0 then + -- grouptiersea = StartboxDefenceStructuresT0Sea + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + -- grouptiersea = StartboxDefenceStructuresT1Sea + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + -- grouptiersea = StartboxDefenceStructuresT2Sea + -- elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + -- grouptiersea = StartboxDefenceStructuresT3Sea + -- end + + -- local posx,posy,posz = Spring.GetUnitPosition(unitID) + -- local posy = Spring.GetGroundHeight(posx, posz) + -- local n = Spring.GetGameFrame() + + -- local r = grouptier[math_random(1,#grouptier)] + -- local r2 = grouptiersea[math_random(1,#grouptiersea)] + -- Spring.CreateUnit("scavengerdroppodfriendly", posx-128, posy, posz-128, math_random(0,3),teamID) + -- local posy = Spring.GetGroundHeight(posx-128, posz-128) + -- if posy > 0 then + -- QueueSpawn(r..scavconfig.unitnamesuffix, posx-128, posy, posz-128, math_random(0,3),teamID, n+90) + -- else + -- QueueSpawn(r2..scavconfig.unitnamesuffix, posx-128, posy, posz-128, math_random(0,3),teamID, n+90) + -- end + + -- local r = grouptier[math_random(1,#grouptier)] + -- local r2 = grouptiersea[math_random(1,#grouptiersea)] + -- Spring.CreateUnit("scavengerdroppodfriendly", posx+128, posy, posz+128, math_random(0,3),teamID) + -- local posy = Spring.GetGroundHeight(posx+128, posz+128) + -- if posy > 0 then + -- QueueSpawn(r..scavconfig.unitnamesuffix, posx+128, posy, posz+128, math_random(0,3),teamID, n+90) + -- else + -- QueueSpawn(r2..scavconfig.unitnamesuffix, posx+128, posy, posz+128, math_random(0,3),teamID, n+90) + -- end + + -- local r = grouptier[math_random(1,#grouptier)] + -- local r2 = grouptiersea[math_random(1,#grouptiersea)] + -- Spring.CreateUnit("scavengerdroppodfriendly", posx-128, posy, posz+128, math_random(0,3),teamID) + -- local posy = Spring.GetGroundHeight(posx-128, posz+128) + -- if posy > 0 then + -- QueueSpawn(r..scavconfig.unitnamesuffix, posx-128, posy, posz+128, math_random(0,3),teamID, n+90) + -- else + -- QueueSpawn(r2..scavconfig.unitnamesuffix, posx-128, posy, posz+128, math_random(0,3),teamID, n+90) + -- end + + -- local r = grouptier[math_random(1,#grouptier)] + -- local r2 = grouptiersea[math_random(1,#grouptiersea)] + -- Spring.CreateUnit("scavengerdroppodfriendly", posx+128, posy, posz-128, math_random(0,3),teamID) + -- local posy = Spring.GetGroundHeight(posx+128, posz-128) + -- if posy > 0 then + -- QueueSpawn(r..scavconfig.unitnamesuffix, posx+128, posy, posz-128, math_random(0,3),teamID, n+90) + -- else + -- QueueSpawn(r2..scavconfig.unitnamesuffix, posx+128, posy, posz-128, math_random(0,3),teamID, n+90) + -- end + + -- grouptier = nil + -- grouptiersea = nil +-- end + +function spawnPlayerReinforcements(n) + --mapsizeX + --mapsizeZ + --ScavengerStartboxXMin + --ScavengerStartboxZMin + --ScavengerStartboxXMax + --ScavengerStartboxZMax + --GaiaTeamID + --GaiaAllyTeamID + --posCheck(posx, posy, posz, posradius) + --posOccupied(posx, posy, posz, posradius) + for _,teamID in ipairs(Spring.GetTeamList()) do + local LuaAI = Spring.GetTeamLuaAI(teamID) + local _,teamLeader,isDead,isAI,_,allyTeamID = Spring.GetTeamInfo(teamID) + + if (not LuaAI) and teamID ~= GaiaTeamID and teamID ~= Spring.GetGaiaTeamID() and (not isAI) then + local playerName = Spring.GetPlayerInfo(teamLeader) + if not numOfSpawnBeaconsTeams[teamID] then + numOfSpawnBeaconsTeams[teamID] = 0 + end + if not numOfSpawnBeaconsTeamsForSpawn[teamID] or numOfSpawnBeaconsTeamsForSpawn[teamID] == 0 then + numOfSpawnBeaconsTeamsForSpawn[teamID] = 2 + else + numOfSpawnBeaconsTeamsForSpawn[teamID] = numOfSpawnBeaconsTeams[teamID] + 2 + end + + + if not ReinforcementsCountPerTeam[teamID] then + ReinforcementsCountPerTeam[teamID] = 0 + end + if not ReinforcementsChancePerTeam[teamID] then + ReinforcementsChancePerTeam[teamID] = (((unitSpawnerModuleConfig.spawnchance)*10)/numOfSpawnBeaconsTeamsForSpawn[teamID]) + end + + if not isDead then + if TryingToSpawnReinforcements[teamID] == true then + local playerunits = Spring.GetTeamUnits(teamID) + PlayerSpawnBeacons = {} + for i = 1,#playerunits do + local playerbeacon = playerunits[i] + local playerbeaconDef = Spring.GetUnitDefID(playerbeacon) + local UnitName = UnitDefs[playerbeaconDef].name + if UnitName == "scavengerdroppodbeacon_scav" then + table.insert(PlayerSpawnBeacons,playerbeacon) + end + end + --numOfSpawnBeaconsTeams[teamID] = 10 + if numOfSpawnBeaconsTeams[teamID] == 1 then + pickedBeacon = PlayerSpawnBeacons[1] + elseif numOfSpawnBeaconsTeams[teamID] > 1 then + pickedBeacon = PlayerSpawnBeacons[math_random(1,#PlayerSpawnBeacons)] + else + pickedBeacon = nil + TryingToSpawnReinforcements[teamID] = false + ReinforcementsChancePerTeam[teamID] = (((unitSpawnerModuleConfig.spawnchance)*10)/numOfSpawnBeaconsTeamsForSpawn[teamID]) + end + PlayerSpawnBeacons = nil + if pickedBeacon then + if not globalScore then + teamsCheck() + end + local groupsize = (bestTeamScore / unitSpawnerModuleConfig.globalscoreperoneunit)*spawnmultiplier + local groupsize = math.ceil(groupsize*2) + if scorePerTeam[teamID] < bestTeamScore*2 then + groupsize = math.ceil(groupsize*2) + end + local posradius = 160 + local posx,posy,posz = Spring.GetUnitPosition(pickedBeacon) + local posy = Spring.GetGroundHeight(posx, posz) + local spawnTier = math_random(1,100) + local aircraftchance = math_random(0,unitSpawnerModuleConfig.aircraftchance) + if aircraftchance == 0 then + if spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1ReinforcementAirUnits[math_random(1,#T1ReinforcementAirUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2ReinforcementAirUnits[math_random(1,#T2ReinforcementAirUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3ReinforcementAirUnits[math_random(1,#T3ReinforcementAirUnits)] + groupsize = 5 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4ReinforcementAirUnits[math_random(1,#T4ReinforcementAirUnits)] + groupsize = 2 + end + elseif posy > -20 then + if spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1ReinforcementLandUnits[math_random(1,#T1ReinforcementLandUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2ReinforcementLandUnits[math_random(1,#T2ReinforcementLandUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3ReinforcementLandUnits[math_random(1,#T3ReinforcementLandUnits)] + groupsize = 5 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4ReinforcementLandUnits[math_random(1,#T4ReinforcementLandUnits)] + groupsize = 2 + end + elseif posy <= -20 then + if spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1ReinforcementSeaUnits[math_random(1,#T1ReinforcementSeaUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2ReinforcementSeaUnits[math_random(1,#T2ReinforcementSeaUnits)] + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3ReinforcementSeaUnits[math_random(1,#T3ReinforcementSeaUnits)] + groupsize = 5 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4ReinforcementSeaUnits[math_random(1,#T4ReinforcementSeaUnits)] + groupsize = 2 + end + ScavSendMessage(playerName .."'s reinforcements detected. Units: ".. UDN[groupunit1].humanName .. "s.") + end + for i = 1,groupsize do + local posx = posx+(math_random(-posradius,posradius)) + local posz = posz+(math_random(-posradius,posradius)) + local newposy = Spring.GetGroundHeight(posx, posz) + if posy >= -20 and newposy >= -20 then + if i then + QueueSpawn("scavengerdroppodfriendly", posx, posy, posz, math_random(0,3),GaiaTeamID, n+(i*60)) + QueueSpawn(groupunit..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90+(i*60)) + else + QueueSpawn("scavengerdroppodfriendly", posx, posy, posz, math_random(0,3),GaiaTeamID, n) + QueueSpawn(groupunit..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + elseif posy < -20 and newposy < -20 then + if i then + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n+(i*60)) + QueueSpawn(groupunit..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90+(i*60)) + else + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n) + QueueSpawn(groupunit..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + end + end + groupsize = nil + groupunit1 = nil + groupunit2 = nil + TryingToSpawnReinforcements[teamID] = false + ReinforcementsCountPerTeam[teamID] = ReinforcementsCountPerTeam[teamID] + 1 + end + else + local r = math_random(0,ReinforcementsChancePerTeam[teamID]) + if r == 0 or ReinforcementsCountPerTeam[teamID] == 0 then + TryingToSpawnReinforcements[teamID] = true + ReinforcementsChancePerTeam[teamID] = (((unitSpawnerModuleConfig.spawnchance)*10)/numOfSpawnBeaconsTeamsForSpawn[teamID]) + else + TryingToSpawnReinforcements[teamID] = false + ReinforcementsChancePerTeam[teamID] = ReinforcementsChancePerTeam[teamID] - 1 + end + end + end + end + end + pickedBeacon = nil +end + diff --git a/LuaRules/Gadgets/scavengers/Modules/spawn_beacons.lua b/LuaRules/Gadgets/scavengers/Modules/spawn_beacons.lua new file mode 100644 index 000000000..be25faa6a --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/spawn_beacons.lua @@ -0,0 +1,250 @@ +local BeaconSpawnChance = unitSpawnerModuleConfig.beaconspawnchance +local UnitLists = VFS.DirList('luarules/gadgets/scavengers/Configs/'..GameShortName..'/UnitLists/','*.lua') +for i = 1,#UnitLists do + VFS.Include(UnitLists[i]) + Spring.Echo("Scav Units Directory: " ..UnitLists[i]) +end + +function SpawnBeacon(n) + if n and n > 7200 then + if scavengersAIEnabled == true then -- Survival + local BeaconSpawnChance = math_random(0,BeaconSpawnChance) + if numOfSpawnBeacons <= unitSpawnerModuleConfig.minimumspawnbeacons then + BeaconSpawnChance = 0 + end + if BossWaveTimeLeft and BossWaveTimeLeft < 1 then + BeaconSpawnChance = 1 -- can't spawn + end + if BeaconSpawnChance == 0 or canSpawnBeaconHere == false then + local posx = math_random(80,mapsizeX-80) + local posz = math_random(80,mapsizeZ-80) + local posy = Spring.GetGroundHeight(posx, posz) + local posradius = 80 + canSpawnBeaconHere = posCheck(posx, posy, posz, posradius) + if canSpawnBeaconHere then + if globalScore then + local g = math_random(0,3) + if ScavengerStartboxExists and g ~= 0 then + if ScavengerStartboxXMin < posx and ScavengerStartboxXMax > posx and ScavengerStartboxZMin < posz and ScavengerStartboxZMax > posz then + canSpawnBeaconHere = true + else + canSpawnBeaconHere = false + end + else + -- elseif globalScore > scavconfig.timers.OnlyLos then + -- canSpawnBeaconHere = posLosCheckOnlyLOS(posx, posy, posz,posradius) + if globalScore > scavconfig.timers.NoRadar then + canSpawnBeaconHere = posLosCheckNoRadar(posx, posy, posz,posradius) + else + canSpawnBeaconHere = posLosCheck(posx, posy, posz,posradius) + end + end + end + end + if canSpawnBeaconHere then + canSpawnBeaconHere = posOccupied(posx, posy, posz, posradius) + end + + if canSpawnBeaconHere then + local spawnTier = math_random(1,100) + if spawnTier <= TierSpawnChances.T0 then + grouptier = BeaconDefenceStructuresT0 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + grouptier = BeaconDefenceStructuresT1 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + grouptier = BeaconDefenceStructuresT2 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + grouptier = BeaconDefenceStructuresT3 + else + grouptier = BeaconDefenceStructuresT0 + end + if spawnTier <= TierSpawnChances.T0 then + grouptiersea = StartboxDefenceStructuresT0Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + grouptiersea = StartboxDefenceStructuresT1Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + grouptiersea = StartboxDefenceStructuresT2Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + grouptiersea = StartboxDefenceStructuresT3Sea + else + grouptiersea = StartboxDefenceStructuresT0Sea + end + + BeaconSpawnChance = unitSpawnerModuleConfig.beaconspawnchance + Spring.CreateUnit("scavengerdroppodbeacon_scav", posx, posy, posz, math_random(0,3),GaiaTeamID) + + + Spring.CreateUnit("scavengerdroppod_scav", posx-128, posy, posz, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx-128, posz) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx-128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx-128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx+128, posy, posz, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx+128, posz) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx+128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx+128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz+128, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx, posz+128) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx, posy, posz+128, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz+128, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz-128, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx, posz-128) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx, posy, posz-128, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz-128, math_random(0,3),GaiaTeamID, n+90) + end + + grouptier = nil + grouptiersea = nil + + end + else + BeaconSpawnChance = BeaconSpawnChance - 1 + if BeaconSpawnChance < 1 then + BeaconSpawnChance = 1 + end + end + else -- PvP + local BeaconSpawnChance = math_random(0,BeaconSpawnChance) + if numOfSpawnBeacons <= unitSpawnerModuleConfig.minimumspawnbeacons then + BeaconSpawnChance = 0 + end + if BossWaveTimeLeft and BossWaveTimeLeft < 1 then + BeaconSpawnChance = 1 -- can't spawn + end + if BeaconSpawnChance == 0 or canSpawnBeaconHere == false then + if not beaconspawnretrycount then + beaconspawnretrycount = 0 + end + local posx = math_random(math.ceil((mapsizeX/2)-(((mapsizeX/2)/60)*beaconspawnretrycount)),math.floor((mapsizeX/2)+(((mapsizeX/2)/60)*beaconspawnretrycount))) + local posz = math_random(math.ceil((mapsizeZ/2)-(((mapsizeZ/2)/60)*beaconspawnretrycount)),math.floor((mapsizeZ/2)+(((mapsizeZ/2)/60)*beaconspawnretrycount))) + if posx < 256 then + posx = 256 + end + if posx > mapsizeX-256 then + posx = mapsizeX-256 + end + if posz < 256 then + posz = 256 + end + if posz > mapsizeZ-256 then + posz = mapsizeZ-256 + end + local posy = Spring.GetGroundHeight(posx, posz) + local posradius = 80 + beaconspawnretrycount = beaconspawnretrycount + 1 + canSpawnBeaconHere = posCheck(posx, posy, posz, posradius) + if canSpawnBeaconHere then + if globalScore then + -- elseif globalScore > scavconfig.timers.NoRadar then + -- canSpawnBeaconHere = posLosCheckNoRadar(posx, posy, posz,posradius) + --else + canSpawnBeaconHere = posLosCheck(posx, posy, posz,posradius) + --end + end + end + if canSpawnBeaconHere then + local posradius = 384 + canSpawnBeaconHere = posOccupied(posx, posy, posz, posradius) + end + + if canSpawnBeaconHere then + beaconspawnretrycount = 0 + local spawnTier = math_random(1,100) + if spawnTier <= TierSpawnChances.T0 then + grouptier = BeaconDefenceStructuresT0 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + grouptier = BeaconDefenceStructuresT1 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + grouptier = BeaconDefenceStructuresT2 + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + grouptier = BeaconDefenceStructuresT3 + end + if spawnTier <= TierSpawnChances.T0 then + grouptiersea = StartboxDefenceStructuresT0Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + grouptiersea = StartboxDefenceStructuresT1Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + grouptiersea = StartboxDefenceStructuresT2Sea + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + grouptiersea = StartboxDefenceStructuresT3Sea + end + + BeaconSpawnChance = unitSpawnerModuleConfig.beaconspawnchance + Spring.CreateUnit("scavengerdroppodbeacon_scav", posx, posy, posz, math_random(0,3),GaiaTeamID) + + + Spring.CreateUnit("scavengerdroppod_scav", posx-128, posy, posz, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx-128, posz) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx-128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx-128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx+128, posy, posz, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx+128, posz) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx+128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx+128, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz+128, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx, posz+128) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx, posy, posz+128, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz+128, math_random(0,3),GaiaTeamID, n+90) + end + + Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz-128, math_random(0,3),GaiaTeamID) + local posy = Spring.GetGroundHeight(posx, posz-128) + if posy > 0 then + local r = grouptier[math_random(1,#grouptier)] + QueueSpawn(r..scavconfig.unitnamesuffix, posx, posy, posz-128, math_random(0,3),GaiaTeamID, n+90) + else + local r2 = grouptiersea[math_random(1,#grouptiersea)] + QueueSpawn(r2..scavconfig.unitnamesuffix, posx, posy, posz-128, math_random(0,3),GaiaTeamID, n+90) + end + + grouptier = nil + grouptiersea = nil + end + posx = nil + posz = nil + else + BeaconSpawnChance = BeaconSpawnChance - 1 + if BeaconSpawnChance < 1 then + BeaconSpawnChance = 1 + end + end + end + end +end diff --git a/LuaRules/Gadgets/scavengers/Modules/startbox_protection.lua b/LuaRules/Gadgets/scavengers/Modules/startbox_protection.lua new file mode 100644 index 000000000..e9481fb91 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/startbox_protection.lua @@ -0,0 +1,136 @@ + +function spawnStartBoxProtection(n) + for i = 1,10 do + --mapsizeX + --mapsizeZ + --ScavengerStartboxXMin + --ScavengerStartboxZMin + --ScavengerStartboxXMax + --ScavengerStartboxZMax + --GaiaTeamID + --GaiaAllyTeamID + --posCheck(posx, posy, posz, posradius) + --posOccupied(posx, posy, posz, posradius) + local r = math_random(0,3) + local r2 = math_random(0,80) + local spread = spawnProtectionConfig.spread + local spawnPosX = math_random(ScavengerStartboxXMin,ScavengerStartboxXMax) + local spawnPosZ = math_random(ScavengerStartboxZMin,ScavengerStartboxZMax) + if r == 0 then -- south edge + spawnPosZ = ScavengerStartboxZMax + spawnDirection = 0 + elseif r == 1 then -- east edge + spawnPosX = ScavengerStartboxXMax + spawnDirection = 1 + elseif r == 2 then -- south edge + spawnPosZ = ScavengerStartboxZMin + spawnDirection = 2 + elseif r == 3 then -- west edge + spawnPosX = ScavengerStartboxXMin + spawnDirection = 3 + end + if r2 == 0 then + spawnPosX = math_random(ScavengerStartboxXMin,ScavengerStartboxXMax) + spawnPosZ = math_random(ScavengerStartboxZMin,ScavengerStartboxZMax) + end + canSpawnDefence = true + if spawnPosX > mapsizeX - 128 or spawnPosX < 128 or spawnPosZ > mapsizeZ - 128 or spawnPosZ < 128 then + canSpawnDefence = false + end + spawnPosX = spawnPosX + math_random(-spread*2,spread*2) + spawnPosZ = spawnPosZ + math_random(-spread*2,spread*2) + if spawnPosX > mapsizeX - 128 or spawnPosX < 128 or spawnPosZ > mapsizeZ - 128 or spawnPosZ < 128 then + canSpawnDefence = false + end + if canSpawnDefence then + local spawnPosY = Spring.GetGroundHeight(spawnPosX, spawnPosZ) + local spawnTier = math_random(1,100) + + if spawnPosY > 0 then + if spawnTier <= TierSpawnChances.T0 then + pickedTurret = StartboxDefenceStructuresT0[math_random(1,#StartboxDefenceStructuresT0)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + pickedTurret = StartboxDefenceStructuresT1[math_random(1,#StartboxDefenceStructuresT1)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + pickedTurret = StartboxDefenceStructuresT2[math_random(1,#StartboxDefenceStructuresT2)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + pickedTurret = StartboxDefenceStructuresT3[math_random(1,#StartboxDefenceStructuresT3)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + pickedTurret = StartboxDefenceStructuresT4[math_random(1,#StartboxDefenceStructuresT4)] + else + pickedTurret = StartboxDefenceStructuresT0[math_random(1,#StartboxDefenceStructuresT0)] + end + elseif spawnPosY <= 0 then + if spawnTier <= TierSpawnChances.T0 then + pickedTurret = StartboxDefenceStructuresT0Sea[math_random(1,#StartboxDefenceStructuresT0Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + pickedTurret = StartboxDefenceStructuresT1Sea[math_random(1,#StartboxDefenceStructuresT1Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + pickedTurret = StartboxDefenceStructuresT2Sea[math_random(1,#StartboxDefenceStructuresT2Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + pickedTurret = StartboxDefenceStructuresT3Sea[math_random(1,#StartboxDefenceStructuresT3Sea)] + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + pickedTurret = StartboxDefenceStructuresT4Sea[math_random(1,#StartboxDefenceStructuresT4Sea)] + else + pickedTurret = StartboxDefenceStructuresT0Sea[math_random(1,#StartboxDefenceStructuresT0Sea)] + end + end + + canSpawnDefence = posCheck(spawnPosX, spawnPosY, spawnPosZ, spread) + if canSpawnDefence then + canSpawnDefence = posOccupied(spawnPosX, spawnPosY, spawnPosZ, spread) + end + + if canSpawnDefence then + QueueSpawn(pickedTurret..scavconfig.unitnamesuffix, spawnPosX, spawnPosY, spawnPosZ, spawnDirection,GaiaTeamID,n+90) + Spring.CreateUnit("scavengerdroppod_scav", spawnPosX, spawnPosY, spawnPosZ, spawnDirection,GaiaTeamID) + end + end + + + spawnPosX = nil + spawnPosZ = nil + spawnDirection = nil + canSpawnDefence = nil + pickedTurret = nil + end +end + +function executeStartBoxProtection(n) + if ScavengerStartboxExists then + local list = Spring.GetUnitsInRectangle(ScavengerStartboxXMin,ScavengerStartboxZMin,ScavengerStartboxXMax,ScavengerStartboxZMax) + for i = 1,#list do + local unitID = list[i] + local unitTeam = Spring.GetUnitTeam(unitID) + if unitTeam ~= GaiaTeamID then + local currentHealth,maxHealth = Spring.GetUnitHealth(unitID) + local damage = maxHealth*0.1 + if damage < currentHealth then + Spring.SetUnitHealth(unitID,currentHealth-damage) + local posx, posy, posz = Spring.GetUnitPosition(unitID) + Spring.SpawnCEG("scavradiation-lightning",posx,posy+40,posz,0,0,0) + else + Spring.DestroyUnit(unitID, false, false) + end + end + end + end +end + +function spawnStartBoxEffect(n) + if ScavengerStartboxExists then + local x = math.random(ScavengerStartboxXMin,ScavengerStartboxXMax) + local z = math.random(ScavengerStartboxZMin,ScavengerStartboxZMax) + local y = Spring.GetGroundHeight(x,z) + Spring.SpawnCEG("scavradiation",x,y+100,z,0,0,0) + end +end + +function spawnStartBoxEffect2(n) + if ScavengerStartboxExists then + local x = math.random(ScavengerStartboxXMin,ScavengerStartboxXMax) + local z = math.random(ScavengerStartboxZMin,ScavengerStartboxZMax) + local y = Spring.GetGroundHeight(x,z) + Spring.SpawnCEG("scavradiation-lightning",x,y+100,z,0,0,0) + end +end diff --git a/LuaRules/Gadgets/scavengers/Modules/stockpiling.lua b/LuaRules/Gadgets/scavengers/Modules/stockpiling.lua new file mode 100644 index 000000000..5317dcdb9 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/stockpiling.lua @@ -0,0 +1,4 @@ + +function ScavStockpile(n, scav) + Spring.GiveOrderToUnit(scav, CMD.STOCKPILE, {}, {}) +end diff --git a/LuaRules/Gadgets/scavengers/Modules/unit_controller.lua b/LuaRules/Gadgets/scavengers/Modules/unit_controller.lua new file mode 100644 index 000000000..fea241dfd --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/unit_controller.lua @@ -0,0 +1,102 @@ +Spring.Echo("[Scavengers] Unit Controller initialized") + +VFS.Include("luarules/gadgets/scavengers/Configs/"..GameShortName.."/UnitLists/staticunits.lua") + +function SelfDestructionControls(n, scav, scavDef) + UnitRange = {} + Constructing = {} + --Constructing[scav] = false + local _,_,_,_,buildProgress = Spring.GetUnitHealth(scav) + if buildProgress == 1 then + if selfdx[scav] then + oldselfdx[scav] = selfdx[scav] + end + if selfdy[scav] then + oldselfdy[scav] = selfdy[scav] + end + if selfdz[scav] then + oldselfdz[scav] = selfdz[scav] + end + selfdx[scav],selfdy[scav],selfdz[scav] = Spring.GetUnitPosition(scav) + if UnitDefs[scavDef].maxWeaponRange < 800 then + UnitRange[scav] = 800 + else + UnitRange[scav] = UnitDefs[scavDef].maxWeaponRange + end + if scavConstructor[scav] then + local metalMake, metalUse = Spring.GetUnitResources(scav) + if metalUse > 0 then + Constructing[scav] = true + else + Constructing[scav] = false + end + end + if (oldselfdx[scav] and oldselfdy[scav] and oldselfdz[scav]) and (oldselfdx[scav] > selfdx[scav]-10 and oldselfdx[scav] < selfdx[scav]+10) and (oldselfdy[scav] > selfdy[scav]-10 and oldselfdy[scav] < selfdy[scav]+10) and (oldselfdz[scav] > selfdz[scav]-10 and oldselfdz[scav] < selfdz[scav]+10) then + if selfdx[scav] < mapsizeX and selfdx[scav] > 0 and selfdz[scav] < mapsizeZ and selfdz[scav] > 0 then + if not scavConstructor[scav] or Constructing[scav] == false then + for q = 1,5 do + local posx = math.random(selfdx[scav] - 400, selfdx[scav] + 400) + local posz = math.random(selfdz[scav] - 400, selfdz[scav] + 400) + local telstartposy = Spring.GetGroundHeight(selfdx[scav], selfdz[scav]) + local telendposy = Spring.GetGroundHeight(posx, posz) + if (UnitDefs[scavDef].minWaterDepth and -(UnitDefs[scavDef].minWaterDepth) > telendposy) or (UnitDefs[scavDef].maxWaterDepth and -(UnitDefs[scavDef].maxWaterDepth) < telendposy) then + Spring.SpawnCEG("scav-prettypop",selfdx[scav],telstartposy,selfdz[scav],0,0,0) + Spring.SpawnCEG("scav-prettypop",posx,telendposy,posz,0,0,0) + Spring.SetUnitPosition(scav, posx, posz) + Spring.GiveOrderToUnit(scav, CMD.STOP, 0, 0) + break + end + end + end + end + --Spring.DestroyUnit(scav, false, true) + end + end + UnitRange[scav] = nil + Constructing[scav] = nil +end + +function ArmyMoveOrders(n, scav, scavDef) + UnitRange = {} + if UnitDefs[scavDef].maxWeaponRange and UnitDefs[scavDef].maxWeaponRange > 10 then + UnitRange[scav] = UnitDefs[scavDef].maxWeaponRange + else + UnitRange[scav] = 10 + end + if not BossWaveStarted or BossWaveStarted == false then + attackTarget = Spring.GetUnitNearestEnemy(scav, 200000, false) + else + if AliveEnemyCommanders and AliveEnemyCommandersCount > 0 then + if AliveEnemyCommandersCount > 1 then + for i = 1,AliveEnemyCommandersCount do + -- let's get nearest commander + local separation = Spring.GetUnitSeparation(scav,AliveEnemyCommanders[i]) + if not lowestSeparation then + lowestSeparation = separation + attackTarget = AliveEnemyCommanders[i] + end + if separation < lowestSeparation then + lowestSeparation = separation + attackTarget = AliveEnemyCommanders[i] + end + end + lowestSeparation = nil + elseif AliveEnemyCommandersCount == 1 then + attackTarget = AliveEnemyCommanders[1] + end + end + end + if attackTarget == nil then + attackTarget = Spring.GetUnitNearestEnemy(scav, 200000, false) + end + local x,y,z = Spring.GetUnitPosition(attackTarget) + local range = UnitRange[scav] + local x = x + math_random(-range*3,range*3) + local z = z + math_random(-range*3,range*3) + if (not BossWaveStarted) and (UnitDefs[scavDef].canFly or (UnitRange[scav] > unitControllerModuleConfig.minimumrangeforfight)) then + Spring.GiveOrderToUnit(scav, CMD.FIGHT,{x,y,z}, {"shift", "alt", "ctrl"}) + else + Spring.GiveOrderToUnit(scav, CMD.MOVE,{x,y,z}, {"shift", "alt", "ctrl"}) + end + attackTarget = nil +end diff --git a/LuaRules/Gadgets/scavengers/Modules/unit_spawner.lua b/LuaRules/Gadgets/scavengers/Modules/unit_spawner.lua new file mode 100644 index 000000000..ddedf4fdb --- /dev/null +++ b/LuaRules/Gadgets/scavengers/Modules/unit_spawner.lua @@ -0,0 +1,365 @@ +Spring.Echo("[Scavengers] Unit Spawner initialized") + +local UnitSpawnChance = unitSpawnerModuleConfig.spawnchance + +function BossWaveTimer(n) + if not BossWaveTimeLeft then + BossWaveTimeLeft = unitSpawnerModuleConfig.BossWaveTimeLeft + end + if not FinalSelfDChance then + FinalSelfDChance = 60 + end + if BossWaveTimeLeft > 0 then + BossWaveTimeLeft = BossWaveTimeLeft - 1 + BossFightMessages(BossWaveTimeLeft) + elseif BossWaveTimeLeft <= 0 then + if not FinalBossUnitSpawned and unitSpawnerModuleConfig.FinalBossUnit == true then + + local bossunit = BossUnits[math_random(1,#BossUnits)] + + local scavengerunits = Spring.GetTeamUnits(GaiaTeamID) + SpawnBeacons = {} + for i = 1,#scavengerunits do + local scav = scavengerunits[i] + local scavDef = Spring.GetUnitDefID(scav) + if scavSpawnBeacon[scav] then + table.insert(SpawnBeacons,scav) + end + end + + if #SpawnBeacons > 1 then + for b = 1,1000 do + local pickedBeaconTest = SpawnBeacons[math_random(1,#SpawnBeacons)] + local _,_,_,pickedBeaconCaptureProgress = Spring.GetUnitHealth(pickedBeaconTest) + if pickedBeaconCaptureProgress == 0 then + pickedBeacon = pickedBeaconTest + break + else + pickedBeacon = 1234567890 + end + end + elseif #SpawnBeacons == 1 then + pickedBeacon = SpawnBeacons[1] + end + SpawnBeacons = nil + + if pickedBeacon == 1234567890 then + return + else + if pickedBeacon then + local posx,posy,posz = Spring.GetUnitPosition(pickedBeacon) + local posy = Spring.GetGroundHeight(posx, posz) + Spring.CreateUnit(bossunit, posx, posy, posz, math_random(0,3),GaiaTeamID) + FinalBossUnitSpawned = true + Spring.Echo("BOSS COMMANDER SPAWNED") + elseif ScavengerStartboxExists == true then + local posx = math.floor((ScavengerStartboxXMin + ScavengerStartboxXMax)/2) + local posz = math.floor((ScavengerStartboxZMin + ScavengerStartboxZMax)/2) + local posy = Spring.GetGroundHeight(posx, posz) + Spring.CreateUnit(bossunit, posx, posy, posz, math_random(0,3),GaiaTeamID) + FinalBossUnitSpawned = true + Spring.Echo("BOSS COMMANDER SPAWNED") + else + local posx = math.floor(mapsizeX/2) + local posz = math.floor(mapsizeZ/2) + local posy = Spring.GetGroundHeight(posx, posz) + Spring.CreateUnit(bossunit, posx, posy, posz, math_random(0,3),GaiaTeamID) + FinalBossUnitSpawned = true + Spring.Echo("BOSS COMMANDER SPAWNED") + end + end + pickedBeacon = nil + + elseif (not unitSpawnerModuleConfig.FinalBossUnit) or FinalBossKilled == true then + local units = Spring.GetTeamUnits(GaiaTeamID) + FinalSelfDChance = FinalSelfDChance - 1 + if FinalSelfDChance < 2 then + FinalSelfDChance = 2 + end + for i = 1,#units do + local r = math_random(1,FinalSelfDChance) + if r == 1 then + Spring.DestroyUnit(units[i],false,false) + end + end + end + end +end + +function BossMinionsSpawn(n) + local x,y,z = Spring.GetUnitPosition(FinalBossUnitID) + local posx = x + math_random(-500,500) + local posz = z + math_random(-500,500) + local posy = Spring.GetGroundHeight(posx, posz) + local r = math_random(0,100) + local rair = math_random(0, unitSpawnerModuleConfig.aircraftchance) + + if rair == 0 then + if r <= 20 then + minionUnit = T1AirUnits[math_random(1,#T1AirUnits)]..scavconfig.unitnamesuffix + elseif r <= 70 then + minionUnit = T2AirUnits[math_random(1,#T2AirUnits)]..scavconfig.unitnamesuffix + elseif r <= 95 then + minionUnit = T3AirUnits[math_random(1,#T3AirUnits)]..scavconfig.unitnamesuffix + elseif r <= 100 then + minionUnit = T4AirUnits[math_random(1,#T4AirUnits)]..scavconfig.unitnamesuffix + else + minionUnit = T0AirUnits[math_random(1,#T0AirUnits)]..scavconfig.unitnamesuffix + end + elseif posy > -20 then + if r <= 20 then + minionUnit = T1LandUnits[math_random(1,#T1LandUnits)]..scavconfig.unitnamesuffix + elseif r <= 70 then + minionUnit = T2LandUnits[math_random(1,#T2LandUnits)]..scavconfig.unitnamesuffix + elseif r <= 95 then + minionUnit = T3LandUnits[math_random(1,#T3LandUnits)]..scavconfig.unitnamesuffix + elseif r <= 100 then + minionUnit = T4LandUnits[math_random(1,#T4LandUnits)]..scavconfig.unitnamesuffix + else + minionUnit = T0LandUnits[math_random(1,#T0LandUnits)]..scavconfig.unitnamesuffix + end + elseif posy <= -20 then + if r <= 20 then + minionUnit = T1SeaUnits[math_random(1,#T1SeaUnits)]..scavconfig.unitnamesuffix + elseif r <= 70 then + minionUnit = T2SeaUnits[math_random(1,#T2SeaUnits)]..scavconfig.unitnamesuffix + elseif r <= 95 then + minionUnit = T3SeaUnits[math_random(1,#T3SeaUnits)]..scavconfig.unitnamesuffix + elseif r <= 100 then + minionUnit = T4SeaUnits[math_random(1,#T4SeaUnits)]..scavconfig.unitnamesuffix + else + minionUnit = T0SeaUnits[math_random(1,#T0SeaUnits)]..scavconfig.unitnamesuffix + end + end + Spring.CreateUnit(minionUnit, posx, posy, posz, math_random(0,3),GaiaTeamID) + Spring.SpawnCEG("scav-prettypop",posx,posy,posz,0,0,0) +end + + +function UnitGroupSpawn(n) + if n > 9000 then + local gaiaUnitCount = Spring.GetTeamUnitCount(GaiaTeamID) + if BossWaveTimeLeft then + if numOfSpawnBeacons or numOfSpawnBeacons == 0 then + ActualUnitSpawnChance = math_random(0,math.ceil(UnitSpawnChance)*3) + else + ActualUnitSpawnChance = math_random(0,(UnitSpawnChance/(numOfSpawnBeacons/5))*3) + end + else + if numOfSpawnBeacons or numOfSpawnBeacons == 0 then + ActualUnitSpawnChance = math_random(0,math.ceil(UnitSpawnChance)) + else + ActualUnitSpawnChance = math_random(0,(UnitSpawnChance/(numOfSpawnBeacons/5))) + end + end + if (ActualUnitSpawnChance == 0 or canSpawnHere == false) and numOfSpawnBeacons > 0 then + -- check positions + local scavengerunits = Spring.GetTeamUnits(GaiaTeamID) + SpawnBeacons = {} + for i = 1,#scavengerunits do + local scav = scavengerunits[i] + local scavDef = Spring.GetUnitDefID(scav) + if scavSpawnBeacon[scav] then + table.insert(SpawnBeacons,scav) + end + end + + for b = 1,10 do + local pickedBeaconTest = SpawnBeacons[math_random(1,#SpawnBeacons)] + local _,_,_,pickedBeaconCaptureProgress = Spring.GetUnitHealth(pickedBeaconTest) + if pickedBeaconCaptureProgress == 0 then + pickedBeacon = pickedBeaconTest + break + else + pickedBeacon = 1234567890 + end + end + if pickedBeacon == 1234567890 then + return + end + + local posx,posy,posz = Spring.GetUnitPosition(pickedBeacon) + local posy = Spring.GetGroundHeight(posx, posz) + local posradius = 256 + local nearestEnemy = Spring.GetUnitNearestEnemy(pickedBeacon, 99999, false) + local nearestEnemyTeam = Spring.GetUnitTeam(nearestEnemy) + if nearestEnemyTeam == bestTeam then + bestTeamGroupMultiplier = 1.25 + else + bestTeamGroupMultiplier = 0.75 + end + canSpawnHere = true + --Spring.DestroyUnit(pickedBeacon,false,false) + SpawnBeacon(n) + pickedBeacon = nil + + if canSpawnHere then + + if BossWaveTimeLeft then + UnitSpawnChance = math.ceil(unitSpawnerModuleConfig.spawnchance / (teamcount/2)) + else + UnitSpawnChance = unitSpawnerModuleConfig.spawnchance + end + if not globalScore then + teamsCheck() + end + if (globalScore/unitSpawnerModuleConfig.globalscoreperoneunit)*spawnmultiplier < #scavengerunits then + UnitSpawnChance = math.ceil(UnitSpawnChance/2) + end + local groupsize = (globalScore / unitSpawnerModuleConfig.globalscoreperoneunit)*spawnmultiplier + local aircraftchance = math_random(0,unitSpawnerModuleConfig.aircraftchance) + local aircraftchanceonsea = math_random(0,unitSpawnerModuleConfig.chanceforaircraftonsea) + local bossaircraftchance = math_random(0,unitSpawnerModuleConfig.aircraftchance*5) + local spawnTier = math_random(1,100) + + if (posy <= -20 and aircraftchanceonsea == 0) or (aircraftchance == 0 and (not BossWaveTimeLeft)) or (bossaircraftchance == 0 and BossWaveTimeLeft and BossWaveTimeLeft > 0) then + if unitSpawnerModuleConfig.bossFightEnabled and BossWaveTimeLeft then + if spawnTier < 50 then + groupunit = T4AirUnits + else + groupunit = T3AirUnits + end + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t4multiplier + elseif spawnTier <= TierSpawnChances.T0 then + groupunit = T0AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t0multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t3multiplier + -- ScavSendMessage("Warning! Scavengers dropped group of ".. UDN[groupunit].humanName .."s") + -- if math_random(0,2) == 0 then + -- ScavSendNotification("scav_scavheavyairdetected") + -- end + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t4multiplier + -- ScavSendNotification("scav_scavbossdetected") + else + groupunit = T0AirUnits + groupsize = groupsize*unitSpawnerModuleConfig.airmultiplier*unitSpawnerModuleConfig.t0multiplier + end + elseif posy > -20 then + if unitSpawnerModuleConfig.bossFightEnabled and BossWaveTimeLeft then + if spawnTier < 50 then + groupunit = T4LandUnits + else + groupunit = T3LandUnits + end + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t4multiplier + elseif spawnTier <= TierSpawnChances.T0 then + groupunit = T0LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t0multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t3multiplier + -- local c = math_random(0,2) + -- if c == 0 then + -- ScavSendMessage("Warning! Scavengers dropped group of ".. UDN[groupunit].humanName .."s") + -- local s = math_random(0,4) + -- if s == 0 then + -- ScavSendNotification("scav_scavtech3") + -- elseif s == 1 then + -- ScavSendNotification("scav_scavtech3b") + -- elseif s == 2 then + -- ScavSendNotification("scav_scavtech3c") + -- elseif s == 3 then + -- ScavSendNotification("scav_scavtech3d") + -- else + -- ScavSendNotification("scav_scavtech3e") + -- end + -- else + -- ScavSendMessage("Warning! Scavengers dropped group of ".. UDN[groupunit].humanName .."s") + -- end + + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t4multiplier + -- ScavSendNotification("scav_scavbossdetected") + else + groupunit = T0LandUnits + groupsize = groupsize*unitSpawnerModuleConfig.landmultiplier*unitSpawnerModuleConfig.t0multiplier + end + elseif posy <= -20 then + if unitSpawnerModuleConfig.bossFightEnabled and BossWaveTimeLeft then + if spawnTier < 50 then + groupunit = T4SeaUnits + else + groupunit = T3SeaUnits + end + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t4multiplier + elseif spawnTier <= TierSpawnChances.T0 then + groupunit = T0SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t0multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 then + groupunit = T1SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t1multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 then + groupunit = T2SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t2multiplier + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 then + groupunit = T3SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t3multiplier + -- ScavSendMessage("Warning! Scavengers dropped group of ".. UDN[groupunit].humanName .."s") + -- if math_random(0,2) == 0 then + -- ScavSendNotification("scav_scavheavyshipsdetected") + -- end + elseif spawnTier <= TierSpawnChances.T0 + TierSpawnChances.T1 + TierSpawnChances.T2 + TierSpawnChances.T3 + TierSpawnChances.T4 then + groupunit = T4SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t4multiplier + -- ScavSendNotification("scav_scavbossdetected") + else + groupunit = T0SeaUnits + groupsize = groupsize*unitSpawnerModuleConfig.seamultiplier*unitSpawnerModuleConfig.t0multiplier + end + end + + local groupsize = math.ceil(groupsize*bestTeamGroupMultiplier*(teamcount/2)) + for i=1, groupsize do + local posx = posx+math_random(-160,160) + local posz = posz+math_random(-160,160) + local newposy = Spring.GetGroundHeight(posx, posz) + if posy >= -20 and newposy >= -20 then + if i then + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n+(i*15)) + QueueSpawn(groupunit[math_random(1,#groupunit)]..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90+(i*15)) + else + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n) + QueueSpawn(groupunit[math_random(1,#groupunit)]..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + elseif posy < -20 and newposy < -20 then + if i then + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n+(i*15)) + QueueSpawn(groupunit[math_random(1,#groupunit)]..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90+(i*15)) + else + QueueSpawn("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID, n) + QueueSpawn(groupunit[math_random(1,#groupunit)]..scavconfig.unitnamesuffix, posx, posy, posz, math_random(0,3),GaiaTeamID, n+90) + end + end + --Spring.CreateUnit("scavengerdroppod_scav", posx, posy, posz, math_random(0,3),GaiaTeamID) + end + posx = nil + posy = nil + posz = nil + SpawnBeacons = nil + end + else + UnitSpawnChance = UnitSpawnChance - 1 + if UnitSpawnChance < 1 then + UnitSpawnChance = 1 + end + end + end +end + diff --git a/LuaRules/Gadgets/scavengers/boot.lua b/LuaRules/Gadgets/scavengers/boot.lua new file mode 100644 index 000000000..4dea445a1 --- /dev/null +++ b/LuaRules/Gadgets/scavengers/boot.lua @@ -0,0 +1,715 @@ +if (not gadgetHandler:IsSyncedCode()) then + return false +end + +GameShortName = Game.gameShortName +VFS.Include("luarules/gadgets/scavengers/Configs/"..GameShortName.."/config.lua") +--for i = 1,#scavconfig do +--Spring.Echo("scavconfig value "..i.." = "..scavconfig[i]) +--end + +function ScavSendMessage(message) + if scavconfig.messenger then + SendToUnsynced("SendMessage", message) + end +end + +function ScavSendNotification(name) + if scavconfig.messenger then + SendToUnsynced("SendNotification", name) + end +end + +function ScavSendVoiceMessage(filedirectory) + if scavconfig.messenger then + Spring.SendCommands("scavplaysoundfile "..filedirectory) + end +end + +VFS.Include("luarules/gadgets/scavengers/API/api.lua") +VFS.Include("luarules/gadgets/scavengers/Modules/unit_controller.lua") + +local UnitLists = VFS.DirList('luarules/gadgets/scavengers/Configs/'..GameShortName..'/UnitLists/','*.lua') +for i = 1,#UnitLists do + VFS.Include(UnitLists[i]) + Spring.Echo("Scav Units Directory: " ..UnitLists[i]) +end + +if scavconfig.modules.buildingSpawnerModule then + ScavengerBlueprintsT0 = {} + ScavengerBlueprintsT1 = {} + ScavengerBlueprintsT2 = {} + ScavengerBlueprintsT3 = {} + ScavengerBlueprintsT4 = {} + ScavengerBlueprintsT0Sea = {} + ScavengerBlueprintsT1Sea = {} + ScavengerBlueprintsT2Sea = {} + ScavengerBlueprintsT3Sea = {} + ScavengerBlueprintsT4Sea = {} + VFS.Include("luarules/gadgets/scavengers/Modules/building_spawner.lua") +end + +if scavconfig.modules.constructorControllerModule then + ScavengerConstructorBlueprintsT0 = {} + ScavengerConstructorBlueprintsT1 = {} + ScavengerConstructorBlueprintsT2 = {} + ScavengerConstructorBlueprintsT3 = {} + ScavengerConstructorBlueprintsT4 = {} + ScavengerConstructorBlueprintsT0Sea = {} + ScavengerConstructorBlueprintsT1Sea = {} + ScavengerConstructorBlueprintsT2Sea = {} + ScavengerConstructorBlueprintsT3Sea = {} + ScavengerConstructorBlueprintsT4Sea = {} + VFS.Include("luarules/gadgets/scavengers/Modules/constructor_controller.lua") +end + +if scavconfig.modules.factoryControllerModule then + VFS.Include("luarules/gadgets/scavengers/Modules/factory_controller.lua") +end + +if scavconfig.modules.unitSpawnerModule then + VFS.Include("luarules/gadgets/scavengers/Modules/unit_spawner.lua") +end + +if scavconfig.modules.startBoxProtection then + VFS.Include("luarules/gadgets/scavengers/Modules/startbox_protection.lua") +end + +if scavconfig.modules.reinforcementsModule then + VFS.Include("luarules/gadgets/scavengers/Modules/reinforcements_module.lua") +end + +if scavconfig.modules.stockpilers == true then + VFS.Include("luarules/gadgets/scavengers/Modules/stockpiling.lua") +end + +if scavconfig.modules.nukes == true then + VFS.Include("luarules/gadgets/scavengers/Modules/nuke_controller.lua") +end + +VFS.Include("luarules/gadgets/scavengers/Modules/spawn_beacons.lua") +VFS.Include("luarules/gadgets/scavengers/Modules/messenger.lua") + + +local function DisableUnit(unitID) + Spring.MoveCtrl.Enable(unitID) + Spring.MoveCtrl.SetNoBlocking(unitID, true) + Spring.MoveCtrl.SetPosition(unitID, Game.mapSizeX+1000, 2000, Game.mapSizeZ+1000) --don't move too far out or prevent_aicraft_hax will explode it! + Spring.SetUnitCloak(unitID, true) + --Spring.SetUnitHealth(unitID, {paralyze=99999999}) + Spring.SetUnitNoDraw(unitID, true) + Spring.SetUnitStealth(unitID, true) + Spring.SetUnitNoSelect(unitID, true) + Spring.SetUnitNoMinimap(unitID, true) + Spring.GiveOrderToUnit(unitID, CMD.MOVE_STATE, { 0 }, 0) + Spring.GiveOrderToUnit(unitID, CMD.FIRE_STATE, { 0 }, 0) +end + +local function DisableCommander() + local teamUnits = Spring.GetTeamUnits(scavengerAITeamID) + for _, unitID in ipairs(teamUnits) do + HiddenCommander = unitID + DisableUnit(unitID) + end +end + +function QueueSpawn(unitName, posx, posy, posz, facing, team, frame) + local QueueSpawnCommand = {unitName, posx, posy, posz, facing, team} + local QueueFrame = frame + if #QueuedSpawnsFrames > 0 then + for i = 1, #QueuedSpawnsFrames do + local CurrentQueueFrame = QueuedSpawnsFrames[i] + if (not(CurrentQueueFrame < QueueFrame)) or i == #QueuedSpawnsFrames then + table.insert(QueuedSpawns, i, QueueSpawnCommand) + table.insert(QueuedSpawnsFrames, i, QueueFrame) + break + end + end + else + table.insert(QueuedSpawns, QueueSpawnCommand) + table.insert(QueuedSpawnsFrames, QueueFrame) + end +end + +function SpawnFromQueue(n) + local QueuedSpawnsForNow = #QueuedSpawns + if QueuedSpawnsForNow > 0 then + for i = 1,QueuedSpawnsForNow do + if n == QueuedSpawnsFrames[1] then + local createSpawnCommand = QueuedSpawns[1] + Spring.CreateUnit(QueuedSpawns[1][1],QueuedSpawns[1][2],QueuedSpawns[1][3],QueuedSpawns[1][4],QueuedSpawns[1][5],QueuedSpawns[1][6]) + table.remove(QueuedSpawns, 1) + table.remove(QueuedSpawnsFrames, 1) + --else + --break + end + end + end +end + +-- function PutSpectatorsInScavTeam(n) + -- local players = Spring.GetPlayerList() + -- for i = 1,#players do + -- local player = players[i] + -- local name, active, spectator = Spring.GetPlayerInfo(player) + -- if spectator == true then + -- Spring.AssignPlayerToTeam(player, GaiaTeamID) + -- end + -- end +-- end + + + +local minionFramerate = math.ceil(unitSpawnerModuleConfig.FinalBossMinionsPassive/(teamcount*spawnmultiplier)) +function gadget:GameFrame(n) + + + -- if n%30 == 0 then + -- PutSpectatorsInScavTeam(n) + -- end + + if n > 1 then + SpawnFromQueue(n) + end + + if n == 300 then + --Spring.Echo("New Scavenger Spawner initialized") + Spring.SetTeamColor(GaiaTeamID, 0.38, 0.14, 0.38) + end + + if n%30 == 0 and scavconfig.messenger == true then + pregameMessages(n) + end + + if n%150 == 85 and FinalBossUnitSpawned and FinalBossKilled == false then + local bosshealth = Spring.GetUnitHealth(FinalBossUnitID) + ScavSendMessage("Boss Health: "..math.ceil(bosshealth)) + end + + if n%minionFramerate == 0 and FinalBossUnitSpawned and FinalBossKilled == false then + BossMinionsSpawn(n) + end + + + if scavconfig.modules.startBoxProtection == true and ScavengerStartboxExists == true and FinalBossKilled == false then + if n%30 == 0 then + spawnStartBoxProtection(n) + executeStartBoxProtection(n) + spawnStartBoxEffect2(n) + end + if n%3 == 0 then + spawnStartBoxEffect(n) + end + end + + if n%30 == 0 and scavconfig.modules.reinforcementsModule then + spawnPlayerReinforcements(n) + CaptureBeacons(n) + SetBeaconsResourceProduction(n) + end + + if n%30 == 0 and GaiaTeamID ~= Spring.GetGaiaTeamID() then + if not disabledCommander then + DisableCommander() + disabledCommander = true + end + Spring.SetUnitHealth(HiddenCommander, 9999999) + end + + if n == 100 and globalScore then + Spring.SetTeamResource(GaiaTeamID, "ms", 1000000) + Spring.SetTeamResource(GaiaTeamID, "es", 1000000) + Spring.SetGlobalLos(GaiaAllyTeamID, false) + end + if n%30 == 0 and globalScore then + Spring.SetTeamResource(GaiaTeamID, "ms", 1000000) + Spring.SetTeamResource(GaiaTeamID, "es", 1000000) + Spring.SetTeamResource(GaiaTeamID, "m", 1000000) + Spring.SetTeamResource(GaiaTeamID, "e", 1000000) + if BossWaveStarted == true then + BossWaveTimer(n) + end + end + if n%1800 == 0 and n > 100 then + teamsCheck() + UpdateTierChances(n) + if (BossWaveStarted == false) and globalScore > scavconfig.timers.BossFight and unitSpawnerModuleConfig.bossFightEnabled then + BossWaveStarted = true + elseif not FinalBossUnitSpawned and not BossWaveStarted then + if scavengersAIEnabled and scavengersAIEnabled == true then + if globalScore == 0 then globalScore = 1 end + if scavconfig.timers.BossFight == 0 then scavconfig.timers.BossFight = 1 end + if globalScore/scavconfig.timers.BossFight < 1 then + ScavSendMessage("Scavengers Tech Progress: "..math.ceil((globalScore/scavconfig.timers.BossFight)*100).."%") + ScavSendMessage("Scav Score: "..globalScore) + ScavSendMessage(TierSpawnChances.Message) + else + ScavSendMessage("Scavengers Tech Progress: 100%") + ScavSendMessage("Score: "..globalScore) + ScavSendMessage(TierSpawnChances.Message) + end + end + end + end + + if n%90 == 0 and scavconfig.modules.buildingSpawnerModule and (not FinalBossUnitSpawned) then + SpawnBlueprint(n) + end + if n%30 == 0 then + if scavconfig.modules.unitSpawnerModule and (not FinalBossUnitSpawned) then + SpawnBeacon(n) + UnitGroupSpawn(n) + end + if scavconfig.modules.constructorControllerModule and constructorControllerModuleConfig.useconstructors and n > 9000 and (not FinalBossUnitSpawned) then + SpawnConstructor(n) + end + local scavengerunits = Spring.GetTeamUnits(GaiaTeamID) + if scavengerunits then + for i = 1,#scavengerunits do + local scav = scavengerunits[i] + local scavDef = Spring.GetUnitDefID(scav) + local collectorRNG = math_random(0,2) + + if n%300 == 0 and scavconfig.modules.stockpilers == true then + if scavStockpiler[scav] == true then + ScavStockpile(n, scav) + end + end + + if scavconfig.modules.nukes == true then + if scavNuke[scav] == true then + SendRandomNukeOrder(n, scav) + end + end + + if scavconfig.modules.constructorControllerModule then + if constructorControllerModuleConfig.useconstructors then + if scavConstructor[scav] then + if Spring.GetCommandQueue(scav, 0) <= 0 then + -- if n%1800 == 0 then + -- if (not HiddenCommander) or (scav ~= HiddenCommander) then + -- SelfDestructionControls(n, scav, scavDef) + -- end + -- end + ConstructNewBlueprint(n, scav) + end + end + end + + if constructorControllerModuleConfig.useresurrectors and collectorRNG == 0 then + if scavResurrector[scav] then + ResurrectorOrders(n, scav) + end + end + + if constructorControllerModuleConfig.usecollectors and collectorRNG == 0 then + if scavCollector[scav] then + CollectorOrders(n, scav) + end + if scavReclaimer[scav] then + ReclaimerOrders(n, scav) + end + end + + if scavAssistant[scav] and Spring.GetCommandQueue(scav, 0) <= 0 then + AssistantOrders(n, scav) + end + end + + if scavconfig.modules.factoryControllerModule then + if scavFactory[scav] and #Spring.GetFullBuildQueue(scav, 0) <= 0 then + FactoryProduction(n, scav, scavDef) + end + end + + -- backup -- and not scavConstructor[scav] and not scavResurrector[scav] and not scavCollector[scav] + if n%450 == 0 and not scavStructure[scav] and not scavAssistant[scav] and not scavFactory[scav] and not scavSpawnBeacon[scav] then + SelfDestructionControls(n, scav, scavDef) + end + if Spring.GetCommandQueue(scav, 0) <= 1 and not scavStructure[scav] and not scavConstructor[scav] and not scavReclaimer[scav] and not scavResurrector[scav] and not scavAssistant[scav] and not scavCollector[scav] and not scavFactory[scav] and not scavSpawnBeacon[scav] then + ArmyMoveOrders(n, scav, scavDef) + end + + end + end + end +end + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + local UnitName = UnitDefs[unitDefID].name + if unitTeam == GaiaTeamID then + + if FinalBossUnitSpawned == true then + for i = 1,#BossUnits do + if string.sub(UnitName, 1, string.len(UnitName)) == BossUnits[i] then + Spring.Echo("GG") + FinalBossKilled = true + FinalBossUnitID = nil + end + end + end + + killedscavengers = killedscavengers + scavconfig.scoreConfig.baseScorePerKill + if scavStructure[unitID] and not UnitName == "scavengerdroppod_scav" and not UnitName == "scavengerdroppodbeacon_scav" then + killedscavengers = killedscavengers + scavconfig.scoreConfig.scorePerKilledBuilding + end + if scavConstructor[unitID] then + killedscavengers = killedscavengers + scavconfig.scoreConfig.scorePerKilledConstructor + end + if UnitName == "scavengerdroppodbeacon_scav" then + numOfSpawnBeacons = numOfSpawnBeacons - 1 + killedscavengers = killedscavengers + scavconfig.scoreConfig.scorePerKilledSpawner + end + if UnitName == "scavengerdroppod_scav" then + killedscavengers = killedscavengers - scavconfig.scoreConfig.baseScorePerKill + end + selfdx[unitID] = nil + selfdy[unitID] = nil + selfdz[unitID] = nil + oldselfdx[unitID] = nil + oldselfdy[unitID] = nil + oldselfdz[unitID] = nil + scavNoSelfD[unitID] = nil + scavConstructor[unitID] = nil + scavAssistant[unitID] = nil + scavResurrector[unitID] = nil + scavCollector[unitID] = nil + scavReclaimer[unitID] = nil + scavStructure[unitID] = nil + scavFactory[unitID] = nil + scavSpawnBeacon[unitID] = nil + scavStockpiler[unitID] = nil + scavNuke[unitID] = nil + UnitSuffixLenght[unitID] = nil + ConstructorNumberOfRetries[unitID] = nil + CaptureProgressForBeacons[unitID] = nil + else + for i = 1,#AliveEnemyCommanders do + local comID = AliveEnemyCommanders[i] + if unitID == comID then + AliveEnemyCommandersCount = AliveEnemyCommandersCount - 1 + table.remove(AliveEnemyCommanders, i) + break + end + end + if UnitName == "scavengerdroppodbeacon_scav" then + numOfSpawnBeaconsTeams[unitTeam] = numOfSpawnBeaconsTeams[unitTeam] - 1 + end + end +end + +function gadget:UnitTaken(unitID, unitDefID, unitOldTeam, unitNewTeam) + local UnitName = UnitDefs[unitDefID].name + if unitOldTeam == GaiaTeamID then + if UnitDefs[unitDefID].name == "scavengerdroppodbeacon_scav" then + numOfSpawnBeacons = numOfSpawnBeacons - 1 + numOfSpawnBeaconsTeams[unitNewTeam] = numOfSpawnBeaconsTeams[unitNewTeam] + 1 + killedscavengers = killedscavengers + scavconfig.scoreConfig.scorePerCapturedSpawner + if scavconfig.modules.reinforcementsModule == true then + Spring.SetUnitNeutral(unitID, false) + Spring.SetUnitHealth(unitID, 2500) + Spring.SetUnitMaxHealth(unitID, 2500) + end + --SpawnDefencesAfterCapture(unitID, unitNewTeam) + end + selfdx[unitID] = nil + selfdy[unitID] = nil + selfdz[unitID] = nil + oldselfdx[unitID] = nil + oldselfdy[unitID] = nil + oldselfdz[unitID] = nil + scavNoSelfD[unitID] = nil + scavConstructor[unitID] = nil + scavAssistant[unitID] = nil + scavResurrector[unitID] = nil + scavCollector[unitID] = nil + scavReclaimer[unitID] = nil + scavStructure[unitID] = nil + scavFactory[unitID] = nil + scavSpawnBeacon[unitID] = nil + scavStockpiler[unitID] = nil + scavNuke[unitID] = nil + UnitSuffixLenght[unitID] = nil + ConstructorNumberOfRetries[unitID] = nil + CaptureProgressForBeacons[unitID] = nil + Spring.SetUnitHealth(unitID, {capture = 0}) + + else + if unitNewTeam == GaiaTeamID then + if string.find(UnitName, scavconfig.unitnamesuffix) then + UnitSuffixLenght[unitID] = string.len(scavconfig.unitnamesuffix) + else + UnitSuffixLenght[unitID] = 0 + end + --Spring.Echo("Scavs just captured me " .. UnitName .. " and my suffix lenght is " .. UnitSuffixLenght[unitID]) + if UnitDefs[unitDefID].name == "scavengerdroppodbeacon_scav" then + numOfSpawnBeaconsTeams[unitOldTeam] = numOfSpawnBeaconsTeams[unitOldTeam] - 1 + numOfSpawnBeacons = numOfSpawnBeacons + 1 + scavSpawnBeacon[unitID] = true + end + -- CMD.CLOAK = 37382 + Spring.GiveOrderToUnit(unitID,37382,{1},0) + -- Fire At Will + Spring.GiveOrderToUnit(unitID,CMD.FIRE_STATE,{2},0) + scavStructure[unitID] = UnitDefs[unitDefID].isBuilding + for i = 1,#NoSelfdList do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == NoSelfdList[i] then--string.find(UnitName, NoSelfdList[i]) then + scavStructure[unitID] = true + end + end + + if scavconfig.modules.stockpilers == true then + for i = 1,#StockpilingUnitNames do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == StockpilingUnitNames[i] then + scavStockpiler[unitID] = true + end + end + end + + if scavconfig.modules.nukes == true then + for i = 1,#NukingUnitNames do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == NukingUnitNames[i] then + scavNuke[unitID] = true + end + end + end + + if scavconfig.modules.constructorControllerModule then + if constructorControllerModuleConfig.useconstructors then + for i = 1,#ConstructorsList do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == ConstructorsList[i] then + scavConstructor[unitID] = true + end + end + end + + if constructorControllerModuleConfig.useresurrectors then + for i = 1,#Resurrectors do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Resurrectors[i] then + scavResurrector[unitID] = true + end + end + for i = 1,#ResurrectorsSea do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == ResurrectorsSea[i] then + scavResurrector[unitID] = true + end + end + end + + if constructorControllerModuleConfig.usecollectors then + for i = 1,#Collectors do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Collectors[i] then + if math_random(0,100) <= 10 then + scavCollector[unitID] = true + else + scavReclaimer[unitID] = true + end + end + end + end + + for i = 1,#AssistUnits do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == AssistUnits[i] then + scavAssistant[unitID] = true + end + end + end + + if scavconfig.modules.factoryControllerModule then + for i = 1,#Factories do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Factories[i] then + scavFactory[unitID] = true + end + end + end + end + if UnitDefs[unitDefID].name == "scavengerdroppodbeacon_scav" then + numOfSpawnBeaconsTeams[unitOldTeam] = numOfSpawnBeaconsTeams[unitOldTeam] - 1 + numOfSpawnBeaconsTeams[unitNewTeam] = numOfSpawnBeaconsTeams[unitNewTeam] + 1 + end + end +end + +function gadget:UnitCreated(unitID, unitDefID, unitTeam) + local UnitName = UnitDefs[unitDefID].name + --Spring.Echo(Spring.GetUnitHeading(unitID)) + if UnitName == "scavengerdroppodfriendly" then + Spring.GiveOrderToUnit(unitID, CMD.SELFD,{}, {"shift"}) + end + if unitTeam == GaiaTeamID then + if string.find(UnitName, scavconfig.unitnamesuffix) then + UnitSuffixLenght[unitID] = string.len(scavconfig.unitnamesuffix) + else + UnitSuffixLenght[unitID] = 0 + local frame = Spring.GetGameFrame() + if frame > 300 then + local heading = Spring.GetUnitHeading(unitID) + local suffix = scavconfig.unitnamesuffix + local posx, posy, posz = Spring.GetUnitPosition(unitID) + Spring.DestroyUnit(unitID, false, true) + if heading >= -24576 and heading < -8192 then -- west + -- 3 + Spring.CreateUnit(UnitName..suffix, posx, posy, posz, 3,GaiaTeamID) + elseif heading >= -8192 and heading < 8192 then -- south + -- 0 + Spring.CreateUnit(UnitName..suffix, posx, posy, posz, 0,GaiaTeamID) + elseif heading >= 8192 and heading < 24576 then -- east + -- 1 + Spring.CreateUnit(UnitName..suffix, posx, posy, posz, 1,GaiaTeamID) + else -- north + -- 2 + Spring.CreateUnit(UnitName..suffix, posx, posy, posz, 2,GaiaTeamID) + end + return + end + end + for i = 1,#BossUnits do + if string.sub(UnitName, 1, string.len(UnitName)) == BossUnits[i] then + Spring.Echo("Got boss commander ID, attempting to spawn minions") + FinalBossUnitID = unitID + local bosshealth = unitSpawnerModuleConfig.FinalBossHealth*teamcount*spawnmultiplier + Spring.SetUnitHealth(unitID, bosshealth) + end + end + if UnitName == "scavengerdroppod_scav" then + Spring.GiveOrderToUnit(unitID, CMD.SELFD,{}, {"shift"}) + end + if UnitName == "scavengerdroppodbeacon_scav" then + scavSpawnBeacon[unitID] = true + numOfSpawnBeacons = numOfSpawnBeacons + 1 + if scavconfig.modules.reinforcementsModule == true then + Spring.SetUnitNeutral(unitID, true) + Spring.SetUnitMaxHealth(unitID, 10000) + Spring.SetUnitHealth(unitID, 10000) + end + end + -- if UnitName == "lootboxgold" then //perhaps add this later when lootboxes are fully implemented + -- Spring.SetUnitNeutral(unitID, true) + -- end + + -- CMD.CLOAK = 37382 + Spring.GiveOrderToUnit(unitID,37382,{1},0) + -- Fire At Will + Spring.GiveOrderToUnit(unitID,CMD.FIRE_STATE,{2},0) + scavStructure[unitID] = UnitDefs[unitDefID].isBuilding + for i = 1,#NoSelfdList do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == NoSelfdList[i] then--string.find(UnitName, NoSelfdList[i]) then + scavStructure[unitID] = true + end + end + + if scavconfig.modules.stockpilers == true then + for i = 1,#StockpilingUnitNames do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == StockpilingUnitNames[i] then + scavStockpiler[unitID] = true + end + end + end + + if scavconfig.modules.nukes == true then + for i = 1,#NukingUnitNames do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == NukingUnitNames[i] then + scavNuke[unitID] = true + end + end + end + + if scavconfig.modules.constructorControllerModule then + if constructorControllerModuleConfig.useconstructors then + for i = 1,#ConstructorsList do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == ConstructorsList[i] then + scavConstructor[unitID] = true + end + end + end + + if constructorControllerModuleConfig.useresurrectors then + for i = 1,#Resurrectors do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Resurrectors[i] then + scavResurrector[unitID] = true + end + end + for i = 1,#ResurrectorsSea do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == ResurrectorsSea[i] then + scavResurrector[unitID] = true + end + end + end + + if constructorControllerModuleConfig.usecollectors then + for i = 1,#Collectors do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Collectors[i] then + if math_random(0,100) <= 10 then + scavCollector[unitID] = true + else + scavReclaimer[unitID] = true + end + end + end + end + + for i = 1,#AssistUnits do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == AssistUnits[i] then + scavAssistant[unitID] = true + end + end + end + + if scavconfig.modules.factoryControllerModule then + for i = 1,#Factories do + if string.sub(UnitName, 1, string.len(UnitName)-UnitSuffixLenght[unitID]) == Factories[i] then + scavFactory[unitID] = true + end + end + end + else + --AliveEnemyCommanders + for i = 1,#CommandersList do + if string.sub(UnitName, 1, string.len(UnitName)) == CommandersList[i] then + AliveEnemyCommandersCount = AliveEnemyCommandersCount + 1 + table.insert(AliveEnemyCommanders,unitID) + end + end + if UnitDefs[unitDefID].name == "scavengerdroppodbeacon_scav" then + numOfSpawnBeaconsTeams[unitTeam] = numOfSpawnBeaconsTeams[unitTeam] + 1 + if scavconfig.modules.reinforcementsModule == true then + Spring.SetUnitNeutral(unitID, false) + Spring.SetUnitMaxHealth(unitID, 10000) + Spring.SetUnitHealth(unitID, 10000) + end + end + end +end + +function gadget:UnitFinished(unitID, unitDefID, unitTeam) + if unitTeam == GaiaTeamID then + -- CMD.CLOAK = 37382 + Spring.GiveOrderToUnit(unitID,37382,{1},0) + -- Fire At Will + if scavConstructor[unitID] then + Spring.GiveOrderToUnit(unitID,CMD.FIRE_STATE,{1},0) + Spring.GiveOrderToUnit(unitID,CMD.MOVE_STATE,{0},0) + else + Spring.GiveOrderToUnit(unitID,CMD.FIRE_STATE,{2},0) + Spring.GiveOrderToUnit(unitID,CMD.MOVE_STATE,{2},0) + end + end +end + +function gadget:UnitDamaged(unitID, unitDefID, unitTeam) + if unitTeam == GaiaTeamID then + local UnitName = UnitDefs[unitDefID].name + for i = 1,#BossUnits do + if string.sub(UnitName, 1, string.len(UnitName)) == BossUnits[i] then + local n = Spring.GetGameFrame() + if not lastMinionFrame then + lastMinionFrame = n + end + if n > lastMinionFrame + math.ceil(unitSpawnerModuleConfig.FinalBossMinionsActive/(teamcount*spawnmultiplier)) and FinalBossUnitID then + lastMinionFrame = n + BossMinionsSpawn(n) + end + end + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/share_control.lua b/LuaRules/Gadgets/share_control.lua deleted file mode 100644 index 6b2229e3a..000000000 --- a/LuaRules/Gadgets/share_control.lua +++ /dev/null @@ -1 +0,0 @@ --- $Id: share_control.lua 4292 2009-04-05 05:29:29Z carrepairer $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- file: share_control.lua -- brief: only allow sharing with allied teams -- author: Dave Rodgers -- -- Copyright (C) 2007. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "ShareControl", desc = "Controls sharing of units and resources", author = "trepan", date = "Apr 22, 2007", license = "GNU GPL, v2 or later", layer = -5, enabled = true -- loaded by default? } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local spGetTeamInfo = Spring.GetTeamInfo local resShare = true -- allow sharing resources local unitShare = true -- allow sharing units local resShareEnemy = false -- allow sharing resources with enemies local unitShareEnemy = false -- allow sharing units with enemies local unitShareCeasefired = false -- allow sharing units with ceasefired if not GG.shareunits then GG.shareunits = {} end --------------- CarRepairer start ------------- --[[ local GetAllyTeamList = Spring.GetAllyTeamList local GetTeamList = Spring.GetTeamList local GetPlayerList = Spring.GetPlayerList local backupPlayerMode local backups = {} --]] local GetTeamInfo = Spring.GetTeamInfo -- -- A team indexed list of the last frames that a unit transfer was blocked. -- This helps to avoid filling up the console with warnings when a user tries -- to share multiple units. -- -- local lastRefusals = {} -------------------------------------------------------------------------------- --if Spring.FixedAllies() == false then return false end --remove local function AllowAction(playerID) if (playerID ~= 0) then Spring.SendMessageToPlayer(playerID, "Must be the host player") return false end if (not Spring.IsCheatingEnabled()) then Spring.SendMessageToPlayer(playerID, "Cheating must be enabled") return false end return true end local function PrintState() Spring.Echo('sharing units is ' .. (unitShare and 'enabled' or 'disabled')) Spring.Echo('sharing resources is ' .. (resShare and 'enabled' or 'disabled')) Spring.Echo('sharing units with enemies is ' .. (unitShare and unitShareEnemy and 'enabled' or 'disabled')) Spring.Echo('sharing resources with enemies is ' .. (resShare and resShareEnemy and 'enabled' or 'disabled')) return true end local function ChatControl(cmd, line, words, playerID) if (not AllowAction(playerID)) then PrintState() return true end local count = #words if (count == 0) then unitShare = not unitShare resShare = unitShare elseif (count == 1) then if ((words[1] == '0') or (words[1] == 'none')) then resShare = false unitShare = false resShareEnemy = false unitShareEnemy = false elseif ((words[1] == '1') or (words[1] == 'ally')) then resShare = true unitShare = true resShareEnemy = false unitShareEnemy = false elseif ((words[1] == '2') or (words[1] == 'full')) then resShare = true unitShare = true resShareEnemy = true unitShareEnemy = true elseif (words[1] == 'r') then resShare = not resShare elseif (words[1] == 'u') then unitShare = not unitShare elseif (words[1] == 'e') then resShareEnemy = not resShareEnemy unitShareEnemy = not unitShareEnemy end elseif (count == 2) then if (words[1] == 'e') then if (words[2] == '0') then resShareEnemy = false unitShareEnemy = false elseif (words[2] == '1') then resShareEnemy = true unitShareEnemy = true end elseif (words[1] == 'r') then if (words[2] == '0') then resShare = false elseif (words[2] == '1') then resShare = true elseif (words[2] == 'e') then resShareEnemy = not resShareEnemy end elseif (words[1] == 'u') then if (words[2] == '0') then unitShare = false elseif (words[2] == '1') then unitShare = true elseif (words[2] == 'e') then unitShareEnemy = not unitShareEnemy end end elseif (count == 3) then if (words[1] == 'r') then if (words[2] == 'e') then if (words[3] == '0') then resShareEnemy = false elseif (words[3] == '1') then resShareEnemy = true end end elseif (words[1] == 'u') then if (words[2] == 'e') then if (words[3] == '0') then unitShareEnemy = false elseif (words[3] == '1') then unitShareEnemy = true end end end end PrintState() return true end function gadget:Initialize() if (not gadgetHandler:IsSyncedCode()) then gadgetHandler:RemoveGadget() return end if( Spring.GetModOptions() ) then unitShareEnemy = Spring.GetModOptions().sharemode == 'anyone' --resShareEnemy = unitShareEnemy unitShareCeasefired = Spring.GetModOptions().sharemode == 'ceasefire' end local cmd, help cmd = "sharectrl" local h = '' h = h.. ' [ "none" | "ally" | "full"]: basic sharing modes\n' h = h..cmd..' <"u"|"r"> ["e"] [0|1]: finer sharing control\n' h = h..' u: unit sharing\n' h = h..' r: resource sharing\n' h = h..' e: enemy mode\n' -- h = h..cmd..' [0|1]: control unit and resource sharing\n' -- h = h..cmd..' res [0|1]: control resource sharing\n' -- h = h..cmd..' unit [0|1]: control unit sharing\n' -- h = h..cmd..' enemy [0|1]: control enemy unit and resource sharing\n' -- h = h..cmd..' enemy res [0|1]: control enemy resource sharing\n' help = h gadgetHandler:AddChatAction(cmd, ChatControl, help) Script.AddActionFallback(cmd .. ' ', help) --------------- CarRepairer start ------------- --[[ allyTeamList = GetAllyTeamList() allyTeamCount = {} backupPlayerMode = (Spring.GetModOptions().backupplayers == 1) for _, allyTeam in ipairs(allyTeamList) do teamList = GetTeamList(allyTeam) allyTeamCount[allyTeam] = #teamList for _, team in ipairs(teamList) do _,_,_,_,faction,_ = GetTeamInfo(team) if (faction == 'backup') then backups[team] = allyTeam end end end --]] --------------- CarRepairer end ------------- end --------------- CarRepairer start ------------- --[[ function MissingPlayer(allyTeamID) local activePlayers = GetPlayerList(true) activePlayerCount = 0 for _, activePlayer in ipairs(activePlayers) do local _, _, _, curTeamID, curAllyTeamID = GetPlayerInfo(activePlayer) if curAllyTeamID == allyTeamID then activePlayerCount = activePlayerCount + 1 end end if activePlayerCount < allyTeamCount[allyTeamID] then return true end return false end --]] --------------- CarRepairer end ------------- function gadget:Shutdown() gadgetHandler:RemoveChatAction("sharectrl", ChatControl) end function gadget:AllowResourceTransfer(oldTeam, newTeam, type, amount) if(amount < 0) then return end --thx to gnurps@o2.pl for this patch. This prevent player from taking resources from his ally. if (resShare) then --if (resShareEnemy or Spring.AreTeamsAllied(oldTeam, newTeam)) then local _,_,_,_,_,oldAlliance = spGetTeamInfo(oldTeam) local _,_,_,_,_,newAlliance = spGetTeamInfo(newTeam) if (resShareEnemy or oldAlliance == newAlliance) then return true else Spring.SendMessageToTeam(oldTeam, "Cannot give resources to enemies when the fixed alliances option is set.") end else Spring.SendMessageToTeam(oldTeam, "Resource sharing has been disabled.") end return false end local function AddRefusal(team, msg) local frameNum = Spring.GetGameFrame() local lastRefusal = lastRefusals[team] if ((not lastRefusal) or (lastRefusal ~= frameNum)) then lastRefusals[team] = frameNum Spring.SendMessageToTeam(team, msg) end end function gadget:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) --------------- CarRepairer start ------------- --[[ if (backups[newTeam]) then allyTeam = backups[newTeam] if backupPlayerMode then if (MissingPlayer(allyTeam)) then backups[newTeam] = nil allyTeamCount[allyTeam] = allyTeamCount[allyTeam] - 1 else AddRefusal(oldTeam, "A Backup Player cannot receive units until a player drops.") return false end else AddRefusal(oldTeam, "A Backup may only receive units in 'Backup Player Mode.'") return false end end --]] --------------- CarRepairer end ------------- if (capture) then return true end if (Spring.IsCheatingEnabled()) then return true end local _,_,_,_,faction,_ = GetTeamInfo(newTeam) if (faction == 'teamspec') then AddRefusal(oldTeam, "Cannot share units to a Teamspec.") return false end if GG.shareunits[unitID] then GG.shareunits[unitID] = nil return true end if (not unitShare) then AddRefusal(oldTeam, "Unit sharing has been disabled.") return false end -- AreTeamsAllied includes temporary alliances local _,_,_,_,_,oldAlliance = spGetTeamInfo(oldTeam) local _,_,_,_,_,newAlliance = spGetTeamInfo(newTeam) if (unitShareEnemy or oldAlliance == newAlliance) then return true end -- can give PW buildings to gaia local pwUnits = (GG.PlanetWars or {}).unitsByID if (newTeam == Spring.GetGaiaTeamID()) and (pwUnits or {})[unitID] then return true end if (unitShareCeasefired and Spring.AreTeamsAllied(oldTeam, newTeam)) then return true end AddRefusal(oldTeam, "Cannot give units to enemies unless enabled in mod options.") return false end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/share_levels.lua b/LuaRules/Gadgets/share_levels.lua deleted file mode 100644 index 78ccb16a7..000000000 --- a/LuaRules/Gadgets/share_levels.lua +++ /dev/null @@ -1,231 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: share_levels.lua --- brief: control resource sharing --- author: Dave Rodgers --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "ShareLevels", - desc = "Control resource sharing", - author = "trepan", - date = "Apr 22, 2007", - license = "GNU GPL, v2 or later", - layer = -5, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local metalForce = true -local metalLevel = 50 - -local energyForce = true -local energyLevel = 75 - --- for toggling -local prevMetal = false -local prevEnery = false - -local cmdName = "sharelevels" -local help = " []>]>" - .. ": control automatic team resource sharing" - - --------------------------------------------------------------------------------- - -local function AllowAction(playerID) - if (playerID ~= 0) then - Spring.SendMessageToPlayer(playerID, "Must be the host player") - return false - end - if (not Spring.IsCheatingEnabled()) then - Spring.SendMessageToPlayer(playerID, "Cheating must be enabled") - return false - end - return true -end - - - -local function PrintHelp() - Spring.Echo(help) - return true -end - - -local function PrintState() - if (not metalForce) then - Spring.Echo('forced metal sharing is disabled') - else - Spring.Echo(string.format( - 'forced metal sharing level set to: %i%%', - ((1 - metalLevel) * 100) - )) - end - if (not energyForce) then - Spring.Echo('forced energy sharing is disabled') - else - Spring.Echo(string.format( - 'forced energy sharing level set to: %i%%', - ((1 - energyLevel) * 100) - )) - end - return true -end - - -local function ToggleBoth() - local hadPrev = (prevMetal or prevEnergy) - if (metalForce or energyForce) then - prevMetal = metalForce - prevEnergy = energyForce - metalForce = false - energyForce = false - elseif (hadPrev) then - metalForce = prevMetal - energyForce = prevEnergy - else - metalForce = true - energyForce = true - end -end - - -local function ChatControl(cmd, line, words, playerID) - if (not AllowAction(playerID)) then - PrintState() - return true - end - - local w1, w2 = words[1], words[2] - - if ((w1 == 'list') or (w1 == 'l')) then - return PrintState() - elseif ((w1 == 'toggle') or (w1 == 't')) then - ToggleBoth() - return PrintState() - elseif (w1 == 'on') then - metalForce = true - energyForce = true - return PrintState() - elseif (w1 == 'off') then - metalForce = false - energyForce = false - return PrintState() - end - - if (not (w1 == 'e') and - not (w1 == 'm') and - not (w1 == '*')) then - return PrintHelp() - end - - if (w2 == nil) then - if (w1 == 'm') then - metalForce = not metalForce - return PrintState() - elseif (w1 == 'e') then - energyForce = not energyForce - return PrintState() - else - ToggleBoth() - return PrintState() - end - end - - if ((w2 == 'on') or (w2 == 'off')) then - local state = (w2 == 'on') - if (w1 == 'm') then - metalForce = state - return PrintState() - elseif (w1 == 'e') then - energyForce = state - return PrintState() - else - metalForce = state - energyForce = state - return PrintState() - end - return PrintHelp() - end - - local level = tonumber(w2) - if (level == nil) then - PrintHelp() - Spring.Echo("bad sharing level: " .. w2) - return true - end - level = (100 - level) * 0.01 - if (level < 0) then level = 0 end - if (level > 1) then level = 1 end - - if ((w1 == 'm') or (w1 == '*')) then - metalLevel = level - metalForce = true - end - if ((w1 == 'e') or (w1 == '*')) then - energyLevel = level - energyForce = true - end - - return PrintState() -end - - --------------------------------------------------------------------------------- - -function gadget:Initialize() - if (not gadgetHandler:IsSyncedCode()) then - gadgetHandler:RemoveGadget() - return - end - gadgetHandler:AddChatAction(cmdName, ChatControl, help) - Script.AddActionFallback(cmdName .. ' ', help) -end - - -function gadget:Shutdown() - gadgetHandler:RemoveChatAction(cmdName, ChatControl) -end - - --------------------------------------------------------------------------------- - -local GetTeamList = Spring.GetTeamList -local SetTeamShareLevel = Spring.SetTeamShareLevel - - -function gadget:GameFrame() - if (not (metalForce or energyForce)) then - return - end - for _,team in ipairs(GetTeamList()) do - if (metalForce) then SetTeamShareLevel(team, 'm', metalLevel) end - if (energyForce) then SetTeamShareLevel(team, 'e', energyLevel) end - end - return false -end - - -function gadget:AllowResourceLevel(teamID, type, level) - if (type == 'm') then - return not metalForce - elseif (type == 'e') then - return not energyForce - end - return true -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/system_info.lua b/LuaRules/Gadgets/system_info.lua index c1ef68ff3..ccf44ad83 100644 --- a/LuaRules/Gadgets/system_info.lua +++ b/LuaRules/Gadgets/system_info.lua @@ -15,9 +15,23 @@ end -------------------------------------------------------------------------------- if gadgetHandler:IsSyncedCode() then + local charset = {} do -- [0-9a-zA-Z] + for c = 48, 57 do table.insert(charset, string.char(c)) end + for c = 65, 90 do table.insert(charset, string.char(c)) end + for c = 97, 122 do table.insert(charset, string.char(c)) end + end + local function randomString(length) + if not length or length <= 0 then return '' end + --math.randomseed(os.clock()^5) + return randomString(length - 1) .. charset[math.random(1, #charset)] + end + + local validation = randomString(2) + _G.validationSys = validation + function gadget:RecvLuaMsg(msg, playerID) - if msg:sub(1,3)=="$y$" then - SendToUnsynced("systemBroadcast",playerID,msg:sub(4)) + if msg:sub(1,3)=="$y$" and msg:sub(4,5)==validation then + SendToUnsynced("systemBroadcast",playerID,msg:sub(6)) return true end end @@ -28,9 +42,8 @@ else -------------------------------------------------------------------------------- local SendLuaRulesMsg = Spring.SendLuaRulesMsg - local GetMyPlayerID = Spring.GetMyPlayerID - local myPlayerID = GetMyPlayerID() local systems = {} + local validation = SYNCED.validationSys function lines(str) local t = {} @@ -49,12 +62,20 @@ else if Engine ~= nil and Platform ~= nil then -- v104 if Platform.gpu ~= nil then s_gpu = Platform.gpu + s_gpu = string.gsub(s_gpu, "/PCIe", "") + s_gpu = string.gsub(s_gpu, "/SSE2", "") + s_gpu = string.gsub(s_gpu, " Series", "") + s_gpu = string.gsub(s_gpu, "%((.*)%)", "") + s_gpu = string.gsub(s_gpu, "Gallium ([0-9].*) on ", "") if Platform.gpuVendor == 'Nvidia' then - s_gpuVram = Platform.gpuMemorySize + s_gpuVram = math.floor(Platform.gpuMemorySize/1000)..'MB' end end if Platform.osFamily ~= nil then s_os = Platform.osFamily + if Platform.osVersion ~= nil then + s_os = s_os .. ' ' .. Platform.osVersion + end end end @@ -65,96 +86,71 @@ else fileLines = lines(infolog) for i, line in ipairs(fileLines) do - if s_os ~= nil then - -- Spring v104 - if s_gpu ~= nil and string.match(line, 'current=\{[0-9]*x[0-9]*') then - s_resolution = string.sub(string.match(line, 'current=\{[0-9]*x[0-9]*'), 10) - end - if s_gpu ~= nil and string.find(line, 'GPU memory') and not string.find(line, 'unknown') then - s_gpuVram = string.match(line, '[0-9]*MB') - s_gpuVram = string.gsub(s_gpuVram, "MB ", "") - if string.find(s_gpuVram, ',') then - s_gpuVram = string.sub(s_gpuVram, 0, string.find(s_gpuVram, ',')-1) - end - end + if string.sub(line, 1, 3) == '[F=' then + break + end - -- Spring v103 - if s_gpu ~= nil and string.find(line, ' video mode set to ') then - s_resolution = string.sub(line, 44) - end - if s_gpu ~= nil and string.find(line, 'Video RAM:') and not string.find(line, 'unknown') then - s_gpuVram = string.sub(line, 14) - s_gpuVram = string.gsub(s_gpuVram, "total ", "") - if string.find(s_gpuVram, ',') then - s_gpuVram = string.sub(s_gpuVram, 0, string.find(s_gpuVram, ',')-1) - end - end + -- Spring v104 + if s_gpu ~= nil and string.match(line, 'current=\{[0-9]*x[0-9]*') then + s_resolution = string.sub(string.match(line, 'current=\{[0-9]*x[0-9]*'), 10) + end - if s_gpu == nil and string.find(line, 'GL renderer') then - s_gpu = string.sub(line, 14) - s_gpu = string.gsub(s_gpu, "/PCIe", "") - s_gpu = string.gsub(s_gpu, "/SSE2", "") - s_gpu = string.gsub(s_gpu, " Series", "") - s_gpu = string.gsub(s_gpu, "%((.*)%)", "") - s_gpu = string.gsub(s_gpu, "Gallium ([0-9].*) on ", "") - end - if s_gpu == nil and string.find(line, '(Supported Video modes on Display )') then - if s_displays == nil then - s_displays = '' - ds = '' - end - s_displays = s_displays .. ds .. string.gsub(string.match(line, '([0-9].*)'), ':','') - ds = ' | ' - end - if string.find(line, 'Physical CPU Cores') then - s_cpuCoresPhysical = string.match(line, '([0-9].*)') - end - if string.find(line, 'Logical CPU Cores') then - s_cpuCoresLogical = string.match(line, '([0-9].*)') - end - if s_osVersion ~= nil and s_cpu == nil and s_cpuCoresPhysical == nil and (string.find(line:lower(), 'intel') or string.find(line:lower(), 'amd')) then - s_cpu = string.match(line, '([\+a-zA-Z0-9 ()@._-]*)') - s_cpu = string.gsub(s_cpu, " Processor", "") - s_cpu = string.gsub(s_cpu, " Eight[-]Core", "") - s_cpu = string.gsub(s_cpu, " Six[-]Core", "") - s_cpu = string.gsub(s_cpu, " Quad[-]Core", "") - s_cpu = string.gsub(s_cpu, "%((.*)%)", "") - s_ram = string.match(line, '([0-9]*MB RAM)') - s_ram = string.gsub(s_ram, " RAM", "") - end - if s_osVersion == nil and cpu == nil and s_cpuCoresPhysical == nil and (string.find(line:lower(), 'microsoft') or string.find(line:lower(), 'linux') or string.find(line:lower(), 'unix')) then - s_osVersion = line + if s_gpu == nil and string.find(line, '(Supported Video modes on Display )') then + if s_displays == nil then + s_displays = '' + ds = '' end + s_displays = s_displays .. ds .. string.gsub(string.match(line, '([0-9].*)'), ':','') + ds = ' | ' end - if s_configs_os == nil and string.find(line, 'Operating System:') then - local charStart = string.find(line, 'Operating System:') - s_os = string.sub(line, 19 + charStart) + if string.find(line, 'Physical CPU Cores') then + s_cpuCoresPhysical = string.match(line, '([0-9].*)') end - - if s_config ~= nil and configEnd == nil and line == '============== ==============' then - configEnd = true + if string.find(line, 'Logical CPU Cores') then + s_cpuCoresLogical = string.match(line, '([0-9].*)') end - if s_config ~= nil and configEnd == nil then - s_config = s_config..nl..line - nl = '\n' + if (string.find(line:lower(), 'hardware config: ')) then + s_cpu = string.sub(line, select(2, string.find(line:lower(), 'hardware config: '))) + s_cpu = string.match(s_cpu, '([\+a-zA-Z0-9 ()@._-]*)') + s_cpu = string.gsub(s_cpu, " Processor", "") + s_cpu = string.gsub(s_cpu, " Eight[-]Core", "") + s_cpu = string.gsub(s_cpu, " Six[-]Core", "") + s_cpu = string.gsub(s_cpu, " Quad[-]Core", "") + s_cpu = string.gsub(s_cpu, " CPU", "") + s_cpu = string.gsub(s_cpu, "%((.*)%)", "") + s_ram = string.match(line, '([0-9]*MB RAM)') + s_ram = string.gsub(s_ram, " RAM", "") end - if s_config == nil and line == '============== ==============' then - s_config = '' - nl = '' + if (string.find(line:lower(), 'operating system: ')) then + s_os = string.sub(line, select(2, string.find(line:lower(), 'operating system: '))) end end - if s_os ~= nil or s_osVersion ~= nil then - local os = '' - if s_os ~= nil then os = s_os end - if s_osVersion ~= nil then os = os ..' '..s_osVersion end - if string.find(os, 'Windows') then - s_os = 'Windows' - end - if string.find(os, 'Linux') then - s_os = 'Linux' - end + + --if s_os == nil and s_configs_os == nil and string.find(line, 'Operating System:') then + -- local charStart = string.find(line, 'Operating System:') + -- s_os = string.sub(line, 18 + charStart) + --end + + if s_config ~= nil and configEnd == nil and line == '============== ==============' then + configEnd = true + end + if s_config ~= nil and configEnd == nil then + s_config = s_config..nl..line + nl = '\n' + end + if s_config == nil and line == '============== ==============' then + s_config = '' + nl = '' + end + end + + if s_os then + if string.find(s_os, 'Windows') then -- simplyfy, also for some privacy (hiding build number) + s_os = string.match(s_os, "(Windows [0-9.]*)") + elseif string.find(s_os, 'Linux') then -- simplyfy, also for some privacy (hiding build number) + s_os = 'Linux' end end @@ -183,7 +179,7 @@ else system = string.sub(system, 2) if system ~= '' then - SendLuaRulesMsg("$y$"..system) + SendLuaRulesMsg("$y$"..validation..system) end end diff --git a/LuaRules/Gadgets/unit_cloak_shield.lua b/LuaRules/Gadgets/unit_cloak_shield.lua index f034a0706..9be87753d 100644 --- a/LuaRules/Gadgets/unit_cloak_shield.lua +++ b/LuaRules/Gadgets/unit_cloak_shield.lua @@ -1 +1,927 @@ --- $Id: unit_cloak_shield.lua 3605 2008-12-31 08:50:31Z google frog $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- file: unit_cloak_shield.lua -- brief: adds a cloak-shield command to units -- author: Dave Rodgers, modified by Evil4Zerggin -- -- Copyright (C) 2007. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "UnitCloakShield", desc = "Adds a cloak-shield command to units", author = "trepan, modified by Evil4Zerggin", date = "May 02, 2007", --updated on 23 January 2014 license = "GNU GPL, v2 or later", layer = 1, enabled = true -- loaded by default? } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- FIXME: (TODO) -- - wait for UnitFinished() before allowing cloak_shield? -- - don't allow state changes during pauses (tied to the above) -- -------------------------------------------------------------------------------- include("LuaRules/Configs/customcmds.h.lua") include("LuaRules/Configs/constants.lua") local SYNCSTR = "unit_cloak_shield" -------------------------------------------------------------------------------- -- COMMON -------------------------------------------------------------------------------- if (gadgetHandler:IsSyncedCode()) then -------------------------------------------------------------------------------- -- SYNCED -------------------------------------------------------------------------------- -- -- speed-ups -- local GetUnitDefID = Spring.GetUnitDefID local GetUnitSeparation = Spring.GetUnitSeparation local SetUnitCloak = Spring.SetUnitCloak local FindUnitCmdDesc = Spring.FindUnitCmdDesc local EditUnitCmdDesc = Spring.EditUnitCmdDesc local SetUnitRulesParam = Spring.SetUnitRulesParam local GetUnitRulesParam = Spring.GetUnitRulesParam -------------------------------------------------------------------------------- local cloakShieldDefs = {} local uncloakableDefs = {} local cloakShieldUnits = {} -- make it global in Initialize() local cloakers = {} local cloakees = {} local cloakShieldCmdDesc = { id = CMD_CLOAK_SHIELD, type = CMDTYPE.ICON_MODE, name = 'CloakShield', cursor = 'CloakShield', -- add with LuaUI? action = 'cloak_shield', tooltip = 'Cloak Shield State: Sets whether the unit is cloaking', params = {'0', 'Cloaker Off', 'Cloaker On' } } -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local function ValidateCloakShieldDefs(mds) local newDefs = {} for udName, def in pairs(mds) do local ud = UnitDefNames[udName] if (not ud) then Spring.Log(gadget:GetInfo().name, LOG.WARNING, 'Bad cloakShield unit type: ' .. udName) else local newData = {} newData.draw = def.draw or true newData.init = def.init or false newData.level = def.level or 2 newData.delay = def.delay or 30 newData.energy = def.energy or 0 newData.minrad = def.minrad or 64 newData.maxrad = def.maxrad or 256 newData.growRate = def.growRate or 256 newData.shrinkRate = def.shrinkRate or 256 newData.selfCloak = def.selfCloak or false newData.decloakDistance = def.decloakDistance or false newData.radiusException = def.radiusException or {} newData.isTransport = (ud.transportCapacity >= 1) newDefs[ud.id] = newData end end -- print the table (alphabetically) --[[ local sorted = {} for n, ud in pairs(UnitDefNames) do table.insert(sorted, {n, ud.id}) end table.sort(sorted, function(a,b) return (a[1] < b[1]) end) for _, name_id in ipairs(sorted) do local nd = newDefs[ name_id[2] ] if (nd) then print('CloakShield ' .. name_id[1]) print(' draw = ' .. tostring(nd.draw)) print(' init = ' .. tostring(nd.init)) print(' delay = ' .. tostring(nd.delay)) print(' energy = ' .. tostring(nd.energy)) print(' minrad = ' .. tostring(nd.minrad)) print(' maxrad = ' .. tostring(nd.maxrad)) print(' growRate = ' .. tostring(nd.growRate)) print(' shrinkRate = ' .. tostring(nd.shrinkRate)) print(' selfCloak = ' .. tostring(nd.selfCloak)) print(' decloakDistance = ' .. tostring(nd.decloakDistance)) end end --]] return newDefs end local function ValidateUncloakableDefs(unclks) local newDefs = {} for udName, data in pairs(unclks) do local ud = UnitDefNames[udName] if (not ud) then Spring.Log(gadget:GetInfo().name, LOG.WARNING, 'Bad uncloakable unit type: ' .. udName) else newDefs[ud.id] = true -- print('uncloakable: ' .. udName) end end return newDefs end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local function AddCloakShieldCmdDesc(unitID, cloakShieldDef) cloakShieldCmdDesc.params[1] = (cloakShieldDef.init and '1') or '0' local insertID = FindUnitCmdDesc(unitID, CMD.CLOAK) or FindUnitCmdDesc(unitID, CMD.ONOFF) or FindUnitCmdDesc(unitID, CMD.TRAJECTORY) or FindUnitCmdDesc(unitID, CMD.REPEAT) or FindUnitCmdDesc(unitID, CMD.MOVE_STATE) or FindUnitCmdDesc(unitID, CMD.FIRE_STATE) or 123456 -- back of the pack Spring.InsertUnitCmdDesc(unitID, insertID + 1, cloakShieldCmdDesc) end local function AddCloakShieldRulesParam(unitID, state) SetUnitRulesParam(unitID, "cloak_shield", state and 2 or 0) end local function AddCloakShieldUnit(unitID, cloakShieldDef) AddCloakShieldCmdDesc(unitID, cloakShieldDef) local data = { id = unitID, def = cloakShieldDef, draw = cloakShieldDef.draw, radius = 0, minrad = cloakShieldDef.minrad, maxrad = cloakShieldDef.maxrad, energy = cloakShieldDef.energy / TEAM_SLOWUPDATE_RATE, isTransport = cloakShieldDef.isTransport, unitRadius = Spring.GetUnitRadius(unitID), } cloakShieldUnits[unitID] = data if (cloakShieldDef.init) then data.want = true cloakers[unitID] = data end AddCloakShieldRulesParam(unitID, cloakShieldDef.init) end local alliedTrueTable = {allied = true} local function SetUnitCloakAndParam(unitID, level, decloakDistance) if level then local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") if cannotCloak ~= 1 then local changeRadius = true if cloakers[unitID] and cloakers[unitID].radius > 0 then changeRadius = false end SetUnitCloak(unitID, level, ((changeRadius and decloakDistance) or GetUnitRulesParam(unitID, "comm_decloak_distance") or false)) end else local wantCloak = GetUnitRulesParam(unitID, "wantcloak") if wantCloak == 1 then local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") if cannotCloak ~= 1 then SetUnitCloak(unitID, 1, GetUnitRulesParam(unitID, "comm_decloak_distance") or false) end else SetUnitCloak(unitID, 0, GetUnitRulesParam(unitID, "comm_decloak_distance") or false) end end SetUnitRulesParam(unitID, "areacloaked", (level and 1) or 0, alliedTrueTable) end -------------------------------------------------------------------------------- function gadget:Initialize() -- get the cloakShieldDefs cloakShieldDefs, uncloakableDefs = include("LuaRules/Configs/cloak_shield_defs.lua") if (not cloakShieldDefs) then gadgetHandler:RemoveGadget() return end gadgetHandler:RegisterCMDID(CMD_CLOAK_SHIELD) cloakShieldDefs = ValidateCloakShieldDefs(cloakShieldDefs) uncloakableDefs = ValidateUncloakableDefs(uncloakableDefs) -- add the CloakShield command to existing units for _,unitID in ipairs(Spring.GetAllUnits()) do local unitDefID = GetUnitDefID(unitID) local cloakShieldDef = cloakShieldDefs[unitDefID] if (cloakShieldDef) then AddCloakShieldUnit(unitID, cloakShieldDef) end end end function gadget:Shutdown() for _,unitID in ipairs(Spring.GetAllUnits()) do SetUnitCloakAndParam(unitID, false) local ud = UnitDefs[GetUnitDefID(unitID)] local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) if (cmdDescID) then Spring.RemoveUnitCmdDesc(unitID, cmdDescID) end end end -------------------------------------------------------------------------------- function gadget:UnitCreated(unitID, unitDefID, unitTeam) local cloakShieldDef = cloakShieldDefs[unitDefID] if (not cloakShieldDef) then return end AddCloakShieldUnit(unitID, cloakShieldDef) end function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) cloakShieldUnits[unitID] = nil cloakers[unitID] = nil cloakees[unitID] = nil end function gadget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) local _,_,_,_,_,newAllyTeam = Spring.GetTeamInfo(teamID) local _,_,_,_,_,oldAllyTeam = Spring.GetTeamInfo(oldTeamID) if (newAllyTeam ~= oldAllyTeam) then if (cloakShieldUnits[unitID]) then cloakShieldUnits[unitID].radius = 0 end cloakers[unitID] = nil cloakees[unitID] = nil SetUnitCloakAndParam(unitID, false) local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) if (cmdDescID) then cloakShieldCmdDesc.params[1] = (state and '2') or '0' EditUnitCmdDesc(unitID, cmdDescID, { params = cloakShieldCmdDesc.params }) end end end -------------------------------------------------------------------------------- local GetUnitAllyTeam = Spring.GetUnitAllyTeam local GetUnitPosition = Spring.GetUnitPosition local GetUnitsInSphere = Spring.GetUnitsInSphere local function UpdateCloakees(data) local unitID = data.id local radius = data.radius local level = data.def.level local selfCloak = data.def.selfCloak local decloakDistance = data.def.decloakDistance local radiusException = data.def.radiusException local x, y, z = GetUnitPosition(unitID) if (x == nil) then return end local closeUnits = GetUnitsInSphere(x, y, z, radius) if (closeUnits == nil) then return end local allyTeam = GetUnitAllyTeam(unitID) for _,cloakee in ipairs(closeUnits) do local udid = GetUnitDefID(cloakee) if ((not uncloakableDefs[udid]) and (not GetUnitRulesParam(cloakee, "comm_shield_id")) and (GetUnitAllyTeam(cloakee) == allyTeam)) then if (cloakee ~= unitID) then --other units SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) cloakees[cloakee] = true elseif (selfCloak) then --self cloak SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) cloakees[cloakee] = true end end -- the GetUnitsInSphere() call uses unit midPos's, which can -- differ from the unit's position while being transported. -- here we do a direct check to see what units the cloakees are -- transporting. this does not fix nested transports if (UnitDefs[udid].transportCapacity >= 1) then local transported = Spring.GetUnitIsTransporting(cloakee) if transported ~= nil then for _,cloakeeLvl2 in ipairs(transported) do local udid = GetUnitDefID(cloakeeLvl2) if ((not uncloakableDefs[udid]) and (GetUnitAllyTeam(cloakeeLvl2) == allyTeam)) then SetUnitCloakAndParam(cloakeeLvl2, 4, (not radiusException[udid]) and decloakDistance) -- note: this gives perfect cloaking, but is the only level -- to work under paralysis cloakees[cloakeeLvl2] = true end end end end end --check if the cloaker is a transport if (data.isTransport and (radius >= data.unitRadius)) then local transported = Spring.GetUnitIsTransporting(unitID) if transported ~= nil then for _,cloakee in ipairs(transported) do local udid = GetUnitDefID(cloakee) if ((not uncloakableDefs[udid]) and (GetUnitAllyTeam(cloakee) == allyTeam)) then SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) cloakees[cloakee] = true end end end end end local function GrowRadius(cloaker) local r = cloaker.radius local maxrad = cloaker.maxrad if (r >= maxrad) then r = maxrad return r end r = (r * r) + cloaker.def.growRate r = math.sqrt(r) r = (r >= cloaker.maxrad) and cloaker.maxrad or r cloaker.radius = r if (cloaker.draw) then SendToUnsynced(SYNCSTR, cloaker.id, r) end end local function ShrinkRadius(cloaker) local r = cloaker.radius if (r <= 0) then cloaker.radius = 0 return 0 end local r = cloaker.radius r = (r * r) - cloaker.def.shrinkRate r = (r < 0) and 0 or math.sqrt(r) cloaker.radius = r if (cloaker.draw) then SendToUnsynced(SYNCSTR, cloaker.id, r) end if ((r <= 0) and (not cloaker.want)) then cloakers[cloaker.id] = nil end end local GetUnitIsStunned = Spring.GetUnitIsStunned function gadget:GameFrame(frameNum) local checkCloakees = ((frameNum % 6) < 1) if (checkCloakees) then for uid in pairs(cloakees) do SetUnitCloakAndParam(uid, false) end cloakees = {} end for unitID, data in pairs(cloakers) do if (data.delay) then data.delay = data.delay - 1 if (data.delay <= 0) then data.delay = nil end ShrinkRadius(data) elseif (GetUnitIsStunned(unitID) or (Spring.GetUnitRulesParam(unitID, "disarmed") == 1) or (Spring.GetUnitRulesParam(unitID, "morphDisable") == 1)) then ShrinkRadius(data) elseif (not data.want) then ShrinkRadius(data) else local activeState = Spring.GetUnitStates(unitID) local newState = activeState and activeState["active"] and (GetUnitRulesParam(unitID, "forcedOff") ~= 1) if (newState) then GrowRadius(data) else ShrinkRadius(data) end if (data.active ~= newState) then data.active = newState if (newState) then SetUnitRulesParam(unitID, "cloak_shield", 2) else SetUnitRulesParam(unitID, "cloak_shield", 1) data.delay = data.def.delay end end end if (checkCloakees and (data.radius > 0)) then UpdateCloakees(data) end end end -------------------------------------------------------------------------------- function CloakShieldCommand(unitID, cmdParams) if (type(cmdParams[1]) ~= 'number') then return false end local data = cloakShieldUnits[unitID] if (not data) then return false end local state = (cmdParams[1] == 1) if (state) then cloakers[unitID] = data data.want = true SetUnitRulesParam(unitID, "cloak_shield", 2) else data.want = false SetUnitRulesParam(unitID, "cloak_shield", 0) end local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) if (cmdDescID) then cloakShieldCmdDesc.params[1] = (state and '1') or '0' EditUnitCmdDesc(unitID, cmdDescID, { params = cloakShieldCmdDesc.params }) end end function gadget:AllowCommand_GetWantedCommand() return {[CMD_CLOAK_SHIELD] = true} end function gadget:AllowCommand_GetWantedUnitDefID() return true end function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) if (cmdID ~= CMD_CLOAK_SHIELD) then return true -- command was not used end CloakShieldCommand(unitID, cmdParams) return false -- command was used end function gadget:CommandFallback(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) if (cmdID ~= CMD_CLOAK_SHIELD) then return false -- command was not used end CloakShieldCommand(unitID, cmdParams) return true, true -- command was used, remove it end -------------------------------------------------------------------------------- -- SYNCED -------------------------------------------------------------------------------- else -------------------------------------------------------------------------------- -- UNSYNCED -------------------------------------------------------------------------------- -- -- speed-ups -- local GetUnitTeam = Spring.GetUnitTeam local GetUnitRadius = Spring.GetUnitRadius local GetUnitHeading = Spring.GetUnitHeading local GetUnitViewPosition = Spring.GetUnitViewPosition local GetGameFrame = Spring.GetGameFrame local GetFrameTimeOffset = Spring.GetFrameTimeOffset local glPushMatrix = gl.PushMatrix local glPopMatrix = gl.PopMatrix local glTranslate = gl.Translate local glRotate = gl.Rotate local glScale = gl.Scale local glCallList = gl.CallList -------------------------------------------------------------------------------- local sphereDivs = 16 local sphereArcs = 32 local drawUnits = {} local sphereList = 0 local negSphereList = 0 local setupMatList = 0 local resetMatList = 0 local backMatList = 0 local frontMatList = 0 local atiFixMatList = 0 local shieldList = 0 local miniMapXformList = 0 local trans = {0.1, 0.28, 0.60 } -------------------------------------------------------------------------------- local function SphereVertex(x, y, z, neg) if (neg) then gl.Normal(-x, -y, -z) else gl.Normal(x, y, z) end gl.Vertex(x, y, z) end local function DrawSphere(divs, arcs, neg) local cos = math.cos local sin = math.sin local twoPI = (2.0 * math.pi) local divRads = math.pi / divs local minRad = sin(divRads) -- sides for d = 4, (divs - 2) do if (d < 7) then gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, trans[d-3]}, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1 }, shininess = 4 }) elseif (d > 10) then gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, trans[15-d]}, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1 }, shininess = 4 }) else gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 1.0 }, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1.0 }, shininess = 4 }) end gl.BeginEnd(GL.QUAD_STRIP, function() local topRads = divRads * (d + 0) local botRads = divRads * (d + 1) local top = cos(topRads) local bot = cos(botRads) local topRad = sin(topRads) local botRad = sin(botRads) for i = 0, arcs do local a = i * (2.0 * math.pi) / arcs SphereVertex(sin(a) * topRad, top, cos(a) * topRad, neg) SphereVertex(sin(a) * botRad, bot, cos(a) * botRad, neg) end end) end -- bottom gl.BeginEnd(GL.TRIANGLE_FAN, function() SphereVertex(0, -1, 0, neg) for i = 0, arcs do local a = -i * (2.0 * math.pi) / arcs SphereVertex(sin(a) * minRad, -cos(divRads), cos(a) * minRad, neg) end end) gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 0.5 }, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1.0 }, shininess = 4 }) -- lines gl.LineWidth(2.0) gl.BeginEnd(GL.LINES, function() SphereVertex( 1, 0, 0); SphereVertex(-1, 0, 0) SphereVertex(0, 1, 0); SphereVertex(0, -1, 0) SphereVertex(0, 0, 1); SphereVertex(0, 0, -1) end) gl.LineWidth(1.0) -- points -- FIXME ATIBUG gl.PointSize(10.0) --[[gl.BeginEnd(GL.POINTS, function() SphereVertex( 1, 0, 0) SphereVertex(-1, 0, 0) SphereVertex(0, 1, 0) SphereVertex(0, -1, 0) SphereVertex(0, 0, 1) SphereVertex(0, 0, -1) end)--]] -- FIXME ATIBUG gl.PointSize(1.0) end -------------------------------------------------------------------------------- local function SetupMaterial() gl.Color(0.1, 0.2, 0.3, 0.3) gl.Blending(GL.SRC_ALPHA, GL.ONE) gl.DepthTest(true) gl.Lighting(true) gl.ShadeModel(GL.FLAT) gl.Fog(false) gl.ClipPlane(1, 0, 1, 0, 0) -- invisible in water end local function ResetMaterial() gl.ShadeModel(GL.SMOOTH) gl.Lighting(false) gl.DepthTest(false) gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) gl.Fog(true) gl.ClipPlane(1, false) -- invisible in water gl.Color(1,1,1,1) end local function BackMaterial() gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 0.5 }, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1.0 }, shininess = 4 }) end local function FrontMaterial() gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 0.75 }, emission = { 0.05, 0.10, 0.15 }, specular = { 0.25, 0.75, 1.0 }, shininess = 4 }) end local function AtiBugFixMaterial() gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 0 }, emission = { 0, 0, 0 }, specular = { 0, 0, 0 }, shininess = 0 }) end local function ShieldList() gl.Culling(GL.FRONT) gl.CallList(backMatList) glCallList(negSphereList) gl.Culling(GL.BACK) gl.CallList(frontMatList) glCallList(sphereList) gl.Culling(false) end local function MiniMapXform() local mapX = Game.mapX * 512 local mapY = Game.mapY * 512 -- this will probably be a common display -- list for widgets that use DrawInMiniMap() gl.LoadIdentity() gl.Translate(0, 1, 0) gl.Scale(1 / mapX, 1 / mapY, 1) gl.Rotate(90, 1, 0, 0) end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --[[ local function getAlpha() local frame = GetGameFrame() + GetFrameTimeOffset() local alpha = (math.abs((frame % 128) - 64) / 64) if (alpha < 0.5) then alpha = 0.5 end return alpha end ]]-- local function DrawShield(unitID, radius, degrees) local x, y, z = GetUnitViewPosition(unitID, true) if (x == nil) then return end if (not Spring.IsSphereInView(x, y, z, math.abs(radius))) then return end glPushMatrix() glTranslate(x, y, z) glScale(radius, radius, radius) glRotate(degrees, 0, 1, 0) glCallList(shieldList) glPopMatrix() end local GetSpectatingState = Spring.GetSpectatingState local GetLocalAllyTeamID = Spring.GetLocalAllyTeamID local IsUnitSelected = Spring.IsUnitSelected local GetUnitAllyTeam = Spring.GetUnitAllyTeam local GetLocalAllyTeamID = Spring.GetLocalAllyTeamID local GetUnitViewPosition = Spring.GetUnitViewPosition local DrawGroundCircle = gl.DrawGroundCircle function gadget:DrawWorld() if (not next(drawUnits)) then return end local dt = GetFrameTimeOffset() local frame = GetGameFrame() + GetFrameTimeOffset() local degrees = frame % (360 * 2 * 3 * 5) local readAllyTeam = GetLocalAllyTeamID() local _, fullView = GetSpectatingState() glCallList(setupMatList) for unitID, radius in pairs(drawUnits) do if (fullView or (GetUnitAllyTeam(unitID) == readAllyTeam)) then DrawShield(unitID, radius, degrees + unitID * 57) end end glCallList(resetMatList) gl.Material({ ambient = { 0, 0, 0 }, diffuse = { 0, 0, 0, 0 }, emission = { 0, 0, 0 }, specular = { 0, 0, 0 }, shininess = 0 }) --gl.CallList(atiFixMatList) end function gadget:DrawInMiniMap() if (not next(drawUnits)) then return end gl.PushMatrix() glCallList(miniMapXformList) local readAllyTeam = GetLocalAllyTeamID() local _, fullView = GetSpectatingState() for unitID, radius in pairs(drawUnits) do if (IsUnitSelected(unitID)) then local x, y, z = GetUnitViewPosition(unitID, true) if (x ~= nil) then if (fullView or (GetUnitAllyTeam(unitID) == readAllyTeam)) then DrawGroundCircle(x, y, z, radius, 64) end end end end gl.PopMatrix() end function gadget:UpdateFIXME() -- testing "cloak_shield" RulesParam for _,unitID in ipairs(Spring.GetSelectedUnits()) do print(unitID, Spring.GetUnitRulesParam(unitID, "cloak_shield")) end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local function UnitUpdate(cmd, unitID, radius) if (radius <= 0) then drawUnits[unitID] = nil else drawUnits[unitID] = radius end end function gadget:UnitDestroyed(unitID) UnitUpdate(0, unitID, 0) end function gadget:Taken(unitID) UnitUpdate(0, unitID, 0) end function gadget:Initialize() gadgetHandler:AddSyncAction(SYNCSTR, UnitUpdate) sphereList = gl.CreateList(DrawSphere, sphereDivs, sphereArcs, false) negSphereList = gl.CreateList(DrawSphere, sphereDivs, sphereArcs, true) setupMatList = gl.CreateList(SetupMaterial) resetMatList = gl.CreateList(ResetMaterial) backMatList = gl.CreateList(BackMaterial) frontMatList = gl.CreateList(FrontMaterial) atiFixMatList = gl.CreateList(AtiBugFixMaterial) shieldList = gl.CreateList(ShieldList) miniMapXformList = gl.CreateList(MiniMapXform) end function gadget:Shutdown() gl.DeleteList(sphereList) gl.DeleteList(negSphereList) gl.DeleteList(setupMatList) gl.DeleteList(resetMatList) gl.DeleteList(backMatList) gl.DeleteList(frontMatList) gl.DeleteList(shieldList) gl.DeleteList(miniMapXformList) end -------------------------------------------------------------------------------- -- UNSYNCED -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- COMMON -------------------------------------------------------------------------------- \ No newline at end of file +-- $Id: unit_cloak_shield.lua 3605 2008-12-31 08:50:31Z google frog $ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: unit_cloak_shield.lua +-- brief: adds a cloak-shield command to units +-- author: Dave Rodgers, modified by Evil4Zerggin +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "UnitCloakShield", + desc = "Adds a cloak-shield command to units", + author = "trepan, modified by Evil4Zerggin", + date = "May 02, 2007", --updated on 23 January 2014 + license = "GNU GPL, v2 or later", + layer = 1, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- FIXME: (TODO) +-- - wait for UnitFinished() before allowing cloak_shield? +-- - don't allow state changes during pauses (tied to the above) +-- +-------------------------------------------------------------------------------- + +include("LuaRules/Configs/customcmds.h.lua") +include("LuaRules/Configs/constants.lua") + +local SYNCSTR = "unit_cloak_shield" + + +-------------------------------------------------------------------------------- +-- COMMON +-------------------------------------------------------------------------------- +if (gadgetHandler:IsSyncedCode()) then +-------------------------------------------------------------------------------- +-- SYNCED +-------------------------------------------------------------------------------- + +-- +-- speed-ups +-- + +local GetUnitDefID = Spring.GetUnitDefID +local GetUnitSeparation = Spring.GetUnitSeparation +local SetUnitCloak = Spring.SetUnitCloak + +local FindUnitCmdDesc = Spring.FindUnitCmdDesc +local EditUnitCmdDesc = Spring.EditUnitCmdDesc + +local SetUnitRulesParam = Spring.SetUnitRulesParam +local GetUnitRulesParam = Spring.GetUnitRulesParam + + +-------------------------------------------------------------------------------- + +local cloakShieldDefs = {} +local uncloakableDefs = {} + +local cloakShieldUnits = {} -- make it global in Initialize() +local cloakers = {} +local cloakees = {} + +local cloakShieldCmdDesc = { + id = CMD_CLOAK_SHIELD, + type = CMDTYPE.ICON_MODE, + name = 'CloakShield', + cursor = 'CloakShield', -- add with LuaUI? + action = 'cloak_shield', + tooltip = 'Cloak Shield State: Sets whether the unit is cloaking', + params = {'0', 'Cloaker Off', 'Cloaker On' } +} + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function ValidateCloakShieldDefs(mds) + local newDefs = {} + for udName, def in pairs(mds) do + local ud = UnitDefNames[udName] + if (not ud) then + Spring.Log(gadget:GetInfo().name, LOG.WARNING, 'Bad cloakShield unit type: ' .. udName) + else + local newData = {} + newData.draw = def.draw or true + newData.init = def.init or false + newData.level = def.level or 2 + newData.delay = def.delay or 30 + newData.energy = def.energy or 0 + newData.minrad = def.minrad or 64 + newData.maxrad = def.maxrad or 256 + newData.growRate = def.growRate or 256 + newData.shrinkRate = def.shrinkRate or 256 + newData.selfCloak = def.selfCloak or false + newData.decloakDistance = def.decloakDistance or false + newData.radiusException = def.radiusException or {} + newData.isTransport = (ud.transportCapacity >= 1) + newDefs[ud.id] = newData + end + end + + -- print the table (alphabetically) +--[[ + local sorted = {} + for n, ud in pairs(UnitDefNames) do table.insert(sorted, {n, ud.id}) end + table.sort(sorted, function(a,b) return (a[1] < b[1]) end) + for _, name_id in ipairs(sorted) do + local nd = newDefs[ name_id[2] ] + if (nd) then + print('CloakShield ' .. name_id[1]) + print(' draw = ' .. tostring(nd.draw)) + print(' init = ' .. tostring(nd.init)) + print(' delay = ' .. tostring(nd.delay)) + print(' energy = ' .. tostring(nd.energy)) + print(' minrad = ' .. tostring(nd.minrad)) + print(' maxrad = ' .. tostring(nd.maxrad)) + print(' growRate = ' .. tostring(nd.growRate)) + print(' shrinkRate = ' .. tostring(nd.shrinkRate)) + print(' selfCloak = ' .. tostring(nd.selfCloak)) + print(' decloakDistance = ' .. tostring(nd.decloakDistance)) + end + end +--]] + + return newDefs +end + + +local function ValidateUncloakableDefs(unclks) + local newDefs = {} + for udName, data in pairs(unclks) do + local ud = UnitDefNames[udName] + if (not ud) then + Spring.Log(gadget:GetInfo().name, LOG.WARNING, 'Bad uncloakable unit type: ' .. udName) + else + newDefs[ud.id] = true +-- print('uncloakable: ' .. udName) + end + end + return newDefs +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function AddCloakShieldCmdDesc(unitID, cloakShieldDef) + cloakShieldCmdDesc.params[1] = (cloakShieldDef.init and '1') or '0' + local insertID = + FindUnitCmdDesc(unitID, CMD.CLOAK) or + FindUnitCmdDesc(unitID, CMD.ONOFF) or + FindUnitCmdDesc(unitID, CMD.TRAJECTORY) or + FindUnitCmdDesc(unitID, CMD.REPEAT) or + FindUnitCmdDesc(unitID, CMD.MOVE_STATE) or + FindUnitCmdDesc(unitID, CMD.FIRE_STATE) or + 123456 -- back of the pack + Spring.InsertUnitCmdDesc(unitID, insertID + 1, cloakShieldCmdDesc) +end + + +local function AddCloakShieldRulesParam(unitID, state) + SetUnitRulesParam(unitID, "cloak_shield", state and 2 or 0) +end + + +local function AddCloakShieldUnit(unitID, cloakShieldDef) + + AddCloakShieldCmdDesc(unitID, cloakShieldDef) + + local data = { + id = unitID, + def = cloakShieldDef, + draw = cloakShieldDef.draw, + radius = 0, + minrad = cloakShieldDef.minrad, + maxrad = cloakShieldDef.maxrad, + energy = cloakShieldDef.energy / TEAM_SLOWUPDATE_RATE, + isTransport = cloakShieldDef.isTransport, + unitRadius = Spring.GetUnitRadius(unitID), + + } + cloakShieldUnits[unitID] = data + + if (cloakShieldDef.init) then + data.want = true + cloakers[unitID] = data + end + + AddCloakShieldRulesParam(unitID, cloakShieldDef.init) +end + +local alliedTrueTable = {allied = true} +local function SetUnitCloakAndParam(unitID, level, decloakDistance) + local newRadius = decloakDistance + if level then + local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") + if cannotCloak ~= 1 then + local changeRadius = true + if cloakers[unitID] and cloakers[unitID].radius > 0 then + changeRadius = false + newRadius = 0 + end + SetUnitCloak(unitID, level, ((changeRadius and decloakDistance) or GetUnitRulesParam(unitID, "comm_decloak_distance") or false)) + end + else + local wantCloak = GetUnitRulesParam(unitID, "wantcloak") + if wantCloak == 1 then + local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") + if cannotCloak ~= 1 then + SetUnitCloak(unitID, 1, GetUnitRulesParam(unitID, "comm_decloak_distance") or false) + end + else + SetUnitCloak(unitID, 0, GetUnitRulesParam(unitID, "comm_decloak_distance") or false) + end + end + SetUnitRulesParam(unitID, "areacloaked", (level and 1) or 0, alliedTrueTable) + SetUnitRulesParam(unitID, "areacloaked_radius", (level and newRadius) or 0, alliedTrueTable) +end + +-------------------------------------------------------------------------------- + +function gadget:Initialize() + -- get the cloakShieldDefs + cloakShieldDefs, uncloakableDefs = include("LuaRules/Configs/cloak_shield_defs.lua") + + if (not cloakShieldDefs) then + gadgetHandler:RemoveGadget() + return + end + gadgetHandler:RegisterCMDID(CMD_CLOAK_SHIELD) + + cloakShieldDefs = ValidateCloakShieldDefs(cloakShieldDefs) + uncloakableDefs = ValidateUncloakableDefs(uncloakableDefs) + + -- add the CloakShield command to existing units + for _,unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = GetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end +end + +function gadget:Shutdown() + for _,unitID in ipairs(Spring.GetAllUnits()) do + SetUnitCloakAndParam(unitID, false) + + local ud = UnitDefs[GetUnitDefID(unitID)] + local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) + if (cmdDescID) then + Spring.RemoveUnitCmdDesc(unitID, cmdDescID) + end + end +end + +-------------------------------------------------------------------------------- + +function gadget:UnitCreated(unitID, unitDefID, unitTeam) + local cloakShieldDef = cloakShieldDefs[unitDefID] + if (not cloakShieldDef) then + return + end + AddCloakShieldUnit(unitID, cloakShieldDef) +end + + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + cloakShieldUnits[unitID] = nil + cloakers[unitID] = nil + cloakees[unitID] = nil +end + + +function gadget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) + local _,_,_,_,_,newAllyTeam = Spring.GetTeamInfo(teamID, false) + local _,_,_,_,_,oldAllyTeam = Spring.GetTeamInfo(oldTeamID, false) + + if (newAllyTeam ~= oldAllyTeam) then + if (cloakShieldUnits[unitID]) then + cloakShieldUnits[unitID].radius = 0 + end + cloakers[unitID] = nil + cloakees[unitID] = nil + SetUnitCloakAndParam(unitID, false) + local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) + if (cmdDescID) then + cloakShieldCmdDesc.params[1] = (state and '2') or '0' + EditUnitCmdDesc(unitID, cmdDescID, { params = cloakShieldCmdDesc.params }) + end + end +end + + +-------------------------------------------------------------------------------- + +local GetUnitAllyTeam = Spring.GetUnitAllyTeam +local GetUnitPosition = Spring.GetUnitPosition +local GetUnitsInSphere = Spring.GetUnitsInSphere + +local function UpdateCloakees(data) + local unitID = data.id + local radius = data.radius + local level = data.def.level + local selfCloak = data.def.selfCloak + local decloakDistance = data.def.decloakDistance + local radiusException = data.def.radiusException + local x, y, z = GetUnitPosition(unitID) + if (x == nil) then return end + local closeUnits = GetUnitsInSphere(x, y, z, radius) + if (closeUnits == nil) then return end + local allyTeam = GetUnitAllyTeam(unitID) + for _,cloakee in ipairs(closeUnits) do + local udid = GetUnitDefID(cloakee) + if ((not uncloakableDefs[udid]) and (not GetUnitRulesParam(cloakee, "comm_shield_id")) and (GetUnitAllyTeam(cloakee) == allyTeam)) then + if (cloakee ~= unitID) then + --other units + SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) + cloakees[cloakee] = true + elseif (selfCloak) then + --self cloak + SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) + cloakees[cloakee] = true + end + end + -- the GetUnitsInSphere() call uses unit midPos's, which can + -- differ from the unit's position while being transported. + -- here we do a direct check to see what units the cloakees are + -- transporting. this does not fix nested transports + if (UnitDefs[udid].transportCapacity >= 1) then + local transported = Spring.GetUnitIsTransporting(cloakee) + if transported ~= nil then + for _,cloakeeLvl2 in ipairs(transported) do + local udid = GetUnitDefID(cloakeeLvl2) + if ((not uncloakableDefs[udid]) and + (GetUnitAllyTeam(cloakeeLvl2) == allyTeam)) then + SetUnitCloakAndParam(cloakeeLvl2, 4, (not radiusException[udid]) and decloakDistance) + -- note: this gives perfect cloaking, but is the only level + -- to work under paralysis + cloakees[cloakeeLvl2] = true + end + end + end + end + end + --check if the cloaker is a transport + if (data.isTransport and (radius >= data.unitRadius)) then + local transported = Spring.GetUnitIsTransporting(unitID) + if transported ~= nil then + for _,cloakee in ipairs(transported) do + local udid = GetUnitDefID(cloakee) + if ((not uncloakableDefs[udid]) and + (GetUnitAllyTeam(cloakee) == allyTeam)) then + SetUnitCloakAndParam(cloakee, level, (not radiusException[udid]) and decloakDistance) + cloakees[cloakee] = true + end + end + end + end +end + + +local function GrowRadius(cloaker) + local r = cloaker.radius + local maxrad = cloaker.maxrad + if (r >= maxrad) then + r = maxrad + return r + end + r = (r * r) + cloaker.def.growRate + r = math.sqrt(r) + r = (r >= cloaker.maxrad) and cloaker.maxrad or r + cloaker.radius = r + Spring.SetUnitRulesParam(cloaker.id, "cloakerRadius", r) + + if (cloaker.draw) then + SendToUnsynced(SYNCSTR, cloaker.id, r) + end +end + + +local function ShrinkRadius(cloaker) + local r = cloaker.radius + if (r <= 0) then + cloaker.radius = 0 + return 0 + end + r = (r * r) - cloaker.def.shrinkRate + r = (r < 0) and 0 or math.sqrt(r) + cloaker.radius = r + Spring.SetUnitRulesParam(cloaker.id, "cloakerRadius", r) + if (cloaker.draw) then + SendToUnsynced(SYNCSTR, cloaker.id, r) + end + if ((r <= 0) and (not cloaker.want)) then + cloakers[cloaker.id] = nil + end +end + + +local GetUnitIsStunned = Spring.GetUnitIsStunned + +function gadget:GameFrame(frameNum) + local checkCloakees = ((frameNum % 6) < 1) + if (checkCloakees) then + for uid in pairs(cloakees) do + SetUnitCloakAndParam(uid, false) + end + cloakees = {} + end + + for unitID, data in pairs(cloakers) do + if (data.delay) then + data.delay = data.delay - 1 + if (data.delay <= 0) then + data.delay = nil + end + ShrinkRadius(data) + elseif (GetUnitIsStunned(unitID) or (Spring.GetUnitRulesParam(unitID, "disarmed") == 1) or (Spring.GetUnitRulesParam(unitID, "morphDisable") == 1)) then + ShrinkRadius(data) + elseif (not data.want) then + ShrinkRadius(data) + else + local newState = Spring.Utilities.GetUnitActiveState(unitID) and (GetUnitRulesParam(unitID, "forcedOff") ~= 1) + if (newState) then + GrowRadius(data) + else + ShrinkRadius(data) + end + + if (data.active ~= newState) then + data.active = newState + if (newState) then + SetUnitRulesParam(unitID, "cloak_shield", 2) + else + SetUnitRulesParam(unitID, "cloak_shield", 1) + data.delay = data.def.delay + end + end + end + + if (checkCloakees and (data.radius > 0)) then + UpdateCloakees(data) + end + end +end + +function gadget:Load(zip) + -- restore cloak shield for dyncomms + for _,unitID in ipairs(Spring.GetAllUnits()) do + if not cloakShieldUnits[unitID] then + local unitDefID = Spring.GetUnitDefID(unitID) + local cloakShieldDef = GG.Upgrades_UnitCloakShieldDef(unitID) + if cloakShieldDef then + local state = GetUnitRulesParam(unitID, "cloak_shield") + local radius = Spring.GetUnitRulesParam(unitID, "cloakerRadius") + local isOn = state ~= nil and state > 0 + + AddCloakShieldUnit(unitID, cloakShieldDef) + CloakShieldCommand(unitID, {isOn and 1 or 0}) + Spring.SetUnitRulesParam(unitID, "cloakerRadius", radius) + end + end + end + + for unitID, data in pairs(cloakers) do + local radius = Spring.GetUnitRulesParam(unitID, "cloakerRadius") or 0 + if radius > 0 then + data.radius = radius + if (data.draw) then + SendToUnsynced(SYNCSTR, data.id, radius) + end + UpdateCloakees(data) + end + end +end + +-------------------------------------------------------------------------------- + +function CloakShieldCommand(unitID, cmdParams) + if (type(cmdParams[1]) ~= 'number') then + return false + end + local data = cloakShieldUnits[unitID] + if (not data) then + return false + end + + local state = (cmdParams[1] == 1) + if (state) then + cloakers[unitID] = data + data.want = true + SetUnitRulesParam(unitID, "cloak_shield", 2) + else + data.want = false + SetUnitRulesParam(unitID, "cloak_shield", 0) + end + + local cmdDescID = FindUnitCmdDesc(unitID, CMD_CLOAK_SHIELD) + if (cmdDescID) then + cloakShieldCmdDesc.params[1] = (state and '1') or '0' + EditUnitCmdDesc(unitID, cmdDescID, { params = cloakShieldCmdDesc.params }) + end +end + + +function gadget:AllowCommand_GetWantedCommand() + return {[CMD_CLOAK_SHIELD] = true} +end + +function gadget:AllowCommand_GetWantedUnitDefID() + return true +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, + cmdID, cmdParams, cmdOptions) + if (cmdID ~= CMD_CLOAK_SHIELD) then + return true -- command was not used + end + CloakShieldCommand(unitID, cmdParams) + return false -- command was used +end + + +function gadget:CommandFallback(unitID, unitDefID, teamID, + cmdID, cmdParams, cmdOptions) + if (cmdID ~= CMD_CLOAK_SHIELD) then + return false -- command was not used + end + CloakShieldCommand(unitID, cmdParams) + return true, true -- command was used, remove it +end + + +-------------------------------------------------------------------------------- +-- SYNCED +-------------------------------------------------------------------------------- +else +-------------------------------------------------------------------------------- +-- UNSYNCED +-------------------------------------------------------------------------------- + +-- +-- speed-ups +-- + +local GetUnitTeam = Spring.GetUnitTeam +local GetUnitRadius = Spring.GetUnitRadius +local GetUnitHeading = Spring.GetUnitHeading +local GetUnitViewPosition = Spring.GetUnitViewPosition + +local GetGameFrame = Spring.GetGameFrame +local GetFrameTimeOffset = Spring.GetFrameTimeOffset + +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glTranslate = gl.Translate +local glRotate = gl.Rotate +local glScale = gl.Scale +local glCallList = gl.CallList + + +-------------------------------------------------------------------------------- + +local sphereDivs = 16 +local sphereArcs = 32 + +local drawUnits = {} + +local sphereList = 0 +local negSphereList = 0 + +local setupMatList = 0 +local resetMatList = 0 +local backMatList = 0 +local frontMatList = 0 +local atiFixMatList = 0 + +local shieldList = 0 + +local miniMapXformList = 0 + +local trans = {0.1, 0.28, 0.60 } + + +-------------------------------------------------------------------------------- + +local function SphereVertex(x, y, z, neg) + if (neg) then + gl.Normal(-x, -y, -z) + else + gl.Normal(x, y, z) + end + gl.Vertex(x, y, z) +end + + +local function DrawSphere(divs, arcs, neg) + local cos = math.cos + local sin = math.sin + local twoPI = (2.0 * math.pi) + local divRads = math.pi / divs + local minRad = sin(divRads) + + -- sides + for d = 4, (divs - 2) do + + if (d < 7) then + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, trans[d-3]}, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1 }, + shininess = 4 + }) + elseif (d > 10) then + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, trans[15-d]}, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1 }, + shininess = 4 + }) + else + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 1.0 }, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1.0 }, + shininess = 4 + }) + end + + gl.BeginEnd(GL.QUAD_STRIP, function() + local topRads = divRads * (d + 0) + local botRads = divRads * (d + 1) + local top = cos(topRads) + local bot = cos(botRads) + local topRad = sin(topRads) + local botRad = sin(botRads) + + for i = 0, arcs do + local a = i * (2.0 * math.pi) / arcs + SphereVertex(sin(a) * topRad, top, cos(a) * topRad, neg) + SphereVertex(sin(a) * botRad, bot, cos(a) * botRad, neg) + end + end) + end + + -- bottom + gl.BeginEnd(GL.TRIANGLE_FAN, function() + SphereVertex(0, -1, 0, neg) + for i = 0, arcs do + local a = -i * (2.0 * math.pi) / arcs + SphereVertex(sin(a) * minRad, -cos(divRads), cos(a) * minRad, neg) + end + end) + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 0.5 }, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1.0 }, + shininess = 4 + }) + -- lines + gl.LineWidth(2.0) + gl.BeginEnd(GL.LINES, function() + SphereVertex( 1, 0, 0); SphereVertex(-1, 0, 0) + SphereVertex(0, 1, 0); SphereVertex(0, -1, 0) + SphereVertex(0, 0, 1); SphereVertex(0, 0, -1) + end) + gl.LineWidth(1.0) + + -- points + -- FIXME ATIBUG gl.PointSize(10.0) + --[[gl.BeginEnd(GL.POINTS, function() + SphereVertex( 1, 0, 0) + SphereVertex(-1, 0, 0) + SphereVertex(0, 1, 0) + SphereVertex(0, -1, 0) + SphereVertex(0, 0, 1) + SphereVertex(0, 0, -1) + end)--]] + -- FIXME ATIBUG gl.PointSize(1.0) +end + + +-------------------------------------------------------------------------------- + +local function SetupMaterial() + gl.Color(0.1, 0.2, 0.3, 0.3) + gl.Blending(GL.SRC_ALPHA, GL.ONE) + gl.DepthTest(true) + gl.Lighting(true) + gl.ShadeModel(GL.FLAT) + gl.Fog(false) + gl.ClipPlane(1, 0, 1, 0, 0) -- invisible in water +end + + +local function ResetMaterial() + gl.ShadeModel(GL.SMOOTH) + gl.Lighting(false) + gl.DepthTest(false) + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.Fog(true) + gl.ClipPlane(1, false) -- invisible in water + gl.Color(1,1,1,1) +end + +local function BackMaterial() + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 0.5 }, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1.0 }, + shininess = 4 + }) +end + +local function FrontMaterial() + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 0.75 }, + emission = { 0.05, 0.10, 0.15 }, + specular = { 0.25, 0.75, 1.0 }, + shininess = 4 + }) +end + +local function AtiBugFixMaterial() + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 0 }, + emission = { 0, 0, 0 }, + specular = { 0, 0, 0 }, + shininess = 0 + }) +end + +local function ShieldList() + gl.Culling(GL.FRONT) + gl.CallList(backMatList) + glCallList(negSphereList) + + gl.Culling(GL.BACK) + gl.CallList(frontMatList) + glCallList(sphereList) + + gl.Culling(false) +end + + +local function MiniMapXform() + local mapX = Game.mapX * 512 + local mapY = Game.mapY * 512 + -- this will probably be a common display + -- list for widgets that use DrawInMiniMap() + gl.LoadIdentity() + gl.Translate(0, 1, 0) + gl.Scale(1 / mapX, 1 / mapY, 1) + gl.Rotate(90, 1, 0, 0) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +--[[ +local function getAlpha() + local frame = GetGameFrame() + GetFrameTimeOffset() + local alpha = (math.abs((frame % 128) - 64) / 64) + if (alpha < 0.5) then alpha = 0.5 end + return alpha +end +]]-- + +local function DrawShield(unitID, radius, degrees) + local x, y, z = GetUnitViewPosition(unitID, true) + if (x == nil) then + return + end + if (not Spring.IsSphereInView(x, y, z, math.abs(radius))) then + return + end + + glPushMatrix() + + glTranslate(x, y, z) + glScale(radius, radius, radius) + glRotate(degrees, 0, 1, 0) + + glCallList(shieldList) + + glPopMatrix() +end + +local GetSpectatingState = Spring.GetSpectatingState +local GetLocalAllyTeamID = Spring.GetLocalAllyTeamID +local IsUnitSelected = Spring.IsUnitSelected +local GetUnitAllyTeam = Spring.GetUnitAllyTeam +local DrawGroundCircle = gl.DrawGroundCircle + +function gadget:DrawWorld() + if (not next(drawUnits)) then + return + end + + local dt = GetFrameTimeOffset() + local frame = GetGameFrame() + GetFrameTimeOffset() + local degrees = frame % (360 * 2 * 3 * 5) + + local readAllyTeam = GetLocalAllyTeamID() + local _, fullView = GetSpectatingState() + + glCallList(setupMatList) + + for unitID, radius in pairs(drawUnits) do + if (fullView or (GetUnitAllyTeam(unitID) == readAllyTeam)) then + DrawShield(unitID, radius, degrees + unitID * 57) + end + end + + glCallList(resetMatList) + gl.Material({ + ambient = { 0, 0, 0 }, + diffuse = { 0, 0, 0, 0 }, + emission = { 0, 0, 0 }, + specular = { 0, 0, 0 }, + shininess = 0 + }) + --gl.CallList(atiFixMatList) +end + + +function gadget:DrawInMiniMap() + if (not next(drawUnits)) then + return + end + + gl.PushMatrix() + glCallList(miniMapXformList) + + local readAllyTeam = GetLocalAllyTeamID() + local _, fullView = GetSpectatingState() + + for unitID, radius in pairs(drawUnits) do + if (IsUnitSelected(unitID)) then + local x, y, z = GetUnitViewPosition(unitID, true) + if (x ~= nil) then + if (fullView or (GetUnitAllyTeam(unitID) == readAllyTeam)) then + DrawGroundCircle(x, y, z, radius, 64) + end + end + end + end + + gl.PopMatrix() +end + + +function gadget:UpdateFIXME() -- testing "cloak_shield" RulesParam + for _,unitID in ipairs(Spring.GetSelectedUnits()) do + print(unitID, Spring.GetUnitRulesParam(unitID, "cloak_shield")) + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function UnitUpdate(cmd, unitID, radius) + if (radius <= 0) then + drawUnits[unitID] = nil + else + drawUnits[unitID] = radius + end +end + +function gadget:UnitDestroyed(unitID) + UnitUpdate(0, unitID, 0) +end + +function gadget:Taken(unitID) + UnitUpdate(0, unitID, 0) +end + +function gadget:Initialize() + gadgetHandler:AddSyncAction(SYNCSTR, UnitUpdate) + sphereList = gl.CreateList(DrawSphere, sphereDivs, sphereArcs, false) + negSphereList = gl.CreateList(DrawSphere, sphereDivs, sphereArcs, true) + setupMatList = gl.CreateList(SetupMaterial) + resetMatList = gl.CreateList(ResetMaterial) + backMatList = gl.CreateList(BackMaterial) + frontMatList = gl.CreateList(FrontMaterial) + atiFixMatList = gl.CreateList(AtiBugFixMaterial) + shieldList = gl.CreateList(ShieldList) + miniMapXformList = gl.CreateList(MiniMapXform) +end + + +function gadget:Shutdown() + gl.DeleteList(sphereList) + gl.DeleteList(negSphereList) + gl.DeleteList(setupMatList) + gl.DeleteList(resetMatList) + gl.DeleteList(backMatList) + gl.DeleteList(frontMatList) + gl.DeleteList(shieldList) + gl.DeleteList(miniMapXformList) +end + + +-------------------------------------------------------------------------------- +-- UNSYNCED +-------------------------------------------------------------------------------- +end +-------------------------------------------------------------------------------- +-- COMMON +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/unit_cobbutton.lua b/LuaRules/Gadgets/unit_cobbutton.lua deleted file mode 100644 index 4bd24c3b1..000000000 --- a/LuaRules/Gadgets/unit_cobbutton.lua +++ /dev/null @@ -1,214 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (not gadgetHandler:IsSyncedCode()) then - return false -end - -function gadget:GetInfo() - return { - name = "CobButton", - desc = "Easy cob button Creation", - author = "quantum, Deadnight Warrior", - date = "June 28, 2008", - license = "GNU GPL, v2 or later", - layer = -10, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- Proposed Command ID Ranges: --- --- all negative: Engine (build commands) --- 0 - 999: Engine --- 1000 - 9999: Group AI --- 10000 - 19999: LuaUI --- 20000 - 29999: LuaCob --- 30000 - 39999: LuaRules --- - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Spring, ipairs, pairs = Spring, ipairs, pairs -local SetUnitRulesParam, GetUnitRulesParam = Spring.SetUnitRulesParam, Spring.GetUnitRulesParam -local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc -local spFindUnitCmdDesc = Spring.FindUnitCmdDesc -local spGetUnitCmdDescs = Spring.GetUnitCmdDescs -local spEditUnitCmdDesc = Spring.EditUnitCmdDesc -local spRemoveUnitCmdDesc = Spring.RemoveUnitCmdDesc -local spCallCOBScript = Spring.CallCOBScript -local spGetUnitDefID = Spring.GetUnitDefID -local format = string.format --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local reloads = {} - -local buttonDefs = VFS.Include"LuaRules/Configs/cob_buttons.lua" - -local buttons = {} -local buttonParams = {} -local cmdOffset = 0 -for unit, cmds in pairs(buttonDefs) do - for i, cmd in ipairs(cmds) do - cmd.id = 34520 + cmdOffset - cmdOffset = cmdOffset + 1 - buttons[cmd.id] = cmd - cmd.unit = unit - cmd.buttonIndex = i - cmd.name = cmd.name or cmd.cob - cmd.cmdDesc = { - id = cmd.id, - name = cmd.name or cmd.cob, - action = string.lower(cmd.name), - type = cmd.type or CMDTYPE.ICON, - tooltip = cmd.tooltip, - params = cmd.params, - } - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:Initialize() - for cmdID in pairs(buttons) do - gadgetHandler:RegisterCMDID(cmdID) - end - for _, unitID in ipairs(Spring.GetAllUnits()) do - gadget:UnitCreated(unitID, Spring.GetUnitDefID(unitID)) - end -end - - -function gadget:UnitCreated(unitID, unitDefID) - local name = UnitDefs[unitDefID].name - if (buttonDefs[name]) then - buttonParams[unitID] = {} - for i, button in ipairs(buttonDefs[name]) do - spInsertUnitCmdDesc(unitID, button.position or 500, button.cmdDesc) - if button.params then - buttonParams[unitID][button.id] = {} - for p=1, #button.params do - buttonParams[unitID][button.id][p] = button.params[p] - end - end - end - reloads[unitID] = {} - end -end - - -function gadget:Shutdown() - for _, unitID in ipairs(Spring.GetAllUnits()) do - for cmdID in pairs(buttons) do - local cmdDescID = spFindUnitCmdDesc(unitID, cmdID) - if (cmdDescID) then - spRemoveUnitCmdDesc(unitID, cmdDescID) - end - end - end -end - - -function gadget:GameFrame(n) - local s = n/30 - for unitID, unitButtons in pairs(reloads) do - local udfid = spGetUnitDefID(unitID) - if (udfid==nil) then - reloads[unitID] = nil - else - local unitName = UnitDefs[udfid].name - for buttonIndex, status in pairs(unitButtons) do - local reload = status[1] - local expired = status[2] - local cmd = buttonDefs[unitName][buttonIndex] - local cmdDescID = spFindUnitCmdDesc(unitID, cmd.id) - if (cmdDescID) then - local cmdArray - if (cmd.duration and s - reload > cmd.duration and s - reload < cmd.reload) then - if (cmd.endcob and not expired) then - spCallCOBScript(unitID, cmd.endcob, 0) - status[2] = true - end - local progress = (s-reload-cmd.duration) / (cmd.reload-cmd.duration) * 100 - local text = format("%d%%", progress) - cmdArray = {name = text, disabled = true} - elseif (s - reload < cmd.reload) then - local progress = (s-reload) / (cmd.duration) * 100 - local text = format("%d%%", progress) - cmdArray = {name = text, disabled = true} - else - if (not cmd.duration) then - spCallCOBScript(unitID, cmd.endcob, 0) - end - cmdArray = {name = cmd.name, disabled = false} - unitButtons[buttonIndex] = nil - end - spEditUnitCmdDesc(unitID, cmdDescID, cmdArray) - end - end - if (not next(unitButtons)) then - reloads[unitID] = nil - end - end - end -end - - -function gadget:UnitDestroyed(unitID) - reloads[unitID] = nil -end - - -function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) - if buttons[cmdID] then - local unitName = UnitDefs[unitDefID].name - if buttonDefs[unitName] then - local buttonDoesntExist = true -- if an unit has multiple cob buttons, check them all, not just the first one - for i=1, #buttonDefs[unitName] do - if buttons[cmdID].name==buttonDefs[unitName][i].name then - buttonDoesntExist = false - break - end - end - if buttonDoesntExist then - return true - end - local cmd = buttons[cmdID] - local cmdDescID = spFindUnitCmdDesc(unitID, cmdID) - if (cmd.reload) then - reloads[unitID] = reloads[unitID] or {} - if (not reloads[unitID][cmd.buttonIndex]) then - reloads[unitID][cmd.buttonIndex] = {Spring.GetGameSeconds()} - spCallCOBScript(unitID, cmd.cob, 0) - end - else - if (cmdDescID and buttonParams[unitID][cmdID]) then - local bp = buttonParams[unitID][cmdID] - bp[1] = cmdParams[1] - spCallCOBScript(unitID, cmd.cob, 0, cmdParams[1]) - spEditUnitCmdDesc(unitID, cmdDescID, {params=bp}) - else - spCallCOBScript(unitID, cmd.cob, 0) - end - end - return false -- command was used - end - end - return true -- command was not used -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Gadgets/unit_decloak_damaged.lua b/LuaRules/Gadgets/unit_decloak_damaged.lua index edd2caa1d..b6beb91f8 100644 --- a/LuaRules/Gadgets/unit_decloak_damaged.lua +++ b/LuaRules/Gadgets/unit_decloak_damaged.lua @@ -1 +1,334 @@ --------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "Decloak when damaged", desc = "Decloaks units when they are damged", author = "Google Frog", date = "Nov 25, 2009", -- Major rework 12 Feb 2014 license = "GNU GPL, v2 or later", layer = 0, enabled = false -- loaded by default? } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- include("LuaRules/Configs/customcmds.h.lua") local CMD_CLOAK = CMD.CLOAK local unitWantCloakCommandDesc = { id = CMD_WANT_CLOAK, type = CMDTYPE.ICON_MODE, name = 'Cloak State', action = 'wantcloak', tooltip = 'Unit cloaking state', params = {0, 'Decloaked', 'Cloaked'} } -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local alliedTrueTable = {allied = true} local Spring = Spring local spAreTeamsAllied = Spring.AreTeamsAllied local spSetUnitCloak = Spring.SetUnitCloak local spGetUnitIsCloaked = Spring.GetUnitIsCloaked local spGetUnitRulesParam = Spring.GetUnitRulesParam local spSetUnitRulesParam = Spring.SetUnitRulesParam local spGetUnitDefID = Spring.GetUnitDefID local spGetUnitIsDead = Spring.GetUnitIsDead if (not gadgetHandler:IsSyncedCode()) then return false -- silent removal end local recloakUnit = {} local recloakUnits = 0 local recloakUnitID = {} local noFFWeaponDefs = {} for i = 1, #WeaponDefs do local wd = WeaponDefs[i] if wd.customParams and wd.customParams.nofriendlyfire then noFFWeaponDefs[i] = true end end local DEFAULT_DECLOAK_TIME = 100 local cloakUnitDefID = {} for i = 1, #UnitDefs do local ud = UnitDefs[i] if ud.canCloak then cloakUnitDefID[i] = true end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function PokeDecloakUnit(unitID, duration) duration = duration or DEFAULT_DECLOAK_TIME if recloakUnitID[unitID] then recloakUnit[recloakUnitID[unitID]].frames = duration else --local cloak = Spring.GetUnitIsCloaked(unitID) spSetUnitRulesParam(unitID, "cannotcloak", 1, alliedTrueTable) spSetUnitCloak(unitID, 0) recloakUnits = recloakUnits + 1 recloakUnit[recloakUnits] = {id = unitID, frames = duration} recloakUnitID[unitID] = recloakUnits end end GG.PokeDecloakUnit = PokeDecloakUnit function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam) if damage > 0 and not (attackerTeam and weaponID and noFFWeaponDefs[weaponID] and attackerID ~= unitID and spAreTeamsAllied(unitTeam, attackerTeam)) then PokeDecloakUnit(unitID) end end function gadget:GameFrame(n) local i = 1 while i <= recloakUnits do recloakUnit[i].frames = recloakUnit[i].frames - 1 --spSetUnitCloak(recloakUnit[i].id, false) if recloakUnit[i].frames <= 0 then local unitID = recloakUnit[i].id local wantCloakState = spGetUnitRulesParam(unitID, "wantcloak") local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") spSetUnitRulesParam(unitID, "cannotcloak", 0, alliedTrueTable) if wantCloakState == 1 or areaCloaked == 1 then spSetUnitCloak(unitID, 1) end -- remove current unit and move last one to current position -- delete index recloakUnitID[recloakUnit[i].id] = nil -- do not to move if last element if i < recloakUnits then -- override recloakUnit[i] = recloakUnit[recloakUnits] -- update recloakUnitID for moved unit recloakUnitID[recloakUnit[i].id] = i end -- remove last recloakUnit[recloakUnits] = nil recloakUnits = recloakUnits - 1 else i = i + 1 end end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local function SetWantedCloaked(unitID, state) if (not unitID) or spGetUnitIsDead(unitID) then return end local wantCloakState = spGetUnitRulesParam(unitID, "wantcloak") local cmdDescID = Spring.FindUnitCmdDesc(unitID, CMD_WANT_CLOAK) if (cmdDescID) then Spring.EditUnitCmdDesc(unitID, cmdDescID, { params = {state, 'Decloaked', 'Cloaked'}}) end if state == 1 and wantCloakState ~= 1 then local cannotCloak = spGetUnitRulesParam(unitID, "cannotcloak") local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") if cannotCloak ~= 1 and areaCloaked ~= 1 then spSetUnitCloak(unitID, 1) end spSetUnitRulesParam(unitID, "wantcloak", 1, alliedTrueTable) elseif state == 0 and wantCloakState == 1 then local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") if areaCloaked ~= 1 then spSetUnitCloak(unitID, 0) end spSetUnitRulesParam(unitID, "wantcloak", 0, alliedTrueTable) end end GG.SetWantedCloaked = SetWantedCloaked function gadget:AllowCommand_GetWantedCommand() return {[CMD_CLOAK] = true, [CMD_WANT_CLOAK] = true} end function gadget:AllowCommand_GetWantedUnitDefID() return true end function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) if cmdID == CMD_WANT_CLOAK then if cloakUnitDefID[unitDefID] then SetWantedCloaked(unitID,cmdParams[1]) end return false elseif cmdID == CMD_CLOAK then return false end return true end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:UnitCreated(unitID, unitDefID) local ud = UnitDefs[unitDefID] if ud.canCloak then local cloakDescID = Spring.FindUnitCmdDesc(unitID, CMD_CLOAK) if cloakDescID then Spring.InsertUnitCmdDesc(unitID, unitWantCloakCommandDesc) Spring.RemoveUnitCmdDesc(unitID, cloakDescID) spSetUnitRulesParam(unitID, "wantcloak", 0, alliedTrueTable) if ud.customParams.initcloaked then SetWantedCloaked(unitID,1) end end end end function gadget:Initialize() for _, unitID in ipairs(Spring.GetAllUnits()) do local unitDefID = spGetUnitDefID(unitID) gadget:UnitCreated(unitID, unitDefID) end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Decloak when damaged", + desc = "Decloaks units when they are damged", + author = "Google Frog", + date = "Nov 25, 2009", -- Major rework 12 Feb 2014 + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +include("LuaRules/Configs/customcmds.h.lua") + +local CMD_CLOAK = CMD.CLOAK + +local unitWantCloakCommandDesc = { + id = CMD_WANT_CLOAK, + type = CMDTYPE.ICON_MODE, + name = 'Cloak State', + action = 'wantcloak', + tooltip = 'Unit cloaking state', + params = {0, 'Decloaked', 'Cloaked'} +} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +if (not gadgetHandler:IsSyncedCode()) then + return false -- silent removal +end + +local alliedTrueTable = {allied = true} + +local Spring = Spring +local spAreTeamsAllied = Spring.AreTeamsAllied + +local spSetUnitCloak = Spring.SetUnitCloak +local spGetUnitIsCloaked = Spring.GetUnitIsCloaked +local spGetUnitRulesParam = Spring.GetUnitRulesParam +local spSetUnitRulesParam = Spring.SetUnitRulesParam +local spGetUnitDefID = Spring.GetUnitDefID +local spGetUnitIsDead = Spring.GetUnitIsDead + +local recloakUnit = {} +local recloakFrame = {} + +local noFFWeaponDefs = {} +for i = 1, #WeaponDefs do + local wd = WeaponDefs[i] + if wd.customParams and wd.customParams.nofriendlyfire then + noFFWeaponDefs[i] = true + end +end + +local DEFAULT_DECLOAK_TIME = 60 +local UPDATE_FREQUENCY = 10 +local CLOAK_MOVE_THRESHOLD = math.sqrt(0.2) + +local currentFrame = 0 + +local cloakUnitDefID = {} +for i = 1, #UnitDefs do + local ud = UnitDefs[i] + if ud.canCloak and not ud.customParams.dynamic_comm then + cloakUnitDefID[i] = true + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Water handling + +local waterUnitCount = 0 +local waterUnitMap = {} +local waterUnits = {} +local waterUnitCloakBlocked = {} + +local function AddWaterUnit(unitID) + if waterUnitMap[unitID] then + return + end + waterUnitCount = waterUnitCount + 1 + waterUnitMap[unitID] = waterUnitCount + waterUnits[waterUnitCount] = unitID +end + +local function RemoveWaterUnit(unitID) + if not waterUnitMap[unitID] then + return + end + waterUnits[waterUnitMap[unitID]] = waterUnits[waterUnitCount] + waterUnitMap[waterUnits[waterUnitCount]] = waterUnitMap[unitID] + waterUnits[waterUnitCount] = nil + waterUnitMap[unitID] = nil + waterUnitCount = waterUnitCount - 1 + + waterUnitCloakBlocked[unitID] = nil +end + +function gadget:UnitEnteredWater(unitID) + AddWaterUnit(unitID) +end + +function gadget:UnitLeftWater(unitID) + RemoveWaterUnit(unitID) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function PokeDecloakUnit(unitID, duration) + if recloakUnit[unitID] then + recloakUnit[unitID] = duration or DEFAULT_DECLOAK_TIME + else + spSetUnitRulesParam(unitID, "cannotcloak", 1, alliedTrueTable) + spSetUnitCloak(unitID, 0) + recloakUnit[unitID] = duration or DEFAULT_DECLOAK_TIME + end + +end + +GG.PokeDecloakUnit = PokeDecloakUnit + +function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, + weaponID, attackerID, attackerDefID, attackerTeam) + if damage > 0 and + not (attackerTeam and + weaponID and + noFFWeaponDefs[weaponID] and + attackerID ~= unitID and + spAreTeamsAllied(unitTeam, attackerTeam)) then + PokeDecloakUnit(unitID) + end +end + +local function CheckWaterBlockCloak(unitID, pos) + local radius = Spring.GetUnitRadius(unitID) + if radius + pos < 0 then + if not waterUnitCloakBlocked[unitID] then + PokeDecloakUnit(unitID) + spSetUnitRulesParam(unitID, "cannotcloak", 1, alliedTrueTable) + waterUnitCloakBlocked[unitID] = true + end + return true + end + return false +end + +function gadget:GameFrame(n) + currentFrame = n + if n%UPDATE_FREQUENCY == 2 then + for unitID, frames in pairs(recloakUnit) do + if frames <= UPDATE_FREQUENCY then + if not ((spGetUnitRulesParam(unitID,"on_fire") == 1) or (spGetUnitRulesParam(unitID,"disarmed") == 1) or waterUnitCloakBlocked[unitID]) then + local wantCloakState = spGetUnitRulesParam(unitID, "wantcloak") + local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") + spSetUnitRulesParam(unitID, "cannotcloak", 0, alliedTrueTable) + if wantCloakState == 1 or areaCloaked == 1 then + spSetUnitCloak(unitID, 1) + end + recloakUnit[unitID] = nil + end + else + recloakUnit[unitID] = frames - UPDATE_FREQUENCY + end + end + + local i = 1 + while i <= waterUnitCount do + local unitID = waterUnits[i] + if Spring.ValidUnitID(unitID) then + local pos = select(5, Spring.GetUnitPosition(unitID, true)) + if pos < 0 then + if (not CheckWaterBlockCloak(unitID, pos)) and waterUnitCloakBlocked[unitID] then + spSetUnitRulesParam(unitID, "cannotcloak", 0, alliedTrueTable) + waterUnitCloakBlocked[unitID] = false + end + else + if waterUnitCloakBlocked[unitID] then + spSetUnitRulesParam(unitID, "cannotcloak", 0, alliedTrueTable) + waterUnitCloakBlocked[unitID] = false + end + end + i = i + 1 + else + RemoveWaterUnit(unitID) + end + end + end +end + +-- Only called with enemyID if an enemy is within decloak radius. +function gadget:AllowUnitCloak(unitID, enemyID) + if enemyID then + local transID = Spring.GetUnitTransporter(unitID) + if transID then + -- For some reason enemyID indicates that the unit is being transported. + return Spring.GetUnitIsCloaked(transID) + end + return false + end + + if recloakFrame[unitID] then + if recloakFrame[unitID] > currentFrame then + return false + end + recloakFrame[unitID] = nil + end + + local stunnedOrInbuild = Spring.GetUnitIsStunned(unitID) + if stunnedOrInbuild then + return false + end + + local unitDefID = unitID and Spring.GetUnitDefID(unitID) + local ud = unitDefID and UnitDefs[unitDefID] + if not ud then + return false + end + + local areaCloaked = (Spring.GetUnitRulesParam(unitID, "areacloaked") == 1) and ((Spring.GetUnitRulesParam(unitID, "cloak_shield") or 0) == 0) + if not areaCloaked then + local speed = select(4, Spring.GetUnitVelocity(unitID)) + local moving = speed and speed > CLOAK_MOVE_THRESHOLD + local cost = moving and ud.cloakCostMoving or ud.cloakCost + + if not Spring.UseUnitResource(unitID, "e", cost/2) then -- SlowUpdate happens twice a second. + return false + end + end + + return true +end + +function gadget:AllowUnitDecloak(unitID, objectID, weaponID) + recloakFrame[unitID] = currentFrame + DEFAULT_DECLOAK_TIME +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function SetWantedCloaked(unitID, state) + if (not unitID) or spGetUnitIsDead(unitID) then + return + end + + local wantCloakState = spGetUnitRulesParam(unitID, "wantcloak") + local cmdDescID = Spring.FindUnitCmdDesc(unitID, CMD_WANT_CLOAK) + if (cmdDescID) then + Spring.EditUnitCmdDesc(unitID, cmdDescID, { params = {state, 'Decloaked', 'Cloaked'}}) + end + + if state == 1 and wantCloakState ~= 1 then + local cannotCloak = spGetUnitRulesParam(unitID, "cannotcloak") + local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") + if cannotCloak ~= 1 and areaCloaked ~= 1 then + spSetUnitCloak(unitID, 1) + end + spSetUnitRulesParam(unitID, "wantcloak", 1, alliedTrueTable) + elseif state == 0 and wantCloakState == 1 then + local areaCloaked = spGetUnitRulesParam(unitID, "areacloaked") + if areaCloaked ~= 1 then + spSetUnitCloak(unitID, 0) + end + spSetUnitRulesParam(unitID, "wantcloak", 0, alliedTrueTable) + end +end + +GG.SetWantedCloaked = SetWantedCloaked + +function gadget:AllowCommand_GetWantedCommand() + return {[CMD_CLOAK] = true, [CMD_WANT_CLOAK] = true} +end + +function gadget:AllowCommand_GetWantedUnitDefID() + return true +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + if cmdID == CMD_WANT_CLOAK then + if cloakUnitDefID[unitDefID] then + SetWantedCloaked(unitID,cmdParams[1]) + end + return false + elseif cmdID == CMD_CLOAK then + return false + end + return true +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:UnitCreated(unitID, unitDefID) + local ud = UnitDefs[unitDefID] + if cloakUnitDefID[unitDefID] then + local cloakDescID = Spring.FindUnitCmdDesc(unitID, CMD_CLOAK) + if cloakDescID then + Spring.InsertUnitCmdDesc(unitID, unitWantCloakCommandDesc) + Spring.RemoveUnitCmdDesc(unitID, cloakDescID) + spSetUnitRulesParam(unitID, "wantcloak", 0, alliedTrueTable) + if ud.customParams.initcloaked then + SetWantedCloaked(unitID, 1) + end + return + end + elseif ud.customParams.dynamic_comm then + local cloakDescID = Spring.FindUnitCmdDesc(unitID, CMD_CLOAK) + if cloakDescID then + Spring.RemoveUnitCmdDesc(unitID, cloakDescID) + end + end +end + +function gadget:Initialize() + for _, unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = spGetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + local pos = select(2, Spring.GetUnitPosition(unitID)) + if pos <= 0 then + gadget:UnitEnteredWater(unitID) + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/unit_morph.lua b/LuaRules/Gadgets/unit_morph.lua index 985f98d3f..a4d04ea26 100644 --- a/LuaRules/Gadgets/unit_morph.lua +++ b/LuaRules/Gadgets/unit_morph.lua @@ -59,7 +59,7 @@ local echo = Spring.Echo local CMD_MORPH_STOP = 32410 local CMD_MORPH = 31410 - +local CMD_EZ_MORPH = 31337 -- accepts target unitDefID as optional 1st parameter (1st found morph if missing) local MAX_MORPH = 0 --// will increase dynamically -------------------------------------------------------------------------------- @@ -397,6 +397,13 @@ local function GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, un return tt end +local function MorphRequirementsFulfilled(unitID, morphDef, techLevel, unreachedTechs) + return morphDef.tech <= techLevel + and morphDef.rank <= GetUnitRank(unitID) + and morphDef.xp <= Spring.GetUnitExperience(unitID) + and #unreachedTechs == 0 +end + local function UpdateMorphReqs(teamID) local morphCmdDesc = {} @@ -413,8 +420,7 @@ local function UpdateMorphReqs(teamID) local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) if (cmdDescID) then local unreachedTechs = TechReqList(teamID, morphDef.require) - morphCmdDesc.disabled = (morphDef.tech > teamTech) or (morphDef.rank > unitRank) - or (morphDef.xp > unitXP) or (#unreachedTechs > 0) + morphCmdDesc.disabled = not MorphRequirementsFulfilled(unitID, morphDef, teamTech, unreachedTechs) if (morphCmdDesc.disabled) then morphCmdDesc.name = "\255\255\64\64"..morphDef.cmdname else @@ -496,11 +502,14 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - local function StartMorph(unitID, unitDefID, teamID, morphDef) -- do not allow morph for unfinsihed units - if not isFinished(unitID) then return true end + if not isFinished(unitID) + or not MorphRequirementsFulfilled(unitID, morphDef, teamTechLevel[teamID] or 0, TechReqList(teamID, morphDef.require)) + then + return true + end --Spring.SetUnitHealth(unitID, { paralyze = 1.0e9 }) --// turns mexes and mm off (paralyze the unit) Spring.SetUnitResourcing(unitID,"e",0) --// turns solars off @@ -749,7 +758,7 @@ function gadget:Initialize() table.insert(GG.UnitRanked, UnitRanked) --// get the morphDefs - morphDefs = include("LuaRules/Configs/morph_defs.lua") + morphDefs = include("gamedata/morph_defs.lua") --// MorphDefs can now be all defined in customParams (by MaDDoX) AddCustomMorphDefs() @@ -1051,9 +1060,38 @@ function gadget:GameFrame(n) end end +local function handleEzMorph(unitID, unitDefID, teamID, targetDefID) + local morphData = morphUnits[unitID] + if morphData then + return true, false + end + local morphSet = morphDefs[unitDefID] + if not morphSet then + return true, true + end + + local validMorphs = {} + for morphCmd, morphDef in pairs(morphSet) do + if (not targetDefID or morphDef.into == targetDefID) + and MorphRequirementsFulfilled(unitID, morphDef, teamTechLevel[teamID] or 0, TechReqList(teamID, morphDef.require)) then + validMorphs[#validMorphs+1] = morphDef + end + end + + if #validMorphs > 0 then + StartMorph(unitID, unitDefID, teamID, validMorphs[math.random(1, #validMorphs)]) + end + + return true, true +end + --// Allows or disallow the morph command button function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) local morphData = morphUnits[unitID] + if cmdID == CMD_EZ_MORPH and isFactory(unitDefID) then + handleEzMorph(unitID, unitDefID, teamID, cmdParams[1]) + return false + end if (morphData) then if (cmdID==morphData.def.stopCmd)or(cmdID == CMD.STOP) then if not Spring.GetUnitTransporter(unitID) then @@ -1092,8 +1130,10 @@ function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpt return true end - function gadget:CommandFallback(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + if cmdID == CMD_EZ_MORPH then + return handleEzMorph(unitID, unitDefID, teamID, cmdParams[1]) + end if (cmdID < CMD_MORPH or cmdID >= CMD_MORPH+MAX_MORPH) then return false --// command was not used end @@ -1320,6 +1360,7 @@ local function InitializeUnitShape(unitDefID,unitTeam) glPushMatrix() gl.ColorMask(false) + gl.Scale(1.002,1.002,1.002) glUnitShape(unitDefID, unitTeam) gl.ColorMask(true) glPopMatrix() @@ -1354,6 +1395,7 @@ local function DrawMorphUnit(unitID, morphData, localTeamID) glPushMatrix() glTranslate(px, py, pz) glRotate(angle, 0, 1, 0) + gl.Scale(1.002,1.002,1.002) glUnitShape(morphData.def.into, unitTeam) glPopMatrix() diff --git a/LuaRules/Gadgets/unit_nofriendlyfire.lua b/LuaRules/Gadgets/unit_nofriendlyfire.lua index 2554b3c1e..5bb4baf5b 100644 --- a/LuaRules/Gadgets/unit_nofriendlyfire.lua +++ b/LuaRules/Gadgets/unit_nofriendlyfire.lua @@ -9,7 +9,7 @@ function gadget:GetInfo() author = "quantum", date = "June 24, 2008", license = "GNU GPL, v2 or later", - layer = 0, + layer = -999, enabled = true -- loaded by default? } end @@ -21,31 +21,114 @@ if (not gadgetHandler:IsSyncedCode()) then return false -- silent removal end +local wantedWeaponList = {} + +local noFFWeaponDefs = {} + +--[[ Units can die before their projectiles hit, so to know whether a damage instance is friendly fire + we need to read the teamID from the projectile. But again: projectiles with slow explosions can be + cleaned up before the explosion finishes. Fortunately the old projectileID is still passed to the + UnitPreDamaged callin which makes it possible to cache these values in ProjectileCreated and only + remove them after the explosion is sure to have dissipated. ]] + +local haxMAX_EXPLOSION_DURATION = 128 -- frames; magic value from engine source +local haxWeapons = {} -- [weaponDefID] = true +local haxProjectiles = {} -- [projID] = teamID +local haxCleanupNow, haxCleanupNowCount = {}, 0 -- { [index] = projID } +local haxCleanupNext, haxCleanupNextCount = {}, 0 + +for wdid = 1, #WeaponDefs do + local wdcp = WeaponDefs[wdid].customParams + if wdcp and wdcp.nofriendlyfire then + noFFWeaponDefs[wdid] = true + wantedWeaponList[#wantedWeaponList + 1] = wdid + + if wdcp.nofriendlyfire == "needs hax" then + haxWeapons[wdid] = true + if Script.SetWatchProjectile then + Script.SetWatchProjectile(wdid, true) + else + Script.SetWatchWeapon(wdid, true) + end + end + end +end + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Automatically generated local definitions -local spAreTeamsAllied = Spring.AreTeamsAllied -local spGetUnitHealth = Spring.GetUnitHealth -local spSetUnitHealth = Spring.SetUnitHealth +local spAreTeamsAllied = Spring.AreTeamsAllied +local spGetProjectileTeamID = Spring.GetProjectileTeamID +local spGetUnitHealth = Spring.GetUnitHealth +local spSetUnitHealth = Spring.SetUnitHealth + +local DefensiveManeuverDefs = { + [UnitDefNames["esolar2"].id] = true +} -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +function gadget:ProjectileCreated(projID, unitID, weaponDefID) + if not haxWeapons[weaponDefID] then + return + end + haxProjectiles[projID] = spGetProjectileTeamID(projID) +end + +function gadget:ProjectileDestroyed(projID) + if not haxProjectiles[projID] then + return + end + + -- cannot cleanup immediately since the whole point is to + -- access data after projectile has been cleaned up by engine + haxCleanupNextCount = haxCleanupNextCount + 1 + haxCleanupNext[haxCleanupNextCount] = projID +end + +function gadget:GameFrame(n) + if n % haxMAX_EXPLOSION_DURATION ~= 0 then + return + end + + for i = 1, haxCleanupNowCount do + haxProjectiles[haxCleanupNow[i]] = nil + end + + local temp = haxCleanupNow + haxCleanupNow = haxCleanupNext + haxCleanupNext = temp + haxCleanupNowCount = haxCleanupNextCount + haxCleanupNextCount = 0 +end + +function gadget:UnitPreDamaged_GetWantedWeaponDef() + return wantedWeaponList +end function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, - projID, weaponID, attackerID, attackerDefID, attackerTeam) - if (attackerDefID and - UnitDefs[attackerDefID] and - UnitDefs[attackerDefID].customParams and - UnitDefs[attackerDefID].customParams.nofriendlyfire and - attackerID ~= unitID and - spAreTeamsAllied(unitTeam, attackerTeam)) then - return 0 - end - return damage + weaponID, attackerID, attackerDefID, attackerTeam, projectileID) + if weaponID and noFFWeaponDefs[weaponID] then + attackerTeam = attackerTeam or haxProjectiles[projectileID] + if not attackerTeam then + --Spring.Echo(" OUTLAWFHTAGN ") -- some unique string I can search infologs for to track the bug's existence (too trivial for LUA_ERRRUN) + attackerTeam = unitTeam + end + if attackerID ~= unitID and spAreTeamsAllied(unitTeam, attackerTeam) then + return 0, 0 + elseif unitDefID and DefensiveManeuverDefs[unitDefID] then + local env = Spring.UnitScript.GetScriptEnv(unitID) + if env then + Spring.UnitScript.CallAsUnit(unitID,env.HitByWeaponGadget) + end + end + end + + return damage end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/unit_plane_stop.lua b/LuaRules/Gadgets/unit_plane_stop.lua new file mode 100644 index 000000000..cf9cd127c --- /dev/null +++ b/LuaRules/Gadgets/unit_plane_stop.lua @@ -0,0 +1,259 @@ +function gadget:GetInfo() + return { + name = "Plane Stop", + desc = "Fighters and Bombers set to flight mode freeze mid-air when stopped", + author = "MaDDoX", + date = "6 Dec 2019", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +if (not gadgetHandler:IsSyncedCode()) then + return +end + +VFS.Include("gamedata/taptools.lua") + +local EditUnitCmdDesc = Spring.EditUnitCmdDesc +local spFindUnitCmdDesc = Spring.FindUnitCmdDesc +local spGetUnitCmdDescs = Spring.GetUnitCmdDescs +local spGetUnitDefID = Spring.GetUnitDefID +local InsertUnitCmdDesc = Spring.InsertUnitCmdDesc +local GiveOrderToUnit = Spring.GiveOrderToUnit +local SetUnitNeutral = Spring.SetUnitNeutral + +local trackedUnits = { + -- [UnitDefNames["armfig"].id] = true, + -- [UnitDefNames["corveng"].id] = true, + -- [UnitDefNames["armthund"].id] = true, + -- [UnitDefNames["corshad"].id] = true, + -- [UnitDefNames["armhawk"].id] = true, + -- [UnitDefNames["corvamp"].id] = true, + -- [UnitDefNames["armpnix"].id] = true, + -- [UnitDefNames["armaap"].id] = true, + -- [UnitDefNames["armplat"].id] = true +} + +local planes = {} +local planesToPause, pausedPlanes, planesToUnpause = {}, {}, {} +local planeDestinations = {} + +local CMD_STOP = CMD.STOP +local CMD_MOVE = CMD.MOVE +local CMD_IDLEMODE = CMD.IDLEMODE + +--TODO: Check if spawning (by group) fires UnitFinished, if not enable this +--function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID) +--end + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + planes[unitID] = nil +end + +function gadget:UnitFinished(unitID, unitDefID, unitTeam) + if trackedUnits[unitDefID] then + local uDefID = spGetUnitDefID(unitID) + local uDef = UnitDefs[uDefID] + planes[unitID] = uDef + Spring.Echo("Alt: "..tostring(uDef.wantedHeight)) + --GiveOrderToUnit(unitID, CMD.IDLEMODE, { planes[builderID].landAt }, { }) + end +end + +local function isSetToFly(unitID) + local cmdIdleModeId = spFindUnitCmdDesc(unitID, CMD_IDLEMODE) + if not cmdIdleModeId then + return false end + local cmdIdleModeDesc = spGetUnitCmdDescs(unitID, cmdIdleModeId, cmdIdleModeId)[1] + if istable(cmdIdleModeDesc.params) then + return cmdIdleModeDesc.params[1] == "0" -- If equal "0" ==> Fly + else + return false end +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + local planeuDefID = planes[unitID] + if planeuDefID then + --DebugTable(cmdOptions) + if cmdID == CMD_MOVE then + --for i = 1, #cmdParams do + -- Spring.Echo(" param "..i..": "..cmdParams[i]) + --end + planeDestinations[unitID] = { x = cmdParams[1], y = cmdParams[2], z = cmdParams[3]} + end + if cmdID == CMD_STOP and not cmdOptions.shift then --TODO: And flyState == fly + if isSetToFly(unitID) and not pausedPlanes[unitID] then + local x, y, z = Spring.GetUnitPosition(unitID) + local velx, vely, velz= Spring.GetUnitVelocity(unitID) + planesToPause[unitID] = { wantedHeight = planeuDefID.wantedHeight, + targetPos = { x = x, y = y, z = z }, + sourceVel = { x = velx, y = vely, z = velz } + } + else + if pausedPlanes[unitID] then + planesToUnpause[unitID] = planeuDefID end + end + else + if pausedPlanes[unitID] then + planesToUnpause[unitID] = planeuDefID end + end + end + return true +end + +local function sign(num) + return num/math.abs(num) +end + +function gadget:GameFrame(f) + --if f%20 > 0.001 then + -- return end + for unitID, data in pairs(planesToPause) do + --planesToPause[unitID] = nil + --Spring.Echo("Pausing Plane: "..tostring(unitID)) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxAcc", 0) + -- Spring.MoveCtrl.SetAirMoveTypeData(unitID, "myGravity", 0) + --local x,y,z=Spring.GetUnitVectors(unitID) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxPitch", 0) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxElevator", 0) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxRudder", 0) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxAileron", 0) + local posx, posy, posz = Spring.GetUnitPosition(unitID) + -- local velx, vely, velz= Spring.GetUnitVelocity(unitID) + -- local currentAlt = posy - Spring.GetGroundHeight(posx, posz) + local relativeHeight = Spring.GetGroundHeight(posx, posz) + data.wantedHeight + -- Spring.SetUnitVelocity(unitID, 0, vely + sign(wantedAlt - currentAlt), 0) + --Spring.SetUnitVelocity(unitID, math.random(-0.5,0.5), 0, math.random(-0.5,0.5)) + --Spring.SetUnitVelocity(unitID, 0, 0, 0) + --local dirx, diry, dirz = Spring.GetUnitDirection(unitID) + --local h = math.asin(-dirx / math.sqrt(dirx*dirx + dirz*dirz)) + --local rotx, roty, rotz = Spring.GetUnitRotation(unitID) + local targetRotY = roty + local dest = planeDestinations[unitID] + if dest then + --rotx = math.deg(math.atan2(px, pz)) + --roty = math.deg(math.atan2(px, pz)) + --rotz = math.deg(math.atan2(py, px)) + --local dirx, dirz = dest.x - posx, dest.z - posz + -- --targetRotY = math.asin(-dirx / math.sqrt(dirx*dirx + dirz*dirz)) + --targetRotY = math.atan2(dirz, dirx) --|| todeg => * 180 / math.pi + --targetRotY = math.max(-2.5, (math.min(2.5, targetRotY))) + --Spring.Echo("rot Y: "..dy.." target rot Y: "..py) + local rx, ry, rz = Spring.GetUnitRotation(unitID) -- source Direction + local px, py, pz = dest.x - posx, dest.y - posy, dest.z - posz + Spring.SetUnitDirection(unitID, px, py, pz) -- apply target Direction + local trx, try, trz = Spring.GetUnitRotation(unitID) -- read back target Rotation + Spring.SetUnitRotation(unitID, lerp(rx, trx, 0.1), lerp(ry, try, 0.1), lerp(rz, trz, 0.1)) + end + --Spring.SetUnitRotation(unitID, 0, targetRotY, 0) + --Spring.SetUnitRotation(unitID, rotx, roty, rotz) + --Spring.SetUnitRotation(unitID, lerp(rotx, 0, 0.1), + -- --roty, + -- lerp(roty, targetRotY, 0.1), + -- lerp(rotz, 0, 0.1)) + + Spring.MoveCtrl.Enable(unitID) + Spring.MoveCtrl.SetPosition(unitID, lerp(posx, data.targetPos.x + data.sourceVel.x * 10, 0.1), + lerp(posy, relativeHeight, 0.025), + lerp(posz, data.targetPos.z + data.sourceVel.z * 10, 0.1)) + + ----if math.abs(currentAlt - wantedAlt) > 10 then + ---- --Spring.SetUnitVelocity(unitID, velx, vely +sign(wantedAlt - currentAlt), velz) + ----end + -- + --if diry > 0 then + --end + pausedPlanes[unitID] = true + end + for unitID, uDef in pairs(planesToUnpause) do + Spring.MoveCtrl.Disable(unitID) + planesToPause[unitID] = nil + planesToUnpause[unitID] = nil + pausedPlanes[unitID] = nil + + Spring.Echo("Unpausing Plane: "..tostring(unitID)) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "maxAcc", uDef.maxAcc) + --Spring.MoveCtrl.SetAirMoveTypeData(unitID, "myGravity", uDef.myGravity) + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +--function gadget:GetInfo() +-- return { +-- name = "Zeppelin Physics", +-- desc = "Forces Zeppelin-type units to obey their cruisealt and prevents them from pitching", +-- author = "Ð�нархид", +-- date = "2.2.2009", +-- license = "None", +-- layer = 50, +-- enabled = true +-- } +--end + +zeppelinuDefs ={} +zeppelin={} + +--SYNCED +--if (gadgetHandler:IsSyncedCode()) then +-- +-- function gadget:Initialize() +-- for id,unitDef in pairs(UnitDefs) do +-- if unitDef.myGravity == 0 and +-- unitDef.maxElevator == 0 then +-- Spring.Echo(unitDef.name.." is a zeppelin with cruisealt "..unitDef.wantedHeight) +-- zeppelinuDefs[id]={ +-- pitch=unitDef.maxPitch, +-- alt=unitDef.wantedHeight, +-- name= unitDef.name, +-- } +-- end +-- end +-- end +-- +-- function gadget:UnitCreated(UnitID, whatever) +-- local uDefID = Spring.GetUnitDefID(UnitID); +-- if zeppelinuDefs[uDefID] then +-- zeppelin[UnitID]= uDefID +-- end +-- end +-- +-- function gadget:UnitDestroyed(UnitID, whatever) +-- local uDefID = Spring.GetUnitDefID(UnitID); +-- if zeppelinuDefs[uDefID] then +-- zeppelin[UnitID]=nil +-- end +-- end +-- +-- local function sign(num) +-- return num/math.abs(num) +-- end +-- +-- function gadget:GameFrame(f) +-- if f%20<1 then +-- for unitID, uDefID in pairs(zeppelin) do +-- local x,y,z=Spring.GetUnitVectors(unitID) +-- local ux, uy, uz= Spring.GetUnitPosition(unitID) +-- local vx, vy, vz= Spring.GetUnitVelocity(unitID) +-- local dirx, diry, dirz = Spring.GetUnitDirection(unitID) +-- local altitude = uy - Spring.GetGroundHeight(ux,uz) +-- local wanted= zeppelinuDefs[uDefID].alt +-- if math.abs(altitude-wanted)>10 then +-- Spring.SetUnitVelocity(unitID, vx, vy+sign(wanted-altitude), vz) +-- end +-- +-- if diry>0 then +-- local h = math.asin(-dirx / math.sqrt(dirx*dirx + dirz*dirz)) +-- Spring.SetUnitRotation(unitID,0,h,0) +-- end +-- end--for +-- end--iff +-- end--fn +-- +--end--sync \ No newline at end of file diff --git a/LuaRules/Gadgets/unit_scaler.lua b/LuaRules/Gadgets/unit_scaler.lua new file mode 100644 index 000000000..3966c616b --- /dev/null +++ b/LuaRules/Gadgets/unit_scaler.lua @@ -0,0 +1,154 @@ +function gadget:GetInfo() + return { + name = "Unit Scaler", + desc = "", + author = "Floris", + date = "March 2019", + license = "GNU LGPL, v2.1 or later", + layer = 0, + enabled = false + } +end + + +if (not gadgetHandler:IsSyncedCode()) then + + local unitScalesUnaffected = true -- exclude units defined in unitScales from additional scalings + local unitScales = { + } + local scales = { + global = 0.75, + --mobile = 1, + --building = 1, + --t1 = 0.95, + --t2 = 1.1, + --t3 = 1.4, + --kbot = 0.9, + --vehicle = 1, + --ship = 1, + --air = 1, + --hover = 1, + } + + --local modCategoryScale = { + --weapon = 0.5 + --} + + + + local spurSetUnitLuaDraw = Spring.UnitRendering.SetUnitLuaDraw + local spGetUnitDefID = Spring.GetUnitDefID + local spGetUnitTeam = Spring.GetUnitTeam + local glScale = gl.Scale + + local udefScale ={} + + local function init() + for udID, ud in pairs(UnitDefs) do + -- only ARM and COR + --if string.sub(ud.name, 1, 3) == 'Outer_Colonies' then + if not unitScales[udID] or not unitScalesUnaffected then + local scale = scales.global or 1 + if scales.building and ud.isBuilding then + scale = scale * scales.building + end + if scales.mobile and not ud.isBuilding then + scale = scale * scales.mobile + end + if ud.customParams and ud.customParams.techlevel then + if scales.t3 and ud.customParams.techlevel == '3' then + scale = scale * scales.t3 + end + if scales.t2 and ud.customParams.techlevel == '2' then + scale = scale * scales.t2 + end + elseif scales.t1 then + scale = scale * scales.t1 + end + if scales.kbot and ud.modCategories.kbot then + scale = scale * scales.kbot + end + if scales.vehicle and ud.modCategories.tank then + scale = scale * scales.vehicle + end + if scales.ship and ud.modCategories.ship then + scale = scale * scales.ship + end + if scales.hover and ud.modCategories.hover then + scale = scale * scales.hover + end + if scales.air and ud.modCategories.vtol then + scale = scale * scales.air + end + if modCategoryScale then + for cat1, cat in pairs(ud.modCategories) do + if modCategoryScale[cat1] then + scale = scale * modCategoryScale[cat1] + end + end + end + if scale ~= 1 then + udefScale[udID] = scale * (unitScales[udID] and unitScales[udID] or 1) + end + else + udefScale[udID] = unitScales[udID] + end + --end + end + end + init() + + + local separator = ';' + local function import() + + end + + + local function export() + + end + + + function gadget:UnitCreated(unitID, unitDefID, team) + if udefScale[unitDefID] then + spurSetUnitLuaDraw(unitID, true) + end + end + + function gadget:Initialize() + + local allUnits = Spring.GetAllUnits() + for i = 1, #allUnits do + local unitID = allUnits[i] + local udID = spGetUnitDefID(unitID) + local team = spGetUnitTeam(unitID) + if not udefScale[udID] then + udefScale[udID] = 1 + end + gadget:UnitCreated(unitID, udID, team) + end + end + + function gadget:DrawUnit(unitID, drawMode) + local udefID = Spring.GetUnitDefID(unitID) + if udefScale[udefID] then + glScale( udefScale[udefID], udefScale[udefID], udefScale[udefID] ) + return false + end + end + + function gadget:Initialize() + gadgetHandler:AddChatAction('scale', scalercmd, "") + end + + function gadget:Shutdown() + gadgetHandler:RemoveChatAction('scale') + end + + function scalercmd(_,line, words, playerID) + if not Spring.IsCheatingEnabled() or playerID ~= Spring.GetMyPlayerID() then return end + + end + +end diff --git a/LuaRules/Gadgets/unit_supply_requirement.lua b/LuaRules/Gadgets/unit_supply_requirement.lua index c8acc2ff0..7d201c50b 100644 --- a/LuaRules/Gadgets/unit_supply_requirement.lua +++ b/LuaRules/Gadgets/unit_supply_requirement.lua @@ -1,10 +1,9 @@ - function gadget:GetInfo() return { name = "Supply Requirement", desc = "Implements a single supply for each team. Uses supply_cost and supply_granted.", - author = "GoogleFrog", - date = "Novemember 11 2013", + author = "GoogleFrog, modified by CommonPlayer", + date = "Novemember 11 2013", --modified by CommonPlayer, Oct 2018 license = "GNU GPL, v2 or later", layer = 0, enabled = true -- loaded by default? @@ -28,14 +27,18 @@ local spGetUnitDefID = Spring.GetUnitDefID local spFindUnitCmdDesc = Spring.FindUnitCmdDesc local spEditUnitCmdDesc = Spring.EditUnitCmdDesc local spGetUnitIsStunned = Spring.GetUnitIsStunned +local spGetUnitTeam = Spring.GetUnitTeam local spSetTeamRulesParam = Spring.SetTeamRulesParam +local teamList = Spring.GetTeamList() +local PRIVATE = {private = true} + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Configuration -local SUPPLY_CAP = tonumber(Spring.GetModOptions().supplycap) or 400 -local INTRINSIC_SUPPLY = tonumber(Spring.GetModOptions().intrinsicsupply) or 0 +local SUPPLY_CAP = tonumber(Spring.GetModOptions().supplycap) or 1000000 -- !!!SREMEMBER TO CHANGE THIS SETTING IN gui_resourceBar.lua !!! +local INTRINSIC_SUPPLY = tonumber(Spring.GetModOptions().intrinsicsupply) or 10 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -71,53 +74,25 @@ local maxSupply = {} -- This ignores SUPPLY_CAP for convinience local maxSupplyWithCap = {} local currentSupply = {} +local isTeamSupplyBlocked = {} + local lockedUnitsArray = {} -- by teamID then unitDefID -- Only finished units grant supply, keep track of it here. local grantingSupply = {} -- by teamID then unitID local costingSupply = {} --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Utility functions for modifying commands and blocking construction. - -function EnableUnit(unitDefID, teamID) - spSetTeamRulesParam(teamID, "disallowed_" .. unitDefID, 0, {private = true}) -end - -function DisableUnit(unitDefID, teamID) - spSetTeamRulesParam(teamID, "disallowed_" .. unitDefID, 1, {private = true}) -end - -local function NewUnitIsAllowed(unitDefID, teamID) - if costUnitDefID[unitDefID] then - return not lockedUnitsArray[teamID][unitDefID] - end - return true -end - --- Do not block commands because that would make the UI stupid ---function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpts) --- return cmdID > 0 or cmdOpts.right or NewUnitIsAllowed(-cmdID, teamID) ---end - --- Block unit creation -function gadget:AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z) - return NewUnitIsAllowed(unitDefID, builderTeam) -end - --- Block unit transfer -function gadget:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) - return NewUnitIsAllowed(unitDefID, newTeam) -end +-- by unitID, if supply cost is not paid for build progress is locked +-- 0 = supply blocked; 1 = paid for +local paidFor = {} -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Handle updates to supply. local function updateIncreaseSupplyGap(teamID) - spSetTeamRulesParam(teamID, "supplyUsed", currentSupply[teamID], {private = true}) - spSetTeamRulesParam(teamID, "supplyMax", maxSupplyWithCap[teamID], {private = true}) + spSetTeamRulesParam(teamID, "supplyUsed", currentSupply[teamID], PRIVATE) + spSetTeamRulesParam(teamID, "supplyMax", maxSupplyWithCap[teamID], PRIVATE) local supplyGap = maxSupplyWithCap[teamID] - currentSupply[teamID] local lockedArray = lockedUnitsArray[teamID] @@ -128,14 +103,14 @@ local function updateIncreaseSupplyGap(teamID) end if supplyGap >= costUnitDefID[unitDefID] then lockedArray[unitDefID] = false - EnableUnit(unitDefID, teamID) + --EnableUnit(unitDefID, teamID) end end end local function updateDecreaseSupplyGap(teamID) - spSetTeamRulesParam(teamID, "supplyUsed", currentSupply[teamID], {private = true}) - spSetTeamRulesParam(teamID, "supplyMax", maxSupplyWithCap[teamID], {private = true}) + spSetTeamRulesParam(teamID, "supplyUsed", currentSupply[teamID], PRIVATE) + spSetTeamRulesParam(teamID, "supplyMax", maxSupplyWithCap[teamID], PRIVATE) local supplyGap = maxSupplyWithCap[teamID] - currentSupply[teamID] local lockedArray = lockedUnitsArray[teamID] @@ -146,7 +121,7 @@ local function updateDecreaseSupplyGap(teamID) end if supplyGap < costUnitDefID[unitDefID] then lockedArray[unitDefID] = true - DisableUnit(unitDefID, teamID) + --DisableUnit(unitDefID, teamID) end end end @@ -188,6 +163,65 @@ local function RemoveSupplyFromUnit(unitID, unitDefID, teamID, justTurnedIntoNan end end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Utility functions for modifying commands and blocking construction. + +--[[function EnableUnit(unitDefID, teamID) + spSetTeamRulesParam(teamID, "disallowed_" .. unitDefID, 0, {private = true}) +end +function DisableUnit(unitDefID, teamID) + spSetTeamRulesParam(teamID, "disallowed_" .. unitDefID, 1, {private = true}) +end]] + +local function NewUnitIsAllowed(unitDefID, teamID) + if costUnitDefID[unitDefID] then + return not lockedUnitsArray[teamID][unitDefID] + end + return true +end + +-- Do not block commands because that would make the UI stupid +--function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpts) +-- return cmdID > 0 or cmdOpts.right or NewUnitIsAllowed(-cmdID, teamID) +--end + +local function AddSupplyBlockedCounter(teamID) + isTeamSupplyBlocked[teamID] = isTeamSupplyBlocked[teamID] + 1 + if isTeamSupplyBlocked[teamID] == 1 then spSetTeamRulesParam(teamID, "supply_blocked", 1, PRIVATE) end +end +local function SubtractSupplyBlockedCounter(teamID) + isTeamSupplyBlocked[teamID] = isTeamSupplyBlocked[teamID] - 1 + if isTeamSupplyBlocked[teamID] == 0 then spSetTeamRulesParam(teamID, "supply_blocked", nil, PRIVATE) end +end + +function gadget:AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) + if part <= 0 or not costUnitDefID[unitDefID] or paidFor[unitID] == 1 then return true end + + local teamID = spGetUnitTeam(unitID) + if NewUnitIsAllowed(unitDefID, teamID) then + AddSupplyFromUnit(unitID, unitDefID, teamID, true) + if paidFor[unitID] == 0 then SubtractSupplyBlockedCounter(teamID) end + paidFor[unitID] = 1 + return true + end + if not paidFor[unitID] then + paidFor[unitID] = 0 + AddSupplyBlockedCounter(teamID) + end + return false +end + +-- Block unit creation +--[[function gadget:AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z) + return NewUnitIsAllowed(unitDefID, builderTeam) +end]] + +-- Block unit transfer +function gadget:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) + return NewUnitIsAllowed(unitDefID, newTeam) +end + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Unit creation, destruction, transfer. This part assumes that the action in @@ -197,23 +231,47 @@ function gadget:UnitFinished(unitID, unitDefID, teamID) AddSupplyFromUnit(unitID, unitDefID, teamID, false) end -function gadget:UnitCreated(unitID, unitDefID, teamID) +--[[function gadget:UnitCreated(unitID, unitDefID, teamID) AddSupplyFromUnit(unitID, unitDefID, teamID, true) -end +end]] function gadget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) + if paidFor[unitID] == 0 then + SubtractSupplyBlockedCounter(teamID) -- this unit no longer blocks supply for old team + end RemoveSupplyFromUnit(unitID, unitDefID, teamID, false) end function gadget:UnitGiven(unitID, unitDefID, teamID, oldTeamID) - local stunned_or_inbuild, stunned, inbuild = spGetUnitIsStunned(unitID) - AddSupplyFromUnit(unitID, unitDefID, teamID, inbuild) + if paidFor[unitID] == 0 then + AddSupplyBlockedCounter(teamID) -- this unit now blocks supply for new team + elseif paidFor[unitID] == 1 then + local stunned_or_inbuild, stunned, inbuild = spGetUnitIsStunned(unitID) + AddSupplyFromUnit(unitID, unitDefID, teamID, inbuild) + end end function gadget:UnitDestroyed(unitID, unitDefID, teamID) + if paidFor[unitID] == 0 then SubtractSupplyBlockedCounter(teamID) end RemoveSupplyFromUnit(unitID, unitDefID, teamID, false) + paidFor[unitID] = nil end +-- TODO: polling is inferior to events, ideally unit created/destroyed would be used +--[[function gadget:GameFrame(n) + if n % 30 ~= 28 then + return + end + + for i = 1, #teamList do + local teamID = teamList[i] + if isTeamSupplyBlocked[teamID] then + spSetTeamRulesParam(teamID, "supply_blocked", nil, PRIVATE) + isTeamSupplyBlocked[teamID] = false + end + end +end]] + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Initialisation @@ -225,13 +283,15 @@ local function InitializeTeamSupply(teamID) lockedUnitsArray[teamID] = {} grantingSupply[teamID] = {} costingSupply[teamID] = {} + isTeamSupplyBlocked[teamID] = 0 + spSetTeamRulesParam(teamID, "supply_blocked", nil, PRIVATE) -- If no units have been added then we have 0 supply cap so everything is locked for i = 1, costUnitCount do local unitDefID = costUnitList[i] if costUnitDefID[unitDefID] > maxSupplyWithCap[teamID] then lockedUnitsArray[teamID][unitDefID] = true - DisableUnit(unitDefID, teamID) + --DisableUnit(unitDefID, teamID) end end @@ -245,8 +305,7 @@ local function InitializeTeamSupply(teamID) end function gadget:Initialize() - local teams = Spring.GetTeamList() - for _, teamID in ipairs(teams) do + for _, teamID in ipairs(teamList) do InitializeTeamSupply(teamID) end end diff --git a/LuaRules/Gadgets/unit_takeCover.lua b/LuaRules/Gadgets/unit_takeCover.lua index 96ae0bd95..79d62c16a 100644 --- a/LuaRules/Gadgets/unit_takeCover.lua +++ b/LuaRules/Gadgets/unit_takeCover.lua @@ -10,7 +10,7 @@ function gadget:GetInfo() date = "2016", license = "CC0", layer = -3, - enabled = true-- loaded by default? + enabled = false -- loaded by default? } end diff --git a/LuaRules/Gadgets/unit_transportee_hider.lua b/LuaRules/Gadgets/unit_transportee_hider.lua new file mode 100644 index 000000000..f3fc66d7e --- /dev/null +++ b/LuaRules/Gadgets/unit_transportee_hider.lua @@ -0,0 +1,99 @@ +function gadget:GetInfo() + return { + name = "Transportee Hider", + desc = "Hides units when inside a closed transport, issues stop command to units trying to enter a full transport", + author = "FLOZi", + date = "09/02/10", + license = "PD", + layer = 0, + enabled = true -- loaded by default? + } +end + +local SetUnitNoDraw = Spring.SetUnitNoDraw +local SetUnitNeutral = Spring.SetUnitNeutral +local SetUnitStealth = Spring.SetUnitStealth +local SetUnitSonarStealth = Spring.SetUnitSonarStealth +local GetUnitDefID = Spring.GetUnitDefID +local GetUnitPosition = Spring.GetUnitPosition +local GetUnitTransporter = Spring.GetUnitTransporter +local GetUnitsInCylinder = Spring.GetUnitsInCylinder +local GiveOrderToUnit = Spring.GiveOrderToUnit + +-- Constants +local CMD_LOAD_ONTO = CMD.LOAD_ONTO +local CMD_STOP = CMD.STOP +-- Variables +local massLeft = {} +local toBeLoaded = {} + +if (gadgetHandler:IsSyncedCode()) then + +function gadget:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions) + if cmdID == CMD_LOAD_ONTO then + local transportID = cmdParams[1] + toBeLoaded[unitID] = transportID + end + return true +end + + +function gadget:UnitCreated(unitID, unitDefID, teamID) + local unitDef = UnitDefs[unitDefID] + local maxMass = unitDef.transportMass + if maxMass then + massLeft[unitID] = maxMass + end +end + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + massLeft[unitID] = nil + toBeLoaded[unitID] = nil +end + +local function TransportIsFull(transportID) + for unitID, targetTransporterID in pairs(toBeLoaded) do + if targetTransporterID == transportID then + GiveOrderToUnit(unitID, CMD_STOP, {}, {}) + toBeLoaded[unitID] = nil + end + end +end + +function gadget:UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) + --Spring.Echo("UnitLoaded", unitDefID, transportID) + if ((not unitDefID) or (not transportID)) then return end + local transportDef = UnitDefs[GetUnitDefID(transportID)] + local unitDef = UnitDefs[unitDefID] + -- Check if transport is full (former crash risk!) + if not massLeft[transportID] then return end + massLeft[transportID] = massLeft[transportID] - unitDef.mass + if massLeft[transportID] == 0 then + TransportIsFull(transportID) + end + if (not transportDef.springCategories.vtol) and (not transportDef.isAirBase) then + SetUnitNoDraw(unitID, true) + SetUnitStealth(unitID, true) + SetUnitSonarStealth(unitID, true) + end +end + +function gadget:UnitUnloaded(unitID, unitDefID, teamID, transportID) + --Spring.Echo("UnitUnloaded") + if ((not unitDefID) or (not transportID)) then return end + local transportDef = UnitDefs[GetUnitDefID(transportID)] + local unitDef = UnitDefs[unitDefID] + if not massLeft[transportID] then return end + massLeft[transportID] = massLeft[transportID] + unitDef.mass + if (not transportDef.springCategories.vtol) and (not transportDef.isAirBase) then + SetUnitNoDraw(unitID, false) + SetUnitStealth(unitID, false) + SetUnitSonarStealth(unitID, false) + end +end + +else + +end + + diff --git a/LuaRules/Gadgets/weapon_ignore_gibs.lua b/LuaRules/Gadgets/weapon_ignore_gibs.lua new file mode 100644 index 000000000..90f5664c5 --- /dev/null +++ b/LuaRules/Gadgets/weapon_ignore_gibs.lua @@ -0,0 +1,23 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if not gadgetHandler:IsSyncedCode() then + return +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +function gadget:GetInfo() + return { + name = "Ignore Gibs", + desc = "Makes shrapnel not call ProjectileCreated and ProjectileDestroyed", + author = "GoogleFrog", + date = "3 March 2019", + license = "Public domain", + layer = 0, + enabled = true + } +end + +function gadget:Initialize() + Script.SetWatchWeapon(-1, false) + gadgetHandler:RemoveGadget() +end diff --git a/LuaRules/Gadgets/weapon_noexplode_stopper.lua b/LuaRules/Gadgets/weapon_noexplode_stopper.lua new file mode 100644 index 000000000..2815cfc6a --- /dev/null +++ b/LuaRules/Gadgets/weapon_noexplode_stopper.lua @@ -0,0 +1,83 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if not gadgetHandler:IsSyncedCode() then + return +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +function gadget:GetInfo() + return { + name = "Noexplode Stopper", + desc = "Implements noexplodes that do not penetrate shields.", + author = "GoogleFrog", + date = "4 Feb 2012", + license = "None", + layer = 50, + enabled = true + } +end + +local passedProjectile = {} +local shieldDamages = {} +local noExplode = {} +for i = 1, #WeaponDefs do + shieldDamages[i] = tonumber(WeaponDefs[i].customParams.shield_damage) + if WeaponDefs[i].noExplode then + noExplode[i] = true + end +end + +function gadget:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile) + + --[[ + -- Code that causes projectile bounce + if Spring.ValidUnitID(shieldCarrierUnitID) then + + local px, py, pz = Spring.GetProjectilePosition(proID) + local vx, vy, vz = Spring.GetProjectileVelocity(proID) + local sx, sy, sz = Spring.GetUnitPosition(shieldCarrierUnitID) + + local rx, ry, rz = px-sx, py-sy, pz-sz + + local f = 2 * (rx*vx + ry*vy + rz*vz) / (rx^2 + ry^2 + rz^2) + + local nx, ny, nz = vx - f*rx, vy - f*ry, vz - f*rz + Spring.SetProjectileVelocity(proID, nx, ny, nz) + + return true + end + + return false + --]] + + local weaponDefID = Spring.GetProjectileDefID(proID) + if passedProjectile[proID] then + return true + --elseif select(2, Spring.GetProjectilePosition(proID)) < 0 then + -- passedProjectile[proID] = true + -- return true + elseif weaponDefID and shieldCarrierUnitID and shieldEmitterWeaponNum and noExplode[weaponDefID] then + local _, charge = Spring.GetUnitShieldState(shieldCarrierUnitID) --FIXME figure out a way to get correct shield + if charge and shieldDamages[weaponDefID] < charge then + Spring.DeleteProjectile(proID) + else + passedProjectile[proID] = true + end + end + + return false + +end + +function gadget:ProjectileDestroyed(proID) + if passedProjectile[proID] then + passedProjectile[proID] = false + end +end + + +function gadget:Initialize() + for id, _ in pairs(noExplode) do + Script.SetWatchProjectile(id, true) + end +end diff --git a/LuaRules/Gadgets/weapon_single_hit.lua b/LuaRules/Gadgets/weapon_single_hit.lua index d073b2929..bcc6152c6 100644 --- a/LuaRules/Gadgets/weapon_single_hit.lua +++ b/LuaRules/Gadgets/weapon_single_hit.lua @@ -8,7 +8,7 @@ end function gadget:GetInfo() return { name = "Single-Hit Weapon", - desc = "Forces marked weapons to only inflict damage once per projectile per unit", + desc = "Forces marked weapons to only inflict damage once per projectile per unit. For use with noexplode weapons.", author = "Anarchid", date = "25.03.2013", license = "Public domain", diff --git a/LuaRules/Utilities/glvolumes.lua b/LuaRules/Utilities/glvolumes.lua index b06f154c1..b31c71561 100644 --- a/LuaRules/Utilities/glvolumes.lua +++ b/LuaRules/Utilities/glvolumes.lua @@ -71,24 +71,47 @@ function gl.Utilities.DrawMyBox(minX,minY,minZ, maxX,maxY,maxZ) end) end +function gl.Utilities.DrawMy3DTriangle(x1,z1, x2, z2, x3,z3, minY, maxY) + gl.BeginEnd(GL.TRIANGLES, function() + --// top + glVertex(x1, maxY, z1) + glVertex(x2, maxY, z2) + glVertex(x3, maxY, z3) + --// bottom + glVertex(x1, minY, z1) + glVertex(x3, minY, z3) + glVertex(x2, minY, z2) + end) + gl.BeginEnd(GL.QUAD_STRIP, function() + --// sides + glVertex(x1, maxY, z1) + glVertex(x1, minY, z1) + glVertex(x2, maxY, z2) + glVertex(x2, minY, z2) + glVertex(x3, maxY, z3) + glVertex(x3, minY, z3) + glVertex(x1, maxY, z1) + glVertex(x1, minY, z1) + end) +end local function CreateSinCosTable(divs) local sinTable = {} local cosTable = {} - + local divAngle = TWO_PI / divs local alpha = 0 local i = 1 repeat sinTable[i] = sin(alpha) cosTable[i] = cos(alpha) - + alpha = alpha + divAngle i = i + 1 until (alpha >= TWO_PI) sinTable[i] = 0.0 -- sin(TWO_PI) cosTable[i] = 1.0 -- cos(TWO_PI) - + return sinTable, cosTable end @@ -98,7 +121,7 @@ function gl.Utilities.DrawMyCylinder(x,y,z, height,radius,divs) local sinTable, cosTable = CreateSinCosTable(divs) local bottomY = y - (height / 2) local topY = y + (height / 2) - + gl.BeginEnd(GL.TRIANGLE_STRIP, function() --// top for i = #sinTable, 1, -1 do @@ -133,6 +156,18 @@ function gl.Utilities.DrawMyCylinder(x,y,z, height,radius,divs) end +function gl.Utilities.DrawMyCircle(x,y,radius,divs) + divs = divs or 25 + local sinTable, cosTable = CreateSinCosTable(divs) + + gl.BeginEnd(GL.LINE_LOOP, function() + for i = #sinTable, 1, -1 do + glVertex(x + radius*sinTable[i], y + radius*cosTable[i], 0) + end + end) +end + + function gl.Utilities.DrawMyHollowCylinder(x,y,z, height,radius,inRadius,divs) divs = divs or 25 local sinTable, cosTable = CreateSinCosTable(divs) @@ -195,6 +230,18 @@ function gl.Utilities.DrawGroundRectangle(x1,z1,x2,z2) gl.PopMatrix() end +local triangles = {} +function gl.Utilities.DrawGroundTriangle(args) + if not triangles[args] then + triangles[args] = gl.CreateList(gl.Utilities.DrawMy3DTriangle, args[1], args[2], args[3], args[4], args[5], args[6], -0.5, 0.5) + end + gl.PushMatrix() + gl.Translate(0, averageGroundHeight, 0) + gl.Scale(1, shapeHeight, 1) + gl.Utilities.DrawVolume(triangles[args]) + gl.PopMatrix() +end + local cylinder = gl.CreateList(gl.Utilities.DrawMyCylinder,0,0,0,1,1,35) function gl.Utilities.DrawGroundCircle(x,z,radius) gl.PushMatrix() @@ -204,6 +251,24 @@ function gl.Utilities.DrawGroundCircle(x,z,radius) gl.PopMatrix() end +local circle = gl.CreateList(gl.Utilities.DrawMyCircle,0,0,1,35) +function gl.Utilities.DrawCircle(x,y,radius) + gl.PushMatrix() + gl.Translate(x, y, 0) + gl.Scale(radius, radius, 1) + gl.Utilities.DrawVolume(circle) + gl.PopMatrix() +end + +-- See comment in DrawMergedVolume +function gl.Utilities.DrawMergedGroundCircle(x,z,radius) + gl.PushMatrix() + gl.Translate(x, averageGroundHeight, z) + gl.Scale(radius, shapeHeight, radius) + gl.Utilities.DrawMergedVolume(cylinder) + gl.PopMatrix() +end + local hollowCylinders = { [ 0 ] = cylinder, @@ -244,8 +309,8 @@ function gl.Utilities.DrawVolume(vol_dlist) gl.ColorMask(false, false, false, false) gl.StencilOp(GL.KEEP, GL.INCR, GL.KEEP) --gl.StencilOp(GL.KEEP, GL.INVERT, GL.KEEP) - gl.StencilMask(0x11) - gl.StencilFunc(GL.ALWAYS, 0, 0) + gl.StencilMask(1) + gl.StencilFunc(GL.ALWAYS, 0, 1) gl.CallList(vol_dlist) @@ -253,16 +318,49 @@ function gl.Utilities.DrawVolume(vol_dlist) gl.DepthTest(false) gl.ColorMask(true, true, true, true) gl.StencilOp(GL.ZERO, GL.ZERO, GL.ZERO) - gl.StencilMask(0x11) - gl.StencilFunc(GL.NOTEQUAL, 0, 0+1) + gl.StencilMask(1) + gl.StencilFunc(GL.NOTEQUAL, 0, 1) gl.CallList(vol_dlist) if (gl.DepthClamp) then gl.DepthClamp(false) end gl.StencilTest(false) + -- gl.DepthTest(true) + gl.Culling(false) +end + +-- Make sure that you start with a clear stencil and that you +-- clear it using gl.Clear(GL.STENCIL_BUFFER_BIT, 0) +-- after finishing all the merged volumes +function gl.Utilities.DrawMergedVolume(vol_dlist) + gl.DepthMask(false) + if (gl.DepthClamp) then gl.DepthClamp(true) end + gl.StencilTest(true) + + gl.Culling(false) gl.DepthTest(true) + gl.ColorMask(false, false, false, false) + gl.StencilOp(GL.KEEP, GL.INVERT, GL.KEEP) + --gl.StencilOp(GL.KEEP, GL.INVERT, GL.KEEP) + gl.StencilMask(1) + gl.StencilFunc(GL.ALWAYS, 0, 1) + + gl.CallList(vol_dlist) + + gl.Culling(GL.FRONT) + gl.DepthTest(false) + gl.ColorMask(true, true, true, true) + gl.StencilOp(GL.KEEP, GL.INCR, GL.INCR) + gl.StencilMask(3) + gl.StencilFunc(GL.EQUAL, 1, 3) + + gl.CallList(vol_dlist) + + if (gl.DepthClamp) then gl.DepthClamp(false) end + gl.StencilTest(false) + -- gl.DepthTest(true) gl.Culling(false) end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaRules/Utilities/unitStates.lua b/LuaRules/Utilities/unitStates.lua new file mode 100644 index 000000000..f694fc255 --- /dev/null +++ b/LuaRules/Utilities/unitStates.lua @@ -0,0 +1,70 @@ +local REVERSE_COMPAT = not Spring.Utilities.IsCurrentVersionNewerThan(104, 1120) +local REVERSE_COMPAT_ORDER = not Spring.Utilities.IsCurrentVersionNewerThan(104, 1140) + +function Spring.Utilities.GetUnitRepeat(unitID) + if REVERSE_COMPAT then + local state = Spring.GetUnitStates(unitID) + return state and state["repeat"] + end + + local _,_,_,repeatState = Spring.GetUnitStates(unitID, false, true) + return repeatState +end + +function Spring.Utilities.GetUnitFireState(unitID) + if REVERSE_COMPAT then + local state = Spring.GetUnitStates(unitID) + return state and state["firestate"] + end + + local fireState = Spring.GetUnitStates(unitID, false) + return fireState +end + +function Spring.Utilities.GetUnitMoveState(unitID) + if REVERSE_COMPAT then + local state = Spring.GetUnitStates(unitID) + return state and state["movestate"] + end + + local _,moveState = Spring.GetUnitStates(unitID, false) + return moveState +end + +function Spring.Utilities.GetUnitActiveState(unitID) + if REVERSE_COMPAT then + local state = Spring.GetUnitStates(unitID) + return state and state["active"] + end + + local _,_,_,_,_,activeState = Spring.GetUnitStates(unitID, false, true) + return activeState +end + +function Spring.Utilities.GetUnitTrajectoryState(unitID) + if REVERSE_COMPAT then + local state = Spring.GetUnitStates(unitID) + return state and state["trajectory"] + end + + local _,_,_,_,_,_,trajectory = Spring.GetUnitStates(unitID, false, true) + return trajectory +end + +function Spring.Utilities.GetUnitFirstCommand(unitID) + if REVERSE_COMPAT_ORDER then + local cQueue = Spring.GetCommandQueue(unitID, 1) + return cQueue and cQueue[1] and cQueue[1].id + end + + local cmdID = Spring.GetUnitCurrentCommand(unitID) + return cmdID +end + +function Spring.Utilities.CheckBit(name, number, bit) + if not number then + Spring.Echo("Name", name) + end + return number and (number%(2*bit) >= bit) +end + diff --git a/LuaRules/callins.lua b/LuaRules/callins.lua index 7c134d378..256e07a61 100644 --- a/LuaRules/callins.lua +++ b/LuaRules/callins.lua @@ -136,6 +136,8 @@ CALLIN_LIST = { "DrawScreen", "DrawInMiniMap", + "SunChanged", + "DrawUnit", "DrawFeature", "DrawShield", diff --git a/LuaRules/factions.lua b/LuaRules/factions.lua index 5d16a4e74..d870400cf 100644 --- a/LuaRules/factions.lua +++ b/LuaRules/factions.lua @@ -35,27 +35,9 @@ local function AddFaction(ud,faction,scaned) end ---[[ for i,sideData in ipairs(sides) do AddFaction(UnitDefNames[sideData.startUnit],sideData.sideName,{}) end ---]] - - -AddFaction(UnitDefNames['ecommander'],'outer_colonies',{}) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - -for udid,udef in ipairs(UnitDefs) do - if ((#udef.factions)==0) then - local lowname = udef.name:lower() - if (lowname:sub(1,3)=='cor') then - AddFaction(udef,'core',{}) - elseif (lowname:sub(1,3)=='arm') then - AddFaction(udef,'arm',{}) - elseif (lowname:sub(1,5)=='chick') then - AddFaction(udef,'chicken',{}) - end - end -end diff --git a/LuaRules/gadgets.lua b/LuaRules/gadgets.lua index 75e81c74f..b77dd30fb 100644 --- a/LuaRules/gadgets.lua +++ b/LuaRules/gadgets.lua @@ -1,3 +1,6 @@ +-- NOTE overrides section at bottom! +-- ALSO look for comments -- FIXME: not in base + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- @@ -12,29 +15,23 @@ -------------------------------------------------------------------------------- -- -- TODO: - get rid of the ':'/self referencing, it's a waste of cycles --- - (De)RegisterCOBCallback(data) + callin? +-- - (De)RegisterCOBCallback(data) -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - -local SAFEWRAP = 0 --- 0: disabled --- 1: enabled, but can be overriden by gadget.GetInfo().unsafe --- 2: always enabled - +local HANDLER_BASENAME = "gadgets.lua" +local isMission = VFS.FileExists("mission.lua") -- or Game.gameName:find("Scenario Editor") local HANDLER_DIR = 'LuaGadgets/' local GADGETS_DIR = Script.GetName():gsub('US$', '') .. '/Gadgets/' local SCRIPT_DIR = Script.GetName() .. '/' -local LOG_SECTION = "" -- FIXME: "LuaRules" section is not registered anywhere -local VFSMODE = VFS.ZIP_ONLY -- FIXME: ZIP_FIRST ? +local VFSMODE = VFS.ZIP_ONLY if (Spring.IsDevLuaEnabled()) then VFSMODE = VFS.RAW_ONLY end - VFS.Include(HANDLER_DIR .. 'setupdefs.lua', nil, VFSMODE) VFS.Include(HANDLER_DIR .. 'system.lua', nil, VFSMODE) VFS.Include(HANDLER_DIR .. 'callins.lua', nil, VFSMODE) @@ -42,18 +39,22 @@ VFS.Include(SCRIPT_DIR .. 'utilities.lua', nil, VFSMODE) local actionHandler = VFS.Include(HANDLER_DIR .. 'actions.lua', nil, VFSMODE) - --------------------------------------------------------------------------------- - -function pgl() -- (print gadget list) FIXME: move this into a gadget - for k,v in ipairs(gadgetHandler.gadgets) do - Spring.Log(LOG_SECTION, LOG.ERROR, - string.format("%3i %3i %s", k, v.ghInfo.layer, v.ghInfo.name) - ) - end +local modOptions = Spring.GetModOptions() +if not modOptions.startmetal then -- load via file + local raw = VFS.Include("modoptions.lua", nil, VFS.ZIP) + for i, v in ipairs(raw) do + if v.type ~= "section" then + modOptions[v.key] = v.def + end + end + raw = VFS.Include("engineoptions.lua", nil, VFS.ZIP) + for i, v in ipairs(raw) do + if v.type ~= "section" then + modOptions[v.key:lower()] = v.def + end + end end - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- @@ -81,14 +82,162 @@ gadgetHandler = { xViewSizeOld = 1, yViewSizeOld = 1, - actionHandler = actionHandler, mouseOwner = nil, + + actionHandler = actionHandler, -- FIXME: not in base +} + + +-- these call-ins are set to 'nil' if not used +-- they are setup in UpdateCallIns() +local callInLists = { + "Shutdown", + + "GamePreload", + "GameStart", + "GameOver", + "GameID", + "TeamDied", + + "PlayerAdded", + "PlayerChanged", + "PlayerRemoved", + + "GameFrame", + + "ViewResize", -- FIXME ? + + "TextCommand", -- FIXME ? + "GotChatMsg", + "RecvLuaMsg", + + -- Unit CallIns + "UnitCreated", + "UnitFinished", + "UnitReverseBuilt", + "UnitFromFactory", + "UnitDestroyed", + "RenderUnitDestroyed", + "UnitExperience", + "UnitIdle", + "UnitCmdDone", + "UnitPreDamaged", + "UnitDamaged", + "UnitStunned", + "UnitTaken", + "UnitGiven", + "UnitEnteredRadar", + "UnitEnteredLos", + "UnitLeftRadar", + "UnitLeftLos", + "UnitSeismicPing", + "UnitLoaded", + "UnitUnloaded", + "UnitCloaked", + "UnitDecloaked", + -- optional + -- "UnitUnitCollision", + -- "UnitFeatureCollision", + -- "UnitMoveFailed", + "StockpileChanged", + + -- Feature CallIns + "FeatureCreated", + "FeatureDestroyed", + + -- Projectile CallIns + "ProjectileCreated", + "ProjectileDestroyed", + + -- Shield CallIns + "ShieldPreDamaged", + + -- Misc Synced CallIns + "Explosion", + + -- LuaRules CallIns (note: the *PreDamaged calls belong here too) + "CommandFallback", + "AllowCommand", + "AllowStartPosition", + "AllowUnitCreation", + "AllowUnitTransfer", + "AllowUnitBuildStep", + "AllowUnitTransport", + "AllowUnitTransportLoad", + "AllowUnitTransportUnload", + "AllowUnitCloak", + "AllowUnitDecloak", + "AllowUnitTargetRange", + "AllowFeatureBuildStep", + "AllowFeatureCreation", + "AllowResourceLevel", + "AllowResourceTransfer", + "AllowDirectUnitControl", + "AllowBuilderHoldFire", + "MoveCtrlNotify", + "TerraformComplete", + "AllowWeaponTargetCheck", + "AllowWeaponTarget", + "AllowWeaponInterceptTarget", + -- unsynced + "DrawUnit", + "DrawFeature", + "DrawShield", + "DrawProjectile", + "RecvSkirmishAIMessage", + + -- COB CallIn (FIXME?) + "CobCallback", + + -- Unsynced CallIns + "Update", + "DefaultCommand", + "DrawGenesis", + "DrawWorld", + "DrawWorldPreUnit", + "DrawWorldShadow", + "DrawWorldReflection", + "DrawWorldRefraction", + "DrawScreenEffects", + "DrawScreenPost", + "DrawScreen", + "DrawInMiniMap", + "RecvFromSynced", + + -- moved from LuaUI + "KeyPress", + "KeyRelease", + "MousePress", + "MouseRelease", + "MouseMove", + "MouseWheel", + "IsAbove", + "GetTooltip", + + -- FIXME -- not implemented (more of these?) + "WorldTooltip", + "MapDrawCmd", + "GameSetup", + "DefaultCommand", + + -- Save/Load + "Save", + "Load", + + -- FIXME: NOT IN BASE + "UnitCommand", + "UnitEnteredWater", + "UnitEnteredAir", + "UnitLeftWater", + "UnitLeftAir", + + "UnsyncedHeightMapUpdate" } -- initialize the call-in lists do - for _,listname in ipairs(CALLIN_LIST) do + for _,listname in ipairs(callInLists) do gadgetHandler[listname .. 'List'] = {} end end @@ -101,32 +250,6 @@ local function IsSyncedCode() end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- array-table reverse iterator --- --- all callin handlers use this so that gadgets can --- RemoveGadget() themselves (during iteration over --- a callin list) without causing a miscount --- --- c.f. Array{Insert,Remove} --- -local function r_ipairs(tbl) - local function r_iter(tbl, key) - if (key <= 1) then - return nil - end - - -- next idx, next val - return (key - 1), tbl[key - 1] - end - - return r_iter, tbl, (1 + #tbl) -end - - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- @@ -145,9 +268,8 @@ end -------------------------------------------------------------------------------- function gadgetHandler:Initialize() - local syncedHandler = Script.GetSynced() - local unsortedGadgets = {} + -- get the gadget names local gadgetFiles = VFS.DirList(GADGETS_DIR, "*.lua", VFSMODE) -- table.sort(gadgetFiles) @@ -187,11 +309,9 @@ function gadgetHandler:Initialize() for _,g in ipairs(unsortedGadgets) do gadgetHandler:InsertGadget(g) - local gtype = ((syncedHandler and "SYNCED") or "UNSYNCED") - local gname = g.ghInfo.name - local gbasename = g.ghInfo.basename - - Spring.Log(LOG_SECTION, LOG.INFO, string.format("Loaded %s gadget: %-18s <%s>", gtype, gname, gbasename)) + local name = g.ghInfo.name + local basename = g.ghInfo.basename + print(string.format("Loaded gadget: %-18s <%s>", name, basename)) end end @@ -200,21 +320,22 @@ function gadgetHandler:LoadGadget(filename) local basename = Basename(filename) local text = VFS.LoadFile(filename, VFSMODE) if (text == nil) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Failed to load: ' .. filename) + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. filename) return nil end local chunk, err = loadstring(text, filename) if (chunk == nil) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') return nil end local gadget = gadgetHandler:NewGadget() setfenv(chunk, gadget) - local success, err = pcall(chunk) + local success + success, err = pcall(chunk) if (not success) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') return nil end if (err == false) then @@ -231,14 +352,14 @@ function gadgetHandler:LoadGadget(filename) err = self:ValidateGadget(gadget) if (err) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') return nil end local knownInfo = self.knownGadgets[name] if (knownInfo) then if (knownInfo.active) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Failed to load: ' .. basename .. ' (duplicate name)') + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (duplicate name)') return nil end else @@ -287,7 +408,8 @@ function gadgetHandler:NewGadget() -- wrapped calls (closures) gadget.gadgetHandler = {} local gh = gadget.gadgetHandler - local self = self + + gh.gadgetHandler = self -- NOT IN BASE (required for api_subdir_gadgets) gadget.include = function (f) return VFS.Include(f, gadget, VFSMODE) @@ -393,69 +515,20 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local function SafeWrap(func, funcName) - local gh = gadgetHandler - return function(g, ...) - local r = { pcall(func, g, ...) } - if (r[1]) then - table.remove(r, 1) - return unpack(r) - else - if (funcName ~= 'Shutdown') then - gadgetHandler:RemoveGadget(g) - else - Spring.Log(LOG_SECTION, LOG.ERROR, 'Error in Shutdown') +local function ArrayInsert(t, f, g) + if (f) then + local layer = g.ghInfo.layer + local index = 1 + for i,v in ipairs(t) do + if (v == g) then + return -- already in the table + end + if (layer >= v.ghInfo.layer) then + index = i + 1 end - local name = g.ghInfo.name - Spring.Log(LOG_SECTION, LOG.INFO, r[2]) - Spring.Log(LOG_SECTION, LOG.INFO, 'Removed gadget: ' .. name) - return nil - end - end -end - - -local function SafeWrapGadget(gadget) - if (SAFEWRAP <= 0) then - return - elseif (SAFEWRAP == 1) then - if (gadget.GetInfo and gadget.GetInfo().unsafe) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'LuaUI: loaded unsafe gadget: ' .. gadget.ghInfo.name) - return - end - end - - for _,ciName in ipairs(CALLIN_LIST) do - if (gadget[ciName]) then - gadget[ciName] = SafeWrap(gadget[ciName], ciName) - end - if (gadget.Initialize) then - gadget.Initialize = SafeWrap(gadget.Initialize, 'Initialize') - end - end -end - - --------------------------------------------------------------------------------- - -local function ArrayInsert(t, g) - local layer = g.ghInfo.layer - local index = 1 - - for i,v in ipairs(t) do - if (v == g) then - return -- already in the table - end - - -- insert-sort the gadget based on its layer - -- note: reversed value ordering, highest to lowest - -- iteration over the callin lists is also reversed - if (layer < v.ghInfo.layer) then - index = i + 1 end + table.insert(t, index, g) end - - table.insert(t, index, g) end @@ -474,11 +547,11 @@ function gadgetHandler:InsertGadget(gadget) return end - ArrayInsert(self.gadgets, gadget) - for _,listname in ipairs(CALLIN_LIST) do + ArrayInsert(self.gadgets, true, gadget) + for _,listname in ipairs(callInLists) do local func = gadget[listname] - if (func ~= nil and type(func) == 'function') then - ArrayInsert(self[listname .. 'List'], gadget) + if (type(func) == 'function') then + ArrayInsert(self[listname..'List'], func, gadget) end end @@ -497,14 +570,15 @@ function gadgetHandler:RemoveGadget(gadget) local name = gadget.ghInfo.name self.knownGadgets[name].active = false + --Spring.Echo(name) if (gadget.Shutdown) then - gadget:Shutdown() + gadget:Shutdown() end ArrayRemove(self.gadgets, gadget) self:RemoveGadgetGlobals(gadget) actionHandler.RemoveGadgetActions(gadget) - for _,listname in ipairs(CALLIN_LIST) do + for _,listname in ipairs(callInLists) do ArrayRemove(self[listname..'List'], gadget) end @@ -522,22 +596,16 @@ end function gadgetHandler:UpdateCallIn(name) local listName = name .. 'List' - local forceUpdate = (name == 'GotChatMsg' or name == 'RecvFromSynced') -- redundant? - - _G[name] = nil - - if (forceUpdate or #self[listName] > 0) then + if ((#self[listName] > 0) or + (name == 'GotChatMsg') or + (name == 'RecvFromSynced')) then local selffunc = self[name] - - if (selffunc ~= nil) then - _G[name] = function(...) - return selffunc(self, ...) - end - else - Spring.Log(LOG_SECTION, LOG.ERROR, "UpdateCallIn: " .. name .. " is not implemented") + _G[name] = function(...) + return selffunc(self, ...) end + else + _G[name] = nil end - Script.UpdateCallIn(name) end @@ -547,14 +615,14 @@ function gadgetHandler:UpdateGadgetCallIn(name, g) local ciList = self[listName] if (ciList) then local func = g[name] - if (func ~= nil and type(func) == 'function') then - ArrayInsert(ciList, g) + if (type(func) == 'function') then + ArrayInsert(ciList, func, g) else ArrayRemove(ciList, g) end self:UpdateCallIn(name) else - Spring.Log(LOG_SECTION, LOG.ERROR, 'UpdateGadgetCallIn: bad name: ' .. name) + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'UpdateGadgetCallIn: bad name: ' .. name) end end @@ -566,13 +634,13 @@ function gadgetHandler:RemoveGadgetCallIn(name, g) ArrayRemove(ciList, g) self:UpdateCallIn(name) else - Spring.Log(LOG_SECTION, LOG.ERROR, 'RemoveGadgetCallIn: bad name: ' .. name) + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'RemoveGadgetCallIn: bad name: ' .. name) end end function gadgetHandler:UpdateCallIns() - for _,name in ipairs(CALLIN_LIST) do + for _,name in ipairs(callInLists) do self:UpdateCallIn(name) end end @@ -584,11 +652,11 @@ end function gadgetHandler:EnableGadget(name) local ki = self.knownGadgets[name] if (not ki) then - Spring.Log(LOG_SECTION, LOG.ERROR, "EnableGadget(), could not find gadget: " .. tostring(name)) + Spring.Log(HANDLER_BASENAME, LOG.ERROR, "EnableGadget(), could not find gadget: " .. tostring(name)) return false end if (not ki.active) then - Spring.Log(LOG_SECTION, LOG.INFO, 'Loading: '..ki.filename) + Spring.Echo('Loading: '..ki.filename) local order = gadgetHandler.orderList[name] if (not order or (order <= 0)) then self.orderList[name] = 1 @@ -604,13 +672,13 @@ end function gadgetHandler:DisableGadget(name) local ki = self.knownGadgets[name] if (not ki) then - Spring.Log(LOG_SECTION, LOG.ERROR, "DisableGadget(), could not find gadget: " .. tostring(name)) + Spring.Log(HANDLER_BASENAME, LOG.ERROR, "DisableGadget(), could not find gadget: " .. tostring(name)) return false end if (ki.active) then local w = self:FindGadget(name) if (not w) then return false end - Spring.Log(LOG_SECTION, LOG.INFO, 'Removed: '..ki.filename) + Spring.Echo('Removed: '..ki.filename) self:RemoveGadget(w) -- deactivate self.orderList[name] = 0 -- disable end @@ -621,7 +689,7 @@ end function gadgetHandler:ToggleGadget(name) local ki = self.knownGadgets[name] if (not ki) then - Spring.Log(LOG_SECTION, LOG.ERROR, "ToggleGadget(), could not find gadget: " .. tostring(name)) + Spring.Echo("ToggleGadget(), could not find gadget: " .. tostring(name)) return end if (ki.active) then @@ -648,49 +716,45 @@ local function FindGadgetIndex(t, w) end +local function FindLowestIndex(t, i, layer) + for x = (i - 1), 1, -1 do + if (t[x].ghInfo.layer < layer) then + return x + 1 + end + end + return 1 +end function gadgetHandler:RaiseGadget(gadget) if (gadget == nil) then return end - - local function FindLowestIndex(t, i, layer) - local n = #t - for x = (i + 1), n, 1 do - if (t[x].ghInfo.layer < layer) then - return (x - 1) - end + local function Raise(t, f, w) + if (f == nil) then return end + local i = FindGadgetIndex(t, w) + if (i == nil) then return end + local n = FindLowestIndex(t, i, w.ghInfo.layer) + if (n and (n < i)) then + table.remove(t, i) + table.insert(t, n, w) end - return n end - - local function Raise(callinList, gadget) - local gadgetIdx = FindGadgetIndex(callinList, gadget) - if (gadgetIdx == nil) then - return - end - - -- starting from gIdx and counting up, find the index - -- of the first gadget whose layer is lower** than g's - -- and move g to right before (lowestIdx - 1) it - -- ** lists are in reverse layer order, lowest at back - local lowestIdx = FindLowestIndex(callinList, gadgetIdx, gadget.ghInfo.layer) - - if (lowestIdx > gadgetIdx) then - -- insert first since lowestIdx is larger - table.insert(callinList, lowestIdx, gadget) - table.remove(callinList, gadgetIdx) - end + Raise(self.gadgets, true, gadget) + for _,listname in ipairs(callInLists) do + Raise(self[listname..'List'], gadget[listname], gadget) end +end - Raise(self.gadgets, gadget) - for _,listname in ipairs(CALLIN_LIST) do - if (gadget[listname] ~= nil) then - Raise(self[listname .. 'List'], gadget) +local function FindHighestIndex(t, i, layer) + local ts = #t + for x = (i + 1),ts do + if (t[x].ghInfo.layer > layer) then + return (x - 1) end end + return (ts + 1) end @@ -698,41 +762,19 @@ function gadgetHandler:LowerGadget(gadget) if (gadget == nil) then return end - - local function FindHighestIndex(t, i, layer) - for x = (i - 1), 1, -1 do - if (t[x].ghInfo.layer > layer) then - return (x + 1) - end - end - return 1 - end - - local function Lower(callinList, gadget) - local gadgetIdx = FindGadgetIndex(callinList, gadget) - if (gadgetIdx == nil) then - return - end - - -- starting from gIdx and counting down, find the index - -- of the first gadget whose layer is higher** than g's - -- and move g to right after (highestIdx + 1) it - -- ** lists are in reverse layer order, highest at front - local highestIdx = FindHighestIndex(callinList, gadgetIdx, gadget.ghInfo.layer) - - if (highestIdx < gadgetIdx) then - -- remove first since highestIdx is smaller - table.remove(callinList, gadgetIdx) - table.insert(callinList, highestIdx, gadget) + local function Lower(t, f, w) + if (f == nil) then return end + local i = FindGadgetIndex(t, w) + if (i == nil) then return end + local n = FindHighestIndex(t, i, w.ghInfo.layer) + if (n and (n > i)) then + table.insert(t, n, w) + table.remove(t, i) end end - - Lower(self.gadgets, gadget) - - for _,listname in ipairs(CALLIN_LIST) do - if (gadget[listname] ~= nil) then - Lower(self[listname .. 'List'], gadget) - end + Lower(self.gadgets, true, gadget) + for _,listname in ipairs(callInLists) do + Lower(self[listname..'List'], gadget[listname], gadget) end end @@ -757,11 +799,12 @@ end -- function gadgetHandler:RegisterGlobal(owner, name, value) - if (name == nil) then return false end - if (_G[name] ~= nil) then return false end - if (self.globals[name] ~= nil) then return false end - if (CALLIN_MAP[name] ~= nil) then return false end - + if ((name == nil) or + (_G[name]) or + (self.globals[name]) or + ((CallInsMap and CallInsMap[name]) or (CALLIN_MAP and CALLIN_MAP[name]))) then + return false + end _G[name] = value self.globals[name] = owner return true @@ -820,82 +863,62 @@ end function gadgetHandler:RegisterCMDID(gadget, id) - if (id <= 1000) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Gadget (' .. gadget.ghInfo.name .. ') ' .. - 'tried to register a reserved CMD_ID') - Script.Kill('Reserved CMD_ID code: ' .. id) - end + if not id then + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Gadget (' .. gadget.ghInfo.name .. ') ' .. + 'tried to register a NIL CMD_ID') + else + if (id < 1000) then + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Gadget (' .. gadget.ghInfo.name .. ') ' .. + 'tried to register a reserved CMD_ID') + Script.Kill('Reserved CMD_ID code: ' .. id) + end - if (self.CMDIDs[id] ~= nil) then - Spring.Log(LOG_SECTION, LOG.ERROR, 'Gadget (' .. gadget.ghInfo.name .. ') ' .. - 'tried to register a duplicated CMD_ID') - Script.Kill('Duplicate CMD_ID code: ' .. id) - end + if (self.CMDIDs[id] ~= nil) then + Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Gadget (' .. gadget.ghInfo.name .. ') ' .. + 'tried to register a duplicated CMD_ID') + Script.Kill('Duplicate CMD_ID code: ' .. id) + end - self.CMDIDs[id] = gadget + self.CMDIDs[id] = gadget + end end - - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- The call-in distribution routines -- -function gadgetHandler:Shutdown() - for _,g in r_ipairs(self.ShutdownList) do - g:Shutdown() - end -end - -function gadgetHandler:GameSetup(state, ready, playerStates) - local success, newReady = false, ready - for _,g in r_ipairs(self.GameSetupList) do - success, newReady = g:GameSetup(state, ready, playerStates) - end - return success, newReady -end function gadgetHandler:GamePreload() - for _,g in r_ipairs(self.GamePreloadList) do + for _,g in ipairs(self.GamePreloadList) do g:GamePreload() end + return end function gadgetHandler:GameStart() - for _,g in r_ipairs(self.GameStartList) do + for _,g in ipairs(self.GameStartList) do g:GameStart() end + return end -function gadgetHandler:GameOver(winningAllyTeams) - for _,g in r_ipairs(self.GameOverList) do - g:GameOver(winningAllyTeams) +function gadgetHandler:Shutdown() + Spring.Echo("Start gadgetHandler:Shutdown") + for _,g in ipairs(self.ShutdownList) do + local name = g.ghInfo.name or "UNKNOWN NAME" + Spring.Echo("Shutdown - " .. name) + g:Shutdown() end + Spring.Echo("End gadgetHandler:Shutdown") + return end function gadgetHandler:GameFrame(frameNum) - for _,g in r_ipairs(self.GameFrameList) do + for _,g in ipairs(self.GameFrameList) do g:GameFrame(frameNum) end -end - -function gadgetHandler:GamePaused(playerID, paused) - for _,g in r_ipairs(self.GamePausedList) do - g:GamePaused(playerID, paused) - end -end - -function gadgetHandler:GameProgress(serverFrameNum) - for _,g in r_ipairs(self.GameProgressList) do - g:GameProgress(serverFrameNum) - end -end - -function gadgetHandler:GameID(gameID) - for _,g in r_ipairs(self.GameIDList) do - g:GameID(gameID) - end + return end @@ -903,7 +926,7 @@ function gadgetHandler:RecvFromSynced(...) if (actionHandler.RecvFromSynced(...)) then return end - for _,g in r_ipairs(self.RecvFromSyncedList) do + for _,g in ipairs(self.RecvFromSyncedList) do if (g:RecvFromSynced(...)) then return end @@ -912,44 +935,44 @@ function gadgetHandler:RecvFromSynced(...) end -function gadgetHandler:GotChatMsg(msg, player) - if ((player == 0) and Spring.IsCheatingEnabled()) then - local sp = '^%s*' -- start pattern - local ep = '%s+(.*)' -- end pattern - local s, e, match - s, e, match = string.find(msg, sp..'togglegadget'..ep) - if (match) then - self:ToggleGadget(match) - return true - end - s, e, match = string.find(msg, sp..'enablegadget'..ep) - if (match) then - self:EnableGadget(match) - return true - end - s, e, match = string.find(msg, sp..'disablegadget'..ep) - if (match) then - self:DisableGadget(match) - return true - end - end - - if (actionHandler.GotChatMsg(msg, player)) then - return true - end - - for _,g in r_ipairs(self.GotChatMsgList) do - if (g:GotChatMsg(msg, player)) then - return true - end - end - - return false -end +--function gadgetHandler:GotChatMsg(msg, player) +-- if ((player == 0) and Spring.IsCheatingEnabled()) then +-- local sp = '^%s*' -- start pattern +-- local ep = '%s+(.*)' -- end pattern +-- local s, e, match +-- s, e, match = string.find(msg, sp..'togglegadget'..ep) +-- if (match) then +-- self:ToggleGadget(match) +-- return true +-- end +-- s, e, match = string.find(msg, sp..'enablegadget'..ep) +-- if (match) then +-- self:EnableGadget(match) +-- return true +-- end +-- s, e, match = string.find(msg, sp..'disablegadget'..ep) +-- if (match) then +-- self:DisableGadget(match) +-- return true +-- end +-- end +-- +-- if (actionHandler.GotChatMsg(msg, player)) then +-- return true +-- end +-- +-- for _,g in ipairs(self.GotChatMsgList) do +-- if (g:GotChatMsg(msg, player)) then +-- return true +-- end +-- end +-- +-- return false +--end function gadgetHandler:RecvLuaMsg(msg, player) - for _,g in r_ipairs(self.RecvLuaMsgList) do + for _,g in ipairs(self.RecvLuaMsgList) do if (g:RecvLuaMsg(msg, player)) then return true end @@ -977,7 +1000,7 @@ end function gadgetHandler:ViewResize(vsx, vsy) - for _,g in r_ipairs(self.ViewResizeList) do + for _,g in ipairs(self.ViewResizeList) do g:ViewResize(vsx, vsy) end return @@ -986,42 +1009,47 @@ end -------------------------------------------------------------------------------- -- --- Team call-ins +-- Game call-ins -- -function gadgetHandler:TeamDied(teamID) - for _,g in r_ipairs(self.TeamDiedList) do - g:TeamDied(teamID) +function gadgetHandler:GameOver(winners) + for _,g in ipairs(self.GameOverList) do + g:GameOver(winners) end return end -function gadgetHandler:TeamChanged(teamID) - for _,g in r_ipairs(self.TeamChangedList) do - g:TeamChanged(teamID) +function gadgetHandler:GameID(gameID) + for _,g in ipairs(self.GameIDList) do + g:GameID(gameID) end return end -function gadgetHandler:PlayerChanged(playerID) - for _,g in r_ipairs(self.PlayerChangedList) do - g:PlayerChanged(playerID) +function gadgetHandler:TeamDied(teamID) + for _,g in ipairs(self.TeamDiedList) do + g:TeamDied(teamID) end return end - function gadgetHandler:PlayerAdded(playerID) - for _,g in r_ipairs(self.PlayerAddedList) do + for _,g in ipairs(self.PlayerAddedList) do g:PlayerAdded(playerID) end return end +function gadgetHandler:PlayerChanged(playerID) + for _,g in ipairs(self.PlayerChangedList) do + g:PlayerChanged(playerID) + end + return +end function gadgetHandler:PlayerRemoved(playerID, reason) - for _,g in r_ipairs(self.PlayerRemovedList) do + for _,g in ipairs(self.PlayerRemovedList) do g:PlayerRemoved(playerID, reason) end return @@ -1034,7 +1062,7 @@ end -- function gadgetHandler:DrawUnit(unitID, drawMode) - for _,g in r_ipairs(self.DrawUnitList) do + for _,g in ipairs(self.DrawUnitList) do if (g:DrawUnit(unitID, drawMode)) then return true end @@ -1043,7 +1071,7 @@ function gadgetHandler:DrawUnit(unitID, drawMode) end function gadgetHandler:DrawFeature(featureID, drawMode) - for _,g in r_ipairs(self.DrawFeatureList) do + for _,g in ipairs(self.DrawFeatureList) do if (g:DrawFeature(featureID, drawMode)) then return true end @@ -1052,7 +1080,7 @@ function gadgetHandler:DrawFeature(featureID, drawMode) end function gadgetHandler:DrawShield(unitID, weaponID, drawMode) - for _,g in r_ipairs(self.DrawShieldList) do + for _,g in ipairs(self.DrawShieldList) do if (g:DrawShield(unitID, weaponID, drawMode)) then return true end @@ -1061,7 +1089,7 @@ function gadgetHandler:DrawShield(unitID, weaponID, drawMode) end function gadgetHandler:DrawProjectile(projectileID, drawMode) - for _,g in r_ipairs(self.DrawProjectileList) do + for _,g in ipairs(self.DrawProjectileList) do if (g:DrawProjectile(projectileID, drawMode)) then return true end @@ -1070,7 +1098,7 @@ function gadgetHandler:DrawProjectile(projectileID, drawMode) end function gadgetHandler:RecvSkirmishAIMessage(aiTeam, dataStr) - for _,g in r_ipairs(self.RecvSkirmishAIMessageList) do + for _,g in ipairs(self.RecvSkirmishAIMessageList) do local dataRet = g:RecvSkirmishAIMessage(aiTeam, dataStr) if (dataRet) then return dataRet @@ -1081,7 +1109,7 @@ end function gadgetHandler:CommandFallback(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) - for _,g in r_ipairs(self.CommandFallbackList) do + for _,g in ipairs(self.CommandFallbackList) do local used, remove = g:CommandFallback(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) if (used) then @@ -1094,8 +1122,9 @@ end function gadgetHandler:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced) - for _,g in r_ipairs(self.AllowCommandList) do - if (not g:AllowCommand(unitID, unitDefID, unitTeam, + for _,g in ipairs(self.AllowCommandList) do + + if (not g:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced)) then return false end @@ -1103,29 +1132,20 @@ function gadgetHandler:AllowCommand(unitID, unitDefID, unitTeam, return true end -if Engine ~= nil and Engine.version ~= nil then -- v104 compatibility - function gadgetHandler:AllowStartPosition(playerID, teamID, readyState, cx, cy, cz, rx, ry, rz) - for _,g in r_ipairs(self.AllowStartPositionList) do - if (not g:AllowStartPosition(playerID, teamID, readyState, cx, cy, cz, rx, ry, rz)) then - return false - end - end - return true - end -else - function gadgetHandler:AllowStartPosition(cx, cy, cz, playerID, readyState, rx, ry, rz) - for _,g in r_ipairs(self.AllowStartPositionList) do - if (not g:AllowStartPosition(cx, cy, cz, playerID, readyState, rx, ry, rz)) then - return false - end +function gadgetHandler:AllowStartPosition(playerID, teamID, readyState, cx, cy, cz, rx, ry, rz) + for _,g in ipairs(self.AllowStartPositionList) do + if (not g:AllowStartPosition(playerID, teamID, readyState, cx, cy, cz, rx, ry, rz)) then + return false end - return true end + return true end -function gadgetHandler:AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z, facing) - for _,g in r_ipairs(self.AllowUnitCreationList) do - if (not g:AllowUnitCreation(unitDefID, builderID, builderTeam, x, y, z, facing)) then +function gadgetHandler:AllowUnitCreation(unitDefID, builderID, + builderTeam, x, y, z, facing) + for _,g in ipairs(self.AllowUnitCreationList) do + if (not g:AllowUnitCreation(unitDefID, builderID, + builderTeam, x, y, z, facing)) then return false end end @@ -1135,7 +1155,7 @@ end function gadgetHandler:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture) - for _,g in r_ipairs(self.AllowUnitTransferList) do + for _,g in ipairs(self.AllowUnitTransferList) do if (not g:AllowUnitTransfer(unitID, unitDefID, oldTeam, newTeam, capture)) then return false @@ -1147,7 +1167,7 @@ end function gadgetHandler:AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) - for _,g in r_ipairs(self.AllowUnitBuildStepList) do + for _,g in ipairs(self.AllowUnitBuildStepList) do if (not g:AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part)) then return false @@ -1156,10 +1176,81 @@ function gadgetHandler:AllowUnitBuildStep(builderID, builderTeam, return true end +function gadgetHandler:AllowUnitTransport( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam +) + for _,g in ipairs(self.AllowUnitTransportList) do + if (not g:AllowUnitTransport( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam + )) then + return false + end + end + return true +end + +function gadgetHandler:AllowUnitTransportLoad( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam, + loadPosX, loadPosY, loadPosZ +) + for _,g in ipairs(self.AllowUnitTransportLoadList) do + if (not g:AllowUnitTransportLoad( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam, + loadPosX, loadPosY, loadPosZ + )) then + return false + end + end + return true +end + +function gadgetHandler:AllowUnitTransportUnload( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam, + unloadPosX, unloadPosY, unloadPosZ +) + for _,g in ipairs(self.AllowUnitTransportUnloadList) do + if (not g:AllowUnitTransportUnload( + transporterID, transporterUnitDefID, transporterTeam, + transporteeID, transporteeUnitDefID, transporteeTeam, + unloadPosX, unloadPosY, unloadPosZ + )) then + return false + end + end + return true +end + +function gadgetHandler:AllowUnitCloak(unitID, enemyID) + -- The case can be that unitID == enemyID. This is for engine stunned unitID, they are their own enemies. + for _,g in ipairs(self.AllowUnitCloakList) do + if (not g:AllowUnitCloak(unitID, enemyID)) then + return false + end + end + + return true +end + + +function gadgetHandler:AllowUnitDecloak(unitID, objectID, weaponID) + for _,g in ipairs(self.AllowUnitDecloakList) do + if (not g:AllowUnitDecloak(unitID, objectID, weaponID)) then + return false + end + end + + return true +end + function gadgetHandler:AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part) - for _,g in r_ipairs(self.AllowFeatureBuildStepList) do + for _,g in ipairs(self.AllowFeatureBuildStepList) do if (not g:AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part)) then return false @@ -1170,7 +1261,7 @@ end function gadgetHandler:AllowFeatureCreation(featureDefID, teamID, x, y, z) - for _,g in r_ipairs(self.AllowFeatureCreationList) do + for _,g in ipairs(self.AllowFeatureCreationList) do if (not g:AllowFeatureCreation(featureDefID, teamID, x, y, z)) then return false end @@ -1180,7 +1271,7 @@ end function gadgetHandler:AllowResourceLevel(teamID, res, level) - for _,g in r_ipairs(self.AllowResourceLevelList) do + for _,g in ipairs(self.AllowResourceLevelList) do if (not g:AllowResourceLevel(teamID, res, level)) then return false end @@ -1190,7 +1281,7 @@ end function gadgetHandler:AllowResourceTransfer(oldTeamID, newTeamID, res, amount) - for _,g in r_ipairs(self.AllowResourceTransferList) do + for _,g in ipairs(self.AllowResourceTransferList) do if (not g:AllowResourceTransfer(oldTeamID, newTeamID, res, amount)) then return false end @@ -1201,7 +1292,7 @@ end function gadgetHandler:AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID) - for _,g in r_ipairs(self.AllowDirectUnitControlList) do + for _,g in ipairs(self.AllowDirectUnitControlList) do if (not g:AllowDirectUnitControl(unitID, unitDefID, unitTeam, playerID)) then return false @@ -1210,20 +1301,19 @@ function gadgetHandler:AllowDirectUnitControl(unitID, unitDefID, unitTeam, return true end - function gadgetHandler:AllowBuilderHoldFire(unitID, unitDefID, action) - for _,g in r_ipairs(self.AllowBuilderHoldFireList) do - if (not g:AllowBuilderHoldFire(unitID, unitDefID, action)) then - return false - end - end - return true + for _,g in ipairs(self.AllowBuilderHoldFireList) do + if (not g:AllowBuilderHoldFire(unitID, unitDefID, action)) then + return false + end + end + return true end function gadgetHandler:MoveCtrlNotify(unitID, unitDefID, unitTeam, data) local state = false - for _,g in r_ipairs(self.MoveCtrlNotifyList) do + for _,g in ipairs(self.MoveCtrlNotifyList) do if (g:MoveCtrlNotify(unitID, unitDefID, unitTeam, data)) then state = true end @@ -1234,7 +1324,7 @@ end function gadgetHandler:TerraformComplete(unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam) - for _,g in r_ipairs(self.TerraformCompleteList) do + for _,g in ipairs(self.TerraformCompleteList) do local stop = g:TerraformComplete(unitID, unitDefID, unitTeam, buildUnitID, buildUnitDefID, buildUnitTeam) if (stop) then @@ -1245,46 +1335,58 @@ function gadgetHandler:TerraformComplete(unitID, unitDefID, unitTeam, end - function gadgetHandler:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) - local ignore = true - for _, g in r_ipairs(self.AllowWeaponTargetCheckList) do - local allowCheck, ignoreCheck = g:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) - if not ignoreCheck then - ignore = false - if not allowCheck then - return 0 - end + for _, g in ipairs(self.AllowWeaponTargetCheckList) do + if (not g:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID)) then + return false end end - - if ignore then - return -1 - else - return 1 - end + return true end +-- AllowWeaponTarget is also called when auto-generating CAI attack commands. +-- When targetID=-1 and weaponNum=-1 targetPriority determines the target search +-- radius; targetPriority=nil accompanies any actual + function gadgetHandler:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority) local allowed = true - local priority = 1.0 + local returnValue + + if targetID == -1 then + local unitID = attackerID + local aquireRange = defPriority + for _, g in ipairs(self.AllowUnitTargetRangeList) do + -- Send priority to each successive gadget. + local targetAllowed, newRange = g:AllowUnitTargetRange(unitID, aquireRange) + + if (not targetAllowed) then + allowed = false + break + end - for _, g in r_ipairs(self.AllowWeaponTargetList) do - local targetAllowed, targetPriority = g:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority) + aquireRange = newRange + end + return true, aquireRange + end + + local priority = defPriority + for _, g in ipairs(self.AllowWeaponTargetList) do + -- Send priority to each successive gadget. + local targetAllowed, targetPriority = g:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, priority) if (not targetAllowed) then - allowed = false; break + allowed = false + break end - priority = math.max(priority, targetPriority) + priority = targetPriority end - return allowed, priority end -function gadgetHandler:AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponNum, interceptorTargetID) - for _, g in r_ipairs(self.AllowWeaponInterceptTargetList) do - if (not g:AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponNum, interceptorTargetID)) then +function gadgetHandler:AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponNum, targetProjectileID) + for _, g in ipairs(self.AllowWeaponInterceptTargetList) do + if (not g:AllowWeaponInterceptTarget(interceptorUnitID, interceptorWeaponNum, targetProjectileID)) then return false end end @@ -1292,64 +1394,77 @@ function gadgetHandler:AllowWeaponInterceptTarget(interceptorUnitID, interceptor return true end - -------------------------------------------------------------------------------- -- -- Unit call-ins -- +local inCreated = false +local finishedDuringCreated = false -- assumes non-recursive create function gadgetHandler:UnitCreated(unitID, unitDefID, unitTeam, builderID) - for _,g in r_ipairs(self.UnitCreatedList) do + + finishedDuringCreated = false + inCreated = true + for _,g in ipairs(self.UnitCreatedList) do g:UnitCreated(unitID, unitDefID, unitTeam, builderID) end - return -end + inCreated = false + if finishedDuringCreated then + finishedDuringCreated = false + gadgetHandler:UnitFinished(unitID, unitDefID, unitTeam) + end +end function gadgetHandler:UnitFinished(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.UnitFinishedList) do + if inCreated then + finishedDuringCreated = true + return + end + + for _,g in ipairs(self.UnitFinishedList) do g:UnitFinished(unitID, unitDefID, unitTeam) end return end - -function gadgetHandler:UnitFromFactory( - unitID, unitDefID, unitTeam, - factID, factDefID, userOrders -) - for _,g in r_ipairs(self.UnitFromFactoryList) do - g:UnitFromFactory(unitID, unitDefID, unitTeam, - factID, factDefID, userOrders) +function gadgetHandler:UnitReverseBuilt(unitID, unitDefID, unitTeam) + for _,g in ipairs(self.UnitReverseBuiltList) do + g:UnitReverseBuilt(unitID, unitDefID, unitTeam) end return end +function gadgetHandler:UnitStunned(unitID, unitDefID, unitTeam, stunned) + for _,g in ipairs(self.UnitStunnedList) do + g:UnitStunned(unitID, unitDefID, unitTeam, stunned) + end + return +end -function gadgetHandler:UnitReverseBuilt(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.UnitReverseBuiltList) do - g:UnitReverseBuilt(unitID, unitDefID, unitTeam) +function gadgetHandler:UnitFromFactory(unitID, unitDefID, unitTeam, + factID, factDefID, userOrders) + for _,g in ipairs(self.UnitFromFactoryList) do + g:UnitFromFactory(unitID, unitDefID, unitTeam, + factID, factDefID, userOrders) end return end -function gadgetHandler:UnitDestroyed( - unitID, unitDefID, unitTeam, - attackerID, attackerDefID, attackerTeam -) - for _,g in r_ipairs(self.UnitDestroyedList) do - g:UnitDestroyed( - unitID, unitDefID, unitTeam, - attackerID, attackerDefID, attackerTeam - ) +function gadgetHandler:UnitDestroyed(unitID, unitDefID, unitTeam, + attackerID, attackerDefID, attackerTeam, pre) + if pre == false then return end + for _,g in ipairs(self.UnitDestroyedList) do + g:UnitDestroyed(unitID, unitDefID, unitTeam, + attackerID, attackerDefID, attackerTeam) end return end function gadgetHandler:RenderUnitDestroyed(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.RenderUnitDestroyedList) do + for _,g in ipairs(self.RenderUnitDestroyedList) do g:RenderUnitDestroyed(unitID, unitDefID, unitTeam) end return @@ -1358,7 +1473,7 @@ end function gadgetHandler:UnitExperience(unitID, unitDefID, unitTeam, experience, oldExperience) - for _,g in r_ipairs(self.UnitExperienceList) do + for _,g in ipairs(self.UnitExperienceList) do g:UnitExperience(unitID, unitDefID, unitTeam, experience, oldExperience) end return @@ -1366,89 +1481,145 @@ end function gadgetHandler:UnitIdle(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.UnitIdleList) do + for _,g in ipairs(self.UnitIdleList) do g:UnitIdle(unitID, unitDefID, unitTeam) end return end -function gadgetHandler:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) - for _,g in r_ipairs(self.UnitCmdDoneList) do - g:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) +function gadgetHandler:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) + for _,g in ipairs(self.UnitCmdDoneList) do + g:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag) end return end -function gadgetHandler:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) - for _,g in r_ipairs(self.UnitCommandList) do - g:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) - end +local UnitPreDamaged_GadgetMap = {} +local UnitPreDamaged_first = true +local allWeaponDefs = {} + +do + for i=-7,#WeaponDefs do + allWeaponDefs[#allWeaponDefs+1] = i + end end -function gadgetHandler:UnitPreDamaged( - unitID, - unitDefID, - unitTeam, - damage, - paralyzer, - weaponDefID, - projectileID, - attackerID, - attackerDefID, - attackerTeam -) - local retDamage = damage - local retImpulse = 1.0 +function gadgetHandler:UnitPreDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponDefID, + projectileID, attackerID, attackerDefID, attackerTeam) + + if UnitPreDamaged_first then + for _,g in ipairs(self.UnitPreDamagedList) do + local weaponDefs = (g.UnitPreDamaged_GetWantedWeaponDef and g:UnitPreDamaged_GetWantedWeaponDef()) or allWeaponDefs + for _,wdid in ipairs(weaponDefs) do + if UnitPreDamaged_GadgetMap[wdid] then + UnitPreDamaged_GadgetMap[wdid].count = UnitPreDamaged_GadgetMap[wdid].count + 1 + UnitPreDamaged_GadgetMap[wdid].data[UnitPreDamaged_GadgetMap[wdid].count] = g + else + UnitPreDamaged_GadgetMap[wdid] = { + count = 1, + data = {g} + } + end + end + end + UnitPreDamaged_first = false + end - for _,g in r_ipairs(self.UnitPreDamagedList) do - dmg, imp = g:UnitPreDamaged( - unitID, unitDefID, unitTeam, - retDamage, paralyzer, - weaponDefID, projectileID, - attackerID, attackerDefID, attackerTeam) + local rDam = damage + local rImp = 1.0 + + local gadgets = UnitPreDamaged_GadgetMap[weaponDefID] + if gadgets then + local data = gadgets.data + local g + for i = 1, gadgets.count do + g = data[i] + local dam, imp = g:UnitPreDamaged(unitID, unitDefID, unitTeam, + rDam, paralyzer, weaponDefID, + attackerID, attackerDefID, attackerTeam, + projectileID) + if (dam ~= nil) then + rDam = dam + end + if (imp ~= nil) then + rImp = math.min(imp, rImp) + end + end + end - if (dmg ~= nil) then retDamage = dmg end - if (imp ~= nil) then retImpulse = imp end + return rDam, rImp +end + +--[[ Old +function gadgetHandler:UnitPreDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponDefID, + projectileID, attackerID, attackerDefID, attackerTeam) + + local rDam = damage + local rImp = 1.0 + + for _,g in ipairs(self.UnitPreDamagedList) do + dam, imp = g:UnitPreDamaged(unitID, unitDefID, unitTeam, + rDam, paralyzer, weaponDefID, + attackerID, attackerDefID, attackerTeam, + projectileID) + if (dam ~= nil) then + rDam = dam + end + if (imp ~= nil) then + rImp = math.min(imp, rImp) + end end - return retDamage, retImpulse + return rDam, rImp end +--]] +local UnitDamaged_first = true +local UnitDamaged_count = 0 +local UnitDamaged_gadgets = {} -function gadgetHandler:UnitDamaged( - unitID, - unitDefID, - unitTeam, - damage, - paralyzer, - weaponDefID, - projectileID, - attackerID, - attackerDefID, - attackerTeam -) - for _,g in r_ipairs(self.UnitDamagedList) do - g:UnitDamaged(unitID, unitDefID, unitTeam, - damage, paralyzer, weaponDefID, projectileID, - attackerID, attackerDefID, attackerTeam) - end +function gadgetHandler:UnitDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponID, projectileID, + attackerID, attackerDefID, attackerTeam) + + if UnitDamaged_first then + for _,g in ipairs(self.UnitDamagedList) do + UnitDamaged_count = UnitDamaged_count + 1 + UnitDamaged_gadgets[UnitDamaged_count] = g + end + UnitDamaged_first = false + end + + local g + for i = 1, UnitDamaged_count do + g = UnitDamaged_gadgets[i] + g:UnitDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponID, + attackerID, attackerDefID, attackerTeam) + end + return end -function gadgetHandler:UnitStunned( - unitID, - unitDefID, - unitTeam, - stunned -) - for _,g in r_ipairs(self.UnitStunnedList) do - g:UnitStunned(unitID, unitDefID, unitTeam, stunned) +--[[ Old +function gadgetHandler:UnitDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponID, projectileID, + attackerID, attackerDefID, attackerTeam) + + for _,g in ipairs(self.UnitDamagedList) do + g:UnitDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponID, + attackerID, attackerDefID, attackerTeam) end + return end +--]] function gadgetHandler:UnitTaken(unitID, unitDefID, unitTeam, newTeam) - for _,g in r_ipairs(self.UnitTakenList) do + for _,g in ipairs(self.UnitTakenList) do g:UnitTaken(unitID, unitDefID, unitTeam, newTeam) end return @@ -1456,7 +1627,7 @@ end function gadgetHandler:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) - for _,g in r_ipairs(self.UnitGivenList) do + for _,g in ipairs(self.UnitGivenList) do g:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) end return @@ -1464,7 +1635,7 @@ end function gadgetHandler:UnitEnteredRadar(unitID, unitTeam, allyTeam, unitDefID) - for _,g in r_ipairs(self.UnitEnteredRadarList) do + for _,g in ipairs(self.UnitEnteredRadarList) do g:UnitEnteredRadar(unitID, unitTeam, allyTeam, unitDefID) end return @@ -1472,7 +1643,7 @@ end function gadgetHandler:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID) - for _,g in r_ipairs(self.UnitEnteredLosList) do + for _,g in ipairs(self.UnitEnteredLosList) do g:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID) end return @@ -1480,7 +1651,7 @@ end function gadgetHandler:UnitLeftRadar(unitID, unitTeam, allyTeam, unitDefID) - for _,g in r_ipairs(self.UnitLeftRadarList) do + for _,g in ipairs(self.UnitLeftRadarList) do g:UnitLeftRadar(unitID, unitTeam, allyTeam, unitDefID) end return @@ -1488,7 +1659,7 @@ end function gadgetHandler:UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) - for _,g in r_ipairs(self.UnitLeftLosList) do + for _,g in ipairs(self.UnitLeftLosList) do g:UnitLeftLos(unitID, unitTeam, allyTeam, unitDefID) end return @@ -1497,7 +1668,7 @@ end function gadgetHandler:UnitSeismicPing(x, y, z, strength, allyTeam, unitID, unitDefID) - for _,g in r_ipairs(self.UnitSeismicPingList) do + for _,g in ipairs(self.UnitSeismicPingList) do g:UnitSeismicPing(x, y, z, strength, allyTeam, unitID, unitDefID) end @@ -1507,7 +1678,7 @@ end function gadgetHandler:UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) - for _,g in r_ipairs(self.UnitLoadedList) do + for _,g in ipairs(self.UnitLoadedList) do g:UnitLoaded(unitID, unitDefID, unitTeam, transportID, transportTeam) end @@ -1517,7 +1688,7 @@ end function gadgetHandler:UnitUnloaded(unitID, unitDefID, unitTeam, transportID, transportTeam) - for _,g in r_ipairs(self.UnitUnloadedList) do + for _,g in ipairs(self.UnitUnloadedList) do g:UnitUnloaded(unitID, unitDefID, unitTeam, transportID, transportTeam) end @@ -1526,7 +1697,7 @@ end function gadgetHandler:UnitCloaked(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.UnitCloakedList) do + for _,g in ipairs(self.UnitCloakedList) do g:UnitCloaked(unitID, unitDefID, unitTeam) end return @@ -1534,7 +1705,7 @@ end function gadgetHandler:UnitDecloaked(unitID, unitDefID, unitTeam) - for _,g in r_ipairs(self.UnitDecloakedList) do + for _,g in ipairs(self.UnitDecloakedList) do g:UnitDecloaked(unitID, unitDefID, unitTeam) end return @@ -1542,13 +1713,13 @@ end function gadgetHandler:UnitUnitCollision(colliderID, collideeID) - for _,g in r_ipairs(self.UnitUnitCollisionList) do + for _,g in ipairs(self.UnitUnitCollisionList) do g:UnitUnitCollision(colliderID, collideeID) end end function gadgetHandler:UnitFeatureCollision(colliderID, collideeID) - for _,g in r_ipairs(self.UnitFeatureCollisionList) do + for _,g in ipairs(self.UnitFeatureCollisionList) do g:UnitFeatureCollision(colliderID, collideeID) end end @@ -1556,7 +1727,7 @@ end function gadgetHandler:StockpileChanged(unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount) - for _,g in r_ipairs(self.StockpileChangedList) do + for _,g in ipairs(self.StockpileChangedList) do g:StockpileChanged(unitID, unitDefID, unitTeam, weaponNum, oldCount, newCount) end @@ -1570,7 +1741,7 @@ end -- function gadgetHandler:FeatureCreated(featureID, allyTeam) - for _,g in r_ipairs(self.FeatureCreatedList) do + for _,g in ipairs(self.FeatureCreatedList) do g:FeatureCreated(featureID, allyTeam) end return @@ -1578,58 +1749,12 @@ end function gadgetHandler:FeatureDestroyed(featureID, allyTeam) - for _,g in r_ipairs(self.FeatureDestroyedList) do + for _,g in ipairs(self.FeatureDestroyedList) do g:FeatureDestroyed(featureID, allyTeam) end return end -function gadgetHandler:FeatureDamaged( - featureID, - featureDefID, - featureTeam, - damage, - weaponDefID, - projectileID, - attackerID, - attackerDefID, - attackerTeam -) - for _,g in r_ipairs(self.FeatureDamagedList) do - g:FeatureDamaged(featureID, featureDefID, featureTeam, - damage, weaponDefID, projectileID, - attackerID, attackerDefID, attackerTeam) - end -end - -function gadgetHandler:FeaturePreDamaged( - featureID, - featureDefID, - featureTeam, - damage, - weaponDefID, - projectileID, - attackerID, - attackerDefID, - attackerTeam -) - local retDamage = damage - local retImpulse = 1.0 - - for _,g in r_ipairs(self.FeaturePreDamagedList) do - dmg, imp = g:FeaturePreDamaged( - featureID, featureDefID, featureTeam, - retDamage, - weaponDefID, projectileID, - attackerID, attackerDefID, attackerTeam) - - if (dmg ~= nil) then retDamage = dmg end - if (imp ~= nil) then retImpulse = imp end - end - - return retDamage, retImpulse -end - -------------------------------------------------------------------------------- -- @@ -1637,7 +1762,7 @@ end -- function gadgetHandler:ProjectileCreated(proID, proOwnerID, proWeaponDefID) - for _,g in r_ipairs(self.ProjectileCreatedList) do + for _,g in ipairs(self.ProjectileCreatedList) do g:ProjectileCreated(proID, proOwnerID, proWeaponDefID) end return @@ -1645,7 +1770,7 @@ end function gadgetHandler:ProjectileDestroyed(proID) - for _,g in r_ipairs(self.ProjectileDestroyedList) do + for _,g in ipairs(self.ProjectileDestroyedList) do g:ProjectileDestroyed(proID) end return @@ -1657,11 +1782,11 @@ end -- Shield call-ins -- -function gadgetHandler:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID) +function gadgetHandler:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ) - for _,g in r_ipairs(self.ShieldPreDamagedList) do + for _,g in ipairs(self.ShieldPreDamagedList) do -- first gadget to handle this consumes the event - if (g:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID)) then + if (g:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitterWeaponNum, beamEmitterUnitID, startX, startY, startZ, hitX, hitY, hitZ)) then return true end end @@ -1675,127 +1800,158 @@ end -- Misc call-ins -- -function gadgetHandler:Explosion(weaponID, px, py, pz, ownerID, projectileID) +local Explosion_GadgetMap = {} +local Explosion_GadgetSingle = {} + +local Explosion_first = true + +function gadgetHandler:Explosion(weaponID, px, py, pz, ownerID, proID) + if Explosion_first then + for _,g in ipairs(self.ExplosionList) do + local weaponDefs = (g.Explosion_GetWantedWeaponDef and g:Explosion_GetWantedWeaponDef()) or allWeaponDefs + for _,wdid in ipairs(weaponDefs) do + if Explosion_GadgetSingle[wdid] or Explosion_GadgetMap[wdid] then + if Explosion_GadgetMap[wdid] then + Explosion_GadgetMap[wdid].count = Explosion_GadgetMap[wdid].count + 1 + Explosion_GadgetMap[wdid].data[Explosion_GadgetMap[wdid].count] = g + else + Explosion_GadgetMap[wdid] = { + count = 2, + data = {Explosion_GadgetSingle[wdid], g} + } + Explosion_GadgetSingle[wdid] = nil + end + else + Explosion_GadgetSingle[wdid] = g + end + end + end + Explosion_first = false + end + + local noGfx = false + local single = Explosion_GadgetSingle[weaponID] + local map = Explosion_GadgetMap[weaponID] + if single then + noGfx = single:Explosion(weaponID, px, py, pz, ownerID, proID) + elseif map then + local gadgets = map + local data = gadgets.data + local g + for i = 1, gadgets.count do + g = data[i] + noGfx = noGfx or g:Explosion(weaponID, px, py, pz, ownerID, proID) + end + end + return noGfx or false +end + +--[[ Base +function gadgetHandler:Explosion(weaponID, px, py, pz, ownerID) local noGfx = false - for _,g in r_ipairs(self.ExplosionList) do - noGfx = noGfx or g:Explosion(weaponID, px, py, pz, ownerID, projectileID) + for _,g in ipairs(self.ExplosionList) do + noGfx = noGfx or g:Explosion(weaponID, px, py, pz, ownerID) end return noGfx end - +--]] -------------------------------------------------------------------------------- -- -- Draw call-ins -- -function gadgetHandler:Update() - for _,g in r_ipairs(self.UpdateList) do - g:Update() +function gadgetHandler:SunChanged() + for _,g in ipairs(self.SunChangedList) do + g:SunChanged() end return end - -function gadgetHandler:DefaultCommand(type, id) - for _,g in r_ipairs(self.DefaultCommandList) do - local id = g:DefaultCommand(type, id) - if (id) then - return id - end +function gadgetHandler:Update(deltaTime) + for _,g in ipairs(self.UpdateList) do + g:Update(deltaTime) end return end -function gadgetHandler:CommandNotify(id, params, options) - for _,g in r_ipairs(self.CommandNotifyList) do - if (g:CommandNotify(id, params, options)) then - return true + +function gadgetHandler:DefaultCommand(type, id, engineCmd) + for _,g in ipairs(self.DefaultCommandList) do + local defCmd = g:DefaultCommand(type, id, engineCmd) + if defCmd then + return defCmd end end - return false + return end function gadgetHandler:DrawGenesis() - for _,g in r_ipairs(self.DrawGenesisList) do + for _,g in ipairs(self.DrawGenesisList) do g:DrawGenesis() end + return end + function gadgetHandler:DrawWorld() - for _,g in r_ipairs(self.DrawWorldList) do + for _,g in ipairs(self.DrawWorldList) do g:DrawWorld() end + return end + function gadgetHandler:DrawWorldPreUnit() - for _,g in r_ipairs(self.DrawWorldPreUnitList) do + for _,g in ipairs(self.DrawWorldPreUnitList) do g:DrawWorldPreUnit() end + return end + function gadgetHandler:DrawWorldShadow() - for _,g in r_ipairs(self.DrawWorldShadowList) do + for _,g in ipairs(self.DrawWorldShadowList) do g:DrawWorldShadow() end + return end + function gadgetHandler:DrawWorldReflection() - for _,g in r_ipairs(self.DrawWorldReflectionList) do + for _,g in ipairs(self.DrawWorldReflectionList) do g:DrawWorldReflection() end + return end + function gadgetHandler:DrawWorldRefraction() - for _,g in r_ipairs(self.DrawWorldRefractionList) do + for _,g in ipairs(self.DrawWorldRefractionList) do g:DrawWorldRefraction() end + return end -function gadgetHandler:DrawGroundPreForward() - for _,g in r_ipairs(self.DrawGroundPreForwardList) do - g:DrawGroundPreForward() - end -end - -function gadgetHandler:DrawGroundPreDeferred() - for _,g in r_ipairs(self.DrawGroundPreDeferredList) do - g:DrawGroundPreDeferred() - end -end - -function gadgetHandler:DrawGroundPostDeferred() - for _,g in r_ipairs(self.DrawGroundPostDeferredList) do - g:DrawGroundPostDeferred() - end -end - - -function gadgetHandler:DrawUnitsPostDeferred() - for _,g in r_ipairs(self.DrawUnitsPostDeferredList) do - g:DrawUnitsPostDeferred() - end -end - -function gadgetHandler:DrawFeaturesPostDeferred() - for _,g in r_ipairs(self.DrawFeaturesPostDeferredList) do - g:DrawFeaturesPostDeferred() +function gadgetHandler:DrawScreenEffects(vsx, vsy) + for _,g in ipairs(self.DrawScreenEffectsList) do + g:DrawScreenEffects(vsx, vsy) end + return end - -function gadgetHandler:DrawScreenEffects(vsx, vsy) - for _,g in r_ipairs(self.DrawScreenEffectsList) do - g:DrawScreenEffects(vsx, vsy) +function gadgetHandler:DrawScreenPost(vsx, vsy) + for _,g in ipairs(self.DrawScreenPostList) do + g:DrawScreenPost(vsx, vsy) end return end function gadgetHandler:DrawScreen(vsx, vsy) - for _,g in r_ipairs(self.DrawScreenList) do + for _,g in ipairs(self.DrawScreenList) do g:DrawScreen(vsx, vsy) end return @@ -1803,7 +1959,7 @@ end function gadgetHandler:DrawInMiniMap(mmsx, mmsy) - for _,g in r_ipairs(self.DrawInMiniMapList) do + for _,g in ipairs(self.DrawInMiniMapList) do g:DrawInMiniMap(mmsx, mmsy) end return @@ -1814,7 +1970,7 @@ end -------------------------------------------------------------------------------- function gadgetHandler:KeyPress(key, mods, isRepeat, label, unicode) - for _,g in r_ipairs(self.KeyPressList) do + for _,g in ipairs(self.KeyPressList) do if (g:KeyPress(key, mods, isRepeat, label, unicode)) then return true end @@ -1824,7 +1980,7 @@ end function gadgetHandler:KeyRelease(key, mods, label, unicode) - for _,g in r_ipairs(self.KeyReleaseList) do + for _,g in ipairs(self.KeyReleaseList) do if (g:KeyRelease(key, mods, label, unicode)) then return true end @@ -1833,27 +1989,13 @@ function gadgetHandler:KeyRelease(key, mods, label, unicode) end -function gadgetHandler:TextInput(utf8, ...) - if (self.tweakMode) then - return true - end - - for _,g in r_ipairs(self.TextInputList) do - if (g:TextInput(utf8, ...)) then - return true - end - end - return false -end - - function gadgetHandler:MousePress(x, y, button) local mo = self.mouseOwner if (mo) then mo:MousePress(x, y, button) return true -- already have an active press end - for _,g in r_ipairs(self.MousePressList) do + for _,g in ipairs(self.MousePressList) do if (g:MousePress(x, y, button)) then self.mouseOwner = g return true @@ -1885,7 +2027,7 @@ end function gadgetHandler:MouseWheel(up, value) - for _,g in r_ipairs(self.MouseWheelList) do + for _,g in ipairs(self.MouseWheelList) do if (g:MouseWheel(up, value)) then return true end @@ -1895,7 +2037,7 @@ end function gadgetHandler:IsAbove(x, y) - for _,g in r_ipairs(self.IsAboveList) do + for _,g in ipairs(self.IsAboveList) do if (g:IsAbove(x, y)) then return true end @@ -1905,7 +2047,7 @@ end function gadgetHandler:GetTooltip(x, y) - for _,g in r_ipairs(self.GetTooltipList) do + for _,g in ipairs(self.GetTooltipList) do if (g:IsAbove(x, y)) then local tip = g:GetTooltip(x, y) if (string.len(tip) > 0) then @@ -1917,70 +2059,242 @@ function gadgetHandler:GetTooltip(x, y) end -function gadgetHandler:MapDrawCmd(playerID, cmdType, px, py, pz, labelText) - for _,g in r_ipairs(self.MapDrawCmdList) do - if (g:MapDrawCmd(playerID, cmdType, px, py, pz, labelText)) then - return true - end +function gadgetHandler:UnsyncedHeightMapUpdate(x1, z1, x2, z2) + for _,g in ipairs(self.UnsyncedHeightMapUpdateList) do + g:UnsyncedHeightMapUpdate(x1, z1, x2, z2) end - return false + return end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadgetHandler:Save(zip) + for _,g in ipairs(self.SaveList) do + g:Save(zip) + end + return +end + + +function gadgetHandler:Load(zip) + for _,g in ipairs(self.LoadList) do + g:Load(zip) + end + return +end + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +-- +-- OVERRIDES +-- -function gadgetHandler:DownloadStarted(id) - for _,g in r_ipairs(self.DownloadStartedList) do - g:DownloadStarted(id) +function gadgetHandler:GetViewSizes() + --FIXME remove + return gl.GetViewSizes() -- ours + --return self.xViewSize, self.yViewSize -- base +end + +local AllowCommand_WantedCommand = {} +local AllowCommand_WantedUnitDefID = {} + +function gadgetHandler:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced) -- ours +--function gadgetHandler:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced) -- base + for _,g in ipairs(self.AllowCommandList) do + if not AllowCommand_WantedCommand[g] then + AllowCommand_WantedCommand[g] = (g.AllowCommand_GetWantedCommand and g:AllowCommand_GetWantedCommand()) or true + end + if not AllowCommand_WantedUnitDefID[g] then + AllowCommand_WantedUnitDefID[g] = (g.AllowCommand_GetWantedUnitDefID and g:AllowCommand_GetWantedUnitDefID()) or true + end + local wantedCommand = AllowCommand_WantedCommand[g] + local wantedUnitDefID = AllowCommand_WantedUnitDefID[g] + + --if g:GetBadCommand() then + -- Spring.Echo(g:GetBadCommand()) + --end + if ((wantedCommand == true) or wantedCommand[cmdID]) and + ((wantedUnitDefID == true) or wantedUnitDefID[unitDefID]) and + (not g:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced)) then -- ours + --if (not g:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions, cmdTag, synced)) then -- base + return false + end end + return true end -function gadgetHandler:DownloadQueued(id) - for _,g in r_ipairs(self.DownloadQueuedList) do - g:DownloadQueued(id) +-- ours +function gadgetHandler:RecvFromSynced(cmd,...) + if (cmd == "proxy_ChatMsg") then + gadgetHandler:GotChatMsg(...) + return + end + + if (actionHandler.RecvFromSynced(cmd, ...)) then + return + end + for _,g in ipairs(self.RecvFromSyncedList) do + if (g:RecvFromSynced(cmd, ...)) then + return + end end + return end -function gadgetHandler:DownloadFinished(id) - for _,g in r_ipairs(self.DownloadFinishedList) do - g:DownloadFinished(id) +-- base +--[[ +function gadgetHandler:RecvFromSynced(...) + if (actionHandler.RecvFromSynced(...)) then + return + end + for _,g in ipairs(self.RecvFromSyncedList) do + if (g:RecvFromSynced(...)) then + return + end end + return end +--]] + +function gadgetHandler:GotChatMsg(msg, player) -function gadgetHandler:DownloadFailed(id, errorid) - for _,g in r_ipairs(self.DownloadFailedList) do - g:DownloadFailed(id, errorid) + if (((player == 0) or (player == 255)) and Spring.IsCheatingEnabled()) then -- ours + --if ((player == 0) and Spring.IsCheatingEnabled()) then -- base + local sp = '^%s*' -- start pattern + local ep = '%s+(.*)' -- end pattern + local s, e, match + s, e, match = string.find(msg, sp..'togglegadget'..ep) + if (match) then + self:ToggleGadget(match) + return true + end + s, e, match = string.find(msg, sp..'enablegadget'..ep) + if (match) then + self:EnableGadget(match) + return true + end + s, e, match = string.find(msg, sp..'disablegadget'..ep) + if (match) then + self:DisableGadget(match) + return false + end end + + if (actionHandler.GotChatMsg(msg, player)) then + return true + end + + for _,g in ipairs(self.GotChatMsgList) do + if (g:GotChatMsg(msg, player)) then + return true + end + end + + return false end -function gadgetHandler:DownloadProgress(id, downloaded, total) - for _,g in r_ipairs(self.DownloadProgressList) do - g:DownloadProgress(id, downloaded, total) + +-- ours +function gadgetHandler:ViewResize(viewGeometry) + local vsx = viewGeometry.viewSizeX + local vsy = viewGeometry.viewSizeY + + for _,g in ipairs(self.ViewResizeList) do + g:ViewResize(vsx, vsy, viewGeometry) end + return end +-- base +--[[ +function gadgetHandler:ViewResize(vsx, vsy) + for _,g in ipairs(self.ViewResizeList) do + g:ViewResize(vsx, vsy) + end + return +end + +-- generates ViewResize() calls for the gadgets +function gadgetHandler:SetViewSize(vsx, vsy) + self.xViewSize = vsx + self.yViewSize = vsy + if ((self.xViewSizeOld ~= vsx) or + (self.yViewSizeOld ~= vsy)) then + gadgetHandler:ViewResize(vsx, vsy) + self.xViewSizeOld = vsx + self.yViewSizeOld = vsy + end +end +--]] + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +-- +-- FIXME: NOT IN BASE VERSION +-- -function gadgetHandler:Save(zip) - for _,g in r_ipairs(self.SaveList) do - g:Save(zip) +function gadgetHandler:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams) -- opts is a bitmask + for _,g in ipairs(self.UnitCommandList) do + g:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams) end return end +function gadgetHandler:UnitEnteredWater(unitID, unitDefID, unitTeam) + for _,g in ipairs(self.UnitEnteredWaterList) do + g:UnitEnteredWater(unitID, unitDefID, unitTeam) + end + return +end -function gadgetHandler:Load(zip) - for _,g in r_ipairs(self.LoadList) do - g:Load(zip) + +function gadgetHandler:UnitEnteredAir(unitID, unitDefID, unitTeam) + for _,g in ipairs(self.UnitEnteredAirList) do + g:UnitEnteredAir(unitID, unitDefID, unitTeam) + end + return +end + + +function gadgetHandler:UnitLeftWater(unitID, unitDefID, unitTeam) + for _,g in ipairs(self.UnitLeftWaterList) do + g:UnitLeftWater(unitID, unitDefID, unitTeam) end return end + +function gadgetHandler:UnitLeftAir(unitID, unitDefID, unitTeam) + for _,g in ipairs(self.UnitLeftAirList) do + g:UnitLeftAir(unitID, unitDefID, unitTeam) + end + return +end + +function gadgetHandler:GameSetup(state, ready, playerStates) + for _,g in ipairs(self.GameSetupList) do + local success, newReady = g:GameSetup(state, ready, playerStates) + if (success) then + return true, newReady + end + end + return false +end + +--[[ +-- makes available to gadgets with handler = true +function gadgetHandler:AddSyncAction(gadget, cmd, func, help) + return actionHandler.AddSyncAction(gadget, cmd, func, help) +end + +function gadgetHandler:RemoveSyncAction(gadget, cmd) + return actionHandler.RemoveSyncAction(gadget, cmd) +end +]] + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- gadgetHandler:Initialize() --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/Configs/LuaMex/options.lua b/LuaUI/Configs/LuaMex/options.lua index 729003eab..948d0d75e 100644 --- a/LuaUI/Configs/LuaMex/options.lua +++ b/LuaUI/Configs/LuaMex/options.lua @@ -1,6 +1,3 @@ -local metalMultiplier = tonumber(Spring.GetModOptions().mexincomemultiplier) or 50 -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions -local metalMultiplier = metalMultiplier * 0.01 - options = { drawincome = { @@ -27,7 +24,7 @@ options = { size = { name = "Income Display Size", type = "number", - value = 40, + value = 50, min = 10, max = 150, step = 5, @@ -45,7 +42,7 @@ options = { multiplier = { name = "Multiplier used for base mex value", type = "number", - value = metalMultiplier, -- Most games will use 1 for this value as most games base mex income around a mex giving 2.0. Please note that changing this value only changes the number visually displayed underneath the mex spot. The actual multiplier is determined in the mex unitdef customparam "metal_extractor = ," + value = 1, -- Most games will use 1 for this value as most games base mex income around a mex giving 2.0. Please note that changing this value only changes the number visually displayed underneath the mex spot. The actual multiplier is determined in the mex unitdef customparam "metal_extractor = ," min = 0, max = 100, OnChange = function() updateMexDrawList() end diff --git a/LuaUI/Configs/evo_buildHotkeysConfig.lua b/LuaUI/Configs/evo_buildHotkeysConfig.lua new file mode 100644 index 000000000..64a5c4a2c --- /dev/null +++ b/LuaUI/Configs/evo_buildHotkeysConfig.lua @@ -0,0 +1,102 @@ +local a = 97 +local b = 98 +local c = 99 +local d = 100 +local e = 101 +local f = 102 +local g = 103 +local h = 104 +local i = 105 +local j = 106 +local k = 107 +local l = 108 +local m = 109 +local n = 110 +local o = 111 +local p = 112 +local q = 113 +local r = 114 +local s = 115 +local t = 116 +local u = 117 +local v = 118 +local w = 119 +local x = 120 +local y = 121 +local z = 122 + +nameToKeyCode = { + ehbotfac = {f, b}, + eminifac = {f, t}, + ebasefactory = {f, h}, + eamphibfac = {f, a}, + eairplant = {f, p}, + f1landfac = {f, l}, + f2landfac = {f, l}, + + etech1 = {b, t}, + emetalextractor = {e, m}, + esolar2 = {e, s}, + egeothermal = {e, g}, + efusion2 = {e, f}, + estorage = {e, d}, + + eradar2 = {b, r}, + ejammer2 = {b, j}, + ekmar = {b, k}, + emine = {v, m}, + elightturret2 = {v, p}, + eheavyturret2 = {v, i}, + elaserbattery = {v, b}, + eartyturret = {v, l}, + eshieldgen = {v, a}, + esilo = {v, s}, + escoutdrone = {b, d}, + ebox = {b, x}, + ehbotengineer = {b, e}, + fedengineer = {b, e}, + lozengineer = {b, e}, + eorb = {b, o}, + ecommander = {v, o}, + + -- HBots + ehbotpeewee = {q}, + ehbotthud = {w}, + ehbotsniper = {e}, + ehbotrocko = {r}, + ehbotkarganneth = {t}, + + -- ATs + eallterrlight = {q}, + eallterrriot = {w}, + eallterrmed = {e}, + eallterrheavy = {r}, + eallterrassault = {t}, + eallterranarchid = {y}, + eallterrshield = {u}, + + -- Hovers + elighttank3 = {q}, + eriottank2 = {w}, + eheavytank3 = {e}, + emissiletank = {r}, + eartytank = {t}, + elacerator = {y}, + + -- Amphibious + eamphibbuggy = {q}, + eamphibriot = {w}, + eamphibneedle = {e}, + eamphibmedtank = {r}, + eamphibrock = {t}, + eamphibarty = {y}, + eamphibleveler = {u}, + + -- Air + efighter = {q}, + egunship2 = {w}, + ebomber = {e}, + eairemp = {r}, + etransport = {t}, + ekrow = {y}, +} diff --git a/LuaUI/Configs/integral_menu_commands.lua b/LuaUI/Configs/integral_menu_commands.lua deleted file mode 100644 index 3bf7b9344..000000000 --- a/LuaUI/Configs/integral_menu_commands.lua +++ /dev/null @@ -1,331 +0,0 @@ -VFS.Include("LuaRules/Configs/customcmds.h.lua") - ---FIXME: use this table until state tooltip detection is fixed -local tooltips = { - priority = "Priority: Set construction priority (low, normal, high)", - miscpriority = "Misc Priority: Set priority for morph or stockpile (low, normal, high)", - retreat = "Retreat: Retreat to closest retreat point at 30/60/90% of health (right-click to disable)", - landat = "Repair level: set the HP % at which this aircraft will go to a repair pad (0, 30, 50, 80)", - factoryGuard = "Auto Assist: Newly built constructors automatically assist their factory", - diveBomb = "\255\90\255\90Green\255\255\255\255:Dive For Shielded Target\n\255\255\255\90Yellow\255\255\255\255:Dive For All Target\n\255\255\90\90Red\255\255\255\255:Always Fly Low\n\255\90\90\90Grey\255\255\255\255:Always Fly High", --override tooltip supplied by unit_bomber_dive.lua gadget. - floatState = "\255\90\255\90Green\255\255\255\255:Always float \n\255\90\90\90Grey\255\255\255\255:Float to fire\n\255\255\90\90Red\255\255\255\255:Never float", - fireState = "Fire State: Sets under what conditions a unit will fire without an explicit attack order (never, when attacked, always)", - moveState = "Move State: Sets how far out of its way a unit will move to attack enemies", - ["repeat"] = "Repeat: if on the unit will continously push finished orders to the end of its order queue", -} - -local factories = { - ebasefactory = {order = 1}, - ebasefactoryai = {order = 1}, - eamphibfac = {order = 2}, - eamphibfacai = {order = 2}, - eminifac = {order = 3}, - eminifacai = {order = 3}, - eairplant = {order = 4}, - eairplantai = {order = 4}, --- eexperimentalfac = {order = 5}, -} - ---Integral menu is NON-ROBUST ---all buildings (except facs) need a row or they won't appear! ---you can put too many things into the same row, but the buttons will be squished -local econ = { --- emetalextractor = {order = 1, row = 1}, --- emetalextractorai = {order = 1, row = 1}, - esolar2 = {order = 2, row = 1}, - esolar2ai = {order = 2, row = 1}, - emediumgen = {order = 3, row = 1}, - emediumgenai = {order = 3, row = 1}, - egeothermal = {order = 4, row = 1}, - efusion2 = {order = 5, row = 1}, - efusion2ai = {order = 5, row = 1}, - emaker = {order = 1, row = 2}, - estorage = {order = 2, row = 2}, - estorageai = {order = 2, row = 2}, -} - -local defense = { - elightturret2 = {order = 0, row = 1}, - elightturret2ai = {order = 0, row = 1}, - eheavyturret2 = {order = 1, row = 1}, - eheavyturret2ai = {order = 1, row = 1}, - euwturret = {order = 2, row = 1}, - eartyturret = {order = 3, row = 1}, - emine = {order = 4, row = 1}, - emineai = {order = 4, row = 1}, - ekmar = {order = 0, row = 2}, - eshieldgen = {order = 1, row = 2}, -} - -local aux = { --merged into special - eorb = {order = 0, row = 1}, - eorbai = {order = 0, row = 1}, - ecommander = {order = 1, row = 1}, - eradar2 = {order = 0, row = 2}, - ejammer2 = {order = 1, row = 2}, -} - -local super = { --merged into special - ecruisesilo = {order = 0, row = 2}, - ecruisesiloai = {order = 0, row = 2}, - esilo = {order = 1, row = 2}, -} - ---manual entries not needed; menu has autodetection -local common_commands = {} -local states_commands = {} - -local factory_commands = {} -local econ_commands = {} -local defense_commands = {} -local special_commands = { - -- [CMD_RAMP] = {order = 16, row = 3}, - -- [CMD_LEVEL] = {order = 17, row = 3}, - -- [CMD_RAISE] = {order = 18, row = 3}, - -- [CMD_RESTORE] = {order = 19, row = 3}, - -- [CMD_SMOOTH] = {order = 20, row = 3}, - --[CMD_BUMPY] = {order = 21, row = 3}, -} - -local function CopyBuildArray(source, target) - for name, value in pairs(source) do - udef = (UnitDefNames[name]) - if udef then - target[-udef.id] = value - end - end -end - -CopyBuildArray(factories, factory_commands) -CopyBuildArray(econ, econ_commands) -CopyBuildArray(aux, special_commands) -CopyBuildArray(defense, defense_commands) -CopyBuildArray(super, special_commands) - --- Global commands defined here - they have cmdDesc format + -local globalCommands = { ---[[ { - name = "crap", - texture= 'LuaUi/Images/move_hold.png', - id = math.huge, - OnClick = {function() - Spring.SendMessage("crap") - end } - } - { - id = CMD_RETREAT_ZONE - type = CMDTYPE.ICON_MAP, - tooltip = 'Place a retreat zone. Units will retreat there. Constructors placed in it will repair units.', - cursor = 'Repair', - action = 'sethaven', - params = { }, - texture = 'LuaUI/Images/ambulance.png', - }]]-- -} - --- Command overrides. State commands by default expect array of textures, one for each state. --- You can specify texture, text,tooltip, color -local imageDir = 'LuaUI/Images/commands/' - ---[[ -local overrides = { - [CMD.ATTACK] = { texture = imageDir .. 'attack.png', text= '\255\0\255\0A\008ttack'}, - [CMD.STOP] = { texture = imageDir .. 'cancel.png', color={1,0,0,1.2}, text= '\255\0\255\0S\008top'}, - [CMD.FIGHT] = { texture = imageDir .. 'fight.png',text= '\255\0\255\0F\008ight'}, - [CMD.GUARD] = { texture = imageDir .. 'guard.png', text= '\255\0\255\0G\008uard'}, - [CMD.MOVE] = { texture = imageDir .. 'move.png', text= '\255\0\255\0M\008ove'}, - [CMD.PATROL] = { texture = imageDir .. 'patrol.png', text= '\255\0\255\0P\008atrol'}, - [CMD.WAIT] = { texture = imageDir .. 'wait.png', text= '\255\0\255\0W\008ait'}, - - [CMD.REPAIR] = {text= '\255\0\255\0R\008epair', texture = imageDir .. 'repair.png'}, - [CMD.RECLAIM] = {text= 'R\255\0\255\0e\008claim', texture = imageDir .. 'reclaim.png'}, - [CMD.RESURRECT] = {text= 'Resurrec\255\0\255\0t\008', texture = imageDir .. 'resurrect.png'}, - [CMD_BUILD] = {text = '\255\0\255\0B\008uild'}, - [CMD.DGUN] = { texture = imageDir .. 'dgun.png', text= '\255\0\255\0D\008Gun'}, - - [CMD_RAMP] = {text = 'Ramp', texture = imageDir .. 'ramp.png'}, - [CMD_LEVEL] = {text = 'Level', texture = imageDir .. 'level.png'}, - [CMD_RAISE] = {text = 'Raise', texture = imageDir .. 'raise.png'}, - [CMD_SMOOTH] = {text = 'Smooth', texture = imageDir .. 'smooth.png'}, - [CMD_RESTORE] = {text = 'Restore', texture = imageDir .. 'restore.png'}, - - [CMD_AREA_MEX] = {text = 'Mex', texture = 'LuaUi/Images/ibeam.png'}, - [CMD_JUMP] = {text = 'Jump', texture = imageDir .. 'Bold/jump.png'}, - - [CMD.ONOFF] = { texture = {imageDir .. 'states/off.png', imageDir .. 'states/on.png'}, text=''}, - [CMD_UNIT_AI] = { texture = {imageDir .. 'states/bulb_off.png', imageDir .. 'states/bulb_on.png'}, text=''}, - [CMD.REPEAT] = { texture = {imageDir .. 'states/repeat_off.png', imageDir .. 'states/repeat_on.png'}, text=''}, - [CMD.CLOAK] = { texture = {imageDir .. 'states/cloak_off.png', imageDir .. 'states/cloak_on.png'}, text ='', tooltip = 'Unit cloaking state - press \255\0\255\0K\008 to toggle'}, - [CMD_CLOAK_SHIELD] = { texture = {imageDir .. 'states/areacloak_off.png', imageDir .. 'states/areacloak_on.png'}, text ='',}, - [CMD_STEALTH] = { texture = {imageDir .. 'states/stealth_off.png', imageDir .. 'states/stealth_on.png'}, text ='', }, - [CMD_PRIORITY] = { texture = {imageDir .. 'states/wrench_low.png', imageDir .. 'states/wrench_med.png', imageDir .. 'states/wrench_high.png'}, text='', tooltip = tooltips.priority}, - [CMD.MOVE_STATE] = { texture = {imageDir .. 'states/move_hold.png', imageDir .. 'states/move_engage.png', imageDir .. 'states/move_roam.png'}, text=''}, - [CMD.FIRE_STATE] = { texture = {imageDir .. 'states/fire_hold.png', imageDir .. 'states/fire_return.png', imageDir .. 'states/fire_atwill.png'}, text=''}, - [CMD_RETREAT] = { texture = {imageDir .. 'states/retreat_off.png', imageDir .. 'states/retreat_30.png', imageDir .. 'states/retreat_60.png', imageDir .. 'states/retreat_90.png'}, text=''}, -}]] - -local overrides = { - [CMD.ATTACK] = { texture = imageDir .. 'Bold/attack.png'}, - [CMD.STOP] = { texture = imageDir .. 'Bold/cancel.png'}, - [CMD.FIGHT] = { texture = imageDir .. 'Bold/fight.png'}, - [CMD.GUARD] = { texture = imageDir .. 'Bold/guard.png'}, - [CMD.MOVE] = { texture = imageDir .. 'Bold/move.png'}, - [CMD.PATROL] = { texture = imageDir .. 'Bold/patrol.png'}, - [CMD.WAIT] = { texture = imageDir .. 'Bold/wait.png'}, - [CMD.CAPTURE] = { texture = imageDir .. 'Bold/capture.png'}, - - [CMD.REPAIR] = {texture = imageDir .. 'Bold/repair.png'}, - [CMD.RECLAIM] = {texture = imageDir .. 'Bold/reclaim.png'}, - [CMD.RESURRECT] = {texture = imageDir .. 'Bold/resurrect.png'}, - [CMD_BUILD] = {texture = imageDir .. 'Bold/build.png'}, - [CMD.MANUALFIRE] = { texture = imageDir .. 'Bold/dgun.png'}, - - [CMD.LOAD_UNITS] = { texture = imageDir .. 'Bold/load.png'}, - [CMD.UNLOAD_UNITS] = { texture = imageDir .. 'Bold/unload.png'}, - [CMD.AREA_ATTACK] = { texture = imageDir .. 'Bold/areaattack.png'}, - - [CMD_RAMP] = {texture = imageDir .. 'ramp.png'}, - [CMD_LEVEL] = {texture = imageDir .. 'level.png'}, - [CMD_RAISE] = {texture = imageDir .. 'raise.png'}, - [CMD_SMOOTH] = {texture = imageDir .. 'smooth.png'}, - [CMD_RESTORE] = {texture = imageDir .. 'restore.png'}, - [CMD_BUMPY] = {texture = imageDir .. 'bumpy.png'}, - - [CMD_AREA_GUARD] = { texture = imageDir .. 'Bold/guard.png'}, - - [CMD_AREA_MEX] = {text = ' ', texture = imageDir .. 'Bold/mex.png'}, - - [CMD_JUMP] = {texture = imageDir .. 'Bold/jump.png'}, - - [CMD_FIND_PAD] = {text = ' ', texture = imageDir .. 'Bold/rearm.png'}, - - [CMD_EMBARK] = {text = ' ', texture = imageDir .. 'Bold/embark.png'}, - [CMD_DISEMBARK] = {text = ' ', texture = imageDir .. 'Bold/disembark.png'}, - - [CMD_ONECLICK_WEAPON] = {},--texture = imageDir .. 'Bold/action.png'}, - [CMD_UNIT_SET_TARGET_CIRCLE] = {text='', texture = imageDir .. 'Bold/settarget.png'}, - [CMD_UNIT_CANCEL_TARGET] = {text='', texture = imageDir .. 'Bold/canceltarget.png'}, - - [CMD_ABANDON_PW] = {text= '', texture = 'LuaUI/Images/Crystal_Clear_action_flag_white.png'}, - - [CMD_PLACE_BEACON] = {text= '', texture = imageDir .. 'Bold/drop_beacon.png'}, - - -- states - [CMD.ONOFF] = { texture = {imageDir .. 'states/off.png', imageDir .. 'states/on.png'}, text=''}, - [CMD_UNIT_AI] = { texture = {imageDir .. 'states/bulb_off.png', imageDir .. 'states/bulb_on.png'}, text=''}, - [CMD.REPEAT] = { texture = {imageDir .. 'states/repeat_off.png', imageDir .. 'states/repeat_on.png'}, text='', tooltip = tooltips["repeat"]}, - [CMD.CLOAK] = { texture = {imageDir .. 'states/cloak_off.png', imageDir .. 'states/cloak_on.png'}, - text ='', tooltip = 'Unit cloaking state - press \255\0\255\0K\008 to toggle'}, - [CMD_WANT_CLOAK] = { texture = {imageDir .. 'states/cloak_off.png', imageDir .. 'states/cloak_on.png'}, - text ='', tooltip = 'Unit cloaking state - press \255\0\255\0K\008 to toggle'}, - [CMD_CLOAK_SHIELD] = { texture = {imageDir .. 'states/areacloak_off.png', imageDir .. 'states/areacloak_on.png'}, - text ='', tooltip = 'Area Cloaker State'}, - [CMD_STEALTH] = { texture = {imageDir .. 'states/stealth_off.png', imageDir .. 'states/stealth_on.png'}, text ='', }, - [CMD_PRIORITY] = { texture = {imageDir .. 'states/wrench_low.png', imageDir .. 'states/wrench_med.png', imageDir .. 'states/wrench_high.png'}, - text='', tooltip = tooltips.priority}, - [CMD_MISC_PRIORITY] = { texture = {imageDir .. 'states/wrench_low_other.png', imageDir .. 'states/wrench_med_other.png', imageDir .. 'states/wrench_high_other.png'}, - text='', tooltip = tooltips.miscpriority}, - [CMD_FACTORY_GUARD] = { texture = {imageDir .. 'states/autoassist_off.png', imageDir .. 'states/autoassist_on.png'}, - text='', tooltip = tooltips.factoryGuard,}, - [CMD.MOVE_STATE] = { texture = {imageDir .. 'states/move_hold.png', imageDir .. 'states/move_engage.png', imageDir .. 'states/move_roam.png'}, text='', tooltip = tooltips.moveState}, - [CMD.FIRE_STATE] = { texture = {imageDir .. 'states/fire_hold.png', imageDir .. 'states/fire_return.png', imageDir .. 'states/fire_atwill.png'}, text='', tooltip = tooltips.fireState}, - [CMD_RETREAT] = { texture = {imageDir .. 'states/retreat_off.png', imageDir .. 'states/retreat_30.png', imageDir .. 'states/retreat_60.png', imageDir .. 'states/retreat_90.png'}, - text='', tooltip = tooltips.retreat,}, - [CMD.IDLEMODE] = { texture = {imageDir .. 'states/fly_on.png', imageDir .. 'states/fly_off.png'}, text=''}, - [CMD_AP_FLY_STATE] = { texture = {imageDir .. 'states/fly_on.png', imageDir .. 'states/fly_off.png'}, text=''}, - [CMD.AUTOREPAIRLEVEL] = { texture = {imageDir .. 'states/landat_off.png', imageDir .. 'states/landat_30.png', imageDir .. 'states/landat_50.png', imageDir .. 'states/landat_80.png'}, - text = '', tooltip = tooltips.landat,}, - [CMD_AP_AUTOREPAIRLEVEL] = { texture = {imageDir .. 'states/landat_off.png', imageDir .. 'states/landat_30.png', imageDir .. 'states/landat_50.png', imageDir .. 'states/landat_80.png'}, - text = ''}, - [CMD_UNIT_BOMBER_DIVE_STATE] = { texture = {imageDir .. 'states/divebomb_off.png', imageDir .. 'states/divebomb_shield.png', imageDir .. 'states/divebomb_attack.png', imageDir .. 'states/divebomb_always.png'}, - text = '', tooltip = tooltips.diveBomb}, - [CMD_UNIT_KILL_SUBORDINATES] = {texture = {imageDir .. 'states/capturekill_off.png', imageDir .. 'states/capturekill_on.png'}, text=''}, - [CMD_DONT_FIRE_AT_RADAR] = {texture = {imageDir .. 'states/stealth_on.png', imageDir .. 'states/stealth_off.png'}, text=''}, - [CMD.TRAJECTORY] = { texture = {imageDir .. 'states/traj_low.png', imageDir .. 'states/traj_high.png'}, text=''}, - [CMD_AIR_STRAFE] = { texture = {imageDir .. 'states/strafe_off.png', imageDir .. 'states/strafe_on.png'}, text=''}, - [CMD_UNIT_FLOAT_STATE] = { texture = {imageDir .. 'states/amph_sink.png', imageDir .. 'states/amph_attack.png', imageDir .. 'states/amph_float.png'}, text='', tooltip=tooltips.floatState}, - } - --- noone really knows what this table does but it's needed for epic menu to get the hotkey -local custom_cmd_actions = { - -- states are 2, targeted commands (e.g. attack) are 1, instant commands (e.g. selfd) are 3 - -- can (probably) set to 1 instead of 3 if order doesn't need to be queueable - --SPRING COMMANDS - selfd=3, - attack=1, - stop=3, - fight=1, - guard=1, - move=1, - patrol=1, - wait=3, - repair=1, - reclaim=1, - resurrect=1, - manualfire=1, - loadunits=1, - unloadunits=1, - areaattack=1, - - -- states - onoff=2, - ['repeat']=2, - cloak=2, - movestate=2, - firestate=2, - idlemode=2, - autorepairlevel=2, - - - --CUSTOM COMMANDS - sethaven=1, - --build=1, - areamex=1, - areaguard=1, - mine=1, - build=1, - jump=1, - find_pad=3, - embark=3, - disembark=3, - oneclickwep=3, - settarget=1, - settargetcircle=1, - canceltarget=3, - setferry=1, - radialmenu=3, - placebeacon=1, - buildprev=1, - - -- terraform - rampground=1, - levelground=1, - raiseground=1, - smoothground=1, - restoreground=1, - --terraform_internal=1, - - resetfire=3, - resetmove=3, - - --states --- stealth=2, --no longer applicable - cloak_shield=2, - retreat=2, - ['luaui noretreat']=2, - priority=2, - miscpriority=2, - ap_fly_state=2, - ap_autorepairlevel=2, - floatstate=2, - dontfireatradar=2, - antinukezone=2, - unitai=2, - unit_kill_subordinates=2, - autoassist=2, - airstrafe=2, - divestate=2, -} - - -return common_commands, states_commands, factory_commands, econ_commands, defense_commands, special_commands, globalCommands, overrides, custom_cmd_actions \ No newline at end of file diff --git a/LuaUI/Configs/lupsfxs.lua b/LuaUI/Configs/lupsfxs.lua index 1adde6fef..eba7f9461 100644 --- a/LuaUI/Configs/lupsfxs.lua +++ b/LuaUI/Configs/lupsfxs.lua @@ -230,6 +230,24 @@ shieldBursts400 = { count = 20, } +shieldBursts1000 = { + layer = -35, + life = math.huge, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 1000, + sizeSpread = 50, + texture = "bitmaps/GPL/Lups/shieldbursts5.png", + --colormap = { {1, 0.6, 1, 0.8} }, + colormap = { {1, 1, 1, 0.1} }, + directional= true, + repeatEffect = true, + count = 10, +} + shieldBursts1500 = { layer = -35, life = math.huge, @@ -329,6 +347,16 @@ ShieldSphere400 = { repeatEffect=true } +ShieldSphere1000 = { + layer=-34, + life=20, + pos={0,60,0}, + size=1000, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + repeatEffect=true +} + ShieldSphere1500 = { layer=-34, life=20, diff --git a/LuaUI/Configs/lupsunitfxs.lua b/LuaUI/Configs/lupsunitfxs.lua index 3a555b5bc..4a0845921 100644 --- a/LuaUI/Configs/lupsunitfxs.lua +++ b/LuaUI/Configs/lupsunitfxs.lua @@ -1,34 +1,34 @@ effectUnitDefs = { ------------------ ------------------ - edrone = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=20, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=20, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=20, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=20, piece="rengine2", onActive=true}}, + escoutdrone = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=40, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=40, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=40, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=40, piece="rengine2", onActive=true}}, }, efighter = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine3", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine4", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine3", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine4", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="rengine2", onActive=true}}, }, egunship2 = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=50, piece="rengine2", onActive=true}}, }, ebomber = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=100, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=100, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=100, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=100, piece="rengine2", onActive=true}}, }, eairengineer = { @@ -39,10 +39,10 @@ effectUnitDefs = { }, escout = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="rengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="rengine2", onActive=true}}, }, eraider = { @@ -52,15 +52,22 @@ effectUnitDefs = { {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="rengine2", onActive=true}}, }, + eairemp = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=70, piece="rengine2", onActive=true}}, + }, + ekrow = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine1", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine2", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine3", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine4", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine5", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine6", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine7", onActive=true, emitVector = {0, 1, 0}}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine8", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine2", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine3", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine4", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine5", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine6", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine7", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=120, piece="engine8", onActive=true, emitVector = {0, 1, 0}}}, }, eairplant = { @@ -75,14 +82,14 @@ effectUnitDefs = { }, etransport = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="fengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="fengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="rengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="rengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="bengine1", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="bengine2", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="bengine3", onActive=true}}, - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="bengine4", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="fengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="fengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="rengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="rengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="bengine1", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="bengine2", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="bengine3", onActive=true}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 2, length=30, piece="bengine4", onActive=true}}, }, ------------------ @@ -355,8 +362,106 @@ effectUnitDefs = { ehbotrocko = { {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotkarganneth = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + + ehbotengineer_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotpeewee_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotthud_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotsniper_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotrocko_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotkarganneth_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + + ehbotengineer_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotpeewee_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotthud_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotsniper_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotrocko_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotkarganneth_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + + ehbotengineer_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotpeewee_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotthud_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotsniper_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, }, + ehbotrocko_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + + ehbotkarganneth_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust1", onActive=true, emitVector = {0, 1, 0}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 5, length=20, piece="exhaust2", onActive=true, emitVector = {0, 1, 0}}}, + }, + ------------------ ------------------ @@ -497,7 +602,7 @@ effectUnitDefs = { eallterrshield = { --{class='ShieldSphere',options=ShieldSphere300}, - {class='Bursts',options=shieldBursts300}, +-- {class='Bursts',options=shieldBursts200}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -509,7 +614,7 @@ effectUnitDefs = { eallterrshield_up1 = { --{class='ShieldSphere',options=ShieldSphere300}, - {class='Bursts',options=shieldBursts300}, + --{class='Bursts',options=shieldBursts300}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -522,7 +627,7 @@ effectUnitDefs = { eallterrshield_up2 = { --{class='ShieldSphere',options=ShieldSphere300}, - {class='Bursts',options=shieldBursts300}, +-- {class='Bursts',options=shieldBursts200}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -535,7 +640,7 @@ effectUnitDefs = { eallterrshield_up3 = { --{class='ShieldSphere',options=ShieldSphere300}, - {class='Bursts',options=shieldBursts300}, +-- {class='Bursts',options=shieldBursts200}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -550,19 +655,19 @@ effectUnitDefs = { ekmar = { --{class='ShieldSphere',options=ShieldSphere400}, - {class='Bursts',options=shieldBursts400}, +-- {class='Bursts',options=shieldBursts200}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, -- {class='StaticParticles', options=corfusNova4}, -- {class='Bursts', options=efusion2Bursts}, - {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=405, precision=0, strength = 0.001, repeatEffect=true}}, + {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=1005, precision=0, strength = 0.001, repeatEffect=true}}, }, ecommandershield = { --{class='ShieldSphere',options=ShieldSphere400}, - {class='Bursts',options=shieldBursts400}, +-- {class='Bursts',options=shieldBursts200}, -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, diff --git a/LuaUI/Configs/marking_menu_keys.lua b/LuaUI/Configs/marking_menu_keys.lua deleted file mode 100644 index ea0ddd83d..000000000 --- a/LuaUI/Configs/marking_menu_keys.lua +++ /dev/null @@ -1,71 +0,0 @@ -local config = { - qwerty = { - keys = { - [KEYSYMS.W] = '0', - [KEYSYMS.E] = '45', - [KEYSYMS.D] = '90', - [KEYSYMS.C] = '135', - [KEYSYMS.X] = '180', - [KEYSYMS.Z] = '225', - [KEYSYMS.A] = '270', - [KEYSYMS.Q] = '315', - }, - keys_display = { - 'W', - 'E', - 'D', - 'C', - 'X', - 'Z', - 'A', - 'Q', - } - }, - qwerty_d = { - keys = { - [KEYSYMS.E] = '0', - [KEYSYMS.R] = '45', - [KEYSYMS.F] = '90', - [KEYSYMS.V] = '135', - [KEYSYMS.C] = '180', - [KEYSYMS.X] = '225', - [KEYSYMS.S] = '270', - [KEYSYMS.W] = '315', - }, - keys_display = { - 'E', - 'R', - 'F', - 'V', - 'C', - 'X', - 'S', - 'W', - } - }, - - qwertz = { - keys = { - [KEYSYMS.W] = '0', - [KEYSYMS.E] = '45', - [KEYSYMS.D] = '90', - [KEYSYMS.C] = '135', - [KEYSYMS.X] = '180', - [KEYSYMS.Y] = '225', - [KEYSYMS.A] = '270', - [KEYSYMS.Q] = '315', - }, - keys_display = { - 'W', - 'E', - 'D', - 'C', - 'X', - 'Y', - 'A', - 'Q', - } - } -} - -return config diff --git a/LuaUI/Configs/marking_menu_menus.lua b/LuaUI/Configs/marking_menu_menus.lua deleted file mode 100644 index 63cf4fabd..000000000 --- a/LuaUI/Configs/marking_menu_menus.lua +++ /dev/null @@ -1,32 +0,0 @@ -local menu_ecommander = { - items = { - { - angle = 0, - unit = "emetalextractor", - label = "Economy", - items = { - { - angle = 45, - unit = "esolar2" - }, - } - }, - { - angle = -45, - unit = "ebasefactory", - label = "Facs", - items = { - { - angle = 90, - unit = "eairplant" - }, - - } - }, - } -} -local menu_use = { - ecommander = menu_ecommander, -} - -return menu_use diff --git a/LuaUI/Fonts/ComicSans-Bold.ttf b/LuaUI/Fonts/ComicSans-Bold.ttf new file mode 100644 index 000000000..b84728924 Binary files /dev/null and b/LuaUI/Fonts/ComicSans-Bold.ttf differ diff --git a/LuaUI/Fonts/ComicSans.ttf b/LuaUI/Fonts/ComicSans.ttf new file mode 100644 index 000000000..22d569472 Binary files /dev/null and b/LuaUI/Fonts/ComicSans.ttf differ diff --git a/LuaUI/Fonts/FreeMonoBold_12.lua b/LuaUI/Fonts/FreeMonoBold_12.lua deleted file mode 100644 index 6185160af..000000000 --- a/LuaUI/Fonts/FreeMonoBold_12.lua +++ /dev/null @@ -1,1365 +0,0 @@ --- $Id: FreeMonoBold_12.lua 3171 2008-11-06 09:06:29Z det $ - -local fontSpecs = { - srcFile = [[Fonts/FreeMonoBold.ttf]], - family = [[FreeMono]], - style = [[Bold]], - yStep = 13, - height = 12, - xTexSize = 256, - yTexSize = 256, - outlineRadius = 1, - outlineWeight = 100, -} - -local glyphs = {} - -glyphs[32] = { --' '-- - num = 32, - adv = 7, - oxn = -1, oyn = -2, oxp = 2, oyp = 1, - txn = 1, tyn = 1, txp = 4, typ = 4, -} -glyphs[33] = { --'!'-- - num = 33, - adv = 7, - oxn = 1, oyn = -2, oxp = 6, oyp = 9, - txn = 14, tyn = 1, txp = 19, typ = 12, -} -glyphs[34] = { --'"'-- - num = 34, - adv = 7, - oxn = 0, oyn = 2, oxp = 7, oyp = 9, - txn = 27, tyn = 1, txp = 34, typ = 8, -} -glyphs[35] = { --'#'-- - num = 35, - adv = 7, - oxn = -1, oyn = -3, oxp = 8, oyp = 10, - txn = 40, tyn = 1, txp = 49, typ = 14, -} -glyphs[36] = { --'$'-- - num = 36, - adv = 7, - oxn = 0, oyn = -3, oxp = 8, oyp = 10, - txn = 53, tyn = 1, txp = 61, typ = 14, -} -glyphs[37] = { --'%'-- - num = 37, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 66, tyn = 1, txp = 75, typ = 12, -} -glyphs[38] = { --'&'-- - num = 38, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 8, - txn = 79, tyn = 1, txp = 88, typ = 11, -} -glyphs[39] = { --'''-- - num = 39, - adv = 7, - oxn = 1, oyn = 2, oxp = 6, oyp = 9, - txn = 92, tyn = 1, txp = 97, typ = 8, -} -glyphs[40] = { --'('-- - num = 40, - adv = 7, - oxn = 2, oyn = -3, oxp = 7, oyp = 9, - txn = 105, tyn = 1, txp = 110, typ = 13, -} -glyphs[41] = { --')'-- - num = 41, - adv = 7, - oxn = 0, oyn = -3, oxp = 6, oyp = 9, - txn = 118, tyn = 1, txp = 124, typ = 13, -} -glyphs[42] = { --'*'-- - num = 42, - adv = 7, - oxn = 0, oyn = 1, oxp = 8, oyp = 9, - txn = 131, tyn = 1, txp = 139, typ = 9, -} -glyphs[43] = { --'+'-- - num = 43, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 144, tyn = 1, txp = 153, typ = 10, -} -glyphs[44] = { --','-- - num = 44, - adv = 7, - oxn = 0, oyn = -3, oxp = 6, oyp = 3, - txn = 157, tyn = 1, txp = 163, typ = 7, -} -glyphs[45] = { --'-'-- - num = 45, - adv = 7, - oxn = -1, oyn = 1, oxp = 8, oyp = 5, - txn = 170, tyn = 1, txp = 179, typ = 5, -} -glyphs[46] = { --'.'-- - num = 46, - adv = 7, - oxn = 1, oyn = -2, oxp = 6, oyp = 3, - txn = 183, tyn = 1, txp = 188, typ = 6, -} -glyphs[47] = { --'/'-- - num = 47, - adv = 7, - oxn = 0, oyn = -3, oxp = 8, oyp = 10, - txn = 196, tyn = 1, txp = 204, typ = 14, -} -glyphs[48] = { --'0'-- - num = 48, - adv = 7, - oxn = 0, oyn = -2, oxp = 8, oyp = 9, - txn = 209, tyn = 1, txp = 217, typ = 12, -} -glyphs[49] = { --'1'-- - num = 49, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 9, - txn = 222, tyn = 1, txp = 230, typ = 11, -} -glyphs[50] = { --'2'-- - num = 50, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 235, tyn = 1, txp = 244, typ = 11, -} -glyphs[51] = { --'3'-- - num = 51, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 1, tyn = 17, txp = 10, typ = 28, -} -glyphs[52] = { --'4'-- - num = 52, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 14, tyn = 17, txp = 23, typ = 27, -} -glyphs[53] = { --'5'-- - num = 53, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 27, tyn = 17, txp = 36, typ = 28, -} -glyphs[54] = { --'6'-- - num = 54, - adv = 7, - oxn = 0, oyn = -2, oxp = 8, oyp = 9, - txn = 40, tyn = 17, txp = 48, typ = 28, -} -glyphs[55] = { --'7'-- - num = 55, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 53, tyn = 17, txp = 62, typ = 28, -} -glyphs[56] = { --'8'-- - num = 56, - adv = 7, - oxn = 0, oyn = -2, oxp = 8, oyp = 9, - txn = 66, tyn = 17, txp = 74, typ = 28, -} -glyphs[57] = { --'9'-- - num = 57, - adv = 7, - oxn = 0, oyn = -2, oxp = 8, oyp = 9, - txn = 79, tyn = 17, txp = 87, typ = 28, -} -glyphs[58] = { --':'-- - num = 58, - adv = 7, - oxn = 1, oyn = -2, oxp = 6, oyp = 7, - txn = 92, tyn = 17, txp = 97, typ = 26, -} -glyphs[59] = { --';'-- - num = 59, - adv = 7, - oxn = 0, oyn = -3, oxp = 6, oyp = 7, - txn = 105, tyn = 17, txp = 111, typ = 27, -} -glyphs[60] = { --'<'-- - num = 60, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 118, tyn = 17, txp = 127, typ = 26, -} -glyphs[61] = { --'='-- - num = 61, - adv = 7, - oxn = -1, oyn = 0, oxp = 8, oyp = 7, - txn = 131, tyn = 17, txp = 140, typ = 24, -} -glyphs[62] = { --'>'-- - num = 62, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 7, - txn = 144, tyn = 17, txp = 153, typ = 25, -} -glyphs[63] = { --'?'-- - num = 63, - adv = 7, - oxn = 0, oyn = -2, oxp = 8, oyp = 9, - txn = 157, tyn = 17, txp = 165, typ = 28, -} -glyphs[64] = { --'@'-- - num = 64, - adv = 7, - oxn = -1, oyn = -3, oxp = 8, oyp = 9, - txn = 170, tyn = 17, txp = 179, typ = 29, -} -glyphs[65] = { --'A'-- - num = 65, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 8, - txn = 183, tyn = 17, txp = 194, typ = 26, -} -glyphs[66] = { --'B'-- - num = 66, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 196, tyn = 17, txp = 205, typ = 26, -} -glyphs[67] = { --'C'-- - num = 67, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 209, tyn = 17, txp = 218, typ = 28, -} -glyphs[68] = { --'D'-- - num = 68, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 222, tyn = 17, txp = 231, typ = 26, -} -glyphs[69] = { --'E'-- - num = 69, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 235, tyn = 17, txp = 244, typ = 26, -} -glyphs[70] = { --'F'-- - num = 70, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 1, tyn = 33, txp = 10, typ = 42, -} -glyphs[71] = { --'G'-- - num = 71, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 9, - txn = 14, tyn = 33, txp = 24, typ = 44, -} -glyphs[72] = { --'H'-- - num = 72, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 27, tyn = 33, txp = 36, typ = 42, -} -glyphs[73] = { --'I'-- - num = 73, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 8, - txn = 40, tyn = 33, txp = 48, typ = 42, -} -glyphs[74] = { --'J'-- - num = 74, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 8, - txn = 53, tyn = 33, txp = 63, typ = 43, -} -glyphs[75] = { --'K'-- - num = 75, - adv = 7, - oxn = -1, oyn = -1, oxp = 9, oyp = 8, - txn = 66, tyn = 33, txp = 76, typ = 42, -} -glyphs[76] = { --'L'-- - num = 76, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 79, tyn = 33, txp = 88, typ = 42, -} -glyphs[77] = { --'M'-- - num = 77, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 9, - txn = 92, tyn = 33, txp = 103, typ = 43, -} -glyphs[78] = { --'N'-- - num = 78, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 8, - txn = 105, tyn = 33, txp = 116, typ = 42, -} -glyphs[79] = { --'O'-- - num = 79, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 118, tyn = 33, txp = 127, typ = 44, -} -glyphs[80] = { --'P'-- - num = 80, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 131, tyn = 33, txp = 140, typ = 42, -} -glyphs[81] = { --'Q'-- - num = 81, - adv = 7, - oxn = -1, oyn = -3, oxp = 8, oyp = 9, - txn = 144, tyn = 33, txp = 153, typ = 45, -} -glyphs[82] = { --'R'-- - num = 82, - adv = 7, - oxn = -1, oyn = -1, oxp = 9, oyp = 8, - txn = 157, tyn = 33, txp = 167, typ = 42, -} -glyphs[83] = { --'S'-- - num = 83, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 170, tyn = 33, txp = 179, typ = 44, -} -glyphs[84] = { --'T'-- - num = 84, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 183, tyn = 33, txp = 192, typ = 42, -} -glyphs[85] = { --'U'-- - num = 85, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 8, - txn = 196, tyn = 33, txp = 206, typ = 43, -} -glyphs[86] = { --'V'-- - num = 86, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 8, - txn = 209, tyn = 33, txp = 220, typ = 42, -} -glyphs[87] = { --'W'-- - num = 87, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 8, - txn = 222, tyn = 33, txp = 233, typ = 42, -} -glyphs[88] = { --'X'-- - num = 88, - adv = 7, - oxn = -1, oyn = -1, oxp = 9, oyp = 8, - txn = 235, tyn = 33, txp = 245, typ = 42, -} -glyphs[89] = { --'Y'-- - num = 89, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 1, tyn = 49, txp = 10, typ = 58, -} -glyphs[90] = { --'Z'-- - num = 90, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 14, tyn = 49, txp = 23, typ = 58, -} -glyphs[91] = { --'['-- - num = 91, - adv = 7, - oxn = 2, oyn = -3, oxp = 7, oyp = 9, - txn = 27, tyn = 49, txp = 32, typ = 61, -} -glyphs[92] = { --'\'-- - num = 92, - adv = 7, - oxn = 0, oyn = -3, oxp = 8, oyp = 10, - txn = 40, tyn = 49, txp = 48, typ = 62, -} -glyphs[93] = { --']'-- - num = 93, - adv = 7, - oxn = 0, oyn = -3, oxp = 6, oyp = 9, - txn = 53, tyn = 49, txp = 59, typ = 61, -} -glyphs[94] = { --'^'-- - num = 94, - adv = 7, - oxn = 0, oyn = 2, oxp = 8, oyp = 9, - txn = 66, tyn = 49, txp = 74, typ = 56, -} -glyphs[95] = { --'_'-- - num = 95, - adv = 7, - oxn = -2, oyn = -3, oxp = 9, oyp = 1, - txn = 79, tyn = 49, txp = 90, typ = 53, -} -glyphs[96] = { --'`'-- - num = 96, - adv = 7, - oxn = 0, oyn = 4, oxp = 6, oyp = 10, - txn = 92, tyn = 49, txp = 98, typ = 55, -} -glyphs[97] = { --'a'-- - num = 97, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 105, tyn = 49, txp = 114, typ = 58, -} -glyphs[98] = { --'b'-- - num = 98, - adv = 7, - oxn = -2, oyn = -2, oxp = 8, oyp = 9, - txn = 118, tyn = 49, txp = 128, typ = 60, -} -glyphs[99] = { --'c'-- - num = 99, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 131, tyn = 49, txp = 140, typ = 58, -} -glyphs[100] = { --'d'-- - num = 100, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 9, - txn = 144, tyn = 49, txp = 154, typ = 60, -} -glyphs[101] = { --'e'-- - num = 101, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 157, tyn = 49, txp = 166, typ = 58, -} -glyphs[102] = { --'f'-- - num = 102, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 170, tyn = 49, txp = 179, typ = 59, -} -glyphs[103] = { --'g'-- - num = 103, - adv = 7, - oxn = -1, oyn = -4, oxp = 9, oyp = 7, - txn = 183, tyn = 49, txp = 193, typ = 60, -} -glyphs[104] = { --'h'-- - num = 104, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 196, tyn = 49, txp = 205, typ = 59, -} -glyphs[105] = { --'i'-- - num = 105, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 209, tyn = 49, txp = 218, typ = 59, -} -glyphs[106] = { --'j'-- - num = 106, - adv = 7, - oxn = 0, oyn = -4, oxp = 7, oyp = 9, - txn = 222, tyn = 49, txp = 229, typ = 62, -} -glyphs[107] = { --'k'-- - num = 107, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 235, tyn = 49, txp = 244, typ = 59, -} -glyphs[108] = { --'l'-- - num = 108, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 1, tyn = 65, txp = 10, typ = 75, -} -glyphs[109] = { --'m'-- - num = 109, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 7, - txn = 14, tyn = 65, txp = 25, typ = 73, -} -glyphs[110] = { --'n'-- - num = 110, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 7, - txn = 27, tyn = 65, txp = 36, typ = 73, -} -glyphs[111] = { --'o'-- - num = 111, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 40, tyn = 65, txp = 49, typ = 74, -} -glyphs[112] = { --'p'-- - num = 112, - adv = 7, - oxn = -2, oyn = -4, oxp = 8, oyp = 7, - txn = 53, tyn = 65, txp = 63, typ = 76, -} -glyphs[113] = { --'q'-- - num = 113, - adv = 7, - oxn = -1, oyn = -4, oxp = 9, oyp = 7, - txn = 66, tyn = 65, txp = 76, typ = 76, -} -glyphs[114] = { --'r'-- - num = 114, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 7, - txn = 79, tyn = 65, txp = 88, typ = 73, -} -glyphs[115] = { --'s'-- - num = 115, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 92, tyn = 65, txp = 101, typ = 74, -} -glyphs[116] = { --'t'-- - num = 116, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 105, tyn = 65, txp = 114, typ = 76, -} -glyphs[117] = { --'u'-- - num = 117, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 118, tyn = 65, txp = 127, typ = 74, -} -glyphs[118] = { --'v'-- - num = 118, - adv = 7, - oxn = -1, oyn = -1, oxp = 9, oyp = 7, - txn = 131, tyn = 65, txp = 141, typ = 73, -} -glyphs[119] = { --'w'-- - num = 119, - adv = 7, - oxn = -1, oyn = -1, oxp = 9, oyp = 7, - txn = 144, tyn = 65, txp = 154, typ = 73, -} -glyphs[120] = { --'x'-- - num = 120, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 7, - txn = 157, tyn = 65, txp = 166, typ = 73, -} -glyphs[121] = { --'y'-- - num = 121, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 7, - txn = 170, tyn = 65, txp = 179, typ = 76, -} -glyphs[122] = { --'z'-- - num = 122, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 7, - txn = 183, tyn = 65, txp = 191, typ = 73, -} -glyphs[123] = { --'{'-- - num = 123, - adv = 7, - oxn = 1, oyn = -3, oxp = 7, oyp = 9, - txn = 196, tyn = 65, txp = 202, typ = 77, -} -glyphs[124] = { --'|'-- - num = 124, - adv = 7, - oxn = 2, oyn = -3, oxp = 6, oyp = 9, - txn = 209, tyn = 65, txp = 213, typ = 77, -} -glyphs[125] = { --'}'-- - num = 125, - adv = 7, - oxn = 1, oyn = -3, oxp = 7, oyp = 9, - txn = 222, tyn = 65, txp = 228, typ = 77, -} -glyphs[126] = { --'~'-- - num = 126, - adv = 7, - oxn = -1, oyn = 1, oxp = 8, oyp = 6, - txn = 235, tyn = 65, txp = 244, typ = 70, -} -glyphs[127] = { --''-- - num = 127, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 1, tyn = 81, txp = 8, typ = 92, -} -glyphs[128] = { --'€'-- - num = 128, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 14, tyn = 81, txp = 21, typ = 92, -} -glyphs[129] = { --'�'-- - num = 129, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 27, tyn = 81, txp = 34, typ = 92, -} -glyphs[130] = { --'‚'-- - num = 130, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 40, tyn = 81, txp = 47, typ = 92, -} -glyphs[131] = { --'ƒ'-- - num = 131, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 53, tyn = 81, txp = 60, typ = 92, -} -glyphs[132] = { --'„'-- - num = 132, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 66, tyn = 81, txp = 73, typ = 92, -} -glyphs[133] = { --'…'-- - num = 133, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 79, tyn = 81, txp = 86, typ = 92, -} -glyphs[134] = { --'†'-- - num = 134, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 92, tyn = 81, txp = 99, typ = 92, -} -glyphs[135] = { --'‡'-- - num = 135, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 105, tyn = 81, txp = 112, typ = 92, -} -glyphs[136] = { --'ˆ'-- - num = 136, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 118, tyn = 81, txp = 125, typ = 92, -} -glyphs[137] = { --'‰'-- - num = 137, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 131, tyn = 81, txp = 138, typ = 92, -} -glyphs[138] = { --'Š'-- - num = 138, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 144, tyn = 81, txp = 151, typ = 92, -} -glyphs[139] = { --'‹'-- - num = 139, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 157, tyn = 81, txp = 164, typ = 92, -} -glyphs[140] = { --'Œ'-- - num = 140, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 170, tyn = 81, txp = 177, typ = 92, -} -glyphs[141] = { --'�'-- - num = 141, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 183, tyn = 81, txp = 190, typ = 92, -} -glyphs[142] = { --'Ž'-- - num = 142, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 196, tyn = 81, txp = 203, typ = 92, -} -glyphs[143] = { --'�'-- - num = 143, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 209, tyn = 81, txp = 216, typ = 92, -} -glyphs[144] = { --'�'-- - num = 144, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 222, tyn = 81, txp = 229, typ = 92, -} -glyphs[145] = { --'‘'-- - num = 145, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 235, tyn = 81, txp = 242, typ = 92, -} -glyphs[146] = { --'’'-- - num = 146, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 1, tyn = 97, txp = 8, typ = 108, -} -glyphs[147] = { --'“'-- - num = 147, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 14, tyn = 97, txp = 21, typ = 108, -} -glyphs[148] = { --'”'-- - num = 148, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 27, tyn = 97, txp = 34, typ = 108, -} -glyphs[149] = { --'•'-- - num = 149, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 40, tyn = 97, txp = 47, typ = 108, -} -glyphs[150] = { --'–'-- - num = 150, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 53, tyn = 97, txp = 60, typ = 108, -} -glyphs[151] = { --'—'-- - num = 151, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 66, tyn = 97, txp = 73, typ = 108, -} -glyphs[152] = { --'˜'-- - num = 152, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 79, tyn = 97, txp = 86, typ = 108, -} -glyphs[153] = { --'™'-- - num = 153, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 92, tyn = 97, txp = 99, typ = 108, -} -glyphs[154] = { --'š'-- - num = 154, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 105, tyn = 97, txp = 112, typ = 108, -} -glyphs[155] = { --'›'-- - num = 155, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 118, tyn = 97, txp = 125, typ = 108, -} -glyphs[156] = { --'œ'-- - num = 156, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 131, tyn = 97, txp = 138, typ = 108, -} -glyphs[157] = { --'�'-- - num = 157, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 144, tyn = 97, txp = 151, typ = 108, -} -glyphs[158] = { --'ž'-- - num = 158, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 157, tyn = 97, txp = 164, typ = 108, -} -glyphs[159] = { --'Ÿ'-- - num = 159, - adv = 7, - oxn = -1, oyn = -1, oxp = 6, oyp = 10, - txn = 170, tyn = 97, txp = 177, typ = 108, -} -glyphs[160] = { --' '-- - num = 160, - adv = 7, - oxn = -1, oyn = -2, oxp = 2, oyp = 1, - txn = 183, tyn = 97, txp = 186, typ = 100, -} -glyphs[161] = { --'¡'-- - num = 161, - adv = 7, - oxn = 1, oyn = -4, oxp = 6, oyp = 7, - txn = 196, tyn = 97, txp = 201, typ = 108, -} -glyphs[162] = { --'¢'-- - num = 162, - adv = 7, - oxn = 0, oyn = -2, oxp = 7, oyp = 9, - txn = 209, tyn = 97, txp = 216, typ = 108, -} -glyphs[163] = { --'£'-- - num = 163, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 222, tyn = 97, txp = 231, typ = 107, -} -glyphs[164] = { --'¤'-- - num = 164, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 235, tyn = 97, txp = 244, typ = 106, -} -glyphs[165] = { --'¥'-- - num = 165, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 1, tyn = 113, txp = 10, typ = 122, -} -glyphs[166] = { --'¦'-- - num = 166, - adv = 7, - oxn = 2, oyn = -3, oxp = 6, oyp = 9, - txn = 14, tyn = 113, txp = 18, typ = 125, -} -glyphs[167] = { --'§'-- - num = 167, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 8, - txn = 27, tyn = 113, txp = 36, typ = 125, -} -glyphs[168] = { --'¨'-- - num = 168, - adv = 7, - oxn = 0, oyn = 5, oxp = 7, oyp = 9, - txn = 40, tyn = 113, txp = 47, typ = 117, -} -glyphs[169] = { --'©'-- - num = 169, - adv = 7, - oxn = -2, oyn = -2, oxp = 9, oyp = 9, - txn = 53, tyn = 113, txp = 64, typ = 124, -} -glyphs[170] = { --'ª'-- - num = 170, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 66, tyn = 113, txp = 73, typ = 121, -} -glyphs[171] = { --'«'-- - num = 171, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 6, - txn = 79, tyn = 113, txp = 88, typ = 120, -} -glyphs[172] = { --'¬'-- - num = 172, - adv = 7, - oxn = -1, oyn = 0, oxp = 7, oyp = 7, - txn = 92, tyn = 113, txp = 100, typ = 120, -} -glyphs[173] = { --'­'-- - num = 173, - adv = 7, - oxn = -1, oyn = 1, oxp = 8, oyp = 5, - txn = 105, tyn = 113, txp = 114, typ = 117, -} -glyphs[174] = { --'®'-- - num = 174, - adv = 7, - oxn = -2, oyn = -2, oxp = 9, oyp = 9, - txn = 118, tyn = 113, txp = 129, typ = 124, -} -glyphs[175] = { --'¯'-- - num = 175, - adv = 7, - oxn = 0, oyn = 5, oxp = 7, oyp = 9, - txn = 131, tyn = 113, txp = 138, typ = 117, -} -glyphs[176] = { --'°'-- - num = 176, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 144, tyn = 113, txp = 151, typ = 121, -} -glyphs[177] = { --'±'-- - num = 177, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 157, tyn = 113, txp = 166, typ = 123, -} -glyphs[178] = { --'²'-- - num = 178, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 170, tyn = 113, txp = 177, typ = 121, -} -glyphs[179] = { --'³'-- - num = 179, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 183, tyn = 113, txp = 190, typ = 121, -} -glyphs[180] = { --'´'-- - num = 180, - adv = 7, - oxn = 2, oyn = 4, oxp = 7, oyp = 10, - txn = 196, tyn = 113, txp = 201, typ = 119, -} -glyphs[181] = { --'µ'-- - num = 181, - adv = 7, - oxn = -1, oyn = -3, oxp = 8, oyp = 7, - txn = 209, tyn = 113, txp = 218, typ = 123, -} -glyphs[182] = { --'¶'-- - num = 182, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 8, - txn = 222, tyn = 113, txp = 231, typ = 125, -} -glyphs[183] = { --'·'-- - num = 183, - adv = 7, - oxn = 1, oyn = 1, oxp = 6, oyp = 6, - txn = 235, tyn = 113, txp = 240, typ = 118, -} -glyphs[184] = { --'¸'-- - num = 184, - adv = 7, - oxn = 1, oyn = -4, oxp = 6, oyp = 1, - txn = 1, tyn = 129, txp = 6, typ = 134, -} -glyphs[185] = { --'¹'-- - num = 185, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 14, tyn = 129, txp = 21, typ = 137, -} -glyphs[186] = { --'º'-- - num = 186, - adv = 7, - oxn = 0, oyn = 1, oxp = 7, oyp = 9, - txn = 27, tyn = 129, txp = 34, typ = 137, -} -glyphs[187] = { --'»'-- - num = 187, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 6, - txn = 40, tyn = 129, txp = 49, typ = 136, -} -glyphs[188] = { --'¼'-- - num = 188, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 9, - txn = 53, tyn = 129, txp = 64, typ = 139, -} -glyphs[189] = { --'½'-- - num = 189, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 9, - txn = 66, tyn = 129, txp = 77, typ = 139, -} -glyphs[190] = { --'¾'-- - num = 190, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 9, - txn = 79, tyn = 129, txp = 90, typ = 139, -} -glyphs[191] = { --'¿'-- - num = 191, - adv = 7, - oxn = -1, oyn = -5, oxp = 7, oyp = 6, - txn = 92, tyn = 129, txp = 100, typ = 140, -} -glyphs[192] = { --'À'-- - num = 192, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 12, - txn = 105, tyn = 129, txp = 116, typ = 142, -} -glyphs[193] = { --'Á'-- - num = 193, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 12, - txn = 118, tyn = 129, txp = 129, typ = 142, -} -glyphs[194] = { --'Â'-- - num = 194, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 12, - txn = 131, tyn = 129, txp = 142, typ = 142, -} -glyphs[195] = { --'Ã'-- - num = 195, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 11, - txn = 144, tyn = 129, txp = 155, typ = 141, -} -glyphs[196] = { --'Ä'-- - num = 196, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 11, - txn = 157, tyn = 129, txp = 168, typ = 141, -} -glyphs[197] = { --'Å'-- - num = 197, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 12, - txn = 170, tyn = 129, txp = 181, typ = 142, -} -glyphs[198] = { --'Æ'-- - num = 198, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 8, - txn = 183, tyn = 129, txp = 194, typ = 138, -} -glyphs[199] = { --'Ç'-- - num = 199, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 9, - txn = 196, tyn = 129, txp = 205, typ = 142, -} -glyphs[200] = { --'È'-- - num = 200, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 12, - txn = 209, tyn = 129, txp = 218, typ = 142, -} -glyphs[201] = { --'É'-- - num = 201, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 12, - txn = 222, tyn = 129, txp = 231, typ = 142, -} -glyphs[202] = { --'Ê'-- - num = 202, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 12, - txn = 235, tyn = 129, txp = 244, typ = 142, -} -glyphs[203] = { --'Ë'-- - num = 203, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 11, - txn = 1, tyn = 145, txp = 10, typ = 157, -} -glyphs[204] = { --'Ì'-- - num = 204, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 12, - txn = 14, tyn = 145, txp = 22, typ = 158, -} -glyphs[205] = { --'Í'-- - num = 205, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 12, - txn = 27, tyn = 145, txp = 35, typ = 158, -} -glyphs[206] = { --'Î'-- - num = 206, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 12, - txn = 40, tyn = 145, txp = 48, typ = 158, -} -glyphs[207] = { --'Ï'-- - num = 207, - adv = 7, - oxn = 0, oyn = -1, oxp = 8, oyp = 11, - txn = 53, tyn = 145, txp = 61, typ = 157, -} -glyphs[208] = { --'Ð'-- - num = 208, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 66, tyn = 145, txp = 75, typ = 154, -} -glyphs[209] = { --'Ñ'-- - num = 209, - adv = 7, - oxn = -2, oyn = -1, oxp = 9, oyp = 11, - txn = 79, tyn = 145, txp = 90, typ = 157, -} -glyphs[210] = { --'Ò'-- - num = 210, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 12, - txn = 92, tyn = 145, txp = 101, typ = 159, -} -glyphs[211] = { --'Ó'-- - num = 211, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 12, - txn = 105, tyn = 145, txp = 114, typ = 159, -} -glyphs[212] = { --'Ô'-- - num = 212, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 12, - txn = 118, tyn = 145, txp = 127, typ = 159, -} -glyphs[213] = { --'Õ'-- - num = 213, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 11, - txn = 131, tyn = 145, txp = 140, typ = 158, -} -glyphs[214] = { --'Ö'-- - num = 214, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 11, - txn = 144, tyn = 145, txp = 153, typ = 158, -} -glyphs[215] = { --'×'-- - num = 215, - adv = 7, - oxn = 0, oyn = -1, oxp = 7, oyp = 7, - txn = 157, tyn = 145, txp = 164, typ = 153, -} -glyphs[216] = { --'Ø'-- - num = 216, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 9, - txn = 170, tyn = 145, txp = 180, typ = 156, -} -glyphs[217] = { --'Ù'-- - num = 217, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 12, - txn = 183, tyn = 145, txp = 193, typ = 159, -} -glyphs[218] = { --'Ú'-- - num = 218, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 12, - txn = 196, tyn = 145, txp = 206, typ = 159, -} -glyphs[219] = { --'Û'-- - num = 219, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 12, - txn = 209, tyn = 145, txp = 219, typ = 159, -} -glyphs[220] = { --'Ü'-- - num = 220, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 11, - txn = 222, tyn = 145, txp = 232, typ = 158, -} -glyphs[221] = { --'Ý'-- - num = 221, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 12, - txn = 235, tyn = 145, txp = 244, typ = 158, -} -glyphs[222] = { --'Þ'-- - num = 222, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 1, tyn = 161, txp = 10, typ = 170, -} -glyphs[223] = { --'ß'-- - num = 223, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 14, tyn = 161, txp = 23, typ = 172, -} -glyphs[224] = { --'à'-- - num = 224, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 27, tyn = 161, txp = 36, typ = 173, -} -glyphs[225] = { --'á'-- - num = 225, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 40, tyn = 161, txp = 49, typ = 173, -} -glyphs[226] = { --'â'-- - num = 226, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 53, tyn = 161, txp = 62, typ = 173, -} -glyphs[227] = { --'ã'-- - num = 227, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 66, tyn = 161, txp = 75, typ = 172, -} -glyphs[228] = { --'ä'-- - num = 228, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 79, tyn = 161, txp = 88, typ = 172, -} -glyphs[229] = { --'å'-- - num = 229, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 92, tyn = 161, txp = 101, typ = 173, -} -glyphs[230] = { --'æ'-- - num = 230, - adv = 7, - oxn = -2, oyn = -2, oxp = 9, oyp = 7, - txn = 105, tyn = 161, txp = 116, typ = 170, -} -glyphs[231] = { --'ç'-- - num = 231, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 7, - txn = 118, tyn = 161, txp = 127, typ = 172, -} -glyphs[232] = { --'è'-- - num = 232, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 131, tyn = 161, txp = 140, typ = 173, -} -glyphs[233] = { --'é'-- - num = 233, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 144, tyn = 161, txp = 153, typ = 173, -} -glyphs[234] = { --'ê'-- - num = 234, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 157, tyn = 161, txp = 166, typ = 173, -} -glyphs[235] = { --'ë'-- - num = 235, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 170, tyn = 161, txp = 179, typ = 172, -} -glyphs[236] = { --'ì'-- - num = 236, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 10, - txn = 183, tyn = 161, txp = 192, typ = 172, -} -glyphs[237] = { --'í'-- - num = 237, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 10, - txn = 196, tyn = 161, txp = 205, typ = 172, -} -glyphs[238] = { --'î'-- - num = 238, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 10, - txn = 209, tyn = 161, txp = 218, typ = 172, -} -glyphs[239] = { --'ï'-- - num = 239, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 222, tyn = 161, txp = 231, typ = 171, -} -glyphs[240] = { --'ð'-- - num = 240, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 235, tyn = 161, txp = 244, typ = 172, -} -glyphs[241] = { --'ñ'-- - num = 241, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 9, - txn = 1, tyn = 177, txp = 10, typ = 187, -} -glyphs[242] = { --'ò'-- - num = 242, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 14, tyn = 177, txp = 23, typ = 189, -} -glyphs[243] = { --'ó'-- - num = 243, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 27, tyn = 177, txp = 36, typ = 189, -} -glyphs[244] = { --'ô'-- - num = 244, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 40, tyn = 177, txp = 49, typ = 189, -} -glyphs[245] = { --'õ'-- - num = 245, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 53, tyn = 177, txp = 62, typ = 188, -} -glyphs[246] = { --'ö'-- - num = 246, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 66, tyn = 177, txp = 75, typ = 188, -} -glyphs[247] = { --'÷'-- - num = 247, - adv = 7, - oxn = -1, oyn = -1, oxp = 8, oyp = 8, - txn = 79, tyn = 177, txp = 88, typ = 186, -} -glyphs[248] = { --'ø'-- - num = 248, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 7, - txn = 92, tyn = 177, txp = 101, typ = 186, -} -glyphs[249] = { --'ù'-- - num = 249, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 105, tyn = 177, txp = 114, typ = 189, -} -glyphs[250] = { --'ú'-- - num = 250, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 118, tyn = 177, txp = 127, typ = 189, -} -glyphs[251] = { --'û'-- - num = 251, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 10, - txn = 131, tyn = 177, txp = 140, typ = 189, -} -glyphs[252] = { --'ü'-- - num = 252, - adv = 7, - oxn = -1, oyn = -2, oxp = 8, oyp = 9, - txn = 144, tyn = 177, txp = 153, typ = 188, -} -glyphs[253] = { --'ý'-- - num = 253, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 10, - txn = 157, tyn = 177, txp = 166, typ = 191, -} -glyphs[254] = { --'þ'-- - num = 254, - adv = 7, - oxn = -2, oyn = -4, oxp = 8, oyp = 9, - txn = 170, tyn = 177, txp = 180, typ = 190, -} -glyphs[255] = { --'ÿ'-- - num = 255, - adv = 7, - oxn = -1, oyn = -4, oxp = 8, oyp = 9, - txn = 183, tyn = 177, txp = 192, typ = 190, -} - -fontSpecs.glyphs = glyphs - -return fontSpecs - diff --git a/LuaUI/Fonts/FreeMonoBold_12.png b/LuaUI/Fonts/FreeMonoBold_12.png deleted file mode 100644 index 96bc21e42..000000000 Binary files a/LuaUI/Fonts/FreeMonoBold_12.png and /dev/null differ diff --git a/LuaUI/Fonts/FreeSansBold.otf b/LuaUI/Fonts/FreeSansBold.otf deleted file mode 100644 index 472270cca..000000000 Binary files a/LuaUI/Fonts/FreeSansBold.otf and /dev/null differ diff --git a/LuaUI/Fonts/FreeSansBoldWOutline_14.lua b/LuaUI/Fonts/FreeSansBoldWOutline_14.lua deleted file mode 100644 index ec60feb6f..000000000 --- a/LuaUI/Fonts/FreeSansBoldWOutline_14.lua +++ /dev/null @@ -1,1365 +0,0 @@ --- $Id: FreeSansBold_14.lua 2491 2008-07-17 13:36:51Z det $ - -local fontSpecs = { - srcFile = [[FreeSansBold.ttf]], - family = [[FreeSans]], - style = [[Bold]], - yStep = 15, - height = 14, - xTexSize = 512, - yTexSize = 256, - outlineRadius = 2, - outlineWeight = 100, -} - -local glyphs = {} - -glyphs[32] = { --' '-- - num = 32, - adv = 4, - oxn = -2, oyn = -3, oxp = 3, oyp = 2, - txn = 1, tyn = 1, txp = 6, typ = 6, -} -glyphs[33] = { --'!'-- - num = 33, - adv = 5, - oxn = -1, oyn = -2, oxp = 6, oyp = 13, - txn = 21, tyn = 1, txp = 28, typ = 16, -} -glyphs[34] = { --'"'-- - num = 34, - adv = 7, - oxn = -2, oyn = 4, oxp = 8, oyp = 13, - txn = 41, tyn = 1, txp = 51, typ = 10, -} -glyphs[35] = { --'#'-- - num = 35, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 12, - txn = 61, tyn = 1, txp = 73, typ = 16, -} -glyphs[36] = { --'$'-- - num = 36, - adv = 8, - oxn = -2, oyn = -4, oxp = 10, oyp = 13, - txn = 81, tyn = 1, txp = 93, typ = 18, -} -glyphs[37] = { --'%'-- - num = 37, - adv = 12, - oxn = -2, oyn = -3, oxp = 15, oyp = 12, - txn = 101, tyn = 1, txp = 118, typ = 16, -} -glyphs[38] = { --'&'-- - num = 38, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 121, tyn = 1, txp = 135, typ = 17, -} -glyphs[39] = { --'''-- - num = 39, - adv = 3, - oxn = -2, oyn = 4, oxp = 5, oyp = 13, - txn = 141, tyn = 1, txp = 148, typ = 10, -} -glyphs[40] = { --'('-- - num = 40, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 161, tyn = 1, txp = 170, typ = 19, -} -glyphs[41] = { --')'-- - num = 41, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 13, - txn = 181, tyn = 1, txp = 189, typ = 19, -} -glyphs[42] = { --'*'-- - num = 42, - adv = 5, - oxn = -2, oyn = 3, oxp = 7, oyp = 13, - txn = 201, tyn = 1, txp = 210, typ = 11, -} -glyphs[43] = { --'+'-- - num = 43, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 221, tyn = 1, txp = 233, typ = 13, -} -glyphs[44] = { --','-- - num = 44, - adv = 4, - oxn = -2, oyn = -5, oxp = 5, oyp = 5, - txn = 241, tyn = 1, txp = 248, typ = 11, -} -glyphs[45] = { --'-'-- - num = 45, - adv = 5, - oxn = -2, oyn = 0, oxp = 7, oyp = 7, - txn = 261, tyn = 1, txp = 270, typ = 8, -} -glyphs[46] = { --'.'-- - num = 46, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 5, - txn = 281, tyn = 1, txp = 288, typ = 8, -} -glyphs[47] = { --'/'-- - num = 47, - adv = 4, - oxn = -2, oyn = -3, oxp = 6, oyp = 12, - txn = 301, tyn = 1, txp = 309, typ = 16, -} -glyphs[48] = { --'0'-- - num = 48, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 321, tyn = 1, txp = 333, typ = 17, -} -glyphs[49] = { --'1'-- - num = 49, - adv = 8, - oxn = -2, oyn = -2, oxp = 8, oyp = 12, - txn = 341, tyn = 1, txp = 351, typ = 15, -} -glyphs[50] = { --'2'-- - num = 50, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 361, tyn = 1, txp = 373, typ = 16, -} -glyphs[51] = { --'3'-- - num = 51, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 1, txp = 393, typ = 17, -} -glyphs[52] = { --'4'-- - num = 52, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 401, tyn = 1, txp = 413, typ = 15, -} -glyphs[53] = { --'5'-- - num = 53, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 12, - txn = 421, tyn = 1, txp = 433, typ = 16, -} -glyphs[54] = { --'6'-- - num = 54, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 441, tyn = 1, txp = 453, typ = 17, -} -glyphs[55] = { --'7'-- - num = 55, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 461, tyn = 1, txp = 473, typ = 15, -} -glyphs[56] = { --'8'-- - num = 56, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 481, tyn = 1, txp = 493, typ = 17, -} -glyphs[57] = { --'9'-- - num = 57, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 1, tyn = 22, txp = 13, typ = 38, -} -glyphs[58] = { --':'-- - num = 58, - adv = 5, - oxn = -1, oyn = -2, oxp = 6, oyp = 10, - txn = 21, tyn = 22, txp = 28, typ = 34, -} -glyphs[59] = { --';'-- - num = 59, - adv = 5, - oxn = -1, oyn = -5, oxp = 6, oyp = 10, - txn = 41, tyn = 22, txp = 48, typ = 37, -} -glyphs[60] = { --'<'-- - num = 60, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 61, tyn = 22, txp = 73, typ = 34, -} -glyphs[61] = { --'='-- - num = 61, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 8, - txn = 81, tyn = 22, txp = 93, typ = 32, -} -glyphs[62] = { --'>'-- - num = 62, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 101, tyn = 22, txp = 113, typ = 34, -} -glyphs[63] = { --'?'-- - num = 63, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 121, tyn = 22, txp = 133, typ = 37, -} -glyphs[64] = { --'@'-- - num = 64, - adv = 14, - oxn = -2, oyn = -4, oxp = 16, oyp = 13, - txn = 141, tyn = 22, txp = 159, typ = 39, -} -glyphs[65] = { --'A'-- - num = 65, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 161, tyn = 22, txp = 175, typ = 37, -} -glyphs[66] = { --'B'-- - num = 66, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 181, tyn = 22, txp = 194, typ = 37, -} -glyphs[67] = { --'C'-- - num = 67, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 201, tyn = 22, txp = 215, typ = 38, -} -glyphs[68] = { --'D'-- - num = 68, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 221, tyn = 22, txp = 234, typ = 37, -} -glyphs[69] = { --'E'-- - num = 69, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 241, tyn = 22, txp = 253, typ = 37, -} -glyphs[70] = { --'F'-- - num = 70, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 261, tyn = 22, txp = 273, typ = 37, -} -glyphs[71] = { --'G'-- - num = 71, - adv = 11, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 281, tyn = 22, txp = 295, typ = 38, -} -glyphs[72] = { --'H'-- - num = 72, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 301, tyn = 22, txp = 315, typ = 37, -} -glyphs[73] = { --'I'-- - num = 73, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 321, tyn = 22, txp = 328, typ = 37, -} -glyphs[74] = { --'J'-- - num = 74, - adv = 8, - oxn = -2, oyn = -3, oxp = 9, oyp = 13, - txn = 341, tyn = 22, txp = 352, typ = 38, -} -glyphs[75] = { --'K'-- - num = 75, - adv = 10, - oxn = -1, oyn = -2, oxp = 13, oyp = 13, - txn = 361, tyn = 22, txp = 375, typ = 37, -} -glyphs[76] = { --'L'-- - num = 76, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 381, tyn = 22, txp = 393, typ = 37, -} -glyphs[77] = { --'M'-- - num = 77, - adv = 12, - oxn = -2, oyn = -2, oxp = 13, oyp = 13, - txn = 401, tyn = 22, txp = 416, typ = 37, -} -glyphs[78] = { --'N'-- - num = 78, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 421, tyn = 22, txp = 435, typ = 37, -} -glyphs[79] = { --'O'-- - num = 79, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 441, tyn = 22, txp = 456, typ = 38, -} -glyphs[80] = { --'P'-- - num = 80, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 461, tyn = 22, txp = 473, typ = 37, -} -glyphs[81] = { --'Q'-- - num = 81, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 481, tyn = 22, txp = 496, typ = 38, -} -glyphs[82] = { --'R'-- - num = 82, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 1, tyn = 43, txp = 14, typ = 58, -} -glyphs[83] = { --'S'-- - num = 83, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 21, tyn = 43, txp = 34, typ = 59, -} -glyphs[84] = { --'T'-- - num = 84, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 13, - txn = 41, tyn = 43, txp = 54, typ = 58, -} -glyphs[85] = { --'U'-- - num = 85, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 13, - txn = 61, tyn = 43, txp = 74, typ = 59, -} -glyphs[86] = { --'V'-- - num = 86, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 81, tyn = 43, txp = 95, typ = 58, -} -glyphs[87] = { --'W'-- - num = 87, - adv = 13, - oxn = -2, oyn = -2, oxp = 16, oyp = 13, - txn = 101, tyn = 43, txp = 119, typ = 58, -} -glyphs[88] = { --'X'-- - num = 88, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 121, tyn = 43, txp = 135, typ = 58, -} -glyphs[89] = { --'Y'-- - num = 89, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 141, tyn = 43, txp = 155, typ = 58, -} -glyphs[90] = { --'Z'-- - num = 90, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 13, - txn = 161, tyn = 43, txp = 174, typ = 58, -} -glyphs[91] = { --'['-- - num = 91, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 181, tyn = 43, txp = 190, typ = 61, -} -glyphs[92] = { --'\'-- - num = 92, - adv = 4, - oxn = -3, oyn = -3, oxp = 7, oyp = 12, - txn = 201, tyn = 43, txp = 211, typ = 58, -} -glyphs[93] = { --']'-- - num = 93, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 13, - txn = 221, tyn = 43, txp = 229, typ = 61, -} -glyphs[94] = { --'^'-- - num = 94, - adv = 8, - oxn = -2, oyn = 1, oxp = 10, oyp = 12, - txn = 241, tyn = 43, txp = 253, typ = 54, -} -glyphs[95] = { --'_'-- - num = 95, - adv = 8, - oxn = -3, oyn = -5, oxp = 11, oyp = 1, - txn = 261, tyn = 43, txp = 275, typ = 49, -} -glyphs[96] = { --'`'-- - num = 96, - adv = 5, - oxn = -2, oyn = 6, oxp = 5, oyp = 13, - txn = 281, tyn = 43, txp = 288, typ = 50, -} -glyphs[97] = { --'a'-- - num = 97, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 301, tyn = 43, txp = 313, typ = 56, -} -glyphs[98] = { --'b'-- - num = 98, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 321, tyn = 43, txp = 334, typ = 59, -} -glyphs[99] = { --'c'-- - num = 99, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 341, tyn = 43, txp = 353, typ = 56, -} -glyphs[100] = { --'d'-- - num = 100, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 43, txp = 373, typ = 59, -} -glyphs[101] = { --'e'-- - num = 101, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 381, tyn = 43, txp = 393, typ = 56, -} -glyphs[102] = { --'f'-- - num = 102, - adv = 5, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 401, tyn = 43, txp = 410, typ = 58, -} -glyphs[103] = { --'g'-- - num = 103, - adv = 9, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 421, tyn = 43, txp = 433, typ = 59, -} -glyphs[104] = { --'h'-- - num = 104, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 441, tyn = 43, txp = 453, typ = 58, -} -glyphs[105] = { --'i'-- - num = 105, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 461, tyn = 43, txp = 468, typ = 58, -} -glyphs[106] = { --'j'-- - num = 106, - adv = 4, - oxn = -2, oyn = -6, oxp = 5, oyp = 13, - txn = 481, tyn = 43, txp = 488, typ = 62, -} -glyphs[107] = { --'k'-- - num = 107, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 1, tyn = 64, txp = 13, typ = 79, -} -glyphs[108] = { --'l'-- - num = 108, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 21, tyn = 64, txp = 28, typ = 79, -} -glyphs[109] = { --'m'-- - num = 109, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 10, - txn = 41, tyn = 64, txp = 57, typ = 76, -} -glyphs[110] = { --'n'-- - num = 110, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 61, tyn = 64, txp = 73, typ = 76, -} -glyphs[111] = { --'o'-- - num = 111, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 81, tyn = 64, txp = 93, typ = 77, -} -glyphs[112] = { --'p'-- - num = 112, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 10, - txn = 101, tyn = 64, txp = 114, typ = 80, -} -glyphs[113] = { --'q'-- - num = 113, - adv = 9, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 121, tyn = 64, txp = 133, typ = 80, -} -glyphs[114] = { --'r'-- - num = 114, - adv = 5, - oxn = -2, oyn = -2, oxp = 8, oyp = 10, - txn = 141, tyn = 64, txp = 151, typ = 76, -} -glyphs[115] = { --'s'-- - num = 115, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 161, tyn = 64, txp = 173, typ = 77, -} -glyphs[116] = { --'t'-- - num = 116, - adv = 5, - oxn = -2, oyn = -3, oxp = 7, oyp = 12, - txn = 181, tyn = 64, txp = 190, typ = 79, -} -glyphs[117] = { --'u'-- - num = 117, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 201, tyn = 64, txp = 213, typ = 77, -} -glyphs[118] = { --'v'-- - num = 118, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 221, tyn = 64, txp = 233, typ = 76, -} -glyphs[119] = { --'w'-- - num = 119, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 10, - txn = 241, tyn = 64, txp = 256, typ = 76, -} -glyphs[120] = { --'x'-- - num = 120, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 261, tyn = 64, txp = 273, typ = 76, -} -glyphs[121] = { --'y'-- - num = 121, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 281, tyn = 64, txp = 293, typ = 80, -} -glyphs[122] = { --'z'-- - num = 122, - adv = 7, - oxn = -2, oyn = -2, oxp = 9, oyp = 10, - txn = 301, tyn = 64, txp = 312, typ = 76, -} -glyphs[123] = { --'{'-- - num = 123, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 321, tyn = 64, txp = 330, typ = 82, -} -glyphs[124] = { --'|'-- - num = 124, - adv = 4, - oxn = -1, oyn = -5, oxp = 5, oyp = 13, - txn = 341, tyn = 64, txp = 347, typ = 82, -} -glyphs[125] = { --'}'-- - num = 125, - adv = 5, - oxn = -1, oyn = -5, oxp = 7, oyp = 13, - txn = 361, tyn = 64, txp = 369, typ = 82, -} -glyphs[126] = { --'~'-- - num = 126, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 7, - txn = 381, tyn = 64, txp = 393, typ = 72, -} -glyphs[127] = { --''-- - num = 127, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 401, tyn = 64, txp = 410, typ = 78, -} -glyphs[128] = { --'€'-- - num = 128, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 421, tyn = 64, txp = 430, typ = 78, -} -glyphs[129] = { --'�'-- - num = 129, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 441, tyn = 64, txp = 450, typ = 78, -} -glyphs[130] = { --'‚'-- - num = 130, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 461, tyn = 64, txp = 470, typ = 78, -} -glyphs[131] = { --'ƒ'-- - num = 131, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 481, tyn = 64, txp = 490, typ = 78, -} -glyphs[132] = { --'„'-- - num = 132, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 1, tyn = 85, txp = 10, typ = 99, -} -glyphs[133] = { --'…'-- - num = 133, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 21, tyn = 85, txp = 30, typ = 99, -} -glyphs[134] = { --'†'-- - num = 134, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 41, tyn = 85, txp = 50, typ = 99, -} -glyphs[135] = { --'‡'-- - num = 135, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 61, tyn = 85, txp = 70, typ = 99, -} -glyphs[136] = { --'ˆ'-- - num = 136, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 81, tyn = 85, txp = 90, typ = 99, -} -glyphs[137] = { --'‰'-- - num = 137, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 101, tyn = 85, txp = 110, typ = 99, -} -glyphs[138] = { --'Š'-- - num = 138, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 121, tyn = 85, txp = 130, typ = 99, -} -glyphs[139] = { --'‹'-- - num = 139, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 141, tyn = 85, txp = 150, typ = 99, -} -glyphs[140] = { --'Œ'-- - num = 140, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 161, tyn = 85, txp = 170, typ = 99, -} -glyphs[141] = { --'�'-- - num = 141, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 181, tyn = 85, txp = 190, typ = 99, -} -glyphs[142] = { --'Ž'-- - num = 142, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 201, tyn = 85, txp = 210, typ = 99, -} -glyphs[143] = { --'�'-- - num = 143, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 221, tyn = 85, txp = 230, typ = 99, -} -glyphs[144] = { --'�'-- - num = 144, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 241, tyn = 85, txp = 250, typ = 99, -} -glyphs[145] = { --'‘'-- - num = 145, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 261, tyn = 85, txp = 270, typ = 99, -} -glyphs[146] = { --'’'-- - num = 146, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 281, tyn = 85, txp = 290, typ = 99, -} -glyphs[147] = { --'“'-- - num = 147, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 301, tyn = 85, txp = 310, typ = 99, -} -glyphs[148] = { --'”'-- - num = 148, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 321, tyn = 85, txp = 330, typ = 99, -} -glyphs[149] = { --'•'-- - num = 149, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 341, tyn = 85, txp = 350, typ = 99, -} -glyphs[150] = { --'–'-- - num = 150, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 361, tyn = 85, txp = 370, typ = 99, -} -glyphs[151] = { --'—'-- - num = 151, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 381, tyn = 85, txp = 390, typ = 99, -} -glyphs[152] = { --'˜'-- - num = 152, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 401, tyn = 85, txp = 410, typ = 99, -} -glyphs[153] = { --'™'-- - num = 153, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 421, tyn = 85, txp = 430, typ = 99, -} -glyphs[154] = { --'š'-- - num = 154, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 441, tyn = 85, txp = 450, typ = 99, -} -glyphs[155] = { --'›'-- - num = 155, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 461, tyn = 85, txp = 470, typ = 99, -} -glyphs[156] = { --'œ'-- - num = 156, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 481, tyn = 85, txp = 490, typ = 99, -} -glyphs[157] = { --'�'-- - num = 157, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 1, tyn = 106, txp = 10, typ = 120, -} -glyphs[158] = { --'ž'-- - num = 158, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 21, tyn = 106, txp = 30, typ = 120, -} -glyphs[159] = { --'Ÿ'-- - num = 159, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 41, tyn = 106, txp = 50, typ = 120, -} -glyphs[160] = { --' '-- - num = 160, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 61, tyn = 106, txp = 70, typ = 120, -} -glyphs[161] = { --'¡'-- - num = 161, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 10, - txn = 81, tyn = 106, txp = 89, typ = 121, -} -glyphs[162] = { --'¢'-- - num = 162, - adv = 8, - oxn = -2, oyn = -4, oxp = 10, oyp = 11, - txn = 101, tyn = 106, txp = 113, typ = 121, -} -glyphs[163] = { --'£'-- - num = 163, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 121, tyn = 106, txp = 133, typ = 122, -} -glyphs[164] = { --'¤'-- - num = 164, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 11, - txn = 141, tyn = 106, txp = 153, typ = 118, -} -glyphs[165] = { --'¥'-- - num = 165, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 161, tyn = 106, txp = 173, typ = 120, -} -glyphs[166] = { --'¦'-- - num = 166, - adv = 4, - oxn = -1, oyn = -5, oxp = 5, oyp = 13, - txn = 181, tyn = 106, txp = 187, typ = 124, -} -glyphs[167] = { --'§'-- - num = 167, - adv = 8, - oxn = -2, oyn = -5, oxp = 10, oyp = 13, - txn = 201, tyn = 106, txp = 213, typ = 124, -} -glyphs[168] = { --'¨'-- - num = 168, - adv = 5, - oxn = -2, oyn = 6, oxp = 7, oyp = 13, - txn = 221, tyn = 106, txp = 230, typ = 113, -} -glyphs[169] = { --'©'-- - num = 169, - adv = 10, - oxn = -3, oyn = -3, oxp = 13, oyp = 13, - txn = 241, tyn = 106, txp = 257, typ = 122, -} -glyphs[170] = { --'ª'-- - num = 170, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 261, tyn = 106, txp = 270, typ = 118, -} -glyphs[171] = { --'«'-- - num = 171, - adv = 8, - oxn = -1, oyn = -1, oxp = 9, oyp = 9, - txn = 281, tyn = 106, txp = 291, typ = 116, -} -glyphs[172] = { --'¬'-- - num = 172, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 8, - txn = 301, tyn = 106, txp = 313, typ = 115, -} -glyphs[173] = { --'­'-- - num = 173, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 321, tyn = 106, txp = 330, typ = 120, -} -glyphs[174] = { --'®'-- - num = 174, - adv = 10, - oxn = -3, oyn = -3, oxp = 13, oyp = 13, - txn = 341, tyn = 106, txp = 357, typ = 122, -} -glyphs[175] = { --'¯'-- - num = 175, - adv = 5, - oxn = -2, oyn = 6, oxp = 7, oyp = 13, - txn = 361, tyn = 106, txp = 370, typ = 113, -} -glyphs[176] = { --'°'-- - num = 176, - adv = 8, - oxn = 0, oyn = 3, oxp = 9, oyp = 12, - txn = 381, tyn = 106, txp = 390, typ = 115, -} -glyphs[177] = { --'±'-- - num = 177, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 11, - txn = 401, tyn = 106, txp = 413, typ = 120, -} -glyphs[178] = { --'²'-- - num = 178, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 421, tyn = 106, txp = 430, typ = 118, -} -glyphs[179] = { --'³'-- - num = 179, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 441, tyn = 106, txp = 450, typ = 118, -} -glyphs[180] = { --'´'-- - num = 180, - adv = 5, - oxn = -1, oyn = 6, oxp = 7, oyp = 13, - txn = 461, tyn = 106, txp = 469, typ = 113, -} -glyphs[181] = { --'µ'-- - num = 181, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 10, - txn = 481, tyn = 106, txp = 494, typ = 122, -} -glyphs[182] = { --'¶'-- - num = 182, - adv = 8, - oxn = -2, oyn = -5, oxp = 10, oyp = 13, - txn = 1, tyn = 127, txp = 13, typ = 145, -} -glyphs[183] = { --'·'-- - num = 183, - adv = 4, - oxn = -2, oyn = 0, oxp = 5, oyp = 7, - txn = 21, tyn = 127, txp = 28, typ = 134, -} -glyphs[184] = { --'¸'-- - num = 184, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 2, - txn = 41, tyn = 127, txp = 50, typ = 135, -} -glyphs[185] = { --'¹'-- - num = 185, - adv = 5, - oxn = -2, oyn = 1, oxp = 6, oyp = 12, - txn = 61, tyn = 127, txp = 69, typ = 138, -} -glyphs[186] = { --'º'-- - num = 186, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 81, tyn = 127, txp = 90, typ = 139, -} -glyphs[187] = { --'»'-- - num = 187, - adv = 8, - oxn = -1, oyn = -1, oxp = 9, oyp = 9, - txn = 101, tyn = 127, txp = 111, typ = 137, -} -glyphs[188] = { --'¼'-- - num = 188, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 121, tyn = 127, txp = 137, typ = 143, -} -glyphs[189] = { --'½'-- - num = 189, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 141, tyn = 127, txp = 157, typ = 143, -} -glyphs[190] = { --'¾'-- - num = 190, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 161, tyn = 127, txp = 177, typ = 143, -} -glyphs[191] = { --'¿'-- - num = 191, - adv = 9, - oxn = -2, oyn = -5, oxp = 10, oyp = 10, - txn = 181, tyn = 127, txp = 193, typ = 142, -} -glyphs[192] = { --'À'-- - num = 192, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 201, tyn = 127, txp = 215, typ = 145, -} -glyphs[193] = { --'Á'-- - num = 193, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 15, - txn = 221, tyn = 127, txp = 235, typ = 144, -} -glyphs[194] = { --'Â'-- - num = 194, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 241, tyn = 127, txp = 255, typ = 145, -} -glyphs[195] = { --'Ã'-- - num = 195, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 261, tyn = 127, txp = 275, typ = 145, -} -glyphs[196] = { --'Ä'-- - num = 196, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 281, tyn = 127, txp = 295, typ = 145, -} -glyphs[197] = { --'Å'-- - num = 197, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 301, tyn = 127, txp = 315, typ = 145, -} -glyphs[198] = { --'Æ'-- - num = 198, - adv = 14, - oxn = -2, oyn = -2, oxp = 16, oyp = 13, - txn = 321, tyn = 127, txp = 339, typ = 142, -} -glyphs[199] = { --'Ç'-- - num = 199, - adv = 10, - oxn = -2, oyn = -6, oxp = 12, oyp = 13, - txn = 341, tyn = 127, txp = 355, typ = 146, -} -glyphs[200] = { --'È'-- - num = 200, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 361, tyn = 127, txp = 373, typ = 145, -} -glyphs[201] = { --'É'-- - num = 201, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 381, tyn = 127, txp = 393, typ = 145, -} -glyphs[202] = { --'Ê'-- - num = 202, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 401, tyn = 127, txp = 413, typ = 145, -} -glyphs[203] = { --'Ë'-- - num = 203, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 421, tyn = 127, txp = 433, typ = 145, -} -glyphs[204] = { --'Ì'-- - num = 204, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 16, - txn = 441, tyn = 127, txp = 448, typ = 145, -} -glyphs[205] = { --'Í'-- - num = 205, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 461, tyn = 127, txp = 470, typ = 145, -} -glyphs[206] = { --'Î'-- - num = 206, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 481, tyn = 127, txp = 490, typ = 145, -} -glyphs[207] = { --'Ï'-- - num = 207, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 1, tyn = 148, txp = 10, typ = 166, -} -glyphs[208] = { --'Ð'-- - num = 208, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 21, tyn = 148, txp = 35, typ = 163, -} -glyphs[209] = { --'Ñ'-- - num = 209, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 41, tyn = 148, txp = 55, typ = 166, -} -glyphs[210] = { --'Ò'-- - num = 210, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 61, tyn = 148, txp = 76, typ = 167, -} -glyphs[211] = { --'Ó'-- - num = 211, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 81, tyn = 148, txp = 96, typ = 167, -} -glyphs[212] = { --'Ô'-- - num = 212, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 101, tyn = 148, txp = 116, typ = 167, -} -glyphs[213] = { --'Õ'-- - num = 213, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 121, tyn = 148, txp = 136, typ = 167, -} -glyphs[214] = { --'Ö'-- - num = 214, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 141, tyn = 148, txp = 156, typ = 167, -} -glyphs[215] = { --'×'-- - num = 215, - adv = 8, - oxn = -1, oyn = -2, oxp = 10, oyp = 9, - txn = 161, tyn = 148, txp = 172, typ = 159, -} -glyphs[216] = { --'Ø'-- - num = 216, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 181, tyn = 148, txp = 196, typ = 164, -} -glyphs[217] = { --'Ù'-- - num = 217, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 201, tyn = 148, txp = 214, typ = 167, -} -glyphs[218] = { --'Ú'-- - num = 218, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 221, tyn = 148, txp = 234, typ = 167, -} -glyphs[219] = { --'Û'-- - num = 219, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 241, tyn = 148, txp = 254, typ = 167, -} -glyphs[220] = { --'Ü'-- - num = 220, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 261, tyn = 148, txp = 274, typ = 167, -} -glyphs[221] = { --'Ý'-- - num = 221, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 281, tyn = 148, txp = 295, typ = 166, -} -glyphs[222] = { --'Þ'-- - num = 222, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 301, tyn = 148, txp = 313, typ = 163, -} -glyphs[223] = { --'ß'-- - num = 223, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 321, tyn = 148, txp = 334, typ = 164, -} -glyphs[224] = { --'à'-- - num = 224, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 341, tyn = 148, txp = 353, typ = 164, -} -glyphs[225] = { --'á'-- - num = 225, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 148, txp = 373, typ = 164, -} -glyphs[226] = { --'â'-- - num = 226, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 148, txp = 393, typ = 164, -} -glyphs[227] = { --'ã'-- - num = 227, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 401, tyn = 148, txp = 413, typ = 164, -} -glyphs[228] = { --'ä'-- - num = 228, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 421, tyn = 148, txp = 433, typ = 164, -} -glyphs[229] = { --'å'-- - num = 229, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 441, tyn = 148, txp = 453, typ = 164, -} -glyphs[230] = { --'æ'-- - num = 230, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 10, - txn = 461, tyn = 148, txp = 477, typ = 161, -} -glyphs[231] = { --'ç'-- - num = 231, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 481, tyn = 148, txp = 493, typ = 164, -} -glyphs[232] = { --'è'-- - num = 232, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 1, tyn = 169, txp = 13, typ = 185, -} -glyphs[233] = { --'é'-- - num = 233, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 21, tyn = 169, txp = 33, typ = 185, -} -glyphs[234] = { --'ê'-- - num = 234, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 41, tyn = 169, txp = 53, typ = 185, -} -glyphs[235] = { --'ë'-- - num = 235, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 61, tyn = 169, txp = 73, typ = 185, -} -glyphs[236] = { --'ì'-- - num = 236, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 81, tyn = 169, txp = 88, typ = 184, -} -glyphs[237] = { --'í'-- - num = 237, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 101, tyn = 169, txp = 110, typ = 184, -} -glyphs[238] = { --'î'-- - num = 238, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 121, tyn = 169, txp = 130, typ = 184, -} -glyphs[239] = { --'ï'-- - num = 239, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 141, tyn = 169, txp = 150, typ = 184, -} -glyphs[240] = { --'ð'-- - num = 240, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 161, tyn = 169, txp = 173, typ = 185, -} -glyphs[241] = { --'ñ'-- - num = 241, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 181, tyn = 169, txp = 193, typ = 184, -} -glyphs[242] = { --'ò'-- - num = 242, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 201, tyn = 169, txp = 213, typ = 185, -} -glyphs[243] = { --'ó'-- - num = 243, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 221, tyn = 169, txp = 233, typ = 185, -} -glyphs[244] = { --'ô'-- - num = 244, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 241, tyn = 169, txp = 253, typ = 185, -} -glyphs[245] = { --'õ'-- - num = 245, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 261, tyn = 169, txp = 273, typ = 185, -} -glyphs[246] = { --'ö'-- - num = 246, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 281, tyn = 169, txp = 293, typ = 185, -} -glyphs[247] = { --'÷'-- - num = 247, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 301, tyn = 169, txp = 313, typ = 181, -} -glyphs[248] = { --'ø'-- - num = 248, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 321, tyn = 169, txp = 334, typ = 182, -} -glyphs[249] = { --'ù'-- - num = 249, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 341, tyn = 169, txp = 353, typ = 185, -} -glyphs[250] = { --'ú'-- - num = 250, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 169, txp = 373, typ = 185, -} -glyphs[251] = { --'û'-- - num = 251, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 169, txp = 393, typ = 185, -} -glyphs[252] = { --'ü'-- - num = 252, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 401, tyn = 169, txp = 413, typ = 185, -} -glyphs[253] = { --'ý'-- - num = 253, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 13, - txn = 421, tyn = 169, txp = 433, typ = 188, -} -glyphs[254] = { --'þ'-- - num = 254, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 13, - txn = 441, tyn = 169, txp = 454, typ = 188, -} -glyphs[255] = { --'ÿ'-- - num = 255, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 13, - txn = 461, tyn = 169, txp = 473, typ = 188, -} - -fontSpecs.glyphs = glyphs - -return fontSpecs - diff --git a/LuaUI/Fonts/FreeSansBoldWOutline_14.png b/LuaUI/Fonts/FreeSansBoldWOutline_14.png deleted file mode 100644 index b4095e590..000000000 Binary files a/LuaUI/Fonts/FreeSansBoldWOutline_14.png and /dev/null differ diff --git a/LuaUI/Fonts/FreeSansBold_14.lua b/LuaUI/Fonts/FreeSansBold_14.lua deleted file mode 100644 index c8faf2372..000000000 --- a/LuaUI/Fonts/FreeSansBold_14.lua +++ /dev/null @@ -1,1365 +0,0 @@ --- $Id: FreeSansBold_14.lua 3171 2008-11-06 09:06:29Z det $ - -local fontSpecs = { - srcFile = [[FreeSansBold.ttf]], - family = [[FreeSans]], - style = [[Bold]], - yStep = 15, - height = 14, - xTexSize = 512, - yTexSize = 256, - outlineRadius = 2, - outlineWeight = 100, -} - -local glyphs = {} - -glyphs[32] = { --' '-- - num = 32, - adv = 4, - oxn = -2, oyn = -3, oxp = 3, oyp = 2, - txn = 1, tyn = 1, txp = 6, typ = 6, -} -glyphs[33] = { --'!'-- - num = 33, - adv = 5, - oxn = -1, oyn = -2, oxp = 6, oyp = 13, - txn = 21, tyn = 1, txp = 28, typ = 16, -} -glyphs[34] = { --'"'-- - num = 34, - adv = 7, - oxn = -2, oyn = 4, oxp = 8, oyp = 13, - txn = 41, tyn = 1, txp = 51, typ = 10, -} -glyphs[35] = { --'#'-- - num = 35, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 12, - txn = 61, tyn = 1, txp = 73, typ = 16, -} -glyphs[36] = { --'$'-- - num = 36, - adv = 8, - oxn = -2, oyn = -4, oxp = 10, oyp = 13, - txn = 81, tyn = 1, txp = 93, typ = 18, -} -glyphs[37] = { --'%'-- - num = 37, - adv = 12, - oxn = -2, oyn = -3, oxp = 15, oyp = 12, - txn = 101, tyn = 1, txp = 118, typ = 16, -} -glyphs[38] = { --'&'-- - num = 38, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 121, tyn = 1, txp = 135, typ = 17, -} -glyphs[39] = { --'''-- - num = 39, - adv = 3, - oxn = -2, oyn = 4, oxp = 5, oyp = 13, - txn = 141, tyn = 1, txp = 148, typ = 10, -} -glyphs[40] = { --'('-- - num = 40, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 161, tyn = 1, txp = 170, typ = 19, -} -glyphs[41] = { --')'-- - num = 41, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 13, - txn = 181, tyn = 1, txp = 189, typ = 19, -} -glyphs[42] = { --'*'-- - num = 42, - adv = 5, - oxn = -2, oyn = 3, oxp = 7, oyp = 13, - txn = 201, tyn = 1, txp = 210, typ = 11, -} -glyphs[43] = { --'+'-- - num = 43, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 221, tyn = 1, txp = 233, typ = 13, -} -glyphs[44] = { --','-- - num = 44, - adv = 4, - oxn = -2, oyn = -5, oxp = 5, oyp = 5, - txn = 241, tyn = 1, txp = 248, typ = 11, -} -glyphs[45] = { --'-'-- - num = 45, - adv = 5, - oxn = -2, oyn = 0, oxp = 7, oyp = 7, - txn = 261, tyn = 1, txp = 270, typ = 8, -} -glyphs[46] = { --'.'-- - num = 46, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 5, - txn = 281, tyn = 1, txp = 288, typ = 8, -} -glyphs[47] = { --'/'-- - num = 47, - adv = 4, - oxn = -2, oyn = -3, oxp = 6, oyp = 12, - txn = 301, tyn = 1, txp = 309, typ = 16, -} -glyphs[48] = { --'0'-- - num = 48, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 321, tyn = 1, txp = 333, typ = 17, -} -glyphs[49] = { --'1'-- - num = 49, - adv = 8, - oxn = -2, oyn = -2, oxp = 8, oyp = 12, - txn = 341, tyn = 1, txp = 351, typ = 15, -} -glyphs[50] = { --'2'-- - num = 50, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 361, tyn = 1, txp = 373, typ = 16, -} -glyphs[51] = { --'3'-- - num = 51, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 1, txp = 393, typ = 17, -} -glyphs[52] = { --'4'-- - num = 52, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 401, tyn = 1, txp = 413, typ = 15, -} -glyphs[53] = { --'5'-- - num = 53, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 12, - txn = 421, tyn = 1, txp = 433, typ = 16, -} -glyphs[54] = { --'6'-- - num = 54, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 441, tyn = 1, txp = 453, typ = 17, -} -glyphs[55] = { --'7'-- - num = 55, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 461, tyn = 1, txp = 473, typ = 15, -} -glyphs[56] = { --'8'-- - num = 56, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 481, tyn = 1, txp = 493, typ = 17, -} -glyphs[57] = { --'9'-- - num = 57, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 1, tyn = 22, txp = 13, typ = 38, -} -glyphs[58] = { --':'-- - num = 58, - adv = 5, - oxn = -1, oyn = -2, oxp = 6, oyp = 10, - txn = 21, tyn = 22, txp = 28, typ = 34, -} -glyphs[59] = { --';'-- - num = 59, - adv = 5, - oxn = -1, oyn = -5, oxp = 6, oyp = 10, - txn = 41, tyn = 22, txp = 48, typ = 37, -} -glyphs[60] = { --'<'-- - num = 60, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 61, tyn = 22, txp = 73, typ = 34, -} -glyphs[61] = { --'='-- - num = 61, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 8, - txn = 81, tyn = 22, txp = 93, typ = 32, -} -glyphs[62] = { --'>'-- - num = 62, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 101, tyn = 22, txp = 113, typ = 34, -} -glyphs[63] = { --'?'-- - num = 63, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 121, tyn = 22, txp = 133, typ = 37, -} -glyphs[64] = { --'@'-- - num = 64, - adv = 14, - oxn = -2, oyn = -4, oxp = 16, oyp = 13, - txn = 141, tyn = 22, txp = 159, typ = 39, -} -glyphs[65] = { --'A'-- - num = 65, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 161, tyn = 22, txp = 175, typ = 37, -} -glyphs[66] = { --'B'-- - num = 66, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 181, tyn = 22, txp = 194, typ = 37, -} -glyphs[67] = { --'C'-- - num = 67, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 201, tyn = 22, txp = 215, typ = 38, -} -glyphs[68] = { --'D'-- - num = 68, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 221, tyn = 22, txp = 234, typ = 37, -} -glyphs[69] = { --'E'-- - num = 69, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 241, tyn = 22, txp = 253, typ = 37, -} -glyphs[70] = { --'F'-- - num = 70, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 261, tyn = 22, txp = 273, typ = 37, -} -glyphs[71] = { --'G'-- - num = 71, - adv = 11, - oxn = -2, oyn = -3, oxp = 12, oyp = 13, - txn = 281, tyn = 22, txp = 295, typ = 38, -} -glyphs[72] = { --'H'-- - num = 72, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 301, tyn = 22, txp = 315, typ = 37, -} -glyphs[73] = { --'I'-- - num = 73, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 321, tyn = 22, txp = 328, typ = 37, -} -glyphs[74] = { --'J'-- - num = 74, - adv = 8, - oxn = -2, oyn = -3, oxp = 9, oyp = 13, - txn = 341, tyn = 22, txp = 352, typ = 38, -} -glyphs[75] = { --'K'-- - num = 75, - adv = 10, - oxn = -1, oyn = -2, oxp = 13, oyp = 13, - txn = 361, tyn = 22, txp = 375, typ = 37, -} -glyphs[76] = { --'L'-- - num = 76, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 381, tyn = 22, txp = 393, typ = 37, -} -glyphs[77] = { --'M'-- - num = 77, - adv = 12, - oxn = -2, oyn = -2, oxp = 13, oyp = 13, - txn = 401, tyn = 22, txp = 416, typ = 37, -} -glyphs[78] = { --'N'-- - num = 78, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 421, tyn = 22, txp = 435, typ = 37, -} -glyphs[79] = { --'O'-- - num = 79, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 441, tyn = 22, txp = 456, typ = 38, -} -glyphs[80] = { --'P'-- - num = 80, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 461, tyn = 22, txp = 473, typ = 37, -} -glyphs[81] = { --'Q'-- - num = 81, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 481, tyn = 22, txp = 496, typ = 38, -} -glyphs[82] = { --'R'-- - num = 82, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 13, - txn = 1, tyn = 43, txp = 14, typ = 58, -} -glyphs[83] = { --'S'-- - num = 83, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 21, tyn = 43, txp = 34, typ = 59, -} -glyphs[84] = { --'T'-- - num = 84, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 13, - txn = 41, tyn = 43, txp = 54, typ = 58, -} -glyphs[85] = { --'U'-- - num = 85, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 13, - txn = 61, tyn = 43, txp = 74, typ = 59, -} -glyphs[86] = { --'V'-- - num = 86, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 81, tyn = 43, txp = 95, typ = 58, -} -glyphs[87] = { --'W'-- - num = 87, - adv = 13, - oxn = -2, oyn = -2, oxp = 16, oyp = 13, - txn = 101, tyn = 43, txp = 119, typ = 58, -} -glyphs[88] = { --'X'-- - num = 88, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 121, tyn = 43, txp = 135, typ = 58, -} -glyphs[89] = { --'Y'-- - num = 89, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 141, tyn = 43, txp = 155, typ = 58, -} -glyphs[90] = { --'Z'-- - num = 90, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 13, - txn = 161, tyn = 43, txp = 174, typ = 58, -} -glyphs[91] = { --'['-- - num = 91, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 181, tyn = 43, txp = 190, typ = 61, -} -glyphs[92] = { --'\'-- - num = 92, - adv = 4, - oxn = -3, oyn = -3, oxp = 7, oyp = 12, - txn = 201, tyn = 43, txp = 211, typ = 58, -} -glyphs[93] = { --']'-- - num = 93, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 13, - txn = 221, tyn = 43, txp = 229, typ = 61, -} -glyphs[94] = { --'^'-- - num = 94, - adv = 8, - oxn = -2, oyn = 1, oxp = 10, oyp = 12, - txn = 241, tyn = 43, txp = 253, typ = 54, -} -glyphs[95] = { --'_'-- - num = 95, - adv = 8, - oxn = -3, oyn = -5, oxp = 11, oyp = 1, - txn = 261, tyn = 43, txp = 275, typ = 49, -} -glyphs[96] = { --'`'-- - num = 96, - adv = 5, - oxn = -2, oyn = 6, oxp = 5, oyp = 13, - txn = 281, tyn = 43, txp = 288, typ = 50, -} -glyphs[97] = { --'a'-- - num = 97, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 301, tyn = 43, txp = 313, typ = 56, -} -glyphs[98] = { --'b'-- - num = 98, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 321, tyn = 43, txp = 334, typ = 59, -} -glyphs[99] = { --'c'-- - num = 99, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 341, tyn = 43, txp = 353, typ = 56, -} -glyphs[100] = { --'d'-- - num = 100, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 43, txp = 373, typ = 59, -} -glyphs[101] = { --'e'-- - num = 101, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 381, tyn = 43, txp = 393, typ = 56, -} -glyphs[102] = { --'f'-- - num = 102, - adv = 5, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 401, tyn = 43, txp = 410, typ = 58, -} -glyphs[103] = { --'g'-- - num = 103, - adv = 9, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 421, tyn = 43, txp = 433, typ = 59, -} -glyphs[104] = { --'h'-- - num = 104, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 441, tyn = 43, txp = 453, typ = 58, -} -glyphs[105] = { --'i'-- - num = 105, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 461, tyn = 43, txp = 468, typ = 58, -} -glyphs[106] = { --'j'-- - num = 106, - adv = 4, - oxn = -2, oyn = -6, oxp = 5, oyp = 13, - txn = 481, tyn = 43, txp = 488, typ = 62, -} -glyphs[107] = { --'k'-- - num = 107, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 1, tyn = 64, txp = 13, typ = 79, -} -glyphs[108] = { --'l'-- - num = 108, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 21, tyn = 64, txp = 28, typ = 79, -} -glyphs[109] = { --'m'-- - num = 109, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 10, - txn = 41, tyn = 64, txp = 57, typ = 76, -} -glyphs[110] = { --'n'-- - num = 110, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 61, tyn = 64, txp = 73, typ = 76, -} -glyphs[111] = { --'o'-- - num = 111, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 81, tyn = 64, txp = 93, typ = 77, -} -glyphs[112] = { --'p'-- - num = 112, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 10, - txn = 101, tyn = 64, txp = 114, typ = 80, -} -glyphs[113] = { --'q'-- - num = 113, - adv = 9, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 121, tyn = 64, txp = 133, typ = 80, -} -glyphs[114] = { --'r'-- - num = 114, - adv = 5, - oxn = -2, oyn = -2, oxp = 8, oyp = 10, - txn = 141, tyn = 64, txp = 151, typ = 76, -} -glyphs[115] = { --'s'-- - num = 115, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 161, tyn = 64, txp = 173, typ = 77, -} -glyphs[116] = { --'t'-- - num = 116, - adv = 5, - oxn = -2, oyn = -3, oxp = 7, oyp = 12, - txn = 181, tyn = 64, txp = 190, typ = 79, -} -glyphs[117] = { --'u'-- - num = 117, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 10, - txn = 201, tyn = 64, txp = 213, typ = 77, -} -glyphs[118] = { --'v'-- - num = 118, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 221, tyn = 64, txp = 233, typ = 76, -} -glyphs[119] = { --'w'-- - num = 119, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 10, - txn = 241, tyn = 64, txp = 256, typ = 76, -} -glyphs[120] = { --'x'-- - num = 120, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 10, - txn = 261, tyn = 64, txp = 273, typ = 76, -} -glyphs[121] = { --'y'-- - num = 121, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 281, tyn = 64, txp = 293, typ = 80, -} -glyphs[122] = { --'z'-- - num = 122, - adv = 7, - oxn = -2, oyn = -2, oxp = 9, oyp = 10, - txn = 301, tyn = 64, txp = 312, typ = 76, -} -glyphs[123] = { --'{'-- - num = 123, - adv = 5, - oxn = -2, oyn = -5, oxp = 7, oyp = 13, - txn = 321, tyn = 64, txp = 330, typ = 82, -} -glyphs[124] = { --'|'-- - num = 124, - adv = 4, - oxn = -1, oyn = -5, oxp = 5, oyp = 13, - txn = 341, tyn = 64, txp = 347, typ = 82, -} -glyphs[125] = { --'}'-- - num = 125, - adv = 5, - oxn = -1, oyn = -5, oxp = 7, oyp = 13, - txn = 361, tyn = 64, txp = 369, typ = 82, -} -glyphs[126] = { --'~'-- - num = 126, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 7, - txn = 381, tyn = 64, txp = 393, typ = 72, -} -glyphs[127] = { --''-- - num = 127, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 401, tyn = 64, txp = 410, typ = 78, -} -glyphs[128] = { --'€'-- - num = 128, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 421, tyn = 64, txp = 430, typ = 78, -} -glyphs[129] = { --'�'-- - num = 129, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 441, tyn = 64, txp = 450, typ = 78, -} -glyphs[130] = { --'‚'-- - num = 130, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 461, tyn = 64, txp = 470, typ = 78, -} -glyphs[131] = { --'ƒ'-- - num = 131, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 481, tyn = 64, txp = 490, typ = 78, -} -glyphs[132] = { --'„'-- - num = 132, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 1, tyn = 85, txp = 10, typ = 99, -} -glyphs[133] = { --'…'-- - num = 133, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 21, tyn = 85, txp = 30, typ = 99, -} -glyphs[134] = { --'†'-- - num = 134, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 41, tyn = 85, txp = 50, typ = 99, -} -glyphs[135] = { --'‡'-- - num = 135, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 61, tyn = 85, txp = 70, typ = 99, -} -glyphs[136] = { --'ˆ'-- - num = 136, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 81, tyn = 85, txp = 90, typ = 99, -} -glyphs[137] = { --'‰'-- - num = 137, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 101, tyn = 85, txp = 110, typ = 99, -} -glyphs[138] = { --'Š'-- - num = 138, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 121, tyn = 85, txp = 130, typ = 99, -} -glyphs[139] = { --'‹'-- - num = 139, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 141, tyn = 85, txp = 150, typ = 99, -} -glyphs[140] = { --'Œ'-- - num = 140, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 161, tyn = 85, txp = 170, typ = 99, -} -glyphs[141] = { --'�'-- - num = 141, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 181, tyn = 85, txp = 190, typ = 99, -} -glyphs[142] = { --'Ž'-- - num = 142, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 201, tyn = 85, txp = 210, typ = 99, -} -glyphs[143] = { --'�'-- - num = 143, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 221, tyn = 85, txp = 230, typ = 99, -} -glyphs[144] = { --'�'-- - num = 144, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 241, tyn = 85, txp = 250, typ = 99, -} -glyphs[145] = { --'‘'-- - num = 145, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 261, tyn = 85, txp = 270, typ = 99, -} -glyphs[146] = { --'’'-- - num = 146, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 281, tyn = 85, txp = 290, typ = 99, -} -glyphs[147] = { --'“'-- - num = 147, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 301, tyn = 85, txp = 310, typ = 99, -} -glyphs[148] = { --'”'-- - num = 148, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 321, tyn = 85, txp = 330, typ = 99, -} -glyphs[149] = { --'•'-- - num = 149, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 341, tyn = 85, txp = 350, typ = 99, -} -glyphs[150] = { --'–'-- - num = 150, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 361, tyn = 85, txp = 370, typ = 99, -} -glyphs[151] = { --'—'-- - num = 151, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 381, tyn = 85, txp = 390, typ = 99, -} -glyphs[152] = { --'˜'-- - num = 152, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 401, tyn = 85, txp = 410, typ = 99, -} -glyphs[153] = { --'™'-- - num = 153, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 421, tyn = 85, txp = 430, typ = 99, -} -glyphs[154] = { --'š'-- - num = 154, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 441, tyn = 85, txp = 450, typ = 99, -} -glyphs[155] = { --'›'-- - num = 155, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 461, tyn = 85, txp = 470, typ = 99, -} -glyphs[156] = { --'œ'-- - num = 156, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 481, tyn = 85, txp = 490, typ = 99, -} -glyphs[157] = { --'�'-- - num = 157, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 1, tyn = 106, txp = 10, typ = 120, -} -glyphs[158] = { --'ž'-- - num = 158, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 21, tyn = 106, txp = 30, typ = 120, -} -glyphs[159] = { --'Ÿ'-- - num = 159, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 41, tyn = 106, txp = 50, typ = 120, -} -glyphs[160] = { --' '-- - num = 160, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 61, tyn = 106, txp = 70, typ = 120, -} -glyphs[161] = { --'¡'-- - num = 161, - adv = 5, - oxn = -2, oyn = -5, oxp = 6, oyp = 10, - txn = 81, tyn = 106, txp = 89, typ = 121, -} -glyphs[162] = { --'¢'-- - num = 162, - adv = 8, - oxn = -2, oyn = -4, oxp = 10, oyp = 11, - txn = 101, tyn = 106, txp = 113, typ = 121, -} -glyphs[163] = { --'£'-- - num = 163, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 121, tyn = 106, txp = 133, typ = 122, -} -glyphs[164] = { --'¤'-- - num = 164, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 11, - txn = 141, tyn = 106, txp = 153, typ = 118, -} -glyphs[165] = { --'¥'-- - num = 165, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 12, - txn = 161, tyn = 106, txp = 173, typ = 120, -} -glyphs[166] = { --'¦'-- - num = 166, - adv = 4, - oxn = -1, oyn = -5, oxp = 5, oyp = 13, - txn = 181, tyn = 106, txp = 187, typ = 124, -} -glyphs[167] = { --'§'-- - num = 167, - adv = 8, - oxn = -2, oyn = -5, oxp = 10, oyp = 13, - txn = 201, tyn = 106, txp = 213, typ = 124, -} -glyphs[168] = { --'¨'-- - num = 168, - adv = 5, - oxn = -2, oyn = 6, oxp = 7, oyp = 13, - txn = 221, tyn = 106, txp = 230, typ = 113, -} -glyphs[169] = { --'©'-- - num = 169, - adv = 10, - oxn = -3, oyn = -3, oxp = 13, oyp = 13, - txn = 241, tyn = 106, txp = 257, typ = 122, -} -glyphs[170] = { --'ª'-- - num = 170, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 261, tyn = 106, txp = 270, typ = 118, -} -glyphs[171] = { --'«'-- - num = 171, - adv = 8, - oxn = -1, oyn = -1, oxp = 9, oyp = 9, - txn = 281, tyn = 106, txp = 291, typ = 116, -} -glyphs[172] = { --'¬'-- - num = 172, - adv = 8, - oxn = -2, oyn = -1, oxp = 10, oyp = 8, - txn = 301, tyn = 106, txp = 313, typ = 115, -} -glyphs[173] = { --'­'-- - num = 173, - adv = 6, - oxn = -2, oyn = -2, oxp = 7, oyp = 12, - txn = 321, tyn = 106, txp = 330, typ = 120, -} -glyphs[174] = { --'®'-- - num = 174, - adv = 10, - oxn = -3, oyn = -3, oxp = 13, oyp = 13, - txn = 341, tyn = 106, txp = 357, typ = 122, -} -glyphs[175] = { --'¯'-- - num = 175, - adv = 5, - oxn = -2, oyn = 6, oxp = 7, oyp = 13, - txn = 361, tyn = 106, txp = 370, typ = 113, -} -glyphs[176] = { --'°'-- - num = 176, - adv = 8, - oxn = 0, oyn = 3, oxp = 9, oyp = 12, - txn = 381, tyn = 106, txp = 390, typ = 115, -} -glyphs[177] = { --'±'-- - num = 177, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 11, - txn = 401, tyn = 106, txp = 413, typ = 120, -} -glyphs[178] = { --'²'-- - num = 178, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 421, tyn = 106, txp = 430, typ = 118, -} -glyphs[179] = { --'³'-- - num = 179, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 441, tyn = 106, txp = 450, typ = 118, -} -glyphs[180] = { --'´'-- - num = 180, - adv = 5, - oxn = -1, oyn = 6, oxp = 7, oyp = 13, - txn = 461, tyn = 106, txp = 469, typ = 113, -} -glyphs[181] = { --'µ'-- - num = 181, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 10, - txn = 481, tyn = 106, txp = 494, typ = 122, -} -glyphs[182] = { --'¶'-- - num = 182, - adv = 8, - oxn = -2, oyn = -5, oxp = 10, oyp = 13, - txn = 1, tyn = 127, txp = 13, typ = 145, -} -glyphs[183] = { --'·'-- - num = 183, - adv = 4, - oxn = -2, oyn = 0, oxp = 5, oyp = 7, - txn = 21, tyn = 127, txp = 28, typ = 134, -} -glyphs[184] = { --'¸'-- - num = 184, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 2, - txn = 41, tyn = 127, txp = 50, typ = 135, -} -glyphs[185] = { --'¹'-- - num = 185, - adv = 5, - oxn = -2, oyn = 1, oxp = 6, oyp = 12, - txn = 61, tyn = 127, txp = 69, typ = 138, -} -glyphs[186] = { --'º'-- - num = 186, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 13, - txn = 81, tyn = 127, txp = 90, typ = 139, -} -glyphs[187] = { --'»'-- - num = 187, - adv = 8, - oxn = -1, oyn = -1, oxp = 9, oyp = 9, - txn = 101, tyn = 127, txp = 111, typ = 137, -} -glyphs[188] = { --'¼'-- - num = 188, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 121, tyn = 127, txp = 137, typ = 143, -} -glyphs[189] = { --'½'-- - num = 189, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 141, tyn = 127, txp = 157, typ = 143, -} -glyphs[190] = { --'¾'-- - num = 190, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 13, - txn = 161, tyn = 127, txp = 177, typ = 143, -} -glyphs[191] = { --'¿'-- - num = 191, - adv = 9, - oxn = -2, oyn = -5, oxp = 10, oyp = 10, - txn = 181, tyn = 127, txp = 193, typ = 142, -} -glyphs[192] = { --'À'-- - num = 192, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 201, tyn = 127, txp = 215, typ = 145, -} -glyphs[193] = { --'Á'-- - num = 193, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 15, - txn = 221, tyn = 127, txp = 235, typ = 144, -} -glyphs[194] = { --'Â'-- - num = 194, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 241, tyn = 127, txp = 255, typ = 145, -} -glyphs[195] = { --'Ã'-- - num = 195, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 261, tyn = 127, txp = 275, typ = 145, -} -glyphs[196] = { --'Ä'-- - num = 196, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 281, tyn = 127, txp = 295, typ = 145, -} -glyphs[197] = { --'Å'-- - num = 197, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 301, tyn = 127, txp = 315, typ = 145, -} -glyphs[198] = { --'Æ'-- - num = 198, - adv = 14, - oxn = -2, oyn = -2, oxp = 16, oyp = 13, - txn = 321, tyn = 127, txp = 339, typ = 142, -} -glyphs[199] = { --'Ç'-- - num = 199, - adv = 10, - oxn = -2, oyn = -6, oxp = 12, oyp = 13, - txn = 341, tyn = 127, txp = 355, typ = 146, -} -glyphs[200] = { --'È'-- - num = 200, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 361, tyn = 127, txp = 373, typ = 145, -} -glyphs[201] = { --'É'-- - num = 201, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 381, tyn = 127, txp = 393, typ = 145, -} -glyphs[202] = { --'Ê'-- - num = 202, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 401, tyn = 127, txp = 413, typ = 145, -} -glyphs[203] = { --'Ë'-- - num = 203, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 16, - txn = 421, tyn = 127, txp = 433, typ = 145, -} -glyphs[204] = { --'Ì'-- - num = 204, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 16, - txn = 441, tyn = 127, txp = 448, typ = 145, -} -glyphs[205] = { --'Í'-- - num = 205, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 461, tyn = 127, txp = 470, typ = 145, -} -glyphs[206] = { --'Î'-- - num = 206, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 481, tyn = 127, txp = 490, typ = 145, -} -glyphs[207] = { --'Ï'-- - num = 207, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 16, - txn = 1, tyn = 148, txp = 10, typ = 166, -} -glyphs[208] = { --'Ð'-- - num = 208, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 13, - txn = 21, tyn = 148, txp = 35, typ = 163, -} -glyphs[209] = { --'Ñ'-- - num = 209, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 41, tyn = 148, txp = 55, typ = 166, -} -glyphs[210] = { --'Ò'-- - num = 210, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 61, tyn = 148, txp = 76, typ = 167, -} -glyphs[211] = { --'Ó'-- - num = 211, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 81, tyn = 148, txp = 96, typ = 167, -} -glyphs[212] = { --'Ô'-- - num = 212, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 101, tyn = 148, txp = 116, typ = 167, -} -glyphs[213] = { --'Õ'-- - num = 213, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 121, tyn = 148, txp = 136, typ = 167, -} -glyphs[214] = { --'Ö'-- - num = 214, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 16, - txn = 141, tyn = 148, txp = 156, typ = 167, -} -glyphs[215] = { --'×'-- - num = 215, - adv = 8, - oxn = -1, oyn = -2, oxp = 10, oyp = 9, - txn = 161, tyn = 148, txp = 172, typ = 159, -} -glyphs[216] = { --'Ø'-- - num = 216, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 13, - txn = 181, tyn = 148, txp = 196, typ = 164, -} -glyphs[217] = { --'Ù'-- - num = 217, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 201, tyn = 148, txp = 214, typ = 167, -} -glyphs[218] = { --'Ú'-- - num = 218, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 221, tyn = 148, txp = 234, typ = 167, -} -glyphs[219] = { --'Û'-- - num = 219, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 241, tyn = 148, txp = 254, typ = 167, -} -glyphs[220] = { --'Ü'-- - num = 220, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 16, - txn = 261, tyn = 148, txp = 274, typ = 167, -} -glyphs[221] = { --'Ý'-- - num = 221, - adv = 9, - oxn = -2, oyn = -2, oxp = 12, oyp = 16, - txn = 281, tyn = 148, txp = 295, typ = 166, -} -glyphs[222] = { --'Þ'-- - num = 222, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 13, - txn = 301, tyn = 148, txp = 313, typ = 163, -} -glyphs[223] = { --'ß'-- - num = 223, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 13, - txn = 321, tyn = 148, txp = 334, typ = 164, -} -glyphs[224] = { --'à'-- - num = 224, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 341, tyn = 148, txp = 353, typ = 164, -} -glyphs[225] = { --'á'-- - num = 225, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 148, txp = 373, typ = 164, -} -glyphs[226] = { --'â'-- - num = 226, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 148, txp = 393, typ = 164, -} -glyphs[227] = { --'ã'-- - num = 227, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 401, tyn = 148, txp = 413, typ = 164, -} -glyphs[228] = { --'ä'-- - num = 228, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 421, tyn = 148, txp = 433, typ = 164, -} -glyphs[229] = { --'å'-- - num = 229, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 441, tyn = 148, txp = 453, typ = 164, -} -glyphs[230] = { --'æ'-- - num = 230, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 10, - txn = 461, tyn = 148, txp = 477, typ = 161, -} -glyphs[231] = { --'ç'-- - num = 231, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 10, - txn = 481, tyn = 148, txp = 493, typ = 164, -} -glyphs[232] = { --'è'-- - num = 232, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 1, tyn = 169, txp = 13, typ = 185, -} -glyphs[233] = { --'é'-- - num = 233, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 21, tyn = 169, txp = 33, typ = 185, -} -glyphs[234] = { --'ê'-- - num = 234, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 41, tyn = 169, txp = 53, typ = 185, -} -glyphs[235] = { --'ë'-- - num = 235, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 61, tyn = 169, txp = 73, typ = 185, -} -glyphs[236] = { --'ì'-- - num = 236, - adv = 4, - oxn = -2, oyn = -2, oxp = 5, oyp = 13, - txn = 81, tyn = 169, txp = 88, typ = 184, -} -glyphs[237] = { --'í'-- - num = 237, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 101, tyn = 169, txp = 110, typ = 184, -} -glyphs[238] = { --'î'-- - num = 238, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 121, tyn = 169, txp = 130, typ = 184, -} -glyphs[239] = { --'ï'-- - num = 239, - adv = 4, - oxn = -2, oyn = -2, oxp = 7, oyp = 13, - txn = 141, tyn = 169, txp = 150, typ = 184, -} -glyphs[240] = { --'ð'-- - num = 240, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 161, tyn = 169, txp = 173, typ = 185, -} -glyphs[241] = { --'ñ'-- - num = 241, - adv = 9, - oxn = -2, oyn = -2, oxp = 10, oyp = 13, - txn = 181, tyn = 169, txp = 193, typ = 184, -} -glyphs[242] = { --'ò'-- - num = 242, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 201, tyn = 169, txp = 213, typ = 185, -} -glyphs[243] = { --'ó'-- - num = 243, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 221, tyn = 169, txp = 233, typ = 185, -} -glyphs[244] = { --'ô'-- - num = 244, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 241, tyn = 169, txp = 253, typ = 185, -} -glyphs[245] = { --'õ'-- - num = 245, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 261, tyn = 169, txp = 273, typ = 185, -} -glyphs[246] = { --'ö'-- - num = 246, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 281, tyn = 169, txp = 293, typ = 185, -} -glyphs[247] = { --'÷'-- - num = 247, - adv = 8, - oxn = -2, oyn = -3, oxp = 10, oyp = 9, - txn = 301, tyn = 169, txp = 313, typ = 181, -} -glyphs[248] = { --'ø'-- - num = 248, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 321, tyn = 169, txp = 334, typ = 182, -} -glyphs[249] = { --'ù'-- - num = 249, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 341, tyn = 169, txp = 353, typ = 185, -} -glyphs[250] = { --'ú'-- - num = 250, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 361, tyn = 169, txp = 373, typ = 185, -} -glyphs[251] = { --'û'-- - num = 251, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 381, tyn = 169, txp = 393, typ = 185, -} -glyphs[252] = { --'ü'-- - num = 252, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 13, - txn = 401, tyn = 169, txp = 413, typ = 185, -} -glyphs[253] = { --'ý'-- - num = 253, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 13, - txn = 421, tyn = 169, txp = 433, typ = 188, -} -glyphs[254] = { --'þ'-- - num = 254, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 13, - txn = 441, tyn = 169, txp = 454, typ = 188, -} -glyphs[255] = { --'ÿ'-- - num = 255, - adv = 8, - oxn = -2, oyn = -6, oxp = 10, oyp = 13, - txn = 461, tyn = 169, txp = 473, typ = 188, -} - -fontSpecs.glyphs = glyphs - -return fontSpecs - diff --git a/LuaUI/Fonts/FreeSansBold_14.png b/LuaUI/Fonts/FreeSansBold_14.png deleted file mode 100644 index 01c39b386..000000000 Binary files a/LuaUI/Fonts/FreeSansBold_14.png and /dev/null differ diff --git a/LuaUI/Fonts/FreeSansBold_16.lua b/LuaUI/Fonts/FreeSansBold_16.lua deleted file mode 100644 index 5b5ad4041..000000000 --- a/LuaUI/Fonts/FreeSansBold_16.lua +++ /dev/null @@ -1,1365 +0,0 @@ --- $Id: FreeSansBold_16.lua 3171 2008-11-06 09:06:29Z det $ - -local fontSpecs = { - srcFile = [[FreeSansBold.ttf]], - family = [[FreeSans]], - style = [[Bold]], - yStep = 17, - height = 16, - xTexSize = 512, - yTexSize = 256, - outlineRadius = 2, - outlineWeight = 100, -} - -local glyphs = {} - -glyphs[32] = { --' '-- - num = 32, - adv = 4, - oxn = -2, oyn = -3, oxp = 3, oyp = 2, - txn = 1, tyn = 1, txp = 6, typ = 6, -} -glyphs[33] = { --'!'-- - num = 33, - adv = 5, - oxn = -1, oyn = -2, oxp = 7, oyp = 14, - txn = 23, tyn = 1, txp = 31, typ = 17, -} -glyphs[34] = { --'"'-- - num = 34, - adv = 8, - oxn = -2, oyn = 5, oxp = 9, oyp = 14, - txn = 45, tyn = 1, txp = 56, typ = 10, -} -glyphs[35] = { --'#'-- - num = 35, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 67, tyn = 1, txp = 80, typ = 18, -} -glyphs[36] = { --'$'-- - num = 36, - adv = 9, - oxn = -2, oyn = -5, oxp = 11, oyp = 15, - txn = 89, tyn = 1, txp = 102, typ = 21, -} -glyphs[37] = { --'%'-- - num = 37, - adv = 14, - oxn = -2, oyn = -3, oxp = 16, oyp = 14, - txn = 111, tyn = 1, txp = 129, typ = 18, -} -glyphs[38] = { --'&'-- - num = 38, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 14, - txn = 133, tyn = 1, txp = 149, typ = 18, -} -glyphs[39] = { --'''-- - num = 39, - adv = 4, - oxn = -2, oyn = 5, oxp = 6, oyp = 14, - txn = 155, tyn = 1, txp = 163, typ = 10, -} -glyphs[40] = { --'('-- - num = 40, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 14, - txn = 177, tyn = 1, txp = 186, typ = 21, -} -glyphs[41] = { --')'-- - num = 41, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 14, - txn = 199, tyn = 1, txp = 208, typ = 21, -} -glyphs[42] = { --'*'-- - num = 42, - adv = 6, - oxn = -2, oyn = 4, oxp = 8, oyp = 14, - txn = 221, tyn = 1, txp = 231, typ = 11, -} -glyphs[43] = { --'+'-- - num = 43, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 243, tyn = 1, txp = 256, typ = 14, -} -glyphs[44] = { --','-- - num = 44, - adv = 4, - oxn = -1, oyn = -5, oxp = 6, oyp = 5, - txn = 265, tyn = 1, txp = 272, typ = 11, -} -glyphs[45] = { --'-'-- - num = 45, - adv = 5, - oxn = -2, oyn = 1, oxp = 7, oyp = 8, - txn = 287, tyn = 1, txp = 296, typ = 8, -} -glyphs[46] = { --'.'-- - num = 46, - adv = 4, - oxn = -1, oyn = -2, oxp = 6, oyp = 5, - txn = 309, tyn = 1, txp = 316, typ = 8, -} -glyphs[47] = { --'/'-- - num = 47, - adv = 4, - oxn = -2, oyn = -3, oxp = 7, oyp = 14, - txn = 331, tyn = 1, txp = 340, typ = 18, -} -glyphs[48] = { --'0'-- - num = 48, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 353, tyn = 1, txp = 366, typ = 18, -} -glyphs[49] = { --'1'-- - num = 49, - adv = 9, - oxn = -1, oyn = -2, oxp = 9, oyp = 14, - txn = 375, tyn = 1, txp = 385, typ = 17, -} -glyphs[50] = { --'2'-- - num = 50, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 14, - txn = 397, tyn = 1, txp = 410, typ = 17, -} -glyphs[51] = { --'3'-- - num = 51, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 419, tyn = 1, txp = 432, typ = 18, -} -glyphs[52] = { --'4'-- - num = 52, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 14, - txn = 441, tyn = 1, txp = 454, typ = 17, -} -glyphs[53] = { --'5'-- - num = 53, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 463, tyn = 1, txp = 476, typ = 18, -} -glyphs[54] = { --'6'-- - num = 54, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 485, tyn = 1, txp = 498, typ = 18, -} -glyphs[55] = { --'7'-- - num = 55, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 14, - txn = 1, tyn = 24, txp = 14, typ = 40, -} -glyphs[56] = { --'8'-- - num = 56, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 23, tyn = 24, txp = 36, typ = 41, -} -glyphs[57] = { --'9'-- - num = 57, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 45, tyn = 24, txp = 58, typ = 41, -} -glyphs[58] = { --':'-- - num = 58, - adv = 5, - oxn = -1, oyn = -2, oxp = 7, oyp = 11, - txn = 67, tyn = 24, txp = 75, typ = 37, -} -glyphs[59] = { --';'-- - num = 59, - adv = 5, - oxn = -1, oyn = -5, oxp = 7, oyp = 11, - txn = 89, tyn = 24, txp = 97, typ = 40, -} -glyphs[60] = { --'<'-- - num = 60, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 111, tyn = 24, txp = 124, typ = 37, -} -glyphs[61] = { --'='-- - num = 61, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 9, - txn = 133, tyn = 24, txp = 146, typ = 35, -} -glyphs[62] = { --'>'-- - num = 62, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 155, tyn = 24, txp = 168, typ = 37, -} -glyphs[63] = { --'?'-- - num = 63, - adv = 10, - oxn = -1, oyn = -2, oxp = 11, oyp = 14, - txn = 177, tyn = 24, txp = 189, typ = 40, -} -glyphs[64] = { --'@'-- - num = 64, - adv = 16, - oxn = -2, oyn = -5, oxp = 18, oyp = 14, - txn = 199, tyn = 24, txp = 219, typ = 43, -} -glyphs[65] = { --'A'-- - num = 65, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 14, - txn = 221, tyn = 24, txp = 237, typ = 40, -} -glyphs[66] = { --'B'-- - num = 66, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 243, tyn = 24, txp = 257, typ = 40, -} -glyphs[67] = { --'C'-- - num = 67, - adv = 12, - oxn = -2, oyn = -3, oxp = 13, oyp = 14, - txn = 265, tyn = 24, txp = 280, typ = 41, -} -glyphs[68] = { --'D'-- - num = 68, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 287, tyn = 24, txp = 301, typ = 40, -} -glyphs[69] = { --'E'-- - num = 69, - adv = 11, - oxn = -1, oyn = -2, oxp = 12, oyp = 14, - txn = 309, tyn = 24, txp = 322, typ = 40, -} -glyphs[70] = { --'F'-- - num = 70, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 14, - txn = 331, tyn = 24, txp = 344, typ = 40, -} -glyphs[71] = { --'G'-- - num = 71, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 14, - txn = 353, tyn = 24, txp = 369, typ = 41, -} -glyphs[72] = { --'H'-- - num = 72, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 375, tyn = 24, txp = 389, typ = 40, -} -glyphs[73] = { --'I'-- - num = 73, - adv = 4, - oxn = -1, oyn = -2, oxp = 6, oyp = 14, - txn = 397, tyn = 24, txp = 404, typ = 40, -} -glyphs[74] = { --'J'-- - num = 74, - adv = 9, - oxn = -2, oyn = -3, oxp = 10, oyp = 14, - txn = 419, tyn = 24, txp = 431, typ = 41, -} -glyphs[75] = { --'K'-- - num = 75, - adv = 12, - oxn = -1, oyn = -2, oxp = 14, oyp = 14, - txn = 441, tyn = 24, txp = 456, typ = 40, -} -glyphs[76] = { --'L'-- - num = 76, - adv = 10, - oxn = -1, oyn = -2, oxp = 12, oyp = 14, - txn = 463, tyn = 24, txp = 476, typ = 40, -} -glyphs[77] = { --'M'-- - num = 77, - adv = 13, - oxn = -1, oyn = -2, oxp = 15, oyp = 14, - txn = 485, tyn = 24, txp = 501, typ = 40, -} -glyphs[78] = { --'N'-- - num = 78, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 1, tyn = 47, txp = 15, typ = 63, -} -glyphs[79] = { --'O'-- - num = 79, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 14, - txn = 23, tyn = 47, txp = 39, typ = 64, -} -glyphs[80] = { --'P'-- - num = 80, - adv = 11, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 45, tyn = 47, txp = 59, typ = 63, -} -glyphs[81] = { --'Q'-- - num = 81, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 14, - txn = 67, tyn = 47, txp = 83, typ = 64, -} -glyphs[82] = { --'R'-- - num = 82, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 89, tyn = 47, txp = 103, typ = 63, -} -glyphs[83] = { --'S'-- - num = 83, - adv = 11, - oxn = -2, oyn = -3, oxp = 13, oyp = 14, - txn = 111, tyn = 47, txp = 126, typ = 64, -} -glyphs[84] = { --'T'-- - num = 84, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 14, - txn = 133, tyn = 47, txp = 147, typ = 63, -} -glyphs[85] = { --'U'-- - num = 85, - adv = 12, - oxn = -1, oyn = -3, oxp = 13, oyp = 14, - txn = 155, tyn = 47, txp = 169, typ = 64, -} -glyphs[86] = { --'V'-- - num = 86, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 14, - txn = 177, tyn = 47, txp = 192, typ = 63, -} -glyphs[87] = { --'W'-- - num = 87, - adv = 15, - oxn = -2, oyn = -2, oxp = 17, oyp = 14, - txn = 199, tyn = 47, txp = 218, typ = 63, -} -glyphs[88] = { --'X'-- - num = 88, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 14, - txn = 221, tyn = 47, txp = 236, typ = 63, -} -glyphs[89] = { --'Y'-- - num = 89, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 14, - txn = 243, tyn = 47, txp = 258, typ = 63, -} -glyphs[90] = { --'Z'-- - num = 90, - adv = 10, - oxn = -2, oyn = -2, oxp = 12, oyp = 14, - txn = 265, tyn = 47, txp = 279, typ = 63, -} -glyphs[91] = { --'['-- - num = 91, - adv = 5, - oxn = -1, oyn = -6, oxp = 7, oyp = 14, - txn = 287, tyn = 47, txp = 295, typ = 67, -} -glyphs[92] = { --'\'-- - num = 92, - adv = 4, - oxn = -3, oyn = -3, oxp = 7, oyp = 14, - txn = 309, tyn = 47, txp = 319, typ = 64, -} -glyphs[93] = { --']'-- - num = 93, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 14, - txn = 331, tyn = 47, txp = 340, typ = 67, -} -glyphs[94] = { --'^'-- - num = 94, - adv = 9, - oxn = -2, oyn = 2, oxp = 11, oyp = 14, - txn = 353, tyn = 47, txp = 366, typ = 59, -} -glyphs[95] = { --'_'-- - num = 95, - adv = 9, - oxn = -3, oyn = -6, oxp = 12, oyp = 1, - txn = 375, tyn = 47, txp = 390, typ = 54, -} -glyphs[96] = { --'`'-- - num = 96, - adv = 5, - oxn = -2, oyn = 7, oxp = 6, oyp = 15, - txn = 397, tyn = 47, txp = 405, typ = 55, -} -glyphs[97] = { --'a'-- - num = 97, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 11, - txn = 419, tyn = 47, txp = 432, typ = 61, -} -glyphs[98] = { --'b'-- - num = 98, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 14, - txn = 441, tyn = 47, txp = 455, typ = 64, -} -glyphs[99] = { --'c'-- - num = 99, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 11, - txn = 463, tyn = 47, txp = 476, typ = 61, -} -glyphs[100] = { --'d'-- - num = 100, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 485, tyn = 47, txp = 498, typ = 64, -} -glyphs[101] = { --'e'-- - num = 101, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 11, - txn = 1, tyn = 70, txp = 14, typ = 84, -} -glyphs[102] = { --'f'-- - num = 102, - adv = 5, - oxn = -2, oyn = -2, oxp = 8, oyp = 14, - txn = 23, tyn = 70, txp = 33, typ = 86, -} -glyphs[103] = { --'g'-- - num = 103, - adv = 10, - oxn = -2, oyn = -6, oxp = 11, oyp = 11, - txn = 45, tyn = 70, txp = 58, typ = 87, -} -glyphs[104] = { --'h'-- - num = 104, - adv = 10, - oxn = -1, oyn = -2, oxp = 11, oyp = 14, - txn = 67, tyn = 70, txp = 79, typ = 86, -} -glyphs[105] = { --'i'-- - num = 105, - adv = 4, - oxn = -1, oyn = -2, oxp = 6, oyp = 14, - txn = 89, tyn = 70, txp = 96, typ = 86, -} -glyphs[106] = { --'j'-- - num = 106, - adv = 4, - oxn = -2, oyn = -6, oxp = 6, oyp = 14, - txn = 111, tyn = 70, txp = 119, typ = 90, -} -glyphs[107] = { --'k'-- - num = 107, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 14, - txn = 133, tyn = 70, txp = 146, typ = 86, -} -glyphs[108] = { --'l'-- - num = 108, - adv = 4, - oxn = -1, oyn = -2, oxp = 6, oyp = 14, - txn = 155, tyn = 70, txp = 162, typ = 86, -} -glyphs[109] = { --'m'-- - num = 109, - adv = 14, - oxn = -2, oyn = -2, oxp = 16, oyp = 11, - txn = 177, tyn = 70, txp = 195, typ = 83, -} -glyphs[110] = { --'n'-- - num = 110, - adv = 10, - oxn = -1, oyn = -2, oxp = 11, oyp = 11, - txn = 199, tyn = 70, txp = 211, typ = 83, -} -glyphs[111] = { --'o'-- - num = 111, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 11, - txn = 221, tyn = 70, txp = 235, typ = 84, -} -glyphs[112] = { --'p'-- - num = 112, - adv = 10, - oxn = -2, oyn = -6, oxp = 12, oyp = 11, - txn = 243, tyn = 70, txp = 257, typ = 87, -} -glyphs[113] = { --'q'-- - num = 113, - adv = 10, - oxn = -2, oyn = -6, oxp = 11, oyp = 11, - txn = 265, tyn = 70, txp = 278, typ = 87, -} -glyphs[114] = { --'r'-- - num = 114, - adv = 6, - oxn = -1, oyn = -2, oxp = 8, oyp = 11, - txn = 287, tyn = 70, txp = 296, typ = 83, -} -glyphs[115] = { --'s'-- - num = 115, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 11, - txn = 309, tyn = 70, txp = 322, typ = 84, -} -glyphs[116] = { --'t'-- - num = 116, - adv = 5, - oxn = -2, oyn = -3, oxp = 7, oyp = 13, - txn = 331, tyn = 70, txp = 340, typ = 86, -} -glyphs[117] = { --'u'-- - num = 117, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 11, - txn = 353, tyn = 70, txp = 366, typ = 84, -} -glyphs[118] = { --'v'-- - num = 118, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 11, - txn = 375, tyn = 70, txp = 388, typ = 83, -} -glyphs[119] = { --'w'-- - num = 119, - adv = 12, - oxn = -2, oyn = -2, oxp = 15, oyp = 11, - txn = 397, tyn = 70, txp = 414, typ = 83, -} -glyphs[120] = { --'x'-- - num = 120, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 11, - txn = 419, tyn = 70, txp = 432, typ = 83, -} -glyphs[121] = { --'y'-- - num = 121, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 11, - txn = 441, tyn = 70, txp = 454, typ = 87, -} -glyphs[122] = { --'z'-- - num = 122, - adv = 8, - oxn = -2, oyn = -2, oxp = 10, oyp = 11, - txn = 463, tyn = 70, txp = 475, typ = 83, -} -glyphs[123] = { --'{'-- - num = 123, - adv = 6, - oxn = -2, oyn = -6, oxp = 8, oyp = 14, - txn = 485, tyn = 70, txp = 495, typ = 90, -} -glyphs[124] = { --'|'-- - num = 124, - adv = 4, - oxn = -1, oyn = -6, oxp = 5, oyp = 14, - txn = 1, tyn = 93, txp = 7, typ = 113, -} -glyphs[125] = { --'}'-- - num = 125, - adv = 6, - oxn = -1, oyn = -6, oxp = 8, oyp = 14, - txn = 23, tyn = 93, txp = 32, typ = 113, -} -glyphs[126] = { --'~'-- - num = 126, - adv = 9, - oxn = -2, oyn = 0, oxp = 11, oyp = 8, - txn = 45, tyn = 93, txp = 58, typ = 101, -} -glyphs[127] = { --''-- - num = 127, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 67, tyn = 93, txp = 77, typ = 108, -} -glyphs[128] = { --'€'-- - num = 128, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 89, tyn = 93, txp = 99, typ = 108, -} -glyphs[129] = { --'�'-- - num = 129, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 111, tyn = 93, txp = 121, typ = 108, -} -glyphs[130] = { --'‚'-- - num = 130, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 133, tyn = 93, txp = 143, typ = 108, -} -glyphs[131] = { --'ƒ'-- - num = 131, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 155, tyn = 93, txp = 165, typ = 108, -} -glyphs[132] = { --'„'-- - num = 132, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 177, tyn = 93, txp = 187, typ = 108, -} -glyphs[133] = { --'…'-- - num = 133, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 199, tyn = 93, txp = 209, typ = 108, -} -glyphs[134] = { --'†'-- - num = 134, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 221, tyn = 93, txp = 231, typ = 108, -} -glyphs[135] = { --'‡'-- - num = 135, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 243, tyn = 93, txp = 253, typ = 108, -} -glyphs[136] = { --'ˆ'-- - num = 136, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 265, tyn = 93, txp = 275, typ = 108, -} -glyphs[137] = { --'‰'-- - num = 137, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 287, tyn = 93, txp = 297, typ = 108, -} -glyphs[138] = { --'Š'-- - num = 138, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 309, tyn = 93, txp = 319, typ = 108, -} -glyphs[139] = { --'‹'-- - num = 139, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 331, tyn = 93, txp = 341, typ = 108, -} -glyphs[140] = { --'Œ'-- - num = 140, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 353, tyn = 93, txp = 363, typ = 108, -} -glyphs[141] = { --'�'-- - num = 141, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 375, tyn = 93, txp = 385, typ = 108, -} -glyphs[142] = { --'Ž'-- - num = 142, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 397, tyn = 93, txp = 407, typ = 108, -} -glyphs[143] = { --'�'-- - num = 143, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 419, tyn = 93, txp = 429, typ = 108, -} -glyphs[144] = { --'�'-- - num = 144, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 441, tyn = 93, txp = 451, typ = 108, -} -glyphs[145] = { --'‘'-- - num = 145, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 463, tyn = 93, txp = 473, typ = 108, -} -glyphs[146] = { --'’'-- - num = 146, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 485, tyn = 93, txp = 495, typ = 108, -} -glyphs[147] = { --'“'-- - num = 147, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 1, tyn = 116, txp = 11, typ = 131, -} -glyphs[148] = { --'”'-- - num = 148, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 23, tyn = 116, txp = 33, typ = 131, -} -glyphs[149] = { --'•'-- - num = 149, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 45, tyn = 116, txp = 55, typ = 131, -} -glyphs[150] = { --'–'-- - num = 150, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 67, tyn = 116, txp = 77, typ = 131, -} -glyphs[151] = { --'—'-- - num = 151, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 89, tyn = 116, txp = 99, typ = 131, -} -glyphs[152] = { --'˜'-- - num = 152, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 111, tyn = 116, txp = 121, typ = 131, -} -glyphs[153] = { --'™'-- - num = 153, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 133, tyn = 116, txp = 143, typ = 131, -} -glyphs[154] = { --'š'-- - num = 154, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 155, tyn = 116, txp = 165, typ = 131, -} -glyphs[155] = { --'›'-- - num = 155, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 177, tyn = 116, txp = 187, typ = 131, -} -glyphs[156] = { --'œ'-- - num = 156, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 199, tyn = 116, txp = 209, typ = 131, -} -glyphs[157] = { --'�'-- - num = 157, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 221, tyn = 116, txp = 231, typ = 131, -} -glyphs[158] = { --'ž'-- - num = 158, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 243, tyn = 116, txp = 253, typ = 131, -} -glyphs[159] = { --'Ÿ'-- - num = 159, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 265, tyn = 116, txp = 275, typ = 131, -} -glyphs[160] = { --' '-- - num = 160, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 287, tyn = 116, txp = 297, typ = 131, -} -glyphs[161] = { --'¡'-- - num = 161, - adv = 5, - oxn = -1, oyn = -5, oxp = 6, oyp = 11, - txn = 309, tyn = 116, txp = 316, typ = 132, -} -glyphs[162] = { --'¢'-- - num = 162, - adv = 9, - oxn = -2, oyn = -4, oxp = 11, oyp = 13, - txn = 331, tyn = 116, txp = 344, typ = 133, -} -glyphs[163] = { --'£'-- - num = 163, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 353, tyn = 116, txp = 366, typ = 133, -} -glyphs[164] = { --'¤'-- - num = 164, - adv = 9, - oxn = -2, oyn = -1, oxp = 11, oyp = 12, - txn = 375, tyn = 116, txp = 388, typ = 129, -} -glyphs[165] = { --'¥'-- - num = 165, - adv = 9, - oxn = -2, oyn = -2, oxp = 11, oyp = 14, - txn = 397, tyn = 116, txp = 410, typ = 132, -} -glyphs[166] = { --'¦'-- - num = 166, - adv = 4, - oxn = -1, oyn = -6, oxp = 5, oyp = 14, - txn = 419, tyn = 116, txp = 425, typ = 136, -} -glyphs[167] = { --'§'-- - num = 167, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 14, - txn = 441, tyn = 116, txp = 454, typ = 136, -} -glyphs[168] = { --'¨'-- - num = 168, - adv = 5, - oxn = -2, oyn = 7, oxp = 8, oyp = 14, - txn = 463, tyn = 116, txp = 473, typ = 123, -} -glyphs[169] = { --'©'-- - num = 169, - adv = 12, - oxn = -3, oyn = -3, oxp = 15, oyp = 14, - txn = 485, tyn = 116, txp = 503, typ = 133, -} -glyphs[170] = { --'ª'-- - num = 170, - adv = 6, - oxn = -2, oyn = 2, oxp = 8, oyp = 14, - txn = 1, tyn = 139, txp = 11, typ = 151, -} -glyphs[171] = { --'«'-- - num = 171, - adv = 9, - oxn = -1, oyn = -1, oxp = 10, oyp = 10, - txn = 23, tyn = 139, txp = 34, typ = 150, -} -glyphs[172] = { --'¬'-- - num = 172, - adv = 9, - oxn = -2, oyn = -1, oxp = 11, oyp = 8, - txn = 45, tyn = 139, txp = 58, typ = 148, -} -glyphs[173] = { --'­'-- - num = 173, - adv = 7, - oxn = -1, oyn = -2, oxp = 9, oyp = 13, - txn = 67, tyn = 139, txp = 77, typ = 154, -} -glyphs[174] = { --'®'-- - num = 174, - adv = 12, - oxn = -3, oyn = -3, oxp = 15, oyp = 14, - txn = 89, tyn = 139, txp = 107, typ = 156, -} -glyphs[175] = { --'¯'-- - num = 175, - adv = 5, - oxn = -2, oyn = 8, oxp = 8, oyp = 14, - txn = 111, tyn = 139, txp = 121, typ = 145, -} -glyphs[176] = { --'°'-- - num = 176, - adv = 10, - oxn = 0, oyn = 4, oxp = 10, oyp = 13, - txn = 133, tyn = 139, txp = 143, typ = 148, -} -glyphs[177] = { --'±'-- - num = 177, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 12, - txn = 155, tyn = 139, txp = 168, typ = 154, -} -glyphs[178] = { --'²'-- - num = 178, - adv = 6, - oxn = -2, oyn = 2, oxp = 8, oyp = 14, - txn = 177, tyn = 139, txp = 187, typ = 151, -} -glyphs[179] = { --'³'-- - num = 179, - adv = 6, - oxn = -2, oyn = 2, oxp = 8, oyp = 14, - txn = 199, tyn = 139, txp = 209, typ = 151, -} -glyphs[180] = { --'´'-- - num = 180, - adv = 5, - oxn = -1, oyn = 7, oxp = 8, oyp = 15, - txn = 221, tyn = 139, txp = 230, typ = 147, -} -glyphs[181] = { --'µ'-- - num = 181, - adv = 10, - oxn = -2, oyn = -6, oxp = 12, oyp = 11, - txn = 243, tyn = 139, txp = 257, typ = 156, -} -glyphs[182] = { --'¶'-- - num = 182, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 14, - txn = 265, tyn = 139, txp = 278, typ = 159, -} -glyphs[183] = { --'·'-- - num = 183, - adv = 4, - oxn = -1, oyn = 0, oxp = 6, oyp = 7, - txn = 287, tyn = 139, txp = 294, typ = 146, -} -glyphs[184] = { --'¸'-- - num = 184, - adv = 5, - oxn = -2, oyn = -6, oxp = 7, oyp = 2, - txn = 309, tyn = 139, txp = 318, typ = 147, -} -glyphs[185] = { --'¹'-- - num = 185, - adv = 6, - oxn = -2, oyn = 2, oxp = 6, oyp = 14, - txn = 331, tyn = 139, txp = 339, typ = 151, -} -glyphs[186] = { --'º'-- - num = 186, - adv = 6, - oxn = -2, oyn = 2, oxp = 8, oyp = 14, - txn = 353, tyn = 139, txp = 363, typ = 151, -} -glyphs[187] = { --'»'-- - num = 187, - adv = 9, - oxn = -1, oyn = -1, oxp = 10, oyp = 10, - txn = 375, tyn = 139, txp = 386, typ = 150, -} -glyphs[188] = { --'¼'-- - num = 188, - adv = 14, - oxn = -2, oyn = -3, oxp = 16, oyp = 14, - txn = 397, tyn = 139, txp = 415, typ = 156, -} -glyphs[189] = { --'½'-- - num = 189, - adv = 14, - oxn = -2, oyn = -3, oxp = 16, oyp = 14, - txn = 419, tyn = 139, txp = 437, typ = 156, -} -glyphs[190] = { --'¾'-- - num = 190, - adv = 14, - oxn = -2, oyn = -3, oxp = 16, oyp = 14, - txn = 441, tyn = 139, txp = 459, typ = 156, -} -glyphs[191] = { --'¿'-- - num = 191, - adv = 10, - oxn = -2, oyn = -6, oxp = 11, oyp = 11, - txn = 463, tyn = 139, txp = 476, typ = 156, -} -glyphs[192] = { --'À'-- - num = 192, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 18, - txn = 485, tyn = 139, txp = 501, typ = 159, -} -glyphs[193] = { --'Á'-- - num = 193, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 18, - txn = 1, tyn = 162, txp = 17, typ = 182, -} -glyphs[194] = { --'Â'-- - num = 194, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 18, - txn = 23, tyn = 162, txp = 39, typ = 182, -} -glyphs[195] = { --'Ã'-- - num = 195, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 17, - txn = 45, tyn = 162, txp = 61, typ = 181, -} -glyphs[196] = { --'Ä'-- - num = 196, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 17, - txn = 67, tyn = 162, txp = 83, typ = 181, -} -glyphs[197] = { --'Å'-- - num = 197, - adv = 12, - oxn = -2, oyn = -2, oxp = 14, oyp = 18, - txn = 89, tyn = 162, txp = 105, typ = 182, -} -glyphs[198] = { --'Æ'-- - num = 198, - adv = 16, - oxn = -2, oyn = -2, oxp = 18, oyp = 14, - txn = 111, tyn = 162, txp = 131, typ = 178, -} -glyphs[199] = { --'Ç'-- - num = 199, - adv = 12, - oxn = -2, oyn = -6, oxp = 13, oyp = 14, - txn = 133, tyn = 162, txp = 148, typ = 182, -} -glyphs[200] = { --'È'-- - num = 200, - adv = 11, - oxn = -1, oyn = -2, oxp = 12, oyp = 18, - txn = 155, tyn = 162, txp = 168, typ = 182, -} -glyphs[201] = { --'É'-- - num = 201, - adv = 11, - oxn = -1, oyn = -2, oxp = 12, oyp = 18, - txn = 177, tyn = 162, txp = 190, typ = 182, -} -glyphs[202] = { --'Ê'-- - num = 202, - adv = 11, - oxn = -1, oyn = -2, oxp = 12, oyp = 18, - txn = 199, tyn = 162, txp = 212, typ = 182, -} -glyphs[203] = { --'Ë'-- - num = 203, - adv = 11, - oxn = -1, oyn = -2, oxp = 12, oyp = 17, - txn = 221, tyn = 162, txp = 234, typ = 181, -} -glyphs[204] = { --'Ì'-- - num = 204, - adv = 4, - oxn = -2, oyn = -2, oxp = 6, oyp = 18, - txn = 243, tyn = 162, txp = 251, typ = 182, -} -glyphs[205] = { --'Í'-- - num = 205, - adv = 4, - oxn = -1, oyn = -2, oxp = 8, oyp = 18, - txn = 265, tyn = 162, txp = 274, typ = 182, -} -glyphs[206] = { --'Î'-- - num = 206, - adv = 4, - oxn = -2, oyn = -2, oxp = 8, oyp = 18, - txn = 287, tyn = 162, txp = 297, typ = 182, -} -glyphs[207] = { --'Ï'-- - num = 207, - adv = 4, - oxn = -2, oyn = -2, oxp = 8, oyp = 17, - txn = 309, tyn = 162, txp = 319, typ = 181, -} -glyphs[208] = { --'Ð'-- - num = 208, - adv = 12, - oxn = -2, oyn = -2, oxp = 13, oyp = 14, - txn = 331, tyn = 162, txp = 346, typ = 178, -} -glyphs[209] = { --'Ñ'-- - num = 209, - adv = 12, - oxn = -1, oyn = -2, oxp = 13, oyp = 17, - txn = 353, tyn = 162, txp = 367, typ = 181, -} -glyphs[210] = { --'Ò'-- - num = 210, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 18, - txn = 375, tyn = 162, txp = 391, typ = 183, -} -glyphs[211] = { --'Ó'-- - num = 211, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 18, - txn = 397, tyn = 162, txp = 413, typ = 183, -} -glyphs[212] = { --'Ô'-- - num = 212, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 18, - txn = 419, tyn = 162, txp = 435, typ = 183, -} -glyphs[213] = { --'Õ'-- - num = 213, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 17, - txn = 441, tyn = 162, txp = 457, typ = 182, -} -glyphs[214] = { --'Ö'-- - num = 214, - adv = 12, - oxn = -2, oyn = -3, oxp = 14, oyp = 17, - txn = 463, tyn = 162, txp = 479, typ = 182, -} -glyphs[215] = { --'×'-- - num = 215, - adv = 9, - oxn = -1, oyn = -2, oxp = 11, oyp = 10, - txn = 485, tyn = 162, txp = 497, typ = 174, -} -glyphs[216] = { --'Ø'-- - num = 216, - adv = 12, - oxn = -2, oyn = -3, oxp = 15, oyp = 14, - txn = 1, tyn = 185, txp = 18, typ = 202, -} -glyphs[217] = { --'Ù'-- - num = 217, - adv = 12, - oxn = -1, oyn = -3, oxp = 13, oyp = 18, - txn = 23, tyn = 185, txp = 37, typ = 206, -} -glyphs[218] = { --'Ú'-- - num = 218, - adv = 12, - oxn = -1, oyn = -3, oxp = 13, oyp = 18, - txn = 45, tyn = 185, txp = 59, typ = 206, -} -glyphs[219] = { --'Û'-- - num = 219, - adv = 12, - oxn = -1, oyn = -3, oxp = 13, oyp = 18, - txn = 67, tyn = 185, txp = 81, typ = 206, -} -glyphs[220] = { --'Ü'-- - num = 220, - adv = 12, - oxn = -1, oyn = -3, oxp = 13, oyp = 17, - txn = 89, tyn = 185, txp = 103, typ = 205, -} -glyphs[221] = { --'Ý'-- - num = 221, - adv = 11, - oxn = -2, oyn = -2, oxp = 13, oyp = 18, - txn = 111, tyn = 185, txp = 126, typ = 205, -} -glyphs[222] = { --'Þ'-- - num = 222, - adv = 11, - oxn = -1, oyn = -2, oxp = 13, oyp = 14, - txn = 133, tyn = 185, txp = 147, typ = 201, -} -glyphs[223] = { --'ß'-- - num = 223, - adv = 10, - oxn = -1, oyn = -3, oxp = 12, oyp = 14, - txn = 155, tyn = 185, txp = 168, typ = 202, -} -glyphs[224] = { --'à'-- - num = 224, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 177, tyn = 185, txp = 190, typ = 203, -} -glyphs[225] = { --'á'-- - num = 225, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 199, tyn = 185, txp = 212, typ = 203, -} -glyphs[226] = { --'â'-- - num = 226, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 221, tyn = 185, txp = 234, typ = 203, -} -glyphs[227] = { --'ã'-- - num = 227, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 243, tyn = 185, txp = 256, typ = 202, -} -glyphs[228] = { --'ä'-- - num = 228, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 265, tyn = 185, txp = 278, typ = 202, -} -glyphs[229] = { --'å'-- - num = 229, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 287, tyn = 185, txp = 300, typ = 203, -} -glyphs[230] = { --'æ'-- - num = 230, - adv = 14, - oxn = -2, oyn = -3, oxp = 16, oyp = 11, - txn = 309, tyn = 185, txp = 327, typ = 199, -} -glyphs[231] = { --'ç'-- - num = 231, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 11, - txn = 331, tyn = 185, txp = 344, typ = 202, -} -glyphs[232] = { --'è'-- - num = 232, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 353, tyn = 185, txp = 366, typ = 203, -} -glyphs[233] = { --'é'-- - num = 233, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 375, tyn = 185, txp = 388, typ = 203, -} -glyphs[234] = { --'ê'-- - num = 234, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 397, tyn = 185, txp = 410, typ = 203, -} -glyphs[235] = { --'ë'-- - num = 235, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 419, tyn = 185, txp = 432, typ = 202, -} -glyphs[236] = { --'ì'-- - num = 236, - adv = 4, - oxn = -2, oyn = -2, oxp = 6, oyp = 15, - txn = 441, tyn = 185, txp = 449, typ = 202, -} -glyphs[237] = { --'í'-- - num = 237, - adv = 4, - oxn = -1, oyn = -2, oxp = 8, oyp = 15, - txn = 463, tyn = 185, txp = 472, typ = 202, -} -glyphs[238] = { --'î'-- - num = 238, - adv = 4, - oxn = -2, oyn = -2, oxp = 8, oyp = 15, - txn = 485, tyn = 185, txp = 495, typ = 202, -} -glyphs[239] = { --'ï'-- - num = 239, - adv = 4, - oxn = -2, oyn = -2, oxp = 8, oyp = 14, - txn = 1, tyn = 208, txp = 11, typ = 224, -} -glyphs[240] = { --'ð'-- - num = 240, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 14, - txn = 23, tyn = 208, txp = 37, typ = 225, -} -glyphs[241] = { --'ñ'-- - num = 241, - adv = 10, - oxn = -1, oyn = -2, oxp = 11, oyp = 14, - txn = 45, tyn = 208, txp = 57, typ = 224, -} -glyphs[242] = { --'ò'-- - num = 242, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 15, - txn = 67, tyn = 208, txp = 81, typ = 226, -} -glyphs[243] = { --'ó'-- - num = 243, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 15, - txn = 89, tyn = 208, txp = 103, typ = 226, -} -glyphs[244] = { --'ô'-- - num = 244, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 15, - txn = 111, tyn = 208, txp = 125, typ = 226, -} -glyphs[245] = { --'õ'-- - num = 245, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 14, - txn = 133, tyn = 208, txp = 147, typ = 225, -} -glyphs[246] = { --'ö'-- - num = 246, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 14, - txn = 155, tyn = 208, txp = 169, typ = 225, -} -glyphs[247] = { --'÷'-- - num = 247, - adv = 9, - oxn = -2, oyn = -3, oxp = 11, oyp = 10, - txn = 177, tyn = 208, txp = 190, typ = 221, -} -glyphs[248] = { --'ø'-- - num = 248, - adv = 10, - oxn = -2, oyn = -3, oxp = 12, oyp = 11, - txn = 199, tyn = 208, txp = 213, typ = 222, -} -glyphs[249] = { --'ù'-- - num = 249, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 221, tyn = 208, txp = 234, typ = 226, -} -glyphs[250] = { --'ú'-- - num = 250, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 243, tyn = 208, txp = 256, typ = 226, -} -glyphs[251] = { --'û'-- - num = 251, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 15, - txn = 265, tyn = 208, txp = 278, typ = 226, -} -glyphs[252] = { --'ü'-- - num = 252, - adv = 10, - oxn = -2, oyn = -3, oxp = 11, oyp = 14, - txn = 287, tyn = 208, txp = 300, typ = 225, -} -glyphs[253] = { --'ý'-- - num = 253, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 15, - txn = 309, tyn = 208, txp = 322, typ = 229, -} -glyphs[254] = { --'þ'-- - num = 254, - adv = 10, - oxn = -2, oyn = -6, oxp = 12, oyp = 14, - txn = 331, tyn = 208, txp = 345, typ = 228, -} -glyphs[255] = { --'ÿ'-- - num = 255, - adv = 9, - oxn = -2, oyn = -6, oxp = 11, oyp = 14, - txn = 353, tyn = 208, txp = 366, typ = 228, -} - -fontSpecs.glyphs = glyphs - -return fontSpecs - diff --git a/LuaUI/Fonts/FreeSansBold_16.png b/LuaUI/Fonts/FreeSansBold_16.png deleted file mode 100644 index 4faf177ba..000000000 Binary files a/LuaUI/Fonts/FreeSansBold_16.png and /dev/null differ diff --git a/LuaUI/Fonts/JosefinSans-Bold.ttf b/LuaUI/Fonts/JosefinSans-Bold.ttf new file mode 100644 index 000000000..f4166a1e9 Binary files /dev/null and b/LuaUI/Fonts/JosefinSans-Bold.ttf differ diff --git a/LuaUI/Fonts/JosefinSans-Regular.ttf b/LuaUI/Fonts/JosefinSans-Regular.ttf new file mode 100644 index 000000000..292dcb07e Binary files /dev/null and b/LuaUI/Fonts/JosefinSans-Regular.ttf differ diff --git a/LuaUI/Fonts/JosefinSans-SemiBold(OTF).otf b/LuaUI/Fonts/JosefinSans-SemiBold(OTF).otf new file mode 100644 index 000000000..0f439422e Binary files /dev/null and b/LuaUI/Fonts/JosefinSans-SemiBold(OTF).otf differ diff --git a/LuaUI/Fonts/JosefinSans-SemiBold.ttf b/LuaUI/Fonts/JosefinSans-SemiBold.ttf new file mode 100644 index 000000000..1ca56c76e Binary files /dev/null and b/LuaUI/Fonts/JosefinSans-SemiBold.ttf differ diff --git a/LuaUI/Fonts/MicrogrammaDBold.ttf b/LuaUI/Fonts/unlisted/microgrammadbold.ttf similarity index 100% rename from LuaUI/Fonts/MicrogrammaDBold.ttf rename to LuaUI/Fonts/unlisted/microgrammadbold.ttf diff --git a/LuaUI/Images/AlliedCursors.png b/LuaUI/Images/AlliedCursors.png deleted file mode 100644 index d5ad6d05d..000000000 Binary files a/LuaUI/Images/AlliedCursors.png and /dev/null differ diff --git a/LuaUI/Images/advplayerslist/barglow-center.png b/LuaUI/Images/advplayerslist/barglow-center.png new file mode 100644 index 000000000..05ccb7252 Binary files /dev/null and b/LuaUI/Images/advplayerslist/barglow-center.png differ diff --git a/LuaUI/Images/advplayerslist/barglow-edge.png b/LuaUI/Images/advplayerslist/barglow-edge.png new file mode 100644 index 000000000..147ea100e Binary files /dev/null and b/LuaUI/Images/advplayerslist/barglow-edge.png differ diff --git a/LuaUI/Images/allycursor.dds b/LuaUI/Images/allycursor.dds new file mode 100644 index 000000000..97cfddd99 Binary files /dev/null and b/LuaUI/Images/allycursor.dds differ diff --git a/LuaUI/Images/barglow-center.dds b/LuaUI/Images/barglow-center.dds index 11be8460e..f5e416d17 100644 Binary files a/LuaUI/Images/barglow-center.dds and b/LuaUI/Images/barglow-center.dds differ diff --git a/LuaUI/Images/barglow-center.png b/LuaUI/Images/barglow-center.png new file mode 100644 index 000000000..05ccb7252 Binary files /dev/null and b/LuaUI/Images/barglow-center.png differ diff --git a/LuaUI/Images/barglow-edge.dds b/LuaUI/Images/barglow-edge.dds index 3e3e961f2..54ef132fb 100644 Binary files a/LuaUI/Images/barglow-edge.dds and b/LuaUI/Images/barglow-edge.dds differ diff --git a/LuaUI/Images/barglow-edge.png b/LuaUI/Images/barglow-edge.png new file mode 100644 index 000000000..147ea100e Binary files /dev/null and b/LuaUI/Images/barglow-edge.png differ diff --git a/LuaUI/Images/ecommander.png b/LuaUI/Images/ecommander.png new file mode 100644 index 000000000..be64a841d Binary files /dev/null and b/LuaUI/Images/ecommander.png differ diff --git a/LuaUI/Images/evologo.png b/LuaUI/Images/evologo.png index 2aeb4e864..fe0df259a 100644 Binary files a/LuaUI/Images/evologo.png and b/LuaUI/Images/evologo.png differ diff --git a/LuaUI/Images/glow2.dds b/LuaUI/Images/glow2.dds new file mode 100644 index 000000000..4a123fe40 Binary files /dev/null and b/LuaUI/Images/glow2.dds differ diff --git a/LuaUI/Images/lozcommander.png b/LuaUI/Images/lozcommander.png new file mode 100644 index 000000000..2df811a34 Binary files /dev/null and b/LuaUI/Images/lozcommander.png differ diff --git a/LuaUI/Images/new.dds b/LuaUI/Images/new.dds new file mode 100644 index 000000000..5a73b3a42 Binary files /dev/null and b/LuaUI/Images/new.dds differ diff --git a/LuaUI/Images/new.png b/LuaUI/Images/new.png deleted file mode 100644 index b3e2d71b1..000000000 Binary files a/LuaUI/Images/new.png and /dev/null differ diff --git a/LuaUI/Images/skull.dds b/LuaUI/Images/skull.dds new file mode 100644 index 000000000..e5fcb5934 Binary files /dev/null and b/LuaUI/Images/skull.dds differ diff --git a/LuaUI/Images/skull.png b/LuaUI/Images/skull.png deleted file mode 100644 index 87cc1aa4c..000000000 Binary files a/LuaUI/Images/skull.png and /dev/null differ diff --git a/LuaUI/Images/xcommander.png b/LuaUI/Images/xcommander.png new file mode 100644 index 000000000..87a46ee49 Binary files /dev/null and b/LuaUI/Images/xcommander.png differ diff --git a/LuaUI/Images/zarm.png b/LuaUI/Images/zarm.png new file mode 100644 index 000000000..05f870f98 Binary files /dev/null and b/LuaUI/Images/zarm.png differ diff --git a/LuaUI/Sounds/ambient/ambient-stereo-short.wav b/LuaUI/Sounds/ambient/ambient-stereo-short.wav new file mode 100644 index 000000000..44352872a Binary files /dev/null and b/LuaUI/Sounds/ambient/ambient-stereo-short.wav differ diff --git a/LuaUI/Sounds/ambient/zaalambient.wav b/LuaUI/Sounds/ambient/zaalambient.wav new file mode 100644 index 000000000..b7d87ec37 Binary files /dev/null and b/LuaUI/Sounds/ambient/zaalambient.wav differ diff --git a/LuaUI/Widgets_Evo/Include/LuaShader.lua b/LuaUI/Widgets_Evo/Include/LuaShader.lua new file mode 100644 index 000000000..1501a513c --- /dev/null +++ b/LuaUI/Widgets_Evo/Include/LuaShader.lua @@ -0,0 +1,468 @@ +local UNIFORM_TYPE_MIXED = 0 -- includes arrays; float or int +local UNIFORM_TYPE_INT = 1 -- includes arrays +local UNIFORM_TYPE_FLOAT = 2 -- includes arrays +local UNIFORM_TYPE_FLOAT_MATRIX = 3 + +local glGetUniformLocation = gl.GetUniformLocation +local glUseShader = gl.UseShader +local glActiveShader = gl.ActiveShader +local glUniform = gl.Uniform +local glUniformInt = gl.UniformInt +local glUniformMatrix = gl.UniformMatrix +local glUniformArray = gl.UniformArray + +local function new(class, shaderParams, shaderName, logEntries) + local logEntriesSanitized + if type(logEntries) == "number" then + logEntriesSanitized = logEntries + else + logEntriesSanitized = 1 + end + + return setmetatable( + { + shaderName = shaderName or "Unnamed Shader", + shaderParams = shaderParams or {}, + logEntries = logEntriesSanitized, + logHash = {}, + shaderObj = nil, + active = false, + ignoreActive = false, + ignoreUnkUniform = false, + uniforms = {}, + }, class) +end + +local function IsGeometryShaderSupported() + return gl.HasExtension("GL_ARB_geometry_shader4") and (gl.SetShaderParameter ~= nil or gl.SetGeometryShaderParameter ~= nil) +end + +local function IsTesselationShaderSupported() + return gl.HasExtension("GL_ARB_tessellation_shader") and (gl.SetTesselationShaderParameter ~= nil) +end + +local function IsDeferredShadingEnabled() + return (Spring.GetConfigInt("AllowDeferredMapRendering") == 1) and (Spring.GetConfigInt("AllowDeferredModelRendering") == 1) and (Spring.GetConfigInt("AdvMapShading") == 1) +end + +local function GetAdvShadingActive() + local advUnitShading, advMapShading = Spring.HaveAdvShading() + if advMapShading == nil then + advMapShading = true + end --old engine + return advUnitShading and advMapShading +end + + +local LuaShader = setmetatable({}, { + __call = function(self, ...) return new(self, ...) end, + }) +LuaShader.__index = LuaShader +LuaShader.isGeometryShaderSupported = IsGeometryShaderSupported() +LuaShader.isTesselationShaderSupported = IsTesselationShaderSupported() +LuaShader.isDeferredShadingEnabled = IsDeferredShadingEnabled() +LuaShader.GetAdvShadingActive = GetAdvShadingActive + +-----------------============ Warnings & Error Gandling ============----------------- +function LuaShader:OutputLogEntry(text, isError) + local message + + local warnErr = (isError and "error") or "warning" + + message = string.format("LuaShader: [%s] shader %s(s):\n%s", self.shaderName, warnErr, text) + + if self.logHash[message] == nil then + self.logHash[message] = 0 + end + + if self.logHash[message] <= self.logEntries then + local newCnt = self.logHash[message] + 1 + self.logHash[message] = newCnt + if (newCnt == self.logEntries) then + message = message .. string.format("\nSupressing further %s of the same kind", warnErr) + end + Spring.Echo(message) + end +end + +function LuaShader:ShowWarning(text) + self:OutputLogEntry(text, false) +end + +function LuaShader:ShowError(text) + self:OutputLogEntry(text, true) +end + +-----------------============ Handle Ghetto Include<> ==============----------------- +local includeRegexps = { + '.-#include <(.-)>.-', + '.-#include \"(.-)\".-', + '.-#pragma(%s+)include <(.-)>.-', + '.-#pragma(%s+)include \"(.-)\".-', +} + +function LuaShader:HandleIncludes(shaderCode, shaderName) + local incFiles = {} + local t1 = Spring.GetTimer() + repeat + local incFile + local regEx + for _, rx in ipairs(includeRegexps) do + _, _, incFile = string.find(shaderCode, rx) + if incFile then + regEx = rx + break + end + end + + Spring.Echo(shaderName, incFile) + + if incFile then + shaderCode = string.gsub(shaderCode, regEx, '', 1) + table.insert(incFiles, incFile) + end + until (incFile == nil) + local t2 = Spring.GetTimer() + Spring.Echo(Spring.DiffTimers(t2, t1, true)) + + local includeText = "" + for _, incFile in ipairs(incFiles) do + if VFS.FileExists(incFile) then + includeText = includeText .. VFS.LoadFile(incFile) .. "\n" + else + self:ShowError(string.format("Attempt to execute %s with file that does not exist in VFS", incFile)) + return false + end + end + + if includeText ~= "" then + return includeText .. shaderCode + else + return shaderCode + end +end + +-----------------========= End of Handle Ghetto Include<> ==========----------------- + +-----------------============ General LuaShader methods ============----------------- +function LuaShader:Compile() + if not gl.CreateShader then + self:ShowError("GLSL Shaders are not supported by hardware or drivers") + return false + end + +-- LuaShader:HandleIncludes is too slow. Figure out faster way. +--[[ + for _, shaderType in ipairs({"vertex", "tcs", "tes", "geometry", "fragment"}) do + if self.shaderParams[shaderType] then + local newShaderCode = LuaShader:HandleIncludes(self.shaderParams[shaderType], self.shaderName) + if newShaderCode then + self.shaderParams[shaderType] = newShaderCode + end + end + end +]]-- + + self.shaderObj = gl.CreateShader(self.shaderParams) + local shaderObj = self.shaderObj + + local shLog = gl.GetShaderLog() or "" + + if not shaderObj then + self:ShowError(shLog) + return false + elseif (shLog ~= "") then + self:ShowWarning(shLog) + end + + local uniforms = self.uniforms + for idx, info in ipairs(gl.GetActiveUniforms(shaderObj)) do + local uniName = string.gsub(info.name, "%[0%]", "") -- change array[0] to array + uniforms[uniName] = { + location = glGetUniformLocation(shaderObj, uniName), + --type = info.type, + --size = info.size, + values = {}, + } + --Spring.Echo(uniName, uniforms[uniName].location, uniforms[uniName].type, uniforms[uniName].size) + --Spring.Echo(uniName, uniforms[uniName].location) + end + return true +end + +LuaShader.Initialize = LuaShader.Compile + +function LuaShader:GetHandle() + if self.shaderObj ~= nil then + return self.shaderObj + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()?", funcName)) + end +end + +function LuaShader:Delete() + if self.shaderObj ~= nil then + gl.DeleteShader(self.shaderObj) + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + end +end + +LuaShader.Finalize = LuaShader.Delete + +function LuaShader:Activate() + if self.shaderObj ~= nil then + self.active = true + return glUseShader(self.shaderObj) + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + return false + end +end + +function LuaShader:SetActiveStateIgnore(flag) + self.ignoreActive = flag +end + +function LuaShader:SetUnknownUniformIgnore(flag) + self.ignoreUnkUniform = flag +end + + +function LuaShader:ActivateWith(func, ...) + if self.shaderObj ~= nil then + self.active = true + glActiveShader(self.shaderObj, func, ...) + self.active = false + else + local funcName = (debug and debug.getinfo(1).name) or "UnknownFunction" + self:ShowError(string.format("Attempt to use invalid shader object in [%s](). Did you call :Compile() or :Initialize()", funcName)) + end +end + +function LuaShader:Deactivate() + self.active = false + glUseShader(0) +end +-----------------============ End of general LuaShader methods ============----------------- + + +-----------------============ Friend LuaShader functions ============----------------- +local function getUniformImpl(self, name) + local uniform = self.uniforms[name] + + if uniform and type(uniform) == "table" then + return uniform + elseif uniform == nil then --used for indexed elements. nil means not queried for location yet + local location = glGetUniformLocation(self.shaderObj, name) + if location and location > -1 then + self.uniforms[name] = { + location = location, + values = {}, + } + return self.uniforms[name] + else + self.uniforms[name] = false --checked dynamic uniform name and didn't find it + end + end + + -- (uniform == false) + return nil +end + +local function getUniform(self, name) + if not (self.active or self.ignoreActive) then + self:ShowError(string.format("Trying to set uniform [%s] on inactive shader object. Did you use :Activate() or :ActivateWith()?", name)) + return nil + end + local uniform = getUniformImpl(self, name) + if not (uniform ~= nil or self.ignoreUnkUniform) then + self:ShowWarning(string.format("Attempt to set uniform [%s], which does not exist in the compiled shader", name)) + return nil + end + return uniform +end + +local function isUpdateRequired(uniform, tbl) + if (#tbl == 1) and (type(tbl[1]) == "string") then --named matrix + return true --no need to update cache + end + + local update = false + local cachedValues = uniform.values + for i, val in ipairs(tbl) do + if cachedValues[i] ~= val then + cachedValues[i] = val --update cache + update = true + end + end + + return update +end +-----------------============ End of friend LuaShader functions ============----------------- + + +-----------------============ LuaShader uniform manipulation functions ============----------------- +-- TODO: do it safely with types, len, size check + +function LuaShader:GetUniformLocation(name) + return (getUniform(self, name) or {}).location or -1 +end + +--FLOAT UNIFORMS +local function setUniformAlwaysImpl(uniform, ...) + glUniform(uniform.location, ...) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformAlwaysImpl(uniform, ...) +end + +local function setUniformImpl(uniform, ...) + if isUpdateRequired(uniform, {...}) then + return setUniformAlwaysImpl(uniform, ...) + end + return true +end + +function LuaShader:SetUniform(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformImpl(uniform, ...) +end + +LuaShader.SetUniformFloat = LuaShader.SetUniform +LuaShader.SetUniformFloatAlways = LuaShader.SetUniformAlways + + +--INTEGER UNIFORMS +local function setUniformIntAlwaysImpl(uniform, ...) + glUniformInt(uniform.location, ...) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformIntAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntAlwaysImpl(uniform, ...) +end + +local function setUniformIntImpl(uniform, ...) + if isUpdateRequired(uniform, {...}) then + return setUniformIntAlwaysImpl(uniform, ...) + end + return true +end + +function LuaShader:SetUniformInt(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntImpl(uniform, ...) +end + + +--FLOAT ARRAY UNIFORMS +local function setUniformFloatArrayAlwaysImpl(uniform, tbl) + glUniformArray(uniform.location, UNIFORM_TYPE_FLOAT, tbl) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformFloatArrayAlways(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformFloatArrayAlwaysImpl(uniform, tbl) +end + +local function setUniformFloatArrayImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformFloatArrayAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformFloatArray(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformFloatArrayImpl(uniform, tbl) +end + + +--INT ARRAY UNIFORMS +local function setUniformIntArrayAlwaysImpl(uniform, tbl) + glUniformArray(uniform.location, UNIFORM_TYPE_INT, tbl) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformIntArrayAlways(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntArrayAlwaysImpl(uniform, tbl) +end + +local function setUniformIntArrayImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformIntArrayAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformIntArray(name, tbl) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformIntArrayImpl(uniform, tbl) +end + + +--MATRIX UNIFORMS +local function setUniformMatrixAlwaysImpl(uniform, tbl) + glUniformMatrix(uniform.location, unpack(tbl)) + return true --currently there is no way to check if uniform is set or not :( +end + +function LuaShader:SetUniformMatrixAlways(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformMatrixAlwaysImpl(uniform, {...}) +end + +local function setUniformMatrixImpl(uniform, tbl) + if isUpdateRequired(uniform, tbl) then + return setUniformMatrixAlwaysImpl(uniform, tbl) + end + return true +end + +function LuaShader:SetUniformMatrix(name, ...) + local uniform = getUniform(self, name) + if not uniform then + return false + end + return setUniformMatrixImpl(uniform, {...}) +end +-----------------============ End of LuaShader uniform manipulation functions ============----------------- + +return LuaShader \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Music/peace/A Pixel is Born.ogg b/LuaUI/Widgets_Evo/Music/peace/A Pixel is Born.ogg deleted file mode 100644 index 71e234ab3..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/A Pixel is Born.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Angel Down.ogg b/LuaUI/Widgets_Evo/Music/peace/Angel Down.ogg deleted file mode 100644 index 6e700d62e..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Angel Down.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Beyond.ogg b/LuaUI/Widgets_Evo/Music/peace/Beyond.ogg deleted file mode 100644 index ed8263d56..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Beyond.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Byte Run.ogg b/LuaUI/Widgets_Evo/Music/peace/Byte Run.ogg deleted file mode 100644 index 64cfe018e..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Byte Run.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Droum.ogg b/LuaUI/Widgets_Evo/Music/peace/Droum.ogg deleted file mode 100644 index df28c5879..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Droum.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/EE Environmental Runs.ogg b/LuaUI/Widgets_Evo/Music/peace/EE Environmental Runs.ogg deleted file mode 100644 index 0be30e035..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/EE Environmental Runs.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Eastern Vector.ogg b/LuaUI/Widgets_Evo/Music/peace/Eastern Vector.ogg deleted file mode 100644 index 27540f1c3..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Eastern Vector.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Environment Alpha.ogg b/LuaUI/Widgets_Evo/Music/peace/Environment Alpha.ogg deleted file mode 100644 index 2c213cc4d..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Environment Alpha.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Evade.ogg b/LuaUI/Widgets_Evo/Music/peace/Evade.ogg deleted file mode 100644 index b6303b009..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Evade.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Exbioract Menu.ogg b/LuaUI/Widgets_Evo/Music/peace/Exbioract Menu.ogg deleted file mode 100644 index 36ff6356b..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Exbioract Menu.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Flour.ogg b/LuaUI/Widgets_Evo/Music/peace/Flour.ogg deleted file mode 100644 index 34556c404..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Flour.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Flow.ogg b/LuaUI/Widgets_Evo/Music/peace/Flow.ogg deleted file mode 100644 index 07c90b799..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Flow.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/GD Initialization.ogg b/LuaUI/Widgets_Evo/Music/peace/GD Initialization.ogg deleted file mode 100644 index 3b74ed51b..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/GD Initialization.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Intrusive Thoughts.ogg b/LuaUI/Widgets_Evo/Music/peace/Intrusive Thoughts.ogg deleted file mode 100644 index bf87ba440..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Intrusive Thoughts.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Lighthouse.ogg b/LuaUI/Widgets_Evo/Music/peace/Lighthouse.ogg deleted file mode 100644 index 3a0827430..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Lighthouse.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Mysteries at Severnaya Industrial 9.ogg b/LuaUI/Widgets_Evo/Music/peace/Mysteries at Severnaya Industrial 9.ogg deleted file mode 100644 index 29998f307..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Mysteries at Severnaya Industrial 9.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Pox.ogg b/LuaUI/Widgets_Evo/Music/peace/Pox.ogg deleted file mode 100644 index 6846d9cd4..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Pox.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Restarting The Time.ogg b/LuaUI/Widgets_Evo/Music/peace/Restarting The Time.ogg deleted file mode 100644 index 0b7fc2eaa..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Restarting The Time.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Strange Robot.ogg b/LuaUI/Widgets_Evo/Music/peace/Strange Robot.ogg deleted file mode 100644 index a81bfe198..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Strange Robot.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/Sweet Cold Revenge.ogg b/LuaUI/Widgets_Evo/Music/peace/Sweet Cold Revenge.ogg deleted file mode 100644 index 30798e4fc..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/Sweet Cold Revenge.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/The URC Extraction.ogg b/LuaUI/Widgets_Evo/Music/peace/The URC Extraction.ogg deleted file mode 100644 index ee16d450b..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/The URC Extraction.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/This World is Imploding.ogg b/LuaUI/Widgets_Evo/Music/peace/This World is Imploding.ogg deleted file mode 100644 index 1f5e18c21..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/This World is Imploding.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/peace/deathkllr84 - Forgive and Forget.ogg b/LuaUI/Widgets_Evo/Music/peace/deathkllr84 - Forgive and Forget.ogg deleted file mode 100644 index 452be4983..000000000 Binary files a/LuaUI/Widgets_Evo/Music/peace/deathkllr84 - Forgive and Forget.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Active Power.ogg b/LuaUI/Widgets_Evo/Music/war/Active Power.ogg deleted file mode 100644 index 5e36ebdcb..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Active Power.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Aftershock.ogg b/LuaUI/Widgets_Evo/Music/war/Aftershock.ogg deleted file mode 100644 index 2ce0d41ae..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Aftershock.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/All This - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/All This - deathkllr84.ogg deleted file mode 100644 index 44b076c5e..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/All This - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Anasasis intro - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Anasasis intro - deathkllr84.ogg deleted file mode 100644 index af1a7828a..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Anasasis intro - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Bear me the Light cover - Recycle.ogg b/LuaUI/Widgets_Evo/Music/war/Bear me the Light cover - Recycle.ogg deleted file mode 100644 index a029bf7b5..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Bear me the Light cover - Recycle.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Better than Nothing - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Better than Nothing - deathkllr84.ogg deleted file mode 100644 index 5d9adc706..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Better than Nothing - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Conform - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Conform - deathkllr84.ogg deleted file mode 100644 index 082bc2056..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Conform - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Defiance-1.ogg b/LuaUI/Widgets_Evo/Music/war/Defiance-1.ogg deleted file mode 100644 index c629d8023..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Defiance-1.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Defiance-2.ogg b/LuaUI/Widgets_Evo/Music/war/Defiance-2.ogg deleted file mode 100644 index 47376b8b6..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Defiance-2.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Defiance-3.ogg b/LuaUI/Widgets_Evo/Music/war/Defiance-3.ogg deleted file mode 100644 index cd66cd488..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Defiance-3.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Defiance-4.ogg b/LuaUI/Widgets_Evo/Music/war/Defiance-4.ogg deleted file mode 100644 index e04e227b7..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Defiance-4.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Defiance-5.ogg b/LuaUI/Widgets_Evo/Music/war/Defiance-5.ogg deleted file mode 100644 index 9c54ad362..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Defiance-5.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Distant Lands - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Distant Lands - deathkllr84.ogg deleted file mode 100644 index 28a493551..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Distant Lands - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Execution.ogg b/LuaUI/Widgets_Evo/Music/war/Execution.ogg deleted file mode 100644 index cedb6c1cf..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Execution.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Explore Your Mind - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Explore Your Mind - deathkllr84.ogg deleted file mode 100644 index 7e3d5df17..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Explore Your Mind - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Fists of Stone - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Fists of Stone - deathkllr84.ogg deleted file mode 100644 index a22b8d14b..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Fists of Stone - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Forever Mine - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Forever Mine - deathkllr84.ogg deleted file mode 100644 index 99a66fe88..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Forever Mine - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Heavy - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Heavy - deathkllr84.ogg deleted file mode 100644 index 12fecdc36..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Heavy - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Knightfall.ogg b/LuaUI/Widgets_Evo/Music/war/Knightfall.ogg deleted file mode 100644 index 2a245241f..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Knightfall.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Left to Rot - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Left to Rot - deathkllr84.ogg deleted file mode 100644 index 8e64b8c25..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Left to Rot - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Marble And Coal - Recycle.ogg b/LuaUI/Widgets_Evo/Music/war/Marble And Coal - Recycle.ogg deleted file mode 100644 index 1368ef8ec..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Marble And Coal - Recycle.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/New.ogg b/LuaUI/Widgets_Evo/Music/war/New.ogg deleted file mode 100644 index d34a48a64..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/New.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/New2.ogg b/LuaUI/Widgets_Evo/Music/war/New2.ogg deleted file mode 100644 index 0852ca188..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/New2.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/No More Sun - Recycle.ogg b/LuaUI/Widgets_Evo/Music/war/No More Sun - Recycle.ogg deleted file mode 100644 index d537ff3d2..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/No More Sun - Recycle.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Prevail - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Prevail - deathkllr84.ogg deleted file mode 100644 index a371d9f35..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Prevail - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Quasar.ogg b/LuaUI/Widgets_Evo/Music/war/Quasar.ogg deleted file mode 100644 index e118e70dc..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Quasar.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Reboot.ogg b/LuaUI/Widgets_Evo/Music/war/Reboot.ogg deleted file mode 100644 index 5f5031195..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Reboot.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Recovery.ogg b/LuaUI/Widgets_Evo/Music/war/Recovery.ogg deleted file mode 100644 index ea169f773..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Recovery.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Sacrifice - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/Sacrifice - deathkllr84.ogg deleted file mode 100644 index 3fa7b5192..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Sacrifice - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Scars of Hate.ogg b/LuaUI/Widgets_Evo/Music/war/Scars of Hate.ogg deleted file mode 100644 index bc949c022..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Scars of Hate.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Sweet Cold Revenge (Metal).ogg b/LuaUI/Widgets_Evo/Music/war/Sweet Cold Revenge (Metal).ogg deleted file mode 100644 index 77b49eaaf..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Sweet Cold Revenge (Metal).ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Things That I Saw - Recycle.ogg b/LuaUI/Widgets_Evo/Music/war/Things That I Saw - Recycle.ogg deleted file mode 100644 index dd37e7db1..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Things That I Saw - Recycle.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/This Means Death.ogg b/LuaUI/Widgets_Evo/Music/war/This Means Death.ogg deleted file mode 100644 index 4b4292778..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/This Means Death.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Torture Arena.ogg b/LuaUI/Widgets_Evo/Music/war/Torture Arena.ogg deleted file mode 100644 index 545460896..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Torture Arena.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/Traitor.ogg b/LuaUI/Widgets_Evo/Music/war/Traitor.ogg deleted file mode 100644 index 84ec0eafb..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/Traitor.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/breakdown - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/breakdown - deathkllr84.ogg deleted file mode 100644 index be4ecf081..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/breakdown - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/carry on - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/carry on - deathkllr84.ogg deleted file mode 100644 index b151dc7a4..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/carry on - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/metalriffs - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/metalriffs - deathkllr84.ogg deleted file mode 100644 index b3765e235..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/metalriffs - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/not yet forgotten - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/not yet forgotten - deathkllr84.ogg deleted file mode 100644 index b6e39b542..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/not yet forgotten - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Music/war/the journey home - deathkllr84.ogg b/LuaUI/Widgets_Evo/Music/war/the journey home - deathkllr84.ogg deleted file mode 100644 index dffdb5ed1..000000000 Binary files a/LuaUI/Widgets_Evo/Music/war/the journey home - deathkllr84.ogg and /dev/null differ diff --git a/LuaUI/Widgets_Evo/Shaders/dof.fs b/LuaUI/Widgets_Evo/Shaders/dof.fs new file mode 100644 index 000000000..a0892a430 --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/dof.fs @@ -0,0 +1,501 @@ +#define NORMALIZE_FILTER(fullRangeFilter) (fullRangeFilter * 0.25) + 0.5 +#define UNNORMALIZE_FILTER(normedFilter) ((2.0 * normedFilter) - 1.0) * 2.0 + +uniform sampler2D origTex; + +uniform sampler2D blurTex0; +uniform sampler2D blurTex1; +uniform sampler2D blurTex2; +uniform sampler2D blurTex3; + +uniform vec3 eyePos; +uniform mat4 viewProjection; +uniform vec2 resolution; +uniform vec2 distanceLimits; +uniform vec2 mouseDepthCoord; + +uniform int autofocus; +uniform int mousefocus; +uniform float manualFocusDepth; +uniform float fStop; +uniform int quality; + +uniform int pass; + +// Circular DOF by Kleber Garcia "Kecho" - 2017 +// Publication & Filter generator: https://github.com/kecho/CircularDofFilterGenerator + +/** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +**/ +//Main blur pass paramters +const int KERNEL_RADIUS = 5; +const int KERNEL_COUNT = 11; +const vec4 Kernel0BracketsRealXY_ImZW = vec4(-0.056556,0.920040,-0.035849,0.611305); +const vec2 Kernel0Weights_RealX_ImY = vec2(0.411259,-0.548794); +const vec4 Kernel0_RealX_ImY_RealZ_ImW[] = vec4[]( + vec4(/*XY: Non Bracketed*/0.022302,-0.035849,/*Bracketed WZ:*/0.085711,0.000000), + vec4(/*XY: Non Bracketed*/-0.056556,-0.013273,/*Bracketed WZ:*/0.000000,0.036931), + vec4(/*XY: Non Bracketed*/-0.023847,0.070538,/*Bracketed WZ:*/0.035552,0.174032), + vec4(/*XY: Non Bracketed*/0.059140,0.066382,/*Bracketed WZ:*/0.125751,0.167233), + vec4(/*XY: Non Bracketed*/0.096696,0.020687,/*Bracketed WZ:*/0.166571,0.092483), + vec4(/*XY: Non Bracketed*/0.102454,0.000000,/*Bracketed WZ:*/0.172829,0.058643), + vec4(/*XY: Non Bracketed*/0.096696,0.020687,/*Bracketed WZ:*/0.166571,0.092483), + vec4(/*XY: Non Bracketed*/0.059140,0.066382,/*Bracketed WZ:*/0.125751,0.167233), + vec4(/*XY: Non Bracketed*/-0.023847,0.070538,/*Bracketed WZ:*/0.035552,0.174032), + vec4(/*XY: Non Bracketed*/-0.056556,-0.013273,/*Bracketed WZ:*/0.000000,0.036931), + vec4(/*XY: Non Bracketed*/0.022302,-0.035849,/*Bracketed WZ:*/0.085711,0.000000) +); +const vec4 Kernel1BracketsRealXY_ImZW = vec4(0.000181,0.552380,0.000000,0.180493); +const vec2 Kernel1Weights_RealX_ImY = vec2(0.513282,4.561110); +const vec4 Kernel1_RealX_ImY_RealZ_ImW[] = vec4[]( + vec4(/*XY: Non Bracketed*/0.000181,0.014423,/*Bracketed WZ:*/0.000000,0.079908), + vec4(/*XY: Non Bracketed*/0.015852,0.024540,/*Bracketed WZ:*/0.028370,0.135962), + vec4(/*XY: Non Bracketed*/0.042831,0.026910,/*Bracketed WZ:*/0.077211,0.149093), + vec4(/*XY: Non Bracketed*/0.072553,0.018473,/*Bracketed WZ:*/0.131019,0.102347), + vec4(/*XY: Non Bracketed*/0.094542,0.005900,/*Bracketed WZ:*/0.170826,0.032690), + vec4(/*XY: Non Bracketed*/0.102454,0.000000,/*Bracketed WZ:*/0.185149,0.000000), + vec4(/*XY: Non Bracketed*/0.094542,0.005900,/*Bracketed WZ:*/0.170826,0.032690), + vec4(/*XY: Non Bracketed*/0.072553,0.018473,/*Bracketed WZ:*/0.131019,0.102347), + vec4(/*XY: Non Bracketed*/0.042831,0.026910,/*Bracketed WZ:*/0.077211,0.149093), + vec4(/*XY: Non Bracketed*/0.015852,0.024540,/*Bracketed WZ:*/0.028370,0.135962), + vec4(/*XY: Non Bracketed*/0.000181,0.014423,/*Bracketed WZ:*/0.000000,0.079908) +); +//Blur pass parameters for objects near camera +const vec4 KernelNearBracketsRealXY_ImZW = vec4(0.034624,0.050280,-0.027250,0.190460); +const vec2 KernelNearWeights_RealX_ImY = vec2(5.268909,-0.886528); +const vec4 KernelNear_RealX_ImY_RealZ_ImW[] = vec4[]( + vec4(/*XY: Non Bracketed*/0.044566,-0.027250,/*Bracketed WZ:*/0.197749,0.000000), + vec4(/*XY: Non Bracketed*/0.042298,-0.015499,/*Bracketed WZ:*/0.152642,0.061698), + vec4(/*XY: Non Bracketed*/0.039368,-0.007880,/*Bracketed WZ:*/0.094353,0.101698), + vec4(/*XY: Non Bracketed*/0.036836,-0.003243,/*Bracketed WZ:*/0.044003,0.126048), + vec4(/*XY: Non Bracketed*/0.035189,-0.000773,/*Bracketed WZ:*/0.011253,0.139018), + vec4(/*XY: Non Bracketed*/0.034624,-0.000000,/*Bracketed WZ:*/0.000000,0.143075), + vec4(/*XY: Non Bracketed*/0.035189,-0.000773,/*Bracketed WZ:*/0.011253,0.139018), + vec4(/*XY: Non Bracketed*/0.036836,-0.003243,/*Bracketed WZ:*/0.044003,0.126048), + vec4(/*XY: Non Bracketed*/0.039368,-0.007880,/*Bracketed WZ:*/0.094353,0.101698), + vec4(/*XY: Non Bracketed*/0.042298,-0.015499,/*Bracketed WZ:*/0.152642,0.061698), + vec4(/*XY: Non Bracketed*/0.044566,-0.027250,/*Bracketed WZ:*/0.197749,0.000000) +); + +const float baseStepValMag = 1.0/540.0; + +const float colorPower = 1.9; + +const float inFocusThreshold = 0.4 / float(KERNEL_RADIUS); +const float focusMixDepthRange = (float(KERNEL_RADIUS) * 2.0); +const float maxFilterRadius = 1.2; //keep between 0 and 2. Any higher than 2 will require modifying the normalization maths + //(currently does (radius/4)+0.5 to get [-2..2] to [0..1]) + +//Approximately a circle, but bulging slightly up to help with focus making sense when looking down ramps +const vec2 autofocusTestCoordOffsets[] = vec2[]( + vec2(-0.71, -0.71), + vec2(-0.71, 0.76), + vec2(0.71, 0.76), + vec2(0.71, -0.71), + vec2(-1.0, 0.0), + vec2(0.0, 1.1), + vec2(0.0, -1.0), + vec2(1.0, 0.0) +); + +vec2 multComplex(vec2 p, vec2 q) +{ + return vec2(p.x*q.x-p.y*q.y, p.x*q.y+p.y*q.x); +} + +vec4 get2CompFilters(int x) +{ + vec2 c0 = Kernel0_RealX_ImY_RealZ_ImW[x].xy; + vec2 c1 = Kernel1_RealX_ImY_RealZ_ImW[x].xy; + return vec4(c0.x, c0.y, c1.x, c1.y); +} +vec2 get1CompFilters(int x) +{ + return KernelNear_RealX_ImY_RealZ_ImW[x].xy; +} + +float LinearizeDepth(vec2 uv){ + float depthNDC = texture2D(blurTex0, uv).r; + #if DEPTH_CLIP01 + depthNDC = 2.0 * depthNDC - 1.0; + #endif + + float n22 = viewProjection[2][2]; + + return ((abs(((1.0 + depthNDC) * (1.0 + n22))/(2.0 * (depthNDC + n22))) + * (distanceLimits.y - distanceLimits.x)) + distanceLimits.x) / BLUR_START_DIST; + // return abs(viewProjection[3][2] / (viewProjection[2][2] + depthNDC)) / BLUR_START_DIST; +} + +float GetFilterRadius(vec2 uv) +{ + return UNNORMALIZE_FILTER(texture2D(origTex, uv).a); +} + +float GetEdgeNearFilterRadius(vec2 uv, vec2 stepVal) +{ + vec2 maxCoordsOffset = stepVal * maxFilterRadius * KERNEL_RADIUS; + vec2 maxCoordsOffsetPerp = vec2(stepVal.y, -stepVal.x) * maxFilterRadius * KERNEL_RADIUS; + float edgeRadius = + min(min(GetFilterRadius(uv + maxCoordsOffset), GetFilterRadius(uv - maxCoordsOffset)), + min(GetFilterRadius(uv + maxCoordsOffsetPerp), GetFilterRadius(uv - maxCoordsOffsetPerp))); + float halfEdgeRadius = + min(min(GetFilterRadius(uv + maxCoordsOffset / 2.0), GetFilterRadius(uv - maxCoordsOffset / 2.0)), + min(GetFilterRadius(uv + maxCoordsOffsetPerp / 2.0), GetFilterRadius(uv - maxCoordsOffsetPerp / 2.0))); + return min(edgeRadius, halfEdgeRadius); +} + +vec2 GetFilterCoords(int i, vec2 uv, vec2 stepVal, float filterRadius, out float targetFilterRadius) +{ + float filterDistance = float(i)*abs(filterRadius); + vec2 coords = uv + stepVal*filterDistance; + targetFilterRadius = GetFilterRadius(coords); + + //Taking the filter radius for the first candidate sampled pixel if it's less than the base filter radius + //makes sure that we both don't blur in-focus objects into out-of-focus regions behind them, and + //also blur in the out-of-focus objects nearer to the camera than the in-focus region. + //This works because it's basically checking if the first candidate sampled pixel's blur radius is large + //enough to hit the pixel we are gathering into now, that means its circle of confusion is big enough to reach + //that starting pixel. + if (targetFilterRadius - filterRadius < -0.02 / float(KERNEL_RADIUS)) + { + filterDistance = (float(i))*abs(targetFilterRadius); + coords = uv + stepVal*filterDistance; + } + return coords; +} + +//Used to find the mix value to blend between the full-size screen texture and the +//downscaled out-of-focus textures. +float FocusThresholdMixFactor(float filterRadius, float threshold) +{ + return clamp((filterRadius - threshold) * focusMixDepthRange, 0.0, 1.0); +} + +float ApertureSizeToKeepFocusFor(float targetInFocusDepth, float focusDepth) +{ + return (targetInFocusDepth * inFocusThreshold) / abs(targetInFocusDepth - focusDepth); +} + +void main() +{ + vec4 fragColor = vec4(0,0,0,0); + vec2 uv = gl_TexCoord[0].st; + float aspectRatio = resolution.y / resolution.x; + vec2 stepVal = vec2(baseStepValMag * aspectRatio, baseStepValMag); + + if (pass == FILTER_SIZE_PASS) + { + + float depth = LinearizeDepth(uv); + float focusDepth = manualFocusDepth; + float aperture = 1.0/fStop; + + vec2 centerUV = vec2(0.5,0.5); + if (mousefocus == 1) + { + centerUV = mouseDepthCoord; + focusDepth = LinearizeDepth(mouseDepthCoord); + } + + if (autofocus == 1) + { + //The numbers in the autofocus computation that look like magic numbers are, + //found by experimentation to work well enough in practice, but not sacred. + float centerDepth = LinearizeDepth(centerUV); + focusDepth = centerDepth; + float testFocusDepth = focusDepth; + + //Find the depths to use as a safety bound for the in-focus region + float minTestDepth = focusDepth; + float maxTestDepth = focusDepth; + float testDepth = 0.0; + int autofocusTestCoordCount = 8; + for (int i = 0; i < autofocusTestCoordCount; ++i) + { + testDepth = LinearizeDepth(centerUV + + (vec2(autofocusTestCoordOffsets[i].x * aspectRatio, + autofocusTestCoordOffsets[i].y) * clamp(focusDepth * 4.4, 0.1, 0.225))); + //We use averages here instead of just directly min/max testing testDepth in order to have smoother focus transitions + //across big changes to focus depth, such as the camera scrolling over a cliff or being zoomed in on a unit. + minTestDepth = min(minTestDepth, (3.0 * minTestDepth + 2.0 * testDepth) / 5.0); + maxTestDepth = max(maxTestDepth, (3.0 * maxTestDepth + 2.0 * testDepth) / 5.0); + } + + //pull focus back a bit to bias slightly towards air units and against distant terrain + float focusDepthAirFactor = clamp(0.92 + (focusDepth * 12.0), 0.92, 1.2); + testFocusDepth /= max(focusDepthAirFactor, 1.0); + focusDepth /= max(focusDepthAirFactor, 1.0); + + //The min depth bound is scaled more strongly to reduce air unit blurring when zoomed moderately out + minTestDepth = min(minTestDepth / focusDepthAirFactor, focusDepth); + maxTestDepth = + max(focusDepthAirFactor > 1.0 ? + (maxTestDepth + 2.5 * maxTestDepth * focusDepthAirFactor) / 3.5 : + maxTestDepth * focusDepthAirFactor, focusDepth); + + float focalLength = 0.05; + float minFStop = 1.0 * focalLength; + float curveDepth = 6.0; + float baseAperture = + focalLength/max(testFocusDepth * exp(curveDepth * testFocusDepth), minFStop); + + float apertureBoundsFudgeFactor = 1.15; //Used to control bounds depths without having to change inFocusThreshold + float maxDepthAperture = ApertureSizeToKeepFocusFor(maxTestDepth, focusDepth) * apertureBoundsFudgeFactor; + float minDepthAperture = ApertureSizeToKeepFocusFor(minTestDepth, focusDepth) * apertureBoundsFudgeFactor; + + aperture = min(baseAperture, min(maxDepthAperture, minDepthAperture)); + } + + float filterRadius = clamp(((depth - focusDepth) * aperture)/depth, -maxFilterRadius, maxFilterRadius); + + vec4 colors = texture2D(origTex, uv); + //Add extra brightness to brighter colours in blurrier spots to maintain a consistent exposure. + //In real life there would be a wide enough range of light levels to make bright blurry regions not + //lose brightness when blurring, but we need to fudge that here. + float lum = dot(colors.rgb,vec3(0.2126,0.7152,0.0722))*(min(0.2 + 0.65 * abs(filterRadius), 1.5)); + colors = colors *(1.0 + 0.2*lum*lum*lum); + //Raise colours to a power to increase the sharpness of the blur discs + colors = vec4(pow(colors.r, colorPower), pow(colors.g, colorPower), pow(colors.b, colorPower), colors.a); + + fragColor = vec4(colors.rgb, NORMALIZE_FILTER(filterRadius)); + + gl_FragData[0] = fragColor; + if (quality > LOW_QUALITY) + { + gl_FragData[1] = fragColor; + } + } + + else if (pass == INITIAL_BLUR_PASS) + { + vec4 valR = vec4(0,0,0,0); + vec4 valG = vec4(0,0,0,0); + vec4 valB = vec4(0,0,0,0); + float filterRadius = GetFilterRadius(uv); + float targetFilterRadius = 0.0; + int compI = 0; + for (int i=-KERNEL_RADIUS; i <=KERNEL_RADIUS; ++i) + { + compI = i; + vec2 coords = GetFilterCoords(i, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius); + if (compI < -KERNEL_RADIUS) continue; + + vec4 imageTexelRGB = texture2D(origTex, coords); + vec4 c0_c1 = get2CompFilters(compI+KERNEL_RADIUS); + valR.xy += imageTexelRGB.r * c0_c1.xy; + valR.zw += imageTexelRGB.r * c0_c1.zw; + valG.xy += imageTexelRGB.g * c0_c1.xy; + valG.zw += imageTexelRGB.g * c0_c1.zw; + valB.xy += imageTexelRGB.b * c0_c1.xy; + valB.zw += imageTexelRGB.b * c0_c1.zw; + } + gl_FragData[0] = valR; + gl_FragData[1] = valG; + gl_FragData[2] = valB; + } + + else if (pass == FINAL_BLUR_PASS) + { + vec4 valR = vec4(0,0,0,0); + vec4 valG = vec4(0,0,0,0); + vec4 valB = vec4(0,0,0,0); + float filterRadius = GetFilterRadius(uv); + float targetFilterRadius = 0.0; + int compI = 0; + for (int i=-KERNEL_RADIUS; i <=KERNEL_RADIUS; ++i) + { + compI = i; + vec2 coords = GetFilterCoords(i, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius); + if (compI < -KERNEL_RADIUS) continue; + vec4 imageTexelR = texture2D(blurTex0, coords); + vec4 imageTexelG = texture2D(blurTex1, coords); + vec4 imageTexelB = texture2D(blurTex2, coords); + + vec4 c0_c1 = get2CompFilters(compI+KERNEL_RADIUS); + + + valR.xy += multComplex(imageTexelR.xy,c0_c1.xy); + valR.zw += multComplex(imageTexelR.zw,c0_c1.zw); + + valG.xy += multComplex(imageTexelG.xy,c0_c1.xy); + valG.zw += multComplex(imageTexelG.zw,c0_c1.zw); + + valB.xy += multComplex(imageTexelB.xy,c0_c1.xy); + valB.zw += multComplex(imageTexelB.zw,c0_c1.zw); + } + + float redChannel = dot(valR.xy,Kernel0Weights_RealX_ImY)+dot(valR.zw,Kernel1Weights_RealX_ImY); + float greenChannel = dot(valG.xy,Kernel0Weights_RealX_ImY)+dot(valG.zw,Kernel1Weights_RealX_ImY); + float blueChannel = dot(valB.xy,Kernel0Weights_RealX_ImY)+dot(valB.zw,Kernel1Weights_RealX_ImY); + + fragColor = vec4(vec3(pow(redChannel, 1.0/colorPower),pow(greenChannel, 1.0/colorPower), + pow(blueChannel, 1.0/colorPower)), NORMALIZE_FILTER(filterRadius)); + gl_FragData[0] = fragColor; + } + + else if (pass == INITIAL_NEAR_BLUR_PASS) + { + vec4 valR = vec4(0,0,0,0); + vec4 valG = vec4(0,0,0,0); + vec4 valB = vec4(0,0,0,0); + vec4 valA = vec4(0,0,0,0); + //Start by finding the maximum possible relevant blur radius, since we're blurring things + //that will end up in front of more in-focus objects. + float baseFilterRadius = GetFilterRadius(uv); + float filterRadius = min(baseFilterRadius, GetEdgeNearFilterRadius(uv, stepVal)); + filterRadius = min(filterRadius, GetEdgeNearFilterRadius(uv, vec2(stepVal.y, 0.0))); + float targetFilterRadius = 0.0; + int compI = 0; + for (int i=-KERNEL_RADIUS; i <=KERNEL_RADIUS; ++i) + { + compI = i; + vec2 coords = GetFilterCoords(i, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius); + if (compI < -KERNEL_RADIUS) continue; + + vec4 imageTexelRGB = texture2D(origTex, coords); + float alpha = FocusThresholdMixFactor(-targetFilterRadius, inFocusThreshold); + alpha = min(alpha, clamp(abs(targetFilterRadius - baseFilterRadius) / 0.05, 0.0, 1.0)); + + // vec2 c0 = get1CompFilters(compI+KERNEL_RADIUS); + // valRG.xy += imageTexelRGB.r * c0; + // valRG.zw += imageTexelRGB.g * c0; + // valBA.xy += imageTexelRGB.b * c0; + // valBA.zw += alpha * c0; + + vec4 c0_c1 = get2CompFilters(compI+KERNEL_RADIUS); + valR.xy += imageTexelRGB.r * c0_c1.xy; + valR.zw += imageTexelRGB.r * c0_c1.zw; + valG.xy += imageTexelRGB.g * c0_c1.xy; + valG.zw += imageTexelRGB.g * c0_c1.zw; + valB.xy += imageTexelRGB.b * c0_c1.xy; + valB.zw += imageTexelRGB.b * c0_c1.zw; + valA.xy += alpha * c0_c1.xy; + valA.zw += alpha * c0_c1.zw; + } + // gl_FragData[0] = valRG; + // gl_FragData[1] = valBA; + + gl_FragData[0] = valR; + gl_FragData[1] = valG; + gl_FragData[2] = valB; + gl_FragData[3] = valA; + + } + + else if (pass == FINAL_NEAR_BLUR_PASS) + { + vec4 valR = vec4(0,0,0,0); + vec4 valG = vec4(0,0,0,0); + vec4 valB = vec4(0,0,0,0); + vec4 valA = vec4(0,0,0,0); + float baseFilterRadius = GetFilterRadius(uv); + float filterRadius = min(GetFilterRadius(uv), GetEdgeNearFilterRadius(uv, stepVal)); + filterRadius = min(filterRadius, GetEdgeNearFilterRadius(uv, vec2(stepVal.x, 0.0))); + float targetFilterRadius = 0.0; + int compI = 0; + for (int i=-KERNEL_RADIUS; i <=KERNEL_RADIUS; ++i) + { + compI = i; + vec2 coords = GetFilterCoords(i, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius); + if (compI < -KERNEL_RADIUS) continue; + + //imageTexelBA/imageTexelA has the alpha from the initial pass, but we need to also get it for the + //final pass separately since alpha represents the edge of different filter radii, and + //that's not something a single pass of a 2-pass blur will fully pick up. + float finalPassAlpha = FocusThresholdMixFactor(-targetFilterRadius, inFocusThreshold); + finalPassAlpha = min(finalPassAlpha, clamp(abs(targetFilterRadius - baseFilterRadius) / 0.05, 0.0, 1.0)); + + // vec4 imageTexelRG = texture2D(blurTex0, coords); + // vec4 imageTexelBA = texture2D(blurTex1, coords); + + // vec2 c0 = get1CompFilters(compI+KERNEL_RADIUS); + + // valR.xy += multComplex(imageTexelRG.xy,c0); + // valG.xy += multComplex(imageTexelRG.zw,c0); + // valB.xy += multComplex(imageTexelBA.xy,c0); + // valA.xy += multComplex(imageTexelBA.zw,c0); + // valA.xy += finalPassAlpha * c0; + + vec4 imageTexelR = texture2D(blurTex0, coords); + vec4 imageTexelG = texture2D(blurTex1, coords); + vec4 imageTexelB = texture2D(blurTex2, coords); + vec4 imageTexelA = texture2D(blurTex3, coords); + + vec4 c0_c1 = get2CompFilters(compI+KERNEL_RADIUS); + + valR.xy += multComplex(imageTexelR.xy,c0_c1.xy); + valR.zw += multComplex(imageTexelR.zw,c0_c1.zw); + + valG.xy += multComplex(imageTexelG.xy,c0_c1.xy); + valG.zw += multComplex(imageTexelG.zw,c0_c1.zw); + + valB.xy += multComplex(imageTexelB.xy,c0_c1.xy); + valB.zw += multComplex(imageTexelB.zw,c0_c1.zw); + + valA.xy += multComplex(imageTexelA.xy,c0_c1.xy); + valA.zw += multComplex(imageTexelA.zw,c0_c1.zw); + valA.xy += finalPassAlpha * c0_c1.xy; + valA.zw += finalPassAlpha * c0_c1.zw; + } + // float redChannel = dot(valR.xy,KernelNearWeights_RealX_ImY); + // float greenChannel = dot(valG.xy,KernelNearWeights_RealX_ImY); + // float blueChannel = dot(valB.xy,KernelNearWeights_RealX_ImY); + // float alphaChannel = dot(valA.xy, KernelNearWeights_RealX_ImY); + + float redChannel = dot(valR.xy,Kernel0Weights_RealX_ImY)+dot(valR.zw,Kernel1Weights_RealX_ImY); + float greenChannel = dot(valG.xy,Kernel0Weights_RealX_ImY)+dot(valG.zw,Kernel1Weights_RealX_ImY); + float blueChannel = dot(valB.xy,Kernel0Weights_RealX_ImY)+dot(valB.zw,Kernel1Weights_RealX_ImY); + float alphaChannel = dot(valA.xy,Kernel0Weights_RealX_ImY)+dot(valA.zw,Kernel1Weights_RealX_ImY); + + fragColor = vec4(pow(redChannel, 1.0/colorPower),pow(greenChannel, 1.0/colorPower), + pow(blueChannel, 1.0/colorPower), clamp(alphaChannel, 0.0, 1.0)); + gl_FragData[0] = fragColor; + } + + else if (pass == COMPOSITION_PASS) + { + vec4 blurTexAtUV = texture2D(blurTex0, uv); + vec4 origTexAtUV = texture2D(origTex, uv); + float filterRadius = UNNORMALIZE_FILTER(blurTexAtUV.a); + float mixFactor = FocusThresholdMixFactor(abs(filterRadius), inFocusThreshold); + fragColor = origTexAtUV; + + // if (quality >= HIGH_QUALITY) + // { + // float mixFactor = FocusThresholdMixFactor(abs(filterRadius), inFocusThreshold * 2.5); //Need to blur later since full screen blurring helps transition + // if (abs(filterRadius) > inFocusThreshold) + // { + // float targetFilterRadius = 0.0; + // fragColor += texture2D(origTex, GetFilterCoords(KERNEL_RADIUS, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(-KERNEL_RADIUS, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(KERNEL_RADIUS, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(-KERNEL_RADIUS, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(KERNEL_RADIUS / 2, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(-KERNEL_RADIUS / 2, uv, vec2(stepVal.x, 0.0), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(KERNEL_RADIUS / 2, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius)) + // + texture2D(origTex, GetFilterCoords(-KERNEL_RADIUS / 2, uv, vec2(0.0, stepVal.y), filterRadius, targetFilterRadius)); + // fragColor /= 9.0; + // } + // } + + fragColor = mix(fragColor, blurTexAtUV, mixFactor); + + if (quality > LOW_QUALITY) + { + vec4 nearBlurTexAtUV = texture2D(blurTex1, uv); + float alpha = clamp(nearBlurTexAtUV.a * 1.5, 0.0, 1.0); + fragColor.rgb = mix(fragColor.rgb, nearBlurTexAtUV.rgb, alpha); + // fragColor = vec4(alpha); + } + + gl_FragData[0] = fragColor; + } + +} diff --git a/LuaUI/Widgets_Evo/Shaders/gaussianBlur.frag.glsl b/LuaUI/Widgets_Evo/Shaders/gaussianBlur.frag.glsl new file mode 100644 index 000000000..35512987b --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/gaussianBlur.frag.glsl @@ -0,0 +1,37 @@ +#version 150 compatibility + +uniform sampler2D tex; + +uniform float offsets[###BLUR_HALF_KERNEL_SIZE###]; +uniform float weights[###BLUR_HALF_KERNEL_SIZE###]; + +uniform vec2 dir; + +uniform vec2 viewPortSize; + +void main(void) +{ + vec2 uv = gl_FragCoord.xy / viewPortSize; + vec4 acc = texture( tex, uv ) * weights[0]; + float okCoords; + + for (int i = 1; i < ###BLUR_HALF_KERNEL_SIZE###; ++i) { + vec2 uvOff = offsets[i] * dir / viewPortSize; + vec2 uvP = uv + uvOff; + vec2 uvN = uv - uvOff; + + float weightP = weights[i]; + float weightN = weights[i]; + + okCoords = float( all(bvec4( greaterThanEqual(uvP, vec2(0.0)), lessThanEqual(uvP, vec2(1.0)) )) ); + weightP *= okCoords; + + okCoords = float( all(bvec4( greaterThanEqual(uvN, vec2(0.0)), lessThanEqual(uvN, vec2(1.0)) )) ); + weightN *= okCoords; + + acc += texture( tex, uvP ) * weightP; + acc += texture( tex, uvN ) * weightN; + } + + gl_FragColor = acc; +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/gbuffFuse.frag.glsl b/LuaUI/Widgets_Evo/Shaders/gbuffFuse.frag.glsl new file mode 100644 index 000000000..eb744fe50 --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/gbuffFuse.frag.glsl @@ -0,0 +1,77 @@ +#version 150 compatibility + +#define DEPTH_CLIP01 ###DEPTH_CLIP01### +#define MERGE_MISC ###MERGE_MISC### + +uniform sampler2D modelDepthTex; +uniform sampler2D mapDepthTex; + +uniform sampler2D modelNormalTex; +uniform sampler2D mapNormalTex; + +uniform sampler2D modelMiscTex; +uniform sampler2D mapMiscTex; + +uniform vec2 viewPortSize; + +uniform mat4 invProjMatrix; +uniform mat4 viewMatrix; + +#define NORM2SNORM(value) (value * 2.0 - 1.0) +#define SNORM2NORM(value) (value * 0.5 + 0.5) + +// Calculate out of the fragment in screen space the view space position. +vec4 GetViewPos(vec2 texCoord, float sampledDepth) { + vec4 projPosition = vec4(0.0, 0.0, 0.0, 1.0); + + //texture space [0;1] to NDC space [-1;1] + #if (DEPTH_CLIP01 == 1) + //don't transform depth as it's in the same [0;1] space + projPosition.xyz = vec3(NORM2SNORM(texCoord), sampledDepth); + #else + projPosition.xyz = NORM2SNORM(vec3(texCoord, sampledDepth)); + #endif + + vec4 viewPosition = invProjMatrix * projPosition; + viewPosition /= viewPosition.w; + + return viewPosition; +} + +void main() { + vec2 uv = gl_FragCoord.xy / viewPortSize; + + float modelDepth = texelFetch(modelDepthTex, ivec2(gl_FragCoord.xy), 0).r; + float mapDepth = texelFetch(mapDepthTex, ivec2(gl_FragCoord.xy), 0).r; + + float modelOccludesMap = float(modelDepth < mapDepth); + float depth = mix(mapDepth, modelDepth, modelOccludesMap); + + vec4 viewPosition = GetViewPos(uv, depth); + + vec3 modelNormal = texture(modelNormalTex, uv).rgb; + vec3 mapNormal = texture(mapNormalTex, uv).rgb; + + vec3 viewNormal = mix(mapNormal, modelNormal, modelOccludesMap); + float validNormal = float(length(viewNormal) > 0.2); //empty spaces in g-buffer will have vec3(0.0) normals + + viewNormal = NORM2SNORM(viewNormal); + viewNormal = normalize(viewNormal); + viewNormal = vec3(viewMatrix * vec4(viewNormal, 0.0)); //transform world-->view space + + #if (MERGE_MISC == 1) + vec4 modelMiscInfo = texture(modelMiscTex, uv); + vec4 mapMiscInfo = texture(mapMiscTex, uv); + vec4 miscInfo = mix(mapMiscInfo, modelMiscInfo, modelOccludesMap); + #endif + + // MRT output: + //[0] = gbuffFuseViewPosTex + //[1] = gbuffFuseViewNormalTex + //[2] = gbuffFuseMiscTex (conditional to MERGE_MISC == 1) + gl_FragData[0].xyz = viewPosition.xyz; + gl_FragData[1].xyz = mix( vec3(0.0), viewNormal.xyz, vec3(validNormal) ); + #if (MERGE_MISC == 1) + gl_FragData[2] = miscInfo; + #endif +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/identity.vert.glsl b/LuaUI/Widgets_Evo/Shaders/identity.vert.glsl new file mode 100644 index 000000000..6c4a87db2 --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/identity.vert.glsl @@ -0,0 +1,5 @@ +#version 150 compatibility + +void main() { + gl_Position = gl_Vertex; +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/outlineApplication.frag.glsl b/LuaUI/Widgets_Evo/Shaders/outlineApplication.frag.glsl new file mode 100644 index 000000000..c08050cee --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/outlineApplication.frag.glsl @@ -0,0 +1,17 @@ +#version 150 compatibility + +uniform sampler2D tex; +uniform sampler2D modelDepthTex; + +uniform float strength = 1.0; + +void main() { + ivec2 imageCoord = ivec2(gl_FragCoord.xy); + + vec4 color = texelFetch(tex, imageCoord, 0); + float modelDepth = texelFetch(modelDepthTex, imageCoord, 0).r; + + vec4 mixVal = strength * vec4(modelDepth == 1.0); //outside of any existing model shapes + + gl_FragColor = mix(vec4(0.0), color, mixVal); +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/outlineDilate.frag.glsl b/LuaUI/Widgets_Evo/Shaders/outlineDilate.frag.glsl new file mode 100644 index 000000000..aba6ea03c --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/outlineDilate.frag.glsl @@ -0,0 +1,86 @@ +#version 150 compatibility + +uniform sampler2D depthTex; +uniform sampler2D colorTex; + +uniform mat4 projMatrix; + +#define DILATE_SINGLE_PASS ###DILATE_SINGLE_PASS### + +uniform int dilateHalfKernelSize = 1; + +uniform vec2 viewPortSize; +uniform float strength = 1.0; +//layout(pixel_center_integer) in vec4 gl_FragCoord; +//layout(origin_upper_left) in vec4 gl_FragCoord; + + +#if (DILATE_SINGLE_PASS == 1) + void main(void) + { + ivec4 vpsMinMax = ivec4(0, 0, ivec2(viewPortSize)); + + float minDepth = 1.0; + vec4 maxColor = vec4(0.0); + + ivec2 thisCoord = ivec2(gl_FragCoord.xy); + + vec2 bnd = vec2(dilateHalfKernelSize - 1, dilateHalfKernelSize + 2) * strength; + + for (int x = -dilateHalfKernelSize; x <= dilateHalfKernelSize; ++x) { + for (int y = -dilateHalfKernelSize; y <= dilateHalfKernelSize; ++y) { + + ivec2 offset = ivec2(x, y); + /* + ivec2 samplingCoord = thisCoord + offset; + bool okCoords = ( all(bvec4( + greaterThanEqual(samplingCoord, vpsMinMax.xy), + lessThanEqual(samplingCoord, vpsMinMax.zw) )) + ); + + if (okCoords)*/ { + minDepth = min(minDepth, texelFetchOffset( depthTex, thisCoord, 0, offset).r); + vec4 thisColor = texelFetchOffset( colorTex, thisCoord, 0, offset); + thisColor.a *= smoothstep(bnd.y, bnd.x, sqrt(float(x * x + y * y))); + maxColor = max(maxColor, thisColor); + } + } + } + gl_FragDepth = minDepth; + gl_FragColor = maxColor; + } +#else //separable vert/horiz passes + uniform vec2 dir; + void main(void) + { + ivec4 vpsMinMax = ivec4(0, 0, ivec2(viewPortSize)); + + float minDepth = 1.0; + vec4 maxColor = vec4(0.0); + + ivec2 thisCoord = ivec2(gl_FragCoord.xy); + + vec2 bnd = vec2(dilateHalfKernelSize - 1, dilateHalfKernelSize + 2) * strength; + + for (int i = -dilateHalfKernelSize; i <= dilateHalfKernelSize; ++i) { + + ivec2 offset = ivec2(i) * ivec2(dir); + /* + ivec2 samplingCoord = thisCoord + offset; + bool okCoords = ( all(bvec4( + greaterThanEqual(samplingCoord, vpsMinMax.xy), + lessThanEqual(samplingCoord, vpsMinMax.zw) )) + ); + + if (okCoords)*/ { + minDepth = min(minDepth, texelFetchOffset( depthTex, thisCoord, 0, offset).r); + vec4 thisColor = texelFetchOffset( colorTex, thisCoord, 0, offset); + thisColor.a *= smoothstep(bnd.y, bnd.x, abs(i)); + maxColor = max(maxColor, thisColor); + } + } + + gl_FragDepth = minDepth; + gl_FragColor = maxColor; + } +#endif \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/outlineShape.frag.glsl b/LuaUI/Widgets_Evo/Shaders/outlineShape.frag.glsl new file mode 100644 index 000000000..97635a810 --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/outlineShape.frag.glsl @@ -0,0 +1,31 @@ +#version 150 compatibility + +uniform sampler2D modelDepthTex; +uniform sampler2D mapDepthTex; +uniform sampler2D modelMiscTex; + +uniform vec4 outlineColor; + +#define USE_MATERIAL_INDICES ###USE_MATERIAL_INDICES### + +void main() { + ivec2 imageCoord = ivec2(gl_FragCoord.xy); + + float mapDepth = texelFetch(mapDepthTex, imageCoord, 0).r; + float modelDepth = texelFetch(modelDepthTex, imageCoord, 0).r; + + bool cond = mapDepth > modelDepth && modelDepth < 1.0; + + vec4 validUnit = vec4(cond); + #if (USE_MATERIAL_INDICES == 1) + #define MATERIAL_UNITS_MAX_INDEX 127 + #define MATERIAL_UNITS_MIN_INDEX 1 + + if (cond) { + int matIndices = int(texelFetch(modelMiscTex, imageCoord, 0).r * 255.0); + validUnit *= float( (matIndices >= MATERIAL_UNITS_MIN_INDEX) && (matIndices <= MATERIAL_UNITS_MAX_INDEX) ); + } + #endif + + gl_FragColor = mix(vec4(0.0), outlineColor, validUnit); +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/Shaders/ssao.frag.glsl b/LuaUI/Widgets_Evo/Shaders/ssao.frag.glsl new file mode 100644 index 000000000..b8a3ebd3b --- /dev/null +++ b/LuaUI/Widgets_Evo/Shaders/ssao.frag.glsl @@ -0,0 +1,113 @@ +#version 150 compatibility + +uniform sampler2D viewPosTex; +uniform sampler2D viewNormalTex; + +uniform vec2 viewPortSize; + +uniform float shadowDensity; + +uniform mat4 projMatrix; + +#define NORM2SNORM(value) (value * 2.0 - 1.0) +#define SNORM2NORM(value) (value * 0.5 + 0.5) + +#define HASHSCALE3 vec3(.1031, .1030, .0973) + +vec3 hash32(vec2 p) { + vec3 p3 = fract(vec3(p.xyx) * HASHSCALE3); + p3 += dot(p3, p3.yxz+19.19); + return fract((p3.xxy+p3.yzz)*p3.zyx); +} + +//---------------------------------------------------------------------------------------- + +#define SSAO_KERNEL_SIZE ###SSAO_KERNEL_SIZE### + +#define SSAO_RADIUS ###SSAO_RADIUS### +#define SSAO_MIN ###SSAO_MIN### +#define SSAO_MAX ###SSAO_MAX### * SSAO_RADIUS + +#define SSAO_FADE_DIST_1 800.0 +#define SSAO_FADE_DIST_0 3.0 * SSAO_FADE_DIST_1 + +#define SSAO_ALPHA_POW ###SSAO_ALPHA_POW### + +//---------------------------------------------------------------------------------------- + +uniform vec3 samplingKernel[SSAO_KERNEL_SIZE]; + +// generally follow https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl +void main() { + vec2 uv = gl_FragCoord.xy / viewPortSize; + + vec4 viewPosition = vec4( texture(viewPosTex, uv).xyz, 1.0 ); + vec3 viewNormal = texture(viewNormalTex, uv).xyz; + + float fragDistFactor = smoothstep( SSAO_FADE_DIST_0, SSAO_FADE_DIST_1, -viewPosition.z ); + + gl_FragColor = vec4(1.0, 1.0, 1.0, 0.0); + + if ( dot(viewNormal, viewNormal) > 0.0 && fragDistFactor > 0.0 ) { + // Calculate the rotation matrix for the kernel. + vec3 randomVector = normalize( NORM2SNORM(hash32(gl_FragCoord.xy)) ); + + // Using Gram-Schmidt process to get an orthogonal vector to the normal vector. + // The resulting tangent is on the same plane as the random and normal vector. + // see http://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process + // Note: No division by needed, as this is for normal vectors 1. + vec3 viewTangent = normalize(randomVector - dot(randomVector, viewNormal) * viewNormal); + + vec3 viewBitangent = cross(viewNormal, viewTangent); + + // Final matrix to reorient the kernel depending on the normal and the random vector. + // TBN matrix. Transforms from tangent space to view space + mat3 kernelMatrix = mat3(viewTangent, viewBitangent, viewNormal); + + // Go through the kernel samples and create occlusion factor. + float occlusion = 0.0; + + + for (int i = 0; i < SSAO_KERNEL_SIZE; ++i) { + // Reorient sample vector in view space ... + vec3 viewSampleVector = kernelMatrix * samplingKernel[i]; + + // ... and calculate sample point. + vec4 viewTestPosition = viewPosition + SSAO_RADIUS * vec4(viewSampleVector, 0.0); + + // projection + vec4 ndcTestPosition = projMatrix * viewTestPosition; + // perspecitive division + ndcTestPosition /= ndcTestPosition.w; + + // [-1;1] to [0;1] + vec2 texSampingPoint = SNORM2NORM(ndcTestPosition.xy); + + // Get sample viewPos from the viewPosTex texture + vec3 viewPositionSampled = texture(viewPosTex, texSampingPoint).xyz; + + float delta = viewPositionSampled.z - viewTestPosition.z; + + #if 0 + float occlusionCondition = float(delta >= SSAO_MIN && delta <= SSAO_MAX); + #else + float occlusionCondition = float(delta >= SSAO_MIN) * smoothstep(SSAO_MAX, 0.5 * SSAO_MAX, delta); + #endif + + occlusion += occlusionCondition; + } + + occlusion *= fragDistFactor; + + // No occlusion gets white, full occlusion gets black. + occlusion = 1.0 - occlusion / float(SSAO_KERNEL_SIZE); + + float occlusionAlpha = occlusion; + occlusionAlpha = pow(occlusionAlpha, SSAO_ALPHA_POW); + + occlusionAlpha = clamp(1.0 - occlusionAlpha, 0.0, 1.0); + //occlusionAlpha = 1.0; + + gl_FragColor = vec4(vec3(shadowDensity * occlusion), occlusionAlpha); + } +} \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/api_chili.lua b/LuaUI/Widgets_Evo/api_chili.lua index a75f2956b..421b07350 100644 --- a/LuaUI/Widgets_Evo/api_chili.lua +++ b/LuaUI/Widgets_Evo/api_chili.lua @@ -73,7 +73,49 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local pressed = {} + +function widget:MousePress(mx, my, mButton) + if pressed[mButton] then --engine bug?(mouserelease is not called when another mouse button is pressed before releasing) + --this is also fixed in Update() + widget:MouseRelease(mx, my, mButton) +end + +pressed[mButton] = true + +return true +end + +function widget:MouseRelease(mx, my, mButton) + if not pressed[mButton] then return false end + + pressed[mButton] = false + return true +end + +function widget:Update() + local mx, my, lmb, mmb, rmb = Spring.GetMouseState()--engine BUG FIX --should work fine even after engine/wh bug is fixed + if pressed[1] and not lmb then + widget:MouseRelease(mx, my, 1) + end + if pressed[2] and not mmb then + widget:MouseRelease(mx, my, 2) + end + if pressed[3] and not rmb then + widget:MouseRelease(mx, my, 3) + end +end + + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end gl.Color(1,1,1,1) if (not screen0:IsEmpty()) then gl.PushMatrix() diff --git a/LuaUI/Widgets_Evo/api_gfx_gui_shader.lua b/LuaUI/Widgets_Evo/api_gfx_gui_shader.lua deleted file mode 100644 index fd0cbe575..000000000 --- a/LuaUI/Widgets_Evo/api_gfx_gui_shader.lua +++ /dev/null @@ -1,476 +0,0 @@ --- $Id: api_gfx_blur.lua 3171 2008-11-06 09:06:29Z det $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---------------------------------------------------------------- --- TEH INTERFACE ---------------------------------------------- --- --- WG['guishader_api'].InsertRect(left,top,right,bottom) -> idx --- WG['guishader_api'].RemoveRect(idx) - - -local widgetName = "GUI-Shader" -function widget:GetInfo() - return { - name = widgetName, - desc = "Blurs the 3D-world under several other widgets UI elements.", - author = "Floris (original blurapi widget by: jK)", - date = "17 february 2015", - license = "GNU GPL, v2 or later", - layer = -1000, - enabled = false -- loaded by default? - } -end - --------------------------------------------------------------------------------- --- Console commands --------------------------------------------------------------------------------- - --- /guishader -- toggles different styles! - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local imageDirectory = ":n:LuaUI/Images/guishader/" -local defaultBlurIntensity = 0.0014 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---hardware capability - -local canRTT = (gl.RenderToTexture ~= nil) -local canCTT = (gl.CopyToTexture ~= nil) -local canShader = (gl.CreateShader ~= nil) -local canFBO = (gl.DeleteTextureFBO ~= nil) - -local NON_POWER_OF_TWO = gl.HasExtension("GL_ARB_texture_non_power_of_two") - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local blurShader -local screencopy -local blurtex -local blurtex2 -local stenciltex -local screenBlur = false -local allowScreenBlur = true - -local blurIntensity = defaultBlurIntensity -local guishaderRects = {} -local updateStencilTexture = false - -local oldvs = 0 -local vsx, vsy = widgetHandler:GetViewSizes() -local ivsx, ivsy = vsx, vsy -function widget:ViewResize(viewSizeX, viewSizeY) - vsx, vsy = viewSizeX,viewSizeY - ivsx,ivsy = vsx, vsy - - if (gl.DeleteTextureFBO) then - gl.DeleteTextureFBO(blurtex) - gl.DeleteTextureFBO(blurtex2) - gl.DeleteTexture(screencopy) - end - - screencopy = gl.CreateTexture(vsx, vsy, { - border = false, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - blurtex = gl.CreateTexture(ivsx, ivsy, { - border = false, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - blurtex2 = gl.CreateTexture(ivsx, ivsy, { - border = false, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - if (blurtex == nil)or(blurtex2 == nil)or(screencopy == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") - widgetHandler:RemoveWidget() - return false - end - - updateStencilTexture = true -end - - -function widget:UpdateCallIns() - self:ViewResize(vsx, vsy) - - self.DrawScreenEffects = DrawScreenEffectsBlur - widgetHandler:UpdateCallIn("DrawScreenEffects") -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function DrawStencilTexture(fullscreen) - if (next(guishaderRects)) then - if (stenciltex == nil)or(vsx+vsy~=oldvs) then - gl.DeleteTextureFBO(stenciltex) - - oldvs = vsx+vsy - stenciltex = gl.CreateTexture(vsx, vsy, { - border = false, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - if (stenciltex == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") - widgetHandler:RemoveWidget() - return false - end - end - else - gl.RenderToTexture(stenciltex, gl.Clear, GL.COLOR_BUFFER_BIT ,0,0,0,0) - return - end - - gl.RenderToTexture(stenciltex, function() - gl.Clear(GL.COLOR_BUFFER_BIT,0,0,0,0) - gl.PushMatrix() - gl.Translate(-1,-1,0) - gl.Scale(2/vsx,2/vsy,0) - if not fullscreen then - for _,rect in pairs(guishaderRects) do - gl.Rect(rect[1],rect[2],rect[3],rect[4]) - end - else - gl.Rect(0,0,vsx,vsy) - end - gl.PopMatrix() - end) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function CheckHardware() - if (not canCTT) then - Spring.Echo("guishader api: your hardware is missing the necessary CopyToTexture feature") - widgetHandler:RemoveWidget() - return false - end - - if (not canRTT) then - Spring.Echo("guishader api: your hardware is missing the necessary RenderToTexture feature") - widgetHandler:RemoveWidget() - return false - end - - if (not canShader) then - Spring.Echo("guishader api: your hardware does not support shaders, OR: change springsettings: \"enable lua shaders\" ") - widgetHandler:RemoveWidget() - return false - end - - if (not canFBO) then - Spring.Echo("guishader api: your hardware does not fbo textures") - widgetHandler:RemoveWidget() - return false - end - - if (not NON_POWER_OF_TWO) then - Spring.Echo("guishader api: your hardware does not non-2^n-textures") - widgetHandler:RemoveWidget() - return false - end - - if Platform ~= nil then - if Platform.gpuVendor == 'Intel' then - Spring.Echo("guishader api: you use an Intel GPU, it will malfunction so we'll disable") - widgetHandler:RemoveWidget() - --Spring.SendCommands("luaui disablewidget "..widgetName) - return false - end - end - return true -end - -function widget:Initialize() - if (not CheckHardware()) then return false end - - CreateShaders() - - self:UpdateCallIns() - - WG['guishader_api'] = {} - WG['guishader_api'].InsertRect = function(left,top,right,bottom,name) - guishaderRects[name] = {left,top,right,bottom} - updateStencilTexture = true - end - WG['guishader_api'].RemoveRect = function(name) - local found = false - if guishaderRects[name] ~= nil then - found = true - end - guishaderRects[name] = nil - updateStencilTexture = true - return found - end - WG['guishader_api'].getBlurDefault = function() - return defaultBlurIntensity - end - WG['guishader_api'].getBlurIntensity = function() - return blurIntensity - end - WG['guishader_api'].setBlurIntensity = function(value) - if value == nil then value = defaultBlurIntensity end - blurIntensity = value - end - WG['guishader_api'].setScreenBlur = function(value) - screenBlur = value - end - WG['guishader_api'].getScreenBlur = function(value) - return screenBlur - end - WG['guishader_api'].setAllowScreenBlur = function(value) - allowScreenBlur = value - end - WG['guishader_api'].getAllowScreenBlur = function(value) - return screenBlur - end -end - - -function CreateShaders() - - if (blurShader) then - gl.DeleteShader(blurShader or 0) - end - - local str_blurShader_part1 = [[ - uniform sampler2D tex0; - uniform float intensity; - - void main(void) - { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - ]] - - local str_blurShader_part2 = [[ - gl_FragColor = vec4(0.0,0.0,0.0,1.0); - - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2(-intensity, -intensity)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2(-intensity, 0.0)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2(-intensity, intensity)).rgb; - - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( 0.0, -intensity)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( 0.0, 0.0)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( 0.0, intensity)).rgb; - - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( intensity, -intensity)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( intensity, 0.0)).rgb; - gl_FragColor.rgb += 0.11 * texture2D(tex0, texCoord + vec2( intensity, intensity)).rgb; - } - ]] - - -- create blur shaders - blurShader = gl.CreateShader({ - fragment = "uniform sampler2D tex2; " .. str_blurShader_part1 .. - " float stencil = texture2D(tex2, texCoord).a; if (stencil<0.01) {gl_FragColor = texture2D(tex0, texCoord); return;} " .. - str_blurShader_part2, - uniform = { - intensity = blurIntensity, - }, - uniformInt = { - tex0 = 0, - tex2 = 2, - } - }) - - if (blurShader == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader blurShader: shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - -- create blurtextures - screencopy = gl.CreateTexture(vsx, vsy, { - border = false, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - blurtex = gl.CreateTexture(ivsx, ivsy, { - border = false, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - blurtex2 = gl.CreateTexture(ivsx, ivsy, { - border = false, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - intensityLoc = gl.GetUniformLocation(blurShader, "intensity") - - -- debug? - if (blurtex == nil)or(blurtex2 == nil)or(screencopy == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") - widgetHandler:RemoveWidget() - return false - end -end - - -function DeleteShaders() - if (gl.DeleteTextureFBO) then - gl.DeleteTextureFBO(blurtex) - gl.DeleteTextureFBO(blurtex2) - gl.DeleteTextureFBO(stenciltex) - end - gl.DeleteTexture(screencopy or 0) - - if (gl.DeleteShader) then - gl.DeleteShader(blurShader or 0) - end - blurShader = nil -end - -function widget:Shutdown() - DeleteShaders() - WG['guishader_api'] = nil -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:DrawScreenEffectsBlur() - if Spring.IsGUIHidden() then return end - - if not screenBlur or not allowScreenBlur then - if not next(guishaderRects) then return end - - gl.Texture(false) - gl.Color(1,1,1,1) - gl.Blending(false) - - if updateStencilTexture then - DrawStencilTexture(false); - updateStencilTexture = false; - end - - gl.CopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) - gl.Texture(screencopy) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - - gl.UseShader(blurShader) - gl.Uniform(intensityLoc, blurIntensity) - - gl.Texture(2,stenciltex) - gl.Texture(2,false) - - gl.Texture(blurtex) - gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) - gl.Texture(blurtex2) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - gl.UseShader(0) - - if blurIntensity >= 0.0016 then - gl.UseShader(blurShader) - gl.Uniform(intensityLoc, blurIntensity*0.5) - - gl.Texture(2,stenciltex) - gl.Texture(2,false) - - gl.Texture(blurtex) - gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) - gl.Texture(blurtex2) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - gl.UseShader(0) - end - - gl.Texture(blurtex) - gl.TexRect(0,vsy,vsx,0) - gl.Texture(false) - - gl.Blending(true) - end -end - -function widget:DrawScreen() - if Spring.IsGUIHidden() then return end - - if screenBlur and allowScreenBlur then - gl.Texture(false) - gl.Color(1,1,1,1) - gl.Blending(false) - - if updateStencilTexture then - DrawStencilTexture(true); - updateStencilTexture = false; - end - - gl.CopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) - gl.Texture(screencopy) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - - gl.UseShader(blurShader) - gl.Uniform(intensityLoc, blurIntensity) - - gl.Texture(2,stenciltex) - gl.Texture(2,false) - - gl.Texture(blurtex) - gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) - gl.Texture(blurtex2) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - gl.UseShader(0) - - --2nd pass - gl.UseShader(blurShader) - gl.Uniform(intensityLoc, blurIntensity*0.4) - - gl.Texture(2,stenciltex) - gl.Texture(2,false) - - gl.Texture(blurtex) - gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) - gl.Texture(blurtex2) - gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) - gl.UseShader(0) - - gl.Texture(blurtex) - gl.TexRect(0,vsy,vsx,0) - gl.Texture(false) - - gl.Blending(true) - end -end - -function widget:GetConfigData(data) - savedTable = {} - savedTable.allowScreenBlur = allowScreenBlur - savedTable.blurIntensity = blurIntensity - return savedTable -end - -function widget:SetConfigData(data) - if data.allowScreenBlur ~= nil then - allowScreenBlur = data.allowScreenBlur - end - if data.blurIntensity ~= nil then - blurIntensity = data.blurIntensity - end -end - -function widget:TextCommand(command) - if (string.find(command, "allowscreenblur") == 1 and string.len(command) == 15) then - allowScreenBlur = not allowScreenBlur - end -end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/autoquit.lua b/LuaUI/Widgets_Evo/autoquit.lua deleted file mode 100644 index f4da9bb61..000000000 --- a/LuaUI/Widgets_Evo/autoquit.lua +++ /dev/null @@ -1,57 +0,0 @@ - ----------------------------------------------------------------- --- global variables ----------------------------------------------------------------- -local versionNumber = "v1.2" -local delay = 20 -local endTime -local mx,my - ----------------------------------------------------------------- --- speedups ----------------------------------------------------------------- -local DiffTimers = Spring.DiffTimers -local GetTimer = Spring.GetTimer -local SendCommands = Spring.SendCommands -local Echo = Spring.Echo -local GetMouseState = Spring.GetMouseState - ----------------------------------------------------------------- --- callins ----------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Autoquit", - desc = versionNumber .. " Automatically quits "..delay.."s after the game ends. Move mouse to cancel.", - author = "Evil4Zerggin & zwzsg", - date = "25 December 2008", - license = "GNU LGPL, v2.1 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - -function widget:Initialize() - endTime = false -end - -function widget:GameOver() - endTime = GetTimer() - mx,my = GetMouseState() - Echo(" Automatically exiting in " .. delay .. " seconds. Move mouse to cancel.") -end - -function widget:Update(dt) - if endTime then - local nmx,nmy = GetMouseState() - if nmx~=mx or nmy~=my then - Echo(" Autoquit canceled.") - endTime = false - -- widgetHandler:RemoveWidget() - elseif DiffTimers(GetTimer(), endTime) > delay then - Echo(" Autoquit sending quit command.") - SendCommands("quitforce") - end - end -end diff --git a/LuaUI/Widgets_Evo/camera_fov_changer.lua b/LuaUI/Widgets_Evo/camera_fov_changer.lua new file mode 100644 index 000000000..a5fadbbe1 --- /dev/null +++ b/LuaUI/Widgets_Evo/camera_fov_changer.lua @@ -0,0 +1,37 @@ +function widget:GetInfo() + return { + name = "FOV changer", + desc = "shortcuts: keypad 1/7 or CTRL+O/P", + author = "", + date = "", + license = "GNU GPL, v2 or later", + layer = 99999999, + enabled = false -- loaded by a horse? + } +end + +local fovStep = 5 +local FOVminus = 111 -- CTRL+O +local FOVplus = 112 -- CTRL+P +local FOVminus2 = 257 --KP1 +local FOVplus2 = 263 --KP7 + +function widget:KeyRelease(key, modifier) + --Spring.Echo(key) + if ((key == FOVplus and modifier.ctrl) or key == FOVplus2 or (key == FOVminus and modifier.ctrl) or key == FOVminus2) then + local current_cam_state = Spring.GetCameraState() + if key == FOVplus or key == FOVplus2 then + current_cam_state.fov = math.floor(current_cam_state.fov + fovStep) + if current_cam_state.fov > 100 then -- glitches beyond 100 + current_cam_state.fov = 100 + end + else + current_cam_state.fov = math.floor(current_cam_state.fov - fovStep) + if current_cam_state.fov < 0 then + current_cam_state.fov = 0 + end + end + Spring.Echo('target FOV: '..current_cam_state.fov) + Spring.SetCameraState(current_cam_state, WG['options'] and WG['options'].getCameraSmoothness() or 2) + end +end diff --git a/LuaUI/Widgets_Evo/camera_player_tv.lua b/LuaUI/Widgets_Evo/camera_player_tv.lua new file mode 100644 index 000000000..aab1c23fd --- /dev/null +++ b/LuaUI/Widgets_Evo/camera_player_tv.lua @@ -0,0 +1,626 @@ +function widget:GetInfo() + return { + name = "Player-TV", + desc = "Automaticly tracks players camera, (shows player-switch countdown on top of advplayerlist)", + author = "Floris", + date = "January 2018", + license = "GNU GPL, v2 or later", + layer = -2, + enabled = true, + } +end + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 32 +local fontfileOutlineSize = 7 +local fontfileOutlineStrength = 1.18 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local displayPlayername = true + +local playerChangeDelay = 40 + +local parentPos = {} +local prevPos = {} +local drawlistsCountdown = {} +local drawlistsPlayername = {} +local fontSize = 14 -- 14 to be alike with advplayerslist_lockcamera widget +local top, left, bottom, right, widgetScale = 0,0,0,0,1 +local rejoining = false +local initGameframe = Spring.GetGameFrame() +local prevOrderID = 1 + +local currentTrackedPlayer +local playersTS = {} +local nextTrackingPlayerChange = os.clock() + +local tsOrderedPlayerCount = 0 +local tsOrderedPlayers = {} + +local isSpec = Spring.GetSpectatingState() +local vsx, vsy = Spring.GetViewGeometry() +local widgetScale = (0.7 + (vsx*vsy / 5000000)) + +local toggled = false + +local bgcorner = ":n:LuaUI/Images/bgcorner.png" + +local drawlist = {} +local widgetHeight = 23 + +--------------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------------- + +function deepcopy(orig) + local orig_type = type(orig) + local copy + if orig_type == 'table' then + copy = {} + for orig_key, orig_value in next, orig, nil do + copy[deepcopy(orig_key)] = deepcopy(orig_value) + end + setmetatable(copy, deepcopy(getmetatable(orig))) + else -- number, string, boolean, etc + copy = orig + end + return copy +end + +function addPlayerTsOrdered(ts, playerID, teamID, spec) + local inserted = false + local newTsOrderedPlayers = {} + tsOrderedPlayerCount = 0 + for _,params in ipairs(tsOrderedPlayers) do + if not inserted and ts > params[1] then + tsOrderedPlayerCount = tsOrderedPlayerCount + 1 + newTsOrderedPlayers[tsOrderedPlayerCount] = {ts, playerID, teamID, spec} + inserted = true + end + tsOrderedPlayerCount = tsOrderedPlayerCount + 1 + newTsOrderedPlayers[tsOrderedPlayerCount] = params + end + if not inserted then + tsOrderedPlayerCount = tsOrderedPlayerCount + 1 + newTsOrderedPlayers[tsOrderedPlayerCount] = {ts, playerID, teamID, spec } + end + tsOrderedPlayers = deepcopy(newTsOrderedPlayers) +end + +function tsOrderPlayers() + local playersList = Spring.GetPlayerList() + for _,playerID in ipairs(playersList) do + local _,_,spec,teamID = Spring.GetPlayerInfo(playerID,false) + if playersTS[playerID] ~= nil then + addPlayerTsOrdered(playersTS[playerID], playerID, teamID, spec) + end + end +end + +function GetSkill(playerID) + local customtable = select(11,Spring.GetPlayerInfo(playerID)) -- player custom table + local tsMu = customtable.skill + local tskill = "" + if tsMu then + tskill = tsMu and tonumber(tsMu:match("%d+%.?%d*")) or 0 + end + return tskill +end + + +function SelectTrackingPlayer(playerID) + local newTrackedPlayer + if playerID then + newTrackedPlayer = playerID + else + local highestTs = 0 + local playersList = Spring.GetPlayerList() + for _,playerID in ipairs(playersList) do + local _,active,spec = Spring.GetPlayerInfo(playerID,false) + if not spec and active then + if playersTS[playerID] ~= nil and playersTS[playerID] > highestTs then + highestTs = playersTS[playerID] + newTrackedPlayer = playerID + end + end + end + end + if newTrackedPlayer ~= nil and newTrackedPlayer ~= currentTrackedPlayer then + currentTrackedPlayer = newTrackedPlayer + + if WG['advplayerlist_api'] ~= nil and WG['advplayerlist_api'].SetLockPlayerID ~= nil then + WG['advplayerlist_api'].SetLockPlayerID(currentTrackedPlayer) + end + end +end + +function createCountdownLists() + --if parentPos ~= nil then + for i=1,#drawlistsCountdown do + gl.DeleteList(drawlistsCountdown[i]) + end + drawlistsCountdown = {} + local i = 0 + local leftPadding = 7.5*widgetScale + while i < playerChangeDelay do + drawlistsCountdown[i] = gl.CreateList(function() + font:Begin() + font:SetTextColor(0,0,0,0.6) + font:Print(i, leftPadding+left-(0.7*widgetScale), bottom+(7*widgetScale), fontSize*widgetScale, 'n') + font:Print(i, leftPadding+left+(0.7*widgetScale), bottom+(7*widgetScale), fontSize*widgetScale, 'n') + font:SetTextColor(0.8,0.8,0.8,1) + font:Print(i, leftPadding+left, bottom+(8*widgetScale), fontSize*widgetScale, 'n') + font:End() + end) + i = i + 1 + end + --end +end + +local function DrawRectRound(px,py,sx,sy,cs) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- top right + if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +local function createList() + for i=1,#drawlist do + gl.DeleteList(drawlist[i]) + end + drawlist[1] = gl.CreateList( function() + --glColor(0, 0, 0, 0.66) + --RectRound(left, bottom, right, top, 5.5*widgetScale) + -- + --local borderPadding = 2.75*widgetScale + --glColor(1,1,1,0.025) + --RectRound(left+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) + local fontSize = (widgetHeight*widgetScale) * 0.5 + local text = ' cancel camera ' + local color = '\255\255\222\222' + if not toggled and not lockPlayerID then + text = ' Player TV ' + color = '\255\222\255\222' + gl.Color(0, 0.5, 0, 0.66) + else + gl.Color(0.66, 0, 0, 0.66) + end + local textWidth = font:GetTextWidth(text) * fontSize + RectRound(right-textWidth, bottom, right, top, 5.5*widgetScale) + toggleButton = {right-textWidth, bottom, right, top } + + local borderPadding = 2.75*widgetScale + gl.Color(0,0,0,0.18) + RectRound(right-textWidth+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) + + font:Begin() + font:Print(color..text, right-(textWidth/2), bottom+(8*widgetScale), fontSize, 'oc') + + if toggled then + local name = 'Player TV ' + local fontSize = (widgetHeight*widgetScale) * 0.6 + local vpos = bottom+(5.5*widgetScale) + font:SetTextColor(0,0,0,0.6) + font:Print(name, right-textWidth-(0.7*widgetScale), vpos, fontSize, 'rn') + font:Print(name, right-textWidth+(0.7*widgetScale), vpos, fontSize, 'rn') + font:SetTextColor(1,1,1,1) + font:Print(name, right-textWidth, vpos+(1*widgetScale), fontSize, 'rn') + end + font:End() + end) + drawlist[2] = gl.CreateList( function() + if toggled or lockPlayerID then + gl.Color(1, 0.2, 0.2, 0.4) + else + gl.Color(0.2, 1, 0.2, 0.4) + end + RectRound(toggleButton[1], toggleButton[2], toggleButton[3], toggleButton[4], 5.5*widgetScale) + + local borderPadding = 2.75*widgetScale + gl.Color(0,0,0,0.14) + RectRound(toggleButton[1]+borderPadding, toggleButton[2]+borderPadding, toggleButton[3]-borderPadding, toggleButton[4]-borderPadding, 4.4*widgetScale) + + local text = ' cancel camera ' + local color = '\255\255\222\222' + if not toggled and not lockPlayerID then + text = ' Player TV ' + color = '\255\222\255\222' + end + local fontSize = (widgetHeight*widgetScale) * 0.5 + local textWidth = font:GetTextWidth(text) * fontSize + font:Begin() + font:Print(color..text, toggleButton[3]-(textWidth/2), toggleButton[2]+(8*widgetScale), fontSize, 'oc') + font:End() + end) + + if WG['guishader'] and isSpec then + if backgroundGuishader then + gl.DeleteList(backgroundGuishader) + end + backgroundGuishader = gl.CreateList( function() + RectRound(toggleButton[1], toggleButton[2], toggleButton[3], toggleButton[4], 5.5*widgetScale) + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'playertv') + end +end + + + +function updatePosition(force) + prevPos = parentPos + if (WG['advplayerlist_api'] ~= nil) then + if WG['displayinfo'] ~= nil then + parentPos = WG['displayinfo'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + elseif WG['music'] ~= nil then + parentPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + else + parentPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + end + end + + if parentPos[1] then + left = parentPos[2] + bottom = parentPos[1] + right = parentPos[4] + top = parentPos[1]+(widgetHeight*parentPos[5]) + widgetScale = parentPos[5] + + if (prevPos[1] == nil or prevPos[1] ~= parentPos[1] or prevPos[2] ~= parentPos[2] or prevPos[5] ~= parentPos[5]) or force then + createCountdownLists() + createList() + end + end +end + + +function widget:Initialize() + isSpec = Spring.GetSpectatingState() + if WG['advplayerlist_api'] == nil then + Spring.Echo("Top TS camera tracker: AdvPlayerlist not found! ...exiting") + widgetHandler:RemoveWidget(self) + return + end + + local humanPlayers = 0 + local playersList = Spring.GetPlayerList() + for _,playerID in ipairs(playersList) do + local _,active,spec,team = Spring.GetPlayerInfo(playerID,false) + if not spec then + playersTS[playerID] = GetSkill(playerID) + if not select(3,Spring.GetTeamInfo(team,false)) and not select(4,Spring.GetTeamInfo(team,false)) then + humanPlayers = humanPlayers + 1 + end + end + end + if humanPlayers == 0 then + widgetHandler:RemoveWidget(self) + return + end + + tsOrderPlayers() + + updatePosition() + WG['playertv'] = {} + WG['playertv'].GetPosition = function() + return {top,left,bottom,right,widgetScale} + end + WG['playertv'].isActive = function() + return (toggled and isSpec) + end + WG['playertv'].GetPlayerChangeDelay = function() + return playerChangeDelay + end + WG['playertv'].SetPlayerChangeDelay = function(value) + playerChangeDelay = value + createCountdownLists() + end +end + + +function widget:GameStart() + isSpec = Spring.GetSpectatingState() + nextTrackingPlayerChange = os.clock() + tsOrderPlayers() + if isSpec and not rejoining and toggled then + SelectTrackingPlayer() + end +end + + +function widget:PlayerChanged(playerID) + isSpec = Spring.GetSpectatingState() + tsOrderPlayers() + if not rejoining then + if playerID == currentTrackedPlayer then + SelectTrackingPlayer() + end + end +end + +local passedTime = 1 +function widget:Update(dt) + passedTime = passedTime + dt + if passedTime > 0.1 then + passedTime = 0 + updatePosition() + end + if isSpec and Spring.GetGameFrame() > 0 and not rejoining then + if WG['tooltip'] and not toggled and not lockPlayerID then + mx,my,mb = Spring.GetMouseState() + if toggleButton ~= nil and isInBox(mx, my, toggleButton) then + WG['tooltip'].ShowTooltip('playertv', 'Auto camera-track of mostly top TS players\n(switches player every '..playerChangeDelay..' seconds)') + end + end + if (not rejoining and toggled) then + if Spring.GetGameFrame() > initGameframe+70 and os.clock() > nextTrackingPlayerChange then --delay some gameframes so we know if we're rejoining or not + nextTrackingPlayerChange = os.clock() + playerChangeDelay + local scope = 1 + math.floor(1 + tsOrderedPlayerCount/2) + if tsOrderedPlayerCount <= 2 then + scope = 2 + elseif tsOrderedPlayerCount <= 6 then + scope = 1 + math.floor(1 + tsOrderedPlayerCount/1.5) + elseif tsOrderedPlayerCount <= 10 then + scope = 1 + math.floor(1 + tsOrderedPlayerCount/1.75) + end + local orderID = math.random(1,scope) + + local r = math.random() + orderID = 1 + math.floor((r * (r*r)) * scope) + if orderID == prevOrderID then -- prevent same player POV again + orderID = orderID - 1 + if orderID < 1 then + orderID = 2 + end + end + prevorderID = orderID + if tsOrderedPlayers[orderID] then + SelectTrackingPlayer(tsOrderedPlayers[orderID][2]) + end + end + end + end +end + +function widget:GameFrame(n) + if WG['topbar'] then + local prevRejoining = rejoining + rejoining = WG['topbar'].showingRejoining() + end + if isSpec and toggled and n % 30 == 5 then + if rejoining and prevRejoining ~= rejoining then + SelectTrackingPlayer() + elseif rejoining and WG['advplayerlist_api'].GetLockPlayerID() ~= nil then + WG['advplayerlist_api'].SetLockPlayerID() + end + prevGameframeClock = os.clock() + + if currentTrackedPlayer ~= nil and not rejoining then + local _,active,spec = Spring.GetPlayerInfo(currentTrackedPlayer,false) + if not active or spec then + SelectTrackingPlayer() + end + end + end +end + +function isInBox(mx, my, box) + if (WG['topbar'] and WG['topbar'].showingQuit()) then + return false + else + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] + end +end + +function widget:MousePress(mx, my, mb) + if isSpec and mb == 1 and (Spring.GetGameFrame() > 0 or lockPlayerID) then + if toggleButton ~= nil and isInBox(mx, my, toggleButton) then + prevorderID = nil + currentTrackedPlayer = nil + if toggled or lockPlayerID then + toggled = false + WG['advplayerlist_api'].SetLockPlayerID() + lockPlayerID = nil + prevLockPlayerID = nil + createList() + elseif not rejoining then + toggled = true + nextTrackingPlayerChange = os.clock()-1 + createList() + end + end + end +end + +function widget:ViewResize(newX,newY) + vsx, vsy = Spring.GetViewGeometry() + widgetScale = (0.7 + (vsx*vsy / 5000000)) + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + createCountdownLists() +end + + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if not isSpec then return end + + local gameFrame = Spring.GetGameFrame() + + if (rejoining or gameFrame == 0) and not lockPlayerID then + if WG['guishader'] then + WG['guishader'].DeleteDlist('playertv') + end + --return + end + + if gameFrame > 0 or lockPlayerID then + if drawlist[1] then + gl.PushMatrix() + gl.CallList(drawlist[1]) + gl.PopMatrix() + mx,my,mb = Spring.GetMouseState() + if toggleButton ~= nil and isInBox(mx, my, toggleButton) then + gl.CallList(drawlist[2]) + end + end + end + + if toggled and not rejoining and gameFrame > 0 then + local countDown = math.floor(nextTrackingPlayerChange - os.clock()) + if drawlistsCountdown[countDown] ~= nil then + gl.PushMatrix() + gl.CallList(drawlistsCountdown[countDown]) + gl.PopMatrix() + end + end + if displayPlayername then + if WG['advplayerlist_api'] then + if lockPlayerID == nil or lockPlayerID ~= WG['advplayerlist_api'].GetLockPlayerID() then + lockPlayerID = WG['advplayerlist_api'].GetLockPlayerID() + if not toggled and prevLockPlayerID ~= lockPlayerID then + createList() + prevLockPlayerID = lockPlayerID + end + if lockPlayerID and not drawlistsPlayername[lockPlayerID] then + drawlistsPlayername[lockPlayerID] = gl.CreateList( function() + local name,_,spec,teamID,_,_,_,_,_ = Spring.GetPlayerInfo(lockPlayerID,false) + local fontSize = 31 * widgetScale + local nameColourR,nameColourG,nameColourB = 1,1,1 + if not spec then + nameColourR,nameColourG,nameColourB,_ = Spring.GetTeamColor(teamID) + end + local posX = vsx * 0.5 + local posY = vsy * 0.095 + + font:Begin() + font:SetTextColor(nameColourR,nameColourG,nameColourB,1) + if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then + font:SetOutlineColor(1,1,1,1) + else + font:SetOutlineColor(0,0,0,1) + end + font:Print(name, posX, posY, fontSize, "con") + font:End() + end) + end + end + end + if lockPlayerID and drawlistsPlayername[lockPlayerID] then + gl.PushMatrix() + gl.CallList(drawlistsPlayername[lockPlayerID]) + gl.PopMatrix() + end + end +end + + +function widget:Shutdown() + for i=1,#drawlistsCountdown do + gl.DeleteList(drawlistsCountdown[i]) + end + for i,v in pairs(drawlistsPlayername) do + gl.DeleteList(drawlistsPlayername[i]) + end + if WG['guishader'] then + WG['guishader'].DeleteDlist('playertv') + end + for i=1,#drawlist do + gl.DeleteList(drawlist[i]) + end + gl.DeleteFont(font) + if toggled then + WG['advplayerlist_api'].SetLockPlayerID() + end +end + + +function widget:GetConfigData(data) + savedTable = {} + savedTable.toggled = toggled + savedTable.playerChangeDelay = playerChangeDelay + return savedTable +end + +function widget:SetConfigData(data) + if Spring.GetGameFrame() > 0 and data.toggled ~= nil then + toggled = data.toggled + end + if data.playerChangeDelay then + playerChangeDelay = data.playerChangeDelay + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/camera_shake.lua b/LuaUI/Widgets_Evo/camera_shake.lua index 44e308e9e..52ce40b08 100644 --- a/LuaUI/Widgets_Evo/camera_shake.lua +++ b/LuaUI/Widgets_Evo/camera_shake.lua @@ -70,6 +70,10 @@ function widget:ShockFront(power, dx, dy, dz) power = 10 end shake = shake + power + if shake > 0.05 then + shake = 0.05 + end + --Spring.Echo ("Shake Power is " .. shake) end diff --git a/LuaUI/Widgets_Evo/chili/controls/control.lua b/LuaUI/Widgets_Evo/chili/controls/control.lua index 8d69c3d2f..f2de5e8ee 100644 --- a/LuaUI/Widgets_Evo/chili/controls/control.lua +++ b/LuaUI/Widgets_Evo/chili/controls/control.lua @@ -20,6 +20,10 @@ -- @int[opt=1e9] maxWidth maximum width -- @int[opt=1e9] maxHeight maximum height -- @tparam {func1,fun2,...} OnResize table of function listeners for size changes, (default {}) + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + Control = Object:Inherit{ classname = 'control', padding = {5, 5, 5, 5}, @@ -50,7 +54,7 @@ Control = Object:Inherit{ tooltip = nil, --// JUST TEXT font = { - font = "FreeSansBold.otf", + font = fontfile2, size = 14, shadow = false, outline = false, diff --git a/LuaUI/Widgets_Evo/chili/controls/font.lua b/LuaUI/Widgets_Evo/chili/controls/font.lua index 37750f837..f8cfcf4aa 100644 --- a/LuaUI/Widgets_Evo/chili/controls/font.lua +++ b/LuaUI/Widgets_Evo/chili/controls/font.lua @@ -13,10 +13,14 @@ -- @tparam {r,g,b,a} color color table (default {1,1,1,1}) -- @tparam {r,g,b,a} outlineColor outlineColor table (default {0,0,0,1}) -- @bool[opt=true] autoOutlineColor ?? + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + Font = Object:Inherit{ classname = 'font', - font = "FreeSansBold.otf", + font = fontfile, size = 12, outlineWidth = 3, outlineWeight = 3, @@ -54,7 +58,8 @@ end function Font:_LoadFont() local oldfont = self._font - self._font = FontHandler.LoadFont(self.font,self.size,self.outlineWidth,self.outlineWeight) + local uiScale = (WG and WG.uiScale or 1) + self._font = FontHandler.LoadFont(self.font,math.floor(self.size*uiScale),math.floor(self.outlineWidth*uiScale),self.outlineWeight) --// do this after LoadFont because it can happen that LoadFont returns the same font again --// but if we Unload our old one before, the gc could collect it before, so the engine would have to reload it again FontHandler.UnloadFont(oldfont) diff --git a/LuaUI/Widgets_Evo/chili/core.lua b/LuaUI/Widgets_Evo/chili/core.lua index 19c7ccd3b..2465b8c31 100644 --- a/LuaUI/Widgets_Evo/chili/core.lua +++ b/LuaUI/Widgets_Evo/chili/core.lua @@ -46,7 +46,7 @@ local includes = { local Chili = widget -Chili.CHILI_DIRNAME = CHILI_DIRNAME or (LUAUI_DIRNAME .. "Widgets/chili/") +Chili.CHILI_DIRNAME = CHILI_DIRNAME or (LUAUI_DIRNAME .. "Widgets_Evo/chili/") Chili.SKIN_DIRNAME = SKIN_DIRNAME or (CHILI_DIRNAME .. "skins/") if (-1>0) then diff --git a/LuaUI/Widgets_Evo/chili/simple examples/Widgets/gui_chiligui.lua b/LuaUI/Widgets_Evo/chili/simple examples/Widgets/gui_chiligui.lua index 463c4437f..3fb1815f0 100644 --- a/LuaUI/Widgets_Evo/chili/simple examples/Widgets/gui_chiligui.lua +++ b/LuaUI/Widgets_Evo/chili/simple examples/Widgets/gui_chiligui.lua @@ -36,7 +36,14 @@ WG.Chili.Screen0 = screen0 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if (not th) then th = Chili.TextureHandler th.Initialize() diff --git a/LuaUI/Widgets_Evo/chili/skins/Evolved/skin.lua b/LuaUI/Widgets_Evo/chili/skins/Evolved/skin.lua index 3141cc708..92d0fd4f3 100644 --- a/LuaUI/Widgets_Evo/chili/skins/Evolved/skin.lua +++ b/LuaUI/Widgets_Evo/chili/skins/Evolved/skin.lua @@ -9,12 +9,15 @@ local skin = { } } +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + --//============================================================================= --// skin.general = { - --font = "FreeSansBold.ttf", - fontOutline = false, + font = fontfile2, + fontOutline = true, fontsize = 13, textColor = {1,1,1,1}, diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.png b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.png new file mode 100644 index 000000000..db0e82845 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.psp new file mode 100644 index 000000000..fef5799da Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_.png b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_.png new file mode 100644 index 000000000..768072220 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_arrow.png b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_arrow.png new file mode 100644 index 000000000..8a8222e33 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/checkbox_arrow.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_ctrl_arrow.png b/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_ctrl_arrow.png new file mode 100644 index 000000000..7c9331b9c Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_ctrl_arrow.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_wnd.png b/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_wnd.png new file mode 100644 index 000000000..5b09522e8 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/combobox_wnd.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glass.png new file mode 100644 index 000000000..3b9cac257 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.png new file mode 100644 index 000000000..dda708c01 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.psp new file mode 100644 index 000000000..934973254 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass2.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glassBK.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glassBK.png new file mode 100644 index 000000000..840293faa Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glassBK.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glassButton.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/glassButton.psp new file mode 100644 index 000000000..56134f9ff Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glassButton.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glassFG.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glassFG.png new file mode 100644 index 000000000..30029e7fe Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glassFG.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass_.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_.png new file mode 100644 index 000000000..c0c592bb6 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line.png new file mode 100644 index 000000000..6b61f09be Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line_vert.png b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line_vert.png new file mode 100644 index 000000000..6d835251e Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/glass_line_vert.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/hscrollbar.png b/LuaUI/Widgets_Evo/chili/skins/Lima/hscrollbar.png new file mode 100644 index 000000000..65ef19e3d Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/hscrollbar.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/itemlistview_item_fg.png b/LuaUI/Widgets_Evo/chili/skins/Lima/itemlistview_item_fg.png new file mode 100644 index 000000000..4c0f1f640 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/itemlistview_item_fg.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/node_selected.png b/LuaUI/Widgets_Evo/chili/skins/Lima/node_selected.png new file mode 100644 index 000000000..0c6509080 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/node_selected.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/panel.png b/LuaUI/Widgets_Evo/chili/skins/Lima/panel.png new file mode 100644 index 000000000..57eb1b046 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/panel.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/panel.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/panel.psp new file mode 100644 index 000000000..234ea8601 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/panel.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/panel_.png b/LuaUI/Widgets_Evo/chili/skins/Lima/panel_.png new file mode 100644 index 000000000..766bff3c3 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/panel_.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/porgressbar_empty.png b/LuaUI/Widgets_Evo/chili/skins/Lima/porgressbar_empty.png new file mode 100644 index 000000000..e2bd11a57 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/porgressbar_empty.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_empty.png b/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_empty.png new file mode 100644 index 000000000..f2dc6213f Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_empty.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_full.png b/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_full.png new file mode 100644 index 000000000..45c88870e Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/progressbar_full.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar.png b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar.png new file mode 100644 index 000000000..f1d0fada5 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.png b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.png new file mode 100644 index 000000000..620c149c9 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.psp new file mode 100644 index 000000000..b185fbcc0 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/scrollbar_knob.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/skin.lua b/LuaUI/Widgets_Evo/chili/skins/Lima/skin.lua new file mode 100644 index 000000000..4f824ed68 --- /dev/null +++ b/LuaUI/Widgets_Evo/chili/skins/Lima/skin.lua @@ -0,0 +1,232 @@ +--//============================================================================= +--// LimaSkin + +local skin = { + info = { + name = "Lima", + version = "0.1", + author = "Adrianulima", + } +} + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + +--//============================================================================= +--// + +skin.general = { + font = "JosefinSans-SemiBold.ttf", + fontsize = 13, + textColor = {1.0, 1.0, 1.0, 1.0}, + focusColor = {0.35, 0.35, 1.0, 0.9}, + borderColor = {1.0, 1.0, 1.0, 1.0}, + + --padding = {5, 5, 5, 5}, --// padding: left, top, right, bottom + backgroundColor = {0.1, 0.1, 0.1, 0.7}, + + font = { + outlineColor = {0,0,0,0.7}, + --autoOutlineColor = false, + shadow = true, + }, +} + +skin.icons = { + imageplaceholder = ":cl:placeholder.png", +} + +skin.button = { + TileImageFG = ":cl:glassFG.png", + TileImageBK = ":cl:glassBK.png", + tiles = {6,6,6,6}, + + textColor = {1,1,1,1}, + + padding = {5, 5, 5, 5}, + backgroundColor = {1, 1, 1, 1}, + focusColor = {1, 1, 1, 0.9}, + + DrawControl = DrawButton, +} + + +skin.combobox = { + TileImageFG = ":cl:glassFG.png", + TileImageBK = ":cl:glassBK.png", + TileImageArrow = ":cl:combobox_ctrl_arrow.png", + tiles = {6,6,6,6}, + padding = {10, 10, 26, 10}, + + textColor = {1,1,1,1}, + backgroundColor = {0.1, 0.1, 0.1, 0.7}, + + DrawControl = DrawComboBox, +} + + +skin.combobox_window = { + clone = "window"; + TileImage = ":cl:combobox_wnd.png", + padding = {4, 3, 3, 4}; +} + + +skin.combobox_scrollpanel = { + clone = "scrollpanel"; + borderColor = {1, 1, 1, 0}; + padding = {0, 0, 0, 0}; +} + + +skin.combobox_item = { + clone = "button"; +} + + +skin.editbox = { + textColor = {1.0, 1.0, 1.0, 1.0}, + backgroundColor = {0.1, 0.1, 0.1, 0.7}, + cursorColor = {0.35, 0.35, 1.0, 0.9}, +} + +skin.checkbox = { + TileImageFG = ":cl:checkbox_arrow.png", + TileImageBK = ":cl:checkbox.png", + tiles = {3,3,3,3}, + boxsize = 13, + + DrawControl = DrawCheckbox, +} + + +skin.imagelistview = { + imageFolder = "folder.png", + imageFolderUp = "folder_up.png", + + --DrawControl = DrawBackground, + + colorFG = {0.75,0.75,0.75,0.65}, + colorFG_selected = {1,1,1,0.65}, + imageFG = ":cl:itemlistview_item_fg.png", + + colorBK = {0.5, 0.5, 0.5, 0.1}, + colorBK_selected = {0.35,0.35,1,0.9}, + imageBK = ":cl:glassBK.png", + + tiles = {6,6,6,6}, + + DrawItemBackground = DrawItemBkGnd, +} +--[[ +skin.imagelistviewitem = { + imageFG = ":cl:glassFG.png", + imageBK = ":cl:glassBK.png", + tiles = {17,15,17,20}, + + padding = {12, 12, 12, 12}, + + DrawSelectionItemBkGnd = DrawSelectionItemBkGnd, +} +--]] + +skin.panel = { + TileImageFG = ":cl:glassFG.png", + TileImageBK = ":cl:glassBK.png", + tiles = {6,6,6,6}, + + DrawControl = DrawPanel, +} + +skin.progressbar = { + TileImageFG = ":cl:progressbar_full.png", + TileImageBK = ":cl:progressbar_empty.png", + tiles = {3,3,3,3}, + + DrawControl = DrawProgressbar, +} + +skin.scrollpanel = { + BorderTileImage = ":cl:panel.png", + bordertiles = {14,10,14,8}, + + TileImage = ":cl:scrollbar.png", + tiles = {6,3,6,3}, + KnobTileImage = ":cl:scrollbar_knob.png", + KnobTiles = {6,7,6,7}, + + HTileImage = ":cl:hscrollbar.png", + htiles = {3,6,3,6}, + HKnobTileImage = ":cl:scrollbar_knob.png", + HKnobTiles = {6,7,6,9}, + + KnobColorSelected = {0.35, 0.35, 1.0, 0.9}, + + padding = {1,1,1,1}, + + scrollbarSize = 11, + DrawControl = DrawScrollPanel, + DrawControlPostChildren = DrawScrollPanelBorder, +} + +skin.trackbar = { + TileImage = ":cl:trackbar.png", + tiles = {6, 3, 6, 3}, --// tile widths: left,top,right,bottom + + ThumbImage = ":cl:trackbar_thumb.png", + StepImage = ":cl:trackbar_step.png", + + hitpadding = {4, 4, 4, 4}, + + DrawControl = DrawTrackbar, +} + +skin.treeview = { + ImageNodeSelected = ":cl:node_selected.png", + tiles = {10,9,10,22}, + + ImageExpanded = ":cl:treeview_node_expanded.png", + ImageCollapsed = ":cl:treeview_node_collapsed.png", + treeColor = {0,0,0,0.4}, + + DrawNode = DrawTreeviewNode, + DrawNodeTree = DrawTreeviewNodeTree, +} + +skin.window = { + TileImage = ":cl:glass_.png", + tiles = {6, 6, 6, 6}, --// tile widths: left,top,right,bottom + padding = {5, 5, 5, 5}, + hitpadding = {0, 0, 0, 0}, + + captionColor = {0, 0, 0, 0.55}, + + boxes = { + resize = {-25, -25, -14, -14}, + drag = {0, 0, "100%", 24}, + }, + + NCHitTest = NCHitTestWithPadding, + NCMouseDown = WindowNCMouseDown, + NCMouseDownPostChildren = WindowNCMouseDownPostChildren, + + DrawControl = DrawWindow, + DrawDragGrip = DrawDragGrip, + DrawResizeGrip = DrawResizeGrip, +} + +skin.line = { + TileImage = ":cl:glass_line.png", + tiles = {0, 0, 0, 0}, + TileImageV = ":cl:glass_line_vert.png", + tilesV = {0, 0, 0, 0}, + DrawControl = DrawLine, +} + +skin.control = skin.general + + +--//============================================================================= +--// + +return skin diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar.png b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar.png new file mode 100644 index 000000000..3e3adcc5a Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_step.png b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_step.png new file mode 100644 index 000000000..aeaeb77b2 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_step.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_thumb.png b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_thumb.png new file mode 100644 index 000000000..ba1b9dfd1 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/trackbar_thumb.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node.psp new file mode 100644 index 000000000..0842074e4 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node2.psp b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node2.psp new file mode 100644 index 000000000..211d719a9 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node2.psp differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_collapsed.png b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_collapsed.png new file mode 100644 index 000000000..4976cb2d6 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_collapsed.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_expanded.png b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_expanded.png new file mode 100644 index 000000000..b09fac6f1 Binary files /dev/null and b/LuaUI/Widgets_Evo/chili/skins/Lima/treeview_node_expanded.png differ diff --git a/LuaUI/Widgets_Evo/chili/skins/Robocracy/skin.lua b/LuaUI/Widgets_Evo/chili/skins/Robocracy/skin.lua index 06fceffdc..e45ba8f70 100644 --- a/LuaUI/Widgets_Evo/chili/skins/Robocracy/skin.lua +++ b/LuaUI/Widgets_Evo/chili/skins/Robocracy/skin.lua @@ -9,6 +9,9 @@ local skin = { } } +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + --//============================================================================= --// @@ -17,7 +20,7 @@ skin.general = { borderColor = {1.0, 1.0, 1.0, 1.0}, font = { - font = SKINDIR .. "fonts/n019003l.pfb", + font = fontfile, color = {1,1,1,1}, outlineColor = {0.05,0.05,0.05,0.9}, outline = false, diff --git a/LuaUI/Widgets_Evo/chili/skins/default/skin.lua b/LuaUI/Widgets_Evo/chili/skins/default/skin.lua index 831d378d4..27eb44ac8 100644 --- a/LuaUI/Widgets_Evo/chili/skins/default/skin.lua +++ b/LuaUI/Widgets_Evo/chili/skins/default/skin.lua @@ -9,6 +9,9 @@ local skin = { } } +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + --//============================================================================= --// Render Helpers @@ -604,12 +607,12 @@ end --// skin.general = { - --font = "FreeSansBold.ttf", + font = fontfile2, textColor = {0,0,0,1}, font = { - outlineColor = {0,0,0,0.5}, - outline = false, + outlineColor = {0,0,0,0.7}, + outline = true, size = 13, }, diff --git a/LuaUI/Widgets_Evo/chili/themes/theme.lua b/LuaUI/Widgets_Evo/chili/themes/theme.lua index eb135eaef..0b80304b8 100644 --- a/LuaUI/Widgets_Evo/chili/themes/theme.lua +++ b/LuaUI/Widgets_Evo/chili/themes/theme.lua @@ -3,13 +3,13 @@ theme = {} -theme.name = "Evolved" +theme.name = "Lima" --//============================================================================= --// Define default skins -local defaultSkin = "Evolved" +local defaultSkin = "Lima" --local defaultSkin = "DarkGlass" theme.skin = { diff --git a/LuaUI/Widgets_Evo/cmd_customformations2.lua b/LuaUI/Widgets_Evo/cmd_customformations2.lua index 582d3b463..8be38a84d 100644 --- a/LuaUI/Widgets_Evo/cmd_customformations2.lua +++ b/LuaUI/Widgets_Evo/cmd_customformations2.lua @@ -157,8 +157,6 @@ local spFindUnitCmdDesc = Spring.FindUnitCmdDesc local spGetModKeyState = Spring.GetModKeyState local spGetInvertQueueKey = Spring.GetInvertQueueKey local spIsAboveMiniMap = Spring.IsAboveMiniMap -local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount -local spGetSelectedUnits = Spring.GetSelectedUnits local spGetUnitDefID = Spring.GetUnitDefID local spGiveOrder = Spring.GiveOrder local spGetUnitIsTransporting = Spring.GetUnitIsTransporting @@ -173,6 +171,7 @@ local spGetCameraPosition = Spring.GetCameraPosition local spGetViewGeometry = Spring.GetViewGeometry local spTraceScreenRay = Spring.TraceScreenRay + local mapSizeX, mapSizeZ = Game.mapSizeX, Game.mapSizeZ local maxUnits = Game.maxUnits @@ -192,7 +191,6 @@ local CMD_MOVE = CMD.MOVE local CMD_ATTACK = CMD.ATTACK local CMD_UNLOADUNIT = CMD.UNLOAD_UNIT local CMD_UNLOADUNITS = CMD.UNLOAD_UNITS -local CMD_SET_WANTED_MAX_SPEED = CMD.SET_WANTED_MAX_SPEED local CMD_OPT_ALT = CMD.OPT_ALT local CMD_OPT_CTRL = CMD.OPT_CTRL local CMD_OPT_META = CMD.OPT_META @@ -200,6 +198,8 @@ local CMD_OPT_SHIFT = CMD.OPT_SHIFT local CMD_OPT_RIGHT = CMD.OPT_RIGHT local keyShift = 304 +local selectedUnits = Spring.GetSelectedUnits() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() -------------------------------------------------------------------------------- -- Helper Functions @@ -269,9 +269,8 @@ local function CanUnitExecute(uID, cmdID) end local function GetExecutingUnits(cmdID) local units = {} - local selUnits = spGetSelectedUnits() - for i = 1, #selUnits do - local uID = selUnits[i] + for i = 1, selectedUnitsCount do + local uID = selectedUnits[i] if CanUnitExecute(uID, cmdID) then units[#units + 1] = uID end @@ -433,6 +432,12 @@ local function GiveNotifyingOrderToUnit(uID, cmdID, cmdParams, cmdOpts) spGiveOrderToUnit(uID, cmdID, cmdParams, cmdOpts.coded) end + +function widget:SelectionChanged(sel) + selectedUnits = sel + selectedUnitsCount = Spring.GetSelectedUnitsCount() +end + -------------------------------------------------------------------------------- -- Mouse/keyboard Callins -------------------------------------------------------------------------------- @@ -505,13 +510,12 @@ function widget:MousePress(mx, my, mButton) if not AddFNode(pos) then return false end -- Is this line a path candidate (We don't do a path off an overriden command) - pathCandidate = (not overriddenCmd) and (spGetSelectedUnitsCount()==1 or (alt and not requiresAlt[usingCmd])) + pathCandidate = (not overriddenCmd) and (selectedUnitsCount==1 or (alt and not requiresAlt[usingCmd])) -- We handled the mouse press return true end function widget:MouseMove(mx, my, dx, dy, mButton) - -- It is possible for MouseMove to fire after MouseRelease if #fNodes == 0 then return false @@ -663,24 +667,6 @@ function widget:MouseRelease(mx, my, mButton) end end end - - -- Move Speed (Applicable to every order) - local wantedSpeed = 99999 -- High enough to exceed all units speed, but not high enough to cause errors (i.e. vs math.huge) - - if ctrl then - local selUnits = spGetSelectedUnits() - for i = 1, #selUnits do - local uSpeed = UnitDefs[spGetUnitDefID(selUnits[i])].speed - if uSpeed > 0 and uSpeed < wantedSpeed then - wantedSpeed = uSpeed - end - end - end - - -- Directly giving speed order appears to work perfectly, including with shifted orders ... - -- ... But other widgets CMD.INSERT the speed order into the front (Posn 1) of the queue instead (which doesn't work with shifted orders) - local speedOpts = GetCmdOpts(alt, ctrl, meta, shift, true) - GiveNotifyingOrder(CMD_SET_WANTED_MAX_SPEED, {wantedSpeed / 30}, speedOpts) end if #fNodes > 1 then @@ -822,7 +808,14 @@ function widget:ViewResize(viewSizeX, viewSizeY) Xs, Ys = Xs*0.5, Ys*0.5 end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() + if chobbyInterface then return end -- Draw lines when a path is drawn instead of a formation, OR when drawmode for formations is not "dots" only if pathCandidate or options.drawmode.value ~= "dots" then DrawFormationLines(tVerts, 2) @@ -843,7 +836,6 @@ function widget:DrawWorld() zoomY = 6 end if lineLength > 0 then --don't try and draw if the command was cancelled by having two mouse buttons pressed at once - local unitCount = spGetSelectedUnitsCount() DrawFormationDots(tVerts, zoomY, unitCount) end end diff --git a/LuaUI/Widgets_Evo/cmd_mex_placement.lua b/LuaUI/Widgets_Evo/cmd_mex_placement.lua index f5b2c294d..c598c68e8 100644 --- a/LuaUI/Widgets_Evo/cmd_mex_placement.lua +++ b/LuaUI/Widgets_Evo/cmd_mex_placement.lua @@ -3,7 +3,7 @@ function widget:GetInfo() return { name = "Mex Placement Handler", desc = "Places mexes in the correct position DO NOT DISABLE", - author = "Google Frog with some from Niobium and Evil4Zerggin.", + author = "Google Frog, Niobium, Evil4Zerggin. Animated spritesheet support by Ivand, art by MaDDoX.", version = "v1", date = "22 April, 2012", --2 April 2013 license = "GNU GPL, v2 or later", @@ -14,7 +14,14 @@ function widget:GetInfo() end VFS.Include("LuaRules/Configs/customcmds.h.lua") -local font = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", 80, 8, 3) +VFS.Include("LuaRules/Utilities/glVolumes.lua") + +local fontfile = "JosefinSans-SemiBold.ttf" + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") + +local font = gl.LoadFont(fontfile, 80, 8, 3) ------------------------------------------------------------ -- Speedups @@ -29,16 +36,17 @@ local spGetUnitHealth = Spring.GetUnitHealth local spGetSelectedUnits = Spring.GetSelectedUnits local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc local spGiveOrderToUnit = Spring.GiveOrderToUnit -local spGetUnitPosition = Spring.GetUnitPosition +local spGetUnitPosition = Spring.GetUnitPosition local spGetTeamUnits = Spring.GetTeamUnits local spGetMyTeamID = Spring.GetMyTeamID local spTestBuildOrder = Spring.TestBuildOrder local spGetUnitsInRectangle = Spring.GetUnitsInRectangle -local spGiveOrder = Spring.GiveOrder +local spGiveOrder = Spring.GiveOrder local spGetGroundInfo = Spring.GetGroundInfo local spGetGroundHeight = Spring.GetGroundHeight local spGetMapDrawMode = Spring.GetMapDrawMode local spGetGameFrame = Spring.GetGameFrame +local spGetFrameTimeOffset = Spring.GetFrameTimeOffset local spGetSpectatingState = Spring.GetSpectatingState local spGetAllUnits = Spring.GetAllUnits local spGetPositionLosState = Spring.GetPositionLosState @@ -50,6 +58,8 @@ local glText = gl.Text local glGetTextWidth = gl.GetTextWidth local glPolygonMode = gl.PolygonMode local glDrawGroundCircle = gl.DrawGroundCircle +local glDrawGroundRect = gl.Utilities.DrawGroundRectangle +local glDrawCircle local glUnitShape = gl.UnitShape local glDepthTest = gl.DepthTest local glLighting = gl.Lighting @@ -75,7 +85,7 @@ local GL_GREATER = GL.GREATER local floor = math.floor local min, max = math.min, math.max local strFind = string.find -local strFormat = string.format +local strFormat = string.format local CMD_OPT_SHIFT = CMD.OPT_SHIFT @@ -98,7 +108,7 @@ local MAP_SIZE_Z = Game.mapSizeZ local MAP_SIZE_Z_SCALED = MAP_SIZE_Z / METAL_MAP_SQUARE_SIZE local allyMexColor = {[1] = {0, 1, 1, 0.7}, [2] = {0, 1, 1, 1}} -local neutralMexColor = {[1] = {1.0, 1.0, 1.0, 0.7}, [2] = {1.0, 1.0, 1.0, 1}} +local neutralMexColor = {[1] = {0.53, 0.77, 0.89, 1}, [2] = {0.53, 0.77, 0.89, 1}} local enemyMexColor = {[1] = {1, 0, 0, 0.7}, [2] = {1, 0, 0, 1}} local allyTeams = {} -- [id] = {team1, team2, ...} @@ -106,12 +116,87 @@ local allyTeams = {} -- [id] = {team1, team2, ...} local previousOsClock = os.clock() local currentRotationAngle = 0 local currentRotationAngleOpposite = 0 +local drawIncome = false -- Should we draw the income estimation? + +local minimapIconSizeMult = 0.0145 --0.0145 + +-- only used when animating a spreadsheet/atlas texture +local spotTexture = "bitmaps/default/metalshimmer_color9.dds" +local animRate = 1000 -- That's actually the reverse of animrate, the lower it is the faster the animation goes +local texturewidth = 40 --160 (actual in-game rect width) +local textureYoffset = 2 --10 (offset from the ground) +local numberOfImagesX = 16 +local numberOfImagesY = 16 + +-------------------- + +local animShader = nil +local animProgressLoc = -1 + +local animShaderVS = [[ + #version 150 compatibility + #line 100126 + + uniform ivec2 numImages; + uniform float animProgress; //0 to 1 + + out vec4 samplingBias; + out vec2 uv; + out float blendFactor; + + void main() { + float ap = fract(animProgress); //sanitize inputs + int maxImgIdx = numImages.x * numImages.y - 1; + ap *= float(maxImgIdx); + + int i0 = int(floor(ap)); + int i1 = i0 + 1; + blendFactor = fract(ap); + + samplingBias = vec4( + float(i0 / numImages.x), + float(i0 % numImages.x), + float(i1 / numImages.x), + float(i1 % numImages.x) + ); + + samplingBias /= vec4(numImages.xyxy); + uv = gl_MultiTexCoord0.xy / vec2(numImages.xy); + + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + } +]] + +local animShaderFS = [[ + #version 150 compatibility + #line 200161 + + uniform sampler2D colorAtlas; + uniform sampler2D normAtlas; + + in vec4 samplingBias; + in vec2 uv; + in float blendFactor; + + void main() { + vec4 c0 = texture(colorAtlas, samplingBias.xy + uv); + vec4 c1 = texture(colorAtlas, samplingBias.zw + uv); + + // unused yet + //vec4 n0 = texture(colorAtlas, samplingBias.xy + uv); + //vec4 n1 = texture(colorAtlas, samplingBias.zw + uv); + + gl_FragColor = mix(c0, c1, blendFactor); + } +]] + +-------------------- ------------------------------------------------------------ -- Config ------------------------------------------------------------ -local MINIMAP_DRAW_SIZE = math.max(mapX,mapZ) * 0.0145 +local MINIMAP_DRAW_SIZE = math.max(mapX,mapZ) * minimapIconSizeMult options_path = 'Settings/Interface/Map/Metal Spots' options_order = { 'drawicons', 'size', 'specPlayerColours', 'rounding'} @@ -119,16 +204,16 @@ options_order = { 'drawicons', 'size', 'specPlayerColours', 'rounding'} VFS.Include("LuaUI/Configs/LuaMex/options.lua") local circleOptions = { - enabled = true, - animating = true, -- its only rotation, but will cost more performance - alwaysshow = true, - innersize = 40, -- outersize-innersize = circle width - outersize = 43, -- outersize-innersize = circle width - circlePieces = 24, - circlePieceDetail = 1, - circleSpaceUsage = 0.45, - circleInnerOffset = 0.42, - rotationSpeed = 2.5, + enabled = true, + animating = true, -- its only rotation, but will cost more performance + alwaysshow = true, + innersize = 40, -- outersize-innersize = circle width + outersize = 43, -- outersize-innersize = circle width + circlePieces = 3, + circlePieceDetail = 5, + circleSpaceUsage = 0.45, + circleInnerOffset = 0.42, + rotationSpeed = 5, } ------------------------------------------------------------------------------------- @@ -137,18 +222,18 @@ local circleOptions = { local mexDefID = {} for udid, ud in pairs(UnitDefs) do - if ud.customParams.metal_extractor then - mexDefID[udid] = tonumber (ud.customParams.metal_extractor) - end + if ud.customParams.metal_extractor then + mexDefID[udid] = tonumber (ud.customParams.metal_extractor) + end end local mexBuilder = {} local mexBuilderDefs = {} -for udid, ud in ipairs(UnitDefs) do - if ud.customParams.area_mex_def then - mexBuilderDefs[udid] = UnitDefNames[ud.customParams.area_mex_def].id - end +for udid, ud in ipairs(UnitDefs) do + if ud.customParams.area_mex_def then + mexBuilderDefs[udid] = UnitDefNames[ud.customParams.area_mex_def].id + end end -------------------------------------------------------------------------------- @@ -167,359 +252,386 @@ local metalSpotsNil = true -- Functions ------------------------------------------------------------ local function GetNearestMex (x, z) - local units = Spring.GetUnitsInRectangle(x-1, z-1, x+1, z+1) - local myAlly = spGetMyAllyTeamID() - for i = 1, #units do - local unitID = units[i] - local unitDefID = Spring.GetUnitDefID(unitID) - if unitDefID and mexDefID[unitDefID] and spGetUnitAllyTeam(unitID) == myAlly then - return unitID - end - end + local units = Spring.GetUnitsInRectangle(x-1, z-1, x+1, z+1) + local myAlly = spGetMyAllyTeamID() + for i = 1, #units do + local unitID = units[i] + local unitDefID = Spring.GetUnitDefID(unitID) + if unitDefID and mexDefID[unitDefID] and spGetUnitAllyTeam(unitID) == myAlly then + return unitID + end + end end local function GetClosestMetalSpot(x, z) --is used by single mex placement, not used by areamex - local bestSpot - local bestDist = math.huge - local bestIndex - for i = 1, #WG.metalSpots do - local spot = WG.metalSpots[i] - local dx, dz = x - spot.x, z - spot.z - local dist = dx*dx + dz*dz - if dist < bestDist then - bestSpot = spot - bestDist = dist - bestIndex = i - end - end - return bestSpot, sqrt(bestDist), bestIndex + local bestSpot + local bestDist = math.huge + local bestIndex + for i = 1, #WG.metalSpots do + local spot = WG.metalSpots[i] + local dx, dz = x - spot.x, z - spot.z + local dist = dx*dx + dz*dz + if dist < bestDist then + bestSpot = spot + bestDist = dist + bestIndex = i + end + end + return bestSpot, sqrt(bestDist), bestIndex end local function Distance(x1,z1,x2,z2) - local dis = (x1-x2)*(x1-x2)+(z1-z2)*(z1-z2) - return dis + local dis = (x1-x2)*(x1-x2)+(z1-z2)*(z1-z2) + return dis end local function IntegrateMetal(x, z, forceUpdate) - local newCenterX, newCenterZ - - newCenterX = (floor( x / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE - newCenterZ = (floor( z / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE - - if (centerX == newCenterX and centerZ == newCenterZ and not forceUpdate) then - return - end - - centerX = newCenterX - centerZ = newCenterZ - - local startX = floor((centerX - MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) - local startZ = floor((centerZ - MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) - local endX = floor((centerX + MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) - local endZ = floor((centerZ + MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) - startX, startZ = max(startX, 0), max(startZ, 0) - endX, endZ = min(endX, MAP_SIZE_X_SCALED - 1), min(endZ, MAP_SIZE_Z_SCALED - 1) - - local mult = Spring.GetGameRulesParam("base_extraction") - local result = 0 - - for i = startX, endX do - for j = startZ, endZ do - local cx, cz = (i + 0.5) * METAL_MAP_SQUARE_SIZE, (j + 0.5) * METAL_MAP_SQUARE_SIZE - local dx, dz = cx - centerX, cz - centerZ - local dist = sqrt(dx * dx + dz * dz) - - if (dist < MEX_RADIUS) then - local _, metal = spGetGroundInfo(cx, cz) - result = result + metal - end - end - end - - extraction = result * mult + local newCenterX, newCenterZ + + newCenterX = (floor( x / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE + newCenterZ = (floor( z / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE + + if (centerX == newCenterX and centerZ == newCenterZ and not forceUpdate) then + return + end + + centerX = newCenterX + centerZ = newCenterZ + + local startX = floor((centerX - MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) + local startZ = floor((centerZ - MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) + local endX = floor((centerX + MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) + local endZ = floor((centerZ + MEX_RADIUS) / METAL_MAP_SQUARE_SIZE) + startX, startZ = max(startX, 0), max(startZ, 0) + endX, endZ = min(endX, MAP_SIZE_X_SCALED - 1), min(endZ, MAP_SIZE_Z_SCALED - 1) + + local mult = Spring.GetGameRulesParam("base_extraction") + local result = 0 + + for i = startX, endX do + for j = startZ, endZ do + local cx, cz = (i + 0.5) * METAL_MAP_SQUARE_SIZE, (j + 0.5) * METAL_MAP_SQUARE_SIZE + local dx, dz = cx - centerX, cz - centerZ + local dist = sqrt(dx * dx + dz * dz) + + if (dist < MEX_RADIUS) then + local _, metal, metal2 = spGetGroundInfo(cx, cz) + if type(metal) == 'string' then -- Spring > v104 + metal = metal2 + end + result = result + metal + end + end + end + + extraction = result * mult end local function DrawCircleLine(innersize, outersize) - gl.BeginEnd(GL.QUADS, function() - local detailPartWidth, a1,a2,a3,a4 - local width = circleOptions.circleSpaceUsage - local detail = circleOptions.circlePieceDetail - - local radstep = (2.0 * math.pi) / circleOptions.circlePieces - for i = 1, circleOptions.circlePieces do - for d = 1, detail do - - detailPartWidth = ((width / detail) * d) - a1 = ((i+detailPartWidth - (width / detail)) * radstep) - a2 = ((i+detailPartWidth) * radstep) - a3 = ((i+circleOptions.circleInnerOffset+detailPartWidth - (width / detail)) * radstep) - a4 = ((i+circleOptions.circleInnerOffset+detailPartWidth) * radstep) - - --outer (fadein) - gl.Vertex(math.sin(a4)*innersize, 0, math.cos(a4)*innersize) - gl.Vertex(math.sin(a3)*innersize, 0, math.cos(a3)*innersize) - --outer (fadeout) - gl.Vertex(math.sin(a1)*outersize, 0, math.cos(a1)*outersize) - gl.Vertex(math.sin(a2)*outersize, 0, math.cos(a2)*outersize) - end - end - end) + gl.BeginEnd(GL.QUADS, function() + local detailPartWidth, a1,a2,a3,a4 + local width = circleOptions.circleSpaceUsage + local detail = circleOptions.circlePieceDetail + + local radstep = (2.0 * math.pi) / circleOptions.circlePieces + for i = 1, circleOptions.circlePieces do + for d = 1, detail do + + detailPartWidth = ((width / detail) * d) + a1 = ((i+detailPartWidth - (width / detail)) * radstep) + a2 = ((i+detailPartWidth) * radstep) + a3 = ((i+circleOptions.circleInnerOffset+detailPartWidth - (width / detail)) * radstep) + a4 = ((i+circleOptions.circleInnerOffset+detailPartWidth) * radstep) + + --outer (fadein) + gl.Vertex(math.sin(a4)*innersize, 0, math.cos(a4)*innersize) + gl.Vertex(math.sin(a3)*innersize, 0, math.cos(a3)*innersize) + --outer (fadeout) + gl.Vertex(math.sin(a1)*outersize, 0, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2)*outersize, 0, math.cos(a2)*outersize) + end + end + end) end ------------------------------------------------------------ -- Command Handling ------------------------------------------------------------ -function widget:CommandNotify(cmdID, params, options) - if (cmdID == CMD_AREA_MEX and WG.metalSpots) then - - local cx, cy, cz, cr = params[1], params[2], params[3], math.max((params[4] or 60),60) - - local xmin = cx-cr - local xmax = cx+cr - local zmin = cz-cr - local zmax = cz+cr - - local commands = {} - local orderedCommands = {} - local dis = {} - - local ux = 0 - local uz = 0 - local us = 0 - - local aveX = 0 - local aveZ = 0 - - local units = spGetSelectedUnits() - - for i = 1, #units do - local unitID = units[i] - if mexBuilder[unitID] then - local x,_,z = spGetUnitPosition(unitID) - ux = ux+x - uz = uz+z - us = us+1 - end - end - - if (us == 0) then - return - else - aveX = ux/us - aveZ = uz/us - end - - for i = 1, #WG.metalSpots do - local mex = WG.metalSpots[i] - --if (mex.x > xmin) and (mex.x < xmax) and (mex.z > zmin) and (mex.z < zmax) then -- square area, should be faster - if (Distance(cx,cz,mex.x,mex.z) < cr*cr) then -- circle area, slower - commands[#commands+1] = {x = mex.x, z = mex.z, d = Distance(aveX,aveZ,mex.x,mex.z)} - end - end - - local noCommands = #commands - while noCommands > 0 do - - tasort(commands, function(a,b) return a.d < b.d end) - orderedCommands[#orderedCommands+1] = commands[1] - aveX = commands[1].x - aveZ = commands[1].z - taremove(commands, 1) - for k, com in pairs(commands) do - com.d = Distance(aveX,aveZ,com.x,com.z) - end - noCommands = noCommands-1 - end - - local shift = options.shift - - local buildersByType = {} - for i = 1, #units do - local unitID = units[i] - local mexType = mexBuilder[unitID] - if mexType then - buildersByType[mexType] = buildersByType[mexType] or {} - local array = buildersByType[mexType] - array[#array + 1] = unitID - end - end - for mexType, unitArrayToReceive in pairs (buildersByType) do - local commandArrayToIssue={} - - --prepare command list - if not shift then - commandArrayToIssue[1] = {CMD.STOP, {} , {}} - end - for i, command in ipairs(orderedCommands) do - local x = command.x - local z = command.z - local y = Spring.GetGroundHeight(x, z) - - local unit = GetNearestMex (x, z) - if unit then - if Spring.GetUnitDefID(unit) ~= mexType then - commandArrayToIssue[#commandArrayToIssue+1] = {CMD.RECLAIM, {unit}, {"shift"}} - commandArrayToIssue[#commandArrayToIssue+1] = {CMD.INSERT, {-1, -mexType, CMD.OPT_INTERNAL, x,y,z,0}, {"alt"}} - elseif select (5, Spring.GetUnitHealth (unit)) < 1 then - commandArrayToIssue[#commandArrayToIssue+1] = {CMD.REPAIR, {unit}, {"shift"}} - end - else - commandArrayToIssue[#commandArrayToIssue+1] = {-mexType, {x,y,z,0} , {"shift"}} - end - end - - if (#commandArrayToIssue > 0) then - Spring.GiveOrderArrayToUnitArray(unitArrayToReceive,commandArrayToIssue) - end - end - return true - end - - if mexDefID[-cmdID] and WG.metalSpots then - local bx, bz = params[1], params[3] - local closestSpot = GetClosestMetalSpot(bx, bz) - if closestSpot then - local commandHeight = math.max(0, Spring.GetGroundHeight(closestSpot.x, closestSpot.z)) - local foundUnit = GetNearestMex (closestSpot.x, closestSpot.z) - if foundUnit then - - if Spring.GetUnitDefID(foundUnit) ~= mexType then - spGiveOrder(CMD.RECLAIM, {foundUnit}, CMD.OPT_INTERNAL) - spGiveOrder(CMD.INSERT, {-1, cmdID, options.coded, closestSpot.x, commandHeight, closestSpot.z, params[4]} , {"alt"}) - elseif select (5, Spring.GetUnitHealth (foundUnit)) < 1 then - spGiveOrder(CMD.REPAIR, {foundUnit}, options.coded) - end - else - spGiveOrder(cmdID, {closestSpot.x, commandHeight, closestSpot.z, params[4]}, options.coded) - end - end - return true - end +function widget:CommandNotify(cmdID, params, options) + if (cmdID == CMD_AREA_MEX and WG.metalSpots) then + + local cx, cy, cz, cr = params[1], params[2], params[3], math.max((params[4] or 60),60) + + local xmin = cx-cr + local xmax = cx+cr + local zmin = cz-cr + local zmax = cz+cr + + local commands = {} + local orderedCommands = {} + local dis = {} + + local ux = 0 + local uz = 0 + local us = 0 + + local aveX = 0 + local aveZ = 0 + + local units = spGetSelectedUnits() + + for i = 1, #units do + local unitID = units[i] + if mexBuilder[unitID] then + local x,_,z = spGetUnitPosition(unitID) + ux = ux+x + uz = uz+z + us = us+1 + end + end + + if (us == 0) then + return + else + aveX = ux/us + aveZ = uz/us + end + + for i = 1, #WG.metalSpots do + local mex = WG.metalSpots[i] + --if (mex.x > xmin) and (mex.x < xmax) and (mex.z > zmin) and (mex.z < zmax) then -- square area, should be faster + if (Distance(cx,cz,mex.x,mex.z) < cr*cr) then -- circle area, slower + commands[#commands+1] = {x = mex.x, z = mex.z, d = Distance(aveX,aveZ,mex.x,mex.z)} + end + end + + local noCommands = #commands + while noCommands > 0 do + + tasort(commands, function(a,b) return a.d < b.d end) + orderedCommands[#orderedCommands+1] = commands[1] + aveX = commands[1].x + aveZ = commands[1].z + taremove(commands, 1) + for _, com in pairs(commands) do + com.d = Distance(aveX,aveZ,com.x,com.z) + end + noCommands = noCommands-1 + end + + local shift = options.shift + + local buildersByType = {} + for i = 1, #units do + local unitID = units[i] + local mexType = mexBuilder[unitID] + if mexType then + buildersByType[mexType] = buildersByType[mexType] or {} + local array = buildersByType[mexType] + array[#array + 1] = unitID + end + end + for mexType, unitArrayToReceive in pairs (buildersByType) do + local commandArrayToIssue={} + + --prepare command list + if not shift then + commandArrayToIssue[1] = {CMD.STOP, {} , {}} + end + for i, command in ipairs(orderedCommands) do + local x = command.x + local z = command.z + local y = Spring.GetGroundHeight(x, z) + + local unit = GetNearestMex (x, z) + if unit then + if Spring.GetUnitDefID(unit) ~= mexType then + commandArrayToIssue[#commandArrayToIssue+1] = {CMD.RECLAIM, {unit}, {"shift"}} + commandArrayToIssue[#commandArrayToIssue+1] = {CMD.INSERT, {-1, -mexType, CMD.OPT_INTERNAL, x,y,z,0}, {"alt"}} + elseif select (5, Spring.GetUnitHealth (unit)) < 1 then + commandArrayToIssue[#commandArrayToIssue+1] = {CMD.REPAIR, {unit}, {"shift"}} + end + else + commandArrayToIssue[#commandArrayToIssue+1] = {-mexType, {x,y,z,0} , {"shift"}} + end + end + + if (#commandArrayToIssue > 0) then + Spring.GiveOrderArrayToUnitArray(unitArrayToReceive,commandArrayToIssue) + end + end + return true + end + + if mexDefID[-cmdID] and WG.metalSpots then + local bx, bz = params[1], params[3] + local closestSpot = GetClosestMetalSpot(bx, bz) + if closestSpot then + local commandHeight = math.max(0, Spring.GetGroundHeight(closestSpot.x, closestSpot.z)) + local foundUnit = GetNearestMex (closestSpot.x, closestSpot.z) + if foundUnit then + + if Spring.GetUnitDefID(foundUnit) ~= mexType then + spGiveOrder(CMD.RECLAIM, {foundUnit}, CMD.OPT_INTERNAL) + spGiveOrder(CMD.INSERT, {-1, cmdID, options.coded, closestSpot.x, commandHeight, closestSpot.z, params[4]} , {"alt"}) + elseif select (5, Spring.GetUnitHealth (foundUnit)) < 1 then + spGiveOrder(CMD.REPAIR, {foundUnit}, options.coded) + end + else + spGiveOrder(cmdID, {closestSpot.x, commandHeight, closestSpot.z, params[4]}, options.coded) + end + end + return true + end end function widget:UnitCreated(unitID, unitDefID) - mexBuilder[unitID] = mexBuilderDefs[unitDefID] + mexBuilder[unitID] = mexBuilderDefs[unitDefID] end function widget:UnitFinished(unitID, unitDefID, teamID) - if mexDefID[unitDefID] and WG.metalSpots then - if spGetSpectatingState() then - local x,_,z = Spring.GetUnitPosition(unitID) - local spotID = WG.metalSpotsByPos[x] and WG.metalSpotsByPos[x][z] - if spotID then - spotByID[unitID] = spotID - spotData[spotID] = {unitID = unitID, team = Spring.GetUnitTeam(unitID), allyTeam = spGetUnitAllyTeam(unitID)} - updateMexDrawList() - end - elseif spGetUnitAllyTeam(unitID) == myAllyTeam then - local x,_,z = Spring.GetUnitPosition(unitID) - local spotID = WG.metalSpotsByPos[x] and WG.metalSpotsByPos[x][z] - if spotID then - spotByID[unitID] = spotID - spotData[spotID] = {unitID = unitID, team = Spring.GetUnitTeam(unitID)} - updateMexDrawList() - end - end - end + if mexDefID[unitDefID] and WG.metalSpots then + if spGetSpectatingState() then + local x,_,z = Spring.GetUnitPosition(unitID) + local spotID = WG.metalSpotsByPos[x] and WG.metalSpotsByPos[x][z] + if spotID then + spotByID[unitID] = spotID + spotData[spotID] = {unitID = unitID, team = Spring.GetUnitTeam(unitID), allyTeam = spGetUnitAllyTeam(unitID)} + updateMexDrawList() + end + elseif spGetUnitAllyTeam(unitID) == myAllyTeam then + local x,_,z = Spring.GetUnitPosition(unitID) + local spotID = WG.metalSpotsByPos[x] and WG.metalSpotsByPos[x][z] + if spotID then + spotByID[unitID] = spotID + spotData[spotID] = {unitID = unitID, team = Spring.GetUnitTeam(unitID)} + updateMexDrawList() + end + end + end end function widget:UnitDestroyed(unitID, unitDefID) - if mexDefID[unitDefID] and spotByID[unitID] then - spotData[spotByID[unitID]] = nil - spotByID[unitID] = nil - updateMexDrawList() - end - mexBuilder[unitID] = nil + if mexDefID[unitDefID] and spotByID[unitID] then + spotData[spotByID[unitID]] = nil + spotByID[unitID] = nil + updateMexDrawList() + end + mexBuilder[unitID] = nil end function widget:UnitGiven(unitID, unitDefID, newTeamID, teamID) - mexBuilder[unitID] = mexBuilderDefs[unitDefID] - if mexDefID[unitDefID] then - local done = select(5, spGetUnitHealth(unitID)) - if done == 1 then - widget:UnitFinished(unitID, unitDefID,unitDefID) - end - end + mexBuilder[unitID] = mexBuilderDefs[unitDefID] + if mexDefID[unitDefID] then + local done = select(5, spGetUnitHealth(unitID)) + if done == 1 then + widget:UnitFinished(unitID, unitDefID,unitDefID) + end + end end function widget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) - widget:UnitDestroyed(unitID, unitDefID, oldTeamID) + widget:UnitDestroyed(unitID, unitDefID, oldTeamID) end -local function Initialize() - - circleList = gl.CreateList(DrawCircleLine, circleOptions.innersize, circleOptions.outersize) - currentClock = os.clock() - - local units = spGetAllUnits() - for i, unitID in ipairs(units) do - local unitDefID = spGetUnitDefID(unitID) - widget:UnitCreated(unitID, unitDefID) - if mexDefID[unitDefID] then - local done = select(5, spGetUnitHealth(unitID)) - if done == 1 then - widget:UnitFinished(unitID, unitDefID,team) - end - end - end - if WG.metalSpots then - --Spring.Echo("Mex Placement Initialised with " .. #WG.metalSpots .. " spots.") - updateMexDrawList() - else - --Spring.Echo("Mex Placement Initialised with metal map mode.") - end +local function Initialize() + animShader = gl.CreateShader({ + vertex = animShaderVS, + fragment = animShaderFS, + uniformInt = { + colorAtlas = 0, + normAtlas = 1, + numImages = {numberOfImagesX, numberOfImagesY} + }, + uniformFloat = { + animProgress = 0.0, + }, + }) + + local shLog = gl.GetShaderLog() or "" + + if not animShader then + Spring.Echo("ERROR:\n"..shLog) + return false + elseif (shLog ~= "") then + Spring.Echo("WARNING:\n"..shLog) + end + + animProgressLoc = gl.GetUniformLocation(animShader, "animProgress") + + + circleList = gl.CreateList(DrawCircleLine, circleOptions.innersize, circleOptions.outersize) + currentClock = os.clock() + + local units = spGetAllUnits() + for i, unitID in ipairs(units) do + local unitDefID = spGetUnitDefID(unitID) + widget:UnitCreated(unitID, unitDefID) + if mexDefID[unitDefID] then + local done = select(5, spGetUnitHealth(unitID)) + if done == 1 then + widget:UnitFinished(unitID, unitDefID,team) + end + end + end + if WG.metalSpots then + --Spring.Echo("Mex Placement Initialised with " .. #WG.metalSpots .. " spots.") + updateMexDrawList() + else + --Spring.Echo("Mex Placement Initialised with metal map mode.") + end end local mexSpotToDraw = false local drawMexSpots = false function widget:Update() - if WG.metalSpots and (not wasSpectating) and spGetSpectatingState() then - spotByID = {} - spotData = {} - wasSpectating = true - local units = spGetAllUnits() - for i, unitID in ipairs(units) do - local unitDefID = spGetUnitDefID(unitID) - if mexDefID[unitDefID] then - local done = select(5, spGetUnitHealth(unitID)) - if done == 1 then - widget:UnitFinished(unitID, unitDefID,team) - end - end - end - end - if metalSpotsNil and WG.metalSpots ~= nil then - Initialize() - metalSpotsNil = false - end - - WG.mouseoverMexIncome = false - - if mexSpotToDraw and WG.metalSpots then - WG.mouseoverMexIncome = mexSpotToDraw.metal - WG.mouseoverMex = mexSpotToDraw - else - local _, cmd_id = spGetActiveCommand() - if not cmd_id or not mexDefID[-cmd_id] then - return - end - local mx, my = spGetMouseState() - local _, coords = spTraceScreenRay(mx, my, true, true) - if (not coords) then - return - end - IntegrateMetal(coords[1], coords[3]) - WG.mouseoverMexIncome = extraction * mexDefID[-cmd_id] - end + if WG.metalSpots and (not wasSpectating) and spGetSpectatingState() then + spotByID = {} + spotData = {} + wasSpectating = true + local units = spGetAllUnits() + for i, unitID in ipairs(units) do + local unitDefID = spGetUnitDefID(unitID) + if mexDefID[unitDefID] then + local done = select(5, spGetUnitHealth(unitID)) + if done == 1 then + widget:UnitFinished(unitID, unitDefID,team) + end + end + end + end + if metalSpotsNil and WG.metalSpots ~= nil then + Initialize() + metalSpotsNil = false + end + + WG.mouseoverMexIncome = false + + if mexSpotToDraw and WG.metalSpots then + WG.mouseoverMexIncome = mexSpotToDraw.metal + WG.mouseoverMex = mexSpotToDraw + else + local _, cmd_id = spGetActiveCommand() + if not cmd_id or not mexDefID[-cmd_id] then + return + end + local mx, my = spGetMouseState() + local _, coords = spTraceScreenRay(mx, my, true, true) + if (not coords) then + return + end + IntegrateMetal(coords[1], coords[3]) + WG.mouseoverMexIncome = extraction * mexDefID[-cmd_id] + end end ------------------------------------------------------------ -- Drawing ------------------------------------------------------------ -local centerX +local centerX local centerZ local extraction = 0 @@ -528,167 +640,191 @@ local mainMexValueDrawList = 0 local miniMexDrawList = 0 local function getSpotColor(x,y,z,id, specatate, t) - if specatate then - if spotData[id] then - if options.specPlayerColours.value then - local r, g, b = Spring.GetTeamColor(spotData[id].team) - local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top - return {r, g, b, alpha} - else - local r, g, b = Spring.GetTeamColor(Spring.GetTeamList(spotData[id].allyTeam)[1]) - local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top - return {r, g, b, alpha} - end - else - return neutralMexColor[t] - end - else - if spotData[id] then - local r, g, b = Spring.GetTeamColor(spotData[id].team) - local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top - return {r, g, b, alpha} - else - return neutralMexColor[t] - end - end + if specatate then + if spotData[id] then + if options.specPlayerColours.value then + local r, g, b = Spring.GetTeamColor(spotData[id].team) + local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top + return {r, g, b, alpha} + else + local r, g, b = Spring.GetTeamColor(Spring.GetTeamList(spotData[id].allyTeam)[1]) + local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top + return {r, g, b, alpha} + end + else + return neutralMexColor[t] + end + else + if spotData[id] then + local r, g, b = Spring.GetTeamColor(spotData[id].team) + local alpha = t == 1 and 0.7 or 1.0 --Judging by colours set up top + return {r, g, b, alpha} + else + return neutralMexColor[t] + end + end end function calcMainMexDrawList(valuesonly) - local specatate = spGetSpectatingState() - - if WG.metalSpots then - if not valuesonly and circleOptions.enabled then - if circleOptions.animating == false then - DrawMexList() - end - end - - for i = 1, #WG.metalSpots do - local spot = WG.metalSpots[i] - local x,z,y = spot.x, spot.z, spot.y - if y < 0 then y = 0 end - local mexColor = getSpotColor(x,y+45,z,i,specatate,1) - local metal = spot.metal - - glPushMatrix() - if not valuesonly and not circleOptions.enabled then - glDepthTest(true) - glColor(0,0,0,0.7) - glLineWidth(spot.metal*2.6) - glDrawGroundCircle(x, 1, z, 40, 32) - glColor(mexColor) - glLineWidth(spot.metal*1.6) - glDrawGroundCircle(x, 1, z, 40, 32) - end - glPopMatrix() - - if valuesonly then - glPushMatrix() - - glDepthTest(false) - if options.drawicons.value then - local size = 1 - if metal > 10 then - if metal > 100 then - metal = metal*0.01 - size = 5 - else - metal = metal*0.1 - size = 2.5 - end - end - - - size = options.size.value - - glRotate(90,1,0,0) - glTranslate(0,0,-y-10) - glColor(1,1,1) - glTexture("LuaUI/Images/ibeam.png") - local width = metal*size - glTexRect(x-width/2, z+42, x+width/2, z+40+size,0,0,metal,1) - glTexture(false) - else - -- Draws the metal spot's base income "south" of the metal spot - glRotate(270,1,0,0) - glColor(1,1,1) - glTranslate(x,-z-52-options.size.value, y) - - font:Begin() - font:SetTextColor(1,1,1) - font:SetOutlineColor(0,0,0) - if options.drawcustomincomeamount.value ~= true then - font:Print(("%."..options.rounding.value.."f"):format(metal*options.multiplier.value), 0, 0, options.size.value, "con") - else - font:Print(("%."..options.rounding.value.."f"):format(options.customamount.value), 0, 0, options.size.value, "con") - end - font:End() - end - - glPopMatrix() - end - end - glLineWidth(1.0) - glColor(1,1,1,1) - end + local specatate = spGetSpectatingState() + + if WG.metalSpots then + if not valuesonly and circleOptions.enabled then + if circleOptions.animating == false then + DrawMexList() + end + end + + for i = 1, #WG.metalSpots do + local spot = WG.metalSpots[i] + local x,z,y = spot.x, spot.z, spot.y + if y < 0 then y = 0 end + local mexColor = getSpotColor(x,y+45,z,i,specatate,1) + local metal = spot.metal or 0 --nil fix by MaDDoX + + glPushMatrix() + if not valuesonly and not circleOptions.enabled then + glDepthTest(true) + glColor(0,0,0,0.7) + glLineWidth(spot.metal*2.6) + glDrawGroundCircle(x, 1, z, 40, 32) + glColor(mexColor) + glLineWidth(spot.metal*1.6) + glDrawGroundCircle(x, 1, z, 40, 32) + end + glPopMatrix() + + if valuesonly then + glPushMatrix() + + glDepthTest(false) + if options.drawicons.value then + local size = 1 + if metal > 10 then + if metal > 100 then + metal = metal*0.01 + size = 5 + else + metal = metal*0.1 + size = 2.5 + end + end + + + size = options.size.value + + glRotate(90,1,0,0) + glTranslate(0,0,-y-10) + glColor(1,1,1) + glTexture("LuaUI/Images/ibeam.png") + local width = metal*size + glTexRect(x-width/2, z+42, x+width/2, z+40+size,0,0,metal,1) + glTexture(false) + else + -- Draws the metal spot's base income "south" of the metal spot + glRotate(270,1,0,0) + glColor(1,1,1) + glTranslate(x,-z-70-options.size.value, y) + + if drawIncome then + font:Begin() + font:SetTextColor(1,1,1) + font:SetOutlineColor(0,0,0) + if options.drawcustomincomeamount.value ~= true then + font:Print(("%."..options.rounding.value.."f"):format(metal*options.multiplier.value), 0, 0, options.size.value, "con") + else + font:Print(("%."..options.rounding.value.."f"):format(options.customamount.value), 0, 0, options.size.value, "con") + end + font:End() + end + end + + glPopMatrix() + end + end + glLineWidth(1.0) + glColor(1,1,1,1) + end end --- only used when animating function DrawMexList() - local specatate = spGetSpectatingState() - - if WG.metalSpots then - for i = 1, #WG.metalSpots do - local spot = WG.metalSpots[i] - local x,z,y = spot.x, spot.z, spot.y - if y < 0 then y = 0 end - local mexColor = getSpotColor(x,y+45,z,i,specatate,1) - local metal = spot.metal - - glPushMatrix() - glTranslate(x,y,z) - glColor(0,0,0,0.75) - glRotate(currentRotationAngle,0,1,0) - glScale(1.04,1,1.04) - glCallList(circleList) - mexColor[4] = 1 - glColor(mexColor) - glScale(1/1.04,1,1/1.04) - glCallList(circleList) - glRotate(-currentRotationAngle,0,1,0) - - glRotate(currentRotationAngleOpposite,0,1,0) - glRotate(180,1,0,0) - glColor(0,0,0,0.4) - glScale(1.21,1,1.21) - glCallList(circleList) - mexColor[4] = 0.47 - glColor(mexColor) - glScale(1/1.04,1,1/1.04) - glCallList(circleList) - glTranslate(-x,-y,-z) - glRotate(-currentRotationAngleOpposite,0,1,0) - glPopMatrix() - end - end + local specatate = spGetSpectatingState() + + local gf = spGetGameFrame() + spGetFrameTimeOffset(); + + gl.Texture(0, spotTexture) + gl.Blending(GL.ONE, GL.ONE) -- "hellish" look (1/2) + + if WG.metalSpots and circleList then + for i = 1, #WG.metalSpots do + local spot = WG.metalSpots[i] + local x,z,y = spot.x, spot.z, spot.y + if y < 0 then y = 0 end + local mexColor = getSpotColor(x,y+45,z,i,specatate,1) + local metal = spot.metal or 0 + metal = math.max(metal, 0.1) --min = 0.1 + + glPushMatrix() + --glScale(0.5,1,0.5) -- Remove this to properly align the fancy circles (from circleList) + --glLoadIdentity() + + --glTranslate(x,y + 100,z) + glTranslate(0, y + textureYoffset, 0) + --glColor(0,0,0,1) Black Solid + glColor(0.53, 0.77, 0.89, 0.9) + --glRotate(currentRotationAngle,0,1,0) + --glScale(0.9,1,0.9) + gl.UseShader(animShader) + gl.Uniform(animProgressLoc, (gf % animRate) / animRate) + glRotate(90, 1, 0, 0) + gl.TexRect(x-texturewidth, z-texturewidth, x+texturewidth, z+texturewidth) + --glDrawGroundRect(x-80, z-80, x+80, z+80) + gl.UseShader(0) + --glCallList(circleList) + ----mexColor[4] = 0.8 + ----glColor(mexColor) + --glColor(1,1,1,(metal or 0) * 0.5) + --glScale(0.9,1,0.9) + --glCallList(circleList) + --glRotate(-currentRotationAngle,0,1,0) + + --glRotate(currentRotationAngleOpposite,0,1,0) + --glRotate(180,1,0,0) + --glColor(0,0,0,1) + --glScale(2.5,1,2.5) + --glCallList(circleList) + ----mexColor[4] = 0.8 + ----glColor(mexColor) + --glColor(0.53, 0.77, 0.89, 1) + --glScale(0.9,0.9,0.9) + --glCallList(circleList) + --glTranslate(-x,-y,-z) + --glRotate(-currentRotationAngleOpposite,0,1,0) + glPopMatrix() + end + end + + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) --Hellish look (2/2) + gl.Texture(0, false) end function updateMexDrawList() - if (mainMexDrawList) then - gl.DeleteList(mainMexDrawList); - gl.DeleteList(mainMexValueDrawList); - mainMexDrawList = nil - mainMexValueDrawList = nil - end --delete previous list if exist (ref:gui_chicken.lua by quantum) - mainMexDrawList = glCreateList(calcMainMexDrawList, false) - mainMexValueDrawList = glCreateList(calcMainMexDrawList, true) - --miniMexDrawList = glCreateList(calcMiniMexDrawList) + if (mainMexDrawList) then + gl.DeleteList(mainMexDrawList); + gl.DeleteList(mainMexValueDrawList); + mainMexDrawList = nil + mainMexValueDrawList = nil + end --delete previous list if exist (ref:gui_chicken.lua by quantum) + mainMexDrawList = glCreateList(calcMainMexDrawList, false) + mainMexValueDrawList = glCreateList(calcMainMexDrawList, true) + --miniMexDrawList = glCreateList(calcMiniMexDrawList) end function widget:Shutdown() - gl.DeleteList(mainMexDrawList) - gl.DeleteList(mainMexValueDrawList) - gl.DeleteList(circleList) + gl.DeleteList(mainMexDrawList) + gl.DeleteList(mainMexValueDrawList) + gl.DeleteList(circleList) + gl.DeleteShader(animShader) end local function DoLine(x1, y1, z1, x2, y2, z2) @@ -697,141 +833,163 @@ local function DoLine(x1, y1, z1, x2, y2, z2) end function widget:DrawWorldPreUnit() - if Spring.IsGUIHidden() then return end - - -- Check command is to build a mex - local _, cmdID = spGetActiveCommand() - local peruse = spGetGameFrame() < 1 or spGetMapDrawMode() == 'metal' - - drawMexSpots = WG.metalSpots and ((cmdID and mexDefID[-cmdID]) or CMD_AREA_MEX == cmdID or peruse) - - - if drawMexSpots or (circleOptions.enabled and circleOptions.alwaysshow) then - - if circleOptions.enabled and circleOptions.animating then - local clockDifference = (os.clock() - previousOsClock) - previousOsClock = os.clock() - - -- animate rotation - if circleOptions.rotationSpeed > 0 then - local angleDifference = (circleOptions.rotationSpeed) * (clockDifference * 5) - currentRotationAngle = currentRotationAngle + (angleDifference*0.66) - if currentRotationAngle > 360 then - currentRotationAngle = currentRotationAngle - 360 - end - - currentRotationAngleOpposite = currentRotationAngleOpposite - angleDifference - if currentRotationAngleOpposite < -360 then - currentRotationAngleOpposite = currentRotationAngleOpposite + 360 - end - end - - DrawMexList() - end - end - if drawMexSpots then - gl.DepthTest(true) - gl.DepthMask(true) - if not circleOptions.enabled then - glCallList(mainMexDrawList) - end - glCallList(mainMexValueDrawList) - - gl.DepthTest(false) - gl.DepthMask(false) - end + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + + -- Check command is to build a mex + local _, cmdID = spGetActiveCommand() + local peruse = spGetGameFrame() < 1 or spGetMapDrawMode() == 'metal' + + drawMexSpots = WG.metalSpots and ((cmdID and mexDefID[-cmdID]) or CMD_AREA_MEX == cmdID or peruse) + + + if drawMexSpots or (circleOptions.enabled and circleOptions.alwaysshow) then + + if circleOptions.enabled and circleOptions.animating then + local clockDifference = (os.clock() - previousOsClock) + previousOsClock = os.clock() + + -- animate rotation + if circleOptions.rotationSpeed > 0 then + local angleDifference = (circleOptions.rotationSpeed) * (clockDifference * 5) + currentRotationAngle = currentRotationAngle + (angleDifference*0.66) + if currentRotationAngle > 360 then + currentRotationAngle = currentRotationAngle - 360 + end + + currentRotationAngleOpposite = currentRotationAngleOpposite - angleDifference + if currentRotationAngleOpposite < -360 then + currentRotationAngleOpposite = currentRotationAngleOpposite + 360 + end + end + + -- Draw the amounts + gl.DepthTest(true) + gl.DepthMask(true) + if not circleOptions.enabled then + glCallList(mainMexDrawList) + end + glCallList(mainMexValueDrawList) + + -- + + DrawMexList() + + gl.DepthTest(false) + gl.DepthMask(false) + end + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawWorld() - if Spring.IsGUIHidden() then return end - - -- Check command is to build a mex - local _, cmdID = spGetActiveCommand() - local peruse = spGetGameFrame() < 1 or spGetMapDrawMode() == 'metal' - - local mx, my = spGetMouseState() - local _, pos = spTraceScreenRay(mx, my, true) - - mexSpotToDraw = false - - if WG.metalSpots and pos and ((cmdID and mexDefID[-cmdID]) or peruse or CMD_AREA_MEX == cmdID) then - - -- Find build position and check if it is valid (Would get 100% metal) - local bx, by, bz - if cmdID and cmdID < 0 then - bx, by, bz = Spring.Pos2BuildPos(-cmdID, pos[1], pos[2], pos[3]) - else - bx, by, bz = pos[1], pos[2], pos[3] - end - local bface = Spring.GetBuildFacing() - local closestSpot, distance, index = GetClosestMetalSpot(bx, bz) - - if closestSpot and ((cmdID and mexDefID[-cmdID]) or not ((CMD_AREA_MEX == cmdID or peruse) and distance > 60)) and (not spotData[index]) then - - mexSpotToDraw = closestSpot - - local height = spGetGroundHeight(closestSpot.x,closestSpot.z) - height = height > 0 and height or 0 - - gl.DepthTest(false) - - gl.LineWidth(1.7) - gl.Color(1, 1, 0, 0.5) - gl.BeginEnd(GL.LINE_STRIP, DoLine, bx, by, bz, closestSpot.x, height, closestSpot.z) - gl.LineWidth(1.0) - - gl.DepthTest(true) - gl.DepthMask(true) - - gl.Color(1, 1, 1, 0.5) - gl.PushMatrix() - gl.Translate(closestSpot.x, height, closestSpot.z) - gl.Rotate(90 * bface, 0, 1, 0) - if (cmdID and cmdID < 0) then - gl.UnitShape(-cmdID, Spring.GetMyTeamID(), false, true, false) - end - gl.PopMatrix() - - gl.DepthTest(false) - gl.DepthMask(false) - end - end - - gl.Color(1, 1, 1, 1) + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + + -- Check command is to build a mex + local _, cmdID = spGetActiveCommand() + local peruse = spGetGameFrame() < 1 or spGetMapDrawMode() == 'metal' + + local mx, my = spGetMouseState() + local _, pos = spTraceScreenRay(mx, my, true) + + mexSpotToDraw = false + + if WG.metalSpots and pos and ((cmdID and mexDefID[-cmdID]) or peruse or CMD_AREA_MEX == cmdID) then + + -- Find build position and check if it is valid (Would get 100% metal) + local bx, by, bz + if cmdID and cmdID < 0 then + bx, by, bz = Spring.Pos2BuildPos(-cmdID, pos[1], pos[2], pos[3]) + else + bx, by, bz = pos[1], pos[2], pos[3] + end + local bface = Spring.GetBuildFacing() + local closestSpot, distance, index = GetClosestMetalSpot(bx, bz) + + if closestSpot and ((cmdID and mexDefID[-cmdID]) or not ((CMD_AREA_MEX == cmdID or peruse) and distance > 60)) and (not spotData[index]) then + + mexSpotToDraw = closestSpot + + local height = spGetGroundHeight(closestSpot.x,closestSpot.z) + height = height > 0 and height or 0 + + gl.DepthTest(false) + + gl.LineWidth(1.7) + gl.Color(1, 1, 0, 0.5) + gl.BeginEnd(GL.LINE_STRIP, DoLine, bx, by, bz, closestSpot.x, height, closestSpot.z) + gl.LineWidth(1.0) + + gl.DepthTest(true) + gl.DepthMask(true) + + gl.Color(1, 1, 1, 0.5) + gl.PushMatrix() + gl.Translate(closestSpot.x, height, closestSpot.z) + gl.Rotate(90 * bface, 0, 1, 0) + if (cmdID and cmdID < 0) then + gl.UnitShape(-cmdID, Spring.GetMyTeamID(), false, true, false) + end + gl.PopMatrix() + + gl.DepthTest(false) + gl.DepthMask(false) + end + end + + gl.Color(1, 1, 1, 1) end -function widget:DrawInMiniMap() - - if drawMexSpots then - local specatate = spGetSpectatingState() - - glLoadIdentity() - glTranslate(0,1,0) - glScale(mapXinv , -mapZinv, 1) - glRotate(270,1,0,0) - - for i = 1, #WG.metalSpots do - local spot = WG.metalSpots[i] - local x,z = spot.x, spot.z - local y = spGetGroundHeight(x,z) - - local mexColor = getSpotColor(x,y,z,i,specatate,2) - - glLighting(false) - - glColor(0,0,0,0.66) - glLineWidth(((spot.metal > 0 and spot.metal) or 0.1)*2.0) - glDrawGroundCircle(x, 0, z, MINIMAP_DRAW_SIZE, 32) - glLineWidth((spot.metal > 0 and spot.metal) or 0.1) - mexColor[4] = 0.85 - glColor(mexColor) - - glDrawGroundCircle(x, 0, z, MINIMAP_DRAW_SIZE, 32) - end - - glLineWidth(1.0) - glColor(1,1,1,1) - - end +function widget:DrawInMiniMap(minimapX, minimapY) + + if not glDrawCircle then + glDrawCircle = gl.Utilities.DrawCircle + end + + --if drawMexSpots then + local specatate = spGetSpectatingState() + + glTranslate(0,minimapY,0) + glScale(minimapX/mapX, -minimapY/mapZ, 1) + + for i = 1, #WG.metalSpots do + local spot = WG.metalSpots[i] + local x,z = spot.x, spot.z + local y = spGetGroundHeight(x,z) + + local mexColor = getSpotColor(x,y,z,i,specatate,2) + + glLighting(false) + + --Static minimap mex marker locations + glColor(0,0,0,1) + glLineWidth(2.5) + glDrawCircle(x, z, MINIMAP_DRAW_SIZE) + glLineWidth(1.75) + --mexColor[4] = 0.85 + --glColor(mexColor) + glColor(0.53, 0.77, 0.89, 1) + + --This is for mex circles on the minimap that denote the amount that mexes give (hard to see) + -- glColor(0,0,0,0.66) + -- glLineWidth(((spot.metal > 0 and spot.metal) or 0.1)*5.0) + -- glDrawGroundCircle(x, 0, z, MINIMAP_DRAW_SIZE, 32) + -- glLineWidth(((spot.metal > 0 and spot.metal)*2) or 0.1) + -- mexColor[4] = 0.85 + -- glColor(mexColor) + + glDrawCircle(x, z, MINIMAP_DRAW_SIZE) + end + + glLineWidth(1.0) + glColor(1,1,1,1) + + --end end diff --git a/LuaUI/Widgets_Evo/cmd_no_duplicate_orders.lua b/LuaUI/Widgets_Evo/cmd_no_duplicate_orders.lua deleted file mode 100644 index a13523c0c..000000000 --- a/LuaUI/Widgets_Evo/cmd_no_duplicate_orders.lua +++ /dev/null @@ -1,128 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: cmd_no_duplicate_orders.lua --- brief: Blocks duplicate Attack and Repair/Build orders --- author: Owen Martindell --- --- Copyright (C) 2008. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "NoDuplicateOrders", - desc = "Blocks duplicate Attack and Repair/Build orders 1.1b", - author = "TheFatController", - date = "16 April, 2008", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local GetSelectedUnits = Spring.GetSelectedUnits -local GetCommandQueue = Spring.GetCommandQueue -local GetUnitPosition = Spring.GetUnitPosition -local GiveOrderToUnit = Spring.GiveOrderToUnit -local GetUnitHealth = Spring.GetUnitHealth - -local buildList = {} - -function widget:Initialize() - if Spring.GetSpectatingState() or Spring.IsReplay() then widgetHandler:RemoveWidget() end - for _,unitID in ipairs(Spring.GetTeamUnits(Spring.GetMyTeamID())) do - local _, _, _, _, buildProgress = GetUnitHealth(unitID) - if (buildProgress < 1) then widget:UnitCreated(unitID) end - end -end - -local function toLocString(posX,posY,posZ) - return (math.ceil(posX - 0.5) .. "_" .. math.ceil(posZ - 0.5)) -end - -function widget:UnitCreated(unitID, unitDefID, unitTeam) - local locString = toLocString(GetUnitPosition(unitID)) - buildList[locString] = unitID -end - -function widget:UnitFinished(unitID, unitDefID, unitTeam) - local locString = toLocString(GetUnitPosition(unitID)) - buildList[locString] = nil -end - -function widget:UnitDestroyed(unitID, unitDefID, unitTeam) - local locString = toLocString(GetUnitPosition(unitID)) - buildList[locString] = nil -end - -function widget:CommandNotify(id, params, options) - if (options.coded == 16) then - if (id == CMD.REPAIR) then - local selUnits = GetSelectedUnits() - local blockUnits = {} - for _,unitID in ipairs(selUnits) do - local cQueue = GetCommandQueue(unitID, 1) - if (#cQueue > 0) then - if (cQueue[1].id < 0) and (params[1] == buildList[toLocString(cQueue[1].params[1], 0, cQueue[1].params[3])]) then - blockUnits[unitID] = true - elseif (cQueue[1].id == CMD.REPAIR) and (params[1] == cQueue[1].params[1]) then - blockUnits[unitID] = true - end - end - end - if next(blockUnits) then - for _,unitID in ipairs(selUnits) do - if not blockUnits[unitID] then - GiveOrderToUnit(unitID, id, params, options) - else - local cQueue = GetCommandQueue(unitID) - for _,v in ipairs(cQueue) do - if (v.tag ~= cQueue[1].tag) then - GiveOrderToUnit(unitID,v.id,v.params,{"shift"}) - end - end - end - end - return true - else - return false - end - elseif (id == CMD.ATTACK) then - local selUnits = GetSelectedUnits() - local blockUnits = {} - for _,unitID in ipairs(selUnits) do - local cQueue = GetCommandQueue(unitID) - if (#cQueue > 0) and (params[1] == cQueue[1].params[1]) then - blockUnits[unitID] = true - end - end - if next(blockUnits) then - for _,unitID in ipairs(selUnits) do - if not blockUnits[unitID] then - GiveOrderToUnit(unitID, id, params, options) - else - local cQueue = GetCommandQueue(unitID) - for _,v in ipairs(cQueue) do - if (v.tag ~= cQueue[1].tag) then - GiveOrderToUnit(unitID,v.id,v.params,{"shift"}) - end - end - end - end - return true - else - return false - end - end - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/cmd_tumorspread.lua.disabledfornow b/LuaUI/Widgets_Evo/cmd_tumorspread.lua.disabledfornow new file mode 100644 index 000000000..9e68cfd57 --- /dev/null +++ b/LuaUI/Widgets_Evo/cmd_tumorspread.lua.disabledfornow @@ -0,0 +1,61 @@ +function widget:GetInfo() + return { + name = "Automatic Tumor Spread", + desc = "AAAAAAAAAAAAAA", + author = "Damgam", + date = "2020", + license = "nobody cares", + layer = 5, + enabled = true + } +end + +--local tumortype = game:GetTypeByName("ztumor") +function widget:GameFrame(n) + + if n == 1 then + myTeamID = Spring.GetMyTeamID() + myFaction = Spring.GetTeamRulesParam(myTeamID, "faction", playerFaction) + --Spring.Echo("[Ambient Background Sound Player] Player faction is " .. myFaction) + + if myFaction ~= "zaal" then + widgetHandler:RemoveWidget(self) + end + end + + +end + +function widget:Initialize() + +end + +function widget:UnitFinished(unitID, unitDefID, unitTeam) + if myTeamID == unitTeam and UnitDefs[unitDefID].name == "ztumor" then + local builderX, builderY, builderZ = Spring.GetUnitPosition(unitID) + local buildpos1X = builderX - 296 + local buildpos2X = builderX + 296 + local buildpos3X = builderX + local buildpos4X = builderX + local buildpos1Z = builderZ + local buildpos2Z = builderZ + local buildpos3Z = builderZ + 296 + local buildpos4Z = builderZ - 296 + local buildpos1Y = Spring.GetGroundHeight(buildpos1X, buildpos1Z) + local buildpos2Y = Spring.GetGroundHeight(buildpos2X, buildpos2Z) + local buildpos3Y = Spring.GetGroundHeight(buildpos3X, buildpos3Z) + local buildpos4Y = Spring.GetGroundHeight(buildpos4X, buildpos4Z) + if #Spring.GetUnitsInCylinder(buildpos1X,buildpos1Z,250) < 1 then + Spring.GiveOrderToUnit(unitID, -unitDefID , {buildpos1X, buildpos1Y, buildpos1Z, 0}, {"shift"}) + end + if #Spring.GetUnitsInCylinder(buildpos2X,buildpos2Z,250) < 1 then + Spring.GiveOrderToUnit(unitID, -unitDefID , {buildpos2X, buildpos2Y, buildpos2Z, 0}, {"shift"}) + end + if #Spring.GetUnitsInCylinder(buildpos3X,buildpos3Z,250) < 1 then + Spring.GiveOrderToUnit(unitID, -unitDefID , {buildpos3X, buildpos3Y, buildpos3Z, 0}, {"shift"}) + end + if #Spring.GetUnitsInCylinder(buildpos4X,buildpos4Z,250) < 1 then + Spring.GiveOrderToUnit(unitID, -unitDefID , {buildpos4X, buildpos4Y, buildpos4Z, 0}, {"shift"}) + end + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/dbg_buildpic_preload.lua b/LuaUI/Widgets_Evo/dbg_buildpic_preload.lua deleted file mode 100644 index 814732109..000000000 --- a/LuaUI/Widgets_Evo/dbg_buildpic_preload.lua +++ /dev/null @@ -1,65 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Image Preloader", - desc = "Preloads images; fixes buildpic issues", - author = "jK", - date = "@2009", - license = "GPLv2", - layer = 1000, - enabled = true, -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local i = 1 -local v = 1 -local files = nil - -local function AddDir(path) - for _, f in ipairs(VFS.DirList(path),"*.png") do - files[#files+1] = f - end - for _, f in ipairs(VFS.DirList(path),"*.dds") do - files[#files+1] = f - end - --[[for _, f in ipairs(VFS.SubDirs(path)) do - if (f ~= "." and f ~=".." and f~=".svn") then - AddDir(f) - end - end]]-- -end - - - -function widget:DrawGenesis() - if files == nil then - files = {} - --AddDir("LuaUI/Images") - AddDir("icons") - else - if (UnitDefs[i]) then - gl.Texture(7,'#'..i) - gl.Texture(7,false) - i = i + 1 - else - local file = files[v] - if file then - --Spring.Echo(file) - gl.Texture(7, file) - gl.Texture(7, false) - v = v + 1 - - else - widgetHandler:RemoveWidget() - end - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/dbg_deferred_test.lua b/LuaUI/Widgets_Evo/dbg_deferred_test.lua new file mode 100644 index 000000000..a82b33e98 --- /dev/null +++ b/LuaUI/Widgets_Evo/dbg_deferred_test.lua @@ -0,0 +1,27 @@ +function widget:GetInfo() + return { + name = "Deferred shading test", + layer = 0, + enabled = false, + } +end + +local vsx, vsy + +function widget:Initialize() + vsx, vsy = widgetHandler:GetViewSizes() +end + +function widget:Shutdown() +end + +function widget:DrawGenesis() +end + +local texName = "$model_gbuffer_normtex" + +function widget:DrawScreenEffects() + gl.Texture(0, texName) + gl.TexRect(0, 0, vsx, vsy, false, true) + gl.Texture(0, false) +end diff --git a/LuaUI/Widgets_Evo/dbg_devcommands.lua b/LuaUI/Widgets_Evo/dbg_devcommands.lua deleted file mode 100644 index 169b2c5c8..000000000 --- a/LuaUI/Widgets_Evo/dbg_devcommands.lua +++ /dev/null @@ -1,96 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Dev Commands", - desc = "v0.01 Dev Commands", - author = "CarRepairer", - date = "2011-11-17", - license = "GPLv2", - layer = 5, - enabled = true, -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local echo = Spring.Echo --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -options_path = 'Settings/Toolbox/Dev Commands' -options = { - - cheat = { - name = "Cheat", - type = 'button', - action = 'cheat', - }, - nocost = { - name = "No Cost", - type = 'button', - action = 'nocost', - }, - - spectator = { - name = "Spectator", - type = 'button', - action = 'spectator', - }, - - godmode = { - name = "Godmode", - type = 'button', - action = 'godmode', - }, - - testunit = { - name = "Spawn Testunit", - type = 'button', - action = 'give testunit', - }, - - luauireload = { - name = "Reload LuaUI", - type = 'button', - action = 'luaui reload', - }, - - luarulesreload = { - name = "Reload LuaRules", - type = 'button', - action = 'luarules reload', - }, - - debug = { - name = "Debug", - type = 'button', - action = 'debug', - }, - debugcolvol = { - name = "Debug Colvol", - type = 'button', - action = 'debugcolvol', - }, - debugpath = { - name = "Debug Path", - type = 'button', - action = 'debugpath', - }, - - - printunits = { - name = "Print Units", - type = 'button', - OnChange = function(self) - for i=1,#UnitDefs do - local ud = UnitDefs[i] - local name = ud.name - Spring.Echo("'" .. name .. "',") - end - end, - }, - -} - diff --git a/LuaUI/Widgets_Evo/dbg_image_preload.lua b/LuaUI/Widgets_Evo/dbg_image_preload.lua new file mode 100644 index 000000000..f7356b0d3 --- /dev/null +++ b/LuaUI/Widgets_Evo/dbg_image_preload.lua @@ -0,0 +1,66 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Image Preloader", + desc = "Preloads images; fixes buildpic issues", + author = "jK", + date = "@2009", + license = "GPLv2", + layer = 1000, + enabled = true, -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local i = 1 +local v = 1 +local files = nil + +local function AddDir(path) + for _, f in ipairs(VFS.DirList(path),"*.png") do + files[#files+1] = f + end + for _, f in ipairs(VFS.DirList(path),"*.dds") do + files[#files+1] = f + end + --[[for _, f in ipairs(VFS.SubDirs(path)) do + if (f ~= "." and f ~=".." and f~=".svn") then + AddDir(f) + end + end]]-- +end + + + +function widget:DrawGenesis() + if files == nil then + files = {} + AddDir("unittextures") + AddDir("unitpics") + AddDir("icons") + else + if (UnitDefs[i]) then + gl.Texture(7,'#'..i) + gl.Texture(7,false) + i = i + 1 + else + local file = files[v] + if file then + --Spring.Echo(file) + gl.Texture(7, file) + gl.Texture(7, false) + v = v + 1 + + else + widgetHandler:RemoveWidget() + end + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/dbg_widget_profiler.lua b/LuaUI/Widgets_Evo/dbg_widget_profiler.lua new file mode 100644 index 000000000..2174f3317 --- /dev/null +++ b/LuaUI/Widgets_Evo/dbg_widget_profiler.lua @@ -0,0 +1,535 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() +return { + name = "Widget Profiler", + desc = "", + author = "jK, Bluestone", + version = "2.0", + date = "2007+", + license = "GNU GPL, v2 or later", + layer = -math.huge, + handler = true, + enabled = false -- loaded by default? +} +end + +local usePrefixedNames = true + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local engineVersion = 100 -- just filled this in here incorrectly but old engines arent used anyway +if Engine and Engine.version then + local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + return results + end + engineVersion = Split(Engine.version, '-') + if engineVersion[2] ~= nil and engineVersion[3] ~= nil then + engineVersion = tonumber(string.gsub(engineVersion[1], '%.', '')..engineVersion[2]) + else + engineVersion = tonumber(Engine.version) + end +elseif Game and Game.version then + engineVersion = tonumber(Game.version) +end + +if (engineVersion < 1000 and engineVersion >= 105) or engineVersion >= 10401409 then + spGetLuaMemUsage = Spring.GetLuaMemUsage +else + function spGetLuaMemUsage() + return 0,0,0,0,0,0,0,0 + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local prefixedWnames = {} +local function ConstructPrefixedName (ghInfo) + local gadgetName = ghInfo.name + local baseName = ghInfo.basename + local _pos = baseName:find("_", 1) + local prefix = ((_pos and usePrefixedNames) and (baseName:sub(1, _pos-1)..": ") or "") + local prefixedGadgetName = "\255\200\200\200" .. prefix .. "\255\255\255\255" .. gadgetName + + prefixedWnames[gadgetName] = prefixedGadgetName + return prefixedWnames[gadgetName] +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local callinStats = {} + +local spGetTimer = Spring.GetTimer +local spDiffTimers = Spring.DiffTimers + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function ArrayInsert(t, f, g) + if (f) then + local layer = g.whInfo.layer + local index = 1 + for i,v in ipairs(t) do + if (v == g) then + return -- already in the table + end + if (layer >= v.whInfo.layer) then + index = i + 1 + end + end + table.insert(t, index, g) + end +end + + +local function ArrayRemove(t, g) + for k,v in ipairs(t) do + if (v == g) then + table.remove(t, k) + -- break + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- make a table of the names of user widgets +local userWidgets = {} +function widget:Initialize() + for name,wData in pairs(widgetHandler.knownWidgets) do + userWidgets[name] = (not wData.fromZip) + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local oldUpdateWidgetCallIn +local oldInsertWidget + +local listOfHooks = {} +setmetatable(listOfHooks, { __mode = 'k' }) + +local inHook = false +local function IsHook(func) + return listOfHooks[func] +end + +local function Hook(w,name) -- name is the callin + local widgetName = w.whInfo.name + + local wname = prefixedWnames[widgetName] or ConstructPrefixedName(w.whInfo) + + local realFunc = w[name] + w["_old" .. name] = realFunc + + if (widgetName=="Widget Profiler") then + return realFunc -- don't profile the profilers callins (it works, but it is better that our DrawScreen call is unoptimized and expensive anyway!) + end + + local widgetCallinTime = callinStats[wname] or {} + callinStats[wname] = widgetCallinTime + widgetCallinTime[name] = widgetCallinTime[name] or {0,0,0,0} + local c = widgetCallinTime[name] + + local t + + local helper_func = function(...) + local dt = spDiffTimers(spGetTimer(),t) + local _,_,new_s,_ = spGetLuaMemUsage() + local ds = new_s - s + c[1] = c[1] + dt + c[2] = c[2] + dt + c[3] = c[3] + ds + c[4] = c[4] + ds + inHook = nil + return ... + end + + local hook_func = function(...) + if (inHook) then + return realFunc(...) + end + + inHook = true + t = spGetTimer() + local _,_,new_s,_ = spGetLuaMemUsage() + s = new_s + return helper_func(realFunc(...)) + end + + listOfHooks[hook_func] = true + + return hook_func +end + +local function StartHook() + Spring.Echo("start profiling") + + local wh = widgetHandler + + local CallInsList = {} + for name,e in pairs(wh) do + local i = name:find("List") + if (i)and(type(e)=="table") then + CallInsList[#CallInsList+1] = name:sub(1,i-1) + end + end + + --// hook all existing callins + for _,callin in ipairs(CallInsList) do + local callinGadgets = wh[callin .. "List"] + for _,w in ipairs(callinGadgets or {}) do + w[callin] = Hook(w,callin) + end + end + + Spring.Echo("hooked all callins") + + --// hook the UpdateCallin function + oldUpdateWidgetCallIn = wh.UpdateWidgetCallIn + wh.UpdateWidgetCallIn = function(self,name,w) + local listName = name .. 'List' + local ciList = self[listName] + if (ciList) then + local func = w[name] + if (type(func) == 'function') then + if (not IsHook(func)) then + w[name] = Hook(w,name) + end + ArrayInsert(ciList, func, w) + else + ArrayRemove(ciList, w) + end + self:UpdateCallIn(name) + else + print('UpdateWidgetCallIn: bad name: ' .. name) + end + end + + Spring.Echo("hooked UpdateCallin") + + --// hook the InsertWidget function + oldInsertWidget = wh.InsertWidget + widgetHandler.InsertWidget = function(self,widget) + if (widget == nil) then + return + end + + oldInsertWidget(self,widget) + + for _,callin in ipairs(CallInsList) do + local func = widget[callin] + if (type(func) == 'function') then + widget[callin] = Hook(widget,callin) + end + end + end + + Spring.Echo("hooked InsertWidget") +end + + +local function StopHook() + Spring.Echo("stop profiling") + + local wh = widgetHandler + + local CallInsList = {} + for name,e in pairs(wh) do + local i = name:find("List") + if (i)and(type(e)=="table") then + CallInsList[#CallInsList+1] = name:sub(1,i-1) + end + end + + --// unhook all existing callins + for _,callin in ipairs(CallInsList) do + local callinWidgets = wh[callin .. "List"] + for _,w in ipairs(callinWidgets or {}) do + if (w["_old" .. callin]) then + w[callin] = w["_old" .. callin] + end + end + end + + Spring.Echo("unhooked all callins") + + --// unhook the UpdateCallin and InsertWidget functions + wh.UpdateWidgetCallIn = oldUpdateWidgetCallIn + Spring.Echo("unhooked UpdateCallin") + wh.InsertWidget = oldInsertWidget + Spring.Echo("unhooked InsertWidget") +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local tick = 0.2 +local averageTime = 2 +local timeLoadAverages = {} +local spaceLoadAverages = {} +local startTimer + +function widget:Update() + widgetHandler:RemoveWidgetCallIn("Update", self) + StartHook() + startTimer = Spring.GetTimer() +end + +function widget:Shutdown() + StopHook() +end + +local lm,_,gm,_,um,_,sm,_ = spGetLuaMemUsage() + +local allOverTime = 0 +local allOverTimeSec = 0 -- currently unused +local allOverSpace = 0 +local totalSpace = {} + +local sortedList = {} +local function SortFunc(a,b) + return a.plainname < b.plainname +end + +local deltaTime +local redStrength = {} + +local minPerc = 0.005 -- above this value, we fade in how red we mark a widget +local maxPerc = 0.02 -- above this value, we mark a widget as red +local minSpace = 10 -- Kb +local maxSpace = 100 + +local title_colour = "\255\160\255\160" +local totals_colour = "\255\200\200\255" + +local function CalcLoad(old_load, new_load, t) + return old_load*math.exp(-tick/t) + new_load*(1 - math.exp(-tick/t)) +end + +function ColourString(R,G,B) + R255 = math.floor(R*255) + G255 = math.floor(G*255) + B255 = math.floor(B*255) + if (R255%10 == 0) then R255 = R255+1 end + if (G255%10 == 0) then G255 = G255+1 end + if (B255%10 == 0) then B255 = B255+1 end + return "\255"..string.char(R255)..string.char(G255)..string.char(B255) +end + +function GetRedColourStrings(v) --tLoad is % + local tTime = v.tTime + local sLoad = v.sLoad + local name = v.plainname + local u = math.exp(-deltaTime/5) --magic colour changing rate + + if tTime>maxPerc then tTime = maxPerc end + if tTime=maxLines-5 then x = x - colWidth; j = 0; end + j = j + 1 + gl.Text(title_colour..name.." WIDGETS", x+152, y-lineSpace*j, fontSize, "no") + j = j + 2 + + for i=1,#list do + if j>=maxLines then x = x - colWidth; j = 0; end + + local v = list[i] + local name = v.plainname + local wname = v.fullname + local tLoad = v.tLoad + local sLoad = v.sLoad + local tColour = v.timeColourString + local sColour = v.spaceColourString + gl.Text(tColour .. ('%.2f%%'):format(tLoad), x, y-lineSpace*j, fontSize, "no") + gl.Text(sColour .. ('%.0f'):format(sLoad) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + gl.Text(wname, x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + + j = j + 1 + end + + gl.Text(totals_colour..('%.2f%%'):format(list.allOverTime), x, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.0f'):format(list.allOverSpace) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour.."totals ("..string.lower(name)..")", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + j = j + 1 + + return x,j +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if not (next(callinStats)) then + return --// nothing to do + end + + deltaTime = Spring.DiffTimers(Spring.GetTimer(),startTimer) + + -- sort & count timing + if (deltaTime>=tick) then + startTimer = Spring.GetTimer() + sortedList = {} + + allOverTime = 0 + allOverSpace = 0 + local n = 1 + for wname,callins in pairs(callinStats) do + local t = 0 -- would call it time, but protected + local cmax_t = 0 + local cmaxname_t = "-" + local space = 0 + local cmax_space = 0 + local cmaxname_space = "-" + for cname,c in pairs(callins) do + t = t + c[1] + if (c[2]>cmax_t) then + cmax_t = c[2] + cmaxname_t = cname + end + c[1] = 0 + + space = space + c[3] + if (c[4]>cmax_space) then + cmax_space = c[4] + cmaxname_space = cname + end + c[3] = 0 + end + + local relTime = 100 * t / deltaTime + timeLoadAverages[wname] = CalcLoad(timeLoadAverages[wname] or relTime, relTime, averageTime) + + local relSpace = space / deltaTime + spaceLoadAverages[wname] = CalcLoad(spaceLoadAverages[wname] or relSpace, relSpace, averageTime) + + allOverTimeSec = allOverTimeSec + t + + local tLoad = timeLoadAverages[wname] + local sLoad = spaceLoadAverages[wname] + sortedList[n] = {plainname=wname, fullname=wname..' \255\200\200\200('..cmaxname_t..','..cmaxname_space..')', tLoad=tLoad, sLoad=sLoad, tTime=t/deltaTime} + allOverTime = allOverTime + tLoad + allOverSpace = allOverSpace + sLoad + + n = n + 1 + end + + table.sort(sortedList,SortFunc) + + for i=1,#sortedList do + GetRedColourStrings(sortedList[i]) + end + lm,_,gm,_,um,_,sm,_ = spGetLuaMemUsage() + end + + if (not sortedList[1]) then + return --// nothing to do + end + + -- add to category and set colour + local userList = {} + local gameList = {} + userList.allOverTime = 0 + gameList.allOverTime = 0 + userList.allOverSpace = 0 + gameList.allOverSpace = 0 + for i=1,#sortedList do + if userWidgets[sortedList[i].plainname] then + userList[#userList+1] = sortedList[i] + userList.allOverTime = userList.allOverTime + sortedList[i].tLoad + userList.allOverSpace = userList.allOverSpace + sortedList[i].sLoad + else + gameList[#gameList+1] = sortedList[i] + gameList.allOverTime = gameList.allOverTime + sortedList[i].tLoad + gameList.allOverSpace = gameList.allOverSpace + sortedList[i].sLoad + end + end + + -- draw + local vsx, vsy = gl.GetViewSizes() + + local fontSize = math.max(11,math.floor(vsy/90)) + local lineSpace = fontSize + 2 + + local dataColWidth = fontSize*5 + local colWidth = vsx*0.98/4 + + local x,y = vsx-colWidth, vsy*0.77 -- initial coord for writing + local maxLines = math.max(20,math.floor(y/lineSpace)-3) + local j = -1 --line number + + gl.Color(1,1,1,1) + gl.BeginText() + + x,j = DrawWidgetList(gameList,"GAME",x,y,j, fontSize,lineSpace,maxLines,colWidth,dataColWidth) + x,j = DrawWidgetList(userList,"USER",x,y,j, fontSize,lineSpace,maxLines,colWidth,dataColWidth) + + if j>=maxLines-15 then x = x - colWidth; j = -1; end + j = j + 1 + gl.Text(title_colour.."ALL", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + j = j + 1 + + j = j + 1 + gl.Text(totals_colour.."total percentage of running time spent in luaui callins", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.1f%%'):format(allOverTime), x+dataColWidth, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour.."total rate of mem allocation by luaui callins", x+dataColWidth*2, y-lineSpace*j, fontSize, "no") + gl.Text(totals_colour..('%.0f'):format(allOverSpace) .. 'kB/s', x+dataColWidth, y-lineSpace*j, fontSize, "no") + + j = j + 2 + gl.Text(totals_colour..'total lua memory usage is '.. ('%.0f'):format(gm/1000) .. 'MB, of which:', x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*lm/gm) .. '% is from luaui', x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*um/gm) .. '% is from unsynced states (luarules+luagaia+luaui)', x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(totals_colour..' '..('%.0f'):format(100*sm/gm) .. '% is from synced states (luarules+luagaia)', x, y-lineSpace*j, fontSize, "no") + + j = j + 2 + gl.Text(title_colour.."All data excludes load from garbage collection & executing GL calls", x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(title_colour.."Callins in brackets are heaviest per widget for (time,allocs)", x, y-lineSpace*j, fontSize, "no") + + j = j + 2 + gl.Text(title_colour.."Tick time: " .. tick .. "s", x, y-lineSpace*j, fontSize, "no") + j = j + 1 + gl.Text(title_colour.."Smoothing time: " .. averageTime .. "s", x, y-lineSpace*j, fontSize, "no") + + gl.EndText() +end + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/dbg_widgetprofiler.lua b/LuaUI/Widgets_Evo/dbg_widgetprofiler.lua index 50981fe5e..6d802517a 100644 --- a/LuaUI/Widgets_Evo/dbg_widgetprofiler.lua +++ b/LuaUI/Widgets_Evo/dbg_widgetprofiler.lua @@ -317,7 +317,14 @@ function CheckLoad(v) --tLoad is % return ColourString(r,g,b) end - function widget:DrawScreen() + function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end if not (next(callinTimes)) then return --// nothing to do end diff --git a/LuaUI/Widgets_Evo/disabled/gfx_outline.disabled b/LuaUI/Widgets_Evo/disabled/gfx_outline.disabled new file mode 100644 index 000000000..f7ad7fe6d --- /dev/null +++ b/LuaUI/Widgets_Evo/disabled/gfx_outline.disabled @@ -0,0 +1,410 @@ +-- $Id: gfx_outline.lua 3171 2008-11-06 09:06:29Z det $ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gfx_outline.lua +-- brief: Displays a nice cartoon like outline around units +-- author: jK +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local minFps = 13 -- disables below this average fps +local fpsDiff = 4 -- enabled aain above minFps + fpsDiff + +local maxOutlineUnits = 750 -- ignores other units above this amount + +function widget:GetInfo() + return { + name = "Outline", + desc = "Displays small outline around units (max "..maxOutlineUnits.."). Disables on low fps ("..minFps.."), re-enables on high fps ("..minFps+fpsDiff..")", + author = "jK", + date = "Dec 06, 2007", + license = "GNU GPL, v2 or later", + layer = -10, + enabled = false -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local customSize = 1 + +--//textures +local offscreentex +local depthtex +local blurtex + +--//shader +local depthShader +local blurShader_h +local blurShader_v +local uniformScreenXY, uniformScreenX, uniformScreenY,uniformSizeX,uniformSizeY + +--// geometric +local vsx, vsy = 0,0 +local resChanged = false + +--// display lists +local enter2d,leave2d + +local averageFps = minFps + fpsDiff + 6 +local show = true +local outlineSize = 1 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local GL_DEPTH_COMPONENT24 = 0x81A6 + +--// speed ups +local ALL_UNITS = Spring.ALL_UNITS +local GetVisibleUnits = Spring.GetVisibleUnits + +local GL_MODELVIEW = GL.MODELVIEW +local GL_PROJECTION = GL.PROJECTION +local GL_COLOR_BUFFER_BIT = GL.COLOR_BUFFER_BIT + +local glUnit = gl.Unit +local glCopyToTexture = gl.CopyToTexture +local glRenderToTexture = gl.RenderToTexture +local glCallList = gl.CallList + +local glUseShader = gl.UseShader +local glUniform = gl.Uniform +local glUniformInt = gl.UniformInt + +local glClear = gl.Clear +local glTexRect = gl.TexRect +local glColor = gl.Color +local glTexture = gl.Texture + +local glResetMatrices = gl.ResetMatrices +local glMatrixMode = gl.MatrixMode +local glPushMatrix = gl.PushMatrix +local glLoadIdentity = gl.LoadIdentity +local glPopMatrix = gl.PopMatrix + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + + +function widget:Initialize() + + vsx, vsy = widgetHandler:GetViewSizes() + + if depthShader then + gl.DeleteShader(depthShader) + gl.DeleteShader(blurShader_h) + gl.DeleteShader(blurShader_v) + end + + depthShader = gl.CreateShader({ + fragment = [[ + uniform sampler2D tex0; + uniform vec2 screenXY; + + void main(void) + { + vec2 texCoord = vec2( gl_FragCoord.x/screenXY.x , gl_FragCoord.y/screenXY.y ); + float depth = texture2D(tex0, texCoord ).z; + + if (depth <= gl_FragCoord.z) { + discard; + } + gl_FragColor = gl_Color; + } + ]], + uniformInt = { + tex0 = 0, + }, + uniform = { + screenXY = {vsx,vsy}, + }, + }) + + blurShader_h = gl.CreateShader({ + fragment = [[ + uniform sampler2D tex0; + uniform int screenX; + uniform float size; + + void main(void) { + vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); + gl_FragColor = vec4(0.0); + + int i; + int n = 1; + float pixelsize = 1.0/float(screenX); + for(i = 1; i < 3; ++i){ + gl_FragColor += size * texture2D(tex0, vec2(texCoord.s + i*pixelsize,texCoord.t) ); + --n; + } + + gl_FragColor += texture2D(tex0, texCoord ); + + n = 0; + for(i = -2; i < 0; ++i){ + gl_FragColor += size * texture2D(tex0, vec2(texCoord.s + i*pixelsize,texCoord.t) ); + ++n; + } + } + ]], + uniformInt = { + tex0 = 0, + screenX = vsx, + }, + }) + + blurShader_v = gl.CreateShader({ + fragment = [[ uniform sampler2D tex0; + uniform int screenY; + uniform float size; + + void main(void) { + vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); + gl_FragColor = vec4(0.0); + + int i; + int n = 1; + float pixelsize = 1.0/float(screenY); + for(i = 0; i < 2; ++i){ + gl_FragColor += size * texture2D(tex0, vec2(texCoord.s,texCoord.t + i*pixelsize) ); + --n; + } + + gl_FragColor += texture2D(tex0, texCoord ); + + n = 0; + for(i = -2; i < 0; ++i){ + gl_FragColor += size * texture2D(tex0, vec2(texCoord.s,texCoord.t + i*pixelsize) ); + ++n; + } + } + ]], + uniformInt = { + tex0 = 0, + screenY = vsy, + }, + }) + + if (depthShader == nil) then + Spring.Echo("Outline widget: depthcheck shader error: "..gl.GetShaderLog()) + widgetHandler:RemoveWidget(self) + return false + end + if (blurShader_h == nil) then + Spring.Echo("Outline widget: hblur shader error: "..gl.GetShaderLog()) + widgetHandler:RemoveWidget(self) + return false + end + if (blurShader_v == nil) then + Spring.Echo("Outline widget: vblur shader error: "..gl.GetShaderLog()) + widgetHandler:RemoveWidget(self) + return false + end + + uniformScreenXY = gl.GetUniformLocation(depthShader, 'screenXY') + uniformScreenX = gl.GetUniformLocation(blurShader_h, 'screenX') + uniformSizeX = gl.GetUniformLocation(blurShader_h, 'size') + uniformScreenY = gl.GetUniformLocation(blurShader_v, 'screenY') + uniformSizeY = gl.GetUniformLocation(blurShader_v, 'size') + + self:ViewResize(widgetHandler:GetViewSizes()) + + enter2d = gl.CreateList(function() + glUseShader(0) + glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity() + glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity() + end) + leave2d = gl.CreateList(function() + glMatrixMode(GL_PROJECTION); glPopMatrix() + glMatrixMode(GL_MODELVIEW); glPopMatrix() + glTexture(false) + glUseShader(0) + end) + + WG['outline'] = {} + WG['outline'].getMaxunits = function() + return maxOutlineUnits + end + WG['outline'].setMaxunits = function(value) + maxOutlineUnits = value + end + WG['outline'].getSize = function() + return customSize + end + WG['outline'].setSize = function(value) + customSize = value + resChanged = true + end +end + +function widget:ViewResize(viewSizeX, viewSizeY) + vsx = viewSizeX + vsy = viewSizeY + + outlineSize = (0.85 + (vsx*vsy / 25000000))*0.55 + + gl.DeleteTexture(depthtex or 0) + gl.DeleteTextureFBO(offscreentex or 0) + gl.DeleteTextureFBO(blurtex or 0) + + depthtex = gl.CreateTexture(vsx,vsy, { + border = false, + format = GL_DEPTH_COMPONENT24, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + }) + + offscreentex = gl.CreateTexture(vsx,vsy, { + border = false, + min_filter = GL.LINEAR, + mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + fboDepth = true, + }) + + blurtex = gl.CreateTexture(vsx,vsy, { + border = false, + min_filter = GL.LINEAR, + mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + + resChanged = true +end + + +function widget:Shutdown() + gl.DeleteTexture(depthtex) + if (gl.DeleteTextureFBO) then + gl.DeleteTextureFBO(offscreentex) + gl.DeleteTextureFBO(blurtex) + end + + if (gl.DeleteShader) then + gl.DeleteShader(depthShader or 0) + gl.DeleteShader(blurShader_h or 0) + gl.DeleteShader(blurShader_v or 0) + end + + gl.DeleteList(enter2d) + gl.DeleteList(leave2d) + + WG['outline'] = nil +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function DrawVisibleUnits() + local visibleUnits = GetVisibleUnits(ALL_UNITS,nil,false) + local count = 0 + for i=1,#visibleUnits do + glUnit(visibleUnits[i],true) + count = count + 1 + if count >= maxOutlineUnits then break end + end +end + +local MyDrawVisibleUnits = function() + glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) + glPushMatrix() + glResetMatrices() + glColor(0,0,0,0.4) + DrawVisibleUnits() + glColor(1,1,1,1) + glPopMatrix() +end + +local blur_h = function() + glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) + glUseShader(blurShader_h) + glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) +end + +local blur_v = function() + glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) + glUseShader(blurShader_v) + glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) +end + +local sec = 0 +local lastUpdate = 0 +function widget:Update(dt) + sec = sec + dt + if sec > lastUpdate + 2 then + lastUpdate = sec + + local modelCount = #Spring.GetVisibleUnits(-1,nil,false) + averageFps = averageFps + (((Spring.GetFPS()*(modelCount/50)) - averageFps*(modelCount/50)) / 70) + + if averageFps < minFps then + show = false + elseif averageFps > minFps + fpsDiff then + show = true + end + end +end + + +function widget:DrawWorldPreUnit() + if not show then return end + gl.ResetState() -- to prevent on/off flicker induced by other widgets maybe (i tried single out which thing included in gl.ResetSate fixed it but it kept doing it) + + glCopyToTexture(depthtex, 0, 0, 0, 0, vsx, vsy) + glTexture(depthtex) + + if (resChanged) then + resChanged = false + if (vsx==1) or (vsy==1) then return end + glUseShader(depthShader) + glUniform(uniformScreenXY, vsx,vsy ) + glUseShader(blurShader_h) + glUniformInt(uniformScreenX, vsx ) + glUniform(uniformSizeX, outlineSize*customSize) + glUseShader(blurShader_v) + glUniformInt(uniformScreenY, vsy ) + glUniform(uniformSizeY, outlineSize*customSize) + end + + glUseShader(depthShader) + glRenderToTexture(offscreentex,MyDrawVisibleUnits) + + glTexture(offscreentex) + glRenderToTexture(blurtex, blur_h) + glTexture(blurtex) + glRenderToTexture(offscreentex, blur_v) + + glCallList(enter2d) + glTexture(offscreentex) + glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) + glCallList(leave2d) +end + + +function widget:GetConfigData() + savedTable = {} + savedTable.maxOutlineUnits = maxOutlineUnits + savedTable.customSize = customSize + return savedTable +end + +function widget:SetConfigData(data) + if data.maxOutlineUnits then maxOutlineUnits = data.maxOutlineUnits or maxOutlineUnits end + if data.customSize then customSize = data.customSize or customSize end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/disabled/gui_fancy_teamplatter.disabled b/LuaUI/Widgets_Evo/disabled/gui_fancy_teamplatter.disabled new file mode 100644 index 000000000..a8bfbf51a --- /dev/null +++ b/LuaUI/Widgets_Evo/disabled/gui_fancy_teamplatter.disabled @@ -0,0 +1,201 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_fancy_teamplatter.lua +-- brief: Draws transparant smoothed donuts under enemy units +-- author: Dave Rodgers (orig. TeamPlatter edited by TradeMark) +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Fancy Teamplatter", + desc = "Draws transparant smoothed donuts under friendly and enemy units (using teamcolor)", + author = "TradeMark (Floris: added multiple ally color support) (Forboding Angel: removed extra FX stuff) (zoggop: made it use only team colors)", + date = "7.02.2014", + license = "GNU GPL, v2 or later", + layer = 5, + enabled = false -- loaded by default? + } +end + + + +-------------------------------------------------------------------------------- +-- Config +-------------------------------------------------------------------------------- + +local drawWithHiddenGUI = true -- keep widget enabled when graphical user interface is hidden (when pressing F5) + +local circleSize = 1 +local circleDivs = 12 -- how precise circle? octagon by default +local circleOpacity = 0.5 +local innerSize = 1.35 -- circle scale compared to unit radius +local outerSize = 1.5 -- outer fade size compared to circle scale (1 = no outer fade) + +local ignoreUnits = {} +for udefID,def in ipairs(UnitDefs) do + if def.customParams['nohealthbars'] then + ignoreUnits[udefID] = true + end +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Automatically generated local definitions + +local GL_ONE = GL.ONE +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local GL_SRC_ALPHA = GL.SRC_ALPHA +local glBlending = gl.Blending +local glBeginEnd = gl.BeginEnd +local glColor = gl.Color +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glDepthTest = gl.DepthTest +local glDrawListAtUnit = gl.DrawListAtUnit +local glPolygonOffset = gl.PolygonOffset +local glVertex = gl.Vertex +local spGetTeamColor = Spring.GetTeamColor +local spGetUnitDefDimensions = Spring.GetUnitDefDimensions +local spGetUnitDefID = Spring.GetUnitDefID +local spIsUnitSelected = Spring.IsUnitSelected +local spGetTeamList = Spring.GetTeamList +local spGetVisibleUnits = Spring.GetVisibleUnits +local spIsGUIHidden = Spring.IsGUIHidden +local spGetUnitTeam = Spring.GetUnitTeam + +local myTeamID = Spring.GetLocalTeamID() + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local realRadii = {} +local circlePolys = {} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +-- Creating polygons: +function widget:Initialize() + + local teamList = spGetTeamList() + local numberOfTeams = #teamList + + for teamListIndex = 1, #teamList do + local teamID = teamList[teamListIndex] + local r,g,b,a = spGetTeamColor(teamID) + + circlePolys[teamID] = glCreateList(function() + glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) -- disable layer blending + + -- colored inner circle: + glBeginEnd(GL.TRIANGLES, function() + local radstep = (2.0 * math.pi) / circleDivs + for i = 1, circleDivs do + local a1 = (i * radstep) + local a2 = ((i+1) * radstep) + --(fadefrom) + glColor(r, g, b, 0) + glVertex(0, 0, 0) + --(colorSet) + glColor(r, g, b, circleOpacity) + glVertex(math.sin(a1), 0, math.cos(a1)) + glVertex(math.sin(a2), 0, math.cos(a2)) + end + end) + + if (outerSize ~= 1) then + -- colored outer circle: + glBeginEnd(GL.QUADS, function() + local radstep = (2.0 * math.pi) / circleDivs + for i = 1, circleDivs do + local a1 = (i * radstep) + local a2 = ((i+1) * radstep) + --(colorSet) + glColor(r, g, b, circleOpacity) + glVertex(math.sin(a1), 0, math.cos(a1)) + glVertex(math.sin(a2), 0, math.cos(a2)) + --(fadeto) + glColor(r, g, b, 0) + glVertex(math.sin(a2)*outerSize, 0, math.cos(a2)*outerSize) + glVertex(math.sin(a1)*outerSize, 0, math.cos(a1)*outerSize) + end + end) + end + end) + + end + +end + +function widget:Shutdown() + --glDeleteList(circlePolys) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +-- Retrieving radius: +local function GetUnitDefRealRadius(udid) + local radius = realRadii[udid] + if (radius) then return radius end + local ud = UnitDefs[udid] + if (ud == nil) then return nil end + local dims = spGetUnitDefDimensions(udid) + if (dims == nil) then return nil end + local scale = ud.hitSphereScale -- missing in 0.76b1+ + scale = ((scale == nil) or (scale == 0.0)) and 1.0 or scale + radius = dims.radius / scale + realRadii[udid] = radius*circleSize + return radius +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +-- Drawing: +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorldPreUnit() + if chobbyInterface then return end + if not drawWithHiddenGUI then + if spIsGUIHidden() then return end + end + glDepthTest(true) + glPolygonOffset(-100, -2) + local visibleUnits = spGetVisibleUnits() + if #visibleUnits then + for i=1, #visibleUnits do + local unitID = visibleUnits[i] + local unitDefIDValue = spGetUnitDefID(unitID) + if ignoreUnits[unitDefIDValue] then break end + local teamID = spGetUnitTeam(unitID) + if circlePolys[teamID] ~= nil then + if (unitDefIDValue) then + local radius = GetUnitDefRealRadius(unitDefIDValue) * circleSize + if (radius) then + glDrawListAtUnit(unitID, circlePolys[teamID], false, radius, 1.0, radius) + end + end + end + end + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/game_buildHotkeys.lua b/LuaUI/Widgets_Evo/game_buildHotkeys.lua new file mode 100644 index 000000000..7ae47b945 --- /dev/null +++ b/LuaUI/Widgets_Evo/game_buildHotkeys.lua @@ -0,0 +1,252 @@ +function widget:GetInfo() + return { + version = "1.0", + name = "EvoRTS Build Hotkeys", + desc = "Use hotkeys to build units", + author = "CommonPlayer", + date = "5 Oct 2018", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + handler = true, --can use widgetHandler:x() + } +end + +VFS.Include("luaui/configs/evo_buildHotkeysConfig.lua") + +-- Taken from gui_red_buildordermenu +local sGetSelectedUnitsCount = Spring.GetSelectedUnitsCount +local sGetActiveCmdDescs = Spring.GetActiveCmdDescs +local ssub = string.sub + +local function GetCommands() + local hiddencmds = { + [76] = true, --load units clone + [65] = true, --selfd + [9] = true, --gatherwait + [8] = true, --squadwait + [7] = true, --deathwait + [6] = true, --timewait + [39812] = true, --raw move + [34922] = true, -- set unit target + --[34923] = true, -- set target + } + local buildcmds = {} + local statecmds = {} + local othercmds = {} + local buildcmdscount = 0 + local statecmdscount = 0 + local othercmdscount = 0 + for index,cmd in pairs(sGetActiveCmdDescs()) do + if (type(cmd) == "table") then + if ( + (not hiddencmds[cmd.id]) and + (cmd.action ~= nil) and + --(not cmd.disabled) and + (not widgetHandler.commands[index].hidden) and --apparently GetActiveCmdDescs is bugged and returns hidden for every command + (cmd.type ~= 21) and + (cmd.type ~= 18) and + (cmd.type ~= 17) + ) then + if (((cmd.type == 20) --build building + or (ssub(cmd.action,1,10) == "buildunit_"))) then + buildcmdscount = buildcmdscount + 1 + buildcmds[buildcmdscount] = cmd + elseif (cmd.type == 5) then + statecmdscount = statecmdscount + 1 + statecmds[statecmdscount] = cmd + else + othercmdscount = othercmdscount + 1 + othercmds[othercmdscount] = cmd + end + end + end + end + local tempcmds = {} + for i=1,statecmdscount do + tempcmds[i] = statecmds[i] + end + for i=1,othercmdscount do + tempcmds[i+statecmdscount] = othercmds[i] + end + othercmdscount = othercmdscount + statecmdscount + othercmds = tempcmds + + return buildcmds,othercmds +end + +local sPlaySoundFile = Spring.PlaySoundFile +local sGetModKeyState = Spring.GetModKeyState +local sGetCmdDescIndex = Spring.GetCmdDescIndex +local sSetActiveCommand = Spring.SetActiveCommand + +local updateCommands = false +local buildOptions = {} +local lengBuildOptions = 0 + +local lengKeysPressed = 0 +local keysPressed = {} + +local sGetKeySymbol = Spring.GetKeySymbol + +-- VFS.Include("LuaUI/Headers/keysym.h.lua", nil, VFS.RAW_FIRST) +-- local keyCodeToString = {} +-- for k, v in pairs(KEYSYMS) do keyCodeToString[v] = k:sub(1, 1) .. k:sub(2):lower() end + +local hotkeyText = "" +local screenWidth = gl.GetViewSizes() +local function updateHotkeyText() + if lengKeysPressed > 0 then + hotkeyText = "Build hotkey: " + for i = 1, lengKeysPressed do + -- hotkeyText = hotkeyText .. keyCodeToString[keysPressed[i]] .. " + " + if keysPressed[i] >= 97 and keysPressed[i] <= 122 then hotkeyText = hotkeyText .. string.char(keysPressed[i]):upper() .. " + " end + -- local keySymbol = sGetKeySymbol(keysPressed[i]) + -- hotkeyText = hotkeyText .. keySymbol:sub(1, 1):upper() .. keySymbol:sub(2) .. " + " + -- if i < lengKeysPressed then str = str .. " + " end + end + + else hotkeyText = "" end +end +local function shortenHotkeyText() hotkeyText = hotkeyText:sub(1, -4) end +local function hotkeyTargetDisabled() hotkeyText = hotkeyText:sub(1, -4) .. ' (Locked)' end +WG.buildHotkeys = {} +WG.buildHotkeys.keysPressed = {} +WG.buildHotkeys.hasUpdated = false +local function updateWidgetVar() + WG.buildHotkeys.keysPressed = {} + for i = 1, lengKeysPressed do + if keysPressed[i] >= 97 and keysPressed[i] <= 122 then WG.buildHotkeys.keysPressed[i] = string.char(keysPressed[i]):upper() end + -- local keySymbol = sGetKeySymbol(keysPressed[i]) + -- WG.buildHotkeys.keysPressed[i] = keySymbol:sub(1, 1):upper() .. keySymbol:sub(2) + end + WG.buildHotkeys.hasUpdated = true +end + +local sGetConfigInt = Spring.GetConfigInt + +function widget:CommandsChanged() + updateCommands = true +end +local oldBuildOptions, oldLengBuildOptions +function widget:Update(dt) + if updateCommands then + updateCommands = false + + local same = true + if not oldLengBuildOptions then same = false end + buildOptions = {} + lengBuildOptions = 0 + local buildcmds, othercmds = GetCommands() + for i = 1, #buildcmds do + local name = buildcmds[i].name + if name:find("_up", -5) then name = name:sub(1, -5) end + --if nameToKeyCode[name] and not buildcmds[i].disabled then + if nameToKeyCode[name] then + lengBuildOptions = lengBuildOptions + 1 + buildOptions[lengBuildOptions] = { + keyCode = nameToKeyCode[name], + id = buildcmds[i].id, + disabled = buildcmds[i].disabled + } + if same and + (lengBuildOptions > oldLengBuildOptions or + buildOptions[lengBuildOptions].keyCode ~= oldBuildOptions[lengBuildOptions].keyCode) then + same = false + end + end + end + if not same then + lengKeysPressed = 0 + keysPressed = {} + updateHotkeyText() + end + oldBuildOptions = buildOptions + oldLengBuildOptions = lengBuildOptions + end +end + +function widget:KeyPress(key, mods, isRepeat) + if key == 304 or key == 306 or key == 308 then return false end -- shift, ctrl, alt keys + lengKeysPressed = lengKeysPressed + 1 + keysPressed[lengKeysPressed] = key + updateHotkeyText() + updateWidgetVar() + + local lengMatches = 0 + local matches = {} + for i = 1, lengBuildOptions do + local getKeyCode = buildOptions[i].keyCode + local lengKeyCode = #getKeyCode + if lengKeyCode >= lengKeysPressed then + local match = true + for j = 1, lengKeysPressed do + if keysPressed[j] ~= getKeyCode[j] then + match = false + break + end + end + if match then + lengMatches = lengMatches + 1 + matches[lengMatches] = { + id = buildOptions[i].id, + disabled = buildOptions[i].disabled, + sameLeng = lengKeyCode == lengKeysPressed + } + end + end + end + if matches[1] then + for i = 1, lengMatches do + if matches[i].sameLeng then + -- if playSounds then + -- sPlaySoundFile(sound_queue_add, 0.75, 'ui') + -- end + if matches[i].disabled then + hotkeyTargetDisabled() + else + local alt, ctrl, meta, shift = sGetModKeyState() + local rmb = 1 + if sGetConfigInt("evo_ctrl_dequeue", 1) == 1 then rmb, ctrl = ctrl and 3 or 1, false end + local index = sGetCmdDescIndex(matches[i].id) + sSetActiveCommand(index, rmb, true, false, alt, ctrl, meta, shift) + shortenHotkeyText() + updateWidgetVar() + end + keysPressed[lengKeysPressed] = nil + lengKeysPressed = lengKeysPressed - 1 -- so you can B + Q + Q + Q to spam units + if matches[i].disabled then updateWidgetVar() end -- Don't show you that you have a locked building selected + return true + end + end + else -- reset + lengKeysPressed = 0 + keysPressed = {} + updateHotkeyText() + updateWidgetVar() + end + return false +end + +function widget:MousePress(x, y, button) + -- reset on left click or right click (button = 2 for clicking mouse wheel because ???) + --if button == 1 or button == 3 then building = -1 end + if button == 1 or button == 3 then + lengKeysPressed = 0 + keysPressed = {} + updateHotkeyText() + updateWidgetVar() + end + return false +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + gl.Text(hotkeyText, screenWidth * 0.5, 60, 20, "onc") +end diff --git a/LuaUI/Widgets_Evo/game_howismybuild.lua b/LuaUI/Widgets_Evo/game_howismybuild.lua index e5f9d31b6..6a5fa60ff 100644 --- a/LuaUI/Widgets_Evo/game_howismybuild.lua +++ b/LuaUI/Widgets_Evo/game_howismybuild.lua @@ -17,13 +17,13 @@ local teamResources = Spring.GetTeamResources local workingUnits = {} local dataArray = {} - local logDir="LuaUI/Widgets/buildsaves/" + local logDir="buildsaves/" local file local fileName function widget:Initialize() Spring.CreateDir(logDir); - fileName = logDir.. Game.mapName.. "_".. tostring(os.date("%Y-%m-%d_%H;%M")) ..".log" + fileName = logDir.. Game.mapName.. "_".. tostring(os.date("%m-%d-%Y_%H;%M")) ..".log" file = io.open(fileName, "w"); local header = string.format("%35s%17s%17s%17s%17s", "Name: ", "Start time: ","Finish time: ","Metal income: ","Energy income: ") @@ -42,7 +42,7 @@ end function widget:UnitFinished(unitID, unitDefID, unitTeam) - if unitTeam == myTeamID() and UnitDefs[unitDefID].isImmobile then + if unitTeam == myTeamID() then if workingUnits[unitID] ~= nil then local finishTime = formatTime(getGameTime()) local finishM, finishMI = getResource("metal") diff --git a/LuaUI/Widgets_Evo/game_resetHotkeys.lua b/LuaUI/Widgets_Evo/game_resetHotkeys.lua index f8b763edf..c64c6e112 100644 --- a/LuaUI/Widgets_Evo/game_resetHotkeys.lua +++ b/LuaUI/Widgets_Evo/game_resetHotkeys.lua @@ -12,6 +12,12 @@ end function widget:Initialize() + -- bind k to cloak + Spring.SendCommands({ + "unbindkeyset k", + }) + Spring.SendCommands("bind k wantcloak") + -- bind sell command Spring.SendCommands({ "unbindkeyset shift+s", @@ -44,6 +50,18 @@ function widget:Initialize() }) Spring.SendCommands("bind i priority") + -- set high quality screenshots to f12 + Spring.SendCommands({ + "unbindkeyset f12", + }) + Spring.SendCommands("bind f12 screenshot png") + + -- Remove Mex Button + Spring.SendCommands({ + "unbindkeyset f4", + }) + Spring.SendCommands("bind f4 screenshot png") + if Game.version == "85.0" then Spring.SendCommands({"unbindaction specteam"}) end diff --git a/LuaUI/Widgets_Evo/gfx_bloom_shader.lua b/LuaUI/Widgets_Evo/gfx_bloom_shader.lua index e7f985f05..390224ea0 100644 --- a/LuaUI/Widgets_Evo/gfx_bloom_shader.lua +++ b/LuaUI/Widgets_Evo/gfx_bloom_shader.lua @@ -5,8 +5,8 @@ function widget:GetInfo() author = "Floris", -- orginal bloom shader: Kloot date = "24-9-2016", license = "", - layer = 9, - enabled = false + layer = -5, + enabled = false, } end @@ -14,13 +14,31 @@ end -- config -------------------------------------------------------------------------------- -local basicAlpha = 0.4 - -local drawHighlights = false -- apply extra bloom bright spots (note: quite costly) -local highlightsAlpha = 0.35 +local basicAlpha = 0.25 +local globalBlursizeMult = 1.1 local dbgDraw = 0 -- debug: draw only the bloom-mask? +local presets = { + { + blursize = 1.66, + blurPasses = 1, + quality = 4, -- high value creates flickering, but lower is more expensive + }, + { + blursize = 1.25, + blurPasses = 2, + quality = 4, + }, + { + blursize = 0.7, + blurPasses = 3, + quality = 3, + }, +} +local qualityPreset = 1 + + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -38,8 +56,6 @@ local blurShaderV71 = nil local brightShader = nil local brightTexture1 = nil local brightTexture2 = nil -local brightTexture3 = nil -local brightTexture4 = nil local combineShader = nil local screenTexture = nil @@ -125,50 +141,42 @@ end local function RemoveMe(msg) Spring.Echo(msg) - --widgetHandler:RemoveWidget() + --widgetHandler:RemoveWidget(self) +end + + +blursize = presets[qualityPreset].blursize +blurPasses = presets[qualityPreset].blurPasses +quality = presets[qualityPreset].quality +function loadPreset() + if presets[qualityPreset] ~= nil then + blursize = presets[qualityPreset].blursize + blurPasses = presets[qualityPreset].blurPasses + quality = presets[qualityPreset].quality + reset() + end end function reset() --if not initialized then return end - - if drawHighlights then - usedBasicAlpha = basicAlpha - drawWorldAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/11) + (0.018 * highlightsAlpha) - drawWorldPreUnitAlpha = 0.16 - (illumThreshold*0.4) + (usedBasicAlpha/6.2) + (0.023 * highlightsAlpha) - else - usedBasicAlpha = basicAlpha - drawWorldAlpha = 0.035 + (usedBasicAlpha/11) - drawWorldPreUnitAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/6) - end + usedBasicAlpha = basicAlpha + drawWorldAlpha = 0.035 + (usedBasicAlpha/11) + drawWorldPreUnitAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/6) + gl.DeleteTexture(brightTexture1 or "") gl.DeleteTexture(brightTexture2 or "") - if drawHighlights then - gl.DeleteTexture(brightTexture3 or "") - gl.DeleteTexture(brightTexture4 or "") - end gl.DeleteTexture(screenTexture or "") - local btQuality = 4.6 -- high value creates flickering, but lower is more expensive - brightTexture1 = glCreateTexture(vsx/btQuality, vsy/btQuality, { + --local quality = 4.6 -- high value creates flickering, but lower is more expensive + brightTexture1 = glCreateTexture(vsx/quality, vsy/quality, { fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, }) - brightTexture2 = glCreateTexture(vsx/btQuality, vsy/btQuality, { + brightTexture2 = glCreateTexture(vsx/quality, vsy/quality, { fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, }) - if drawHighlights then - btQuality = 3.2 -- high value creates flickering, but lower is more expensive - brightTexture3 = glCreateTexture(vsx/btQuality, vsy/btQuality, { - fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, - format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, - }) - brightTexture4 = glCreateTexture(vsx/btQuality, vsy/btQuality, { - fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, - format = GL_RGB16F_ARB, wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, - }) - end screenTexture = glCreateTexture(vsx, vsy, { min_filter = GL.LINEAR, mag_filter = GL.LINEAR, }) @@ -203,22 +211,24 @@ function widget:Update(dt) end function widget:DrawWorldPreUnit() + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) if initialized == false or drawWorldPreUnitAlpha <= 0.05 then return end gl.PushMatrix() - gl.Color(0,0,0,drawWorldPreUnitAlpha) + gl.Color(0,0,0,(drawWorldPreUnitAlpha/2) + drawWorldPreUnitAlpha*(basicAlpha*1.5)) gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) gl.Billboard() - gl.Rect(-500, -500, 500, 500) + gl.Rect(-vsx, -vsy, vsx, vsy) gl.PopMatrix() end function widget:DrawWorld() + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) if initialized == false or drawWorldAlpha <= 0.05 then return end gl.PushMatrix() - gl.Color(0,0,0,drawWorldAlpha) + gl.Color(0,0,0,(drawWorldAlpha/2) + drawWorldAlpha*(basicAlpha*1.5)) gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) gl.Billboard() - gl.Rect(-500, -500, 500, 500) + gl.Rect(-vsx, -vsy, vsx, vsy) gl.PopMatrix() end @@ -232,26 +242,33 @@ function widget:Initialize() SetIllumThreshold() WG['bloom'] = {} - WG['bloom'].getAdvBloom = function() - return drawHighlights + WG['bloom'].getBrightness = function() + return basicAlpha end - WG['bloom'].setAdvBloom = function(value) - drawHighlights = value - reset() + WG['bloom'].setBrightness = function(value) + basicAlpha = value + reset() if initialized == false then Spring.Echo('Bloom shader doesnt work (enable shaders: \'ForceShaders = 1\' in springsettings.cfg)') end end - WG['bloom'].getBrightness = function() - return basicAlpha + WG['bloom'].getBlursize = function() + return globalBlursizeMult end - WG['bloom'].setBrightness = function(value) - basicAlpha = value - reset() + WG['bloom'].setBlursize = function(value) + globalBlursizeMult = value + reset() if initialized == false then Spring.Echo('Bloom shader doesnt work (enable shaders: \'ForceShaders = 1\' in springsettings.cfg)') end end + WG['bloom'].getPreset = function() + return qualityPreset + end + WG['bloom'].setPreset = function(value) + qualityPreset = value + loadPreset() + end if (gl.CreateShader == nil) then RemoveMe("[BloomShader::Initialize] no shader support") @@ -263,6 +280,7 @@ function widget:Initialize() combineShader = gl.CreateShader({ fragment = [[ + #version 150 compatibility uniform sampler2D texture0; uniform sampler2D texture1; uniform float illuminationThreshold; @@ -291,6 +309,7 @@ function widget:Initialize() blurShaderH71 = gl.CreateShader({ fragment = [[ + #version 150 compatibility uniform sampler2D texture0; uniform float inverseRX; uniform float fragKernelRadius; @@ -326,6 +345,7 @@ function widget:Initialize() blurShaderV71 = gl.CreateShader({ fragment = [[ + #version 150 compatibility uniform sampler2D texture0; uniform float inverseRY; uniform float fragKernelRadius; @@ -361,6 +381,7 @@ function widget:Initialize() brightShader = gl.CreateShader({ fragment = [[ + #version 150 compatibility uniform sampler2D texture0; uniform float illuminationThreshold; uniform float inverseRX; @@ -412,10 +433,6 @@ function widget:Shutdown() if initialized then gl.DeleteTexture(brightTexture1 or "") gl.DeleteTexture(brightTexture2 or "") - if drawHighlights then - gl.DeleteTexture(brightTexture3 or "") - gl.DeleteTexture(brightTexture4 or "") - end gl.DeleteTexture(screenTexture or "") if (gl.DeleteShader) then @@ -481,17 +498,17 @@ local function Bloom() mglRenderToTexture(brightTexture1, screenTexture, 1, -1) glUseShader(0) - for i = 1, 4 do + for i = 1, blurPasses do glUseShader(blurShaderH71) glUniformInt(blurShaderH71Text0Loc, 0) glUniform( blurShaderH71InvRXLoc, ivsx) - glUniform( blurShaderH71FragLoc, kernelRadius) + glUniform( blurShaderH71FragLoc, kernelRadius*blursize*globalBlursizeMult) mglRenderToTexture(brightTexture2, brightTexture1, 1, -1) glUseShader(0) glUseShader(blurShaderV71) glUniformInt(blurShaderV71Text0Loc, 0) glUniform( blurShaderV71InvRYLoc, ivsy) - glUniform( blurShaderV71FragLoc, kernelRadius) + glUniform( blurShaderV71FragLoc, kernelRadius*blursize*globalBlursizeMult) mglRenderToTexture(brightTexture1, brightTexture2, 1, -1) glUseShader(0) end @@ -505,43 +522,6 @@ local function Bloom() mglActiveTexture(0, screenTexture, vsx, vsy, false, true) mglActiveTexture(1, brightTexture1, vsx, vsy, false, true) glUseShader(0) - - -- highlights - if drawHighlights then - glCopyToTexture(screenTexture, 0, 0, 0, 0, vsx, vsy) - - glUseShader(brightShader) - glUniformInt(brightShaderText0Loc, 0) - glUniform( brightShaderInvRXLoc, ivsx) - glUniform( brightShaderInvRYLoc, ivsy) - glUniform( brightShaderIllumLoc, 0.5) - mglRenderToTexture(brightTexture3, screenTexture, 1, -1) - glUseShader(0) - - for i = 1, 1 do - glUseShader(blurShaderH71) - glUniformInt(blurShaderH71Text0Loc, 0) - glUniform( blurShaderH71InvRXLoc, ivsx) - glUniform( blurShaderH71FragLoc, kernelRadius2) - mglRenderToTexture(brightTexture4, brightTexture3, 1, -1) - glUseShader(0) - glUseShader(blurShaderV71) - glUniformInt(blurShaderV71Text0Loc, 0) - glUniform( blurShaderV71InvRYLoc, ivsy) - glUniform( blurShaderV71FragLoc, kernelRadius2) - mglRenderToTexture(brightTexture3, brightTexture4, 1, -1) - glUseShader(0) - end - glUseShader(combineShader) - glUniformInt(combineShaderDebgDrawLoc, dbgDraw) - glUniformInt(combineShaderTexture0Loc, 0) - glUniformInt(combineShaderTexture1Loc, 1) - glUniform( combineShaderIllumLoc, illumThreshold*0.66) - glUniform( combineShaderFragLoc, highlightsAlpha) - mglActiveTexture(0, screenTexture, vsx, vsy, false, true) - mglActiveTexture(1, brightTexture3, vsx, vsy, false, true) - glUseShader(0) - end end function widget:DrawScreenEffects() @@ -552,27 +532,24 @@ end function widget:GetConfigData(data) savedTable = {} savedTable.basicAlpha = basicAlpha - savedTable.drawHighlights = drawHighlights + savedTable.qualityPreset = qualityPreset + savedTable.globalBlursizeMult = globalBlursizeMult return savedTable end function widget:SetConfigData(data) if data.basicAlpha ~= nil then basicAlpha = data.basicAlpha - if data.highlightsAlpha ~= nil then - highlightsAlpha = data.highlightsAlpha - end - drawHighlights = data.drawHighlights end -end - -function widget:TextCommand(command) - if (string.find(command, "advbloom") == 1 and string.len(command) == 8) then - WG['bloom'].setAdvBloom(not drawHighlights) - if drawHighlights then - Spring.Echo('Adv bloom enabled') - else - Spring.Echo('Adv bloom disabled') - end + if data.globalBlursizeMult ~= nil then + globalBlursizeMult = data.globalBlursizeMult + end + if data.qualityPreset ~= nil then + if presets[data.qualityPreset] ~= nil then + qualityPreset = data.qualityPreset + blursize = presets[qualityPreset].blursize + blurPasses = presets[qualityPreset].blurPasses + quality = presets[qualityPreset].quality + end end end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_bloom_shader_deferred.lua b/LuaUI/Widgets_Evo/gfx_bloom_shader_deferred.lua new file mode 100644 index 000000000..6117c8606 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_bloom_shader_deferred.lua @@ -0,0 +1,509 @@ +function widget:GetInfo() + return { + name = "Bloom Shader Deferred", --(v0.5) + desc = "Light Bloom Shader, simulates overbrightness", + author = "Kloot, Beherith", + date = "2018-05-13", + license = "GPL V2", + layer = 99999, + enabled = true, + } +end + + +-- config params +local dbgDraw = 0 -- draw only the bloom-mask? [0 | 1] +local globalBlursizeMult = 1 + +local glowAmplifier = 0.75 -- intensity multiplier when filtering a glow source fragment [1, n] +local blurAmplifier = 1 -- intensity multiplier when applying a blur pass [1, n] (should be set close to 1) +local drawWorldAlpha = 0.08 -- darken world so bloom doesnt blown-white out the brightest areas too much +local illumThreshold = 0 -- how bright does a fragment need to be before being considered a glow source? [0, 1] + +local presets = { + { + blursize = 22, -- gaussian blur iteration blur size + blurPasses = 1, -- how many iterations of Gaussian blur should be applied to the glow sources? + quality = 4, -- resolution divider + }, + { + blursize = 17, + blurPasses = 2, + quality = 2, + }, + { + blursize = 13, + blurPasses = 3, + quality = 2, + }, +} +--quality =1 : 90 fps, 9% memctrler load, 99% shader load +--quality =2 : 113 fps, 57% memctrler load, 99% shader load +--quality =4 : 123 fps, 9% memctrler load, 99% shader load +local qualityPreset = 1 +local blursize = presets[qualityPreset].blursize +local blurPasses = presets[qualityPreset].blurPasses +local quality = presets[qualityPreset].quality + + -- non-editables +local vsx = 1 -- current viewport width +local vsy = 1 -- current viewport height +local ivsx = 1.0 / vsx +local ivsy = 1.0 / vsy + +local debugBrightShader = false + + +-- shader and texture handles +local blurShaderH71 = nil +local blurShaderV71 = nil + +local brightShader = nil +local brightTexture1 = nil +local brightTexture2 = nil + +local combineShader = nil + +-- speedups +local glGetSun = gl.GetSun + +local glCreateTexture = gl.CreateTexture +local glDeleteTexture = gl.DeleteTexture +local glActiveTexture = gl.ActiveTexture +local glCopyToTexture = gl.CopyToTexture +local glRenderToTexture = gl.RenderToTexture +local glTexture = gl.Texture +local glTexRect = gl.TexRect + +local glGetShaderLog = gl.GetShaderLog +local glCreateShader = gl.CreateShader +local glDeleteShader = gl.DeleteShader +local glUseShader = gl.UseShader + +local glUniformInt = gl.UniformInt +local glUniform = gl.Uniform +local glGetUniformLocation = gl.GetUniformLocation +local glGetActiveUniforms = gl.GetActiveUniforms + + +-- shader uniform locations +local brightShaderText0Loc = nil +local brightShaderText1Loc = nil +local brightShaderIllumLoc = nil +local brightShaderFragLoc = nil + + +local blurShaderH71Text0Loc = nil +local blurShaderH71FragLoc = nil +local blurShaderV71Text0Loc = nil +local blurShaderV71FragLoc = nil + +local combineShaderDebgDrawLoc = nil +local combineShaderTexture0Loc = nil +local combineShaderTexture1Loc = nil + + +local hasdeferredmodelrendering = nil + +local function SetIllumThreshold() + local ra, ga, ba = glGetSun("ambient", "unit") + local rd, gd, bd = glGetSun("diffuse","unit") + local rs, gs, bs = glGetSun("specular") + + local ambientIntensity = ra * 0.299 + ga * 0.587 + ba * 0.114 + local diffuseIntensity = rd * 0.299 + gd * 0.587 + bd * 0.114 + local specularIntensity = rs * 0.299 + gs * 0.587 + bs * 0.114 + + illumThreshold = illumThreshold*(0.8 * ambientIntensity) + (0.5 * diffuseIntensity) + (0.1 * specularIntensity) + illumThreshold = math.min(illumThreshold, 0.8) + + illumThreshold = (0.5 + illumThreshold) / 2 +end + +local function RemoveMe(msg) + Spring.Echo(msg) + widgetHandler:RemoveWidget() +end + +local function MakeBloomShaders() + + if (glDeleteShader) then + if brightShader ~= nil then glDeleteShader(brightShader or 0) end + if blurShaderH71 ~= nil then glDeleteShader(blurShaderH71 or 0) end + if blurShaderV71 ~= nil then glDeleteShader(blurShaderV71 or 0) end + if combineShader ~= nil then glDeleteShader(combineShader or 0) end + end + + combineShader = glCreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D texture0; + uniform int debugDraw; + + void main(void) { + vec4 a = texture2D(texture0, gl_TexCoord[0].st); + if (debugDraw == 1) { + a.a= 1.0; + } + gl_FragColor = a; + } + ]], + --while this vertex shader seems to do nothing, it actually does the very important world space to screen space mapping for gl.TexRect! + vertex = [[ + #version 150 compatibility + void main(void) + { + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_Vertex; + } + ]], + uniformInt = { + texture0 = 0, + debugDraw = 0, + } + }) + + if (combineShader == nil) then + RemoveMe("[BloomShader::Initialize] combineShader compilation failed"); print(glGetShaderLog()); return + end + + -- How about we do linear sampling instead, using the GPU's built in texture fetching linear blur hardware :) + -- http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ + -- this allows us to get away with 5 texture fetches instead of 9 for our 9 sized kernel! + -- TODO: all this simplification may result in the accumulation of quantizing errors due to the small numbers that get pushed into the BrightTexture + + blurShaderH71 = glCreateShader({ + fragment = "#version 150 compatibility\n".. + "#define inverseRX " .. tostring(ivsx) .. "\n" .. [[ + uniform sampler2D texture0; + uniform int blursize; + uniform float fragBlurAmplifier; + const float invKernelSum = 0.0084; // (1/119) + + void main(void) { + vec2 texCoors = vec2(gl_TexCoord[0]); + vec3 newblur; + + newblur = 10 * texture2D(texture0, texCoors + vec2(-blursize * inverseRX, 0)).rgb; + newblur += 37 * texture2D(texture0, texCoors + vec2(-(blursize/3.5) * inverseRX, 0)).rgb; + newblur += 25 * texture2D(texture0, texCoors + vec2(0 , 0)).rgb; + newblur += 37 * texture2D(texture0, texCoors + vec2( (blursize/3.5) * inverseRX, 0)).rgb; + newblur += 10 * texture2D(texture0, texCoors + vec2( blursize * inverseRX, 0)).rgb; + gl_FragColor = vec4(newblur * invKernelSum * fragBlurAmplifier, 1.0); + } + ]], + uniformInt = { + texture0 = 0, + blursize = math.floor(blursize * globalBlursizeMult), + }, + }) + + if (blurShaderH71 == nil) then + RemoveMe("[BloomShader::Initialize] blurShaderH71 compilation failed"); Spring.Echo(glGetShaderLog()); return + end + + blurShaderV71 = glCreateShader({ + fragment = "#version 150 compatibility\n".. + "#define inverseRY " .. tostring(ivsy) .. "\n" .. [[ + uniform sampler2D texture0; + uniform int blursize; + uniform float fragBlurAmplifier; + const float invKernelSum = 0.0084; // (1/119) + + void main(void) { + vec2 texCoors = vec2(gl_TexCoord[0]); + vec3 newblur; + + newblur = 10 * texture2D(texture0, texCoors + vec2(0, -blursize * inverseRY)).rgb; + newblur += 37 * texture2D(texture0, texCoors + vec2(0, -(blursize/3.5) * inverseRY)).rgb; + newblur += 25 * texture2D(texture0, texCoors + vec2(0, 0)).rgb; + newblur += 37 * texture2D(texture0, texCoors + vec2(0, (blursize/3.5) * inverseRY)).rgb; + newblur += 10 * texture2D(texture0, texCoors + vec2(0, blursize * inverseRY)).rgb; + gl_FragColor = vec4(newblur * invKernelSum * fragBlurAmplifier, 1.0); + } + ]], + + uniformInt = { + texture0 = 0, + blursize = math.floor(blursize*globalBlursizeMult), + } + }) + + if (blurShaderV71 == nil) then + RemoveMe("[BloomShader::Initialize] blurShaderV71 compilation failed"); Spring.Echo(glGetShaderLog()); return + end + + brightShader = glCreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D modelDiffuseTex; + uniform sampler2D modelEmitTex; + + uniform sampler2D modelDepthTex; + uniform sampler2D mapDepthTex; + + uniform float illuminationThreshold; + uniform float fragGlowAmplifier; + + void main(void) { + vec2 texCoors = vec2(gl_TexCoord[0]); + vec3 color = vec3(texture2D(modelDiffuseTex, texCoors)); + vec4 colorEmit = texture2D(modelEmitTex, texCoors); + + float modelDepth = texture2D(modelDepthTex, texCoors).r; + float mapDepth = texture2D(mapDepthTex, texCoors).r; + + float unoccludedModel = float(modelDepth < mapDepth); + + //float detectchangedbuffer = clamp(colorEmit.g,0.0,1.0); //this is required because some things overwrite all the buffers, and deferred rendering forces this to 0.0 + //color = color *(1.0 - detectchangedbuffer); + + color += color * colorEmit.r; + + float illum = dot(color, vec3(0.2990, 0.4870, 0.2140)); //adjusted from the real values of vec3(0.2990, 0.5870, 0.1140) + + vec4 illumCond = vec4(illum > illuminationThreshold) ; + + gl_FragColor = mix( + vec4(0.0, 0.0, 0.0, 1.0), + vec4(color * (illum-illuminationThreshold), 1.0) * fragGlowAmplifier * unoccludedModel, + illumCond); + } + ]], + + uniformInt = { + modelDiffuseTex = 0, + modelEmitTex = 1, + modelDepthTex = 2, + mapDepthTex = 3, + } + }) + + if (brightShader == nil) then + RemoveMe("[BloomShader::Initialize] brightShader compilation failed"); print(glGetShaderLog()); return + end + + + + --brightShaderText0Loc = glGetUniformLocation(brightShader, "modelDiffuseTex") + --brightShaderText1Loc = glGetUniformLocation(brightShader, "modelEmitTex") + + brightShaderIllumLoc = glGetUniformLocation(brightShader, "illuminationThreshold") + brightShaderFragLoc = glGetUniformLocation(brightShader, "fragGlowAmplifier") + + --blurShaderH71Text0Loc = glGetUniformLocation(blurShaderH71, "texture0") + blurShaderH71FragLoc = glGetUniformLocation(blurShaderH71, "fragBlurAmplifier") + --blurShaderV71Text0Loc = glGetUniformLocation(blurShaderV71, "texture0") + blurShaderV71FragLoc = glGetUniformLocation(blurShaderV71, "fragBlurAmplifier") + + combineShaderDebgDrawLoc = glGetUniformLocation(combineShader, "debugDraw") + --combineShaderTexture0Loc = glGetUniformLocation(combineShader, "texture0") + --combineShaderTexture1Loc = glGetUniformLocation(combineShader, "texture1") + +end + + +function widget:ViewResize(viewSizeX, viewSizeY) + vsx = math.max(4,viewSizeX); ivsx = 1.0 / vsx --we can do /n here! + vsy = math.max(4,viewSizeY); ivsy = 1.0 / vsy + qvsx,qvsy = math.floor(vsx/quality), math.floor(vsy/quality) + glDeleteTexture(brightTexture1 or "") + glDeleteTexture(brightTexture2 or "") + + brightTexture1 = glCreateTexture(qvsx, qvsy, { + fbo = true, + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, + }) + brightTexture2 = glCreateTexture(qvsx, qvsy, { + fbo = true, + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP, wrap_t = GL.CLAMP, + }) + + if (brightTexture1 == nil or brightTexture2 == nil) then + if (brightTexture1 == nil ) then Spring.Echo('brightTexture1 == nil ') end + if (brightTexture2 == nil ) then Spring.Echo('brightTexture2 == nil ') end + RemoveMe("[BloomShader::ViewResize] removing widget, bad texture target") + return + end + MakeBloomShaders() --we are gonna reinit the the widget, in order to recompile the shaders with the static IVSX and IVSY values in the blur shaders +end + +widget:ViewResize(widgetHandler:GetViewSizes()) + +SetIllumThreshold() + +function loadPreset() + if presets[qualityPreset] ~= nil then + blursize = presets[qualityPreset].blursize + blurPasses = presets[qualityPreset].blurPasses + quality = presets[qualityPreset].quality + MakeBloomShaders() + end +end + +function widget:Initialize() + + WG['bloomdeferred'] = {} + WG['bloomdeferred'].getBrightness = function() + return glowAmplifier + end + WG['bloomdeferred'].setBrightness = function(value) + glowAmplifier = value + MakeBloomShaders() + end + WG['bloomdeferred'].getBlursize = function() + return globalBlursizeMult + end + WG['bloomdeferred'].setBlursize = function(value) + globalBlursizeMult = value + MakeBloomShaders() + end + WG['bloomdeferred'].getPreset = function() + return qualityPreset + end + WG['bloomdeferred'].setPreset = function(value) + qualityPreset = value + loadPreset() + end + + + if (glCreateShader == nil) then + RemoveMe("[BloomShader::Initialize] removing widget, no shader support") + return + end + + hasdeferredmodelrendering = (Spring.GetConfigString("AllowDeferredModelRendering")=='1') + if hasdeferredmodelrendering == false then + RemoveMe("[BloomShader::Initialize] removing widget, AllowDeferredModelRendering is required") + end + hasdeferredmaprendering = (Spring.GetConfigString("AllowDeferredMapRendering")=='1') + if hasdeferredmaprendering == false then + RemoveMe("[BloomShader::Initialize] removing widget, AllowDeferredMapRendering is required") + end + MakeBloomShaders() + +end + +function widget:Shutdown() + + glDeleteTexture(brightTexture1 or "") + + if (glDeleteShader) then + if brightShader ~= nil then glDeleteShader(brightShader or 0) end + if blurShaderH71 ~= nil then glDeleteShader(blurShaderH71 or 0) end + if blurShaderV71 ~= nil then glDeleteShader(blurShaderV71 or 0) end + if combineShader ~= nil then glDeleteShader(combineShader or 0) end + end +end + + +local function Bloom() + gl.DepthMask(false) + gl.Color(1, 1, 1, 1) + + glUseShader(brightShader) + --glUniformInt(brightShaderText0Loc, 0) + --glUniformInt(brightShaderText1Loc, 1) + glUniform( brightShaderIllumLoc, illumThreshold) + glUniform( brightShaderFragLoc, glowAmplifier) + glTexture(0, "$model_gbuffer_difftex") + glTexture(1, "$model_gbuffer_emittex") + glTexture(2, "$model_gbuffer_zvaltex") + glTexture(3, "$map_gbuffer_zvaltex") + + glRenderToTexture(brightTexture1, gl.TexRect, -1, 1, 1, -1) + + glTexture(0, false) + glTexture(1, false) + glTexture(2, false) + glTexture(3, false) + glUseShader(0) + + if not debugBrightShader then + for i = 1, blurPasses do + glUseShader(blurShaderH71) + --glUniformInt(blurShaderH71Text0Loc, 0) + glUniform(blurShaderH71FragLoc, blurAmplifier) + glTexture(brightTexture1) + glRenderToTexture(brightTexture2, gl.TexRect, -1, 1, 1, -1) + glTexture(false) + glUseShader(0) + + glUseShader(blurShaderV71) + --glUniformInt(blurShaderV71Text0Loc, 0) + glUniform(blurShaderV71FragLoc, blurAmplifier) + glTexture(brightTexture2) + glRenderToTexture(brightTexture1, gl.TexRect, -1, 1, 1, -1) + glTexture(false) + glUseShader(0) + end + end + + if dbgDraw == 0 then + gl.Blending("alpha_add") + else + gl.Blending(GL.ONE, GL.ZERO) + end + + glUseShader(combineShader) + glUniformInt(combineShaderDebgDrawLoc, dbgDraw) + --glUniformInt(combineShaderTexture0Loc, 0) + glTexture(0, brightTexture1) + gl.TexRect(-1, -1, 1, 1, 0, 0, 1, 1) + glTexture(0, false) + glUseShader(0) + + gl.Blending("reset") + gl.DepthMask(true) +end + +local camX, camY, camZ = Spring.GetCameraPosition() +local camDirX, camDirY, camDirZ = Spring.GetCameraDirection() +function widget:Update(dt) + if drawWorldAlpha <= 0 then return end + camX, camY, camZ = Spring.GetCameraPosition() + camDirX, camDirY, camDirZ = Spring.GetCameraDirection() +end + +function widget:DrawWorld() + if drawWorldAlpha <= 0 then return end + -- darken world so bloom doesnt blown-white out the brightest areas too much + + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.PushPopMatrix(function() + gl.Color(0, 0, 0, drawWorldAlpha * glowAmplifier) + gl.Translate(camX + (camDirX * 360), camY + (camDirY * 360), camZ + (camDirZ * 360)) + gl.Billboard() + gl.Rect(-vsx, -vsy, vsx, vsy) + end) + + Bloom() +end + + +function widget:GetConfigData(data) + savedTable = {} + savedTable.glowAmplifier = glowAmplifier + savedTable.qualityPreset = qualityPreset + savedTable.globalBlursizeMult = globalBlursizeMult + return savedTable +end + +function widget:SetConfigData(data) + if data.glowAmplifier ~= nil then + glowAmplifier = data.glowAmplifier + end + if data.globalBlursizeMult ~= nil then + globalBlursizeMult = data.globalBlursizeMult + end + if data.qualityPreset ~= nil then + if presets[data.qualityPreset] ~= nil then + qualityPreset = data.qualityPreset + blursize = presets[qualityPreset].blursize + blurPasses = presets[qualityPreset].blurPasses + quality = presets[qualityPreset].quality + end + end +end diff --git a/LuaUI/Widgets_Evo/gfx_cas.lua b/LuaUI/Widgets_Evo/gfx_cas.lua new file mode 100644 index 000000000..03e5baf4d --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_cas.lua @@ -0,0 +1,222 @@ +if gl.CreateShader == nil then + return +end + +function widget:GetInfo() + return { + name = "Contrast Adaptive Sharpen (Old)", + desc = "Spring port of AMD FidelityFX' Contrast Adaptive Sharpen (CAS)", + author = "martymcmodding, ivand", + layer = 2000, + enabled = true, + } +end + +-- Shameless port from https://gist.github.com/martymcmodding/30304c4bffa6e2bd2eb59ff8bb09d135 + +----------------------------------------------------------------- +-- Constants +----------------------------------------------------------------- + +local GL_RGBA8 = 0x8058 + +local SHARPNESS = 0.7 +local version = 1.01 + +----------------------------------------------------------------- +-- Lua Shortcuts +----------------------------------------------------------------- + +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glCallList = gl.CallList +local glCopyToTexture = gl.CopyToTexture + +----------------------------------------------------------------- +-- File path Constants +----------------------------------------------------------------- + +local luaShaderDir = "LuaUI/Widgets_Evo/Include/" + +----------------------------------------------------------------- +-- Shader Sources +----------------------------------------------------------------- + +local vsCAS = [[ +#version 150 compatibility + +void main() { + gl_Position = gl_Vertex; +} +]] + +local fsCAS = [[ +#version 150 compatibility +#line 20051 + +uniform sampler2D screenCopyTex; +uniform float sharpness; + +#if 0 + #define TEXEL_FETCH_OFFSET(t, c, l, o) texelFetch(t, c + o, l) +#else + #define TEXEL_FETCH_OFFSET texelFetchOffset +#endif + +vec3 CASPass(ivec2 tc) { + // fetch a 3x3 neighborhood around the pixel 'e', + // a b c + // d(e)f + // g h i + vec3 a = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2(-1, -1)).rgb; + vec3 b = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 0, -1)).rgb; + vec3 c = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 1, -1)).rgb; + vec3 d = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2(-1, 0)).rgb; + vec3 e = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 0, 0)).rgb; + vec3 f = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 1, 0)).rgb; + vec3 g = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2(-1, 1)).rgb; + vec3 h = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 0, 1)).rgb; + vec3 i = TEXEL_FETCH_OFFSET(screenCopyTex, tc, 0, ivec2( 1, 1)).rgb; + + // Soft min and max. + // a b c b + // d e f * 0.5 + d e f * 0.5 + // g h i h + // These are 2.0x bigger (factored out the extra multiply). + vec3 mnRGB = min(min(min(d, e), min(f, b)), h); + vec3 mnRGB2 = min(mnRGB, min(min(a, c), min(g, i))); + mnRGB += mnRGB2; + + vec3 mxRGB = max(max(max(d, e), max(f, b)), h); + vec3 mxRGB2 = max(mxRGB, max(max(a, c), max(g, i))); + mxRGB += mxRGB2; + + // Smooth minimum distance to signal limit divided by smooth max. + vec3 rcpMRGB = vec3(1.0) / mxRGB; + vec3 ampRGB = clamp(min(mnRGB, 2.0 - mxRGB) * rcpMRGB, vec3(0.0), vec3(1.0)); + + // Shaping amount of sharpening. + ampRGB = inversesqrt(ampRGB); + + float peak = 8.0 - 3.0 * sharpness; + vec3 wRGB = vec3(-1.0) / (ampRGB * peak); + + vec3 rcpWeightRGB = vec3(1.0) / (1.0 + 4.0 * wRGB); + + // 0 w 0 + // Filter shape: w 1 w + // 0 w 0 + vec3 window = (b + d) + (f + h); + vec3 outColor = clamp((window * wRGB + e) * rcpWeightRGB, vec3(0.0), vec3(1.0)); + + return outColor; +} + +void main() { + gl_FragColor = vec4(CASPass(ivec2(gl_FragCoord.xy)), 1.0); +} +]] + +----------------------------------------------------------------- +-- Global Variables +----------------------------------------------------------------- + +local LuaShader = VFS.Include(luaShaderDir.."LuaShader.lua") + +local vsx, vsy, vpx, vpy +local screenCopyTex +local casShader + +local fullTexQuad + +----------------------------------------------------------------- +-- Local Functions +----------------------------------------------------------------- + + +----------------------------------------------------------------- +-- Widget Functions +----------------------------------------------------------------- + + +function widget:Initialize() + + if gl.CreateShader == nil then + Spring.Echo("CAS: createshader not supported, removing") + widgetHandler:RemoveWidget(self) + return + end + + vsx, vsy, vpx, vpy = Spring.GetViewGeometry() + + local commonTexOpts = { + target = GL_TEXTURE_2D, + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + + wrap_s = GL.CLAMP_TO_EDGE, + wrap_t = GL.CLAMP_TO_EDGE, + } + + commonTexOpts.format = GL_RGBA8 + screenCopyTex = gl.CreateTexture(vsx, vsy, commonTexOpts) + + casShader = LuaShader({ + vertex = vsCAS, + fragment = fsCAS, + uniformInt = { + screenCopyTex = 0, + }, + }, ": Contrast Adaptive Sharpen") + casShader:Initialize() + + fullTexQuad = gl.CreateList( function () + gl.DepthTest(false) + gl.Blending(false) + gl.TexRect(-1, -1, 1, 1, false, true) --false, true + gl.Blending(true) + end) + + WG.cas = {} + WG.cas.setSharpness = function(value) + SHARPNESS = value + end + WG.cas.getSharpness = function(value) + return SHARPNESS + end +end + +function widget:Shutdown() + gl.DeleteTexture(screenCopyTex) + casShader:Finalize() + gl.DeleteList(fullTexQuad) +end + +function widget:ViewResize() + widget:Shutdown() + widget:Initialize() +end + +function widget:DrawScreenEffects() + glCopyToTexture(screenCopyTex, 0, 0, vpx, vpy, vsx, vsy) + glTexture(0, screenCopyTex) + casShader:ActivateWith( function() + casShader:SetUniform("sharpness", SHARPNESS) + glCallList(fullTexQuad) + end) + glTexture(0, false) +end + +function widget:GetConfigData(data) + return { + version = version, + SHARPNESS = SHARPNESS + } +end + +function widget:SetConfigData(data) + if data.SHARPNESS ~= nil and data.version ~= nil and data.version == version then + SHARPNESS = data.SHARPNESS + end +end diff --git a/LuaUI/Widgets_Evo/gfx_darken_map.lua b/LuaUI/Widgets_Evo/gfx_darken_map.lua index 0970e0a80..3c527367e 100644 --- a/LuaUI/Widgets_Evo/gfx_darken_map.lua +++ b/LuaUI/Widgets_Evo/gfx_darken_map.lua @@ -9,7 +9,7 @@ function widget:GetInfo() author = "Floris", date = "2015", license = "GNU GPL, v2 or later", - layer = 0, + layer = 10000, enabled = true -- loaded by default? } end @@ -69,19 +69,21 @@ end local prevCam = {} prevCam[1],prevCam[2],prevCam[3] = Spring.GetCameraPosition() function widget:Update(dt) - camX, camY, camZ = Spring.GetCameraPosition() - camDirX,camDirY,camDirZ = Spring.GetCameraDirection() - if camX ~= prevCam[1] or camY ~= prevCam[2] or camZ ~= prevCam[3] then - features = Spring.GetVisibleFeatures(gaia, 250, false) - end + if darknessvalue >= 0.01 then + camX, camY, camZ = Spring.GetCameraPosition() + camDirX,camDirY,camDirZ = Spring.GetCameraDirection() + if darkenFeatures and (camX ~= prevCam[1] or camY ~= prevCam[2] or camZ ~= prevCam[3]) then + features = Spring.GetVisibleFeatures(-1, 250, false) + end + end end function widget:DrawWorldPreUnit() + if darknessvalue >= 0.01 then - local drawMode = Spring.GetMapDrawMode() - if (drawMode=="height") or (drawMode=="path") then return end + local drawMode = Spring.GetMapDrawMode() + if (drawMode=="height") or (drawMode=="path") then return end - if darknessvalue >= 0.01 then gl.PushMatrix() gl.Color(0,0,0,darknessvalue) gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) @@ -94,18 +96,20 @@ end local spGetFeatureDefID = Spring.GetFeatureDefID function widget:DrawWorld() if darkenFeatures and darknessvalue >= 0.01 then - if features == nil then - features = Spring.GetVisibleFeatures(gaia, 250, false) + features = Spring.GetVisibleFeatures(-1, 250, false) end - + if features ~= nil then gl.DepthTest(true) gl.PolygonOffset(-2, -2) gl.Color(0,0,0,darknessvalue) for i, featureID in pairs(features) do - gl.Texture('%-'..spGetFeatureDefID(featureID)..':1') - gl.Feature(featureID, true) + local fdefID = spGetFeatureDefID(featureID) + if fdefID then + gl.Texture('%-'..fdefID..':1') + gl.Feature(featureID, true) + end end gl.PolygonOffset(false) gl.DepthTest(false) diff --git a/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua b/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua index 1d4690ae4..2078e1157 100644 --- a/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua +++ b/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua @@ -51,9 +51,9 @@ local spGetCameraPosition = Spring.GetCameraPosition local spWorldToScreenCoords = Spring.WorldToScreenCoords -local glowImg = ":n:LuaUI/Images/glow.dds" -local beamGlowImg = "LuaUI/Images/barglow-center.dds" -local beamGlowEndImg = "LuaUI/Images/barglow-edge.dds" +local glowImg = "LuaUI/Images/glow2.dds" +local beamGlowImg = ":n:LuaUI/Images/barglow-center.png" +local beamGlowEndImg = ":n:LuaUI/Images/barglow-edge.png" local GLSLRenderer = true @@ -283,7 +283,7 @@ function widget:Initialize() if (glCreateShader == nil) then Spring.Echo('Deferred Rendering requires shader support!') - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end @@ -292,14 +292,14 @@ function widget:Initialize() if (Spring.GetConfigString("AllowDeferredMapRendering") == '0' or Spring.GetConfigString("AllowDeferredModelRendering") == '0') then Spring.Echo('Deferred Rendering (gfx_deferred_rendering.lua) requires AllowDeferredMapRendering and AllowDeferredModelRendering to be enabled in springsettings.cfg!') - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end if ((not forceNonGLSL) and Spring.GetMiniMapDualScreen() ~= 'left') then --FIXME dualscreen if (not glCreateShader) then spEcho("gfx_deferred_rendering.lua: Shaders not found, removing self.") GLSLRenderer = false - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) else depthPointShader = depthPointShader or glCreateShader({ defines = { @@ -322,7 +322,7 @@ function widget:Initialize() spEcho(glGetShaderLog()) spEcho("gfx_deferred_rendering.lua: Bad depth point shader, removing self.") GLSLRenderer = false - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) else lightposlocPoint = glGetUniformLocation(depthPointShader, "lightpos") lightcolorlocPoint = glGetUniformLocation(depthPointShader, "lightcolor") @@ -351,7 +351,7 @@ function widget:Initialize() spEcho(glGetShaderLog()) spEcho("gfx_deferred_rendering.lua: Bad depth beam shader, removing self.") GLSLRenderer = false - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) else lightposlocBeam = glGetUniformLocation(depthBeamShader, 'lightpos') lightpos2locBeam = glGetUniformLocation(depthBeamShader, 'lightpos2') @@ -487,20 +487,18 @@ end -- adding a glow to Cannon projectiles function widget:DrawWorld() - local lights = pointLights glBlending(GL.SRC_ALPHA, GL.ONE) gl.Texture(glowImg) + local size = 1 for i = 1, pointLightCount do local light = lights[i] local param = light.param if param.gib == nil and param.type == "Cannon"then - size = param.glowradius * 0.28 + size = param.glowradius * 0.44 gl.PushMatrix() local colorMultiplier = 1 / math.max(param.r, param.g, param.b) - local glowOpacity = 0.013 + (size/32000) - if glowOpacity > 0.027 then glowOpacity = 0.027 end - gl.Color(param.r*colorMultiplier, param.g*colorMultiplier, param.b*colorMultiplier, glowOpacity) + gl.Color(param.r*colorMultiplier, param.g*colorMultiplier, param.b*colorMultiplier, 0.016 + (size/4000)) gl.Translate(light.px, light.py, light.pz) gl.Billboard(true) gl.TexRect(-(size/2), -(size/2), (size/2), (size/2)) @@ -509,26 +507,26 @@ function widget:DrawWorld() end gl.Billboard(false) gl.Texture(false) - glBlending(false) + glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) end function widget:DrawScreenEffects() if not (GLSLRenderer) then Spring.Echo('Removing deferred rendering widget: failed to use GLSL shader') - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end --glBlending(GL.DST_COLOR, GL.ONE) -- Set add blending mode glBlending(GL.SRC_ALPHA, GL.ONE) - if beamLightCount > 0 then DrawLightType(beamLights, beamLightCount, 1) end + --glBlending(GL.ONE_MINUS_SRC_COLOR, GL.ONE) if pointLightCount > 0 then DrawLightType(pointLights, pointLightCount, 0) end - - glBlending(false) + + glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_disablegrass.lua b/LuaUI/Widgets_Evo/gfx_disablegrass.lua deleted file mode 100644 index a7b4abec9..000000000 --- a/LuaUI/Widgets_Evo/gfx_disablegrass.lua +++ /dev/null @@ -1,16 +0,0 @@ -function widget:GetInfo() - return { - name = "Disable Grass", - desc = "Disables Spring Grass (improves FPS)", - author = "Some Loser", - date = "2012-08-11", - license = "GPL v2 or later", - layer = 5, - enabled = true - } -end - -function widget:Initialize() - Spring.SetConfigInt("GrassDetail",0) -end - diff --git a/LuaUI/Widgets_Evo/gfx_dof.lua b/LuaUI/Widgets_Evo/gfx_dof.lua index 107938c6c..cad82e918 100644 --- a/LuaUI/Widgets_Evo/gfx_dof.lua +++ b/LuaUI/Widgets_Evo/gfx_dof.lua @@ -1,411 +1,475 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - function widget:GetInfo() - return { - name = "Depth of Field", - desc = "f10 toggles on/off, ctrl+] or [ to change intensity, /dofQuality #", - author = "jK, Satirik (shortcuts: BD & Floris)", - date = "March, 2013", - license = "GNU GPL, v2 or later", - layer = -10000, - enabled = false - } + return { + name = "Depth of Field", + version = 2.0, + desc = "Blurs far away objects.", + author = "aeonios, Shadowfury333 (with some code from Kleber Garcia)", + date = "Feb. 2019", + license = "GPL, MIT", + layer = -100000, --To run after gfx_deferred_rendering.lua + enabled = false + } end - -options = { - fadeInOut = 2, -- seconds - shortcuts = { - toggle = 'f10', - intensityIncrease = 'Ctrl+]', - intensityDecrease = 'Ctrl+[', - }, - quality = { - name = 'Quality', - type = 'number', - min = 1, - max = 30, - step = 1, - value = 4, - }, - intensity = { - name = 'Intensity', - type = 'number', - min = 0.05, - max = 5., - step = 0.05, - value = 1.5, - }, - focusCurveExp = { - name = 'Non linear focused area', - type = 'number', - min = 1., - max = 4., - step = 0.1, - value = 2, - }, - focusRangeMultiplier = { - name = 'Focus range multiplier', - type = 'number', - min = 0.1, - max = 3.0, - step = 0.1, - value = 0.2, - }, -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---hardware capability - -local canRTT = (gl.RenderToTexture ~= nil) -local canCTT = (gl.CopyToTexture ~= nil) -local canShader = (gl.CreateShader ~= nil) - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local GL_DEPTH_BITS = 0x0D56 +local highQuality = true -- doesnt seem to do anything +local autofocus = true +local mousefocus = not autofocus +local focusDepth = 300 +local fStop = 3 + +----------------------------------------------------------------- +-- Engine Functions +----------------------------------------------------------------- + +local spGetCameraPosition = Spring.GetCameraPosition +local spGetMouseState = Spring.GetMouseState +local spTraceScreenRay = Spring.TraceScreenRay +local diag = math.diag + +local glCopyToTexture = gl.CopyToTexture +local glCreateShader = gl.CreateShader +local glCreateTexture = gl.CreateTexture +local glDeleteShader = gl.DeleteShader +local glDeleteTexture = gl.DeleteTexture +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glRenderToTexture = gl.RenderToTexture +local glUseShader = gl.UseShader +local glUniform = gl.Uniform +local glUniformInt = gl.UniformInt +local glUniformMatrix = gl.UniformMatrix local GL_DEPTH_COMPONENT = 0x1902 local GL_DEPTH_COMPONENT16 = 0x81A5 local GL_DEPTH_COMPONENT24 = 0x81A6 local GL_DEPTH_COMPONENT32 = 0x81A7 --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local blurShader -local dofShader -local screencopy -local depthcopy - -local focusLoc -local focusRangeLoc -local viewXLoc -local viewYLoc -local qualityLoc -local intensityLoc -local focusCurveExpLoc -local focusRangeMultiplierLoc -local focusPtXLoc -local focusPtYLoc - -local oldvs = 0 -local vsx, vsy = widgetHandler:GetViewSizes() -function widget:ViewResize(viewSizeX, viewSizeY) - vsx, vsy = viewSizeX,viewSizeY - - if (gl.DeleteTextureFBO) then - gl.DeleteTexture(depthcopy) - gl.DeleteTextureFBO(blurtex) - gl.DeleteTextureFBO(blurtex2) - gl.DeleteTexture(screencopy) - end - - depthcopy = gl.CreateTexture(vsx,vsy, { - border = false, - format = GL_DEPTH_COMPONENT24, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - screencopy = gl.CreateTexture(vsx, vsy, { - border = false, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - - if (screencopy == nil) then - Spring.Echo("Depth of Field: texture error") - widgetHandler:RemoveWidget() - return false - end +local GL_COLOR_ATTACHMENT0_EXT = 0x8CE0 +local GL_COLOR_ATTACHMENT1_EXT = 0x8CE1 +local GL_COLOR_ATTACHMENT2_EXT = 0x8CE2 +local GL_COLOR_ATTACHMENT3_EXT = 0x8CE3 + +----------------------------------------------------------------- + + +local function CleanupTextures() + glDeleteTexture(baseBlurTex or "") + glDeleteTexture(baseNearBlurTex or "") + glDeleteTexture(intermediateBlurTex0 or "") + glDeleteTexture(intermediateBlurTex1 or "") + glDeleteTexture(intermediateBlurTex2 or "") + glDeleteTexture(intermediateBlurTex3 or "") + glDeleteTexture(finalBlurTex or "") + glDeleteTexture(finalNearBlurTex or "") + glDeleteTexture(screenTex or "") + glDeleteTexture(depthTex or "") + gl.DeleteFBO(intermediateBlurFBO) + gl.DeleteFBO(baseBlurFBO) + baseBlurTex, baseNearBlurTex, intermediateBlurTex0, intermediateBlurTex1, + intermediateBlurTex2, intermediateBlurTex3, finalBlurTex, finalNearBlurTex, + screenTex, depthTex = + nil, nil, nil, nil, + nil, nil, nil, nil, + nil, nil + intermediateBlurFBO = nil + baseBlurFBO = nil end +----------------------------------------------------------------- +-- Global Vars +----------------------------------------------------------------- + +local maxBlurDistance = 10000 --Distance in Spring units above which autofocus blurring can't happen + +local vsx = nil -- current viewport width +local vsy = nil -- current viewport height +local dofShader = nil +local screenTex = nil +local depthTex = nil +local baseBlurTex = nil +local baseNearBlurTex = nil +local baseBlurFBO = nil +local intermediateBlurTex0 = nil +local intermediateBlurTex1 = nil +local intermediateBlurTex2 = nil +local intermediateBlurTex3 = nil +local intermediateBlurFBO = nil +local finalBlurTex = nil +local finalNearBlurTex = nil + +-- shader uniform handles +local eyePosLoc = nil +local viewProjectionLoc = nil +local resolutionLoc = nil +local distanceLimitsLoc = nil +local autofocusLoc = nil +local mousefocusLoc = nil +local focusDepthLoc = nil +local mouseDepthCoordLoc = nil +local fStopLoc = nil +local qualityLoc = nil +local passLoc = nil + +-- shader uniform enums +local shaderPasses = +{ + filterSize = 0, + initialBlur = 1, + finalBlur = 2, + initialNearBlur = 3, + finalNearBlur = 4, + composition = 5, +} -function widget:GetConfigData() - return { - quality = options.quality.value, - intensity = options.intensity.value, - focusCurveExp = options.focusCurveExp.value, - focusRangeMultiplier = options.focusRangeMultiplier.value, - } -end -function widget:SetConfigData(data) - --options.quality.value = data.quality or 2. - --options.intensity.value = data.intensity or 1. - --options.focusCurveExp.value = data.focusCurveExp or 2. - --options.focusRangeMultiplier.value = data.focusRangeMultiplier or 1. +function InitTextures() + vsx, vsy = gl.GetViewSizes() + local blurTexSizeX, blurTexSizeY = vsx/2, vsy/2; + + CleanupTextures() + + screenTex = glCreateTexture(vsx, vsy, { + fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + + depthTex = gl.CreateTexture(vsx,vsy, { + border = false, + format = GL_DEPTH_COMPONENT24, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + }) + + baseBlurTex = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + if highQuality then + baseNearBlurTex = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + end + + intermediateBlurTex0 = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + + intermediateBlurTex1 = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + + intermediateBlurTex2 = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + + if highQuality then + intermediateBlurTex3 = glCreateTexture(blurTexSizeX, blurTexSizeY, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + format = GL_RGBA16F_ARB, wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + end + + finalBlurTex = glCreateTexture(blurTexSizeX, blurTexSizeY, { + fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + if highQuality then + finalNearBlurTex = glCreateTexture(blurTexSizeX, blurTexSizeY, { + fbo = true, min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + wrap_s = GL.CLAMP_TO_EDGE, wrap_t = GL.CLAMP_TO_EDGE, + }) + end + + if highQuality then + baseBlurFBO = gl.CreateFBO({ + color0 = baseBlurTex, + color1 = baseNearBlurTex, + drawbuffers = { + GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT + } + }) + + intermediateBlurFBO = gl.CreateFBO({ + color0 = intermediateBlurTex0, + color1 = intermediateBlurTex1, + color2 = intermediateBlurTex2, + color3 = intermediateBlurTex3, + drawbuffers = { + GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT, + GL_COLOR_ATTACHMENT2_EXT, + GL_COLOR_ATTACHMENT3_EXT + } + }) + else + baseBlurFBO = gl.CreateFBO({ + color0 = baseBlurTex, + drawbuffers = { + GL_COLOR_ATTACHMENT0_EXT + } + }) + + intermediateBlurFBO = gl.CreateFBO({ + color0 = intermediateBlurTex0, + color1 = intermediateBlurTex1, + color2 = intermediateBlurTex2, + drawbuffers = { + GL_COLOR_ATTACHMENT0_EXT, + GL_COLOR_ATTACHMENT1_EXT, + GL_COLOR_ATTACHMENT2_EXT + } + }) + end + + if not intermediateBlurTex0 or not intermediateBlurTex1 or not intermediateBlurTex2 + or not finalBlurTex or not baseBlurTex or not screenTex or not depthTex + or (highQuality and (not baseNearBlurTex or not intermediateBlurTex3 or not finalNearBlurTex)) then + Spring.Echo("Depth of Field: Failed to create textures!") + widgetHandler:RemoveWidget() + return + end end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function CheckHardware() - if (not canCTT) then - Spring.Echo("Depth of Field: your hardware is missing the necessary CopyToTexture feature") - widgetHandler:RemoveWidget() - return false - end - - if (not canRTT) then - Spring.Echo("Depth of Field: your hardware is missing the necessary RenderToTexture feature") - widgetHandler:RemoveWidget() - return false - end - - if (not canShader) then - Spring.Echo("Depth of Field: your hardware does not support shaders") - widgetHandler:RemoveWidget() - return false - end - - return true +function widget:ViewResize(x, y) + InitTextures() end - --- user controls -local deactivated = true -function dofToggle(cmd, line, words) - deactivated = not deactivated - if words[1] then - deactivated = words[1] == "0" - end - if not deactivated then - widgetHandler:UpdateCallIn('DrawScreenEffects') - Spring.Echo("Depth of Field: on") - else - widgetHandler:RemoveCallIn('DrawScreenEffects') - Spring.Echo("Depth of Field: off") - end +function init() + reset() + + if (glCreateShader == nil) then + Spring.Echo("[Depth of Field::Initialize] removing widget, no shader support") + widgetHandler:RemoveWidget() + return + end + + dofShader = dofShader or glCreateShader({ + defines = { + "#version 150 compatibility\n", + "#define DEPTH_CLIP01 " .. (Platform.glSupportClipSpaceControl and "1" or "0") .. "\n", + + "#define FILTER_SIZE_PASS " .. shaderPasses.filterSize .. "\n", + "#define INITIAL_BLUR_PASS " .. shaderPasses.initialBlur .. "\n", + "#define FINAL_BLUR_PASS " .. shaderPasses.finalBlur .. "\n", + "#define INITIAL_NEAR_BLUR_PASS " .. shaderPasses.initialNearBlur .. "\n", + "#define FINAL_NEAR_BLUR_PASS " .. shaderPasses.finalNearBlur .. "\n", + "#define COMPOSITION_PASS " .. shaderPasses.composition .. "\n", + + "#define BLUR_START_DIST " .. maxBlurDistance .. "\n", + + "#define LOW_QUALITY 0 \n", + "#define HIGH_QUALITY 1 \n" + }, + fragment = VFS.LoadFile("LuaUI/Widgets_EVO/Shaders/dof.fs", VFS.ZIP), + + uniformInt = {origTex = 0, blurTex0 = 1, blurTex1 = 2, blurTex2 = 3, blurTex3 = 4}, + }) + + if not dofShader then + Spring.Echo("Depth of Field: Failed to create shader!") + Spring.Echo(gl.GetShaderLog()) + widgetHandler:RemoveWidget() + return + end + + eyePosLoc = gl.GetUniformLocation(dofShader, "eyePos") + viewProjectionLoc = gl.GetUniformLocation(dofShader, "viewProjection") + resolutionLoc = gl.GetUniformLocation(dofShader, "resolution") + distanceLimitsLoc = gl.GetUniformLocation(dofShader, "distanceLimits") + autofocusLoc = gl.GetUniformLocation(dofShader, "autofocus") + mousefocusLoc = gl.GetUniformLocation(dofShader, "mousefocus") + focusDepthLoc = gl.GetUniformLocation(dofShader, "manualFocusDepth") + mouseDepthCoordLoc = gl.GetUniformLocation(dofShader, "mouseDepthCoord") + fStopLoc = gl.GetUniformLocation(dofShader, "fStop") + qualityLoc = gl.GetUniformLocation(dofShader, "quality") + passLoc = gl.GetUniformLocation(dofShader, "pass") + + widget:ViewResize() end -function dofIntensity(cmd, line, words) - options.intensity.value = tonumber(words[1]) - --Spring.Echo("Depth of Field: intensity: "..options.intensity.value) - return true +function widget:Initialize() + init() + WG['dof'] = {} + WG['dof'].getFocusDepth = function() + return focusDepth + end + WG['dof'].setFocusDepth = function(value) + focusDepth = value + end + WG['dof'].getFstop = function() + return fStop + end + WG['dof'].setFstop = function(value) + fStop = value + end + WG['dof'].getHighQuality = function() + return highQuality + end + WG['dof'].setHighQuality = function(value) + highQuality = value + InitTextures() + end + WG['dof'].getAutofocus = function() + return autofocus + end + WG['dof'].setAutofocus = function(value) + autofocus = value + mousefocus = not autofocus + end end -function dofIntensityIncrease() - options.intensity.value = options.intensity.value + options.intensity.step - if (options.intensity.value > options.intensity.max) then - options.intensity.value = options.intensity.max - end - --Spring.Echo("Depth of Field: intensity: "..options.intensity.value) - return true +function reset() + if (glDeleteShader and dofShader) then + glDeleteShader(dofShader) + end + + if glDeleteTexture then + CleanupTextures() + end + dofShader = nil end -function dofIntensityDecrease() - options.intensity.value = options.intensity.value - options.intensity.step - if (options.intensity.value < options.intensity.min) then - options.intensity.value = options.intensity.min - end - --Spring.Echo("Depth of Field: intensity: "..options.intensity.value) - return true +function widget:Shutdown() + reset() + WG['dof'] = nil end -function dofQuality(cmd, line, words) - options.quality.value = tonumber(words[1]) - if (options.quality.value > options.quality.max) then - options.quality.value = options.quality.max - end - --Spring.Echo("Depth of Field: quality changed to: "..options.quality.value) - return true +local function FilterCalculation() + local cpx, cpy, cpz = spGetCameraPosition() + local gmin, gmax = Spring.GetGroundExtremes() + local effectiveHeight = cpy - math.max(0, gmin) + cpy = 3.5 * math.sqrt(effectiveHeight) * math.log(effectiveHeight) + glUniform(eyePosLoc, cpx, cpy, cpz) + glUniformInt(passLoc, shaderPasses.filterSize) + glTexture(0, screenTex) + glTexture(1, depthTex) + + -- glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) + glTexRect(0, 0, vsx, vsy, false, true) + -- + glTexture(0, false) + glTexture(1, false) end +local function InitialBlur() + glUniform(resolutionLoc, vsx/2, vsy/2) + glUniformInt(passLoc, shaderPasses.initialBlur) + glTexture(0, baseBlurTex) + glTexRect(0, 0, vsx, vsy, false, true) + glTexture(0, false) +end +local function FinalBlur() + glUniform(resolutionLoc, vsx/2, vsy/2) + glUniformInt(passLoc, shaderPasses.finalBlur) + glTexture(0, baseBlurTex) + glTexture(1, intermediateBlurTex0) --R + glTexture(2, intermediateBlurTex1) --G + glTexture(3, intermediateBlurTex2) --B + glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) + glTexture(0, false) + glTexture(1, false) + glTexture(2, false) + glTexture(3, false) +end -function widget:Initialize() - if (not CheckHardware()) then return false end - - -- register user control commands/keys - widgetHandler:AddAction("dofToggle", dofToggle, nil, "t") - Spring.SendCommands({"bind "..options.shortcuts.toggle.." dofToggle"}) - Spring.SendCommands({"dofToggle 0"}) -- toggle off defaultly - - widgetHandler:AddAction("dofIntensityIncrease", dofIntensityIncrease, nil, "t") - Spring.SendCommands({"bind "..options.shortcuts.intensityIncrease.." dofIntensityIncrease"}) - - widgetHandler:AddAction("dofIntensityDecrease", dofIntensityDecrease, nil, "t") - Spring.SendCommands({"bind "..options.shortcuts.intensityDecrease.." dofIntensityDecrease"}) - - widgetHandler:AddAction("dofQuality", dofQuality, nil, "t") - widgetHandler:AddAction("dofIntensity", dofIntensity, nil, "t") - - - dofShader = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - uniform sampler2D tex1; - uniform sampler2D tex2; - - uniform float focus; - uniform float focusRange; - uniform float viewX; - uniform float viewY; - uniform float quality; - uniform float intensity; - uniform float focusCurveExp; - uniform float focusRangeMultiplier; - uniform float focusPtX; - uniform float focusPtY; - - void main(void) - { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - gl_FragColor = vec4(0.0,0.0,0.0,1.0); - - float focus = texture2D(tex2, vec2(focusPtX,focusPtY)).z; - - int k,l; - float zValue = texture2D(tex2, texCoord).z; - float dmix = clamp(abs(focus-zValue)*focusRange*focusRangeMultiplier ,0.0,1.0); - - if(dmix > 0.05 || focus>zValue) - { - zValue = 0; - for(k = -1; k <= 1; k++){ - for(l = -1; l <= 1; l++){ - zValue += texture2D(tex2, texCoord + vec2(0.005*k,0.005*l)).z/9.; - } - } - dmix = clamp(abs(focus-zValue)*focusRange*focusRangeMultiplier ,0.0,1.0); - } - if(focusCurveExp>1.){ - dmix = (exp(focusCurveExp*dmix)-1.)/exp(focusCurveExp); - } - - - float halfSizeKernel = quality; // quality - float dy = (8./halfSizeKernel)*dmix/viewY*intensity; - float dx = (8./halfSizeKernel)*dmix/viewX*intensity; - float i,j; - float sumKernel = 0; - for(j = -halfSizeKernel; j <= halfSizeKernel; j++) - for(i = -halfSizeKernel; i <= halfSizeKernel; i++){ - sumKernel += (halfSizeKernel+1-abs(i)+halfSizeKernel+1-abs(j))/2.; - } - for(j = -halfSizeKernel; j <= halfSizeKernel; j++) - for(i = -halfSizeKernel; i <= halfSizeKernel; i++){ - gl_FragColor.rgb+= (halfSizeKernel+1-abs(i)+halfSizeKernel+1-abs(j))/(2*sumKernel)*texture2D(tex0, texCoord + vec2(j*dy,i*dx)).rgb; - } - //gl_FragColor.rgb = vec3(dmix,dmix,dmix); - } - ]], - uniform = { - focus = 0.9955, - focusRange = 1./0.0005, - }, - uniformInt = { - tex0 = 0, - tex1 = 1, - tex2 = 2, - } - }) - - Spring.Echo('DoF shaderlog:') - Spring.Echo(gl.GetShaderLog()) - - -- create blurtexture - depthcopy = gl.CreateTexture(vsx,vsy, { - border = false, - format = GL_DEPTH_COMPONENT24, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - screencopy = gl.CreateTexture(vsx, vsy, { - border = false, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - - -- debug? - if (screencopy == nil) then - Spring.Echo("Depth of Field: texture error") - widgetHandler:RemoveWidget() - return false - end - - focusLoc = gl.GetUniformLocation(dofShader,"focus") - focusRangeLoc = gl.GetUniformLocation(dofShader,"focusRange") - viewXLoc = gl.GetUniformLocation(dofShader,"viewX") - viewYLoc = gl.GetUniformLocation(dofShader,"viewY") - qualityLoc = gl.GetUniformLocation(dofShader,"quality") - intensityLoc = gl.GetUniformLocation(dofShader,"intensity") - focusCurveExpLoc = gl.GetUniformLocation(dofShader,"focusCurveExp") - focusRangeMultiplierLoc = gl.GetUniformLocation(dofShader,"focusRangeMultiplier") - focusRangeMultiplierLoc = gl.GetUniformLocation(dofShader,"focusRangeMultiplier") - focusPtXLoc = gl.GetUniformLocation(dofShader,"focusPtX") - focusPtYLoc = gl.GetUniformLocation(dofShader,"focusPtY") +local function InitialNearBlur() + glUniform(resolutionLoc, vsx/2, vsy/2) + glUniformInt(passLoc, shaderPasses.initialNearBlur) + glTexture(0, baseNearBlurTex) + glTexRect(0, 0, vsx, vsy, false, true) + glTexture(0, false) end +local function FinalNearBlur() + glUniform(resolutionLoc, vsx/2, vsy/2) + glUniformInt(passLoc, shaderPasses.finalNearBlur) + glTexture(0, baseNearBlurTex) + glTexture(1, intermediateBlurTex0) --R + glTexture(2, intermediateBlurTex1) --G + glTexture(3, intermediateBlurTex2) --B + glTexture(4, intermediateBlurTex3) --A + glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) + glTexture(0, false) + glTexture(1, false) + glTexture(2, false) + glTexture(3, false) + glTexture(4, false) +end -function widget:Shutdown() - Spring.SendCommands({"DofEnable 0"}) - widgetHandler:RemoveAction("DofEnable", DofEnable) - - if (gl.DeleteTextureFBO) then - gl.DeleteTexture(depthcopy) - gl.DeleteTexture(screencopy) - gl.DeleteTextureFBO(blurtex) - gl.DeleteTextureFBO(blurtex2) - end - if (gl.DeleteShader) then - gl.DeleteShader(blurShader or 0) - gl.DeleteShader(dofShader or 0) - end +local function Composition() + glUniformInt(passLoc, shaderPasses.composition) + glTexture(0, screenTex) + glTexture(1, finalBlurTex) + if (highQuality) then + glTexture(2, finalNearBlurTex) + end + + glTexRect(0, 0, vsx, vsy, false, true) + glTexture(0, false) + glTexture(1, false) + glTexture(2, false) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +function widget:DrawWorld() + if chobbyInterface then return end + gl.ActiveShader(dofShader, function() glUniformMatrix(viewProjectionLoc, "projection") end) +end function widget:DrawScreenEffects() - if deactivated then return end - - local zfocus = 0.9995 - - local msx,msy = widgetHandler:GetViewSizes() - msx,msy = 0.5*msx,0.5*msy - local type,mpos = Spring.TraceScreenRay(msx,msy,true) - if (type=="ground") then - _,_,zfocus = Spring.WorldToScreenCoords(mpos[1],mpos[2],mpos[3]) - end - - viewX,viewY = gl.GetViewSizes() - - local mouseX,mouseY = Spring.GetMouseState() - - local focusRange = 0.8*(1-zfocus) -- + ((1-zfocus)*(1-zfocus)*10) - --zfocus = zfocus - zfocus^10000 - - gl.CopyToTexture(depthcopy, 0, 0, 0, 0, vsx, vsy) - gl.CopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) - - gl.Texture(screencopy) - - gl.UseShader(dofShader) - gl.Uniform(focusLoc,zfocus) - gl.Uniform(focusRangeLoc,1/focusRange) - gl.Uniform(viewXLoc,viewX) - gl.Uniform(viewYLoc,viewY) - gl.Uniform(qualityLoc,options.quality.value) - gl.Uniform(intensityLoc,options.intensity.value) - gl.Uniform(focusCurveExpLoc,options.focusCurveExp.value) - gl.Uniform(focusRangeMultiplierLoc,options.focusRangeMultiplier.value) - gl.Uniform(focusPtXLoc,mouseX/viewX) - gl.Uniform(focusPtYLoc,mouseY/viewY) - gl.Texture(0,screencopy) - gl.Texture(2,depthcopy) - gl.TexRect(0,vsy,vsx,0) - - gl.Texture(0,false) - gl.Texture(1,false) - gl.Texture(2,false) - gl.UseShader(0) + gl.Blending(false) + glCopyToTexture(screenTex, 0, 0, 0, 0, vsx, vsy) -- the original screen image + glCopyToTexture(depthTex, 0, 0, 0, 0, vsx, vsy) -- the original screen image + + local mx, my = Spring.GetMouseState() + + glUseShader(dofShader) + glUniform(distanceLimitsLoc, gl.GetViewRange()) + + glUniformInt(autofocusLoc, autofocus and 1 or 0) + glUniformInt(mousefocusLoc, mousefocus and 1 or 0) + glUniform(mouseDepthCoordLoc, mx/vsx, my/vsy) + glUniform(focusDepthLoc, focusDepth / maxBlurDistance) + glUniform(fStopLoc, fStop) + glUniformInt(qualityLoc, highQuality and 1 or 0) + + gl.ActiveFBO(baseBlurFBO, FilterCalculation) + gl.ActiveFBO(intermediateBlurFBO, InitialBlur) + glRenderToTexture(finalBlurTex, FinalBlur) + if highQuality then + gl.ActiveFBO(intermediateBlurFBO, InitialNearBlur) + glRenderToTexture(finalNearBlurTex, FinalNearBlur) + end + Composition() + + glUseShader(0) end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +function widget:GetConfigData() + return { + highQuality = highQuality, + autofocus = autofocus, + focusDepth = focusDepth, + fStop = fStop, + } +end + +function widget:SetConfigData(data) + if data.highQuality ~= nil then + highQuality = data.highQuality + autofocus = data.autofocus + mousefocus = not autofocus + focusDepth = data.focusDepth + fStop = data.fStop + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_guishader.lua b/LuaUI/Widgets_Evo/gfx_guishader.lua new file mode 100644 index 000000000..19633e712 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_guishader.lua @@ -0,0 +1,559 @@ + +-- disable for intel cards (else it will render solid dark screen) +if Platform ~= nil and Platform.gpuVendor == 'Intel' then + return +end + + +function widget:GetInfo() + return { + name = "GUI Shader", + desc = "Blurs the 3D-world under several other widgets UI elements.", + author = "Floris (original blurapi widget by: jK)", + date = "17 february 2015", + license = "GNU GPL, v2 or later", + layer = -99999999, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +------------------------------------------------------------------- + +local defaultBlurIntensity = 0.002 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +--hardware capability + +local canRTT = (gl.RenderToTexture ~= nil) +local canCTT = (gl.CopyToTexture ~= nil) +local canShader = (gl.CreateShader ~= nil) +local canFBO = (gl.DeleteTextureFBO ~= nil) + +local NON_POWER_OF_TWO = gl.HasExtension("GL_ARB_texture_non_power_of_two") + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local renderDlists = {} +local deleteDlistQueue = {} +local blurShader +local screencopy +local blurtex +local blurtex2 +local stenciltex +local stenciltexScreen +local screenBlur = false + +local blurIntensity = defaultBlurIntensity +local guishaderRects = {} +local guishaderDlists = {} +local guishaderScreenRects = {} +local guishaderScreenDlists = {} +local updateStencilTexture = false +local updateStencilTextureScreen = false + +local oldvs = 0 +local vsx, vsy = widgetHandler:GetViewSizes() +local ivsx, ivsy = vsx, vsy +function widget:ViewResize(viewSizeX, viewSizeY) + vsx, vsy = viewSizeX,viewSizeY + ivsx,ivsy = vsx, vsy + + if (gl.DeleteTextureFBO) then + gl.DeleteTextureFBO(blurtex) + gl.DeleteTextureFBO(blurtex2) + gl.DeleteTexture(screencopy) + end + + screencopy = gl.CreateTexture(vsx, vsy, { + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + }) + blurtex = gl.CreateTexture(ivsx, ivsy, { + border = false, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + blurtex2 = gl.CreateTexture(ivsx, ivsy, { + border = false, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + + if (blurtex == nil)or(blurtex2 == nil)or(screencopy == nil) then + Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") + widgetHandler:RemoveWidget(self) + return false + end + + updateStencilTexture = true + updateStencilTextureScreen = true +end + + +function widget:UpdateCallIns() + self:ViewResize(vsx, vsy) + self.DrawScreenEffects = DrawScreenEffectsBlur + widgetHandler:UpdateCallIn("DrawScreenEffects") +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function DrawStencilTexture(world,fullscreen) + local usedStencilTex + if world then usedStencilTex = stenciltex else usedStencilTex = stenciltexScreen end + + if (next(guishaderRects) or next(guishaderScreenRects) or next(guishaderDlists)) then + + if (usedStencilTex == nil)or(vsx+vsy~=oldvs) then + gl.DeleteTextureFBO(usedStencilTex) + + oldvs = vsx+vsy + usedStencilTex = gl.CreateTexture(vsx, vsy, { + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + + if (usedStencilTex == nil) then + Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") + widgetHandler:RemoveWidget(self) + return false + end + end + else + gl.RenderToTexture(usedStencilTex, gl.Clear, GL.COLOR_BUFFER_BIT ,0,0,0,0) + return + end + + gl.RenderToTexture(usedStencilTex, function() + gl.Clear(GL.COLOR_BUFFER_BIT,0,0,0,0) + gl.PushMatrix() + gl.Translate(-1,-1,0) + gl.Scale(2/vsx,2/vsy,0) + if world then + for _,rect in pairs(guishaderRects) do + gl.Rect(rect[1],rect[2],rect[3],rect[4]) + end + for _,dlist in pairs(guishaderDlists) do + gl.CallList(dlist) + end + elseif fullscreen then + gl.Rect(0,0,vsx,vsy) + else + for _,rect in pairs(guishaderScreenRects) do + gl.Rect(rect[1],rect[2],rect[3],rect[4]) + end + for _,dlist in pairs(guishaderScreenDlists) do + gl.CallList(dlist) + end + end + gl.PopMatrix() + end) + + if world then stenciltex = usedStencilTex else stenciltexScreen = usedStencilTex end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function CheckHardware() + if (not canCTT) then + Spring.Echo("guishader api: your hardware is missing the necessary CopyToTexture feature") + widgetHandler:RemoveWidget(self) + return false + end + + if (not canRTT) then + Spring.Echo("guishader api: your hardware is missing the necessary RenderToTexture feature") + widgetHandler:RemoveWidget(self) + return false + end + + if (not canShader) then + Spring.Echo("guishader api: your hardware does not support shaders, OR: change springsettings: \"enable lua shaders\" ") + widgetHandler:RemoveWidget(self) + return false + end + + if (not canFBO) then + Spring.Echo("guishader api: your hardware does not fbo textures") + widgetHandler:RemoveWidget(self) + return false + end + + if (not NON_POWER_OF_TWO) then + Spring.Echo("guishader api: your hardware does not non-2^n-textures") + widgetHandler:RemoveWidget(self) + return false + end + + --if Platform ~= nil then + -- if Platform.gpuVendor == 'Intel' then + -- widgetHandler:RemoveWidget(self) + -- Spring.SendCommands("luaui disablewidget GUI Shader") + -- return false + -- end + --end + return true +end + + +function widget:Initialize() + if (not CheckHardware()) then return false end + + CreateShaders() + + self:UpdateCallIns() + + WG['guishader'] = {} + WG['guishader'].InsertDlist = function(dlist,name) + guishaderDlists[name] = dlist + updateStencilTexture = true + end + WG['guishader'].RemoveDlist = function(name) + local found = false + if guishaderDlists[name] ~= nil then + found = true + end + guishaderDlists[name] = nil + updateStencilTexture = true + return found + end + WG['guishader'].DeleteDlist = function(name) + local found = false + if guishaderDlists[name] ~= nil then + found = true + deleteDlistQueue[name] = guishaderDlists[name] + end + return found + end + WG['guishader'].InsertRect = function(left,top,right,bottom,name) + guishaderRects[name] = {left,top,right,bottom} + updateStencilTexture = true + end + WG['guishader'].RemoveRect = function(name) + local found = false + if guishaderRects[name] ~= nil then + found = true + end + guishaderRects[name] = nil + updateStencilTexture = true + return found + end + WG['guishader'].InsertScreenDlist = function(dlist,name) + guishaderScreenDlists[name] = dlist + updateStencilTextureScreen = true + end + WG['guishader'].RemoveScreenDlist = function(name) + local found = false + if guishaderScreenDlists[name] ~= nil then + found = true + end + guishaderScreenDlists[name] = nil + updateStencilTextureScreen = true + return found + end + WG['guishader'].DeleteScreenDlist = function(name) + local found = false + if guishaderScreenDlists[name] ~= nil then + found = true + deleteDlistQueue[name] = guishaderScreenDlists[name] + end + return found + end + WG['guishader'].InsertScreenRect = function(left,top,right,bottom,name) + guishaderScreenRects[name] = {left,top,right,bottom} + updateStencilTextureScreen = true + end + WG['guishader'].RemoveScreenRect = function(name) + local found = false + if guishaderScreenRects[name] ~= nil then + found = true + end + guishaderScreenRects[name] = nil + updateStencilTextureScreen = true + return found + end + WG['guishader'].getBlurDefault = function() + return defaultBlurIntensity + end + WG['guishader'].getBlurIntensity = function() + return blurIntensity + end + WG['guishader'].setBlurIntensity = function(value) + if value == nil then value = defaultBlurIntensity end + blurIntensity = value + end + + WG['guishader'].setScreenBlur = function(value) + updateStencilTextureScreen = true + screenBlur = value + end + WG['guishader'].getScreenBlur = function(value) + return screenBlur + end + + -- will let it draw a given dlist to be rendered on top of screenblur + WG['guishader'].insertRenderDlist = function(value) + renderDlists[value] = true + end + WG['guishader'].removeRenderDlist = function(value) + if renderDlists[value] then + renderDlists[value] = nil + end + end + + widgetHandler:RegisterGlobal('GuishaderInsertRect', WG['guishader'].InsertRect) + widgetHandler:RegisterGlobal('GuishaderRemoveRect', WG['guishader'].RemoveRect) +end + + +function CreateShaders() + + if (blurShader) then + gl.DeleteShader(blurShader or 0) + end + + -- create blur shaders + blurShader = gl.CreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D tex2; + uniform sampler2D tex0; + uniform float intensity; + + void main(void) + { + vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); + float stencil = texture2D(tex2, texCoord).a; + if (stencil<0.01) + { + gl_FragColor = texture2D(tex0, texCoord); + return; + } + gl_FragColor = vec4(0.0,0.0,0.0,1.0); + + float sum = 0.0; + for (int i = -1; i <= 1; ++i) + for (int j = -1; j <= 1; ++j) { + vec2 samplingCoords = texCoord + vec2(i, j) * intensity; + float samplingCoordsOk = float( all( greaterThanEqual(samplingCoords, vec2(0.0)) ) && all( lessThanEqual(samplingCoords, vec2(1.0)) ) ); + gl_FragColor.rgb += texture2D(tex0, samplingCoords).rgb * samplingCoordsOk; + sum += samplingCoordsOk; + } + gl_FragColor.rgb /= sum; + } + ]], + + uniformInt = { + tex0 = 0, + tex2 = 2, + }, + uniformFloat = { + intensity = blurIntensity, + } + }) + + if (blurShader == nil) then + Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader blurShader: shader error: "..gl.GetShaderLog()) + widgetHandler:RemoveWidget(self) + return false + end + + -- create blurtextures + screencopy = gl.CreateTexture(vsx, vsy, { + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + }) + blurtex = gl.CreateTexture(ivsx, ivsy, { + border = false, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + blurtex2 = gl.CreateTexture(ivsx, ivsy, { + border = false, + wrap_s = GL.CLAMP, + wrap_t = GL.CLAMP, + fbo = true, + }) + + intensityLoc = gl.GetUniformLocation(blurShader, "intensity") + + -- debug? + if (blurtex == nil)or(blurtex2 == nil)or(screencopy == nil) then + Spring.Log(widget:GetInfo().name, LOG.ERROR, "guishader api: texture error") + widgetHandler:RemoveWidget(self) + return false + end +end + + +function DeleteShaders() + if (gl.DeleteTextureFBO) then + gl.DeleteTextureFBO(blurtex) + gl.DeleteTextureFBO(blurtex2) + gl.DeleteTextureFBO(stenciltex) + gl.DeleteTextureFBO(stenciltexScreen) + end + gl.DeleteTexture(screencopy or 0) + + if (gl.DeleteShader) then + gl.DeleteShader(blurShader or 0) + end + blurShader = nil +end + +function widget:Shutdown() + DeleteShaders() + WG['guishader'] = nil +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:DrawScreenEffectsBlur() + if Spring.IsGUIHidden() then return end + + if not screenBlur and blurShader then + if not next(guishaderRects) and not next(guishaderDlists) then return end + + gl.Texture(false) + gl.Color(1,1,1,1) + gl.Blending(false) + + if updateStencilTexture then + DrawStencilTexture(true); + updateStencilTexture = false; + end + + gl.CopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) + gl.Texture(screencopy) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + + gl.UseShader(blurShader) + gl.Uniform(intensityLoc, blurIntensity) + + gl.Texture(2,stenciltex) + gl.Texture(blurtex) + gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) + gl.Texture(blurtex2) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + gl.Texture(2,false) + gl.UseShader(0) + + if blurIntensity >= 0.0016 then + gl.UseShader(blurShader) + gl.Uniform(intensityLoc, blurIntensity*0.5) + + gl.Texture(blurtex) + gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) + gl.Texture(blurtex2) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + gl.UseShader(0) + end + + gl.Texture(blurtex) + gl.TexRect(0,vsy,vsx,0) + gl.Texture(false) + + gl.Blending(true) + end +end + +function widget:DrawScreen() + if Spring.IsGUIHidden() then return end + + if ((screenBlur or next(guishaderScreenRects) or next(guishaderScreenDlists))) and blurShader then + gl.Texture(false) + gl.Color(1,1,1,1) + gl.Blending(false) + + if updateStencilTextureScreen then + DrawStencilTexture(false, screenBlur) + updateStencilTextureScreen = false + end + + gl.CopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) + gl.Texture(screencopy) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + + gl.UseShader(blurShader) + if screenBlur then + gl.Uniform(intensityLoc, math.max(blurIntensity, 0.0015)) + else + gl.Uniform(intensityLoc, blurIntensity) + end + + gl.Texture(2,stenciltexScreen) + gl.Texture(2,false) + + gl.Texture(blurtex) + gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) + gl.Texture(blurtex2) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + gl.UseShader(0) + + --2nd pass + gl.UseShader(blurShader) + gl.Uniform(intensityLoc, blurIntensity*0.5) + + gl.Texture(blurtex) + gl.RenderToTexture(blurtex2, gl.TexRect, -1,1,1,-1) + gl.Texture(blurtex2) + gl.RenderToTexture(blurtex, gl.TexRect, -1,1,1,-1) + gl.UseShader(0) + + gl.Texture(blurtex) + gl.TexRect(0,vsy,vsx,0) + gl.Texture(false) + + gl.Blending(true) + end + + for k,v in pairs(renderDlists) do + gl.CallList(k) + end + + for k,v in pairs(deleteDlistQueue) do + gl.DeleteList(deleteDlistQueue[v]) + if guishaderDlists[k] then + guishaderDlists[k] = nil + elseif guishaderScreenDlists[k] then + guishaderScreenDlists[k] = nil + end + updateStencilTexture = true + end + deleteDlistQueue = {} +end + +function widget:GetConfigData(data) + savedTable = {} + savedTable.blurIntensity = blurIntensity + return savedTable +end + +function widget:SetConfigData(data) + if data.blurIntensity ~= nil then + blurIntensity = data.blurIntensity + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + screenBlur = (msg:sub(1,19) == 'LobbyOverlayActive1') + updateStencilTextureScreen = true + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_light_effects.lua b/LuaUI/Widgets_Evo/gfx_light_effects.lua index 5c390bd9b..69700c772 100644 --- a/LuaUI/Widgets_Evo/gfx_light_effects.lua +++ b/LuaUI/Widgets_Evo/gfx_light_effects.lua @@ -10,7 +10,7 @@ function widget:GetInfo() date = "May 2017", license = "GPL V2", layer = 0, - enabled = true + enabled = true, } end @@ -49,6 +49,9 @@ local globalLightMultLaser = 1.3 local globalRadiusMultLaser = 1.3 -- gets applied on top op globalRadiusMult local globalLifeMult = 0.7 +local enableHeatDistortion = false +local enableDeferred = true -- else use groundflashes instead + local gibParams = {r = 0.145*globalLightMult, g = 0.1*globalLightMult, b = 0.05*globalLightMult, radius = 75*globalRadiusMult, gib = true} -------------------------------------------------------------------------------- @@ -73,6 +76,94 @@ local function Split(s, separator) return results end + + +local weaponConf = {} +function loadWeaponDefs() + weaponConf = {} + for i=1, #WeaponDefs do + local customParams = WeaponDefs[i].customParams or {} + if customParams.expl_light_skip == nil then + local params = {} + --local maxDamage = 0 + --for armortype, value in pairs(WeaponDefs[i].damages) do + -- maxDamage = math.max(maxDamage, value) + --end + --local dmgBonus = math.sqrt(math.sqrt(math.sqrt(maxDamage))) + params.r, params.g, params.b = 1, 0.8, 0.4 + params.radius = (WeaponDefs[i].damageAreaOfEffect*4.5) * globalRadiusMult + params.orgMult = (0.35 + (params.radius/2400)) * globalLightMult + params.life = (14*(0.8+ params.radius/1200))*globalLifeMult + + if customParams.expl_light_color then + local colorList = Split(customParams.expl_light_color, " ") + params.r = colorList[1] + params.g = colorList[2] + params.b = colorList[3] + elseif WeaponDefs[i].rgbColor ~= nil then + local colorList = Split(WeaponDefs[i].rgbColor, " ") + params.r = colorList[1] + params.g = colorList[2] + params.b = colorList[3] + end + + if customParams.expl_light_opacity ~= nil then + params.orgMult = customParams.expl_light_opacity * globalLightMult + end + + if customParams.expl_light_mult ~= nil then + params.orgMult = params.orgMult * customParams.expl_light_mult + end + + if customParams.expl_light_radius then + params.radius = tonumber(customParams.expl_light_radius) * globalRadiusMult + end + if customParams.expl_light_radius_mult then + params.radius = params.radius * tonumber(customParams.expl_light_radius_mult) + end + + params.heatradius = (WeaponDefs[i].damageAreaOfEffect*0.5) + params.heatlife = (13*(0.8+ params.heatradius/1200)) + (params.heatradius/4) + + if customParams.expl_light_heat_radius_mult then + params.heatradius = (params.heatradius * tonumber(customParams.expl_light_heat_radius_mult)) + end + + params.heatstrength = 1 + (params.heatradius/30) + + if customParams.expl_light_heat_strength_mult then + params.heatstrength = params.heatstrength * customParams.expl_light_heat_strength_mult + end + if customParams.expl_noheatdistortion then + params.noheatdistortion = true + end + + if customParams.expl_light_life then + params.life = tonumber(customParams.expl_light_life) + end + if customParams.expl_light_life_mult then + params.life = params.life * tonumber(customParams.expl_light_life_mult) + end + if WeaponDefs[i].paralyzer then + params.type = 'paralyzer' + end + if WeaponDefs[i].type == 'Flame' then + params.type = 'flame' + params.radius = params.radius * 0.66 + params.orgMult = params.orgMult * 0.66 + end + params.wtype = WeaponDefs[i].type + if params.wtype == 'Cannon' then + params.cannonsize = WeaponDefs[i].size + end + weaponConf[i] = params + end + end +end +loadWeaponDefs() + + + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Light Defs @@ -140,6 +231,8 @@ local function GetLightsFromUnitDefs() recalcRGB = true elseif (weaponDef.type == 'StarburstLauncher') then weaponData.radius = 400 + weaponData.radius1 = weaponData.radius + weaponData.radius2 = weaponData.radius*0.6 elseif (weaponDef.type == 'Flame') then weaponData.radius = 70 * weaponDef.size lightMultiplier = 0.05 @@ -160,9 +253,9 @@ local function GetLightsFromUnitDefs() if customParams.light_opacity then lightMultiplier = customParams.light_opacity end - if customParams.light_multiplier ~= nil then + if customParams.light_mult ~= nil then recalcRGB = true - lightMultiplier = lightMultiplier * tonumber(customParams.light_multiplier) + lightMultiplier = lightMultiplier * tonumber(customParams.light_mult) end -- For long lasers or projectiles @@ -184,6 +277,10 @@ local function GetLightsFromUnitDefs() if customParams.light_radius_mult then weaponData.radius = weaponData.radius * tonumber(customParams.light_radius_mult) + if weaponData.radius1 and weaponData.radius2 then + weaponData.radius1 = weaponData.radius * tonumber(customParams.light_radius_mult) + weaponData.radius2 = weaponData.radius * tonumber(customParams.light_radius_mult) + end end if customParams.light_ground_height then @@ -364,6 +461,9 @@ local function GetProjectileLight(lightParams, pID, x, y, z) end local function GetProjectileLights(beamLights, beamLightCount, pointLights, pointLightCount) + local cx, cy, cz = Spring.GetCameraPosition() + + if not enableDeferred then return {}, 0, {}, 0 end local projectiles = spGetVisibleProjectiles() local projectileCount = #projectiles @@ -410,11 +510,40 @@ local function GetProjectileLights(beamLights, beamLightCount, pointLights, poin else -- point type if not (lightParams.groundHeightLimit and lightParams.groundHeightLimit < (y - math.max(Spring.GetGroundHeight(y, y), 0))) then local drawParams = GetProjectileLight(lightParams, pID, x, y, z) + if lightParams.radius2 ~= nil then + local dirX,dirY,dirZ = Spring.GetProjectileDirection(pID) + if dirX == 0 and dirZ == 0 then + drawParams.param.radius = lightParams.radius1 + else + drawParams.param.radius = lightParams.radius2 + end + end pointLightCount = pointLightCount + 1 pointLights[pointLightCount] = drawParams if projectileDrawParams then projectileDrawParams[#projectileDrawParams + 1] = drawParams end + if enableHeatDistortion and WG['Lups'] then + local weaponDefID = Spring.GetProjectileDefID(pID) + if weaponDefID and weaponConf[weaponDefID] and not weaponConf[weaponDefID].noheatdistortion and Spring.IsSphereInView(x,y,z,100) then + if weaponConf[weaponDefID].wtype == 'DGun' then + local distance = math.diag(x-cx, y-cy, z-cz) + local strengthMult = 1 / (distance*0.001) + + WG['Lups'].AddParticles('JitterParticles2', { + layer = -35, + life = weaponConf[weaponDefID].heatlife/4, + pos = {x,y,z}, + size = weaponConf[weaponDefID].heatradius*1.5, + sizeGrowth = 0.2, + strength = (weaponConf[weaponDefID].heatstrength*0.5)*strengthMult, + animSpeed = 1.3, + heat = 1, + force = {0,0.35,0}, + }) + end + end + end end end end @@ -464,6 +593,7 @@ local function GetProjectileLights(beamLights, beamLightCount, pointLights, poin -- add explosion lights for i, params in pairs(explosionLights) do local progress = 1-((frame-params.frame)/params.life) + progress = ((progress * (progress*progress)) + (progress*1.4)) / 2.4 -- fade out fast, but ease out at the end params.colMult = params.orgMult * progress if params.colMult <= 0 then explosionLights[i] = nil @@ -476,84 +606,101 @@ local function GetProjectileLights(beamLights, beamLightCount, pointLights, poin return beamLights, beamLightCount, pointLights, pointLightCount end -local weaponConf = {} -function loadWeaponDefs() - weaponConf = {} - for i=1, #WeaponDefs do - local customParams = WeaponDefs[i].customParams or {} - if customParams.expl_light_skip == nil then - local params = {} - --local maxDamage = 0 - --for armortype, value in pairs(WeaponDefs[i].damages) do - -- maxDamage = math.max(maxDamage, value) - --end - --local dmgBonus = math.sqrt(math.sqrt(math.sqrt(maxDamage))) - params.r, params.g, params.b = 1, 0.8, 0.4 - params.radius = (WeaponDefs[i].damageAreaOfEffect*4.5) * globalRadiusMult - params.orgMult = (0.35 + (params.radius/2400)) * globalLightMult - params.life = (14*(0.8+ params.radius/1200))*globalLifeMult - if customParams.expl_light_color then - local colorList = Split(customParams.expl_light_color, " ") - params.r = colorList[1] - params.g = colorList[2] - params.b = colorList[3] - elseif WeaponDefs[i].rgbColor ~= nil then - local colorList = Split(WeaponDefs[i].rgbColor, " ") - params.r = colorList[1] - params.g = colorList[2] - params.b = colorList[3] - end +-- function called by explosion_lights gadget +function GadgetWeaponExplosion(px, py, pz, weaponID, ownerID) + if weaponConf[weaponID] ~= nil then + local params = { + life = weaponConf[weaponID].life, + orgMult = weaponConf[weaponID].orgMult, + frame = Spring.GetGameFrame(), + px = px, + py = py + 16 + (weaponConf[weaponID].radius/35), + pz = pz, + param = { + type = 'explosion', + r = weaponConf[weaponID].r, + g = weaponConf[weaponID].g, + b = weaponConf[weaponID].b, + radius = weaponConf[weaponID].radius, + }, + } + + if not enableDeferred then + if WG['Lups'] then + WG['Lups'].AddParticles('GroundFlash', { + worldspace = true, + layer = -35, + life = weaponConf[weaponID].life, + pos = {px,py+10,pz}, + size = weaponConf[weaponID].radius/2.2, + sizeGrowth = 0, + colormap = { {weaponConf[weaponID].r, weaponConf[weaponID].g, weaponConf[weaponID].b, weaponConf[weaponID].orgMult*1.33} }, + texture = 'LuaUI/Images/glow2.dds', + }) + end + else + explosionLightsCount = explosionLightsCount + 1 + explosionLights[explosionLightsCount] = params + end - if customParams.expl_light_opacity ~= nil then - params.orgMult = customParams.expl_light_opacity * globalLightMult - end + if py > 0 and enableHeatDistortion and WG['Lups'] and params.param.radius > 80 and not weaponConf[weaponID].noheatdistortion and Spring.IsSphereInView(px,py,pz,100) then - if customParams.expl_light_multiplier ~= nil then - params.orgMult = params.orgMult * customParams.expl_light_multiplier - end + local strength,animSpeed,life,heat,sizeGrowth,size,force - if customParams.expl_light_radius then - params.radius = tonumber(customParams.expl_light_radius) * globalRadiusMult - end - if customParams.expl_light_radius_mult then - params.radius = params.radius * tonumber(customParams.expl_light_radius_mult) - end - if customParams.expl_light_life then - params.life = tonumber(customParams.expl_light_life) + local cx, cy, cz = Spring.GetCameraPosition() + local distance = math.diag(px-cx, py-cy, pz-cz) + local strengthMult = 1 / (distance*0.001) + + if weaponConf[weaponID].type == 'paralyzer' then + strength = 10 + animSpeed = 0.1 + life = params.life*0.6 + (params.param.radius/80) + sizeGrowth = 0 + heat = 15 + size = params.param.radius/16 + force = {0,0.15,0} + else + animSpeed = 1.3 + sizeGrowth = 0.6 + if weaponConf[weaponID].type == 'flame' then + strength = 1 + (params.life/25) + size = params.param.radius/2.35 + life = params.life*0.64 + (params.param.radius/90) + force = {1,5.5,1} + heat = 8 + else + strength = weaponConf[weaponID].heatstrength + size = weaponConf[weaponID].heatradius + life = weaponConf[weaponID].heatlife + force = {0,0.35,0} + heat = 1 + end end - if customParams.expl_light_life_mult then - params.life = params.life * tonumber(customParams.expl_light_life_mult) + if size*strengthMult > 5 then + WG['Lups'].AddParticles('JitterParticles2', { + layer = -35, + life = life, + pos = {px,py+10,pz}, + size = size, + sizeGrowth = sizeGrowth, + strength = strength*strengthMult, + animSpeed = animSpeed, + heat = heat, + force = force, + }) end - - weaponConf[i] = params end end end -loadWeaponDefs() - --- function called by explosion_lights gadget -function GadgetWeaponExplosion(px, py, pz, weaponID, ownerID) - if weaponConf[weaponID] ~= nil then - local params = {param={type='explosion'}} - params.param.r, params.param.g, params.param.b = weaponConf[weaponID].r, weaponConf[weaponID].g, weaponConf[weaponID].b - params.life = weaponConf[weaponID].life - params.orgMult = weaponConf[weaponID].orgMult - params.param.radius = weaponConf[weaponID].radius - - params.frame = Spring.GetGameFrame() - params.px, params.py, params.pz = px, py, pz - params.py = params.py + 16 + (params.param.radius/35) - - --Spring.Echo(UnitDefs[unitDefID].name..' '..params.orgMult) - explosionLightsCount = explosionLightsCount + 1 - explosionLights[explosionLightsCount] = params - end -end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +function widget:Shutdown() + WG['lighteffects'] = nil +end + function widget:Initialize() loadWeaponDefs() @@ -579,6 +726,12 @@ function widget:Initialize() WG['lighteffects'].getLife = function() return globalLifeMult end + WG['lighteffects'].getHeatDistortion = function() + return enableHeatDistortion + end + WG['lighteffects'].getDeferred = function() + return enableDeferred + end WG['lighteffects'].setGlobalBrightness = function(value) globalLightMult = value projectileLightTypes = GetLightsFromUnitDefs() @@ -601,35 +754,52 @@ function widget:Initialize() globalLifeMult = value loadWeaponDefs() end + WG['lighteffects'].setHeatDistortion = function(value) + enableHeatDistortion = value + end + WG['lighteffects'].setDeferred = function(value) + enableDeferred = value + end end function widget:GetConfigData(data) - savedTable = {} - savedTable.globalLightMult = globalLightMult - savedTable.globalRadiusMult = globalRadiusMult - savedTable.globalLightMultLaser = globalLightMultLaser - savedTable.globalRadiusMultLaser = globalRadiusMultLaser - savedTable.globalLifeMult = globalLifeMult - savedTable.resetted = 1 + local savedTable = { + globalLightMult = globalLightMult, + globalRadiusMult = globalRadiusMult, + globalLightMultLaser = globalLightMultLaser, + globalRadiusMultLaser = globalRadiusMultLaser, + globalLifeMult = globalLifeMult, + enableHeatDistortion = enableHeatDistortion, + enableDeferred = enableDeferred, + resetted = 1, + } return savedTable end function widget:SetConfigData(data) - if data.globalLightMult ~= nil then - globalLightMult = data.globalLightMult - end - if data.globalRadiusMult ~= nil then - globalRadiusMult = data.globalRadiusMult - end - if data.globalLightMultLaser ~= nil then - globalLightMultLaser = data.globalLightMultLaser - end - if data.globalRadiusMultLaser ~= nil then - globalRadiusMultLaser = data.globalRadiusMultLaser - end - if data.globalLifeMult ~= nil and data.resetted ~= nil then - globalLifeMult = data.globalLifeMult + if data.globalLifeMult ~= nil and data.resetted ~= nil and data.resetted == 1 then + if data.globalLightMult ~= nil then + globalLightMult = data.globalLightMult + end + if data.globalRadiusMult ~= nil then + globalRadiusMult = data.globalRadiusMult + end + if data.globalLightMultLaser ~= nil then + globalLightMultLaser = data.globalLightMultLaser + end + if data.globalRadiusMultLaser ~= nil then + globalRadiusMultLaser = data.globalRadiusMultLaser + end + if data.globalLifeMult ~= nil then + globalLifeMult = data.globalLifeMult + end + if data.enableHeatDistortion ~= nil then + enableHeatDistortion = data.enableHeatDistortion + end + if data.enableDeferred ~= nil then + enableDeferred = data.enableDeferred + end end end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_move_window_position.lua b/LuaUI/Widgets_Evo/gfx_move_window_position.lua new file mode 100644 index 000000000..817c0cb6e --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_move_window_position.lua @@ -0,0 +1,285 @@ + +local widgetName = "Move Window Position" +function widget:GetInfo() + return { + name = widgetName, + desc = "Move around window position with the arrow keys or by dragging", + author = "Floris", + date = "August 2018", + license = "GPL v2 or later", + layer = -math.huge, + enabled = false, + handler = true, + } +end + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 50 +local fontfileOutlineSize = 16 +local fontfileOutlineStrength = 1.5 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local vsx, vsy = gl.GetViewSizes() +local customScale = 1.2 +local widgetScale = (1 + (vsx*vsy / 4000000)) * customScale + +local windowPosX = tonumber(Spring.GetConfigInt("WindowPosX",1) or 0) +local windowPosY = tonumber(Spring.GetConfigInt("WindowPosY",1) or 0) +local initialWindowPosX = windowPosX +local initialWindowPosY = windowPosY +local dlistPosX = windowPosX +local dlistPosY = windowPosY + +local bgcorner = "LuaUI/Images/bgcorner.png" + +local function DrawRectRound(px,py,sx,sy,cs) + + local csx = cs + local csy = cs + if sx-px < (cs*2) then + csx = (sx-px)/2 + if csx < 0 then csx = 0 end + end + if sy-py < (cs*2) then + csy = (sy-py)/2 + if csy < 0 then csy = 0 end + end + cs = math.min(csx, csy) + + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- top right + if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +function DrawWindow() + dlistPosX = windowPosX + dlistPosY = windowPosY + if WG['guishader'] then + WG['guishader'].InsertRect(0,0,vsx,vsy, 'movewindowpos') + WG['guishader'].setScreenBlur(true) + end + font:Begin() + gl.Color(0,0,0,0.6) + gl.Rect(0,0,vsx,vsy) + font:Print("\255\170\170\170Move window position with the \255\255\255\255arrow keys\255\170\170\170 or \255\255\255\255drag\255\170\170\170 using the mouse.", vsx/2, (vsy/2)+(50*widgetScale), 12*widgetScale, "ocn") + font:Print("\255\222\255\222x = "..windowPosX.." y = "..windowPosY, vsx/2, (vsy/2), 14*widgetScale, "ocn") + local buttonText = ' Apply ' + local buttonX = vsx/2 + local buttonY = (vsy/2)-(36*widgetScale) + local buttonFontsize = 15*widgetScale + local buttonWidth = font:GetTextWidth(buttonText)*buttonFontsize + local buttonHeight = buttonFontsize*2.2 + font:Print("\255\255\255\255ESCAPE\255\170\170\170 key will cancel changes", vsx/2, (vsy/2)-(50*widgetScale)-buttonHeight, 12*widgetScale, "ocn") + if initialWindowPosX ~= dlistPosX or initialWindowPosY ~= dlistPosY then + applyButtonPos = {buttonX-(buttonWidth/2), buttonY-(buttonHeight/2), buttonX+(buttonWidth/2), buttonY+(buttonHeight/2),buttonFontsize/5} + gl.Color(0,0.33,0,0.8) + RectRound(applyButtonPos[1],applyButtonPos[2],applyButtonPos[3],applyButtonPos[4],applyButtonPos[5]) + local padding = 2*widgetScale + gl.Color(1,1,1,0.1) + RectRound(applyButtonPos[1]+padding,applyButtonPos[2]+padding,applyButtonPos[3]-padding,applyButtonPos[4]-padding,applyButtonPos[5]*0.66) + font:Print("\255\222\255\222"..buttonText, buttonX, buttonY-(buttonFontsize*0.27), buttonFontsize, "ocn") + else + applyButtonPos = nil + end + font:End() +end + +function widget:ViewResize() + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (1 + (vsx*vsy / 4000000)) * customScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) +end + +function widget:Initialize() + widget:ViewResize() +end + +function widget:Update(dt) + if (changeClock and changeClock < os.clock()-0.7) or escape or applyChanges then + if changeClock then + Spring.SetConfigInt("WindowPosX", windowPosX) + Spring.SetConfigInt("WindowPosY", windowPosY) + Spring.SendCommands("Fullscreen 1") --tonumber(Spring.GetConfigInt("Fullscreen",1) or 1) + Spring.SendCommands("Fullscreen 0") + changeClock = nil + end + if applyChanges then + widgetHandler:DisableWidget(widgetName) + end + if escape then + if initialWindowPosX ~= dlistPosX or initialWindowPosY ~= dlistPosY then + Spring.SetConfigInt("WindowPosX", initialWindowPosX) + Spring.SetConfigInt("WindowPosY", initialWindowPosY) + Spring.SendCommands("Fullscreen 1") --tonumber(Spring.GetConfigInt("Fullscreen",1) or 1) + Spring.SendCommands("Fullscreen 0") + end + widgetHandler:DisableWidget(widgetName) + end + end +end + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY +end + +function widget:MousePress(x, y, button) + if applyButtonPos and IsOnRect(x, y, applyButtonPos[1],applyButtonPos[2],applyButtonPos[3],applyButtonPos[4]) then + applyChanges = true + return true + end + dragging = true + draggingStartX = x + draggingStartY = y + return true +end + +function widget:MouseRelease(x, y, button) + if dragging then + dragging = nil + windowPosX = windowPosX + (x-draggingStartX) + windowPosY = windowPosY + (draggingStartY-y) + if initialWindowPosX ~= dlistPosX or initialWindowPosY ~= dlistPosY then + changeClock = os.clock()-1 + end + end + return true +end + +function widget:MouseMove(x, y) + windowPosX = windowPosX + (x-draggingStartX) + windowPosY = windowPosY + (draggingStartY-y) + draggingStartX = x + draggingStartY = y + if dlistPosX ~= windowPosX or dlistPosY ~= windowPosY then + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + end + return true +end + +function widget:KeyPress(key) + if key == 27 then -- ESC + escape = true + end + if key == 273 then -- UP then + windowPosY = windowPosY - 1 + changeClock = os.clock() + end + if key == 274 then -- DOWN then + windowPosY = windowPosY + 1 + changeClock = os.clock() + end + if key == 275 then -- RIGHT then + windowPosX = windowPosX + 1 + changeClock = os.clock() + end + if key == 276 then -- LEFT then + windowPosX = windowPosX - 1 + changeClock = os.clock() + end + if dlistPosX ~= windowPosX or dlistPosY ~= windowPosY then + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + end + return true +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + gl.CallList(windowList) + + local x,y,b = Spring.GetMouseState() + if applyButtonPos and IsOnRect(x, y, applyButtonPos[1],applyButtonPos[2],applyButtonPos[3],applyButtonPos[4]) then + gl.Color(0.25,1,0.25,0.15) + RectRound(applyButtonPos[1],applyButtonPos[2],applyButtonPos[3],applyButtonPos[4],applyButtonPos[5]) + end +end + +function widget:Shutdown() + if WG['guishader'] then + WG['guishader'].RemoveRect('movewindowpos') + WG['guishader'].setScreenBlur(false) + end + if windowList then gl.DeleteList(windowList) end + widgetHandler:DisableWidget(widgetName) + gl.DeleteFont(font) +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_outline.lua b/LuaUI/Widgets_Evo/gfx_outline.lua deleted file mode 100644 index 3c7602e1e..000000000 --- a/LuaUI/Widgets_Evo/gfx_outline.lua +++ /dev/null @@ -1,340 +0,0 @@ --- $Id: gfx_outline.lua 3171 2008-11-06 09:06:29Z det $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: gfx_outline.lua --- brief: Displays a nice cartoon like outline around units --- author: jK --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Outline", - desc = "Displays a nice cartoon like outline around units.", - author = "jK", - date = "Dec 06, 2007", - license = "GNU GPL, v2 or later", - layer = -10, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---//textures -local offscreentex -local depthtex -local blurtex - ---//shader -local depthShader -local blurShader_h -local blurShader_v -local uniformScreenXY, uniformScreenX, uniformScreenY - ---// geometric -local vsx, vsy = 0,0 -local resChanged = false - ---// display lists -local enter2d,leave2d - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local GL_DEPTH_BITS = 0x0D56 - -local GL_DEPTH_COMPONENT = 0x1902 -local GL_DEPTH_COMPONENT16 = 0x81A5 -local GL_DEPTH_COMPONENT24 = 0x81A6 -local GL_DEPTH_COMPONENT32 = 0x81A7 - ---// speed ups -local ALL_UNITS = Spring.ALL_UNITS -local GetVisibleUnits = Spring.GetVisibleUnits - -local GL_MODELVIEW = GL.MODELVIEW -local GL_PROJECTION = GL.PROJECTION -local GL_COLOR_BUFFER_BIT = GL.COLOR_BUFFER_BIT - -local glUnit = gl.Unit -local glCopyToTexture = gl.CopyToTexture -local glRenderToTexture = gl.RenderToTexture -local glCallList = gl.CallList - -local glUseShader = gl.UseShader -local glUniform = gl.Uniform -local glUniformInt = gl.UniformInt - -local glBlending = gl.Blending -local glClear = gl.Clear -local glTexRect = gl.TexRect -local glColor = gl.Color -local glTexture = gl.Texture - -local glResetMatrices = gl.ResetMatrices -local glMatrixMode = gl.MatrixMode -local glPushMatrix = gl.PushMatrix -local glLoadIdentity = gl.LoadIdentity -local glPopMatrix = gl.PopMatrix - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - vsx, vsy = widgetHandler:GetViewSizes() - - depthShader = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - uniform vec2 screenXY; - - void main(void) - { - vec2 texCoord = vec2( gl_FragCoord.x/screenXY.x , gl_FragCoord.y/screenXY.y ); - float depth = texture2D(tex0, texCoord ).z; - - if (depth <= gl_FragCoord.z) { - discard; - } - gl_FragColor = gl_Color; - } - ]], - uniformInt = { - tex0 = 0, - }, - uniform = { - screenXY = {vsx,vsy}, - }, - }) - - blurShader_h = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - uniform int screenX; - - const vec2 kernel = vec2(0.6,0.7); - - void main(void) { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - gl_FragColor = vec4(0.0); - - int i; - int n = 1; - float pixelsize = 1.0/float(screenX); - for(i = 1; i < 3; ++i){ - gl_FragColor += kernel[n] * texture2D(tex0, vec2(texCoord.s + i*pixelsize,texCoord.t) ); - --n; - } - - gl_FragColor += texture2D(tex0, texCoord ); - - n = 0; - for(i = -2; i < 0; ++i){ - gl_FragColor += kernel[n] * texture2D(tex0, vec2(texCoord.s + i*pixelsize,texCoord.t) ); - ++n; - } - } - ]], - uniformInt = { - tex0 = 0, - screenX = vsx, - }, - }) - - - blurShader_v = gl.CreateShader({ - fragment = [[ uniform sampler2D tex0; - uniform int screenY; - - const vec2 kernel = vec2(0.6,0.7); - - void main(void) { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - gl_FragColor = vec4(0.0); - - int i; - int n = 1; - float pixelsize = 1.0/float(screenY); - for(i = 0; i < 2; ++i){ - gl_FragColor += kernel[n] * texture2D(tex0, vec2(texCoord.s,texCoord.t + i*pixelsize) ); - --n; - } - - gl_FragColor += texture2D(tex0, texCoord ); - - n = 0; - for(i = -2; i < 0; ++i){ - gl_FragColor += kernel[n] * texture2D(tex0, vec2(texCoord.s,texCoord.t + i*pixelsize) ); - ++n; - } - } - ]], - uniformInt = { - tex0 = 0, - screenY = vsy, - }, - }) - - if (depthShader == nil) then - Spring.Echo("Halo widget: depthcheck shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - if (blurShader_h == nil) then - Spring.Echo("Halo widget: hblur shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - if (blurShader_v == nil) then - Spring.Echo("Halo widget: vblur shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - uniformScreenXY = gl.GetUniformLocation(depthShader, 'screenXY') - uniformScreenX = gl.GetUniformLocation(blurShader_h, 'screenX') - uniformScreenY = gl.GetUniformLocation(blurShader_v, 'screenY') - - self:ViewResize(widgetHandler:GetViewSizes()) - - enter2d = gl.CreateList(function() - glUseShader(0) - glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity() - glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity() - end) - leave2d = gl.CreateList(function() - glMatrixMode(GL_PROJECTION); glPopMatrix() - glMatrixMode(GL_MODELVIEW); glPopMatrix() - glTexture(false) - glUseShader(0) - end) -end - -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY - - gl.DeleteTexture(depthtex or 0) - gl.DeleteTextureFBO(offscreentex or 0) - gl.DeleteTextureFBO(blurtex or 0) - - depthtex = gl.CreateTexture(vsx,vsy, { - border = false, - format = GL_DEPTH_COMPONENT24, - min_filter = GL.NEAREST, - mag_filter = GL.NEAREST, - }) - - offscreentex = gl.CreateTexture(vsx,vsy, { - border = false, - min_filter = GL.LINEAR, - mag_filter = GL.LINEAR, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - fboDepth = true, - }) - - blurtex = gl.CreateTexture(vsx,vsy, { - border = false, - min_filter = GL.LINEAR, - mag_filter = GL.LINEAR, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - resChanged = true -end - - -function widget:Shutdown() - gl.DeleteTexture(depthtex) - if (gl.DeleteTextureFBO) then - gl.DeleteTextureFBO(offscreentex) - gl.DeleteTextureFBO(blurtex) - end - - if (gl.DeleteShader) then - gl.DeleteShader(depthShader or 0) - gl.DeleteShader(blurShader_h or 0) - gl.DeleteShader(blurShader_v or 0) - end - - gl.DeleteList(enter2d) - gl.DeleteList(leave2d) -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function DrawVisibleUnits() - local visibleUnits = GetVisibleUnits(ALL_UNITS,nil,true) - for i=1,#visibleUnits do - glUnit(visibleUnits[i],true) - end -end - -local MyDrawVisibleUnits = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - glPushMatrix() - glResetMatrices() - glColor(0,0,0,0.4) - DrawVisibleUnits() - glColor(1,1,1,1) - glPopMatrix() -end - -local blur_h = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - glUseShader(blurShader_h) - glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) -end - -local blur_v = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - glUseShader(blurShader_v) - glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) -end - -function widget:DrawWorldPreUnit() - glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) - glCopyToTexture(depthtex, 0, 0, 0, 0, vsx, vsy) - glTexture(depthtex) - - if (resChanged) then - resChanged = false - if (vsx==1) or (vsy==1) then return end - glUseShader(depthShader) - glUniform(uniformScreenXY, vsx,vsy ) - glUseShader(blurShader_h) - glUniformInt(uniformScreenX, vsx ) - glUseShader(blurShader_v) - glUniformInt(uniformScreenY, vsy ) - end - - glUseShader(depthShader) - glRenderToTexture(offscreentex,MyDrawVisibleUnits) - - glTexture(offscreentex) - glRenderToTexture(blurtex, blur_h) - glTexture(blurtex) - glRenderToTexture(offscreentex, blur_v) - - glCallList(enter2d) - glTexture(offscreentex) - glTexRect(-1-0.5/vsx,1+0.5/vsy,1+0.5/vsx,-1-0.5/vsy) - glCallList(leave2d) - glBlending(false) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_outline_shader.lua b/LuaUI/Widgets_Evo/gfx_outline_shader.lua new file mode 100644 index 000000000..b382ddb70 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_outline_shader.lua @@ -0,0 +1,415 @@ +local wiName = "Outline (deferred)" +function widget:GetInfo() + return { + name = wiName, + desc = "Displays small outline around units based on deferred g-buffer", + author = "ivand", + date = "2019", + license = "GNU GPL, v2 or later", + layer = math.huge, + enabled = true -- loaded by default? + } +end + +----------------------------------------------------------------- +-- Accel +----------------------------------------------------------------- +local glMatrixMode = gl.MatrixMode +local glPushMatrix = gl.PushMatrix +local glLoadIdentity = gl.LoadIdentity +local glPopMatrix = gl.PopMatrix +local glDepthTest = gl.DepthTest +local glDepthMask = gl.DepthMask +local glBlending = gl.Blending +local glBlendFunc = gl.BlendFunc +local glTexture = gl.Texture +local glActiveFBO = gl.ActiveFBO +local glCallList = gl.CallList + +local GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA = GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA +local GL_MODELVIEW, GL_PROJECTION = GL.MODELVIEW, GL.PROJECTION + +----------------------------------------------------------------- +-- Constants +----------------------------------------------------------------- + +local GL_COLOR_ATTACHMENT0_EXT = 0x8CE0 + +----------------------------------------------------------------- +-- Configuration Constants +----------------------------------------------------------------- + +local MIN_FPS = 15 +local MIN_FPS_DELTA = 10 +local AVG_FPS_ELASTICITY = 0.15 +local AVG_FPS_ELASTICITY_INV = 1.0 - AVG_FPS_ELASTICITY + +local BLUR_HALF_KERNEL_SIZE = 4 -- (BLUR_HALF_KERNEL_SIZE + BLUR_HALF_KERNEL_SIZE + 1) samples are used to perform the blur. +local BLUR_PASSES = 1 -- number of blur passes +local BLUR_SIGMA = 3 -- Gaussian sigma of a single blur pass, other factors like BLUR_HALF_KERNEL_SIZE, BLUR_PASSES and DOWNSAMPLE affect the end result gaussian shape too + +local OUTLINE_COLOR = {0.0, 0.0, 0.0, 1.0} +local OUTLINE_STRENGTH = 2.0 -- make it much smaller for softer edges + +local USE_MATERIAL_INDICES = true -- for future material indices based SSAO evaluation + + +----------------------------------------------------------------- +-- File path Constants +----------------------------------------------------------------- + +local shadersDir = "LuaUI/Widgets_Evo/Shaders/" +local luaShaderDir = "LuaUI/Widgets_Evo/Include/" + +----------------------------------------------------------------- +-- Global Variables +----------------------------------------------------------------- + +local LuaShader = VFS.Include(luaShaderDir.."LuaShader.lua") + +local vsx, vsy, vpx, vpy + +local screenQuadList +local screenWideList + + +local shapeTex +local blurTexes = {} + +local shapeFBO +local blurFBOs = {} + +local shapeShader +local gaussianBlurShader +local applicationShader + +local show = true + +----------------------------------------------------------------- +-- Local Functions +----------------------------------------------------------------- + +local function G(x, sigma) + return ( 1 / ( math.sqrt(2 * math.pi) * sigma ) ) * math.exp( -(x * x) / (2 * sigma * sigma) ) +end + +local function GetGaussDiscreteWeightsOffsets(sigma, kernelHalfSize, valMult) + local weights = {} + local offsets = {} + + weights[1] = G(0, sigma) + local sum = weights[1] + + for i = 1, kernelHalfSize - 1 do + weights[i + 1] = G(i, sigma) + sum = sum + 2.0 * weights[i + 1] + end + + for i = 0, kernelHalfSize - 1 do --normalize so the weights sum up to valMult + weights[i + 1] = weights[i + 1] / sum * valMult + offsets[i + 1] = i + end + return weights, offsets +end + +--see http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +local function GetGaussLinearWeightsOffsets(sigma, kernelHalfSize, valMult) + local dWeights, dOffsets = GetGaussDiscreteWeightsOffsets(sigma, kernelHalfSize, 1.0) + + local weights = {dWeights[1]} + local offsets = {dOffsets[1]} + + for i = 1, (kernelHalfSize - 1) / 2 do + local newWeight = dWeights[2 * i] + dWeights[2 * i + 1] + weights[i + 1] = newWeight * valMult + offsets[i + 1] = (dOffsets[2 * i] * dWeights[2 * i] + dOffsets[2 * i + 1] * dWeights[2 * i + 1]) / newWeight + end + return weights, offsets +end + +----------------------------------------------------------------- +-- Widget Functions +----------------------------------------------------------------- + +function widget:ViewResize() + widget:Shutdown() + widget:Initialize() +end + +function widget:Initialize() + local canContinue = LuaShader.isDeferredShadingEnabled and LuaShader.GetAdvShadingActive() + if not canContinue then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, "Deferred shading is not enabled or advanced shading is not active")) + end + + local configName = "AllowDrawModelPostDeferredEvents" + if Spring.GetConfigInt(configName, 0) == 0 then + Spring.Echo(string.format("Warning in [%s] widget: %s", wiName, "AllowDrawModelPostDeferredEvents is not enabled, enabling it now")) + Spring.SetConfigInt(configName, 1) --required to enable receiving DrawUnitsPostDeferred/DrawFeaturesPostDeferred + end + + vsx, vsy, vpx, vpy = Spring.GetViewGeometry() + + local commonTexOpts = { + target = GL_TEXTURE_2D, + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.LINEAR, + + wrap_s = GL.CLAMP_TO_EDGE, + wrap_t = GL.CLAMP_TO_EDGE, + } + + shapeTex = gl.CreateTexture(vsx, vsy, commonTexOpts) + + for i = 1, 2 do + blurTexes[i] = gl.CreateTexture(vsx, vsy, commonTexOpts) + end + + + + shapeFBO = gl.CreateFBO({ + color0 = shapeTex, + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT}, + }) + + if not gl.IsValidFBO(shapeFBO) then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, "Invalid shapeFBO")) + end + + for i = 1, 2 do + blurFBOs[i] = gl.CreateFBO({ + color0 = blurTexes[i], + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT}, + }) + if not gl.IsValidFBO(blurFBOs[i]) then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, string.format("Invalid blurFBOs[%d]", i))) + end + end + + + local identityShaderVert = VFS.LoadFile(shadersDir.."identity.vert.glsl") + + local shapeShaderFrag = VFS.LoadFile(shadersDir.."outlineShape.frag.glsl") + + shapeShaderFrag = shapeShaderFrag:gsub("###USE_MATERIAL_INDICES###", tostring((USE_MATERIAL_INDICES and 1) or 0)) + + shapeShader = LuaShader({ + vertex = identityShaderVert, + fragment = shapeShaderFrag, + uniformInt = { + -- be consistent with gfx_deferred_rendering.lua + -- glTexture(1, "$model_gbuffer_zvaltex") + modelDepthTex = 1, + modelMiscTex = 2, + mapDepthTex = 3, + }, + uniformFloat = { + outlineColor = OUTLINE_COLOR, + }, + }, wiName..": Shape drawing") + shapeShader:Initialize() + + local gaussianBlurFrag = VFS.LoadFile(shadersDir.."gaussianBlur.frag.glsl") + + gaussianBlurFrag = gaussianBlurFrag:gsub("###BLUR_HALF_KERNEL_SIZE###", tostring(BLUR_HALF_KERNEL_SIZE)) + + gaussianBlurShader = LuaShader({ + vertex = identityShaderVert, + fragment = gaussianBlurFrag, + uniformInt = { + tex = 0, + }, + uniformFloat = { + viewPortSize = {vsx, vsy}, + }, + }, wiName..": Gaussian Blur") + gaussianBlurShader:Initialize() + + local gaussWeights, gaussOffsets = GetGaussLinearWeightsOffsets(BLUR_SIGMA, BLUR_HALF_KERNEL_SIZE, OUTLINE_STRENGTH) + + gaussianBlurShader:ActivateWith( function() + gaussianBlurShader:SetUniformFloatArrayAlways("weights", gaussWeights) + gaussianBlurShader:SetUniformFloatArrayAlways("offsets", gaussOffsets) + end) + + local applicationFrag = VFS.LoadFile(shadersDir.."outlineApplication.frag.glsl") + + applicationShader = LuaShader({ + vertex = identityShaderVert, + fragment = applicationFrag, + uniformInt = { + tex = 0, + modelDepthTex = 1, + }, + uniformFloat = { + viewPortSize = {vsx, vsy}, + }, + }, wiName..": Outline Application") + applicationShader:Initialize() + + screenQuadList = gl.CreateList(gl.TexRect, -1, -1, 1, 1) + screenWideList = gl.CreateList(gl.TexRect, -1, -1, 1, 1, false, true) +end + +function widget:Shutdown() + if screenQuadList then + gl.DeleteList(screenQuadList) + end + + if screenWideList then + gl.DeleteList(screenWideList) + end + + gl.DeleteTexture(shapeTex) + + for i = 1, 2 do + gl.DeleteTexture(blurTexes[i]) + end + + gl.DeleteFBO(shapeFBO) + for i = 1, 2 do + gl.DeleteFBO(blurFBOs[i]) + end + + shapeShader:Finalize() + gaussianBlurShader:Finalize() + applicationShader:Finalize() +end + +local function PrepareOutline() + glDepthTest(false) + glDepthMask(false) + + glActiveFBO(shapeFBO, function() + shapeShader:ActivateWith( function () + glTexture(1, "$model_gbuffer_zvaltex") + if USE_MATERIAL_INDICES then + glTexture(2, "$model_gbuffer_misctex") + end + glTexture(3, "$map_gbuffer_zvaltex") + + glCallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + + --glTexture(1, false) --will reuse later + if USE_MATERIAL_INDICES then + glTexture(2, false) + end + glTexture(3, false) + end) + end) + + glTexture(0, shapeTex) + + for i = 1, BLUR_PASSES do + gaussianBlurShader:ActivateWith( function () + + gaussianBlurShader:SetUniform("dir", 1.0, 0.0) --horizontal blur + glActiveFBO(blurFBOs[1], function() + glCallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + end) + glTexture(0, blurTexes[1]) + + gaussianBlurShader:SetUniform("dir", 0.0, 1.0) --vertical blur + glActiveFBO(blurFBOs[2], function() + glCallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + end) + glTexture(0, blurTexes[2]) + + end) + end + + glTexture(0, false) + glTexture(1, false) +end + +local function DrawOutline(strength, dupd) + glBlending(true) + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) --alpha NO pre-multiply + + if dupd then + glDepthTest(false) + glDepthMask(false) + end + + glTexture(0, blurTexes[2]) + glTexture(1, "$model_gbuffer_zvaltex") + + applicationShader:ActivateWith( function () + applicationShader:SetUniformFloat("strength", strength or 1.0) + glCallList(screenWideList) + end) + + if dupd then + glBlending(false) + glDepthTest(true) + glDepthMask(true) + end + + glTexture(0, false) + glTexture(1, false) +end + + +local accuTime = 0 +local lastTime = 0 +local averageFPS = MIN_FPS + MIN_FPS_DELTA + +function widget:Update(dt) + accuTime = accuTime + dt + if accuTime >= lastTime + 1 then + lastTime = accuTime + averageFPS = AVG_FPS_ELASTICITY_INV * averageFPS + AVG_FPS_ELASTICITY * Spring.GetFPS() + if averageFPS < MIN_FPS then + show = false + elseif averageFPS > MIN_FPS + MIN_FPS_DELTA then + show = true + end + end +end + +local function EnterLeaveScreenSpace(functionName, ...) + glMatrixMode(GL_MODELVIEW) + glPushMatrix() + glLoadIdentity() + + glMatrixMode(GL_PROJECTION) + glPushMatrix() + glLoadIdentity(); + + functionName(...) + + glMatrixMode(GL_PROJECTION) + glPopMatrix() + + glMatrixMode(GL_MODELVIEW) + glPopMatrix() +end + +function widget:DrawUnitsPostDeferred() + if not show then + return + end + EnterLeaveScreenSpace( function() + PrepareOutline() + DrawOutline(1.0, true) + end) + widgetHandler:RemoveCallIn("DrawWorldPreUnit") +end + +function widget:DrawWorldPreUnit() + if not show then + return + end + EnterLeaveScreenSpace( function() + PrepareOutline() + DrawOutline(1.0, false) + end) +end + +function widget:DrawWorld() + if not show then + return + end + EnterLeaveScreenSpace(DrawOutline, 0.25, false) +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_shadow_quality_manager.lua b/LuaUI/Widgets_Evo/gfx_shadow_quality_manager.lua deleted file mode 100644 index d413dc354..000000000 --- a/LuaUI/Widgets_Evo/gfx_shadow_quality_manager.lua +++ /dev/null @@ -1,112 +0,0 @@ - -function widget:GetInfo() -return { - name = "Shadow Quality Manager", - desc = "Because quality shadows are CPU heavy, it will reduce quality when fps gets low.", - author = "Floris", - date = "22 february 2015", - license = "GNU GPL, v2 or later", - layer = -10000, - enabled = true -} -end - --------------------------------------------------------------------------------- --- Config --------------------------------------------------------------------------------- - -local maxQuality = 8192 -local minQuality = 2048 -- I dont think a value below 2048 looks acceptable enough... wont free that much extra cpu power too -local disableBelowMinimum = false -local skipGameframes = 1611 -- dont check if quality change is needed for X gameframes -local fpsDifference = 8 -- if fps differs X amount, then shadow quality will be allowed to change. (we dont want frequent changes because these are causing extra cpu load, also spring spams an echo each time) - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local spGetVisibleUnits = Spring.GetVisibleUnits -local spGetVisibleFeatures = Spring.GetVisibleFeatures -local spGetFPS = Spring.GetFPS -local spHaveShadows = Spring.HaveShadows -local averageFps = spGetFPS() + 5 - -local previousQuality = maxQuality -local previousQualityFps = 30 - -local shadowsAtInit = spHaveShadows() -local turnedShadowsOff = false - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - if spHaveShadows() and Spring.GetGameFrame() < 1 then - Spring.SendCommands({"shadows 1 "..maxQuality}) - end -end - -function widget:Shutdown() - - -- enable shadows again when the widget has turned these off - if not spHaveShadows() and turnedShadowsOff then - Spring.SendCommands({"shadows 1 "..((maxQuality+minQuality)/2)}) - end -end - -function widget:GameFrame(gameFrame) - if spHaveShadows() or shadowsAtInit and turnedShadowsOff then - - if gameFrame%109==0 then - local modelCount = #spGetVisibleUnits(-1,nil,false) + #spGetVisibleFeatures(-1,nil,false,false) -- expensive) - local modelCountWeight = modelCount/1700 - if modelCountWeight > 1 then modelCountWeight = 1 end - if modelCountWeight < 0.05 then modelCountWeight = 0.05 end - local newAvgFps = ((spGetFPS() + (averageFps*14)) / 15) - averageFps = averageFps + ((newAvgFps - averageFps) * modelCountWeight) -- make it so that high model count impact avg fps changes more - --local dquality = math.floor((maxQuality+minQuality) - (maxQuality / (averageFps/20))) - --Spring.Echo(averageFps..' '..dquality) - end - if gameFrame%skipGameframes==0 then - quality = math.floor((maxQuality+minQuality) - (maxQuality / (averageFps/20))) - - if averageFps > previousQualityFps + fpsDifference or averageFps < previousQualityFps - fpsDifference then -- weight fps values with more rendered models heavier - - if quality > maxQuality then - quality = maxQuality - end - if quality < minQuality then - quality = minQuality-1 - end - if previousQuality ~= quality then - previousQuality = quality - previousQualityFps = averageFps - if quality < minQuality and disableBelowMinimum then - turnedShadowsOff = true - Spring.SendCommands({"shadows 0"}) - --Spring.Echo("Shadow quality: off avgfps: "..math.floor(averageFps)) - else - Spring.SendCommands({"shadows 1 "..quality}) - --Spring.Echo("Shadow quality: "..quality.." avgfps: "..math.floor(averageFps)) - end - end - end - end - end -end - --- preserve data in case of a /luaui reload -function widget:GetConfigData(data) - savedTable = {} - savedTable.averageFps = averageFps - savedTable.previousQuality = previousQuality - savedTable.previousQualityFps = previousQualityFps - return savedTable -end - -function widget:SetConfigData(data) - if Spring.GetGameFrame() > 0 then - if data.averageFps ~= nil then averageFps = data.averageFps end - if data.previousQuality ~= nil then previousQuality = data.previousQuality end - if data.previousQualityFps ~= nil then previousQualityFps = data.previousQualityFps end - end -end diff --git a/LuaUI/Widgets_Evo/gfx_snow.lua b/LuaUI/Widgets_Evo/gfx_snow.lua index 8c81444c0..3da632f17 100644 --- a/LuaUI/Widgets_Evo/gfx_snow.lua +++ b/LuaUI/Widgets_Evo/gfx_snow.lua @@ -19,6 +19,14 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local minFps = 22 -- stops snowing at local maxFps = 55 -- max particles at local particleSteps = 14 -- max steps in diminishing number of particles (dont use too much steps, creates extra dlist for each step) @@ -39,7 +47,7 @@ local fpsDifference = (maxFps-minFps)/particleSteps -- fps difference need b local snowTexFolder = "LuaUI/Images/snow/" -local snowKeywords = {'snow','frozen','cold','winter','ice','icy','arctic','frost','melt','glacier','mosh_pit','blindside','northernmountains','amarante'} +local snowKeywords = {'snow','frozen','cold','winter','ice','icy','arctic','frost','melt','glacier','mosh_pit','blindside','northernmountains','amarante','cervino'} local snowMaps = {} @@ -167,6 +175,7 @@ local startOsClock = os.clock() function widget:Shutdown() removeSnow() + WG['snow'] = nil end function removeSnow() @@ -227,12 +236,13 @@ function init() if (glCreateShader == nil) then Spring.Echo("[Snow widget:Initialize] no shader support") - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end shader = glCreateShader({ vertex = [[ + #version 150 compatibility uniform float time; uniform float scale; uniform vec3 speed; @@ -281,7 +291,7 @@ function init() if (shader == nil) then Spring.Echo("[Snow widget:Initialize] particle shader compilation failed") Spring.Echo(glGetShaderLog()) - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end @@ -322,7 +332,9 @@ function widget:Initialize() end WG['snow'].setMultiplier = function(value) customParticleMultiplier = value - CreateParticleLists() + if enabled or widgetDisabledSnow then + CreateParticleLists() + end end WG['snow'].setAutoReduce = function(value) autoReduce = value @@ -353,11 +365,13 @@ function widget:Initialize() local text = "Snowing less when FPS gets lower \n" local text2 = "/snow to toggle snow... for this map \n".."disable 'Snow' widget... for all maps " local fontSize = 30 - --local textWidth = gl.GetTextWidth(text)*fontSize - local textHeight = gl.GetTextHeight(text)*fontSize + --local textWidth = font:GetTextWidth(text)*fontSize + local textHeight = font:GetTextHeight(text)*fontSize --gl.Text(text, -textWidth/2, -textHeight/2, fontSize, "") - gl.Text(text, 0, textHeight/2, fontSize, "c") - gl.Text(text2, 0, -textHeight/1.6, fontSize*0.8, "c") + font:Begin() + font:Print(text, 0, textHeight/2, fontSize, "c") + font:Print(text2, 0, -textHeight/1.6, fontSize*0.8, "c") + font:End() end) startOsClock = os.clock() @@ -439,12 +453,21 @@ function widget:GameFrame(gameFrame) end function widget:Shutdown() + enabled = false if drawinfolist ~= nil then gl.DeleteList(drawinfolist) end + gl.DeleteFont(font) +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawScreen() + if chobbyInterface then return end if not enabled or not autoReduce then return end if not gameStarted and snowMaps[currentMapname] ~= nil and snowMaps[currentMapname] then @@ -522,6 +545,12 @@ end function widget:ViewResize(newX,newY) vsx, vsy = newX, newY widgetScale = (0.55 + (vsx*vsy / 10000000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end if particleLists[#particleTypes] ~= nil then CreateParticleLists() gameFrameCountdown = 80 diff --git a/LuaUI/Widgets_Evo/gfx_ssao.lua b/LuaUI/Widgets_Evo/gfx_ssao.lua new file mode 100644 index 000000000..7616d7626 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_ssao.lua @@ -0,0 +1,548 @@ +local wiName = "SSAO" +function widget:GetInfo() + return { + name = wiName, + version = 2.0, + desc = "Screen-Space Ambient Occlusion", + author = "ivand", + date = "2019", + license = "GPL", + layer = math.huge, + enabled = true, --true + } +end + +----------------------------------------------------------------- +-- Constants +----------------------------------------------------------------- + +local GL_COLOR_ATTACHMENT0_EXT = 0x8CE0 +local GL_COLOR_ATTACHMENT1_EXT = 0x8CE1 +local GL_COLOR_ATTACHMENT2_EXT = 0x8CE2 + +local GL_RGB16F = 0x881B + +local GL_RGB8_SNORM = 0x8F96 + +local GL_RGBA8 = 0x8058 + +local GL_FUNC_ADD = 0x8006 +local GL_FUNC_REVERSE_SUBTRACT = 0x800B + +----------------------------------------------------------------- +-- Configuration Constants +----------------------------------------------------------------- + +local SSAO_KERNEL_SIZE = 24 -- how many samples are used for SSAO spatial sampling +local SSAO_RADIUS = 5 -- world space maximum sampling radius +local SSAO_MIN = 1.0 -- minimum depth difference between fragment and sample depths to trigger SSAO sample occlusion. Absolute value in world space coords. +local SSAO_MAX = 1.0 -- maximum depth difference between fragment and sample depths to trigger SSAO sample occlusion. Percentage of SSAO_RADIUS. +local SSAO_ALPHA_POW = 3.0 -- consider this as SSAO effect strength + +local BLUR_HALF_KERNEL_SIZE = 4 -- (BLUR_HALF_KERNEL_SIZE + BLUR_HALF_KERNEL_SIZE + 1) samples are used to perform the blur +local BLUR_PASSES = 3 -- number of blur passes +local BLUR_SIGMA = 1.8 -- Gaussian sigma of a single blur pass, other factors like BLUR_HALF_KERNEL_SIZE, BLUR_PASSES and DOWNSAMPLE affect the end result gaussian shape too + +local DOWNSAMPLE = 2 -- increasing downsapling will reduce GPU RAM occupation (a little bit), increase performace (a little bit), introduce occlusion blockiness + +local MERGE_MISC = false -- for future material indices based SSAO evaluation +local DEBUG_SSAO = false -- use for debug + + +----------------------------------------------------------------- +-- File path Constants +----------------------------------------------------------------- + +local shadersDir = "LuaUI/Widgets_Evo/Shaders/" +local luaShaderDir = "LuaUI/Widgets_Evo/Include/" + +----------------------------------------------------------------- +-- Global Variables +----------------------------------------------------------------- + +local LuaShader = VFS.Include(luaShaderDir.."LuaShader.lua") + +local vsx, vsy, vpx, vpy +local firstTime + +local screenQuadList +local screenWideList + +local gbuffFuseFBO +local ssaoFBO +local ssaoBlurFBOs = {} + +local gbuffFuseViewPosTex +local gbuffFuseViewNormalTex +local gbuffFuseMiscTex +local ssaoTex +local ssaoBlurTexes = {} + +local ssaoShader +local gbuffFuseShader +local gaussianBlurShader + +----------------------------------------------------------------- +-- Local Functions +----------------------------------------------------------------- + +local function G(x, sigma) + return ( 1 / ( math.sqrt(2 * math.pi) * sigma ) ) * math.exp( -(x * x) / (2 * sigma * sigma) ) +end + +local function GetGaussDiscreteWeightsOffsets(sigma, kernelHalfSize, valMult) + local weights = {} + local offsets = {} + + weights[1] = G(0, sigma) + local sum = weights[1] + + for i = 1, kernelHalfSize - 1 do + weights[i + 1] = G(i, sigma) + sum = sum + 2.0 * weights[i + 1] + end + + for i = 0, kernelHalfSize - 1 do --normalize so the weights sum up to valMult + weights[i + 1] = weights[i + 1] / sum * valMult + offsets[i + 1] = i + end + return weights, offsets +end + +--see http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ +local function GetGaussLinearWeightsOffsets(sigma, kernelHalfSize, valMult) + local dWeights, dOffsets = GetGaussDiscreteWeightsOffsets(sigma, kernelHalfSize, 1.0) + + local weights = {dWeights[1]} + local offsets = {dOffsets[1]} + + for i = 1, (kernelHalfSize - 1) / 2 do + local newWeight = dWeights[2 * i] + dWeights[2 * i + 1] + weights[i + 1] = newWeight * valMult + offsets[i + 1] = (dOffsets[2 * i] * dWeights[2 * i] + dOffsets[2 * i + 1] * dWeights[2 * i + 1]) / newWeight + end + return weights, offsets +end + + +-- quick port of GLSL. +--[[ + for (int i = 0; i < SSAO_KERNEL_SIZE; i++) { + vec3 tmp = hash31( float(i) ); + tmp.xy = NORM2SNORM(tmp.xy); + tmp = normalize(tmp); + float scale = float(i)/float(SSAO_KERNEL_SIZE); + scale = clamp(scale * scale, 0.1, 1.0); + tmp *= scale; + samplingKernel[i] = tmp; + } +]]-- +-- I do so because of according GLSL spec gl_MaxVertexOutputComponents = 64; and gl_MaxFragmentUniformComponents = 1024; +-- so bigger SSAO kernel size can be supported if they are conveyed via uniforms vs varyings +local function GetSamplingVectorArray(kernelSize) + local result = {} + math.randomseed(kernelSize) -- for repeatability + for i = 0, kernelSize - 1 do + local x, y, z = math.random(), math.random(), math.random() -- [0, 1]^3 + + x, y = 2.0 * x - 1.0, 2.0 * y - 1.0 -- xy:[-1, 1]^2, z:[0, 1] + + local l = math.sqrt(x * x + y * y + z * z) --norm + x, y, z = x / l, y / l, z / l --normalize + + local scale = i / (kernelSize - 1) + scale = scale * scale -- shift most samples closer to the origin + scale = math.min(math.max(scale, 0.1), 1.0) --clamp + + x, y, z = x * scale, y * scale, z * scale -- scale + result[i] = {x = x, y = y, z = z} + end + return result +end + +----------------------------------------------------------------- +-- Widget Functions +----------------------------------------------------------------- + +function widget:ViewResize() + widget:Shutdown() + widget:Initialize() +end + +function widget:Initialize() + WG['ssao'] = {} + WG['ssao'].getStrength = function() + return SSAO_ALPHA_POW + end + WG['ssao'].setStrength = function(value) + SSAO_ALPHA_POW = value + widget:Shutdown() + widget:Initialize() + end + WG['ssao'].getRadius = function() + return SSAO_RADIUS + end + WG['ssao'].setRadius = function(value) + SSAO_RADIUS = value + widget:Shutdown() + widget:Initialize() + end + local canContinue = LuaShader.isDeferredShadingEnabled and LuaShader.GetAdvShadingActive() + if not canContinue then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, "Deferred shading is not enabled or advanced shading is not active")) + end + + firstTime = true + vsx, vsy, vpx, vpy = Spring.GetViewGeometry() + + local commonTexOpts = { + target = GL_TEXTURE_2D, + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + + wrap_s = GL.CLAMP_TO_EDGE, + wrap_t = GL.CLAMP_TO_EDGE, + } + + commonTexOpts.format = GL_RGB16F + gbuffFuseViewPosTex = gl.CreateTexture(vsx, vsy, commonTexOpts) + + commonTexOpts.format = GL_RGB8_SNORM + gbuffFuseViewNormalTex = gl.CreateTexture(vsx, vsy, commonTexOpts) + + if MERGE_MISC then + commonTexOpts.format = GL_RGBA8 + gbuffFuseMiscTex = gl.CreateTexture(vsx, vsy, commonTexOpts) + end + + commonTexOpts.min_filter = GL.LINEAR + commonTexOpts.mag_filter = GL.LINEAR + + commonTexOpts.format = GL_RGBA8 + ssaoTex = gl.CreateTexture(vsx / DOWNSAMPLE, vsy / DOWNSAMPLE, commonTexOpts) + + commonTexOpts.format = GL_RGBA8 + for i = 1, 2 do + ssaoBlurTexes[i] = gl.CreateTexture(vsx / DOWNSAMPLE, vsy / DOWNSAMPLE, commonTexOpts) + end + + if MERGE_MISC then + gbuffFuseFBO = gl.CreateFBO({ + color0 = gbuffFuseViewPosTex, + color1 = gbuffFuseViewNormalTex, + color2 = gbuffFuseMiscTex, + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT}, + }) + else + gbuffFuseFBO = gl.CreateFBO({ + color0 = gbuffFuseViewPosTex, + color1 = gbuffFuseViewNormalTex, + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT}, + }) + end + + if not gl.IsValidFBO(gbuffFuseFBO) then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, "Invalid gbuffFuseFBO")) + end + + ssaoFBO = gl.CreateFBO({ + color0 = ssaoTex, + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT}, + }) + if not gl.IsValidFBO(ssaoFBO) then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, "Invalid ssaoFBO")) + end + + for i = 1, 2 do + ssaoBlurFBOs[i] = gl.CreateFBO({ + color0 = ssaoBlurTexes[i], + drawbuffers = {GL_COLOR_ATTACHMENT0_EXT}, + }) + if not gl.IsValidFBO(ssaoBlurFBOs[i]) then + Spring.Echo(string.format("Error in [%s] widget: %s", wiName, string.format("Invalid ssaoBlurFBOs[%d]", i))) + end + end + + + local gbuffFuseShaderVert = VFS.LoadFile(shadersDir.."identity.vert.glsl") + local gbuffFuseShaderFrag = VFS.LoadFile(shadersDir.."gbuffFuse.frag.glsl") + + gbuffFuseShaderFrag = gbuffFuseShaderFrag:gsub("###DEPTH_CLIP01###", tostring((Platform.glSupportClipSpaceControl and 1) or 0)) + gbuffFuseShaderFrag = gbuffFuseShaderFrag:gsub("###MERGE_MISC###", tostring((MERGE_MISC and 1) or 0)) + + gbuffFuseShader = LuaShader({ + vertex = gbuffFuseShaderVert, + fragment = gbuffFuseShaderFrag, + uniformInt = { + -- be consistent with gfx_deferred_rendering.lua + -- glTexture(0, "$model_gbuffer_normtex") + -- glTexture(1, "$model_gbuffer_zvaltex") + -- glTexture(2, "$map_gbuffer_normtex") + -- glTexture(3, "$map_gbuffer_zvaltex") + modelNormalTex = 0, + modelDepthTex = 1, + mapNormalTex = 2, + mapDepthTex = 3, + + modelMiscTex = 4, + mapMiscTex = 5, + }, + uniformFloat = { + viewPortSize = {vsx, vsy}, + }, + }, wiName..": G-buffer Fuse") + gbuffFuseShader:Initialize() + + + local ssaoShaderVert = VFS.LoadFile(shadersDir.."identity.vert.glsl") + local ssaoShaderFrag = VFS.LoadFile(shadersDir.."ssao.frag.glsl") + + ssaoShaderFrag = ssaoShaderFrag:gsub("###SSAO_KERNEL_SIZE###", tostring(SSAO_KERNEL_SIZE)) + + ssaoShaderFrag = ssaoShaderFrag:gsub("###SSAO_RADIUS###", tostring(SSAO_RADIUS)) + ssaoShaderFrag = ssaoShaderFrag:gsub("###SSAO_MIN###", tostring(SSAO_MIN)) + ssaoShaderFrag = ssaoShaderFrag:gsub("###SSAO_MAX###", tostring(SSAO_MAX)) + + ssaoShaderFrag = ssaoShaderFrag:gsub("###SSAO_ALPHA_POW###", tostring(SSAO_ALPHA_POW)) + + ssaoShader = LuaShader({ + vertex = ssaoShaderVert, + fragment = ssaoShaderFrag, + uniformInt = { + viewPosTex = 0, + viewNormalTex = 1, + }, + uniformFloat = { + viewPortSize = {vsx / DOWNSAMPLE, vsy / DOWNSAMPLE}, + }, + }, wiName..": Processing") + ssaoShader:Initialize() + + ssaoShader:ActivateWith( function() + local samplingKernel = GetSamplingVectorArray(SSAO_KERNEL_SIZE) + for i = 0, SSAO_KERNEL_SIZE - 1 do + local sv = samplingKernel[i] + ssaoShader:SetUniformFloatAlways(string.format("samplingKernel[%d]", i), sv.x, sv.y, sv.z) + end + end) + + + local gaussianBlurVert = VFS.LoadFile(shadersDir.."identity.vert.glsl") + local gaussianBlurFrag = VFS.LoadFile(shadersDir.."gaussianBlur.frag.glsl") + + gaussianBlurFrag = gaussianBlurFrag:gsub("###BLUR_HALF_KERNEL_SIZE###", tostring(BLUR_HALF_KERNEL_SIZE)) + + gaussianBlurShader = LuaShader({ + vertex = gaussianBlurVert, + fragment = gaussianBlurFrag, + uniformInt = { + tex = 0, + }, + uniformFloat = { + viewPortSize = {vsx / DOWNSAMPLE, vsy / DOWNSAMPLE}, + }, + }, wiName..": Gaussian Blur") + gaussianBlurShader:Initialize() + + local gaussWeights, gaussOffsets = GetGaussLinearWeightsOffsets(BLUR_SIGMA, BLUR_HALF_KERNEL_SIZE, 1.0) + + gaussianBlurShader:ActivateWith( function() + gaussianBlurShader:SetUniformFloatArrayAlways("weights", gaussWeights) + gaussianBlurShader:SetUniformFloatArrayAlways("offsets", gaussOffsets) + end) + + widget:SunChanged() +end + +function widget:SunChanged() + ssaoShader:ActivateWith( function() + local shadowDensity = gl.GetSun("shadowDensity", "unit") + ssaoShader:SetUniformFloatAlways("shadowDensity", shadowDensity) + end) +end + +function widget:Shutdown() + firstTime = nil + + if screenQuadList then + gl.DeleteList(screenQuadList) + end + + if screenWideList then + gl.DeleteList(screenWideList) + end + + + gl.DeleteTexture(ssaoTex) + gl.DeleteTexture(gbuffFuseViewPosTex) + gl.DeleteTexture(gbuffFuseViewNormalTex) + if MERGE_MISC then + gl.DeleteTexture(gbuffFuseMiscTex) + end + + for i = 1, 2 do + gl.DeleteTexture(ssaoBlurTexes[i]) + end + + gl.DeleteFBO(ssaoFBO) + gl.DeleteFBO(gbuffFuseFBO) + for i = 1, 2 do + gl.DeleteFBO(ssaoBlurFBOs[i]) + end + + ssaoShader:Finalize() + gbuffFuseShader:Finalize() + gaussianBlurShader:Finalize() +end + +local function DoDrawSSAO(isScreenSpace) + gl.DepthTest(false) + gl.DepthMask(false) + gl.Blending(false) + + + if firstTime then + screenQuadList = gl.CreateList(gl.TexRect, -1, -1, 1, 1) + if isScreenSpace then + screenWideList = gl.CreateList(gl.TexRect, 0, vsy, vsx, 0) + else + screenWideList = gl.CreateList(gl.TexRect, -1, -1, 1, 1, false, true) + end + firstTime = false + end + + gl.ActiveFBO(gbuffFuseFBO, function() + gbuffFuseShader:ActivateWith( function () + + gbuffFuseShader:SetUniformMatrix("invProjMatrix", "projectioninverse") + gbuffFuseShader:SetUniformMatrix("viewMatrix", "view") + + gl.Texture(0, "$model_gbuffer_normtex") + gl.Texture(1, "$model_gbuffer_zvaltex") + gl.Texture(2, "$map_gbuffer_normtex") + gl.Texture(3, "$map_gbuffer_zvaltex") + + if MERGE_MISC then + gl.Texture(4, "$model_gbuffer_misctex") + gl.Texture(5, "$map_gbuffer_misctex") + end + + + gl.CallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + --gl.TexRect(-1, -1, 1, 1) + + gl.Texture(0, false) + gl.Texture(1, false) + gl.Texture(2, false) + gl.Texture(3, false) + if MERGE_MISC then + gl.Texture(4, false) + gl.Texture(5, false) + end + end) + end) + + gl.ActiveFBO(ssaoFBO, function() + ssaoShader:ActivateWith( function () + ssaoShader:SetUniformMatrix("projMatrix", "projection") + + gl.Texture(0, gbuffFuseViewPosTex) + gl.Texture(1, gbuffFuseViewNormalTex) + gl.CallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + --gl.TexRect(-1, -1, 1, 1) + + gl.Texture(0, false) + gl.Texture(1, false) + end) + end) + + gl.Texture(0, ssaoTex) + + for i = 1, BLUR_PASSES do + gaussianBlurShader:ActivateWith( function () + + gaussianBlurShader:SetUniform("dir", 1.0, 0.0) --horizontal blur + gl.ActiveFBO(ssaoBlurFBOs[1], function() + gl.CallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + end) + gl.Texture(0, ssaoBlurTexes[1]) + + gaussianBlurShader:SetUniform("dir", 0.0, 1.0) --vertical blur + gl.ActiveFBO(ssaoBlurFBOs[2], function() + gl.CallList(screenQuadList) -- gl.TexRect(-1, -1, 1, 1) + end) + gl.Texture(0, ssaoBlurTexes[2]) + + end) + end + + + if DEBUG_SSAO then + gl.Blending(false) + else + gl.BlendEquation(GL_FUNC_REVERSE_SUBTRACT) + --gl.Blending("alpha") + gl.Blending(true) + gl.BlendFuncSeparate(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ZERO, GL.ONE) + --gl.BlendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) --alpha NO pre-multiply + --gl.BlendFunc(GL.ONE, GL.ONE_MINUS_SRC_ALPHA) --alpha pre-multiply + --gl.BlendFunc(GL.ZERO, GL.ONE) + end + + -- Already bound + --gl.Texture(0, ssaoBlurTexes[1]) + + gl.CallList(screenWideList) + + if not DEBUG_SSAO then + gl.BlendEquation(GL_FUNC_ADD) + end + + + + + gl.Texture(0, false) + gl.Texture(1, false) + gl.Texture(2, false) + gl.Texture(3, false) + + + gl.Blending("alpha") + --gl.DepthMask(true) + --gl.DepthTest(true) +end + +function widget:DrawWorld() + gl.MatrixMode(GL.MODELVIEW) + gl.PushMatrix() + gl.LoadIdentity() + + gl.MatrixMode(GL.PROJECTION) + gl.PushMatrix() + gl.LoadIdentity(); + + DoDrawSSAO(false) + + gl.MatrixMode(GL.PROJECTION) + gl.PopMatrix() + + gl.MatrixMode(GL.MODELVIEW) + gl.PopMatrix() +end + +function widget:GetConfigData(data) + savedTable = {} + savedTable.strength = SSAO_ALPHA_POW + savedTable.radius = SSAO_RADIUS + return savedTable +end + +function widget:SetConfigData(data) + if data.strength ~= nil then + SSAO_ALPHA_POW = data.strength + end + if data.strength ~= nil then + SSAO_RADIUS = data.radius + end +end diff --git a/LuaUI/Widgets_Evo/gfx_undercontruction.lua b/LuaUI/Widgets_Evo/gfx_undercontruction.lua new file mode 100644 index 000000000..773ccd3d6 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_undercontruction.lua @@ -0,0 +1,233 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_highlight_unit.lua +-- brief: highlights the unit/feature under the cursor +-- author: Dave Rodgers, modified by zwzsg +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Under construction gfx", + desc = "", + author = "Floris", + date = "May 2018", + license = "GPL", + layer = 50, + enabled = true + } +end + +local highlightAlpha = 0.4 +local useHighlightShader = true +local maxShaderUnits = 100 +local edgeExponent = 5 + +local spIsUnitIcon = Spring.IsUnitIcon +local spIsUnitInView = Spring.IsUnitInView +local spGetTeamColor = Spring.GetTeamColor +local spGetUnitTeam = Spring.GetUnitTeam +local myPlayerID = Spring.GetMyPlayerID() +local prevMyAllyTeamID = Spring.GetMyAllyTeamID() +local mySpec, prevMyFullView = Spring.GetSpectatingState() +local unitList = {} +local unitListCount = 0 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +function CreateHighlightShader() + if shader then + gl.DeleteShader(shader) + end + shader = gl.CreateShader({ + + uniform = { + edgeExponent = edgeExponent/(0.8+highlightAlpha), + plainAlpha = highlightAlpha*0.8, + }, + + vertex = [[ + // Application to vertex shader + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + uniform mat4 camera; + uniform mat4 caminv; + + void main() + { + vec4 P = gl_ModelViewMatrix * gl_Vertex; + + eyeVec = P.xyz; + + normal = gl_NormalMatrix * gl_Normal; + + color = gl_Color.rgb; + + gl_Position = gl_ProjectionMatrix * P; + } + ]], + + fragment = [[ + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + + uniform float edgeExponent; + uniform float plainAlpha; + + void main() + { + float opac = dot(normalize(normal), normalize(eyeVec)); + opac = 1.0 - abs(opac); + opac = pow(opac, edgeExponent)*0.45; + + gl_FragColor.rgb = color + (opac*1.3); + gl_FragColor.a = plainAlpha + opac; + + } + ]], + }) +end +-------------------------------------------------------------------------------- + +function ResetUnderConstructionUnits() + local allUnits = Spring.GetAllUnits() + unitList = {} + unitListCount = 0 + for _, unitID in pairs(allUnits) do + local health,maxHealth,paralyzeDamage,captureProgress,buildProgress=Spring.GetUnitHealth(unitID) + if buildProgress and buildProgress < 1 then + --local unitDefID = Spring.GetUnitDefID(unitID) + unitList[unitID] = spGetUnitTeam(unitID) + unitListCount = unitListCount + 1 + end + end +end + +function widget:Initialize() + WG['underconstructiongfx'] = {} + WG['underconstructiongfx'].getOpacity = function() + return highlightAlpha + end + WG['underconstructiongfx'].setOpacity = function(value) + highlightAlpha = value + CreateHighlightShader() + end + WG['underconstructiongfx'].getShader = function() + return useHighlightShader + end + WG['underconstructiongfx'].setShader = function(value) + useHighlightShader = value + CreateHighlightShader() + end + + if gl.CreateShader ~= nil then + CreateHighlightShader() + end + + ResetUnderConstructionUnits() +end + + +function widget:Shutdown() + if shader then + gl.DeleteShader(shader) + end + WG['underconstructiongfx'] = nil +end + + +function widget:UnitCreated(unitID, unitDefID, unitTeam) + unitList[unitID] = unitTeam + unitListCount = unitListCount + 1 +end + +function widget:UnitDestroyed(unitID, unitDefID, unitTeam) + if unitList[unitID] then + unitList[unitID] = nil + unitListCount = unitListCount - 1 + end +end + +function widget:UnitTaken(unitID, unitDefID, unitTeam, newTeam) + if unitList[unitID] then + unitList[unitID] = unitTeam + end +end + +function widget:UnitFinished(unitID, unitDefID, unitTeam) + if unitList[unitID] then + unitList[unitID] = nil + unitListCount = unitListCount - 1 + end +end + + +-------------------------------------------------------------------------------- + +function widget:DrawWorld() + --if Spring.IsGUIHidden() then return end + + if Spring.GetMyAllyTeamID() ~= prevMyAllyTeamID or select(2,Spring.GetSpectatingState()) ~= prevMyFullView then + prevMyAllyTeamID = Spring.GetMyAllyTeamID() + ResetUnderConstructionUnits() + end + + gl.DepthTest(true) + gl.PolygonOffset(-1, -1) + --gl.Blending(GL.SRC_ALPHA, GL.ONE) + + if useHighlightShader and shader and unitListCount < maxShaderUnits then + gl.UseShader(shader) + end + local teamID, prevTeamID, r,g,b + for unitID,teamID in pairs(unitList) do + if not spIsUnitIcon(unitID) and spIsUnitInView(unitID) then + local health,maxHealth,paralyzeDamage,captureProgress,buildProgress=Spring.GetUnitHealth(unitID) + if maxHealth ~= nil then + if teamID ~= prevTeamID then + r,g,b = spGetTeamColor(teamID) + end + prevTeamID = teamID + gl.Color(r*0.8,g*0.8,b*0.8,highlightAlpha - (highlightAlpha*buildProgress)) + gl.Unit(unitID, true) + end + end + end + + if useHighlightShader and shader and unitListCount < maxShaderUnits then + gl.UseShader(0) + end + + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.PolygonOffset(false) + gl.DepthTest(false) +end + + +widget.DrawWorldReflection = widget.DrawWorld + +widget.DrawWorldRefraction = widget.DrawWorld + + + +function widget:GetConfigData() + return {highlightAlpha=highlightAlpha, useHighlightShader=useHighlightShader} +end + +function widget:SetConfigData(data) + if data.useHighlightShader ~= nil then highlightAlpha = data.highlightAlpha end + if data.useHighlightShader ~= nil then useHighlightShader = data.useHighlightShader end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gfx_weather.lua b/LuaUI/Widgets_Evo/gfx_weather.lua index 122f7c250..729ec4b62 100644 --- a/LuaUI/Widgets_Evo/gfx_weather.lua +++ b/LuaUI/Widgets_Evo/gfx_weather.lua @@ -16,6 +16,8 @@ if timeCyclesWeatherEffects ~= 1 then return false end +lightningcolor = 0 + function widget:Initialize() spx,spy,spz = gl.GetSun() r = 1 @@ -85,9 +87,9 @@ end function widget:UnitDestroyed(unitID) explosion = UnitDefs[Spring.GetUnitDefID(unitID)].deathExplosion - maxlightningcolor = 0--(WeaponDefs[WeaponDefNames[explosion].id].damages[1]^0.001 * WeaponDefs[WeaponDefNames[explosion].id].damageAreaOfEffect)/160 - -- Spring.Echo(maxlightningcolor) - lightning = true + maxlightningcolor = (WeaponDefs[WeaponDefNames[explosion].id].damages[1]^0.001 * WeaponDefs[WeaponDefNames[explosion].id].damageAreaOfEffect)/160 + --Spring.Echo(maxlightningcolor) + lightning = false end function GameStart() diff --git a/LuaUI/Widgets_Evo/grabinput_local.lua b/LuaUI/Widgets_Evo/grabinput_local.lua index 70f93f47a..ac7c09251 100644 --- a/LuaUI/Widgets_Evo/grabinput_local.lua +++ b/LuaUI/Widgets_Evo/grabinput_local.lua @@ -6,7 +6,7 @@ function widget:GetInfo() date = "2012-08-11", license = "GPL v2 or later", layer = 5, - enabled = false + enabled = true } end diff --git a/LuaUI/Widgets_Evo/gui_FactoryExitIndicator.lua b/LuaUI/Widgets_Evo/gui_FactoryExitIndicator.lua index d39f61f24..b93b93b1d 100644 --- a/LuaUI/Widgets_Evo/gui_FactoryExitIndicator.lua +++ b/LuaUI/Widgets_Evo/gui_FactoryExitIndicator.lua @@ -91,7 +91,14 @@ function widget:Update() end end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() + if chobbyInterface then return end drawOrientation() ResetGl() diff --git a/LuaUI/Widgets_Evo/gui_advplayerslist.lua b/LuaUI/Widgets_Evo/gui_advplayerslist.lua index 4967c3e17..03eb8426d 100644 --- a/LuaUI/Widgets_Evo/gui_advplayerslist.lua +++ b/LuaUI/Widgets_Evo/gui_advplayerslist.lua @@ -15,7 +15,7 @@ function widget:GetInfo() desc = "Playerlist. Use tweakmode (ctrl+F11) to customize.", author = "Marmoth. (spiced up by Floris)", date = "25 april 2015", - version = "19.0", + version = "22.0", license = "GNU GPL, v2 or later", layer = -4, enabled = true, -- loaded by default? @@ -40,22 +40,41 @@ end -- v17 (Floris): Added alliances display and button and /cputext option -- v18 (Floris): Player system shown on tooltip + added FPS counter + replaced allycursor data with activity gadget data (all these features need gadgets too) -- v19 (Floris): added player resource bars +-- v20 (Floris): added /alwayshidespecs + fixed drawing when playerlist is at the leftside of the screen +-- v21 (Floris): toggles LoS and /specfullview when camera tracking a player +-- v22 (Floris): added auto collapse function -------------------------------------------------------------------------------- --- Widget Scale +-- Config -------------------------------------------------------------------------------- -local customScale = 1 +local customScale = 1.05 local customScaleStep = 0.025 local pointDuration = 40 local cpuText = false local drawAlliesLabel = false +local alwaysHideSpecs = false +local lockcameraHideEnemies = true -- specfullview +local lockcameraLos = true -- togglelos +local collapsable = false + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.35 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local fontfileScale2 = fontfileScale * 1.25 +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) + -------------------------------------------------------------------------------- -- SPEED UPS -------------------------------------------------------------------------------- local Spring_GetGameSeconds = Spring.GetGameSeconds -local Spring_GetGameFrame = Spring.GetGameFrame +local Spring_GetGameFrame = Spring.GetGameFrame local Spring_GetAllyTeamList = Spring.GetAllyTeamList local Spring_GetTeamInfo = Spring.GetTeamInfo local Spring_GetTeamList = Spring.GetTeamList @@ -76,7 +95,6 @@ local Spring_GetAIInfo = Spring.GetAIInfo local Spring_GetTeamRulesParam = Spring.GetTeamRulesParam local Spring_IsGUIHidden = Spring.IsGUIHidden local Spring_GetDrawFrame = Spring.GetDrawFrame -local Spring_GetTeamColor = Spring.GetTeamColor local Spring_GetMyTeamID = Spring.GetMyTeamID local Spring_AreTeamsAllied = Spring.AreTeamsAllied @@ -84,27 +102,25 @@ local GetCameraState = Spring.GetCameraState local SetCameraState = Spring.SetCameraState local GetCameraNames = Spring.GetCameraNames -local gl_Texture = gl.Texture -local gl_Rect = gl.Rect -local gl_TexRect = gl.TexRect -local gl_Color = gl.Color -local gl_CreateList = gl.CreateList -local gl_BeginEnd = gl.BeginEnd -local gl_DeleteList = gl.DeleteList -local gl_CallList = gl.CallList -local gl_Text = gl.Text -local gl_GetTextWidth = gl.GetTextWidth -local gl_GetTextHeight = gl.GetTextHeight +local gl_Texture = gl.Texture +local gl_Rect = gl.Rect +local gl_TexRect = gl.TexRect +local gl_Color = gl.Color +local gl_CreateList = gl.CreateList +local gl_BeginEnd = gl.BeginEnd +local gl_DeleteList = gl.DeleteList +local gl_CallList = gl.CallList +local gl_Text = gl.Text -------------------------------------------------------------------------------- -- IMAGES -------------------------------------------------------------------------------- -local imageDirectory = ":n:LuaUI/Images/advplayerslist/" +local imageDirectory = ":n:"..LUAUI_DIRNAME.."Images/advplayerslist/" local flagsDirectory = imageDirectory.."flags/" -local bgcorner = "LuaUI/Images/bgcorner.png" +local bgcorner = LUAUI_DIRNAME.."Images/bgcorner.png" local pics = { chipPic = imageDirectory.."chip.dds", @@ -137,8 +153,8 @@ local pics = { resourcesPic = imageDirectory.."res.png", resbarPic = imageDirectory.."resbar.png", resbarBgPic = imageDirectory.."resbarBg.png", - barGlowCenterPic= imageDirectory.."barglow-center.dds", - barGlowEdgePic = imageDirectory.."barglow-edge.dds", + barGlowCenterPic= imageDirectory.."barglow-center.png", + barGlowEdgePic = imageDirectory.."barglow-edge.png", cpuPingPic = imageDirectory.."cpuping.dds", specPic = imageDirectory.."spec.png", @@ -166,6 +182,8 @@ local sidePics = {} -- loaded in SetSidePics function local sidePicsWO = {} -- loaded in SetSidePics function local originalColourNames = {} -- loaded in SetOriginalColourNames, format is originalColourNames['name'] = colourString +local apiAbsPosition = {0,0,0,0,1,1,false} + -------------------------------------------------------------------------------- -- Colors -------------------------------------------------------------------------------- @@ -187,12 +205,15 @@ local lastTime = 0 local blinkTime = 0 local now = 0 +local lastRequestTime = -1 +local interRequestTime = 1 -- seconds + -------------------------------------------------------------------------------- -- LockCamera variables -------------------------------------------------------------------------------- -local transitionTime = 2 --how long it takes the camera to move -local listTime = 15 --how long back to look for recent broadcasters +local transitionTime = 0.6 --how long it takes the camera to move when trackign a player +local listTime = 14 --how long back to look for recent broadcasters local myPlayerID = Spring.GetMyPlayerID() local lockPlayerID @@ -211,14 +232,15 @@ local myLastCameraState -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- - +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) local playSounds = true -local buttonclick = 'LuaUI/Sounds/buildbar_waypoint.wav' -local sliderdrag = 'LuaUI/Sounds/buildbar_rem.wav' +local buttonclick = LUAUI_DIRNAME..'Sounds/buildbar_waypoint.wav' +local sliderdrag = LUAUI_DIRNAME..'Sounds/buildbar_rem.wav' local lastActivity = {} local lastFpsData = {} local lastSystemData = {} +local lastGpuMemData = {} -------------------------------------------------------------------------------- -- Tooltip @@ -233,7 +255,7 @@ local tipText -- local player info local myAllyTeamID local myTeamID -local mySpecStatus,_,_ = Spring.GetSpectatingState() +local mySpecStatus,fullView,_ = Spring.GetSpectatingState() --General players/spectator count and tables local player = {} @@ -273,20 +295,19 @@ local dblclickPeriod = 0.4 local backgroundMargin = 7 local widgetRelRight = 0 +local desiredLosmodeChanged = 0 + -------------------------------------------------------------------------------- -- GEOMETRY VARIABLES -------------------------------------------------------------------------------- -local vsx,vsy = gl.GetViewSizes() - -local openClose = 0 local widgetTop = 0 local widgetRight = 1 local widgetHeight = 0 local widgetWidth = 0 local widgetPosX = vsx-200 local widgetPosY = 0 -local widgetScale = 1 +local widgetScale = 0 local expandDown = false local expandLeft = true @@ -302,6 +323,9 @@ local teamN local prevClickTime = os.clock() local specListShow = true +local collapsed = false +local collapsedHeight = 42 + -------------------------------------------------- -- Modules -------------------------------------------------- @@ -549,10 +573,10 @@ m_seespec = { } - local specsLabelOffset = 0 local teamsizeVersusText = "" + --------------------------------------------------------------------------------------------------- -- Geometry --------------------------------------------------------------------------------------------------- @@ -599,19 +623,33 @@ end function SetMaxPlayerNameWidth() -- determines the maximal player name width (in order to set the width of the widget) local t = Spring_GetPlayerList() - local maxWidth = 14*gl_GetTextWidth(absentName) + 8 -- 8 is minimal width - local name = "" + local maxWidth = 14*font2:GetTextWidth(absentName) + 8 -- 8 is minimal width + local name = '' + local spec = false + local version = '' + local teamID = 0 local nextWidth = 0 for _,wplayer in ipairs(t) do - name,_,spec = Spring_GetPlayerInfo(wplayer) + name,_,spec,teamID = Spring_GetPlayerInfo(wplayer) + if select(4,Spring_GetTeamInfo(teamID,false)) then -- is AI? + _,_,_,_,name, version = Spring_GetAIInfo(teamID) + if type(version) == "string" then + name = "AI:" .. name .. "-" .. version + else + name = "AI:" .. name + end + if Spring.GetGameRulesParam(teamID, 'ainame') then + name = Spring.GetGameRulesParam(teamID, 'ainame') .. ' (AI)' + end + end local charSize if spec then charSize = 11 else charSize = 14 end - nextWidth = charSize*gl_GetTextWidth(name)+8 + nextWidth = charSize*font2:GetTextWidth(name)+8 if nextWidth > maxWidth then maxWidth = nextWidth end end - return maxWidth + return maxWidth end function GetNumberOfSpecs() @@ -648,7 +686,7 @@ local function UpdateAlliances() local alliances = {} for _,player2ID in pairs (playerList) do if not player[playerID].spec and not player[player2ID].spec and playerID ~= player2ID and player[playerID].team ~= nil and player[player2ID].team ~= nil and player[playerID].allyteam ~= player[player2ID].allyteam and Spring_AreTeamsAllied(player[player2ID].team, player[playerID].team) then - table.insert(alliances, player2ID) + alliances[#alliances+1] = player2ID end end player[playerID].alliances = alliances @@ -656,11 +694,187 @@ local function UpdateAlliances() end end +function toPixels(str) + local chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !@#$%^&*()_+-=[]{};:,./<>?~|`'\"\\" + local pixels = {} + for i=1, string.len(str) do + if i%3 == 1 then + pixels[#pixels+1] = {} + end + local char = string.sub(str,i,i) + for ci=1, string.len(chars) do + if char == string.sub(chars,ci,ci) then + pixels[#pixels][#pixels[#pixels]+1] = (ci-1)/string.len(chars) + break + end + end + end + return pixels +end + +-- only being called for devs registered in gadget +function PlayerDataBroadcast(playerName, msg) + local data = '' + local count = 0 + local startPos = 0 + for i=1, string.len(msg) do + if string.sub(msg, i, i) == ';' then + count = count + 1 + if count == 1 then + startPos = i+1 + playerName = string.sub(msg,1,i-1) + elseif count == 2 then + msgType = string.sub(msg,startPos,i-1) + data = string.sub(msg, i+1) + break + end + end + end + if data then + if msgType == 'screenshot' then + data = VFS.ZlibDecompress(data) + count = 0 + for i=1, string.len(data) do + if string.sub(data, i, i) == ';' then + count = count + 1 + if count == 1 then + local finished = string.sub(data,1,i-1) + if finished == '1' then + screenshotFinished = true + else + screenshotFinished = false + end + startPos = i+1 + elseif count == 2 then + screenshotWidth = string.sub(data,startPos,i-1) + startPos = i+1 + elseif count == 3 then + screenshotHeight = string.sub(data,startPos,i-1) + startPos = i+1 + elseif count == 4 then + screenshotGameframe = tonumber(string.sub(data,startPos,i-1)) + if not screenshotData then + screenshotData = string.sub(data, i+1) + else + screenshotData = screenshotData .. string.sub(data, i+1) + end + break + end + end + end + data = nil + screenshotDataLast = totalTime + + if screenshotFinished or totalTime-4000 > screenshotDataLast then + screenshotFinished = true + local map = Game.mapName + local datetable = os.date('*t') + local frame = Spring.GetGameFrame() + local minutes = math.floor((screenshotGameframe / 30 / 60)) + local seconds = math.floor((screenshotGameframe - ((minutes*60)*30)) / 30) + if seconds == 0 then + seconds = '00' + elseif seconds < 10 then + seconds = '0'..seconds + end + local time = minutes..':'..seconds + local yyyy = datetable.year + local m = datetable.month + local d = datetable.day + local h = datetable.hour + local min = datetable.min + local s = datetable.sec + local yyyy = tostring(yyyy) + local mm = ((m > 9 and tostring(m)) or (m <10 and ("0"..tostring(m)))) + local dd = ((d > 9 and tostring(d)) or (d <10 and ("0"..tostring(d)))) + local hh = ((h > 9 and tostring(h)) or (h <10 and ("0"..tostring(h)))) + local minmin = ((min > 9 and tostring(min)) or (min <10 and ("0"..tostring(min)))) + local ss = ((s > 9 and tostring(s)) or (s <10 and ("0"..tostring(s)))) + local engine = Engine.versionFull + + screenshotPixels = toPixels(screenshotData) + screenshotPlayer = playerName + screenshotFilename = yyyy..mm..dd.."_"..hh..minmin..ss.."_" ..minutes..'.'..seconds.."_"..playerName + screenshotSaved = nil + screenshotSaveQueued = true + screenshotPosX = widgetPosX-(backgroundMargin+30+screenshotWidth*widgetScale) + screenshotPosY = widgetPosY + screenshotDlist = gl_CreateList(function() + gl.PushMatrix() + gl.Translate(screenshotPosX, screenshotPosY,0) + gl.Scale(widgetScale,widgetScale,0) + + gl_Color(0,0,0,0.66) + local margin = 2 + RectRound(-margin,-margin,screenshotWidth+margin+margin,screenshotHeight+15+margin+margin, 6, true) + gl_Color(1,1,1,0.025) + RectRound(0,0,screenshotWidth,screenshotHeight+12+margin+margin, 4.5, true) + + font:Begin() + font:Print(screenshotPlayer, 4, screenshotHeight+6.5, 11, "on") + font:End() + + local row = 0 + local col = 0 + for p=1, #screenshotPixels do + col = col + 1 + if p%screenshotWidth == 1 then + row = row + 1 + col = 1 + end + gl.Color(screenshotPixels[p][1], screenshotPixels[p][2], screenshotPixels[p][3], 1) + gl.Rect(col, row, col+1, row+1) + end + gl.PopMatrix() + + end) + screenshotPixels = nil + screenshotData = nil + screenshotFinished = nil + end + elseif msgType == 'infolog' or msgType == 'config' then + local playerID + for i=1, string.len(data) do + if string.sub(data, i, i) == ';' then + playerID = tonumber(string.sub(data,1,i-1)) + startPos = i+1 + data = string.sub(data, i+1) + break + end + end + if playerID == myPlayerID then + local datetable = os.date('*t') + local yyyy = datetable.year + local m = datetable.month + local d = datetable.day + local h = datetable.hour + local min = datetable.min + local yyyy = tostring(yyyy) + local mm = ((m > 9 and tostring(m)) or (m <10 and ("0"..tostring(m)))) + local dd = ((d > 9 and tostring(d)) or (d <10 and ("0"..tostring(d)))) + local hh = ((h > 9 and tostring(h)) or (h <10 and ("0"..tostring(h)))) + local minmin = ((min > 9 and tostring(min)) or (min <10 and ("0"..tostring(min)))) + + local filename = 'playerdata_'..msgType..'s.txt' + local filedata = '' + if VFS.FileExists(filename) then + filedata = tostring(VFS.LoadFile(filename)) + end + local file = assert(io.open(filename, 'w'), 'Unable to save '..filename) + file:write(filedata .. '-----------------------------------------------------\n---- '.. yyyy..'-'..mm..'-'..dd.." "..hh..'.'..minmin .. ' ' .. playerName .. '\n-----------------------------------------------------\n' .. VFS.ZlibDecompress(data) .. "\n\n\n\n\n\n") + file:close() + Spring.Echo('Added '..msgType..' to '..filename) + end + end + end +end --------------------------------------------------------------------------------------------------- -- LockCamera stuff --------------------------------------------------------------------------------------------------- + + local function UpdateRecentBroadcasters() recentBroadcasters = {} local i = 1 @@ -676,7 +890,28 @@ local function UpdateRecentBroadcasters() end local function LockCamera(playerID) + if playerID and playerID ~= myPlayerID and playerID ~= lockPlayerID then + if lockcameraHideEnemies and not select(3,Spring_GetPlayerInfo(playerID)) then + Spring.SendCommands("specteam "..select(4,Spring_GetPlayerInfo(playerID))) + if not fullView then + sceduledSpecFullView = 1 -- this is needed else the minimap/world doesnt update properly + Spring.SendCommands("specfullview") + else + sceduledSpecFullView = 2 -- this is needed else the minimap/world doesnt update properly + Spring.SendCommands("specfullview") + end + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()~="los" then + desiredLosmode = 'los' + desiredLosmodeChanged = os.clock() + end + elseif lockcameraHideEnemies and select(3,Spring_GetPlayerInfo(playerID)) then + if not fullView then + Spring.SendCommands("specfullview") + end + desiredLosmode = 'normal' + desiredLosmodeChanged = os.clock() + end lockPlayerID = playerID myLastCameraState = myLastCameraState or GetCameraState() local info = lastBroadcasts[lockPlayerID] @@ -688,24 +923,39 @@ local function LockCamera(playerID) SetCameraState(myLastCameraState, transitionTime) myLastCameraState = nil end + if lockcameraHideEnemies and lockPlayerID and not select(3,Spring_GetPlayerInfo(lockPlayerID)) then + if not fullView then + Spring.SendCommands("specfullview") + end + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()=="los" then + desiredLosmode = 'normal' + desiredLosmodeChanged = os.clock() + end + end lockPlayerID = nil end UpdateRecentBroadcasters() end +function GpuMemEvent(playerID, percentage) + lastGpuMemData[playerID] = percentage +end function FpsEvent(playerID, fps) - lastFpsData[playerID] = fps + lastFpsData[playerID] = fps + + WG.playerFPS = WG.playerFPS or {} + WG.playerFPS[playerID] = fps end function SystemEvent(playerID, system) - -- dont trust the recieved data, limiting abuse local lines, length = 0, 0 local function helper(line) lines=lines+1; if string.len(line) then length = string.len(line) end return "" end - helper((system:gsub("(.-)\r?\n", helper))) - if lines <= 9 and length <= 64 then - lastSystemData[playerID] = system - end + helper((system:gsub("(.-)\r?\n", helper))) + lastSystemData[playerID] = system + + WG.playerSystemData = WG.playerSystemData or {} + WG.playerSystemData[playerID] = system end function ActivityEvent(playerID) @@ -746,16 +996,20 @@ end end]]-- function widget:Initialize() - --widgetHandler:RegisterGlobal('getPlayerScores', RecvPlayerScores) - widgetHandler:RegisterGlobal('CameraBroadcastEvent', CameraBroadcastEvent) - widgetHandler:RegisterGlobal('ActivityEvent', ActivityEvent) - widgetHandler:RegisterGlobal('FpsEvent', FpsEvent) - widgetHandler:RegisterGlobal('SystemEvent', SystemEvent) + widget:ViewResize(gl.GetViewSizes()) + + --widgetHandler:RegisterGlobal('getPlayerScoresAdvplayerslist', RecvPlayerScores) + widgetHandler:RegisterGlobal('CameraBroadcastEvent', CameraBroadcastEvent) + widgetHandler:RegisterGlobal('ActivityEvent', ActivityEvent) + widgetHandler:RegisterGlobal('FpsEvent', FpsEvent) + widgetHandler:RegisterGlobal('GpuMemEvent', GpuMemEvent) + widgetHandler:RegisterGlobal('SystemEvent', SystemEvent) + widgetHandler:RegisterGlobal('PlayerDataBroadcast', PlayerDataBroadcast) UpdateRecentBroadcasters() - mySpecStatus,_,_ = Spring.GetSpectatingState() + mySpecStatus,fullView,_ = Spring.GetSpectatingState() if Spring.GetGameFrame() <= 0 then - if mySpecStatus then + if mySpecStatus and not alwaysHideSpecs then specListShow = true else specListShow = false @@ -777,40 +1031,80 @@ function widget:Initialize() WG['advplayerlist_api'] = {} WG['advplayerlist_api'].GetPosition = function() - - local margin = backgroundMargin - - local BLcornerX = widgetPosX - margin - local BLcornerY = widgetPosY - margin - local TRcornerX = widgetPosX + widgetWidth + margin - local TRcornerY = widgetPosY + widgetHeight - 1 + margin - - local left = BLcornerX - ((widgetPosX - BLcornerX) * (widgetScale-1)) - local bottom = BLcornerY - ((widgetPosY - BLcornerY) * (widgetScale-1)) - local right = TRcornerX - ((widgetPosX - TRcornerX) * (widgetScale-1)) - local top = TRcornerY - ((widgetPosY - TRcornerY) * (widgetScale-1)) - - return {top,left,bottom,right,widgetScale} + return apiAbsPosition end - WG['advplayerlist_api'].GetLockPlayerID = function() - return lockPlayerID + WG['advplayerlist_api'].GetCollapsable = function() + return collapsable end - WG['advplayerlist_api'].SetLockPlayerID = function(playerID) - if playerID ~= nil then - lockPlayerID = playerID - else - lockPlayerID = nil - if myLastCameraState ~= nil then - SetCameraState(myLastCameraState, transitionTime) - end - end + WG['advplayerlist_api'].SetCollapsable = function(value) + collapsable = value + if not collapsable and collapsed then + collapsed = false + CreateBackground() + end + end + + WG['advplayerlist_api'].GetLockPlayerID = function() + return lockPlayerID end + WG['advplayerlist_api'].SetLockPlayerID = function(playerID) + LockCamera(playerID) + end + WG['advplayerlist_api'].GetLockHideEnemies = function() + return lockcameraHideEnemies + end + WG['advplayerlist_api'].SetLockHideEnemies = function(value) + lockcameraHideEnemies = value + if lockPlayerID and not select(3,Spring_GetPlayerInfo(lockPlayerID)) then + if not lockcameraHideEnemies then + if not fullView then + Spring.SendCommands("specfullview") + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()=="los" then + desiredLosmode = 'normal' + desiredLosmodeChanged = os.clock() + Spring.SendCommands("togglelos") + end + end + else + if fullView then + Spring.SendCommands("specfullview") + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()~="los" then + desiredLosmode = 'los' + desiredLosmodeChanged = os.clock() + Spring.SendCommands("togglelos") + end + end + end + end + end + WG['advplayerlist_api'].GetLockTransitionTime = function() + return transitionTime + end + WG['advplayerlist_api'].SetLockTransitionTime = function(value) + transitionTime = value + end + WG['advplayerlist_api'].GetLockLos = function() + return lockcameraLos + end + WG['advplayerlist_api'].SetLockLos = function(value) + lockcameraLos = value + if lockcameraHideEnemies and mySpecStatus and lockPlayerID and not select(3,Spring_GetPlayerInfo(lockPlayerID)) then + if lockcameraLos and Spring.GetMapDrawMode()~="los" then + desiredLosmode = 'los' + desiredLosmodeChanged = os.clock() + Spring.SendCommands("togglelos") + elseif not lockcameraLos and Spring.GetMapDrawMode()=="los" then + desiredLosmode = 'normal' + desiredLosmodeChanged = os.clock() + Spring.SendCommands("togglelos") + end + end + end end function widget:GameFrame(n) - if n > 0 and not gameStarted then - mySpecStatus,_,_ = Spring.GetSpectatingState() - if mySpecStatus then + if n > 0 and not gameStarted and not collapsed then + if mySpecStatus and not alwaysHideSpecs then specListShow = true else specListShow = false @@ -826,14 +1120,39 @@ end function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('advplayerlist') + if WG['guishader'] then + WG['guishader'].RemoveDlist('advplayerlist') + --WG['guishader'].RemoveRect('advplayerlist') + WG['guishader'].RemoveRect('advplayerlist_screenshot') end WG['advplayerlist_api'] = nil widgetHandler:DeregisterGlobal('CameraBroadcastEvent') widgetHandler:DeregisterGlobal('ActivityEvent') - widgetHandler:DeregisterGlobal('FpsEvent') - widgetHandler:DeregisterGlobal('SystemEvent') + widgetHandler:DeregisterGlobal('FpsEvent') + widgetHandler:DeregisterGlobal('GpuMemEvent') + widgetHandler:DeregisterGlobal('SystemEvent') + if ShareSlider then + gl_DeleteList(ShareSlider) + end + if MainList then + gl_DeleteList(MainList) + end + if Background then + gl_DeleteList(Background) + end + if screenshotDlist then + gl_DeleteList(screenshotDlist) + end + gl.DeleteFont(font) + if lockPlayerID then + LockCamera() + end +end + +function widget:GameOver() + if lockPlayerID then + LockCamera() + end end @@ -853,11 +1172,11 @@ function SetSidePics() if startunit == sideOneDefID then teamSide = teamSideOne end - if startunit == sideOneDefID then + if startunit == sideOneDefID then teamSide = teamSideTwo end else - _,_,_,_,teamSide = Spring_GetTeamInfo(team) + _,_,_,_,teamSide = Spring_GetTeamInfo(team,false) end if teamSide then @@ -883,6 +1202,7 @@ end function GetAllPlayers() local noplayer + local tplayerCount = 0 local allteams = Spring_GetTeamList() teamN = table.maxn(allteams) - 1 --remove gaia for i = 0,teamN-1 do @@ -890,12 +1210,21 @@ function GetAllPlayers() player[i + 64] = CreatePlayerFromTeam(i) for _,playerID in ipairs(teamPlayers) do player[playerID] = CreatePlayer(playerID) + tplayerCount = tplayerCount + 1 + end + + local _,_,_,isAiTeam = Spring.GetTeamInfo(teamN,false) + local isLuaAI = (Spring.GetTeamLuaAI(teamN) ~= "") + if not (isAiTeam or isLuaAI) then + if tplayerCount > 0 then + playerSpecs[i] = true -- (this isnt correct when team consists of only AI) + end + tplayerCount = 0 end - playerSpecs[i] = true -- (this isnt correct when team consists of only AI) end specPlayers = Spring_GetTeamList() for _,playerID in ipairs(specPlayers) do - local active,_,spec = Spring_GetPlayerInfo(playerID) + local active,_,spec = Spring_GetPlayerInfo(playerID,false) if spec == true then if active == true then player[playerID] = CreatePlayer(playerID) @@ -910,7 +1239,7 @@ function GetAliveAllyTeams() local allteams = Spring_GetTeamList() teamN = table.maxn(allteams) - 1 --remove gaia for i = 0,teamN-1 do - local _,_, isDead, _, _, tallyteam = Spring_GetTeamInfo(i) + local _,_, isDead, _, _, tallyteam = Spring_GetTeamInfo(i,false) if not isDead then aliveAllyTeams[tallyteam] = true end @@ -924,7 +1253,8 @@ function round(num, idp) end function GetSkill(playerID) - local customtable = select(10,Spring_GetPlayerInfo(playerID)) -- player custom table + + local customtable = select(11,Spring.GetPlayerInfo(playerID)) local tsMu = customtable.skill local tsSigma = customtable.skilluncertainty local tskill = "" @@ -969,8 +1299,8 @@ end function CreatePlayer(playerID) --generic player data - local tname,_, tspec, tteam, tallyteam, tping, tcpu, tcountry, trank = Spring_GetPlayerInfo(playerID) - local _,_,_,_, tside, tallyteam = Spring_GetTeamInfo(tteam) + local tname,_, tspec, tteam, tallyteam, tping, tcpu, tcountry, trank = Spring_GetPlayerInfo(playerID,false) + local _,_,_,_, tside, tallyteam = Spring_GetTeamInfo(tteam,false) local tred, tgreen, tblue = Spring_GetTeamColor(tteam) --skill @@ -988,10 +1318,15 @@ function CreatePlayer(playerID) if aliveAllyTeams[tallyteam] ~= nil and (mySpecStatus or myAllyTeamID == tallyteam) then energy, energyStorage,_, energyIncome = Spring_GetTeamResources(tteam, "energy") metal, metalStorage,_, metalIncome = Spring_GetTeamResources(tteam, "metal") - energy = math.floor(energy) - metal = math.floor(metal) - if energy < 0 then energy = 0 end - if metal < 0 then metal = 0 end + if energy then + energy = math.floor(energy) + metal = math.floor(metal) + if energy < 0 then energy = 0 end + if metal < 0 then metal = 0 end + else + energy = 0 + metal = 0 + end end return { @@ -1025,7 +1360,7 @@ end function CreatePlayerFromTeam(teamID) -- for when we don't have a human player occupying the slot, also when a player changes team (dies) - local _,_, isDead, isAI, tside, tallyteam = Spring_GetTeamInfo(teamID) + local _,_, isDead, isAI, tside, tallyteam = Spring_GetTeamInfo(teamID,false) local tred, tgreen, tblue = Spring_GetTeamColor(teamID) local tname, ttotake, tskill local tdead = true @@ -1041,6 +1376,9 @@ function CreatePlayerFromTeam(teamID) -- for when we don't have a human player o else tname = "AI:" .. tname end + if Spring.GetGameRulesParam('ainame_'..teamID) then + tname = Spring.GetGameRulesParam('ainame_'..teamID)..' (AI)' + end ttotake = false tdead = false @@ -1070,8 +1408,8 @@ function CreatePlayerFromTeam(teamID) -- for when we don't have a human player o if aliveAllyTeams[tallyteam] ~= nil and (mySpecStatus or myAllyTeamID == tallyteam) then energy, energyStorage,_, energyIncome = Spring_GetTeamResources(teamID, "energy") or 0 metal, metalStorage,_, metalIncome = Spring_GetTeamResources(teamID, "metal") or 0 - energy = math.floor(energy) - metal = math.floor(metal) + energy = math.floor(energy or 0) + metal = math.floor(metal or 0) if energy < 0 then energy = 0 end if metal < 0 then metal = 0 end end @@ -1158,15 +1496,14 @@ function SortList() local teamList local myOldSpecStatus = mySpecStatus - _,_, mySpecStatus,_,_,_,_,_,_ = Spring_GetPlayerInfo(myPlayerID) + mySpecStatus = select(3,Spring_GetPlayerInfo(myPlayerID,false)) -- checks if a team has died if mySpecStatus ~= myOldSpecStatus then - if mySpecStatus == true then + if mySpecStatus then teamList = Spring_GetTeamList() - for _, team in ipairs(teamList) do -- - _,_, isDead = Spring_GetTeamInfo(team) - if isDead == false then + for _, team in ipairs(teamList) do + if not select(3,Spring_GetTeamInfo(team,false)) then -- not dead Spec(team) break end @@ -1227,8 +1564,8 @@ function SortAllyTeams(vOffset) if allyTeamID == myAllyTeamID then vOffset = vOffset + labelOffset - 3 if drawAlliesLabel then - table.insert(drawListOffset, vOffset) - table.insert(drawList, -2) -- "Allies" label + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -2 -- "Allies" label vOffset = SortTeams(allyTeamID, vOffset)+2 -- Add the teams from the allyTeam else vOffset = SortTeams(allyTeamID, vOffset-labelOffset) @@ -1245,13 +1582,13 @@ function SortAllyTeams(vOffset) vOffset = vOffset + 13 vOffset = vOffset + labelOffset - 3 - table.insert(drawListOffset, vOffset) - table.insert(drawList, -3) -- "Enemies" label + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -3 -- "Enemies" label firstenemy = false else vOffset = vOffset + separatorOffset - table.insert(drawListOffset, vOffset) - table.insert(drawList, -4) -- Enemy teams separator + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -4 -- Enemy teams separator end vOffset = SortTeams(allyTeamID, vOffset)+2 -- Add the teams from the allyTeam end @@ -1270,13 +1607,12 @@ function SortTeams(allyTeamID, vOffset) --add teams for _,teamID in ipairs(teamsList) do - table.insert(drawListOffset, vOffset) - table.insert(drawList, -1) - vOffset = SortPlayers(teamID,allyTeamID,vOffset) -- adds players form the team - local _,_, isDead, _, _, _ = Spring_GetTeamInfo(teamID) - if isDead then - vOffset = vOffset - (deadPlayerHeightReduction/2) - end + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -1 + vOffset = SortPlayers(teamID,allyTeamID,vOffset) -- adds players form the team + if select(3,Spring_GetTeamInfo(teamID,false)) then + vOffset = vOffset - (deadPlayerHeightReduction/2) + end end return vOffset @@ -1287,15 +1623,14 @@ function SortPlayers(teamID,allyTeamID,vOffset) local playersList = Spring_GetPlayerList(teamID,true) local noPlayer = true - local _,_,_, isAi = Spring_GetTeamInfo(teamID) -- add own player (if not spec) if myTeamID == teamID then if player[myPlayerID].name ~= nil then if mySpecStatus == false then vOffset = vOffset + playerOffset - table.insert(drawListOffset, vOffset) - table.insert(drawList, myPlayerID) -- new player (with ID) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = myPlayerID -- new player (with ID) player[myPlayerID].posY = vOffset noPlayer = false end @@ -1308,8 +1643,8 @@ function SortPlayers(teamID,allyTeamID,vOffset) if player[playerID].name ~= nil then if player[playerID].spec ~= true then vOffset = vOffset + playerOffset - table.insert(drawListOffset, vOffset) - table.insert(drawList, playerID) -- new player (with ID) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = playerID -- new player (with ID) player[playerID].posY = vOffset noPlayer = false end @@ -1318,10 +1653,10 @@ function SortPlayers(teamID,allyTeamID,vOffset) end -- add AI teams - if isAi == true then + if select(4,Spring_GetTeamInfo(teamID,false)) then -- is AI vOffset = vOffset + playerOffset - table.insert(drawListOffset, vOffset) - table.insert(drawList, 64 + teamID) -- new AI team (instead of players) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = 64 + teamID -- new AI team (instead of players) player[64 + teamID].posY = vOffset noPlayer = false end @@ -1329,8 +1664,8 @@ function SortPlayers(teamID,allyTeamID,vOffset) -- add no player token if no player found in this team at this point if noPlayer == true then vOffset = vOffset + playerOffset - (deadPlayerHeightReduction/2) - table.insert(drawListOffset, vOffset) - table.insert(drawList, 64 + teamID) -- no players team + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = 64 + teamID -- no players team player[64 + teamID].posY = vOffset if Spring_GetGameFrame() > 0 then player[64+teamID].totake = IsTakeable(teamID) @@ -1345,7 +1680,7 @@ function SortSpecs(vOffset) local playersList = Spring_GetPlayerList(-1,true) local noSpec = true for _,playerID in ipairs(playersList) do - _,active,spec = Spring_GetPlayerInfo(playerID) + _,active,spec = Spring_GetPlayerInfo(playerID,false) if spec and active then if player[playerID].name ~= nil then @@ -1353,8 +1688,8 @@ function SortSpecs(vOffset) if noSpec == true then vOffset = vOffset + 13 vOffset = vOffset + labelOffset - 2 - table.insert(drawListOffset, vOffset) - table.insert(drawList, -5) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -5 noSpec = false specJoinedOnce = true vOffset = vOffset + 4 @@ -1363,8 +1698,8 @@ function SortSpecs(vOffset) -- add spectator if specListShow == true then vOffset = vOffset + specOffset - table.insert(drawListOffset, vOffset) - table.insert(drawList, playerID) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = playerID player[playerID].posY = vOffset noPlayer = false end @@ -1376,8 +1711,8 @@ function SortSpecs(vOffset) if specJoinedOnce and noSpec then vOffset = vOffset + 13 vOffset = vOffset + labelOffset - 2 - table.insert(drawListOffset, vOffset) - table.insert(drawList, -5) + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -5 vOffset = vOffset + 4 end @@ -1396,61 +1731,118 @@ local Background local ShareSlider +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() - + if chobbyInterface then return end + if Spring_IsGUIHidden() then return end - - local scaleDiffX = -((widgetPosX*widgetScale)-widgetPosX)/widgetScale - local scaleDiffY = -((widgetPosY*widgetScale)-widgetPosY)/widgetScale - gl.Scale(widgetScale,widgetScale,0) - gl.Translate(scaleDiffX,scaleDiffY,0) - - -- update lists frequently if there is mouse interaction - local NeedUpdate = false - local mouseX,mouseY = Spring_GetMouseState() - if (mouseX > widgetPosX + m_name.posX + m_name.width - 5) and (mouseX < widgetPosX + widgetWidth) and (mouseY > widgetPosY - 16) and (mouseY < widgetPosY + widgetHeight) then - local DrawFrame = Spring_GetDrawFrame() - local CurGameFrame = Spring_GetGameFrame() - if PrevGameFrame == nil then PrevGameFrame = CurGameFrame end - if (DrawFrame%5==0) or (CurGameFrame>PrevGameFrame+1) then - --Echo(DrawFrame) - NeedUpdate = true + local mouseX,mouseY,mouseButtonL = Spring_GetMouseState() + if not collapsed then + -- update lists frequently if there is mouse interaction + local NeedUpdate = false + if (mouseX > widgetPosX + m_name.posX + m_name.width - 5) and (mouseX < widgetPosX + widgetWidth) and (mouseY > widgetPosY - 16) and (mouseY < widgetPosY + widgetHeight) then + local DrawFrame = Spring_GetDrawFrame() + local CurGameFrame = Spring_GetGameFrame() + if PrevGameFrame == nil then PrevGameFrame = CurGameFrame end + if (DrawFrame%5==0) or (CurGameFrame>PrevGameFrame+1) then + --Echo(DrawFrame) + NeedUpdate = true + end + end + + if NeedUpdate then + --Spring.Echo("DS APL update") + CreateLists() + PrevGameFrame = CurGameFrame end end - - if NeedUpdate then - --Spring.Echo("DS APL update") - CreateLists() - PrevGameFrame = CurGameFrame - end - -- draws the background if Background then gl_CallList(Background) else CreateBackground() end - - -- draws the main list - if MainList then - gl_CallList(MainList) - else - CreateMainList() - end - - -- draws share energy/metal sliders - if ShareSlider then - gl_CallList(ShareSlider) - else - CreateShareSlider() + + local scaleDiffX = -((widgetPosX*widgetScale)-widgetPosX)/widgetScale + local scaleDiffY = -((widgetPosY*widgetScale)-widgetPosY)/widgetScale + gl.Scale(widgetScale,widgetScale,0) + gl.Translate(scaleDiffX,scaleDiffY,0) + + if not collapsed then + -- draws the main list + if MainList then + gl_CallList(MainList) + else + CreateMainList() + end + + -- draws share energy/metal sliders + if ShareSlider then + gl_CallList(ShareSlider) + else + CreateShareSlider() + end end - + local scaleReset = widgetScale / widgetScale / widgetScale gl.Translate(-scaleDiffX,-scaleDiffY,0) gl.Scale(scaleReset,scaleReset,0) + + + if screenshotDlist then + gl_CallList(screenshotDlist) + local margin = 1.9*widgetScale + local left = screenshotPosX-margin + local bottom = screenshotPosY-margin + local width = (screenshotWidth*widgetScale)+margin+margin+margin + local height = (screenshotHeight*widgetScale)+margin+margin+margin+(15*widgetScale) + if screenshotSaveQueued then + if WG['guishader'] then + WG['guishader'].InsertRect(left,bottom,left+width,bottom+height,'advplayerlist_screenshot') + screenshotGuishader = true + end + if not screenshotSaved then + screenshotSaved = 'next' + elseif screenshotSaved == 'next' then + screenshotSaved = 'done' + local file = 'screenshots/'..screenshotFilename..'.png' + gl.SaveImage(left,bottom,width,height,file) + Spring.Echo('Screenshot saved to: '..file) + screenshotSaveQueued = nil + end + end + if screenshotWidth and IsOnRectPlain(mouseX,mouseY, screenshotPosX,screenshotPosY,screenshotPosX+(screenshotWidth*widgetScale),screenshotPosY+(screenshotHeight*widgetScale)) then + if mouseButtonL then + gl_DeleteList(screenshotDlist) + if WG['guishader'] then + WG['guishader'].RemoveRect('advplayerlist_screenshot') + end + screenshotDlist = nil + else + gl.Color(0,0,0,0.25) + RectRound(screenshotPosX,screenshotPosY,screenshotPosX+(screenshotWidth*widgetScale),screenshotPosY+(screenshotHeight*widgetScale), 2*widgetScale, true) -- close button + local size = (screenshotHeight*widgetScale)*1.2 + local width = size*0.011 + gl.Color(1,1,1,0.66) + gl.PushMatrix() + gl.Translate(screenshotPosX+((screenshotWidth*widgetScale)/2), screenshotPosY+((screenshotHeight*widgetScale)/2),0) + gl.Rotate(-60,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.Rotate(120,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.PopMatrix() + end + end + end end + function CreateLists() CheckTime() --this also calls CheckPlayers @@ -1474,69 +1866,69 @@ end -- Background gllist --------------------------------------------------------------------------------------------------- -local function DrawRectRound(px,py,sx,sy,cs,ignoreBorder) +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) gl.TexCoord(0.8,0.8) gl.Vertex(px+cs, py, 0) gl.Vertex(sx-cs, py, 0) gl.Vertex(sx-cs, sy, 0) gl.Vertex(px+cs, sy, 0) - + gl.Vertex(px, py+cs, 0) gl.Vertex(px+cs, py+cs, 0) gl.Vertex(px+cs, sy-cs, 0) gl.Vertex(px, sy-cs, 0) - + gl.Vertex(sx, py+cs, 0) gl.Vertex(sx-cs, py+cs, 0) gl.Vertex(sx-cs, sy-cs, 0) gl.Vertex(sx, sy-cs, 0) - - local offset = 0.05 -- texture offset, because else gaps could show - - -- top left - if (py+((sy-py)*widgetScale) >= vsy-backgroundMargin or px <= backgroundMargin) and ignoreBorder == nil then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, sy-cs, 0) - -- top right - if (py+((sy-py)*widgetScale) >= vsy-backgroundMargin or (px+((sx-px)*widgetScale)) >= vsx-backgroundMargin) and ignoreBorder == nil then o = 0.5 else o = offset end + + local offset = 0.07 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) - -- bottom left - if (py <= backgroundMargin or px <= backgroundMargin) and ignoreBorder == nil then o = 0.5 else o = offset end + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) - -- bottom right - if (py <= backgroundMargin or (px+((sx-px)*widgetScale)) >= vsx-backgroundMargin) and ignoreBorder == nil then o = 0.5 else o = offset end + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end -function RectRound(px,py,sx,sy,cs,ignoreBorder) -- (coordinates work differently than the RectRound func in other widgets) +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) gl.Texture(bgcorner) - gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs,ignoreBorder) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) gl.Texture(false) end @@ -1552,31 +1944,56 @@ function CreateBackground() local BLcornerY = widgetPosY - margin local TRcornerX = widgetPosX + widgetWidth + margin local TRcornerY = widgetPosY + widgetHeight - 1 + margin - - if (WG['guishader_api'] ~= nil) then - local left = BLcornerX - ((widgetPosX - BLcornerX) * (widgetScale-1)) - local bottom = BLcornerY - ((widgetPosY - BLcornerY) * (widgetScale-1)) - local right = TRcornerX - ((widgetPosX - TRcornerX) * (widgetScale-1)) - local top = TRcornerY - ((widgetPosY - TRcornerY) * (widgetScale-1)) - WG['guishader_api'].InsertRect(left,bottom,right,top,'advplayerlist') + + if collapsed then + TRcornerY = widgetPosY - margin + collapsedHeight + end + + local absLeft = math.floor(BLcornerX - ((widgetPosX - BLcornerX) * (widgetScale-1))) + local absBottom = math.floor(BLcornerY - ((widgetPosY - BLcornerY) * (widgetScale-1))) + local absRight = math.ceil(TRcornerX - ((widgetPosX - TRcornerX) * (widgetScale-1))) + local absTop = math.ceil(TRcornerY - ((widgetPosY - TRcornerY) * (widgetScale-1))) + apiAbsPosition = {absTop,absLeft,absBottom,absRight,widgetScale,right,collapsed} + + local padding = 3*widgetScale + local paddingBottom = padding + local paddingRight = padding + local paddingTop = padding + local paddingLeft = padding + if absBottom <= 0.2 then paddingBottom = 0 end + if absRight >= vsx-0.2 then paddingRight = 0 end + if absTop <= 0.2 then paddingTop = 0 end + if absLeft <= 0.2 then paddingLeft = 0 end + + if WG['guishader'] then + BackgroundGuishader = gl_CreateList( function() + RectRound(absLeft,absBottom,absRight,absTop,padding*2, math.min(paddingLeft,paddingTop), math.min(paddingTop,paddingRight), math.min(paddingRight,paddingBottom), math.min(paddingBottom,paddingLeft)) + end) + WG['guishader'].InsertDlist(BackgroundGuishader, 'advplayerlist') + --WG['guishader'].InsertRect(absLeft,absBottom,absRight,absTop,'advplayerlist') end - Background = gl_CreateList(function() - gl_Color(0,0,0,0.66) - RectRound(BLcornerX,BLcornerY,TRcornerX,TRcornerY,6) - - local padding = 2.75 - gl_Color(1,1,1,0.025) - RectRound(BLcornerX+padding,BLcornerY+padding,TRcornerX-padding,TRcornerY-padding,padding,true) - - --DrawRect(BLcornerX,BLcornerY,TRcornerX,TRcornerY) - -- draws highlight (top and left sides) - --gl_Color(0.44,0.44,0.44,0.38) - --gl_Rect(widgetPosX-margin-1, widgetPosY + widgetHeight +margin, widgetPosX + widgetWidth+margin, widgetPosY + widgetHeight-1+margin) - --gl_Rect(widgetPosX-margin-1 , widgetPosY-margin, widgetPosX-margin, widgetPosY-margin + widgetHeight + 1 - 1+margin+margin) - + + gl_Color(0,0,0,ui_opacity) + RectRound(absLeft,absBottom,absRight,absTop,padding*2, math.min(paddingLeft,paddingTop), math.min(paddingTop,paddingRight), math.min(paddingRight,paddingBottom), math.min(paddingBottom,paddingLeft)) + gl_Color(1,1,1,ui_opacity*0.055) + RectRound(absLeft+paddingLeft,absBottom+paddingBottom,absRight-paddingRight,absTop-paddingTop,padding*1.66, math.min(paddingLeft,paddingTop), math.min(paddingTop,paddingRight), math.min(paddingRight,paddingBottom), math.min(paddingBottom,paddingLeft)) + if collapsed then + font:Begin() + local text = 'Playerlist' + local yOffset = collapsedHeight*0.5 + local xOffset = collapsedHeight/6 + font:SetTextColor(0,0,0,0.2) + font:Print(text, widgetPosX - 1 + xOffset, TRcornerY-padding -yOffset, 13, "") + font:Print(text, widgetPosX + 1 + xOffset, TRcornerY-padding -yOffset, 13, "") + font:SetTextColor(0.9,0.9,0.9,0.75) + font:Print(text, widgetPosX + xOffset, TRcornerY-padding -yOffset+0.8, 13, "n") + font:End() + end + gl_Color(1,1,1,1) - end) + end) + end --------------------------------------------------------------------------------------------------- @@ -1650,7 +2067,7 @@ function CreateMainList(tip) if MainList then gl_DeleteList(MainList) end - + tipText = nil MainList = gl_CreateList(function() drawTipText = nil for i, drawObject in ipairs(drawList) do @@ -1693,7 +2110,9 @@ function CreateMainList(tip) end if drawTipText ~= nil then tipText = drawTipText - DrawTip(drawTipMouseX, drawTipMouseY) + if not WG['tooltip'] then -- else use tooltip widget (in widget:update) + DrawTip(drawTipMouseX, drawTipMouseY) + end end end) @@ -1703,12 +2122,13 @@ function DrawLabel(text, vOffset, drawSeparator) if widgetWidth < 67 then text = string.sub(text, 0, 1) end - gl_Color(0,0,0,0.2) - gl_Text(text, widgetPosX - 1, widgetPosY + widgetHeight -vOffset+6.6, 12, "") - gl_Text(text, widgetPosX + 1, widgetPosY + widgetHeight -vOffset+6.6, 12, "") - gl_Color(0.9,0.9,0.9,0.75) - gl_Text(text, widgetPosX, widgetPosY + widgetHeight -vOffset+7.5, 12, "n") - + font:Begin() + --font:SetTextColor(0,0,0,0.2) + --font:Print(text, widgetPosX - 1, widgetPosY + widgetHeight -vOffset+6.6, 12, "") + --font:Print(text, widgetPosX + 1, widgetPosY + widgetHeight -vOffset+6.6, 12, "") + font:SetTextColor(0.9,0.9,0.9,0.75) + font:Print(text, widgetPosX, widgetPosY + widgetHeight -vOffset+7.5, 12, "on") + font:End() if drawSeparator then --DrawSeparator(vOffset) end @@ -1718,11 +2138,13 @@ function DrawLabelTip(text, vOffset, xOffset) if widgetWidth < 67 then text = string.sub(text, 0, 1) end - gl_Color(0,0,0,0.08) - gl_Text(text, widgetPosX + xOffset - 1, widgetPosY + widgetHeight -vOffset+6.8, 10, "") - gl_Text(text, widgetPosX + xOffset + 1, widgetPosY + widgetHeight -vOffset+6.8, 10, "") - gl_Color(0.9,0.9,0.9,0.35) - gl_Text(text, widgetPosX + xOffset, widgetPosY + widgetHeight -vOffset+7.5, 10, "n") + font:Begin() + --font:SetTextColor(0,0,0,0.08) + --font:Print(text, widgetPosX + xOffset - 1, widgetPosY + widgetHeight -vOffset+6.8, 10, "") + --font:Print(text, widgetPosX + xOffset + 1, widgetPosY + widgetHeight -vOffset+6.8, 10, "") + font:SetTextColor(0.9,0.9,0.9,0.35) + font:Print(text, widgetPosX + xOffset, widgetPosY + widgetHeight -vOffset+7.5, 10, "on") + font:End() end function DrawSeparator(vOffset) @@ -1735,9 +2157,11 @@ function DrawSeparator(vOffset) end function DrawLabelRightside(text, vOffset) - local textLength = (gl_GetTextWidth(text)*12)*widgetScale - gl_Color(1,1,1,0.13) - gl_Text(text, widgetRight - textLength, widgetPosY + widgetHeight -vOffset+7.5, 12, "n") + local textLength = (font:GetTextWidth(text)*12)*widgetScale + font:Begin() + font:SetTextColor(1,1,1,0.13) + font:Print(text, widgetRight - textLength, widgetPosY + widgetHeight -vOffset+7.5, 12, "n") + font:End() end @@ -1774,29 +2198,25 @@ function DrawPlayer(playerID, leader, vOffset, mouseX, mouseY) if WG['betfrontend'] ~= nil then playerScores = WG['betfrontend'].GetPlayerScores() end - - --if mySpecStatus then - alpha = 0.33 - local alphaActivity = 0 - -- keyboard/mouse activity - if lastActivity[playerID] ~= nil and type(lastActivity[playerID]) == "number" then - alphaActivity = (8 - math.floor(now-lastActivity[playerID])) / 5.5 - if alphaActivity > 1 then alphaActivity = 1 end - if alphaActivity < 0 then alphaActivity = 0 end - alphaActivity = 0.33 + (alphaActivity*0.21) - alpha = alphaActivity - end - -- camera activity - if recentBroadcasters[playerID] ~= nil and type(recentBroadcasters[playerID]) == "number" then - local alphaCam = (13 - math.floor(recentBroadcasters[playerID])) / 8.5 - if alphaCam > 1 then alphaCam = 1 end - if alphaCam < 0 then alphaCam = 0 end - alpha = 0.33 + (alphaCam*0.42) - if alpha < alphaActivity then alpha = alphaActivity end - end - --else - -- alpha = 0.44 - --end + + alpha = 0.33 + local alphaActivity = 0 + -- keyboard/mouse activity + if lastActivity[playerID] ~= nil and type(lastActivity[playerID]) == "number" then + alphaActivity = (8 - math.floor(now-lastActivity[playerID])) / 5.5 + if alphaActivity > 1 then alphaActivity = 1 end + if alphaActivity < 0 then alphaActivity = 0 end + alphaActivity = 0.33 + (alphaActivity*0.21) + alpha = alphaActivity + end + -- camera activity + if recentBroadcasters[playerID] ~= nil and type(recentBroadcasters[playerID]) == "number" then + local alphaCam = (13 - math.floor(recentBroadcasters[playerID])) / 8.5 + if alphaCam > 1 then alphaCam = 1 end + if alphaCam < 0 then alphaCam = 0 end + alpha = 0.33 + (alphaCam*0.42) + if alpha < alphaActivity then alpha = alphaActivity end + end if mouseY >= tipPosY and mouseY <= tipPosY + (16*widgetScale) then tipY = true end @@ -1894,7 +2314,7 @@ function DrawPlayer(playerID, leader, vOffset, mouseX, mouseY) if m_cpuping.active == true then if cpuLvl ~= nil then -- draws CPU usage and ping icons (except AI and ghost teams) DrawPingCpu(pingLvl,cpuLvl,posY,spec,1,cpu,lastFpsData[playerID]) - if tipY == true then PingCpuTip(mouseX, ping, cpu, lastFpsData[playerID], lastSystemData[playerID], name) end + if tipY == true then PingCpuTip(mouseX, ping, cpu, lastFpsData[playerID], lastGpuMemData[playerID], lastSystemData[playerID], name) end end end @@ -1926,7 +2346,7 @@ end function DrawTakeSignal(posY) if blink == true then -- Draws a blinking rectangle if the player of the same team left (/take option) - if right == true then + if right then gl_Color(0.7,0.7,0.7) gl_Texture(pics["arrowPic"]) DrawRect(widgetPosX - 14, posY, widgetPosX, posY + 16) @@ -1987,8 +2407,8 @@ function DrawResources(energy, energyStorage, metal, metalStorage, posY, dead) DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/metalStorage)*metal), posY + y2Offset) if ((barWidth/metalStorage)*metal) > 0.8 then - local glowsize = 12 - gl_Color(1,1,1.2,0.033) + local glowsize = 10 + gl_Color(1,1,1.2,0.08) gl_Texture(pics["barGlowCenterPic"]) DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/metalStorage)*metal), posY + y2Offset-glowsize) @@ -2012,8 +2432,8 @@ function DrawResources(energy, energyStorage, metal, metalStorage, posY, dead) DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/energyStorage)*energy), posY + y2Offset) if ((barWidth/energyStorage)*energy) > 0.8 then - local glowsize = 12 - gl_Color(1,1,0.2,0.033) + local glowsize = 10 + gl_Color(1,1,0.2,0.08) gl_Texture(pics["barGlowCenterPic"]) DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/energyStorage)*energy), posY + y2Offset-glowsize) @@ -2025,8 +2445,10 @@ end function DrawChips(playerID, posY) local xPos = m_name.posX + widgetPosX - 6 - gl_Color(0.75,0.75,0.75,0.8) - gl_Text(playerScores[playerID].score, xPos-5, posY+4, 9.5, "r") + font:Begin() + font:SetTextColor(0.75,0.75,0.75,0.8) + font:Print(playerScores[playerID].score, xPos-5, posY+4, 9.5, "r") + font:End() gl_Color(1,1,1,1) gl_Texture(pics["chipPic"]) DrawRect(xPos+4, posY+3.5, xPos-2.5, posY + 10) @@ -2193,6 +2615,7 @@ end function DrawName(name, team, posY, dark, playerID) local willSub = "" + local ignored = WG.ignoredPlayers and WG.ignoredPlayers[name] if not gameStarted then if playerID>=64 then willSub = (Spring.GetGameRulesParam("Player" .. (playerID-64) .. "willSub")==1) and " (sub)" or "" --pID-64 because apl uses dummy playerIDs for absent players @@ -2201,6 +2624,7 @@ function DrawName(name, team, posY, dark, playerID) end end local nameText = name .. willSub + local nameColourR,nameColourG,nameColourB,nameColourA = Spring_GetTeamColor(team) local xPadding = 0 @@ -2211,50 +2635,88 @@ function DrawName(name, team, posY, dark, playerID) DrawState(playerID, m_name.posX + widgetPosX, posY) end if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then - gl_Text(colourNames(team) .. nameText, m_name.posX + widgetPosX + 3 + xPadding, posY + 4, 14, "o") -- draws name + font2:Begin() + font2:Print(colourNames(team) .. nameText, m_name.posX + widgetPosX + 3 + xPadding, posY + 4, 14, "o") + font2:End() else - gl_Color(0,0,0,0.45) - gl_Text(nameText, m_name.posX + widgetPosX + 2 + xPadding, posY + 3, 14, "n") -- draws name - gl_Text(nameText, m_name.posX + widgetPosX + 4 + xPadding, posY + 3, 14, "n") -- draws name - gl_Color(nameColourR,nameColourG,nameColourB,1) - gl_Text(nameText, m_name.posX + widgetPosX + 3 + xPadding, posY + 4, 14, "n") -- draws name + font2:Begin() + font2:SetTextColor(0,0,0,0.4) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(nameText, m_name.posX + widgetPosX + 2 + xPadding, posY + 3, 14, "n") -- draws name + font2:Print(nameText, m_name.posX + widgetPosX + 4 + xPadding, posY + 3, 14, "n") -- draws name + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,1) + font2:Print(colourNames(team) .. nameText, m_name.posX + widgetPosX + 3 + xPadding, posY + 4, 14, "n") + font2:End() + end + if ignored then + gl_Color(1,1,1,0.9) + local x = m_name.posX + widgetPosX + 2 + xPadding + local y = posY + 7 + local w = font:GetTextWidth(nameText) * 14 + 2 + local h = 2 + gl_Texture(false) + DrawRect(x,y,x+w,y+h) end - gl_Color(1,1,1) + gl_Color(1,1,1) end function DrawSmallName(name, team, posY, dark, playerID, alpha) - if team ~= nil then - if originalColourNames[playerID] then - name = originalColourNames[playerID] .. name - end - local textindent = 4 - local explayerindent = -3 - if m_indent.active or m_rank.active or m_side.active or m_ID.active then - textindent = 0 - end - local nameColourR,nameColourG,nameColourB,nameColourA = 1,1,1,1 + if team == nil then + return + end + + local ignored = WG.ignoredPlayers and WG.ignoredPlayers[name] + if originalColourNames[playerID] then + name = originalColourNames[playerID] .. name + end - if playerSpecs[playerID] ~= nil then - nameColourR,nameColourG,nameColourB,nameColourA = Spring_GetTeamColor(team) - if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then - gl_Text(colourNames(team) .. name, m_name.posX + textindent + explayerindent + widgetPosX + 3, posY + 4, 11, "o") - else - gl_Color(0,0,0,0.3) - gl_Text(name, m_name.posX + textindent + explayerindent + widgetPosX + 2, posY + 3.2, 11, "n") -- draws name - gl_Text(name, m_name.posX + textindent + explayerindent + widgetPosX + 4, posY + 3.2, 11, "n") -- draws name - gl_Color(nameColourR,nameColourG,nameColourB,0.78) - gl_Text(name, m_name.posX + textindent + explayerindent + widgetPosX + 3, posY + 4, 11, "n") - end + local textindent = 4 + local explayerindent = -3 + if m_indent.active or m_rank.active or m_side.active or m_ID.active then + textindent = 0 + end + local nameColourR,nameColourG,nameColourB,nameColourA = 1,1,1,1 + + if playerSpecs[playerID] ~= nil then + nameColourR,nameColourG,nameColourB,nameColourA = Spring_GetTeamColor(team) + if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then + font2:Begin() + font2:Print(colourNames(team) .. name, m_name.posX + textindent + explayerindent + widgetPosX + 3, posY + 4, 11, "o") + font2:End() else - gl_Color(0,0,0,0.3) - gl_Text(name, m_name.posX + textindent + widgetPosX + 2.2, posY + 3.3, 10, "n") - gl_Text(name, m_name.posX + textindent + widgetPosX + 3.8, posY + 3.3, 10, "n") - gl_Color(1,1,1,alpha) - gl_Text(name, m_name.posX + textindent + widgetPosX + 3, posY + 4, 10, "n") + font2:Begin() + font2:SetTextColor(0,0,0,0.3) + font2:SetOutlineColor(0,0,0,0.3) + font2:Print(name, m_name.posX + textindent + explayerindent + widgetPosX + 2, posY + 3.2, 11, "n") -- draws name + font2:Print(name, m_name.posX + textindent + explayerindent + widgetPosX + 4, posY + 3.2, 11, "n") -- draws name + font2:SetTextColor(1,1,1,0.78) + font2:SetOutlineColor(0,0,0,0.3) + --gl_Color(nameColourR,nameColourG,nameColourB,0.78) + font2:Print(colourNames(team) .. name, m_name.posX + textindent + explayerindent + widgetPosX + 3, posY + 4, 11, "n") + font2:End() end - gl_Color(1,1,1) + else + font2:Begin() + font2:SetTextColor(0,0,0,0.3) + font2:SetOutlineColor(0,0,0,0.3) + font2:Print(name, m_name.posX + textindent + widgetPosX + 2.2, posY + 3.3, 10, "n") + font2:Print(name, m_name.posX + textindent + widgetPosX + 3.8, posY + 3.3, 10, "n") + font2:SetTextColor(1,1,1,alpha) + font2:Print(name, m_name.posX + textindent + widgetPosX + 3, posY + 4, 10, "n") + font2:End() + end + if ignored then + gl_Color(1,1,1,0.7) + local x = m_name.posX + textindent + widgetPosX + 2.2 + local y = posY + 6 + local w = font:GetTextWidth(name) * 10 + 2 + local h = 2 + gl_Texture(false) + DrawRect(x,y,x+w,y+h) end + gl_Color(1,1,1) end function DrawID(playerID, posY, dark, dead) @@ -2264,27 +2726,29 @@ function DrawID(playerID, posY, dark, dead) end local fontSize = 11 local deadspace = 0 - if dead then - fontSize = 8 - deadspace = 1.5 - gl_Color(0,0,0,0.4) - else - gl_Color(0,0,0,0.6) - end + font:Begin() + --if dead then + -- fontSize = 8 + -- deadspace = 1.5 + -- font:SetTextColor(0,0,0,0.4) + --else + -- font:SetTextColor(0,0,0,0.6) + --end --gl_Text(colourNames(playerID) .. " ".. playerID .. "", m_ID.posX + widgetPosX+4.5, posY + 5, 11, "o") - gl_Text(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 4.1, fontSize, "n") + --font:Print(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 4.1, fontSize, "n") if dead then - gl_Color(1,1,1,0.33) + font:SetTextColor(1,1,1,0.4) else - gl_Color(1,1,1,0.5) + font:SetTextColor(1,1,1,0.66) end - gl_Text(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 5, fontSize, "n") - gl_Color(1,1,1) + font:Print(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 5, fontSize, "on") + font:End() end function DrawSkill(skill, posY, dark) - gl_Text(skill, m_skill.posX + widgetPosX + m_skill.width - 2, posY + 5.3, 9.5, "or") - gl_Color(1,1,1) + font:Begin() + font:Print(skill, m_skill.posX + widgetPosX + m_skill.width - 2, posY + 5.3, 9.5, "or") + font:End() end function DrawPingCpu(pingLvl, cpuLvl, posY, spec, alpha, cpu, fps) @@ -2300,23 +2764,23 @@ function DrawPingCpu(pingLvl, cpuLvl, posY, spec, alpha, cpu, fps) grayvalue = 0.7 + (cpu/135) + font:Begin() if cpuText ~= nil and cpuText then if type(cpu) == "number" then if cpu > 99 then cpu = 99 end if spec then - gl_Color(0,0,0,0.1+(grayvalue*0.4)) - gl_Text(cpu, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9, "r") - gl_Color(grayvalue,grayvalue,grayvalue,0.66*alpha*grayvalue) - gl_Text(cpu, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9, "r") + --font:SetTextColor(0,0,0,0.1+(grayvalue*0.4)) + --font:Print(cpu, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9, "r") + font:SetTextColor(grayvalue,grayvalue,grayvalue,0.66*alpha*grayvalue) + font:Print(cpu, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9, "ro") else - gl_Color(0,0,0,0.12+(grayvalue*0.44)) - gl_Text(cpu, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9.5, "r") - gl_Color(grayvalue,grayvalue,grayvalue,0.8*alpha*grayvalue) - gl_Text(cpu, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9.5, "r") + --font:SetTextColor(0,0,0,0.12+(grayvalue*0.44)) + --font:Print(cpu, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9.5, "r") + font:SetTextColor(grayvalue,grayvalue,grayvalue,0.8*alpha*grayvalue) + font:Print(cpu, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9.5, "ro") end - gl_Color(1,1,1) end else @@ -2325,18 +2789,21 @@ function DrawPingCpu(pingLvl, cpuLvl, posY, spec, alpha, cpu, fps) fps = 99 end grayvalue = 0.95 - (fps/195) + if fps < 0 then + fps = 0 + greyvalue = 1 + end if spec then - gl_Color(0,0,0,0.1+(grayvalue*0.4)) - gl_Text(fps, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9, "r") - gl_Color(grayvalue,grayvalue,grayvalue,0.77*alpha*grayvalue) - gl_Text(fps, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9, "r") + --font:SetTextColor(0,0,0,0.1+(grayvalue*0.4)) + --font:Print(fps, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9, "r") + font:SetTextColor(grayvalue,grayvalue,grayvalue,0.77*alpha*grayvalue) + font:Print(fps, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9, "ro") else - gl_Color(0,0,0,0.12+(grayvalue*0.44)) - gl_Text(fps, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9.5, "r") - gl_Color(grayvalue,grayvalue,grayvalue,alpha*grayvalue) - gl_Text(fps, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9.5, "r") + --font:SetTextColor(0,0,0,0.12+(grayvalue*0.44)) + --font:Print(fps, m_cpuping.posX + widgetPosX+11, posY + 4.3, 9.5, "r") + font:SetTextColor(grayvalue,grayvalue,grayvalue,alpha*grayvalue) + font:Print(fps, m_cpuping.posX + widgetPosX+11, posY + 5.3, 9.5, "ro") end - gl_Color(1,1,1) else gl_Texture(pics["cpuPic"]) if spec then @@ -2346,8 +2813,10 @@ function DrawPingCpu(pingLvl, cpuLvl, posY, spec, alpha, cpu, fps) gl_Color(pingCpuColors[cpuLvl].r,pingCpuColors[cpuLvl].g,pingCpuColors[cpuLvl].b) DrawRect(m_cpuping.posX + widgetPosX + 1, posY+1, m_cpuping.posX + widgetPosX + 14, posY + 15) end + gl_Color(1,1,1,1) end end + font:End() end function DrawPoint(posY,pointtime) @@ -2362,10 +2831,10 @@ function DrawPoint(posY,pointtime) leftPosX = widgetPosX + widgetWidth gl_Color(1,0,0,pointtime/pointDuration) gl_Texture(pics["arrowPic"]) - DrawRect(leftPosX + 158, posY, leftPosX + 2, posY + 14) + DrawRect(leftPosX + 18, posY, leftPosX + 2, posY + 14) gl_Color(1,1,1,pointtime/pointDuration) gl_Texture(pics["pointPic"]) - DrawRect(leftPosX + 33, posY-1, leftPosX + 17, posY + 15) + DrawRect(leftPosX + 33, posY-1, leftPosX + 17, posY + 15) end gl_Color(1,1,1,1) end @@ -2445,12 +2914,12 @@ function ResourcesTip(mouseX, e, es, ei, m, ms, mi) if m >= 10000 then e = math.floor(m/1000).."k" end if ei >= 10000 then ei = math.floor(ei/1000).."k" end if mi >= 10000 then ei = math.floor(mi/1000).."k" end - tipText = "\255\255\255\000+"..ei.."\n"..e.."\n\255\255\255\255"..m.."\n+"..mi + tipText = "\255\255\255\000+"..ei.."\n\255\255\255\000"..e.."\n\255\255\255\255"..m.."\n\255\255\255\255+"..mi end end -function PingCpuTip(mouseX, pingLvl, cpuLvl, fps, system, name) +function PingCpuTip(mouseX, pingLvl, cpuLvl, fps, gpumem, system, name) if mouseX >= widgetPosX + (m_cpuping.posX + 13) * widgetScale and mouseX <= widgetPosX + (m_cpuping.posX + 23) * widgetScale then if pingLvl < 2000 then pingLvl = pingLvl.." ms" @@ -2465,6 +2934,9 @@ function PingCpuTip(mouseX, pingLvl, cpuLvl, fps, system, name) if fps ~= nil then tipText = "FPS: "..fps.." "..tipText end + if gpumem ~= nil then + tipText = tipText.." Gpu mem: "..gpumem.."%" + end if system ~= nil then tipText = "\255\000\000\000"..name.."\n\255\233\180\180"..tipText.."\n\255\240\240\240"..system end @@ -2487,7 +2959,7 @@ end function stringToLines(str) local t = {} - local function helper(line) table.insert(t, line) return "" end + local function helper(line) t[#t+1] = line return "" end helper((str:gsub("(.-)\r?\n", helper))) return t end @@ -2504,14 +2976,13 @@ function DrawTip(mouseX, mouseY) text = tipText --this is needed because we're inside a gllist if text ~= nil then local fontSize = 14*widgetScale - local tw = fontSize*gl_GetTextWidth(text) + (20*widgetScale) + local tw = fontSize*font:GetTextWidth(text) + (20*widgetScale) local _, lines = string.gsub(text, "\n", "") lines = lines + 1 local lineHeight = fontSize + (fontSize/4.5) local th = lineHeight * lines + (fontSize*0.75) - - if right ~= true then tw = -tw end + local oldWidgetScale = widgetScale widgetScale = 1 @@ -2520,24 +2991,39 @@ function DrawTip(mouseX, mouseY) if bottomY < 0 then ycorrection = (15*widgetScale)-bottomY end local padding = -1.8*oldWidgetScale - gl_Color(0.8,0.8,0.8,0.75) - RectRound(mouseX-tw+padding, bottomY+ycorrection+padding, mouseX-padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding,4.5*oldWidgetScale) - - padding = 0*oldWidgetScale - gl_Color(0,0,0,0.28) - RectRound(mouseX-tw+padding, bottomY+ycorrection+padding, mouseX-padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding, 3.5*oldWidgetScale) - + + local xoffset = -15*oldWidgetScale + if right then + gl_Color(0.8,0.8,0.8,0.75) + RectRound(mouseX-tw+padding+xoffset, bottomY+ycorrection+padding, mouseX+xoffset-padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding, 4.5*oldWidgetScale) + + padding = 0*oldWidgetScale + gl_Color(0,0,0,0.28) + RectRound(mouseX-tw+padding+xoffset, bottomY+ycorrection+padding, mouseX+xoffset-padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding, 3.5*oldWidgetScale) + else + xoffset = 22*oldWidgetScale + gl_Color(0.8,0.8,0.8,0.75) + RectRound(mouseX+padding+xoffset, bottomY+ycorrection+padding, mouseX+tw+xoffset-padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding, 4.5*oldWidgetScale) + + padding = 0*oldWidgetScale + gl_Color(0,0,0,0.28) + RectRound(mouseX+padding+xoffset, bottomY+ycorrection+padding, mouseX+tw+xoffset+padding, (mouseY+(26*oldWidgetScale)+ycorrection)-padding, 3.5*oldWidgetScale) + end widgetScale = oldWidgetScale -- draw text local textLines = stringToLines(text) th = 0 - gl.BeginText() + font:Begin() for i, line in ipairs(textLines) do - gl_Text('\255\244\244\244'..line, mouseX+(8*widgetScale)-tw, mouseY+(8*widgetScale)+ycorrection+th, fontSize, "o") + if right then + font:Print('\255\244\244\244'..line, mouseX+xoffset+(8*widgetScale)-tw, mouseY+(8*widgetScale)+ycorrection+th, fontSize, "o") + else + font:Print('\255\244\244\244'..line, mouseX+xoffset+(8*widgetScale), mouseY+(8*widgetScale)+ycorrection+th, fontSize, "o") + end th = th - lineHeight end - gl.EndText() + font:End() end tipText = nil @@ -2558,6 +3044,7 @@ function CreateShareSlider() ShareSlider = gl_CreateList(function() + font:Begin() local posY if energyPlayer ~= nil then posY = widgetPosY + widgetHeight - energyPlayer.posY @@ -2569,12 +3056,12 @@ function CreateShareSlider() if right == true then DrawRect(m_share.posX + widgetPosX - 28,posY-1+sliderPosition, m_share.posX + widgetPosX + 19,posY+17+sliderPosition) gl_Texture(false) - gl_Text(amountEM.."", m_share.posX + widgetPosX - 5,posY+3+sliderPosition) - else - DrawRect(m_share.posX + widgetPosX + 76,posY-1+sliderPosition, m_share.posX + widgetPosX + 31,posY+17+sliderPosition) - gl_Texture(false) - gl_Text(amountEM.."", m_share.posX + widgetPosX + 55,posY+3+sliderPosition) - end + font:Print(amountEM.."", m_share.posX + widgetPosX - 5,posY+3+sliderPosition, 14, "on") + else + DrawRect(m_share.posX + widgetPosX + 76,posY-1+sliderPosition, m_share.posX + widgetPosX + 31,posY+17+sliderPosition) + gl_Texture(false) + font:Print(amountEM.."", m_share.posX + widgetPosX + 55,posY+3+sliderPosition, 14, "on") + end elseif metalPlayer ~= nil then posY = widgetPosY + widgetHeight - metalPlayer.posY gl_Texture(pics["barPic"]) @@ -2585,13 +3072,14 @@ function CreateShareSlider() if right == true then DrawRect(m_share.posX + widgetPosX - 12,posY-1+sliderPosition, m_share.posX + widgetPosX + 35,posY+17+sliderPosition) gl_Texture(false) - gl_Text(amountEM.."", m_share.posX + widgetPosX + 11,posY+3+sliderPosition) - else - DrawRect(m_share.posX + widgetPosX + 88,posY-1+sliderPosition, m_share.posX + widgetPosX + 47,posY+17+sliderPosition) - gl_Texture(false) - gl_Text(amountEM.."", m_share.posX + widgetPosX + 71,posY+3+sliderPosition) + font:Print(amountEM.."", m_share.posX + widgetPosX + 11,posY+3+sliderPosition, 14, "on") + else + DrawRect(m_share.posX + widgetPosX + 88,posY-1+sliderPosition, m_share.posX + widgetPosX + 47,posY+17+sliderPosition) + gl_Texture(false) + font:Print(amountEM.."", m_share.posX + widgetPosX + 71,posY+3+sliderPosition, 14, "on") + end end - end + font:End() end) end @@ -2630,6 +3118,9 @@ local prevClickedName local clickedName function widget:MousePress(x,y,button) --super ugly code here + + if collapsed then return end + local t = false -- true if the object is a team leader local clickedPlayer local posY @@ -2690,9 +3181,6 @@ function widget:MousePress(x,y,button) --super ugly code here if (mySpecStatus or player[i].allyteam == myAllyTeamID) and clickTime - prevClickTime < dblclickPeriod and clickedName == prevClickedName then LockCamera(i) prevClickedName = '' - if not clickedPlayer.spec then - Spring_SendCommands{"specteam "..i} - end SortList() CreateLists() return true @@ -2798,14 +3286,13 @@ function widget:MousePress(x,y,button) --super ugly code here if m_name.active and clickedPlayer.name ~= absentName and IsOnRect(x, y, m_name.posX + widgetPosX +1, posY, m_name.posX + widgetPosX + m_name.width, posY+12) then if ctrl then Spring_SendCommands{"toggleignore "..clickedPlayer.name} + SortList() + CreateLists() return true end if (mySpecStatus or player[i].allyteam == myAllyTeamID) and clickTime - prevClickTime < dblclickPeriod and clickedName == prevClickedName then LockCamera(clickedPlayer.team) prevClickedName = '' - if not clickedPlayer.spec then - Spring_SendCommands{"specteam "..clickedPlayer.team} - end SortList() CreateLists() return true @@ -2822,6 +3309,9 @@ end local mouseX, mouseY = 0,0 function widget:MouseMove(x,y,dx,dy,button) + + if collapsed then return end + mouseX, mouseY = x, y local moveStartX, moveStartY if energyPlayer ~= nil or metalPlayer ~= nil then -- move energy/metal share slider @@ -2841,6 +3331,9 @@ function widget:MouseMove(x,y,dx,dy,button) end function widget:MouseRelease(x,y,button) + + if collapsed then return end + if button == 1 then if firstclick ~= nil then -- double click system for share units release = firstclick @@ -2897,6 +3390,9 @@ end -- Tweak mode --------------------------------------------------------------------------------------------------- +function IsOnRectPlain(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY +end function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) @@ -2976,7 +3472,9 @@ local function DrawArrows() end function widget:TweakDrawScreen() - + + if collapsed then return end + local scaleDiffX = -((widgetPosX*widgetScale)-widgetPosX)/widgetScale local scaleDiffY = -((widgetPosY*widgetScale)-widgetPosY)/widgetScale gl.Scale(widgetScale,widgetScale,0) @@ -3022,6 +3520,9 @@ function checkButton(module, x, y, localLeft, localOffset, localBottom) end function widget:TweakMousePress(x,y,button) + + if collapsed then return end + if button == 1 then local localLeft = widgetPosX local localBottom = widgetPosY + widgetHeight - 28 @@ -3053,6 +3554,9 @@ end function widget:TweakMouseMove(x,y,dx,dy,button) + + if collapsed then return end + if clickToMove ~= nil then if moveStartX == nil then -- move widget on y axis moveStartX = x - widgetPosX @@ -3091,6 +3595,9 @@ function widget:TweakMouseMove(x,y,dx,dy,button) end function widget:TweakMouseRelease(x,y,button) + + if collapsed then return end + clickToMove = nil -- ends the share slider process end @@ -3128,7 +3635,12 @@ function widget:GetConfigData(data) -- save lockPlayerID = lockPlayerID, specListShow = specListShow, gameFrame = Spring.GetGameFrame(), - lastSystemData = lastSystemData + lastSystemData = lastSystemData, + alwaysHideSpecs = alwaysHideSpecs, + collapsable = collapsable, + transitionTime = transitionTime, + lockcameraHideEnemies = lockcameraHideEnemies, + lockcameraLos = lockcameraLos, } return settings @@ -3139,11 +3651,31 @@ function widget:SetConfigData(data) -- load if data.customScale ~= nil then customScale = data.customScale end - + if data.specListShow ~= nil then specListShow = data.specListShow end - + + if data.alwaysHideSpecs ~= nil then + alwaysHideSpecs = data.alwaysHideSpecs + end + + if data.lockcameraHideEnemies ~= nil then + lockcameraHideEnemies = data.lockcameraHideEnemies + end + + if data.lockcameraLos ~= nil then + lockcameraLos = data.lockcameraLos + end + + if data.lockcameraLos ~= nil then + transitionTime = data.transitionTime + end + + if data.collapsable ~= nil then + collapsable = data.collapsable + end + --view if data.expandDown ~= nil and data.widgetRight ~= nil then expandDown = data.expandDown @@ -3178,6 +3710,25 @@ function widget:SetConfigData(data) -- load end if data.lockPlayerID ~= nil and Spring.GetGameFrame()>0 then lockPlayerID = data.lockPlayerID + if lockPlayerID and not select(3,Spring_GetPlayerInfo(lockPlayerID),false) then + if not lockcameraHideEnemies then + if not fullView then + Spring.SendCommands("specfullview") + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()=="los" then + desiredLosmode = 'normal' + desiredLosmodeChanged = os.clock() + end + end + else + if fullView then + Spring.SendCommands("specfullview") + if lockcameraLos and mySpecStatus and Spring.GetMapDrawMode()~="los" then + desiredLosmode = 'los' + desiredLosmodeChanged = os.clock() + end + end + end + end end if data.cpuText ~= nil then cpuText = data.cpuText @@ -3213,7 +3764,7 @@ function widget:SetConfigData(data) -- load end end end - + SetModulesPositionX() if data.lastSystemData ~= nil and data.gameFrame ~= nil and data.gameFrame <= Spring.GetGameFrame() and data.gameFrame > Spring.GetGameFrame()-300 then @@ -3222,9 +3773,18 @@ function widget:SetConfigData(data) -- load end function widget:TextCommand(command) - if (string.find(command, "cputext") == 1 and string.len(command) == 7) then + if (string.find(command, "cputext") == 1 and string.len(command) == 7) then cpuText = not cpuText end + if (string.find(command, "alwayshidespecs") == 1 and string.len(command) == 15) then + alwaysHideSpecs = not alwaysHideSpecs + if alwaysHideSpecs then + Spring.Echo("AdvPlayersList: always hiding specs") + specListShow = false + else + Spring.Echo("AdvPlayersList: not always hiding specs") + end + end end --------------------------------------------------------------------------------------------------- @@ -3234,7 +3794,7 @@ end function CheckPlayersChange() local sorting = false for i = 0,63 do - local name,active,spec,teamID,allyTeamID,pingTime,cpuUsage, country, rank = Spring_GetPlayerInfo(i) + local name,active,spec,teamID,allyTeamID,pingTime,cpuUsage, country, rank = Spring_GetPlayerInfo(i,false) if active == false then if player[i].name ~= nil then -- NON SPEC PLAYER LEAVING if player[i].spec==false then @@ -3303,7 +3863,7 @@ function CheckPlayersChange() end end - if sorting == true then -- sorts the list again if change needs it + if sorting == true and not collapsed then -- sorts the list again if change needs it SortList() SetModulesPositionX() -- change the X size if needed (change of widest name) end @@ -3374,18 +3934,80 @@ function IsTakeable(teamID) end +function isInBox(mx, my, box) + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] +end --timers local timeCounter = 0 local updateRate = 0.75 local updateRatePreStart = 0.25 local lastTakeMsg = -120 - +local uiOpacitySec = 0.5 +local hoverPlayerlist = false function widget:Update(delta) --handles takes & related messages + + local mx,my = Spring.GetMouseState() + hoverPlayerlist = false + if isInBox(mx, my, {apiAbsPosition[2]-1,apiAbsPosition[3]-1,apiAbsPosition[4]+1,apiAbsPosition[1]+1}) then + hoverPlayerlist = true + if tipText and WG['tooltip'] then + WG['tooltip'].ShowTooltip('advplayerlist', tipText) + end + end + + + uiOpacitySec = uiOpacitySec + delta + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + CreateBackground() + end + end + + if collapsable then + if collapsed and hoverPlayerlist then + collapsed = false + CreateBackground() + elseif not collapsed and not energyPlayer and not metalPlayer then + local graceDistance = 85*widgetScale + if not isInBox(mx, my, {apiAbsPosition[2]-graceDistance,apiAbsPosition[3]-graceDistance,apiAbsPosition[4]+graceDistance,apiAbsPosition[1]+graceDistance}) then + collapsed = true + CreateBackground() + end + end + end + + if collapsed then return end + totalTime = totalTime + delta timeCounter = timeCounter + delta curFrame = Spring_GetGameFrame() - + mySpecStatus,fullView,_ = Spring.GetSpectatingState() + + if sceduledSpecFullView ~= nil then -- this is needed else the minimap/world doesnt update properly + Spring.SendCommands("specfullview") + sceduledSpecFullView = sceduledSpecFullView - 1 + if sceduledSpecFullView == 0 then + sceduledSpecFullView = nil + end + end + if lockcameraLos then + if desiredLosmodeChanged+1 > os.clock() then + if lockPlayerID ~= nil then + if desiredLosmode ~= Spring.GetMapDrawMode() then -- this is needed else the minimap/world doesnt update properly + Spring.SendCommands("togglelos") + end + elseif mySpecStatus and Spring.GetMapDrawMode() == 'los' then + Spring.SendCommands("togglelos") + end + end + end + + if lockPlayerID ~= nil then + Spring.SetCameraState(Spring.GetCameraState(), transitionTime) + end if energyPlayer ~= nil or metalPlayer ~= nil then CreateShareSlider() @@ -3453,7 +4075,7 @@ function updateWidgetScale() if customScale < 0.6 then customScale = 0.6 end - widgetScale = (0.7 + (vsx*vsy / 5000000)) * customScale + widgetScale = (0.75 + (vsx*vsy / 5000000)) * customScale end function customScaleUp() @@ -3470,12 +4092,19 @@ function customScaleDown() updateWidgetScale() end + function widget:ViewResize(viewSizeX, viewSizeY) local dx, dy = vsx - viewSizeX, vsy - viewSizeY + + --local vsxDiff = 1 / (vsx/viewSizeX) + --local vsyDiff = 1 / (vsy/viewSizeY) + vsx, vsy = viewSizeX, viewSizeY - + + --local oldWidgetScale = widgetScale updateWidgetScale() - + --local scaleDiff = 1 / (vsx/widgetScale) + if expandDown == true then widgetTop = widgetTop - dy widgetPosY = widgetTop - widgetHeight @@ -3484,6 +4113,15 @@ function widget:ViewResize(viewSizeX, viewSizeY) widgetRight = widgetRight - dx widgetPosX = vsx - (widgetWidth * widgetScale) - widgetRelRight end + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + fontfileScale2 = newFontfileScale * 1.25 + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) + end end function widget:MapDrawCmd(playerID, cmdType, px, py, pz) -- get the points drawn (to display point indicator) diff --git a/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua b/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua index f0a4ecdfa..da2901c41 100644 --- a/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua +++ b/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua @@ -18,9 +18,8 @@ function widget:GetInfo() author = "Floris", date = "april 2017", license = "GNU GPL, v2 or later", - layer = -4, + layer = -3, enabled = true, -- loaded by default? - handler = true, } end @@ -28,27 +27,21 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- Unfucked volumes finally. Instead of setting the volume in Spring.PlaySoundStream. you need to call Spring.PlaySoundStream and then immediately call Spring.SetSoundStreamVolume --- This widget desperately needs to be reorganized - - -local vsx, vsy = widgetHandler:GetViewSizes() +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 5.75 +local fontfileOutlineStrength = 1.33 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) local bgcorner = ":n:LuaUI/Images/bgcorner.png" local widgetScale = 1 -local glText = gl.Text -local glGetTextWidth = gl.GetTextWidth -local glBlending = gl.Blending -local glScale = gl.Scale -local glRotate = gl.Rotate -local glTranslate = gl.Translate local glPushMatrix = gl.PushMatrix local glPopMatrix = gl.PopMatrix local glColor = gl.Color -local glRect = gl.Rect -local glTexRect = gl.TexRect -local glTexture = gl.Texture local glCreateList = gl.CreateList local glDeleteList = gl.DeleteList local glCallList = gl.CallList @@ -58,8 +51,6 @@ local advplayerlistPos = {} local widgetHeight = 23 local top, left, bottom, right = 0,0,0,0 -local shown = false -local mouseover = false local volume -------------------------------------------------------------------------------- @@ -77,73 +68,69 @@ function widget:Initialize() end -local function DrawRectRound(px,py,sx,sy,cs) +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) gl.TexCoord(0.8,0.8) gl.Vertex(px+cs, py, 0) gl.Vertex(sx-cs, py, 0) gl.Vertex(sx-cs, sy, 0) gl.Vertex(px+cs, sy, 0) - + gl.Vertex(px, py+cs, 0) gl.Vertex(px+cs, py+cs, 0) gl.Vertex(px+cs, sy-cs, 0) gl.Vertex(px, sy-cs, 0) - + gl.Vertex(sx, py+cs, 0) gl.Vertex(sx-cs, py+cs, 0) gl.Vertex(sx-cs, sy-cs, 0) gl.Vertex(sx, sy-cs, 0) - - local offset = 0.05 -- texture offset, because else gaps could show - local o = offset - - -- top left - if py <= 0 or px <= 0 then o = 0.5 else o = offset end + + local offset = 0.07 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) - -- top right - if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) - -- bottom left - if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, sy-cs, 0) - -- bottom right - if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end - -function RectRound(px,py,sx,sy,cs) - local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) - +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) gl.Texture(bgcorner) - gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) gl.Texture(false) end @@ -160,37 +147,52 @@ local function updateValues() local _,gamespeed,_ = Spring.GetGameSpeed() gamespeed = string.format("%.2f", gamespeed) local fps = Spring.GetFPS() - local titleColor = '\255\155\155\155' - local valueColor = '\255\200\200\200' + local titleColor = '\255\185\185\185' + local valueColor = '\255\230\230\230' local gameframe = Spring.GetGameFrame() local minutes = math.floor((gameframe / 30 / 60)) local seconds = math.floor((gameframe - ((minutes*60)*30)) / 30) - if seconds == 0 then + if seconds == 0 then seconds = '00' elseif seconds < 10 then seconds = '0'..seconds end local time = minutes..':'..seconds - - glColor(0.45,0.45,0.45,1) - glText(titleColor..'time '..valueColor..time..titleColor..' speed '..valueColor..gamespeed..titleColor..' fps '..valueColor..fps, left+textXPadding, bottom+textYPadding, textsize, 'no') - end) + + font:Begin() + font:Print(titleColor..'time '..valueColor..time..titleColor..' speed '..valueColor..gamespeed..titleColor..' fps '..valueColor..fps, left+textXPadding, bottom+textYPadding, textsize, 'no') + font:End() + end) end local function createList() + if drawlist[3] ~= nil then + glDeleteList(drawlist[3]) + end + if WG['guishader'] then + drawlist[3] = glCreateList( function() + RectRound(left, bottom, right, top, 5.5*widgetScale) + end) + WG['guishader'].InsertDlist(drawlist[3], 'displayinfo') + end if drawlist[1] ~= nil then glDeleteList(drawlist[1]) end - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].InsertRect(left, bottom, right, top, 'displayinfo') - end drawlist[1] = glCreateList( function() - glColor(0, 0, 0, 0.66) + glColor(0, 0, 0, ui_opacity) RectRound(left, bottom, right, top, 5.5*widgetScale) - local borderPadding = 2.75*widgetScale - glColor(1,1,1,0.025) - RectRound(left+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) + local borderPadding = 3*widgetScale + local borderPaddingRight = borderPadding + if right >= vsx-0.2 then + borderPaddingRight = 0 + end + local borderPaddingLeft = borderPadding + if left <= 0.2 then + borderPaddingLeft = 0 + end + glColor(1,1,1,ui_opacity*0.055) + RectRound(left+borderPaddingLeft, bottom+borderPadding, right-borderPaddingRight, top-borderPadding, borderPadding*1.66) end) updateValues() @@ -198,24 +200,44 @@ end function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('displayinfo') + if WG['guishader'] then + WG['guishader'].RemoveDlist('displayinfo') end for i=1,#drawlist do glDeleteList(drawlist[i]) end + gl.DeleteFont(font) Spring.SendCommands("fps 1") Spring.SendCommands("clock 1") Spring.SendCommands("speed 1") WG['displayinfo'] = nil end +local guishaderEnabled = (WG['guishader']) + local passedTime = 0 +local passedTime2 = 0 +local uiOpacitySec = 0.5 function widget:Update(dt) + + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) or guishaderEnabled ~= (WG['guishader']) then + guishaderEnabled = (WG['guishader']) + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + createList() + end + end passedTime = passedTime + dt - if passedTime > 1 then + passedTime2 = passedTime2 + dt + if passedTime > 0.1 then + passedTime = passedTime - 0.1 + updatePosition() + end + if passedTime2 > 1 then updateValues() - passedTime = passedTime - 1 + passedTime2 = passedTime2 - 1 end end @@ -225,18 +247,18 @@ function updatePosition(force) local prevPos = advplayerlistPos advplayerlistPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - if WG['music'] ~= nil then - if widgetHandler.orderList["Music Player"] ~= nil and (widgetHandler.orderList["Music Player"] > 0) then - advplayerlistPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end + if WG['music'] and WG['music'].GetPosition and WG['music'].GetPosition() then + advplayerlistPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} end - + --if widgetScale ~= advplayerlistPos[5] then + -- local fontScale = widgetScale/2 + -- font = gl.LoadFont(fontfile, 52*fontScale, 17*fontScale, 1.25) + --end left = advplayerlistPos[2] bottom = advplayerlistPos[1] right = advplayerlistPos[4] - top = advplayerlistPos[1]+(widgetHeight*advplayerlistPos[5]) + top = math.ceil(advplayerlistPos[1]+(widgetHeight*advplayerlistPos[5])) widgetScale = advplayerlistPos[5] - if (prevPos[1] == nil or prevPos[1] ~= advplayerlistPos[1] or prevPos[2] ~= advplayerlistPos[2] or prevPos[5] ~= advplayerlistPos[5]) or force then createList() end @@ -245,10 +267,22 @@ end function widget:ViewResize(newX,newY) vsx, vsy = newX, newY + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawScreen() - updatePosition() + if chobbyInterface then return end if drawlist[1] ~= nil then glPushMatrix() glCallList(drawlist[1]) diff --git a/LuaUI/Widgets_Evo/gui_advplayerslist_lockcamera.lua b/LuaUI/Widgets_Evo/gui_advplayerslist_lockcamera.lua deleted file mode 100644 index 9f1310a7b..000000000 --- a/LuaUI/Widgets_Evo/gui_advplayerslist_lockcamera.lua +++ /dev/null @@ -1,304 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: gui_musicPlayer.lua --- brief: yay music --- author: cake --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "AdvPlayersList lockcamera", - desc = "Displays current tracked player", - author = "Floris", - date = "july 2017", - license = "GNU GPL, v2 or later", - layer = -2, - enabled = true, -- loaded by default? - handler = true, - } -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -local vsx, vsy = widgetHandler:GetViewSizes() - -local bgcorner = ":n:LuaUI/Images/bgcorner.png" - -local widgetScale = 1 -local glText = gl.Text -local glGetTextWidth = gl.GetTextWidth -local glBlending = gl.Blending -local glScale = gl.Scale -local glRotate = gl.Rotate -local glTranslate = gl.Translate -local glPushMatrix = gl.PushMatrix -local glPopMatrix = gl.PopMatrix -local glColor = gl.Color -local glRect = gl.Rect -local glTexRect = gl.TexRect -local glTexture = gl.Texture -local glCreateList = gl.CreateList -local glDeleteList = gl.DeleteList -local glCallList = gl.CallList - -local drawlist = {} -local parentPos = {} -local widgetHeight = 23 -local top, left, bottom, right = 0,0,0,0 - -local shown = false -local mouseover = false -local volume - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - updatePosition() - WG['lockcamerainfo'] = {} - WG['lockcamerainfo'].GetPosition = function() - return {top,left,bottom,right,widgetScale} - end - Spring.SendCommands("fps 0") - Spring.SendCommands("clock 0") - Spring.SendCommands("speed 0") -end - - -local function DrawRectRound(px,py,sx,sy,cs) - gl.TexCoord(0.8,0.8) - gl.Vertex(px+cs, py, 0) - gl.Vertex(sx-cs, py, 0) - gl.Vertex(sx-cs, sy, 0) - gl.Vertex(px+cs, sy, 0) - - gl.Vertex(px, py+cs, 0) - gl.Vertex(px+cs, py+cs, 0) - gl.Vertex(px+cs, sy-cs, 0) - gl.Vertex(px, sy-cs, 0) - - gl.Vertex(sx, py+cs, 0) - gl.Vertex(sx-cs, py+cs, 0) - gl.Vertex(sx-cs, sy-cs, 0) - gl.Vertex(sx, sy-cs, 0) - - local offset = 0.05 -- texture offset, because else gaps could show - local o = offset - - -- top left - if py <= 0 or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, py+cs, 0) - -- top right - if py <= 0 or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, py+cs, 0) - -- bottom left - if sy >= vsy or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, sy-cs, 0) - -- bottom right - if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, sy-cs, 0) -end - -function RectRound(px,py,sx,sy,cs) - local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) - - gl.Texture(bgcorner) - gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) - gl.Texture(false) -end - -function colourNames(teamID) - nameColourR,nameColourG,nameColourB,nameColourA = Spring.GetTeamColor(teamID) - R255 = math.floor(nameColourR*255) --the first \255 is just a tag (not colour setting) no part can end with a zero due to engine limitation (C) - G255 = math.floor(nameColourG*255) - B255 = math.floor(nameColourB*255) - if ( R255%10 == 0) then - R255 = R255+1 - end - if( G255%10 == 0) then - G255 = G255+1 - end - if ( B255%10 == 0) then - B255 = B255+1 - end - return "\255"..string.char(R255)..string.char(G255)..string.char(B255) --works thanks to zwzsg -end - -local function createList() - for i=1,#drawlist do - glDeleteList(drawlist[i]) - end - if (WG['guishader_api'] ~= nil) then - --WG['guishader_api'].InsertRect(left, bottom, right, top, 'lockcamerainfo') - end - drawlist[1] = glCreateList( function() - --glColor(0, 0, 0, 0.66) - --RectRound(left, bottom, right, top, 5.5*widgetScale) - -- - --local borderPadding = 2.75*widgetScale - --glColor(1,1,1,0.025) - --RectRound(left+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) - local text = ' cancel ' - local fontSize = (widgetHeight*widgetScale) * 0.5 - local textWidth = gl.GetTextWidth(text) * fontSize - glColor(0.66, 0, 0, 0.66) - RectRound(right-textWidth, bottom, right, top, 5.5*widgetScale) - cancelButton = {right-textWidth, bottom, right, top } - - local borderPadding = 2.75*widgetScale - glColor(0,0,0,0.18) - RectRound(right-textWidth+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) - - glText('\255\255\222\222'..text, right-(textWidth/2), bottom+(8*widgetScale), fontSize, 'oc') - - if lockPlayerID ~= nil then - local name,_,_,teamID,_,_,_,_,_ = Spring.GetPlayerInfo(lockPlayerID) - name = name..' ' - local fontSize = (widgetHeight*widgetScale) * 0.66 - local nameWidth = gl.GetTextWidth(name) * fontSize - local nameColourR,nameColourG,nameColourB,_ = Spring.GetTeamColor(teamID) - --glText('\255\222\222\222viewing ', right-textWidth-nameWidth, bottom+(7.5*widgetScale), fontSize*0.7, 'or') - if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then - glText(colourNames(teamID)..name, right-textWidth, bottom+(8*widgetScale), fontSize, 'or') - else - glColor(0,0,0,0.6) - glText(name, right-textWidth-(0.7*widgetScale), bottom+(7*widgetScale), fontSize, 'rn') - glText(name, right-textWidth+(0.7*widgetScale), bottom+(7*widgetScale), fontSize, 'rn') - glColor(nameColourR,nameColourG,nameColourB,1) - glText(name, right-textWidth, bottom+(8*widgetScale), fontSize, 'rn') - end - end - end) - drawlist[2] = glCreateList( function() - glColor(1, 0.2, 0.2, 0.4) - RectRound(cancelButton[1], cancelButton[2], cancelButton[3], cancelButton[4], 5.5*widgetScale) - - local borderPadding = 2.75*widgetScale - glColor(0,0,0,0.14) - RectRound(cancelButton[1]+borderPadding, cancelButton[2]+borderPadding, cancelButton[3]-borderPadding, cancelButton[4]-borderPadding, 4.4*widgetScale) - - local text = ' cancel ' - local fontSize = (widgetHeight*widgetScale) * 0.5 - local textWidth = gl.GetTextWidth(text) * fontSize - glText('\255\255\222\222'..text, cancelButton[3]-(textWidth/2), cancelButton[2]+(8*widgetScale), fontSize, 'oc') - end) -end - - -function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('lockcamerainfo') - end - for i=1,#drawlist do - glDeleteList(drawlist[i]) - end -end - -local passedTime = 0 -function widget:Update(dt) - passedTime = passedTime + dt - if passedTime > 0.2 then - passedTime = passedTime - 0.2 - if WG['advplayerlist_api'].GetLockPlayerID ~= nil then - lockPlayerID = WG['advplayerlist_api'].GetLockPlayerID() - if lockPlayerID ~= prevLockPlayerID then - createList() - end - prevLockPlayerID = lockPlayerID - end - end -end - - -function updatePosition(force) - if (WG['advplayerlist_api'] ~= nil) then - local prevPos = parentPos - if WG['displayinfo'] ~= nil then - if widgetHandler.orderList["AdvPlayersList info"] ~= nil and (widgetHandler.orderList["AdvPlayersList info"] > 0) then - parentPos = WG['displayinfo'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end - elseif WG['music'] ~= nil then - if widgetHandler.orderList["Music Player"] ~= nil and (widgetHandler.orderList["Music Player"] > 0) then - parentPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end - else - parentPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end - - parentPos = WG['displayinfo'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - - left = parentPos[2] - bottom = parentPos[1] - right = parentPos[4] - top = parentPos[1]+(widgetHeight*parentPos[5]) - widgetScale = parentPos[5] - - if (prevPos[1] == nil or prevPos[1] ~= parentPos[1] or prevPos[2] ~= parentPos[2] or prevPos[5] ~= parentPos[5]) or force then - createList() - end - end -end - -function isInBox(mx, my, box) - return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] -end - -function widget:MousePress(mx, my, mb) - if mb == 1 and cancelButton ~= nil and lockPlayerID ~= nil and isInBox(mx, my, cancelButton) then - lockPlayerID = WG['advplayerlist_api'].SetLockPlayerID() - end -end - -function widget:ViewResize(newX,newY) - vsx, vsy = newX, newY -end - -function widget:DrawScreen() - updatePosition() - if lockPlayerID ~= nil and drawlist[1] ~= nil then - glPushMatrix() - glCallList(drawlist[1]) - glPopMatrix() - mx,my,mb = Spring.GetMouseState() - if cancelButton ~= nil and lockPlayerID ~= nil and isInBox(mx, my, cancelButton) then - glCallList(drawlist[2]) - end - end -end diff --git a/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua b/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua index 0410b6e23..b0cc82834 100644 --- a/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua +++ b/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua @@ -1,10 +1,9 @@ -include("colors.h.lua") include("keysym.h.lua") local versionNumber = "2.03" function widget:GetInfo() return { - name = "Ally Selected Units ", + name = "Ally Selected Units", desc = "Shows units selected by teammates [v" .. string.format("%s", versionNumber ) .. "]", author = "very_bad_soldier", date = "August 1, 2008", @@ -14,6 +13,14 @@ function widget:GetInfo() } end +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + --callin driven --"hot" units @@ -36,7 +43,6 @@ local spIsSphereInView = Spring.IsSphereInView local spGetSpectatingState = Spring.GetSpectatingState local spGetGameSeconds = Spring.GetGameSeconds local spIsGUIHidden = Spring.IsGUIHidden -local glDrawGroundCircle = gl.DrawGroundCircle local glColor = gl.Color local glDepthTest = gl.DepthTest local glUnitShape = gl.UnitShape @@ -52,15 +58,17 @@ local glBeginEnd = gl.BeginEnd local glScale = gl.Scale local glVertex = gl.Vertex local glCallList = gl.CallList +local glDrawListAtUnit = gl.DrawListAtUnit local GL_LINE_LOOP = GL.LINE_LOOP local spec = false +local showGui = false ---------------------------------------------------------------- local scaleMultiplier = 1.05 -local maxAlpha = 0.4 +local maxAlpha = 0.45 local hotFadeTime = 0.25 local lockTeamUnits = false --disallow selection of units selected by teammates local showAlly = true --also show allies (besides coop) @@ -82,14 +90,14 @@ playerColorPool[6] = { 1.0, 0.0, 1.0 } playerColorPool[7] = { 1.0, 0.0, 0.0 } playerColorPool[8] = { 1.0, 0.0, 0.0 } -local xRelPos, yRelPos = 0.8, 0.8 -- (only used here for now) +local xRelPos, yRelPos = 0.835, 0.88 -- (only used here for now) local vsx, vsy = gl.GetViewSizes() local xPos, yPos = xRelPos*vsx, yRelPos*vsy local panelWidth = 200; local panelHeight = 55; -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local bgcorner = "LuaUI/Images/bgcorner.png" local sizeMultiplier = 1 --Internals------------------------------------------------------ @@ -103,18 +111,19 @@ local circleLinesCoop local circleLinesAlly local lockPlayerID --- preferred to keep these values the same as other widgets -local rectangleFactor = 3.3 -local scalefaktor = 2.9 local unitConf ={} ------------------------------------------------------------------ function SetUnitConf() + -- preferred to keep these values the same as other widgets + local scaleFactor = 2.6 + local rectangleFactor = 3.25 + for udid, unitDef in pairs(UnitDefs) do local xsize, zsize = unitDef.xsize, unitDef.zsize - local scale = scalefaktor*( xsize^2 + zsize^2 )^0.5 + local scale = scaleFactor*( xsize^2 + zsize^2 )^0.5 local shape, xscale, zscale if (unitDef.isBuilding or unitDef.isFactory or unitDef.speed==0) then @@ -122,11 +131,19 @@ function SetUnitConf() xscale, zscale = rectangleFactor * xsize, rectangleFactor * zsize elseif (unitDef.isAirUnit) then shape = 'triangle' - xscale, zscale = scale, scale + xscale, zscale = scale*1.07, scale*1.07 + elseif (unitDef.modCategories["ship"]) then + shape = 'circle' + xscale, zscale = scale*0.82, scale*0.82 else shape = 'circle' xscale, zscale = scale, scale end + + local radius = Spring.GetUnitDefDimensions(udid).radius + xscale = (xscale*0.7) + (radius/5) + zscale = (zscale*0.7) + (radius/5) + unitConf[udid] = {shape=shape, xscale=xscale, zscale=zscale} end end @@ -144,20 +161,44 @@ function widget:Initialize() widgetHandler:RegisterGlobal('selectedUnitsClear', selectedUnitsClear) widgetHandler:RegisterGlobal('selectedUnitsAdd', selectedUnitsAdd) spec = spGetSpectatingState() + + WG['allyselectedunits'] = {} + WG['allyselectedunits'].getOpacity = function() + return maxAlpha + end + WG['allyselectedunits'].setOpacity = function(value) + maxAlpha = value + end + WG['allyselectedunits'].getSelectPlayerUnits = function() + return selectPlayerUnits + end + WG['allyselectedunits'].setSelectPlayerUnits = function(value) + selectPlayerUnits = value + Spring.Echo(selectPlayerUnits) + end end function widget:Shutdown() widgetHandler:DeregisterGlobal('selectedUnitsRemove') widgetHandler:DeregisterGlobal('selectedUnitsClear') widgetHandler:DeregisterGlobal('selectedUnitsAdd') - gl.DeleteList(circleLines) - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('allyselectedunits') + if guiList ~= nil then + gl.DeleteList(guiList) + end + if circleLinesCoop ~= nil then + gl.DeleteList(circleLinesCoop) + end + if circleLinesAlly ~= nil then + gl.DeleteList(circleLinesAlly) + end + gl.DeleteFont(font) + if WG['guishader'] then + WG['guishader'].RemoveRect('allyselectedunits') end end function widget:PlayerAdded(playerID) - local playerTeam = select(4,spGetPlayerInfo(playerID)) + local playerTeam = select(4,spGetPlayerInfo(playerID,false)) if not playerSelectedUnits[ playerID ] then playerSelectedUnits[ playerID ] = { ["units"]={}, @@ -195,12 +236,12 @@ function widget:PlayerChanged(playerID) spec = true setPlayerColours() if not showAsSpectator then - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end end myTeamID = spGetLocalTeamID() - local playerTeam = select(4,spGetPlayerInfo(playerID)) + local playerTeam = select(4,spGetPlayerInfo(playerID,false)) local oldCoopStatus = playerSelectedUnits[ playerID ]["coop"] playerSelectedUnits[ playerID ]["coop"] = (teamID == myTeamID) playerSelectedUnits[ playerID ]["todraw"] = DoDrawPlayer(playerID) @@ -233,7 +274,7 @@ function widget:CommandsChanged( id, params, options ) end end -function widget:UnitDestroyed(unitID, attacker ) +function widget:UnitDestroyed(unitID) hotUnits[ unitID ] = nil for playerID, selUnits in pairs( playerSelectedUnits ) do @@ -257,7 +298,7 @@ end function selectedUnitsClear(playerID) - isSpec = select(3,spGetPlayerInfo(playerID)) + isSpec = select(3,spGetPlayerInfo(playerID),false) if not isSpec or (lockPlayerID ~= nil and playerID == lockPlayerID) then if not playerSelectedUnits[ playerID ] then widget:PlayerAdded(playerID) @@ -275,7 +316,7 @@ function selectedUnitsClear(playerID) end function selectedUnitsAdd(playerID,unitID) - isSpec = select(3,spGetPlayerInfo(playerID)) + isSpec = select(3,spGetPlayerInfo(playerID),false) if not isSpec or (lockPlayerID ~= nil and playerID == lockPlayerID) then if not playerSelectedUnits[ playerID ] then widget:PlayerAdded(playerID) @@ -297,7 +338,7 @@ function selectedUnitsAdd(playerID,unitID) end function selectedUnitsRemove(playerID,unitID) - isSpec = select(3,spGetPlayerInfo(playerID)) + isSpec = select(3,spGetPlayerInfo(playerID),false) if not isSpec or (lockPlayerID ~= nil and playerID == lockPlayerID) then if not playerSelectedUnits[ playerID ] then widget:PlayerAdded(playerID) @@ -355,135 +396,68 @@ function widget:Update(dt) end end end - -function widget:ViewResize(viewSizeX, viewSizeY) - vsx, vsy = viewSizeX, viewSizeY + +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + xPos, yPos = xRelPos*vsx, yRelPos*vsy sizeMultiplier = 0.55 + (vsx*vsy / 8000000) end function selectPlayerSelectedUnits(playerID) local units = {} + local count = 0 for pID, selUnits in pairs( playerSelectedUnits ) do if pID == playerID then for unitId, _ in pairs( selUnits["units"] ) do - table.insert(units, unitId) + count = count + 1 + units[count] = unitId end end end Spring.SelectUnitArray(units) end -function widget:DrawScreen() - if lockPlayerID ~= nil then +local function createGuiList() + if guiList ~= nil then + gl.DeleteList(guiList) + end + guiList = gl.CreateList(function() glColor(0, 0, 0, 0.6) RectRound(xPos, yPos, xPos + (panelWidth*sizeMultiplier), yPos + (panelHeight*sizeMultiplier), 8*sizeMultiplier) - glColor(1, 1, 1, 1) - glText("Ally Selected Units", xPos + (10*sizeMultiplier), yPos + ((panelHeight - 19)*sizeMultiplier), 13*sizeMultiplier, "n") + font:Begin() + font:Print("Ally Selected Units", xPos + (10*sizeMultiplier), yPos + ((panelHeight - 19)*sizeMultiplier), 13*sizeMultiplier, "n") + font:End() glColor(1, 1, 1, 0.2) drawCheckbox(xPos + (12*sizeMultiplier), yPos + (10*sizeMultiplier), selectPlayerUnits, "Select tracked player units") - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].InsertRect(xPos, yPos, xPos + (panelWidth*sizeMultiplier), yPos + (panelHeight*sizeMultiplier), 'allyselectedunits') + if WG['guishader'] then + WG['guishader'].InsertRect(xPos, yPos, xPos + (panelWidth*sizeMultiplier), yPos + (panelHeight*sizeMultiplier), 'allyselectedunits') end - else - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('allyselectedunits') - end - end -end - -local function DrawRectRound(px,py,sx,sy,cs) - gl.TexCoord(0.8,0.8) - gl.Vertex(px+cs, py, 0) - gl.Vertex(sx-cs, py, 0) - gl.Vertex(sx-cs, sy, 0) - gl.Vertex(px+cs, sy, 0) - - gl.Vertex(px, py+cs, 0) - gl.Vertex(px+cs, py+cs, 0) - gl.Vertex(px+cs, sy-cs, 0) - gl.Vertex(px, sy-cs, 0) - - gl.Vertex(sx, py+cs, 0) - gl.Vertex(sx-cs, py+cs, 0) - gl.Vertex(sx-cs, sy-cs, 0) - gl.Vertex(sx, sy-cs, 0) - - local offset = 0.07 -- texture offset, because else gaps could show - local o = offset - -- top left - --if py <= 0 or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, py+cs, 0) - -- top right - --if py <= 0 or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, py+cs, 0) - -- bottom left - --if sy >= vsy or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, sy-cs, 0) - -- bottom right - --if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, sy-cs, 0) -end - - -function RectRound(px,py,sx,sy,cs) - local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) - - gl.Texture(bgcorner) - gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) - gl.Texture(false) -end - -function drawCheckbox(x, y, state, text) - glPushMatrix() - glTranslate(x, y, 0) - glColor(1, 1, 1, 0.2) - RectRound(0, 0, 16*sizeMultiplier, 16*sizeMultiplier, 3*sizeMultiplier) - glColor(1, 1, 1, 1) - if state then - glTexture('LuaUI/Images/tick.png') - glTexRect(0, 0, 16*sizeMultiplier, 16*sizeMultiplier) - glTexture(false) - end - glText(text, 23*sizeMultiplier, 4*sizeMultiplier, 12*sizeMultiplier, "n") - glPopMatrix() + end) end function widget:DrawWorldPreUnit() + if chobbyInterface then return end if spIsGUIHidden() then return end gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) -- disable layer blending DrawSelectedUnits() DrawHotUnits() end +--local vsx,vsy = Spring.GetViewGeometry() +--local lineScale = (0.75 + (vsx*vsy / 7500000)) +--function widget:ViewResize() +-- local vsx,vsy = Spring.GetViewGeometry() +-- lineScale = (0.75 + (vsx*vsy / 7500000)) +--end + function DrawSelectedUnits() glColor(0.0, 1.0, 0.0, 1.0) glLineWidth(2) @@ -494,23 +468,27 @@ function DrawSelectedUnits() if lockPlayerID == nil or lockPlayerID ~= playerID or (lockPlayerID == playerID and not selectPlayerUnits) then if selUnits["todraw"] then glColor( playerColors[ playerID ][1], playerColors[ playerID ][2], playerColors[ playerID ][3], maxAlpha) - for unitId, defRadius in pairs( selUnits["units"] ) do - local x, y, z = spGetUnitBasePosition(unitId) + for unitID, defRadius in pairs( selUnits["units"] ) do + local x, y, z = spGetUnitBasePosition(unitID) local inView = false if ( z ~= nil ) then --checking z should be enough insteady of x,y,z inView = spIsSphereInView( x, y, z, defRadius ) end if ( inView ) then - local lines = circleLinesAlly + --glPushMatrix() + --glTranslate( x, y, z) + --glScale( defRadius, 1, defRadius) + --if ( selUnits["coop"] == true and not spec) then + -- glCallList(circleLinesCoop) + --else + -- glCallList(circleLinesAlly) + --end + --glPopMatrix() if ( selUnits["coop"] == true and not spec) then - lines = circleLinesCoop + glDrawListAtUnit(unitID, circleLinesCoop, false, defRadius,defRadius,defRadius) + else + glDrawListAtUnit(unitID, circleLinesAlly, false, defRadius,defRadius,defRadius) end - - glPushMatrix() - glTranslate( x, y, z) - glScale( defRadius, 1, defRadius) - glCallList(lines) - glPopMatrix() end end end @@ -578,55 +556,170 @@ function DrawHotUnits() end -function widget:IsAbove(mx, my) - if lockPlayerID == nil then return end - return mx > xPos and my > yPos and mx < xPos + (panelWidth*sizeMultiplier) and my < yPos + (panelHeight*sizeMultiplier) -end - -function widget:MousePress(mx, my, mb) - if lockPlayerID ~= nil then - if mb == 1 then - if mx > xPos + (12*sizeMultiplier) and my > yPos + (10*sizeMultiplier) and mx < (xPos + ((panelWidth - 12)*sizeMultiplier)) and my < (yPos + ((10 + 16)*sizeMultiplier)) then - selectPlayerUnits = not selectPlayerUnits - end - if lockPlayerID ~= nil and widget:IsAbove(mx,my) then - return false - end - end - end -end - -function widget:TweakMousePress(mx, my, mb) - if lockPlayerID ~= nil and (mb == 2 or mb == 3) and widget:IsAbove(mx,my) then - return true - end -end - -function widget:TweakMouseMove(mx, my, dx, dy) - if xPos + dx >= -1 and xPos + (panelWidth*sizeMultiplier) + dx - 1 <= vsx then - xRelPos = xRelPos + dx/vsx - end - if yPos + dy >= -1 and yPos + (panelHeight*sizeMultiplier) + dy - 1<= vsy then - yRelPos = yRelPos + dy/vsy - end - xPos, yPos = xRelPos * vsx,yRelPos * vsy -end function widget:GetConfigData() return { + maxAlpha = maxAlpha, selectPlayerUnits = selectPlayerUnits, - xRelPos = xRelPos, yRelPos = yRelPos + xRelPos = xRelPos, yRelPos = yRelPos, + version = 1.1 } end function widget:SetConfigData(data) - if data.selectPlayerUnits ~= nil then - selectPlayerUnits = data.selectPlayerUnits - end - if data.xRelPos ~= nil then - xRelPos = data.xRelPos or xRelPos - yRelPos = data.yRelPos or yRelPos - xPos = xRelPos * vsx - yPos = yRelPos * vsy + if data.version ~= nil and data.version == 1.1 then + maxAlpha = data.maxAlpha or maxAlpha + selectPlayerUnits = data.selectPlayerUnits or selectPlayerUnits + xRelPos = data.xRelPos or xRelPos + yRelPos = data.yRelPos or yRelPos + xPos = xRelPos * vsx + yPos = yRelPos * vsy + end +end + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') end end + + +if showGui then + + function widget:DrawScreen() + if chobbyInterface then return end + if lockPlayerID ~= nil then + if not guiList then + createGuiList() + end + glCallList(guiList) + else + if WG['guishader'] then + WG['guishader'].RemoveRect('allyselectedunits') + end + end + end + + local function DrawRectRound(px,py,sx,sy,cs) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.07 -- texture offset, because else gaps could show + local o = offset + -- top left + --if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- top right + --if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + --if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + --if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) + end + + function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) + end + + function drawCheckbox(x, y, state, text) + glPushMatrix() + glTranslate(x, y, 0) + glColor(1, 1, 1, 0.2) + RectRound(0, 0, 16*sizeMultiplier, 16*sizeMultiplier, 3*sizeMultiplier) + glColor(1, 1, 1, 1) + if state then + glTexture('LuaUI/Images/tick.png') + glTexRect(0, 0, 16*sizeMultiplier, 16*sizeMultiplier) + glTexture(false) + end + font:Begin() + font:Print(text, 23*sizeMultiplier, 4*sizeMultiplier, 12*sizeMultiplier, "n") + font:End() + glPopMatrix() + end + + function widget:IsAbove(mx, my) + if lockPlayerID == nil then return end + return mx > xPos and my > yPos and mx < xPos + (panelWidth*sizeMultiplier) and my < yPos + (panelHeight*sizeMultiplier) + end + + function widget:MousePress(mx, my, mb) + if lockPlayerID ~= nil then + if mb == 1 then + if mx > xPos + (12*sizeMultiplier) and my > yPos + (10*sizeMultiplier) and mx < (xPos + ((panelWidth - 12)*sizeMultiplier)) and my < (yPos + ((10 + 16)*sizeMultiplier)) then + selectPlayerUnits = not selectPlayerUnits + createGuiList() + end + if lockPlayerID ~= nil and widget:IsAbove(mx,my) then + return false + end + end + end + end + + function widget:TweakMousePress(mx, my, mb) + if lockPlayerID ~= nil and (mb == 2 or mb == 3) and widget:IsAbove(mx,my) then + return true + end + end + + function widget:TweakMouseMove(mx, my, dx, dy) + if xPos + dx >= -1 and xPos + (panelWidth*sizeMultiplier) + dx - 1 <= vsx then + xRelPos = xRelPos + dx/vsx + end + if yPos + dy >= -1 and yPos + (panelHeight*sizeMultiplier) + dy - 1<= vsy then + yRelPos = yRelPos + dy/vsy + end + xPos, yPos = xRelPos * vsx,yRelPos * vsy + createGuiList() + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_ally_cursors.lua b/LuaUI/Widgets_Evo/gui_ally_cursors.lua index f6f81bdfe..1d0e56a5c 100644 --- a/LuaUI/Widgets_Evo/gui_ally_cursors.lua +++ b/LuaUI/Widgets_Evo/gui_ally_cursors.lua @@ -1,22 +1,22 @@ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function widget:GetInfo() - return { - name = "AllyCursors", - desc = "Shows the mouse pos of allied players", - author = "jK", - date = "May,2008", - license = "GNU GPL, v2 or later", - layer = 5, - enabled = true - } + return { + name = "AllyCursors", + desc = "Shows the mouse pos of allied players", + author = "Floris,jK,TheFatController", + date = "31 may 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } end -------------------------------------------------------------------------------- @@ -24,256 +24,452 @@ end -- configs -local sendPacketEvery = 0.8 -local numMousePos = 2 --//num mouse pos in 1 packet +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local cursorSize = 11 +local drawNamesCursorSize = 8.5 + +local dlistAmount = 5 -- number of dlists generated for each player (# available opacity levels) + +local sendPacketEvery = 0.6 +local numMousePos = 2 --//num mouse pos in 1 packet + +local showSpectatorName = true +local showPlayerName = true +local drawNamesScaling = true +local drawNamesFade = true + +local fontSizePlayer = 18 +local fontOpacityPlayer = 0.68 +local fontSizeSpec = 14 +local fontOpacitySpec = 0.48 + +local NameFadeStartDistance = 4800 +local NameFadeEndDistance = 7200 +local idleCursorTime = 30 -- fade time cursor (specs only) + +-- tweak ui +local buttonsize = 18 +local rowgap = 6 +local leftmargin = 20 +local buttontab = 200 +local vsx, vsy = gl.GetViewSizes() +local tweakUiWidth, tweakUiHeight = 240, 215 +local tweakUiPosX, tweakUiPosY = 500, 550 + +-- images +local allyCursor = ":n:LuaUI/Images/allycursor.dds" -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- locals +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local fontScale = widgetScale/2 + font = gl.LoadFont(fontfile, 52*fontScale, 17*fontScale, 1.5) +end -local pairs = pairs +function widget:TextCommand(command) + local mycommand = false + if (string.find(command, "allycursorspecname") == 1 and string.len(command) == 18) then showSpectatorName = not showSpectatorName end -local GetMouseState = Spring.GetMouseState -local TraceScreenRay = Spring.TraceScreenRay -local SendLuaUIMsg = Spring.SendLuaUIMsg -local GetGameFrame = Spring.GetGameFrame -local GetGroundHeight = Spring.GetGroundHeight -local GetPlayerInfo = Spring.GetPlayerInfo -local GetTeamColor = Spring.GetTeamColor -local IsSphereInView = Spring.IsSphereInView -local GetSpectatingState = Spring.GetSpectatingState + if (string.find(command, "allycursorplayername") == 1 and string.len(command) == 20) then showPlayerName = not showPlayerName end -local glTexCoord = gl.TexCoord -local glVertex = gl.Vertex -local glPolygonOffset = gl.PolygonOffset -local glDepthTest = gl.DepthTest -local glTexture = gl.Texture -local glColor = gl.Color -local glBeginEnd = gl.BeginEnd + if showPlayerName then + usedCursorSize = drawNamesCursorSize + end +end + +function widget:GetConfigData(data) + savedTable = {} + savedTable.showSpectatorName = showSpectatorName + savedTable.showPlayerName = showPlayerName + return savedTable +end -local floor = math.floor -local tanh = math.tanh -local GL_QUADS = GL.QUADS +function widget:SetConfigData(data) + if data.showSpectatorName ~= nil then showSpectatorName = data.showSpectatorName end + if data.showPlayerName ~= nil then showPlayerName = data.showPlayerName end + + if showPlayerName then + usedCursorSize = drawNamesCursorSize + end +end -local clock = os.clock -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local function CubicInterpolate2(x0,x1,mix) - local mix2 = mix*mix; - local mix3 = mix2*mix; +local spGetGroundHeight = Spring.GetGroundHeight +local spGetPlayerInfo = Spring.GetPlayerInfo +local spGetTeamColor = Spring.GetTeamColor +local spIsSphereInView = Spring.IsSphereInView +local spGetCameraPosition = Spring.GetCameraPosition +local spGetCameraDirection = Spring.GetCameraDirection +local spIsGUIHidden = Spring.IsGUIHidden + +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +local floor = math.floor +local min = math.min +local diag = math.diag +local GL_QUADS = GL.QUADS +local clock = os.clock +local Button = {} +local Panel = {} +local alliedCursorsPos = {} +local prevCursorPos = {} +local alliedCursorsTime = {} -- for API purpose +local usedCursorSize = cursorSize +local prevMouseX,prevMouseY = 0 +local allycursorDrawList = {} +local myPlayerID = Spring.GetMyPlayerID() + + +local specList = {} +function updateSpecList() + specList = {} + local t = Spring.GetPlayerList() + for _,playerID in ipairs(t) do + specList[playerID] = select(3,spGetPlayerInfo(playerID,false)) + end +end - return x0*(2*mix3-3*mix2+1) + x1*(3*mix2-2*mix3); +function widget:Initialize() + widgetHandler:RegisterGlobal('MouseCursorEvent', MouseCursorEvent) + + if showPlayerName then + usedCursorSize = drawNamesCursorSize + end + updateSpecList() + + WG['allycursor_api'] = {} + WG['allycursor_api'].GetCursorTimes = function() + return alliedCursorsTime + end + + local now = clock() + local pList = Spring.GetPlayerList() + for _,playerID in ipairs(pList) do + alliedCursorsTime[playerID] = now + end +end + + +function widget:Shutdown() + widgetHandler:DeregisterGlobal('MouseCursorEvent') + for playerID, dlists in pairs(allycursorDrawList) do + for opacityMultiplier, dlist in pairs(dlists) do + gl.DeleteList(allycursorDrawList[playerID][opacityMultiplier]) + end + end + gl.DeleteFont(font) end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local alliedCursorsPos = {} +local function CubicInterpolate2(x0,x1,mix) + local mix2 = mix*mix; + local mix3 = mix2*mix; -local newPos = {} -function widget:RecvLuaMsg(msg, playerID) - if (msg:sub(1,1)=="%") - then - if (playerID==Spring.GetMyPlayerID()) then return true; end - local xz = msg:sub(3) - - local l = xz:len()*0.25 - if (l==numMousePos) then - for i=0,numMousePos-1 do - local x = VFS.UnpackU16(xz:sub(i*4+1,i*4+2)) - local z = VFS.UnpackU16(xz:sub(i*4+3,i*4+4)) - newPos[i*2+1] = x - newPos[i*2+2] = z - end - - if (alliedCursorsPos[playerID]) then + return x0*(2*mix3-3*mix2+1) + x1*(3*mix2-2*mix3); +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local playerPos = {} +function MouseCursorEvent(playerID,x,z,click) + if myPlayerID == playerID then + return true + end + local playerPosList = playerPos[playerID] or {} + playerPosList[#playerPosList+1] = {x=x,z=z,click=click} + playerPos[playerID] = playerPosList + if #playerPosList < numMousePos then + return + end + playerPos[playerID] = {} + + if alliedCursorsPos[playerID] then local acp = alliedCursorsPos[playerID] acp[(numMousePos)*2+1] = acp[1] acp[(numMousePos)*2+2] = acp[2] for i=0,numMousePos-1 do - acp[i*2+1] = newPos[i*2+1] - acp[i*2+2] = newPos[i*2+2] + acp[i*2+1] = playerPosList[i+1].x + acp[i*2+2] = playerPosList[i+1].z end acp[(numMousePos+1)*2+1] = clock() - acp[(numMousePos+1)*2+2] = (msg:sub(2,2)=="1") - else + acp[(numMousePos+1)*2+2] = playerPosList[#playerPosList].click + else local acp = {} alliedCursorsPos[playerID] = acp for i=0,numMousePos-1 do - acp[i*2+1] = newPos[i*2+1] - acp[i*2+2] = newPos[i*2+2] + acp[i*2+1] = playerPosList[i+1].x + acp[i*2+2] = playerPosList[i+1].z end - acp[(numMousePos)*2+1] = newPos[(numMousePos-2)*2+1] - acp[(numMousePos)*2+2] = newPos[(numMousePos-2)*2+2] + acp[(numMousePos)*2+1] = playerPosList[(numMousePos-2)*2+1].x + acp[(numMousePos)*2+2] = playerPosList[(numMousePos-2)*2+1].z acp[(numMousePos+1)*2+1] = clock() - acp[(numMousePos+1)*2+2] = (msg:sub(2,2)=="1") - _,_,_,acp[(numMousePos+1)*2+3] = GetPlayerInfo(playerID) - end + acp[(numMousePos+1)*2+2] = playerPosList[#playerPosList].click + acp[(numMousePos+1)*2+3] = select(4,spGetPlayerInfo(playerID,false)) + end + + + -- check if there has been changes + wx,wz = alliedCursorsPos[playerID][1*2+1],alliedCursorsPos[playerID][1*2+1] + + if prevCursorPos[playerID] == nil or wx ~= prevCursorPos[playerID].wx or wz ~= prevCursorPos[playerID].wz then + alliedCursorsTime[playerID] = clock() + end + + if prevCursorPos[playerID] == nil then + prevCursorPos[playerID] = {} end - return true - end + prevCursorPos[playerID].wx = wx + prevCursorPos[playerID].wz = wz end -------------------------------------------------------------------------------- -local updateTimer = 0 -local poshistory = {} - -local saveEach = sendPacketEvery/numMousePos +local function DrawGroundquad(wx,gy,wz,size) + gl.TexCoord(0,0) + gl.Vertex(wx-size,gy+size,wz-size) + gl.TexCoord(0,1) + gl.Vertex(wx-size,gy+size,wz+size) + gl.TexCoord(1,1) + gl.Vertex(wx+size,gy+size,wz+size) + gl.TexCoord(1,0) + gl.Vertex(wx+size,gy+size,wz-size) +end -local n = 0 +local teamColors = {} +local color +local time,wx,wz,lastUpdateDiff,scale,iscale,fscale,gy --keep memory always allocated for these since they are referenced so frequently +local notIdle = {} + +local function SetTeamColor(teamID,playerID,a) + color = teamColors[playerID] + if color then + gl.Color(color[1],color[2],color[3],color[4]*a) + return + end + + --make color + local r, g, b = spGetTeamColor(teamID) + if specList[playerID] then + color = {1, 1, 1, 0.6} + elseif r and g and b then + color = {r, g, b, 0.75} + end + teamColors[playerID] = color + gl.Color(color) + return +end -function widget:Update(t) - updateTimer = updateTimer + t +local sec = 0 +local updateTime = 2 +function widget:Update(dt) + sec = sec+dt + if sec > updateTime then + sec = 0 + updateSpecList() + end +end - if (updateTimer%saveEach<0.2) then - local mx,my = GetMouseState() - local _,pos = TraceScreenRay(mx,my,true) - if (pos~=nil) then - poshistory[n*2] = VFS.PackU16(floor(pos[1])) - poshistory[n*2+1] = VFS.PackU16(floor(pos[3])) +function widget:PlayerChanged(playerID) + local _, _, isSpec, teamID = spGetPlayerInfo(playerID,false) + specList[playerID] = isSpec + local r, g, b = spGetTeamColor(teamID) + local color + if isSpec then + color = {1, 1, 1, 0.6} + elseif r and g and b then + color = {r, g, b, 0.75} end + teamColors[playerID] = color + allycursorDrawList[playerID] = nil +end +function widget:PlayerAdded(playerID) + widget:PlayerChanged(playerID) +end +function widget:PlayerRemoved(playerID, reason) + specList[playerID] = nil +end - n = n + 1 - end - - if (updateTimer>sendPacketEvery)and(n>=numMousePos) then - updateTimer = 0 - n=0 - local posStr = "0" - local _,_,l,m,r = Spring.GetMouseState() - if (l or r) then posStr = "1" end - for i=numMousePos,1,-1 do - local xStr = poshistory[i*2] - local zStr = poshistory[i*2+1] - if (xStr and zStr) then posStr = posStr .. xStr .. zStr end +function createCursorDrawList(playerID, opacityMultiplier) + local name,_,spec,teamID = spGetPlayerInfo(playerID,false) + local r, g, b = spGetTeamColor(teamID) + local wx,gy,wz = 0,0,0 + local quadSize = usedCursorSize + if spec then + quadSize = usedCursorSize * 0.77 end - SendLuaUIMsg("%" .. posStr,"allies") - end - - if (GetSpectatingState()) then - widgetHandler:RemoveCallIn("Update") - return - end + SetTeamColor(teamID,playerID,1) + + if not spec and not showPlayerName or spec and not showSpectatorName then + --draw a cursor + gl.Texture(allyCursor) + gl.BeginEnd(GL.QUADS,DrawGroundquad,wx,gy,wz,quadSize) + gl.Texture(false) + else + if not spec then + --draw a cursor + gl.Texture(allyCursor) + gl.BeginEnd(GL.QUADS,DrawGroundquad,wx,gy,wz,quadSize) + gl.Texture(false) + end + + --draw the nickname + gl.PushMatrix() + gl.Translate(wx, gy, wz) + gl.Rotate(-90,1,0,0) + + font:Begin() + if spec then + font:SetTextColor(1,1,1,fontOpacitySpec*opacityMultiplier) + font:Print(name, 0, 0, fontSizeSpec, "cn") + else + local verticalOffset = usedCursorSize + 8 + local horizontalOffset = usedCursorSize + 1 + -- text shadow + font:SetTextColor(0,0,0,fontOpacityPlayer*0.62*opacityMultiplier) + font:Print(name, horizontalOffset-(fontSizePlayer/50), verticalOffset-(fontSizePlayer/42), fontSizePlayer, "n") + font:Print(name, horizontalOffset+(fontSizePlayer/50), verticalOffset-(fontSizePlayer/42), fontSizePlayer, "n") + -- text + font:SetTextColor(r,g,b,fontOpacityPlayer*opacityMultiplier) + font:Print(name, horizontalOffset, verticalOffset, fontSizePlayer, "n") + end + font:End() + gl.PopMatrix() + end end -local function DrawGroundquad(wx,gy,wz) - -- get ground heights - local gy_tl,gy_tr = GetGroundHeight(wx-16,wz-16),GetGroundHeight(wx+16,wz-16) - local gy_bl,gy_br = GetGroundHeight(wx-16,wz+16),GetGroundHeight(wx+16,wz+16) - local gy_t,gy_b = GetGroundHeight(wx,wz-16),GetGroundHeight(wx,wz+16) - local gy_l,gy_r = GetGroundHeight(wx-16,wz),GetGroundHeight(wx+16,wz) - - --topleft - glTexCoord(0,0) - glVertex(wx-16,gy_bl,wz-16) - glTexCoord(0,0.5) - glVertex(wx-16,gy_l,wz) - glTexCoord(0.5,0.5) - glVertex(wx,gy,wz) - glTexCoord(0.5,0) - glVertex(wx,gy_t,wz-16) - - --topright - glTexCoord(0.5,0) - glVertex(wx,gy_t,wz-16) - glTexCoord(0.5,0.5) - glVertex(wx,gy,wz) - glTexCoord(1,0.5) - glVertex(wx+16,gy_r,wz) - glTexCoord(1,0) - glVertex(wx+16,gy_tr,wz-16) - - --bottomright - glTexCoord(0.5,0.5) - glVertex(wx,gy,wz) - glTexCoord(0.5,1) - glVertex(wx,gy_b,wz+16) - glTexCoord(1,1) - glVertex(wx+16,gy_br,wz+16) - glTexCoord(1,0.5) - glVertex(wx+16,gy_r,wz) - - --bottomleft - glTexCoord(0.5,0) - glVertex(wx-16,gy_l,wz) - glTexCoord(1,0) - glVertex(wx-16,gy_bl,wz+16) - glTexCoord(1,0.5) - glVertex(wx,gy_b,wz+16) - glTexCoord(0.5,0.5) - glVertex(wx,gy,wz) + + +local camDistance, glScale + +local function DrawCursor(playerID,wx,wz,camX,camY,camZ,opacity) + local gy = spGetGroundHeight(wx,wz) + if not (spIsSphereInView(wx,gy,wz,usedCursorSize)) then + return + end + + --calc scale + camDistance = diag(camX-wx, camY-gy, camZ-wz) + glScale = 0.83 + camDistance / 5000 + + -- calc opacity + local opacityMultiplier = 1 + if drawNamesFade and camDistance > NameFadeStartDistance then + opacityMultiplier = (1 - (camDistance-NameFadeStartDistance) / (NameFadeEndDistance-NameFadeStartDistance)) + if opacityMultiplier > 1 then + opacityMultiplier = 1 + end + end + + if opacity >= 1 then + opacityMultiplier = math.floor(opacityMultiplier * dlistAmount)/dlistAmount + else -- if (spec and) fading out due to idling + opacityMultiplier = math.floor(opacityMultiplier * (opacity * dlistAmount))/dlistAmount + end + + if opacityMultiplier > 0.11 then + if allycursorDrawList[playerID] == nil then + allycursorDrawList[playerID] = {} + end + if allycursorDrawList[playerID][opacityMultiplier] == nil then + allycursorDrawList[playerID][opacityMultiplier] = glCreateList(createCursorDrawList, playerID, opacityMultiplier) + end + + local rotValue = 0 + gl.PushMatrix() + gl.Translate(wx, gy, wz) + gl.Rotate(rotValue,0,1,0) + if drawNamesScaling then + gl.Scale(glScale,0,glScale) + end + glCallList(allycursorDrawList[playerID][opacityMultiplier]) + if drawNamesScaling then + gl.Scale(-glScale,0,-glScale) + end + gl.PopMatrix() + end end - -local teamColors = {} -local function SetTeamColor(teamID,a) - local color = teamColors[teamID] - if (color) then - color[4]=a - glColor(color) - return - end - local r, g, b = Spring.GetTeamColor(teamID) - if (r and g and b) then - color = { r, g, b } - teamColors[teamID] = color - glColor(color) - return - end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end - function widget:DrawWorldPreUnit() - glDepthTest(true) - glTexture('LuaUI/Images/AlliedCursors.png') - glPolygonOffset(-7,-10) - local time = clock() - - for playerID,data in pairs(alliedCursorsPos) do - local teamID = data[#data] - for n=0,5 do - local wx,wz = data[1],data[2] - local lastUpdatedDiff = time-data[#data-2] + n*0.025 - - if (lastUpdatedDiff (time-idleCursorTime) then + local opacity = 1 + if specList[playerID] then + opacity = 1 - ((time - alliedCursorsTime[playerID]) / idleCursorTime) + if opacity > 1 then opacity = 1 end + end + if opacity > 0.1 then + DrawCursor(playerID,wx,wz,camX,camY,camZ,opacity) + end else - SetTeamColor(teamID,n*0.2) + --mark a player as notIdle as soon as they move (and keep them always set notIdle after this) + if wx and wz and wz_old and wz_old and(math.abs(wx_old-wx)>=1 or math.abs(wz_old-wz)>=1) then --math.abs is needed because of floating point used in interpolation + notIdle[playerID] = true + wx_old = nil + wz_old = nil + else + wx_old = wx + wz_old = wz + end + end - glBeginEnd(GL_QUADS,DrawGroundquad,wx,gy,wz) - end end - end - - glPolygonOffset(false) - glTexture(false) - glDepthTest(false) -end + --gl.EndText + gl.PolygonOffset(false) + gl.Texture(false) + gl.DepthTest(false) +end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_attack_aoe.lua b/LuaUI/Widgets_Evo/gui_attack_aoe.lua index 367fef1fc..8178dddee 100644 --- a/LuaUI/Widgets_Evo/gui_attack_aoe.lua +++ b/LuaUI/Widgets_Evo/gui_attack_aoe.lua @@ -588,7 +588,14 @@ function widget:Shutdown() DeleteDisplayLists() end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() + if chobbyInterface then return end if not hasSelection then return end local _, cmd, _ = GetActiveCommand() @@ -663,12 +670,18 @@ function widget:DrawWorld() end function widget:SelectionChanged(sel) - UpdateSelection() - widgetHandler:RemoveCallIn("MousePress") - widgetHandler:RemoveCallIn("KeyPress") + selectionChanged = true end +local selChangedSec = 0 function widget:Update(dt) secondPart = secondPart + dt secondPart = secondPart - floor(secondPart) + + selChangedSec = selChangedSec + dt + if selectionChanged and selChangedSec>0.15 then + selChangedSec = 0 + selectionChanged = nil + UpdateSelection() + end end diff --git a/LuaUI/Widgets_Evo/gui_build_eta.lua b/LuaUI/Widgets_Evo/gui_build_eta.lua index c61eb6b2e..e6b58e5fa 100644 --- a/LuaUI/Widgets_Evo/gui_build_eta.lua +++ b/LuaUI/Widgets_Evo/gui_build_eta.lua @@ -20,7 +20,7 @@ function widget:GetInfo() author = "trepan (modified by jK)", date = "Feb, 2008", license = "GNU GPL, v2 or later", - layer = -1, + layer = -9, enabled = true -- loaded by default? } end @@ -28,6 +28,14 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local gl = gl -- use a local copy for faster access local Spring = Spring local table = table @@ -40,9 +48,11 @@ local etaMaxDist= 10000000 -- max dist at which to draw ETA local vsx, vsy = widgetHandler:GetViewSizes() -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local fontScale = widgetScale/2 + font = gl.LoadFont(fontfile, 52*fontScale, 17*fontScale, 1.5) end @@ -85,6 +95,7 @@ end local lastGameUpdate = Spring.GetGameSeconds() function widget:Update(dt) + if chobbyInterface then return end local userSpeed,_,pause = Spring.GetGameSpeed() if (pause) then @@ -98,10 +109,12 @@ function widget:Update(dt) lastGameUpdate = gs local killTable = {} + local count = 0 for unitID,bi in pairs(etaTable) do local _,_,_,_,buildProgress = Spring.GetUnitHealth(unitID) if ((not buildProgress) or (buildProgress >= 1.0)) then - table.insert(killTable, unitID) + count = count + 1 + killTable[count] = unitID else local dp = buildProgress - bi.lastProg local dt = gs - bi.lastTime @@ -178,13 +191,15 @@ function widget:UnitFinished(unitID, unitDefID, unitTeam) etaTable[unitID] = nil end - +function widget:Shutdown() + gl.DeleteFont(font) +end -------------------------------------------------------------------------------- local function DrawEtaText(timeLeft,yoffset) local etaStr if (timeLeft == nil) then - etaStr = '\255\255\255\1ETA\255\255\255\255:\255\255\255\255???' + etaStr = '\255\255\255\1ETA\255\255\255\255:\255\1\1\255???' else if (timeLeft > 60) then etaStr = "\255\255\255\1ETA\255\255\255\255:" .. string.format('\255\1\255\1%d', timeLeft / 60) .. "m, " .. string.format('\255\1\255\1%.1f', timeLeft % 60) .. "s" @@ -199,10 +214,19 @@ local function DrawEtaText(timeLeft,yoffset) gl.Billboard() gl.Translate(0, 5 ,0) --fontHandler.DrawCentered(etaStr) - gl.Text(etaStr, 0, 0, 16, "co") + font:Begin() + font:Print(etaStr, 0, 0, 5.75, "co") + font:End() +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawWorld() + if chobbyInterface then return end if Spring.IsGUIHidden() == false then gl.DepthTest(true) @@ -215,6 +239,10 @@ function widget:DrawWorld() local dx, dy, dz = ux-cx, uy-cy, uz-cz local dist = dx*dx + dy*dy + dz*dz if dist < etaMaxDist then + local unitName = UnitDefs[Spring.GetUnitDefID(unitID)].name + if unitName == "armomex" or unitName == "coromoex" then + bi.yoffset = 25 + end gl.DrawFuncAtUnit(unitID, false, DrawEtaText, bi.timeLeft,bi.yoffset) end end @@ -227,4 +255,4 @@ end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_chickenStatsPanel.lua b/LuaUI/Widgets_Evo/gui_chickenStatsPanel.lua deleted file mode 100644 index aba31abb7..000000000 --- a/LuaUI/Widgets_Evo/gui_chickenStatsPanel.lua +++ /dev/null @@ -1,466 +0,0 @@ --- $Id$ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Chicken Stats Panel", - desc = "Shows statics and progress whhen fighting vs Chickens", - author = "quantum", - date = "May 04, 2008", - license = "GNU GPL, v2 or later", - layer = -9, - enabled = true -- loaded by default? - } -end - -local customScale = 1 -local widgetScale = customScale - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: Chicken Panel] Activated!") -else - Spring.Echo("[ChickenDefense: Chicken Panel] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (not Spring.GetGameRulesParam("difficulty")) then - return false -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local GetTimer = Spring.GetTimer -local DiffTimers = Spring.DiffTimers -local lastRulesUpdate = Spring.GetTimer() -local GetGameSeconds = Spring.GetGameSeconds -local GetGameRulesParam = Spring.GetGameRulesParam -local Spring = Spring -local gl, GL = gl, GL -local widgetHandler = widgetHandler -local math = math -local table = table - -local displayList -local fontHandler = loadstring(VFS.LoadFile("LuaUI/modfonts.lua"))() -local panelFont = "LuaUI/Fonts/FreeSansBold_14" -local waveFont = "LuaUI/Fonts/Skrawl_40" -local panelTexture = ":n:LuaUI/Images/panel.tga" - -local viewSizeX, viewSizeY = 0,0 -local w = 300 -local h = 210 -local x1 = 0 -local y1 = 0 -local panelMarginX = 30 -local panelMarginY = 40 -local panelSpacingY = 7 -local waveSpacingY = 7 -local moving -local capture -local gameInfo -local waveY = 800 -local waveSpeed = 0.2 -local waveCount = 0 -local waveTime -local enabled -local gotScore -local scoreCount = 0 -local queenAnger = 0 - -local guiPanel --// a displayList -local updatePanel -local hasChickenEvent = false - -local red = "\255\255\001\001" -local white = "\255\255\255\255" - -local difficulties = { - [1] = 'Very Easy', - [2] = 'Easy', - [3] = 'Normal', - [4] = 'Hard', - [5] = 'Very Hard', - [6] = 'Epic', - [7] = 'Custom', - [8] = 'Survival', -} - -local rules = { - "queenTime", - "queenAnger", - "gracePeriod", - "queenLife", - "lagging", - "difficulty", - "chickenCount", - "chickenaCount", - "chickensCount", - "chickenfCount", - "chickenrCount", - "chickenwCount", - "chickencCount", - "chickenpCount", - "chickenhCount", - "chickendCount", - "chicken_dodoCount", - "roostCount", - "chickenKills", - "chickenaKills", - "chickensKills", - "chickenfKills", - "chickenrKills", - "chickenwKills", - "chickencKills", - "chickenpKills", - "chickenhKills", - "chickendKills", - "chicken_dodoKills", - "roostKills", -} - -local waveColors = {} -waveColors[1] = "\255\184\100\255" -waveColors[2] = "\255\120\50\255" -waveColors[3] = "\255\255\153\102" -waveColors[4] = "\255\120\230\230" -waveColors[5] = "\255\100\255\100" -waveColors[6] = "\255\150\001\001" -waveColors[7] = "\255\255\255\100" -waveColors[8] = "\255\100\255\255" -waveColors[9] = "\255\100\100\255" -waveColors[10] = "\255\200\050\050" -waveColors[11] = "\255\255\255\255" - -local chickenColors = { - {"chicken", "\255\184\100\255"}, - {"chickena", "\255\255\100\100"}, - {"chickenh", "\255\255\150\150"}, - {"chickens", "\255\100\255\100"}, - {"chickenw", "\255\184\075\200"}, - {"chicken_dodo", "\255\150\001\001"}, - {"chickenp", "\255\250\090\090"}, - {"chickenf", "\255\255\255\100"}, - {"chickenc", "\255\100\255\255"}, - {"chickenr", "\255\100\100\255"}, -} - -local chickenColorSet = {} -for _, t in ipairs(chickenColors) do - chickenColorSet[t[1]] = t[2] -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -fontHandler.UseFont(panelFont) -local panelFontSize = fontHandler.GetFontSize() -fontHandler.UseFont(waveFont) -local waveFontSize = fontHandler.GetFontSize() - -function comma_value(amount) - local formatted = amount - while true do - formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') - if (k==0) then - break - end - end - return formatted -end - -local function MakeCountString(type, showbreakdown) - local t = {} - local total = 0 - local showbrackets = false - for _, colorInfo in ipairs(chickenColors) do - local subTotal = gameInfo[colorInfo[1]..type] - if subTotal > 0 then - table.insert(t, colorInfo[2]..subTotal) - total = total + subTotal - showbrackets = true - end - end - total = total + gameInfo["chickend"..type] - if showbreakdown then - local breakDown = table.concat(t, white..",")..white - if showbrackets then - return string.format("Chickens: %d (%s)", total, breakDown) - else - return string.format("Chickens: %d", total) - end - else - return ("Chicken Kills: " .. white .. total) - end -end - -local function updatePos(x, y) - x1 = math.min((viewSizeX*0.94)-(w*widgetScale)/2,x) - y1 = math.min((viewSizeY*0.89)-(h*widgetScale)/2,y) - updatePanel = true -end - -local function PanelRow(n) - return panelMarginX, h-panelMarginY-(n-1)*(panelFontSize+panelSpacingY) -end - - -local function WaveRow(n) - return n*(waveFontSize+waveSpacingY) -end - - -local function CreatePanelDisplayList() - gl.PushMatrix() - gl.Translate(x1, y1, 0) - gl.Scale(widgetScale, widgetScale, 1) - gl.CallList(displayList) - fontHandler.DisableCache() - fontHandler.UseFont(panelFont) - fontHandler.BindTexture() - local currentTime = GetGameSeconds() - local techLevel = "" - if (currentTime > gameInfo.gracePeriod) then - if gameInfo.queenAnger < 100 then - techLevel = "Queen Anger: " .. gameInfo.queenAnger .. "%" - else - techLevel = "Queen Health: " .. gameInfo.queenLife .. "%" - end - else - techLevel = "Grace Period: " .. math.ceil(((currentTime - gameInfo.gracePeriod) * -1) -0.5) - end - fontHandler.DrawStatic(white..techLevel, PanelRow(1)) - fontHandler.DrawStatic(white..gameInfo.unitCounts, PanelRow(2)) - fontHandler.DrawStatic(white..gameInfo.unitKills, PanelRow(3)) - fontHandler.DrawStatic(white.."Burrows: "..gameInfo.roostCount, PanelRow(4)) - fontHandler.DrawStatic(white.."Burrow Kills: "..gameInfo.roostKills, PanelRow(5)) - local s = white.."Mode: "..difficulties[gameInfo.difficulty] - if gotScore then - fontHandler.DrawStatic(white.."Your Score: "..comma_value(scoreCount), 88, h-170) - else - fontHandler.DrawStatic(white.."Mode: "..difficulties[gameInfo.difficulty], 120, h-170) - end - gl.Texture(false) - gl.PopMatrix() -end - - -local function Draw() - if (not enabled)or(not gameInfo) then - return - end - - if (updatePanel) then - if (guiPanel) then gl.DeleteList(guiPanel); guiPanel=nil end - guiPanel = gl.CreateList(CreatePanelDisplayList) - updatePanel = false - end - - if (guiPanel) then - gl.CallList(guiPanel) - end - - if (waveMessage) then - local t = Spring.GetTimer() - fontHandler.UseFont(waveFont) - local waveY = viewSizeY - Spring.DiffTimers(t, waveTime)*waveSpeed*viewSizeY - if (waveY > 0) then - for i, message in ipairs(waveMessage) do - fontHandler.DrawCentered(message, viewSizeX/2, waveY-WaveRow(i)) - end - else - waveMessage = nil - waveY = viewSizeY - end - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -local function UpdateRules() - if (not gameInfo) then - gameInfo = {} - end - - for _, rule in ipairs(rules) do - gameInfo[rule] = Spring.GetGameRulesParam(rule) or 999 - end - gameInfo.unitCounts = MakeCountString("Count", true) - gameInfo.unitKills = MakeCountString("Kills", false) - - updatePanel = true -end - - -local function MakeLine(chicken, n) - if (n <= 0) then - return - end - local humanName = UnitDefNames[chicken].humanName - local color = chickenColorSet[chicken] - return color..n.." "..humanName.."s" -end - -function ChickenEvent(chickenEventArgs) - if (chickenEventArgs.type == "wave") then - if (gameInfo.roostCount < 1) then - return - end - waveMessage = {} - waveCount = waveCount + 1 - waveMessage[1] = "Wave "..waveCount - waveMessage[2] = waveColors[chickenEventArgs.tech]..chickenEventArgs.number.." chickens!" - waveTime = Spring.GetTimer() - elseif (chickenEventArgs.type == "burrowSpawn") then - UpdateRules() - elseif (chickenEventArgs.type == "queen") then - waveMessage = {} - waveMessage[1] = "The Queen is angered!" - waveTime = Spring.GetTimer() - elseif (chickenEventArgs.type == "score"..(Spring.GetMyTeamID())) then - gotScore = chickenEventArgs.number - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - displayList = gl.CreateList( function() - gl.Blending(true) - gl.Color(1, 1, 1, 1) - gl.Texture(panelTexture) - gl.TexRect(0, 0, w, h) - end) - - widgetHandler:RegisterGlobal("ChickenEvent", ChickenEvent) - UpdateRules() - viewSizeX, viewSizeY = gl.GetViewSizes() - local x = math.abs(math.floor(viewSizeX - 320)) - local y = math.abs(math.floor(viewSizeY - 300)) - updatePos(x, y) -end - - -function widget:Shutdown() - if hasChickenEvent then - Spring.SendCommands({"luarules HasChickenEvent 0"}) - end - fontHandler.FreeFont(panelFont) - fontHandler.FreeFont(waveFont) - - if (guiPanel) then gl.DeleteList(guiPanel); guiPanel=nil end - - gl.DeleteList(displayList) - gl.DeleteTexture(panelTexture) - widgetHandler:DeregisterGlobal("ChickenEvent") -end - -function widget:GameFrame(n) - if not(hasChickenEvent) and n > 1 then - Spring.SendCommands({"luarules HasChickenEvent 1"}) - hasChickenEvent = true - end - if (n%30< 1) then - UpdateRules() - - if (not enabled and n > 1) then - enabled = true - end --- --- queenAnger = math.ceil((((GetGameSeconds()-gameInfo.gracePeriod+gameInfo.queenAnger)/(gameInfo.queenTime-gameInfo.gracePeriod))*100) -0.5) - - end - if gotScore then - local sDif = gotScore - scoreCount - if sDif > 0 then - scoreCount = scoreCount + math.ceil(sDif / 7.654321) - if scoreCount > gotScore then - scoreCount = gotScore - else - updatePanel = true - end - end - end -end - - -function widget:DrawScreen() - Draw() -end - - -function widget:MouseMove(x, y, dx, dy, button) - if (enabled and moving) then - updatePos(x1 + dx, y1 + dy) - end -end - - -function widget:MousePress(x, y, button) - if (enabled and - x > x1 and x < x1 + (w*widgetScale) and - y > y1 and y < y1 + (h*widgetScale)) then - capture = true - moving = true - end - return capture -end - - -function widget:MouseRelease(x, y, button) - if (not enabled) then - return - end - capture = nil - moving = nil - return capture -end - - -function widget:ViewResize(vsx, vsy) - x1 = math.floor(x1 - viewSizeX) - y1 = math.floor(y1 - viewSizeY) - viewSizeX, viewSizeY = vsx, vsy - widgetScale = (0.75 + (viewSizeX*viewSizeY / 10000000)) * customScale - x1 = viewSizeX + x1+((x1/2) * (widgetScale-1)) - y1 = viewSizeY + y1+((y1/2) * (widgetScale-1)) -end - - -local widgetScale = 1 -local vsx, vsy = Spring.GetViewGeometry() - -local changelogLines = {} -local totalChangelogLines = 0 - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_chicken_teamcolor.lua b/LuaUI/Widgets_Evo/gui_chicken_teamcolor.lua deleted file mode 100644 index 1625fbd09..000000000 --- a/LuaUI/Widgets_Evo/gui_chicken_teamcolor.lua +++ /dev/null @@ -1,66 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Chicken Team Colour", - desc = "Changes the Chicken team colour as the queen gets angrier", - author = "TheFatController", - date = "Aug 07, 2011", - license = "MIT", - layer = -9, - enabled = false -- loaded by default? - } -end - -local teams = Spring.GetTeamList() -for i =1, #teams do - local luaAI = Spring.GetTeamLuaAI(teams[i]) - if luaAI ~= "" then - if luaAI == "Chicken: Very Easy" or - luaAI == "Chicken: Easy" or - luaAI == "Chicken: Normal" or - luaAI == "Chicken: Hard" or - luaAI == "Chicken: Very Hard" or - luaAI == "Chicken: Epic!" or - luaAI == "Chicken: Custom" or - luaAI == "Chicken: Survival" then - chickensEnabled = true - end - end -end - -if chickensEnabled == true then - Spring.Echo("[ChickenDefense: Chicken Team Colour] Activated!") -else - Spring.Echo("[ChickenDefense: Chicken Team Colour] Deactivated!") - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (not Spring.GetGameRulesParam("difficulty")) then - return false -end - -local chickenTeamID = Spring.GetGameRulesParam("chickenTeamID") - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GameFrame(n) - if (n == 1) then - chickenTeamID = Spring.GetGameRulesParam("chickenTeamID") - end - if (n%63< 1) then - queenAnger = (Spring.GetGameRulesParam("queenAnger") or 0) - gracePeriod = (Spring.GetGameRulesParam("gracePeriod") or 0) - queenTime = (Spring.GetGameRulesParam("queenTime") or 0) - queenAnger = 1 - math.ceil((((Spring.GetGameSeconds()-gracePeriod+queenAnger)/(queenTime-gracePeriod))*100) -0.5) / 100 - Spring.SetTeamColor(chickenTeamID, 1,queenAnger,queenAnger) - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_chili_buildordermenu.lua b/LuaUI/Widgets_Evo/gui_chili_buildordermenu.lua new file mode 100644 index 000000000..859c1d104 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_chili_buildordermenu.lua @@ -0,0 +1,767 @@ +function widget:GetInfo() + return { + version = "0.1", + name = "chiliBuildOrderMenu", + desc = "Build/Order menu implemented with chili ui", + author = "Adrianulima", + date = "WIP", + license = "GNU GPL, v2 or later", + layer = 1, + enabled = true, --false, + handler = true, + } +end + +local vsx,vsy = Spring.GetViewGeometry() +local widgetScale = (0.5 + (vsx*vsy / 5700000)) + +-------------------------------------------------------------------------------- +-- Hotkeys +VFS.Include("luaui/configs/evo_buildHotkeysConfig.lua") +local sGetKeySymbol = Spring.GetKeySymbol +local function getKeySymbol(k) + if k >= 97 and k <= 122 then return string.char(k):upper() end + -- basically unused + local keySymbol = sGetKeySymbol(k) + return keySymbol:sub(1, 1):upper() .. keySymbol:sub(2) +end +local nameToKeySymbols = {} +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + local trimmedName = ud.name + if trimmedName:find("_up", -5) then trimmedName = trimmedName:sub(1, -5) end + if nameToKeyCode[trimmedName] then + -- local str = "" + -- local leng = #nameToKeyCode[name] + -- for i = 1, leng do + -- str = str .. getKeySymbol(nameToKeyCode[name][i]) + -- if i < leng then str = str .. " + " end + -- end + -- nameToKeySymbols[name] = str + nameToKeySymbols[ud.name] = {} + for i = 1, #nameToKeyCode[trimmedName] do + nameToKeySymbols[ud.name][i] = getKeySymbol(nameToKeyCode[trimmedName][i]) + end + end +end +local hotkeyLabels = {} +-------------------------------------------------------------------------------- +-- Localize +local sForceLayoutUpdate = Spring.ForceLayoutUpdate +local sSetActiveCommand = Spring.SetActiveCommand +local sGetCmdDescIndex = Spring.GetCmdDescIndex +local sGetActiveCommand = Spring.GetActiveCommand +local sGetWindowGeometry = Spring.GetWindowGeometry + +local stringfind = string.find +local stringsub = string.sub +local stringgsub = string.gsub +local mathceil = math.ceil +local mathmax = math.max +local mathmin = math.min + +local glGetTextWidth = gl.GetTextWidth + +-- Chili classes +local Chili, Window, Image, Button, Grid, Label, ScrollPanel, color2incolor + +-- Global vars +local orderWindow, buildWindow, orderGrid, buildGrid, updateRequired, tooltip, btWidth +local chiliCache = {} +local vsx, vsy = sGetWindowGeometry() + +local sGetConfigInt = Spring.GetConfigInt +local buildOrderUI = sGetConfigInt("evo_buildorderui", 2) +local showCost = sGetConfigInt("evo_showcost", 1) == 1 +local showTechReq = sGetConfigInt("evo_showtechreq", 1) == 1 +local showHotkeys = sGetConfigInt("evo_showhotkeys", 1) == 1 +WG.buildOrderUI = {updateConfigInt = false} + +local fontSize = 12 * widgetScale + + +--Horizontal +if buildOrderUI == 0 or buildOrderUI == nil then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 13, columns = 2, + x = '0%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 3, columns = 10, + x = '21.2%', y = '57.5%', + width = '60%', height = '20%', + orientation = 'horizontal', + --maxWidth = 420, + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +--Compact Horizontal +if buildOrderUI == 1 then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 13, columns = 2, + x = '0%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 3, columns = 10, + x = '32%', y = '66%', + width = '40%', height = '15%', + orientation = 'horizontal', + --maxWidth = 420, + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +--Traditional +if buildOrderUI == 2 then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 6, columns = 4, + x = '0%', y = '24%', + width = '50%', height = '25%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 5, columns = 5, + x = '0%', y = '50%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +--Traditional (SxS) +if buildOrderUI == 3 then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 13, columns = 2, + x = '0%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 7, columns = 5, + x = '21%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +--Right Side +if buildOrderUI == 4 then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 13, columns = 2, + x = '0%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 7, columns = 5, + x = '79.75%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +--Right Side Compact +if buildOrderUI == 5 then + Config = { + ordermenu = { + name = 'ordermenu', + rows = 13, columns = 2, + x = '0%', y = '35%', + width = '50%', height = '50%', + orientation = 'horizontal', + maxWidth = 390, + padding = {5, 5, 5, 5}, -- outer panel + }, + buildmenu = { + name = 'buildmenu', + rows = 7, columns = 5, + x = '85%', y = '35%', + width = '15%', height = '30%', + orientation = 'horizontal', + padding = {5, 5, 5, 5}, + }, + labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + }, + hiddenCMDs = { + timewait = true, deathwait = true, squadwait = true, gatherwait = true, + loadonto = true, selfd = false, settargetnoground = true, + }, + } +end + +-------------------------------------------------------------------------------- +-- Helpers +local function deepEquals(t1, t2, ignore_mt) + if t1 == t2 then return true end + local ty1 = type(t1) + local ty2 = type(t2) + if ty1 ~= ty2 then return false end + -- non-table types can be directly compared + if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end + -- as well as tables which have the metamethod __eq + local mt = getmetatable(t1) + if not ignore_mt and mt and mt.__eq then return t1 == t2 end + for k1,v1 in pairs(t1) do + local v2 = t2[k1] + if v2 == nil or not deepEquals(v1, v2) then return false end + end + for k2,v2 in pairs(t2) do + local v1 = t1[k2] + if v1 == nil or not deepEquals(v1, v2) then return false end + end + return true +end --deepEquals + +local function processRelativeCoord(code, total) + local num = tonumber(code) + if (type(code) == "string") then + local percent = tonumber(code:sub(1,-2)) or 0 + if (percent<0) then + percent = 0 + elseif (percent>100) then + percent = 100 + end + return math.floor(total * percent/100) + elseif (num)and((1/num)<0) then + return math.floor(total + num) + else + return math.floor(num or 0) + end +end --processRelativeCoord + +local function createGridWindow(config) + local scroll = ScrollPanel:New{ + name = 'scroll_' .. config.name, + x = '0%', y = '0%', + width = '100%', height = '100%', + padding = config.padding, + } + local grid = Grid:New{ + name = 'grid_' .. config.name, + x = '0%', y = '0%', + width = '100%', height = '100%', + rows = config.rows, + columns = config.columns, + orientation = config.orientation, + padding = {0, 0, 0, 0}, + } + local gridWindow = Window:New{ + name = 'window_' .. config.name, + parent = Chili.Screen0, + x = config.x, y = config.y, + height = config.height, width = config.width, + maxWidth = config.maxWidth, + children = {grid}, + bringToFrontOnClick = true, dockable = false, draggable = false, + resizable = false, tweakDraggable = true, tweakResizable = false, + padding = config.padding, + } + + local function updateGrid() + local rowsNeeded = mathceil(#grid.children / grid.columns) + if rowsNeeded > grid.rows then + local ratio = (gridWindow.height / config.rows) / (gridWindow.width / config.columns) + grid:SetPos(nil, nil, nil, (grid.width / grid.columns) * ratio * rowsNeeded) + grid.rows = rowsNeeded + if grid.parent and grid.parent.name == gridWindow.name then + gridWindow:RemoveChild(grid) + gridWindow:AddChild(scroll) + scroll:AddChild(grid) + end + elseif rowsNeeded <= config.rows then + grid:SetPos(nil, nil, nil, gridWindow.height - gridWindow.padding[2] - gridWindow.padding[4]) + grid.rows = config.rows + if scroll.parent and scroll.parent.name == gridWindow.name then + scroll:RemoveChild(grid) + gridWindow:RemoveChild(scroll) + gridWindow:AddChild(grid) + end + end + end + + grid.updateGrid = updateGrid + gridWindow:Hide() + return grid, gridWindow +end --createGridWindow + +local function applyHighlightHandler(button, cmd) + local selected = {0.85, 0.65, 0, 0.5} + local hovered = {0.75, 0.75, 0.75, 0.25} + local out = {0, 0, 0, 0} + local disabled = {0, 0, 0, 0.6} + + local highlight = chiliCache['highlight' .. button.cmdID] or Image:New{ + name = 'highlight' .. button.cmdID, + parent = button, + file = 'LuaUI/Images/button-highlight.dds', + width = '100%', height = '100%', + fixedRatio = false, keepAspect = false, + color = out, + } + chiliCache['highlight' .. button.cmdID] = highlight + local function updateSelection(cmdID) + local function checkColor(color) + if highlight.color ~= color then + highlight.color = color + highlight:Invalidate() + end + end + + if cmd.disabled then + checkColor(disabled) + if button.state.hovered then + tooltip = stringgsub(cmd.tooltip, "Metal cost %d*\nEnergy cost %d*\n", "") + end + elseif button.cmdID == cmdID then checkColor(selected) + elseif button.state.hovered then + tooltip = stringgsub(cmd.tooltip, "Metal cost %d*\nEnergy cost %d*\n", "") + checkColor(hovered) + else checkColor(out) + end + end + button.updateSelection = updateSelection + updateSelection() + return button +end --applyHighlightHandler + +local function applyStateHandler(button, cmd) + local stateCount = #cmd.params - 1 + local state = cmd.params[1] + 1 + + local function curve(c) return -0.5 * c * (c - 4) end -- makes yellow more vivid + local function getStateColor(i) + local g = (i - 1) / (stateCount - 1) + return (i == state) and {curve(1 - g), curve(g), 0, 1} or {0.9, 0.9, 0.9, 0.3} + end + + local stateButtons = {} + for i = 1, stateCount do + local pad = 7 + local sx = (100 - pad * (stateCount + 3)) / stateCount + local px = pad + i * pad + (i - 1) * sx + stateButtons[i] = chiliCache['stateButton_' .. cmd.id .. '_' .. i] or Image:New{ + name = 'stateButton_' .. cmd.id .. '_' .. i, + parent = button, + file = 'LuaUI/Images/button-highlight.dds', + x = px .. '%', y = '75%', + width = sx .. '%', maxHeight = 6, + keepAspect = false, + color = getStateColor(i), + } + chiliCache['stateButton_' .. cmd.id .. '_' .. i] = stateButtons[i] + end + local oldUpdateSelection = button.updateSelection + local function updateSelection(cmdID) + oldUpdateSelection(cmdID) + for i = 1, stateCount do stateButtons[i].color = getStateColor(i) end + end + button.updateSelection = updateSelection + return button +end --applyStateHandler +-------------------------------------------------------------------------------- +local function InitializeControls() + orderGrid, orderWindow = createGridWindow(Config.ordermenu) + buildGrid, buildWindow = createGridWindow(Config.buildmenu) +end --InitializeControls + +local function ActionCommand(self, x, y, mouse, mods) + local index = sGetCmdDescIndex(self.cmdID) + if index then + local left, right = mouse == 1, mouse == 3 + local alt, ctrl, meta, shift = mods.alt, mods.ctrl, mods.meta, mods.shift + sSetActiveCommand(index, mouse, left, right, alt, ctrl, meta, shift) + end +end --ActionCommand + +local function addOrderCommand(cmd) + local button = chiliCache['button' .. cmd.id] or Button:New{ + name = 'button' .. cmd.id, + --parent = orderGrid, + cmdID = cmd.id, + caption = cmd.name, + textPadding = 9, --8, (MaDDoX) + padding = {0, 0, 0, 0}, + margin = {2, 2, 2, 2}, + OnClick = {function() end}, + OnMouseDown = {ActionCommand} + } + if cmd.name == "Repair" then button:SetCaption("Build") + else button:SetCaption(cmd.name) end + chiliCache['button' .. cmd.id] = button + local s = (btWidth - button.textPadding * 2) / glGetTextWidth(button.caption) + button.font:SetSize(mathmin(s, Config.labels.captionFontMaxSize)) + applyHighlightHandler(button, cmd) + orderGrid:AddChild(button) +end --addOrderCommand + +local function addStateCommand(cmd) + local button = chiliCache['button' .. cmd.id] or Button:New{ + name = 'button' .. cmd.id, + cmdID = cmd.id, + caption = cmd.params[cmd.params[1] + 2], + textPadding = 12, --8, + padding = {0, 0, 0, 0}, + margin = {2, 2, 2, 2}, + OnClick = {function() end}, + OnMouseDown = {ActionCommand} + } + button:SetCaption(cmd.params[cmd.params[1] + 2]) + chiliCache['button' .. cmd.id] = button + local s = (btWidth - button.textPadding * 2) / glGetTextWidth(button.caption) + button.font:SetSize(mathmin(s, Config.labels.captionFontMaxSize)) + applyHighlightHandler(button, cmd) + applyStateHandler(button, cmd) + orderGrid:AddChild(button) +end --addStateCommand + +local function addBuildCommand(cmd) + local image = chiliCache['button' .. cmd.id] or Image:New{ + name = 'button' .. cmd.id, + cmdID = cmd.id, + width = '100%', height = '100%', + file = '#' .. cmd.id * -1, + padding = {0, 0, 0, 0}, + margin = {2, 2, 2, 2}, + OnClick = {function() end}, + OnMouseDown = {ActionCommand} + } + chiliCache['button' .. cmd.id] = image + + if cmd.params[1] then + if (not chiliCache['queueLabel' .. cmd.id]) then + chiliCache['queueLabel' .. cmd.id] = Label:New{ + name = 'queueLabel' .. cmd.id, + parent = image, + right = '5%', y = '5%', + align = 'right', + valign = 'top', + --caption = tostring(cmd.params[1] or ''), + font = { + size = Config.labels.queueFontSize, + outline = true, shadow = true, + outlineWidth = 4, outlineWeight = 4, + }, + } + end + end + if chiliCache['queueLabel' .. cmd.id] then + chiliCache['queueLabel' .. cmd.id]:SetCaption(tostring(cmd.params[1] or '')) + end + + local str = '' + if showCost then + local s, e = 0, 0 + local comma = color2incolor(1,1,1) .. ',' + s, e = stringfind(cmd.tooltip, 'Uses %+%d* Supply') + if s then str = str .. color2incolor(1,0.5,0) .. stringsub(cmd.tooltip, s + 6, e - 7) .. comma end + s, e = stringfind(cmd.tooltip, 'Energy cost %d*') + str = str .. color2incolor(1,1,0) .. stringsub(cmd.tooltip, s + 12, e) .. comma + s, e = stringfind(cmd.tooltip, 'Metal cost %d*') + str = str .. color2incolor(0.53,0.77,0.89) .. stringsub(cmd.tooltip, s + 11, e) .. comma + end + local techReqColors = {color2incolor(1,0.5,0), color2incolor(0,0.8,1), color2incolor(1,0,1), color2incolor(0,1,0)} + if showTechReq and cmd.disabled then + if stringfind(cmd.tooltip, 'Requires') and not stringfind(cmd.tooltip, 'Provides') then + local s, e = stringfind(cmd.tooltip, 'tech%d*') + if s then + local techLevel = stringsub(cmd.tooltip, s + 4, e) + str = techReqColors[tonumber(techLevel) + 1] .. "T" .. techLevel .. '\n' .. str + end + end + end + if str ~= '' then + if (not chiliCache['costLabel' .. cmd.id]) then + chiliCache['costLabel' .. cmd.id] = Label:New{ + name = 'costLabel' .. cmd.id, + parent = image, + x = '5%', bottom = '5%', + valign = 'bottom', + --caption = metalCost .. line .. energyCost, + font = { + size = Config.labels.costFontSize, + outline = true, shadow = true, + outlineWidth = 4, outlineWeight = 4, + }, + } + end + chiliCache['costLabel' .. cmd.id]:SetCaption(str:sub(1, -2)) + elseif chiliCache['costLabel' .. cmd.id] then + chiliCache['costLabel' .. cmd.id]:SetCaption(str) + end + + if showHotkeys and widgetHandler.orderList["EvoRTS Build Hotkeys"] and widgetHandler.orderList["EvoRTS Build Hotkeys"] ~= 0 then + if nameToKeySymbols[cmd.name] then + if not chiliCache['hotkeyLabel' .. cmd.id] then + chiliCache['hotkeyLabel' .. cmd.id] = Label:New{ + name = 'hotkeyLabel' .. cmd.id, + parent = image, + x = '5%', y = '5%', + valign = 'top', + --caption = metalCost .. line .. energyCost, + font = { + size = Config.labels.costFontSize, + outline = true, shadow = true, + outlineWidth = 4, outlineWeight = 4, + }, + } + end + -- chiliCache['hotkeyLabel' .. cmd.id]:SetCaption(color2incolor(1,1,1) .. nameToKeySymbols[cmd.name]) + local function updateLabel() + local str = color2incolor(1,1,1) + local leng = #nameToKeySymbols[cmd.name] + local getLengKeysPressed = WG.buildHotkeys and #WG.buildHotkeys.keysPressed or 0 + local matching = true + for i = 1, leng do + if i <= getLengKeysPressed and matching then + if nameToKeySymbols[cmd.name][i] == WG.buildHotkeys.keysPressed[i] then str = str .. color2incolor(0,1,0) + else matching = false end + end + str = str .. nameToKeySymbols[cmd.name][i] + if i < leng then str = str .. color2incolor(1,1,1) .. ' + ' end + end + chiliCache['hotkeyLabel' .. cmd.id]:SetCaption(str) + end + chiliCache['hotkeyLabel' .. cmd.id].updateLabel = updateLabel + updateLabel() + hotkeyLabels[cmd.id] = chiliCache['hotkeyLabel' .. cmd.id] + end + elseif chiliCache['hotkeyLabel' .. cmd.id] then + chiliCache['hotkeyLabel' .. cmd.id].updateLabel = nil + chiliCache['hotkeyLabel' .. cmd.id]:SetCaption('') + end + + applyHighlightHandler(image, cmd) + buildGrid:AddChild(image) + end --addBuildCommand + +local function processCommand(cmd) + if UnitDefNames[cmd.name] then return 3 + elseif #cmd.params > 1 then return 1 + else return 2 end +end --processCommand + +local lastCommands +local function processAllCommands(flush) + if (deepEquals(lastCommands, widgetHandler.commands)) and not flush then + return + end + lastCommands = widgetHandler.commands + + buildGrid:ClearChildren() + orderGrid:ClearChildren() + --chiliCache = {} -- clears all cached chili elements + + local haveCmd = 0 + local commands = { [1] = {}, [2] = {}, [3] = {} } + for _,cmd in ipairs(lastCommands) do + if cmd.name ~= '' and not (Config.hiddenCMDs[cmd.name] or Config.hiddenCMDs[cmd.action]) then + local grid = processCommand(cmd) + haveCmd = mathmax(haveCmd, grid) + commands[grid][#commands[grid]+1] = cmd + end + end + + local gridFunc = { [1] = addStateCommand, [2] = addOrderCommand, [3] = addBuildCommand } + for grid,cmds in ipairs(commands) do + for i = 1, #cmds do gridFunc[grid](cmds[i]) end + end + + orderGrid.updateGrid() + buildGrid.updateGrid() + + if haveCmd > 0 and orderWindow.hidden then orderWindow:Show() + elseif haveCmd == 0 and orderWindow.visible then orderWindow:Hide() end + if haveCmd > 2 and buildWindow.hidden then buildWindow:Show() + elseif haveCmd <= 2 and buildWindow.visible then buildWindow:Hide() end +end --processAllCommands + +local function updateSelection() + tooltip = nil + local _,cmdID = sGetActiveCommand() + for _, bt in ipairs(buildGrid.children) do + if bt.updateSelection then bt.updateSelection(cmdID) end + end + for _, bt in ipairs(orderGrid.children) do + if bt.updateSelection then bt.updateSelection(cmdID) end + end +end --updateSelection +local function updateLabel() + for _, label in pairs(hotkeyLabels) do + if label.updateLabel then label.updateLabel() end + end +end --updateLabel + +local function OverrideDefaultMenu() + local function layoutHandler(xIcons, yIcons, cmdCount, commands) + widgetHandler.commands = commands + widgetHandler.commands.n = cmdCount + widgetHandler:CommandsChanged() + local customCmds = widgetHandler.customCommands + return '', xIcons, yIcons, {}, customCmds, {}, {}, {}, {}, {}, {[1337]=9001} + end + widgetHandler:ConfigLayoutHandler(layoutHandler) + sForceLayoutUpdate() +end --OverrideDefaultMenu +-------------------------------------------------------------------------------- +function widget:Initialize() + if not WG.Chili then + widgetHandler:RemoveWidget() + return + end + OverrideDefaultMenu() + + Chili = WG.Chili + Window = Chili.Window + Grid = Chili.Grid + Image = Chili.Image + Button = Chili.Button + Label = Chili.Label + ScrollPanel = Chili.ScrollPanel + color2incolor = Chili.color2incolor + + btWidth = processRelativeCoord(Config.ordermenu.width, vsx/Config.ordermenu.columns) + + InitializeControls() +end --Initialize + +function widget:CommandsChanged() + updateRequired = true +end --CommandsChanged + +function widget:Update() + if WG['topbar'] and WG['topbar'].showingQuit() then + return + end + if updateRequired then + processAllCommands() + updateRequired = false + end + updateSelection() + + if WG.buildHotkeys and WG.buildHotkeys.hasUpdated then + updateLabel() + WG.buildHotkeys.hasUpdated = false + end + if WG.buildOrderUI and WG.buildOrderUI.updateConfigInt then + WG.buildOrderUI.updateConfigInt = false + showCost = sGetConfigInt("evo_showcost", 1) == 1 + showTechReq = sGetConfigInt("evo_showtechreq", 1) == 1 + showHotkeys = sGetConfigInt("evo_showhotkeys", 1) == 1 + processAllCommands(true) + end +end --Update + +function widget:WorldTooltip(ttType,data1,data2,data3) + return tooltip +end --WorldTooltip + +function widget:ViewResize(newX,newY) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + if Config then + Config.labels = { + captionFontMaxSize = fontSize, + queueFontSize = fontSize, --32 (MaDDoX) + costFontSize = fontSize, + } + end + -- TODO: implement config for this resize and make a reusable helper function to handle it + Config.buildmenu.height = buildWindow.width * (Config.buildmenu.rows / Config.buildmenu.columns) + buildWindow:SetPos(nil, nil, nil,Config.buildmenu.height) +end --ViewResize + +function widget:Shutdown() + orderWindow:Dispose() + buildWindow:Dispose() + widgetHandler:ConfigLayoutHandler(nil) + chiliCache = nil + sForceLayoutUpdate() +end --Shutdown diff --git a/LuaUI/Widgets_Evo/gui_chili_endgraph.lua b/LuaUI/Widgets_Evo/gui_chili_endgraph.lua index ac67570dc..420e05c4f 100644 --- a/LuaUI/Widgets_Evo/gui_chili_endgraph.lua +++ b/LuaUI/Widgets_Evo/gui_chili_endgraph.lua @@ -492,19 +492,19 @@ function loadWindow() if WG.BarMenu then WG.BarMenu.AddControl('Graph', control0) else - Chili.Button:New{ - parent = control0, - caption = 'Quit', - right = 0, - y = 0, - width = 50, - height = 25, - OnMouseUp = { - function() - Spring.SendCommands{'QuitForce'} - end - }, - } + -- Chili.Button:New{ + -- parent = control0, + -- caption = 'Quit', + -- right = 0, + -- y = 0, + -- width = 50, + -- height = 25, + -- OnMouseUp = { + -- function() + -- Spring.SendCommands{'QuitForce'} + -- end + -- }, + -- } Chili.Window:New{ parent = Chili.Screen0, x = '20%', diff --git a/LuaUI/Widgets_Evo/gui_clearmapmarks.lua b/LuaUI/Widgets_Evo/gui_clearmapmarks.lua new file mode 100644 index 000000000..832a607e4 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_clearmapmarks.lua @@ -0,0 +1,143 @@ +function widget:GetInfo() + return { + name = "Clearmapmarks button", + desc = "clears mapmarks, located next to advplayerlist", + author = "Floris", + date = "24 july 2016", + license = "GNU GPL, v2 or later", + layer = -3, -- set to -5 to draw mascotte on top of advplayerlist + enabled = true + } +end + +local iconTexture = ":n:LuaUI/Images/mapmarksfx/eraser.dds" +local iconSize = 19 + +local glTranslate = gl.Translate +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix + +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +local drawlist = {} +local xPos = 0 +local yPos = 0 + +local mouseover = false + +local usedImgSize = iconSize + +--------------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------------- + +local function RectQuad(px,py,sx,sy) + local o = 0.008 -- texture offset, because else grey line might show at the edges + gl.TexCoord(o,1-o) + gl.Vertex(px, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx, py, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) +end + +function DrawRect(px,py,sx,sy) + gl.BeginEnd(GL.QUADS, RectQuad, px,py,sx,sy) +end + +local function createList(size) + if drawlist[1] ~= nil then + glDeleteList(drawlist[1]) + end + drawlist[1] = glCreateList( function() + gl.Texture(iconTexture) + DrawRect(-usedImgSize, 0, 0, usedImgSize) + gl.Texture(false) + end) + if WG['tooltip'] ~= nil then + WG['tooltip'].AddTooltip('clearmapmarks', {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}, "clear mapmarks/drawings") + end +end + +local advplayerlistPos = {} +function updatePosition(force) + if (WG['advplayerlist_api'] ~= nil) then + local prevPos = advplayerlistPos + advplayerlistPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + usedImgSize = iconSize * advplayerlistPos[5] + if advplayerlistPos[6] == nil or advplayerlistPos[6] then + xPos = advplayerlistPos[2] - (5.3*advplayerlistPos[5]) + else + xPos = advplayerlistPos[4] + (5.3*advplayerlistPos[5]) + usedImgSize + end + yPos = advplayerlistPos[3] + if advplayerlistPos[3] < 0 then + yPos = 0 + end + yPos = yPos + (4*advplayerlistPos[5]) + if (prevPos[1] == nil or prevPos[1] ~= advplayerlistPos[1] or prevPos[2] ~= advplayerlistPos[2] or prevPos[5] ~= advplayerlistPos[5]) or force then + createList(usedImgSize) + end + end +end + +function widget:Initialize() + updatePosition() +end + +function widget:Shutdown() + if drawlist[1] ~= nil then + glDeleteList(drawlist[1]) + end +end + +local sec = 0 +function widget:Update(dt) + sec = sec + dt + if sec > 0.5 then + sec = 0 + updatePosition() + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if drawlist[1] ~= nil then + local mx,my = Spring.GetMouseState() + glPushMatrix() + glTranslate(xPos, yPos, 0) + if isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then + gl.Color(1,1,1,1) + else + gl.Color(0.96,0.96,0.96,0.92) + end + glCallList(drawlist[1]) + glPopMatrix() + end +end + +function isInBox(mx, my, box) + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] +end + +function widget:MousePress(mx, my, mb) + if mb == 1 and isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then + return true + end +end + +function widget:MouseRelease(mx, my, mb) + if mb == 1 and isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then + Spring.SendCommands({"clearmapmarks"}) + updatePosition(true) + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_com_nametags.lua b/LuaUI/Widgets_Evo/gui_com_nametags.lua index d4396afca..f802fb8ac 100644 --- a/LuaUI/Widgets_Evo/gui_com_nametags.lua +++ b/LuaUI/Widgets_Evo/gui_com_nametags.lua @@ -5,7 +5,7 @@ function widget:GetInfo() author = "Bluestone, Floris", date = "20 february 2015", license = "GNU GPL, v2 or later", - layer = 2, + layer = -2, enabled = true, -- loaded by default? } end @@ -14,6 +14,7 @@ end -- config -------------------------------------------------------------------------------- +local drawForIcon = true -- note that commander icon still gets drawn on top of the name local nameScaling = true local useThickLeterring = true local heightOffset = 50 @@ -22,44 +23,49 @@ local scaleFontAmount = 120 local fontShadow = true -- only shows if font has a white outline local shadowOpacity = 0.35 -local font = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", 55, 10, 10) -local shadowFont = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", 55, 38, 1.6) +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 50 +local fontfileOutlineSize = 10 +local fontfileOutlineStrength = 10 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local shadowFont = gl.LoadFont(fontfile, fontfileSize*fontfileScale, 35*fontfileScale, 1.6) +local fontfileScale2 = fontfileScale * 0.66 +local fonticon = gl.LoadFont(fontfile, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength*0.33) +local singleTeams = false +if #Spring.GetTeamList()-1 == #Spring.GetAllyTeamList()-1 then + singleTeams = true +end + +local spec = Spring.GetSpectatingState() -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local GetUnitTeam = Spring.GetUnitTeam -local GetTeamInfo = Spring.GetTeamInfo local GetPlayerInfo = Spring.GetPlayerInfo local GetPlayerList = Spring.GetPlayerList local GetTeamColor = Spring.GetTeamColor -local GetVisibleUnits = Spring.GetVisibleUnits local GetUnitDefID = Spring.GetUnitDefID local GetAllUnits = Spring.GetAllUnits local IsUnitInView = Spring.IsUnitInView local GetCameraPosition = Spring.GetCameraPosition local GetUnitPosition = Spring.GetUnitPosition -local GetFPS = Spring.GetFPS -local GetSpectatingState = Spring.GetSpectatingState local glDepthTest = gl.DepthTest local glAlphaTest = gl.AlphaTest local glColor = gl.Color -local glText = gl.Text local glTranslate = gl.Translate local glBillboard = gl.Billboard local glDrawFuncAtUnit = gl.DrawFuncAtUnit -local glDrawListAtUnit = gl.DrawListAtUnit local GL_GREATER = GL.GREATER local GL_SRC_ALPHA = GL.SRC_ALPHA local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA local glBlending = gl.Blending local glScale = gl.Scale -local glCreateList = gl.CreateList -local glBeginEnd = gl.BeginEnd -local glDeleteList = gl.DeleteList local glCallList = gl.CallList local diag = math.diag @@ -67,9 +73,27 @@ local diag = math.diag -------------------------------------------------------------------------------- local comms = {} -local drawShadow = fontShadow local comnameList = {} +local comnameIconList = {} +local drawScreenUnits = {} local CheckedForSpec = false +local myTeamID = Spring.GetMyTeamID() +local myPlayerID = Spring.GetMyPlayerID() + +local comDefs = {} +for unitDefID, defs in pairs(UnitDefs) do + --For some reason spring throws errors if I write these statements in short form, so here I am being overly specific + if defs.customParams.iscommander and defs.customParams.shownametag == false then + + elseif defs.customParams.iscommander and defs.customParams.shownametag == nil or defs.customParams.iscommander and defs.customParams.shownametag == true then + comDefs[unitDefID] = true + end +end + +local sameTeamColors = false +if WG['playercolorpalette'] ~= nil and WG['playercolorpalette'].getSameTeamColors ~= nil then + sameTeamColors = WG['playercolorpalette'].getSameTeamColors() +end -------------------------------------------------------------------------------- @@ -79,18 +103,25 @@ local function GetCommAttributes(unitID, unitDefID) if team == nil then return nil end - local players = GetPlayerList(team) - local name = (#players>0) and GetPlayerInfo(players[1]) or 'Evil Machine' - for _,pID in ipairs(players) do - local pname,active,spec = GetPlayerInfo(pID) - if active and not spec then - name = pname - break + + local name = '' + if Spring.GetGameRulesParam('ainame_'..team) then + name = Spring.GetGameRulesParam('ainame_'..team)..' (AI)' + else + local players = GetPlayerList(team) + name = (#players>0) and GetPlayerInfo(players[1],false) or '------' + for _,pID in ipairs(players) do + local pname,active,isspec = GetPlayerInfo(pID,false) + if active and not isspec then + name = pname + break + end end end + local r, g, b, a = GetTeamColor(team) local bgColor = {0,0,0,1} - if (r + g*1.35 + b*0.5) < 0.75 then -- not acurate (enough) with playerlist but... font:SetAutoOutlineColor(true) doesnt seem to work + if (r + g*1.2 + b*0.4) < 0.8 then -- try to keep these values the same as the playerlist bgColor = {1,1,1,1} end @@ -98,10 +129,24 @@ local function GetCommAttributes(unitID, unitDefID) return {name, {r, g, b, a}, height, bgColor} end +local function RemoveLists() + for name, list in pairs(comnameList) do + gl.DeleteList(comnameList[name]) + end + for name, list in pairs(comnameIconList) do + gl.DeleteList(comnameIconList[name]) + end + comnameList = {} + comnameIconList = {} +end + local function createComnameList(attributes) + if comnameList[attributes[1]] ~= nil then + gl.DeleteList(comnameList[attributes[1]]) + end comnameList[attributes[1]] = gl.CreateList( function() local outlineColor = {0,0,0,1} - if (attributes[2][1] + attributes[2][2]*1.35 + attributes[2][3]*0.5) < 0.8 then + if (attributes[2][1] + attributes[2][2]*1.2 + attributes[2][3]*0.4) < 0.8 then -- try to keep these values the same as the playerlist outlineColor = {1,1,1,1} end if useThickLeterring then @@ -128,7 +173,49 @@ local function createComnameList(attributes) end) end -local function DrawName(unitID, attributes, shadow) +local sec = 0 +function widget:Update(dt) + sec = sec + dt + if WG['playercolorpalette'] ~= nil then + if WG['playercolorpalette'].getSameTeamColors and sameTeamColors ~= WG['playercolorpalette'].getSameTeamColors() then + sameTeamColors = WG['playercolorpalette'].getSameTeamColors() + RemoveLists() + CheckAllComs() + sec = 0 + end + elseif sameTeamColors == true then + sameTeamColors = false + RemoveLists() + CheckAllComs() + sec = 0 + end + if not singleTeams and WG['playercolorpalette'] ~= nil and WG['playercolorpalette'].getSameTeamColors() then + if myTeamID ~= Spring.GetMyTeamID() then + -- old + local name = GetPlayerInfo(select(2,Spring.GetTeamInfo(myTeamID,false)),false) + if comnameList[name] ~= nil then + gl.DeleteList(comnameList[name]) + comnameList[name] = nil + end + -- new + myTeamID = Spring.GetMyTeamID() + myPlayerID = Spring.GetMyPlayerID() + name = GetPlayerInfo(select(2,Spring.GetTeamInfo(myTeamID,false)),false) + if comnameList[name] ~= nil then + gl.DeleteList(comnameList[name]) + comnameList[name] = nil + end + CheckAllComs() + sec = 0 + end + end + if not spec and sec > 1.5 then + sec = 0 + CheckAllComs() + end +end + +local function DrawName(attributes) if comnameList[attributes[1]] == nil then createComnameList(attributes) end @@ -138,22 +225,79 @@ local function DrawName(unitID, attributes, shadow) glScale(usedFontSize/fontSize,usedFontSize/fontSize,usedFontSize/fontSize) end glCallList(comnameList[attributes[1]]) - + if nameScaling then glScale(1,1,1) end end -local vsx, vsy = Spring.GetViewGeometry() function widget:ViewResize() vsx,vsy = Spring.GetViewGeometry() + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + RemoveLists() + CheckAllComs() + fontfileScale = newFontfileScale + fontfileScale2 = fontfileScale * 0.66 + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + shadowFont = gl.LoadFont(fontfile, fontfileSize*fontfileScale, 35*fontfileScale, 1.6) + fonticon = gl.LoadFont(fontfile, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength*0.33) + end +end + +local function createComnameIconList(unitID, attributes) + if comnameIconList[attributes[1]] ~= nil then + gl.DeleteList(comnameIconList[attributes[1]]) + end + comnameIconList[attributes[1]] = gl.CreateList( function() + local x,y,z = GetUnitPosition(unitID) + x,z = Spring.WorldToScreenCoords(x, y, z) + + local outlineColor = {0,0,0,1} + if (attributes[2][1] + attributes[2][2]*1.2 + attributes[2][3]*0.4) < 0.8 then -- try to keep these values the same as the playerlist + outlineColor = {1,1,1,1} + end + fonticon:Begin() + fonticon:SetTextColor(attributes[2]) + fonticon:SetOutlineColor(outlineColor) + fonticon:Print(attributes[1], 0, 0, fontSize*1.9, "con") + fonticon:End() + end) +end + +function widget:DrawScreenEffects() -- using DrawScreenEffects so that guishader will blur it when needed + if Spring.IsGUIHidden() then return end + + for unitID, attributes in pairs(drawScreenUnits) do + if not comnameIconList[attributes[1]] then + createComnameIconList(unitID, attributes) + end + local x,y,z = GetUnitPosition(unitID) + x,z = Spring.WorldToScreenCoords(x, y+50+heightOffset, z) + local scale = 1-(attributes[5]/25000) + if scale < 0.5 then scale = 0.5 end + gl.PushMatrix() + gl.Translate(x,z,0) + gl.Scale(scale,scale,scale) + gl.CallList(comnameIconList[attributes[1]]) + gl.PopMatrix() + end + drawScreenUnits = {} +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawWorld() + if chobbyInterface then return end if Spring.IsGUIHidden() then return end -- untested fix: when you resign, to also show enemy com playernames (because widget:PlayerChanged() isnt called anymore) if not CheckedForSpec and Spring.GetGameFrame() > 1 then - if GetSpectatingState() then + if spec then CheckedForSpec = true CheckAllComs() end @@ -164,17 +308,21 @@ function widget:DrawWorld() glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) local camX, camY, camZ = GetCameraPosition() - + for unitID, attributes in pairs(comms) do -- calc opacity if IsUnitInView(unitID) then local x,y,z = GetUnitPosition(unitID) camDistance = diag(camX-x, camY-y, camZ-z) - - usedFontSize = (fontSize*0.5) + (camDistance/scaleFontAmount) - - glDrawFuncAtUnit(unitID, false, DrawName, unitID, attributes, fontShadow) + + if drawForIcon and Spring.IsUnitIcon(unitID) then + attributes[5] = camDistance + drawScreenUnits[unitID] = attributes + else + usedFontSize = (fontSize*0.5) + (camDistance/scaleFontAmount) + glDrawFuncAtUnit(unitID, false, DrawName, attributes) + end end end @@ -185,8 +333,10 @@ end -------------------------------------------------------------------------------- + + function CheckCom(unitID, unitDefID, unitTeam) - if (unitDefID and UnitDefs[unitDefID] and UnitDefs[unitDefID].customParams.iscommander) then + if comDefs[unitDefID] then comms[unitID] = GetCommAttributes(unitID, unitDefID) end end @@ -195,18 +345,31 @@ function CheckAllComs() local allUnits = GetAllUnits() for _, unitID in pairs(allUnits) do local unitDefID = GetUnitDefID(unitID) - if (unitDefID and UnitDefs[unitDefID].customParams.iscommander) then + if comDefs[unitDefID] then comms[unitID] = GetCommAttributes(unitID, unitDefID) end end end function widget:Initialize() - CheckAllComs() + WG['nametags'] = {} + WG['nametags'].getDrawForIcon = function() + return drawForIcon + end + WG['nametags'].setDrawForIcon = function(value) + drawForIcon = value + end + CheckAllComs() +end + +function widget:Shutdown() + RemoveLists() + gl.DeleteFont(font) end function widget:PlayerChanged(playerID) - local name,_ = GetPlayerInfo(playerID) + spec = Spring.GetSpectatingState() + local name,_ = GetPlayerInfo(playerID,false) comnameList[name] = nil CheckAllComs() -- handle substitutions, etc end @@ -217,14 +380,27 @@ end function widget:UnitDestroyed(unitID, unitDefID, unitTeam) comms[unitID] = nil + + if comnameIconList[unitID] then + gl.DeleteList(comnameIconList[unitID]) + comnameIconList[unitID] = nil + end end function widget:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) CheckCom(unitID, unitDefID, unitTeam) + if comnameIconList[unitID] then + gl.DeleteList(comnameIconList[unitID]) + comnameIconList[unitID] = nil + end end function widget:UnitTaken(unitID, unitDefID, unitTeam, newTeam) CheckCom(unitID, unitDefID, unitTeam) + if comnameIconList[unitID] then + gl.DeleteList(comnameIconList[unitID]) + comnameIconList[unitID] = nil + end end function widget:UnitEnteredLos(unitID, unitDefID, unitTeam) @@ -238,13 +414,17 @@ end function widget:GetConfigData() return { - nameScaling = nameScaling + nameScaling = nameScaling, + drawForIcon = drawForIcon } end function widget:SetConfigData(data) --load config widgetHandler:AddAction("comnamescale", toggleNameScaling) - if data.nameScaling ~= nil then - nameScaling = data.nameScaling - end + if data.nameScaling ~= nil then + nameScaling = data.nameScaling + end + if data.drawForIcon ~= nil then + drawForIcon = data.drawForIcon + end end diff --git a/LuaUI/Widgets_Evo/gui_commands_fx.lua b/LuaUI/Widgets_Evo/gui_commands_fx.lua index aa8c34476..1e01ed01f 100644 --- a/LuaUI/Widgets_Evo/gui_commands_fx.lua +++ b/LuaUI/Widgets_Evo/gui_commands_fx.lua @@ -57,14 +57,18 @@ local glTexCoord = gl.TexCoord local glUnit = gl.Unit local GL_QUADS = GL.QUADS - -------------------------------------------------------------------------------- +local GaiaTeamID = Spring.GetGaiaTeamID() + +-------------------------------------------------------------------------------- -- Config -------------------------------------------------------------------------------- +local filterAIteams = true + local drawBuildQueue = true local drawLineTexture = true local drawUnitHighlight = true -local drawUnitHighlightSkipFPS = 10 -- (0 to disable) skip drawing when framerate gets below this value +local drawUnitHighlightSkipFPS = 13 -- (0 to disable) skip drawing when framerate gets below this value local opacity = 1 local duration = 2.6 @@ -76,18 +80,19 @@ local lineWidthEnd = 0.85 -- multiplier local lineTextureLength = 4 local lineTextureSpeed = 2.4 -local groundGlow = true +local groundGlow = true local glowRadius = 26 local glowDuration = 0.5 local glowOpacity = 0.11 -- limit amount of effects to keep performance sane -local maxCommandCount = 400 -local maxGroundGlowCount = 50 +local maxCommandCount = 500 -- dont draw more commands than this amount, but keep processing them +local maxTotalCommandCount = 850 -- dont add more commands above this amount +local maxGroundGlowCount = 50 local drawUnitHightlightMaxUnits = 70 local glowImg = ":n:LuaUI/Images/commandsfx/glow.dds" -local lineImg = ":n:LuaUI/Images/commandsfx/line2.dds" +local lineImg = ":n:LuaUI/Images/commandsfx/line.dds" local ignoreUnits = {} for udefID,def in ipairs(UnitDefs) do @@ -197,10 +202,12 @@ local CONFIG = { -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local enabledTeams = {} local commands = {} local monitorCommands = {} local minQueueCommand = 1 local maxCommand = 0 +local totalCommands = 0 local unitCommand = {} -- most recent key in command table of order for unitID local osClock @@ -212,7 +219,7 @@ local drawFrame = 0 local gameframeDrawFrame = 0 local spGetUnitPosition = Spring.GetUnitPosition -local spGetUnitCommands = Spring.GetUnitCommands +local spGetCommandQueue = Spring.GetCommandQueue local spIsUnitInView = Spring.IsUnitInView local spIsSphereInView = Spring.IsSphereInView local spIsUnitIcon = Spring.IsUnitIcon @@ -266,7 +273,6 @@ end local function setCmdLineColors(alpha) - spLoadCmdColorsConfig('move 0.5 1.0 0.5 '..alpha) spLoadCmdColorsConfig('attack 1.0 0.2 0.2 '..alpha) spLoadCmdColorsConfig('fight 0.5 0.5 1.0 '..alpha) @@ -285,6 +291,16 @@ local function setCmdLineColors(alpha) spLoadCmdColorsConfig('deathWatch 0.5 0.5 0.5 '..alpha) end +function resetEnabledTeams() + enabledTeams = {} + local t = Spring.GetTeamList() + for _,teamID in ipairs(t) do + if not filterAIteams or not select(4,Spring.GetTeamInfo(teamID,false)) then + enabledTeams[teamID] = true + end + end +end + function widget:Initialize() --SetUnitConf() @@ -293,10 +309,25 @@ function widget:Initialize() spLoadCmdColorsConfig('queueIconAlpha 0.5 ') setCmdLineColors(0.5) + resetEnabledTeams() + + WG['commandsfx'] = {} + WG['commandsfx'].getOpacity = function() + return opacity + end + WG['commandsfx'].setOpacity = function(value) + opacity = value + end + WG['commandsfx'].getFilterAI = function() + return filterAIteams + end + WG['commandsfx'].setFilterAI = function(value) + filterAIteams = value + resetEnabledTeams() + end end function widget:Shutdown() - --spLoadCmdColorsConfig('useQueueIcons 1 ') spLoadCmdColorsConfig('queueIconScale 1 ') spLoadCmdColorsConfig('queueIconAlpha 1 ') @@ -447,22 +478,29 @@ function RemovePreviousCommand(unitID) end end +local unprocessedCommands = {} +local unprocessedCommandsNum = 0 function addUnitCommand(unitID, unitDefID, cmdID) - -- record that a command was given (note: cmdID is not used, but useful to record for debugging) - if ignoreUnits[unitDefID] then return end - if unitID and (CONFIG[cmdID] or cmdID==CMD_INSERT or cmdID<0) then - maxCommand = maxCommand + 1 - commands[maxCommand] = {ID=cmdID,time=os.clock(),unitID=unitID,draw=false,selected=spIsUnitSelected(unitID),udid=unitDefID} -- command queue is not updated until next gameframe - end + -- record that a command was given (note: cmdID is not used, but useful to record for debugging) + if unitID and (CONFIG[cmdID] or cmdID==CMD_INSERT or cmdID<0) then + unprocessedCommandsNum = unprocessedCommandsNum + 1 + unprocessedCommands[unprocessedCommandsNum] = {ID=cmdID,time=os.clock(),unitID=unitID,draw=false,selected=spIsUnitSelected(unitID),udid=unitDefID} -- command queue is not updated until next gameframe + end end local newUnitCommands = {} function widget:UnitCommand(unitID, unitDefID, teamID, cmdID, _, _) - if newUnitCommands[unitID] == nil then -- only process the first in queue, else when super large queue order is given widget will hog memory and crash - addUnitCommand(unitID, unitDefID, cmdID) - newUnitCommands[unitID] = true - else - newUnitCommands[unitID] = {unitDefID, cmdID} + if enabledTeams[teamID] ~= nil then + if teamID ~= GaiaTeamID or not string.find(UnitDefs[unitDefID].name, "critter_") then + if ignoreUnits[unitDefID] == nil then + if newUnitCommands[unitID] == nil then -- only process the first in queue, else when super large queue order is given widget will hog memory and crash + addUnitCommand(unitID, unitDefID, cmdID) + newUnitCommands[unitID] = true + else + newUnitCommands[unitID] = {unitDefID, cmdID} + end + end + end end end @@ -490,104 +528,111 @@ function ExtractTargetLocation(a,b,c,d,cmdID) end function getCommandsQueue(unitID) - local q = spGetUnitCommands(unitID, 35) or {} --limit to prevent mem leak, hax etc + local q = spGetCommandQueue(unitID, 35) or {} --limit to prevent mem leak, hax etc local our_q = {} - for _,cmd in ipairs(q) do - if CONFIG[cmd.id] or cmd.id < 0 then - if cmd.id < 0 then - cmd.buildingID = -cmd.id; - cmd.id = BUILD - if not cmd.params[4] then - cmd.params[4] = 0 --sometimes the facing param is missing (wtf) + local cmd + for i=1, #q do + if CONFIG[q[i].id] or q[i].id < 0 then + if q[i].id < 0 then + q[i].buildingID = -q[i].id; + q[i].id = BUILD + if not q[i].params[4] then + q[i].params[4] = 0 --sometimes the facing param is missing (wtf) end end - our_q[#our_q+1] = cmd + our_q[#our_q+1] = q[i] end end return our_q end - +local prevGameframe = 0 local sec = 0 local lastUpdate = 0 +local sec2 = 0 +local lastUpdate2 = 0 function widget:Update(dt) sec = sec + dt - if sec > lastUpdate + 0.2 then + if sec > lastUpdate + 0.1 then lastUpdate = sec -- process newly given commands (not done in widgetUnitCommand() because with huge build queue it eats memory and can crash lua) - for i, v in pairs(newUnitCommands) do - if v ~= true then - addUnitCommand(i, v[1], v[2]) + for unitID,v in pairs(newUnitCommands) do + if v ~= true and ignoreUnits[v[1]] == nil then + addUnitCommand(unitID, v[1], v[2]) end end newUnitCommands = {} - - -- update queue (in case unit has reached the nearest queue coordinate) - for i, qsize in pairs(monitorCommands) do - if commands[i] ~= nil then - if commands[i].draw == false then - monitorCommands[i] = nil - else - local q = spGetUnitCommands(commands[i].unitID,35) or {} - if qsize ~= #q then - local our_q = getCommandsQueue(commands[i].unitID) - commands[i].queue = our_q - commands[i].queueSize = #our_q - if qsize > 1 then - monitorCommands[i] = qsize - else - monitorCommands[i] = nil - end - end - end - end - end - - end -end - - -function widget:GameFrame(gameFrame) - if drawFrame == gameframeDrawFrame then - return - end - gameframeDrawFrame = drawFrame - - -- process new commands (cant be done directly because at widget:UnitCommand() the queue isnt updated yet) - for i, v in pairs(commands) do - if v.processed ~= true then - - RemovePreviousCommand(v.unitID) - unitCommand[v.unitID] = i - - -- get pruned command queue - local our_q = getCommandsQueue(v.unitID) - local qsize = #our_q - commands[i].queue = our_q - commands[i].queueSize = qsize - if qsize > 1 then - monitorCommands[i] = qsize - end - if qsize > 0 then - commands[i].highlight = CONFIG[our_q[1].id].colour - commands[i].draw = true - end - - -- get location of final command - local lastCmd = our_q[#our_q] - if lastCmd and lastCmd.params then - local x,y,z = ExtractTargetLocation(lastCmd.params[1],lastCmd.params[2],lastCmd.params[3],lastCmd.params[4],lastCmd.id) - if x then - commands[i].x = x - commands[i].y = y - commands[i].z = z - end - end - commands[i].time = os.clock() - commands[i].processed = true - end + -- process new commands (cant be done directly because at widget:UnitCommand() the queue isnt updated yet) + for k=1, #unprocessedCommands do + if totalCommands <= maxTotalCommandCount then + maxCommand = maxCommand + 1 + local i = maxCommand + commands[i] = unprocessedCommands[k] + totalCommands = totalCommands + 1 + + RemovePreviousCommand(unprocessedCommands[k].unitID) + unitCommand[unprocessedCommands[k].unitID] = i + + -- get pruned command queue + local our_q = getCommandsQueue(unprocessedCommands[k].unitID) + local qsize = #our_q + commands[i].queue = our_q + commands[i].queueSize = qsize + if qsize > 1 then + monitorCommands[i] = qsize + end + if qsize > 0 then + commands[i].highlight = CONFIG[our_q[1].id].colour + commands[i].draw = true + end + + -- get location of final command + local lastCmd = our_q[#our_q] + if lastCmd and lastCmd.params then + local x,y,z = ExtractTargetLocation(lastCmd.params[1],lastCmd.params[2],lastCmd.params[3],lastCmd.params[4],lastCmd.id) + if x then + commands[i].x = x + commands[i].y = y + commands[i].z = z + end + end + commands[i].time = os.clock() + end + end + unprocessedCommands = {} + unprocessedCommandsNum = 0 + + + if sec2 > lastUpdate2 + 0.3 then + lastUpdate2 = sec2 + if prevGameframe ~= Spring.GetGameFrame() then + prevGameframe = Spring.GetGameFrame() + -- update queue (in case unit has reached the nearest queue coordinate) + local qsize + for i=1, #monitorCommands do + if commands[i] ~= nil then + qsize = monitorCommands[i] + if commands[i].draw == false then + monitorCommands[i] = nil + else + local q = spGetCommandQueue(commands[i].unitID,35) or {} + if qsize ~= #q then + local our_q = getCommandsQueue(commands[i].unitID) + commands[i].queue = our_q + commands[i].queueSize = #our_q + if qsize > 1 then + monitorCommands[i] = qsize + else + monitorCommands[i] = nil + end + end + end + end + end + end + end end end @@ -604,8 +649,8 @@ local prevTexOffset = 0 local texOffset = 0 local prevOsClock = os.clock() - function widget:DrawWorldPreUnit() + if chobbyInterface then return end drawFrame = drawFrame + 1 if spIsGUIHidden() then return end @@ -623,40 +668,56 @@ function widget:DrawWorldPreUnit() local groundGlowCount = 0 local commandCount = 0 - for i, v in pairs(commands) do - local progress = (osClock - commands[i].time) / duration - local unitID = commands[i].unitID - - if progress >= 1 and commands[i].processed then - -- remove when duration has passed (also need to check if it was processed yet, because of pausing) - --Spring.Echo("Removing " .. i) - commands[i] = nil - monitorCommands[i] = nil - if unitCommand[unitID] == i then - unitCommand[unitID] = nil - end - elseif commands[i].draw and (spIsUnitInView(unitID) or IsPointInView(commands[i].x,commands[i].y,commands[i].z)) then - local prevX, prevY, prevZ = spGetUnitPosition(unitID) - - -- draw set target command (TODO) - --[[ - if prevX and commands[i].set_target and commands[i].set_target.params and commands[i].set_target.params[1] then - local lineColour = CONFIG[CMD_SET_TARGET].colour - local lineAlpha = opacity * lineColour[4] * (1-progress) - glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) - if commands[i].set_target.params[3] then - glBeginEnd(GL_QUADS, DrawLine, prevX,prevY,prevZ, commands[i].set_target.params[1], commands[i].set_target.params[2], commands[i].set_target.params[3], lineWidth) - else - local x,y,z = spGetUnitPosition(commands[i].set_target.params[1]) - if x then - glBeginEnd(GL_QUADS, DrawLine, prevX,prevY,prevZ, x,y,z, lineWidth) - end - end - end - ]] - - -- draw command queue - if commands[i].queueSize > 0 and prevX and commandCount < maxCommandCount then + local newCommands = {} + local newCommandsCount = 0 + + --for i=1, #commands do + for i, v in pairs(commands) do + local progress = (osClock - commands[i].time) / duration + local unitID = commands[i].unitID + + if progress >= 1 then + -- remove when duration has passed + --Spring.Echo("Removing " .. i) + commands[i] = nil + totalCommands = totalCommands - 1 + monitorCommands[i] = nil + if unitCommand[unitID] == i then + unitCommand[unitID] = nil + end + elseif commands[i].draw and (spIsUnitInView(unitID) or IsPointInView(commands[i].x,commands[i].y,commands[i].z)) then + --newCommandsCount = newCommandsCount + 1 + --newCommands[newCommandsCount] = commands[i] + --unitCommand[unitID] = newCommandsCount + --if monitorCommands[i] then + -- monitorCommands[newCommandsCount] = monitorCommands[i] + -- if i ~= newCommandsCount then + -- monitorCommands[i] = nil + -- end + --end + + local prevX, prevY, prevZ = spGetUnitPosition(unitID) + + -- draw set target command (TODO) + --[[ + if prevX and commands[i].set_target and commands[i].set_target.params and commands[i].set_target.params[1] then + local lineColour = CONFIG[CMD_SET_TARGET].colour + local lineAlpha = opacity * lineColour[4] * (1-progress) + glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) + if commands[i].set_target.params[3] then + glBeginEnd(GL_QUADS, DrawLine, prevX,prevY,prevZ, commands[i].set_target.params[1], commands[i].set_target.params[2], commands[i].set_target.params[3], lineWidth) + else + local x,y,z = spGetUnitPosition(commands[i].set_target.params[1]) + if x then + glBeginEnd(GL_QUADS, DrawLine, prevX,prevY,prevZ, x,y,z, lineWidth) + end + end + end + ]] + + -- draw command queue + if commands[i].queueSize > 0 and prevX and commandCount < maxCommandCount then + local lineAlphaMultiplier = 1 - (progress / lineDuration) for j=1,commands[i].queueSize do local X,Y,Z = ExtractTargetLocation(commands[i].queue[j].params[1], commands[i].queue[j].params[2], commands[i].queue[j].params[3], commands[i].queue[j].params[4], commands[i].queue[j].id) @@ -725,19 +786,28 @@ function widget:DrawWorldPreUnit() glTexture(false) end - end - prevX, prevY, prevZ = X, Y, Z - end - end - end - end - end + end + prevX, prevY, prevZ = X, Y, Z + end + end + end + end + end + --commands = newCommands + --maxCommand = #commands + --newCommands = nil glColor(1,1,1,1) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end function widget:DrawWorld() + if chobbyInterface then return end if spIsGUIHidden() then return end if drawUnitHighlightSkipFPS > 0 and spGetFPS() < drawUnitHighlightSkipFPS then return end @@ -748,7 +818,7 @@ function widget:DrawWorld() gl.PolygonOffset(-2, -2) gl.Blending(GL_SRC_ALPHA, GL_ONE) local highlightUnitCounter = 0 - for i, v in pairs(commands) do + for i,_ in pairs(commands) do if commands[i].draw and commands[i].highlight and not spIsUnitIcon(commands[i].unitID) then local progress = (osClock - commands[i].time) / duration glColor(commands[i].highlight[1],commands[i].highlight[2],commands[i].highlight[3],0.08*(1-progress)) @@ -763,4 +833,17 @@ function widget:DrawWorld() gl.PolygonOffset(false) gl.DepthTest(false) end +end + + +function widget:GetConfigData(data) + savedTable = {} + savedTable.opacity = opacity + savedTable.filterAIteams = filterAIteams + return savedTable +end + +function widget:SetConfigData(data) + if data.opacity ~= nil then opacity = data.opacity end + if data.filterAIteams ~= nil then filterAIteams = data.filterAIteams end end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_commands_info.lua b/LuaUI/Widgets_Evo/gui_commands_info.lua new file mode 100644 index 000000000..684f58be3 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_commands_info.lua @@ -0,0 +1,521 @@ + +function widget:GetInfo() +return { + name = "Commands info", + desc = "Leftmouse: scroll down, Rightmouse: scroll up, ctrl/shift/alt combi: speedup)", + author = "Floris", + date = "August 2015", + license = "Dental flush", + layer = -99990, + enabled = true, +} +end + +--local show = true + +local loadedFontSize = 32 + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfileScale2 = fontfileScale * 1.2 +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) + +local bgcorner = "LuaUI/Images/bgcorner.png" + +local changelogFile = VFS.LoadFile("commandlist.txt") + +local bgMargin = 6 + +local closeButtonSize = 30 +local screenHeight = 520-bgMargin-bgMargin +local screenWidth = 1050-bgMargin-bgMargin + +local textareaMinLines = 10 -- wont scroll down more, will show at least this amount of lines + +local customScale = 1 + +local startLine = 1 + +local vsx,vsy = Spring.GetViewGeometry() +local screenX = (vsx*0.5) - (screenWidth/2) +local screenY = (vsy*0.5) + (screenHeight/2) + +local spIsGUIHidden = Spring.IsGUIHidden +local showHelp = false + +local glColor = gl.Color +local glLineWidth = gl.LineWidth +local glPolygonMode = gl.PolygonMode +local glRect = gl.Rect +local glText = gl.Text +local glShape = gl.Shape +local glGetTextWidth = gl.GetTextWidth +local glGetTextHeight = gl.GetTextHeight + +local bgColorMultiplier = 0 + +local glCreateList = gl.CreateList +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList + +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glTranslate = gl.Translate +local glScale = gl.Scale + +local GL_FILL = GL.FILL +local GL_FRONT_AND_BACK = GL.FRONT_AND_BACK +local GL_LINE_STRIP = GL.LINE_STRIP + +local widgetScale = 1 +local vsx, vsy = Spring.GetViewGeometry() + +local changelogLines = {} +local totalChangelogLines = 0 + +function widget:ViewResize() + vsx,vsy = Spring.GetViewGeometry() + screenX = (vsx*0.5) - (screenWidth/2) + screenY = (vsy*0.5) + (screenHeight/2) + widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + fontfileScale2 = fontfileScale * 1.2 + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) + end + if changelogList then gl.DeleteList(changelogList) end + changelogList = gl.CreateList(DrawWindow) +end + +local myTeamID = Spring.GetMyTeamID() + +local showOnceMore = false -- used because of GUI shader delay + +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, py+cs, 0) + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, py+cs, 0) + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) + gl.Texture(false) +end + + +function DrawTextarea(x,y,width,height,scrollbar) + local scrollbarOffsetTop = 18 -- note: wont add the offset to the bottom, only to top + local scrollbarOffsetBottom = 12 -- note: wont add the offset to the top, only to bottom + local scrollbarMargin = 10 + local scrollbarWidth = 8 + local scrollbarPosWidth = 4 + local scrollbarPosMinHeight = 8 + local scrollbarBackgroundColor = {0,0,0,0.24 } + local scrollbarBarColor = {1,1,1,0.08} + + local fontSizeTitle = 17 -- is version number + local fontSizeDate = 13 + local fontSizeLine = 15 + local lineSeparator = 2 + + local fontColorTitle = {1,1,1,1} + local fontColorDate = {0.66,0.88,0.66,1} + local fontColorLine = {0.8,0.77,0.74,1} + local fontColorCommand = {0.86,0.66,0.2,1} + + local textRightOffset = scrollbar and scrollbarMargin+scrollbarWidth+scrollbarWidth or 0 + local maxLines = math.floor((height-5)/fontSizeLine) + + -- textarea scrollbar + if scrollbar then + if (totalChangelogLines > maxLines or startLine > 1) then -- only show scroll above X lines + local scrollbarTop = y-scrollbarOffsetTop-scrollbarMargin-(scrollbarWidth-scrollbarPosWidth) + local scrollbarBottom = y-scrollbarOffsetBottom-height+scrollbarMargin+(scrollbarWidth-scrollbarPosWidth) + local scrollbarPosHeight = math.max(((height-scrollbarMargin-scrollbarMargin) / totalChangelogLines) * ((height-scrollbarMargin-scrollbarMargin) / 25), scrollbarPosMinHeight) + if scrollbarPosHeight > scrollbarTop-scrollbarBottom then scrollbarPosHeight = scrollbarTop-scrollbarBottom end + local scrollbarPos = scrollbarTop + (scrollbarBottom - scrollbarTop) * ((startLine-1) / totalChangelogLines) + scrollbarPos = scrollbarPos + ((startLine-1) / totalChangelogLines) * scrollbarPosHeight -- correct position taking position bar height into account + + -- background + gl.Color(scrollbarBackgroundColor) + RectRound( + x+width-scrollbarMargin-scrollbarWidth, + scrollbarBottom-(scrollbarWidth-scrollbarPosWidth), + x+width-scrollbarMargin, + scrollbarTop+(scrollbarWidth-scrollbarPosWidth), + scrollbarWidth/2 + ) + -- bar + gl.Color(scrollbarBarColor) + RectRound( + x+width-scrollbarMargin-scrollbarWidth + (scrollbarWidth - scrollbarPosWidth), + scrollbarPos, + x+width-scrollbarMargin-(scrollbarWidth - scrollbarPosWidth), + scrollbarPos - (scrollbarPosHeight), + scrollbarPosWidth/2 + ) + end + end + + -- draw textarea + if changelogFile then + font:Begin() + local lineKey = startLine + local j = 1 + while j < maxLines do -- maxlines is not exact, just a failsafe + if (lineSeparator+fontSizeTitle)*j > height then + break; + end + if changelogLines[lineKey] == nil then + break; + end + + local line = changelogLines[lineKey] + if string.find(line, '^/([a-zA-Z0-9]*)') then + local cmd = string.match(line, '^(/[\+a-zA-Z0-9_-]*)') + local line = string.sub(line, string.len(string.match(line, '^/[a-zA-Z0-9_-]*[ \t]*'))) + line, numLines = font:WrapText(line, (width - 90 - textRightOffset)*(loadedFontSize/fontSizeLine)) + if (lineSeparator+fontSizeTitle)*(j+numLines-1) > height then + break; + end + + font:SetTextColor(fontColorCommand) + font:Print(cmd, x+20, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") + + font:SetTextColor(fontColorLine) + font:Print(line, x+230, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") + j = j + (numLines - 1) + else + -- line + font:SetTextColor(fontColorLine) + line = line + line, numLines = font:WrapText(line, (width-50)*(loadedFontSize/fontSizeLine)) + if (lineSeparator+fontSizeTitle)*(j+numLines-1) > height then + break; + end + font:Print(line, x+10, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") + j = j + (numLines - 1) + end + + j = j + 1 + lineKey = lineKey + 1 + end + font:End() + end +end + + +function DrawWindow() + local vsx,vsy = Spring.GetViewGeometry() + local x = screenX --rightwards + local y = screenY --upwards + + -- background + gl.Color(0,0,0,0.8) + RectRound(x-bgMargin,y-screenHeight-bgMargin,x+screenWidth+bgMargin,y+bgMargin,8, 0,1,1,1) + -- content area + gl.Color(0.33,0.33,0.33,0.15) + RectRound(x,y-screenHeight,x+screenWidth,y,6) + + -- close button + local size = closeButtonSize*0.7 + local width = size*0.055 + gl.Color(1,1,1,1) + gl.PushMatrix() + gl.Translate(screenX+screenWidth-(closeButtonSize/2),screenY-(closeButtonSize/2),0) + gl.Rotate(-45,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.Rotate(90,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.PopMatrix() + + -- title + local title = "Commmands" + local titleFontSize = 18 + gl.Color(0,0,0,0.8) + titleRect = {x-bgMargin, y+bgMargin, x+(glGetTextWidth(title)*titleFontSize)+27-bgMargin, y+37} + RectRound(titleRect[1], titleRect[2], titleRect[3], titleRect[4], 8, 1,1,0,0) + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") + font2:End() + + -- textarea + DrawTextarea(x, y-10, screenWidth, screenHeight-24, 1) +end + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if spIsGUIHidden() then return end + + -- draw the help + if not changelogList then + changelogList = gl.CreateList(DrawWindow) + end + + if show or showOnceMore then + + -- draw the changelog panel + glPushMatrix() + glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) + glScale(widgetScale, widgetScale, 1) + glCallList(changelogList) + glPopMatrix() + if (WG['guishader'] ~= nil) then + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + WG['guishader'].InsertRect(rectX1, rectY2, rectX2, rectY1, 'commandslist') + --WG['guishader'].setBlurIntensity(0.0017) + --WG['guishader'].setScreenBlur(true) + end + showOnceMore = false + + else + if (WG['guishader'] ~= nil) then + local removed = WG['guishader'].RemoveRect('commandslist') + if removed then + --WG['guishader'].setBlurIntensity() + WG['guishader'].setScreenBlur(false) + end + end + end +end + +function widget:KeyPress(key) + if key == 27 then -- ESC + show = false + end +end + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + + -- check if the mouse is in a rectangle + return x >= BLcornerX and x <= TRcornerX + and y >= BLcornerY + and y <= TRcornerY +end + +--function widget:IsAbove(x, y) +-- -- on window +-- if show then +-- local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) +-- local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) +-- local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) +-- local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) +-- return IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) +-- else +-- return false +-- end +--end +-- +--function widget:GetTooltip(mx, my) +-- if show and widget:IsAbove(mx,my) then +-- return string.format( +-- "\255\255\255\1Left mouse\255\255\255\255 on textarea to scroll down.\n".. +-- "\255\255\255\1Right mouse\255\255\255\255 on textarea to scroll up.\n\n".. +-- "Add CTRL or SHIFT to scroll faster, or combine CTRL+SHIFT (+ALT).") +-- end +--end + +function widget:MouseWheel(up, value) + + if show then + local addLines = value*-3 -- direction is retarded + + startLine = startLine + addLines + if startLine < 1 then startLine = 1 end + if startLine > totalChangelogLines - textareaMinLines then startLine = totalChangelogLines - textareaMinLines end + + if changelogList then + glDeleteList(changelogList) + end + + changelogList = gl.CreateList(DrawWindow) + return true + else + return false + end +end + +function widget:MouseMove(x, y) + if show then + -- on window + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + if not IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + + end + end +end + +function widget:MousePress(x, y, button) + return mouseEvent(x, y, button, false) +end + +function widget:MouseRelease(x, y, button) + return mouseEvent(x, y, button, true) +end + +function mouseEvent(x, y, button, release) + if spIsGUIHidden() then return false end + + if show then + -- on window + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + + -- on close button + local brectX1 = rectX2 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) + local brectY2 = rectY1 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) + if IsOnRect(x, y, brectX1, brectY2, rectX2, rectY1) then + if release then + showOnceMore = true -- show once more because the guishader lags behind, though this will not fully fix it + show = not show + end + return true + end + + if button == 1 or button == 3 then + if button == 3 and release then + show = not show + end + return true + end + elseif titleRect == nil or not IsOnRect(x, y, (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2), (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2)) then + if release then + showOnceMore = true -- show once more because the guishader lags behind, though this will not fully fix it + show = false + end + return true + end + end +end + +function lines(str) + local t = {} + local function helper(line) t[#t+1] = line return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t +end + +function widget:Initialize() + if changelogFile then + + WG['commands'] = {} + WG['commands'].toggle = function(state) + if state ~= nil then + show = state + else + show = not show + end + end + WG['commands'].isvisible = function() + return show + end + + -- somehow there are a few characters added at the start that we need to remove + --changelogFile = string.sub(changelogFile, 4) + + -- store changelog into array + changelogLines = lines(changelogFile) + + for i, line in ipairs(changelogLines) do + totalChangelogLines = i + end + + else + Spring.Echo("Commands info: couldn't load the commandslist file") + widgetHandler:RemoveWidget(self) + end +end + +function widget:Shutdown() + if buttonGL then + glDeleteList(buttonGL) + buttonGL = nil + end + if changelogList then + glDeleteList(changelogList) + changelogList = nil + end + gl.DeleteFont(font) + gl.DeleteFont(font2) +end diff --git a/LuaUI/Widgets_Evo/gui_con_locater.lua b/LuaUI/Widgets_Evo/gui_con_locater.lua new file mode 100644 index 000000000..4eb9fe7cd --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_con_locater.lua @@ -0,0 +1,597 @@ +local version = "1.15" + +function widget:GetInfo() + return { + name = "Constructor locater", + desc = "Version " .. version .. ". Shows graphics around your constructors on demand to " .. + "make finding them faster" , + author = "Alcur", + date = "Aug 3, 2012", + license = "BSD 3-clause", + layer = 0, + enabled = true + } +end + +include"keysym.h.lua" + + + + + +-- options begin + +-- how many sides the marker "circles" will have +local circleDivs = 32 + +-- how fast the constructor-indicating graphics blink +local aniSpeedMultiplier = 4 + +-- color 1 for the constructor-indicating graphics +local red1 = 1 +local green1 = 1 +local blue1 = 0 + +-- color 2 for the constructor-indicating graphics +local red2 = 0 +local green2 = 1 +local blue2 = 0 + +-- if the camera aka. in-game view is below this height the constructor-indicating graphics +-- are disabled +local minActivationHeight = 1000 + +-- if the camera is above this height the constructor-indicating graphics are shown. +-- Type "false" or "nil" (without the quotation marks) to disable +local activationHeight = nil + +-- the keys that activate the constructor-indicating graphics +local activationKeyTable = { + --[KEYSYMS.C] = true, + --[KEYSYMS.Q] = true, + --[KEYSYMS.B] = true, + [KEYSYMS.SPACE] = true, +} + +-- enabling this means having your cursor on a constructor activates +-- the constructor-indicating graphics +local activateOnMouseOver = false + +-- enabling this causes the widget to draw only on the mini map +local miniMapOnly = false + +-- options end + + + + + +local widgetName = widget:GetInfo().name + +local abs = math.abs +local floor = math.floor +local pi = math.pi +local cos = math.cos +local sin = math.sin +local insert = table.insert +local remove = table.remove +local bit_inv = math.bit_inv + +local glDrawGroundCircle = gl.DrawGroundCircle +local glLineWidth = gl.LineWidth +local glColor = gl.Color +local glCreateList = gl.CreateList +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList +local glVertex = gl.Vertex +local glDrawListAtUnit = gl.DrawListAtUnit +local glDrawFuncAtUnit = gl.DrawFuncAtUnit +local glBeginEnd = gl.BeginEnd +local glTranslate = gl.Translate +local glScale = gl.Scale +local glRotate = gl.Rotate +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix + +local IsGUIHidden = Spring.IsGUIHidden +local GetTeamUnits = Spring.GetTeamUnits +local myTeam = Spring.GetMyTeamID() +local GetUnitDefID = Spring.GetUnitDefID +local GetCameraPosition = Spring.GetCameraPosition +local GetGroundNormal = Spring.GetGroundNormal +local GetGroundHeight = Spring.GetGroundHeight +local TraceScreenRay = Spring.TraceScreenRay +local IsUnitInView = Spring.IsUnitInView +local IsUnitIcon = Spring.IsUnitIcon +local GetUnitPosition = Spring.GetUnitPosition +local GetUnitTeam = Spring.GetUnitTeam +local GetUnitBasePosition = Spring.GetUnitBasePosition +local GetFPS = Spring.GetFPS +local Echo = Spring.Echo + +local unitListIndex = 0 +local radstep = (2.0 * pi) / circleDivs +local radInDeg = 180/pi +local red = red1 +local green = green1 +local blue = blue1 +local mapSizeX, mapSizeZ = Game.mapSizeX, Game.mapSizeZ +local circleGlList +local aniFactor = 1 +local mobileConDefIdTable = {} +local conMemoTable = {} +local keyPressed = false +local above = false +local useSecColors = true +local lastTime +local aniSpeed +local aniDelta + + + +function append(list, value) + --Echo(widgetName .. ': entered "' .. debug.getinfo(1, "n").name .. '"') + list[#list+1] = value +end + +function contains(list, entry) + --Echo(widgetName .. ': entered "' .. debug.getinfo(1, "n").name .. '"') + for i = 1, #list do + if list[i] == entry then return true end + end + return false +end + +function radToDeg(rad) + return rad*radInDeg +end + +function makeCircle(x, y, z, scale) + function circleLines() + for i = 1, circleDivs do + local a = (i * radstep) + glVertex(sin(a)*scale + x, + y, cos(a)*scale + z) + end + end + + glBeginEnd(GL.LINE_LOOP, circleLines) +end + + +function isMobileCon(unitDef) + return unitDef.isBuilder and unitDef.canMove and not unitDef.isBuilding +end + + + +function worldToMiniMapPos(x, z, mmxsize, mmzsize) + + --Echo(widgetName .. ": sx*mmxsize/vxsize, sy*mmysize/vysize = " .. sx*mmxsize/vxsize .. ", " .. sy*mmysize/vysize) + + return x*mmxsize/mapSizeX, z*mmzsize/mapSizeZ + +end + +function areConditionsMet() + local cx, cy, cz = GetCameraPosition() + + if (keyPressed or above or (activationHeight and cy >= activationHeight)) and + cy >= minActivationHeight and not IsGUIHidden() then + return true + end + return false +end + + +function loadClasses() + + List = {} + + function List:new(contents) + local o = {} + + + + setmetatable(o, self) + + o.contents = contents or {} + o.locked = false + + + self.__index = function (table, key) + if type(key) == "number" then + return table:get(key) + else + return rawget(self, key) + end + end + + + return o + end + + function List:get(key) + if key == nil then + return self.contents + elseif type(key) == "number" then + return self.contents[key] + end + end + + + function List:len() + return #self:get() + end + + function List:insert(pos, val) + if not val then + self:append(pos) + else + insert(self:get(), pos, val) + end + end + + + function List:replace(pos, val) + if not val then + self:get()[self:len()] = val + else + self:get()[pos] = val + end + end + + function List:setContents(list) + self.contents = list + end + + function List:__newindex(key, value) + if type(key) == "number" then + self:replace(key, value) + else + rawset(self, key, value) + end + end + + function List:append(val) + append(self:get(), val) + end + + function List:remove(k) + if type(k) == "number" then + return remove(self:get(), k) + end + end + + function List:search(entry) + local value + local key + for i = 1, self:len() do + if self:get(i) == entry then value = entry; key = i end + end + return key, value + end + + function List:find(entry) + local tempT = self:get() + local value + local key + for i = 1, self:len() do + if tempT[i] == entry then value = entry; key = i end + end + return key, value + end + + function List:contains(entry) + local tempT = self:get() + for i = 1, self:len() do + if tempT[i] == entry then return true end + end + return false + end + + function List:removeByValue(entry) + local k, v = self:search(entry) + return self:remove(k) + end + + function List:lock() + if self:isLocked() then + error('unable to lock an already locked List object') + end + self.locked = true + end + + function List:unlock() + if not self:isLocked() then + error('unable to unlock an already unlocked List object') + end + self.locked = false + end + + function List:isLocked() + return self.locked + end + +end + +loadClasses() + + + + + + +local conList = List:new() + + + +function fillConList(unitIdList) + if conList[1] then return end + local unit + local unitDef + local unitDefId + local unitPos = {} + local curUnitIdList = unitIdList or Spring.GetTeamUnits(myTeam) + --Echo(widgetName .. ": #curUnitIdList = " .. #curUnitIdList) + for i = 1, #curUnitIdList do + unit = curUnitIdList[i] + unitDefId = GetUnitDefID(unit) + unitDef = UnitDefs[unitDefId] + if not conMemoTable[unit] and mobileConDefIdTable[unitDefId] then + --Echo(widgetName .. ": new builder found") + addToConTables(unit) + end + end + +end + +function addToConTables(unitId) + if not unitId then return end + conList:insert(unitId) + conMemoTable[unitId] = true +end + +function removeFromConTables(unitId, unitListIndex) + if unitListIndex then + conList:remove(unitListIndex) + elseif unitId then + conList:removeByValue(unitId) + else + return + end + conMemoTable[unitId] = nil + --Echo(widgetName .. ": removed " .. tostring(unitId) .. ", " .. + --tostring(unitListIndex)) +end + +function widget:Update(timeSinceLastUpdate) + aniSpeed = timeSinceLastUpdate*aniSpeedMultiplier +end + +function widget:DrawInMiniMap(sx, sy) + + + if areConditionsMet() then + + local cx, cy, cz = GetCameraPosition() + + glLineWidth(1) + + glColor(red, green, blue, aniFactor*0.4) + + local max = conList:len() + + for i = 1, max do + + local unit = conList[i] + --Echo(widgetName .. ": unit = " .. unit) + + if not unit then + --Echo(widgetName .. ": could not get unit id (DrawInMiniMap)") + else + + local ux, uy, uz = GetUnitBasePosition(unit) + + + if not ux then + --Echo(widgetName .. ": could not get unit coordinates (DrawInMiniMap)") + removeFromConTables(unit) + else + local mmux, mmuz = worldToMiniMapPos(ux, uz, sx, sy) + + gl.Rect(mmux - 5, sy-mmuz - 5, mmux + 5, sy-mmuz + 5) + + end + end + end + end +end + +function rewindAnimation() + if aniFactor < 1 then + aniFactor = 1 + useSecColors = true + aniDelta = aniSpeed + red = red1 + green = green1 + blue = blue1 + end +end + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorldPreUnit() + if chobbyInterface then return end + + + if not miniMapOnly and areConditionsMet() then + local cx, cy, cz = GetCameraPosition() + + + local camFactor + local camYDiff + + + if aniFactor < 0 then + aniDelta = aniSpeed + if useSecColors then + red = red2 + green = green2 + blue = blue2 + else + red = red1 + green = green1 + blue = blue1 + end + useSecColors = not useSecColors + elseif aniFactor >= 1 then + aniDelta = -aniSpeed + end + + aniFactor = aniFactor + aniDelta + + + glLineWidth(2.5) + + camFactor = cy/200+25 + + if camFactor < 50 then + camFactor = 50 + end + + glColor(red, green, blue, aniFactor) + + local max = conList:len() + + for i = 1, max do + + + local unit = conList[i] + + if not unit then + --Echo(widgetName .. ": could not get unit id (DrawWorld)") + else + --Echo(widgetName .. ": unit = " .. unit) + if IsUnitInView(unit) then + local ux, uy, uz = GetUnitBasePosition(unit) + + if not ux then + --Echo(widgetName .. ": could not get unit coordinates (DrawWorld)") + removeFromConTables(unit) + else + if IsUnitIcon(unit) then + --Echo(widgetName .. ": using inefficient drawing method") + makeCircle(ux, uy, uz, camFactor) + else + --Echo(widgetName .. ": using efficient drawing method") + glDrawListAtUnit(unit, circleGlList, false, camFactor, + camFactor, camFactor) + end + end + end + end + end + + + else + rewindAnimation() + end + +end + +function widget:KeyPress(key, mods, isRepeat) + + if activationKeyTable[key] and isRepeat == false then + + fillConList() + + keyPressed = true + end + +end + +function widget:KeyRelease(key) + + if activationKeyTable[key] then + keyPressed = false + rewindAnimation() + end + + + +end + + + +function widget:UnitDestroyed(unitId, unitDefId) + if conMemoTable[unitId] then + removeFromConTables(unitId) + end +end + + +function widget:UnitFinished(unitId, unitDefId) + if mobileConDefIdTable[unitDefId] and GetUnitTeam(unitId) == myTeam then + addToConTables(unitId) + end +end + +function widget:UnitTaken(unitId, unitDefId, unitTeam, newTeam) + --Echo(widgetName .. ": unit taken: " .. tostring(unitTeam) .. ", " .. tostring(newTeam)) + if mobileConDefIdTable[unitDefId] and newTeam == myTeam then + addToConTables(unitId) + end +end + +function widget:UnitGiven(unitId, unitDefId, unitTeam, oldTeam) + if conMemoTable[unitId] then + removeFromConTables(unitId) + end +end + +function widget:IsAbove(x, y) + + if not activateOnMouseOver then + return + end + + local class, info = TraceScreenRay(x, y) + + if class == "unit" then + local unitDefId = GetUnitDefID(info) + if mobileConDefIdTable[unitDefId] then + fillConList() + + above = true + end + + elseif above then + above = false + rewindAnimation() + end + +end + + + + + + +function widget:Initialize() + + circleGlList = glCreateList(makeCircle, 0, 0, 0, 1) + + for k,v in pairs(UnitDefs) do + if isMobileCon(v) then + mobileConDefIdTable[k] = true + --Echo(widgetName .. ": mobile con added to table") + end + end + +end diff --git a/LuaUI/Widgets_Evo/gui_damage_cursortip.lua b/LuaUI/Widgets_Evo/gui_damage_cursortip.lua index 4c444c619..3d8c22ccb 100644 --- a/LuaUI/Widgets_Evo/gui_damage_cursortip.lua +++ b/LuaUI/Widgets_Evo/gui_damage_cursortip.lua @@ -7,7 +7,7 @@ function widget:GetInfo() date = "4-11-2010", license = "GNU GPL v2", layer = 0, - enabled = false + enabled = true } end @@ -22,6 +22,28 @@ local drawString = false local attackText = "" local defendText = "" +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 4.75 +local fontfileOutlineStrength = 5 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +function widget:ViewResize(x,y) + vsx,vsy = Spring.GetViewGeometry() + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:Shutdown() + gl.DeleteFont(font) +end + local function UpdateSelection(newSelection) selectedHealth = {} @@ -122,9 +144,18 @@ function widget:Update(dt) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if drawString then local x, y = Spring.GetMouseState() - gl.Text(attackText .. "\n" .. defendText, x+40, y, 15, "o") + font:Begin() + font:Print(attackText .. "\n" .. defendText, x+40, y, 15, "o") + font:End() end end diff --git a/LuaUI/Widgets_Evo/gui_discord.lua b/LuaUI/Widgets_Evo/gui_discord.lua index 8d61c6f2d..5f042fe7f 100644 --- a/LuaUI/Widgets_Evo/gui_discord.lua +++ b/LuaUI/Widgets_Evo/gui_discord.lua @@ -5,15 +5,24 @@ function widget:GetInfo() author = "Floris", date = "24 july 2016", license = "GNU GPL, v2 or later", - layer = -3, -- set to -5 to draw mascotte on top of advplayerlist - enabled = true, - handler = true, + layer = -4, -- set to -5 to draw mascotte on top of advplayerlist + enabled = false, } end -local iconTexture = ":n:"..LUAUI_DIRNAME.."Images/discord.png" +local discordLink = 'discord.me/evolutionrts' + +local iconTexture = ":n:LuaUI/Images/discord.png" local iconSize = 32 +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local spGetGameFrame = Spring.GetGameFrame local glText = gl.Text @@ -31,6 +40,18 @@ local xPos = 0 local yPos = 0 local mouseover = false +local usedImgSize = iconSize + +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- @@ -67,13 +88,9 @@ function updatePosition(force) if (WG['advplayerlist_api'] ~= nil) then local prevPos = parentPos if WG['displayinfo'] ~= nil then - if widgetHandler.orderList["AdvPlayersList info"] ~= nil and (widgetHandler.orderList["AdvPlayersList info"] > 0) then - parentPos = WG['displayinfo'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end + parentPos = WG['displayinfo'].GetPosition() -- returns {top,left,bottom,right,widgetScale} elseif WG['music'] ~= nil then - if widgetHandler.orderList["Music Player"] ~= nil and (widgetHandler.orderList["Music Player"] > 0) then - parentPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - end + parentPos = WG['music'].GetPosition() -- returns {top,left,bottom,right,widgetScale} else parentPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} end @@ -97,6 +114,7 @@ function widget:Shutdown() if drawlist[1] ~= nil then glDeleteList(drawlist[1]) end + gl.DeleteFont(font) end function widget:GameFrame(n) @@ -105,7 +123,14 @@ function widget:GameFrame(n) end end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end updatePosition() if drawlist[1] ~= nil then glPushMatrix() @@ -118,8 +143,10 @@ function widget:DrawScreen() glCallList(drawlist[1]) local mx,my = Spring.GetMouseState() if widget:IsAbove(mx,my) then - local textWidth = glGetTextWidth("discord.gg/aDtX3hW") * 13 - glText("discord.me/evolutionrts", -(textWidth+6+iconSize)*parentPos[5], 12*parentPos[5], 13*parentPos[5], "no") + local textWidth = font:GetTextWidth(discordLink) * 13 + font:Begin() + font:Print(discordLink, -(textWidth+6+iconSize)*parentPos[5], 12*parentPos[5], 13*parentPos[5], "no") + font:End() end glPopMatrix() mouseover = false @@ -132,7 +159,7 @@ end function widget:MousePress(mx, my, mb) if mb == 1 and isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then - Spring.SendCommands("say BA's discord server: https://discord.gg/aDtX3hW") + Spring.SendCommands("our discord server: https://"..discordLink) widgetHandler:RemoveWidget(self) return true end @@ -153,6 +180,6 @@ end function widget:GetTooltip(mx, my) if widget:IsAbove(mx,my) then - return string.format("We have our own Discord server now!\nour central community hub (chat/voice/info)\n\ndiscord.gg/aDtX3hW") + return string.format("We have our own Discord server now!\nour central community hub (chat/voice/info)\n\n"..discordLink) end end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_display_dps.lua b/LuaUI/Widgets_Evo/gui_display_dps.lua index 1995b28e7..1e0da38d7 100644 --- a/LuaUI/Widgets_Evo/gui_display_dps.lua +++ b/LuaUI/Widgets_Evo/gui_display_dps.lua @@ -19,19 +19,26 @@ function widget:GetInfo() date = "May 27, 2008", license = "GNU GPL, v2 or later", layer = 0, - enabled = true -- loaded by default? + enabled = false -- loaded by default? } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + -- Speed Up local GetUnitDefID = Spring.GetUnitDefID local GetUnitDefDimensions = Spring.GetUnitDefDimensions local AreTeamsAllied = Spring.AreTeamsAllied -local GetMyTeamID = Spring.GetMyTeamID local GetGameSpeed = Spring.GetGameSpeed local GetGameSeconds = Spring.GetGameSeconds local GetUnitViewPosition = Spring.GetUnitViewPosition @@ -39,7 +46,6 @@ local GetUnitViewPosition = Spring.GetUnitViewPosition local glTranslate = gl.Translate local glColor = gl.Color local glBillboard = gl.Billboard -local glText = gl.Text local glDepthMask = gl.DepthMask local glDepthTest = gl.DepthTest local glAlphaTest = gl.AlphaTest @@ -47,6 +53,7 @@ local glBlending = gl.Blending local glDrawFuncAtUnit = gl.DrawFuncAtUnit local glPushMatrix = gl.PushMatrix local glPopMatrix = gl.PopMatrix +local glCallList = gl.CallList local GL_GREATER = GL.GREATER local GL_SRC_ALPHA = GL.SRC_ALPHA @@ -64,10 +71,21 @@ local lastTime = 0 local paused = false local changed = false local heightList = {} +local drawTextLists = {} +local drawTextListsDeath = {} +local drawTextListsEmp = {} -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local fontScale = widgetScale/2 + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, 52*fontScale, 17*fontScale, 1.5) +end + local function unitHeight(unitDefID) if not heightList[unitDefID] then heightList[unitDefID] = (GetUnitDefDimensions(unitDefID).height * 0.9) @@ -82,39 +100,44 @@ function widget:UnitFinished(unitID, unitDefID, unitTeam) end local function getTextSize(damage, paralyze) - local sizeMod = 3 - if paralyze then sizeMod = 2.25 end - return math.floor(8 * (1 + sizeMod * (1 - (200 / (200 + damage))))) + --if paralyze then sizeMod = 2.25 end + return 15 + math.floor(3 * (2 * (1 - (100 / (100 + damage/10))))) end local function displayDamage(unitID, unitDefID, damage, paralyze) table.insert(damageTable,1,{}) - damageTable[1].unitID = unitID - damageTable[1].damage = math.ceil(damage - 0.5) - damageTable[1].height = unitHeight(unitDefID) - damageTable[1].offset = (6 - math.random(0,12)) - damageTable[1].textSize = getTextSize(damage, paralyze) - damageTable[1].heightOffset = 0 - damageTable[1].lifeSpan = 1 - damageTable[1].paralyze = paralyze - damageTable[1].fadeTime = math.max((0.03 - (damage / 333333)), 0.015) - damageTable[1].riseTime = (math.min((damage / 2500), 2) + 1) + damageTable[1] = { + unitID = unitID, + damage = math.ceil(damage - 0.5), + height = unitHeight(unitDefID), + offset = (10 - math.random(0,12)), + textSize = getTextSize(damage, paralyze), + heightOffset = 0, + lifeSpan = 1, + paralyze = paralyze, + fadeTime = math.max((0.03 - (damage / 333333)), 0.015), + riseTime = (math.min((damage / 2500), 2) + 1)/3, + } end function widget:UnitDestroyed(unitID, unitDefID, unitTeam) if unitDamage[unitID] then local ux, uy, uz = GetUnitViewPosition(unitID) - table.insert(deadList,1,{}) - local damage = math.ceil(unitDamage[unitID].damage - 0.5) - deadList[1].x = ux - deadList[1].y = (uy + unitHeight(unitDefID)) - deadList[1].z = uz - deadList[1].lifeSpan = 1 - deadList[1].fadeTime = math.max((0.03 - (damage / 333333)), 0.015) * 0.66 - deadList[1].riseTime = (math.min((damage / 2500), 2) + 1)* 1.33 - deadList[1].damage = damage - deadList[1].textSize = getTextSize(damage, false) - deadList[1].red = true + if ux ~= nil then + local damage = math.ceil(unitDamage[unitID].damage - 0.5) + table.insert(deadList,1,{}) + deadList[1] = { + x = ux, + y = (uy + unitHeight(unitDefID)), + z = uz, + lifeSpan = 1, + fadeTime = math.max((0.03 - (damage / 333333)), 0.015) * 0.5, + riseTime = (math.min((damage / 2500), 2) + 1)/3, + damage = damage, + textSize = getTextSize(damage, false), + red = true, + } + end end unitDamage[unitID] = nil unitParalyze[unitID] = nil @@ -122,16 +145,20 @@ function widget:UnitDestroyed(unitID, unitDefID, unitTeam) if (v.unitID == unitID) then if not v.paralyze then local ux, uy, uz = GetUnitViewPosition(unitID) - table.insert(deadList,1,{}) - deadList[1].x = ux + v.offset - deadList[1].y = uy + v.height + v.heightOffset - deadList[1].z = uz - deadList[1].lifeSpan = v.lifeSpan - deadList[1].fadeTime = v.fadeTime * 2.5 - deadList[1].riseTime = v.riseTime * 0.66 - deadList[1].damage = v.damage - deadList[1].textSize = v.textSize - deadList[1].red = false + if ux ~= nil then + table.insert(deadList,1,{}) + deadList[1] = { + x = ux + v.offset, + y = uy + v.height + v.heightOffset, + z = uz, + lifeSpan = v.lifeSpan, + fadeTime = v.fadeTime * 2.5, + riseTime = v.riseTime * 0.9, + damage = v.damage, + textSize = v.textSize, + red = false, + } + end end table.remove(damageTable,i) end @@ -148,18 +175,16 @@ function widget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer) if (damage < 1.5) then return end if (UnitDefs[unitDefID] == nil) then return end - - if paralyzer then - if unitParalyze[unitID] then - unitParalyze[unitID].damage = (unitParalyze[unitID].damage + damage) - end + + if paralyzer and unitParalyze[unitID] then + unitParalyze[unitID].damage = (unitParalyze[unitID].damage + damage) return elseif unitDamage[unitID] then unitDamage[unitID].damage = (unitDamage[unitID].damage + damage) return end - if paralyze then + if paralyzer then unitParalyze[unitID] = {} unitParalyze[unitID].damage = damage unitParalyze[unitID].time = (lastTime + 0.1) @@ -192,15 +217,29 @@ local function drawDeathDPS(damage,ux,uy,uz,textSize,red,alpha) glTranslate(ux, uy, uz) glBillboard() gl.MultiTexCoord(1, 0.25 + (0.5 * alpha)) - + if red then - glColor(1, 0, 0) + if drawTextListsDeath[damage] == nil then + drawTextListsDeath[damage] = gl.CreateList(function() + font:Begin() + font:SetTextColor(1, 0.5, 0.5) + font:Print(damage, 0, 0, textSize, 'cnO') + font:End() + end) + end + glCallList(drawTextListsDeath[damage]) else - glColor(1, 1, 1) + if drawTextLists[damage] == nil then + drawTextLists[damage] = gl.CreateList(function() + font:Begin() + font:SetTextColor(1, 1, 1) + font:Print(damage, 0, 0, textSize, 'cnO') + font:End() + end) + end + glCallList(drawTextLists[damage]) end - glText(damage, 0, 0, textSize, "cno") - glPopMatrix() end @@ -209,16 +248,38 @@ local function DrawUnitFunc(yshift, xshift, damage, textSize, alpha, paralyze) glBillboard() gl.MultiTexCoord(1, 0.25 + (0.5 * alpha)) if paralyze then - glColor(0, 0, 1) - glText(damage, 0, 0, textSize, 'cnO') + if drawTextListsEmp[damage] == nil then + drawTextListsEmp[damage] = gl.CreateList(function() + font:Begin() + font:SetTextColor(0.5, 0.5, 1) + font:Print(damage, 0, 0, textSize, 'cnO') + font:End() + end) + end + glCallList(drawTextListsEmp[damage]) else - glColor(1, 1, 1) - glText(damage, 0, 0, textSize, 'cno') + if drawTextLists[damage] == nil then + drawTextLists[damage] = gl.CreateList(function() + font:Begin() + font:SetTextColor(1, 1, 1) + font:Print(damage, 0, 0, textSize, 'cnO') + font:End() + end) + end + glCallList(drawTextLists[damage]) end end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() -if not Spring.IsGUIHidden() then + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + local theTime = GetGameSeconds() if (theTime ~= lastTime) then @@ -242,7 +303,7 @@ if not Spring.IsGUIHidden() then glDepthTest(true) glAlphaTest(GL_GREATER, 0) glBlending(GL_SRC_ALPHA, GL_ONE) - gl.Texture(1, LUAUI_DIRNAME .. "images/gradient_alpha_2.png") + gl.Texture(1, "LuaUI/images/gradient_alpha_2.png") for i, damage in pairs(damageTable) do if (damage.lifeSpan <= 0) then @@ -251,15 +312,15 @@ if not Spring.IsGUIHidden() then glDrawFuncAtUnit(damage.unitID, false, DrawUnitFunc, (damage.height + damage.heightOffset), damage.offset, damage.damage, damage.textSize, damage.lifeSpan, damage.paralyze) if not paused then - if damage.paralyze then - damage.lifeSpan = (damage.lifeSpan - 0.05) - damage.textSize = (damage.textSize + 0.2) - else + --if damage.paralyze then + -- damage.lifeSpan = (damage.lifeSpan - 0.05) + -- damage.textSize = (damage.textSize + 0.2) + --else damage.heightOffset = (damage.heightOffset + damage.riseTime) if (damage.heightOffset > 25) then damage.lifeSpan = (damage.lifeSpan - damage.fadeTime) end - end + --end end end end @@ -282,6 +343,27 @@ if not Spring.IsGUIHidden() then glDepthTest(false) glDepthMask(false) end + + +--function widget:Initialize() +-- for damage=1, 200 do +-- drawTextLists[damage] = gl.CreateList(function() +-- glText(damage, 0, 0, getTextSize(damage, false), 'cnO') +-- end) +-- end +--end + +function widget:Shutdown() + for k,_ in pairs(drawTextLists) do + gl.DeleteList(drawTextLists[k]) + end + for k,_ in pairs(drawTextListsDeath) do + gl.DeleteList(drawTextListsDeath[k]) + end + for k,_ in pairs(drawTextListsEmp) do + gl.DeleteList(drawTextListsEmp[k]) + end + gl.DeleteFont(font) end -------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua b/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua index fdce181ad..fcca550ed 100644 --- a/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua +++ b/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua @@ -301,7 +301,14 @@ end local TweakAbove -function widget:DrawScreen() --Tweak Mode doesn't work without it +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end --Tweak Mode doesn't work without it end function widget:TweakDrawScreen() glPushMatrix() diff --git a/LuaUI/Widgets_Evo/gui_evo_tooltip.lua b/LuaUI/Widgets_Evo/gui_evo_tooltip.lua new file mode 100644 index 000000000..59fc4f8db --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_evo_tooltip.lua @@ -0,0 +1,1223 @@ +function widget:GetInfo() + return { + name = "Evo Tooltip", + desc = "overrides default tooltip, shows shield and weapon info", + author = "CommonPlayer, raaar, based on a Kernel Panic widget by zwszg", + date = "September 2012", + license = "GNU GPL v2", + layer = 0, + enabled = true + } +end + +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 4.5 +local fontfileOutlineStrength = 1.8 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local barTexture = LUAUI_DIRNAME.."Images/resbar.dds" +local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl ,vsx,vsy) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.07 -- texture offset, because else gaps could show + local o = offset + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, py+cs, 0) + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, py+cs, 0) + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl, vsx,vsy) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl, vsx,vsy) + gl.Texture(false) +end + +-- icons +local useEnergyTexture = "ENERGY_TEXTURE" +local useMetalTexture = "METAL_TEXTURE" +local useSupplyTexture = "SUPPLY_TEXTURE" +local drawIcons = { + ENERGY_TEXTURE = LUAUI_DIRNAME.."Images/energy2.png", + METAL_TEXTURE = LUAUI_DIRNAME.."Images/metal.png", + SUPPLY_TEXTURE = LUAUI_DIRNAME.."Images/supply.png", +} +local function stringSplitIcons(str, convertIconStr, ...) + --[[ Usage notes: + returns a table in the format of { text, icon, text, ... } + length is always an odd number and there can be empty text + if convertIconStr is set to true, it converts strings meant for accessing icons like "SOME_ICON" into "someIcon" + ]] + local result = {} + local lengResult = 0 + local icons = {...} + local lengIcons = #icons + local i = 1 + local lengStr = #str + while true do + local minPos = math.huge + local lengChosenIcon = 0 + for j = 1, lengIcons do + local pos = str:find(icons[j], i) or math.huge + if minPos > pos then minPos, lengChosenIcon = pos, #icons[j] end + end + if minPos == math.huge then + lengResult = lengResult + 1 + result[lengResult] = str:sub(i, #str) + return result + else + lengResult = lengResult + 1 + result[lengResult] = str:sub(i, minPos - 1) + lengResult = lengResult + 1 + local iconStr = str:sub(minPos, minPos + lengChosenIcon - 1) + result[lengResult] = convertIconStr and iconStr:lower():gsub("_%a", function(input) return input:sub(2, 2):upper() end) or iconStr + i = minPos + lengChosenIcon + end + end +end +-- + +local TechColour = {"\255\0\205\255", "\255\255\0\255", "\255\0\255\0", "\255\255\0\0"} +local TechToStr = {TechColour[1].."Mark II", TechColour[2].."Mark III", TechColour[3].."Mark IV", TechColour[4].."Hive"} + +-- colours +local supplyColour = "\255\255\128\0" +local energyColour = "\255\255\255\1" +local metalColour = "\255\136\197\226" +local white = "\255\255\255\255" +local generateResColour = "\255\0\255\0" +local useResColour = "\255\255\0\0" +local weaponDamageColour = "\255\255\100\100" +local weaponParalyzeColour = "\255\100\255\255" +-- + +-- Hotkeys +VFS.Include("luaui/configs/evo_buildHotkeysConfig.lua") + +local sGetKeySymbol = Spring.GetKeySymbol +local function getKeySymbol(k) + if k >= 97 and k <= 122 then return string.char(k):upper() end + -- basically unused + local keySymbol = sGetKeySymbol(k) + return keySymbol:sub(1, 1):upper() .. keySymbol:sub(2) +end +local humanNameToKeySymbols = {} +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + local name = ud.name + if name:find("_up", -5) then name = name:sub(1, -5) end + if nameToKeyCode[name] then + local str = "" + local leng = #nameToKeyCode[name] + for i = 1, leng do + str = str .. getKeySymbol(nameToKeyCode[name][i]) + if i < leng then str = str .. " + " end + end + humanNameToKeySymbols[ud.humanName] = str + end +end +-- + +local weaponTypeToStr = { "Light", "Armored", "Building", "Air" } + +local frameSkip = 4 -- draw once every frameSkip+1 frames +local counter = 0 +--[[local xpArr = { +"", +"\255\255\100\0I", +"\255\255\120\50II", +"\255\240\140\75III", +"\255\220\150\100IV", +"\255\200\200\200V", +"\255\210\210\200VI", +"\255\220\220\200VII", +"\255\230\230\200VIII", +"\255\240\240\200IX", +"\255\255\255\200X" +}]] +local tempTooltip = nil +local min = math.min +local floor = math.floor +local ceil = math.ceil +local modf = math.modf +local GetMouseState = Spring.GetMouseState +local TraceScreenRay = Spring.TraceScreenRay +local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount +local spGetSelectedUnits = Spring.GetSelectedUnits +local spGetUnitIsCloaked = Spring.GetUnitIsCloaked +local spGetUnitExperience = Spring.GetUnitExperience +local spGetUnitVelocity = Spring.GetUnitVelocity +local spGetUnitRulesParam = Spring.GetUnitRulesParam +local spGetTeamRulesParam = Spring.GetTeamRulesParam +local spGetUnitTeam = Spring.GetUnitTeam + +--local TRANSPORT_MASS_LIMIT_LIGHT = 1200 +--local TRANSPORT_MASS_LIMIT_HEAVY = 3000 + +local ONCE_RELOAD_THRESHOLD = 999 + +function widget:Initialize() + Spring.SendCommands({"tooltip 0"}) + + Spring.SetDrawSelectionInfo(false) + + -- find shield weapon and its max power + for _,ud in pairs(UnitDefs) do + ud.shieldPower = 0; + local shieldDefID = ud.shieldWeaponDef + ud.shieldPower = ((shieldDefID)and(WeaponDefs[shieldDefID].shieldPower))or(-1) + end +end + +local FontSize = math.max(8,3+vsy/80) +function widget:ViewResize(x,y) + vsx,vsy = Spring.GetViewGeometry() + + FontSize = math.max(8,3+vsy/80) + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:Shutdown() + Spring.SendCommands({"tooltip 1"}) + gl.DeleteFont(font) +end + +-- format number +-- TODO put this on a lib +function FormatNbr(x,digits) + if x then + local ret=string.format("%."..(digits or 0).."f",x) + if digits and digits>0 then + while true do + local last = string.sub(ret,string.len(ret)) + if last=="0" or last=="." then + ret = string.sub(ret,1,string.len(ret)-1) + end + if last~="0" then + break + end + end + end + return ret + else + return "" + end +end + +-- generates upgrade data string for player +--[[function GetTooltipUpgradeData(teamId) + local NewTooltip = "" + + -- get upgrades for team + local statusStr = spGetTeamRulesParam(teamId,"upgrade_status") + local listStr = spGetTeamRulesParam(teamId,"upgrade_list") + local modStr = spGetTeamRulesParam(teamId,"upgrade_modifiers") + + if (statusStr) then + NewTooltip = NewTooltip..statusStr.."\n" + end + if (listStr) then + NewTooltip = NewTooltip..listStr.."\n" + end + if (modStr) then + NewTooltip = NewTooltip.." \nEFFECTS\n"..modStr + end + + return NewTooltip +end]] + + +-- generates upgrade summary string for player +--[[function GetTooltipUpgradeLabel(teamId) + local NewTooltip = "" + + -- get upgrades for team + local labelStr = spGetTeamRulesParam(teamId,"upgrade_label") + + if (labelStr) then + NewTooltip = NewTooltip..labelStr + else + NewTooltip = NewTooltip.."Upgrades: \255\130\130\130[0] [0] [0]" + end + + return NewTooltip +end]] + +-- generates weapon data string for unit +local function GetUnitTotalDamageEnergyMaxRange(ud) + local damages, paralyzeDamages = { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } + damages[0], paralyzeDamages[0] = 0, 0 + local hasDamage, hasParalyzDamage = false, false + local maxRange, totalEnergyCost = 0, 0 + --if ud.weapons and ud.weapons[1] and ud.weapons[1].weaponDef then + for _,w in pairs(ud.weapons) do + local weap=WeaponDefs[w.weaponDef] + if weap.isShield == false and weap.description ~= "No Weapon" then + local reloadTime = weap.reload + local dpsConversion = (weap.projectiles*weap.salvoSize) / weap.reload + local energyPerSecond = weap.energyCost * dpsConversion + local isDisruptor = weap.damages and weap.damages.paralyzeDamageTime and weap.damages.paralyzeDamageTime>0 + + maxRange = maxRange < weap.range and weap.range or maxRange + totalEnergyCost = totalEnergyCost + energyPerSecond + for i = 0, #weap.damages do -- don't even bother asking exactly what attributes "damages" hold + if isDisruptor then + paralyzeDamages[i] = paralyzeDamages[i] + weap.damages[i] * dpsConversion + hasParalyzDamage = true + else + damages[i] = damages[i] + weap.damages[i] * dpsConversion + hasDamage = true + end + end + end + end + --end + return damages, paralyzeDamages, hasDamage, hasParalyzDamage, maxRange, totalEnergyCost -- 0 = default, 1, ... = damage types +end +function GetTooltipWeaponData(ud) + local NewTooltip = "" + + local xpMod, rangeMod, dmgMod = 1, 1, 1 + --[[if not rangeMod then + rangeMod = 1 + end + if not dmgMod then + dmgMod = 1 + end]] + + if ud.canKamikaze then + -- local weapname=ud.selfDExplosion + -- local weap=nil + -- for wid,weaponDef in pairs(WeaponDefs) do + -- if weaponDef.name==weapname then + -- weap=WeaponDefs[wid] + -- end + -- end + -- if weap then + -- local weapon_action="Damage" + -- if weap.damages and weap.damages.paralyzeDamageTime and weap.damages.paralyzeDamageTime>0 then + -- weapon_action="Paralyze" + -- end + -- NewTooltip = NewTooltip.."\n\255\255\213\213Damage: \255\255\170\170"..FormatNbr(dmgMod * weap.damages[Game.armorTypes.default],2).."/once" + -- end + elseif ud.weapons and ud.weapons[1] and ud.weapons[1].weaponDef then + -- local damages, paralyzeDamages, hasDamage, hasParalyzDamage, maxRange, totalEnergyCost = GetUnitTotalDamageEnergyMaxRange(ud) + -- if hasDamage then + -- NewTooltip = NewTooltip .. white .. "Damage/s: " + -- for i = 1, #damages do -- actually ignore default + -- local reorder = (i + 1) % 5 + 1 + -- if damages[reorder] > 0 then NewTooltip = NewTooltip .. weaponDamageColour .. FormatNbr(damages[reorder], 1) .. white .. " (" .. weaponTypeToStr[reorder] .. ") / " end + -- end + -- NewTooltip = NewTooltip:sub(1, -4) + -- end + -- if hasParalyzDamage then + -- NewTooltip = NewTooltip .. white .. "Paralyze/s: " + -- for i = 1, #paralyzeDamages do -- actually ignore default + -- local reorder = (i + 1) % 5 + 1 + -- if paralyzeDamages[reorder] > 0 then NewTooltip = NewTooltip .. weaponParalyzeColour .. FormatNbr(paralyzeDamages[reorder], 1) .. white .. " (" .. weaponTypeToStr[reorder] .. ") / " end + -- end + -- NewTooltip = NewTooltip:sub(1, -4) + -- end + -- if hasDamage or hasParalyzDamage then + -- NewTooltip = "\n" .. NewTooltip + -- NewTooltip = NewTooltip .. " Range: " .. FormatNbr(maxRange, 2) + -- if totalEnergyCost > 0 then NewTooltip = NewTooltip .. " " .. useEnergyTexture .. useResColour .. " -" .. FormatNbr(totalEnergyCost, 1) end + -- end + + + for _,w in pairs(ud.weapons) do + local weap=WeaponDefs[w.weaponDef] + --Spring.Echo(weap.damages[0],weap.damages[1],weap.damages[2],weap.damages[3]) -- default, armored, building, light + if weap.isShield == false and weap.description ~= "No Weapon" then + local weapon_action="Dmg/s" + local reloadTime = weap.reload / xpMod + local isBeamLaser = weap.type == "BeamLaser" + local damage = dmgMod * (weap.damages[Game.armorTypes.default] * (weap.projectiles*weap.salvoSize)) + local dps = damage / reloadTime + local energyPerSecond = (weap.energyCost * (weap.projectiles*weap.salvoSize)) / reloadTime + local isDisruptor = false + local actionStr = "" + + if weap.damages and weap.damages.paralyzeDamageTime and weap.damages.paralyzeDamageTime>0 then + weapon_action="Paralyze/s" + isDisruptor = true + end + if (reloadTime >= 2.5) then + actionStr = weapon_action..": \255\255\255\255"..(isDisruptor and "\255\100\255\255" or "")..FormatNbr(damage,0).."\255\255\255\255"..(reloadTime >= ONCE_RELOAD_THRESHOLD and " once" or ("/"..FormatNbr(reloadTime,2).."s")) + else + actionStr = weapon_action..": \255\255\255\255"..(isDisruptor and "\255\100\255\255" or "")..FormatNbr(dps,1).."\255\255\255\255" + end + + local range = weap.range * rangeMod + local damagetype = weap.customParams.damagetype + if damagetype == nil then + damagetype = "default" + end + + if damagetype == "light" or damagetype == "antilight" then damagetype = "Light" end + if damagetype == "turretantilight" then damagetype = "Light Mobile Units" end + if damagetype == "turretantiarmored" then damagetype = "Armored Mobile Units" end + if damagetype == "turretantilightarmored" then damagetype = "Light/Armored Mobile Units" end + if damagetype == "antiarmored" then damagetype = "Armored" end + if damagetype == "antilightarmored" then damagetype = "Light/Armored" end + if damagetype == "antilightbuilding" then damagetype = "Light/Buildings" end + if damagetype == "antibuilding" then damagetype = "Buildings" end + if damagetype == "antiair" then damagetype = "Aircraft" end + if damagetype == "antiarmoredbuilding" then damagetype = "Armored and Buildings" end + if damagetype == "antibuildingair" then damagetype = "Buildings and Aircraft" end + if damagetype == "antiarmoredair" then damagetype = "Armored and Aircraft" end + if damagetype == "Default" then damagetype = "None" end + + local AOE = weap.damageAreaOfEffect + + + NewTooltip = NewTooltip.."\n\255\255\255\255"..weap.description.." "..actionStr.." (+50% vs "..damagetype..") AoE: "..AOE.."(r) Range: "..FormatNbr(range,2) + + if energyPerSecond > 0 then + NewTooltip = NewTooltip.." \255\255\255\0E/s: "..FormatNbr(energyPerSecond,1) + end + + if weap.waterWeapon then + NewTooltip = NewTooltip.." \255\64\64\255WATER" + end + end + end + end + + return NewTooltip +end + +-- generates build power string in m/s as a function of build speed +function GetTooltipBuildPower(buildSpeed) + + -- time is 11 * weighted_cost_metal + -- time = 11 * (m + e/60) / spd + -- m + e/60 = time * spd / 11 + -- non-aircraft have 5x e cost as metal, so + -- m + 5m/60 = time * spd / 11 + -- 13m/12 = time * spd / 11 + -- m/time = 12*spd / (11*13) + + --return "\255\255\255\150Build Power: ".. FormatNbr(12 * buildSpeed / (11*13),1).." metal/s" + return "\255\255\255\150Build Power: ".. FormatNbr(buildSpeed * 4,1).." metal/s" +end + +-- get tooltip mass/transportability label +function GetTooltipTransportability(ud) + --[[if ud.speed > 0 then + local transpStr = "" + if ud.mass < TRANSPORT_MASS_LIMIT_LIGHT then + transpStr = "light" + elseif ud.mass < TRANSPORT_MASS_LIMIT_HEAVY then + transpStr = "heavy" + else + transpStr = "no transport" + end + + return " \255\200\200\200Mass: ".. FormatNbr(ud.mass,0).." ("..transpStr..")" + else + return "" + end ]] + if ud.canFly or ud.customParams.armortype == "building" or not ud.customParams.canbetransported then return "" end + --return " \255\200\200\200Transportable" + return "" +end + +-- get tooltip: supply energy metal cost +local function GetTooltipCost(sUse, sGive, e, m) + sUse, sGive = tonumber(sUse), tonumber(sGive) + local supplyStr = "" + --[[local sNet = sGive - sUse + local supplyStr = "" + if sNet > 0 then supplyStr = "Gives "..useSupplyTexture..supplyColour.." "..sNet..white.." " + elseif sNet < 0 then supplyStr = "Uses "..useSupplyTexture..supplyColour.." "..(-sNet)..white.." " end]] + if sGive > 0 then supplyStr = supplyStr .. "Gives "..useSupplyTexture..supplyColour.." "..sGive..white.." " end + if sUse > 0 then supplyStr = supplyStr .. "Uses "..useSupplyTexture..supplyColour.." "..sUse..white.." " end + local costStr = "Cost: " .. + useEnergyTexture..energyColour.." "..e..white.." / ".. + useMetalTexture..metalColour.." "..m + return supplyStr .. costStr +end +-- get tooltip for armor +local function GetTooltipArmor(ud) + -- TODO replace text with icons + local str = ud.customParams.armortype + if str == "light" then return "Light" + elseif str == "armored" then return "Armored" + elseif str == "building" then return "Building" + elseif str == "air" then return "Air" end + return "Default" +end +-- get tooltip for resource upkeeps +local function GetTooltipUpkeep(eMake, eUse, mMake, mUse) + return + useEnergyTexture..generateResColour.." +"..FormatNbr(eMake, 1)..white.." / "..useResColour..FormatNbr(-eUse, 1).." ".. + useMetalTexture..generateResColour.." +"..FormatNbr(mMake, 1)..white.." / "..useResColour..FormatNbr(-mUse, 1) +end +-- get tooltip for one unit +local function GetTooltipUnit(id) + local result = "" + local u=id + local ud=UnitDefs[Spring.GetUnitDefID(u)] + + local metalMake,metalUse,energyMake,energyUse = Spring.GetUnitResources(u) + local isFriendly = metalMake ~= nil -- assume only friendly units have this info + + -- build progress, health and shield + local health,maxHealth,paralyzeDamage,captureProgress,buildProgress = Spring.GetUnitHealth(u) + stunned_or_beingbuilt, stunned, beingbuilt = Spring.GetUnitIsStunned(u) + result = result.."\n"..ud.humanName.." ("..ud.tooltip..")" + --[[local hpMod = spGetUnitRulesParam(u,"upgrade_hp") + if not hpMod then + hpMod = 1 + else + hpMod = 1 + hpMod + end + health = health * hpMod + maxHealth = maxHealth * hpMod]] + --[[ + -- experience + local xp = spGetUnitExperience(u) + local xpMod = 1 + if xp and xp>0 then + local xpIndex = math.min(10,math.max(floor(11*xp/(xp+1)),0))+1 + xpMod = 1+0.35*(xp/(xp+1)) + if(xpIndex > 1) then + result = result.."\255\255\255\255 Experience: "..xpArr[xpIndex] + end + end + ]] + --[[ + local dmgMod = spGetUnitRulesParam(u,"upgrade_damage") + if not dmgMod then + dmgMod = 1 + else + dmgMod = 1 + dmgMod + end + local rangeMod = spGetUnitRulesParam(u,"upgrade_range") + if not rangeMod then + rangeMod = 1 + else + rangeMod = 1 + rangeMod + end + ]] + + + -- paralysis + if stunned then + result = result.."\255\194\173\255 PARALYZED" + end + -- cloaking + if spGetUnitIsCloaked(u) then + result = result.."\255\170\170\170 CLOAKED" + end + -- alliance + if isFriendly == false then + result = result.." \255\255\0\0ENEMY" + end + result = result.."\n" + if buildProgress and buildProgress<1 then + result = result.."\255\213\213\255".."Build progress: ".."\255\170\170\255"..FormatNbr(100*buildProgress).."%\n" + end + + -- cost + --result = result.."\255\200\200\200Metal: "..ud.metalCost.." \255\255\255\0Energy: "..ud.energyCost.." "..GetTooltipTransportability(ud).."\n" + local unitsupplycost = ud.customParams.supply_cost or 0 + local unitsupplygive = ud.customParams.supply_granted or 0 + result = result..GetTooltipCost(unitsupplycost, unitsupplygive, ud.energyCost, ud.metalCost).." "..GetTooltipTransportability(ud).."\n" + + + --[[local armorTypeStr= "L" + if ( Game.armorTypes[ud.armorType] == "armor_heavy" ) then armorTypeStr = "H" + elseif ( Game.armorTypes[ud.armorType] == "armor_medium" ) then armorTypeStr = "M" end]] + local armorTypeStr = ud.customParams.armortype + if armorTypeStr == nil then + armorTypeStr = "None" + end + + local hasShield, ShieldPower=Spring.GetUnitShieldState(id) + local maxShieldPower = ud.shieldPower + if (health ~= nil) then + result = result.."\255\200\200\200Health: ".."\255\200\200\200"..floor(health).."\255\200\200\200/\255\200\200\200"..floor(maxHealth).." ("..armorTypeStr..")" + if hasShield then result=result.."\255\135\135\255 Shield: "..FormatNbr(math.min(ShieldPower,maxShieldPower)).."/"..FormatNbr(maxShieldPower) end + end + + -- energy and metal upkeep + if isFriendly then + --result = result.." \255\200\200\200Metal: \255\0\255\0+"..FormatNbr(metalMake,1).."\255\255\255\255/\255\255\0\0"..FormatNbr(-metalUse,1) + --result = result.." \255\255\255\0Energy: \255\0\255\0+"..FormatNbr(energyMake,1).."\255\255\255\255/\255\255\0\0"..FormatNbr(-energyUse,1) + -- result=result.."\255\255\255\0 +E/M ratio: "..FormatNbr(energyMake / ud.metalCost,4).."\n" + local upkeepStr = GetTooltipUpkeep(energyMake, energyUse, metalMake, metalUse) + result = result.." "..upkeepStr + end + + -- weapons + result = result..GetTooltipWeaponData(ud).."\n" + + -- build power + if ud.buildSpeed and ud.buildSpeed > 0 then + result = result.."\n"..GetTooltipBuildPower(ud.buildSpeed).. "\255\255\255\255\n" + end + + -- upgrades (upgrade centers only) + --[[local isUpgradeCenter = string.find(ud.name, "upgrade_center") + local teamId = spGetUnitTeam(u) + if isUpgradeCenter then + result = result..GetTooltipUpgradeData(teamId).."\n\n" + end]] + + -- speed + + --Disable Speed Readout + --if ud.speed and ud.speed>0 then + --[[local speedMod = spGetUnitRulesParam(u,"upgrade_speed") + if not speedMod then + speedMod = 1 + else + speedMod = 1 + speedMod + end]] + --local speedMod = 1 + + --local vx,vy,vz = spGetUnitVelocity(u) + --local speed = 30*math.sqrt(vx*vx+vz*vz) + --result = result.."\255\193\255\187Speed: \255\134\255\121"..FormatNbr(speed).."\255\193\255\187/\255\134\255\121"..FormatNbr(ud.speed*speedMod,2).."\255\255\255\255 " + --end + + --[[if ud.transportCapacity>0 and ud.transportMass>0 and isFriendly then + local currentCapacityUsage = 0 + local currentMassUsage = 0 + + -- get sum of mass and size for all transported units + for _,tUnit in pairs(Spring.GetUnitIsTransporting(u)) do + local tUd=UnitDefs[Spring.GetUnitDefID(tUnit)] + currentCapacityUsage = currentCapacityUsage + tUd.xsize + currentMassUsage = currentMassUsage + tUd.mass + end + + result = result.."\255\255\255\255Transport: "..FormatNbr(min(2,(currentCapacityUsage/ud.transportCapacity))*50,0).."% / "..FormatNbr((currentMassUsage/ud.transportMass)*100,0).."% " + end]] + + -- upgrade summary + --[[if not isUpgradeCenter then + result = result..GetTooltipUpgradeLabel(spGetUnitTeam(u)) + end]] + + --[[if ud.customParams.tip then + result = result.."\n\255\180\180\180"..ud.customParams.tip.."\255\255\255\255\n" + end]] + return result +end + +-- generates new tooltip +function GenerateNewTooltip() + local CurrentTooltip = Spring.GetCurrentTooltip() + + if tempTooltip and frameSkip > 0 then + counter = counter +1 + if (counter % (frameSkip+1) ~= 0) then + return tempTooltip + end + end + + local NewTooltip = "" + local HotkeyTooltip = "" + local FoundTooltipType = nil + local mx,my,gx,gy,gz,id + + mx,my = GetMouseState() + if mx and my then + local _,pos = TraceScreenRay(mx,my,true,true) + if pos then + gx,gy,gz=unpack(pos) + end + local kind,var1 = TraceScreenRay(mx,my,false,true) + if kind=="unit" then + id = var1 + end + end + + + if spGetSelectedUnitsCount()>1 then + NewTooltip=NewTooltip.."\255\255\255\255"..spGetSelectedUnitsCount().."\255\255\255\255 units selected\255\255\255\255\n" + end + + + local TerrainType = string.match(CurrentTooltip,"Terrain type: (.+)\nSpeeds T/K/H/S ") + local TerrainSpeeds = string.match(CurrentTooltip,"Speeds T/K/H/S (.+)\nHardness") + if TerrainType~=nil then + NewTooltip=NewTooltip.."\255\255\255\64"..TerrainType + if TerrainSpeeds~=nil then + TerrainSpeedList={} + for Speed in string.gmatch(TerrainSpeeds,"[0-7]+.[0-7]+") do + table.insert(TerrainSpeedList,Speed) + end + if #TerrainSpeedList>=1 then + local DiffSpeed = false + for _,Speeds in pairs(TerrainSpeedList) do + if Speeds~=TerrainSpeedList[1] then + DiffSpeed = true + end + end + for i=1,#TerrainSpeedList do + while true do + local last = string.sub(TerrainSpeedList[i],string.len(TerrainSpeedList[i])) + if last=="0" or last=="." then + TerrainSpeedList[i] = string.sub(TerrainSpeedList[i],1,string.len(TerrainSpeedList[i])-1) + end + if last~="0" then + break + end + end + end + if DiffSpeed then + --NewTooltip=NewTooltip.."\nSpeeds x "..TerrainSpeeds + else + --NewTooltip=NewTooltip.."\nSpeed x"..TerrainSpeedList[1] + end + end + end + if gx and gz then + --NewTooltip=NewTooltip.."\n\n("..(32)*floor((gx+16)/32)..","..(32)*floor((gz+16)/32)..")" + NewTooltip=NewTooltip.."\n\n("..floor(gx+0.5)..","..floor(gz+0.5)..")" + + local h = Spring.GetGroundHeight(gx,gz) + local airMeshH = Spring.GetSmoothMeshHeight(gx,gz) + NewTooltip=NewTooltip.."\n\nAltitude "..floor(h).."\n\nAir Mesh Altitude "..floor(airMeshH) + end + FoundTooltipType="terrain" + end + + local buildpower = 1 + + -- compute total buildpower of units selected + if spGetSelectedUnitsCount() >= 1 then + for _,u in pairs(spGetSelectedUnits()) do + local def=UnitDefs[Spring.GetUnitDefID(u)] + if def ~= nil then + buildpower = buildpower + def.buildSpeed + end + end + end + + -- selecting units to build + local unitpre = string.match(CurrentTooltip,"(.-)\nBuild:") or string.match(CurrentTooltip,"(.-)\n\255\255\255\255Build:") or "" + --local unitname = string.match(CurrentTooltip,"Build: (.+) %- ") + local unitname = string.match(CurrentTooltip,"Build: (.-) %- ") + local unitdesc = string.match(CurrentTooltip," %- (.+)\nHealth ") + local unithealth = string.match(CurrentTooltip,"Health (.+)\nMetal") or string.match(CurrentTooltip,"Health (.+)\nBuild time ") + local unitbuildtime = string.match(CurrentTooltip.."\n","Build time (.-)\n") + local unitmetalcost = string.match(CurrentTooltip,"Metal cost (.-)\nEnergy cost ") + local unitenergycost = string.match(CurrentTooltip,"\nEnergy cost (.-).Build time ") + + if unitname and unitdesc and unithealth and unitbuildtime then + local fud = nil + --local collisions = 0 + for _,ud in pairs(UnitDefs) do + --[[ + Spring.Echo("ud.humanName=",ud.humanName) + Spring.Echo("ud.tooltip=",ud.tooltip) + Spring.Echo("ud.health=",ud.health) + Spring.Echo("ud.buildTime=",ud.buildTime) + ]]-- + -- Note: used approximately equal to because Evo fucking sucks + if ud.humanName==unitname and ud.tooltip==unitdesc and math.abs(ud.health-tonumber(unithealth))<=1 then + --and ""..ud.buildTime==unitbuildtime then + fud=ud + break + end + --[[if ud.humanName==unitname or ud.tooltip==unitdesc then + Spring.Echo(ud.humanName,unitname,ud.humanName==unitname) + Spring.Echo(ud.tooltip,unitdesc,ud.tooltip==unitdesc) + Spring.Echo(ud.health,unithealth,ud.health==unithealth) + Spring.Echo(ud.buildTime,unitbuildtime) + --collisions = collisions + 1 + end]] + end + if fud then + --[[local armorTypeStr= "L" + if ( Game.armorTypes[fud.armorType] == "armor_heavy" ) then armorTypeStr = "H" + elseif ( Game.armorTypes[fud.armorType] == "armor_medium" ) then armorTypeStr = "M" end]] + + --[[NewTooltip = NewTooltip.."\n"..unitpre.."\n"..fud.humanName.." ("..fud.tooltip..")\n".. + "\255\200\200\200Metal: "..unitmetalcost.." \255\255\255\0Energy: "..unitenergycost.."".. + "\255\213\213\255".." Build time: ".."\255\170\170\255".. + floor((29+floor(31+fud.buildTime/(buildpower/32)))/30).."s".." "..GetTooltipTransportability(fud).."\n".. + "\255\200\200\200Health: ".."\255\200\200\200"..fud.health.."("..armorTypeStr..")" + if fud.shieldPower > 0 then NewTooltip=NewTooltip.."\255\135\135\255 Shield: "..FormatNbr(fud.shieldPower) end]] + + local hotkeyStr = "" + if humanNameToKeySymbols[unitname] then + hotkeyStr = " (" .. "\255\170\255\170" .. "Hotkey: " .. humanNameToKeySymbols[unitname] .. white .. ")" + end + + if unitpre ~= "" then + local techText = unitpre:sub(22, 22) + if techText == "0" or techText == nil then + unitpre = "" + else + -- unitpre = unitpre:sub(1, 13) .. TechColour[tonumber(techText)] .. "Tech " .. techText + end + end + + local unitsupplycost = fud.customParams.supply_cost or 0 + local unitsupplygive = fud.customParams.supply_granted or 0 + local costStr = GetTooltipCost(unitsupplycost, unitsupplygive, unitenergycost or fud.energyCost, unitmetalcost or fud.metalCost) + local armorTypeStr = GetTooltipArmor(fud) + NewTooltip = NewTooltip.."\n"..unitpre.."\n"..fud.humanName..hotkeyStr.." ("..fud.tooltip..")\n".. + costStr.."\255\213\213\255".." Build time: ".."\255\170\170\255".. + floor((29+floor(31+fud.buildTime/(buildpower/32)))/30).."s".." "..GetTooltipTransportability(fud).."\n".. + "\255\200\200\200Health: ".."\255\200\200\200"..fud.health.." ("..armorTypeStr..")" + if fud.shieldPower > 0 then NewTooltip=NewTooltip.."\255\135\135\255 Shield: "..FormatNbr(fud.shieldPower) end + + -- weapons + if fud.weapons and fud.weapons[1] and fud.weapons[1].weaponDef then + NewTooltip = NewTooltip..GetTooltipWeaponData(fud) + end + + -- build power + if fud.buildSpeed and fud.buildSpeed > 0 then + NewTooltip = NewTooltip.."\n"..GetTooltipBuildPower(fud.buildSpeed).."\255\255\255\255" + end + + -- speed + NewTooltip = NewTooltip.."\255\255\255\255\n" + if fud.speed and fud.speed>0 then + NewTooltip = NewTooltip.."\255\193\255\187Speed: \255\134\255\121"..FormatNbr(fud.speed,2).."\255\255\255\255" + end + FoundTooltipType="knownbuildbutton" + + if fud.windGenerator > 1 then + local minWindE = FormatNbr((fud.windGenerator/25)*Game.windMin,0) + local maxWindE = FormatNbr((fud.windGenerator/25)*Game.windMax,0) + NewTooltip = NewTooltip.."Generates \255\255\255\0"..minWindE.."-"..maxWindE.." E/s\255\255\255\255 (up to +20% on higher ground) \n" + elseif fud.tidalGenerator == 1 then + NewTooltip = NewTooltip.."Generates \255\255\255\0"..Game.tidal.." E/s\255\255\255\255\n" + end + + --[[if fud.customParams.tip then + NewTooltip = NewTooltip.."\n\255\180\180\180"..fud.customParams.tip.."\255\255\255\255\n" + end]] + else + NewTooltip = NewTooltip.."\n"..unitpre.."\n"..unitname.." ("..unitdesc..")\n".. + "\255\255\213\213Health: ".."\255\255\170\170"..unithealth.. + "\n\255\213\213\255Build time: ".."\255\170\170\255".. + floor((29+floor(31+unitbuildtime/(buildpower/32)))/30).."s".. + "\255\255\255\255\n" + --NewTooltip = "WTF IS THIS " .. unitname + --Spring.Echo("collisions",collisions) + FoundTooltipType="unknownbuildbutton" + end + end + + local isItLiveUnitTooltip = string.match(CurrentTooltip,"Experience (.+) Cost ") + if isItLiveUnitTooltip or CurrentTooltip=="" then + + -- id being calculated way above + --[[if not id and spGetSelectedUnitsCount()>=1 then + id = spGetSelectedUnits()[spGetSelectedUnitsCount()] + end]] + + -- many units + --if id and spGetSelectedUnitsCount()>1 then + if spGetSelectedUnitsCount()>1 then + + if id then NewTooltip = NewTooltip .. GetTooltipUnit(id) + else + local totalMetalMake = 0 + local totalMetalUse = 0 + local totalEnergyMake = 0 + local totalEnergyUse = 0 + local totalHealth = 0 + local totalMaxHealth = 0 + local totalShieldPower = 0 + local totalMaxShieldPower = 0 + local totalEnergyCost = 0 + local totalMetalCost = 0 + local totalSupplyCost = 0 + local totalSupplyGive = 0 + local anyShield = false + local highestTech = 0 + + for _,u in pairs(spGetSelectedUnits()) do + + --[[local hpMod = spGetUnitRulesParam(u,"upgrade_hp") + if not hpMod then + hpMod = 1 + else + hpMod = 1 + hpMod + end]] + local ud=UnitDefs[Spring.GetUnitDefID(u)] + local metalMake,metalUse,energyMake,energyUse = Spring.GetUnitResources(u) + local health,maxHealth,paralyzeDamage,captureProgress,buildProgress = Spring.GetUnitHealth(u) + --[[health = health * hpMod + maxHealth = maxHealth * hpMod]] + health = health + maxHealth = maxHealth + local hasShield, ShieldPower=Spring.GetUnitShieldState(u) + local maxShieldPower = ud.shieldPower + if(hasShield) then + anyShield = true + end + + -- energy and metal cost + totalEnergyCost = totalEnergyCost + ud.energyCost + totalMetalCost = totalMetalCost + ud.metalCost + totalSupplyCost = totalSupplyCost + (ud.customParams.supply_cost or 0) + totalSupplyGive = totalSupplyGive + (ud.customParams.supply_granted or 0) + + -- Evo: upgrade levels + local upgradeLevel = ud.name:find("_up", -5) and tonumber(ud.name:sub(-1, -1)) or 0 + highestTech = highestTech < upgradeLevel and upgradeLevel or highestTech + + if (health and maxHealth) then + totalHealth = totalHealth + health + totalMaxHealth = totalMaxHealth + maxHealth + end + if (hasShield) then + totalShieldPower = totalShieldPower + ShieldPower + totalMaxShieldPower = totalMaxShieldPower + maxShieldPower + end + + -- energy and metal upkeep + if( metalMake and metalUse and energyMake and energyUse) then + totalMetalMake = totalMetalMake + metalMake + totalMetalUse = totalMetalUse + metalUse + totalEnergyMake = totalEnergyMake + energyMake + totalEnergyUse = totalEnergyUse + energyUse + end + end + + -- Evo: upgrade levels + local techStr = "" + if highestTech > 0 then techStr = white .. " Highest upgrade: " .. TechToStr[highestTech] end + + -- cost + --NewTooltip = NewTooltip.."\255\200\200\200Metal: "..totalMetalCost.." \255\255\255\0Energy: "..totalEnergyCost.."\n" + NewTooltip = NewTooltip..GetTooltipCost(totalSupplyCost, totalSupplyGive, totalEnergyCost, totalMetalCost)..techStr.."\n" + + -- health totals + NewTooltip = NewTooltip.."\255\200\200\200Health: ".."\255\200\200\200"..floor(totalHealth).."\255\200\200\200/\255\200\200\200"..floor(totalMaxHealth) + if anyShield then NewTooltip=NewTooltip.."\255\135\135\255 Shield: "..FormatNbr(math.min(totalShieldPower,totalMaxShieldPower)).."/"..FormatNbr(totalMaxShieldPower) end + + -- energy and metal upkeep totals + if true then + --NewTooltip = NewTooltip.."\n\255\200\200\200Metal: \255\0\255\0+"..FormatNbr(totalMetalMake,1).."\255\255\255\255/\255\255\0\0"..FormatNbr(-totalMetalUse,1) + --NewTooltip = NewTooltip.." \255\255\255\0Energy: \255\0\255\0+"..FormatNbr(totalEnergyMake,1).."\255\255\255\255/\255\255\0\0"..FormatNbr(-totalEnergyUse,1) + local upkeepStr = GetTooltipUpkeep(totalEnergyMake, totalEnergyUse, totalMetalMake, totalMetalUse) + NewTooltip = NewTooltip.."\n"..upkeepStr + end + end + + FoundTooltipType="liveunit" + + -- one unit + elseif id or spGetSelectedUnitsCount()==1 then + if not id then id = spGetSelectedUnits()[1] end + NewTooltip = NewTooltip .. GetTooltipUnit(id) + + FoundTooltipType="liveunit" + end + end + + local hotkeys = string.match(CurrentTooltip.."\n","Hotkeys: (.-)\n") + if hotkeys then + HotkeyTooltip = "\n\255\255\196\128Hotkeys: ".."\255\255\128\001"..hotkeys.."\255\255\255\255" + CurrentTooltip=string.gsub(CurrentTooltip.."\n","Hotkeys: .-\n","") + NewTooltip=NewTooltip..HotkeyTooltip + CurrentTooltip=CurrentTooltip..HotkeyTooltip + end + + -- default resource color (a,r,g,b) = (255, 255, 80, 1) + local _, metal = CurrentTooltip:find("Metal: ") + local _, energy = CurrentTooltip:find("Energy: ") + if metal and energy then + -- bad solution + local featureName = CurrentTooltip:match("(.+)\n") + local metalValue, _, energyValue = CurrentTooltip:match("(%d+)(.-)(%d+)") + if metalValue == "0" and energyValue == "0" then + CurrentTooltip = featureName + else + CurrentTooltip = CurrentTooltip:gsub("(%d+)(.-)(%d+)", "%3%2%1", 1) -- first swap metal and energy values for Evo (Supply, Energy, Metal) + CurrentTooltip = CurrentTooltip:sub(1, energy) .. CurrentTooltip:sub(energy + 5) -- remove default resource color + CurrentTooltip = CurrentTooltip:sub(1, metal) .. CurrentTooltip:sub(metal + 5) -- ditto + CurrentTooltip = CurrentTooltip:gsub("Metal: ", useEnergyTexture .. " " .. energyColour) -- swap the metal and energy strings to fit the values + CurrentTooltip = CurrentTooltip:gsub("Energy: ", useMetalTexture .. " " .. metalColour) + end + else + if CurrentTooltip == "Repair: Repairs another unit" then + CurrentTooltip = "Build: Builds unfinished structures" -- hack for Evo (no repair after construction completed) + end + + -- ignore sell command as well + if not CurrentTooltip:find("Refund amount") and not CurrentTooltip:find("Evolve into") then + -- Evo's Evolve tooltip is too cancer + --if CurrentTooltip:find("Evolve into") and not CurrentTooltip:find("turret") then CurrentTooltip = CurrentTooltip:sub(5) end + CurrentTooltip = CurrentTooltip:gsub("(.-: )", "\255\170\255\170%1"..white, 1) + end + + --[[local action = string.match(CurrentTooltip,"(.-)\n") + if action then + action = string.match(action,"(.-): ") + if action then + CurrentTooltip=string.gsub(CurrentTooltip,"(.-): ","",1) + CurrentTooltip="\255\170\255\170"..action..":\255\255\255\255 "..CurrentTooltip + end + end]] + end + + if FoundTooltipType ~= "liveunit" then + if WG.smartSelectTooltip and WG.smartSelectTooltip.active then + local tooltipOverride = WG.smartSelectTooltip.unitCount .. " unit" .. (WG.smartSelectTooltip.unitCount > 1 and "s" or "") .. " selected\n" + tooltipOverride = tooltipOverride .. GetTooltipCost(WG.smartSelectTooltip.totalSupplyCost, WG.smartSelectTooltip.totalSupplyGive, WG.smartSelectTooltip.totalEnergyCost, WG.smartSelectTooltip.totalMetalCost) + if WG.smartSelectTooltip.highestTech ~= 0 then tooltipOverride = tooltipOverride .. white .. " Highest upgrade: " .. TechToStr[WG.smartSelectTooltip.highestTech] end + tempTooltip = tooltipOverride + return tempTooltip + end + end + + --Spring.Echo(FoundTooltipType) + if FoundTooltipType then + tempTooltip = NewTooltip + return NewTooltip + else + tempTooltip = CurrentTooltip + return CurrentTooltip + end +end + + +local xTooltipSize = 0 +local yTooltipSize = 0 +local tooltipX, tooltipY = 0, 0 +local bgmargin = 4 + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + -- KP_ToolTip is probably deprecated + --WG.KP_ToolTip=nil + if Spring.IsGUIHidden() then + return + end + + if WG['topbar'] and WG['topbar'].showingQuit() then + return + end + + local nttString = GenerateNewTooltip() + local nttList = {} + local lengNttList = 0 + local maxWidth = 0 + for line in string.gmatch(nttString,"[^\r\n]+") do + --table.insert(nttList,"\255\255\255\255"..line) + lengNttList = lengNttList + 1 + nttList[lengNttList] = stringSplitIcons("\255\255\255\255"..line, false, useMetalTexture, useEnergyTexture, useSupplyTexture) + local width = FontSize * font:GetTextWidth(line) + for i = 2, #nttList[lengNttList], 2 do + width = width - FontSize * font:GetTextWidth(nttList[lengNttList][i]) + FontSize + end + if width > maxWidth then + maxWidth = width + end + end + + --xTooltipSize = FontSize*(1+maxWidth) + xTooltipSize = maxWidth + FontSize + yTooltipSize = FontSize*(1+lengNttList) + + -- Bottom left position by default + local x1,y1,x2,y2= tooltipX, tooltipY, tooltipX + xTooltipSize, tooltipY + yTooltipSize + + -- Note: this line is done even if the KP_ToolTip is devoid of text + -- The only case where KP_ToolTip is nil are when the widget is off or the GUI is hidden + --WG.KP_ToolTip={x1=x1,y1=y1,x2=x2,y2=y2,xSize=xTooltipSize,ySize=yTooltipSize,FontSize=FontSize} + + + gl.Blending(GL.SRC_ALPHA,GL.ONE_MINUS_SRC_ALPHA) -- default + if WG.MidKnightBG then + gl.Color(1,1,1,1) + gl.Texture("bitmaps/tooltipbg.png") + gl.TexRect(x1,y1,x2*1.2,y2*1.2,0.01,0.99,0.99,0.01) + gl.Texture(false) + else + local tl, tr, br, bl = (y2 >= vsy or x1 <= 0) and 0 or 1, (y2 >= vsy or x2 >= vsx) and 0 or 1, (y1 <= 0 or x2 >= vsx) and 0 or 1, (y1 <= 0 or x1 <= 0) and 0 or 1 + gl.Color(0.0,0.0,0.0,ui_opacity) --background + RectRound(x1, y1, x2, y2, 15,tl, tr, br, bl,vsx,vsy) + gl.Color(0.33,0.33,0.33,0.1*ui_opacity) + RectRound(x1 + bgmargin, y1 + bgmargin, x2 - bgmargin, y2 - bgmargin, 10,tl, tr, br, bl,vsx,vsy) + --[[gl.Rect(x1,y1,x2,y2) + gl.Color(0.0,0.0,0.0,1) --border + gl.LineWidth(1) + gl.Shape(GL.LINE_LOOP,{ + {v={x1,y2}},{v={x2,y2}}, + {v={x2,y1}},{v={x1,y1}},}) + ]] + gl.Color(1,1,1,1) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(x1, y1, x2, y2, 'evo_tooltip') + end + end + font:Begin() + for i = 1, lengNttList do + local iconStr = nttList[i] + local currX, currY = x1 + FontSize / 2, y1 + FontSize * (lengNttList + 0.5 - i) + for j = 1, #iconStr do + if j % 2 == 1 then + font:Print(iconStr[j], currX, currY, FontSize, 'o') + currX = currX + FontSize * font:GetTextWidth(iconStr[j]) + else + gl.Texture(drawIcons[iconStr[j]]) + -- Icon size = font size + gl.TexRect(currX, currY - FontSize * 0.2, currX + FontSize, currY - FontSize * 0.2 + FontSize, 0.2, 0.8, 0.8, 0.2) + currX = currX + FontSize + end + end + --font:Print(nttList[i], currX, currY, FontSize, 'o') + end + gl.Texture(false) + font:Print("\255\255\255\255 ",0,0,FontSize,'o') -- Reset color to white for other widgets using gl.Text + font:End() +end + + +local uiOpacitySec = 0 +function widget:Update(dt) + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + end + end +end + + +--[[ +-- tweaking UI position with ctrl+f11 +local widgetScale = 1 -- potential TODO +local tweakStartX, tweakStartY = 0, 0 +function widget:TweakMousePress(x, y, button) + local posxScaled = posx - (bgmargin*widgetScale) - ((vsx - posx) * (widgetScale-1)) + local posyScaled = posy - (bgmargin*widgetScale) - ((vsy - posy) * (widgetScale-1)) + if x >= posxScaled and x < posxScaled + ((width+bgmargin+bgmargin)*widgetScale) and y >= posyScaled and y < posyScaled + ((height+bgmargin+bgmargin)*widgetScale) then + tweakStartX = x - posx + tweakStartY = y - posy + return true + end +end + +function widget:TweakMouseMove(x, y, dx, dy, button) + posx = x - tweakStartX + posy = y - tweakStartY + if posx < 0 then + posx = 0 + end + if posx > vsx - width then + posx = vsx - width + end + if posy < 0 then + posy = 0 + end + if posy > vsy - height then + posy = vsy - height + end + generateDisplayList() + generateDisplayList3() +end + +-- save and load +function widget:GetConfigData(data) + return { + posx = posx, + posy = posy, + } +end + +function widget:SetConfigData(data) + posx = data.posx or posx + posy = data.posy or posy + generateDisplayList() + generateDisplayList3() +end + ]] + +--function widget:MouseWheel(up,value) +-- local xMouse,yMouse = GetMouseState() +-- if xMouse < xTooltipSize and yMouse < yTooltipSize and not Spring.IsGUIHidden() then +-- if up then +-- FontSize = math.max(FontSize - 1,2) +-- else +-- FontSize = FontSize + 1 +-- end +-- return true +-- end +-- return false +--end diff --git a/LuaUI/Widgets_Evo/gui_faction_change.lua b/LuaUI/Widgets_Evo/gui_faction_change.lua new file mode 100644 index 000000000..0d43c9f2a --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_faction_change.lua @@ -0,0 +1,347 @@ + +function widget:GetInfo() + return { + name = 'Faction Change', + desc = 'Adds buttons to switch faction', + author = 'Niobium', + date = 'May 2011', + license = 'GNU GPL v2', + layer = -100, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-- Var +-------------------------------------------------------------------------------- +local wWidth, wHeight = Spring.GetWindowGeometry() +local px, py = 0.42*wWidth, 0.42*wHeight + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +-------------------------------------------------------------------------------- +-- Speedups +-------------------------------------------------------------------------------- +local teamList = Spring.GetTeamList() +local myTeamID = Spring.GetMyTeamID() + +local glTexCoord = gl.TexCoord +local glVertex = gl.Vertex +local glColor = gl.Color +local glRect = gl.Rect +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glDepthTest = gl.DepthTest +local glBeginEnd = gl.BeginEnd +local GL_QUADS = GL.QUADS +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glTranslate = gl.Translate +local glBeginText = gl.BeginText +local glEndText = gl.EndText +local glText = gl.Text +local glCallList = gl.CallList +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList + +local spGetTeamStartPosition = Spring.GetTeamStartPosition +local spGetTeamRulesParam = Spring.GetTeamRulesParam +local spGetGroundHeight = Spring.GetGroundHeight +local spSendLuaRulesMsg = Spring.SendLuaRulesMsg +local spGetSpectatingState = Spring.GetSpectatingState + +local fedcomDefID = UnitDefNames.fedcommander.id +local lozcomDefID = UnitDefNames.lozcommander.id + +local commanderDefID = spGetTeamRulesParam(myTeamID, 'startUnit') +local amNewbie = (spGetTeamRulesParam(myTeamID, 'isNewbie') == 1) + +local factionChangeList + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (1.5 + (vsx*vsy / 5000000)) + +local bgcorner = "LuaUI/Images/bgcorner.png" + +-------------------------------------------------------------------------------- +-- Funcs +-------------------------------------------------------------------------------- + +local function QuadVerts(x, y, z, r) + glTexCoord(0, 0); glVertex(x - r, y, z - r) + glTexCoord(1, 0); glVertex(x + r, y, z - r) + glTexCoord(1, 1); glVertex(x + r, y, z + r) + glTexCoord(0, 1); glVertex(x - r, y, z + r) +end + +local function DrawRectRound(px,py,sx,sy,cs) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + --if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- top right + --if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + --if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + --if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +function updateGuishader() + if WG['guishader'] then + if backgroundGuishader then + glDeleteList(backgroundGuishader) + end + backgroundGuishader = glCreateList( function() + RectRound(px+(2*widgetScale), py+(2*widgetScale), px+(190*widgetScale), py+(78*widgetScale), 6*widgetScale) + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'factionchange') + end +end + +-------------------------------------------------------------------------------- +-- Callins +-------------------------------------------------------------------------------- + +function widget:Initialize() + if spGetSpectatingState() or + Spring.GetGameFrame() > 0 or + amNewbie then + widgetHandler:RemoveWidget(self) + end +end + +function widget:Shutdown() + if WG['guishader'] then + WG['guishader'].DeleteDlist('factionchange') + end + if factionChangeList then + glDeleteList(factionChangeList) + end + gl.DeleteFont(font) +end + +function widget:DrawWorld() + if chobbyInterface then return end + glColor(1, 1, 1, 0.5) + glDepthTest(false) + for i = 1, #teamList do + local teamID = teamList[i] + local tsx, tsy, tsz = spGetTeamStartPosition(teamID) + if tsx and tsx > 0 then + if spGetTeamRulesParam(teamID, 'startUnit') == fedcomDefID then + glTexture('LuaUI/Images/ecommander.png') + glBeginEnd(GL_QUADS, QuadVerts, tsx, spGetGroundHeight(tsx, tsz), tsz, 80) + elseif spGetTeamRulesParam(teamID, 'startUnit') == lozcomDefID then + glTexture('LuaUI/Images/lozcommander.png') + glBeginEnd(GL_QUADS, QuadVerts, tsx, spGetGroundHeight(tsx, tsz), tsz, 64) + end + end + end + glTexture(false) +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + + -- Spectator check + if spGetSpectatingState() then + widgetHandler:RemoveWidget(self) + return + end + + -- Positioning + glPushMatrix() + glTranslate(px, py, 0) + --call list + if factionChangeList then + glCallList(factionChangeList) + else + factionChangeList = glCreateList(GenerateFactionChangeList) + updateGuishader() + end + glPopMatrix() + + +end + +function widget:ViewResize(n_vsx,n_vsy) + vsx, vsy = gl.GetViewSizes() + widgetScale = (1.5 + (vsx*vsy / 5000000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function GenerateFactionChangeList() + -- Panel + glColor(0, 0, 0, 0.66) + RectRound(0, 0, 192*widgetScale, 80*widgetScale,6*widgetScale) + glColor(1, 1, 1, 0.025) + RectRound(2*widgetScale, 2*widgetScale, 190*widgetScale, 78*widgetScale, 5*widgetScale) + + + -- Highlight + glColor(0.8, 0.8, 0.8, 0.3) + if commanderDefID == fedcomDefID then + RectRound(3*widgetScale, 3*widgetScale, 61*widgetScale, 61*widgetScale,4.5*widgetScale) + elseif commanderDefID == lozcomDefID then + RectRound(65*widgetScale, 3*widgetScale, 125*widgetScale, 61*widgetScale,4.5*widgetScale) + elseif commanderDefID == patterncomDefID then + RectRound(128*widgetScale, 3*widgetScale, 189*widgetScale, 61*widgetScale,4.5*widgetScale) + end + -- Icons + glColor(1, 1, 1, 1) + glTexture('LuaUI/Images/ecommander.png') + glTexRect(12*widgetScale, 17*widgetScale, 52*widgetScale, 59*widgetScale) + glTexture('LuaUI/Images/lozcommander.png') + glTexRect(76*widgetScale, 20*widgetScale, 116*widgetScale, 60*widgetScale) + glTexture(false) + + -- Text + font:Begin() + font:Print('Choose Your Faction', 96*widgetScale, 64*widgetScale, 11.5*widgetScale, 'ocd') + font:Print('Federation of Kala', 32*widgetScale, 4*widgetScale, 12*widgetScale, 'ocd') + font:Print('Loz Alliance', 96*widgetScale, 4*widgetScale, 12*widgetScale, 'ocd') + font:End() +end + + + +function widget:MousePress(mx, my, mButton) + + -- Check 3 of the 4 sides + if mx >= px and my >= py and my < py + (80*widgetScale) then + + -- Check buttons + if mButton == 1 then + + -- Spectator check before any action + if spGetSpectatingState() then + widgetHandler:RemoveWidget(self) + return false + end + + local newCom + -- Which button? + if mx < px + (64*widgetScale) then + newCom = fedcomDefID + elseif mx < px + (128*widgetScale) then + newCom = lozcomDefID + elseif mx < px + (192*widgetScale) then + newCom = patterncomDefID + end + if newCom then + commanderDefID = newCom + -- tell initial_spawn + spSendLuaRulesMsg("\138" .. tostring(commanderDefID)) + -- tell initial_queue + if WG["faction_change"] then + WG["faction_change"](commanderDefID) + end + + --Remake gui + if factionChangeList then + glDeleteList(factionChangeList) + end + factionChangeList = glCreateList(GenerateFactionChangeList) + updateGuishader() + + return true + end + + elseif (mButton == 2 or mButton == 3) and mx < px + (192*widgetScale) then + -- Dragging + return true + end + end +end + +function widget:MouseMove(mx, my, dx, dy, mButton) + -- Dragging + if mButton == 2 or mButton == 3 then + px = px + dx + py = py + dy + if factionChangeList then + glDeleteList(factionChangeList) + end + factionChangeList = glCreateList(FactionChangeList) + end +end + +function widget:GameStart() + widgetHandler:RemoveWidget(self) +end + diff --git a/LuaUI/Widgets_Evo/gui_fancy_selected_units.lua b/LuaUI/Widgets_Evo/gui_fancy_selected_units.lua index d8b4edeb4..64670fcb9 100644 --- a/LuaUI/Widgets_Evo/gui_fancy_selected_units.lua +++ b/LuaUI/Widgets_Evo/gui_fancy_selected_units.lua @@ -5,7 +5,7 @@ function widget:GetInfo() author = "Floris", date = "04.04.2014", license = "GNU GPL, v2 or later", - layer = 2, + layer = -50, enabled = true } end @@ -13,13 +13,6 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local clearquad -local shapes = {} - -local rad_con = 180 / math.pi - -local UNITCONF = {} - local currentRotationAngle = 0 local currentRotationAngleOpposite = 0 local previousOsClock = os.clock() @@ -28,15 +21,23 @@ local animationMultiplier = 1 local animationMultiplierInner = 1 local animationMultiplierAdd = true -local defaultEngineSelection = true +local clearquad +local shapes = {} +local degrot = {} + +local rad_con = 180 / math.pi +local math_acos = math.acos + +local UNITCONF = {} local selectedUnits = {} -local perfSelectedUnits = {} +local selectedUnitsInvisible = {} local maxSelectTime = 0 --time at which units "new selection" animation will end local maxDeselectedTime = -1 --time at which units deselection animation will end -local currentOption = 5 +local checkSelectionChanges = true +local limitDetails = false local glCallList = gl.CallList local glDrawListAtUnit = gl.DrawListAtUnit @@ -60,29 +61,20 @@ local spIsUnitVisible = Spring.IsUnitVisible -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local OPTIONS = {} -OPTIONS.defaults = { -- these will be loaded when switching style, but the style will overwrite the those values - name = "Defaults", - -- Quality settings - showNoOverlap = false, -- set true for no line overlapping - showBase = true, - showFirstLine = true, - showFirstLineDetails = true, - showSecondLine = false, +local OPTIONS = { -- these will be loaded when switching style, but the style will overwrite the those values showExtraComLine = true, -- extra circle lines for the commander unit showExtraBuildingWeaponLine = true, - teamcolorOpacity = 0.1, -- teamcolor use for the base platter + teamcolorOpacity = 0.55, -- how much teamcolor used for the base platter -- opacity - spotterOpacity = 0.9, - baseOpacity = 0.22, + spotterOpacity = 0.95, + baseOpacity = 0.15, -- setting to 0: wont be rendered firstLineOpacity = 1, - secondLineOpacity = 1, -- animation selectionStartAnimation = true, - selectionStartAnimationTime = 0.045, + selectionStartAnimationTime = 0.05, selectionStartAnimationScale = 0.82, -- selectionStartAnimationScale = 1.17, selectionEndAnimation = true, @@ -91,7 +83,7 @@ OPTIONS.defaults = { -- these will be loaded when switching style, but the style --selectionEndAnimationScale = 1.17, -- animation - rotationSpeed = 1, + rotationSpeed = 2.5, animationSpeed = 0.00045, -- speed of scaling up/down inner and outer lines animateSpotterSize = true, maxAnimationMultiplier = 1.012, @@ -99,144 +91,21 @@ OPTIONS.defaults = { -- these will be loaded when switching style, but the style -- circle shape solidCirclePieces = 32, - circlePieces = 24, - circlePieceDetail = 1, -- smoothness of each piece (1 or higher) - circleSpaceUsage = 0.7, -- 1 = whole circle space gets filled - circleInnerOffset = 0.45, + circlePieces = 64, + circlePieceDetail = 1, + circleSpaceUsage = 1, + circleInnerOffset = 0, -- size - scaleMultiplier = 1.04, innersize = 1.7, selectinner = 1.66, outersize = 1.8, } -table.insert(OPTIONS, { - name = "Cheap Fill", - showFirstLineDetails = false, - rotationSpeed = 0, - baseOpacity = 0.4, -}) -table.insert(OPTIONS, { - name = "Tilted Blocky Dots", - circlePieces = 36, - circlePieceDetail = 1, - circleSpaceUsage = 0.7, - circleInnerOffset = 0.45, -}) -table.insert(OPTIONS, { - name = "Blocky Dots", - circlePieces = 40, - circlePieceDetail = 1, - circleSpaceUsage = 0.55, - circleInnerOffset = 0, - rotationSpeed = 1, -}) -table.insert(OPTIONS, { - name = "Stretched Blocky Dots", - circlePieces = 22, - circlePieceDetail = 4, - circleSpaceUsage = 0.28, - circleInnerOffset = 1, -}) -table.insert(OPTIONS, { - name = "Curvy Lines", - circlePieces = 5, - circlePieceDetail = 7, - circleSpaceUsage = 0.7, - circleInnerOffset = 0, - rotationSpeed = 1.8, -}) -table.insert(OPTIONS, { - name = "Curvy Lines 2", - circlePieces = 7, - circlePieceDetail = 4, - circleSpaceUsage = 0.7, - circleInnerOffset = 0, - rotationSpeed = 2.5, -}) -local styleList = {} -for i,_ in ipairs(OPTIONS) do - styleList[i] = OPTIONS[i].name -end - -function table.shallow_copy(t) - local t2 = {} - for k,v in pairs(t) do - t2[k] = v - end - return t2 -end -OPTIONS_original = table.shallow_copy(OPTIONS) -OPTIONS_original.defaults = nil ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ -local function updateSelectedUnitsData() - - -- remove deselected units - local clockDifference - for teamID,_ in pairs(selectedUnits) do - for unitID,_ in pairs(selectedUnits[teamID]) do - if not spIsUnitSelected(unitID) and selectedUnits[teamID][unitID]['selected'] then - clockDifference = OPTIONS[currentOption].selectionStartAnimationTime - (currentClock - selectedUnits[teamID][unitID]['new']) - if clockDifference < 0 then - clockDifference = 0 - end - selectedUnits[teamID][unitID]['selected'] = false - selectedUnits[teamID][unitID]['new'] = false - selectedUnits[teamID][unitID]['old'] = currentClock - clockDifference - end - end - end - - -- add selected units - if spGetSelectedUnitsCount() > 0 then - local units = spGetSelectedUnitsSorted() - local clockDifference, unit, unitID - for uDID,_ in pairs(units) do - if uDID ~= 'n' then --'n' returns table size - for i=1,#units[uDID] do - unitID = units[uDID][i] - unit = UNITCONF[uDID] - if (unit) then - teamID = spGetUnitTeam(unitID) - if not selectedUnits[teamID] then - selectedUnits[teamID] = {} - end - if not selectedUnits[teamID][unitID] then - selectedUnits[teamID][unitID] = {} - selectedUnits[teamID][unitID]['new'] = currentClock - elseif selectedUnits[teamID][unitID]['old'] then - clockDifference = OPTIONS[currentOption].selectionEndAnimationTime - (currentClock - selectedUnits[teamID][unitID]['old']) - if clockDifference < 0 then - clockDifference = 0 - end - selectedUnits[teamID][unitID]['new'] = currentClock - clockDifference - selectedUnits[teamID][unitID]['old'] = nil - end - selectedUnits[teamID][unitID]['selected'] = true - end - end - end - end - end - - -- creates has blinking problem - --[[ create new table that has iterative keys instead of unitID (to speedup after about 300 different units have ever been selected) - perfSelectedUnits = {} - for teamID,_ in pairs(selectedUnits) do - perfSelectedUnits[teamID] = {} - for unitID,_ in pairs(selectedUnits[teamID]) do - table.insert(perfSelectedUnits[teamID], unitID) - end - perfSelectedUnits[teamID]['totalUnits'] = table.getn(perfSelectedUnits[teamID]) - end - ]]-- -end - - local function SetupCommandColors(state) spLoadCmdColorsConfig('unitBox 0 1 0 ' .. (state and 1 or 0)) end @@ -248,10 +117,10 @@ end local function CreateDisplayLists(callback) local displayLists = {} - displayLists.select = callback.fading(OPTIONS[currentOption].outersize, OPTIONS[currentOption].selectinner) - displayLists.inner = callback.solid({0, 0, 0, 0}, OPTIONS[currentOption].innersize) - displayLists.large = callback.solid(nil, OPTIONS[currentOption].selectinner) - displayLists.shape = callback.fading(OPTIONS[currentOption].innersize, OPTIONS[currentOption].selectinner) + displayLists.select = callback.fading(OPTIONS.outersize, OPTIONS.selectinner) + displayLists.inner = callback.solid({0, 0, 0, 0}, OPTIONS.innersize) + displayLists.large = callback.solid(nil, OPTIONS.selectinner) + displayLists.shape = callback.fading(OPTIONS.innersize, OPTIONS.selectinner) return displayLists end @@ -261,18 +130,18 @@ end local function DrawCircleLine(innersize, outersize) gl.BeginEnd(GL.QUADS, function() local detailPartWidth, a1,a2,a3,a4 - local width = OPTIONS[currentOption].circleSpaceUsage - local detail = OPTIONS[currentOption].circlePieceDetail + local width = OPTIONS.circleSpaceUsage + local detail = OPTIONS.circlePieceDetail - local radstep = (2.0 * math.pi) / OPTIONS[currentOption].circlePieces - for i = 1, OPTIONS[currentOption].circlePieces do + local radstep = (2.0 * math.pi) / OPTIONS.circlePieces + for i = 1, OPTIONS.circlePieces do for d = 1, detail do detailPartWidth = ((width / detail) * d) a1 = ((i+detailPartWidth - (width / detail)) * radstep) a2 = ((i+detailPartWidth) * radstep) - a3 = ((i+OPTIONS[currentOption].circleInnerOffset+detailPartWidth - (width / detail)) * radstep) - a4 = ((i+OPTIONS[currentOption].circleInnerOffset+detailPartWidth) * radstep) + a3 = ((i+OPTIONS.circleInnerOffset+detailPartWidth - (width / detail)) * radstep) + a4 = ((i+OPTIONS.circleInnerOffset+detailPartWidth) * radstep) --outer (fadein) gl.Vertex(math.sin(a4)*innersize, 1, math.cos(a4)*innersize) @@ -287,7 +156,7 @@ end local function DrawCircleSolid(size) gl.BeginEnd(GL.TRIANGLE_FAN, function() - local pieces = OPTIONS[currentOption].solidCirclePieces + local pieces = OPTIONS.solidCirclePieces local radstep = (2.0 * math.pi) / pieces local a1 if (color) then @@ -357,8 +226,6 @@ local function DrawSquareSolid(size) local width, a1,a2,a2_2 local radstep = (2.0 * math.pi) / 4 - gl.Vertex(0, 0, 0) - for i = 1, 4 do --straight piece width = 0.7 @@ -366,6 +233,7 @@ local function DrawSquareSolid(size) a1 = (i * radstep) a2 = ((i+width) * radstep) + gl.Vertex(0, 0, 0) gl.Vertex(math.sin(a2)*size, 1, math.cos(a2)*size) gl.Vertex(math.sin(a1)*size, 1, math.cos(a1)*size) @@ -377,6 +245,7 @@ local function DrawSquareSolid(size) i = i -0.6 a2_2 = ((i+width) * radstep) + gl.Vertex(0, 0, 0) gl.Vertex(math.sin(a2_2)*size, 1, math.cos(a2_2)*size) gl.Vertex(math.sin(a1)*size, 1, math.cos(a1)*size) end @@ -407,8 +276,8 @@ local function DrawTriangleLine(innersize, outersize) for i = 1, 3 do --straight piece - width = 0.7 - i = i + 0.65 + width = 0.75 + i = i + 0.625 a1 = (i * radstep) a2 = ((i+width) * radstep) @@ -419,7 +288,7 @@ local function DrawTriangleLine(innersize, outersize) gl.Vertex(math.sin(a2)*outersize, 1, math.cos(a2)*outersize) -- corner piece - width = 0.3 + width = 0.35 i = i + 3 a1 = (i * radstep) a2 = ((i+width) * radstep) @@ -443,26 +312,26 @@ local function DrawTriangleSolid(size) local width, a1,a2,a2_2 local radstep = (2.0 * math.pi) / 3 - gl.Vertex(0, 1, 0) - for i = 1, 3 do -- straight piece - width = 0.7 - i = i + 0.65 + width = 0.75 + i = i + 0.625 a1 = (i * radstep) a2 = ((i+width) * radstep) + gl.Vertex(0, 0, 0) gl.Vertex(math.sin(a2)*size, 1, math.cos(a2)*size) gl.Vertex(math.sin(a1)*size, 1, math.cos(a1)*size) -- corner piece - width = 0.3 + width = 0.35 i = i + 3 a1 = (i * radstep) a2 = ((i+width) * radstep) i = i -0.6 a2_2 = ((i+width) * radstep) + gl.Vertex(0, 0, 0) gl.Vertex(math.sin(a2_2)*size, 1, math.cos(a2_2)*size) gl.Vertex(math.sin(a1)*size, 1, math.cos(a1)*size) end @@ -512,75 +381,45 @@ function widget:Initialize() WG['fancyselectedunits'] = {} WG['fancyselectedunits'].getOpacity = function() - return OPTIONS.defaults.spotterOpacity + return OPTIONS.spotterOpacity end WG['fancyselectedunits'].setOpacity = function(value) - OPTIONS.defaults.spotterOpacity = value - OPTIONS[currentOption].spotterOpacity = value + OPTIONS.spotterOpacity = value + OPTIONS.spotterOpacity = value end WG['fancyselectedunits'].getBaseOpacity = function() - return OPTIONS.defaults.baseOpacity + return OPTIONS.baseOpacity end WG['fancyselectedunits'].setBaseOpacity = function(value) - OPTIONS.defaults.baseOpacity = value - OPTIONS[currentOption].baseOpacity = value + OPTIONS.baseOpacity = value + OPTIONS.baseOpacity = value end WG['fancyselectedunits'].getTeamcolorOpacity = function() - return OPTIONS.defaults.teamcolorOpacity + return OPTIONS.teamcolorOpacity end WG['fancyselectedunits'].setTeamcolorOpacity = function(value) - OPTIONS.defaults.teamcolorOpacity = value - OPTIONS[currentOption].teamcolorOpacity = value - end - WG['fancyselectedunits'].getSecondLine = function() - return OPTIONS.defaults.showSecondLine - end - WG['fancyselectedunits'].setSecondLine = function(value) - OPTIONS.defaults.showSecondLine = value - OPTIONS[currentOption].showSecondLine = value - end - WG['fancyselectedunits'].getStyle = function() - return currentOption - end - WG['fancyselectedunits'].getStyleList = function() - return styleList - end - WG['fancyselectedunits'].setStyle = function(value) - currentOption = value - loadConfig() + OPTIONS.teamcolorOpacity = value + OPTIONS.teamcolorOpacity = value end SetupCommandColors(false) end -function loadOption() - local appliedOption = OPTIONS_original[currentOption] - OPTIONS[currentOption] = table.shallow_copy(OPTIONS.defaults) - - for option, value in pairs(appliedOption) do - OPTIONS[currentOption][option] = value - end -end - - function loadConfig() - loadOption() CreateCircleLists() CreateSquareLists() CreateTriangleLists() SetUnitConf() - - Spring.Echo("Fancy Selected Units-dev: loaded style... '"..OPTIONS[currentOption].name.."'") end function SetUnitConf() -- prefer not to change because other widgets use these values too (highlight_units, given_units, selfd_icons, ...) - local scaleFactor = 2.6 - local rectangleFactor = 3.3 + local scaleFactor = 2.6 + local rectangleFactor = 3.25 local name, shape, xscale, zscale, scale, xsize, zsize, weaponcount, shapeName for udid, unitDef in pairs(UnitDefs) do @@ -596,7 +435,11 @@ function SetUnitConf() elseif (unitDef.isAirUnit) then shapeName = 'triangle' shape = shapes.triangle - xscale, zscale = scale, scale + xscale, zscale = scale*1.07, scale*1.07 + elseif (unitDef.modCategories["ship"]) then + shapeName = 'circle' + shape = shapes.circle + xscale, zscale = scale*0.82, scale*0.82 else shapeName = 'circle' shape = shapes.circle @@ -632,171 +475,234 @@ end -------------------------------------------------------------------------------- -function widget:Update() +function GetUsedRotationAngle(unitID, shapeName, opposite) + if (shapeName == 'circle') then + if opposite then + return currentRotationAngleOpposite + else + return currentRotationAngle + end + else + return degrot[unitID] + end +end - currentClock = os.clock() - maxSelectTime = currentClock - OPTIONS[currentOption].selectionStartAnimationTime - maxDeselectedTime = currentClock - OPTIONS[currentOption].selectionEndAnimationTime - updateSelectedUnitsData() -- calling updateSelectedUnitsData() inside widget:CommandsChanged() will return in buggy behavior in combination with the 'smart-select' widget +local selectedUnitsSorted = Spring.GetSelectedUnitsSorted() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() +function widget:SelectionChanged(sel) + checkSelectionChanges = true end +local function updateSelectedUnitsData() -local degrot = {} -function widget:GameFrame(frame) - - if frame%1~=0 then return end + -- re-add selected units that became visible again + for unitID, unitParams in pairs(selectedUnitsInvisible) do + if spIsUnitVisible(unitID) then + selectedUnits[unitParams.teamID][unitID] = unitParams + selectedUnitsInvisible[unitID] = nil + end + end - -- logs current unit direction (needs regular updates for air units, and for buildings only once) for teamID,_ in pairs(perfSelectedUnits) do - --for teamID,_ in pairs(perfSelectedUnits) do - --for unitKey=1, perfSelectedUnits[teamID]['totalUnits'] do - --unitID = perfSelectedUnits[teamID][unitKey] + -- remove deselected and out-of-view units + -- adjust unit direction + local clockDifference + local visibleUnitCount = 0 for teamID,_ in pairs(selectedUnits) do for unitID,_ in pairs(selectedUnits[teamID]) do - local dirx, _, dirz = spGetUnitDirection(unitID) - if (dirz ~= nil) then - degrot[unitID] = 180 - math.acos(dirz) * rad_con - if dirx < 0 then - degrot[unitID] = 180 - math.acos(dirz) * rad_con - else - degrot[unitID] = 180 + math.acos(dirz) * rad_con + + -- remove deselected units + if not spIsUnitSelected(unitID) and selectedUnits[teamID][unitID].selected then + clockDifference = OPTIONS.selectionStartAnimationTime - (currentClock - selectedUnits[teamID][unitID].new) + if clockDifference < 0 then + clockDifference = 0 + end + selectedUnits[teamID][unitID].selected = false + selectedUnits[teamID][unitID].new = false + selectedUnits[teamID][unitID].old = currentClock - clockDifference + end + selectedUnits[teamID][unitID].visible = spIsUnitVisible(unitID) + + -- check if isnt visible + if not spIsUnitVisible(unitID) then + selectedUnitsInvisible[unitID] = selectedUnits[teamID][unitID] + selectedUnitsInvisible[unitID].teamID = teamID + selectedUnits[teamID][unitID] = nil + else + visibleUnitCount = visibleUnitCount + 1 + -- logs current unit direction (needs regular updates for air units, and for buildings only once) + local dirx, _, dirz = spGetUnitDirection(unitID) + if (dirz ~= nil) then + degrot[unitID] = 180 - math_acos(dirz) * rad_con + if dirx < 0 then + degrot[unitID] = 180 - math_acos(dirz) * rad_con + else + degrot[unitID] = 180 + math_acos(dirz) * rad_con + end end end end end -end - -function GetUsedRotationAngle(unitID, shapeName, opposite) - if (shapeName == 'circle') then - if opposite then - return currentRotationAngleOpposite - else - return currentRotationAngle + -- add selected units + if selectedUnitsCount > 0 then + local units = selectedUnitsSorted + local clockDifference, unitID, teamID + for uDID,_ in pairs(units) do + if uDID ~= 'n' then --'n' returns table size + for i=1, #units[uDID] do + unitID = units[uDID][i] + if UNITCONF[uDID] then + teamID = spGetUnitTeam(unitID) + if teamID then + if not selectedUnits[teamID] then + selectedUnits[teamID] = {} + end + if not selectedUnitsInvisible[unitID] then + if not selectedUnits[teamID][unitID] then + selectedUnits[teamID][unitID] = {} + selectedUnits[teamID][unitID].new = currentClock + elseif selectedUnits[teamID][unitID].old then + clockDifference = OPTIONS.selectionEndAnimationTime - (currentClock - selectedUnits[teamID][unitID].old) + if clockDifference < 0 then + clockDifference = 0 + end + selectedUnits[teamID][unitID].new = currentClock - clockDifference + selectedUnits[teamID][unitID].old = nil + end + selectedUnits[teamID][unitID].selected = true + selectedUnits[teamID][unitID].udid = spGetUnitDefID(unitID) + selectedUnits[teamID][unitID].visible = spIsUnitVisible(unitID) + end + end + end + end + end end - else - return degrot[unitID] end end +local selChangedSec = 0 +function widget:Update(dt) + currentClock = os.clock() + maxSelectTime = currentClock - OPTIONS.selectionStartAnimationTime + maxDeselectedTime = currentClock - OPTIONS.selectionEndAnimationTime + + selChangedSec = selChangedSec + dt + if checkSelectionChanges and selChangedSec >= 0.05 then + selChangedSec = 0 + selectedUnitsSorted = Spring.GetSelectedUnitsSorted() + selectedUnitsCount = Spring.GetSelectedUnitsCount() + updateSelectedUnitsData() + checkSelectionChanges = false + end +end do - local unitID, udid, unit, draw, unitPosX, unitPosY, unitPosZ, changedScale, usedAlpha, usedScale, usedXScale, usedZScale, usedRotationAngle + local unitID, unit, draw, unitPosX, unitPosY, unitPosZ, changedScale, usedAlpha, usedScale, usedXScale, usedZScale, usedRotationAngle local health,maxHealth,paralyzeDamage,captureProgress,buildProgress function DrawSelectionSpottersPart(teamID, type, r,g,b,a,scale, opposite, relativeScaleSchrinking, changeOpacity, drawUnitStyles) - local OPTIONScurrentOption = OPTIONS[currentOption] - - --for unitKey=1, perfSelectedUnits[teamID]['totalUnits'] do - -- unitID = perfSelectedUnits[teamID][unitKey] - for unitID in pairs(selectedUnits[teamID]) do - udid = spGetUnitDefID(unitID) - unit = UNITCONF[udid] - - if (unit) and spUnitInView(unitID) then -- and spIsUnitVisible(unitID, unit.xscale*scale*1.3, false) - unitPosX, unitPosY, unitPosZ = spGetUnitViewPosition(unitID, true) + for unitID,unitParams in pairs(selectedUnits[teamID]) do - changedScale = 1 - usedAlpha = a + unit = UNITCONF[unitParams.udid] + changedScale = 1 + usedAlpha = a - if not selectedUnits[teamID][unitID] then return end - - - if (OPTIONScurrentOption.selectionEndAnimation or OPTIONScurrentOption.selectionStartAnimation) then - if changeOpacity then - gl.Color(r,g,b,a) - end - -- check if the unit is deselected - if (OPTIONScurrentOption.selectionEndAnimation and not selectedUnits[teamID][unitID]['selected']) then - if (maxDeselectedTime < selectedUnits[teamID][unitID]['old']) then - changedScale = OPTIONScurrentOption.selectionEndAnimationScale + (((selectedUnits[teamID][unitID]['old'] - maxDeselectedTime) / OPTIONScurrentOption.selectionEndAnimationTime)) * (1 - OPTIONScurrentOption.selectionEndAnimationScale) - if (changeOpacity) then - if type == 'unit highlight' then - usedAlpha = (((selectedUnits[teamID][unitID]['old'] - maxDeselectedTime) / OPTIONScurrentOption.selectionEndAnimationTime) * a) - else - usedAlpha = 1 - (((selectedUnits[teamID][unitID]['old'] - maxDeselectedTime) / OPTIONScurrentOption.selectionEndAnimationTime) * (1-a)) - end - gl.Color(r,g,b,usedAlpha) - end - else - selectedUnits[teamID][unitID] = nil + if (OPTIONS.selectionEndAnimation or OPTIONS.selectionStartAnimation) then + if changeOpacity then + gl.Color(r,g,b,a) + end + -- check if the unit is deselected + if (OPTIONS.selectionEndAnimation and not unitParams.selected) then + if (maxDeselectedTime < unitParams.old) then + changedScale = OPTIONS.selectionEndAnimationScale + (((unitParams.old - maxDeselectedTime) / OPTIONS.selectionEndAnimationTime)) * (1 - OPTIONS.selectionEndAnimationScale) + if (changeOpacity) then + usedAlpha = 1 - (((unitParams.old - maxDeselectedTime) / OPTIONS.selectionEndAnimationTime) * (1-a)) + gl.Color(r,g,b,usedAlpha) end + else + selectedUnits[teamID][unitID] = nil + degrot[unitID] = nil + end - -- check if the unit is newly selected - elseif (OPTIONScurrentOption.selectionStartAnimation and selectedUnits[teamID][unitID]['new'] > maxSelectTime) then - --spEcho(selectedUnits[teamID][unitID]['new'] - maxSelectTime) - changedScale = OPTIONScurrentOption.selectionStartAnimationScale + (((currentClock - selectedUnits[teamID][unitID]['new']) / OPTIONScurrentOption.selectionStartAnimationTime)) * (1 - OPTIONScurrentOption.selectionStartAnimationScale) - if (changeOpacity) then - if type == 'unit highlight' then - usedAlpha = (((currentClock - selectedUnits[teamID][unitID]['new']) / OPTIONScurrentOption.selectionStartAnimationTime) * a) + -- check if the unit is newly selected + elseif (OPTIONS.selectionStartAnimation and unitParams.new > maxSelectTime) then + --spEcho(unitParams.new - maxSelectTime) + changedScale = OPTIONS.selectionStartAnimationScale + (((currentClock - unitParams.new) / OPTIONS.selectionStartAnimationTime)) * (1 - OPTIONS.selectionStartAnimationScale) + if (changeOpacity) then + usedAlpha = 1 - (((currentClock - unitParams.new) / OPTIONS.selectionStartAnimationTime) * (1-a)) + gl.Color(r,g,b,usedAlpha) + end + if not degrot[unitID] then + local dirx, _, dirz = spGetUnitDirection(unitID) + if (dirz ~= nil) then + degrot[unitID] = 180 - math_acos(dirz) * rad_con + if dirx < 0 then + degrot[unitID] = 180 - math_acos(dirz) * rad_con else - usedAlpha = 1 - (((currentClock - selectedUnits[teamID][unitID]['new']) / OPTIONScurrentOption.selectionStartAnimationTime) * (1-a)) + degrot[unitID] = 180 + math_acos(dirz) * rad_con end - gl.Color(r,g,b,usedAlpha) end end end + end - - if selectedUnits[teamID][unitID] then - - usedRotationAngle = GetUsedRotationAngle(unitID, unit.shapeName, opposite) - if type == 'normal solid' or type == 'normal alpha' then - - -- special style for coms - if drawUnitStyles and OPTIONScurrentOption.showExtraComLine and (unit.name == 'corcom' or unit.name == 'armcom') then - usedRotationAngle = GetUsedRotationAngle(unitID, unit.shapeName) - gl.Color(r,g,b,(usedAlpha*usedAlpha)+0.22) - usedScale = scale * 1.25 - glDrawListAtUnit(unitID, unit.shape.inner, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/10), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/10), currentRotationAngleOpposite, 0, degrot[unitID], 0) - usedScale = scale * 1.23 - usedRotationAngle = GetUsedRotationAngle(unitID, unit.shapeName , true) - gl.Color(r,g,b,(usedAlpha*usedAlpha)+0.08) - glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/10), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/10), 0, 0, degrot[unitID], 0) - else - -- adding style for buildings with weapons - if drawUnitStyles and OPTIONScurrentOption.showExtraBuildingWeaponLine and unit.shapeName == 'square' then - if (unit.weaponcount > 0) then - usedRotationAngle = GetUsedRotationAngle(unitID, unit.shapeName) - gl.Color(r,g,b,usedAlpha*(usedAlpha+0.2)) - usedScale = scale * 1.11 - glDrawListAtUnit(unitID, unit.shape.select, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/7.5), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/7.5), usedRotationAngle, 0, degrot[unitID], 0) - end - gl.Color(r,g,b,usedAlpha) - end - - if relativeScaleSchrinking then - glDrawListAtUnit(unitID, unit.shape.select, false, (unit.xscale*scale*changedScale)-((unit.xscale*changedScale-5)/10), 1.0, (unit.zscale*scale*changedScale)-((unit.zscale*changedScale-5)/10), usedRotationAngle, 0, degrot[unitID], 0) - else - glDrawListAtUnit(unitID, unit.shape.select, false, unit.xscale*scale*changedScale, 1.0, unit.zscale*scale*changedScale, usedRotationAngle, 0, degrot[unitID], 0) + if selectedUnits[teamID][unitID] and unitParams.visible then + usedRotationAngle = GetUsedRotationAngle(unitID, unit.shapeName, opposite) + + if type == 'normal solid' then + + -- special style for coms + if drawUnitStyles and OPTIONS.showExtraComLine and (unit.name == 'corcom' or unit.name == 'armcom') then + gl.Color(r,g,b,(usedAlpha*usedAlpha)+0.22) + usedScale = scale * 1.25 + glDrawListAtUnit(unitID, unit.shape.inner, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/10), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/10), currentRotationAngleOpposite, 0, degrot[unitID], 0) + usedScale = scale * 1.23 + gl.Color(r,g,b,(usedAlpha*usedAlpha)+0.08) + glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/10), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/10), 0, 0, degrot[unitID], 0) + else + -- adding style for buildings with weapons + if drawUnitStyles and OPTIONS.showExtraBuildingWeaponLine and unit.shapeName == 'square' then + if (unit.weaponcount > 0) then + gl.Color(r,g,b,usedAlpha*(usedAlpha+0.2)) + usedScale = scale * 1.1 + glDrawListAtUnit(unitID, unit.shape.select, false, (unit.xscale*usedScale*changedScale)-((unit.xscale*changedScale-10)/7.5), 1.0, (unit.zscale*usedScale*changedScale)-((unit.zscale*changedScale-10)/7.5), usedRotationAngle, 0, degrot[unitID], 0) end + gl.Color(r,g,b,usedAlpha) end - elseif type == 'solid overlap' then - if relativeScaleSchrinking then - glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*scale*changedScale)-((unit.xscale*changedScale-5)/50), 1.0, (unit.zscale*scale*changedScale)-((unit.zscale*changedScale-5)/50), usedRotationAngle, 0, degrot[unitID], 0) + glDrawListAtUnit(unitID, unit.shape.select, false, (unit.xscale*scale*changedScale)-((unit.xscale*changedScale-5)/10), 1.0, (unit.zscale*scale*changedScale)-((unit.zscale*changedScale-5)/10), usedRotationAngle, 0, degrot[unitID], 0) else - glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*scale*changedScale)+((unit.xscale-15)/15), 1.0, (unit.zscale*scale*changedScale)+((unit.zscale-15)/15), usedRotationAngle, 0, degrot[unitID], 0) + glDrawListAtUnit(unitID, unit.shape.select, false, unit.xscale*scale*changedScale, 1.0, unit.zscale*scale*changedScale, usedRotationAngle, 0, degrot[unitID], 0) end + end - elseif type == 'base solid' or type == 'base alpha' then - usedXScale = unit.xscale - usedZScale = unit.zscale - if OPTIONScurrentOption.showExtraComLine and (unit.name == 'corcom' or unit.name == 'armcom') then - usedXScale = usedXScale * 1.23 - usedZScale = usedZScale * 1.23 - elseif OPTIONScurrentOption.showExtraBuildingWeaponLine and unit.shapeName == 'square' then - if (unit.weaponcount > 0) then - usedXScale = usedXScale * 1.14 - usedZScale = usedZScale * 1.14 - end + elseif type == 'solid overlap' then + + if relativeScaleSchrinking then + glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*scale*changedScale)-((unit.xscale*changedScale-5)/50), 1.0, (unit.zscale*scale*changedScale)-((unit.zscale*changedScale-5)/50), usedRotationAngle, 0, degrot[unitID], 0) + else + glDrawListAtUnit(unitID, unit.shape.large, false, (unit.xscale*scale*changedScale)+((unit.xscale-15)/15), 1.0, (unit.zscale*scale*changedScale)+((unit.zscale-15)/15), usedRotationAngle, 0, degrot[unitID], 0) + end + + elseif type == 'base' then + usedXScale = unit.xscale + usedZScale = unit.zscale + if OPTIONS.showExtraComLine and (unit.name == 'corcom' or unit.name == 'armcom') then + usedXScale = usedXScale * 1.23 + usedZScale = usedZScale * 1.23 + elseif OPTIONS.showExtraBuildingWeaponLine and unit.shapeName == 'square' then + if (unit.weaponcount > 0) then + usedXScale = usedXScale * 1.14 + usedZScale = usedZScale * 1.14 end - glDrawListAtUnit(unitID, unit.shape.large, false, (usedXScale*scale*changedScale)-((usedXScale*changedScale-10)/10), 1.0, (usedZScale*scale*changedScale)-((usedZScale*changedScale-10)/10), usedRotationAngle, 0, degrot[unitID], 0) end + glDrawListAtUnit(unitID, unit.shape.large, false, (usedXScale*scale*changedScale)-((usedXScale*changedScale-10)/10), 1.0, (usedZScale*scale*changedScale)-((usedZScale*changedScale-10)/10), usedRotationAngle, 0, degrot[unitID], 0) end end end @@ -804,19 +710,22 @@ do end --// end do +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorldPreUnit() + if chobbyInterface then return end if spIsGUIHidden() then return end local clockDifference = (os.clock() - previousOsClock) previousOsClock = os.clock() - - gl.PushAttrib(GL.COLOR_BUFFER_BIT) - gl.DepthTest(false) - -- animate rotation - if OPTIONS[currentOption].rotationSpeed > 0 then - local angleDifference = (OPTIONS[currentOption].rotationSpeed) * (clockDifference * 5) + if OPTIONS.rotationSpeed > 0 then + local angleDifference = (OPTIONS.rotationSpeed) * (clockDifference * 5) currentRotationAngle = currentRotationAngle + (angleDifference*0.66) if currentRotationAngle > 360 then currentRotationAngle = currentRotationAngle - 360 @@ -829,63 +738,61 @@ function widget:DrawWorldPreUnit() end -- animate scale - if OPTIONS[currentOption].animateSpotterSize then - local addedMultiplierValue = OPTIONS[currentOption].animationSpeed * (clockDifference * 50) - if (animationMultiplierAdd and animationMultiplier < OPTIONS[currentOption].maxAnimationMultiplier) then + if OPTIONS.animateSpotterSize then + local addedMultiplierValue = OPTIONS.animationSpeed * (clockDifference * 50) + if (animationMultiplierAdd and animationMultiplier < OPTIONS.maxAnimationMultiplier) then animationMultiplier = animationMultiplier + addedMultiplierValue animationMultiplierInner = animationMultiplierInner - addedMultiplierValue - if (animationMultiplier > OPTIONS[currentOption].maxAnimationMultiplier) then - animationMultiplier = OPTIONS[currentOption].maxAnimationMultiplier - animationMultiplierInner = OPTIONS[currentOption].minAnimationMultiplier + if (animationMultiplier > OPTIONS.maxAnimationMultiplier) then + animationMultiplier = OPTIONS.maxAnimationMultiplier + animationMultiplierInner = OPTIONS.minAnimationMultiplier animationMultiplierAdd = false end else animationMultiplier = animationMultiplier - addedMultiplierValue animationMultiplierInner = animationMultiplierInner + addedMultiplierValue - if (animationMultiplier < OPTIONS[currentOption].minAnimationMultiplier) then - animationMultiplier = OPTIONS[currentOption].minAnimationMultiplier - animationMultiplierInner = OPTIONS[currentOption].maxAnimationMultiplier + if (animationMultiplier < OPTIONS.minAnimationMultiplier) then + animationMultiplier = OPTIONS.minAnimationMultiplier + animationMultiplierInner = OPTIONS.maxAnimationMultiplier animationMultiplierAdd = true end end end + + local baseR, baseG, baseB, a, scale, scaleBase, scaleOuter + scale = 1 * animationMultiplierInner + scaleBase = scale * 1.133 + + gl.PushAttrib(GL.COLOR_BUFFER_BIT) + gl.DepthTest(false) + -- loop teams - local baseR, baseG, baseB, r, g, b, a, scale, scaleBase, scaleOuter for teamID,_ in pairs(selectedUnits) do - r,g,b = 1,1,1 - scale = 1 * OPTIONS[currentOption].scaleMultiplier * animationMultiplierInner - scaleBase = scale * 1.133 - if OPTIONS[currentOption].showSecondLine then - scaleOuter = (1 * OPTIONS[currentOption].scaleMultiplier * animationMultiplier) * 1.18 - scaleBase = scaleOuter * 1.08 - end - gl.ColorMask(false, false, false, true) gl.BlendFunc(GL.ONE, GL.ONE) - gl.Color(r,g,b,1) + gl.Color(1,1,1,1) glCallList(clearquad) - -- draw base background layer - if OPTIONS[currentOption].showBase then - if OPTIONS[currentOption].teamcolorOpacity <= 0.02 then + if OPTIONS.baseOpacity > 0.009 then + if OPTIONS.teamcolorOpacity < 0.02 then baseR,baseG,baseB = 1,1,1 else baseR,baseG,baseB = spGetTeamColor(teamID) - baseR = 1-OPTIONS[currentOption].teamcolorOpacity + (baseR*OPTIONS[currentOption].teamcolorOpacity) - baseG = 1-OPTIONS[currentOption].teamcolorOpacity + (baseG*OPTIONS[currentOption].teamcolorOpacity) - baseB = 1-OPTIONS[currentOption].teamcolorOpacity + (baseB*OPTIONS[currentOption].teamcolorOpacity) + baseR = 1-OPTIONS.teamcolorOpacity + (baseR*OPTIONS.teamcolorOpacity) + baseG = 1-OPTIONS.teamcolorOpacity + (baseG*OPTIONS.teamcolorOpacity) + baseB = 1-OPTIONS.teamcolorOpacity + (baseB*OPTIONS.teamcolorOpacity) end gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) - DrawSelectionSpottersPart(teamID, 'base solid', baseR,baseG,baseB,0,scaleBase, false, false, false, false) + DrawSelectionSpottersPart(teamID, 'base', baseR,baseG,baseB,0,scaleBase, false, false, false, false) -- Here the inner of the selected spotters are removed gl.BlendFunc(GL.ONE, GL.ZERO) - a = 1 - (OPTIONS[currentOption].baseOpacity) - DrawSelectionSpottersPart(teamID, 'base alpha', baseR,baseG,baseB,a,scaleBase, false, false, true, false) + a = 1 - (OPTIONS.baseOpacity) + DrawSelectionSpottersPart(teamID, 'base', baseR,baseG,baseB,a,scaleBase, false, false, true, false) -- Really draw the spotters now (This could be optimised if we could say Draw as much as DST_ALPHA * SRC_ALPHA is) -- (without protecting form drawing them twice) @@ -894,64 +801,27 @@ function widget:DrawWorldPreUnit() glCallList(clearquad) end + -- draw line layer + a = 1 - (OPTIONS.firstLineOpacity * OPTIONS.spotterOpacity) - -- draw 1st line layer - if OPTIONS[currentOption].showFirstLine then - a = 1 - (OPTIONS[currentOption].firstLineOpacity * OPTIONS[currentOption].spotterOpacity) - - gl.ColorMask(false, false, false, true) - gl.BlendFunc(GL.ONE_MINUS_SRC_ALPHA, GL.SRC_ALPHA) - if OPTIONS[currentOption].showFirstLineDetails then - if OPTIONS[currentOption].showNoOverlap then - -- draw normal spotters solid - gl.Color(r,g,b,0) - DrawSelectionSpottersPart(teamID, 'normal solid', r,g,b,a,scale, false, false, false, false) - - -- Here the spotters are given the alpha level (this step makes sure overlappings dont have different alpha level) - gl.BlendFunc(GL.ONE, GL.ZERO) - gl.Color(r,g,b,a) - DrawSelectionSpottersPart(teamID, 'normal alpha', r,g,b,a,scale, false, false, true, false) - else - gl.Color(r,g,b,a) - DrawSelectionSpottersPart(teamID, 'normal alpha', r,g,b,a,scale, false, false, true, false) - end - end - - -- Here the inner of the selected spotters are removed - gl.BlendFunc(GL.ONE, GL.ZERO) - gl.Color(r,g,b,1) - DrawSelectionSpottersPart(teamID, 'solid overlap', r,g,b,a,scale, opposite, relativeScaleSchrinking, false, drawUnitStyles) - - -- Really draw the spotters now (This could be optimised if we could say Draw as much as DST_ALPHA * SRC_ALPHA is) - -- (without protecting form drawing them twice) - gl.ColorMask(true, true, true, true) - gl.BlendFunc(GL.ONE_MINUS_DST_ALPHA, GL.DST_ALPHA) - - -- Does not need to be drawn per Unit anymore - glCallList(clearquad) - end - - - -- draw 2nd line layer - if OPTIONS[currentOption].showSecondLine then - a = 1 - (OPTIONS[currentOption].secondLineOpacity * OPTIONS[currentOption].spotterOpacity) + gl.ColorMask(false, false, false, true) + gl.BlendFunc(GL.ONE_MINUS_SRC_ALPHA, GL.SRC_ALPHA) - gl.ColorMask(false, false, false, true) - gl.BlendFunc(GL.ONE_MINUS_SRC_ALPHA, GL.SRC_ALPHA) + gl.Color(1,1,1,a) + DrawSelectionSpottersPart(teamID, 'normal solid', 1,1,1,a,scale, false, false, true, false) - -- Here the inner of the selected spotters are removed - gl.BlendFunc(GL.ONE, GL.ZERO) - gl.Color(r,g,b,1) - DrawSelectionSpottersPart(teamID, 'solid overlap', r,g,b,a,scaleOuter, false, true, false, true) + -- Here the inner of the selected spotters are removed + gl.BlendFunc(GL.ONE, GL.ZERO) + gl.Color(1,1,1,1) + DrawSelectionSpottersPart(teamID, 'solid overlap', 1,1,1,a,scale, false, false, false, false) - -- Really draw the spotters now (This could be optimised if we could say Draw as much as DST_ALPHA * SRC_ALPHA is) - -- (without protecting form drawing them twice) - gl.ColorMask(true, true, true, true) - gl.BlendFunc(GL.ONE_MINUS_DST_ALPHA, GL.DST_ALPHA) + -- Really draw the spotters now (This could be optimised if we could say Draw as much as DST_ALPHA * SRC_ALPHA is) + -- (without protecting form drawing them twice) + gl.ColorMask(true, true, true, true) + gl.BlendFunc(GL.ONE_MINUS_DST_ALPHA, GL.DST_ALPHA) - -- Does not need to be drawn per Unit anymore - glCallList(clearquad) - end + -- Does not need to be drawn per Unit anymore + glCallList(clearquad) end gl.ColorMask(false,false,false,false) @@ -967,20 +837,16 @@ end function widget:GetConfigData(data) savedTable = {} - savedTable.currentOption = currentOption - savedTable.spotterOpacity = OPTIONS.defaults.spotterOpacity - savedTable.baseOpacity = OPTIONS.defaults.baseOpacity - savedTable.teamcolorOpacity = OPTIONS.defaults.teamcolorOpacity - savedTable.showSecondLine = OPTIONS.defaults.showSecondLine + savedTable.spotterOpacity = OPTIONS.spotterOpacity + savedTable.baseOpacity = OPTIONS.baseOpacity + savedTable.teamcolorOpacity = OPTIONS.teamcolorOpacity return savedTable end function widget:SetConfigData(data) - currentOption = data.currentOption or currentOption - OPTIONS.defaults.spotterOpacity = data.spotterOpacity or OPTIONS.defaults.spotterOpacity - OPTIONS.defaults.baseOpacity = data.baseOpacity or OPTIONS.defaults.baseOpacity - OPTIONS.defaults.teamcolorOpacity = data.teamcolorOpacity or OPTIONS.defaults.teamcolorOpacity - OPTIONS.defaults.showSecondLine = data.showSecondLine or OPTIONS.defaults.showSecondLine + OPTIONS.spotterOpacity = data.spotterOpacity or OPTIONS.spotterOpacity + OPTIONS.baseOpacity = data.baseOpacity or OPTIONS.baseOpacity + OPTIONS.teamcolorOpacity = data.teamcolorOpacity or OPTIONS.teamcolorOpacity end diff --git a/LuaUI/Widgets_Evo/gui_fancy_teamplatter.lua b/LuaUI/Widgets_Evo/gui_fancy_teamplatter.lua deleted file mode 100644 index ba483d8c3..000000000 --- a/LuaUI/Widgets_Evo/gui_fancy_teamplatter.lua +++ /dev/null @@ -1,194 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: gui_fancy_teamplatter.lua --- brief: Draws transparant smoothed donuts under enemy units --- author: Dave Rodgers (orig. TeamPlatter edited by TradeMark) --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Fancy Teamplatter", - desc = "Draws transparant smoothed donuts under friendly and enemy units (using teamcolor)", - author = "TradeMark (Floris: added multiple ally color support) (Forboding Angel: removed extra FX stuff) (zoggop: made it use only team colors)", - date = "7.02.2014", - license = "GNU GPL, v2 or later", - layer = 5, - enabled = true -- loaded by default? - } -end - - - --------------------------------------------------------------------------------- --- Config --------------------------------------------------------------------------------- - -local drawWithHiddenGUI = true -- keep widget enabled when graphical user interface is hidden (when pressing F5) - -local circleSize = 1 -local circleDivs = 12 -- how precise circle? octagon by default -local circleOpacity = 0.5 -local innerSize = 1.35 -- circle scale compared to unit radius -local outerSize = 1.5 -- outer fade size compared to circle scale (1 = no outer fade) - -local ignoreUnits = {} -for udefID,def in ipairs(UnitDefs) do - if def.customParams['nohealthbars'] then - ignoreUnits[udefID] = true - end -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- Automatically generated local definitions - -local GL_ONE = GL.ONE -local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA -local GL_SRC_ALPHA = GL.SRC_ALPHA -local glBlending = gl.Blending -local glBeginEnd = gl.BeginEnd -local glColor = gl.Color -local glCreateList = gl.CreateList -local glDeleteList = gl.DeleteList -local glDepthTest = gl.DepthTest -local glDrawListAtUnit = gl.DrawListAtUnit -local glPolygonOffset = gl.PolygonOffset -local glVertex = gl.Vertex -local spGetTeamColor = Spring.GetTeamColor -local spGetUnitDefDimensions = Spring.GetUnitDefDimensions -local spGetUnitDefID = Spring.GetUnitDefID -local spIsUnitSelected = Spring.IsUnitSelected -local spGetTeamList = Spring.GetTeamList -local spGetVisibleUnits = Spring.GetVisibleUnits -local spIsGUIHidden = Spring.IsGUIHidden -local spGetUnitTeam = Spring.GetUnitTeam - -local myTeamID = Spring.GetLocalTeamID() - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local realRadii = {} -local circlePolys = {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - --- Creating polygons: -function widget:Initialize() - - local teamList = spGetTeamList() - local numberOfTeams = #teamList - - for teamListIndex = 1, #teamList do - local teamID = teamList[teamListIndex] - local r,g,b,a = spGetTeamColor(teamID) - - circlePolys[teamID] = glCreateList(function() - glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) -- disable layer blending - - -- colored inner circle: - glBeginEnd(GL.TRIANGLES, function() - local radstep = (2.0 * math.pi) / circleDivs - for i = 1, circleDivs do - local a1 = (i * radstep) - local a2 = ((i+1) * radstep) - --(fadefrom) - glColor(r, g, b, 0) - glVertex(0, 0, 0) - --(colorSet) - glColor(r, g, b, circleOpacity) - glVertex(math.sin(a1), 0, math.cos(a1)) - glVertex(math.sin(a2), 0, math.cos(a2)) - end - end) - - if (outerSize ~= 1) then - -- colored outer circle: - glBeginEnd(GL.QUADS, function() - local radstep = (2.0 * math.pi) / circleDivs - for i = 1, circleDivs do - local a1 = (i * radstep) - local a2 = ((i+1) * radstep) - --(colorSet) - glColor(r, g, b, circleOpacity) - glVertex(math.sin(a1), 0, math.cos(a1)) - glVertex(math.sin(a2), 0, math.cos(a2)) - --(fadeto) - glColor(r, g, b, 0) - glVertex(math.sin(a2)*outerSize, 0, math.cos(a2)*outerSize) - glVertex(math.sin(a1)*outerSize, 0, math.cos(a1)*outerSize) - end - end) - end - end) - - end - -end - -function widget:Shutdown() - --glDeleteList(circlePolys) -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - --- Retrieving radius: -local function GetUnitDefRealRadius(udid) - local radius = realRadii[udid] - if (radius) then return radius end - local ud = UnitDefs[udid] - if (ud == nil) then return nil end - local dims = spGetUnitDefDimensions(udid) - if (dims == nil) then return nil end - local scale = ud.hitSphereScale -- missing in 0.76b1+ - scale = ((scale == nil) or (scale == 0.0)) and 1.0 or scale - radius = dims.radius / scale - realRadii[udid] = radius*circleSize - return radius -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - --- Drawing: -function widget:DrawWorldPreUnit() - if not drawWithHiddenGUI then - if spIsGUIHidden() then return end - end - glDepthTest(true) - glPolygonOffset(-100, -2) - local visibleUnits = spGetVisibleUnits() - if #visibleUnits then - for i=1, #visibleUnits do - local unitID = visibleUnits[i] - local unitDefIDValue = spGetUnitDefID(unitID) - if ignoreUnits[unitDefIDValue] then break end - local teamID = spGetUnitTeam(unitID) - if circlePolys[teamID] ~= nil then - if (unitDefIDValue) then - local radius = GetUnitDefRealRadius(unitDefIDValue) * circleSize - if (radius) then - glDrawListAtUnit(unitID, circlePolys[teamID], false, radius, 1.0, radius) - end - end - end - end - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_gameinfo.lua b/LuaUI/Widgets_Evo/gui_gameinfo.lua index 3992d5484..3694d22e9 100644 --- a/LuaUI/Widgets_Evo/gui_gameinfo.lua +++ b/LuaUI/Widgets_Evo/gui_gameinfo.lua @@ -1,22 +1,30 @@ function widget:GetInfo() -return { - name = "Game info", - desc = "", - author = "Floris", - date = "May 2017", - license = "", - layer = 2, - enabled = true, -} + return { + name = "Game info", + desc = "", + author = "Floris", + date = "May 2017", + license = "", + layer = 2, + enabled = true, + } end -local loadedFontSize = 32 -local font = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", loadedFontSize, 16,2) +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local loadedFontSize = fontfileSize*fontfileScale + +local bgcorner = "LuaUI/Images/bgcorner.png" -local bgcorner = LUAUI_DIRNAME.."Images/bgcorner.png" - local titlecolor = "\255\255\205\100" local keycolor = "" local valuecolor = "\255\255\255\255" @@ -24,44 +32,55 @@ local valuegreycolor = "\255\180\180\180" local vcolor = valuegreycolor local separator = "::" -local changelogFile = "" -changelogFile = changelogFile .. titlecolor..Game.gameName..valuegreycolor.." ("..Game.gameMutator..") "..titlecolor..Game.gameVersion.."\n" -changelogFile = changelogFile .. keycolor.."Engine"..separator..valuegreycolor..((Game and Game.version) or (Engine and Engine.version) or "Engine version error").."\n" -changelogFile = changelogFile .. "\n" +local teams = Spring.GetTeamList() +for i =1, #teams do + local luaAI = Spring.GetTeamLuaAI(teams[i]) + if luaAI and luaAI ~= "" and string.sub(luaAI, 1, 9) == 'Chicken: ' then + chickensEnabled = true + end +end + +local content = "" +content = content .. titlecolor..Game.gameName..valuegreycolor.." ("..Game.gameMutator..") "..titlecolor..Game.gameVersion.."\n" +content = content .. keycolor.."Engine"..separator..valuegreycolor..((Game and Game.version) or (Engine and Engine.version) or "Engine version error").."\n" +content = content .. "\n" -- map info -changelogFile = changelogFile .. titlecolor..Game.mapName.."\n" -changelogFile = changelogFile .. valuegreycolor..Game.mapDescription.."\n" -changelogFile = changelogFile .. keycolor.."Size"..separator..valuegreycolor..Game.mapX..valuegreycolor.." x "..valuegreycolor..Game.mapY.."\n" -changelogFile = changelogFile .. keycolor.."Gravity"..separator..valuegreycolor..Game.gravity.."\n" -changelogFile = changelogFile .. keycolor.."Hardness"..separator..valuegreycolor..Game.mapHardness.. keycolor.."\n" +content = content .. titlecolor..Game.mapName.."\n" +content = content .. valuegreycolor..Game.mapDescription.."\n" +content = content .. keycolor.."Size"..separator..valuegreycolor..Game.mapX..valuegreycolor.." x "..valuegreycolor..Game.mapY.."\n" +content = content .. keycolor.."Gravity"..separator..valuegreycolor..Game.gravity.."\n" +content = content .. keycolor.."Hardness"..separator..valuegreycolor..Game.mapHardness.. keycolor.."\n" tidal = Game.tidal - if Spring.GetModOptions() and Spring.GetModOptions().map_tidal then - map_tidal = Spring.GetModOptions().map_tidal - if map_tidal == "unchanged" then - elseif map_tidal == "low" then - tidal = 13 - elseif map_tidal == "medium" then - tidal = 18 - elseif map_tidal == "high" then - tidal = 23 - end +if Spring.GetModOptions() and Spring.GetModOptions().map_tidal then + map_tidal = Spring.GetModOptions().map_tidal + if map_tidal == "unchanged" then + elseif map_tidal == "low" then + tidal = 13 + elseif map_tidal == "medium" then + tidal = 18 + elseif map_tidal == "high" then + tidal = 23 end -changelogFile = changelogFile .. keycolor.."Tidal speed"..separator..valuegreycolor..tidal.. keycolor.."\n" +end +if Spring.GetTidal then + tidal = Spring.GetTidal() +end +content = content .. keycolor.."Tidal speed"..separator..valuegreycolor..tidal.. keycolor.."\n" + - if Game.windMin == Game.windMax then - changelogFile = changelogFile .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.."\n" + content = content .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.."\n" else - changelogFile = changelogFile .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.." - "..valuegreycolor..Game.windMax.."\n" + content = content .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.." - "..valuegreycolor..Game.windMax.."\n" end -if Game.waterDamage == 0 then +if Game.waterDamage == 0 then vcolor = valuegreycolor else vcolor = valuecolor end -changelogFile = changelogFile .. keycolor.."Water damage"..separator..vcolor..Game.waterDamage .. keycolor.."\n" -changelogFile = changelogFile .. "\n" +content = content .. keycolor.."Water damage"..separator..vcolor..Game.waterDamage .. keycolor.."\n" +content = content .. "\n" -- modoptions local defaultModoptions = VFS.Include("modoptions.lua") @@ -74,33 +93,61 @@ for key, value in pairs(defaultModoptions) do elseif value.def == true then v = 1 end - modoptionsDefault[tostring(value.key)] = tostring(v) + modoptionsDefault[tostring(value.key)] = tostring(v) end -- modoptions.lua doesnt contain engine modoptions: maxunits, pathfinder, startmetal, startenergy, disablemapdamage, fixedallies -modoptionsDefault['pathfinder'] = 'normal' +modoptionsDefault['maxspeed'] = '3' +modoptionsDefault['minspeed'] = '0.3' +--modoptionsDefault['pathfinder'] = 'normal' modoptionsDefault['startmetal'] = '1000' modoptionsDefault['startenergy'] = '1000' modoptionsDefault['fixedallies'] = '1' -modoptionsDefault['maxunits'] = '1000' +modoptionsDefault['maxunits'] = '2000' modoptionsDefault['disablemapdamage'] = '0' local modoptions = Spring.GetModOptions() local vcolor = valuegreycolor local changedModoptions = {} local unchangedModoptions = {} +local changedChickenModoptions = {} +local unchangedChickenModoptions = {} + +for key, value in pairs(modoptions) do + if string.sub(key, 1, 8) == 'chicken_' then + if chickensEnabled then + if value == modoptionsDefault[key] then + unchangedChickenModoptions[key] = value + else + changedChickenModoptions[key] = value + end + end + modoptions[key] = nil -- filter chicken modoptions + end +end + for key, value in pairs(modoptions) do - if value == modoptionsDefault[key] then + if value == modoptionsDefault[key] then unchangedModoptions[key] = value else changedModoptions[key] = value end end -changelogFile = changelogFile .. titlecolor.."Mod options\n" +if chickensEnabled then -- filter chicken modoptions + content = content .. titlecolor.."Chicken options\n" + for key, value in pairs(changedChickenModoptions) do + content = content .. keycolor..string.sub(key, 9)..separator..valuecolor..value.."\n" + end + for key, value in pairs(unchangedChickenModoptions) do + content = content .. keycolor..string.sub(key, 9)..separator..valuegreycolor..value.."\n" + end + content = content .. "\n" +end +content = content .. titlecolor.."Mod options\n" for key, value in pairs(changedModoptions) do - changelogFile = changelogFile .. keycolor..key..separator..valuecolor..value.."\n" + content = content .. keycolor..key..separator..valuecolor..value.."\n" end for key, value in pairs(unchangedModoptions) do - changelogFile = changelogFile .. keycolor..key..separator..valuegreycolor..value.."\n" + content = content .. keycolor..key..separator..valuegreycolor..value.."\n" end @@ -119,7 +166,7 @@ local startLine = 1 local vsx,vsy = Spring.GetViewGeometry() local screenX = (vsx*0.5) - (screenWidth/2) local screenY = (vsy*0.5) + (screenHeight/2) - + local spIsGUIHidden = Spring.IsGUIHidden local showHelp = false @@ -129,8 +176,6 @@ local glPolygonMode = gl.PolygonMode local glRect = gl.Rect local glText = gl.Text local glShape = gl.Shape -local glGetTextWidth = gl.GetTextWidth -local glGetTextHeight = gl.GetTextHeight local bgColorMultiplier = 0 @@ -154,12 +199,21 @@ local changelogLines = {} local totalChangelogLines = 0 function widget:ViewResize() - vsx,vsy = Spring.GetViewGeometry() - screenX = (vsx*0.5) - (screenWidth/2) - screenY = (vsy*0.5) + (screenHeight/2) - widgetScale = (0.75 + (vsx*vsy / 7500000)) * customScale - if changelogList then gl.DeleteList(changelogList) end - changelogList = gl.CreateList(DrawWindow) + vsx,vsy = Spring.GetViewGeometry() + screenX = (vsx*0.5) - (screenWidth/2) + screenY = (vsy*0.5) + (screenHeight/2) + widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + loadedFontSize = fontfileSize*fontfileScale + end + if changelogList then gl.DeleteList(changelogList) end + changelogList = gl.CreateList(DrawWindow) end local myTeamID = Spring.GetMyTeamID() @@ -173,58 +227,58 @@ local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) gl.Vertex(sx-cs, py, 0) gl.Vertex(sx-cs, sy, 0) gl.Vertex(px+cs, sy, 0) - + gl.Vertex(px, py+cs, 0) gl.Vertex(px+cs, py+cs, 0) gl.Vertex(px+cs, sy-cs, 0) gl.Vertex(px, sy-cs, 0) - + gl.Vertex(sx, py+cs, 0) gl.Vertex(sx-cs, py+cs, 0) gl.Vertex(sx-cs, sy-cs, 0) gl.Vertex(sx, sy-cs, 0) - + local offset = 0.05 -- texture offset, because else gaps could show - + -- bottom left if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) -- bottom right if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) -- top left if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, sy-cs, 0) -- top right if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) @@ -232,7 +286,7 @@ function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differentl gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) gl.Texture(false) end - + function DrawTextarea(x,y,width,height,scrollbar) local scrollbarOffsetTop = 18 -- note: wont add the offset to the bottom, only to top local scrollbarOffsetBottom = 12 -- note: wont add the offset to the top, only to bottom @@ -242,20 +296,20 @@ function DrawTextarea(x,y,width,height,scrollbar) local scrollbarPosMinHeight = 8 local scrollbarBackgroundColor = {0,0,0,0.24 } local scrollbarBarColor = {1,1,1,0.08} - + local fontSizeTitle = 17 -- is version number local fontSizeDate = 13 local fontSizeLine = 15 local lineSeparator = 2 - + local fontColorTitle = {1,1,1,1} local fontColorDate = {0.66,0.88,0.66,1} local fontColorLine = {0.8,0.77,0.74,1} local fontColorCommand = {0.9,0.6,0.2,1} - + local textRightOffset = scrollbar and scrollbarMargin+scrollbarWidth+scrollbarWidth or 0 local maxLines = math.floor((height-5)/fontSizeLine) - + -- textarea scrollbar if scrollbar then if (totalChangelogLines > maxLines or startLine > 1) then -- only show scroll above X lines @@ -286,9 +340,9 @@ function DrawTextarea(x,y,width,height,scrollbar) ) end end - + -- draw textarea - if changelogFile then + if content then font:Begin() local lineKey = startLine local j = 1 @@ -299,7 +353,7 @@ function DrawTextarea(x,y,width,height,scrollbar) if changelogLines[lineKey] == nil then break; end - + local line = changelogLines[lineKey] if string.find(line, '::') then local cmd = string.match(line, '^[ \+a-zA-Z0-9_-]*') -- escaping the escape: \\ doesnt work in lua !#$@&*()&5$# @@ -308,10 +362,10 @@ function DrawTextarea(x,y,width,height,scrollbar) if (lineSeparator+fontSizeTitle)*(j+numLines-1) > height then break; end - + font:SetTextColor(fontColorCommand) font:Print(cmd, x+20, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") - + font:SetTextColor(fontColorLine) font:Print(descr, x+250, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") j = j + (numLines - 1) @@ -336,81 +390,95 @@ end function DrawWindow() - local vsx,vsy = Spring.GetViewGeometry() - local x = screenX --rightwards - local y = screenY --upwards - + local vsx,vsy = Spring.GetViewGeometry() + local x = screenX --rightwards + local y = screenY --upwards + -- background - gl.Color(0,0,0,0.8) + gl.Color(0,0,0,0.8) RectRound(x-bgMargin,y-screenHeight-bgMargin,x+screenWidth+bgMargin,y+bgMargin,8, 0,1,1,1) -- content area gl.Color(0.33,0.33,0.33,0.15) RectRound(x,y-screenHeight,x+screenWidth,y,6) - + -- close button local size = closeButtonSize*0.7 local width = size*0.055 - gl.Color(1,1,1,1) + gl.Color(1,1,1,1) gl.PushMatrix() - gl.Translate(screenX+screenWidth-(closeButtonSize/2),screenY-(closeButtonSize/2),0) - gl.Rotate(-45,0,0,1) - gl.Rect(-width,size/2,width,-size/2) - gl.Rotate(90,0,0,1) - gl.Rect(-width,size/2,width,-size/2) + gl.Translate(screenX+screenWidth-(closeButtonSize/2),screenY-(closeButtonSize/2),0) + gl.Rotate(-45,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.Rotate(90,0,0,1) + gl.Rect(-width,size/2,width,-size/2) gl.PopMatrix() - + -- title - local title = "Game info" + local title = "Game info" local titleFontSize = 18 - gl.Color(0,0,0,0.8) - titleRect = {x-bgMargin, y+bgMargin, x+(glGetTextWidth(title)*titleFontSize)+27-bgMargin, y+37} + gl.Color(0,0,0,0.8) + titleRect = {x-bgMargin, y+bgMargin, x+(font2:GetTextWidth(title)*titleFontSize)+27-bgMargin, y+37} RectRound(titleRect[1], titleRect[2], titleRect[3], titleRect[4], 8, 1,1,0,0) - font:Begin() - font:SetTextColor(1,1,1,1) - font:SetOutlineColor(0,0,0,0.4) - font:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") - font:End() - + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") + font2:End() + -- textarea DrawTextarea(x, y-10, screenWidth, screenHeight-24, 1) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() - if spIsGUIHidden() then return end - if amNewbie then return end - - -- draw the help - if not changelogList then - changelogList = gl.CreateList(DrawWindow) - end - - if show or showOnceMore then - + if chobbyInterface then return end + if spIsGUIHidden() then return end + if amNewbie then return end + + -- draw the help + if not changelogList then + changelogList = gl.CreateList(DrawWindow) + end + + if show or showOnceMore then + -- draw the changelog panel glPushMatrix() - glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) - glScale(widgetScale, widgetScale, 1) - glCallList(changelogList) + glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) + glScale(widgetScale, widgetScale, 1) + glCallList(changelogList) glPopMatrix() - if (WG['guishader_api'] ~= nil) then + if WG['guishader'] then local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - WG['guishader_api'].InsertRect(rectX1, rectY2, rectX2, rectY1, 'gameinfo') - --WG['guishader_api'].setBlurIntensity(0.0017) - --WG['guishader_api'].setScreenBlur(true) + if backgroundGuishader ~= nil then + glDeleteList(backgroundGuishader) + end + backgroundGuishader = glCreateList( function() + -- background + RectRound(rectX1, rectY2, rectX2, rectY1, 9*widgetScale, 0,1,1,1) + -- title + rectX1 = (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY1 = (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2) + rectX2 = (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY2 = (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2) + RectRound(rectX1, rectY1, rectX2, rectY2, 9*widgetScale, 1,1,0,0) + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'gameinfo') end showOnceMore = false - - else - if (WG['guishader_api'] ~= nil) then - local removed = WG['guishader_api'].RemoveRect('gameinfo') - if removed then - --WG['guishader_api'].setBlurIntensity() - WG['guishader_api'].setScreenBlur(false) - end + + else + if WG['guishader'] then + WG['guishader'].DeleteDlist('gameinfo') end end end @@ -422,48 +490,26 @@ function widget:KeyPress(key) end function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) - + -- check if the mouse is in a rectangle return x >= BLcornerX and x <= TRcornerX - and y >= BLcornerY - and y <= TRcornerY -end - -function widget:IsAbove(x, y) - -- on window - if show then - local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) - local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) - local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - return IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) - else - return false - end -end - -function widget:GetTooltip(mx, my) - if show and widget:IsAbove(mx,my) then - return string.format( - "\255\255\255\1Left mouse\255\255\255\255 on textarea to scroll down.\n".. - "\255\255\255\1Right mouse\255\255\255\255 on textarea to scroll up.\n\n".. - "Add CTRL or SHIFT to scroll faster, or combine CTRL+SHIFT (+ALT).") - end + and y >= BLcornerY + and y <= TRcornerY end function widget:MouseWheel(up, value) - - if show then + + if show then local addLines = value*-3 -- direction is retarded - + startLine = startLine + addLines if startLine < 1 then startLine = 1 end if startLine > totalChangelogLines - textareaMinLines then startLine = totalChangelogLines - textareaMinLines end - + if changelogList then glDeleteList(changelogList) end - + changelogList = gl.CreateList(DrawWindow) return true else @@ -472,14 +518,14 @@ function widget:MouseWheel(up, value) end function widget:MouseMove(x, y) - if show then + if show then -- on window local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) if not IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then - + end end end @@ -493,16 +539,16 @@ function widget:MouseRelease(x, y, button) end function mouseEvent(x, y, button, release) - if spIsGUIHidden() then return false end - - if show then + if spIsGUIHidden() then return false end + + if show then -- on window local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then - + -- on close button local brectX1 = rectX2 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) local brectY2 = rectY1 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) @@ -513,7 +559,7 @@ function mouseEvent(x, y, button, release) end return true end - + if button == 1 or button == 3 then if button == 3 and release then show = not show @@ -531,10 +577,10 @@ function mouseEvent(x, y, button, release) end function lines(str) - local t = {} - local function helper(line) table.insert(t, line) return "" end - helper((str:gsub("(.-)\r?\n", helper))) - return t + local t = {} + local function helper(line) t[#t+1] = line return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t end @@ -564,9 +610,9 @@ function toggle() end function widget:Initialize() - if changelogFile then - - widgetHandler:AddAction("customgameinfo", toggle) + if content then + + widgetHandler:AddAction("customgameinfo", toggle) Spring.SendCommands("unbind any+i gameinfo") Spring.SendCommands("unbind i gameinfo") Spring.SendCommands("bind i customgameinfo") @@ -582,35 +628,40 @@ function widget:Initialize() hideWindows() end end - + -- somehow there are a few characters added at the start that we need to remove - --changelogFile = string.sub(changelogFile, 4) - + --content = string.sub(content, 4) + -- store changelog into array - changelogLines = lines(changelogFile) - + changelogLines = lines(content) + for i, line in ipairs(changelogLines) do totalChangelogLines = i end - + else --Spring.Echo("Commands info: couldn't load the commandslist file") - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) end end function widget:Shutdown() - Spring.SendCommands("unbind i customgameinfo") - Spring.SendCommands("bind any+i gameinfo") - Spring.SendCommands("bind i gameinfo") - widgetHandler:RemoveAction("customgameinfo", toggle) - - if buttonGL then - glDeleteList(buttonGL) - buttonGL = nil - end - if changelogList then - glDeleteList(changelogList) - changelogList = nil - end + Spring.SendCommands("unbind i customgameinfo") + Spring.SendCommands("bind any+i gameinfo") + Spring.SendCommands("bind i gameinfo") + widgetHandler:RemoveAction("customgameinfo", toggle) + + if buttonGL then + glDeleteList(buttonGL) + buttonGL = nil + end + if changelogList then + glDeleteList(changelogList) + changelogList = nil + end + if WG['guishader'] then + WG['guishader'].DeleteDlist('gameinfo') + end + gl.DeleteFont(font) + gl.DeleteFont(font2) end diff --git a/LuaUI/Widgets_Evo/gui_given_units.lua b/LuaUI/Widgets_Evo/gui_given_units.lua index d234b0b72..d4ab75306 100644 --- a/LuaUI/Widgets_Evo/gui_given_units.lua +++ b/LuaUI/Widgets_Evo/gui_given_units.lua @@ -5,7 +5,7 @@ function widget:GetInfo() author = "Floris", date = "24.04.2014", license = "GNU GPL, v2 or later", - layer = 5, + layer = -50, enabled = true } end @@ -20,61 +20,42 @@ end -------------------------------------------------------------------------------- OPTIONS = { - iconSize = 32, - selectedFadeTime = 0.5, - timeoutTime = 9, - timeoutFadeTime = 4, - iconSize = 30, + selectedFadeTime = 0.75, + timeoutTime = 6.5, + timeoutFadeTime = 3, } -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local myTeamID = Spring.GetLocalTeamID() - --- preferred to keep these values the same as fancy unit selections widget -local rectangleFactor = 3.3 -local scalefaktor = 2.9 -local unitConf = {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - local givenUnits = {} -local glDrawListAtUnit = gl.DrawListAtUnit -local glDrawFuncAtUnit = gl.DrawFuncAtUnit +local drawList +local unitConf = {} +local glDrawListAtUnit = gl.DrawListAtUnit local spIsGUIHidden = Spring.IsGUIHidden local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount -local spGetSelectedUnits = Spring.GetSelectedUnits local spGetUnitDefID = Spring.GetUnitDefID local spIsUnitInView = Spring.IsUnitInView +local spGetCameraDirection = Spring.GetCameraDirection + +local myTeamID = Spring.GetLocalTeamID() + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function SetUnitConf() for udid, unitDef in pairs(UnitDefs) do local xsize, zsize = unitDef.xsize, unitDef.zsize - local scale = scalefaktor*( xsize^2 + zsize^2 )^0.5 - local shape, xscale, zscale - - if (unitDef.isBuilding or unitDef.isFactory or unitDef.speed==0) then - shape = 'square' - xscale, zscale = rectangleFactor * xsize, rectangleFactor * zsize - elseif (unitDef.isAirUnit) then - shape = 'triangle' - xscale, zscale = scale, scale - else - shape = 'circle' - xscale, zscale = scale, scale - end - unitConf[udid] = {shape=shape, xscale=xscale, zscale=zscale} + local scale = 6*( xsize^2 + zsize^2 )^0.5 + unitConf[udid] = 7 + (scale/2.5) end end -function DrawIcon(posY, posX, iconSize) - gl.Translate(posX*0.9,posY,posX*1.5) +function DrawIcon() + local iconSize = 1 + gl.Translate(0,1,1.4) gl.Billboard() gl.TexRect(-(iconSize/2), 0, (iconSize/2), iconSize) end @@ -82,12 +63,12 @@ end -- add unit-icon to unit function AddGivenUnit(unitID) - local ud = UnitDefs[spGetUnitDefID(unitID)] - + local unitDefID = spGetUnitDefID(unitID) givenUnits[unitID] = {} givenUnits[unitID].osClock = os.clock() givenUnits[unitID].lastInViewClock = os.clock() - givenUnits[unitID].unitHeight = ud.height + givenUnits[unitID].unitHeight = UnitDefs[unitDefID].height + givenUnits[unitID].unitScale = unitConf[unitDefID] --givenUnits[unitID].lastInViewClock = Spring.GetGameSeconds() + OPTIONS.timeoutTime --givenUnits[unitID].endSecs = Spring.GetGameSeconds() + OPTIONS.timeoutTime end @@ -96,24 +77,92 @@ end -- Engine Calls -------------------------------------------------------------------------------- +function maybeRemoveSelf() + if Spring.GetSpectatingState() and (Spring.GetGameFrame() > 0 or gameStarted) then + widgetHandler:RemoveWidget(self) + end +end + +function widget:GameStart() + gameStarted = true + maybeRemoveSelf() +end + +function widget:PlayerChanged(playerID) + maybeRemoveSelf() +end + function widget:Initialize() - + if Spring.IsReplay() or Spring.GetGameFrame() > 0 then + maybeRemoveSelf() + end SetUnitConf() + drawList = gl.CreateList(DrawIcon) +end + +function widget:Shutdown() + gl.DeleteList(drawList) +end + + +local sec = 0 +local prevCam = {spGetCameraDirection()} +function widget:Update(dt) + sec = sec + dt + if sec > 0.15 then + sec = 0 + + if commandsChangedCheck then + commandsChangedCheck = nil + for uDID,unit in pairs(Spring.GetSelectedUnitsSorted()) do + if uDID ~= 'n' then --'n' returns table size + for i=1,#unit do + local unitID = unit[i] + if givenUnits[unitID] then + local currentAlpha = 1 - ((os.clock() - (givenUnits[unitID].osClock + (OPTIONS.timeoutTime - OPTIONS.timeoutFadeTime))) / OPTIONS.timeoutFadeTime) + if currentAlpha > 1 then + currentAlpha = 1 + end + givenUnits[unitID].selected = os.clock() - (OPTIONS.selectedFadeTime * (1 - currentAlpha)) + --givenUnits[unitID].selectedGameSecs = Spring.GetGameSeconds() + UnitDefs[spGetUnitDefID(unitID)].selfDCountdown + else + -- uncomment line below for testing + -- AddGivenUnit(unitID) + end + end + end + end + end + + local camX, camY, camZ = spGetCameraDirection() + if camX ~= prevCam[1] or camY ~= prevCam[2] or camZ ~= prevCam[3] then + gl.DeleteList(drawList) + drawList = gl.CreateList(DrawIcon) + end + prevCam = {camX,camY,camZ } + end end -- draw icons +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() + if chobbyInterface then return end if spIsGUIHidden() then return end local osClock = os.clock() --local gameSecs = Spring.GetGameSeconds() gl.DepthMask(true) gl.DepthTest(true) - gl.Texture('LuaUI/Images/new.png') - + gl.Texture('LuaUI/Images/new.dds') + + local alpha for unitID, unit in pairs(givenUnits) do - local alpha = 1 if unit.selected then alpha = 1 - ((osClock - unit.selected) / OPTIONS.selectedFadeTime) else @@ -125,9 +174,7 @@ function widget:DrawWorld() givenUnits[unitID] = nil else gl.Color(1,1,1,alpha) - local unitDefs = unitConf[spGetUnitDefID(unitID)] - local unitScale = unitDefs.xscale*1.22 - (unitDefs.xscale/6.6) - glDrawFuncAtUnit(unitID, false, DrawIcon, 10, unitScale, OPTIONS.iconSize) + glDrawListAtUnit(unitID, drawList, false, unit.unitScale, unit.unitScale, unit.unitScale) end else if unit.selected then @@ -157,25 +204,7 @@ end function widget:CommandsChanged() if spGetSelectedUnitsCount() > 0 then - local units = Spring.GetSelectedUnitsSorted() - for uDID,_ in pairs(units) do - if uDID ~= 'n' then --'n' returns table size - for i=1,#units[uDID] do - local unitID = units[uDID][i] - if givenUnits[unitID] then - local currentAlpha = 1 - ((os.clock() - (givenUnits[unitID].osClock + (OPTIONS.timeoutTime - OPTIONS.timeoutFadeTime))) / OPTIONS.timeoutFadeTime) - if currentAlpha > 1 then - currentAlpha = 1 - end - givenUnits[unitID].selected = os.clock() - (OPTIONS.selectedFadeTime * (1 - currentAlpha)) - --givenUnits[unitID].selectedGameSecs = Spring.GetGameSeconds() + UnitDefs[spGetUnitDefID(unitID)].selfDCountdown - else - -- uncomment line below for testing - -- AddGivenUnit(unitID) - end - end - end - end + commandsChangedCheck = true end end diff --git a/LuaUI/Widgets_Evo/gui_group_recall_fix.lua b/LuaUI/Widgets_Evo/gui_group_recall_fix.lua index aa20aec7f..068028bb2 100644 --- a/LuaUI/Widgets_Evo/gui_group_recall_fix.lua +++ b/LuaUI/Widgets_Evo/gui_group_recall_fix.lua @@ -31,7 +31,7 @@ options = { timeoutlength = { name = "Double Press Speed", type = "number", - value = 0.4, + value = 0.2, min = 0, max = 5, step = 0.1, @@ -59,6 +59,7 @@ local groupNumber = { [KEYSYMS.N_7] = 7, [KEYSYMS.N_8] = 8, [KEYSYMS.N_9] = 9, + [KEYSYMS.N_0] = 0, } local function GroupRecallFix(key, modifier, isRepeat) diff --git a/LuaUI/Widgets_Evo/gui_healthbars.lua b/LuaUI/Widgets_Evo/gui_healthbars.lua index 164a64103..90e397c93 100644 --- a/LuaUI/Widgets_Evo/gui_healthbars.lua +++ b/LuaUI/Widgets_Evo/gui_healthbars.lua @@ -2,9 +2,9 @@ function widget:GetInfo() return { name = "Health Bars", - desc = "Options: /healthbars_style, /healthbars_percentage, /healthbars_glow", + desc = "Options: /healthbars_style, /healthbars_percentage", author = "Floris (original plain bars by jK)", - date = "January 2015", + date = "28 march 2015", license = "GNU GPL, v2 or later", layer = -10, enabled = true @@ -18,12 +18,12 @@ end -- /healthbars_percentage -- toggles rendering of the textual percentage beside each bar -- /healthbars_compercentage -- toggles always rendering health precentagees for coms -- /healthbars_style -- toggles different styles --- /healthbars_glow -- toggles a subtle glow to the bar´s value (note error: possible visual exclusion with overlapping bars) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local barScale = 1 + local barHeightOffset = 34 -- set value that healthbars for units that can unfold and become larger than its unitdef.height are still visible local barHeight = 5 @@ -55,10 +55,6 @@ local featureHpThreshold = 0.85 local featureResurrectVisibility= true -- draw feature bars for resurrected features on same distance as normal unit bars local featureReclaimVisibility = true -- draw feature bars for reclaimed features on same distance as normal unit bars -local addGlow = false -- adds a small subtle glow around the value of a bar (has issues with overlapping bars) -local glowSize = outlineSize*6 -local glowAlpha = 0.15 - local minPercentageDistance = 120000 -- always show health percentage text below this distance local infoDistance = 800000 local maxFeatureInfoDistance = 300000 --max squared distance at which text it drawn for features @@ -67,6 +63,13 @@ local maxUnitDistance = 11000000 --max squared distance at which any local minReloadTime = 4 --// in seconds +local destructableFeature = {} +local drawnFeature = {} +for i = 1, #FeatureDefs do + destructableFeature[i] = FeatureDefs[i].destructable + drawnFeature[i] = (FeatureDefs[i].drawTypeString=="model") +end + local drawStunnedOverlay = true --// this table is used to shows the hp of perimeter defence, and filter it for default wreckages @@ -75,6 +78,8 @@ local walls = {dragonsteeth=true,dragonsteeth_core=true,fortification=true,forti local stockpileH = 24 local stockpileW = 12 +local notificationTimeout = 0 + local OPTIONS = {} OPTIONS[1] = { @@ -125,6 +130,12 @@ for udefID,def in ipairs(UnitDefs) do ignoreUnits[udefID] = true end end +local ignoreFeatures = {} +for fdefID,def in pairs(FeatureDefs) do + if def.customParams['nohealthbars'] then + ignoreFeatures[fdefID] = true + end +end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -150,7 +161,8 @@ local barFeatureDList; --// speedup (there are a lot more localizations, but they are in limited scope cos we are running out of upvalues) local glColor = gl.Color local glMyText = gl.FogCoord -local floor = math.floor +local floor = math.floor +local sub = string.sub local GetUnitDefID = Spring.GetUnitDefID local glDepthTest = gl.DepthTest @@ -194,63 +206,8 @@ function drawBarGl() if OPTIONS[currentOption].showOutline then heightAddition = outlineSize end - -- add glow gl.PushMatrix() gl.Scale(barScale,barScale,barScale) - if addGlow then - gl.BeginEnd(GL.QUADS,function() - -- bottom mid piece - gl.Vertex(-barWidth, (barHeight/2), 0, -2); - gl.Vertex(-barWidth+cs, (barHeight/2), (barWidth*2)-cs*2, -2); - gl.Vertex(-barWidth+cs, -glowSize, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth, -glowSize, 0, -4); - - -- top mid piece - gl.Vertex(-barWidth, (barHeight/2), 0, -2); - gl.Vertex(-barWidth+cs, (barHeight/2), (barWidth*2)-cs*2, -2); - gl.Vertex(-barWidth+cs, barHeight+glowSize, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth, barHeight+glowSize, 0, -4); - - - -- top left - gl.Vertex(-barWidth-glowSize, barHeight, 0, -4); - gl.Vertex(-barWidth, barHeight, 0, -3); - gl.Vertex(-barWidth, barHeight+glowSize, 0, -4); - gl.Vertex(-barWidth-glowSize, barHeight+glowSize, 0, -4); - - -- bottom left - gl.Vertex(-barWidth-glowSize, 0, 0, -4); - gl.Vertex(-barWidth, 0, 0, -3); - gl.Vertex(-barWidth, -glowSize, 0, -4); - gl.Vertex(-barWidth-glowSize, -glowSize, 0, -4); - - -- mid left - gl.Vertex(-barWidth-glowSize, 0, 0, -4); - gl.Vertex(-barWidth, 0, 0, -3); - gl.Vertex(-barWidth, barHeight, 0, -3); - gl.Vertex(-barWidth-glowSize, barHeight, 0, -4); - - - -- top right - gl.Vertex(-barWidth+cs, barHeight, (barWidth*2)-cs*2, -3); - gl.Vertex(-barWidth+cs+glowSize, barHeight, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs+glowSize, barHeight+glowSize, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs, barHeight+glowSize, (barWidth*2)-cs*2, -4); - - -- bottom right - gl.Vertex(-barWidth+cs, 0, (barWidth*2)-cs*2, -3); - gl.Vertex(-barWidth+cs+glowSize, 0, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs+glowSize, -glowSize, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs, -glowSize, (barWidth*2)-cs*2, -4); - - -- mid right - gl.Vertex(-barWidth+cs, 0, (barWidth*2)-cs*2, -3); - gl.Vertex(-barWidth+cs+glowSize, 0, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs+glowSize, barHeight, (barWidth*2)-cs*2, -4); - gl.Vertex(-barWidth+cs, barHeight, (barWidth*2)-cs*2, -3); - - end) - end if (OPTIONS[currentOption].choppedCorners) then gl.BeginEnd(GL.QUADS,function() @@ -441,7 +398,7 @@ function drawBarGl() end --- is a copy of drawBarGl(), without glow vertexcode + some vars changed (only at top: barHeight, barWidth, bkBottom, bkTop) +-- is a copy of drawBarGl(), some vars changed (only at top: barHeight, barWidth, bkBottom, bkTop) function drawFeatureBarGl() local barHeight = featureBarHeight local barWidth = featureBarWidth @@ -682,8 +639,6 @@ function init() #define barColor gl_MultiTexCoord1 #define progress gl_MultiTexCoord2.x #define offset gl_MultiTexCoord2.y - - uniform float glowAlpha; void main() { @@ -703,7 +658,7 @@ function init() } }else if (vertex.w==-2 ) { - gl_FrontColor = vec4(barColor.rgb,barColor.a*glowAlpha); + gl_FrontColor = vec4(barColor.rgb,barColor.a); if (gl_Vertex.z>1.0) { vertex.x += progress*gl_Vertex.z; @@ -712,7 +667,7 @@ function init() vertex.w = 1; }else if (vertex.w==-3 ) { - gl_FrontColor = vec4(barColor.rgb,barColor.a*(glowAlpha/1.5)); + gl_FrontColor = vec4(barColor.rgb,barColor.a); if (vertex.z>1.0) { vertex.x += progress*gl_Vertex.z; @@ -759,7 +714,7 @@ function init() } ]], uniform = { - glowAlpha = glowAlpha, + }, }); @@ -1050,10 +1005,11 @@ do local customInfo = {} local ci - function DrawUnitInfos(unitID,unitDefID, ud) + function DrawUnitInfos(unitID,unitDefID) if ignoreUnits[unitDefID] ~= nil then return end if (not customInfo[unitDefID]) then + local ud = UnitDefs[unitDefID] customInfo[unitDefID] = { height = ud.height+barHeightOffset, maxShield = ud.shieldPower, @@ -1146,7 +1102,7 @@ do if (fullText and (drawBarPercentage > 0 or dist < minPercentageDistance)) then infotext = floor(morph.progress*100)..'%' end - AddBar("morph",morph.progress,"build",infotext or '') + AddBar("Evolving",morph.progress,"build",infotext or '') end --// PARALYZE @@ -1198,6 +1154,9 @@ do glTranslate(ux, uy+ci.height, uz ) glBillboard() + --// DRAW BARS + DrawBars(fullText) + --// STOCKPILE ICON if (numStockpiled) then if (barShader) then @@ -1209,9 +1168,6 @@ do end end - --// DRAW BARS - DrawBars(fullText) - glPopMatrix() end end @@ -1240,6 +1196,8 @@ do local ci function DrawFeatureInfos(featureID,featureDefID,fullText,fx,fy,fz) + if ignoreFeatures[featureDefID] ~= nil then return end + if (not customInfo[featureDefID]) then local featureDef = FeatureDefs[featureDefID or -1] or {height=0,name=''} customInfo[featureDefID] = { @@ -1376,7 +1334,14 @@ do local GetFeatureHealth = Spring.GetFeatureHealth local GetFeatureResources = Spring.GetFeatureResources - function widget:DrawWorld() + function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorld() + if chobbyInterface then return end if Spring.IsGUIHidden() then return end @@ -1389,23 +1354,19 @@ do --if the camera is too far up, higher than maxDistance on smoothmesh, dont even call any visibility checks or nothing local smoothheight=GetSmoothMeshHeight(cx,cz) --clamps x and z if ((cy-smoothheight)^2 < maxUnitDistance) then - - if not addGlow then - glDepthTest(true) -- enabling this will make healthbars opague to other healthbars or mapmarks and lups?, will remain transparant to world. will be serious issue if glow is enabled - end - + + glDepthTest(true) -- enabling this will make healthbars opague to other healthbars glDepthMask(true) if (barShader) then gl.UseShader(barShader); glMyText(0); end --// draw bars of units - local unitID,unitDefID,unitDef + local unitID,unitDefID for i=1,#visibleUnits do unitID = visibleUnits[i] unitDefID = GetUnitDefID(unitID) - unitDef = UnitDefs[unitDefID or -1] - if unitDef then - DrawUnitInfos(unitID, unitDefID, unitDef) + if unitDefID then + DrawUnitInfos(unitID, unitDefID) end end @@ -1420,10 +1381,10 @@ do for i=1,#visibleFeatures do featureInfo = visibleFeatures[i] if featureResurrectVisibility then - _,_,resurrect = GetFeatureHealth(featureInfo[4]) + resurrect = select(3,GetFeatureHealth(featureInfo[4])) end if featureReclaimVisibility then - _,_,_,_,reclaimLeft = GetFeatureResources(featureInfo[4]) + reclaimLeft = select(5,GetFeatureResources(featureInfo[4])) end if drawFeatureInfo or (featureResurrectVisibility and resurrect and resurrect > 0) or (featureReclaimVisibility and reclaimLeft and reclaimLeft < 1) then wx, wy, wz = featureInfo[1],featureInfo[2],featureInfo[3] @@ -1464,15 +1425,12 @@ do local sec1 = 0 local sec2 = 0 - local videoFrame = 0 - function widget:Update(dt) + gameFrame = GetGameFrame() + sec=sec+dt blink = (sec%1)<0.5 - gameFrame = GetGameFrame() - - videoFrame = videoFrame+1 sec1=sec1+dt if (sec1>1/4) and ((cy-smoothheight)^2 < maxUnitDistance) then sec1 = 0 @@ -1484,23 +1442,21 @@ do sec2 = 0 visibleFeatures = GetVisibleFeatures(-1,nil,false,false) local cnt = #visibleFeatures - local featureID,featureDefID,featureDef - for i=cnt,1,-1 do --TODO: this is very inefficient - featureID = visibleFeatures[i] - featureDefID = GetFeatureDefID(featureID) or -1 - featureDef = FeatureDefs[featureDefID] - --// filter trees and none destructable features - if (featureDef)and(featureDef.destructable)and( - (featureDef.drawTypeString=="model")or(select(5,GetFeatureResources(featureID))<1) - ) then - local fx,fy,fz = GetFeaturePosition(featureID) - visibleFeatures[i] = {fx,fy,fz, featureID, featureDefID} - else - visibleFeatures[i] = visibleFeatures[cnt] - visibleFeatures[cnt] = nil - cnt = cnt-1 - end - end + local featureID,featureDefID + + for i=cnt,1,-1 do + featureID = visibleFeatures[i] + featureDefID = GetFeatureDefID(featureID) or -1 + --// filter trees and none destructable features + if destructableFeature[featureDefID] and (drawnFeature[featureDefID] or (select(5,GetFeatureResources(featureID))<1)) then + local fx,fy,fz = GetFeaturePosition(featureID) + visibleFeatures[i] = {fx,fy,fz, featureID, featureDefID} + else + visibleFeatures[i] = visibleFeatures[cnt] + visibleFeatures[cnt] = nil + cnt = cnt-1 + end + end end end @@ -1516,7 +1472,6 @@ function widget:GetConfigData(data) savedTable.barScale = barScale savedTable.drawBarPercentage = drawBarPercentage savedTable.alwaysDrawBarPercentageForComs = alwaysDrawBarPercentageForComs - savedTable.addGlow = addGlow savedTable.currentOption = currentOption return savedTable end @@ -1525,7 +1480,6 @@ function widget:SetConfigData(data) barScale = data.barScale or barScale drawBarPercentage = data.drawBarPercentage or drawBarPercentage alwaysDrawBarPercentageForComs = data.alwaysDrawBarPercentageForComs or alwaysDrawBarPercentageForComs - addGlow = data.addGlow or addGlow currentOption = data.currentOption or currentOption end @@ -1539,17 +1493,30 @@ function widget:TextCommand(command) if (string.find(command, "healthbars_style") == 1 and string.len(command) == 16) then toggleOption() end - if (string.find(command, "healthbars_glow") == 1 and string.len(command) == 15) then - addGlow = not addGlow - init() - if addGlow then - Spring.Echo("Healthbars: Glow enabled") - else - Spring.Echo("Healthbars: Glow disabled") +end + +function widget:GameFrame(n) + if n%30 == 1 then + notificationTimeout = notificationTimeout - 1 + --Spring.Echo(notificationTimeout) + end + if n%30 == 1 then + local spectator = Spring.GetSpectatingState() + resourcePrompts = Spring.GetConfigInt("evo_resourceprompts", 1) + + --Assume that if it isn't set, resourcePrompts is true + if resourcePrompts == nil then + resourcePrompts = 1 end + + if spectator then + resourcePrompts = 0 + end + --Spring.Echo(resourcePrompts) end end + function MorphUpdate(morphTable) UnitMorphs = morphTable end @@ -1563,5 +1530,14 @@ function MorphStop(unitID) end function MorphFinished(unitID) - UnitMorphs[unitID] = nil + if notificationTimeout > 0 then + UnitMorphs[unitID] = nil + else + if resourcePrompts == 1 then + Spring.PlaySoundFile("sounds/ui/evolutionfinished.wav", 1) + end + Spring.Echo("Your unit(s) have finished Evolving") + notificationTimeout = 10 + UnitMorphs[unitID] = nil + end end diff --git a/LuaUI/Widgets_Evo/gui_highlight_geos.lua b/LuaUI/Widgets_Evo/gui_highlight_geos.lua deleted file mode 100644 index 083dbf052..000000000 --- a/LuaUI/Widgets_Evo/gui_highlight_geos.lua +++ /dev/null @@ -1,119 +0,0 @@ - -function widget:GetInfo() - return { - name = 'Highlight Geos', - desc = 'Highlights geothermal spots when in metal map view', - author = 'Niobium, modified by GoogleFrog', - version = '1.0', - date = 'Mar, 2011', - license = 'GNU GPL, v2 or later', - layer = 0, - enabled = true, -- loaded by default? - } -end - ----------------------------------------------------------------- --- Globals ----------------------------------------------------------------- -local geoDisplayList - ----------------------------------------------------------------- --- Speedups ----------------------------------------------------------------- -local glLineWidth = gl.LineWidth -local glDepthTest = gl.DepthTest -local glCallList = gl.CallList -local spGetMapDrawMode = Spring.GetMapDrawMode -local spGetActiveCommand = Spring.GetActiveCommand -local spGetGameFrame = Spring.GetGameFrame - - -local geoDefID = UnitDefNames["egeothermal"].id - -local mapX = Game.mapSizeX -local mapZ = Game.mapSizeZ -local mapXinv = 1/mapX -local mapZinv = 1/mapZ - -local size = math.max(mapX,mapZ) * 60/4096 - ----------------------------------------------------------------- --- Functions ----------------------------------------------------------------- -local function PillarVerts(x, y, z) - gl.Color(1, 1, 0, 1) - gl.Vertex(x, y, z) - gl.Color(1, 1, 0, 0) - gl.Vertex(x, y + 1000, z) -end - -local geos = {} - -local function HighlightGeos() - local features = Spring.GetAllFeatures() - for i = 1, #features do - local fID = features[i] - if FeatureDefs[Spring.GetFeatureDefID(fID)].geoThermal then - local fx, fy, fz = Spring.GetFeaturePosition(fID) - gl.BeginEnd(GL.LINE_STRIP, PillarVerts, fx, fy, fz) - geos[#geos+1] = {x = fx, z = fz} - end - end -end - ----------------------------------------------------------------- --- Callins ----------------------------------------------------------------- -local drawGeos = false - -function widget:Shutdown() - if geoDisplayList then - gl.DeleteList(geoDisplayList) - end -end - -function widget:DrawWorld() - - local _, cmdID = spGetActiveCommand() - drawGeos = spGetMapDrawMode() == 'metal' or -geoDefID == cmdID or spGetGameFrame() < 1 or (WG.GetWidgetOption and WG.GetWidgetOption('Chili Minimap','Settings/Interface/Map','alwaysDisplayMexes').value) - - if drawGeos then - - if not geoDisplayList then - geoDisplayList = gl.CreateList(HighlightGeos) - end - - glLineWidth(20) - glDepthTest(true) - glCallList(geoDisplayList) - glLineWidth(1) - end -end - -local function drawMinimapGeos(x,z) - gl.Vertex(x - size,0,z - size) - gl.Vertex(x + size,0,z + size) - gl.Vertex(x + size,0,z - size) - gl.Vertex(x - size,0,z + size) -end - -function widget:DrawInMiniMap() - - if drawGeos then - - gl.LoadIdentity() - gl.Translate(0,1,0) - gl.Scale(mapXinv , -mapZinv, 1) - gl.Rotate(270,1,0,0) - gl.LineWidth(2) - gl.Lighting(false) - gl.Color(1,1,0,0.7) - for i = 1, #geos do - local geo = geos[i] - gl.BeginEnd(GL.LINES,drawMinimapGeos,geo.x,geo.z) - end - - gl.LineWidth(0.00000000001) - gl.Color(1,1,1,1) - end -end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_highlight_geos.xlua b/LuaUI/Widgets_Evo/gui_highlight_geos.xlua new file mode 100644 index 000000000..095c5df93 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_highlight_geos.xlua @@ -0,0 +1,127 @@ + +function widget:GetInfo() + return { + name = 'Highlight Geos', + desc = 'Highlights geothermal spots when in metal map view', + author = 'Niobium, modified by GoogleFrog', + version = '1.0', + date = 'Mar, 2011', + license = 'GNU GPL, v2 or later', + layer = 0, + enabled = true, -- loaded by default? + } +end + +---------------------------------------------------------------- +-- Globals +---------------------------------------------------------------- +local geoDisplayList + +---------------------------------------------------------------- +-- Speedups +---------------------------------------------------------------- +local glLineWidth = gl.LineWidth +local glDepthTest = gl.DepthTest +local glCallList = gl.CallList +local spGetMapDrawMode = Spring.GetMapDrawMode +local spGetActiveCommand = Spring.GetActiveCommand +local spGetGameFrame = Spring.GetGameFrame + + +local geoDefID = UnitDefNames["egeothermal"].id + +local mapX = Game.mapSizeX +local mapZ = Game.mapSizeZ +local mapXinv = 1/mapX +local mapZinv = 1/mapZ + +local size = math.max(mapX,mapZ) * 60/4096 + +---------------------------------------------------------------- +-- Functions +---------------------------------------------------------------- +local function PillarVerts(x, y, z) + gl.Color(1, 1, 0, 1) + gl.Vertex(x, y, z) + gl.Color(1, 1, 0, 0) + gl.Vertex(x, y + 500, z) +end + +local geos = {} + +local function HighlightGeos() + local features = Spring.GetAllFeatures() + for i = 1, #features do + local fID = features[i] + if FeatureDefs[Spring.GetFeatureDefID(fID)].geoThermal then + local fx, fy, fz = Spring.GetFeaturePosition(fID) + gl.BeginEnd(GL.LINE_STRIP, PillarVerts, fx, fy, fz) + geos[#geos+1] = {x = fx, z = fz} + end + end +end + +---------------------------------------------------------------- +-- Callins +---------------------------------------------------------------- +local drawGeos = false + +function widget:Shutdown() + if geoDisplayList then + gl.DeleteList(geoDisplayList) + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorld() + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + + local _, cmdID = spGetActiveCommand() + drawGeos = spGetMapDrawMode() == 'metal' or -geoDefID == cmdID or spGetGameFrame() < 1 or (WG.GetWidgetOption and WG.GetWidgetOption('Chili Minimap','Settings/Interface/Map','alwaysDisplayMexes').value) + + --if drawGeos then + + if not geoDisplayList then + geoDisplayList = gl.CreateList(HighlightGeos) + end + + glLineWidth(2) + glDepthTest(true) + glCallList(geoDisplayList) + glLineWidth(1) + --end +end + +local function drawMinimapGeos(x,z) + gl.Vertex(x - size,0,z - size) + gl.Vertex(x + size,0,z + size) + gl.Vertex(x + size,0,z - size) + gl.Vertex(x - size,0,z + size) +end + +function widget:DrawInMiniMap() + + --if drawGeos then + + gl.LoadIdentity() + gl.Translate(0,1,0) + gl.Scale(mapXinv , -mapZinv, 1) + gl.Rotate(270,1,0,0) + gl.LineWidth(2) + gl.Lighting(false) + gl.Color(1,1,0,0.7) + for i = 1, #geos do + local geo = geos[i] + gl.BeginEnd(GL.LINES,drawMinimapGeos,geo.x,geo.z) + end + + gl.LineWidth(0.00000000001) + gl.Color(1,1,1,1) + --end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_highlight_selectedunits.lua b/LuaUI/Widgets_Evo/gui_highlight_selectedunits.lua new file mode 100644 index 000000000..476b89ea4 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_highlight_selectedunits.lua @@ -0,0 +1,238 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_highlight_unit.lua +-- brief: highlights the unit/feature under the cursor +-- author: Dave Rodgers, modified by zwzsg +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Highlight Selected Units", + desc = "Highlights the selelected units", + author = "Floris (original: zwzsg, from trepan HighlightUnit)", + date = "Apr 24, 2009", + license = "GNU GPL, v2 or later", + layer = -8, + enabled = false + } +end + +local useTeamcolor = false +local highlightAlpha = 0.1 +local useHighlightShader = true +local maxShaderUnits = 150 +local edgeExponent = 3 + +local spIsUnitIcon = Spring.IsUnitIcon +local spIsUnitInView = Spring.IsUnitInView +local spGetTeamColor = Spring.GetTeamColor +local spGetUnitTeam = Spring.GetUnitTeam + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +local function SetupCommandColors(state) + local alpha = state and 1 or 0 + local f = io.open('cmdcolors.tmp', 'w+') + if (f) then + f:write('unitBox 0 1 0 ' .. alpha) + f:close() + Spring.SendCommands({'cmdcolors cmdcolors.tmp'}) + end + os.remove('cmdcolors.tmp') +end + + +function CreateHighlightShader() + if shader then + gl.DeleteShader(shader) + end + if gl.CreateShader ~= nil then + shader = gl.CreateShader({ + + uniform = { + edgeExponent = edgeExponent/(0.8+highlightAlpha), + plainAlpha = highlightAlpha*0.8, + }, + + vertex = [[ + #version 150 compatibility + // Application to vertex shader + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + uniform mat4 camera; + uniform mat4 caminv; + + void main() + { + vec4 P = gl_ModelViewMatrix * gl_Vertex; + + eyeVec = P.xyz; + + normal = gl_NormalMatrix * gl_Normal; + + color = gl_Color.rgb; + + gl_Position = gl_ProjectionMatrix * P; + } + ]], + + fragment = [[ + #version 150 compatibility + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + + uniform float edgeExponent; + uniform float plainAlpha; + + void main() + { + float opac = dot(normalize(normal), normalize(eyeVec)); + opac = 1.0 - abs(opac); + opac = pow(opac, edgeExponent)*0.45; + + gl_FragColor.rgb = color + (opac*1.3); + gl_FragColor.a = plainAlpha + opac; + + } + ]], + }) + end +end +-------------------------------------------------------------------------------- + +function widget:Initialize() + WG['highlightselunits'] = {} + WG['highlightselunits'].getOpacity = function() + return highlightAlpha + end + WG['highlightselunits'].setOpacity = function(value) + highlightAlpha = value + CreateHighlightShader() + end + WG['highlightselunits'].getShader = function() + return useHighlightShader + end + WG['highlightselunits'].setShader = function(value) + if value and (Spring.GetConfigInt("ForceShaders") or 1) ~= 1 then + Spring.SetConfigInt("ForceShaders",1) + Spring.Echo('enabled lua shaders') + end + useHighlightShader = value + CreateHighlightShader() + end + WG['highlightselunits'].getTeamcolor = function() + return useTeamcolor + end + WG['highlightselunits'].setTeamcolor = function(value) + useTeamcolor = value + CreateHighlightShader() + end + + SetupCommandColors(false) + CreateHighlightShader() +end + + +function widget:Shutdown() + if shader then + gl.DeleteShader(shader) + end + if WG['teamplatter'] == nil and WG['fancyselectedunits'] == nil then + SetupCommandColors(true) + end + WG['highlightselunits'] = nil +end + + + +-------------------------------------------------------------------------------- + +local selectedUnits = Spring.GetSelectedUnits() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() +function widget:SelectionChanged(sel) + selectedUnits = sel + selectedUnitsCount = Spring.GetSelectedUnitsCount() +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorld() + if chobbyInterface then return end + if not selectedUnits or Spring.IsGUIHidden() then return end + + gl.DepthTest(true) + gl.PolygonOffset(-0.5, -0.5) + gl.Blending(GL.SRC_ALPHA, GL.ONE) + + --local selectedUnits = Spring.GetSelectedUnits() + if useHighlightShader and shader and selectedUnitsCount < maxShaderUnits then + gl.UseShader(shader) + end + local teamID, prevTeamID, r,g,b + for _,unitID in ipairs(selectedUnits) do + if not spIsUnitIcon(unitID) and spIsUnitInView(unitID) then + local health,maxHealth,paralyzeDamage,captureProgress,buildProgress=Spring.GetUnitHealth(unitID) + if maxHealth ~= nil then + if useTeamcolor then + teamID = spGetUnitTeam(unitID) + if teamID ~= prevTeamID then + r,g,b = spGetTeamColor(teamID) + end + prevTeamID = teamID + gl.Color(r,g,b,highlightAlpha) + else + gl.Color( + health>maxHealth/2 and 2-2*health/maxHealth or 1, -- red + health>maxHealth/2 and 1 or 2*health/maxHealth, -- green + 0, -- blue + highlightAlpha + ) + end + gl.Unit(unitID, true) + end + end + end + + if useHighlightShader and shader and #selectedUnits < maxShaderUnits then + gl.UseShader(0) + end + + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.PolygonOffset(false) + gl.DepthTest(false) +end + + +widget.DrawWorldReflection = widget.DrawWorld + +widget.DrawWorldRefraction = widget.DrawWorld + + + +function widget:GetConfigData() + return {highlightAlpha=highlightAlpha, useHighlightShader=useHighlightShader, useTeamcolor=useTeamcolor} +end + +function widget:SetConfigData(data) + if data.useHighlightShader ~= nil then highlightAlpha = data.highlightAlpha end + if data.useHighlightShader ~= nil then useHighlightShader = data.useHighlightShader end + if data.useHighlightShader ~= nil then useTeamcolor = data.useTeamcolor end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_highlight_unit.lua b/LuaUI/Widgets_Evo/gui_highlight_unit.lua new file mode 100644 index 000000000..57ff342ca --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_highlight_unit.lua @@ -0,0 +1,384 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_highlight_unit.lua +-- brief: highlights the unit/feature under the cursor +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + local grey = "\255\192\192\192" + local yellow = "\255\255\255\128" + return { + name = "Highlight Unit", + desc = "Highlights the unit or feature under the cursor\n", + author = "trepan", + date = "Apr 16, 2007", + license = "GNU GPL, v2 or later", + layer = 5, + enabled = true -- loaded by default? + } +end + +local drawFeatureHighlight = false +local unitAlpha = 0.2 +local featureAlpha = 0.14 + +local useShader = true +local edgeExponent = 1.25 +local shaderUnitAlphaMultiplier = 0.7 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local GL_BACK = GL.BACK +local GL_EYE_LINEAR = GL.EYE_LINEAR +local GL_EYE_PLANE = GL.EYE_PLANE +local GL_FRONT = GL.FRONT +local GL_INVERT = GL.INVERT +local GL_ONE = GL.ONE +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local GL_QUAD_STRIP = GL.QUAD_STRIP +local GL_SRC_ALPHA = GL.SRC_ALPHA +local GL_T = GL.T +local GL_TEXTURE_GEN_MODE = GL.TEXTURE_GEN_MODE +local GL_TRIANGLE_FAN = GL.TRIANGLE_FAN +local glBeginEnd = gl.BeginEnd +local glBlending = gl.Blending +local glCallList = gl.CallList +local glColor = gl.Color +local glCreateList = gl.CreateList +local glCulling = gl.Culling +local glDeleteList = gl.DeleteList +local glDepthTest = gl.DepthTest +local glFeature = gl.Feature +local glLogicOp = gl.LogicOp +local glPolygonOffset = gl.PolygonOffset +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glScale = gl.Scale +local glTexCoord = gl.TexCoord +local glTexGen = gl.TexGen +local glTexture = gl.Texture +local glTranslate = gl.Translate +local glUnit = gl.Unit +local glVertex = gl.Vertex +local spDrawUnitCommands = Spring.DrawUnitCommands +local spGetFeatureDefID = Spring.GetFeatureDefID +local spGetFeaturePosition = Spring.GetFeaturePosition +local spGetFeatureRadius = Spring.GetFeatureRadius +local spGetModKeyState = Spring.GetModKeyState +local spGetMouseState = Spring.GetMouseState +local spGetMyAllyTeamID = Spring.GetMyAllyTeamID +local spGetMyPlayerID = Spring.GetMyPlayerID +local spGetMyTeamID = Spring.GetMyTeamID +local spGetPlayerControlledUnit = Spring.GetPlayerControlledUnit +local spGetUnitAllyTeam = Spring.GetUnitAllyTeam +local spGetUnitTeam = Spring.GetUnitTeam +local spTraceScreenRay = Spring.TraceScreenRay + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +local texName = 'LuaUI/Images/highlight_strip.png' + +local cylDivs = 64 +local cylList = 0 + +local vsx, vsy = widgetHandler:GetViewSizes() +function widget:ViewResize(viewSizeX, viewSizeY) + vsx = viewSizeX + vsy = viewSizeY +end + + +function CreateHighlightShader() + if shader then + gl.DeleteShader(shader) + end + if gl.CreateShader ~= nil then + shader = gl.CreateShader({ + + uniform = { + edgeExponent = edgeExponent, + }, + + vertex = [[ + #version 150 compatibility + // Application to vertex shader + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + uniform mat4 camera; + uniform mat4 caminv; + + void main() + { + vec4 P = gl_ModelViewMatrix * gl_Vertex; + + eyeVec = P.xyz; + + normal = gl_NormalMatrix * gl_Normal; + + color = gl_Color.rgb; + + gl_Position = gl_ProjectionMatrix * P; + } + ]], + + fragment = [[ + #version 150 compatibility + varying vec3 normal; + varying vec3 eyeVec; + varying vec3 color; + + uniform float edgeExponent; + + void main() + { + float opac = dot(normalize(normal), normalize(eyeVec)); + opac = 1.0 - abs(opac); + opac = pow(opac, edgeExponent)*0.4; + + gl_FragColor.rgb = color + opac); + gl_FragColor.a = opac; + + } + ]], + }) + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + cylList = glCreateList(DrawCylinder, cylDivs) + CreateHighlightShader() +end + + +function widget:Shutdown() + glDeleteList(cylList) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function DrawCylinder(divs) + local cos = math.cos + local sin = math.sin + local divRads = (2.0 * math.pi) / divs + -- top + glBeginEnd(GL_TRIANGLE_FAN, function() + for i = 1, divs do + local a = i * divRads + glVertex(sin(a), 1.0, cos(a)) + end + end) + -- bottom + glBeginEnd(GL_TRIANGLE_FAN, function() + for i = 1, divs do + local a = -i * divRads + glVertex(sin(a), -1.0, cos(a)) + end + end) + -- sides + glBeginEnd(GL_QUAD_STRIP, function() + for i = 0, divs do + local a = i * divRads + glVertex(sin(a), 1.0, cos(a)) + glVertex(sin(a), -1.0, cos(a)) + end + end) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function HilightModel(drawFunc, drawData) + glDepthTest(true) + glPolygonOffset(-2, -2) + glBlending(GL_SRC_ALPHA, GL_ONE) + + local scale = 35 + local shift = (2 * widgetHandler:GetHourTimer()) % scale + glTexCoord(0, 0) + glTexGen(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR) + glTexGen(GL_T, GL_EYE_PLANE, 0, (1 / scale), 0, shift) + glTexture(texName) + + drawFunc(drawData) + + glTexture(false) + glTexGen(GL_T, false) + + glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + glPolygonOffset(false) + glDepthTest(false) +end + + +-------------------------------------------------------------------------------- + +local function SetUnitColor(unitID, alpha) + local teamID = spGetUnitTeam(unitID) + if (teamID == nil) then + glColor(1.0, 0.0, 0.0, alpha) -- red + elseif (teamID == spGetMyTeamID()) then + glColor(1.0, 1.0, 1.0, alpha) -- white + elseif (spGetUnitAllyTeam(unitID) == spGetMyAllyTeamID()) then + glColor(0.0, 1.0, 0.0, alpha) -- green + else + glColor(1.0, 0.0, 0.0, alpha) -- red + end +end + + +local function SetFeatureColor(featureID, alpha) + glColor(1.0, 0.0, 1.0, alpha) -- purple + do return end -- FIXME -- wait for feature team/allyteam resolution + + local allyTeamID = spGetFeatureAllyTeam(featureID) + if ((allyTeamID == nil) or (allyTeamID < 0)) then + glColor(1.0, 1.0, 1.0, alpha) -- white + elseif (allyTeamID == spGetMyAllyTeamID()) then + glColor(1.0, 1.0, 1.0, alpha) -- white + else + glColor(1.0, 0.0, 0.0, alpha) -- red + end +end + + +local function UnitDrawFunc(unitID) + glUnit(unitID, true) +end + + +local function FeatureDrawFunc(featureID) + glFeature(featureID, true) +end + + +local function HilightUnit(unitID) + --local outline = (spGetUnitIsCloaked(unitID) ~= true) + SetUnitColor(unitID, (useShader and shader) and unitAlpha*shaderUnitAlphaMultiplier or unitAlpha) + HilightModel(UnitDrawFunc, unitID) +end + + +local function HilightFeatureModel(featureID) + SetFeatureColor(featureID, (useShader and shader) and featureAlpha*shaderUnitAlphaMultiplier or featureAlpha) + HilightModel(FeatureDrawFunc, featureID, true) +end + + +local function HilightFeature(featureID) + local fDefID = spGetFeatureDefID(featureID) + local fd = FeatureDefs[fDefID] + if (fd == nil) then return end + + if (fd.drawType == 0) then + HilightFeatureModel(featureID) + return + end + + local radius = spGetFeatureRadius(featureID) + if (radius == nil) then + return + end + + local px, py, pz = spGetFeaturePosition(featureID) + if (px == nil) then return end + + local yScale = 4 + glPushMatrix() + glTranslate(px, py, pz) + glScale(radius, yScale * radius, radius) + -- FIXME: needs an 'inside' check + + glDepthTest(true) + glLogicOp(GL_INVERT) + + glCulling(GL_FRONT) + glCallList(cylList) + + glCulling(GL_BACK) + glCallList(cylList) + + glLogicOp(false) + glCulling(false) + glDepthTest(false) + + glPopMatrix() +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local type, data -- for the TraceScreenRay() call + + +function widget:Update() + local mx, my = spGetMouseState() + type, data = spTraceScreenRay(mx, my) +end + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawWorld() + if chobbyInterface then return end + if (WG['topbar'] and WG['topbar'].showingQuit()) then + return + end + if Spring.IsGUIHidden() then return end + if drawFeatureHighlight and (type == 'feature') then + HilightFeature(data) + if useShader and shader then + gl.UseShader(shader) + HilightModel(FeatureDrawFunc, data) + gl.UseShader(0) + end + elseif (type == 'unit') then + local unitID = spGetPlayerControlledUnit(spGetMyPlayerID()) + if data ~= unitID and not Spring.IsUnitIcon(data) then + + HilightUnit(data) + + if useShader and shader then + gl.UseShader(shader) + HilightModel(UnitDrawFunc, data) + gl.UseShader(0) + end + -- also draw the unit's command queue + local a,c,m,s = spGetModKeyState() + if (m) then + spDrawUnitCommands(data) + end + end + end +end + + +widget.DrawWorldReflection = widget.DrawWorld + +widget.DrawWorldRefraction = widget.DrawWorld + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_idle_builders.lua b/LuaUI/Widgets_Evo/gui_idle_builders.lua new file mode 100644 index 000000000..7db08ef51 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_idle_builders.lua @@ -0,0 +1,742 @@ + +function widget:GetInfo() + return { + name = "Idle Builders", + desc = "Idle Indicator", + author = "Floris (original by Ray)", + date = "15 april 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = false -- loaded by default? + } +end + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local enabledAsSpec = false + +local MAX_ICONS = 10 +local iconsize = 37 +local ICON_SIZE_X = iconsize +local ICON_SIZE_Y = iconsize +local CONDENSE = false -- show one icon for all builders of same type +local POSITION_X = 0.5 -- horizontal centre of screen +local POSITION_Y = 0.095 -- near bottom +local NEAR_IDLE = 0 -- this means that factories with only X build items left will be shown as idle + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +local bgcorner = "LuaUI/Images/bgcorner.png" +local cornerSize = 7 +local bgcornerSize = cornerSize + +local playSounds = true +local leftclick = 'LuaUI/Sounds/buildbar_add.wav' +local middleclick = 'LuaUI/Sounds/buildbar_click.wav' +local rightclick = 'LuaUI/Sounds/buildbar_rem.wav' + +local hoversize = 0 +local rot = 0 + +local X_MIN = 0 +local X_MAX = 0 +local Y_MIN = 0 +local Y_MAX = 0 +local drawTable = {} +local IdleList = {} +local activePress = false +local QCount = {} +local noOfIcons = 0 +local displayList = {} + +local spGetSpectatingState = Spring.GetSpectatingState +local enabled = true + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +local glColor = gl.Color +local glShape = gl.Shape +local glDepthTest = gl.DepthTest +local glDepthMask = gl.DepthMask +local glCulling = gl.Culling +local glLighting = gl.Lighting +local glBlending = gl.Blending +local glMaterial = gl.Material +local glTranslate = gl.Translate +local glTexture = gl.Texture +local glScissor = gl.Scissor +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glUnitShape = gl.UnitShape +local glUnitShapeTextures = gl.UnitShapeTextures +local glClear = gl.Clear +local glText = gl.Text +local glUnit = gl.Unit +local glScale = gl.Scale +local glRotate = gl.Rotate +local glRect = gl.Rect +local glCallList = gl.CallList +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glBeginEnd = gl.BeginEnd +local glTexCoord = gl.TexCoord +local glVertex = gl.Vertex +local glLoadIdentity = gl.LoadIdentity +local glGetScreenViewTrans = gl.GetScreenViewTrans + +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local GL_LINE_LOOP = GL.LINE_LOOP +local GL_FRONT = GL.FRONT +local GL_SRC_ALPHA = GL.SRC_ALPHA +local GL_ONE = GL.ONE +local GL_QUADS = GL.QUADS +local GL_DEPTH_BUFFER_BIT = GL.DEPTH_BUFFER_BIT + + +local GetUnitDefID = Spring.GetUnitDefID +local GetFullBuildQueue = Spring.GetFullBuildQueue +local GetUnitHealth = Spring.GetUnitHealth +local GetCommandQueue = Spring.GetCommandQueue +local GetMyTeamID = Spring.GetMyTeamID +local GetTeamUnitsSorted = Spring.GetTeamUnitsSorted +local GetMouseState = Spring.GetMouseState +local GetUnitPosition = Spring.GetUnitPosition +local SendCommands = Spring.SendCommands +local SelectUnitArray = Spring.SelectUnitArray +local GetModKeyState = Spring.GetModKeyState +local GetUnitDefDimensions = Spring.GetUnitDefDimensions + +local GetViewGeometry = Spring.GetViewGeometry +local ValidUnitID = Spring.ValidUnitID +local GetTeamUnitsSorted = Spring.GetTeamUnitsSorted +local GetGameFrame = Spring.GetGameFrame +local GetCameraPosition = Spring.GetCameraPosition +local GetCameraDirection = Spring.GetCameraDirection +local SetCameraTarget = Spring.SetCameraTarget + +local fmod = math.fmod +local math_sin = math.sin +local math_pi = math.pi + +local getn = table.getn + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +local sizeMultiplier = 1 +local function init() + vsx,vsy = GetViewGeometry() + sizeMultiplier = 1 + (vsx*vsy / 4500000) + + ICON_SIZE_X = iconsize * sizeMultiplier + ICON_SIZE_Y = ICON_SIZE_X + bgcornerSize = cornerSize * (sizeMultiplier - 1) + noOfIcons = 0 -- this fixes positioning when resolution change +end + +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + init() +end + +function widget:PlayerChanged(playerID) + if enabledAsSpec == false and Spring.GetGameFrame() > 0 and Spring.GetSpectatingState() then + widgetHandler:RemoveWidget(self) + end +end + +function widget:Initialize() + widget:PlayerChanged() + enabled = true + if not enabledAsSpec then + enabled = not spGetSpectatingState() + end + init() +end + +function widget:GameOver() + widgetHandler:RemoveWidget(self) +end + +local function IsIdleBuilder(unitID) + local udef = GetUnitDefID(unitID) + local ud = UnitDefs[udef] + local qCount = 0 + if ud.buildSpeed > 0 and ud.buildOptions[1] then --- can build + local bQueue = GetFullBuildQueue(unitID) + if not bQueue[1] then --- has no build queue + local _, _, _, _, buildProg = GetUnitHealth(unitID) + if buildProg == 1 then --- isnt under construction + if ud.isFactory then + return true + else + if GetCommandQueue(unitID,0) == 0 then + return true + end + end + end + elseif ud.isFactory then + for _, thing in ipairs(bQueue) do + for _, count in pairs(thing) do + qCount = qCount + count + end + end + if qCount <= NEAR_IDLE then + QCount[unitID] = qCount + return true + end + end + end + return false +end + +local function DrawBoxes(number) + glColor({ 0, 0, 0, 0.7}) + local X1 = X_MIN + local ct = 0 + while (ct < number) do + ct = ct + 1 + local X2 = X1+ICON_SIZE_X + + if widgetHandler:InTweakMode() then + glShape(GL_LINE_LOOP, { + { v = { X1, Y_MIN } }, + { v = { X2, Y_MIN } }, + { v = { X2, Y_MAX } }, + { v = { X1, Y_MAX } }, + }) + X1 = X2 + else + --DrawIconQuad((ct-1), { 0, 0, 0, 0.4 }, 1.2) + end + end + --Spring.Echo(X2) +end--]] + +local function CenterUnitDef(unitDefID) + local ud = UnitDefs[unitDefID] + if (not ud) then + return + end + if (not ud.dimensions) then + ud.dimensions = GetUnitDefDimensions(unitDefID) + end + if (not ud.dimensions) then + return + end + + local d = ud.dimensions + local xSize = (d.maxx - d.minx) + local ySize = (d.maxy - d.miny) + local zSize = (d.maxz - d.minz) + + local hSize -- maximum horizontal dimension + if (xSize > zSize) then hSize = xSize else hSize = zSize end + + -- aspect ratios + local mAspect = hSize / ySize + local vAspect = ICON_SIZE_X / ICON_SIZE_Y + + -- scale the unit to the box (maxspect) + local scale + if (mAspect > vAspect) then + scale = (ICON_SIZE_X / hSize) + else + scale = (ICON_SIZE_Y / ySize) + end + scale = scale * 0.8 + glScale(scale, scale, scale) + + -- translate to the unit's midpoint + local xMid = 0.5 * (d.maxx + d.minx) + local yMid = 0.5 * (d.maxy + d.miny) + local zMid = 0.5 * (d.maxz + d.minz) + glTranslate(-xMid, -yMid, -zMid) +end + + + +local function DrawUnitIcons(number) + if not drawTable then + return -1 + end + local ct = 0 + local X1, X2 + + local cpx, cpy, cpz = GetCameraPosition() + local ctx, cty, ctz = glGetScreenViewTrans() + + -- magic to keep UnitShape fog under control + SetCameraTarget(ctx, cty, ctz, -1.0) + + glTexture(false) + glScissor(true) + + while (ct < number) do + ct = ct + 1 + local unitID = drawTable[ct][2] + + if (type(unitID) == 'number' and ValidUnitID(unitID)) or type(unitID) == 'table' then + + X1 = X_MIN+(ICON_SIZE_X*(ct-1)) + X2 = X1+ICON_SIZE_X + + glPushMatrix() + glLoadIdentity() + glTranslate(ctx, cty, ctz) + + glScissor(X1, Y_MIN, X2 - X1, Y_MAX - Y_MIN) + + glTranslate(0.5*(X2+X1), 0.5*(Y_MAX+Y_MIN), 0) + glRotate(18, 1, 0, 0) + glRotate(rot, 0, 1, 0) + + CenterUnitDef(drawTable[ct][1]) + + --glUnitShapeTextures(drawTable[ct][1], true) + glUnitShape(drawTable[ct][1], GetMyTeamID(), false, true, true) + --glUnitShapeTextures(drawTable[ct][1], false) + + glScissor(false) + glPopMatrix() + + if CONDENSE then + local NumberCondensed = table.getn(drawTable[ct][2]) + if NumberCondensed > 1 then + font:Begin() + font:Print(NumberCondensed, X1, Y_MIN, 8*sizeMultiplier, "o") + font:End() + end + end + + if type(unitID) == 'table' then + unitID = unitID[1] + end + if ValidUnitID(unitID) and QCount[unitID] then + font:Begin() + font:Print(QCount[unitID], X1+(0.5*ICON_SIZE_X),Y_MIN,10*sizeMultiplier,"ocn") + font:End() + end + end + end + + SetCameraTarget(cpx, cpy, cpz, -1.0) +end + + +local function MouseOverIcon(x, y) + if not drawTable then return -1 end + + local NumOfIcons = table.getn(drawTable) + if (x < X_MIN) then return -1 end + if (x > X_MAX) then return -1 end + if (y < Y_MIN) then return -1 end + if (y > Y_MAX) then return -1 end + + local icon = math.floor((x-X_MIN)/ICON_SIZE_X) + if (icon < 0) then + icon = 0 + end + if (icon >= NumOfIcons) then + icon = (NumOfIcons - 1) + end + return icon +end + + +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) + glTexCoord(0.8,0.8) + glVertex(px+cs, py, 0) + glVertex(sx-cs, py, 0) + glVertex(sx-cs, sy, 0) + glVertex(px+cs, sy, 0) + + glVertex(px, py+cs, 0) + glVertex(px+cs, py+cs, 0) + glVertex(px+cs, sy-cs, 0) + glVertex(px, sy-cs, 0) + + glVertex(sx, py+cs, 0) + glVertex(sx-cs, py+cs, 0) + glVertex(sx-cs, sy-cs, 0) + glVertex(sx, sy-cs, 0) + + local offset = 0.03 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end + glTexCoord(o,o) + glVertex(px, py, 0) + glTexCoord(o,1-offset) + glVertex(px+cs, py, 0) + glTexCoord(1-offset,1-offset) + glVertex(px+cs, py+cs, 0) + glTexCoord(1-offset,o) + glVertex(px, py+cs, 0) + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end + glTexCoord(o,o) + glVertex(sx, py, 0) + glTexCoord(o,1-offset) + glVertex(sx-cs, py, 0) + glTexCoord(1-offset,1-offset) + glVertex(sx-cs, py+cs, 0) + glTexCoord(1-offset,o) + glVertex(sx, py+cs, 0) + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + glTexCoord(o,o) + glVertex(px, sy, 0) + glTexCoord(o,1-offset) + glVertex(px+cs, sy, 0) + glTexCoord(1-offset,1-offset) + glVertex(px+cs, sy-cs, 0) + glTexCoord(1-offset,o) + glVertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end + glTexCoord(o,o) + glVertex(sx, sy, 0) + glTexCoord(o,1-offset) + glVertex(sx-cs, sy, 0) + glTexCoord(1-offset,1-offset) + glVertex(sx-cs, sy-cs, 0) + glTexCoord(1-offset,o) + glVertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) + glTexture(bgcorner) + glBeginEnd(GL_QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) + glTexture(false) +end + + +function DrawIconQuad(iconPos, color, size) + local X1 = X_MIN + (ICON_SIZE_X * iconPos) + local X2 = X1 + (ICON_SIZE_X) + local corneradjust = (bgcornerSize / (3 + (math.abs(hoversize)))) * size + + glColor(color) + RectRound(X1-corneradjust, Y_MIN-corneradjust, X2+corneradjust, Y_MAX+corneradjust, bgcornerSize) + + if WG['guishader'] then + WG['guishader'].InsertDlist(glCreateList( function() RectRound(X1-corneradjust, Y_MIN-corneradjust, X2+corneradjust, Y_MAX+corneradjust, bgcornerSize) end), 'idlebuilders') + end + +end--]] + + +------------------------------------------------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------------------------------------------------------ +local Clicks = {} +local mouseOnUnitID = nil + + + +function widget:GetConfigData(data) + return { + position_x = POSITION_X, + position_y = POSITION_Y, + max_icons = MAX_ICONS + } +end + + +function widget:SetConfigData(data) + POSITION_X = data.position_x or POSITION_X + POSITION_Y = data.position_y or POSITION_Y + MAX_ICONS = data.max_icons or MAX_ICONS +end + + +local sec = 0 +local doUpdate = true +function widget:Update(dt) + if chobbyInterface then return end + + if not enabled then return end + + local iconNum = MouseOverIcon(GetMouseState()) + if iconNum < 0 then + mouseOnUnitID = nil + else + local unitID = drawTable[iconNum+1][2] + local unitDefID = drawTable[iconNum+1][1] + if not Clicks[unitDefID] then + Clicks[unitDefID] = 1 + end + if type(unitID) == 'table' then + unitID = unitID[fmod(Clicks[unitDefID]+1, getn(unitID))+1] + end + mouseOnUnitID = unitID + end + + sec = sec + dt + hoversize = math_sin(math_pi*(sec)) + rot = 30* math_sin(math_pi*(sec/2.5)) + + if GetGameFrame() % 31 == 0 or doUpdate then + doUpdate = false + IdleList = {} + QCount = {} + local myUnits = GetTeamUnitsSorted(GetMyTeamID()) + local unitCount = 0 + for unitDefID, unitTable in pairs(myUnits) do + if type(unitTable) == 'table' then + for count, unitID in pairs(unitTable) do + if count ~= 'n' and IsIdleBuilder(unitID) then + unitCount = unitCount + 1 + if IdleList[unitDefID] then + IdleList[unitDefID][#IdleList[unitDefID]+1] = unitID + else + IdleList[unitDefID] = {unitID} + end + end + end + end + end + + if unitCount >= MAX_ICONS then + CONDENSE = true + else + CONDENSE = false + end + + oldNoOfIcons = noOfIcons + noOfIcons = 0 + drawTable = {} + + for unitDefID, units in pairs(IdleList) do + if CONDENSE then + drawTable[#drawTable+1] = {unitDefID, units} + noOfIcons = noOfIcons + 1 + else + for _, unitID in pairs(units) do + drawTable[#drawTable+1] = {unitDefID, unitID} + end + noOfIcons = noOfIcons + table.getn(units) + end + end + if noOfIcons > MAX_ICONS then + noOfIcons = MAX_ICONS + end + if noOfIcons ~= oldNoOfIcons then + calcSizes(noOfIcons) + end + end +end + +function calcSizes(numIcons) + X_MIN = POSITION_X*vsx-0.5*numIcons*ICON_SIZE_X + X_MAX = POSITION_X*vsx+0.5*numIcons*ICON_SIZE_X + Y_MIN = POSITION_Y*vsy-0.5*ICON_SIZE_Y + Y_MAX = POSITION_Y*vsy+0.5*ICON_SIZE_Y +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + + if widgetHandler:InTweakMode() then + calcSizes(MAX_ICONS) + DrawBoxes(MAX_ICONS) + calcSizes(noOfIcons) + local line1 = "Idle cons tweak mode" + local line2 = "Click and drag here to move icons around, hover over icons and move mouse wheel to change max number of icons" + font:Begin() + font:Print(line1, POSITION_X*vsx, POSITION_Y*vsy, 15, "c") + font:Print(line2, POSITION_X*vsx, (POSITION_Y*vsy)-10, 10, "c") + font:End() + return + end + + if WG['guishader'] then + WG['guishader'].DeleteDlist('idlebuilders') + end + + if enabled and noOfIcons > 0 then + local x, y, lb, mb, rb = GetMouseState() + + if not WG['topbar'] or not WG['topbar'].showingQuit() then + local icon = MouseOverIcon(x, y) + if (icon >= 0) then + + if (lb or mb or rb) then + DrawIconQuad(icon, { 0.5, 0.2, 0, 0.5 }, 1.1) + else + DrawIconQuad(icon, { 0, 0, 0.1, 0.4 }, 1.1) + end + end + end + glClear(GL_DEPTH_BUFFER_BIT) + DrawUnitIcons(noOfIcons) + end +end + + +function widget:TweakMouseMove(x, y, dx, dy, button) + local right = (x + (0.5*MAX_ICONS*ICON_SIZE_X))/vsx + local left = (x - (0.5*MAX_ICONS*ICON_SIZE_X))/vsx + local top = (y + (0.5*ICON_SIZE_Y))/vsy + local bottom = (y - (0.5*ICON_SIZE_Y))/vsy + if right > 1 then + right = 1 + left = 1 - (MAX_ICONS*ICON_SIZE_X)/vsx + end + if left < 0 then + left = 0 + right = (MAX_ICONS*ICON_SIZE_X)/vsx + end + if top > 1 then + top = 1 + bottom = 1 - ICON_SIZE_Y/vsy + end + if bottom < 0 then + bottom = 0 + top = ICON_SIZE_Y/vsy + end + + POSITION_X = 0.5*(right+left) + POSITION_Y = 0.5*(top+bottom) +end + + +function widget:TweakMousePress(x, y, button) + local iconNum = MouseOverIcon(x, y) + if iconNum >= 0 then return true end +end + + +function widget:MouseWheel(up, value) + if not widgetHandler:InTweakMode() then return false end + + local x,y,_,_,_ = GetMouseState() + local iconNum = MouseOverIcon(x, y) + if iconNum < 0 then return false end + + if up then + MAX_ICONS = MAX_ICONS + 1 + else + MAX_ICONS = MAX_ICONS - 1 + if MAX_ICONS < 1 then MAX_ICONS = 1 end + end + return true +end + + +function widget:DrawInMiniMap(sx, sz) + if not mouseOnUnitID then return -1 end + + local ux, uy, uz = GetUnitPosition(mouseOnUnitID) + if (not ux or not uy or not uz) then + return + end + local xr = ux/(Game.mapSizeX) + local yr = 1 - uz/(Game.mapSizeZ) + glColor(1,0,0) + glRect(xr*sx, yr*sz, (xr*sx)+5, (yr*sz)+5) +end + + +function widget:MousePress(x, y, button) + local icon = MouseOverIcon(x, y) + activePress = (icon >= 0) + return activePress +end + + +function widget:MouseRelease(x, y, button) + if not activePress then return -1 end + activePress = false + + local iconNum = MouseOverIcon(x, y) + if iconNum < 0 then return -1 end + + local unitID = drawTable[iconNum+1][2] + local unitDefID = drawTable[iconNum+1][1] + + if type(unitID) == 'table' then + if Clicks[unitDefID] then + Clicks[unitDefID] = Clicks[unitDefID] + 1 + else + Clicks[unitDefID] = 1 + end + unitID = unitID[fmod(Clicks[unitDefID], getn(unitID))+1] + end + + local alt, ctrl, meta, shift = GetModKeyState() + + if (button == 1) then -- left mouse + SelectUnitArray({unitID}) + if playSounds then + Spring.PlaySoundFile(leftclick, 0.75, 'ui') + end + elseif (button == 2) then -- middle mouse + SelectUnitArray({unitID}) + SendCommands({"viewselection"}) + if playSounds then + Spring.PlaySoundFile(middleclick, 0.75, 'ui') + end + end + + return -1 +end + + +--function widget:GetTooltip(x, y) +-- local iconNum = MouseOverIcon(x, y) +-- local units = drawTable[iconNum+1][2] +-- if type(units) == 'table' then +-- units = units[1] +-- end +-- local unitDefID = GetUnitDefID(units) +-- local ud = UnitDefs[unitDefID] +-- if not ud then +-- return "" +-- end +-- return ud.humanName .. "\nLeft mouse: select unit\nMiddle mouse: move to unit\n" +--end +-- +-- +--function widget:IsAbove(x, y) +-- return MouseOverIcon(x, y) ~= -1 +--end + + +function widget:DrawWorld() + if chobbyInterface then return end + if mouseOnUnitID and (not WG['topbar'] or not WG['topbar'].showingQuit()) then + if widgetHandler:InTweakMode() then return -1 end + glColor(1,1,1,0.22) + glUnit(mouseOnUnitID, true) + end +end + +function widget:Shutdown() + gl.DeleteFont(font) + if WG['guishader'] then + WG['guishader'].DeleteDlist('idlebuilders') + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_idle_builders_new.lua b/LuaUI/Widgets_Evo/gui_idle_builders_new.lua deleted file mode 100644 index ce9df180e..000000000 --- a/LuaUI/Widgets_Evo/gui_idle_builders_new.lua +++ /dev/null @@ -1,524 +0,0 @@ - -function widget:GetInfo() - return { - name = "IdleBuildersNEW", - desc = "Adv Idle Indicator", - author = "Ray", - date = "Jul 23, 2007", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = false -- loaded by default? - } -end - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -include("colors.h.lua") - -local vsx, vsy = widgetHandler:GetViewSizes() - -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY -end - -local MAX_ICONS = 5 -local ICON_SIZE_X = 70 -local ICON_SIZE_Y = 70 -local CONDENSE = false -- show one icon for all builders of same type -local POSITION_X = 0.5 -- horizontal centre of screen -local POSITION_Y = 0.05 -- near bottom -local NEAR_IDLE = 0 -- this means that factories with only 8 build items left will be shown as idle -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - - -local X_MIN = 0 -local X_MAX = 0 -local Y_MIN = 0 -local Y_MAX = 0 -local drawTable = {} -local IdleList = {} -local activePress = false -local QCount = {} -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - -local function IsIdleBuilder(unitID) - local udef = Spring.GetUnitDefID(unitID) - local ud = UnitDefs[udef] - local qCount = 0 - if ud.buildSpeed > 0 then --- can build - local bQueue = Spring.GetFullBuildQueue(unitID) - if not bQueue[1] then --- has no build queue - local _, _, _, _, buildProg = Spring.GetUnitHealth(unitID) - if buildProg == 1 then --- isnt under construction - if ud.isFactory then - return true - else - local cQueue = Spring.GetCommandQueue(unitID) - if not cQueue[1] then - return true - end - end - end - elseif ud.isFactory then - for _, thing in ipairs(bQueue) do - for _, count in pairs(thing) do - qCount = qCount + count - end - end - if qCount <= NEAR_IDLE then - QCount[unitID] = qCount - return true - end - end - end - return false -end - -local function DrawBoxes(number) - gl.Color({ 0, 0, 0, 0.65 }) - X_MIN = POSITION_X*vsx-0.5*number*ICON_SIZE_X - X_MAX = POSITION_X*vsx+0.5*number*ICON_SIZE_X - Y_MIN = POSITION_Y*vsy-0.5*ICON_SIZE_Y - Y_MAX = POSITION_Y*vsy+0.5*ICON_SIZE_Y - local X1 = X_MIN - local ct = 0 - while (ct < number) do - ct = ct + 1 - local X2 = X1+ICON_SIZE_X - - gl.Shape(GL.LINE_LOOP, { - { v = { X1, Y_MIN } }, - { v = { X2, Y_MIN } }, - { v = { X2, Y_MAX } }, - { v = { X1, Y_MAX } }, - }) - X1 = X2 - - end -end--]] - -local function SetupModelDrawing() - gl.DepthTest(true) - gl.DepthMask(true) - gl.Culling(GL.FRONT) - gl.Lighting(true) - gl.Blending(false) - gl.Material({ - ambient = { 1.0, 1.0, 1.0, 1.0 }, - diffuse = { 1.0, 1.0, 1.0, 1.0 }, - emission = { 0.0, 0.0, 0.0, 1.0 }, - specular = { 0.3, 0.2, 0.2, 1.0 }, - shininess = 16.0 - }) -end - - -local function RevertModelDrawing() - gl.Blending(true) - gl.Lighting(false) - gl.Culling(false) - gl.DepthMask(false) - gl.DepthTest(false) -end - -local function CenterUnitDef(unitDefID) - local ud = UnitDefs[unitDefID] - if (not ud) then - return - end - if (not ud.dimensions) then - ud.dimensions = Spring.GetUnitDefDimensions(unitDefID) - end - if (not ud.dimensions) then - return - end - - local d = ud.dimensions - local xSize = (d.maxx - d.minx) - local ySize = (d.maxy - d.miny) - local zSize = (d.maxz - d.minz) - - local hSize -- maximum horizontal dimension - if (xSize > zSize) then hSize = xSize else hSize = zSize end - - -- aspect ratios - local mAspect = hSize / ySize - local vAspect = ICON_SIZE_X / ICON_SIZE_Y - - -- scale the unit to the box (maxspect) - local scale - if (mAspect > vAspect) then - scale = (ICON_SIZE_X / hSize) - else - scale = (ICON_SIZE_Y / ySize) - end - scale = scale * 0.8 - gl.Scale(scale, scale, scale) - - -- translate to the unit's midpoint - local xMid = 0.5 * (d.maxx + d.minx) - local yMid = 0.5 * (d.maxy + d.miny) - local zMid = 0.5 * (d.maxz + d.minz) - gl.Translate(-xMid, -yMid, -zMid) -end - - - -local function DrawUnitIcons(number) - if not drawTable then - return -1 - end - - local ct = 0 - local X1, X2 - gl.Texture(false) - SetupModelDrawing() - - gl.Scissor(true) - while (ct < number) do - ct = ct + 1 - - gl.PushMatrix() - X1 = X_MIN+(ICON_SIZE_X*(ct-1)) - X2 = X1+ICON_SIZE_X - - gl.Scissor(X1, Y_MIN, X2 - X1, Y_MAX - Y_MIN) - - gl.Translate(0.5*(X2+X1), 0.5*(Y_MAX+Y_MIN), 0) - gl.Rotate(15.0, 1, 0, 0) - - CenterUnitDef(drawTable[ct].unitDefID) - - gl.UnitShape(drawTable[ct].unitDefID, Spring.GetMyTeamID()) - - gl.Scissor(false) - gl.PopMatrix() - - if CONDENSE then - local NumberCondensed = table.getn(drawTable[ct].units) - if NumberCondensed > 1 then - gl.Text(NumberCondensed, X1, Y_MIN, 10, "o") - end - - end - - local unitID = drawTable[ct].units - if type(unitID) == 'table' then - unitID = unitID[1] - end - if QCount[unitID] then - gl.Text(QCount[unitID], X1+(0.5*ICON_SIZE_X),Y_MIN,15,"ocn") - end - - end - RevertModelDrawing() -end--]] - -local function MouseOverIcon(x, y) - if not drawTable then return -1 end - - local NumOfIcons = table.getn(drawTable) - if (x < X_MIN) then return -1 end - if (x > X_MAX) then return -1 end - if (y < Y_MIN) then return -1 end - if (y > Y_MAX) then return -1 end - - local icon = math.floor((x-X_MIN)/ICON_SIZE_X) - if (icon < 0) then - icon = 0 - end - if (icon >= NumOfIcons) then - icon = (NumOfIcons - 1) - end - return icon -end--]] - - -function DrawIconQuad(iconPos, color) - local X1 = X_MIN + (ICON_SIZE_X * iconPos) - local X2 = X1 + ICON_SIZE_X - - gl.Color(color) - gl.Blending(GL.SRC_ALPHA, GL.ONE) - gl.Shape(GL.QUADS, { - { v = { X1, Y_MIN } }, - { v = { X2, Y_MIN } }, - { v = { X2, Y_MAX } }, - { v = { X1, Y_MAX } }, - }) - - gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) -end--]] - - ------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------- -local Clicks = {} -local mouseOnUnitID = nil - - -function widget:Initialize() - local _, _, spec = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) - if spec then - -- widgetHandler:RemoveWidget() - -- return false - end - - -end - -function widget:GetConfigData(data) - return { - position_x = POSITION_X, - position_y = POSITION_Y, - max_icons = MAX_ICONS - } -end - -function widget:SetConfigData(data) - POSITION_X = data.position_x or POSITION_X - POSITION_Y = data.position_y or POSITION_Y - MAX_ICONS = data.max_icons or MAX_ICONS -end - - -function widget:Update() - IdleList = {} - QCount = {} - local myUnits = Spring.GetTeamUnitsSorted(Spring.GetMyTeamID()) - local unitCount = 0 - for unitDefID, unitTable in pairs(myUnits) do - if type(unitTable) == 'table' then - for count, unitID in pairs(unitTable) do - if count ~= 'n' and IsIdleBuilder(unitID) then - unitCount = unitCount + 1 - if IdleList[unitDefID] then - table.insert(IdleList[unitDefID], unitID) - else - IdleList[unitDefID] = {unitID} - end - end - end - else - - end - end - - if unitCount >= MAX_ICONS then - CONDENSE = true - else - CONDENSE = false - end - -end - - - -function widget:TweakMouseMove(x, y, dx, dy, button) - local right = (x + (0.5*MAX_ICONS*ICON_SIZE_X))/vsx - local left = (x - (0.5*MAX_ICONS*ICON_SIZE_X))/vsx - local top = (y + (0.5*ICON_SIZE_Y))/vsy - local bottom = (y - (0.5*ICON_SIZE_Y))/vsy - if right > 1 then - right = 1 - left = 1 - (MAX_ICONS*ICON_SIZE_X)/vsx - end - if left < 0 then - left = 0 - right = (MAX_ICONS*ICON_SIZE_X)/vsx - end - if top > 1 then - top = 1 - bottom = 1 - ICON_SIZE_Y/vsy - end - if bottom < 0 then - bottom = 0 - top = ICON_SIZE_Y/vsy - end - - POSITION_X = 0.5*(right+left) - POSITION_Y = 0.5*(top+bottom) -end - -function widget:TweakMousePress(x, y, button) - local iconNum = MouseOverIcon(x, y) - if iconNum >= 0 then return true end -end - -function widget:MouseWheel(up, value) - if not widgetHandler:InTweakMode() then return false end - - local x,y,_,_,_ = Spring.GetMouseState() - local iconNum = MouseOverIcon(x, y) - if iconNum < 0 then return false end - - if up then - MAX_ICONS = MAX_ICONS + 1 - else - MAX_ICONS = MAX_ICONS - 1 - if MAX_ICONS < 1 then MAX_ICONS = 1 end - end - return true -end - -function widget:DrawScreen() - - if widgetHandler:InTweakMode() then - DrawBoxes(MAX_ICONS) - local line1 = "Idle cons tweak mode" - local line2 = "Click and drag here to move icons around, hover over icons and move mouse wheel to change max number of icons" - gl.Text(line1, POSITION_X*vsx, POSITION_Y*vsy, 15, "c") - gl.Text(line2, POSITION_X*vsx, (POSITION_Y*vsy)-10, 10, "c") - return - end - - local noOfIcons = 0 - drawTable = {} - - for unitDefID, units in pairs(IdleList) do - if CONDENSE then - table.insert(drawTable, {unitDefID = unitDefID, units = units}) - noOfIcons = noOfIcons + 1 - else - for _, unitID in pairs(units) do - table.insert(drawTable, {unitDefID = unitDefID, units = unitID}) - end - noOfIcons = noOfIcons + table.getn(units) - end - - - end - if noOfIcons > MAX_ICONS then - noOfIcons = MAX_ICONS - elseif noOfIcons == 0 then - return - end - gl.Clear(GL.DEPTH_BUFFER_BIT) - - DrawBoxes(noOfIcons) - DrawUnitIcons(noOfIcons) - - - local x, y, lb, mb, rb = Spring.GetMouseState() - local icon = MouseOverIcon(x, y) - if (icon >= 0) then - if (lb or mb or rb) then - DrawIconQuad(icon, { 1, 0, 0, 0.333 }) - else - DrawIconQuad(icon, { 0, 0.1, 0.8, 0.433 }) - end - end - -end - ---]] - -function widget:DrawWorld() - if widgetHandler:InTweakMode() then return -1 end - - local x,y,_,_,_ = Spring.GetMouseState() - local iconNum = MouseOverIcon(x, y) - if iconNum < 0 then - mouseOnUnitID = nil - return -1 - end - - local unitID = drawTable[iconNum+1].units - local unitDefID = drawTable[iconNum+1].unitDefID - if Clicks[unitDefID] == nil then - Clicks[unitDefID] = 1 - end - if type(unitID) == 'table' then - unitID = unitID[math.fmod(Clicks[unitDefID]+1, table.getn(unitID))+1] - end - - mouseOnUnitID = unitID - -- hilight the unit we are about to click on - gl.Unit(unitID, true) -end - - -function widget:DrawInMiniMap(sx, sz) - if not mouseOnUnitID then return -1 end - - local ux, uy, uz = Spring.GetUnitPosition(mouseOnUnitID) - if (not ux or not uy or not uz) then - return - end - local xr = ux/(Game.mapX*512) - local yr = 1 - uz/(Game.mapY*512) - gl.Color(1,0,0) - gl.Rect(xr*sx, yr*sz, (xr*sx)+5, (yr*sz)+5) -end - - -function widget:MousePress(x, y, button) - local icon = MouseOverIcon(x, y) - activePress = (icon >= 0) - return activePress -end - - -function widget:MouseRelease(x, y, button) - if not activePress then return -1 end - activePress = false - - local iconNum = MouseOverIcon(x, y) - if iconNum < 0 then return -1 end - - local unitID = drawTable[iconNum+1].units - local unitDefID = drawTable[iconNum+1].unitDefID - - if type(unitID) == 'table' then - if Clicks[unitDefID] then - Clicks[unitDefID] = Clicks[unitDefID] + 1 - else - Clicks[unitDefID] = 1 - end - unitID = unitID[math.fmod(Clicks[unitDefID], table.getn(unitID))+1] - end - - local alt, ctrl, meta, shift = Spring.GetModKeyState() - - if (button == 1) then -- left mouse - Spring.SelectUnitArray({unitID}) - elseif (button == 2) then -- middle mouse - Spring.SelectUnitArray({unitID}) - Spring.SendCommands({"viewselection"}) - end - - return -1 -end - -function widget:GetTooltip(x, y) - local iconNum = MouseOverIcon(x, y) - local units = drawTable[iconNum+1].units - if type(units) == 'table' then - units = units[1] - end - local unitDefID = Spring.GetUnitDefID(units) - local ud = UnitDefs[unitDefID] - return ud.humanName .. "\nLeft mouse: select unit\nMiddle mouse: move to unit\n" -end - -function widget:IsAbove(x, y) - if MouseOverIcon(x, y) == -1 then - return false - else - return true - end -end - -function echo(msg) - if type(msg) == 'string' or type(msg) == 'number' then - Spring.SendCommands({"echo " .. msg}) - elseif type(msg) == 'table' then - Spring.SendCommands({"echo echo failed on table"}) - else - Spring.SendCommands({"echo broke :-"}) - end -end diff --git a/LuaUI/Widgets_Evo/gui_keybind_info.lua b/LuaUI/Widgets_Evo/gui_keybind_info.lua new file mode 100644 index 000000000..febf71f15 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_keybind_info.lua @@ -0,0 +1,377 @@ + +function widget:GetInfo() +return { + name = "Keybind/Mouse Info", + desc = "Provides information on the controls", + author = "Bluestone", + date = "April 2015", + license = "Mouthwash", + layer = -99990, + enabled = true, +} +end + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local bgcorner = "LuaUI/Images/bgcorner.png" + +local bgMargin = 6 + +local closeButtonSize = 30 +local screenHeight = 520-bgMargin-bgMargin +local screenWidth = 1050-bgMargin-bgMargin + +local customScale = 1 + +local spIsGUIHidden = Spring.IsGUIHidden +local showHelp = false + +local glColor = gl.Color +local glLineWidth = gl.LineWidth +local glPolygonMode = gl.PolygonMode +local glRect = gl.Rect +local glText = gl.Text +local glShape = gl.Shape + +local bgColorMultiplier = 0 + +local glCreateList = gl.CreateList +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList + +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glTranslate = gl.Translate +local glScale = gl.Scale + +local GL_FILL = GL.FILL +local GL_FRONT_AND_BACK = GL.FRONT_AND_BACK +local GL_LINE_STRIP = GL.LINE_STRIP + +local widgetScale = 1 +local vsx, vsy = Spring.GetViewGeometry() + +local vsx,vsy = Spring.GetViewGeometry() +local screenX = (vsx*0.5) - (screenWidth/2) +local screenY = (vsy*0.5) + (screenHeight/2) + +function widget:ViewResize() + vsx,vsy = Spring.GetViewGeometry() + screenX = (vsx*0.5) - (screenWidth/2) + screenY = (vsy*0.5) + (screenHeight/2) + widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + if keybinds then gl.DeleteList(keybinds) end + keybinds = gl.CreateList(DrawWindow) +end + +local myTeamID = Spring.GetMyTeamID() +local showOnceMore = false + +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.07 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) + gl.Texture(false) +end + +-- keybind info + +include("configs/EVO_HotkeyInfo.lua") +local bindColor = "\255\235\185\070" +local titleColor = "\255\254\254\254" +local descriptionColor = "\255\192\190\180" + +function DrawTextTable(t,x,y) + local j = 0 + local height = 0 + local width = 0 + font:Begin() + for _,t in pairs(t) do + if t.blankLine then + -- nothing here + elseif t.title then + -- title line + local title = t[1] or "" + local line = " " .. titleColor .. title -- a WTF whitespace is needed here, the colour doesn't show without it... + font:Print(line, x+4, y-((13)*j)+5, 14) + screenWidth = math.max(font:GetTextWidth(line)*13,screenWidth) + else + -- keybind line + local bind = string.upper(t[1]) or "" + local effect = t[2] or "" + local line = " " .. bindColor .. bind .. " " .. descriptionColor .. effect + font:Print(line, x+14, y-(13)*j, 11) + width = math.max(font:GetTextWidth(line)*11,width) + end + height = height + 13 + + j = j + 1 + end + font:End() + --screenHeight = math.max(screenHeight, height) + --screenWidth = screenWidth + width + return x,j +end + +function DrawWindow() + local vsx,vsy = Spring.GetViewGeometry() + local x = screenX --rightwards + local y = screenY --upwards + + -- background + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end + RectRound(x-bgMargin,y-screenHeight-bgMargin,x+screenWidth+bgMargin,y+bgMargin,8, 0,1,1,1) + -- content area + gl.Color(0.33,0.33,0.33,0.15) + RectRound(x,y-screenHeight,x+screenWidth,y,8) + + -- close button + local size = closeButtonSize*0.7 + local width = size*0.055 + gl.Color(1,1,1,1) + gl.PushMatrix() + gl.Translate(screenX+screenWidth-(closeButtonSize/2),screenY-(closeButtonSize/2),0) + gl.Rotate(-45,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.Rotate(90,0,0,1) + gl.Rect(-width,size/2,width,-size/2) + gl.PopMatrix() + + -- title background + local title = "Keybinds" + local titleFontSize = 18 + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end + titleRect = {x-bgMargin, y+bgMargin, x-bgMargin+(font2:GetTextWidth(title)*titleFontSize)+27, y+37} + RectRound(titleRect[1], titleRect[2], titleRect[3], titleRect[4], 8, 1,1,0,0) + -- title + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") + font2:End() + + DrawTextTable(General,x,y-24) + x = x + 350 + DrawTextTable(Units_I_II,x,y-24) + x = x + 350 + DrawTextTable(Units_III,x,y-24) + + gl.Color(1,1,1,1) + font:Begin() + font:Print("These keybinds are set by default. If you remove/replace hotkey widgets, or use your own uikeys, they might stop working!", screenX+12, y-screenHeight + 14, 12.5) + font:End() +end + + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if spIsGUIHidden() then return end + + -- draw the help + if not keybinds then + keybinds = gl.CreateList(DrawWindow) + end + + if show or showOnceMore then + glPushMatrix() + glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) + glScale(widgetScale, widgetScale, 1) + glCallList(keybinds) + glPopMatrix() + if WG['guishader'] then + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + if backgroundGuishader ~= nil then + glDeleteList(backgroundGuishader) + end + backgroundGuishader = glCreateList( function() + -- background + RectRound(rectX1, rectY2, rectX2, rectY1, 9*widgetScale, 0,1,1,1) + -- title + rectX1 = (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY1 = (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2) + rectX2 = (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY2 = (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2) + RectRound(rectX1, rectY1, rectX2, rectY2, 9*widgetScale, 1,1,0,0) + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'keybindinfo') + end + showOnceMore = false + else + if WG['guishader'] then + WG['guishader'].DeleteDlist('keybindinfo') + end + end +end + +function widget:KeyPress(key) + if key == 27 then -- ESC + show = false + end +end + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + + -- check if the mouse is in a rectangle + return x >= BLcornerX and x <= TRcornerX + and y >= BLcornerY + and y <= TRcornerY +end + +function widget:MousePress(x, y, button) + return mouseEvent(x, y, button, false) +end + +function widget:MouseRelease(x, y, button) + return mouseEvent(x, y, button, true) +end + +function mouseEvent(x, y, button, release) + if spIsGUIHidden() then return false end + + if show then + -- on window + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + + -- on close button + rectX1 = rectX2 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) + rectY2 = rectY1 - ((closeButtonSize+bgMargin+bgMargin) * widgetScale) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + if release then + showOnceMore = true -- show once more because the guishader lags behind, though this will not fully fix it + show = not show + end + return true + end + return true + elseif titleRect == nil or not IsOnRect(x, y, (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2), (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2)) then + if release then + showOnceMore = show -- show once more because the guishader lags behind, though this will not fully fix it + show = false + end + return true + end + end +end + +function widget:Initialize() + + WG['keybinds'] = {} + WG['keybinds'].toggle = function(state) + if state ~= nil then + show = state + else + show = not show + end + end + WG['keybinds'].isvisible = function() + return show + end +end + +function widget:Shutdown() + if keybinds then + glDeleteList(keybinds) + keybinds = nil + end + if WG['guishader'] then + WG['guishader'].DeleteDlist('keybindinfo') + end + gl.DeleteFont(font) + gl.DeleteFont(font2) +end diff --git a/LuaUI/Widgets_Evo/gui_lups_stats.lua b/LuaUI/Widgets_Evo/gui_lups_stats.lua index eae86f5ff..57e161709 100644 --- a/LuaUI/Widgets_Evo/gui_lups_stats.lua +++ b/LuaUI/Widgets_Evo/gui_lups_stats.lua @@ -42,7 +42,7 @@ local yposf = 0.010 local ypos = yposf * vsy + 40 local sizef = 0.015 local size = sizef * vsy -local font = "LuaUI/Fonts/FreeSansBold_14" +local font = "LuaUI/Fonts/JosefinSans-SemiBold(OTF)" local format = "orn" local fh = (font ~= nil) @@ -53,7 +53,14 @@ local fh = (font ~= nil) -- Rendering -- +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end gl.Color(color) local fxcount, fxlayers, fx = WG['Lups'].GetStats() diff --git a/LuaUI/Widgets_Evo/gui_mapinfo.lua b/LuaUI/Widgets_Evo/gui_mapinfo.lua index a0bf049e1..7c6befe7a 100644 --- a/LuaUI/Widgets_Evo/gui_mapinfo.lua +++ b/LuaUI/Widgets_Evo/gui_mapinfo.lua @@ -1,11 +1,11 @@ -local versionNumber = "0.51" +local versionNumber = "0.6" function widget:GetInfo() return { name = "Map Info", - desc = versionNumber .." Draws map-info on the bottom left of the map. Toggle height with /mapinfo_floor", + desc = versionNumber .." Draws map info on the bottom left of the map. Toggle vertical position with /mapinfo_floor", author = "Floris", - date = "20 May 2014", + date = "20 May 2015", license = "GNU GPL, v2 or later", layer = -10, enabled = true, -- loaded by default? @@ -24,13 +24,20 @@ end local scale = 1 local offset = 5 -local backgroundOpacity = 0.5 -local textOpacity = 0.85 -local fadeMultiplier = 1 -local stickToFloor = true +local stickToFloor = false local thickness = 6 local fadeStartHeight = 800 local fadeEndHeight = 4800 +local dlistAmount = 20 -- amount of dlists created, one for each opacity value + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + -------------------------------------------------------------------------------- -- speed-ups @@ -51,6 +58,8 @@ local glBeginEnd = gl.BeginEnd local glVertex = gl.Vertex local glGetTextWidth = gl.GetTextWidth local glBlending = gl.Blending +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList local glDepthTest = gl.DepthTest local glAlphaTest = gl.AlphaTest @@ -59,34 +68,56 @@ local glRotate = gl.Rotate local mapInfo = {} local mapInfoWidth = 400 -- minimum width +local mapinfoList = {} -------------------------------------------------------------------------------- -- Functions -------------------------------------------------------------------------------- -function DrawMapInfo(backgroundOpacity, opacityMultiplier) - - glDepthTest(true) - glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) - - if stickToFloor then - glTranslate(offset, offset, Game.mapSizeZ) - else - glTranslate(offset, mapInfoBoxHeight-offset, Game.mapSizeZ) +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + for opacity, list in pairs(mapinfoList) do + glDeleteList(list) + mapinfoList[opacity] = nil end - glPushMatrix() - glScale(scale,scale,scale) - if backgroundOpacity > 0 then +end + +local function createMapinfoList(opacityMultiplier) + mapinfoList[opacityMultiplier] = gl.CreateList( function() + local textOpacity = 0.85 + local textSize = 12 + local textOffsetX = 11 + local textOffsetY = 16 + local usedTextOffsetY = textOffsetY + (offset/2) + local length = math.max(mapInfoWidth, (font:GetTextWidth(Game.mapDescription)*textSize) + 45) + + glDepthTest(true) + glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + + if stickToFloor then + glTranslate(offset, offset, Game.mapSizeZ+0.01) + else + glTranslate(offset, mapInfoBoxHeight-offset, Game.mapSizeZ+0.01) + end + + glPushMatrix() + + glScale(scale,scale,scale) glRotate(90,0,-1,0) glRotate(180,1,0,0) - - local length = math.max(mapInfoWidth, (glGetTextWidth(mapInfo.mapDescription)*12) + 45) - --Spring.Echo(glGetTextWidth(mapInfo.mapDescription)) + + --Spring.Echo(font:GetTextWidth(Game.mapDescription)) local height = 90 local thickness = -(thickness*scale) glBeginEnd(GL.QUADS,function() - glColor(0.12,0.12,0.12,backgroundOpacity*opacityMultiplier*opacityMultiplier) + glColor(0.12,0.12,0.12,0.4*opacityMultiplier*opacityMultiplier) glVertex( height, 0 , 0); -- Top Right Of The Quad (Top) glVertex( 0 , 0 , 0); -- Top Left Of The Quad (Top) glVertex( 0 , 0 , length); -- Bottom Left Of The Quad (Top) @@ -113,7 +144,7 @@ function DrawMapInfo(backgroundOpacity, opacityMultiplier) glVertex( height,-thickness, 0); -- Bottom Right Of The Quad (Right) - glColor(0.05,0.05,0.05,backgroundOpacity*opacityMultiplier*opacityMultiplier) + glColor(0.05,0.05,0.05,0.4*opacityMultiplier*opacityMultiplier) glVertex( height,-thickness, length); -- Top Right Of The Quad (Bottom) glVertex( 0 ,-thickness, length); -- Top Left Of The Quad (Bottom) glVertex( 0 ,-thickness, 0); -- Bottom Left Of The Quad (Bottom) @@ -122,87 +153,84 @@ function DrawMapInfo(backgroundOpacity, opacityMultiplier) glRotate(180,1,0,0) glRotate(90,0,1,0) - end - - glRotate(90,1,0,0) - glTranslate(0,3,0) - - local textOffsetX = 11 - local textOffsetY = 16 - usedTextOffsetY = textOffsetY + (offset/2) - local text = mapInfo.mapName - - glRotate(180,1,0,0) - - -- map name - glColor(1,1,1,(textOpacity*1.12)*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,14,"n") - glColor(0,0,0,textOpacity*0.12*opacityMultiplier) - glText(text, textOffsetX+0.5,-usedTextOffsetY-0.9,14,"n") - - --map description - usedTextOffsetY = usedTextOffsetY+textOffsetY - text = mapInfo.mapDescription - glColor(1,1,1,textOpacity*0.6*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,12,"n") - - if 1 == 2 then - usedTextOffsetY = usedTextOffsetY+textOffsetY - text = "Waterdamage: "..math.floor(mapInfo.waterDamage) - glColor(1,1,1,textOpacity*0.6*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,12,"n") - glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY-1,12,"n") - textOffsetX = textOffsetX + 120 - text = "Gravity: "..math.floor(mapInfo.gravity) - glColor(1,1,1,textOpacity*0.6*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,12,"n") - glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY-1,12,"n") - textOffsetX = textOffsetX - 120 - - textOffsetX = textOffsetX + 210 - text = "Tidal: "..math.floor(mapInfo.tidal) - glColor(1,1,1,textOpacity*0.6*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,12,"n") - glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY-1,12,"n") - textOffsetX = textOffsetX - 210 - - -- game name - usedTextOffsetY = usedTextOffsetY+textOffsetY+textOffsetY+textOffsetY - text = mapInfo.gameName.." "..mapInfo.gameVersion - glColor(1,1,1,textOpacity*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY,12,"n") - glColor(0,0,0,textOpacity*0.17*opacityMultiplier) - glText(text, textOffsetX,-usedTextOffsetY-1,12,"n") - end - - glPopMatrix() - - if stickToFloor then - glTranslate(-offset, -offset, -Game.mapSizeZ) - else - glTranslate(-offset, -mapInfoBoxHeight-offset, -Game.mapSizeZ) - end - glColor(1,1,1,1) - glScale(1,1,1) - glDepthTest(false) + glRotate(90,1,0,0) + glTranslate(0,3,0) + + glRotate(180,1,0,0) + + -- map name + font:Begin() + local text = Game.mapName + font:SetTextColor(1,1,1,(textOpacity*1.12)*opacityMultiplier) + font:Print(text, textOffsetX,-usedTextOffsetY,14,"n") + font:SetTextColor(0,0,0,textOpacity*0.12*opacityMultiplier) + font:Print(text, textOffsetX+0.5,-usedTextOffsetY-0.9,14,"n") + + --map description + usedTextOffsetY = usedTextOffsetY+textOffsetY + text = Game.mapDescription + font:SetTextColor(1,1,1,textOpacity*0.6*opacityMultiplier) + font:Print(text, textOffsetX,-usedTextOffsetY,textSize,"n") + + --map size + usedTextOffsetY = usedTextOffsetY+textOffsetY + text = Game.mapDescription + font:SetTextColor(1,1,1,textOpacity*0.6*opacityMultiplier) + font:Print("Size: "..Game.mapX.. " x "..Game.mapY, textOffsetX,-usedTextOffsetY+0.8,textSize,"n") + font:End() + + --[[ + usedTextOffsetY = usedTextOffsetY+textOffsetY + text = "Waterdamage: "..math.floor(Game.waterDamage) + glColor(1,1,1,textOpacity*0.6*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY,textSize,"n") + glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY-1,textSize,"n") + + textOffsetX = textOffsetX + 120 + text = "Gravity: "..math.floor(Game.gravity) + glColor(1,1,1,textOpacity*0.6*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY,textSize,"n") + glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY-1,textSize,"n") + textOffsetX = textOffsetX - 120 + + textOffsetX = textOffsetX + 210 + text = "Tidal: "..math.floor(Game.tidal) + glColor(1,1,1,textOpacity*0.6*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY,textSize,"n") + glColor(0,0,0,textOpacity*0.6*0.17*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY-1,textSize,"n") + textOffsetX = textOffsetX - 210 + + -- game name + usedTextOffsetY = usedTextOffsetY+textOffsetY+textOffsetY+textOffsetY + text = Game.gameName.." "..Game.gameVersion + glColor(1,1,1,textOpacity*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY,textSize,"n") + glColor(0,0,0,textOpacity*0.17*opacityMultiplier) + glText(text, textOffsetX,-usedTextOffsetY-1,textSize,"n") + ]]-- + + glPopMatrix() + + if stickToFloor then + glTranslate(-offset, -offset, -Game.mapSizeZ) + else + glTranslate(-offset, -mapInfoBoxHeight-offset, -Game.mapSizeZ) + end + glColor(1,1,1,1) + glScale(1,1,1) + glDepthTest(false) + end) end + function Init() - mapInfo.mapName = Game.mapName - mapInfo.mapDescription = Game.mapDescription - mapInfo.waterDamage = Game.waterDamage - mapInfo.gravity = Game.gravity - mapInfo.tidal = Game.tidal - mapInfo.gameName = Game.gameName - mapInfo.gameVersion = Game.gameVersion - mapInfo.gameMutator = Game.gameMutator - if (glGetTextWidth(mapInfo.mapDescription) * 12) > mapInfoWidth then - --mapInfoWidth = (glGetTextWidth(mapInfo.mapDescription) * 12) + 33 + if (font:GetTextWidth(Game.mapDescription) * 12) > mapInfoWidth then + --mapInfoWidth = (font:GetTextWidth(Game.mapDescription) * 12) + 33 end if stickToFloor then mapInfoBoxHeight = 0 @@ -227,33 +255,43 @@ function widget:Initialize() Init() end -local inView = false -local camDistance = 1000 -function widget:Update() - local camX, camY, camZ = spGetCameraPosition() - local xDifference = camX - (mapInfoWidth/2)*scale - local yDifference = camY - mapInfoBoxHeight - local zDifference = camZ - Game.mapSizeZ - camDistance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) - inView = spIsAABBInView(offset, mapInfoBoxHeight, Game.mapSizeZ, mapInfoWidth*scale, mapInfoBoxHeight+(thickness*scale), Game.mapSizeZ) +function widget:Shutdown() + for opacity, list in pairs(mapinfoList) do + glDeleteList(mapinfoList[opacity]) + mapinfoList[opacity] = nil + end + gl.DeleteFont(font) +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end end function widget:DrawWorld() - if Spring.IsGUIHidden() then return end - if inView then - local opacityMultiplier = (1 - (camDistance-fadeStartHeight) / (fadeEndHeight-fadeStartHeight))*fadeMultiplier + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + + if spIsAABBInView(offset, mapInfoBoxHeight, Game.mapSizeZ, mapInfoWidth*scale, mapInfoBoxHeight+(thickness*scale), Game.mapSizeZ) then + local camX, camY, camZ = spGetCameraPosition() + local camDistance = math.diag(camX - (mapInfoWidth/2)*scale, camY - mapInfoBoxHeight, camZ - Game.mapSizeZ) + local opacityMultiplier = (1 - (camDistance-fadeStartHeight) / (fadeEndHeight-fadeStartHeight)) if opacityMultiplier > 1 then opacityMultiplier = 1 end - - if opacityMultiplier > 0.06 then - DrawMapInfo(backgroundOpacity, opacityMultiplier) + if opacityMultiplier > 0.05 then + opacityMultiplier = math.floor(opacityMultiplier * dlistAmount)/dlistAmount + + if mapinfoList[opacityMultiplier] == nil then + createMapinfoList(opacityMultiplier) + end + glCallList(mapinfoList[opacityMultiplier]) end end end - function widget:GetConfigData(data) savedTable = {} savedTable.stickToFloor = stickToFloor diff --git a/LuaUI/Widgets_Evo/gui_mapmarks_fx.lua b/LuaUI/Widgets_Evo/gui_mapmarks_fx.lua index 44295fa2c..5d1d77b45 100644 --- a/LuaUI/Widgets_Evo/gui_mapmarks_fx.lua +++ b/LuaUI/Widgets_Evo/gui_mapmarks_fx.lua @@ -15,6 +15,14 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local commands = {} local mapDrawNicknameTime = {} -- this table is used to filter out previous map drawing nicknames if user has drawn something new local mapEraseNicknameTime = {} @@ -22,12 +30,8 @@ local mapEraseNicknameTime = {} local ownPlayerID = Spring.GetMyPlayerID() -- spring vars -local spGetCameraPosition = Spring.GetCameraPosition local spGetPlayerInfo = Spring.GetPlayerInfo -local spTraceScreenRay = Spring.TraceScreenRay -local spLoadCmdColorsConfig = Spring.LoadCmdColorsConfig local spGetTeamColor = Spring.GetTeamColor -local spGetMouseState = Spring.GetMouseStates local glCreateList = gl.CreateList local glDeleteList = gl.DeleteList @@ -37,7 +41,6 @@ local glCallList = gl.CallList -------------------------------------------------------------------------------- local nicknameOpacityMultiplier = 6 -- multiplier applied to the given color opacity of the type: 'map_draw' -local showMouseclicks = true local generalSize = 28 -- overall size local generalOpacity = 0.8 -- overall opacity @@ -46,12 +49,12 @@ local generalDuration = 1.2 -- overall duration local ringStartSize = 9 local ringScale = 0.75 -local imageDir = ":n:"..LUAUI_DIRNAME.."Images/mapmarksfx/" +local imageDir = ":n:LuaUI/Images/mapmarksfx/" local types = { map_mark = { - size = 4.0, - endSize = 2.75, + size = 3.2, + endSize = 2.25, duration = 14, glowColor = {1.00 ,1.00 ,1.00 ,0.20}, ringColor = {1.00 ,1.00 ,1.00 ,0.75} @@ -94,7 +97,7 @@ local function AddEffect(cmdType, x, y, z, osClock, unitID, playerID) if not playerID then playerID = false end - local nickname,_,spec,teamID = spGetPlayerInfo(playerID) + local nickname,_,spec,teamID = spGetPlayerInfo(playerID,false) local teamcolor = {} teamcolor[1],teamcolor[2],teamcolor[3] = spGetTeamColor(teamID) @@ -121,6 +124,16 @@ end ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end function widget:Initialize() @@ -152,6 +165,7 @@ function widget:Shutdown() glDeleteList(pencilDlist) glDeleteList(eraserDlist) glDeleteList(ringDlist) + gl.DeleteFont(font) end @@ -175,7 +189,14 @@ function Round(num, idp) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorldPreUnit() + if chobbyInterface then return end if Spring.IsGUIHidden() then return end local osClock = os.clock() @@ -184,6 +205,7 @@ function widget:DrawWorldPreUnit() gl.PushMatrix() local duration, durationProcess, size, a, glowColor, ringColor, aRing, ringSize, iconSize + for cmdKey, cmdValue in pairs(commands) do duration = types[cmdValue.cmdType].duration * generalDuration @@ -253,7 +275,9 @@ function widget:DrawWorldPreUnit() gl.PushMatrix() gl.Billboard() - gl.Text(cmdValue.nickname, 0, -28, 20, "cn") + font:Begin() + font:Print(cmdValue.nickname, 0, -28, 20, "cn") + font:End() gl.PopMatrix() end end diff --git a/LuaUI/Widgets_Evo/gui_messages.lua b/LuaUI/Widgets_Evo/gui_messages.lua new file mode 100644 index 000000000..05578d3ef --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_messages.lua @@ -0,0 +1,527 @@ +function widget:GetInfo() + return { + name = "Messages", + desc = "Typewrites messages at the center-bottom of the screen (missions, tutorials)", + author = "Floris", + date = "September 2019", + license = "GNU GPL, v2 or later", + layer = 30000, + enabled = true + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Widgets can call: WG['messages'].addMessage('message text') +-- Gadgets (unsynced) can call: Script.LuaUI.GadgetAddMessage('message text') +-- plain text (without markup) via: /addmessage message text + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local vsx,vsy = Spring.GetViewGeometry() + +local posY = 0.16 + +local showTestMessages = false + +local charSize = 19.5 - (3.5 * ((vsx/vsy) - 1.78)) +local charDelay = 0.022 +local maxLines = 6 +local maxLinesScroll = 9 +local lineTTL = 14 +local fadeTime = 0.4 +local fadeDelay = 0.25 -- need to hover this long in order to fadein and respond to CTRL +local backgroundOpacity = 0.18 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 38 +local fontfileOutlineSize = 7 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local ui_scale = tonumber(Spring.GetConfigFloat("ui_scale",1) or 1) + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (((vsx+vsy) / 2000) * 0.55) * (1+(ui_scale-1)/1.5) + +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glDeleteList = gl.DeleteList +local glCreateList = gl.CreateList +local glCallList = gl.CallList +local glTranslate = gl.Translate +local glColor = gl.Color + +local messageLines = {} +local activationArea = {0,0,0,0} +local activatedHeight = 0 +local currentLine = 0 +local currentTypewriterLine = 0 +local scrolling = false +local lineMaxWidth = 0 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function lines(str) + local t = {} + local function helper(line) t[#t+1] = line return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t +end + +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl, c1,c2) + local csyMult = 1 / ((sy-py)/cs) + + if c2 then + gl.Color(c1[1],c1[2],c1[3],c1[4]) + end + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + if c2 then + gl.Color(c2[1],c2[2],c2[3],c2[4]) + end + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + -- left side + if c2 then + gl.Color(c1[1]*(1-csyMult)+(c2[1]*csyMult),c1[2]*(1-csyMult)+(c2[2]*csyMult),c1[3]*(1-csyMult)+(c2[3]*csyMult),c1[4]*(1-csyMult)+(c2[4]*csyMult)) + end + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + if c2 then + gl.Color(c2[1]*(1-csyMult)+(c1[1]*csyMult),c2[2]*(1-csyMult)+(c1[2]*csyMult),c2[3]*(1-csyMult)+(c1[3]*csyMult),c2[4]*(1-csyMult)+(c1[4]*csyMult)) + end + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + -- right side + if c2 then + gl.Color(c1[1]*(1-csyMult)+(c2[1]*csyMult),c1[2]*(1-csyMult)+(c2[2]*csyMult),c1[3]*(1-csyMult)+(c2[3]*csyMult),c1[4]*(1-csyMult)+(c2[4]*csyMult)) + end + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + if c2 then + gl.Color(c2[1]*(1-csyMult)+(c1[1]*csyMult),c2[2]*(1-csyMult)+(c1[2]*csyMult),c2[3]*(1-csyMult)+(c1[3]*csyMult),c2[4]*(1-csyMult)+(c1[4]*csyMult)) + end + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.15 -- texture offset, because else gaps could show + + -- bottom left + if c2 then + gl.Color(c1[1],c1[2],c1[3],c1[4]) + end + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then + gl.Vertex(px, py, 0) + else + gl.Vertex(px+cs, py, 0) + end + gl.Vertex(px+cs, py, 0) + if c2 then + gl.Color(c1[1]*(1-csyMult)+(c2[1]*csyMult),c1[2]*(1-csyMult)+(c2[2]*csyMult),c1[3]*(1-csyMult)+(c2[3]*csyMult),c1[4]*(1-csyMult)+(c2[4]*csyMult)) + end + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px, py+cs, 0) + -- bottom right + if c2 then + gl.Color(c1[1],c1[2],c1[3],c1[4]) + end + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then + gl.Vertex(sx, py, 0) + else + gl.Vertex(sx-cs, py, 0) + end + gl.Vertex(sx-cs, py, 0) + if c2 then + gl.Color(c1[1]*(1-csyMult)+(c2[1]*csyMult),c1[2]*(1-csyMult)+(c2[2]*csyMult),c1[3]*(1-csyMult)+(c2[3]*csyMult),c1[4]*(1-csyMult)+(c2[4]*csyMult)) + end + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx, py+cs, 0) + -- top left + if c2 then + gl.Color(c2[1],c2[2],c2[3],c2[4]) + end + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then + gl.Vertex(px, sy, 0) + else + gl.Vertex(px+cs, sy, 0) + end + gl.Vertex(px+cs, sy, 0) + if c2 then + gl.Color(c2[1]*(1-csyMult)+(c1[1]*csyMult),c2[2]*(1-csyMult)+(c1[2]*csyMult),c2[3]*(1-csyMult)+(c1[3]*csyMult),c2[4]*(1-csyMult)+(c1[4]*csyMult)) + end + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + -- top right + if c2 then + gl.Color(c2[1],c2[2],c2[3],c2[4]) + end + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then + gl.Vertex(sx, sy, 0) + else + gl.Vertex(sx-cs, sy, 0) + end + gl.Vertex(sx-cs, sy, 0) + if c2 then + gl.Color(c2[1]*(1-csyMult)+(c1[1]*csyMult),c2[2]*(1-csyMult)+(c1[2]*csyMult),c2[3]*(1-csyMult)+(c1[3]*csyMult),c2[4]*(1-csyMult)+(c1[4]*csyMult)) + end + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl, c1,c2) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(false) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl, c1,c2) +end + +function IsOnRect(x, y, leftX, bottomY,rightX,TopY) + return x >= leftX and x <= rightX and y >= bottomY and y <= TopY +end + +function widget:ViewResize() + vsx,vsy = Spring.GetViewGeometry() + lineMaxWidth = lineMaxWidth / widgetScale + widgetScale = (((vsx+vsy) / 2000) * 0.55) * (1+(ui_scale-1)/1.5) + lineMaxWidth = lineMaxWidth * widgetScale + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + + for i, _ in ipairs(messageLines) do + if messageLines[i][6] then + glDeleteList(messageLines[i][6]) + messageLines[i][6] = nil + end + end + + activationArea = { + (vsx * 0.31)-(charSize*widgetScale), (vsy * posY)+(charSize*0.15*widgetScale), + (vsx * 0.6), (vsy * (posY+0.077)) + } + lineMaxWidth = math.max(lineMaxWidth, activationArea[3] - activationArea[1]) + activatedHeight = (1+maxLinesScroll)*charSize*1.15*widgetScale +end + +function addMessage(text) + if text then + + -- determine text typing start time + local startTime = os.clock() + if messageLines[#messageLines] then + if startTime < messageLines[#messageLines][1] + messageLines[#messageLines][3]*charDelay then + startTime = messageLines[#messageLines][1] + messageLines[#messageLines][3]*charDelay + else + currentTypewriterLine = currentTypewriterLine + 1 + end + else + currentTypewriterLine = currentTypewriterLine + 1 + end + + -- convert /n into lines + local textLines = lines(text) + + -- word wrap text into lines + local wordwrappedText = {} + local wordwrappedTextCount = 0 + for i, line in ipairs(textLines) do + local words = {} + local wordsCount = 0 + local linebuffer = '' + for w in line:gmatch("%S+") do + wordsCount = wordsCount + 1 + words[wordsCount] = w + end + for wi, word in ipairs(words) do + if font:GetTextWidth(linebuffer..' '..word)*charSize*widgetScale > lineMaxWidth then + wordwrappedTextCount = wordwrappedTextCount + 1 + wordwrappedText[wordwrappedTextCount] = linebuffer + linebuffer = '' + end + if linebuffer == '' then + linebuffer = word + else + linebuffer = linebuffer..' '..word + end + end + if linebuffer ~= '' then + wordwrappedTextCount = wordwrappedTextCount + 1 + wordwrappedText[wordwrappedTextCount] = linebuffer + end + end + local messageLinesCount = #messageLines + for i, line in ipairs(wordwrappedText) do + lineMaxWidth = math.max(lineMaxWidth, font:GetTextWidth(line)*charSize*widgetScale) + messageLinesCount = messageLinesCount + 1 + messageLines[messageLinesCount] = { + startTime, + line, + string.len(line), + 0, -- num typed chars + 0, -- time passed during typing chars (used to calc 'num typed chars') + glCreateList(function() end), + 0 -- num chars the displaylist contains + } + startTime = startTime + (string.len(line)*charDelay) + end + + if currentTypewriterLine > messageLinesCount then + currentTypewriterLine = messageLinesCount + end + if not scrolling then + currentLine = currentTypewriterLine + end + end +end + +function widget:Initialize() + widget:ViewResize(vsx,vsy) + widgetHandler:RegisterGlobal('GadgetAddMessage', addMessage) + WG['messages'] = {} + WG['messages'].addMessage = function(text) + addMessage(text) + end +end + +local sec = 0 +local testmessaged = 0 +local uiSec = 0 +function widget:Update(dt) + uiSec = uiSec + dt + if uiSec > 0.5 then + uiSec = 0 + if ui_scale ~= Spring.GetConfigFloat("ui_scale",1) then + ui_scale = Spring.GetConfigFloat("ui_scale",1) + widget:ViewResize(vsx,vsy) + end + end + + local x,y,b = Spring.GetMouseState() + if WG['topbar'] and WG['topbar'].showingQuit() then + scrolling = false + elseif IsOnRect(x, y, activationArea[1], activationArea[2], activationArea[3], activationArea[4]) then + local alt, ctrl, meta, shift = Spring.GetModKeyState() + if ctrl and startFadeTime and os.clock() > startFadeTime+fadeDelay then + scrolling = true + else + --scrolling = false + end + elseif scrolling and IsOnRect(x, y, activationArea[1], activationArea[2], activationArea[1]+lineMaxWidth+(charSize*2*widgetScale), activationArea[2]+activatedHeight) then + + else + scrolling = false + currentLine = #messageLines + end + + -- delayed test msg + if showTestMessages and not dataRestored and Spring.GetGameFrame() > 30 then + sec = sec + dt + if testmessaged < 1 and sec > 3.5 then + testmessaged = 1 + addMessage("\nStandby we will keep you updated.\nGood luck!") + end + if testmessaged < 2 and sec > 12 then --and Spring.GetGameFrame() < 30*11 then + testmessaged = 2 + addMessage("\n\nEnemies have been detected in your vicinity!\nBetter expand quick.") + end + end + + if messageLines[currentTypewriterLine] ~= nil then + -- continue typewriting line + if messageLines[currentTypewriterLine][4] <= messageLines[currentTypewriterLine][3] then + messageLines[currentTypewriterLine][5] = messageLines[currentTypewriterLine][5] + dt + messageLines[currentTypewriterLine][4] = math.ceil(messageLines[currentTypewriterLine][5]/charDelay) + + -- typewrite next line when complete + if messageLines[currentTypewriterLine][4] >= messageLines[currentTypewriterLine][3] then + currentTypewriterLine = currentTypewriterLine + 1 + if currentTypewriterLine > #messageLines then + currentTypewriterLine = #messageLines + end + end + end + end +end + +function processLine(i) + if messageLines[i][6] == nil or messageLines[i][4] ~= messageLines[i][7] then + messageLines[i][7] = messageLines[i][4] + local text = string.sub(messageLines[i][2], 1, messageLines[i][4]) + glDeleteList(messageLines[i][6]) + messageLines[i][6] = glCreateList(function() + font:Begin() + lineMaxWidth = math.max(lineMaxWidth, font:GetTextWidth(text)*charSize*widgetScale) + font:Print(text, 0, 0, charSize*widgetScale, "o") + font:End() + end) + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if not messageLines[1] then return end + + local x,y,b = Spring.GetMouseState() + if IsOnRect(x, y, activationArea[1], activationArea[2], activationArea[3], activationArea[4]) or (scrolling and IsOnRect(x, y, activationArea[1], activationArea[2], activationArea[1]+lineMaxWidth+(charSize*2*widgetScale), activationArea[2]+activatedHeight)) then + hovering = true + if not startFadeTime then + startFadeTime = os.clock() + end + if scrolling then + glColor(0,0,0,backgroundOpacity) + RectRound(activationArea[1], activationArea[2], activationArea[1]+lineMaxWidth+(charSize*2*widgetScale), activationArea[2]+activatedHeight, 6.5*widgetScale) + else + local opacity = ((os.clock() - (startFadeTime+fadeDelay)) / fadeTime) * backgroundOpacity + if opacity > backgroundOpacity then + opacity = backgroundOpacity + end + glColor(0,0,0,opacity) + RectRound(activationArea[1], activationArea[2], activationArea[3], activationArea[4], 6.5*widgetScale) + end + + else + + if hovering then + local opacityPercentage = (os.clock() - (startFadeTime+fadeDelay)) / fadeTime + startFadeTime = os.clock() - math.max((1-opacityPercentage)*fadeTime, 0) + end + hovering = false + if startFadeTime then + local opacity = backgroundOpacity - (((os.clock() - startFadeTime) / fadeTime) * backgroundOpacity) + if opacity > 1 then + opacity = 1 + end + if opacity <= 0 then + startFadeTime = nil + else + glColor(0,0,0,opacity) + RectRound(activationArea[1], activationArea[2], activationArea[3], activationArea[4], 6.5*widgetScale) + end + end + scrolling = false + currentLine = #messageLines + end + + if messageLines[currentLine] then + glPushMatrix() + glTranslate((vsx * 0.31), (vsy * posY), 0) + local displayedLines = 0 + local i = currentLine + local usedMaxLines = maxLines + if scrolling then + usedMaxLines = maxLinesScroll + end + while i > 0 do + glTranslate(0, (charSize*1.15*widgetScale), 0) + if scrolling or os.clock() - messageLines[i][1] < lineTTL then + processLine(i) + glCallList(messageLines[i][6]) + end + displayedLines = displayedLines + 1 + if displayedLines >= usedMaxLines then + break + end + i = i - 1 + end + glPopMatrix() + + -- show newly written line when in scrolling mode + if scrolling and currentLine < #messageLines and os.clock() - messageLines[currentTypewriterLine][1] < lineTTL then + glPushMatrix() + glTranslate((vsx * 0.31), (vsy * (posY-0.02)), 0) + processLine(currentTypewriterLine) + glCallList(messageLines[currentTypewriterLine][6]) + glPopMatrix() + end + + end +end + +function widget:MouseWheel(up, value) + if scrolling then + if up then + currentLine = currentLine - 1 + if currentLine < maxLinesScroll then + currentLine = maxLinesScroll + end + else + currentLine = currentLine + 1 + if currentLine > #messageLines then + currentLine = #messageLines + end + end + return true + else + return false + end +end + +function widget:WorldTooltip(ttType,data1,data2,data3) + local x,y,_ = Spring.GetMouseState() + if #messageLines > 0 and IsOnRect(x, y, activationArea[1],activationArea[2],activationArea[3],activationArea[4]) then + return "Press\255\255\255\001 CTRL \255\255\255\255to activate chatlog viewing/scrolling" + end +end + +function widget:GameStart() + if showTestMessages then + addMessage("\255\230\255\200Commander,\nWe're in a peculiar situation so you have to begin on your own...\nInitiate a base and we'll redirect reinforcements right after...") + end +end + +function widget:GameOver() + --widgetHandler:RemoveWidget(self) +end + +function widget:Shutdown() + WG['messages'] = nil + gl.DeleteFont(font) + for i, _ in ipairs(messageLines) do + if messageLines[i][6] then + glDeleteList(messageLines[i][6]) + messageLines[i][6] = nil + end + end + widgetHandler:DeregisterGlobal('GadgetAddMessage') +end + +function widget:TextCommand(command) + if string.sub(command,1, 11) == "addmessage " then + addMessage(string.sub(command, 11)) + end +end + +function widget:GetConfigData(data) + for i, _ in ipairs(messageLines) do + messageLines[i][6] = nil + end + savedTable = {} + savedTable.messageLines = messageLines + return savedTable +end + +function widget:SetConfigData(data) + if Spring.GetGameFrame() > 0 and data.messageLines ~= nil then + messageLines = data.messageLines + currentLine = #messageLines + currentTypewriterLine = currentLine + dataRestored = true + end +end diff --git a/LuaUI/Widgets_Evo/gui_mouse_fx.lua b/LuaUI/Widgets_Evo/gui_mouse_fx.lua index 44c214af2..aac1be7ad 100644 --- a/LuaUI/Widgets_Evo/gui_mouse_fx.lua +++ b/LuaUI/Widgets_Evo/gui_mouse_fx.lua @@ -46,7 +46,7 @@ local generalSize = 30 -- overall size local generalOpacity = 0.8 -- overall opacity local generalDuration = 1.2 -- overall duration -local imageDir = ":n:"..LUAUI_DIRNAME.."Images/" +local imageDir = ":n:LuaUI/Images/" local types = { leftclick = { @@ -165,7 +165,16 @@ function widget:Update() end end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorldPreUnit() + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + local osClock = os.clock() local camX, camY, camZ = spGetCameraPosition() gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) diff --git a/LuaUI/Widgets_Evo/gui_musicPlayer.lua b/LuaUI/Widgets_Evo/gui_musicPlayer.lua deleted file mode 100644 index 77f530fe2..000000000 --- a/LuaUI/Widgets_Evo/gui_musicPlayer.lua +++ /dev/null @@ -1,707 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: gui_musicPlayer.lua --- brief: yay music --- author: cake --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Music Player", - desc = "Plays music and offers volume controls", - author = "Forboding Angel, Floris, Damgam", - date = "november 2016", - license = "GNU GPL, v2 or later", - layer = -4, - enabled = true -- loaded by default? - } -end - -local pauseWhenPaused = false - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- Unfucked volumes finally. Instead of setting the volume in Spring.PlaySoundStream. you need to call Spring.PlaySoundStream and then immediately call Spring.SetSoundStreamVolume --- This widget desperately needs to be reorganized - -local buttons = {} - -local previousTrack = '' -local curTrack = "no name" - -local peaceTracks = VFS.DirList('luaui/Widgets_Evo/music/peace', '*.ogg') -local warTracks = VFS.DirList('luaui/Widgets_Evo/music/war', '*.ogg') - ---We check to make sure that we can function properly without crashing due to missing music tracks -local next = next -if next(peaceTracks) == nil then - Spring.Echo("[Music Player] No Peace tracks were found (you must have at least 2)! Add some and try again!") - return false -end - -if next(warTracks) == nil then - Spring.Echo("[Music Player] No War tracks were found (you must have at least 2)! Add some and try again!") - return false -end - -local tracks = peaceTracks - -local charactersInPath = 25 - -local firstTime = false -local wasPaused = false -local firstFade = true -local gameOver = false -local playing = true - -local vsx, vsy = widgetHandler:GetViewSizes() - -local playTex = ":n:"..LUAUI_DIRNAME.."Images/music/play.png" -local pauseTex = ":n:"..LUAUI_DIRNAME.."Images/music/pause.png" -local nextTex = ":n:"..LUAUI_DIRNAME.."Images/music/next.png" -local musicTex = ":n:"..LUAUI_DIRNAME.."Images/music/music.png" -local volumeTex = ":n:"..LUAUI_DIRNAME.."Images/music/volume.png" -local buttonTex = ":n:"..LUAUI_DIRNAME.."Images/button.dds" -local buttonHighlightTex = ":n:"..LUAUI_DIRNAME.."Images/button-highlight.dds" -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" - -local widgetScale = 1 -local glText = gl.Text -local glGetTextWidth = gl.GetTextWidth -local glBlending = gl.Blending -local glScale = gl.Scale -local glRotate = gl.Rotate -local glTranslate = gl.Translate -local glPushMatrix = gl.PushMatrix -local glPopMatrix = gl.PopMatrix -local glColor = gl.Color -local glRect = gl.Rect -local glTexRect = gl.TexRect -local glTexture = gl.Texture -local glCreateList = gl.CreateList -local glDeleteList = gl.DeleteList -local glCallList = gl.CallList - -local drawlist = {} -local advplayerlistPos = {} -local widgetHeight = 23 -local top, left, bottom, right = 0,0,0,0 - -local shown = false -local mouseover = false -local volume - -local dynamicMusic = Spring.GetConfigInt("evo_dynamicmusic", 1) -local interruptMusic = Spring.GetConfigInt("evo_interruptmusic", 1) -local warMeter = 0 -local fadelvl = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 -local fadeOut = false - ---Assume that if it isn't set, dynamic music is true -if dynamicMusic == nil then - dynamicMusic = 1 -end - ---Assume that if it isn't set, interrupt music is true -if interruptMusic == nil then - interruptMusic = 1 -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - - volume = Spring.GetConfigInt("snd_volmaster", 100) - music_volume_percentage = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 - - musicInitialValue = Spring.GetConfigInt("evo_musicInitialValue", 0) - if musicInitialValue ~= 1 then - Spring.SetConfigInt("snd_volmusic", 20) - Spring.SetConfigInt("evo_musicInitialValue", 1) - end - - music_volume = Spring.GetConfigInt("snd_volmusic", 20) - - if #tracks == 0 then - Spring.Echo("[Music Player] No music was found, Shutting Down") - widgetHandler:RemoveWidget() - end - - updatePosition() - - WG['music'] = {} - WG['music'].GetPosition = function() - return {top,left,bottom,right,widgetScale} - end -end - - -local function DrawRectRound(px,py,sx,sy,cs) - gl.TexCoord(0.8,0.8) - gl.Vertex(px+cs, py, 0) - gl.Vertex(sx-cs, py, 0) - gl.Vertex(sx-cs, sy, 0) - gl.Vertex(px+cs, sy, 0) - - gl.Vertex(px, py+cs, 0) - gl.Vertex(px+cs, py+cs, 0) - gl.Vertex(px+cs, sy-cs, 0) - gl.Vertex(px, sy-cs, 0) - - gl.Vertex(sx, py+cs, 0) - gl.Vertex(sx-cs, py+cs, 0) - gl.Vertex(sx-cs, sy-cs, 0) - gl.Vertex(sx, sy-cs, 0) - - local offset = 0.05 -- texture offset, because else gaps could show - local o = offset - - -- top left - if py <= 0 or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, py+cs, 0) - -- top right - if py <= 0 or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, py+cs, 0) - -- bottom left - if sy >= vsy or px <= 0 then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(px, sy-cs, 0) - -- bottom right - if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end - gl.TexCoord(o,o) - gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) - gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) - gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) - gl.Vertex(sx, sy-cs, 0) -end - -function RectRound(px,py,sx,sy,cs) - local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) - - gl.Texture(bgcorner) - gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) - gl.Texture(false) -end - -local function createList() - - local padding = 3*widgetScale -- button background margin - local padding2 = 2.5*widgetScale -- inner icon padding - local volumeWidth = 50*widgetScale - - buttons['playpause'] = {left+padding, bottom+padding, left+(widgetHeight*widgetScale)-padding, top-padding} - - buttons['next'] = {buttons['playpause'][3]+padding, bottom+padding, buttons['playpause'][3]+((widgetHeight*widgetScale)-padding), top-padding} - - buttons['musicvolumeicon'] = {buttons['next'][3]+padding+padding, bottom+padding, buttons['next'][3]+((widgetHeight*widgetScale)), top-padding} - buttons['musicvolume'] = {buttons['musicvolumeicon'][3]+padding, bottom+padding, buttons['musicvolumeicon'][3]+padding+volumeWidth, top-padding} - buttons['musicvolume'][5] = buttons['musicvolume'][1] + (buttons['musicvolume'][3] - buttons['musicvolume'][1]) * (music_volume/100) - - buttons['volumeicon'] = {buttons['musicvolume'][3]+padding+padding+padding, bottom+padding, buttons['musicvolume'][3]+((widgetHeight*widgetScale)), top-padding} - buttons['volume'] = {buttons['volumeicon'][3]+padding, bottom+padding, buttons['volumeicon'][3]+padding+volumeWidth, top-padding} - buttons['volume'][5] = buttons['volume'][1] + (buttons['volume'][3] - buttons['volume'][1]) * (volume/100) - - local textsize = 11*widgetScale - local textYPadding = 8*widgetScale - local textXPadding = 7*widgetScale - local maxTextWidth = right-buttons['next'][3]-textXPadding-textXPadding - - if drawlist[1] ~= nil then - glDeleteList(drawlist[1]) - glDeleteList(drawlist[2]) - glDeleteList(drawlist[3]) - end - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].InsertRect(left, bottom, right, top,'music') - end - drawlist[1] = glCreateList( function() - glColor(0, 0, 0, 0.66) - RectRound(left, bottom, right, top, 5.5*widgetScale) - - local borderPadding = 2.75*widgetScale - glColor(1,1,1,0.022) - RectRound(left+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) - - end) - drawlist[2] = glCreateList( function() - - local button = 'playpause' - glColor(1,1,1,0.7) - glTexture(buttonTex) - glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) - glColor(1,1,1,0.4) - if playing then - glTexture(pauseTex) - else - glTexture(playTex) - end - glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) - - button = 'next' - glColor(1,1,1,0.7) - glTexture(buttonTex) - glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) - glColor(1,1,1,0.4) - glTexture(nextTex) - glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) - - end) - drawlist[3] = glCreateList( function() - - -- track name - glColor(0.45,0.45,0.45,1) - local trackname = string.gsub(curTrack, ".ogg", "") - local text = '' - for i=charactersInPath, #trackname do - local c = string.sub(trackname, i,i) - local width = glGetTextWidth(text..c)*textsize - if width > maxTextWidth then - break - else - text = text..c - end - end - glText('\255\135\135\135'..text, buttons['next'][3]+textXPadding, bottom+textYPadding, textsize, 'no') - - end) - drawlist[4] = glCreateList( function() - - ---glColor(0,0,0,0.5) - --RectRound(left, bottom, right, top, 5.5*widgetScale) - - local sliderWidth = 3.3*widgetScale - local sliderHeight = 3.3*widgetScale - local lineHeight = 0.8*widgetScale - local lineOutlineSize = 0.85*widgetScale - - button = 'musicvolumeicon' - local sliderY = buttons[button][2] + (buttons[button][4] - buttons[button][2])/2 - glColor(0.66,0.66,0.66,1) - glTexture(musicTex) - glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) - - button = 'musicvolume' - glColor(0,0,0,0.12) - RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) - glColor(0.45,0.45,0.45,1) - RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) - glColor(0,0,0,0.12) - RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) - glColor(0.66,0.66,0.66,1) - RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) - - - button = 'volumeicon' - glColor(0.66,0.66,0.66,1) - glTexture(volumeTex) - glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) - - button = 'volume' - glColor(0,0,0,0.12) - RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) - glColor(0.45,0.45,0.45,1) - RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) - glColor(0,0,0,0.12) - RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) - glColor(0.66,0.66,0.66,1) - RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) - - end) -end - -function getSliderValue(draggingSlider, x) - local sliderWidth = buttons[draggingSlider][3] - buttons[draggingSlider][1] - local value = (x - buttons[draggingSlider][1]) / (sliderWidth) - if value < 0 then value = 0 end - if value > 1 then value = 1 end - return value -end - -function isInBox(mx, my, box) - return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] -end - - -function widget:MouseMove(x, y) - if draggingSlider ~= nil then - if draggingSlider == 'musicvolume' then - changeMusicVolume(getSliderValue('musicvolume', x) * 100) - end - if draggingSlider == 'volume' then - changeVolume(getSliderValue('volume', x) * 100) - end - end -end - -function widget:MousePress(x, y, button) - return mouseEvent(x, y, button, false) -end - -function widget:MouseRelease(x, y, button) - return mouseEvent(x, y, button, true) -end - -function changeMusicVolume(value) - music_volume = value - Spring.SetConfigInt("snd_volmusic", music_volume) - createList() -end - -function changeVolume(value) - volume = value - Spring.SetConfigInt("snd_volmaster", volume) - createList() -end - -function mouseEvent(x, y, button, release) - if Spring.IsGUIHidden() then return false end - - if not release then - local sliderWidth = (3.3*widgetScale) -- should be same as in createlist() - local button = 'musicvolume' - if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then - draggingSlider = button - changeMusicVolume(getSliderValue(button, x) * 100) - end - button = 'volume' - if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then - draggingSlider = button - changeVolume(getSliderValue(button, x) * 100) - end - end - if release and draggingSlider ~= nil then - draggingSlider = nil - end - if button == 1 and not release and isInBox(x, y, {left, bottom, right, top}) then - if button == 1 and buttons['playpause'] ~= nil and isInBox(x, y, {buttons['playpause'][1], buttons['playpause'][2], buttons['playpause'][3], buttons['playpause'][4]}) then - playing = not playing - Spring.PauseSoundStream() - createList() - return true - end - if button == 1 and buttons['next'] ~= nil and isInBox(x, y, {buttons['next'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then - if fadeIn ~= true and fadeOut ~= true then - if Spring.GetGameFrame() >= 1 then - fadeOut = true - fadelvl = music_volume_percentage - --PlayNewTrack() - end - end - if Spring.GetGameFrame() == 0 then - PlayNewTrack() - end - return true - end - return true - end - -end -function widget:IsAbove(mx, my) - if isInBox(mx, my, {left, bottom, right, top}) then - local curVolume = Spring.GetConfigInt("snd_volmaster", 100) - if volume ~= curVolume then - volume = curVolume - createList() - end - mouseover = true - end - return mouseover -end - -function widget:GetTooltip(mx, my) - if widget:IsAbove(mx,my) then - return string.format("Music info and controls") - end -end - -function widget:Shutdown() - Spring.StopSoundStream() - - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('music') - end - - for i=1,#drawlist do - glDeleteList(drawlist[i]) - end - WG['music'] = nil -end - -function widget:UnitDamaged(_, _, _, damage) - warMeter = warMeter + damage -end - -function widget:GameFrame(n) - if n%30 == 4 then - --This is a little messy, but we need to be able to update these values on the fly so I see no better way - music_volume_percentage = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 - - dynamicMusic = Spring.GetConfigInt("evo_dynamicmusic", 1) - interruptMusic = Spring.GetConfigInt("evo_interruptmusic", 1) - - --Assume that if it isn't set, dynamic music is true - if dynamicMusic == nil then - dynamicMusic = 1 - end - - --Assume that if it isn't set, interrupt music is true - if interruptMusic == nil then - interruptMusic = 1 - end - end - if n%5 == 4 then - if dynamicMusic == 1 then - --Spring.Echo("[Music Player] Unit Death Count is currently: ".. warMeter) - if warMeter <= 1 then - warMeter = 0 - elseif warMeter >= 3000 then - warMeter = warMeter - 500 - elseif warMeter >= 1000 then - warMeter = warMeter - 100 - elseif warMeter >= 0 then - warMeter = warMeter - 3 - end - if interruptMusic == 1 then - if tracks == peaceTracks and warMeter >= 200 and fadeIn == false and fadeOut == false then - fadeOut = true - elseif tracks == warTracks and warMeter <= 0 and fadeIn == false and fadeOut == false then - fadeOut = true - end - end - end - - --80's fadeout when a track is almost finished - local playedTime, totalTime = Spring.GetSoundStreamTime() - playedTime = math.floor(playedTime) - totalTime = math.floor(totalTime) - - if totalTime ~= nil then - --Spring.Echo("Total time is :" .. totalTime) - if playedTime > totalTime - music_volume * 0.05 then - --Spring.Echo("Fading out now!") - if Spring.GetGameFrame() >= 1 then - fadeOut = true - end - if Spring.GetGameFrame() == 0 then - PlayNewTrack() - end - end - end - - --This has become the preferred handler of playing new tracks instead of calling the PlayNewTrack() function, set fadeOut = true - if fadeOut == true and fadelvl >= 0.01 then - fadelvl = fadelvl - 0.05 - --Spring.Echo(fadelvl) - Spring.SetSoundStreamVolume(fadelvl) - else - fadeOut = false - end - if fadeOut == false and fadelvl <= 0.005 then - fadelvl = music_volume_percentage * 0.01 - PlayNewTrack() - --Spring.Echo("Playing a new song now") - end - - if fadeIn == true and fadelvl <= music_volume_percentage then - fadelvl = fadelvl + 0.05 - --Spring.Echo(fadelvl) - Spring.SetSoundStreamVolume(fadelvl) - else - fadeIn = false - end - end -end - -function PlayNewTrack() - Spring.StopSoundStream() - if Spring.GetGameFrame() >= 1 then - fadelvl = 0 - fadeIn = true - end - --Spring.Echo(dynamicMusic) - - if dynamicMusic == 0 then - --Spring.Echo("Choosing a random track") - r = math.random(0,1) - if r == 0 then - tracks = peaceTracks - else - tracks = warTracks - end - end - - if dynamicMusic == 1 then - --Spring.Echo("Unit Death Count is (Gameframe): " .. warMeter) - if warMeter <= 3 then - tracks = peaceTracks - --Spring.Echo("Current tracklist is : Peace Tracks") - else - tracks = warTracks - --Spring.Echo("Current tracklist is : War Tracks") - end - end - local newTrack = previousTrack - repeat - newTrack = tracks[math.random(1, #tracks)] - until newTrack ~= previousTrack - firstFade = false - previousTrack = newTrack - curTrack = newTrack - local musicVolScaled = music_volume * 0.01 - Spring.PlaySoundStream(newTrack) - Spring.SetSoundStreamVolume(musicVolScaled or 0.33) - if playing == false then - Spring.PauseSoundStream() - end - createList() -end - -function widget:Update(dt) - if gameOver then - return - end - - if (not firstTime) then - if Spring.GetGameFrame() >= 1 then - fadelvl = 0 - fadeOut = true - end - if Spring.GetGameFrame() == 0 then - PlayNewTrack() - end - firstTime = true -- pop this cherry - end - - local playedTime, totalTime = Spring.GetSoundStreamTime() - playedTime = math.floor(playedTime) - totalTime = math.floor(totalTime) - - if playedTime >= totalTime then -- both zero means track stopped in 8 - if Spring.GetGameFrame() >= 1 then - fadelvl = 0 - fadeOut = true - end - if Spring.GetGameFrame() == 0 then - PlayNewTrack() - end - end - - if (pauseWhenPaused and Spring.GetGameSeconds()>=0) then - local _, _, paused = Spring.GetGameSpeed() - if (paused ~= wasPaused) then - Spring.PauseSoundStream() - wasPaused = paused - end - end -end - -function updatePosition(force) - if (WG['advplayerlist_api'] ~= nil) then - local prevPos = advplayerlistPos - advplayerlistPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} - - left = advplayerlistPos[2] - bottom = advplayerlistPos[1] - right = advplayerlistPos[4] - top = advplayerlistPos[1]+(widgetHeight*advplayerlistPos[5]) - widgetScale = advplayerlistPos[5] - - if (prevPos[1] == nil or prevPos[1] ~= advplayerlistPos[1] or prevPos[2] ~= advplayerlistPos[2] or prevPos[5] ~= advplayerlistPos[5]) or force then - createList() - end - end -end - -function widget:ViewResize(newX,newY) - vsx, vsy = newX, newY -end - -function widget:DrawScreen() - updatePosition() - if drawlist[1] ~= nil then - glPushMatrix() - glCallList(drawlist[1]) - glCallList(drawlist[2]) - local mx, my, mlb = Spring.GetMouseState() - if not mouseover and not draggingSlider or isInBox(mx, my, {buttons['playpause'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then - glCallList(drawlist[3]) - else - glCallList(drawlist[4]) - end - if mouseover then - local color = {1,1,1,0.25} - local colorHighlight = {1,1,1,0.33} - local button = 'playpause' - if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then - if mlb then - glColor(colorHighlight) - else - glColor(color) - end - glTexture(buttonHighlightTex) - glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) - end - button = 'next' - if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then - if mlb then - glColor(colorHighlight) - else - glColor(color) - end - glTexture(buttonHighlightTex) - glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) - end - end - glPopMatrix() - mouseover = false - end -end - -function widget:GetConfigData(data) - --local playedTime, totalTime = Spring.GetSoundStreamTime() - local savedTable = {} - --savedTable.curTrack = curTrack - --savedTable.playedTime = playedTime - savedTable.playing = playing - return savedTable -end - --- would be great if there is be a way to continue track where we left off after a /luaui reload -function widget:SetConfigData(data) - if data.playing ~= nil then - playing = data.playing - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_musicPlayer_Dynamic_Advanced.lua b/LuaUI/Widgets_Evo/gui_musicPlayer_Dynamic_Advanced.lua new file mode 100644 index 000000000..40dbaf92f --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_musicPlayer_Dynamic_Advanced.lua @@ -0,0 +1,851 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_musicPlayer.lua +-- brief: yay music +-- author: cake +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +math.randomseed( os.time() - os.clock() * 1000 ) +math.random() math.random() math.random() + +function widget:GetInfo() + return { + name = "Music Player - Dynamic Advanced", + desc = "Plays music and offers volume controls with dynamic swells and fades based upon what is happening in the game.", + author = "Forboding Angel, Floris, Damgam", + date = "november 2016", + license = "GNU GPL, v2 or later", + layer = -4, + enabled = true -- loaded by default? + } +end + +local pauseWhenPaused = false + + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 36 +local fontfileOutlineSize = 8.5 +local fontfileOutlineStrength = 1.33 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) + +local guishaderEnabled = (WG['guishader']) + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Unfucked volumes finally. Instead of setting the volume in Spring.PlaySoundStream. you need to call Spring.PlaySoundStream and then immediately call Spring.SetSoundStreamVolume +-- This widget desperately needs to be reorganized + +local buttons = {} + +local previousTrack = '' +local curTrack = "no name" + +local peaceTracks = VFS.DirList('luaui/Widgets_Evo/Music/peace', '*.ogg') +local warTracks = VFS.DirList('luaui/Widgets_Evo/Music/war', '*.ogg') +local warCutTracks = VFS.DirList('luaui/Widgets_Evo/Music/warcut', '*.ogg') +local silenceTracks = VFS.DirList('luaui/Widgets_Evo/Music/silence', '*.ogg') +local loadingTracks = VFS.DirList('luaui/Widgets_Evo/Music/loading', '*.ogg') + + +--We check to make sure that we can function properly without crashing due to missing music tracks +local next = next +if next(peaceTracks) == nil then + Spring.Echo("[Music Player] No Peace tracks were found (you must have at least 2)! Add some and try again!") + return false +end + +if next(warTracks) == nil then + Spring.Echo("[Music Player] No War tracks were found (you must have at least 2)! Add some and try again!") + return false +end + +if next(warCutTracks) == nil then + warCutTracks = warTracks +end + +--local tracks = peaceTracks +local tracks = loadingTracks + +local firstTime = false +local wasPaused = false +local firstFade = true +local gameOver = false +local playing = true + +local playedTime, totalTime = Spring.GetSoundStreamTime() +local playTex = ":n:"..LUAUI_DIRNAME.."Images/music/play.png" +local pauseTex = ":n:"..LUAUI_DIRNAME.."Images/music/pause.png" +local nextTex = ":n:"..LUAUI_DIRNAME.."Images/music/next.png" +local musicTex = ":n:"..LUAUI_DIRNAME.."Images/music/music.png" +local volumeTex = ":n:"..LUAUI_DIRNAME.."Images/music/volume.png" +local buttonTex = ":n:"..LUAUI_DIRNAME.."Images/button.dds" +local buttonHighlightTex = ":n:"..LUAUI_DIRNAME.."Images/button-highlight.dds" +local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" + +local widgetScale = 1 +local glBlending = gl.Blending +local glScale = gl.Scale +local glRotate = gl.Rotate +local glTranslate = gl.Translate +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glColor = gl.Color +local glRect = gl.Rect +local glTexRect = gl.TexRect +local glTexture = gl.Texture +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +local drawlist = {} +local advplayerlistPos = {} +local widgetHeight = 23 +local top, left, bottom, right = 0,0,0,0 +local borderPadding = 5 + +local shown = false +local mouseover = false +local volume + +local warMeter = 0 +local buildMeter = false +local buildTimer = 0 +local fadelvl = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 or 0.2 +local fadeOut = false +local fadeIn = false +local endFade = false +local maxWarMeter = 1500 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + + MyTeamID = Spring.GetMyTeamID() + + volume = Spring.GetConfigInt("snd_volmaster", 100) + music_volume_set = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 + music_volume_target = music_volume_set + + musicInitialValue = Spring.GetConfigInt("evo_musicInitialValue", 0) + if musicInitialValue ~= 1 then + Spring.SetConfigInt("snd_volmusic", 20) + Spring.SetConfigInt("evo_musicInitialValue", 1) + end + + music_volume = Spring.GetConfigInt("snd_volmusic", 20) + + if #tracks == 0 then + Spring.Echo("[Music Player] No music was found, Shutting Down") + widgetHandler:RemoveWidget() + end + + updatePosition() + + WG['music'] = {} + WG['music'].GetPosition = function() + return {top,left,bottom,right,widgetScale} + end +end + + +local function DrawRectRound(px,py,sx,sy,cs) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, py+cs, 0) + -- top right + if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +local function createList() + + local padding = 3*widgetScale -- button background margin + local padding2 = 2.5*widgetScale -- inner icon padding + local volumeWidth = 50*widgetScale + + buttons['playpause'] = {left+padding, bottom+padding, left+(widgetHeight*widgetScale)-padding, top-padding} + + buttons['next'] = {buttons['playpause'][3]+padding, bottom+padding, buttons['playpause'][3]+((widgetHeight*widgetScale)-padding), top-padding} + + buttons['musicvolumeicon'] = {buttons['next'][3]+padding+padding, bottom+padding, buttons['next'][3]+((widgetHeight*widgetScale)), top-padding} + buttons['musicvolume'] = {buttons['musicvolumeicon'][3]+padding, bottom+padding, buttons['musicvolumeicon'][3]+padding+volumeWidth, top-padding} + buttons['musicvolume'][5] = buttons['musicvolume'][1] + (buttons['musicvolume'][3] - buttons['musicvolume'][1]) * (music_volume/100) + + buttons['volumeicon'] = {buttons['musicvolume'][3]+padding+padding+padding, bottom+padding, buttons['musicvolume'][3]+((widgetHeight*widgetScale)), top-padding} + buttons['volume'] = {buttons['volumeicon'][3]+padding, bottom+padding, buttons['volumeicon'][3]+padding+volumeWidth, top-padding} + buttons['volume'][5] = buttons['volume'][1] + (buttons['volume'][3] - buttons['volume'][1]) * (volume/100) + + local textsize = 11*widgetScale + local textYPadding = 8*widgetScale + local textXPadding = 7*widgetScale + local maxTextWidth = right-buttons['next'][3]-textXPadding-textXPadding + + if drawlist[1] ~= nil then + glDeleteList(drawlist[1]) + glDeleteList(drawlist[2]) + glDeleteList(drawlist[3]) + end + if (WG['guishader'] ~= nil) then + WG['guishader'].InsertRect(left, bottom, right, top,'music') + end + drawlist[1] = glCreateList( function() + glColor(0, 0, 0, ui_opacity) + RectRound(left, bottom, right, top, 5.5*widgetScale) + + borderPadding = 3*widgetScale + borderPaddingRight = borderPadding + if right >= vsx-0.2 then + borderPaddingRight = 0 + end + borderPaddingLeft = borderPadding + if left <= 0.2 then + borderPaddingLeft = 0 + end + glColor(1,1,1,ui_opacity*0.055) + RectRound(left+borderPaddingLeft, bottom+borderPadding, right-borderPaddingRight, top-borderPadding, borderPadding*1.66) + end) + drawlist[2] = glCreateList( function() + + local button = 'playpause' + glColor(1,1,1,0.7) + glTexture(buttonTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + glColor(1,1,1,0.4) + if playing then + glTexture(pauseTex) + else + glTexture(playTex) + end + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'next' + glColor(1,1,1,0.7) + glTexture(buttonTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + glColor(1,1,1,0.4) + glTexture(nextTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + end) + drawlist[3] = glCreateList( function() + + -- track name + glColor(0.45,0.45,0.45,1) + + local trackname = string.gsub(curTrack, ".ogg", "") + local text = '' + --local charactersToCut = GetPathLenght() + charactersInPath = 23 + if tracks and tracks == peaceTracks then + charactersInPath = charactersInPath + 8 + elseif tracks and tracks == warTracks then + charactersInPath = charactersInPath + 6 + elseif tracks and tracks == warCutTracks then + charactersInPath = charactersInPath + 9 + elseif tracks and tracks == silenceTracks then + charactersInPath = 999 + elseif tracks and tracks == loadingTracks then + charactersInPath = charactersInPath + 10 + end + for i=charactersInPath, #trackname do + local c = string.sub(trackname, i,i) + local width = font:GetTextWidth(text..c)*textsize + if width > maxTextWidth then + break + else + text = text..c + end + end + font:Begin() + font:Print('\255\255\255\135'..text, buttons['next'][3]+textXPadding, bottom+textYPadding, textsize, 'no') + font:End() + + end) + drawlist[4] = glCreateList( function() + + ---glColor(0,0,0,0.5) + --RectRound(left, bottom, right, top, 5.5*widgetScale) + + local sliderWidth = 3.3*widgetScale + local sliderHeight = 3.3*widgetScale + local lineHeight = 0.8*widgetScale + local lineOutlineSize = 0.85*widgetScale + + button = 'musicvolumeicon' + local sliderY = buttons[button][2] + (buttons[button][4] - buttons[button][2])/2 + glColor(0.66,0.66,0.66,1) + glTexture(musicTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'musicvolume' + glColor(0,0,0,0.12) + RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) + glColor(0.45,0.45,0.45,1) + RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) + glColor(0,0,0,0.12) + RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) + glColor(0.66,0.66,0.66,1) + RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) + + + button = 'volumeicon' + glColor(0.66,0.66,0.66,1) + glTexture(volumeTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'volume' + glColor(0,0,0,0.12) + RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) + glColor(0.45,0.45,0.45,1) + RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) + glColor(0,0,0,0.12) + RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) + glColor(0.66,0.66,0.66,1) + RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) + + end) +end + +function getSliderValue(draggingSlider, x) + local sliderWidth = buttons[draggingSlider][3] - buttons[draggingSlider][1] + local value = (x - buttons[draggingSlider][1]) / (sliderWidth) + if value < 0 then value = 0 end + if value > 1 then value = 1 end + return value +end + +function isInBox(mx, my, box) + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] +end + + +function widget:MouseMove(x, y) + if draggingSlider ~= nil then + if draggingSlider == 'musicvolume' then + changeMusicVolume(getSliderValue('musicvolume', x) * 100) + fadelvl = getSliderValue('musicvolume', x) + --Spring.Echo("Music volume set to: " .. (getSliderValue('musicvolume', x) * 100)) + end + if draggingSlider == 'volume' then + changeVolume(getSliderValue('volume', x) * 100) + --Spring.Echo("Global volume set to: " .. changeVolume(getSliderValue('volume', x) * 100)) + end + end +end + +function widget:MousePress(x, y, button) + return mouseEvent(x, y, button, false) +end + +function widget:MouseRelease(x, y, button) + return mouseEvent(x, y, button, true) +end + +function changeMusicVolume(value) + music_volume = value + Spring.SetConfigInt("snd_volmusic", music_volume) + createList() +end + +function changeVolume(value) + volume = value + Spring.SetConfigInt("snd_volmaster", volume) + createList() +end + +function mouseEvent(x, y, button, release) + if Spring.IsGUIHidden() then return false end + + if not release then + local sliderWidth = (3.3*widgetScale) -- should be same as in createlist() + local button = 'musicvolume' + if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then + draggingSlider = button + changeMusicVolume(getSliderValue(button, x) * 100) + end + button = 'volume' + if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then + draggingSlider = button + changeVolume(getSliderValue(button, x) * 100) + end + end + if release and draggingSlider ~= nil then + draggingSlider = nil + end + if button == 1 and not release and isInBox(x, y, {left, bottom, right, top}) then + if button == 1 and buttons['playpause'] ~= nil and isInBox(x, y, {buttons['playpause'][1], buttons['playpause'][2], buttons['playpause'][3], buttons['playpause'][4]}) then + playing = not playing + Spring.PauseSoundStream() + createList() + return true + end + if button == 1 and buttons['next'] ~= nil and isInBox(x, y, {buttons['next'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then + fadeIn = false + fadeOut = false + PlayNewTrack() + return true + end + return true + end + +end + +function widget:IsAbove(mx, my) + if isInBox(mx, my, {left, bottom, right, top}) then + local curVolume = Spring.GetConfigInt("snd_volmaster", 100) + if volume ~= curVolume then + volume = curVolume + createList() + end + mouseover = true + end + return mouseover +end + +function widget:GetTooltip(mx, my) + if widget:IsAbove(mx,my) then + return string.format("Music info and controls") + end +end + +function widget:Shutdown() + Spring.StopSoundStream() + + if (WG['guishader'] ~= nil) then + WG['guishader'].RemoveRect('music') + end + + for i=1,#drawlist do + glDeleteList(drawlist[i]) + end + WG['music'] = nil + gl.DeleteFont(font) +end + +function widget:UnitDamaged() + warMeter = maxWarMeter + if warMeter > maxWarMeter then + warMeter = maxWarMeter + end +end + + +function widget:GameFrame(n) + --Spring.Echo([[Warmeter: ]] ..warMeter) + --This is a little messy, but we need to be able to update these values on the fly so I see no better way + if n%120 == 0 and tracks ~= loadingTracks then + music_volume_set = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 + music_volume_target = music_volume_set + end + if music_volume_set > 0.02 then + + prevfadelvl = fadelvl + --VolumeTargets + if tracks == warTracks or tracks == warCutTracks then + local playedTime, totalTime = Spring.GetSoundStreamTime() + if fadelvl and fadelvl < music_volume_set*0.4 and playedTime > 10 then + music_volume_target = 0 + elseif warMeter > 0 then + music_volume_target = music_volume_set + else + music_volume_target = 0 + end + elseif tracks == peaceTracks then + if warMeter > 0 or buildTimer <= 0 then + music_volume_target = 0 + else + music_volume_target = music_volume_set + end + elseif gameOver then + music_volume_target = music_volume_set + elseif tracks == loadingTracks then + music_volume_target = 0 + end + + --BuildMeter + local mc, ms, mp, mi, me = Spring.GetTeamResources(MyTeamID, "metal") + + if me and me > 1 then + buildMeter = true + else + buildMeter = false + end + + if buildMeter == false then + if buildTimer > 0 then + buildTimer = buildTimer - 1 + end + elseif buildMeter == true then + buildTimer = 450 + end + --Spring.Echo("BuildMeter: " .. buildMeter) + + --WarMeter + if warMeter <= 0 then + warMeter = 0 + elseif warMeter >= 0 then + warMeter = warMeter - 1 + end + + --80's fadeout when a track is almost finished + local playedTime, totalTime = Spring.GetSoundStreamTime() + playedTime = math.floor(playedTime) + totalTime = math.floor(totalTime) + + if totalTime ~= nil then + --Spring.Echo("Total time is :" .. playedTime .."/".. totalTime) + if playedTime >= totalTime - 2 then + --Spring.Echo("Fading out now!") + if Spring.GetGameFrame() >= 1 then + endFade = true + + end + if Spring.GetGameFrame() == 0 then + PlayNewTrack() + end + end + end + + --This has become the preferred handler of playing new tracks instead of calling the PlayNewTrack() function, set fadeOut = true + + --endfade + if endFade == true then + warMeter = 0 + fadelvl = fadelvl - 0.01 + Spring.SetSoundStreamVolume(fadelvl) + end + + --volumecontrol + if endFade == false then + if fadelvl < 0 then + fadelvl = 0 + end + if fadelvl < music_volume_target then + if tracks == peaceTracks then + fadelvl = fadelvl + 0.001 + elseif playedTime < 5 then + fadelvl = fadelvl + 0.03 + else + fadelvl = fadelvl + 0.003 + end + Spring.SetSoundStreamVolume(fadelvl) + end + if fadelvl > music_volume_target then + if tracks == peaceTracks and warMeter > 0 then + fadelvl = fadelvl - 0.01 + else + fadelvl = fadelvl - 0.001 + end + Spring.SetSoundStreamVolume(fadelvl) + end + end + + --playnewtrack + if fadelvl <= 0 then + PlayNewTrack() + end + + if tracks == silenceTracks then + if warMeter > 0 or buildTimer > 0 then + PlayNewTrack() + end + end + + if gameOver and tracks ~= loadingTracks then + PlayNewTrack() + end + end +end + +function PlayNewTrack() + local oldPlayedTime, oldTotalTime = Spring.GetSoundStreamTime() + Spring.StopSoundStream() + endFade = false + fadelvl = 0.02 + if warMeter < 100 then + warMeter = 0 + else + warMeter = 200 + end + + --Spring.Echo("Unit Death Count is (Gameframe): " .. warMeter) + if gameOver then + tracks = loadingTracks + fadelvl = music_volume_set + warMeter = 0 + buildTimer = 450 + elseif Spring.GetGameFrame() == 0 then + tracks = peaceTracks + fadelvl = music_volume_set + elseif warMeter <= 0 then + if buildTimer > 10 then + tracks = peaceTracks + --Spring.Echo("Current tracklist is : Peace Tracks") + else + tracks = silenceTracks + --Spring.Echo("Current tracklist is : Silence Tracks") + end + else + if tracks == peaceTracks or tracks == silenceTracks then + local r = math.random(0,4) + if r ~= 0 and oldPlayedTime > 10 then + tracks = warCutTracks + --Spring.Echo("Current tracklist is : WarCut Tracks") + else + tracks = warTracks + --Spring.Echo("Current tracklist is : War Tracks") + end + + else + tracks = warTracks + --Spring.Echo("Current tracklist is : War Tracks") + end + end + local newTrack = previousTrack + repeat + newTrack = tracks[math.random(1, #tracks)] + until newTrack ~= previousTrack + firstFade = false + previousTrack = newTrack + curTrack = newTrack + Spring.PlaySoundStream(newTrack) + Spring.SetSoundStreamVolume(fadelvl or 0.5) + if playing == false then + Spring.PauseSoundStream() + end + createList() +end + +local uiOpacitySec = 0 +function widget:Update(dt) + if gameOver then + return + end + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) or guishaderEnabled ~= (WG['guishader']) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + guishaderEnabled = (WG['guishader']) + createList() + end + end + local playedTime, totalTime = Spring.GetSoundStreamTime() + playedTime = math.floor(playedTime) + totalTime = math.floor(totalTime) + if music_volume_set > 0.02 then + if (not firstTime) then + if Spring.GetGameFrame() >= 1 then + fadelvl = 0.02 + end + --if Spring.GetGameFrame() == 0 then + --PlayNewTrack() + --end + firstTime = true -- pop this cherry + end + + if playedTime >= totalTime then -- both zero means track stopped in 8 + if Spring.GetGameFrame() >= 1 then + fadelvl = 0 + end + if Spring.GetGameFrame() == 0 then + PlayNewTrack() + end + if gameOver then + PlayNewTrack() + end + end + + if (pauseWhenPaused and Spring.GetGameSeconds()>=0) then + local _, _, paused = Spring.GetGameSpeed() + if (paused ~= wasPaused) then + Spring.PauseSoundStream() + wasPaused = paused + end + end + elseif playedTime > 0 and totalTime > 0 then + Spring.StopSoundStream() + end +end + +function updatePosition(force) + if (WG['advplayerlist_api'] ~= nil) then + local prevPos = advplayerlistPos + advplayerlistPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + + left = advplayerlistPos[2] + bottom = advplayerlistPos[1] + right = advplayerlistPos[4] + top = advplayerlistPos[1]+(widgetHeight*advplayerlistPos[5]) + widgetScale = advplayerlistPos[5] + + if (prevPos[1] == nil or prevPos[1] ~= advplayerlistPos[1] or prevPos[2] ~= advplayerlistPos[2] or prevPos[5] ~= advplayerlistPos[5]) or force then + createList() + end + end +end + +function widget:ViewResize(newX,newY) + vsx, vsy = newX, newY + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + updatePosition() + if drawlist[1] ~= nil then + glPushMatrix() + glCallList(drawlist[1]) + glCallList(drawlist[2]) + local mx, my, mlb = Spring.GetMouseState() + if not mouseover and not draggingSlider or isInBox(mx, my, {buttons['playpause'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then + glCallList(drawlist[3]) + else + glCallList(drawlist[4]) + end + if mouseover then + + -- display play progress + local progressPx = ((right-left)*(playedTime/totalTime)) + if progressPx > 1 then + if progressPx < borderPadding*5 then + progressPx = borderPadding*5 + end + glColor(1,1,1,ui_opacity*0.09) + RectRound(left+borderPaddingLeft, bottom+borderPadding, left-borderPaddingRight+progressPx , top-borderPadding, borderPadding*1.66) + end + + local color = {1,1,1,0.25} + local colorHighlight = {1,1,1,0.33} + local button = 'playpause' + if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then + if mlb then + glColor(colorHighlight) + else + glColor(color) + end + glTexture(buttonHighlightTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + end + button = 'next' + if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then + if mlb then + glColor(colorHighlight) + else + glColor(color) + end + glTexture(buttonHighlightTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + end + end + glPopMatrix() + mouseover = false + end +end + +function widget:GetConfigData(data) + --local playedTime, totalTime = Spring.GetSoundStreamTime() + local savedTable = {} + --savedTable.curTrack = curTrack + --savedTable.playedTime = playedTime + savedTable.playing = playing + return savedTable +end + +-- would be great if there is be a way to continue track where we left off after a /luaui reload +function widget:SetConfigData(data) + if data.playing ~= nil then + playing = data.playing + end +end + +function widget.GameOver() + gameOver = true +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_musicPlayer_Traditional.lua b/LuaUI/Widgets_Evo/gui_musicPlayer_Traditional.lua new file mode 100644 index 000000000..a779c4782 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_musicPlayer_Traditional.lua @@ -0,0 +1,687 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_musicPlayer_traditional.lua +-- brief: yay music +-- author: cake +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Music Player (Traditional)", + desc = "Plays music and offers volume controls", + author = "Forboding Angel, Floris, Damgam", + date = "november 2016", + license = "GNU GPL, v2 or later", + layer = -4, + enabled = false -- loaded by default? + } +end + +local pauseWhenPaused = false + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Unfucked volumes finally. Instead of setting the volume in Spring.PlaySoundStream. you need to call Spring.PlaySoundStream and then immediately call Spring.SetSoundStreamVolume +-- This widget desperately needs to be reorganized + +local buttons = {} + +local previousTrack = '' +local curTrack = "no name" + +local peaceTracks = VFS.DirList('luaui/Widgets_Evo/music/peace', '*.ogg') +local warTracks = VFS.DirList('luaui/Widgets_Evo/music/war', '*.ogg') + +--We check to make sure that we can function properly without crashing due to missing music tracks +local next = next +if next(peaceTracks) == nil then + Spring.Echo("[Music Player] No Peace tracks were found (you must have at least 2)! Add some and try again!") + return false +end + +if next(warTracks) == nil then + Spring.Echo("[Music Player] No War tracks were found (you must have at least 2)! Add some and try again!") + return false +end + +local tracks = peaceTracks + +local charactersInPath = 24 + +local firstTime = false +local wasPaused = false +local firstFade = true +local gameOver = false +local playing = true + +local vsx, vsy = widgetHandler:GetViewSizes() + +local playTex = ":n:"..LUAUI_DIRNAME.."Images/music/play.png" +local pauseTex = ":n:"..LUAUI_DIRNAME.."Images/music/pause.png" +local nextTex = ":n:"..LUAUI_DIRNAME.."Images/music/next.png" +local musicTex = ":n:"..LUAUI_DIRNAME.."Images/music/music.png" +local volumeTex = ":n:"..LUAUI_DIRNAME.."Images/music/volume.png" +local buttonTex = ":n:"..LUAUI_DIRNAME.."Images/button.dds" +local buttonHighlightTex = ":n:"..LUAUI_DIRNAME.."Images/button-highlight.dds" +local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" + +local widgetScale = 1 +local glText = gl.Text +local glGetTextWidth = gl.GetTextWidth +local glBlending = gl.Blending +local glScale = gl.Scale +local glRotate = gl.Rotate +local glTranslate = gl.Translate +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glColor = gl.Color +local glRect = gl.Rect +local glTexRect = gl.TexRect +local glTexture = gl.Texture +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +local drawlist = {} +local advplayerlistPos = {} +local widgetHeight = 23 +local top, left, bottom, right = 0,0,0,0 + +local shown = false +local mouseover = false +local volume + +local dynamicMusic = Spring.GetConfigInt("evo_dynamicmusic", 1) +local interruptMusic = Spring.GetConfigInt("evo_interruptmusic", 1) +local warMeter = 0 +local fadelvl = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 +local fadeOut = false + +--Assume that if it isn't set, dynamic music is true +if dynamicMusic == nil then + dynamicMusic = 1 +end + +--Assume that if it isn't set, interrupt music is true +if interruptMusic == nil then + interruptMusic = 1 +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + + volume = Spring.GetConfigInt("snd_volmaster", 100) + music_volume_percentage = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 + + musicInitialValue = Spring.GetConfigInt("evo_musicInitialValue", 0) + if musicInitialValue ~= 1 then + Spring.SetConfigInt("snd_volmusic", 20) + Spring.SetConfigInt("evo_musicInitialValue", 1) + end + + music_volume = Spring.GetConfigInt("snd_volmusic", 20) + + if #tracks == 0 then + Spring.Echo("[Music Player] No music was found, Shutting Down") + widgetHandler:RemoveWidget() + end + + updatePosition() + + WG['music'] = {} + WG['music'].GetPosition = function() + return {top,left,bottom,right,widgetScale} + end +end + + +local function DrawRectRound(px,py,sx,sy,cs) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, py+cs, 0) + -- top right + if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-o) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-o,1-o) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-o,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +local function createList() + + local padding = 3*widgetScale -- button background margin + local padding2 = 2.5*widgetScale -- inner icon padding + local volumeWidth = 50*widgetScale + + buttons['playpause'] = {left+padding, bottom+padding, left+(widgetHeight*widgetScale)-padding, top-padding} + + buttons['next'] = {buttons['playpause'][3]+padding, bottom+padding, buttons['playpause'][3]+((widgetHeight*widgetScale)-padding), top-padding} + + buttons['musicvolumeicon'] = {buttons['next'][3]+padding+padding, bottom+padding, buttons['next'][3]+((widgetHeight*widgetScale)), top-padding} + buttons['musicvolume'] = {buttons['musicvolumeicon'][3]+padding, bottom+padding, buttons['musicvolumeicon'][3]+padding+volumeWidth, top-padding} + buttons['musicvolume'][5] = buttons['musicvolume'][1] + (buttons['musicvolume'][3] - buttons['musicvolume'][1]) * (music_volume/100) + + buttons['volumeicon'] = {buttons['musicvolume'][3]+padding+padding+padding, bottom+padding, buttons['musicvolume'][3]+((widgetHeight*widgetScale)), top-padding} + buttons['volume'] = {buttons['volumeicon'][3]+padding, bottom+padding, buttons['volumeicon'][3]+padding+volumeWidth, top-padding} + buttons['volume'][5] = buttons['volume'][1] + (buttons['volume'][3] - buttons['volume'][1]) * (volume/100) + + local textsize = 11*widgetScale + local textYPadding = 8*widgetScale + local textXPadding = 7*widgetScale + local maxTextWidth = right-buttons['next'][3]-textXPadding-textXPadding + + if drawlist[1] ~= nil then + glDeleteList(drawlist[1]) + glDeleteList(drawlist[2]) + glDeleteList(drawlist[3]) + end + if (WG['guishader_api'] ~= nil) then + WG['guishader_api'].InsertRect(left, bottom, right, top,'music') + end + drawlist[1] = glCreateList( function() + glColor(0, 0, 0, 0.66) + RectRound(left, bottom, right, top, 5.5*widgetScale) + + local borderPadding = 2.75*widgetScale + glColor(1,1,1,0.022) + RectRound(left+borderPadding, bottom+borderPadding, right-borderPadding, top-borderPadding, 4.4*widgetScale) + + end) + drawlist[2] = glCreateList( function() + + local button = 'playpause' + glColor(1,1,1,0.7) + glTexture(buttonTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + glColor(1,1,1,0.4) + if playing then + glTexture(pauseTex) + else + glTexture(playTex) + end + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'next' + glColor(1,1,1,0.7) + glTexture(buttonTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + glColor(1,1,1,0.4) + glTexture(nextTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + end) + drawlist[3] = glCreateList( function() + + -- track name + glColor(0.45,0.45,0.45,1) + local trackname = string.gsub(curTrack, ".ogg", "") + local text = '' + for i=charactersInPath, #trackname do + local c = string.sub(trackname, i,i) + local width = glGetTextWidth(text..c)*textsize + if width > maxTextWidth then + break + else + text = text..c + end + end + glText('\255\135\135\135'..text, buttons['next'][3]+textXPadding, bottom+textYPadding, textsize, 'no') + + end) + drawlist[4] = glCreateList( function() + + ---glColor(0,0,0,0.5) + --RectRound(left, bottom, right, top, 5.5*widgetScale) + + local sliderWidth = 3.3*widgetScale + local sliderHeight = 3.3*widgetScale + local lineHeight = 0.8*widgetScale + local lineOutlineSize = 0.85*widgetScale + + button = 'musicvolumeicon' + local sliderY = buttons[button][2] + (buttons[button][4] - buttons[button][2])/2 + glColor(0.66,0.66,0.66,1) + glTexture(musicTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'musicvolume' + glColor(0,0,0,0.12) + RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) + glColor(0.45,0.45,0.45,1) + RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) + glColor(0,0,0,0.12) + RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) + glColor(0.66,0.66,0.66,1) + RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) + + + button = 'volumeicon' + glColor(0.66,0.66,0.66,1) + glTexture(volumeTex) + glTexRect(buttons[button][1]+padding2, buttons[button][2]+padding2, buttons[button][3]-padding2, buttons[button][4]-padding2) + + button = 'volume' + glColor(0,0,0,0.12) + RectRound(buttons[button][1]-lineOutlineSize, sliderY-lineHeight-lineOutlineSize, buttons[button][3]+lineOutlineSize, sliderY+lineHeight+lineOutlineSize, (lineHeight/2.2)*widgetScale) + glColor(0.45,0.45,0.45,1) + RectRound(buttons[button][1], sliderY-lineHeight, buttons[button][3], sliderY+lineHeight, (lineHeight/2.2)*widgetScale) + glColor(0,0,0,0.12) + RectRound(buttons[button][5]-sliderWidth-lineOutlineSize, sliderY-sliderHeight-lineOutlineSize, buttons[button][5]+sliderWidth+lineOutlineSize, sliderY+sliderHeight+lineOutlineSize, (sliderWidth/4)*widgetScale) + glColor(0.66,0.66,0.66,1) + RectRound(buttons[button][5]-sliderWidth, sliderY-sliderHeight, buttons[button][5]+sliderWidth, sliderY+sliderHeight, (sliderWidth/4)*widgetScale) + + end) +end + +function getSliderValue(draggingSlider, x) + local sliderWidth = buttons[draggingSlider][3] - buttons[draggingSlider][1] + local value = (x - buttons[draggingSlider][1]) / (sliderWidth) + if value < 0 then value = 0 end + if value > 1 then value = 1 end + return value +end + +function isInBox(mx, my, box) + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] +end + + +function widget:MouseMove(x, y) + if draggingSlider ~= nil then + if draggingSlider == 'musicvolume' then + changeMusicVolume(getSliderValue('musicvolume', x) * 100) + end + if draggingSlider == 'volume' then + changeVolume(getSliderValue('volume', x) * 100) + end + end +end + +function widget:MousePress(x, y, button) + return mouseEvent(x, y, button, false) +end + +function widget:MouseRelease(x, y, button) + return mouseEvent(x, y, button, true) +end + +function changeMusicVolume(value) + music_volume = value + Spring.SetConfigInt("snd_volmusic", music_volume) + createList() +end + +function changeVolume(value) + volume = value + Spring.SetConfigInt("snd_volmaster", volume) + createList() +end + +function mouseEvent(x, y, button, release) + if Spring.IsGUIHidden() then return false end + + if not release then + local sliderWidth = (3.3*widgetScale) -- should be same as in createlist() + local button = 'musicvolume' + if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then + draggingSlider = button + changeMusicVolume(getSliderValue(button, x) * 100) + end + button = 'volume' + if isInBox(x, y, {buttons[button][1]-sliderWidth, buttons[button][2], buttons[button][3]+sliderWidth, buttons[button][4]}) then + draggingSlider = button + changeVolume(getSliderValue(button, x) * 100) + end + end + if release and draggingSlider ~= nil then + draggingSlider = nil + end + if button == 1 and not release and isInBox(x, y, {left, bottom, right, top}) then + if button == 1 and buttons['playpause'] ~= nil and isInBox(x, y, {buttons['playpause'][1], buttons['playpause'][2], buttons['playpause'][3], buttons['playpause'][4]}) then + playing = not playing + Spring.PauseSoundStream() + createList() + return true + end + if button == 1 and buttons['next'] ~= nil and isInBox(x, y, {buttons['next'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then + if fadeIn ~= true and fadeOut ~= true then + fadeOut = true + fadelvl = music_volume_percentage + --PlayNewTrack() + end + return true + end + return true + end + +end +function widget:IsAbove(mx, my) + if isInBox(mx, my, {left, bottom, right, top}) then + local curVolume = Spring.GetConfigInt("snd_volmaster", 100) + if volume ~= curVolume then + volume = curVolume + createList() + end + mouseover = true + end + return mouseover +end + +function widget:GetTooltip(mx, my) + if widget:IsAbove(mx,my) then + return string.format("Music info and controls") + end +end + +function widget:Shutdown() + Spring.StopSoundStream() + + if (WG['guishader_api'] ~= nil) then + WG['guishader_api'].RemoveRect('music') + end + + for i=1,#drawlist do + glDeleteList(drawlist[i]) + end + WG['music'] = nil +end + +function widget:UnitDamaged(_, _, _, damage) + warMeter = warMeter + damage +end + +function widget:GameFrame(n) + if n%30 == 4 then + --This is a little messy, but we need to be able to update these values on the fly so I see no better way + music_volume_percentage = Spring.GetConfigInt("snd_volmusic", 20) * 0.01 + + dynamicMusic = Spring.GetConfigInt("evo_dynamicmusic", 1) + interruptMusic = Spring.GetConfigInt("evo_interruptmusic", 1) + + --Assume that if it isn't set, dynamic music is true + if dynamicMusic == nil then + dynamicMusic = 1 + end + + --Assume that if it isn't set, interrupt music is true + if interruptMusic == nil then + interruptMusic = 1 + end + end + if n%5 == 4 then + if dynamicMusic == 1 then + --Spring.Echo("[Music Player] Unit Death Count is currently: ".. warMeter) + if warMeter <= 1 then + warMeter = 0 + elseif warMeter >= 3000 then + warMeter = warMeter - 500 + elseif warMeter >= 1000 then + warMeter = warMeter - 100 + elseif warMeter >= 0 then + warMeter = warMeter - 3 + end + if interruptMusic == 1 then + if tracks == peaceTracks and warMeter >= 200 then + fadeOut = true + elseif tracks == warTracks and warMeter <= 0 then + fadeOut = true + end + end + end + + --80's fadeout when a track is almost finished + local playedTime, totalTime = Spring.GetSoundStreamTime() + playedTime = math.floor(playedTime) + totalTime = math.floor(totalTime) + + if totalTime ~= nil then + --Spring.Echo("Total time is :" .. totalTime) + if playedTime > totalTime - music_volume * 0.05 then + --Spring.Echo("Fading out now!") + fadeOut = true + end + end + + --This has become the preferred handler of playing new tracks instead of calling the PlayNewTrack() function, set fadeOut = true + if fadeOut == true and fadelvl >= 0.01 then + fadelvl = fadelvl - 0.05 + --Spring.Echo(fadelvl) + Spring.SetSoundStreamVolume(fadelvl) + else + fadeOut = false + end + if fadeOut == false and fadelvl <= 0.005 then + fadelvl = music_volume_percentage * 0.01 + PlayNewTrack() + --Spring.Echo("Playing a new song now") + end + + if fadeIn == true and fadelvl <= music_volume_percentage then + fadelvl = fadelvl + 0.05 + --Spring.Echo(fadelvl) + Spring.SetSoundStreamVolume(fadelvl) + else + fadeIn = false + end + end +end + +function PlayNewTrack() + Spring.StopSoundStream() + if Spring.GetGameFrame() >= 1 then + fadelvl = 0 + fadeIn = true + end + --Spring.Echo(dynamicMusic) + + if dynamicMusic == 0 then + --Spring.Echo("Choosing a random track") + r = math.random(0,1) + if r == 0 then + tracks = peaceTracks + else + tracks = warTracks + end + end + + if dynamicMusic == 1 then + --Spring.Echo("Unit Death Count is (Gameframe): " .. warMeter) + if warMeter <= 3 then + tracks = peaceTracks + --Spring.Echo("Current tracklist is : Peace Tracks") + else + tracks = warTracks + --Spring.Echo("Current tracklist is : War Tracks") + end + end + local newTrack = previousTrack + repeat + newTrack = tracks[math.random(1, #tracks)] + until newTrack ~= previousTrack + firstFade = false + previousTrack = newTrack + curTrack = newTrack + local musicVolScaled = music_volume * 0.01 + Spring.PlaySoundStream(newTrack) + Spring.SetSoundStreamVolume(musicVolScaled or 0.33) + if playing == false then + Spring.PauseSoundStream() + end + createList() +end + +function widget:Update(dt) + if gameOver then + return + end + + if (not firstTime) then + fadelvl = 0 + fadeOut = true + firstTime = true -- pop this cherry + end + + local playedTime, totalTime = Spring.GetSoundStreamTime() + playedTime = math.floor(playedTime) + totalTime = math.floor(totalTime) + + if playedTime >= totalTime then -- both zero means track stopped in 8 + fadelvl = 0 + fadeOut = true + end + + if (pauseWhenPaused and Spring.GetGameSeconds()>=0) then + local _, _, paused = Spring.GetGameSpeed() + if (paused ~= wasPaused) then + Spring.PauseSoundStream() + wasPaused = paused + end + end +end + +function updatePosition(force) + if (WG['advplayerlist_api'] ~= nil) then + local prevPos = advplayerlistPos + advplayerlistPos = WG['advplayerlist_api'].GetPosition() -- returns {top,left,bottom,right,widgetScale} + + left = advplayerlistPos[2] + bottom = advplayerlistPos[1] + right = advplayerlistPos[4] + top = advplayerlistPos[1]+(widgetHeight*advplayerlistPos[5]) + widgetScale = advplayerlistPos[5] + + if (prevPos[1] == nil or prevPos[1] ~= advplayerlistPos[1] or prevPos[2] ~= advplayerlistPos[2] or prevPos[5] ~= advplayerlistPos[5]) or force then + createList() + end + end +end + +function widget:ViewResize(newX,newY) + vsx, vsy = newX, newY +end + +function widget:DrawScreen() + updatePosition() + if drawlist[1] ~= nil then + glPushMatrix() + glCallList(drawlist[1]) + glCallList(drawlist[2]) + local mx, my, mlb = Spring.GetMouseState() + if not mouseover and not draggingSlider or isInBox(mx, my, {buttons['playpause'][1], buttons['next'][2], buttons['next'][3], buttons['next'][4]}) then + glCallList(drawlist[3]) + else + glCallList(drawlist[4]) + end + if mouseover then + local color = {1,1,1,0.25} + local colorHighlight = {1,1,1,0.33} + local button = 'playpause' + if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then + if mlb then + glColor(colorHighlight) + else + glColor(color) + end + glTexture(buttonHighlightTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + end + button = 'next' + if buttons[button] ~= nil and isInBox(mx, my, {buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]}) then + if mlb then + glColor(colorHighlight) + else + glColor(color) + end + glTexture(buttonHighlightTex) + glTexRect(buttons[button][1], buttons[button][2], buttons[button][3], buttons[button][4]) + end + end + glPopMatrix() + mouseover = false + end +end + +function widget:GetConfigData(data) + --local playedTime, totalTime = Spring.GetSoundStreamTime() + local savedTable = {} + --savedTable.curTrack = curTrack + --savedTable.playedTime = playedTime + savedTable.playing = playing + return savedTable +end + +-- would be great if there is be a way to continue track where we left off after a /luaui reload +function widget:SetConfigData(data) + if data.playing ~= nil then + playing = data.playing + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_options.lua b/LuaUI/Widgets_Evo/gui_options.lua index 8be19b6d1..e5a0ee57c 100644 --- a/LuaUI/Widgets_Evo/gui_options.lua +++ b/LuaUI/Widgets_Evo/gui_options.lua @@ -5,13 +5,26 @@ return { desc = "", author = "Floris", date = "September 2016", - layer = 2, + layer = 20000, enabled = true, handler = true, } end ---local show = true +--[[ +-- Add option, at: +-- function init +-- +-- Apply new option value: +-- function applyOptionValue +-- +-- Load widget data (to get settings for when widget is disabled): +-- function loadAllWidgetData +-- +]]-- + +local cameraTransitionTime = 0.2 +local cameraPanTransitionTime = 0.03 local playSounds = true local buttonclick = 'LuaUI/Sounds/tock.wav' @@ -23,14 +36,21 @@ local selecthoverclick = 'LuaUI/Sounds/hover.wav' local toggleonclick = 'LuaUI/Sounds/switchon.wav' local toggleoffclick = 'LuaUI/Sounds/switchoff.wav' -local loadedFontSize = 32 -local font = gl.LoadFont("LuaUI/Fonts/FreeSansBold.otf", loadedFontSize, 16,2) +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfileScale2 = fontfileScale * 1.2 +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) local bgcorner = "LuaUI/Images/bgcorner.png" -local bgcorner1 = ":n:".."LuaUI/Images/bgcorner1.png" -- only used to draw dropdown arrow local backwardTex = "LuaUI/Images/backward.dds" local forwardTex = "LuaUI/Images/forward.dds" -local glowTex = "LuaUI/Images/glow.dds" +local glowTex = "LuaUI/Images/glow2.dds" local bgMargin = 6 @@ -38,13 +58,15 @@ local closeButtonSize = 30 local screenHeight = 520-bgMargin-bgMargin local screenWidth = 1050-bgMargin-bgMargin -local textareaMinLines = 10 -- wont scroll down more, will show at least this amount of lines +local changesRequireRestart = false +local textareaMinLines = 10 -- wont scroll down more, will show at least this amount of lines local customScale = 1 local startLine = 1 -local vsx,vsy = Spring.GetViewGeometry() +local customMapSunPos = {} + local screenX = (vsx*0.5) - (screenWidth/2) local screenY = (vsy*0.5) + (screenHeight/2) @@ -62,8 +84,6 @@ local glRotate = gl.Rotate local glTexture = gl.Texture local glText = gl.Text local glShape = gl.Shape -local glGetTextWidth = gl.GetTextWidth -local glGetTextHeight = gl.GetTextHeight local bgColorMultiplier = 0 @@ -80,13 +100,17 @@ local GL_FILL = GL.FILL local GL_FRONT_AND_BACK = GL.FRONT_AND_BACK local GL_LINE_STRIP = GL.LINE_STRIP -local widgetScale = 1 local vsx, vsy = Spring.GetViewGeometry() +local widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale +WG.uiScale = widgetScale local resolutionX, resolutionY = Spring.GetScreenGeometry() + local myTeamID = Spring.GetMyTeamID() local amNewbie = (Spring.GetTeamRulesParam(myTeamID, 'isNewbie') == 1) +local defaultMapSunPos = {gl.GetSun("pos")} + local options = {} local optionGroups = {} local optionButtons = {} @@ -97,13 +121,13 @@ local widgetOptionColor = '\255\160\160\160' local luaShaders = tonumber(Spring.GetConfigInt("ForceShaders",1) or 0) - local presetNames = {'lowest','low','medium','high','ultra'} -- defined so these get listed in the right order local presets = { lowest = { - fsaa = 0, + msaa = 0, bloom = false, bloomhighlights = false, + ssao = false, water = 1, mapedgeextension = false, lighteffects = false, @@ -127,9 +151,10 @@ local presets = { enemyspotter_highlight = false, }, low = { - fsaa = 0, + msaa = 2, bloom = false, bloomhighlights = false, + ssao = false, water = 2, mapedgeextension = false, lighteffects = false, @@ -153,9 +178,10 @@ local presets = { enemyspotter_highlight = false, }, medium = { - fsaa = 2, + msaa = 4, bloom = true, bloomhighlights = false, + ssao = false, water = 3, mapedgeextension = true, lighteffects = true, @@ -170,7 +196,7 @@ local presets = { timecyclesweathereffects = false, outline = false, guishader = false, - shadows = false, + shadows = true, advmapshading = true, advmodelshading = true, decals = 1, @@ -179,9 +205,10 @@ local presets = { enemyspotter_highlight = false, }, high = { - fsaa = 4, + msaa = 8, bloom = true, bloomhighlights = false, + ssao = true, water = 3, mapedgeextension = true, lighteffects = true, @@ -205,9 +232,10 @@ local presets = { enemyspotter_highlight = false, }, ultra = { - fsaa = 8, + msaa = 16, bloom = true, bloomhighlights = true, + ssao = true, water = 3, mapedgeextension = true, lighteffects = true, @@ -243,23 +271,52 @@ function widget:ViewResize() vsx,vsy = Spring.GetViewGeometry() screenX = (vsx*0.5) - (screenWidth/2) screenY = (vsy*0.5) + (screenHeight/2) - widgetScale = (0.75 + (vsx*vsy / 7500000)) * customScale + widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + WG.uiScale = widgetScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + fontfileScale2 = fontfileScale * 1.2 + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale2, fontfileOutlineSize*fontfileScale2, fontfileOutlineStrength) + end if windowList then gl.DeleteList(windowList) end windowList = gl.CreateList(DrawWindow) end local showOnceMore = false -- used because of GUI shader delay -local showOptionsToggleButton = true +local showOptionsToggleButton = false local textSize = 1 local textMargin = 0.25 local lineWidth = 0.0625 local posX = 0.947 -local posY = 0.970 +local posY = 0.965 local buttonGL local startPosX = posX + +local engineVersion = 100 -- just filled this in here incorrectly but old engines arent used anyway +if Engine and Engine.version then + local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + return results + end + engineVersion = Split(Engine.version, '-') + if engineVersion[2] ~= nil and engineVersion[3] ~= nil then + engineVersion = tonumber(string.gsub(engineVersion[1], '%.', '')..engineVersion[2]) + else + engineVersion = tonumber(Engine.version) + end +elseif Game and Game.version then + engineVersion = tonumber(Game.version) +end + + local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) gl.TexCoord(0.8,0.8) gl.Vertex(px+cs, py, 0) @@ -283,41 +340,41 @@ local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) -- bottom right if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) -- top left if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, sy-cs, 0) -- top right if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) @@ -326,22 +383,9 @@ function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differentl gl.Texture(false) end -function DrawButton() - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) - gl.Color(0,0,0,0.8) - RectRound(-1,-0.5,5.5,1.5,0.25, 2,2,2,2) - local vertices = { - {v = {0, 1, 0}}, - {v = {0, 0, 0}}, - {v = {1, 0, 0}}, - } - glShape(GL_LINE_STRIP, vertices) - glText("Settings", textMargin, textMargin, textSize, "nos") -end - function lines(str) local t = {} - local function helper(line) table.insert(t, line) return "" end + local function helper(line) t[#t+1]=line return "" end helper((str:gsub("(.-)\r?\n", helper))) return t end @@ -393,10 +437,11 @@ function orderOptions() end for oid,option in pairs(options) do if option.type ~= 'label' then - table.insert(groupOptions[option.group], option) + groupOptions[option.group][#groupOptions[option.group]+1] = option end end local newOptions = {} + local newOptionsCount = 0 for id,group in pairs(optionGroups) do grOptions = groupOptions[group.id] if #grOptions > 0 then @@ -404,16 +449,32 @@ function orderOptions() if group.id == 'gfx' then name = group.name..' \255\130\130\130'..vsx..' x '..vsy end - table.insert(newOptions, {id="group_"..group.id, name=name, type="label"}) + newOptionsCount = newOptionsCount +1 + newOptions[newOptionsCount] = {id="group_"..group.id, name=name, type="label"} end for oid,option in pairs(grOptions) do - table.insert(newOptions, option) + newOptionsCount = newOptionsCount +1 + newOptions[newOptionsCount] = option end end options = deepcopy(newOptions) end +function mouseoverGroupTab(id) + if optionGroups[id].id == currentGroupTab then return end + + local tabFontSize = 16 + local groupMargin = bgMargin/1.7 + gl.Color(0.4,0.4,0.4,0.3) + RectRound(groupRect[id][1]+groupMargin, groupRect[id][2], groupRect[id][3]-groupMargin, groupRect[id][4]-groupMargin, groupMargin*1.8, 1,1,0,0) + font2:Begin() + font2:SetTextColor(1,0.85,0.55,1) + font2:SetOutlineColor(0.4,0.3,0.15,0.4) + font2:Print(optionGroups[id].name, groupRect[id][1]+((groupRect[id][3]-groupRect[id][1])/2), screenY+bgMargin+8, tabFontSize, "con") + font2:End() +end + local startColumn = 1 -- used for navigation local maxShownColumns = 3 local maxColumnRows = 0 -- gets calculated @@ -425,10 +486,18 @@ function DrawWindow() local x = screenX --rightwards local y = screenY --upwards -- background - gl.Color(0,0,0,0.8) + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end RectRound(x-bgMargin,y-screenHeight-bgMargin,x+screenWidth+bgMargin,y+bgMargin,8, 0,1,1,1) -- content area - gl.Color(0.33,0.33,0.33,0.15) + if currentGroupTab then + gl.Color(0.4,0.4,0.4,0.15) + else + gl.Color(0.33,0.33,0.33,0.15) + end RectRound(x,y-screenHeight,x+screenWidth,y,6) --[[ close button @@ -442,26 +511,73 @@ function DrawWindow() gl.Rotate(90,0,0,1) gl.Rect(-width,size/2,width,-size/2) gl.PopMatrix()]]-- - + -- title - local title = "Options" + local title = "Settings" local titleFontSize = 18 - gl.Color(0,0,0,0.8) - titleRect = {x-bgMargin, y+bgMargin, x+(glGetTextWidth(title)*titleFontSize)+27-bgMargin, y+37} + titleRect = {x-bgMargin, y+bgMargin, x+(font2:GetTextWidth(title)*titleFontSize)+27-bgMargin, y+37 } + + -- group tabs + local tabFontSize = 16 + local xpos = titleRect[3] + local groupMargin = bgMargin/1.7 + groupRect = {} + for id,group in pairs(optionGroups) do + groupRect[id] = {xpos, y+(bgMargin/2), xpos+(font2:GetTextWidth(group.name)*tabFontSize)+27, y+37} + xpos = groupRect[id][3] + if currentGroupTab == nil or currentGroupTab ~= group.id then + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end + RectRound(groupRect[id][1], groupRect[id][2]+(bgMargin/2), groupRect[id][3], groupRect[id][4], 8, 1,1,0,0) + gl.Color(0.62,0.5,0.22,0.18) + RectRound(groupRect[id][1]+groupMargin, groupRect[id][2], groupRect[id][3]-groupMargin, groupRect[id][4]-groupMargin, groupMargin*1.8, 1,1,0,0) + font2:Begin() + font2:SetTextColor(0.6,0.51,0.38,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(group.name, groupRect[id][1]+((groupRect[id][3]-groupRect[id][1])/2), y+bgMargin+8, tabFontSize, "con") + font2:End() + else + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end + RectRound(groupRect[id][1], groupRect[id][2]+(bgMargin/2), groupRect[id][3], groupRect[id][4], 8, 1,1,0,0) + gl.Color(0.4,0.4,0.4,0.15) + RectRound(groupRect[id][1]+groupMargin, groupRect[id][2]+(bgMargin/2)-bgMargin, groupRect[id][3]-groupMargin, groupRect[id][4]-groupMargin, groupMargin*1.8, 1,1,0,0) + font2:Begin() + font2:SetTextColor(1,0.75,0.4,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(group.name, groupRect[id][1]+((groupRect[id][3]-groupRect[id][1])/2), y+bgMargin+8, tabFontSize, "con") + font2:End() + end + end + + -- title drawing + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end RectRound(titleRect[1], titleRect[2], titleRect[3], titleRect[4], 8, 1,1,0,0) - + + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") + font2:End() + font:Begin() - font:SetTextColor(1,1,1,1) - font:SetOutlineColor(0,0,0,0.4) - font:Print(title, x-bgMargin+(titleFontSize*0.75), y+bgMargin+8, titleFontSize, "on") - font:End() - local width = screenWidth/3 --gl.Color(0.66,0.66,0.66,0.08) --RectRound(x+width+width+6,y-screenHeight,x+width+width+width,y,6) - + -- description background - gl.Color(0.62,0.5,0.22,0.14) + --gl.Color(0.55,0.48,0.22,0.14) + gl.Color(1,0.85,0.55,0.04) RectRound(x,y-screenHeight,x+width+width,y-screenHeight+90,6) -- draw options @@ -481,10 +597,19 @@ function DrawWindow() local rows = 0 local column = 1 local drawColumnPos = 1 - if totalColumns == 0 or maxColumnRows == 0 then - maxColumnRows = math.floor((y-yPosMax+oPadding) / (oHeight+oPadding+oPadding)) - totalColumns = math.ceil(#options / maxColumnRows) + + maxColumnRows = math.floor((y-yPosMax+oPadding) / (oHeight+oPadding+oPadding)) + local numOptions = #options + if currentGroupTab ~= nil then + numOptions = 0 + for oid,option in pairs(options) do + if option.group == currentGroupTab then + numOptions = numOptions + 1 + end + end end + totalColumns = math.ceil(numOptions / maxColumnRows) + optionButtons = {} optionHover = {} @@ -492,7 +617,7 @@ function DrawWindow() -- draw navigation... backward/forward if totalColumns > maxShownColumns then local buttonSize = 52 - local buttonMargin = 13 + local buttonMargin = 18 local startX = x+screenWidth local startY = screenY-screenHeight+buttonMargin @@ -507,9 +632,8 @@ function DrawWindow() optionButtonForward = nil end - glColor(1,1,1,0.4) - glText(math.ceil(startColumn/maxShownColumns)..' / '..math.ceil(totalColumns/maxShownColumns), startX-(buttonSize*2.6)-buttonMargin, startY+buttonSize/2.6, buttonSize/2.9, "rn") - + font:SetTextColor(1,1,1,0.4) + font:Print(math.ceil(startColumn/maxShownColumns)..' / '..math.ceil(totalColumns/maxShownColumns), startX-(buttonSize*2.6)-buttonMargin, startY+buttonSize/2.6, buttonSize/2.9, "rn") if startColumn > 1 then if optionButtonForward == nil then optionButtonBackward = {startX-buttonSize-buttonMargin, startY, startX-buttonMargin, startY+buttonSize } @@ -524,92 +648,124 @@ function DrawWindow() end end + -- require restart notification + if changesRequireRestart then + font:SetTextColor(1,0.35,0.35,1) + font:SetOutlineColor(0,0,0,0.4) + font:Print("...made changes that require restart", x+screenWidth-3, screenY-screenHeight+3, 15, "rn") + end + -- draw options for oid,option in pairs(options) do - yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) - if yPos-oHeight < yPosMax then - i = 0 - column = column + 1 - if column >= startColumn and rows > 0 then - drawColumnPos = drawColumnPos + 1 - end - if drawColumnPos > 3 then - break + if currentGroupTab == nil or option.group == currentGroupTab then + yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) + if yPos-oHeight < yPosMax then + i = 0 + column = column + 1 + if column >= startColumn and rows > 0 then + drawColumnPos = drawColumnPos + 1 + end + if drawColumnPos > 3 then + break + end + if rows > 0 then + xPos = x + (( (screenWidth/3))*(drawColumnPos-1)) + xPosMax = xPos + oWidth + end + yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) end - if rows > 0 then - xPos = x + (( (screenWidth/3))*(drawColumnPos-1)) - xPosMax = xPos + oWidth + + if column >= startColumn then + rows = rows + 1 + --option name + color = '\255\225\225\225 ' + if option.type == 'label' then + color = '\255\235\200\125' + end + + font:SetTextColor(1,1,1,1) + font:Print(color..option.name, xPos+(oPadding/2), yPos-(oHeight/3)-oPadding, oHeight, "no") + + -- define hover area + optionHover[oid] = {xPos, yPos-oHeight-oPadding, xPosMax, yPos+oPadding} + + -- option controller + local rightPadding = 4 + if option.type == 'bool' then + optionButtons[oid] = {} + optionButtons[oid] = {xPosMax-boolWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos} + glColor(1,1,1,0.11) + RectRound(xPosMax-boolWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 2) + if option.value == true then + glColor(0.66,0.92,0.66,1) + RectRound(xPosMax-oHeight+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-boolPadding-rightPadding, yPos-boolPadding, 1) + local boolGlow = boolPadding*3.5 + glColor(0.66,1,0.66,0.5) + glTexture(glowTex) + glTexRect(xPosMax-oHeight+boolPadding-rightPadding-boolGlow, yPos-oHeight+boolPadding-boolGlow, xPosMax-boolPadding-rightPadding+boolGlow, yPos-boolPadding+boolGlow) + glColor(0.55,1,0.55,0.09) + glTexture(glowTex) + glTexRect(xPosMax-oHeight+boolPadding-rightPadding-(boolGlow*3), yPos-oHeight+boolPadding-(boolGlow*3), xPosMax-boolPadding-rightPadding+(boolGlow*3), yPos-boolPadding+(boolGlow*3)) + elseif option.value == 0.5 then + glColor(0.91,0.82,0.66,1) + RectRound(xPosMax-(boolWidth/1.9)+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-(boolWidth/1.9)+oHeight-boolPadding-rightPadding, yPos-boolPadding, 1) + else + glColor(0.9,0.66,0.66,1) + RectRound(xPosMax-boolWidth+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-boolWidth+oHeight-boolPadding-rightPadding, yPos-boolPadding, 1) + end + + elseif option.type == 'slider' then + local sliderSize = oHeight*0.75 + local sliderPos = 0 + if option.steps then + local min, max = option.steps[1], option.steps[1] + for k, v in ipairs(option.steps) do + if v > max then max = v end + if v < min then min = v end + end + sliderPos = (option.value-min) / (max-min) + else + sliderPos = (option.value-option.min) / (option.max-option.min) + end + glColor(1,1,1,0.11) + RectRound(xPosMax-(sliderSize/2)-sliderWidth-rightPadding, yPos-((oHeight/7)*4.2), xPosMax-(sliderSize/2)-rightPadding, yPos-((oHeight/7)*2.8), 1) + glColor(0.8,0.8,0.8,1) + RectRound(xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)-(sliderSize/2)-rightPadding, yPos-oHeight+((oHeight-sliderSize)/2), xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)+(sliderSize/2)-rightPadding, yPos-((oHeight-sliderSize)/2), 1) + optionButtons[oid] = {xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)-(sliderSize/2)-rightPadding, yPos-oHeight+((oHeight-sliderSize)/2), xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)+(sliderSize/2)-rightPadding, yPos-((oHeight-sliderSize)/2)} + optionButtons[oid].sliderXpos = {xPosMax-(sliderSize/2)-sliderWidth-rightPadding, xPosMax-(sliderSize/2)-rightPadding} + + elseif option.type == 'select' then + optionButtons[oid] = {xPosMax-selectWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos} + glColor(1,1,1,0.11) + RectRound(xPosMax-selectWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 2) + if option.options[tonumber(option.value)] ~= nil then + if option.id == 'font2' then + font:End() + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:Print(option.options[tonumber(option.value)], xPosMax-selectWidth+5-rightPadding, yPos-(oHeight/3)-oPadding, oHeight*0.85, "no") + font2:End() + font:Begin() + else + font:SetTextColor(1,1,1,1) + font:Print(option.options[tonumber(option.value)], xPosMax-selectWidth+5-rightPadding, yPos-(oHeight/3)-oPadding, oHeight*0.85, "no") + end + end + glColor(1,1,1,0.11) + RectRound(xPosMax-oHeight-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 1) + glColor(1,1,1,0.16) + glTexture(bgcorner) + glPushMatrix() + glTranslate(xPosMax-(oHeight*0.5)-rightPadding, yPos-(oHeight*0.33), 0) + glRotate(-45,0,0,1) + glTexRect(-(oHeight*0.25),-(oHeight*0.25),(oHeight*0.25),(oHeight*0.25)) + glPopMatrix() + end end - yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) + i = i + 1 end - - if column >= startColumn then - rows = rows + 1 - --option name - color = '\255\225\225\225 ' - if option.type == 'label' then - color = '\255\235\200\125' - end - glText(color..option.name, xPos+(oPadding/2), yPos-(oHeight/3)-oPadding, oHeight, "no") - - -- define hover area - optionHover[oid] = {xPos, yPos-oHeight-oPadding, xPosMax, yPos+oPadding} - - -- option controller - local rightPadding = 4 - if option.type == 'bool' then - optionButtons[oid] = {} - optionButtons[oid] = {xPosMax-boolWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos} - glColor(1,1,1,0.11) - RectRound(xPosMax-boolWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 3) - if option.value == true then - glColor(0.66,0.92,0.66,1) - RectRound(xPosMax-oHeight+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-boolPadding-rightPadding, yPos-boolPadding, 2.5) - local boolGlow = boolPadding*1.3 - glColor(0.66,1,0.66,0.23) - glTexture(glowTex) - glTexRect(xPosMax-oHeight+boolPadding-rightPadding-boolGlow, yPos-oHeight+boolPadding-boolGlow, xPosMax-boolPadding-rightPadding+boolGlow, yPos-boolPadding+boolGlow) - glColor(0.55,1,0.55,0.09) - glTexture(glowTex) - glTexRect(xPosMax-oHeight+boolPadding-rightPadding-(boolGlow*3), yPos-oHeight+boolPadding-(boolGlow*3), xPosMax-boolPadding-rightPadding+(boolGlow*3), yPos-boolPadding+(boolGlow*3)) - elseif option.value == 0.5 then - glColor(0.91,0.82,0.66,1) - RectRound(xPosMax-(boolWidth/1.9)+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-(boolWidth/1.9)+oHeight-boolPadding-rightPadding, yPos-boolPadding, 2.5) - else - glColor(0.9,0.66,0.66,1) - RectRound(xPosMax-boolWidth+boolPadding-rightPadding, yPos-oHeight+boolPadding, xPosMax-boolWidth+oHeight-boolPadding-rightPadding, yPos-boolPadding, 2.5) - end - - elseif option.type == 'slider' then - local sliderSize = oHeight*0.75 - local sliderPos = (option.value-option.min) / (option.max-option.min) - glColor(1,1,1,0.11) - RectRound(xPosMax-(sliderSize/2)-sliderWidth-rightPadding, yPos-((oHeight/7)*4.2), xPosMax-(sliderSize/2)-rightPadding, yPos-((oHeight/7)*2.8), 1) - glColor(0.8,0.8,0.8,1) - RectRound(xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)-(sliderSize/2)-rightPadding, yPos-oHeight+((oHeight-sliderSize)/2), xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)+(sliderSize/2)-rightPadding, yPos-((oHeight-sliderSize)/2), 3) - optionButtons[oid] = {xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)-(sliderSize/2)-rightPadding, yPos-oHeight+((oHeight-sliderSize)/2), xPosMax-(sliderSize/2)-sliderWidth+(sliderWidth*sliderPos)+(sliderSize/2)-rightPadding, yPos-((oHeight-sliderSize)/2)} - optionButtons[oid].sliderXpos = {xPosMax-(sliderSize/2)-sliderWidth-rightPadding, xPosMax-(sliderSize/2)-rightPadding} - - elseif option.type == 'select' then - optionButtons[oid] = {xPosMax-selectWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos} - glColor(1,1,1,0.11) - RectRound(xPosMax-selectWidth-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 3) - if option.options[tonumber(option.value)] ~= nil then - glText(option.options[tonumber(option.value)], xPosMax-selectWidth+5-rightPadding, yPos-(oHeight/3)-oPadding, oHeight*0.85, "no") - end - glColor(1,1,1,0.11) - RectRound(xPosMax-oHeight-rightPadding, yPos-oHeight, xPosMax-rightPadding, yPos, 2.5) - glColor(1,1,1,0.16) - glTexture(bgcorner1) - glPushMatrix() - glTranslate(xPosMax-(oHeight*0.5)-rightPadding, yPos-(oHeight*0.33), 0) - glRotate(-45,0,0,1) - glTexRect(-(oHeight*0.25),-(oHeight*0.25),(oHeight*0.25),(oHeight*0.25)) - glPopMatrix() - end - end - i = i + 1 end + font:End() end @@ -624,6 +780,13 @@ end local sec = 0 local lastUpdate = 0 function widget:Update(dt) + if WG['advplayerlist_api'] and not WG['advplayerlist_api'].GetLockPlayerID() then + --if select(7, Spring.GetMouseState()) then -- when camera panning + -- Spring.SetCameraState(Spring.GetCameraState(), cameraPanTransitionTime) + --else + Spring.SetCameraState(Spring.GetCameraState(), cameraTransitionTime) + --end + end sec = sec + dt if show and (sec > lastUpdate + 0.5 or forceUpdate) then forceUpdate = nil @@ -641,18 +804,49 @@ function widget:Update(dt) end windowList = gl.CreateList(DrawWindow) end + --options[getOptionByID('sndvolmaster')].value = tonumber(Spring.GetConfigInt("snd_volmaster",40) or 40) -- update value because other widgets can adjust this too + --if getOptionByID('sndvolmusic') then + -- if WG['music'] and WG['music'].GetMusicVolume then + -- options[getOptionByID('sndvolmusic')].value = WG['music'].GetMusicVolume() + -- else + -- options[getOptionByID('sndvolmusic')].value = tonumber(Spring.GetConfigInt("snd_volmusic",20) or 20) + -- end + --end + end +end + +function widget:CommandNotify(cmdID, cmdParams, cmdOptions) + if show then + --on window + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local x,y,ml = Spring.GetMouseState() + local cx, cy = correctMouseForScaling(x,y) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + return true + elseif groupRect ~= nil then + for id,group in pairs(optionGroups) do + if IsOnRect(cx, cy, groupRect[id][1], groupRect[id][2], groupRect[id][3], groupRect[id][4]) then + return true + end + end + end + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') end end function widget:DrawScreen() + if chobbyInterface then return end if spIsGUIHidden() then return end - -- draw the button - if not buttonGL then - buttonGL = gl.CreateList(DrawButton) - end - if showOptionsToggleButton then glPushMatrix() glTranslate(posX*vsx, posY*vsy, 0) @@ -664,7 +858,7 @@ function widget:DrawScreen() -- draw the window if not windowList then - windowList = gl.CreateList(DrawWindow) + --windowList = gl.CreateList(DrawWindow) end -- update new slider value @@ -674,21 +868,70 @@ function widget:DrawScreen() sliderValueChanged = nil end + if selectOptionsList then + if WG['guishader'] then + WG['guishader'].RemoveScreenRect('options_select') + WG['guishader'].removeRenderDlist(selectOptionsList) + end + glDeleteList(selectOptionsList) + selectOptionsList = nil + end + if show or showOnceMore then - + + --on window + local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) + local x,y,ml = Spring.GetMouseState() + local cx, cy = correctMouseForScaling(x,y) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + Spring.SetMouseCursor('cursornormal') + elseif groupRect ~= nil then + for id,group in pairs(optionGroups) do + if IsOnRect(cx, cy, groupRect[id][1], groupRect[id][2], groupRect[id][3], groupRect[id][4]) then + Spring.SetMouseCursor('cursornormal') + break + end + end + elseif titleRect ~= nil and IsOnRect(cx, cy, titleRect[1], titleRect[2], titleRect[3], titleRect[4]) then + Spring.SetMouseCursor('cursornormal') + end -- draw the options panel glPushMatrix() glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) glScale(widgetScale, widgetScale, 1) glCallList(windowList) - if (WG['guishader_api'] ~= nil) then + if WG['guishader'] then local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - WG['guishader_api'].InsertRect(rectX1, rectY2, rectX2, rectY1, 'options') - --WG['guishader_api'].setBlurIntensity(0.0017) - --WG['guishader_api'].setScreenBlur(true) + if backgroundGuishader ~= nil then + glDeleteList(backgroundGuishader) + end + backgroundGuishader = glCreateList( function() + -- background + RectRound(rectX1, rectY2, rectX2, rectY1, 9*widgetScale, 0,1,1,1) + -- title + rectX1 = (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY1 = (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2) + rectX2 = (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY2 = (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2) + RectRound(rectX1, rectY1, rectX2, rectY2, 9*widgetScale, 1,1,0,0) + -- tabs + for id,group in pairs(optionGroups) do + if groupRect[id] then + rectX1 = (groupRect[id][1] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY1 = (groupRect[id][2] * widgetScale) - ((vsy * (widgetScale-1))/2) + rectX2 = (groupRect[id][3] * widgetScale) - ((vsx * (widgetScale-1))/2) + rectY2 = (groupRect[id][4] * widgetScale) - ((vsy * (widgetScale-1))/2) + RectRound(rectX1, rectY1, rectX2, rectY2, 9*widgetScale, 1,1,0,0) + end + end + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'options') end showOnceMore = false @@ -698,47 +941,62 @@ function widget:DrawScreen() -- mouseover (highlight and tooltip) - local description = '' + local description = '' local x,y,ml = Spring.GetMouseState() local cx, cy = correctMouseForScaling(x,y) - if optionButtonForward ~= nil and IsOnRect(cx, cy, optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4]) then - if ml then - glColor(1,0.91,0.66,0.36) - else - glColor(1,1,1,0.14) - end - RectRound(optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4], (optionButtonForward[4]-optionButtonForward[2])/8) - end - if optionButtonBackward ~= nil and IsOnRect(cx, cy, optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4]) then - if ml then - glColor(1,0.91,0.66,0.36) - else - glColor(1,1,1,0.14) - end - RectRound(optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4], (optionButtonBackward[4]-optionButtonBackward[2])/8) - end + if groupRect ~= nil then + for id,group in pairs(optionGroups) do + if IsOnRect(cx, cy, groupRect[id][1], groupRect[id][2], groupRect[id][3], groupRect[id][4]) then + mouseoverGroupTab(id) + end + end + end + if optionButtonForward ~= nil and IsOnRect(cx, cy, optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4]) then + if ml then + glColor(1,0.91,0.66,0.36) + else + glColor(1,1,1,0.14) + end + RectRound(optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4], (optionButtonForward[4]-optionButtonForward[2])/12) + end + if optionButtonBackward ~= nil and IsOnRect(cx, cy, optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4]) then + if ml then + glColor(1,0.91,0.66,0.36) + else + glColor(1,1,1,0.14) + end + RectRound(optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4], (optionButtonBackward[4]-optionButtonBackward[2])/12) + end if not showSelectOptions then for i, o in pairs(optionHover) do if IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) and options[i].type ~= 'label' then glColor(1,1,1,0.055) - RectRound(o[1]-4, o[2], o[3]+4, o[4], 4) + RectRound(o[1]-4, o[2], o[3]+4, o[4], 2) + font:Begin() if options[i].description ~= nil then description = options[i].description - glText('\255\235\200\125'..options[i].description, screenX+15, screenY-screenHeight+64.5, 16, "no") + font:Print('\255\235\190\122'..options[i].description, screenX+15, screenY-screenHeight+64.5, 16, "no") end + font:SetTextColor(0.46,0.4,0.3,0.45) + font:Print('/option '..options[i].id, screenX+screenWidth*0.659, screenY-screenHeight+8, 14, "nr") + font:End() end end for i, o in pairs(optionButtons) do if IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then - glColor(1,1,1,0.08) - RectRound(o[1], o[2], o[3], o[4], 2.5) + gl.Color(0,0,0,0.08) + RectRound(o[1], o[2], o[3], o[4], 1) if WG['tooltip'] ~= nil and options[i].type == 'slider' then local value = options[i].value - local decimalValue, floatValue = math.modf(options[i].step) - if floatValue ~= 0 then - value = string.format("%."..string.len(string.sub(''..options[i].step, 3)).."f", value) -- do rounding via a string because floats show rounding errors at times + if options[i].steps then + value = NearestValue(options[i].steps, value) + else + local decimalValue, floatValue = math.modf(options[i].step) + if floatValue ~= 0 then + value = string.format("%."..string.len(string.sub(''..options[i].step, 3)).."f", value) -- do rounding via a string because floats show rounding errors at times + end end WG['tooltip'].ShowTooltip('options_showvalue', value) end @@ -751,11 +1009,11 @@ function widget:DrawScreen() -- highlight all that are affected by presets if options[showSelectOptions].id == 'preset' then - glColor(1,1,1,0.08) + glColor(1,1,1,0.07) for optionID, _ in pairs(presets['lowest']) do optionKey = getOptionByID(optionID) if optionHover[optionKey] ~= nil then - RectRound(optionHover[optionKey][1], optionHover[optionKey][2]+1.33, optionHover[optionKey][3], optionHover[optionKey][4]-1.33, 2.5) + RectRound(optionHover[optionKey][1], optionHover[optionKey][2]+1.33, optionHover[optionKey][3], optionHover[optionKey][4]-1.33, 1) end end end @@ -769,46 +1027,106 @@ function widget:DrawScreen() for i, option in pairs(options[showSelectOptions].options) do yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) end - glColor(0.22,0.22,0.22,0.85) - RectRound(optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4], 4) - glColor(1,1,1,0.07) - RectRound(optionButtons[showSelectOptions][1], optionButtons[showSelectOptions][2], optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4], 4) - for i, option in pairs(options[showSelectOptions].options) do - yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) - if IsOnRect(cx, cy, optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding) then - glColor(1,1,1,0.1) - RectRound(optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding, 4) - if playSounds and (prevSelectHover == nil or prevSelectHover ~= i) then - Spring.PlaySoundFile(selecthoverclick, 0.04, 'ui') + + selectOptionsList = glCreateList(function() + if WG['guishader'] then + glPushMatrix() + glTranslate(-(vsx * (widgetScale-1))/2, -(vsy * (widgetScale-1))/2, 0) + glScale(widgetScale, widgetScale, 1) + glColor(0.25,0.25,0.25,0.7) + else + glColor(0.25,0.25,0.25,0.85) + end + RectRound(optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4], 2) + glColor(1,1,1,0.07) + RectRound(optionButtons[showSelectOptions][1], optionButtons[showSelectOptions][2], optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4], 2) + for i, option in pairs(options[showSelectOptions].options) do + yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) + if IsOnRect(cx, cy, optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding) then + glColor(1,1,1,0.18) + RectRound(optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding, 2) + if playSounds and (prevSelectHover == nil or prevSelectHover ~= i) then + Spring.PlaySoundFile(selecthoverclick, 0.04, 'ui') + end + prevSelectHover = i + end + optionSelect[#optionSelect+1] = {optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding, i } + + if options[showSelectOptions].optionsFont and fontOption then + fontOption[i]:Begin() + fontOption[i]:Print('\255\255\255\255'..option, optionButtons[showSelectOptions][1]+7, yPos-(oHeight/2.25)-oPadding, oHeight*0.85, "no") + fontOption[i]:End() + else + font:Begin() + font:Print('\255\255\255\255'..option, optionButtons[showSelectOptions][1]+7, yPos-(oHeight/2.25)-oPadding, oHeight*0.85, "no") + font:End() end - prevSelectHover = i end - table.insert(optionSelect, {optionButtons[showSelectOptions][1], yPos-oHeight-oPadding, optionButtons[showSelectOptions][3], yPos+oPadding, i}) - glText('\255\255\255\255'..option, optionButtons[showSelectOptions][1]+7, yPos-(oHeight/2.25)-oPadding, oHeight*0.85, "no") + if WG['guishader'] then + glPopMatrix() + end + end) + if WG['guishader'] then + local interfaceScreenCenterPosX = (screenX+(screenWidth/2))/vsx + local interfaceScreenCenterPosY = (screenY-(screenHeight/2))/vsy + + -- translate coordinates to actual screen coords (because we applied glscale/gltranlate above) + local x1 = (vsx*interfaceScreenCenterPosX) - (((vsx/2) - optionButtons[showSelectOptions][1]) * widgetScale) + local x2 = (vsx*interfaceScreenCenterPosX) - (((vsx/2) - optionButtons[showSelectOptions][3]) * widgetScale) + local y1 = (vsy*interfaceScreenCenterPosY) - (((vsy/2) - (yPos-oHeight-oPadding)) * widgetScale) + local y2 = (vsy*interfaceScreenCenterPosY) - (((vsy/2) - optionButtons[showSelectOptions][4]) * widgetScale) + WG['guishader'].InsertScreenRect(x1, y1, x2, y2, 'options_select') + WG['guishader'].insertRenderDlist(selectOptionsList) + else + glCallList(selectOptionsList) end elseif prevSelectHover ~= nil then prevSelectHover = nil end - glPopMatrix() + glPopMatrix() else - if (WG['guishader_api'] ~= nil) then - local removed = WG['guishader_api'].RemoveRect('options') - if removed then - --WG['guishader_api'].setBlurIntensity() - WG['guishader_api'].setScreenBlur(false) - end + if WG['guishader'] then + WG['guishader'].DeleteDlist('options') + end end if checkedWidgetDataChanges == nil then checkedWidgetDataChanges = true - loadWidgetConfigData() + loadAllWidgetData() end end +function saveOptionValue(widgetName, widgetApiName, widgetApiFunction, configVar, configValue) + if widgetHandler.configData[widgetName] == nil then + widgetHandler.configData[widgetName] = {} + end + if widgetHandler.configData[widgetName][configVar[1]] == nil then + widgetHandler.configData[widgetName][configVar[1]] = {} + end + if configVar[2] ~= nil and widgetHandler.configData[widgetName][configVar[1]][configVar[2]] == nil then + widgetHandler.configData[widgetName][configVar[1]][configVar[2]] = {} + end + if configVar[2] ~= nil then + if configVar[3] ~= nil then + widgetHandler.configData[widgetName][configVar[1]][configVar[2]][configVar[3]] = configValue + else + widgetHandler.configData[widgetName][configVar[1]][configVar[2]] = configValue + end + else + widgetHandler.configData[widgetName][configVar[1]] = configValue + end + if widgetApiName ~= nil and WG[widgetApiName] ~= nil and WG[widgetApiName][widgetApiFunction] ~= nil then + WG[widgetApiName][widgetApiFunction](configValue) + end +end function applyOptionValue(i, skipRedrawWindow) if options[i] == nil then return end + if options[i].restart then + changesRequireRestart = true + end + local id = options[i].id if options[i].type == 'bool' then local value = 0 @@ -818,9 +1136,20 @@ function applyOptionValue(i, skipRedrawWindow) if id == 'advmapshading' then Spring.SendCommands("AdvMapShading "..value) Spring.SetConfigInt("AdvMapShading",value) + elseif id == 'advmodelshading' then Spring.SendCommands("AdvModelShading "..value) Spring.SetConfigInt("AdvModelShading",value) + elseif id == 'normalmapping' then + Spring.SendCommands("luarules normalmapping "..value) + Spring.SetConfigInt("NormalMapping",value) + elseif id == 'lupsdynamic' then + Spring.SetConfigInt("DynamicLups",value) + elseif id == 'lupsreflectionrefraction' then + Spring.SetConfigInt("lupsreflectionrefraction",value) + elseif id == 'treewind' then + Spring.SendCommands("luarules treewind "..value) + Spring.SetConfigInt("TreeWind",value) elseif id == 'advsky' then Spring.SetConfigInt("AdvSky",value) elseif id == 'timecyclesweathereffects' then @@ -830,17 +1159,30 @@ function applyOptionValue(i, skipRedrawWindow) Spring.SendCommands("Shadows "..value) elseif id == 'vsync' then Spring.SendCommands("Vsync "..value) - Spring.SetConfigInt("Vsync",value) + Spring.SetConfigInt("VSync",value) elseif id == 'fullscreen' then + if value == 1 then + options[getOptionByID('borderless')].value = false + applyOptionValue(getOptionByID('borderless')) + local xres = tonumber(Spring.GetConfigInt('XResolutionWindowed',ssx)) + local yres = tonumber(Spring.GetConfigInt('YResolutionWindowed',ssy)) + Spring.SetConfigInt("XResolution", xres) + Spring.SetConfigInt("YResolution", yres) + else + local xres = tonumber(Spring.GetConfigInt('XResolution',ssx)) + local yres = tonumber(Spring.GetConfigInt('YResolution',ssy)) + Spring.SetConfigInt("XResolutionWindowed", xres) + Spring.SetConfigInt("YResolutionWindowed", yres) + end Spring.SendCommands("Fullscreen "..value) Spring.SetConfigInt("Fullscreen",value) elseif id == 'borderless' then Spring.SetConfigInt("WindowBorderless",value) if value == 1 then + options[getOptionByID('fullscreen')].value = false + applyOptionValue(getOptionByID('fullscreen')) Spring.SetConfigInt("WindowPosX",0) Spring.SetConfigInt("WindowPosY",0) - Spring.SetConfigInt("XResolutionWindowed",resolutionX) - Spring.SetConfigInt("YResolutionWindowed",resolutionY) Spring.SetConfigInt("WindowState",0) else Spring.SetConfigInt("WindowPosX",0) @@ -850,6 +1192,15 @@ function applyOptionValue(i, skipRedrawWindow) elseif id == 'screenedgemove' then Spring.SetConfigInt("FullscreenEdgeMove",value) Spring.SetConfigInt("WindowedEdgeMove",value) + elseif id == 'scrollinverse' then + if value == 1 then + Spring.SetConfigInt("ScrollWheelSpeed",-options[getOptionByID('scrollspeed')].value) + else + Spring.SetConfigInt("ScrollWheelSpeed",options[getOptionByID('scrollspeed')].value) + end + elseif id == 'simpleminimapcolors' then + Spring.SendCommands("minimap simplecolors "..value) + Spring.SetConfigInt("SimpleMiniMapColors",value) elseif id == 'hwcursor' then Spring.SendCommands("HardwareCursor "..value) Spring.SetConfigInt("HardwareCursor",value) @@ -857,110 +1208,75 @@ function applyOptionValue(i, skipRedrawWindow) Spring.SendCommands("fps "..value) Spring.SendCommands("clock "..value) Spring.SendCommands("speed "..value) - elseif id == 'buildmenuoldicons' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].oldUnitpics = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigOldUnitIcons(options[i].value) - end + + elseif id == 'resourcebarcoloring' then + saveOptionValue('Top Bar', 'topbar', 'setResourceBgTint', {'resourcebarBgTint'}, options[i].value) + elseif id == 'playerlistcollapse' then + saveOptionValue('AdvPlayersList', 'advplayerlist_api', 'SetCollapsable', {'collapsable'}, options[i].value) + elseif id == 'lockcamera_hideenemies' then + saveOptionValue('AdvPlayersList', 'advplayerlist_api', 'SetLockHideEnemies', {'lockcameraHideEnemies'}, options[i].value) + elseif id == 'lockcamera_los' then + saveOptionValue('AdvPlayersList', 'advplayerlist_api', 'SetLockLos', {'lockcameraLos'}, options[i].value) + elseif id == 'allyselunits_select' then + saveOptionValue('Ally Selected Units', 'allyselectedunits', 'setSelectPlayerUnits', {'selectPlayerUnits'}, options[i].value) + elseif id == 'voicenotifs_playtrackedplayernotifs' then + saveOptionValue('Voice Notifs', 'voicenotifs', 'setPlayTrackedPlayerNotifs', {'playTrackedPlayerNotifs'}, options[i].value) elseif id == 'buildmenushortcuts' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].shortcutsInfo = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigShortcutsInfo(options[i].value) - end + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigShortcutsInfo', {'shortcutsInfo'}, options[i].value) elseif id == 'buildmenuprices' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].drawPrice = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigUnitPrice(options[i].value) - end + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigUnitPrice', {'drawPrice'}, options[i].value) + elseif id == 'buildmenuradaricons' then + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigUnitRadaricon', {'drawRadaricon'}, options[i].value) elseif id == 'buildmenusounds' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].playSounds = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigPlaySounds(options[i].value) - end + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigPlaySounds', {'playSounds'}, options[i].value) elseif id == 'buildmenutooltip' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].drawTooltip = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigUnitTooltip(options[i].value) - end + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigUnitTooltip', {'drawTooltip'}, options[i].value) elseif id == 'buildmenubigtooltip' then - if widgetHandler.configData["Red Build/Order Menu"] == nil then - widgetHandler.configData["Red Build/Order Menu"] = {} - end - widgetHandler.configData["Red Build/Order Menu"].drawBigTooltip = options[i].value - if WG['red_buildmenu'] ~= nil then - WG['red_buildmenu'].setConfigUnitBigTooltip(options[i].value) - end + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigUnitBigTooltip', {'drawBigTooltip'}, options[i].value) + elseif id == 'buildmenulargeicons' then + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigLargeUnitIcons', {'largeUnitIons'}, options[i].value) + elseif id == 'nametags_icon' then + saveOptionValue('Commander Name Tags', 'nametags', 'setDrawForIcon', {'drawForIcon'}, options[i].value) elseif id == 'sameteamcolors' then - if widgetHandler.configData["Player Color Palette"] == nil then - widgetHandler.configData["Player Color Palette"] = {} - end - widgetHandler.configData["Player Color Palette"].useSameTeamColors = options[i].value - if WG['playercolorpalette'] ~= nil then - WG['playercolorpalette'].setSameTeamColors(options[i].value) - end - elseif id == 'bloomhighlights' then - if widgetHandler.configData["Bloom Shader"] == nil then - widgetHandler.configData["Bloom Shader"] = {} - end - widgetHandler.configData["Bloom Shader"].drawHighlights = options[i].value - if WG['bloom'] ~= nil then - WG['bloom'].setAdvBloom(options[i].value) - end + saveOptionValue('Player Color Palette', 'playercolorpalette', 'setSameTeamColors', {'useSameTeamColors'}, options[i].value) + elseif id == 'commandsfxfilterai' then + saveOptionValue('Commands FX', 'commandsfx', 'setFilterAI', {'filterAIteams'}, options[i].value) elseif id == 'snowmap' then - if widgetHandler.configData["Snow"] == nil then - widgetHandler.configData["Snow"] = {} - end - widgetHandler.configData["Snow"].snowMaps[Game.mapName:lower()] = options[i].value - if WG['snow'] ~= nil then - WG['snow'].setSnowMap(options[i].value) - end + saveOptionValue('Snow', 'snow', 'setSnowMap', {'snowMaps',Game.mapName:lower()}, options[i].value) elseif id == 'snowautoreduce' then - if widgetHandler.configData["Snow"] == nil then - widgetHandler.configData["Snow"] = {} - end - widgetHandler.configData["Snow"].autoReduce = options[i].value - if WG['snow'] ~= nil then - WG['snow'].setAutoReduce(options[i].value) - end + saveOptionValue('Snow', 'snow', 'setAutoReduce', {'autoReduce'}, options[i].value) + elseif id == 'dof_highquality' then + saveOptionValue('Depth of Field', 'dof', 'setHighQuality', {'highQuality'}, options[i].value) + elseif id == 'dof_autofocus' then + saveOptionValue('Depth of Field', 'dof', 'setAutofocus', {'autofocus'}, options[i].value) + elseif id == 'sun_reset' then + options[getOptionByID('sun_x')].value = defaultMapSunPos[1] + options[getOptionByID('sun_y')].value = defaultMapSunPos[2] + options[getOptionByID('sun_z')].value = defaultMapSunPos[3] + options[getOptionByID('sun_reset')].value = false + Spring.SetSunDirection(defaultMapSunPos[1],defaultMapSunPos[2],defaultMapSunPos[3]) + -- just so that map/model lighting gets updated + Spring.SetSunLighting({groundShadowDensity = gl.GetSun("shadowDensity"), modelShadowDensity = gl.GetSun("shadowDensity")}) + Spring.Echo('resetted map sun defaults') + customMapSunPos[Game.mapName] = nil elseif id == 'darkenmap_darkenfeatures' then - if widgetHandler.configData["Darken map"] == nil then - widgetHandler.configData["Darken map"] = {} - end - widgetHandler.configData["Darken map"].darkenFeatures = options[i].value - if WG['darkenmap'] ~= nil then - WG['darkenmap'].setDarkenFeatures(options[i].value) - end + saveOptionValue('Darken map', 'darkenmap', 'setDarkenFeatures', {'darkenFeatures'}, options[i].value) elseif id == 'teamplatter_skipownteam' then - if widgetHandler.configData.TeamPlatter == nil then - widgetHandler.configData.TeamPlatter = {} - end - widgetHandler.configData.TeamPlatter.skipOwnTeam = options[i].value - if WG['teamplatter'] ~= nil then - WG['teamplatter'].setSkipOwnTeam(options[i].value) - end + saveOptionValue('TeamPlatter', 'teamplatter', 'setSkipOwnTeam', {'skipOwnTeam'}, options[i].value) elseif id == 'enemyspotter_highlight' then - if widgetHandler.configData.EnemySpotter == nil then - widgetHandler.configData.EnemySpotter = {} - end - widgetHandler.configData.EnemySpotter.useXrayHighlight = options[i].value - if WG['enemyspotter'] ~= nil then - WG['enemyspotter'].setHighlight(options[i].value) - end + saveOptionValue('EnemySpotter', 'enemyspotter', 'setHighlight', {'useXrayHighlight'}, options[i].value) + elseif id == 'underconstructiongfx_shader' then + saveOptionValue('Highlight Selected Units', 'underconstructiongfx', 'setShader', {'useHighlightShader'}, options[i].value) + elseif id == 'highlightselunits_shader' then + saveOptionValue('Highlight Selected Units', 'highlightselunits', 'setShader', {'useHighlightShader'}, options[i].value) + elseif id == 'highlightselunits_teamcolor' then + saveOptionValue('Highlight Selected Units', 'highlightselunits', 'setTeamcolor', {'useTeamcolor'}, options[i].value) + elseif id == 'fancyselectedunits_secondline' then + saveOptionValue('Fancy Selected Units', 'fancyselectedunits', 'setSecondLine', {'showSecondLine'}, options[i].value) + elseif id == 'lighteffects_heatdistortion' then + saveOptionValue('Light Effects', 'lighteffects', 'setHeatDistortion', {'enableHeatDistortion'}, options[i].value) + elseif id == 'lighteffects_deferred' then + saveOptionValue('Light Effects', 'lighteffects', 'setDeferred', {'enableDeferred'}, options[i].value) elseif id == 'highlightselunits_shader' then if widgetHandler.configData["Highlight Selected Units"] == nil then widgetHandler.configData["Highlight Selected Units"] = {} @@ -970,13 +1286,9 @@ function applyOptionValue(i, skipRedrawWindow) WG['highlightselunits'].setShader(options[i].value) end elseif id == 'smartselect_includebuildings' then - if widgetHandler.configData["SmartSelect"] == nil then - widgetHandler.configData["SmartSelect"] = {} - end - widgetHandler.configData["SmartSelect"].selectBuildingsWithMobile = options[i].value - if WG['smartselect'] ~= nil then - WG['smartselect'].setIncludeBuildings(options[i].value) - end + saveOptionValue('SmartSelect', 'smartselect', 'setIncludeBuildings', {'selectBuildingsWithMobile'}, options[i].value) + elseif id == 'smartselect_includebuilders' then + saveOptionValue('SmartSelect', 'smartselect', 'setIncludeBuilders', {'includeBuilders'}, options[i].value) elseif id == 'lighteffects' then if value ~= 0 then if widgetHandler.orderList["Deferred rendering"] ~= nil then @@ -989,8 +1301,25 @@ function applyOptionValue(i, skipRedrawWindow) end widgetHandler:DisableWidget("Light Effects") end + elseif id == 'autogroup_immediate' then + if widgetHandler.configData["Auto Group"] == nil then + widgetHandler.configData["Auto Group"] = {} + end + if widgetHandler.configData["Auto Group"].config == nil then + widgetHandler.configData["Auto Group"].config = {immediate={value=options[i].value}} + else + widgetHandler.configData["Auto Group"].config.immediate.value = options[i].value + end + saveOptionValue('Auto Group', 'autogroup', 'setImmediate', {'config','immediate','value'}, options[i].value) elseif id == 'resourceprompts' then Spring.SetConfigInt("evo_resourceprompts",value) + elseif string.sub(id, 1, 19) == 'voicenotifs_' then + local sound = string.sub(id, 20) + saveOptionValue('Voice Notifs', 'voicenotifs', 'setSound'..sound, {'soundList'}, options[i].value) + elseif id == 'musicplayer' then + if value then + Spring.StopSoundStream() + end elseif id == 'simplifiedresourcebar' then Spring.SetConfigInt("evo_simplifiedresourcebar",value) elseif id == 'buildpichelp' then @@ -999,8 +1328,19 @@ function applyOptionValue(i, skipRedrawWindow) Spring.SetConfigInt("evo_dynamicmusic", value) elseif id == 'interruptmusic' then Spring.SetConfigInt("evo_interruptmusic", value) + elseif id == 'showcost' then + Spring.SetConfigInt("evo_showcost", value) + if WG.buildOrderUI then WG.buildOrderUI.updateConfigInt = true end + elseif id == 'showtechreq' then + Spring.SetConfigInt("evo_showtechreq", value) + if WG.buildOrderUI then WG.buildOrderUI.updateConfigInt = true end + elseif id == 'showhotkeys' then + Spring.SetConfigInt("evo_showhotkeys", value) + if WG.buildOrderUI then WG.buildOrderUI.updateConfigInt = true end + elseif id == 'ctrl_dequeue' then + Spring.SetConfigInt("evo_ctrl_dequeue", value) end - + if options[i].widget ~= nil then if value == 1 then if id == 'bloom' or id == 'guishader' or id == 'xrayshader' or id == 'snow' or id == 'mapedgeextension' then @@ -1014,6 +1354,9 @@ function applyOptionValue(i, skipRedrawWindow) if widgetHandler.orderList[options[i].widget] < 0.5 then widgetHandler:EnableWidget(options[i].widget) end + if id == "fancyselectedunits" and getOptionByID('fancyselectedunits_style') then + options[getOptionByID('fancyselectedunits_style')].options = WG['fancyselectedunits'].getStyleList() + end else if widgetHandler.orderList[options[i].widget] > 0 then widgetHandler:ToggleWidget(options[i].widget) @@ -1029,13 +1372,17 @@ function applyOptionValue(i, skipRedrawWindow) elseif options[i].type == 'slider' then local value = options[i].value - if id == 'fsaa' then + if id == 'msaa' then if value > 0 then - Spring.SetConfigInt("FSAA",1) + Spring.SetConfigInt("MSAALevel",1) else - Spring.SetConfigInt("FSAA",0) + Spring.SetConfigInt("MSAALevel",0) end - Spring.SetConfigInt("FSAALevel",value) + Spring.SetConfigInt("FSAALevel",0) -- engine deprecated it in 104.x + Spring.SetConfigInt("MSAALevel",value) + + elseif id == 'vsync2' then + Spring.SetConfigInt("VSync",value) elseif id == 'shadowslider' then local enabled = 1 if value == options.min then @@ -1043,31 +1390,63 @@ function applyOptionValue(i, skipRedrawWindow) end Spring.SendCommands("shadows "..enabled.." "..value) Spring.SetConfigInt("shadows", value) - elseif id == 'windowposx' then - Spring.SetConfigInt("WindowPosX ", value) - elseif id == 'windowposy' then - Spring.SetConfigInt("WindowPosY ", value) - elseif id == 'windowresx' then - Spring.SetConfigInt("XResolutionWindowed ", value) - elseif id == 'windowresy' then - Spring.SetConfigInt("YResolutionWindowed ", value) + elseif id == 'shadows_maxquality' then + if value < options[getOptionByID('shadows_minquality')].value then + options[getOptionByID('shadows_minquality')].value = value + saveOptionValue('Shadow Quality Manager', 'shadowmanager', 'setMinQuality', {'maxQuality'}, value) + end + saveOptionValue('Shadow Quality Manager', 'shadowmanager', 'setMaxQuality', {'maxQuality'}, value) + elseif id == 'shadows_minquality' then + if value > options[getOptionByID('shadows_maxquality')].value then + options[getOptionByID('shadows_maxquality')].value = value + saveOptionValue('Shadow Quality Manager', 'shadowmanager', 'setMaxQuality', {'maxQuality'}, value) + end + saveOptionValue('Shadow Quality Manager', 'shadowmanager', 'setMinQuality', {'minQuality'}, value) + elseif id == 'shadows_disablefps' then + saveOptionValue('Shadow Quality Manager', 'shadowmanager', 'setDisableFps', {'disableFps'}, value) elseif id == 'decals' then Spring.SetConfigInt("GroundDecals", value) Spring.SendCommands("GroundDecals "..value) Spring.SetConfigInt("GroundScarAlphaFade", 1) elseif id == 'scrollspeed' then - Spring.SetConfigInt("ScrollWheelSpeed",value) + if options[getOptionByID('scrollinverse')].value then + Spring.SetConfigInt("ScrollWheelSpeed",-value) + else + Spring.SetConfigInt("ScrollWheelSpeed",value) + end elseif id == 'disticon' then if Spring.GetConfigInt("distdraw",1) < 10000 then Spring.SendCommands("distdraw 10000") end Spring.SendCommands("disticon "..value) + elseif id == 'featuredrawdist' then + if getOptionByID('featurefadedist') and value < options[getOptionByID('featurefadedist')].value then + options[getOptionByID('featurefadedist')].value = value + Spring.SetConfigInt("FeatureFadeDistance",value) + end + Spring.SetConfigInt("FeatureDrawDistance",value) + elseif id == 'featurefadedist' then + if getOptionByID('featuredrawdist') and value > options[getOptionByID('featuredrawdist')].value then + options[getOptionByID('featuredrawdist')].value = value + Spring.SetConfigInt("FeatureDrawDistance",value) + end + Spring.SetConfigInt("FeatureFadeDistance",value) + elseif id == 'iconscale' then + Spring.SendCommands("luarules uniticonscale "..value) elseif id == 'treeradius' then Spring.SetConfigInt("TreeRadius",value) elseif id == 'particles' then Spring.SetConfigInt("MaxParticles",value) + + + elseif id == 'nanobeamamount' then + Spring.SetConfigInt("NanoBeamAmount",value) elseif id == 'nanoparticles' then - Spring.SetConfigInt("MaxNanoParticles",value) + maxNanoParticles = value + if getOptionByID('nanoeffect') and options[getOptionByID('nanoeffect')].value == 2 then + Spring.SetConfigInt("MaxNanoParticles",value) + end + elseif id == 'grassdetail' then Spring.SetConfigInt("GrassDetail",value) elseif id == 'grounddetail' then @@ -1084,169 +1463,156 @@ function applyOptionValue(i, skipRedrawWindow) elseif id == 'sndvolunitreply' then Spring.SetConfigInt("snd_volunitreply", value) elseif id == 'sndairabsorption' then - Spring.SetConfigInt("snd_airAbsorption", value) + Spring.SetConfigFloat("snd_airAbsorption", value) elseif id == 'sndvolmusic' then - Spring.SetConfigInt("snd_volmusic", value) + if WG['music'] and WG['music'].SetMusicVolume then + WG['music'].SetMusicVolume(value) + else + Spring.SetConfigInt("snd_volmusic", value) + end elseif id == 'crossalpha' then Spring.SendCommands("cross "..tonumber(Spring.GetConfigInt("CrossSize",1) or 10).." "..value) elseif id == 'darkenmap' then - if widgetHandler.configData["Darken map"] == nil then - widgetHandler.configData["Darken map"] = {} - end - if widgetHandler.configData["Darken map"].maps == nil then - widgetHandler.configData["Darken map"].maps = {} - end - widgetHandler.configData["Darken map"].maps[Game.mapName:lower()] = value - if WG['darkenmap'] ~= nil then - WG['darkenmap'].setMapDarkness(value) - end + saveOptionValue('Darken map', 'darkenmap', 'setMapDarkness', {'maps',Game.mapName:lower()}, value) elseif id == 'iconadjuster' then - if widgetHandler.configData["Icon adjuster"] == nil then - widgetHandler.configData["Icon adjuster"] = {} - end - widgetHandler.configData["Icon adjuster"].iconScale = value - if WG['iconadjuster'] ~= nil then - WG['iconadjuster'].setScale(value) - end + saveOptionValue('Icon adjuster', 'iconadjuster', 'setScale', {'iconScale'}, value) elseif id == 'healthbarsscale' then - if widgetHandler.configData["Health Bars"] == nil then - widgetHandler.configData["Health Bars"] = {} - end - widgetHandler.configData["Health Bars"].barScale = value - if WG['healthbars'] ~= nil then - WG['healthbars'].setScale(value) - end + saveOptionValue('Health Bars', 'healthbars', 'setScale', {'barScale'}, value) + elseif id == 'ssao_strength' then + saveOptionValue('SSAO', 'ssao', 'setStrength', {'strength'}, value) + elseif id == 'ssao_radius' then + saveOptionValue('SSAO', 'ssao', 'setRadius', {'radius'}, value) + elseif id == 'bloomdeferredbrightness' then + saveOptionValue('Bloom Shader Deferred', 'bloomdeferred', 'setBrightness', {'glowAmplifier'}, value) + elseif id == 'bloomdeferredsize' then + saveOptionValue('Bloom Shader Deferred', 'bloomdeferred', 'setBlursize', {'globalBlursizeMult'}, value) elseif id == 'bloombrightness' then - if widgetHandler.configData["Bloom Shader"] == nil then - widgetHandler.configData["Bloom Shader"] = {} - end - widgetHandler.configData["Bloom Shader"].basicAlpha = value - if WG['bloom'] ~= nil then - WG['bloom'].setBrightness(value) - end + saveOptionValue('Bloom Shader', 'bloom', 'setBrightness', {'basicAlpha'}, value) + elseif id == 'bloomsize' then + saveOptionValue('Bloom Shader', 'bloom', 'setBlursize', {'globalBlursizeMult'}, value) elseif id == 'consolemaxlines' then - if widgetHandler.configData["Red Console (In-game chat only)"] == nil then - widgetHandler.configData["Red Console (In-game chat only)"] = {} - end - if widgetHandler.configData["Red Console (In-game chat only)"].Config == nil then - widgetHandler.configData["Red Console (In-game chat only)"].Config = {} - end - if widgetHandler.configData["Red Console (In-game chat only)"].Config.console == nil then - widgetHandler.configData["Red Console (In-game chat only)"].Config.console = {} - end - widgetHandler.configData["Red Console (In-game chat only)"].Config.console.maxlines = value - if WG['red_chatonlyconsole'] ~= nil then - WG['red_chatonlyconsole'].setMaxLines(value) - end - - if widgetHandler.configData["Red Console (old)"] == nil then - widgetHandler.configData["Red Console (old)"] = {} - end - if widgetHandler.configData["Red Console (old)"].Config == nil then - widgetHandler.configData["Red Console (old)"].Config = {} - end - if widgetHandler.configData["Red Console (old)"].Config.console == nil then - widgetHandler.configData["Red Console (old)"].Config.console = {} - end - widgetHandler.configData["Red Console (old)"].Config.console.maxlines = value - if WG['red_console'] ~= nil then - WG['red_console'].setMaxLines(value) - end + saveOptionValue('Red Console (In-game chat only)', 'red_chatonlyconsole', 'setMaxLines', {'Config','console','maxlines'}, value) + saveOptionValue('Red Console (old)', 'red_console', 'setMaxLines', {'Config','console','maxlines'}, value) elseif id == 'consolefontsize' then - if widgetHandler.configData["Red Console (In-game chat only)"] == nil then - widgetHandler.configData["Red Console (In-game chat only)"] = {} - end - widgetHandler.configData["Red Console (In-game chat only)"].fontsizeMultiplier = value - if WG['red_chatonlyconsole'] ~= nil then - WG['red_chatonlyconsole'].setFontsize(value) - end - - if widgetHandler.configData["Red Console (old)"] == nil then - widgetHandler.configData["Red Console (old)"] = {} - end - widgetHandler.configData["Red Console (old)"].fontsizeMultiplier = value - if WG['red_console'] ~= nil then - WG['red_console'].setFontsize(value) - end + saveOptionValue('Red Console (In-game chat only)', 'red_chatonlyconsole', 'setFontsize', {'fontsizeMultiplier'}, value) + saveOptionValue('Red Console (old)', 'red_console', 'setFontsize', {'fontsizeMultiplier'}, value) elseif id == 'guishaderintensity' then - if widgetHandler.configData["GUI-Shader"] == nil then - widgetHandler.configData["GUI-Shader"] = {} - end - widgetHandler.configData["GUI-Shader"].blurIntensity = value - if WG['guishader_api'] ~= nil then - WG['guishader_api'].setBlurIntensity(value) - end + saveOptionValue('GUI Shader', 'guishader', 'setBlurIntensity', {'blurIntensity'}, value) + elseif id == 'guiopacity' then + Spring.SetConfigFloat("ui_opacity", value) elseif id == 'snowamount' then - if widgetHandler.configData["Snow"] == nil then - widgetHandler.configData["Snow"] = {} - end - widgetHandler.configData["Snow"].customParticleMultiplier = value - if WG['snow'] ~= nil then - WG['snow'].setMultiplier(value) - end + saveOptionValue('Snow', 'snow', 'setMultiplier', {'customParticleMultiplier'}, value) + elseif id == 'dof_focusdepth' then + saveOptionValue('Depth of Field', 'dof', 'setFocusDepth', {'focusDepth'}, value) + elseif id == 'dof_fstop' then + saveOptionValue('Depth of Field', 'dof', 'setFstop', {'fStop'}, value) + elseif id == 'sun_x' then + local sunX,sunY,sunZ = gl.GetSun("pos") + sunX = value + if sunX < options[getOptionByID('sun_x')].min then + sunX = options[getOptionByID('sun_x')].min + end + if sunX > options[getOptionByID('sun_x')].max then + sunX = options[getOptionByID('sun_x')].max + end + options[getOptionByID('sun_x')].value = sunX + Spring.SetSunDirection(sunX,sunY,sunZ) + -- just so that map/model lighting gets updated + Spring.SetSunLighting({groundShadowDensity = gl.GetSun("shadowDensity"), modelShadowDensity = gl.GetSun("shadowDensity")}) + customMapSunPos[Game.mapName] = {gl.GetSun("pos")} + elseif id == 'sun_y' then + local sunX,sunY,sunZ = gl.GetSun("pos") + sunY = value + if sunY < options[getOptionByID('sun_y')].min then + sunY = options[getOptionByID('sun_y')].min + end + if sunY > options[getOptionByID('sun_y')].max then + sunY = options[getOptionByID('sun_y')].max + end + options[getOptionByID('sun_y')].value = sunY + Spring.SetSunDirection(sunX,sunY,sunZ) + -- just so that map/model lighting gets updated + Spring.SetSunLighting({groundShadowDensity = gl.GetSun("shadowDensity"), modelShadowDensity = gl.GetSun("shadowDensity")}) + customMapSunPos[Game.mapName] = {gl.GetSun("pos")} + elseif id == 'sun_z' then + local sunX,sunY,sunZ = gl.GetSun("pos") + sunZ = value + if sunZ < options[getOptionByID('sun_z')].min then + sunZ = options[getOptionByID('sun_z')].min + end + if sunZ > options[getOptionByID('sun_z')].max then + sunZ = options[getOptionByID('sun_z')].max + end + options[getOptionByID('sun_z')].value = sunZ + Spring.SetSunDirection(sunX,sunY,sunZ) + -- just so that map/model lighting gets updated + Spring.SetSunLighting({groundShadowDensity = gl.GetSun("shadowDensity"), modelShadowDensity = gl.GetSun("shadowDensity")}) + customMapSunPos[Game.mapName] = {gl.GetSun("pos")} + elseif id == 'shadows_opacity' then + Spring.SetSunLighting({groundShadowDensity = value, modelShadowDensity = value}) + elseif id == 'fog_start' then + Spring.SetAtmosphere({fogStart = value}) + if value >= gl.GetAtmosphere("fogEnd") then + value = value + 0.0001 + options[getOptionByID('fog_end')].value = value + Spring.SetAtmosphere({fogEnd = value}) + end + elseif id == 'fog_end' then + Spring.SetAtmosphere({fogEnd = value}) + if value <= gl.GetAtmosphere("fogStart") then + value = value - 0.0001 + options[getOptionByID('fog_start')].value = value + Spring.SetAtmosphere({fogStart = value}) + end + elseif id == 'commandsfxopacity' then + saveOptionValue('Commands FX', 'commandsfx', 'setOpacity', {'opacity'}, value) + elseif id == 'minimapiconsize' then + minimapIconsize = value + Spring.SetConfigFloat("MinimapIconScale", value) + Spring.SendCommands("minimap unitsize "..value) -- spring wont remember what you set with '/minimap iconssize #' elseif id == 'lighteffects_brightness' then - if widgetHandler.configData["Light Effects"] == nil then - widgetHandler.configData["Light Effects"] = {} - end - widgetHandler.configData["Light Effects"].globalLightMult = value - if WG['lighteffects'] ~= nil then - WG['lighteffects'].setGlobalBrightness(value) - end + saveOptionValue('Light Effects', 'lighteffects', 'setGlobalBrightness', {'globalLightMult'}, value) elseif id == 'lighteffects_radius' then - if widgetHandler.configData["Light Effects"] == nil then - widgetHandler.configData["Light Effects"] = {} - end - widgetHandler.configData["Light Effects"].globalRadiusMult = value - if WG['lighteffects'] ~= nil then - WG['lighteffects'].setGlobalRadius(value) - end + saveOptionValue('Light Effects', 'lighteffects', 'setGlobalRadius', {'globalRadiusMult'}, value) elseif id == 'lighteffects_laserbrightness' then - if widgetHandler.configData["Light Effects"] == nil then - widgetHandler.configData["Light Effects"] = {} - end - widgetHandler.configData["Light Effects"].globalLightMultLaser = value - if WG['lighteffects'] ~= nil then - WG['lighteffects'].setLaserBrightness(value) - end - elseif id == 'lighteffects_radius' then - if widgetHandler.configData["Light Effects"] == nil then - widgetHandler.configData["Light Effects"] = {} - end - widgetHandler.configData["Light Effects"].globalRadiusMultLaser = value - if WG['lighteffects'] ~= nil then - WG['lighteffects'].setLaserRadius(value) - end + saveOptionValue('Light Effects', 'lighteffects', 'setLaserBrightness', {'globalLightMultLaser'}, value) + elseif id == 'lighteffects_laserradius' then + saveOptionValue('Light Effects', 'lighteffects', 'setLaserRadius', {'globalRadiusMultLaser'}, value) elseif id == 'lighteffects_life' then - if widgetHandler.configData["Light Effects"] == nil then - widgetHandler.configData["Light Effects"] = {} - end - widgetHandler.configData["Light Effects"].globalLifeMult = value - if WG['lighteffects'] ~= nil then - WG['lighteffects'].setLife(value) - end + saveOptionValue('Light Effects', 'lighteffects', 'setLife', {'globalLifeMult'}, value) elseif id == 'teamplatter_opacity' then - if widgetHandler.configData.TeamPlatter == nil then - widgetHandler.configData.TeamPlatter = {} - end - widgetHandler.configData.TeamPlatter.spotterOpacity = value - if WG['teamplatter'] ~= nil then - WG['teamplatter'].setOpacity(value) - end + saveOptionValue('TeamPlatter', 'teamplatter', 'setOpacity', {'spotterOpacity'}, value) elseif id == 'enemyspotter_opacity' then - if widgetHandler.configData.EnemySpotter == nil then - widgetHandler.configData.EnemySpotter = {} - end - widgetHandler.configData.EnemySpotter.spotterOpacity = value - if WG['enemyspotter'] ~= nil then - WG['enemyspotter'].setOpacity(value) - end + saveOptionValue('EnemySpotter', 'enemyspotter', 'setOpacity', {'spotterOpacity'}, value) + elseif id == 'outline_size' then + saveOptionValue('Outline', 'outline', 'setSize', {'BLUR_SIGMA'}, value) + elseif id == 'outline_strength' then + saveOptionValue('Outline', 'outline', 'setStrength', {'OUTLINE_STRENGTH'}, value) + elseif id == 'underconstructiongfx_opacity' then + saveOptionValue('Highlight Selected Units', 'underconstructiongfx', 'setOpacity', {'highlightAlpha'}, value) elseif id == 'highlightselunits_opacity' then - if widgetHandler.configData["Highlight Selected Units"] == nil then - widgetHandler.configData["Highlight Selected Units"] = {} - end - widgetHandler.configData["Highlight Selected Units"].highlightAlpha = value - if WG['highlightselunits'] ~= nil then - WG['highlightselunits'].setOpacity(value) + saveOptionValue('Highlight Selected Units', 'highlightselunits', 'setOpacity', {'highlightAlpha'}, value) + elseif id == 'fancyselectedunits_opacity' then + saveOptionValue('Fancy Selected Units', 'fancyselectedunits', 'setOpacity', {'spotterOpacity'}, value) + elseif id == 'fancyselectedunits_baseopacity' then + saveOptionValue('Fancy Selected Units', 'fancyselectedunits', 'setBaseOpacity', {'baseOpacity'}, value) + elseif id == 'fancyselectedunits_teamcoloropacity' then + saveOptionValue('Fancy Selected Units', 'fancyselectedunits', 'setTeamcolorOpacity', {'teamcolorOpacity'}, value) + elseif id == 'voicenotifs_volume' then + saveOptionValue('Voice Notifs', 'voicenotifs', 'setVolume', {'volume'}, value) + elseif id == 'lockcamera_transitiontime' then + saveOptionValue('AdvPlayersList', 'advplayerlist_api', 'SetLockTransitionTime', {'transitionTime'}, value) + elseif id == 'playertv_countdown' then + saveOptionValue('Player-TV', 'playertv', 'SetPlayerChangeDelay', {'playerChangeDelay'}, value) + elseif id == 'camerasmoothness' then + cameraTransitionTime = value + elseif id == 'camerapansmoothness' then + cameraPanTransitionTime = value + elseif id == 'fov' then + local current_cam_state = Spring.GetCameraState() + if (current_cam_state.fov) then + current_cam_state.fov = value + Spring.SetCameraState(current_cam_state,0) end end @@ -1256,8 +1622,38 @@ function applyOptionValue(i, skipRedrawWindow) Spring.Echo('Loading preset: '..options[i].options[value]) options[i].value = 0 loadPreset(presetNames[value]) + elseif id == 'buildordermenu' then + Spring.SetConfigInt("evo_buildorderui",(value-1)) + Spring.SendCommands("luarules reloadluaui") elseif id == 'water' then Spring.SendCommands("water "..(value-1)) + Spring.SendCommands("water "..(value-1)) + elseif id == 'lupseffectlevel' then + if WG.Lups then + Spring.SetConfigInt("LupsPriority",value) + --Spring.Echo("option for lups",value,WG.LupsPriority) + end + elseif id == 'font' then + if VFS.FileExists(LUAUI_DIRNAME..'fonts/'..options[i].optionsFont[value]) then + Spring.SetConfigString("ui_font", options[i].optionsFont[value]) + Spring.SendCommands("luarules reloadluaui") + end + elseif id == 'font2' then + if VFS.FileExists(LUAUI_DIRNAME..'fonts/'..options[i].optionsFont[value]) then + Spring.SetConfigString("ui_font2", options[i].optionsFont[value]) + Spring.SendCommands("luarules reloadluaui") + end + elseif id == 'nanoeffect' then + Spring.SetConfigInt("NanoEffect",value) + if value == 1 then + Spring.SetConfigInt("MaxNanoParticles",0) + else + Spring.SetConfigInt("MaxNanoParticles",maxNanoParticles) + end + elseif id == 'bloomdeferredquality' then + saveOptionValue('Bloom Shader Deferred', 'bloomdeferred', 'setPreset', {'qualityPreset'}, value) + elseif id == 'bloomquality' then + saveOptionValue('Bloom Shader', 'bloom', 'setPreset', {'qualityPreset'}, value) elseif id == 'camera' then Spring.SetConfigInt("CamMode",(value-1)) if value == 1 then @@ -1272,13 +1668,24 @@ function applyOptionValue(i, skipRedrawWindow) Spring.SendCommands('viewfree') end elseif id == 'cursor' then - if widgetHandler.configData["Cursors"] == nil then - widgetHandler.configData["Cursors"] = {} - end - widgetHandler.configData["Cursors"].cursorSet = options[i].options[value] - if WG['cursors'] ~= nil then - WG['cursors'].setcursor(options[i].options[value]) + saveOptionValue('Cursors', 'cursors', 'setcursor', {'cursorSet'}, options[i].options[value]) + elseif id == 'fancyselectedunits_style' then + saveOptionValue('Fancy Selected Units', 'fancyselectedunits', 'setStyle', {'currentOption'}, value) + elseif id == 'resolution' then + local resolutionX = string.match(options[i].options[options[i].value], '[0-9]*') + local resolutionY = string.gsub(string.match(options[i].options[options[i].value], 'x [0-9]*'), 'x ', '') + if tonumber(Spring.GetConfigInt("Fullscreen",1) or 1) == 1 then + Spring.SendCommands("Fullscreen 0") + Spring.SetConfigInt("XResolution", tonumber(resolutionX)) + Spring.SetConfigInt("YResolution", tonumber(resolutionY)) + Spring.SendCommands("Fullscreen 1") + else + Spring.SendCommands("Fullscreen 1") + Spring.SetConfigInt("XResolutionWindowed", tonumber(resolutionX)) + Spring.SetConfigInt("YResolutionWindowed", tonumber(resolutionY)) + Spring.SendCommands("Fullscreen 0") end + --options[i].value = 0 end end if skipRedrawWindow == nil then @@ -1287,7 +1694,6 @@ function applyOptionValue(i, skipRedrawWindow) end end - function loadPreset(preset) for optionID, value in pairs(presets[preset]) do local i = getOptionByID(optionID) @@ -1304,7 +1710,11 @@ end function widget:KeyPress(key) if key == 27 then -- ESC - show = false + if showSelectOptions then + showSelectOptions = nil + else + show = false + end end end @@ -1316,24 +1726,6 @@ function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) and y <= TRcornerY end -function widget:IsAbove(x, y) - -- on window - if show then - local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) - local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) - local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - return IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) - else - return false - end -end - -function widget:GetTooltip(mx, my) - if show and widget:IsAbove(mx,my) then - return string.format("") - end -end function round(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) @@ -1341,13 +1733,37 @@ function round(num, numDecimalPlaces) else return math.ceil(num * mult - 0.5) / mult end end + +function NearestValue(table, number) + local smallestSoFar, smallestIndex + for i, y in ipairs(table) do + if not smallestSoFar or (math.abs(number-y) < smallestSoFar) then + smallestSoFar = math.abs(number-y) + smallestIndex = i + end + end + return table[smallestIndex] +end function getSliderValue(draggingSlider, cx) local sliderWidth = optionButtons[draggingSlider].sliderXpos[2] - optionButtons[draggingSlider].sliderXpos[1] local value = (cx - optionButtons[draggingSlider].sliderXpos[1]) / sliderWidth - value = options[draggingSlider].min + ((options[draggingSlider].max - options[draggingSlider].min) * value) - if value < options[draggingSlider].min then value = options[draggingSlider].min end - if value > options[draggingSlider].max then value = options[draggingSlider].max end - if options[draggingSlider].step ~= nil then + local min, max + if options[draggingSlider].steps then + min, max = options[draggingSlider].steps[1], options[draggingSlider].steps[1] + for k, v in ipairs(options[draggingSlider].steps) do + if v > max then max = v end + if v < min then min = v end + end + else + min = options[draggingSlider].min + max = options[draggingSlider].max + end + value = min + ((max - min) * value) + if value < min then value = min end + if value > max then value = max end + if options[draggingSlider].steps ~= nil then + value = NearestValue(options[draggingSlider].steps, value) + elseif options[draggingSlider].step ~= nil then value = math.floor(value / options[draggingSlider].step) * options[draggingSlider].step end return value -- is a string now :( @@ -1389,10 +1805,14 @@ end function mouseEvent(x, y, button, release) if spIsGUIHidden() then return false end + local cx, cy = correctMouseForScaling(x,y) if show then local cx, cy = correctMouseForScaling(x,y) - if button == 3 then + if titleRect ~= nil and IsOnRect(cx, cy, titleRect[1], titleRect[2], titleRect[3], titleRect[4]) then -- showhow rightmouse doesnt get triggered :S + --Spring.Echo(button..' '..math.random()) + return true + end if showSelectOptions ~= nil and options[showSelectOptions].id == 'preset' then for i, o in pairs(optionSelect) do if IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then @@ -1472,12 +1892,34 @@ function mouseEvent(x, y, button, release) end end + + local tabClicked = false + if show and groupRect ~= nil then + for id,group in pairs(optionGroups) do + if IsOnRect(cx, cy, groupRect[id][1], groupRect[id][2], groupRect[id][3], groupRect[id][4]) then + if not release then + currentGroupTab = group.id + startColumn = 1 + showSelectOptions = nil + selectClickAllowHide = nil + if playSounds then + Spring.PlaySoundFile(paginatorclick, 0.9, 'ui') + end + end + tabClicked = true + returnTrue = true + end + end + end + -- on window local rectX1 = ((screenX-bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY1 = ((screenY+bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) local rectX2 = ((screenX+screenWidth+bgMargin) * widgetScale) - ((vsx * (widgetScale-1))/2) local rectY2 = ((screenY-screenHeight-bgMargin) * widgetScale) - ((vsy * (widgetScale-1))/2) - if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + if tabClicked then + + elseif IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then if release then @@ -1510,6 +1952,7 @@ function mouseEvent(x, y, button, release) end end else -- mousepress + if not showSelectOptions then for i, o in pairs(optionButtons) do if options[i].type == 'slider' and (IsOnRect(cx, cy, o.sliderXpos[1], o[2], o.sliderXpos[2], o[4]) or IsOnRect(cx, cy, o[1], o[2], o[3], o[4])) then @@ -1540,7 +1983,12 @@ function mouseEvent(x, y, button, release) if button == 1 or button == 3 then return true end - elseif titleRect == nil or not IsOnRect(x, y, (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2), (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2)) then + -- on title + elseif titleRect ~= nil and IsOnRect(x, y, (titleRect[1] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[2] * widgetScale) - ((vsy * (widgetScale-1))/2), (titleRect[3] * widgetScale) - ((vsx * (widgetScale-1))/2), (titleRect[4] * widgetScale) - ((vsy * (widgetScale-1))/2)) then + --currentGroupTab = nil + --startColumn = 1 + returnTrue = true + elseif not tabClicked then if release and draggingSlider == nil then showOnceMore = true -- show once more because the guishader lags behind, though this will not fully fix it show = false @@ -1552,6 +2000,9 @@ function mouseEvent(x, y, button, release) if windowList then gl.DeleteList(windowList) end windowList = gl.CreateList(DrawWindow) end + if returnTrue then + return true + end end elseif showOptionsToggleButton then tx = (x - posX*vsx)/(17*widgetScale) @@ -1583,191 +2034,265 @@ function GetWidgetToggleValue(widgetname) end end - -function loadWidgetConfigData() - local changes = false - - if widgetHandler.configData["Health Bars"] ~= nil and widgetHandler.configData["Health Bars"].basicAlpha ~= nil then - if options[getOptionByID("healthbarsscale")].value ~= widgetHandler.configData["Health Bars"].barScale then - options[getOptionByID("healthbarsscale")].value = widgetHandler.configData["Health Bars"].barScale - changes = true +-- configVar = table, add more entries the deeper the configdata table var is: example: {'Config','console','maxlines'} (limit = 3 deep) +function loadWidgetData(widgetName, optionId, configVar) + if widgetHandler.knownWidgets[widgetName] ~= nil then + if getOptionByID(optionId) and widgetHandler.configData[widgetName] ~= nil and widgetHandler.configData[widgetName][configVar[1]] ~= nil then + if configVar[2] ~= nil and widgetHandler.configData[widgetName][configVar[1]][configVar[2]] ~= nil then + if configVar[3] ~= nil and widgetHandler.configData[widgetName][configVar[1]][configVar[2]][configVar[3]] ~= nil then + options[getOptionByID(optionId)].value = widgetHandler.configData[widgetName][configVar[1]][configVar[2]][configVar[3]] + return true + else + options[getOptionByID(optionId)].value = widgetHandler.configData[widgetName][configVar[1]][configVar[2]] + return true + end + elseif options[getOptionByID(optionId)].value ~= widgetHandler.configData[widgetName][configVar[1]] then + options[getOptionByID(optionId)].value = widgetHandler.configData[widgetName][configVar[1]] + return true + end end end +end - if widgetHandler.configData["Bloom Shader"] ~= nil and widgetHandler.configData["Bloom Shader"].basicAlpha ~= nil then - if options[getOptionByID("bloombrightness")].value ~= widgetHandler.configData["Bloom Shader"].basicAlpha then - options[getOptionByID("bloombrightness")].value = widgetHandler.configData["Bloom Shader"].basicAlpha - changes = true - end - end - if widgetHandler.configData["Bloom Shader"] ~= nil and widgetHandler.configData["Bloom Shader"].drawHighlights ~= nil then - if options[getOptionByID("bloomhighlights")].value ~= widgetHandler.configData["Bloom Shader"].drawHighlights then - options[getOptionByID("bloomhighlights")].value = widgetHandler.configData["Bloom Shader"].drawHighlights - changes = true - end - end - if widgetHandler.configData["Red Console (In-game chat only)"] ~= nil and widgetHandler.configData["Red Console (In-game chat only)"].Config ~= nil and widgetHandler.configData["Red Console (In-game chat only)"].Config.console ~= nil and widgetHandler.configData["Red Console (In-game chat only)"].Config.console.maxlines ~= nil then - if options[getOptionByID("consolemaxlines")].value ~= widgetHandler.configData["Red Console (In-game chat only)"].Config.console.maxlines then - options[getOptionByID("consolemaxlines")].value = widgetHandler.configData["Red Console (In-game chat only)"].Config.console.maxlines - changes = true - end - end +-- loads values via stored game config in luaui/configs +function loadAllWidgetData() + loadWidgetData("Health Bars", "healthbarsscale", {'barScale'}) + loadWidgetData("Shadow Quality Manager", "shadows_maxquality", {'maxQuality'}) + loadWidgetData("Shadow Quality Manager", "shadows_minquality", {'minQuality'}) + loadWidgetData("Shadow Quality Manager", "shadows_disablefps", {'disableFps'}) - if widgetHandler.configData["Red Console (In-game chat only)"] ~= nil and widgetHandler.configData["Red Console (In-game chat only)"].fontsizeMultiplier ~= nil then - if options[getOptionByID("consolefontsize")].value ~= widgetHandler.configData["Red Console (In-game chat only)"].fontsizeMultiplier then - options[getOptionByID("consolefontsize")].value = widgetHandler.configData["Red Console (In-game chat only)"].fontsizeMultiplier - changes = true - end - end + loadWidgetData("SSAO", "ssao_strength", {'strength'}) + loadWidgetData("SSAO", "ssao_radius", {'radius'}) - if widgetHandler.configData["GUI-Shader"] ~= nil and widgetHandler.configData["GUI-Shader"].blurIntensity ~= nil then - if options[getOptionByID("guishaderintensity")].value ~= widgetHandler.configData["GUI-Shader"].blurIntensity then - options[getOptionByID("guishaderintensity")].value = widgetHandler.configData["GUI-Shader"].blurIntensity - changes = true - end - end + loadWidgetData("Bloom Shader Deferred", "bloomdeferredbrightness", {'glowAmplifier'}) + loadWidgetData("Bloom Shader Deferred", "bloomdeferredsize", {'qualityBlursizeMult'}) + loadWidgetData("Bloom Shader Deferred", "bloomdeferredquality", {'qualityPreset'}) - if widgetHandler.configData["Snow"] ~= nil and widgetHandler.configData["Snow"].customParticleMultiplier ~= nil then - if options[getOptionByID("snowamount")].value ~= widgetHandler.configData["Snow"].customParticleMultiplier then - options[getOptionByID("snowamount")].value = widgetHandler.configData["Snow"].customParticleMultiplier - changes = true - end - end - if widgetHandler.configData["Snow"] ~= nil and widgetHandler.configData["Snow"].snowMaps ~= nil and widgetHandler.configData["Snow"].snowMaps[Game.mapName:lower()] ~= nil then - if options[getOptionByID("snowmap")].value ~= widgetHandler.configData["Snow"].snowMaps[Game.mapName:lower()] then - options[getOptionByID("snowmap")].value = widgetHandler.configData["Snow"].snowMaps[Game.mapName:lower()] - changes = true - end - end - if widgetHandler.configData["Snow"] ~= nil and widgetHandler.configData["Snow"].autoReduce ~= nil then - if options[getOptionByID("snowautoreduce")].value ~= widgetHandler.configData["Snow"].autoReduce then - options[getOptionByID("snowautoreduce")].value = widgetHandler.configData["Snow"].autoReduce - changes = true - end - end - if widgetHandler.configData.TeamPlatter ~= nil and widgetHandler.configData.TeamPlatter.spotterOpacity ~= nil then - if options[getOptionByID("teamplatter_opacity")].value ~= widgetHandler.configData.TeamPlatter.spotterOpacity then - options[getOptionByID("teamplatter_opacity")].value = widgetHandler.configData.TeamPlatter.spotterOpacity - changes = true - end - end - if widgetHandler.configData.TeamPlatter ~= nil and widgetHandler.configData.TeamPlatter.skipOwnTeam ~= nil then - if options[getOptionByID("teamplatter_skipownteam")].value ~= widgetHandler.configData.TeamPlatter.skipOwnTeam then - options[getOptionByID("teamplatter_skipownteam")].value = widgetHandler.configData.TeamPlatter.skipOwnTeam - changes = true - end - end + loadWidgetData("Bloom Shader", "bloombrightness", {'basicAlpha'}) + loadWidgetData("Bloom Shader", "bloomsize", {'globalBlursizeMult'}) + loadWidgetData("Bloom Shader", "bloomquality", {'qualityPreset'}) - if widgetHandler.configData.EnemySpotter ~= nil and widgetHandler.configData.EnemySpotter.spotterOpacity ~= nil then - if options[getOptionByID("enemyspotter_opacity")].value ~= widgetHandler.configData.EnemySpotter.spotterOpacity then - options[getOptionByID("enemyspotter_opacity")].value = widgetHandler.configData.EnemySpotter.spotterOpacity - changes = true - end - end - if widgetHandler.configData.EnemySpotter ~= nil and widgetHandler.configData.EnemySpotter.useXrayHighlight ~= nil then - if options[getOptionByID("enemyspotter_highlight")] ~= nil and options[getOptionByID("enemyspotter_highlight")].value ~= widgetHandler.configData.EnemySpotter.useXrayHighlight then - options[getOptionByID("enemyspotter_highlight")].value = widgetHandler.configData.EnemySpotter.useXrayHighlight - changes = true - end - end + loadWidgetData("Red Console (In-game chat only)", "consolemaxlines", {'Config','console','maxlines'}) + loadWidgetData("Red Console (In-game chat only)", "consolefontsize", {'fontsizeMultiplier'}) + + loadWidgetData("AdvPlayersList", "lockcamera_hideenemies", {'lockcameraHideEnemies'}) + loadWidgetData("AdvPlayersList", "lockcamera_los", {'lockcameraLos'}) + loadWidgetData("AdvPlayersList", "lockcamera_transitiontime", {'transitionTime'}) + loadWidgetData("AdvPlayersList", "playerlistcollapse", {'collapsable'}) + + loadWidgetData("Top Bar", "resourcebarcoloring", {'resourcebarBgTint'}) + + loadWidgetData("Commander Name Tags", "nametags_icon", {'drawForIcon'}) + + loadWidgetData("Ally Selected Units", "allyselunits_select", {'selectPlayerUnits'}) + + loadWidgetData("Voice Notifs", "voicenotifs_playtrackedplayernotifs", {'playTrackedPlayerNotifs'}) + + loadWidgetData("GUI Shader", "guishaderintensity", {'blurIntensity'}) + + loadWidgetData("Depth of Field", "dof_focusdepth", {'focusDepth'}) + loadWidgetData("Depth of Field", "dof_fstop", {'fStop'}) + loadWidgetData("Depth of Field", "dof_highquality", {'highQuality'}) + loadWidgetData("Depth of Field", "dof_autofocus", {'autofocus'}) + + loadWidgetData("Snow", "snowamount", {'customParticleMultiplier'}) + loadWidgetData("Snow", "snowmap", {'snowMaps',Game.mapName:lower()}) + loadWidgetData("Snow", "snowautoreduce", {'autoReduce'}) + + loadWidgetData("Commands FX", "commandsfxopacity", {'opacity'}) + loadWidgetData("Commands FX", "commandsfxfilterai", {'filterAIteams'}) + + loadWidgetData("TeamPlatter", "teamplatter_opacity", {'spotterOpacity'}) + loadWidgetData("TeamPlatter", "teamplatter_skipownteam", {'skipOwnTeam'}) + + loadWidgetData("EnemySpotter", "enemyspotter_opacity", {'spotterOpacity'}) + loadWidgetData("EnemySpotter", "enemyspotter_highlight", {'useXrayHighlight'}) + + loadWidgetData("Outline", "outline_size", {'BLUR_SIGMA'}) + loadWidgetData("Outline", "outline_strength", {'OUTLINE_STRENGTH'}) + + loadWidgetData("Under construction gfx", "underconstructiongfx_opacity", {'highlightAlpha'}) + loadWidgetData("Under construction gfx", "underconstructiongfx_shader", {'useHighlightShader'}) + + loadWidgetData("Highlight Selected Units", "highlightselunits_opacity", {'highlightAlpha'}) + loadWidgetData("Highlight Selected Units", "highlightselunits_shader", {'useHighlightShader'}) + loadWidgetData("Highlight Selected Units", "highlightselunits_teamcolor", {'useTeamcolor'}) + + loadWidgetData("Fancy Selected Units", "fancyselectedunits_style", {'currentOption'}) + loadWidgetData("Fancy Selected Units", "fancyselectedunits_opacity", {'spotterOpacity'}) + loadWidgetData("Fancy Selected Units", "fancyselectedunits_baseopacity", {'baseOpacity'}) + loadWidgetData("Fancy Selected Units", "fancyselectedunits_teamcoloropacity", {'teamcolorOpacity'}) + loadWidgetData("Fancy Selected Units", "fancyselectedunits_secondline", {'showSecondLine'}) + + loadWidgetData("Voice Notifs", "voicenotifs_volume", {'volume'}) + + loadWidgetData("Defense Range", "defrange_allyair", {'enabled','ally','air'}) + loadWidgetData("Defense Range", "defrange_allyground", {'enabled','ally','ground'}) + loadWidgetData("Defense Range", "defrange_allynuke", {'enabled','ally','nuke'}) + loadWidgetData("Defense Range", "defrange_enemyair", {'enabled','enemy','air'}) + loadWidgetData("Defense Range", "defrange_enemyground", {'enabled','enemy','ground'}) + loadWidgetData("Defense Range", "defrange_enemynuke", {'enabled','enemy','nuke'}) + + loadWidgetData("Light Effects", "lighteffects_brightness", {'globalLightMult'}) + loadWidgetData("Light Effects", "lighteffects_radius", {'globalRadiusMult'}) + loadWidgetData("Light Effects", "lighteffects_laserbrightness", {'globalLightMultLaser'}) + loadWidgetData("Light Effects", "lighteffects_laserradius", {'globalRadiusMultLaser'}) + loadWidgetData("Light Effects", "lighteffects_life", {'globalLifeMult'}) + loadWidgetData("Light Effects", "lighteffects_heatdistortion", {'enableHeatDistortion'}) + loadWidgetData("Light Effects", "lighteffects_deferred", {'enableDeferred'}) + + loadWidgetData("Auto Group", "autogroup_immediate", {'config','immediate','value'}) - if widgetHandler.configData["Light Effects"] ~= nil and widgetHandler.configData["Light Effects"].globalLightMult ~= nil then - if options[getOptionByID("lighteffects_brightness")].value ~= widgetHandler.configData["Light Effects"].globalLightMult then - options[getOptionByID("lighteffects_brightness")].value = widgetHandler.configData["Light Effects"].globalLightMult - changes = true - end - end - if widgetHandler.configData["Light Effects"] ~= nil and widgetHandler.configData["Light Effects"].globalLightMult ~= nil then - if options[getOptionByID("lighteffects_radius")].value ~= widgetHandler.configData["Light Effects"].globalRadiusMult then - options[getOptionByID("lighteffects_radius")].value = widgetHandler.configData["Light Effects"].globalRadiusMult - changes = true - end - end - if widgetHandler.configData["Light Effects"] ~= nil and widgetHandler.configData["Light Effects"].globalLightMultLaser ~= nil then - if options[getOptionByID("lighteffects_laserbrightness")].value ~= widgetHandler.configData["Light Effects"].globalLightMultLaser then - options[getOptionByID("lighteffects_laserbrightness")].value = widgetHandler.configData["Light Effects"].globalLightMultLaser - changes = true - end - end - if widgetHandler.configData["Light Effects"] ~= nil and widgetHandler.configData["Light Effects"].globalRadiusMultLaser ~= nil then - if options[getOptionByID("lighteffects_laserradius")].value ~= widgetHandler.configData["Light Effects"].globalRadiusMultLaser then - options[getOptionByID("lighteffects_laserradius")].value = widgetHandler.configData["Light Effects"].globalRadiusMultLaser - changes = true - end - end - if widgetHandler.configData["Light Effects"] ~= nil and widgetHandler.configData["Light Effects"].globalLifeMult ~= nil then - if options[getOptionByID("lighteffects_life")].value ~= widgetHandler.configData["Light Effects"].globalLifeMult then - options[getOptionByID("lighteffects_life")].value = widgetHandler.configData["Light Effects"].globalLifeMult - changes = true - end - end return changes end +function lines(str) + local t = {} + local function helper(line) table.insert(t, line) return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t +end function init() + + local supportedResolutions = {} + local infolog = VFS.LoadFile("infolog.txt") + if infolog then + local fileLines = lines(infolog) + for i, line in ipairs(fileLines) do + if addResolutions then + local resolution = string.match(line, '[0-9]*x[0-9]*') + if resolution and string.len(resolution) >= 7 then + local resolution = string.gsub(resolution, "x", " x ") + local resolutionX = string.match(resolution, '[0-9]*') + local resolutionY = string.gsub(string.match(resolution, 'x [0-9]*'), 'x ', '') + if tonumber(resolutionX) >= 640 and tonumber(resolutionY) >= 480 then + supportedResolutions[#supportedResolutions+1] = resolution + end + else + break + end + end + if string.find(line, ' display=') then + if addResolutions then + break + end + addResolutions = true + end + end + end + -- if you want to add an option it should be added here, and in applyOptionValue(), if option needs shaders than see the code below the options definition optionGroups = { - {id='preset', name='Preset'}, {id='gfx', name='Graphics'}, - {id='control', name='Control'}, - {id='snd', name='Sound'}, {id='ui', name='Interface'}, + {id='snd', name='Sound'}, + {id='control', name='Control'}, {id='game', name='Game'}, } + if not currentGroupTab or Spring.GetGameFrame() == 0 then + currentGroupTab = optionGroups[1].id + else + -- check if group exists + local found = false + for id,group in pairs(optionGroups) do + if group.id == currentGroupTab then + found = true + break + end + end + if not found then + currentGroupTab = optionGroups[1].id + end + end + options = { -- PRESET - {id="preset", group="preset", name="Load graphics preset", type="select", options=presetNames, value=0, description='This wont set the preset every time you restart a game. So feel free to adjust things.\n\nSave custom preset with /savepreset name\nRightclick to delete a custom preset'}, + {id="preset", group="gfx", name="Load graphics preset", type="select", options=presetNames, value=0, description='This wont set the preset every time you restart a game. So feel free to adjust things.\n\nSave custom preset with /savepreset name\nRightclick to delete a custom preset'}, --GFX - --{id="windowposx", group="gfx", name="Window position X", type="slider", min=0, max=math.ceil(ssx/3), step=1, value=tonumber(Spring.GetConfigInt("WindowPosX",1) or 0), description='Set where on the screen the window is positioned on the X axis'}, - --{id="windowposy", group="gfx", name="Window position Y", type="slider", min=0, max=math.ceil(ssy/3), step=1, value=tonumber(Spring.GetConfigInt("WindowPosY",1) or 0), description='Set where on the screen the window is positioned on the Y axis'}, - --{id="windowresx", group="gfx", name="Window resolution X", type="slider", min=math.floor(ssx/3), max=ssx, step=1, value=tonumber(Spring.GetConfigInt("XResolutionWindowed",1) or 0), description='Set where on the screen the window is positioned on the X axis'}, - --{id="windowresy", group="gfx", name="Window resolution Y", type="slider", min=math.floor(ssy/3), max=ssy, step=1, value=tonumber(Spring.GetConfigInt("YResolutionWindowe",1) or 0), description='Set where on the screen the window is positioned on the Y axis'}, + {id="resolution", group="gfx", name="Resolution", type="select", options=supportedResolutions, value=0, description='WARNING: sometimes freezes game engine in windowed mode'}, {id="fullscreen", group="gfx", name="Fullscreen", type="bool", value=tonumber(Spring.GetConfigInt("Fullscreen",1) or 1) == 1}, - {id="borderless", group="gfx", name=" Borderless window", type="bool", value=tonumber(Spring.GetConfigInt("WindowBorderless",1) or 1) == 1, description="Changes will be applied next game.\n\n(dont forget to turn off the \'fullscreen\' option next game)"}, - {id="vsync", group="gfx", name="V-sync", type="bool", value=tonumber(Spring.GetConfigInt("Vsync",1) or 1) == 1, description=''}, - {id="fsaa", group="gfx", name="Anti Aliasing", type="slider", min=0, max=16, step=1, value=tonumber(Spring.GetConfigInt("FSAALevel",1) or 2), description='Changes will be applied next game'}, + {id="borderless", group="gfx", name="Borderless window", type="bool", value=tonumber(Spring.GetConfigInt("WindowBorderless",1) or 1) == 1, description="Changes will be applied next game.\n\n(dont forget to turn off the \'fullscreen\' option next game)"}, + {id="windowpos", group="gfx", widget="Move Window Position", name="Move window position", type="bool", value=GetWidgetToggleValue("Move Window Position"), description='Toggle and move window position with the arrow keys or by dragging'}, + {id="vsync", group="gfx", name="V-sync", type="bool", value=tonumber(Spring.GetConfigInt("VSync",1) or 1) == 1, description=''}, + {id="msaa", group="gfx", name="Anti Aliasing", type="slider", steps={0,1,2,4,8,16}, restart=true, value=tonumber(Spring.GetConfigInt("MSAALevel",1) or 8), description='Enables multisample anti-aliasing. NOTE: Can be expensive!\n\nChanges will be applied next game'}, {id="advmapshading", group="gfx", name="Advanced map shading", type="bool", value=tonumber(Spring.GetConfigInt("AdvMapShading",1) or 1) == 1, description='When disabled: map shadows aren\'t rendered as well'}, {id="advmodelshading", group="gfx", name="Advanced model shading", type="bool", value=tonumber(Spring.GetConfigInt("AdvModelShading",1) or 1) == 1}, - {id="advsky", group="gfx", name="Advanced sky", type="bool", value=tonumber(Spring.GetConfigInt("AdvSky",1) or 1) == 1, description='Enables high resolution clouds\n\nChanges will be applied next game'}, + {id="advsky", group="gfx", name="Advanced sky", type="bool", restart=true, value=tonumber(Spring.GetConfigInt("AdvSky",1) or 1) == 1, description='Enables high resolution clouds\n\nChanges will be applied next game'}, -- only one of these shadow options are shown, depending if "Shadow Quality Manager" widget is active {id="shadows", group="gfx", name="Shadows", type="bool", value=tonumber(Spring.GetConfigInt("Shadows",1) or 1) == 1, description='Shadow detail is currently controlled by "Shadow Quality Manager" widget\n...this widget will auto reduce detail when fps gets low.\n\nShadows requires "Advanced map shading" option to be enabled'}, - {id="shadowslider", group="gfx", name="Shadows", type="slider", min=2048, max=8192, step=500, value=tonumber(Spring.GetConfigInt("ShadowMapSize",1) or 2048), description='Set shadow detail\nSlider positioned the very left means shadows will be disabled\n\nShadows requires "Advanced map shading" option to be enabled'}, + {id="shadowslider", group="gfx", name="Shadows", type="slider", steps={1024,2048,4096,8192}, value=tonumber(Spring.GetConfigInt("ShadowMapSize",1) or 4096), description='Set shadow detail'}, + {id="shadows_maxquality", group="gfx", name=widgetOptionColor.." max quality", min=1024, max=8192, step=1024, type="slider", value=8192, description='Maximum shadow detail when having high Frames Per Second'}, + {id="shadows_minquality", group="gfx", name=widgetOptionColor.." min quality", min=1024, max=8192, step=1024, type="slider", value=1024, description='Minimum shadow detail when having low Frames Per Second'}, + --{id="shadows_disablefps", group="gfx", name=widgetOptionColor.." disable at FPS", min=0, max=30, step=1, type="slider", value=0, description='Automaticly disables shadows at this average FPS value'}, + + {id="shadows_opacity", group="gfx", name=widgetOptionColor.." opacity", type="slider", min=0.3, max=1, step=0.01, value=gl.GetSun("shadowDensity"), description=''}, {id="decals", group="gfx", name="Ground decals", type="slider", min=0, max=5, step=1, value=tonumber(Spring.GetConfigInt("GroundDecals",1) or 1), description='Set how long map decals will stay.\n\nDecals are ground scars, footsteps/tracks and shading under buildings'}, - {id="grounddetail", group="gfx", name="Ground detail", type="slider", min=32, max=200, step=1, value=tonumber(Spring.GetConfigInt("GroundDetail",1) or 64), description='Set how detailed the map mesh/model is'}, - {id="mapedgeextension", group="gfx", widget="Map Edge Extension", name="Map edge extension", type="bool", value=GetWidgetToggleValue("Map Edge Extension"), description='Mirrors the map at screen edges and darkens and decolorizes them\n\nEnable shaders for best result'}, - {id="grassdetail", group="gfx", name="Grass", type="slider", min=0, max=10, step=1, value=tonumber(Spring.GetConfigInt("GrassDetail",0) or 0), description='Amount of grass rendered\n\nChanges will be applied next game'}, + {id="grounddetail", group="gfx", name="Ground detail", type="slider", min=32, max=200, step=1, value=tonumber(Spring.GetConfigInt("GroundDetail",1) or 1), description='Set how detailed the map mesh/model is. Note that detail over 120 is largely unnoticeable.\n64 is a good default amount for playing that will not cost unnecessary fps.'}, {id="water", group="gfx", name="Water type", type="select", options={'basic','reflective','dynamic','reflective&refractive','bump-mapped'}, value=(tonumber(Spring.GetConfigInt("Water",1) or 1)+1)}, - {id="bloom", group="gfx", widget="Bloom Shader", name="Bloom", type="bool", value=GetWidgetToggleValue("Bloom Shader"), description='Bloom will make the map and units glow'}, - {id="bloombrightness", group="gfx", name=widgetOptionColor.." brightness", type="slider", min=0.25, max=0.75, step=0.05, value=0.4, description=''}, - {id="bloomhighlights", group="gfx", name=widgetOptionColor.." highlights", type="bool", value=false, description=''}, + {id="bloomdeferred", group="gfx", widget="Bloom Shader Deferred", name="Bloom (unit)", type="bool", value=GetWidgetToggleValue("Bloom Shader Deferred"), description='Unit highlights and lights will glow.\n\n(via deferred rendering = less lag)'}, + {id="bloomdeferredbrightness", group="gfx", name=widgetOptionColor.." brightness", type="slider", min=0.4, max=1.1, step=0.05, value=1, description=''}, + --{id="bloomdeferredsize", group="gfx", name=widgetOptionColor.." size", type="slider", min=0.8, max=1.5, step=0.05, value=1, description=''}, + --{id="bloomdeferredquality", group="gfx", name=widgetOptionColor.." quality", type="select", options={'low','medium'}, value=1, description='Render quality'}, - {id="darkenmap", group="gfx", name="Darken map", min=0, max=0.5, step=0.01, type="slider", value=0, description='Darkens the whole map (not the units)\n\nRemembers setting per map\nUse /resetmapdarkness if you want to reset all stored map settings'}, - {id="darkenmap_darkenfeatures", group="gfx", name=widgetOptionColor.." Darken features with map", type="bool", value=false, description='Darkens features (trees, wrecks, ect..) along with darken map slider above\n\nNOTE: This setting can be CPU intensive because it cycles through all visible features \nand renders then another time.'}, + {id="bloom", group="gfx", widget="Bloom Shader", name="Bloom (global)", type="bool", value=GetWidgetToggleValue("Bloom Shader"), description='Bloom will make the map and units glow\n\n(might result in more laggy experience)'}, + {id="bloombrightness", group="gfx", name=widgetOptionColor.." brightness", type="slider", min=0.15, max=0.5, step=0.05, value=0.25, description=''}, + --{id="bloomsize", group="gfx", name=widgetOptionColor.." size", type="slider", min=0.9, max=1.5, step=0.05, value=1.1, description=''}, + --{id="bloomquality", group="gfx", name=widgetOptionColor.." quality", type="select", options={'low','medium'}, value=1, description='Render quality'}, + {id="mapedgeextension", group="gfx", widget="Map Edge Extension", name="Map edge extension", type="bool", value=GetWidgetToggleValue("Map Edge Extension"), description='Mirrors the map at screen edges and darkens and decolorizes them\n\nEnable shaders for best result'}, + --{id="grassdetail", group="gfx", name="Grass", type="slider", min=0, max=10, step=1, value=tonumber(Spring.GetConfigInt("GrassDetail",1) or 5), description='Amount of grass rendered\n\nChanges will be applied next game'}, + + {id="darkenmap", group="gfx", name="Darken map", min=0, max=0.5, step=0.01, type="slider", value=0, description='Darkens the whole map (not the units)\n\nRemembers setting per map\nUse /resetmapdarkness if you want to reset all stored map settings'}, + {id="darkenmap_darkenfeatures", group="gfx", name=widgetOptionColor.." darken features", type="bool", value=false, description='Darkens features (trees, wrecks, ect..) along with darken map slider above\n\nNOTE: Can be CPU intensive: it cycles through all visible features \nand renders them another time.'}, + + {id="sun_y", group="gfx", name="Sun height", type="slider", min=0.05, max=0.9999, step=0.0001, value=select(2,gl.GetSun("pos")), description=''}, + {id="sun_x", group="gfx", name=widgetOptionColor.." pos X", type="slider", min=-0.9999, max=0.9999, step=0.0001, value=select(1,gl.GetSun("pos")), description=''}, + {id="sun_z", group="gfx", name=widgetOptionColor.." pos Z", type="slider", min=-0.9999, max=0.9999, step=0.0001, value=select(3,gl.GetSun("pos")), description=''}, + {id="sun_reset", group="gfx", name=widgetOptionColor.." reset map default", type="bool", value=false, description=''}, + + {id="ssao", group="gfx", widget="SSAO", name="SSAO", type="bool", value=GetWidgetToggleValue("SSAO"), description='Screen-Space Ambient Occlusion.'}, + {id="ssao_strength", group="gfx", name=widgetOptionColor.." strength", type="slider", min=1, max=5, step=0.05, value=3.5, description=''}, + {id="ssao_radius", group="gfx", name=widgetOptionColor.." radius", type="slider", min=4, max=7, step=1, value=4, description=''}, + + {id="dof", group="gfx", widget="Depth of Field", name="Depth of Field", type="bool", value=GetWidgetToggleValue("Depth of Field"), description='Applies out of focus blur'}, + {id="dof_autofocus", group="gfx", name=widgetOptionColor.." autofocus", type="bool", value=true, description='Disable to have mouse position focus'}, + --{id="dof_focusdepth", group="gfx", name=widgetOptionColor.." focus depth", type="slider", min=0, max=2000, step=1, value=300, description=''}, + {id="dof_fstop", group="gfx", name=widgetOptionColor.." f-stop", type="slider", min=1, max=16, step=0.1, value=3, description='Set amount of blur\n\nOnly works if autofocus is off'}, + --{id="dof_highquality", group="gfx", name=widgetOptionColor.." high quality", type="bool", value=false, description=''}, + + {id="outline", group="gfx", widget="Outline", name="Unit outline", type="bool", value=GetWidgetToggleValue("Outline"), description='Adds a small outline to all units which makes them crisp.'}, + {id="outline_size", group="gfx", name=widgetOptionColor.." size", min=0.5, max=3, step=0.05, type="slider", value=1, description='Set the size of the outline'}, + --{id="outline_strength", group="gfx", name=widgetOptionColor.." opacity", min=1, max=6, step=0.05, type="slider", value=2.5, description='Set the opacity of the outline'}, + + {id="disticon", group="gfx", name="Strategic icon distance", type="slider", min=0, max=900, step=10, value=tonumber(Spring.GetConfigInt("UnitIconDist",1) or 400), description='Set a lower value to get better performance'}, + {id="iconscale", group="gfx", name=widgetOptionColor.." scale", type="slider", min=0.85, max=1.35, step=0.05, value=tonumber(Spring.GetConfigFloat("UnitIconScale",1.15) or 1.05), description='Note that the minimap icon size is affected as well'}, + {id="minimapiconsize", group="gfx", name=widgetOptionColor.." minimap scale", type="slider", min=1.5, max=5, step=0.25, value=tonumber(Spring.GetConfigFloat("MinimapIconScale",3.5) or 1), description=''}, + + {id="featuredrawdist", group="gfx", name="Feature draw distance", type="slider", min=2500, max=15000, step=500, value=tonumber(Spring.GetConfigInt("FeatureDrawDistance",6000) or 400), description='Features (trees, stones, wreckage) stop being displayed at this distance'}, + {id="lighteffects", group="gfx", name="Light effects", type="bool", value=GetWidgetToggleValue("Light Effects"), description='Adds lights to projectiles, lasers and explosions.\n\nRequires shaders.'}, + --{id="lighteffects_deferred", group="gfx", name=widgetOptionColor.." real map and model lights", type="bool", value=true, description='Otherwise simple ground flashes instead of actual map and model lighting.\n\nExpensive for the gpu when lots of (big) lights are there or when you zoom in on them.'}, + --{id="lighteffects_heatdistortion", group="gfx", name=widgetOptionColor.." apply heat distortion", type="bool", value=true, description='Enables a distortion on top of explosions to simulate heat'}, {id="lighteffects_life", group="gfx", name=widgetOptionColor.." lifetime", min=0.25, max=1, step=0.05, type="slider", value=0.6, description='lifetime of explosion lights'}, {id="lighteffects_brightness", group="gfx", name=widgetOptionColor.." brightness", min=1, max=5, step=0.1, type="slider", value=2.5, description='Set the brightness of the lights'}, - {id="lighteffects_radius", group="gfx", name=widgetOptionColor.." radius (gpu intensive)", min=1, max=2, step=0.1, type="slider", value=1.2, description='Set the radius of the lights\n\nWARNING: the bigger the radius the heavier on the GPU'}, + {id="lighteffects_radius", group="gfx", name=widgetOptionColor.." radius", min=1, max=2, step=0.1, type="slider", value=1.2, description='Set the radius of the lights\n\nWARNING: the bigger the radius the heavier on the GPU'}, {id="lighteffects_laserbrightness", group="gfx", name=widgetOptionColor.." laser brightness", min=0.4, max=2, step=0.1, type="slider", value=1.2, description='laser lights brightness RELATIVE to global light brightness set above'}, - {id="lighteffects_laserradius", group="gfx", name=widgetOptionColor.." laser radius (gpu intensive)", min=0.4, max=2, step=0.1, type="slider", value=1, description='laser lights radius RELATIVE to global light radius set above\n\nWARNING: the bigger the radius the heavier on the GPU'}, + {id="lighteffects_laserradius", group="gfx", name=widgetOptionColor.." laser radius", min=0.4, max=2, step=0.1, type="slider", value=1, description='laser lights radius RELATIVE to global light radius set above\n\nWARNING: the bigger the radius the heavier on the GPU'}, {id="lups", group="gfx", widget="LupsManager", name="Lups particle/shader effects", type="bool", value=GetWidgetToggleValue("LupsManager"), description='Toggle unit particle effects: jet beams, ground flashes, fusion energy balls'}, - {id="outline", group="gfx", widget="Outline", name="Unit outline", type="bool", value=GetWidgetToggleValue("Outline"), description='Adds a small outline to all units which makes them crisp\n\nLimits total outlined units to 1200.\nStops rendering outlines when average fps falls below 13.'}, {id="xrayshader", group="gfx", widget="XrayShader", name="Unit xray shader", type="bool", value=GetWidgetToggleValue("XrayShader"), description='Highlights all units, highlight effect dissolves on close camera range.\n\nFades out and disables at low fps\nWorks less on dark teamcolors'}, {id="particles", group="gfx", name="Max particles", type="slider", min=5000, max=25000, step=500, value=tonumber(Spring.GetConfigInt("MaxParticles",1) or 10000), description='Particles used for explosions, smoke, fire and missiletrails\n\nSetting a low value will mean that various effects wont show properly'}, - {id="nanoparticles", group="gfx", name="Max nano particles", type="slider", min=500, max=5000, step=100, value=tonumber(Spring.GetConfigInt("MaxNanoParticles",1) or 500), description='NOTE: Nano particles are more expensive regarding the CPU'}, + {id="nanoparticles", group="gfx", name="Max nano particles", type="slider", min=0, max=5000, step=100, value=tonumber(Spring.GetConfigInt("MaxNanoParticles",1) or 500), description='NOTE: Nano particles are more expensive regarding the CPU'}, - {id="iconadjuster", group="gfx", name="Unit icon scale", min=0.8, max=1.2, step=0.05, type="slider", value=1, description='Sets radar/unit icon size\n\n(Used for unit icon distance and minimap icons)'}, - {id="disticon", group="gfx", name="Icon render distance", type="slider", min=0, max=800, step=10, value=tonumber(Spring.GetConfigInt("UnitIconDist",1) or 300)}, - {id="treeradius", group="gfx", name="Tree render distance", type="slider", min=0, max=2000, step=50, value=tonumber(Spring.GetConfigInt("TreeRadius",1) or 1000), description='Applies to SpringRTS engine default trees\n\nChanges will be applied next game'}, + --{id="treeradius", group="gfx", name="Tree render distance", type="slider", restart=true, min=0, max=2000, step=50, value=tonumber(Spring.GetConfigInt("TreeRadius",1) or 1000), description='Applies to SpringRTS engine default trees\n\nChanges will be applied next game'}, {id="timecyclesweathereffects", group="gfx", name="Day/Night/Weather Cycles", type="bool", value=tonumber(Spring.GetConfigInt("evo_timecyclesweathereffects",0) or 0) == 1, description='Enables Day/Night Cycles and Weather Effects\n\nTHIS IS HIGHLY EXPERIMENTAL!!! *Could Cause Crashes on older hardware!!!*\n*NOTE* This will cause all widgets to reload'}, {id="snow", group="gfx", widget="Snow", name="Snow", type="bool", value=GetWidgetToggleValue("Snow"), description='Snow widget (By default.. maps with wintery names have snow applied)'}, @@ -1775,12 +2300,16 @@ function init() {id="snowautoreduce", group="gfx", name=widgetOptionColor.." auto reduce", type="bool", value=true, description='Automaticly reduce snow when average FPS gets lower\n\n(re-enabling this needs time to readjust to average fps again'}, {id="snowamount", group="gfx", name=widgetOptionColor.." amount", type="slider", min=0.2, max=2, step=0.2, value=1, description='Tip: disable "auto reduce" option temporarily to see the max snow amount you have set'}, - {id="commandsfx", group="gfx", widget="Commands FX", name="Command FX", type="bool", value=GetWidgetToggleValue("Commands FX"), description='Shows unit target lines when you give orders\n\nThe commands from your teammates are shown as well'}, + {id="dofintensity", group="gfx", name="DoF intensity", type="slider", min=0.05, max=5, step=0.01, value=1.5, description='Enable Depth of Field with F8 first'}, - {id="resurrectionhalos", group="gfx", widget="Resurrection Halos", name="Resurrected unit halos", type="bool", value=GetWidgetToggleValue("Resurrection Halos"), description='Gives units have have been resurrected a little halo above it.'}, + {id="resurrectionhalos", group="gfx", widget="Resurrection Halos", name="Resurrected unit halos", type="bool", value=GetWidgetToggleValue("Resurrection Halos"), description='Gives units have have been resurrected a little halo above it.'}, {id="tombstones", group="gfx", widget="Tombstones", name="Tombstones", type="bool", value=GetWidgetToggleValue("Tombstones"), description='Displays tombstones where commanders died'}, {id="rankicons", group="gfx", widget="Rank Icons", name="Rank icons", type="bool", value=GetWidgetToggleValue("Rank Icons"), description='Shows a rank icon depending on experience next to units'}, + {id="underconstructiongfx", group="gfx", widget="Under construction gfx", name="Under construction highlight", type="bool", value=GetWidgetToggleValue("Under construction gfx"), description='Highlights unit models when under construction'}, + {id="underconstructiongfx_opacity", group="gfx", name=widgetOptionColor.." opacity", min=0.25, max=0.5, step=0.01, type="slider", value=0.2, description='Set the opacity of the highlight on selected units'}, + {id="underconstructiongfx_shader", group="gfx", name=widgetOptionColor.." use shader", type="bool", value=false, description='Highlight model edges a bit'}, + -- SND {id="sndvolmaster", group="snd", name="Master volume", type="slider", min=0, max=200, step=2, value=tonumber(Spring.GetConfigInt("snd_volmaster",1) or 100)}, --{id="sndvolgeneral", group="snd", name="General volume", type="slider", min=0, max=100, step=2, value=tonumber(Spring.GetConfigInt("snd_volgeneral",1) or 100)}, @@ -1791,27 +2320,53 @@ function init() {id="dynamicmusic", group="snd", name="Dynamic Music", type="bool", value=tonumber(Spring.GetConfigInt("evo_dynamicmusic",1) or 1) == 1, description="If enabled, Music trackks will dynamically switch between war and peace depending on what is going on at that moment."}, {id="interruptmusic", group="snd", name="Dynamic Music Interruption", type="bool", value=tonumber(Spring.GetConfigInt("evo_interruptmusic",1) or 1) == 1, description="If enabled, Music tracks will fade out and switch from peace to war \nand vice versa at that moment instead of allowing the entire peace or war track to finish first."}, --{id="sndairabsorption", group="snd", name="Air absorption", type="slider", min=0, max=0.5, step=0.01, value=tonumber(Spring.GetConfigInt("snd_airAbsorption",1) or.1)}, - {id="musicplayer", group="snd", widget="Music Player", name="Music player", type="bool", value=GetWidgetToggleValue("Music Player"), description='Shown on top of (adv)playerlist'}, + {id="musicplayer", group="snd", widget="Music Player", name="Music player", type="bool", value=GetWidgetToggleValue("Music Player"), description='Shown on top of (adv)playerlist'}, + {id="buildmenusounds", group="snd", name="Buildmenu click sounds", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigPlaySounds~= nil and WG['red_buildmenu'].getConfigPlaySounds()), description='Plays a sound when clicking on orders or buildmenu icons'}, + + {id="voicenotifs", group="snd", widget="Voice Notifs", name="Voice notifications", type="bool", value=GetWidgetToggleValue("Voice Notifs"), description='Plays various voice notifications\n\nAdjust volume with the interface volume slider'}, + {id="voicenotifs_playtrackedplayernotifs", group="snd", name=widgetOptionColor.." tracked cam/player notifs",type="bool", value=(WG['voicenotifs']~=nil and WG['voicenotifs'].getPlayTrackedPlayerNotifs()), description='Play voice notifs from the perspective of the currently camera tracked player'}, + {id="voicenotifs_volume", group="snd", name=widgetOptionColor.." volume", type="slider", min=0.05, max=1, step=0.05, value=1, description='NOTE: It uses interface volume channel'}, -- CONTROL {id="camera", group="control", name="Camera", type="select", options={'fps','overhead','spring','rot overhead','free'}, value=(tonumber((Spring.GetConfigInt("CamMode",1)+1) or 2))}, {id="camerashake", group="control", widget="CameraShake", name="Camera shake", type="bool", value=GetWidgetToggleValue("CameraShake"), description='Shakes camera on explosions'}, - {id="scrollspeed", group="control", name="Zoom direction/speed", type="slider", min=-45, max=45, step=1, value=tonumber(Spring.GetConfigInt("ScrollWheelSpeed",1) or -25), description='Leftside of the slider means inversed scrolling direction!\nNOTE: Having the slider centered means no mousewheel zooming at all!'}, + {id="camerasmoothness", group="control", name="Camera smoothing", type="slider", min=0, max=2, step=0.01, value=cameraTransitionTime, description="How smooth should the transitions between camera movement be?"}, + {id="lockcamera_transitiontime", group="control", name="Tracking cam smoothing", type="slider", min=0.4, max=1.5, step=0.01, value=(WG['advplayerlist_api']~=nil and WG['advplayerlist_api'].GetLockTransitionTime~=nil and WG['advplayerlist_api'].GetLockTransitionTime()), description="When viewing a players camera...\nhow smooth should the transitions between camera movement be?"}, + + {id="scrollspeed", group="control", name="Scroll zoom speed", type="slider", min=1, max=45, step=1, value=math.abs(tonumber(Spring.GetConfigInt("ScrollWheelSpeed",1) or 25)), description=''}, + {id="scrollinverse", group="control", name="Scroll inversed", type="bool", value=(tonumber(Spring.GetConfigInt("ScrollWheelSpeed",1) or 25) < 0), description=""}, {id="hwcursor", group="control", name="Hardware cursor", type="bool", value=tonumber(Spring.GetConfigInt("hardwareCursor",1) or 1) == 1, description="When disabled: the mouse cursor refresh rate will be the same as your ingame fps"}, {id="crossalpha", group="control", name="Mouse cross alpha", type="slider", min=0, max=1, step=0.05, value=tonumber(Spring.GetConfigString("CrossAlpha",1) or 1), description='Opacity of mouse icon in center of screen when you are in camera pan mode\n\n(The\'icon\' has a dot in center with 4 arrows pointing in all directions)'}, - {id="screenedgemove", group="control", name="Screen edge moves camera", type="bool", value=tonumber(Spring.GetConfigInt("FullscreenEdgeMove",1) or 1) == 1, description="If mouse is close to screen edge this will move camera\n\nChanges will be applied next game"}, + {id="screenedgemove", group="control", name="Screen edge moves camera", type="bool", restart=true, value=tonumber(Spring.GetConfigInt("FullscreenEdgeMove",1) or 1) == 1, description="If mouse is close to screen edge this will move camera\n\nChanges will be applied next game"}, + {id="containmouse", group="control", widget="Grabinput", name="Contain mouse inside window", type="bool", value=GetWidgetToggleValue("Grabinput"), description='When you are in windowed mode, this will keep your mouse from moving out of it'}, + {id="allyselunits_select", group="control", name="Select units of tracked player", type="bool", value=(WG['allyselectedunits']~=nil and WG['allyselectedunits'].getSelectPlayerUnits()), description="When viewing a players camera, this will also select the units the player has selected"}, + {id="lockcamera_hideenemies", group="control", name="Only show tracked player viewpoint", type="bool", value=(WG['advplayerlist_api']~=nil and WG['advplayerlist_api'].GetLockHideEnemies()), description="When viewing a players camera, this will only display what the tracked player sees"}, + {id="lockcamera_los", group="control", name=widgetOptionColor.." show tracked player LoS", type="bool", value=(WG['advplayerlist_api']~=nil and WG['advplayerlist_api'].GetLockLos()), description="When viewing a players camera and los, shows shaded los ranges too"}, -- UI + {id="buildordermenu", group="ui", name="Build Menu Preset", type="select", options={'Horizontal','Compact Horizontal','Traditional', 'Traditional (SxS)','Right Side','Right Side Compact'}, value=Spring.GetConfigInt("evo_buildorderui",0) + 1, description='Use these presets to change the build menu size and position.\nBuild and Order menus can further be custom positioned using TweakMode (ctrl+f11)\n\nNOTE: Changing this setting will cause the interface to be reloaded'}, + {id="showcost", group="ui", name="Show Cost", type="bool", value=Spring.GetConfigInt("evo_showcost",1) == 1, description='Show cost of units in the build icon'}, + {id="showtechreq", group="ui", name="Show Tech Requirement", type="bool", value=Spring.GetConfigInt("evo_showtechreq",1) == 1, description='Show tech requirement of units in the build icon'}, + {id="showhotkeys", group="ui", name="Show Build Hotkeys", type="bool", value=Spring.GetConfigInt("evo_showhotkeys",1) == 1, description='Show build hotkeys in the build icon'}, + {id="teamcolors", group="ui", widget="Player Color Palette", name="Team colors based on a palette", type="bool", value=GetWidgetToggleValue("Player Color Palette"), description='Replaces lobby team colors for a color palette based one\n\nNOTE: reloads all widgets because these need to update their teamcolors'}, - --{id="sameteamcolors", group="ui", name=widgetOptionColor.." same team colors", type="bool", value=(WG['playercolorpalette']~=nil and WG['playercolorpalette'].getSameTeamColors~=nil and WG['playercolorpalette'].getSameTeamColors()), description='Use the same teamcolor for all the players in a team\n\nNOTE: reloads all widgets because these need to update their teamcolors'}, + {id="sameteamcolors", group="ui", name=widgetOptionColor.." same team colors", type="bool", value=(WG['playercolorpalette']~=nil and WG['playercolorpalette'].getSameTeamColors~=nil and WG['playercolorpalette'].getSameTeamColors()), description='Use the same teamcolor for all the players in a team\n\nNOTE: reloads all widgets because these need to update their teamcolors'}, + + {id="simpleminimapcolors", group="ui", name="Simple minimap colors", type="bool", value=tonumber(Spring.GetConfigInt("SimpleMiniMapColors",0) or 0) == 1, description="Enable simple minimap teamcolors\nRed is enemy,blue is ally and you are green!"}, + + {id="font", group="ui", name="Font", type="select", options={}, value=1, description='Regular read friendly font used for text'}, + {id="font2", group="ui", name="Font 2", type="select", options={}, value=1, description='Stylistic font mainly used for names/buttons/titles'}, + {id="guiopacity", group="ui", name="GUI opacity", type="slider", min=0, max=1, step=0.01, value=Spring.GetConfigFloat("ui_opacity",0.66), description=''}, + + {id="guishader", group="ui", widget="GUI Shader", name="GUI blur", type="bool", value=GetWidgetToggleValue("GUI Shader"), description='Blurs the world under every user interface element'}, + {id="guishaderintensity", group="ui", name=widgetOptionColor.." intensity", type="slider", min=0.001, max=0.003, step=0.0001, value=0.002, description=''}, {id="autoquit", group="ui", widget="Autoquit", name="Auto quit", type="bool", value=GetWidgetToggleValue("Autoquit"), description='Automatically quits after the game ends.\n...unless the mouse has been moved within a few seconds.'}, - {id="healthbarsscale", group="ui", name="Health Bars Scale", type="slider", min=0.7, max=1.31, step=0.1, value=1, description=''}, + --{id="showbuilderqueue", group="ui", widget="Show Builder Queue", name="Show Builder Queue", type="bool", value=GetWidgetToggleValue("Show Builder Queue"), description='Shows ghosted buildings about to be built on the map'}, - {id="guishader", group="ui", widget="GUI-Shader", name="GUI blur shader", type="bool", value=GetWidgetToggleValue("GUI-Shader"), description='Blurs the world under every user interface element\n\nIntel Graphics have trouble with this'}, - {id="guishaderintensity", group="ui", name=widgetOptionColor.." intensity", type="slider", min=0.0007, max=0.003, step=0.0001, value=0.0014, description='NOTE: does 2nd blur when value is above 0.0015'}, + {id="healthbarsscale", group="ui", name="Health Bars Scale", type="slider", min=0.7, max=1.31, step=0.1, value=1, description=''}, {id="consolemaxlines", group="ui", name="Console max lines", type="slider", min=3, max=9, step=1, value=6, description=''}, {id="consolefontsize", group="ui", name="Console font size", type="slider", min=0.9, max=1.1, step=0.05, value=1, description=''}, @@ -1819,57 +2374,225 @@ function init() --{id="buildmenuoldicons", group="ui", name="Buildmenu old unit icons", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigOldUnitIcons()), description='Use the old unit icons in the buildmenu\n\n(reselect something to see the change applied)'}, {id="buildmenushortcuts", group="ui", name="Buildmenu shortcuts", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigShortcutsInfo()), description='Enables and shows shortcut keys in the buildmenu\n\n(reselect something to see the change applied)'}, {id="buildmenuprices", group="ui", name="Buildmenu prices", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigUnitPrice~=nil and WG['red_buildmenu'].getConfigUnitPrice()), description='Enables and shows unit prices in the buildmenu\n\n(reselect something to see the change applied)'}, - {id="buildmenusounds", group="ui", name="Buildmenu sounds", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigPlaySounds~= nil and WG['red_buildmenu'].getConfigPlaySounds()), description='Plays a sound when clicking on orders or buildmenu icons'}, + {id="buildmenulargeicons", group="ui", name="Buildmenu large icons", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigLargeUnitIcons~=nil and WG['red_buildmenu'].getConfigLargeUnitIcons()), description='Use large unit icons'}, {id="buildmenutooltip", group="ui", name="Buildmenu tooltip", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigUnitTooltip~=nil and WG['red_buildmenu'].getConfigUnitTooltip()), description='Enables unit tooltip when hovering over unit in buildmenu'}, {id="buildmenubigtooltip", group="ui", name=widgetOptionColor.." extensive unit info", type="bool", value=(WG['red_buildmenu']~=nil and WG['red_buildmenu'].getConfigUnitBigTooltip~=nil and WG['red_buildmenu'].getConfigUnitBigTooltip()), description='Displays elaborative unit description when availible'}, {id="buildpichelp", group="ui", name="Flashing Buildpic Help", type="bool", value=tonumber(Spring.GetConfigInt("evo_buildpichelp",1) or 1) == 1, description="Flashes relevant build menu items when resources are in a crisis situation"}, - {id="resourceprompts", group="ui", name="Audio/Visual Resource Prompts", type="bool", value=tonumber(Spring.GetConfigInt("evo_resourceprompts",1) or 1) == 1, description="If enabled, messages will be sent to the chat as well as\naudio cues when your resources need attention"}, + {id="resourceprompts", group="ui", name="Audio/Visual Helper Prompts", type="bool", value=tonumber(Spring.GetConfigInt("evo_resourceprompts",1) or 1) == 1, description="If enabled, messages will be sent to the chat as well as\naudio cues when your resources need attention"}, {id="simplifiedresourcebar", group="ui", name="Simplified Resource Bar", type="bool", value=tonumber(Spring.GetConfigInt("evo_simplifiedresourcebar",1) or 1) == 1, description="Removes extra information from the resource bar"}, --{id="fancyselunits", group="gfx", widget="Fancy Selected Units", name="Fancy Selected Units", type="bool", value=GetWidgetToggleValue("Fancy Selected Units"), description=''}, --{id="fpstimespeed", group="ui", name="Display FPS, GameTime and Speed", type="bool", value=tonumber(Spring.GetConfigInt("ShowFPS",1) or 1) == 1, description='Located at the top right of the screen\n\nIndividually toggle them with /fps /clock /speed'}, + {id="playerlistcollapse", group="ui", name="Playerlist auto collapses", type="bool", value=false, description='Auto collapses the playerlist, mouseover will show it again'}, {id="fpstimespeed-widget", group="ui", widget="AdvPlayersList info", name="Playerlist time/speed/fps", type="bool", value=GetWidgetToggleValue("AdvPlayersList info"), description='Shows time, gamespeed and fps on top of the (adv)playerslist'}, - {id="mascotte", group="ui", widget="AdvPlayersList mascotte", name="Playerlist mascotte", type="bool", value=GetWidgetToggleValue("AdvPlayersList mascotte"), description='Shows a mascotte on top of the (adv)playerslist'}, + --{id="mascotte", group="ui", widget="AdvPlayersList mascotte", name="Playerlist mascotte", type="bool", value=GetWidgetToggleValue("AdvPlayersList mascotte"), description='Shows a mascotte on top of the (adv)playerslist'}, {id="displaydps", group="ui", widget="Display DPS", name="Display DPS", type="bool", value=GetWidgetToggleValue("Display DPS"), description='Display the \'Damage Per Second\' done where target are hit'}, + {id="nametags_icon", group="ui", name="Commander name on icon", type="bool", value=(WG['nametags']~=nil and WG['nametags'].getDrawForIcon()), description='Show commander name when its displayed as icon'}, + {id="idlebuilders", group="ui", widget="Idle Builders", name="List Idle builders", type="bool", value=GetWidgetToggleValue("Idle Builders"), description='Displays a row containing a list of idle builder units (if there are any)'}, {id="betfrontend", group="ui", widget="Bet-Frontend", name="Bet interface", type="bool", value=GetWidgetToggleValue("Bet-Frontend"), description='When spectator: display a betting interface.\nIt allows betting on when you think a unit will be destroyed.\nBeware... you have a limited supply of chips.'}, + {id="commandsfx", group="ui", widget="Commands FX", name="Command FX", type="bool", value=GetWidgetToggleValue("Commands FX"), description='Shows unit target lines when you give orders\n\nThe commands from your teammates are shown as well'}, + {id="commandsfxfilterai", group="ui", name=widgetOptionColor.." filter AI teams", type="bool", value=true, description='Hide commands for AI teams'}, + {id="commandsfxopacity", group="ui", name=widgetOptionColor.." opacity", type="slider", min=0.3, max=1, step=0.1, value=1, description=''}, - {id="teamplatter", group="ui", widget="TeamPlatter", name="Unit team platters", type="bool", value=GetWidgetToggleValue("TeamPlatter"), description='Shows a team color platter above all visible units'}, - {id="teamplatter_opacity", group="ui", name=widgetOptionColor.." opacity", min=0.15, max=0.4, step=0.01, type="slider", value=0.3, description='Set the opacity of the team spotters'}, - {id="teamplatter_skipownteam", group="ui", name=widgetOptionColor.." skip own units", type="bool", value=false, description='Doesnt draw platters for yourself'}, + --{id="teamplatter", group="ui", widget="TeamPlatter", name="Unit team platters", type="bool", value=GetWidgetToggleValue("TeamPlatter"), description='Shows a team color platter above all visible units'}, + --{id="teamplatter_opacity", group="ui", name=widgetOptionColor.." opacity", min=0.15, max=0.4, step=0.01, type="slider", value=0.3, description='Set the opacity of the team spotters'}, + --{id="teamplatter_skipownteam", group="ui", name=widgetOptionColor.." skip own units", type="bool", value=false, description='Doesnt draw platters for yourself'}, - {id="enemyspotter", group="ui", widget="EnemySpotter", name="Enemy spotters", type="bool", value=GetWidgetToggleValue("EnemySpotter"), description='Draws smoothed circles under enemy units'}, - {id="enemyspotter_opacity", group="ui", name=widgetOptionColor.." opacity", min=0.15, max=0.4, step=0.005, type="slider", value=0.15, description='Set the opacity of the enemy-spotter rings'}, + --{id="enemyspotter", group="ui", widget="EnemySpotter", name="Enemy spotters", type="bool", value=GetWidgetToggleValue("EnemySpotter"), description='Draws smoothed circles under enemy units'}, + --{id="enemyspotter_opacity", group="ui", name=widgetOptionColor.." opacity", min=0.12, max=0.4, step=0.01, type="slider", value=0.15, description='Set the opacity of the enemy-spotter rings'}, --{id="enemyspotter_highlight", group="ui", name=widgetOptionColor.." unit highlight", type="bool", value=false, description='Colorize/highlight enemy units'}, - {id="highlightselunits_opacity", group="ui", name="Selected units opacity", min=0.15, max=0.3, step=0.01, type="slider", value=0.2, description='Set the opacity of the highlight on selected units'}, - {id="highlightselunits_shader", group="ui", name=widgetOptionColor.." use shader", type="bool", value=false, description='Shades selected unit models'}, + {id="highlightselunits", group="ui", widget="Highlight Selected Units", name="Highlight selected units", type="bool", value=GetWidgetToggleValue("Highlight Selected Units"), description='Highlights unit models when selected'}, + {id="highlightselunits_opacity", group="ui", name=widgetOptionColor.." opacity", min=0.08, max=0.3, step=0.01, type="slider", value=0.2, description='Set the opacity of the highlight on selected units'}, + {id="highlightselunits_shader", group="ui", name=widgetOptionColor.." use shader", type="bool", value=false, description='Highlight model edges a bit'}, + {id="highlightselunits_teamcolor", group="ui", name=widgetOptionColor.." use teamcolor", type="bool", value=false, description='Use teamcolor instead of unit health coloring'}, - {id="pausescreen", group="ui", widget="Pause Screen", name="Pause screen", type="bool", value=GetWidgetToggleValue("Pause Screen"), description='Displays an overlay when the game is paused'}, + {id="fancyselectedunits", group="ui", widget="Fancy Selected Units", name="Fancy selected units", type="bool", value=GetWidgetToggleValue("Fancy Selected Units"), description='Draws a platter under selected units\n\n\NOTE: this widget can be heavy when having lots of units selected'}, + --{id="fancyselectedunits_style", group="ui", name=widgetOptionColor.." style", type="select", options={}, value=1}, + {id="fancyselectedunits_opacity", group="ui", name=widgetOptionColor.." line opacity", min=0.8, max=1, step=0.01, type="slider", value=0.9, description='Set the opacity of the highlight on selected units'}, + {id="fancyselectedunits_baseopacity", group="ui", name=widgetOptionColor.." base opacity", min=0, max=0.5, step=0.01, type="slider", value=0.25, description='Set the opacity of the highlight on selected units'}, + {id="fancyselectedunits_teamcoloropacity", group="ui", name=widgetOptionColor.." teamcolor opacity", min=0, max=1, step=0.01, type="slider", value=0.1, description='Set the amount of teamcolor used for the base platter'}, + --{id="fancyselectedunits_secondline", group="ui", name=widgetOptionColor.." add second line", type="bool", value=false, description='Adds a second line'}, + {id="pausescreen", group="ui", widget="Pause Screen", name="Pause screen", type="bool", value=GetWidgetToggleValue("Pause Screen"), description='Displays an overlay when the game is paused'}, {id="givenunits", group="ui", widget="Given Units", name="Given unit icons", type="bool", value=GetWidgetToggleValue("Given Units"), description='Tags given units with \'new\' icon'}, + -- GAME - {id="smartselect_includebuildings", group="game", name="Include buildings in area-selection", type="bool", value=false, description='When rectangle-drag-selecting an area, include building units too?\n\ndisabled: non-mobile units will not be selected\n(except: nanos always will be selected)'}, + {id="autoquit", group="game", widget="Autoquit", name="Auto quit", type="bool", value=GetWidgetToggleValue("Autoquit"), description='Automatically quits after the game ends.\n...unless the mouse has been moved within a few seconds.'}, + + {id="ctrl_dequeue", group="game", name="Ctrl to dequeue units", type="bool", value=Spring.GetConfigInt("evo_ctrl_dequeue",1) == 1, description='Use ctrl key to dequeue units for factory'}, + + {id="smartselect_includebuildings", group="game", name="Include structures in area-selection", type="bool", value=false, description='When rectangle-drag-selecting an area, include building units too?\n\ndisabled: non-mobile units will be excluded\n(except: nanos always will be selected)'}, + {id="smartselect_includebuilders", group="game", name=widgetOptionColor.." include builders (if above is off)", type="bool", value=true, description='When rectangle-drag-selecting an area, exclude builder units'}, - {id="onlyfighterspatrol", group="game", widget="OnlyFightersPatrol", name="Only fighters patrol", type="bool", value=GetWidgetToggleValue("Autoquit"), description='Only fighters obey a factory\'s patrol route after leaving airlab.'}, + {id="onlyfighterspatrol", group="game", widget="OnlyFightersPatrol", name="Only fighters patrol", type="bool", value=GetWidgetToggleValue("Autoquit"), description='Only fighters obey a factory\'s patrol route after leaving airlab.'}, {id="fightersfly", group="game", widget="Set fighters on Fly mode", name="Set fighters on Fly mode", type="bool", value=GetWidgetToggleValue("Set fighters on Fly mode"), description='Setting fighters on Fly mode when created'}, {id="passivebuilders", group="game", widget="Passive builders", name="Passive builders", type="bool", value=GetWidgetToggleValue("Passive builders"), description='Sets builders (nanos, labs and cons) on passive mode\n\nPassive mode means that builders will only spend energy when its availible.\nUsage: You could set your most important builders on active and leave the rest on passive'}, + {id="autogroup_immediate", group="game", name="Autogroup immediate mode", type="bool", value=(WG['autogroup']~=nil and WG['autogroup'].getImmediate~=nil and WG['autogroup'].getImmediate()), description='Units built/resurrected/received are added to autogroups immediately instead of waiting them to be idle.\n\n(add units to autogroup with ALT+number)'}, + {id="factoryguard", group="game", widget="FactoryGuard", name="Factory guard (builders)", type="bool", value=GetWidgetToggleValue("FactoryGuard"), description='Newly created builders will assist their source factory'}, {id="factoryholdpos", group="game", widget="Factory hold position", name="Factory hold position", type="bool", value=GetWidgetToggleValue("Factory hold position"), description='Sets new factories, and all units they build, to hold position automatically (not aircraft)'}, {id="factoryrepeat", group="game", widget="Factory Auto-Repeat", name="Factory auto-repeat", type="bool", value=GetWidgetToggleValue("Factory Auto-Repeat"), description='Sets new factories on Repeat mode'}, - - {id="transportai", group="game", widget="Transport AI", name="Transport AI", type="bool", value=GetWidgetToggleValue("Transport AI"), description='Transport units automatically pick up new units going to factory waypoint.'}, + + {id="transportai", group="game", widget="Transport AI", name="Transport AI", type="bool", value=GetWidgetToggleValue("Transport AI"), description='Transport units automatically pick up new units going to factory waypoint.'}, {id="settargetdefault", group="game", widget="Set target default", name="Set-target as default", type="bool", value=GetWidgetToggleValue("Set target default"), description='Replace default attack command to a set-target command\n(when rightclicked on enemy unit)'}, } - loadWidgetConfigData() + -- set lowest quality shadows for Intel GPU (they eat fps but dont show) + if Platform ~= nil and Platform.gpuVendor == 'Intel' then + options[getOptionByID('shadows_maxquality')] = nil + options[getOptionByID('shadows_minquality')] = nil + options[getOptionByID('shadowslider')] = nil + options[getOptionByID('shadows_opacity')] = nil + end + + if getOptionByID('fancyselectedunits_style') then + options[getOptionByID('fancyselectedunits_style')].options = WG['fancyselectedunits'].getStyleList() + end + + -- add fonts + if getOptionByID('font') then + local fonts = {} + local fontsFull = {} + local fontsn = {} + local files = VFS.DirList(LUAUI_DIRNAME..'fonts', '*') + fontOption = {} + for k, file in ipairs(files) do + local name = string.sub(file, 13) + local ext = string.sub(name, string.len(name) - 2) + if ext == 'otf' or ext == 'ttf' then + name = string.sub(name, 1, string.len(name) - 4) + if not fontsn[name:lower()] then + fonts[#fonts+1] = name + fontsFull[#fontsFull+1] = string.sub(file, 13) + fontsn[name:lower()] = true + local fontScale = (0.5 + (vsx*vsy / 5700000)) + fontOption[#fonts] = gl.LoadFont(LUAUI_DIRNAME .. "fonts/"..fontsFull[#fontsFull], 20*fontScale, 5*fontScale, 1.5) + end + end + end + + options[getOptionByID('font')].options = fonts + options[getOptionByID('font')].optionsFont = fontsFull + local fname = Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf"):lower() + options[getOptionByID('font')].value = getSelectKey(getOptionByID('font'), string.sub(fname, 1, string.len(fname) - 4)) + + options[getOptionByID('font2')].options = fonts + options[getOptionByID('font2')].optionsFont = fontsFull + local fname = Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf"):lower() + options[getOptionByID('font2')].value = getSelectKey(getOptionByID('font2'), string.sub(fname, 1, string.len(fname) - 4)) + end + + -- set sun minimal height + if getOptionByID('sun_y') then + if select(2,gl.GetSun("pos")) < options[getOptionByID('sun_y')].min then + Spring.SetSunDirection(select(1,gl.GetSun("pos")), options[getOptionByID('sun_y')].min, select(3,gl.GetSun("pos"))) + end + end + + -- set minimal shadow opacity + if getOptionByID('shadows_opacity') then + if gl.GetSun("shadowDensity") < options[getOptionByID('shadows_opacity')].min then + Spring.SetSunLighting({groundShadowDensity = options[getOptionByID('shadows_opacity')].min, modelShadowDensity = options[getOptionByID('shadows_opacity')].min}) + end + end + + -- fsaa is deprecated in 104.x + if tonumber(Spring.GetConfigInt("FSAALevel",0)) > 0 then + local fsaa = tonumber(Spring.GetConfigInt("FSAALevel",0)) + if fsaa > 4 then + fsaa = 8 + end + Spring.SetConfigInt("MSAALevel", 8) + Spring.SetConfigInt("FSAALevel", 0) + end + + -- remove engine particles if nano beams are enabled + if options[getOptionByID('nanoeffect')] and options[getOptionByID('nanoeffect')].value == 1 then + Spring.SetConfigInt("MaxNanoParticles", 0) + end + -- loads values via stored game config in luaui/configs + loadAllWidgetData() + + -- while we have set config-ints, that isnt enough to have these settings applied ingame + if savedConfig and Spring.GetGameFrame() == 0 then + for k, v in pairs(savedConfig) do + if getOptionByID(k) then + applyOptionValue(getOptionByID(k)) + end + end + changesRequireRestart = false + end + + -- detect AI + local aiDetected = false + local t = Spring.GetTeamList() + for _,teamID in ipairs(t) do + if select(4,Spring.GetTeamInfo(teamID,false)) then + aiDetected = true + end + end + if not aiDetected then + options[getOptionByID('commandsfxfilterai')] = nil + end + + if #supportedResolutions < 2 then + options[getOptionByID('resolution')] = nil + else + for id,res in pairs(options[getOptionByID('resolution')].options) do + if res == vsx..' x '..vsy then + options[getOptionByID('resolution')].value = id + break + end + end + + -- disable music volume slider + if widgetHandler.knownWidgets["Music Player"] == nil then + options[getOptionByID('sndvolmusic')] = nil + end + end + + -- add sound notification widget sound toggle options + if widgetHandler.knownWidgets["Voice Notifs"] then + local soundList + if WG['voicenotifs'] ~= nil then + soundList = WG['voicenotifs'].getSoundList() + elseif widgetHandler.configData["Voice Notifs"] ~= nil and widgetHandler.configData["Voice Notifs"].soundList ~= nil then + soundList = widgetHandler.configData["Voice Notifs"].soundList + end + if type(soundList) == 'table' then + local newOptions = {} + local count = 0 + for i, option in pairs(options) do + count = count + 1 + newOptions[count] = option + if option.id == 'voicenotifs_volume' then + for sound, enabled in pairs(soundList) do + count = count + 1 + newOptions[count] = {id="voicenotifs_snd_"..sound, group="snd", name=widgetOptionColor.." "..sound, type="bool", value=enabled, description=''} + end + end + end + options = newOptions + end + else + options[getOptionByID('voicenotifs')] = nil + options[getOptionByID('voicenotifs_volume')] = nil + options[getOptionByID('voicenotifs_playtrackedplayernotifs')] = nil + end + + if not widgetHandler.knownWidgets["Player-TV"] then + options[getOptionByID('playertv_countdown')] = nil + end + -- cursors if (WG['cursors'] == nil) then @@ -1889,6 +2612,21 @@ function init() options[getOptionByID('cursor')].options = cursorsets options[getOptionByID('cursor')].value = cursor end + if widgetHandler.knownWidgets["SSAO"] == nil then + options[getOptionByID('ssao')] = nil + options[getOptionByID('ssao_strength')] = nil + options[getOptionByID('ssao_radius')] = nil + end + if widgetHandler.knownWidgets["Bloom Shader"] == nil then + options[getOptionByID('bloombrightness')] = nil + options[getOptionByID('bloomsize')] = nil + options[getOptionByID('bloomquality')] = nil + end + if widgetHandler.knownWidgets["Bloom Shader Deferred"] == nil then + options[getOptionByID('bloomdeferredbrightness')] = nil + options[getOptionByID('bloomdeferredsize')] = nil + options[getOptionByID('bloomdeferredquality')] = nil + end if (WG['healthbars'] == nil) then options[getOptionByID('healthbarsscale')] = nil @@ -1896,33 +2634,20 @@ function init() options[getOptionByID('healthbarsscale')].value = WG['healthbars'].getScale() end - if (WG['iconadjuster'] == nil) then - options[getOptionByID('iconadjuster')] = nil - else - options[getOptionByID('iconadjuster')].value = WG['iconadjuster'].getScale() - end - - if (WG['highlightselunits'] == nil) then - options[getOptionByID('highlightselunits_opacity')] = nil - else - options[getOptionByID('highlightselunits_opacity')].value = WG['highlightselunits'].getOpacity() - end - - if (WG['highlightselunits'] == nil) then - options[getOptionByID('highlightselunits_shader')] = nil - else - options[getOptionByID('highlightselunits_shader')].value = WG['highlightselunits'].getShader() - end - if (WG['smartselect'] == nil) then options[getOptionByID('smartselect_includebuildings')] = nil + options[getOptionByID('smartselect_includebuilders')] = nil else options[getOptionByID('smartselect_includebuildings')].value = WG['smartselect'].getIncludeBuildings() + options[getOptionByID('smartselect_includebuilders')].value = WG['smartselect'].getIncludeBuilders() end if WG['snow'] ~= nil and WG['snow'].getSnowMap ~= nil then options[getOptionByID('snowmap')].value = WG['snow'].getSnowMap() end + if (WG['LupsPriority'] ~= nil) then + options[getOptionByID('lupseffectlevel')].value = WG['LupsPriority'] + end if (WG['darkenmap'] == nil) then options[getOptionByID('darkenmap')] = nil @@ -1933,10 +2658,14 @@ function init() end -- not sure if needed: remove vsync option when its done by monitor (freesync/gsync) -> config value is set as 'x' - if Spring.GetConfigInt("Vsync",1) == 'x' then + if Spring.GetConfigInt("VSync",1) == 'x' then options[getOptionByID('vsync')] = nil end + if not widgetHandler.knownWidgets["Commander Name Tags"] then + options[getOptionByID('nametags_icon')] = nil + end + if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigShortcutsInfo == nil then options[getOptionByID('buildmenushortcuts')] = nil end @@ -1952,16 +2681,59 @@ function init() if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigUnitBigTooltip == nil then options[getOptionByID('buildmenubigtooltip')] = nil end + if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigLargeUnitIcons == nil then + options[getOptionByID('buildmenulargeicons')] = nil + end if WG['playercolorpalette'] == nil or WG['playercolorpalette'].getSameTeamColors == nil then options[getOptionByID('sameteamcolors')] = nil end + + if WG['advplayerlist_api']==nil or WG['advplayerlist_api'].GetLockTransitionTime==nil then + options[getOptionByID('lockcamera_transitiontime')] = nil + end + + -- disable options when widget isnt availible + if widgetHandler.knownWidgets["Outline"] == nil then + options[getOptionByID('outline')] = nil + options[getOptionByID("outline_size")] = nil + options[getOptionByID("outline_strength")] = nil + end + + if widgetHandler.knownWidgets["Fancy Selected Units"] == nil then + options[getOptionByID('fancyselectedunits')] = nil + options[getOptionByID("fancyselectedunits_style")] = nil + options[getOptionByID("fancyselectedunits_opacity")] = nil + options[getOptionByID("fancyselectedunits_baseopacity")] = nil + options[getOptionByID("fancyselectedunits_teamcoloropacity")] = nil + options[getOptionByID("fancyselectedunits_secondline")] = nil + end + + if widgetHandler.knownWidgets["Auto Group"] == nil then + options[getOptionByID("autogroup_immediate")] = nil + end + + if widgetHandler.knownWidgets["Highlight Selected Units"] == nil then + options[getOptionByID('highlightselunits')] = nil + options[getOptionByID("highlightselunits_opacity")] = nil + options[getOptionByID("highlightselunits_shader")] = nil + options[getOptionByID("highlightselunits_teamcolor")] = nil + end + + if widgetHandler.knownWidgets["Under construction gfx"] == nil then + options[getOptionByID('underconstructiongfx')] = nil + options[getOptionByID("underconstructiongfx_opacity")] = nil + options[getOptionByID("underconstructiongfx_shader")] = nil + end + if widgetHandler.knownWidgets["Light Effects"] == nil or widgetHandler.knownWidgets["Deferred rendering"] == nil then options[getOptionByID('lighteffects')] = nil options[getOptionByID("lighteffects_brightness")] = nil options[getOptionByID("lighteffects_laserbrightness")] = nil options[getOptionByID("lighteffects_radius")] = nil options[getOptionByID("lighteffects_laserradius")] = nil + --options[getOptionByID("lighteffects_heatdistortion")] = nil + --options[getOptionByID("lighteffects_deferred")] = nil end if widgetHandler.knownWidgets["TeamPlatter"] == nil then @@ -1975,14 +2747,15 @@ function init() end local processedOptions = {} + local processedOptionsCount = 0 local insert = true for oid,option in pairs(options) do insert = true - if option.type == 'slider' then + if option.type == 'slider' and not option.steps then if option.value < option.min then option.value = option.min end if option.value > option.max then option.value = option.max end end - if option.id == "shadows" and (widgetHandler.knownWidgets["Shadow Quality Manager"] == nil or (widgetHandler.orderList["Shadow Quality Manager"] == 0)) then + if (option.id == "shadows" or option.id == "shadows_maxquality" or option.id == "shadows_minquality" or option.id == "shadows_disablefps") and (widgetHandler.knownWidgets["Shadow Quality Manager"] == nil or (widgetHandler.orderList["Shadow Quality Manager"] == 0)) then insert = false end if option.id == "shadowslider" and widgetHandler.knownWidgets["Shadow Quality Manager"] ~= nil and (widgetHandler.orderList["Shadow Quality Manager"] > 0) then @@ -1991,13 +2764,9 @@ function init() if option.widget ~= nil and widgetHandler.knownWidgets[option.widget] == nil then insert = false end - if luaShaders ~= 1 then - if option.id == "advmapshading" or option.id == "advmodelshading" or option.id == "bloom" or option.id == "guishader" or option.id == "xrayshader" or option.id == "mapedgeextension" or option.id == "snow" then - option.description = 'You dont have shaders enabled, we will enable it for you but...\n\nChanges will be applied next game' - end - end if insert then - table.insert(processedOptions, option) + processedOptionsCount = processedOptionsCount + 1 + processedOptions[processedOptionsCount] = option end end options = processedOptions @@ -2050,9 +2819,64 @@ end function widget:Initialize() - --if Platform ~= nil and Platform.gpuVendor ~= 'Nvidia' then -- because UsePBO displays tiled map texture bug for ATI/AMD cards - Spring.SetConfigInt("UsePBO",0) - --end + + if Spring.GetGameFrame() == 0 then + -- set minimum particle amount + if tonumber(Spring.GetConfigInt("MaxParticles",1) or 10000) <= 10000 then + Spring.SetConfigInt("MaxParticles",10000) + end + -- enable lua shaders + if not tonumber(Spring.GetConfigInt("ForceShaders",1) or 0) then + Spring.SetConfigInt("ForceShaders", 1) + end + -- enable map/model shading + if Spring.GetConfigInt("AdvMapShading",0) ~= 1 then + Spring.SetConfigInt("AdvMapShading",1) + end + if Spring.GetConfigInt("AdvModelShading",0) ~= 1 then + Spring.SetConfigInt("AdvModelShading",1) + end + -- enable normal mapping + --if Spring.GetConfigInt("NormalMapping",0) ~= 1 then + -- Spring.SetConfigInt("NormalMapping",1) + -- Spring.SendCommands("luarules normalmapping 1") + --end + -- disable clouds + --if Spring.GetConfigInt("AdvSky",0) ~= 0 then + -- Spring.SetConfigInt("AdvSky",0) + --end + -- disable grass + if Spring.GetConfigInt("GrassDetail",0) ~= 0 then + Spring.SetConfigInt("GrassDetail",0) + end + + --if Platform ~= nil and Platform.gpuVendor ~= 'Nvidia' then -- because UsePBO displays tiled map texture bug for ATI/AMD cards + --Spring.SetConfigInt("UsePBO",0) + --end + + -- enable shadows at gamestart + --if Spring.GetConfigInt("Shadows",0) ~= 1 then + -- Spring.SetConfigInt("Shadows",1) + -- Spring.SendCommands("Shadows 1") + --end + -- set lowest quality shadows for Intel GPU (they eat fps but dont really show, but without any shadows enables it looks glitchy) + if Platform ~= nil and Platform.gpuVendor == 'Intel' then + Spring.SendCommands("Shadows 1 1024") + end + + -- set custom user map sun position + if customMapSunPos[Game.mapName] and customMapSunPos[Game.mapName][1] then + Spring.SetSunDirection(customMapSunPos[Game.mapName][1],customMapSunPos[Game.mapName][2],customMapSunPos[Game.mapName][3]) + Spring.SetSunLighting({groundShadowDensity = gl.GetSun("shadowDensity"), modelShadowDensity = gl.GetSun("shadowDensity")}) + end + + -- disable fog + Spring.SetAtmosphere({fogStart = 0.99999, fogEnd = 1.0, fogColor = {1.0, 1.0, 1.0, 0.0}}) + end + + Spring.SendCommands("minimap unitsize "..(Spring.GetConfigFloat("MinimapIconScale", 3.5))) -- spring wont remember what you set with '/minimap iconssize #' + + Spring.SendCommands({"bind f10 options"}) WG['options'] = {} WG['options'].toggle = function(state) @@ -2065,6 +2889,9 @@ function widget:Initialize() WG['options'].isvisible = function() return show end + WG['options'].getCameraSmoothness = function() + return cameraTransitionTime + end presets = tableMerge(presets, customPresets) for preset,_ in pairs(customPresets) do @@ -2081,6 +2908,16 @@ function widget:Shutdown() if windowList then glDeleteList(windowList) end + if fontOption then + for i, font in pairs(fontOption) do + gl.DeleteFont(fontOption[i]) + end + end + if WG['guishader'] then + WG['guishader'].DeleteDlist('options') + end + gl.DeleteFont(font) + gl.DeleteFont(font2) WG['options'] = nil end @@ -2093,10 +2930,50 @@ local function Split(s, separator) return results end +local lastOptionCommand = 0 function widget:TextCommand(command) if (string.find(command, "options") == 1 and string.len(command) == 7) then show = not show end + if os.clock() > lastOptionCommand+1 and string.sub(command, 1, 7) == "option " then -- clock check is needed because toggling widget will somehow do an identical call of widget:TextCommand(command) + local option = string.sub(command, 8) + local optionID = getOptionByID(option) + if optionID then + if options[optionID].type == 'bool' then + lastOptionCommand = os.clock() + options[optionID].value = not options[optionID].value + applyOptionValue(optionID) + else + show = true + end + else + option = Split(option, ' ') + optionID = option[1] + if optionID then + optionID = getOptionByID(optionID) + if optionID and option[2] then + lastOptionCommand = os.clock() + if options[optionID].type == 'select' then + local selectKey = getSelectKey(optionID, option[2]) + if selectKey then + options[optionID].value = selectKey + applyOptionValue(optionID) + end + elseif options[optionID].type == 'bool' then + if option[2] == '0' then + options[optionID].value = false + else + options[optionID].value = true + end + applyOptionValue(optionID) + else + options[optionID].value = tonumber(option[2]) + applyOptionValue(optionID) + end + end + end + end + end if (string.find(command, "savepreset") == 1) then local words = Split(command, ' ') if words[2] then @@ -2107,10 +2984,49 @@ function widget:TextCommand(command) end end --- preserve data in case of a /luaui reload +function getSelectKey(i, value) + for k, v in pairs(options[i].options) do + if v == value then + return k + end + end + return false +end + + function widget:GetConfigData(data) savedTable = {} savedTable.customPresets = customPresets + savedTable.cameraTransitionTime = cameraTransitionTime + savedTable.cameraPanTransitionTime = cameraPanTransitionTime + savedTable.maxNanoParticles = maxNanoParticles + savedTable.currentGroupTab = currentGroupTab + savedTable.show = show + savedTable.defaultMapSunPos = defaultMapSunPos + savedTable.mapName = Game.mapName + savedTable.customMapSunPos = customMapSunPos + savedTable.savedConfig = { + vsync = {'VSync', tonumber(Spring.GetConfigInt("VSync",1) or 1)}, + water = {'Water', tonumber(Spring.GetConfigInt("Water",1) or 1)}, + disticon = {'UnitIconDist', tonumber(Spring.GetConfigInt("UnitIconDist",1) or 400)}, + particles = {'MaxParticles', tonumber(Spring.GetConfigInt("MaxParticles",1) or 10000)}, + nanoparticles = {'MaxNanoParticles', tonumber(Spring.GetConfigInt("MaxNanoParticles",1) or 500)}, + decals = {'GroundDecals', tonumber(Spring.GetConfigInt("GroundDecals",1) or 1)}, + grounddetail = {'GroundDetail', tonumber(Spring.GetConfigInt("GroundDetail",1) or 1)}, + grassdetail = {'GrassDetail', tonumber(Spring.GetConfigInt("GrassDetail",1) or 5)}, + shadows = {'Shadows', tonumber(Spring.GetConfigInt("Shadows",1) or 1)}, + advsky = {'AdvSky', tonumber(Spring.GetConfigInt("AdvSky",1) or 1)}, + camera = {'CamMode', tonumber(Spring.GetConfigInt("CamMode",1) or 1)}, + advmodelshading = {'AdvModelShading', tonumber(Spring.GetConfigInt("AdvModelShading",1) or 1)}, + advmapshading = {'AdvMapShading', tonumber(Spring.GetConfigInt("AdvMapShading",1) or 1)}, + --normalmapping = {'NormalMapping', tonumber(Spring.GetConfigInt("NormalMapping",1) or 1)}, + --treewind = {'TreeWind', tonumber(Spring.GetConfigInt("TreeWind",1) or 1)}, + hwcursor = {'HardwareCursor', tonumber(Spring.GetConfigInt("HardwareCursor",1) or 1)}, + sndvolmaster = {'snd_volmaster', tonumber(Spring.GetConfigInt("snd_volmaster",1) or 50)}, + sndvolbattle = {'snd_volbattle', tonumber(Spring.GetConfigInt("snd_volbattle",1) or 50)}, + sndvolunitreply = {'snd_volunitreply', tonumber(Spring.GetConfigInt("snd_volunitreply",1) or 50)}, + sndvolmusic = {'snd_volmusic', tonumber(Spring.GetConfigInt("snd_volmusic",1) or 50)}, + } return savedTable end @@ -2118,4 +3034,31 @@ function widget:SetConfigData(data) if data.customPresets ~= nil then customPresets = data.customPresets end + if data.cameraTransitionTime ~= nil then + cameraTransitionTime = data.cameraTransitionTime + end + if data.cameraPanTransitionTime ~= nil then + cameraPanTransitionTime = data.cameraPanTransitionTime + end + if data.maxNanoParticles ~= nil then + maxNanoParticles = data.maxNanoParticles + end + if data.currentGroupTab ~= nil then + currentGroupTab = data.currentGroupTab + end + if data.show ~= nil and Spring.GetGameFrame() > 0 then + show = data.show + end + if data.savedConfig ~= nil then + savedConfig = data.savedConfig + for k, v in pairs(savedConfig) do + Spring.SetConfigFloat(v[1],v[2]) + end + end + if data.defaultMapSunPos ~= nil and data.mapName == Game.mapName then + defaultMapSunPos = data.defaultMapSunPos + end + if data.customMapSunPos then + customMapSunPos = data.customMapSunPos + end end diff --git a/LuaUI/Widgets_Evo/gui_pauseScreen.lua b/LuaUI/Widgets_Evo/gui_pauseScreen.lua index 3e42203f8..1f0498317 100644 --- a/LuaUI/Widgets_Evo/gui_pauseScreen.lua +++ b/LuaUI/Widgets_Evo/gui_pauseScreen.lua @@ -8,7 +8,7 @@ function widget:GetInfo() author = "Floris", date = "sept 2016", license = "GNU GPL v2", - layer = -1001, + layer = 99999999, enabled = true } end @@ -16,102 +16,68 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local spGetGameSeconds = Spring.GetGameSeconds -local spGetMouseState = Spring.GetMouseState -local spEcho = Spring.Echo - -local spGetGameSpeed = Spring.GetGameSpeed - -local max = math.max +local spGetGameSpeed = Spring.GetGameSpeed local glColor = gl.Color local glTexture = gl.Texture -local glScale = gl.Scale +local glScale = gl.Scale local glPopMatrix = gl.PopMatrix local glPushMatrix = gl.PushMatrix local glTranslate = gl.Translate -local glBeginEnd = gl.BeginEnd local glTexRect = gl.TexRect -local glLoadFont = gl.LoadFont -local glDeleteFont = gl.DeleteFont +local glDeleteFont = gl.DeleteFont local glRect = gl.Rect -local glLineWidth = gl.LineWidth -local glDepthTest = gl.DepthTest +local glUseShader = gl.UseShader +local glCopyToTexture = gl.CopyToTexture +local glUniform = gl.Uniform +local glGetUniformLocation = gl.GetUniformLocation -local osClock = os.clock +local osClock = os.clock ---------------------------------------------------------------------------------- -- CONFIGURATION -local sizeMultiplier = 1 -local maxAlpha = 0.6 -local maxShaderAlpha = 0.2 -local maxNonShaderAlpha = 0.1 --background alpha when shaders arent availible -local boxWidth = 200 -local boxHeight = 35 -local slideTime = 0.4 -local fadeTime = 0.22 -local fadeToAlpha = 0 -local fadeToTextAlpha = 0.22 -local fontSizeHeadline = 24 -local fontSizeAddon = 15 -local fontPath = "LuaUI/Fonts/MicrogrammaDBold.ttf" -local autoFadeTime = 1 -local forceHideWindow = false - -local blurScreen = false -- makes use of guishader api widget - ---Color config in drawPause function - ----------------- +local fontfile = LUAUI_DIRNAME .. "fonts/unlisted/MicrogrammaDBold.ttf" +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local sizeMultiplier = 1 +local maxAlpha = 0.65 +local maxShaderAlpha = 0.25 +local maxNonShaderAlpha = 0.12 --background alpha when shaders arent availible +local boxWidth = 200 +local boxHeight = 35 +local slideTime = 0.4 +local fadeToTextAlpha = 0.4 +local fontSizeHeadline = 24 +local autoFadeTime = 1 + +local blurScreen = false -- makes use of guishader api widget + local vsx, vsy -local myFont -local autoFadeTimestamp = 0 local pauseTimestamp = -10 --start or end of pause local lastPause = false -local screenCenterX = nil -local screenCenterY = nil local wndX1 = nil local wndY1 = nil local wndX2 = nil local wndY2 = nil local textX = nil local textY = nil -local mouseOverClose = false -local checkedWindowSize = false local usedSizeMultiplier = 1 local vsx, vsy = Spring.GetWindowGeometry() local widgetInitTime = osClock() local previousDrawScreenClock = osClock() local paused = false - local shaderAlpha = 0 - -local glColor = gl.Color -local glTexture = gl.Texture -local glScale = gl.Scale -local glPopMatrix = gl.PopMatrix -local glPushMatrix = gl.PushMatrix -local glTranslate = gl.Translate -local glBeginEnd = gl.BeginEnd -local glTexRect = gl.TexRect -local glLoadFont = gl.LoadFont -local glDeleteFont = gl.DeleteFont -local glRect = gl.Rect -local glDepthTest = gl.DepthTest - -local vsx, vsy local screencopy local shaderProgram -local glUseShader = gl.UseShader -local glCopyToTexture = gl.CopyToTexture -local glTexture = gl.Texture -local glTexRect = gl.TexRect -local glUniform = gl.Uniform -local glGetUniformLocation = gl.GetUniformLocation --intensity formula based on http://alienryderflex.com/hsp.html local fragmentShaderSource = { @@ -150,17 +116,49 @@ local fragmentShaderSource = { ]], } +local gameover = false +function widget:GameOver() + gameover = true +end + +function widget:Update(dt) + local now = osClock() + previousDrawScreenClock = now + + local diffPauseTime = ( now - pauseTimestamp) + + if ( ( not paused and lastPause ) or ( paused and not lastPause ) ) then + --pause switch + pauseTimestamp = osClock() + if ( diffPauseTime <= slideTime ) then + pauseTimestamp = pauseTimestamp - ( slideTime - ( diffPauseTime / slideTime ) * slideTime ) + end + end + + if ( paused and not lastPause ) then + --new pause + if widgetInitTime + 5 > now then -- so if you do /luaui reload when paused, it wont re-animate + pauseTimestamp = now - (slideTime + autoFadeTime) + end + end + + lastPause = paused + + local _, _, isPaused = spGetGameSpeed() + if not gameover and isPaused then -- when host (admin) paused its just gamespeed 0 + paused = true + else + paused = false + end +end function widget:Initialize() vsx, vsy = widgetHandler:GetViewSizes() widget:ViewResize(vsx, vsy) - - myFont = glLoadFont( fontPath, fontSizeHeadline ) - checkedWindowSize = true - - local _, _, isPaused = spGetGameSpeed() - if isPaused then + + local _, gameSpeed, isPaused = spGetGameSpeed() + if isPaused or gameSpeed == 0 then -- when host admin paused its just gamespeed 0 paused = true end @@ -178,7 +176,6 @@ function widget:Initialize() else Spring.Echo(": GLSL not supported.") end - end function widget:Shutdown() @@ -192,49 +189,29 @@ function widget:GamePaused(playerID, isGamePaused) paused = isGamePaused end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if Spring.IsGUIHidden() then return end local now = osClock() - local drawScreenDelay = now - previousDrawScreenClock - previousDrawScreenClock = now - - local diffPauseTime = ( now - pauseTimestamp) - - local diffPauseTime = ( now - pauseTimestamp) - - if ( ( not paused and lastPause ) or ( paused and not lastPause ) ) then - --pause switch - pauseTimestamp = osClock() - if ( diffPauseTime <= slideTime ) then - pauseTimestamp = pauseTimestamp - ( slideTime - ( diffPauseTime / slideTime ) * slideTime ) - end - end - - if ( paused and not lastPause ) then - --new pause - autoFadeTimestamp = nil - if widgetInitTime + 5 > now then -- so if you do /luaui reload when paused, it wont re-animate - autoFadeTimestamp = now - autoFadeTime - pauseTimestamp = now - (slideTime + autoFadeTime) - end - end - - lastPause = paused if ( paused or ( ( now - pauseTimestamp) <= slideTime ) ) then - showPauseScreen = true + showPauseScreen = true drawPause() - if blurScreen and WG['guishader_api'] ~= nil then - WG['guishader_api'].InsertRect(0,0,vsx,vsy, 'pausescreen') + if blurScreen and WG['guishader'] then + WG['guishader'].InsertRect(0,0,vsx,vsy, 'pausescreen') end else - showPauseScreen = false - if blurScreen and WG['guishader_api'] ~= nil then - WG['guishader_api'].RemoveRect('pausescreen') + showPauseScreen = false + if blurScreen and WG['guishader'] then + WG['guishader'].RemoveRect('pausescreen') end end - - ResetGl() end @@ -283,24 +260,20 @@ function drawPause() end --draw text - myFont:Begin() - myFont:SetOutlineColor( outline ) - myFont:SetTextColor( text ) - myFont:Print( "GAME PAUSED", textX, textY, fontSizeHeadline, "O" ) - myFont:End() + font:Begin() + font:SetOutlineColor( outline ) + font:SetTextColor( text ) + font:Print( "GAME PAUSED", textX, textY, fontSizeHeadline, "O" ) + font:End() glPopMatrix() - - ResetGl() end function updateWindowCoords() - screenCenterX = vsx / 2 - screenCenterY = vsy / 2 - wndX1 = screenCenterX - boxWidth - wndY1 = screenCenterY + boxHeight - wndX2 = screenCenterX + boxWidth - wndY2 = screenCenterY - boxHeight + wndX1 = (vsx / 2) - boxWidth + wndY1 = (vsy / 2) + boxHeight + wndX2 = (vsx / 2) + boxWidth + wndY2 = (vsy / 2) - boxHeight textX = wndX1 + ( wndX2 - wndX1 ) * 0.33 textY = wndY2 + ( wndY1 - wndY2 ) * 0.4 @@ -309,7 +282,13 @@ end function widget:ViewResize(viewSizeX, viewSizeY) vsx, vsy = viewSizeX, viewSizeY usedSizeMultiplier = (0.5 + ((vsx*vsy)/5500000)) * sizeMultiplier - + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + updateWindowCoords() screencopy = gl.CreateTexture(vsx, vsy, { @@ -331,11 +310,3 @@ function widget:DrawScreenEffects() glUseShader(0) end end - -function ResetGl() - glScale(1,1,1) - glColor( { 1.0, 1.0, 1.0, 1.0 } ) - glLineWidth( 1.0 ) - glDepthTest(false) - glTexture(false) -end diff --git a/LuaUI/Widgets_Evo/gui_pip.lua b/LuaUI/Widgets_Evo/gui_pip.lua index 4f260ad05..625f5c781 100644 --- a/LuaUI/Widgets_Evo/gui_pip.lua +++ b/LuaUI/Widgets_Evo/gui_pip.lua @@ -717,7 +717,14 @@ function widget:SetConfigData(data) usingSimpleColors = data.usingSimpleColors or usingSimpleColors end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if inMinMode then DrawPanel(minModeL, minModeL + buttonSize, minModeB, minModeB + buttonSize) @@ -845,7 +852,9 @@ function widget:DrawScreen() glColor(1, 1, 1, 1) end + function widget:DrawWorld() + if chobbyInterface then return end if inMinMode then return end glColor(1, 1, 0, 0.25) glLineWidth(1.49) diff --git a/LuaUI/Widgets_Evo/gui_pip_extra1.lua b/LuaUI/Widgets_Evo/gui_pip_extra1.lua index c89c06825..f3c9eb772 100644 --- a/LuaUI/Widgets_Evo/gui_pip_extra1.lua +++ b/LuaUI/Widgets_Evo/gui_pip_extra1.lua @@ -712,7 +712,14 @@ function widget:SetConfigData(data) usingSimpleColors = data.usingSimpleColors or usingSimpleColors end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if inMinMode then DrawPanel(minModeL, minModeL + buttonSize, minModeB, minModeB + buttonSize) diff --git a/LuaUI/Widgets_Evo/gui_pip_extra2.lua b/LuaUI/Widgets_Evo/gui_pip_extra2.lua index e2a91af57..890f12d8b 100644 --- a/LuaUI/Widgets_Evo/gui_pip_extra2.lua +++ b/LuaUI/Widgets_Evo/gui_pip_extra2.lua @@ -712,7 +712,14 @@ function widget:SetConfigData(data) usingSimpleColors = data.usingSimpleColors or usingSimpleColors end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if inMinMode then DrawPanel(minModeL, minModeL + buttonSize, minModeB, minModeB + buttonSize) diff --git a/LuaUI/Widgets_Evo/gui_player_color_palette.lua b/LuaUI/Widgets_Evo/gui_player_color_palette.lua deleted file mode 100644 index 645721178..000000000 --- a/LuaUI/Widgets_Evo/gui_player_color_palette.lua +++ /dev/null @@ -1,226 +0,0 @@ -function widget:GetInfo() - return { - name = "Player Color Palette", - desc = "Applies an evenly distributed color palette among players. Toggle randomized colors with /shufflecolors, order by hue with /ordercolors", - author = "Floris", - date = "March 2017", - license = "GPL v2", - layer = -10001, - enabled = true, - } -end - -local randomize = false -- randomize player colors -local offsetstartcolor = true -- when false it will always use red as start color, when true it starts with an offset towards center of rgb hue palette more in effect with small playernumbers -local useSameTeamColors = false - -local GaiaTeam = Spring.GetGaiaTeamID() -local GaiaTeamColor = {255,0,0 } - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function hue2rgb(p, q, t) - if (t < 0) then t = t + 1 end - if (t > 1) then t = t - 1 end - if (t < 1/6) then return p + (q - p) * 6 * t end - if (t < 1/2) then return q end - if (t < 2/3) then return p + (q - p) * (2/3 - t) * 6 end - return p -end - -local function hslToRgb(h, s, l) - local r, g, b - if s == 0 then - r = l - g = l - b = l - else - local q = l + s - l * s - if l < 0.5 then - q = l * (1 + s) - end - local p = 2 * l - q - r = hue2rgb(p, q, h + 1/3) - g = hue2rgb(p, q, h) - b = hue2rgb(p, q, h - 1/3) - end - return r,g,b -end - -local function GetColor(i, teams) - local s = 1 - local l = 0.53 - local h = 0 - --if i > (teams * 0.33) then l = 0.7 end - --if i > (teams * 0.66) then l = 0.3 end - if teams > 10 then - if i%3==0 then - l = 0.88 - end - if i%3==2 then - l = 0.25 - end - else - if teams > 6 then - if i%2==0 then - l = 0.8 - end - if i%2==1 then - l = 0.42 - end - end - end - - local r,g,b = 0,0,0 - local hueteams = teams - local useHueRGB = true - if teams > 7 then - hueteams = hueteams - 1 - if i == teams then - r,g,b = 0.5, 0.5, 0.5 - useHueRGB = false - end - end - if teams > 11 then - hueteams = hueteams - 1 - if i == teams-1 then - r,g,b = 0.9, 0.9, 0.9 - useHueRGB = false - end - end - if teams > 15 then - hueteams = hueteams - 1 - if i == teams-2 then - r,g,b = 0, 0, 0 - useHueRGB = false - end - end - - if useHueRGB then - local offset = 0 - if offsetstartcolor then - offset = 1 / (hueteams*6) - end - h = ((i-1)/(hueteams*(1.035+offset))) + offset - r,g,b = hslToRgb(h, s, l) -- teams *1.1 so last teamcolor isnt very similar to first teamcolor - end - return r,g,b -end - -local colorOrder = {} -local function GetShuffledNumber(i, numteams) - local n - while true do - n = math.floor((math.random() * numteams) + 1.5) - if colorOrder[n] == nil then - colorOrder[n] = i - return n - end - end -end - -local function SetNewTeamColors() - local allyTeamList = Spring.GetAllyTeamList() - local numteams = #Spring.GetTeamList() - 1 -- minus gaia - local numallyteams = #Spring.GetAllyTeamList() - 1 -- minus gaia - - colorOrder = {} - local i = 0 - local r,g,b - for _, allyID in ipairs(allyTeamList) do - if useSameTeamColors then - i = i + 1 - end - for _, teamID in ipairs(Spring.GetTeamList(allyID)) do - if teamID == GaiaTeam then - Spring.SetTeamColor(teamID, GaiaTeamColor[1],GaiaTeamColor[2],GaiaTeamColor[3]) - else - if not useSameTeamColors then - if randomize then - i = GetShuffledNumber(i, numteams) - else - i = i + 1 - end - r,g,b = GetColor(i, numteams) - else - r,g,b = GetColor(i, numallyteams) - end - - local _, playerID = Spring.GetTeamInfo(teamID) - local name = playerID and Spring.GetPlayerInfo(playerID) or 'noname' - Spring.SetTeamColor(teamID, r,g,b) - end - end - end -end - -local function ResetOldTeamColors() - for _,team in ipairs(Spring.GetTeamList()) do - Spring.SetTeamColor(team,Spring.GetTeamOrigColor(team)) - end -end - - -function ordercolors(_,_,params) - local oldRandomize = randomize - randomize = false - if oldRandomize == randomize then - Spring.Echo("Player Color Palette: Player colors are already ordered by hue") - else - SetNewTeamColors() - Spring.SendCommands("luarules reloadluaui") -- cause several widgets are still using old colors - end -end - -function shufflecolors(_,_,params) - randomize = true - SetNewTeamColors() - Spring.SendCommands("luarules reloadluaui") -- cause several widgets are still using old colors -end - -function widget:Initialize() - WG['playercolorpalette'] = {} - WG['playercolorpalette'].getRandomize = function() - return randomize - end - WG['playercolorpalette'].setRandomize = function(value) - randomize = value - SetNewTeamColors() - end - WG['playercolorpalette'].getSameTeamColors = function() - return useSameTeamColors - end - WG['playercolorpalette'].setSameTeamColors = function(value) - useSameTeamColors = value - SetNewTeamColors() - Spring.SendCommands("luarules reloadluaui") -- cause several widgets are still using old colors - end - - widgetHandler:AddAction("shufflecolors", shufflecolors, nil, "t") - widgetHandler:AddAction("ordercolors", ordercolors, nil, "t") - - SetNewTeamColors() -end - -function widget:Shutdown() - ResetOldTeamColors() - WG['playercolorpalette'] = nil -end - - -function widget:GetConfigData(data) - savedTable = {} - savedTable.randomize = randomize - savedTable.useSameTeamColors = useSameTeamColors - return savedTable -end - -function widget:SetConfigData(data) - if data.randomize ~= nil then - randomize = data.randomize - end - if data.useSameTeamColors ~= nil then - useSameTeamColors = data.useSameTeamColors - end -end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_point_tracker.lua b/LuaUI/Widgets_Evo/gui_point_tracker.lua index c46b03a07..a9e8847f7 100644 --- a/LuaUI/Widgets_Evo/gui_point_tracker.lua +++ b/LuaUI/Widgets_Evo/gui_point_tracker.lua @@ -95,7 +95,14 @@ function widget:Initialize() myPlayerID = Spring.GetMyPlayerID() end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if (not on) then return end glLineWidth(lineWidth) diff --git a/LuaUI/Widgets_Evo/gui_power_range.lua b/LuaUI/Widgets_Evo/gui_power_range.lua index a3183181b..f89204a00 100644 --- a/LuaUI/Widgets_Evo/gui_power_range.lua +++ b/LuaUI/Widgets_Evo/gui_power_range.lua @@ -52,7 +52,14 @@ local function DrawTexturedGroundQuadFromU(u) DrawTexturedGroundQuadFromUdXZ(Spring.GetUnitDefID(u),x,z) end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorldPreUnit() + if chobbyInterface then return end -- Units being placed local _,cmd=Spring.GetActiveCommand() diff --git a/LuaUI/Widgets_Evo/gui_red_battleroom.lua b/LuaUI/Widgets_Evo/gui_red_battleroom.lua index 89997ab42..70adc3089 100644 --- a/LuaUI/Widgets_Evo/gui_red_battleroom.lua +++ b/LuaUI/Widgets_Evo/gui_red_battleroom.lua @@ -304,7 +304,7 @@ local function createconsole(r) b.active = false b.py = b.py+(i-1)*r.fontsize counters[#counters+1] = b - table.insert(background.movableslaves,b) + background.movableslaves[#background.movableslaves+1] = b end --tooltip @@ -379,7 +379,7 @@ local function clipLine(line,fontsize,maxwidth) break end end - + -- check if we need to clip again local width = glGetTextWidth(line)*fontsize if (width <= maxwidth) then @@ -435,12 +435,6 @@ local function convertColor(r,g,b) end local function processLine(line,g,cfg,newlinecolor) - if (g.vars.browsinghistory) then - if (g.vars.historyoffset == nil) then - g.vars.historyoffset = 0 - end - g.vars.historyoffset = g.vars.historyoffset + 1 - end g.vars.nextupdate = 0 @@ -470,9 +464,9 @@ local function processLine(line,g,cfg,newlinecolor) local text = "" local linetype = 0 --other if Initialized == true then - ignoreThisMessage = false + ignoreThisMessage = false else - ignoreThisMessage = false + ignoreThisMessage = false end local playSound = false @@ -481,7 +475,11 @@ local function processLine(line,g,cfg,newlinecolor) registermyname = true ignoreThisMessage = true end - + + if sfind(line, "Input grabbing is ") then + ignoreThisMessage = true + end + if (not newlinecolor) then if (names[ssub(line,2,(sfind(line,"> ") or 1)-1)] ~= nil) then ignoreThisMessage = true @@ -596,11 +594,11 @@ local function processLine(line,g,cfg,newlinecolor) end if registermyname and not nameregistered then - myname = name - registermyname = false - nameregistered = true - ignoreThisMessage = true - -- Spring.SendCommands("wByNum "..regID.." Registered as "..myname) + myname = name + registermyname = false + nameregistered = true + ignoreThisMessage = true + -- Spring.SendCommands("wByNum "..regID.." Registered as "..myname) end -- filter shadows config changes @@ -611,7 +609,11 @@ local function processLine(line,g,cfg,newlinecolor) if sfind(line,"->") then ignoreThisMessage = true end - + + -- filter hash messages: server= / client= + if sfind(line,"server=[0-9a-z][0-9a-z][0-9a-z][0-9a-z]") or sfind(line,"client=[0-9a-z][0-9a-z][0-9a-z][0-9a-z]") then + ignoreThisMessage = true + end -- filter Sync error when its a spectator --if sfind(line,"^Sync error for ") then @@ -766,10 +768,16 @@ local function processLine(line,g,cfg,newlinecolor) end if (not ignoreThisMessage) then --mute-- + if (g.vars.browsinghistory) then + if (g.vars.historyoffset == nil) then + g.vars.historyoffset = 0 + end + g.vars.historyoffset = g.vars.historyoffset + 1 + end local lineID = #history+1 history[#history+1] = {line,clock(),lineID,textcolor,linetype} - if ( playSound ) then + if ( playSound and not Spring.IsGUIHidden() ) then spPlaySoundFile( SoundIncomingChat, SoundIncomingChatVolume, nil, "ui" ) end end diff --git a/LuaUI/Widgets_Evo/gui_red_buildordermenu-EvoRTS.lua b/LuaUI/Widgets_Evo/gui_red_buildordermenu-EvoRTS.lua new file mode 100644 index 000000000..e11f09536 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_red_buildordermenu-EvoRTS.lua @@ -0,0 +1,1413 @@ +function widget:GetInfo() + return { + version = "9.1", + name = "Red Build/Order Menu - EvoRTS", + desc = "Requires Red UI Framework", + author = "Regret, modified by CommonPlayer", + date = "29 may 2015", --modified by CommonPlayer, Oct 2016 + license = "GNU GPL, v2 or later", + layer = -10, + enabled = false, --enabled by default + handler = true, --can use widgetHandler:x() + } +end + +-- build hotkeys stuff +local building = -1 +local buildStartKey = 98 +local buildNextKey = 110 +local buildKeys = {113, 119, 101, 114, 116, 97, 115, 100, 102, 103, 122, 120, 99, 118, 98} +local buildLetters = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} +local highlightedIcons = {} +local highlightedIconsLeng = 0 + +local stateTexture = "LuaUI/Images/resbar.dds" +local buttonTexture = "LuaUI/Images/button.dds" +local barGlowCenterTexture = ":n:LuaUI/Images/barglow-center.png" +local barGlowEdgeTexture = ":n:LuaUI/Images/barglow-edge.png" + +local sound_queue_add = 'LuaUI/Sounds/buildbar_add.wav' +local sound_queue_rem = 'LuaUI/Sounds/buildbar_rem.wav' +local sound_button = 'LuaUI/Sounds/buildbar_waypoint.wav' + +local NeededFrameworkVersion = 9 +local CanvasX,CanvasY = 1272,734 --resolution in which the widget was made (for 1:1 size) +--1272,734 == 1280,768 windowed + +--todo: build categories (eco | labs | defences | etc) basically sublists of buildcmds (maybe for regular orders too) + +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) + +local playSounds = true +local iconScaling = true +local largeInfo = false +local shortcutsInfo = true +local highlightscale = true +local drawPrice = true +local drawTooltip = true +local drawBigTooltip = false +local largePrice = true +local oldUnitpics = false +local largeUnitIcons = false + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (1 + (vsx*vsy / 7500000)) + +local normalUnitIconSize = { + isx = 45,isy = 40, --icon size + ix = 5,iy = 8, --icons x/y +} +local largeUnitIconSize = { + isx = 50,isy = 45, --icon size + ix = 5,iy = 7, --icons x/y +} +local normalOrderIconSize = { + isx = 45,isy = 33, --icon size + ix = 5,iy = 4, --icons x/y +} +local largeOrderIconSize = { + isx = 50,isy = 33, --icon size + ix = 5,iy = 4, --icons x/y +} + +local buildPicHelp = Spring.GetConfigInt("evo_buildpichelp", 1) +--Assume that if it isn't set, buildPicHelp is true +if buildPicHelp == nil then + buildPicHelp = 1 +end + +local maxSupply = tonumber(Spring.GetModOptions().supplycap) or 400 + +local Config = { + buildmenu = { + menuname = "buildmenu", + px = 0,py = CanvasY - 415, --default start position + + isx = 45,isy = 40, --icon size + ix = 5,iy = 8, --icons x/y + + roundedPercentage = 0.2, -- 0.25 == iconsize / 4 == cornersize + + iconscale = 0.925, + iconhoverscale = 0.925, + ispreadx=0,ispready=0, --space between icons + + margin = 5, --distance from background border + + padding = 4*widgetScale, -- for border effect + color2 = {1,1,1,ui_opacity*0.045}, -- for border effect + + fadetime = 0.14, --fade effect time, in seconds + fadetimeOut = 0.022, --fade effect time, in seconds + + ctext = {1,1,1,1}, --color {r,g,b,alpha} + cbackground = {0,0,0,ui_opacity}, + cborder = {0,0,0,1}, + cbuttonbackground = {0.1,0.1,0.1,1}, + dragbutton = {2,3}, --middle mouse button + tooltip = { + background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag the buildmenu.", + }, + }, + + ordermenu = { + menuname = "ordermenu", + px = 0,py = CanvasY - 415 - 145, + + isx = 45,isy = 33, + ix = 5,iy = 4, + + roundedPercentage = 0.2, -- 0.25 == iconsize / 4 == cornersize + + iconscale = 0.93, + iconhoverscale = 0.93, + ispreadx=0,ispready=0, + + margin = 5, + + padding = 4*widgetScale, -- for border effect + color2 = {1,1,1,0.025}, -- for border effect + + fadetime = 0.1, + fadetimeOut = 0.015, --fade effect time, in seconds + + ctext = {1,1,1,1}, + cbackground = {0,0,0,ui_opacity}, + cborder = {0,0,0,1}, + cbuttonbackground={0.1,0.1,0.1,1}, + + dragbutton = {2,3}, --middle mouse button + tooltip = { + background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag the ordermenu.", + }, + }, +} + + +function widget:ViewResize(newX,newY) + vsx, vsy = gl.GetViewSizes() + widgetScale = (1 + (vsx*vsy / 7500000)) + Config.buildmenu.padding = 3*widgetScale + Config.ordermenu.padding = 3*widgetScale +end + +local guishaderEnabled = WG['guishader'] or false + +local sGetSelectedUnitsCount = Spring.GetSelectedUnitsCount +local sGetActiveCommand = Spring.GetActiveCommand +local sGetActiveCmdDescs = Spring.GetActiveCmdDescs +local ssub = string.sub + +local function IncludeRedUIFrameworkFunctions() + New = WG.Red.New(widget) + Copy = WG.Red.Copytable + SetTooltip = WG.Red.SetTooltip + GetSetTooltip = WG.Red.GetSetTooltip + Screen = WG.Red.Screen + GetWidgetObjects = WG.Red.GetWidgetObjects +end + +local function RedUIchecks() + local color = "\255\255\255\1" + local passed = true + if (type(WG.Red)~="table") then + Spring.Echo(color..widget:GetInfo().name.." requires Red UI Framework.") + passed = false + elseif (type(WG.Red.Screen)~="table") then + Spring.Echo(color..widget:GetInfo().name..">> strange error.") + passed = false + elseif (WG.Red.Version < NeededFrameworkVersion) then + Spring.Echo(color..widget:GetInfo().name..">> update your Red UI Framework.") + passed = false + end + if (not passed) then + widgetHandler:ToggleWidget(widget:GetInfo().name) + return false + end + IncludeRedUIFrameworkFunctions() + return true +end + +local function AutoResizeObjects() --autoresize v2 + if (LastAutoResizeX==nil) then + LastAutoResizeX = CanvasX + LastAutoResizeY = CanvasY + end + local lx,ly = LastAutoResizeX,LastAutoResizeY + local vsx,vsy = Screen.vsx,Screen.vsy + if ((lx ~= vsx) or (ly ~= vsy)) then + local objects = GetWidgetObjects(widget) + local scale = vsy/ly + local skippedobjects = {} + for i=1,#objects do + local o = objects[i] + local adjust = 0 + if ((o.movableslaves) and (#o.movableslaves > 0)) then + adjust = (o.px*scale+o.sx*scale)-vsx + if (((o.px+o.sx)-lx) == 0) then + o._moveduetoresize = true + end + end + if (o.px) then o.px = o.px * scale end + if (o.py) then o.py = o.py * scale end + if (o.sx) then o.sx = o.sx * scale end + if (o.sy) then o.sy = o.sy * scale end + if (o.fontsize) then o.fontsize = o.fontsize * scale end + if (adjust > 0) then + o._moveduetoresize = true + o.px = o.px - adjust + for j=1,#o.movableslaves do + local s = o.movableslaves[j] + s.px = s.px - adjust/scale + end + elseif ((adjust < 0) and o._moveduetoresize) then + o._moveduetoresize = nil + o.px = o.px - adjust + for j=1,#o.movableslaves do + local s = o.movableslaves[j] + s.px = s.px - adjust/scale + end + end + end + LastAutoResizeX,LastAutoResizeY = vsx,vsy + end +end + +local function esc(x) + return (x:gsub('%%', '%%%%') + :gsub('^%^', '%%^') + :gsub('%$$', '%%$') + :gsub('%(', '%%(') + :gsub('%)', '%%)') + :gsub('%.', '%%.') + :gsub('%[', '%%[') + :gsub('%]', '%%]') + :gsub('%*', '%%*') + :gsub('%+', '%%+') + :gsub('%-', '%%-') + :gsub('%?', '%%?')) +end + +function wrap(str, limit) + limit = limit or 72 + local here = 1 + local buf = "" + local t = {} + str:gsub("(%s*)()(%S+)()", + function(sp, st, word, fi) + if fi-here > limit then + --# Break the line + here = st + t[#t+1] = buf + buf = word + else + buf = buf..sp..word --# Append + end + end) + --# Tack on any leftovers + if(buf ~= "") then + t[#t+1] = buf + end + return t +end + WG.hoverID = nil +local function CreateGrid(r) + + local background2 = {"rectanglerounded", + px=r.px+r.padding,py=r.py+r.padding, + sx=(r.isx*r.ix+r.ispreadx*(r.ix-1) +r.margin*2) -r.padding -r.padding, + sy=(r.isy*(r.iy)+r.ispready*(r.iy) +r.margin*2) -r.padding -r.padding, + color=r.color2, + roundedsize=r.padding*1.45, + } + local background = {"rectanglerounded", + px=r.px,py=r.py, + sx=r.isx*r.ix+r.ispreadx*(r.ix-1) +r.margin*2, + sy=r.isy*(r.iy)+r.ispready*(r.iy) +r.margin*2, + color=r.cbackground, + border=r.cborder, + movable=r.dragbutton, + obeyscreenedge = true, + overrideclick = {1}, + + padding=r.padding, + + guishader=true, + effects = { + fadein_at_activation = r.fadetime, + fadeout_at_deactivation = r.fadetimeOut, + }, + onupdate=function(self) + background2.px = self.px + self.padding + background2.py = self.py + self.padding + background2.sx = self.sx - self.padding - self.padding + background2.sy = self.sy - self.padding - self.padding + end, + } + + local selecthighlight = {"rectanglerounded", + roundedsize = math.floor(r.isy*r.roundedPercentage), + px=0,py=0, + sx=r.isx,sy=r.isy, + iconscale=(iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and r.iconscale or 1), + color={1,0,0,0.26}, + border={0.8,0,0,0}, + glone=0.12, + texture = "LuaUI/Images/button-pushed.dds", + texturecolor={1,0,0,0.15}, + + active=false, + onupdate=function(self) + self.active = false + end, + } + + local mouseoverhighlight = Copy(selecthighlight,true) + mouseoverhighlight.color={1,1,1,0.08} + mouseoverhighlight.border={1,1,1,0} + mouseoverhighlight.texture = "LuaUI/Images/button-highlight.dds" + mouseoverhighlight.texturecolor={1,1,1,0.08} + + local heldhighlight = Copy(selecthighlight,true) + heldhighlight.color={1,0.75,0,0.06} + heldhighlight.border={1,1,0,0} + heldhighlight.texture = "LuaUI/Images/button-pushed.dds" + heldhighlight.texturecolor={1,0.75,0,0.06} + + local icon = {"rectangle", + px=0,py=0, + sx=r.isx,sy=r.isy, + iconscale=(iconScaling and r.iconscale or 1), + iconhoverscale=(iconScaling and r.iconhoverscale or 1), + iconnormalscale=(iconScaling and r.iconscale or 1), + roundedsize = math.floor(r.isy*r.roundedPercentage), + color={0,0,0,0}, + border={0,0,0,0}, + options="n", --disable colorcodes + captioncolor=r.ctext, + font2 = true, + + overridecursor = true, + overrideclick = {3}, + + mouseheld={ + {1,function(mx,my,self) + self.iconscale=(iconScaling and self.iconhoverscale or 1) + --if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then + -- heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) + --else + -- heldhighlight.iconscale = self.iconscale + --end + heldhighlight.iconscale = self.iconscale + heldhighlight.color={1,0.75,0,0.06} + heldhighlight.px = self.px + heldhighlight.py = self.py + heldhighlight.active = nil + end}, + {3,function(mx,my,self) + self.iconscale=(iconScaling and self.iconhoverscale or 1) + --if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then + -- heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) + --else + -- heldhighlight.iconscale = self.iconscale + --end + heldhighlight.iconscale = self.iconscale + heldhighlight.color={1,0.2,0,0.06} + heldhighlight.px = self.px + heldhighlight.py = self.py + heldhighlight.active = nil + end}, + }, + + --[[mouserelease={ + {1,function(mx,my,self) + if r.menuname == "buildmenu" then + self.iconscale=(iconScaling and self.iconhoverscale or 1) + if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then + heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) + else + heldhighlight.iconscale = self.iconscale + end + heldhighlight.px = self.px + heldhighlight.py = self.py + heldhighlight.active = nil + end + end}, + },]]-- + + mouseover=function(mx,my,self) + self.iconscale=(iconScaling and self.iconhoverscale or 1) + mouseoverhighlight.iconscale=(iconScaling and self.iconhoverscale or 1) + mouseoverhighlight.px = self.px + mouseoverhighlight.py = self.py + mouseoverhighlight.active = nil + local tt = self.tooltip + if r.menuname == "buildmenu" then + if self.texture ~= nil and self.udid then--string.sub(self.texture, 1, 1) == '#' then + local udefid = self.udid --tonumber(string.sub(self.texture, 2)) + WG.hoverID = udefid + local alt, ctrl, meta, shift = Spring.GetModKeyState() + if not meta and drawTooltip and WG['tooltip'] ~= nil then + local text = "\255\215\255\215"..UnitDefs[udefid].humanName.."\n\255\240\240\240" + if drawBigTooltip and UnitDefs[udefid].customParams.description_long ~= nil then + local lines = wrap(UnitDefs[udefid].customParams.description_long, 58) + local description = '' + local newline = '' + for i, line in ipairs(lines) do + description = description..newline..line + newline = '\n' + end + text = text..description + else + text = text..UnitDefs[udefid].tooltip + end + WG['tooltip'].ShowTooltip('redui_buildmenu', text) + tt = string.gsub(tt, esc("Build: "..UnitDefs[udefid].humanName.." - "..UnitDefs[udefid].tooltip).."\n", "") + end + end + end + if drawPrice and tt ~= nil then + tt = string.gsub(tt, "Metal cost %d*\nEnergy cost %d*\n", "") + end + SetTooltip(tt) + if r.menuname == "ordermenu" then + mouseoverhighlight.texturecolor={1,1,1,0.02} + end + --[[ + if r.menuname == "buildmenu" then + local CurMouseState = {Spring.GetMouseState()} --{mx,my,m1,m2,m3} + if CurMouseState[3] or CurMouseState[5] then + if self.cmdid ~= nil then + Spring.SetActiveCommand(Spring.GetCmdDescIndex(self.cmdid),1,true,false,Spring.GetModKeyState()) + end + end + end]]-- + end, + + onupdate=function(self) + local _,_,_,curcmdname = sGetActiveCommand() + self.iconscale= (iconScaling and self.iconnormalscale or 1) + --selecthighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) + selecthighlight.iconscale = (iconScaling and self.iconhoverscale or 1) + if (curcmdname ~= nil) then + if (self.cmdname == curcmdname) then + selecthighlight.px = self.px + selecthighlight.py = self.py + selecthighlight.active = nil + end + end + end, + + effects = background.effects, + + active=false, + } + + New(background) + New(background2) + + local backward = New(Copy(icon,true)) + backward.texture = "LuaUI/Images/backward.dds" + + local forward = New(Copy(icon,true)) + forward.texture = "LuaUI/Images/forward.dds" + + local indicator = New({"rectangle", + px=0,py=0, + sx=r.isx,sy=r.isy, + captioncolor=r.ctext, + options = "n", + + effects = background.effects, + }) + background.movableslaves={backward,forward,indicator} + + local icons = {} + for y=1,r.iy do + for x=1,r.ix do + local b = New(Copy(icon,true)) + b.px = background.px +r.margin + (x-1)*(r.ispreadx + r.isx) + b.py = background.py +r.margin + (y-1)*(r.ispready + r.isy) + background.movableslaves[#background.movableslaves+1] = b + icons[#icons+1] = b + if ((y==r.iy) and (x==r.ix)) then + backward.px = icons[#icons-r.ix+1].px + forward.px = icons[#icons].px + indicator.px = (forward.px + backward.px)/2 + + backward.py = icons[#icons-r.ix].py + r.isy + r.ispready + forward.py = backward.py + indicator.py = backward.py + end + end + end + + local text = {"rectangle", + px,py = 0, 0, + sx=r.isx,sy=r.isy, + captioncolor={0.8,0.8,0.8,1}, + caption = nil, + options = "on", + } + local texts = {} + for y=1,r.iy do + for x=1,r.ix do + local b = New(Copy(text,true)) + b.px = background.px +r.margin + (x-1)*(r.ispreadx + r.isx) + b.py = background.py +r.margin + (y-1)*(r.ispready + r.isy) + background.movableslaves[#background.movableslaves+1] = b + texts[#texts+1] = b + end + end + + local staterect = {"rectangle", + border = r.cborder, + texture = stateTexture, + texturecolor = r.cborder, + effects = background.effects, + } + local staterectangles = {} + local staterectanglesglow = {} + + New(selecthighlight) + New(mouseoverhighlight) + New(heldhighlight) + + --tooltip + background.mouseover = function(mx,my,self) SetTooltip(r.tooltip.background) end + + return { + ["menuname"] = r.menuname, + ["background"] = background, + ["background2"] = background2, + ["icons"] = icons, + ["backward"] = backward, + ["forward"] = forward, + ["indicator"] = indicator, + ["staterectangles"] = staterectangles, + ["staterectanglesglow"] = staterectanglesglow, + ["staterect"] = staterect, + ["texts"] = texts, + } +end + + +local function UpdateGrid(g,cmds,ordertype) + if (#cmds==0) then + g.background.active = false + g.background2.active = false + else + g.background.active = nil + g.background2.active = nil + end + + local curpage = g.page + local icons = g.icons + local page = {{}} + + + local visibleIconCount = #icons + if #cmds > #icons then + visibleIconCount = visibleIconCount - Config[g.menuname].ix + end + for i=1,#cmds do + local index = i-(#page-1)*visibleIconCount + page[#page][index] = cmds[i] + if ((i == (visibleIconCount*#page)) and (i~=#cmds)) then + page[#page+1] = {} + end + end + g.pagecount = #page + + + if (curpage > g.pagecount) then + curpage = 1 + end + + local iconsleft = (#icons-#page[curpage]) + if (iconsleft > 0) then + for i=iconsleft+#page[curpage],#page[curpage]+1,-1 do + icons[i].active = false --deactivate + end + end + + for i=1,#g.staterectangles do + g.staterectangles[i].active = false + end + local usedstaterectangles = 0 + + for i=1,#g.staterectanglesglow do + g.staterectanglesglow[i].active = false + end + local usedstaterectanglesglow = 0 + + for i=1,#g.texts do + local text = g.texts[i] + text.caption = nil + end + + for i=1,#page[curpage] do + local cmd = page[curpage][i] + local icon = icons[i] + icon.tooltip = cmd.tooltip + icon.active = nil --activate + icon.cmdname = cmd.name + if icon.cmdname == "Repair" then icon.cmdname = "Build" end -- hack for Evo + icon.cmdid = cmd.id + icon.texture = nil + if (cmd.texture) then + if (cmd.texture ~= "") then + icon.texture = cmd.texture + end + end + + local myTeamID = Spring.GetMyTeamID() + local disableString = "disallowed_" .. (-cmd.id) + local powerBlocked = cmd.disabled + local supplyBlocked = Spring.GetTeamRulesParam(myTeamID, disableString) == 1 + + if (powerBlocked or supplyBlocked) then + icon.texturecolor = {0.44,0.44,0.44,1} + else + icon.texturecolor = {1,1,1,1} + end + + icon.mouseclick = { + {1,function(mx,my,self) + mouseClicked = 2 + if playSounds then + Spring.PlaySoundFile(sound_queue_add, 0.75, 'ui') + end + Spring.SetActiveCommand(Spring.GetCmdDescIndex(cmd.id),1,true,false,Spring.GetModKeyState()) + end}, + {3,function(mx,my,self) + mouseClicked = 2 + if playSounds then + Spring.PlaySoundFile(sound_queue_rem, 0.75, 'ui') + end + Spring.SetActiveCommand(Spring.GetCmdDescIndex(cmd.id),3,false,true,Spring.GetModKeyState()) + end}, + } + + if (ordertype == 1) then --build icons + icon.texture = "#"..cmd.id*-1 + icon.udid = cmd.id*-1 + + if (cmd.params[1]) then + icon.options = "bs" + icon.caption = "\n"..cmd.params[1].." \n" + else + icon.caption = nil + end + --icon.texturecolor = {0.88,0.88,0.88,1} + + --text to show build hotkey + local white = "\255\255\255\255" + local offwhite = "\255\222\222\222" + local yellow = "\255\255\255\0" + local orange = "\255\255\135\0" + local green = "\255\0\255\0" + local red = "\255\255\0\0" + local skyblue = "\255\136\197\226" + + local s, e = string.find(cmd.tooltip, "Metal cost %d*") + local metalCost = string.sub(cmd.tooltip, s + 11, e) + local s, e = string.find(cmd.tooltip, "Energy cost %d*") + local energyCost = string.sub(cmd.tooltip, s + 12, e) + --local metalColor = "\255\136\197\226" + + + local text = g.texts[i] + text.px = icon.px + text.py = icon.py + if powerBlocked then + text.caption = red.."\nTech\nRequired\n\n" + elseif supplyBlocked then + text.caption = red.."\nSupply\nNeeded\n\n" + else + local captionColor = white + +-- If you don't want to display the metal or energy cost on the unit buildicon, then you can disable it here + + -- redui adjusts position based on text length, so adding spaces helps us putting it at the left side of the icon + --local str = tostring(math.max(metalCost, energyCost)) + --local addedSpaces = " " -- too bad 1 space isnt as wide as 1 number in the used font + --local infoNewline = '\n' + --if largeInfo then + -- addedSpaces = " " -- too bad 1 space isnt as wide as 1 number in the used font + -- infoNewline = '' + --end + --for digit in string.gmatch(str, "%d") do + -- addedSpaces = string.sub(addedSpaces, 0, -2) + --end + + local shotcutCaption = '' + if shortcutsInfo then + if i <= 15 then + if building == 0 then + captionColor = skyblue + end + text.caption = captionColor..buildLetters[buildStartKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i]-96].."\n\n\n\n"..skyblue.." M: "..metalCost..offwhite.."\n"..yellow.." E: "..energyCost + text.options = "bs" + elseif i <= 30 then + if building == 1 then + captionColor = skyblue + end + text.caption = captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i-15]-96].."\n\n\n\n"..skyblue.." M: "..metalCost..offwhite.."\n"..yellow.." E: "..energyCost + text.options = "bs" + elseif i <= 45 then + if building == 2 then + captionColor = skyblue + end + text.caption = captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i-30]-96].."\n\n\n\n"..skyblue.." M: "..metalCost..offwhite.."\n"..yellow.." E: "..energyCost + text.options = "bs" + else + text.caption = nil + end + end + end + else + if buttonTexture ~= nil then + icon.texture = buttonTexture + end + if (cmd.type == 5) then --state cmds (fire at will, etc) + icon.caption = " "..(cmd.params[cmd.params[1]+2] or icon.cmdname).." " + + local statecount = #cmd.params-1 --number of states for the cmd + local curstate = cmd.params[1]+1 + + local scale = icon.iconscale * 0.9 + local px = icon.px + ((icon.sx * (1-scale))/2) + local py = icon.py + ((icon.sy * (1-scale))/2) + local sx = icon.sx * scale + local sy = icon.sy * scale + local usr = nil + + for i=1,statecount do + usedstaterectangles = usedstaterectangles + 1 + local s = g.staterectangles[usedstaterectangles] + if (s == nil) then + s = New(Copy(g.staterect,true)) + g.staterectangles[usedstaterectangles] = s + g.background.movableslaves[#g.background.movableslaves+1] = s + end + s.active = nil --activate + + + local spread = 7 + s.sx = (sx-(spread*(statecount-1+2)))/statecount + s.sy = (sy/8.5) + s.px = px+spread + (s.sx+spread)*(i-1) + s.py = py + sy - s.sy - spread + + --s.sx = (icon.sx-(spread*(statecount-1+2)))/statecount + --s.sy = (icon.sy/7) + --s.px = icon.px+spread + (s.sx+spread)*(i-1) + --s.py = icon.py + icon.sy - s.sy -spread + s.border = {0.22,0.22,0.22,0.8} + + if (i == curstate) then + usr = usedstaterectangles + if (statecount < 4) then + if (i == 1) then + s.color = {0.93,0,0,1} + s.border = {0.93,0,0,1} + elseif (i == 2) then + if (statecount == 3) then + s.color = {0.93,0.93,0,1} + s.border = {0.93,0.93,0,1} + else + s.color = {0,0.93,0,1} + s.border = {0,0.93,0,1} + end + elseif (i == 3) then + s.color = {0,0.93,0,1} + s.border = {0,0.93,0,1} + end + else + s.color = {0.93,0.93,0.93,1} + s.border = {0.93,0.93,0.93,1} + end + s.border[4] = 0.3 + else + s.color = nil + end + if s.color == nil then + s.texturecolor = s.border + else + s.texturecolor = s.color + end + end + + -- add glow for current state + if (g.staterectangles[usr] ~= nil) then + s = g.staterectangles[usr] + usedstaterectanglesglow = usedstaterectanglesglow + 1 + local s2 = g.staterectanglesglow[usedstaterectanglesglow] + if (s2 == nil) then + s2 = New(Copy(g.staterectangles[usr],true)) + g.staterectanglesglow[usedstaterectanglesglow] = s2 + g.background.movableslaves[#g.background.movableslaves+1] = s2 + end + + local glowSize = s.sy * 6 + s2.sy = s.sy + glowSize + glowSize + s2.py = s.py - glowSize + s2.px = s.px + s2.sx = s.sx + s2.texture = barGlowCenterTexture + s2.border = {0,0,0,0} + s2.color = {s.color[1] * 10, s.color[2] * 10, s.color[3] * 10, 0} + s2.texturecolor = {s.texturecolor[1] * 10, s.texturecolor[2] * 10, s.texturecolor[3] * 10, 0.11} + s2.active = true + + usedstaterectanglesglow = usedstaterectanglesglow + 1 + local s3 = g.staterectanglesglow[usedstaterectanglesglow] + if (s3 == nil) then + s3 = New(Copy(s2,true)) + g.staterectanglesglow[usedstaterectanglesglow] = s3 + g.background.movableslaves[#g.background.movableslaves+1] = s3 + end + s3.sy = s.sy + glowSize + glowSize + s3.py = s.py - glowSize + s3.px = s.px - (glowSize * 2) + s3.sx = (glowSize * 2) + s3.texture = barGlowEdgeTexture + s3.border = s2.border + s3.color = s2.color + s3.texturecolor = s2.texturecolor + s3.active = true + + usedstaterectanglesglow = usedstaterectanglesglow + 1 + local s4 = g.staterectanglesglow[usedstaterectanglesglow] + if (s4 == nil) then + s4 = New(Copy(s2,true)) + g.staterectanglesglow[usedstaterectanglesglow] = s4 + g.background.movableslaves[#g.background.movableslaves+1] = s4 + end + s4.sy = s.sy + glowSize + glowSize + s4.py = s.py - glowSize + s4.px = s.px + s.sx + (glowSize * 2) + s4.sx = -(glowSize * 2) + s4.texture = barGlowEdgeTexture + s4.border = s2.border + s4.color = s2.color + s4.texturecolor = s2.texturecolor + s4.active = true + + end + else + icon.caption = " "..icon.cmdname.." " + end + end + end + + if (#page>1) then + g.forward.mouseclick={ + {1,function(mx,my,self) + g.page = g.page + 1 + if (g.page > g.pagecount) then + g.page = 1 + end + UpdateGrid(g,cmds,ordertype) + if playSounds then + Spring.PlaySoundFile(sound_button, 0.6, 'ui') + end + end}, + } + g.backward.mouseclick={ + {1,function(mx,my,self) + g.page = g.page - 1 + if (g.page < 1) then + g.page = g.pagecount + end + UpdateGrid(g,cmds,ordertype) + if playSounds then + Spring.PlaySoundFile(sound_button, 0.6, 'ui') + end + end}, + } + g.backward.active = nil --activate + g.forward.active = nil + g.indicator.active = nil + g.indicator.caption = " "..curpage.." / "..#page.." " + else + g.backward.active = false + g.forward.active = false + g.indicator.active = false + end +end + + +function widget:TextCommand(command) + if (string.find(command, "iconspace") == 1 and string.len(command) == 9) then + iconScaling = not iconScaling + --AutoResizeObjects() + Spring.ForceLayoutUpdate() + if iconScaling then + Spring.Echo("Build/order menu icon spacing: enabled") + else + Spring.Echo("Build/order menu icon spacing: disabled") + end + end + if (string.find(command, "icontooltip") == 1 and string.len(command) == 11) then + drawTooltip = not drawTooltip + --AutoResizeObjects() + Spring.ForceLayoutUpdate() + if drawTooltip then + Spring.Echo("Build menu icon tooltip: enabled") + else + Spring.Echo("Build menu icon tooltip: disabled") + end + end + if (string.find(command, "iconinfo") == 1 and string.len(command) == 8) then + largeInfo = not largeInfo + --AutoResizeObjects() + Spring.ForceLayoutUpdate() + if largeInfo then + Spring.Echo("Build/order menu icon info: large") + else + Spring.Echo("Build/order menu icon info: small") + end + end + if (string.find(command, "iconinfokeys") == 1 and string.len(command) == 12) then + shortcutsInfo = not shortcutsInfo + --AutoResizeObjects() + Spring.ForceLayoutUpdate() + if shortcutsInfo then + Spring.Echo("Build/order menu icon shortcut info: enabled") + else + Spring.Echo("Build/order menu icon shortcut info: disabled") + end + end + if (string.find(command, "buildmenusounds") == 1 and string.len(command) == 15) then + playSounds = not playSounds + --AutoResizeObjects() + Spring.ForceLayoutUpdate() + if playSounds then + Spring.Echo("Build/order menu sounds: enabled") + else + Spring.Echo("Build/order menu sounds: disabled") + end + end +end + +function tableMerge(t1, t2) + for k,v in pairs(t2) do + if type(v) == "table" then + if type(t1[k] or false) == "table" then + tableMerge(t1[k] or {}, t2[k] or {}) + else + t1[k] = v + end + else + t1[k] = v + end + end + return t1 +end + +function deepcopy(orig) + local orig_type = type(orig) + local copy + if orig_type == 'table' then + copy = {} + for orig_key, orig_value in next, orig, nil do + copy[deepcopy(orig_key)] = deepcopy(orig_value) + end + setmetatable(copy, deepcopy(getmetatable(orig))) + else -- number, string, boolean, etc + copy = orig + end + return copy +end + +function widget:Initialize() + PassedStartupCheck = RedUIchecks() + if (not PassedStartupCheck) then return end + + if largeUnitIcons then + Config.buildmenu = tableMerge(deepcopy(Config.buildmenu), deepcopy(largeUnitIconSize)) + Config.ordermenu = tableMerge(deepcopy(Config.ordermenu), deepcopy(largeOrderIconSize)) + else + Config.buildmenu = tableMerge(deepcopy(Config.buildmenu), deepcopy(normalUnitIconSize)) + Config.ordermenu = tableMerge(deepcopy(Config.ordermenu), deepcopy(normalOrderIconSize)) + end + + ordermenu = CreateGrid(Config.ordermenu) + ordermenu.page = 1 + buildmenu = CreateGrid(Config.buildmenu) + buildmenu.page = 1 + + AutoResizeObjects() --fix for displacement on crash issue + + + WG['red_buildmenu'] = {} + WG['red_buildmenu'].getConfigLargeInfo = function() + return largeInfo + end + WG['red_buildmenu'].getConfigUnitTooltip = function() + return drawTooltip + end + WG['red_buildmenu'].getConfigShortcutsInfo = function() + return shortcutsInfo + end + WG['red_buildmenu'].getConfigPlaySounds = function() + return playSounds + end + WG['red_buildmenu'].getConfigLargeUnitIcons = function() + return largeUnitIcons + end + WG['red_buildmenu'].setConfigLargeInfo = function(value) + largeInfo = value + end + WG['red_buildmenu'].setConfigUnitTooltip = function(value) + drawTooltip = value + end + WG['red_buildmenu'].getConfigPlaySounds = function() + return playSounds + end + WG['red_buildmenu'].setConfigShortcutsInfo = function(value) + shortcutsInfo = value + end + WG['red_buildmenu'].setConfigPlaySounds = function(value) + playSounds = value + end + WG['red_buildmenu'].setConfigLargeUnitIcons = function(value) + largeUnitIcons = value + Spring.SendCommands("luarules reloadluaui") + end +end + +local function onWidgetUpdate() --function widget:Update() + AutoResizeObjects() +end + +--save/load stuff +--currently only position +function widget:GetConfigData() --save config + if (PassedStartupCheck) then + local vsy = Screen.vsy + local unscale = CanvasY/vsy --needed due to autoresize, stores unresized variables + Config.buildmenu.px = buildmenu.background.px * unscale + Config.buildmenu.py = buildmenu.background.py * unscale + Config.ordermenu.px = ordermenu.background.px * unscale + Config.ordermenu.py = ordermenu.background.py * unscale + return {Config=Config, iconScaling=iconScaling, drawPrice=drawPrice, drawTooltip=drawTooltip, drawBigTooltip=drawBigTooltip, largePrice=largePrice, oldUnitpics=oldUnitpics, shortcutsInfo=shortcutsInfo, playSounds=playSounds, largeUnitIcons=largeUnitIcons} + end +end +function widget:SetConfigData(data) --load config + if (data.Config ~= nil) then + Config.buildmenu.px = data.Config.buildmenu.px + Config.buildmenu.py = data.Config.buildmenu.py + Config.ordermenu.px = data.Config.ordermenu.px + Config.ordermenu.py = data.Config.ordermenu.py + if (data.drawPrice ~= nil) then + drawPrice = data.drawPrice + end + if (data.drawTooltip ~= nil) then + drawTooltip = data.drawTooltip + end + if (data.drawTooltip ~= nil) then + drawBigTooltip = data.drawBigTooltip + end + if (data.iconScaling ~= nil) then + iconScaling = data.iconScaling + end + if (data.largeInfo ~= nil) then + largeInfo = data.largeInfo + end + if (data.shortcutsInfo ~= nil) then + shortcutsInfo = data.shortcutsInfo + end + if (data.largeUnitIcons ~= nil) then + largeUnitIcons = data.largeUnitIcons + end + if (data.playSounds ~= nil) then + playSounds = data.playSounds + end + end +end + + + + + + +--lots of hacks under this line ------------- overrides/disables default spring menu layout and gets current orders + filters out some commands +local hijackedlayout = false +function widget:Shutdown() + if (hijackedlayout) then + widgetHandler:ConfigLayoutHandler(true) + Spring.ForceLayoutUpdate() + end + WG['red_buildmenu'] = nil +end + +local function GetCommands() + local hiddencmds = { + [76] = true, --load units clone + [65] = true, --selfd + [9] = true, --gatherwait + [8] = true, --squadwait + [7] = true, --deathwait + [6] = true, --timewait + [39812] = true, --raw move + [34922] = true, -- set unit target + --[34923] = true, -- set target + } + local buildcmds = {} + local statecmds = {} + local othercmds = {} + local buildcmdscount = 0 + local statecmdscount = 0 + local othercmdscount = 0 + for index,cmd in pairs(sGetActiveCmdDescs()) do + if (type(cmd) == "table") then + if ( + (not hiddencmds[cmd.id]) and + (cmd.action ~= nil) and + --(not cmd.disabled) and + (not widgetHandler.commands[index].hidden) and --apparently GetActiveCmdDescs is bugged and returns hidden for every command + (cmd.type ~= 21) and + (cmd.type ~= 18) and + (cmd.type ~= 17) + ) then + if (((cmd.type == 20) --build building + or (ssub(cmd.action,1,10) == "buildunit_"))) then + buildcmdscount = buildcmdscount + 1 + buildcmds[buildcmdscount] = cmd + elseif (cmd.type == 5) then + statecmdscount = statecmdscount + 1 + statecmds[statecmdscount] = cmd + else + othercmdscount = othercmdscount + 1 + othercmds[othercmdscount] = cmd + end + end + end + end + local tempcmds = {} + for i=1,statecmdscount do + tempcmds[i] = statecmds[i] + end + for i=1,othercmdscount do + tempcmds[i+statecmdscount] = othercmds[i] + end + othercmdscount = othercmdscount + statecmdscount + othercmds = tempcmds + + return buildcmds,othercmds +end + + + +local selectionChanged = true +local function onNewCommands(force) + local buildcmds,othercmds = {},{} + if selectionChanged or force then + if (SelectedUnitsCount==0) then + buildmenu.page = 1 + ordermenu.page = 1 + else + buildcmds,othercmds = GetCommands() + end + UpdateGrid(ordermenu,othercmds,2) + UpdateGrid(buildmenu,buildcmds,1) + selectionChanged = false + end +end + +local function updateGrids() + local buildcmds,othercmds = {},{} + if (SelectedUnitsCount == 0) then + buildmenu.page = 1 + ordermenu.page = 1 + else + buildcmds,othercmds = GetCommands() + end + UpdateGrid(ordermenu,othercmds,2) + UpdateGrid(buildmenu,buildcmds,1) +end + +local hijackattempts = 0 +local layoutping = 54352 --random number +local function hijacklayout() + if (hijackattempts>5) then + Spring.Echo(widget:GetInfo().name.." failed to hijack config layout.") + widgetHandler:ToggleWidget(widget:GetInfo().name) + return + end + local function dummylayouthandler(xIcons, yIcons, cmdCount, commands) --gets called on selection change + WG.layoutpinghax = 54352 + widgetHandler.commands = commands + widgetHandler.commands.n = cmdCount + widgetHandler:CommandsChanged() --call widget:CommandsChanged() + local iconList = {[1337]=9001} + local custom_cmdz = widgetHandler.customCommands + return "", xIcons, yIcons, {}, custom_cmdz, {}, {}, {}, {}, {}, iconList + end + widgetHandler:ConfigLayoutHandler(dummylayouthandler) --override default build/ordermenu layout + Spring.ForceLayoutUpdate() + hijackedlayout = true + hijackattempts = hijackattempts + 1 +end +local updatehax = false +local updatehax2 = true +local firstupdate = true +local function haxlayout() + if (WG.layoutpinghax~=layoutping) then + hijacklayout() + end + WG.layoutpinghax = nil + updatehax = true +end +function widget:CommandsChanged() + haxlayout() +end + +local sec = 0 + +local guishaderCheckInterval = 1 +local oldSupplyMax = 0 +local uiOpacitySec = 0 +function widget:Update(dt) + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + ordermenu.background.color = {0,0,0,ui_opacity} + buildmenu.background.color = {0,0,0,ui_opacity} + ordermenu.background2.color = {1,1,1,ui_opacity*0.055} + buildmenu.background2.color = {1,1,1,ui_opacity*0.055} + end + end + sec=sec+dt + if (sec>1/guishaderCheckInterval) then + sec = 0 + if (WG['guishader'] ~= guishaderEnabled) then + guishaderEnabled = WG['guishader'] + if (guishaderEnabled) then + Config.buildmenu.fadetimeOut = 0.02 + Config.ordermenu.fadetimeOut = 0.02 + else + Config.buildmenu.fadetimeOut = Config.buildmenu.fadetime*0.66 + Config.ordermenu.fadetimeOut = Config.ordermenu.fadetime*0.66 + end + end + end + onWidgetUpdate() + if (updatehax or firstupdate) then + if (firstupdate) then + haxlayout() + firstupdate = nil + end + onNewCommands(mouseClicked>0) + mouseClicked = mouseClicked-1 + updatehax = false + updatehax2 = true + end + + -- refresh cause queue text could have changed + queueUpdateSec = queueUpdateSec + dt + if buildmenu.background.active == nil and queueUpdateSec > 0.5 then + queueUpdateSec = 0 + local buildcmds = GetCommands() + UpdateGrid(buildmenu,buildcmds,1) + end + + if (updatehax2) then + if (SelectedUnitsCount == 0) then + onNewCommands() --flush + updatehax2 = false + end + end +end + +function widget:SelectionChanged(sel) + selectionChanged = true + SelectedUnitsCount = sGetSelectedUnitsCount() +end + + +function widget:KeyPress(key, mods, isRepeat) + if shortcutsInfo then + if building ~= -1 then + if building == 1 and key == buildNextKey then + building = 2 + onNewCommands(true) + return true + end + local buildcmds, othercmds = GetCommands() + local found = -1 + for index = 1, #buildKeys do + if buildKeys[index] == key then + found = index + (15*building) + break + end + end + if found ~= -1 and buildcmds[found] ~= nil then + if playSounds then + Spring.PlaySoundFile(sound_queue_add, 0.75, 'ui') + end + Spring.SetActiveCommand(Spring.GetCmdDescIndex(buildcmds[found].id),1,true,false,Spring.GetModKeyState()) + end + building = -1 + onNewCommands(true) + return true + else + -- this prevents keys to be captured when you cannot build anything + local buildcmds = GetCommands() + if #buildcmds == 0 then return false end + + if key == buildStartKey then + building = 0 + onNewCommands(true) + return true + elseif key == buildNextKey then + building = 1 + onNewCommands(true) + return true + end + end + -- updates UI because hotkeys text changed color + onNewCommands(true) + return false + end +end + +function widget:GameFrame(n) + if n%450 == 4 then + _, _, spectator = Spring.GetPlayerInfo(Spring.GetMyTeamID()) + end +end + +-- highlights stuff for new players +local function setBrightness(condition, icon) + if condition and spectator == false then + local brightness = Spring.GetGameFrame() % 60 / 60 + if brightness < 0.5 then brightness = 0.5 + brightness -- lighter + else brightness = 1.5 - brightness end -- dimmer + icon.border = {brightness, brightness, 0, 1} + + highlightedIconsLeng = highlightedIconsLeng + 1 + highlightedIcons[highlightedIconsLeng] = icon + else + icon.border = {0, 0, 0, 0} + end +end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if buildPicHelp == 1 then + + --Legend for quick reference + + -- c currentLevel, + -- s storage, + -- p pull, + -- i income, + -- e expense, + -- sh share, + -- se sent, + -- r received + + -- copied from "gui_resourceBar.lua" + local myTeamID = Spring.GetMyTeamID() + local su, sm = math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed") or 0), math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax") or 0) + local ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") + local mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") + local supplyWarning = (sm < 30 and su >= sm - 5) or (su > sm) or (sm >= 30 and su >= sm - 10 and su < sm and sm < maxSupply * 0.95) + local energyWarning = ec / es < 0.2 + local metalLowWarning = mc / ms < 0.2 + local metalHighWarning = mc / ms > 0.9 + + for i = 1, #highlightedIcons do + highlightedIcons[i].border = {0, 0, 0, 0} + end + highlightedIcons = {} + highlightedIconsLeng = 0 + + local icons = buildmenu.icons + for i=1,#icons do + local icon = icons[i] + if icon.active == nil then + if icon.cmdname == "estorage" then + setBrightness(supplyWarning, icon) + elseif icon.cmdname == "esolar2" or icon.cmdname == "egeothermal" or icon.cmdname == "efusion2" then + setBrightness(energyWarning, icon) + elseif icon.cmdname == "emetalextractor" then + setBrightness(metalLowWarning, icon) + elseif icon.cmdname == "eorb" then + setBrightness(metalHighWarning, icon) + end + end + end + end +end diff --git a/LuaUI/Widgets_Evo/gui_red_buildordermenu.lua b/LuaUI/Widgets_Evo/gui_red_buildordermenu.lua deleted file mode 100644 index 24d14904d..000000000 --- a/LuaUI/Widgets_Evo/gui_red_buildordermenu.lua +++ /dev/null @@ -1,1281 +0,0 @@ -function widget:GetInfo() - return { - version = "9.1", - name = "Red Build/Order Menu", - desc = "Requires Red UI Framework", - author = "Regret, modified by CommonPlayer", - date = "29 may 2015", --modified by CommonPlayer, Oct 2016 - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true, --enabled by default - handler = true, --can use widgetHandler:x() - } -end - --- build hotkeys stuff -local building = -1 -local buildStartKey = 98 -local buildNextKey = 110 -local buildKeys = {113, 119, 101, 114, 116, 97, 115, 100, 102, 103, 122, 120, 99, 118, 98} -local buildLetters = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} - -local stateTexture = "LuaUI/Images/resbar.dds" -local buttonTexture = "LuaUI/Images/button.dds" -local barGlowCenterTexture = "LuaUI/Images/barglow-center.dds" -local barGlowEdgeTexture = "LuaUI/Images/barglow-edge.dds" - -local sound_queue_add = 'LuaUI/Sounds/buildbar_add.wav' -local sound_queue_rem = 'LuaUI/Sounds/buildbar_rem.wav' -local sound_button = 'LuaUI/Sounds/buildbar_waypoint.wav' - -local NeededFrameworkVersion = 9 -local CanvasX,CanvasY = 1272,734 --resolution in which the widget was made (for 1:1 size) ---1272,734 == 1280,768 windowed - ---todo: build categories (eco | labs | defences | etc) basically sublists of buildcmds (maybe for regular orders too) - -local playSounds = true -local iconScaling = true -local largeInfo = false -local shortcutsInfo = true -local highlightscale = true -local drawPrice = true -local drawTooltip = true -local drawBigTooltip = false -local largePrice = true -local oldUnitpics = false - -local vsx, vsy = gl.GetViewSizes() -local widgetScale = (1 + (vsx*vsy / 7500000)) - -local buildPicHelp = Spring.GetConfigInt("evo_buildpichelp", 1) ---Assume that if it isn't set, buildPicHelp is true -if buildPicHelp == nil then - buildPicHelp = 1 -end - -local maxSupply = tonumber(Spring.GetModOptions().supplycap) or 400 - -local Config = { - buildmenu = { - menuname = "buildmenu", - px = 0,py = CanvasY - 415, --default start position - - isx = 45,isy = 40, --icon size - ix = 5,iy = 8, --icons x/y - - roundedPercentage = 0.2, -- 0.25 == iconsize / 4 == cornersize - - iconscale = 0.925, - iconhoverscale = 0.925, - ispreadx=0,ispready=0, --space between icons - - margin = 5, --distance from background border - - padding = 4*widgetScale, -- for border effect - color2 = {1,1,1,0.025}, -- for border effect - - fadetime = 0.14, --fade effect time, in seconds - fadetimeOut = 0.022, --fade effect time, in seconds - - ctext = {1,1,1,1}, --color {r,g,b,alpha} - cbackground = {0,0,0,0.66}, - cborder = {0,0,0,1}, - cbuttonbackground = {0.1,0.1,0.1,1}, - dragbutton = {2,3}, --middle mouse button - tooltip = { - background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag the buildmenu.", - }, - }, - - ordermenu = { - menuname = "ordermenu", - px = 0,py = CanvasY - 415 - 145, - - isx = 45,isy = 33, - ix = 5,iy = 4, - - roundedPercentage = 0.2, -- 0.25 == iconsize / 4 == cornersize - - iconscale = 0.925, - iconhoverscale = 0.925, - ispreadx=0,ispready=0, - - margin = 5, - - padding = 4*widgetScale, -- for border effect - color2 = {1,1,1,0.025}, -- for border effect - - fadetime = 0.14, - fadetimeOut = 0.022, --fade effect time, in seconds - - ctext = {1,1,1,1}, - cbackground = {0,0,0,0.66}, - cborder = {0,0,0,1}, - cbuttonbackground={0.1,0.1,0.1,1}, - - dragbutton = {2,3}, --middle mouse button - tooltip = { - background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag the ordermenu.", - }, - }, -} - -function widget:ViewResize(newX,newY) - vsx, vsy = gl.GetViewSizes() - widgetScale = (1 + (vsx*vsy / 7500000)) - Config.buildmenu.padding = 3*widgetScale - Config.ordermenu.padding = 3*widgetScale -end - -local guishaderEnabled = WG['guishader_api'] or false - -local sGetSelectedUnitsCount = Spring.GetSelectedUnitsCount -local sGetActiveCommand = Spring.GetActiveCommand -local sGetActiveCmdDescs = Spring.GetActiveCmdDescs -local ssub = string.sub - -local function IncludeRedUIFrameworkFunctions() - New = WG.Red.New(widget) - Copy = WG.Red.Copytable - SetTooltip = WG.Red.SetTooltip - GetSetTooltip = WG.Red.GetSetTooltip - Screen = WG.Red.Screen - GetWidgetObjects = WG.Red.GetWidgetObjects -end - -local function RedUIchecks() - local color = "\255\255\255\1" - local passed = true - if (type(WG.Red)~="table") then - Spring.Echo(color..widget:GetInfo().name.." requires Red UI Framework.") - passed = false - elseif (type(WG.Red.Screen)~="table") then - Spring.Echo(color..widget:GetInfo().name..">> strange error.") - passed = false - elseif (WG.Red.Version < NeededFrameworkVersion) then - Spring.Echo(color..widget:GetInfo().name..">> update your Red UI Framework.") - passed = false - end - if (not passed) then - widgetHandler:ToggleWidget(widget:GetInfo().name) - return false - end - IncludeRedUIFrameworkFunctions() - return true -end - -local function AutoResizeObjects() --autoresize v2 - if (LastAutoResizeX==nil) then - LastAutoResizeX = CanvasX - LastAutoResizeY = CanvasY - end - local lx,ly = LastAutoResizeX,LastAutoResizeY - local vsx,vsy = Screen.vsx,Screen.vsy - if ((lx ~= vsx) or (ly ~= vsy)) then - local objects = GetWidgetObjects(widget) - local scale = vsy/ly - local skippedobjects = {} - for i=1,#objects do - local o = objects[i] - local adjust = 0 - if ((o.movableslaves) and (#o.movableslaves > 0)) then - adjust = (o.px*scale+o.sx*scale)-vsx - if (((o.px+o.sx)-lx) == 0) then - o._moveduetoresize = true - end - end - if (o.px) then o.px = o.px * scale end - if (o.py) then o.py = o.py * scale end - if (o.sx) then o.sx = o.sx * scale end - if (o.sy) then o.sy = o.sy * scale end - if (o.fontsize) then o.fontsize = o.fontsize * scale end - if (adjust > 0) then - o._moveduetoresize = true - o.px = o.px - adjust - for j=1,#o.movableslaves do - local s = o.movableslaves[j] - s.px = s.px - adjust/scale - end - elseif ((adjust < 0) and o._moveduetoresize) then - o._moveduetoresize = nil - o.px = o.px - adjust - for j=1,#o.movableslaves do - local s = o.movableslaves[j] - s.px = s.px - adjust/scale - end - end - end - LastAutoResizeX,LastAutoResizeY = vsx,vsy - end -end - -local function esc(x) - return (x:gsub('%%', '%%%%') - :gsub('^%^', '%%^') - :gsub('%$$', '%%$') - :gsub('%(', '%%(') - :gsub('%)', '%%)') - :gsub('%.', '%%.') - :gsub('%[', '%%[') - :gsub('%]', '%%]') - :gsub('%*', '%%*') - :gsub('%+', '%%+') - :gsub('%-', '%%-') - :gsub('%?', '%%?')) -end - -function wrap(str, limit) - limit = limit or 72 - local here = 1 - local buf = "" - local t = {} - str:gsub("(%s*)()(%S+)()", - function(sp, st, word, fi) - if fi-here > limit then - --# Break the line - here = st - table.insert(t, buf) - buf = word - else - buf = buf..sp..word --# Append - end - end) - --# Tack on any leftovers - if(buf ~= "") then - table.insert(t, buf) - end - return t -end - -local function CreateGrid(r) - - local background2 = {"rectanglerounded", - px=r.px+r.padding,py=r.py+r.padding, - sx=(r.isx*r.ix+r.ispreadx*(r.ix-1) +r.margin*2) -r.padding -r.padding, - sy=(r.isy*(r.iy)+r.ispready*(r.iy) +r.margin*2) -r.padding -r.padding, - color=r.color2, - } - local background = {"rectanglerounded", - px=r.px,py=r.py, - sx=r.isx*r.ix+r.ispreadx*(r.ix-1) +r.margin*2, - sy=r.isy*(r.iy)+r.ispready*(r.iy) +r.margin*2, - color=r.cbackground, - border=r.cborder, - movable=r.dragbutton, - obeyscreenedge = true, - overrideclick = {1}, - - padding=r.padding, - - effects = { - fadein_at_activation = r.fadetime, - fadeout_at_deactivation = r.fadetimeOut, - }, - onupdate=function(self) - background2.px = self.px + self.padding - background2.py = self.py + self.padding - background2.sx = self.sx - self.padding - self.padding - background2.sy = self.sy - self.padding - self.padding - end, - } - - local selecthighlight = {"rectanglerounded", - roundedsize = math.floor(r.isy*r.roundedPercentage), - px=0,py=0, - sx=r.isx,sy=r.isy, - iconscale=(iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and r.iconscale or 1), - color={1,0,0,0.26}, - border={0.8,0,0,0}, - glone=0.12, - texture = "LuaUI/Images/button-pushed.dds", - texturecolor={1,0,0,0.15}, - - active=false, - onupdate=function(self) - self.active = false - end, - } - - local mouseoverhighlight = Copy(selecthighlight,true) - mouseoverhighlight.color={1,1,1,0.08} - mouseoverhighlight.border={1,1,1,0} - mouseoverhighlight.texture = "LuaUI/Images/button-highlight.dds" - mouseoverhighlight.texturecolor={1,1,1,0.08} - - local heldhighlight = Copy(selecthighlight,true) - heldhighlight.color={1,0.75,0,0.06} - heldhighlight.border={1,1,0,0} - heldhighlight.texture = "LuaUI/Images/button-pushed.dds" - heldhighlight.texturecolor={1,0.75,0,0.06} - - local icon = {"rectangle", - px=0,py=0, - sx=r.isx,sy=r.isy, - iconscale=(iconScaling and r.iconscale or 1), - iconhoverscale=(iconScaling and r.iconhoverscale or 1), - iconnormalscale=(iconScaling and r.iconscale or 1), - roundedsize = math.floor(r.isy*r.roundedPercentage), - color={0,0,0,0}, - border={0,0,0,0}, - options="n", --disable colorcodes - captioncolor=r.ctext, - - overridecursor = true, - overrideclick = {3}, - - mouseheld={ - {1,function(mx,my,self) - self.iconscale=(iconScaling and self.iconhoverscale or 1) - --if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then - -- heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) - --else - -- heldhighlight.iconscale = self.iconscale - --end - heldhighlight.iconscale = self.iconscale - heldhighlight.color={1,0.75,0,0.06} - heldhighlight.px = self.px - heldhighlight.py = self.py - heldhighlight.active = nil - end}, - {3,function(mx,my,self) - self.iconscale=(iconScaling and self.iconhoverscale or 1) - --if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then - -- heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) - --else - -- heldhighlight.iconscale = self.iconscale - --end - heldhighlight.iconscale = self.iconscale - heldhighlight.color={1,0.2,0,0.06} - heldhighlight.px = self.px - heldhighlight.py = self.py - heldhighlight.active = nil - end}, - }, - - --[[mouserelease={ - {1,function(mx,my,self) - if r.menuname == "buildmenu" then - self.iconscale=(iconScaling and self.iconhoverscale or 1) - if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then - heldhighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) - else - heldhighlight.iconscale = self.iconscale - end - heldhighlight.px = self.px - heldhighlight.py = self.py - heldhighlight.active = nil - end - end}, - },]]-- - - mouseover=function(mx,my,self) - self.iconscale=(iconScaling and self.iconhoverscale or 1) - mouseoverhighlight.iconscale=(iconScaling and self.iconhoverscale or 1) - mouseoverhighlight.px = self.px - mouseoverhighlight.py = self.py - mouseoverhighlight.active = nil - local tt = self.tooltip - if drawTooltip and WG['tooltip'] ~= nil and r.menuname == "buildmenu" then - if self.texture ~= nil and string.sub(self.texture, 1, 1) == '#' then - local udefid = tonumber(string.sub(self.texture, 2)) - local text = "\255\215\255\215"..UnitDefs[udefid].humanName.."\n\255\240\240\240" - if drawBigTooltip and UnitDefs[udefid].customParams.description_long ~= nil then - local lines = wrap(UnitDefs[udefid].customParams.description_long, 58) - local description = '' - local newline = '' - for i, line in ipairs(lines) do - description = description..newline..line - newline = '\n' - end - text = text..description - else - text = text..UnitDefs[udefid].tooltip - end - WG['tooltip'].ShowTooltip('redui_buildmenu', text) - tt = string.gsub(tt, esc("Build: "..UnitDefs[udefid].humanName.." - "..UnitDefs[udefid].tooltip).."\n", "") - end - end - if drawPrice and tt ~= nil then - tt = string.gsub(tt, "Metal cost %d*\nEnergy cost %d*\n", "") - end - SetTooltip(tt) - if r.menuname == "ordermenu" then - mouseoverhighlight.texturecolor={1,1,1,0.02} - end - --[[ - if r.menuname == "buildmenu" then - local CurMouseState = {Spring.GetMouseState()} --{mx,my,m1,m2,m3} - if CurMouseState[3] or CurMouseState[5] then - if self.cmdid ~= nil then - Spring.SetActiveCommand(Spring.GetCmdDescIndex(self.cmdid),1,true,false,Spring.GetModKeyState()) - end - end - end]]-- - end, - - onupdate=function(self) - local _,_,_,curcmdname = sGetActiveCommand() - self.iconscale= (iconScaling and self.iconnormalscale or 1) - --selecthighlight.iconscale = (iconScaling and ((not highlightscale and r.menuname == "buildmenu") or r.menuname ~= "buildmenu") and self.iconhoverscale or 1) - selecthighlight.iconscale = (iconScaling and self.iconhoverscale or 1) - if (curcmdname ~= nil) then - if (self.cmdname == curcmdname) then - selecthighlight.px = self.px - selecthighlight.py = self.py - selecthighlight.active = nil - end - end - end, - - effects = background.effects, - - active=false, - } - - New(background) - New(background2) - - local backward = New(Copy(icon,true)) - backward.texture = "LuaUI/Images/backward.dds" - - local forward = New(Copy(icon,true)) - forward.texture = "LuaUI/Images/forward.dds" - - local indicator = New({"rectangle", - px=0,py=0, - sx=r.isx,sy=r.isy, - captioncolor=r.ctext, - options = "n", - - effects = background.effects, - }) - background.movableslaves={backward,forward,indicator} - - local icons = {} - for y=1,r.iy do - for x=1,r.ix do - local b = New(Copy(icon,true)) - b.px = background.px +r.margin + (x-1)*(r.ispreadx + r.isx) - b.py = background.py +r.margin + (y-1)*(r.ispready + r.isy) - table.insert(background.movableslaves,b) - icons[#icons+1] = b - if ((y==r.iy) and (x==r.ix)) then - backward.px = icons[#icons-r.ix+1].px - forward.px = icons[#icons].px - indicator.px = (forward.px + backward.px)/2 - - backward.py = icons[#icons-r.ix].py + r.isy + r.ispready - forward.py = backward.py - indicator.py = backward.py - end - end - end - - local text = {"rectangle", - px,py = 0, 0, - sx=r.isx,sy=r.isy, - captioncolor={0.8,0.8,0.8,1}, - caption = nil, - options = "on", - } - local texts = {} - for y=1,r.iy do - for x=1,r.ix do - local b = New(Copy(text,true)) - b.px = background.px +r.margin + (x-1)*(r.ispreadx + r.isx) - b.py = background.py +r.margin + (y-1)*(r.ispready + r.isy) - table.insert(background.movableslaves,b) - texts[#texts+1] = b - end - end - - local staterect = {"rectangle", - border = r.cborder, - texture = stateTexture, - texturecolor = r.cborder, - effects = background.effects, - } - local staterectangles = {} - local staterectanglesglow = {} - - New(selecthighlight) - New(mouseoverhighlight) - New(heldhighlight) - - --tooltip - background.mouseover = function(mx,my,self) SetTooltip(r.tooltip.background) end - - return { - ["menuname"] = r.menuname, - ["background"] = background, - ["background2"] = background2, - ["icons"] = icons, - ["backward"] = backward, - ["forward"] = forward, - ["indicator"] = indicator, - ["staterectangles"] = staterectangles, - ["staterectanglesglow"] = staterectanglesglow, - ["staterect"] = staterect, - ["texts"] = texts, - } -end - - -local function UpdateGrid(g,cmds,ordertype) - if (#cmds==0) then - g.background.active = false - g.background2.active = false - else - g.background.active = nil - g.background2.active = nil - end - - local curpage = g.page - local icons = g.icons - local page = {{}} - - local visibleIconCount = #icons - if #cmds > #icons then - visibleIconCount = visibleIconCount - Config[g.menuname].ix - end - for i=1,#cmds do - local index = i-(#page-1)*visibleIconCount - page[#page][index] = cmds[i] - if ((i == (visibleIconCount*#page)) and (i~=#cmds)) then - page[#page+1] = {} - end - end - g.pagecount = #page - - - if (curpage > g.pagecount) then - curpage = 1 - end - - local iconsleft = (#icons-#page[curpage]) - if (iconsleft > 0) then - for i=iconsleft+#page[curpage],#page[curpage]+1,-1 do - icons[i].active = false --deactivate - end - end - - for i=1,#g.staterectangles do - g.staterectangles[i].active = false - end - local usedstaterectangles = 0 - - for i=1,#g.staterectanglesglow do - g.staterectanglesglow[i].active = false - end - local usedstaterectanglesglow = 0 - - for i=1,#g.texts do - local text = g.texts[i] - text.caption = nil - end - - for i=1,#page[curpage] do - local cmd = page[curpage][i] - local icon = icons[i] - icon.tooltip = cmd.tooltip - icon.active = nil --activate - icon.cmdname = cmd.name - if icon.cmdname == "Repair" then icon.cmdname = "Build" end -- hack for Evo - icon.cmdid = cmd.id - icon.texture = nil - if (cmd.texture) then - if (cmd.texture ~= "") then - icon.texture = cmd.texture - end - end - - local myTeamID = Spring.GetMyTeamID() - local disableString = "disallowed_" .. (-cmd.id) - local powerBlocked = cmd.disabled - local supplyBlocked = Spring.GetTeamRulesParam(myTeamID, disableString) == 1 - - if (powerBlocked or supplyBlocked) then - icon.texturecolor = {0.44,0.44,0.44,1} - else - icon.texturecolor = {1,1,1,1} - end - - icon.mouseclick = { - {1,function(mx,my,self) - if playSounds then - Spring.PlaySoundFile(sound_queue_add, 0.75, 'ui') - end - Spring.SetActiveCommand(Spring.GetCmdDescIndex(cmd.id),1,true,false,Spring.GetModKeyState()) - end}, - {3,function(mx,my,self) - if playSounds then - Spring.PlaySoundFile(sound_queue_rem, 0.75, 'ui') - end - Spring.SetActiveCommand(Spring.GetCmdDescIndex(cmd.id),3,false,true,Spring.GetModKeyState()) - end}, - } - - if (ordertype == 1) then --build icons - icon.texture = "#"..cmd.id*-1 - if (cmd.params[1]) then - icon.options = "bs" - icon.caption = "\n"..cmd.params[1].." \n" - else - icon.caption = nil - end - --icon.texturecolor = {0.88,0.88,0.88,1} - - --text to show build hotkey - local white = "\255\255\255\255" - local offwhite = "\255\222\222\222" - local yellow = "\255\255\255\0" - local orange = "\255\255\135\0" - local green = "\255\0\255\0" - local red = "\255\255\0\0" - local skyblue = "\255\136\197\226" - - local s, e = string.find(cmd.tooltip, "Metal cost %d*") - local metalCost = string.sub(cmd.tooltip, s + 11, e) - local s, e = string.find(cmd.tooltip, "Energy cost %d*") - local energyCost = string.sub(cmd.tooltip, s + 12, e) - --local metalColor = "\255\136\197\226" - - - local text = g.texts[i] - text.px = icon.px - text.py = icon.py - if powerBlocked then - text.caption = red.."\nTech\nRequired\n\n" - elseif supplyBlocked then - text.caption = red.."\nSupply\nNeeded\n\n" - else - local captionColor = white - --- If you don't want to display the metal or energy cost on the unit buildicon, then you can disable it here - - -- redui adjusts position based on text length, so adding spaces helps us putting it at the left side of the icon - --local str = tostring(math.max(metalCost, energyCost)) - --local addedSpaces = " " -- too bad 1 space isnt as wide as 1 number in the used font - --local infoNewline = '\n' - --if largeInfo then - -- addedSpaces = " " -- too bad 1 space isnt as wide as 1 number in the used font - -- infoNewline = '' - --end - --for digit in string.gmatch(str, "%d") do - -- addedSpaces = string.sub(addedSpaces, 0, -2) - --end - - local shotcutCaption = '' - if shortcutsInfo then - if i <= 15 then - if building == 0 then - captionColor = skyblue - end - text.caption = captionColor..buildLetters[buildStartKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i]-96].."\n\n\n\n"..skyblue.." M:"..metalCost--..offwhite.."\n"..yellow.." E:"..energyCost - text.options = "bs" - elseif i <= 30 then - if building == 1 then - captionColor = skyblue - end - text.caption = captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i-15]-96].."\n\n\n\n"..skyblue.." M:"..metalCost--..offwhite.."\n"..yellow.." E:"..energyCost - text.options = "bs" - elseif i <= 45 then - if building == 2 then - captionColor = skyblue - end - text.caption = captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildNextKey-96]..offwhite.." → "..captionColor..buildLetters[buildKeys[i-30]-96].."\n\n\n\n"..skyblue.." M:"..metalCost--..offwhite.."\n"..yellow.." E:"..energyCost - text.options = "bs" - else - text.caption = nil - end - end - end - else - if buttonTexture ~= nil then - icon.texture = buttonTexture - end - if (cmd.type == 5) then --state cmds (fire at will, etc) - icon.caption = " "..(cmd.params[cmd.params[1]+2] or icon.cmdname).." " - - local statecount = #cmd.params-1 --number of states for the cmd - local curstate = cmd.params[1]+1 - - local scale = icon.iconscale * 0.9 - local px = icon.px + ((icon.sx * (1-scale))/2) - local py = icon.py + ((icon.sy * (1-scale))/2) - local sx = icon.sx * scale - local sy = icon.sy * scale - local usr = nil - - for i=1,statecount do - usedstaterectangles = usedstaterectangles + 1 - local s = g.staterectangles[usedstaterectangles] - if (s == nil) then - s = New(Copy(g.staterect,true)) - g.staterectangles[usedstaterectangles] = s - table.insert(g.background.movableslaves,s) - end - s.active = nil --activate - - - local spread = 7 - s.sx = (sx-(spread*(statecount-1+2)))/statecount - s.sy = (sy/8.5) - s.px = px+spread + (s.sx+spread)*(i-1) - s.py = py + sy - s.sy - spread - - --s.sx = (icon.sx-(spread*(statecount-1+2)))/statecount - --s.sy = (icon.sy/7) - --s.px = icon.px+spread + (s.sx+spread)*(i-1) - --s.py = icon.py + icon.sy - s.sy -spread - s.border = {0.22,0.22,0.22,0.8} - - if (i == curstate) then - usr = usedstaterectangles - if (statecount < 4) then - if (i == 1) then - s.color = {0.93,0,0,1} - s.border = {0.93,0,0,1} - elseif (i == 2) then - if (statecount == 3) then - s.color = {0.93,0.93,0,1} - s.border = {0.93,0.93,0,1} - else - s.color = {0,0.93,0,1} - s.border = {0,0.93,0,1} - end - elseif (i == 3) then - s.color = {0,0.93,0,1} - s.border = {0,0.93,0,1} - end - else - s.color = {0.93,0.93,0.93,1} - s.border = {0.93,0.93,0.93,1} - end - s.border[4] = 0.3 - else - s.color = nil - end - if s.color == nil then - s.texturecolor = s.border - else - s.texturecolor = s.color - end - end - - - -- add glow for current state - if (g.staterectangles[usr] ~= nil) then - s = g.staterectangles[usr] - usedstaterectanglesglow = usedstaterectanglesglow + 1 - local s2 = g.staterectanglesglow[usedstaterectanglesglow] - if (s2 == nil) then - s2 = New(Copy(g.staterectangles[usr],true)) - g.staterectanglesglow[usedstaterectanglesglow] = s2 - table.insert(g.background.movableslaves,s2) - end - - local glowSize = s.sy * 4.4 - s2.sy = s.sy + glowSize + glowSize - s2.py = s.py - glowSize - s2.px = s.px - s2.sx = s.sx - s2.texture = barGlowCenterTexture - s2.border = {0,0,0,0} - s2.color = {s.color[1] * 10, s.color[2] * 10, s.color[3] * 10, 0} - s2.texturecolor = {s.texturecolor[1] * 10, s.texturecolor[2] * 10, s.texturecolor[3] * 10, 0.06} - s2.active = true - - usedstaterectanglesglow = usedstaterectanglesglow + 1 - local s3 = g.staterectanglesglow[usedstaterectanglesglow] - if (s3 == nil) then - s3 = New(Copy(s2,true)) - g.staterectanglesglow[usedstaterectanglesglow] = s3 - table.insert(g.background.movableslaves,s3) - end - s3.sy = s.sy + glowSize + glowSize - s3.py = s.py - glowSize - s3.px = s.px - (glowSize * 2) - s3.sx = (glowSize * 2) - s3.texture = barGlowEdgeTexture - s3.border = s2.border - s3.color = s2.color - s3.texturecolor = s2.texturecolor - s3.active = true - - usedstaterectanglesglow = usedstaterectanglesglow + 1 - local s4 = g.staterectanglesglow[usedstaterectanglesglow] - if (s4 == nil) then - s4 = New(Copy(s2,true)) - g.staterectanglesglow[usedstaterectanglesglow] = s4 - table.insert(g.background.movableslaves,s4) - end - s4.sy = s.sy + glowSize + glowSize - s4.py = s.py - glowSize - s4.px = s.px + s.sx + (glowSize * 2) - s4.sx = -(glowSize * 2) - s4.texture = barGlowEdgeTexture - s4.border = s2.border - s4.color = s2.color - s4.texturecolor = s2.texturecolor - s4.active = true - - end - else - icon.caption = " "..icon.cmdname.." " - end - end - end - - if (#page>1) then - g.forward.mouseclick={ - {1,function(mx,my,self) - g.page = g.page + 1 - if (g.page > g.pagecount) then - g.page = 1 - end - UpdateGrid(g,cmds,ordertype) - if playSounds then - Spring.PlaySoundFile(sound_button, 0.6, 'ui') - end - end}, - } - g.backward.mouseclick={ - {1,function(mx,my,self) - g.page = g.page - 1 - if (g.page < 1) then - g.page = g.pagecount - end - UpdateGrid(g,cmds,ordertype) - if playSounds then - Spring.PlaySoundFile(sound_button, 0.6, 'ui') - end - end}, - } - g.backward.active = nil --activate - g.forward.active = nil - g.indicator.active = nil - g.indicator.caption = " "..curpage.." / "..#page.." " - else - g.backward.active = false - g.forward.active = false - g.indicator.active = false - end -end - - -function widget:TextCommand(command) - if (string.find(command, "iconspace") == 1 and string.len(command) == 9) then - iconScaling = not iconScaling - --AutoResizeObjects() - Spring.ForceLayoutUpdate() - if iconScaling then - Spring.Echo("Build/order menu icon spacing: enabled") - else - Spring.Echo("Build/order menu icon spacing: disabled") - end - end - if (string.find(command, "icontooltip") == 1 and string.len(command) == 11) then - drawTooltip = not drawTooltip - --AutoResizeObjects() - Spring.ForceLayoutUpdate() - if drawTooltip then - Spring.Echo("Build menu icon tooltip: enabled") - else - Spring.Echo("Build menu icon tooltip: disabled") - end - end - if (string.find(command, "iconinfo") == 1 and string.len(command) == 8) then - largeInfo = not largeInfo - --AutoResizeObjects() - Spring.ForceLayoutUpdate() - if largeInfo then - Spring.Echo("Build/order menu icon info: large") - else - Spring.Echo("Build/order menu icon info: small") - end - end - if (string.find(command, "iconinfokeys") == 1 and string.len(command) == 12) then - shortcutsInfo = not shortcutsInfo - --AutoResizeObjects() - Spring.ForceLayoutUpdate() - if shortcutsInfo then - Spring.Echo("Build/order menu icon shortcut info: enabled") - else - Spring.Echo("Build/order menu icon shortcut info: disabled") - end - end - if (string.find(command, "buildmenusounds") == 1 and string.len(command) == 15) then - playSounds = not playSounds - --AutoResizeObjects() - Spring.ForceLayoutUpdate() - if playSounds then - Spring.Echo("Build/order menu sounds: enabled") - else - Spring.Echo("Build/order menu sounds: disabled") - end - end -end - -function widget:Initialize() - PassedStartupCheck = RedUIchecks() - if (not PassedStartupCheck) then return end - - ordermenu = CreateGrid(Config.ordermenu) - buildmenu = CreateGrid(Config.buildmenu) -- the list with the largest grid must be last or it will get buggy with mousehovers - - buildmenu.page = 1 - ordermenu.page = 1 - - AutoResizeObjects() --fix for displacement on crash issue - - - WG['red_buildmenu'] = {} - WG['red_buildmenu'].getConfigLargeInfo = function() - return largeInfo - end - WG['red_buildmenu'].getConfigUnitTooltip = function() - return drawTooltip - end - WG['red_buildmenu'].getConfigShortcutsInfo = function() - return shortcutsInfo - end - WG['red_buildmenu'].getConfigPlaySounds = function() - return playSounds - end - WG['red_buildmenu'].setConfigLargeInfo = function(value) - largeInfo = value - end - WG['red_buildmenu'].setConfigUnitTooltip = function(value) - drawTooltip = value - end - WG['red_buildmenu'].getConfigPlaySounds = function() - return playSounds - end - WG['red_buildmenu'].setConfigShortcutsInfo = function(value) - shortcutsInfo = value - end - WG['red_buildmenu'].setConfigPlaySounds = function(value) - playSounds = value - end -end - -local function onNewCommands(buildcmds,othercmds) - if (SelectedUnitsCount==0) then - buildmenu.page = 1 - ordermenu.page = 1 - end - - UpdateGrid(ordermenu,othercmds,2) - UpdateGrid(buildmenu,buildcmds,1) -end - -local function onWidgetUpdate() --function widget:Update() - AutoResizeObjects() - SelectedUnitsCount = sGetSelectedUnitsCount() -end - ---save/load stuff ---currently only position -function widget:GetConfigData() --save config - if (PassedStartupCheck) then - local vsy = Screen.vsy - local unscale = CanvasY/vsy --needed due to autoresize, stores unresized variables - Config.buildmenu.px = buildmenu.background.px * unscale - Config.buildmenu.py = buildmenu.background.py * unscale - Config.ordermenu.px = ordermenu.background.px * unscale - Config.ordermenu.py = ordermenu.background.py * unscale - return {Config=Config, iconScaling=iconScaling, drawPrice=drawPrice, drawTooltip=drawTooltip, drawBigTooltip=drawBigTooltip, largePrice=largePrice, oldUnitpics=oldUnitpics, shortcutsInfo=shortcutsInfo, playSounds=playSounds} - end -end -function widget:SetConfigData(data) --load config - if (data.Config ~= nil) then - Config.buildmenu.px = data.Config.buildmenu.px - Config.buildmenu.py = data.Config.buildmenu.py - Config.ordermenu.px = data.Config.ordermenu.px - Config.ordermenu.py = data.Config.ordermenu.py - if (data.drawPrice ~= nil) then - drawPrice = data.drawPrice - end - if (data.drawTooltip ~= nil) then - drawTooltip = data.drawTooltip - end - if (data.drawTooltip ~= nil) then - drawBigTooltip = data.drawBigTooltip - end - if (data.iconScaling ~= nil) then - iconScaling = data.iconScaling - end - if (data.largeInfo ~= nil) then - largeInfo = data.largeInfo - end - if (data.shortcutsInfo ~= nil) then - shortcutsInfo = data.shortcutsInfo - end - if (data.playSounds ~= nil) then - playSounds = data.playSounds - end - end -end - - - - - - - - - - - ---lots of hacks under this line ------------- overrides/disables default spring menu layout and gets current orders + filters out some commands -local hijackedlayout = false -function widget:Shutdown() - if (hijackedlayout) then - widgetHandler:ConfigLayoutHandler(true) - Spring.ForceLayoutUpdate() - end - WG['red_buildmenu'] = nil -end -local function GetCommands() - local hiddencmds = { - [76] = true, --load units clone - [65] = true, --selfd - [9] = true, --gatherwait - [8] = true, --squadwait - [7] = true, --deathwait - [6] = true, --timewait - [39812] = true, --raw move - [34922] = true, -- set unit target - --[34923] = true, -- set target - } - local buildcmds = {} - local statecmds = {} - local othercmds = {} - local buildcmdscount = 0 - local statecmdscount = 0 - local othercmdscount = 0 - for index,cmd in pairs(sGetActiveCmdDescs()) do - if (type(cmd) == "table") then - if ( - (not hiddencmds[cmd.id]) and - (cmd.action ~= nil) and - --(not cmd.disabled) and - (not widgetHandler.commands[index].hidden) and --apparently GetActiveCmdDescs is bugged and returns hidden for every command - (cmd.type ~= 21) and - (cmd.type ~= 18) and - (cmd.type ~= 17) - ) then - if ((cmd.type == 20) --build building - or (ssub(cmd.action,1,10) == "buildunit_")) then - buildcmdscount = buildcmdscount + 1 - buildcmds[buildcmdscount] = cmd - elseif (cmd.type == 5) then - statecmdscount = statecmdscount + 1 - statecmds[statecmdscount] = cmd - else - othercmdscount = othercmdscount + 1 - othercmds[othercmdscount] = cmd - end - end - end - end - local tempcmds = {} - for i=1,statecmdscount do - tempcmds[i] = statecmds[i] - end - for i=1,othercmdscount do - tempcmds[i+statecmdscount] = othercmds[i] - end - othercmdscount = othercmdscount + statecmdscount - othercmds = tempcmds - - return buildcmds,othercmds -end - -local hijackattempts = 0 -local layoutping = 54352 --random number -local function hijacklayout() - if (hijackattempts>5) then - Spring.Echo(widget:GetInfo().name.." failed to hijack config layout.") - widgetHandler:ToggleWidget(widget:GetInfo().name) - return - end - local function dummylayouthandler(xIcons, yIcons, cmdCount, commands) --gets called on selection change - WG.layoutpinghax = 54352 - widgetHandler.commands = commands - widgetHandler.commands.n = cmdCount - widgetHandler:CommandsChanged() --call widget:CommandsChanged() - local iconList = {[1337]=9001} - local custom_cmdz = widgetHandler.customCommands - return "", xIcons, yIcons, {}, custom_cmdz, {}, {}, {}, {}, {}, iconList - end - widgetHandler:ConfigLayoutHandler(dummylayouthandler) --override default build/ordermenu layout - Spring.ForceLayoutUpdate() - hijackedlayout = true - hijackattempts = hijackattempts + 1 -end -local updatehax = false -local updatehax2 = true -local firstupdate = true -local function haxlayout() - if (WG.layoutpinghax~=layoutping) then - hijacklayout() - end - WG.layoutpinghax = nil - updatehax = true -end -function widget:CommandsChanged() - haxlayout() -end -local sec = 0 -local guishaderCheckInterval = 1 -local oldSupplyMax = 0 -function widget:Update(dt) - sec=sec+dt - if (sec>1/guishaderCheckInterval) then - sec = 0 - if (WG['guishader_api'] ~= guishaderEnabled) then - guishaderEnabled = WG['guishader_api'] - if (guishaderEnabled) then - Config.buildmenu.fadetimeOut = 0.02 - Config.ordermenu.fadetimeOut = 0.02 - else - Config.buildmenu.fadetimeOut = Config.buildmenu.fadetime*0.66 - Config.ordermenu.fadetimeOut = Config.ordermenu.fadetime*0.66 - end - end - end - onWidgetUpdate() - if (updatehax or firstupdate) then - if (firstupdate) then - haxlayout() - firstupdate = nil - end - onNewCommands(GetCommands()) - updatehax = false - updatehax2 = true - end - if (updatehax2) then - if (SelectedUnitsCount == 0) then - onNewCommands({},{}) --flush - updatehax2 = false - end - end - - -- updates UI when supply count changed - local myTeamID = Spring.GetMyTeamID() - local newSupplyMax = Spring.GetTeamRulesParam(myTeamID, "supplyMax") or 0 - if oldSupplyMax ~= newSupplyMax then - onNewCommands(GetCommands()) - oldSupplyMax = newSupplyMax - end -end - - - -function widget:KeyPress(key, mods, isRepeat) - if shortcutsInfo then - if building ~= -1 then - if building == 1 and key == buildNextKey then - building = 2 - onNewCommands(GetCommands()) - return true - end - local buildcmds, othercmds = GetCommands() - local found = -1 - for index = 1, #buildKeys do - if buildKeys[index] == key then - found = index + (15*building) - break - end - end - if found ~= -1 and buildcmds[found] ~= nil then - if playSounds then - Spring.PlaySoundFile(sound_queue_add, 0.75, 'ui') - end - Spring.SetActiveCommand(Spring.GetCmdDescIndex(buildcmds[found].id),1,true,false,Spring.GetModKeyState()) - end - building = -1 - onNewCommands(GetCommands()) - return true - else - -- this prevents keys to be captured when you cannot build anything - local buildcmds = GetCommands() - if #buildcmds == 0 then return false end - - if key == buildStartKey then - building = 0 - onNewCommands(GetCommands()) - return true - elseif key == buildNextKey then - building = 1 - onNewCommands(GetCommands()) - return true - end - end - -- updates UI because hotkeys text changed color - onNewCommands(GetCommands()) - return false - end -end - -function widget:GameFrame(n) - if n%450 == 4 then - _, _, spectator = Spring.GetPlayerInfo(Spring.GetMyTeamID()) - end -end - --- highlights stuff for new players -local function setBrightness(condition, icon) - if condition and spectator == false then - local brightness = Spring.GetGameFrame() % 60 / 60 - if brightness < 0.5 then brightness = 0.5 + brightness -- lighter - else brightness = 1.5 - brightness end -- dimmer - icon.border = {brightness, brightness, 0, 1} - else - icon.border = {0, 0, 0, 0} - end -end -function widget:DrawScreen() - if buildPicHelp == 1 then - - --Legend for quick reference - - -- c currentLevel, - -- s storage, - -- p pull, - -- i income, - -- e expense, - -- sh share, - -- se sent, - -- r received - - -- copied from "gui_resourceBar.lua" - local myTeamID = Spring.GetMyTeamID() - local su, sm = math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed") or 0), math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax") or 0) - local ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") - local mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") - local supplyWarning = (sm < 30 and su >= sm - 5) or (su > sm) or (sm >= 30 and su >= sm - 10 and su < sm and sm < maxSupply * 0.95) - local energyWarning = ec / es < 0.2 - local metalLowWarning = mc / ms < 0.2 - local metalHighWarning = mc / ms > 0.9 - - local icons = buildmenu.icons - for i=1,#icons do - local icon = icons[i] - if icon.active == nil then - if icon.cmdname == "estorage" then - setBrightness(supplyWarning, icon) - elseif icon.cmdname == "esolar2" or icon.cmdname == "egeothermal" or icon.cmdname == "efusion2" then - setBrightness(energyWarning, icon) - elseif icon.cmdname == "emetalextractor" then - setBrightness(metalLowWarning, icon) - elseif icon.cmdname == "eorb" then - setBrightness(metalHighWarning, icon) - end - end - end - end -end diff --git a/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua b/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua index f734e9303..07893fa17 100644 --- a/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua +++ b/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua @@ -47,17 +47,23 @@ local sGetModKeyState = Spring.GetModKeyState local spPlaySoundFile = Spring.PlaySoundFile local sGetMyPlayerID = Spring.GetMyPlayerID +local fontsize = 11.5 +local fontsizeMultiplier = 1 + +local showBackground = false +local showBackgroundOpacity = 0.19 + local Config = { console = { px = vsx*0.3,py = vsy*0.105, --default start position sx = vsx*0.4, --background size - fontsize = 11.5*widgetScale, + fontsize = fontsize*widgetScale, minlines = 2, --minimal number of lines to display maxlines = 6, maxlinesScrollmode = 10, - + maxage = 60, --max time for a message to be displayed, in seconds margin = 7*widgetScale, --distance from background border @@ -304,7 +310,7 @@ local function createconsole(r) b.active = false b.py = b.py+(i-1)*r.fontsize counters[#counters+1] = b - table.insert(background.movableslaves,b) + background.movableslaves[#background.movableslaves+1] = b end --tooltip @@ -435,12 +441,7 @@ local function convertColor(r,g,b) end local function processLine(line,g,cfg,newlinecolor) - if (g.vars.browsinghistory) then - if (g.vars.historyoffset == nil) then - g.vars.historyoffset = 0 - end - g.vars.historyoffset = g.vars.historyoffset + 1 - end + g.vars.nextupdate = 0 @@ -466,44 +467,46 @@ local function processLine(line,g,cfg,newlinecolor) local text = "" local linetype = 0 --other if Initialized == true then - ignoreThisMessage = true + bypassThisMessage = true else - ignoreThisMessage = false + bypassThisMessage = false end + local ignoreThisMessage = false + local ignoredText = "(ignored)" if sfind(line, "My player ID is") and sfind(line, regID) and not nameregistered then - -- Spring.SendCommands("say Registration ID found") - registermyname = true - ignoreThisMessage = true + -- Spring.SendCommands("say Registration ID found") + registermyname = true + bypassThisMessage = true end if (not newlinecolor) then if (names[ssub(line,2,(sfind(line,"> ") or 1)-1)] ~= nil) then - ignoreThisMessage = false + bypassThisMessage = false linetype = 1 --playermessage name = ssub(line,2,sfind(line,"> ")-1) text = ssub(line,slen(name)+4) - if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command - ignoreThisMessage = true - end + if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command + bypassThisMessage = true + end elseif (names[ssub(line,2,(sfind(line,"] ") or 1)-1)] ~= nil) then - ignoreThisMessage = false + bypassThisMessage = false linetype = 2 --spectatormessage name = ssub(line,2,sfind(line,"] ")-1) text = ssub(line,slen(name)+4) - if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command - ignoreThisMessage = true - end + if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command + bypassThisMessage = true + end elseif (names[ssub(line,2,(sfind(line,"(replay)") or 3)-3)] ~= nil) then - ignoreThisMessage = false + bypassThisMessage = false linetype = 2 --spectatormessage name = ssub(line,2,sfind(line,"(replay)")-3) text = ssub(line,slen(name)+13) - if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command - ignoreThisMessage = true - end + if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command + bypassThisMessage = true + end elseif (names[ssub(line,1,(sfind(line," added point: ") or 1)-1)] ~= nil) then - ignoreThisMessage = false + bypassThisMessage = false linetype = 3 --playerpoint name = ssub(line,1,sfind(line," added point: ")-1) text = ssub(line,slen(name.." added point: ")+1) @@ -513,18 +516,19 @@ local function processLine(line,g,cfg,newlinecolor) elseif (ssub(line,1,1) == ">") then linetype = 4 --gamemessage text = ssub(line,3) - ignoreThisMessage = true + bypassThisMessage = true if ssub(line,1,3) == "> <" then --player speaking in battleroom - ignoreThisMessage = false - if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command - ignoreThisMessage = true - end + bypassThisMessage = false + if ssub(text,1,1) == "!" and ssub(text, 1,2) ~= "!!" then --bot command + bypassThisMessage = true + end local i = sfind(ssub(line,4,slen(line)), ">") if (i) then name = ssub(line,4,i+2) else name = "unknown" end + end end end @@ -533,14 +537,14 @@ local function processLine(line,g,cfg,newlinecolor) myname = name registermyname = false nameregistered = true - ignoreThisMessage = true + bypassThisMessage = true elseif sfind(line, "My player ID is") and sfind(line, regID) then - ignoreThisMessage = true + bypassThisMessage = true end -- filter shadows config changes if sfind(line,"^Set \"shadows\" config(-)parameter to ") then - ignoreThisMessage = true + bypassThisMessage = true end @@ -548,7 +552,7 @@ local function processLine(line,g,cfg,newlinecolor) if sfind(line,"^Sync error for ") then name = ssub(line,16,sfind(line," in frame ")-1) if names[name] ~= nil and names[name][2] ~= nil and names[name][2] and sGetMyPlayerID() ~= names[name][4] then -- when spec - ignoreThisMessage = true + bypassThisMessage = true end end @@ -556,7 +560,7 @@ local function processLine(line,g,cfg,newlinecolor) if sfind(line,"^Error: %[DESYNC WARNING%] ") then name = ssub(line,sfind(line," %(")+2,sfind(line,"%) ")-1) if names[name] ~= nil and names[name][2] ~= nil and names[name][2] and sGetMyPlayerID() ~= names[name][4] then -- when spec - ignoreThisMessage = true + bypassThisMessage = true end end @@ -564,13 +568,13 @@ local function processLine(line,g,cfg,newlinecolor) if sfind(line,"^Connection attempt from ") then name = ssub(line,25) lastConnectionAttempt = name - ignoreThisMessage = true + bypassThisMessage = true end -- filter Connection established if sfind(line," Connection established") then name = lastConnectionAttempt - ignoreThisMessage = true + bypassThisMessage = true end @@ -578,7 +582,7 @@ local function processLine(line,g,cfg,newlinecolor) --filter out some engine messages; --2 lines (instead of 4) appears when player connects if sfind(line,'-> Version') or sfind(line,'ClientReadNet') or sfind(line,'Address') then - ignoreThisMessage = true + bypassThisMessage = true end if sfind(line,"Wrong network version") then @@ -591,15 +595,16 @@ local function processLine(line,g,cfg,newlinecolor) if gameOver then if sfind(line,'left the game') then - ignoreThisMessage = true + bypassThisMessage = true end end end --ignore messages from muted-- - if WG.ignoredPlayers and WG.ignoredPlayers[name] then - ignoreThisMessage = true + if WG.ignoredPlayers and WG.ignoredPlayers[name] then + bypassThisMessage = true + --ignoreThisMessage = true --Spring.Echo ("blocked message by " .. name) end @@ -625,6 +630,7 @@ local function processLine(line,g,cfg,newlinecolor) textcolor = convertColor(c[1],c[2],c[3]) local r,g,b,a = sGetTeamColor(names[name][3]) local namecolor = convertColor(r,g,b) + if ignoreThisMessage then text = ignoredText end line = namecolor..name..misccolor..": "..textcolor..text @@ -642,8 +648,9 @@ local function processLine(line,g,cfg,newlinecolor) end textcolor = convertColor(c[1],c[2],c[3]) c = cfg.cspectext - local namecolor = convertColor(c[1],c[2],c[3]) - + local namecolor = convertColor(c[1],c[2],c[3]) + if ignoreThisMessage then text = ignoredText end + line = namecolor.."(s) "..name..misccolor..": "..textcolor..text playSound = true @@ -672,14 +679,18 @@ local function processLine(line,g,cfg,newlinecolor) textcolor = convertColor(c[1],c[2],c[3]) c = cfg.cothertext local misccolor = convertColor(c[1],c[2],c[3]) - + if ignoreThisMessage then text = ignoredText end + line = namecolor..name..misccolor.." * "..textcolor..text elseif (linetype==4) then --gamemessage local c = cfg.cgametext textcolor = convertColor(c[1],c[2],c[3]) - - line = textcolor.."> "..text + if ignoreThisMessage and name then -- ignored player talking in battleroom + line = textcolor.."> <"..name.."> "..ignoredText + else + line = textcolor.."> "..text + end else --every other message local c = cfg.cmisctext textcolor = convertColor(c[1],c[2],c[3]) @@ -693,11 +704,17 @@ local function processLine(line,g,cfg,newlinecolor) local history = g.vars.consolehistory - if (not ignoreThisMessage == true) then --mute-- + if (not bypassThisMessage == true) then --mute-- + if (g.vars.browsinghistory) then + if (g.vars.historyoffset == nil) then + g.vars.historyoffset = 0 + end + g.vars.historyoffset = g.vars.historyoffset + 1 + end local lineID = #history+1 history[#history+1] = {line,clock(),lineID,textcolor,linetype} - if ( playSound ) and (not ignoreThisMessage == true) then + if ( playSound ) and (not bypassThisMessage == true) and not Spring.IsGUIHidden() then spPlaySoundFile( SoundIncomingChat, SoundIncomingChatVolume, nil, "ui" ) end end @@ -823,7 +840,7 @@ local function updateconsole(g,cfg) end function widget:Initialize() -regID = tostring(Spring.GetMyPlayerID()) + regID = tostring(Spring.GetMyPlayerID()) PassedStartupCheck = RedUIchecks() if (not PassedStartupCheck) then return end @@ -831,6 +848,41 @@ regID = tostring(Spring.GetMyPlayerID()) Spring.SendCommands("console 0") Spring.SendCommands('inputtextgeo 0.26 0.73 0.02 0.028') AutoResizeObjects() + + WG['red_chatonlyconsole'] = {} + WG['red_chatonlyconsole'].getMaxLines = function() + return Config.console.maxlines + end + WG['red_chatonlyconsole'].setMaxLines = function(value) + Config.console.maxlines = value + if console ~= nil and console.vars ~= nil then + console.vars._forceupdate = true + end + end + WG['red_chatonlyconsole'].getFontsize = function() + return fontsizeMultiplier + end + WG['red_chatonlyconsole'].setFontsize = function(value) + fontsizeMultiplier = value + Config.console.fontsize = fontsize*widgetScale*fontsizeMultiplier + if console ~= nil and console.vars ~= nil then + console.lines.fontsize = Config.console.fontsize + end + end + WG['red_chatonlyconsole'].getShowBackground = function() + return showBackground + end + WG['red_chatonlyconsole'].setShowBackground = function(value) + showBackground = value + if showBackground then + Config.console.cbackground = {0,0,0,showBackgroundOpacity} + else + Config.console.cbackground = {0,0,0,0} + end + if console ~= nil and console.background ~= nil then + console.background.color = Config.console.cbackground + end + end end function widget:GameOver() @@ -840,10 +892,16 @@ end function widget:Shutdown() Initialized = false Spring.SendCommands("console 1") + WG['red_chatonlyconsole'] = nil +end + +function widget:TextCommand(command) + if (string.find(command, "chatbackground") == 1 and string.len(command) == 14) then + WG['red_chatonlyconsole'].setShowBackground(not showBackground) + end end function widget:AddConsoleLine(lines,priority) - -- widget:Initialize() lines = lines:match('^\[f=[0-9]+\] (.*)$') or lines local textcolor for line in lines:gmatch("[^\n]+") do @@ -856,28 +914,51 @@ function widget:Update() updateconsole(console,Config.console) AutoResizeObjects() if not Initialized == true then - if onelinedone == true then - regID = tostring(Spring.GetMyPlayerID()) -Spring.SendCommands("wByNum "..regID.." My player ID is "..regID) - Initialized = true - end + if onelinedone == true then + regID = tostring(Spring.GetMyPlayerID()) + Spring.SendCommands("wByNum "..regID.." My player ID is "..regID) + Initialized = true + end end +end +function widget:ViewResize() + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (1 + (vsx*vsy / 4000000)) + Config.console.fontsize = fontsize*fontsizeMultiplier*widgetScale + if console ~= nil and console.vars ~= nil then + console.vars._forceupdate = true + end end --save/load stuff --currently only position function widget:GetConfigData() --save config - if (PassedStartupCheck) then + if (console ~= nil) then local vsy = Screen.vsy Config.console.px = console.background.px Config.console.py = console.background.py - return {Config=Config} + return {Config=Config, fontsizeMultiplier=fontsizeMultiplier, showBackground=showBackground} end end function widget:SetConfigData(data) --load config if (data.Config ~= nil) then --Config.console.px = data.Config.console.px --Config.console.py = data.Config.console.py + if data.Config.console.maxlines ~= nil then + Config.console.maxlines = data.Config.console.maxlines + end + if data.fontsizeMultiplier ~= nil then + fontsizeMultiplier = data.fontsizeMultiplier + Config.console.fontsize = fontsize*fontsizeMultiplier*widgetScale + end + if data.showBackground ~= nil then + showBackground = data.showBackground + if showBackground then + Config.console.cbackground = {0,0,0,showBackgroundOpacity} + else + Config.console.cbackground = {0,0,0,0} + end + end end end diff --git a/LuaUI/Widgets_Evo/gui_red_minimap.lua b/LuaUI/Widgets_Evo/gui_red_minimap.lua index 01b24fd6c..93fe8a9e4 100644 --- a/LuaUI/Widgets_Evo/gui_red_minimap.lua +++ b/LuaUI/Widgets_Evo/gui_red_minimap.lua @@ -356,7 +356,14 @@ function widget:Update() lastPos.sy = rMinimap.sy end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if (rMinimap.active ~= nil) then return diff --git a/LuaUI/Widgets_Evo/gui_red_tooltip.lua b/LuaUI/Widgets_Evo/gui_red_tooltip.lua deleted file mode 100644 index 01a5f30ae..000000000 --- a/LuaUI/Widgets_Evo/gui_red_tooltip.lua +++ /dev/null @@ -1,338 +0,0 @@ -function widget:GetInfo() - return { - name = "Red Tooltip", - desc = "Toggle unitcounter with /unitcounter (Requires Red UI Framework)", - author = "Regret", - date = "29 may 2015", - license = "GNU GPL, v2 or later", - layer = -100, - enabled = true, --enabled by default - handler = true, --can use widgetHandler:x() - } -end -local NeededFrameworkVersion = 8 -local CanvasX,CanvasY = 1280,734 --resolution in which the widget was made (for 1:1 size) ---1272,734 == 1280,768 windowed - - ---todo: sy adjustment - -local vsx, vsy = gl.GetViewSizes() -local widgetScale = (1 + (vsx*vsy / 7500000)) -local Config = { - tooltip = { - px = -0.5,py = CanvasY-82, --default start position - sx = 270,sy = 82, --background size - - fontsize = 10.5, - - padding = 3*widgetScale, - color2 = {1,1,1,0.025}, - - margin = 11, --distance from background border - - cbackground = {0,0,0,0.66}, --color {r,g,b,alpha} - cborder = {0,0,0,0.2}, - - dragbutton = {2,3}, --middle mouse button - tooltip = { - background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag this element.", - }, - unitCounterEnabled = false, - }, -} - -local totalUnits = 0 -local totalGaiaUnits = 0 - -local spGetTeamUnitCount = Spring.GetTeamUnitCount -local sGetCurrentTooltip = Spring.GetCurrentTooltip -local sGetSelectedUnitsCount = Spring.GetSelectedUnitsCount - -local GaiaTeamID = Spring.GetGaiaTeamID() - - -local function IncludeRedUIFrameworkFunctions() - New = WG.Red.New(widget) - Copy = WG.Red.Copytable - SetTooltip = WG.Red.SetTooltip - GetSetTooltip = WG.Red.GetSetTooltip - Screen = WG.Red.Screen - GetWidgetObjects = WG.Red.GetWidgetObjects -end - -local function RedUIchecks() - local color = "\255\255\255\1" - local passed = true - if (type(WG.Red)~="table") then - Spring.Echo(color..widget:GetInfo().name.." requires Red UI Framework.") - passed = false - elseif (type(WG.Red.Screen)~="table") then - Spring.Echo(color..widget:GetInfo().name..">> strange error.") - passed = false - elseif (WG.Red.Version < NeededFrameworkVersion) then - Spring.Echo(color..widget:GetInfo().name..">> update your Red UI Framework.") - passed = false - end - if (not passed) then - widgetHandler:ToggleWidget(widget:GetInfo().name) - return false - end - IncludeRedUIFrameworkFunctions() - return true -end - -local function AutoResizeObjects() --autoresize v2 - if (LastAutoResizeX==nil) then - LastAutoResizeX = CanvasX - LastAutoResizeY = CanvasY - end - local lx,ly = LastAutoResizeX,LastAutoResizeY - local vsx,vsy = Screen.vsx,Screen.vsy - if ((lx ~= vsx) or (ly ~= vsy)) then - local objects = GetWidgetObjects(widget) - local scale = vsy/ly - local skippedobjects = {} - for i=1,#objects do - local o = objects[i] - local adjust = 0 - if ((o.movableslaves) and (#o.movableslaves > 0)) then - adjust = (o.px*scale+o.sx*scale)-vsx - if (((o.px+o.sx)-lx) == 0) then - o._moveduetoresize = true - end - end - if (o.px) then o.px = o.px * scale end - if (o.py) then o.py = o.py * scale end - if (o.sx) then o.sx = o.sx * scale end - if (o.sy) then o.sy = o.sy * scale end - if (o.fontsize) then o.fontsize = o.fontsize * scale end - if (adjust > 0) then - o._moveduetoresize = true - o.px = o.px - adjust - for j=1,#o.movableslaves do - local s = o.movableslaves[j] - s.px = s.px - adjust/scale - end - elseif ((adjust < 0) and o._moveduetoresize) then - o._moveduetoresize = nil - o.px = o.px - adjust - for j=1,#o.movableslaves do - local s = o.movableslaves[j] - s.px = s.px - adjust/scale - end - end - end - LastAutoResizeX,LastAutoResizeY = vsx,vsy - end -end -local function getEditedCurrentTooltip() - local text = sGetCurrentTooltip() - if text == "Repair: Repairs another unit" then text = "Build: Builds unfinished structures" end -- hack for Evo - --extract the exp value with regexp - local expPattern = "Experience (%d+%.%d%d)" - local currentExp = tonumber(text:match(expPattern)) - --replace with limexp: exp/(1+exp) since all spring exp effects are linear in limexp, multiply by 10 because people like big numbers instead of [0,1] - return currentExp and text:gsub(expPattern,string.format("Experience %.2f", 10*currentExp/(1+currentExp)) ) or text -end - -local function createtooltip(r) - local text = {"text", - px=r.px+r.margin,py=r.py+(r.margin/1.5), - fontsize=r.fontsize, - color={1,1,1,0.3}, - caption="", - options="o", - - onupdate=function(self) - local unitcount = sGetSelectedUnitsCount() - if (unitcount ~= 0) then - self.caption = "Selected units: "..unitcount.."\n" - else - self.caption = "\n" - end - - if (self._mouseoverself) then - self.caption = self.caption..r.tooltip.background - else - self.caption = self.caption..(getEditedCurrentTooltip() or sGetCurrentTooltip()) - end - end - } - - local unitcounter = {"text", - px=r.sx-(r.margin/2),py=r.py+(r.margin/2), - fontsize=r.fontsize/1.3, - color={1,1,1,0.2}, - caption="", - options="r", - - onupdate=function(self) - if Config.tooltip.unitCounterEnabled then - -- get total unit count - if Spring.GetGameFrame() % 60 == 0 then - totalUnits = 0 - totalGaiaUnits = 0 - local allyTeamList = Spring.GetAllyTeamList() - local numberOfAllyTeams = #allyTeamList - for allyTeamListIndex = 1, numberOfAllyTeams do - local allyID = allyTeamList[allyTeamListIndex] - local teamList = Spring.GetTeamList(allyID) - for _,teamID in pairs(teamList) do - totalUnits = totalUnits + spGetTeamUnitCount(teamID) - if teamID == GaiaTeamID then - totalGaiaUnits = totalGaiaUnits + spGetTeamUnitCount(teamID) - end - end - end - local alpha = (totalUnits/6600) - if alpha > 0.66 then alpha = 0.66 end - if alpha < 0.2 then alpha = 0.2 end - self.color={1,1,1,alpha} - end - self.caption = totalUnits.."\n"..totalGaiaUnits - vsx,vsy = gl.GetViewSizes() - - else - self.caption = "" - end - end - } - local background2 = {"rectanglerounded", - px=r.px+r.padding,py=r.py+r.padding, - sx=r.sx-r.padding-r.padding,sy=r.sy-r.padding-r.padding, - color=r.color2, - } - local background = {"rectanglerounded", - px=r.px,py=r.py, - sx=r.sx,sy=r.sy, - color=r.cbackground, - border=r.cborder, - - padding=r.padding, - - movable=r.dragbutton, - movableslaves={text,unitcounter,background2}, - - obeyscreenedge = true, - --overridecursor = true, - --overrideclick = {2}, - - onupdate=function(self) - if (self.px < (Screen.vsx/2)) then --left side of screen - if ((self.sx-r.margin*2) <= text.getwidth()) then - self.sx = (text.getwidth()+r.margin*2) -1 - else - self.sx = r.sx * Screen.vsy/CanvasY - end - text.px = self.px + r.margin - else --right side of screen - if ((self.sx-r.margin*2 -1) <= text.getwidth()) then - self.px = self.px - ((text.getwidth() + r.margin*2) - self.sx) - self.sx = (text.getwidth() + r.margin*2) - else - self.px = self.px - ((r.sx * Screen.vsy/CanvasY) - self.sx) - self.sx = r.sx * Screen.vsy/CanvasY - end - text.px = self.px + r.margin - end - unitcounter.px = self.sx - ((r.margin/2)* Screen.vsy/CanvasY) - background2.px = self.px + self.padding - background2.py = self.py + self.padding - background2.sx = self.sx - self.padding - self.padding - background2.sy = self.sy - self.padding - self.padding - end, - - mouseover=function(mx,my,self) - text._mouseoverself = true - end, - mousenotover=function(mx,my,self) - text._mouseoverself = nil - end, - } - - - New(background) - New(background2) - New(text) - New(unitcounter) - - return { - ["background"] = background, - ["background2"] = background2, - ["text"] = text, - ["unitcounter"] = unitcounter, - - margin = r.margin, - } -end - -function widget:Initialize() - PassedStartupCheck = RedUIchecks() - if (not PassedStartupCheck) then return end - - tooltip = createtooltip(Config.tooltip) - - Spring.SetDrawSelectionInfo(false) --disables springs default display of selected units count - Spring.SendCommands("tooltip 0") - AutoResizeObjects() -end - -function widget:Shutdown() - Spring.SendCommands("tooltip 1") -end - -function widget:Update() - AutoResizeObjects() -end - -function widget:GameFrame(n) - - -- get total unit count - if n % 120 == 0 then - totalUnits = 0 - local allyTeamList = Spring.GetAllyTeamList() - local numberOfAllyTeams = #allyTeamList - for allyTeamListIndex = 1, numberOfAllyTeams do - local allyID = allyTeamList[allyTeamListIndex] - local teamList = Spring.GetTeamList(allyID) - for _,teamID in pairs(teamList) do - totalUnits = totalUnits + spGetTeamUnitCount(teamID) - if teamID == GaiaTeamID then - totalGaiaUnits = totalGaiaUnits + 1 - end - end - end - end -end - ---save/load stuff ---currently only position -function widget:GetConfigData() --save config - if (PassedStartupCheck) then - local vsy = Screen.vsy - local unscale = CanvasY/vsy --needed due to autoresize, stores unresized variables - --Config.tooltip.px = tooltip.background.px * unscale - --Config.tooltip.py = tooltip.background.py * unscale - Config.tooltip.unitCounterEnabled = Config.tooltip.unitCounterEnabled - return {Config=Config} - end -end -function widget:SetConfigData(data) --load config - if (data.Config ~= nil) then - --Config.tooltip.px = data.Config.tooltip.px - --Config.tooltip.py = data.Config.tooltip.py - Config.tooltip.unitCounterEnabled = data.Config.tooltip.unitCounterEnabled - end -end - -function widget:TextCommand(command) - if (string.find(command, "unitcount") == 1 and string.len(command) == 11) then - Config.tooltip.unitCounterEnabled = not Config.tooltip.unitCounterEnabled - if Config.tooltip.unitCounterEnabled then - Spring.Echo("Total units counter: enabled") - else - Spring.Echo("Total units counter: disabled") - end - end -end diff --git a/LuaUI/Widgets_Evo/gui_red_tooltip.xlua b/LuaUI/Widgets_Evo/gui_red_tooltip.xlua new file mode 100644 index 000000000..280eba96b --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_red_tooltip.xlua @@ -0,0 +1,372 @@ +function widget:GetInfo() + return { + name = "Red Tooltip", + desc = "Toggle unitcounter with /unitcounter (Requires Red UI Framework)", + author = "Regret", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + layer = -100, + enabled = true, --enabled by default + handler = true, --can use widgetHandler:x() + } +end +local NeededFrameworkVersion = 8 +local CanvasX,CanvasY = 1280,734 --resolution in which the widget was made (for 1:1 size) +--1272,734 == 1280,768 windowed + + +--todo: sy adjustment + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (1 + (vsx*vsy / 7500000)) +local Config = { + tooltip = { + px = -0.5,py = CanvasY-82, --default start position + sx = 270,sy = 82, --background size + + fontsize = 10.5, + + padding = 3*widgetScale, + color2 = {1,1,1,0.025}, + + margin = 11, --distance from background border + + cbackground = {0,0,0,0.66}, --color {r,g,b,alpha} + cborder = {0,0,0,0.2}, + + dragbutton = {2,3}, --middle mouse button + tooltip = { + background = "In CTRL+F11 mode: Hold \255\255\255\1middle mouse button\255\255\255\255 to drag this element.", + }, + unitCounterEnabled = false, + }, +} + +local totalUnits = 0 +local totalGaiaUnits = 0 + +local spGetTeamUnitCount = Spring.GetTeamUnitCount +local sGetCurrentTooltip = Spring.GetCurrentTooltip +local sGetSelectedUnitsCount = Spring.GetSelectedUnitsCount + +local GaiaTeamID = Spring.GetGaiaTeamID() + +-- Hotkeys +VFS.Include("luaui/configs/evo_buildHotkeysConfig.lua") + +local sGetKeySymbol = Spring.GetKeySymbol +local function getKeySymbol(k) + local keySymbol = sGetKeySymbol(k) + return keySymbol:sub(1, 1):upper() .. keySymbol:sub(2) +end +local humanNameToKeySymbols = {} +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + local name = ud.name + if name:find("_up", -5) then name = name:sub(1, -5) end + if nameToKeyCode[name] then + local str = "" + local leng = #nameToKeyCode[name] + for i = 1, leng do + str = str .. getKeySymbol(nameToKeyCode[name][i]) + if i < leng then str = str .. ", " end + end + humanNameToKeySymbols[ud.humanName] = str + end +end +-- + + +local function IncludeRedUIFrameworkFunctions() + New = WG.Red.New(widget) + Copy = WG.Red.Copytable + SetTooltip = WG.Red.SetTooltip + GetSetTooltip = WG.Red.GetSetTooltip + Screen = WG.Red.Screen + GetWidgetObjects = WG.Red.GetWidgetObjects +end + +local function RedUIchecks() + local color = "\255\255\255\1" + local passed = true + if (type(WG.Red)~="table") then + Spring.Echo(color..widget:GetInfo().name.." requires Red UI Framework.") + passed = false + elseif (type(WG.Red.Screen)~="table") then + Spring.Echo(color..widget:GetInfo().name..">> strange error.") + passed = false + elseif (WG.Red.Version < NeededFrameworkVersion) then + Spring.Echo(color..widget:GetInfo().name..">> update your Red UI Framework.") + passed = false + end + if (not passed) then + widgetHandler:ToggleWidget(widget:GetInfo().name) + return false + end + IncludeRedUIFrameworkFunctions() + return true +end + +local function AutoResizeObjects() --autoresize v2 + if (LastAutoResizeX==nil) then + LastAutoResizeX = CanvasX + LastAutoResizeY = CanvasY + end + local lx,ly = LastAutoResizeX,LastAutoResizeY + local vsx,vsy = Screen.vsx,Screen.vsy + if ((lx ~= vsx) or (ly ~= vsy)) then + local objects = GetWidgetObjects(widget) + local scale = vsy/ly + local skippedobjects = {} + for i=1,#objects do + local o = objects[i] + local adjust = 0 + if ((o.movableslaves) and (#o.movableslaves > 0)) then + adjust = (o.px*scale+o.sx*scale)-vsx + if (((o.px+o.sx)-lx) == 0) then + o._moveduetoresize = true + end + end + if (o.px) then o.px = o.px * scale end + if (o.py) then o.py = o.py * scale end + if (o.sx) then o.sx = o.sx * scale end + if (o.sy) then o.sy = o.sy * scale end + if (o.fontsize) then o.fontsize = o.fontsize * scale end + if (adjust > 0) then + o._moveduetoresize = true + o.px = o.px - adjust + for j=1,#o.movableslaves do + local s = o.movableslaves[j] + s.px = s.px - adjust/scale + end + elseif ((adjust < 0) and o._moveduetoresize) then + o._moveduetoresize = nil + o.px = o.px - adjust + for j=1,#o.movableslaves do + local s = o.movableslaves[j] + s.px = s.px - adjust/scale + end + end + end + LastAutoResizeX,LastAutoResizeY = vsx,vsy + end +end +local function getEditedCurrentTooltip() + local text = sGetCurrentTooltip() + if text == "Repair: Repairs another unit" then return "Build: Builds unfinished structures" end -- hack for Evo + -- Shows build hotkey + local buildTextPosition = text:find("Build: ") + if buildTextPosition then + local nameEndPosition = text:find("- ") + local humanName = text:sub(buildTextPosition + 7, nameEndPosition - 2) + if humanNameToKeySymbols[humanName] then + text = text:gsub("- ", "(Hotkey: " .. humanNameToKeySymbols[humanName] .. ") - ", 1) + end + end + --extract the exp value with regexp + local expPattern = "Experience (%d+%.%d%d)" + local currentExp = tonumber(text:match(expPattern)) + --replace with limexp: exp/(1+exp) since all spring exp effects are linear in limexp, multiply by 10 because people like big numbers instead of [0,1] + return currentExp and text:gsub(expPattern,string.format("Experience %.2f", 10*currentExp/(1+currentExp)) ) or text +end + +local function createtooltip(r) + local text = {"text", + px=r.px+r.margin,py=r.py+(r.margin/1.5), + fontsize=r.fontsize, + color={1,1,1,0.3}, + caption="", + options="o", + + onupdate=function(self) + local unitcount = sGetSelectedUnitsCount() + if (unitcount ~= 0) then + self.caption = "Selected units: "..unitcount.."\n" + else + self.caption = "\n" + end + + if (self._mouseoverself) then + self.caption = self.caption..r.tooltip.background + else + self.caption = self.caption..(getEditedCurrentTooltip() or sGetCurrentTooltip()) + end + end + } + + local unitcounter = {"text", + px=r.sx-(r.margin/2),py=r.py+(r.margin/2), + fontsize=r.fontsize/1.3, + color={1,1,1,0.2}, + caption="", + options="r", + + onupdate=function(self) + if Config.tooltip.unitCounterEnabled then + -- get total unit count + if Spring.GetGameFrame() % 60 == 0 then + totalUnits = 0 + totalGaiaUnits = 0 + local allyTeamList = Spring.GetAllyTeamList() + local numberOfAllyTeams = #allyTeamList + for allyTeamListIndex = 1, numberOfAllyTeams do + local allyID = allyTeamList[allyTeamListIndex] + local teamList = Spring.GetTeamList(allyID) + for _,teamID in pairs(teamList) do + totalUnits = totalUnits + spGetTeamUnitCount(teamID) + if teamID == GaiaTeamID then + totalGaiaUnits = totalGaiaUnits + spGetTeamUnitCount(teamID) + end + end + end + local alpha = (totalUnits/6600) + if alpha > 0.66 then alpha = 0.66 end + if alpha < 0.2 then alpha = 0.2 end + self.color={1,1,1,alpha} + end + self.caption = totalUnits.."\n"..totalGaiaUnits + vsx,vsy = gl.GetViewSizes() + + else + self.caption = "" + end + end + } + local background2 = {"rectanglerounded", + px=r.px+r.padding,py=r.py+r.padding, + sx=r.sx-r.padding-r.padding,sy=r.sy-r.padding-r.padding, + color=r.color2, + } + local background = {"rectanglerounded", + px=r.px,py=r.py, + sx=r.sx,sy=r.sy, + color=r.cbackground, + border=r.cborder, + + padding=r.padding, + + movable=r.dragbutton, + movableslaves={text,unitcounter,background2}, + + obeyscreenedge = true, + --overridecursor = true, + --overrideclick = {2}, + + onupdate=function(self) + if (self.px < (Screen.vsx/2)) then --left side of screen + if ((self.sx-r.margin*2) <= text.getwidth()) then + self.sx = (text.getwidth()+r.margin*2) -1 + else + self.sx = r.sx * Screen.vsy/CanvasY + end + text.px = self.px + r.margin + else --right side of screen + if ((self.sx-r.margin*2 -1) <= text.getwidth()) then + self.px = self.px - ((text.getwidth() + r.margin*2) - self.sx) + self.sx = (text.getwidth() + r.margin*2) + else + self.px = self.px - ((r.sx * Screen.vsy/CanvasY) - self.sx) + self.sx = r.sx * Screen.vsy/CanvasY + end + text.px = self.px + r.margin + end + unitcounter.px = self.sx - ((r.margin/2)* Screen.vsy/CanvasY) + background2.px = self.px + self.padding + background2.py = self.py + self.padding + background2.sx = self.sx - self.padding - self.padding + background2.sy = self.sy - self.padding - self.padding + end, + + mouseover=function(mx,my,self) + text._mouseoverself = true + end, + mousenotover=function(mx,my,self) + text._mouseoverself = nil + end, + } + + + New(background) + New(background2) + New(text) + New(unitcounter) + + return { + ["background"] = background, + ["background2"] = background2, + ["text"] = text, + ["unitcounter"] = unitcounter, + + margin = r.margin, + } +end + +function widget:Initialize() + PassedStartupCheck = RedUIchecks() + if (not PassedStartupCheck) then return end + + tooltip = createtooltip(Config.tooltip) + + Spring.SetDrawSelectionInfo(false) --disables springs default display of selected units count + Spring.SendCommands("tooltip 0") + AutoResizeObjects() +end + +function widget:Shutdown() + Spring.SendCommands("tooltip 1") +end + +function widget:Update() + AutoResizeObjects() +end + +function widget:GameFrame(n) + + -- get total unit count + if n % 120 == 0 then + totalUnits = 0 + local allyTeamList = Spring.GetAllyTeamList() + local numberOfAllyTeams = #allyTeamList + for allyTeamListIndex = 1, numberOfAllyTeams do + local allyID = allyTeamList[allyTeamListIndex] + local teamList = Spring.GetTeamList(allyID) + for _,teamID in pairs(teamList) do + totalUnits = totalUnits + spGetTeamUnitCount(teamID) + if teamID == GaiaTeamID then + totalGaiaUnits = totalGaiaUnits + 1 + end + end + end + end +end + +--save/load stuff +--currently only position +function widget:GetConfigData() --save config + if (PassedStartupCheck) then + local vsy = Screen.vsy + local unscale = CanvasY/vsy --needed due to autoresize, stores unresized variables + --Config.tooltip.px = tooltip.background.px * unscale + --Config.tooltip.py = tooltip.background.py * unscale + Config.tooltip.unitCounterEnabled = Config.tooltip.unitCounterEnabled + return {Config=Config} + end +end +function widget:SetConfigData(data) --load config + if (data.Config ~= nil) then + --Config.tooltip.px = data.Config.tooltip.px + --Config.tooltip.py = data.Config.tooltip.py + Config.tooltip.unitCounterEnabled = data.Config.tooltip.unitCounterEnabled + end +end + +function widget:TextCommand(command) + if (string.find(command, "unitcount") == 1 and string.len(command) == 11) then + Config.tooltip.unitCounterEnabled = not Config.tooltip.unitCounterEnabled + if Config.tooltip.unitCounterEnabled then + Spring.Echo("Total units counter: enabled") + else + Spring.Echo("Total units counter: disabled") + end + end +end diff --git a/LuaUI/Widgets_Evo/gui_replaybuttons.lua b/LuaUI/Widgets_Evo/gui_replaybuttons.lua index 94ef2248f..9045fc66c 100644 --- a/LuaUI/Widgets_Evo/gui_replaybuttons.lua +++ b/LuaUI/Widgets_Evo/gui_replaybuttons.lua @@ -12,7 +12,15 @@ function widget:GetInfo() } end -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local bgcorner = "LuaUI/Images/bgcorner.png" + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) local speedbuttons={} --the 1x 2x 3x etc buttons local buttons={} --other buttons (atm only pause/play) @@ -21,6 +29,9 @@ local speeds = {0.5, 1, 2, 3, 4, 5, 10, 20} wPos = {x=0.00, y=0.15} local isPaused = false local isActive = true --is the widget shown and reacts to clicks? +local sceduleUpdate = true +local vsx,vsy = Spring.GetViewGeometry() +widgetScale = (0.5 + (vsx*vsy / 5700000)) function widget:Initialize() if (not Spring.IsReplay()) then @@ -45,30 +56,78 @@ function widget:Initialize() end -function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('replaybuttons') +function widget:Shutdown() + if WG['guishader'] then + WG['guishader'].DeleteDlist('replaybuttons') end + gl.DeleteList(speedButtonsList) + gl.DeleteList(buttonsList) + gl.DeleteFont(font) end function speedButtonColor (i) return{0,0,0,0.6} end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() - if (WG['guishader_api'] ~= nil) then + if chobbyInterface then return end + if WG['guishader'] then if isActive then local h = 0.033 local dy = (#speeds +1) * h - WG['guishader_api'].InsertRect(sX(wPos.x), sY(wPos.y), sX(wPos.x+0.037), sY(wPos.y+dy), 'replaybuttons') + + if backgroundGuishader then + gl.DeleteList(backgroundGuishader) + end + backgroundGuishader = gl.CreateList( function() + RectRound(sX(wPos.x), sY(wPos.y), sX(wPos.x+0.037), sY(wPos.y+dy), 6*widgetScale) + end) + WG['guishader'].InsertDlist(backgroundGuishader, 'replaybuttons') else - WG['guishader_api'].RemoveRect('replaybuttons') + WG['guishader'].DeleteDlist('replaybuttons') end end if not isActive then return end - draw_buttons(speedbuttons) - draw_buttons(buttons) + if sceduleUpdate then + if speedButtonsList then + gl.DeleteList(speedButtonsList) + gl.DeleteList(buttonsList) + end + speedButtonsList = gl.CreateList(draw_buttons, speedbuttons) + buttonsList = gl.CreateList(draw_buttons, buttons) + sceduleUpdate = false + end + if speedButtonsList then + gl.CallList(speedButtonsList) + gl.CallList(buttonsList) + end + local mousex, mousey = Spring.GetMouseState() + local b = speedbuttons + local topbutton = #speedbuttons + if point_in_rect (buttons[1].x, buttons[1].y, b[topbutton].x+b[topbutton].w, b[topbutton].y+b[topbutton].h, uiX(mousex), uiY(mousey)) then + for i = 1, #b, 1 do + if (point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, uiX(mousex), uiY(mousey)) or i == active_button) then + gl.Color (0.4,0.4,0.4,0.6) + uiRect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h) + uiText (b[i].text, b[i].x, b[i].y+b[i].h/2, (0.0115), 'vo') + end + end + b = buttons + for i = 1, #b, 1 do + if (point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, uiX(mousex), uiY(mousey)) or i == active_button) then + gl.Color (0.4,0.4,0.4,0.6) + uiRect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h) + uiText (b[i].text, b[i].x, b[i].y+b[i].h/2, (0.0115), 'vo') + end + end + end end function widget:MousePress(x,y,button) @@ -79,7 +138,8 @@ function widget:MousePress(x,y,button) for i = 1, #speeds do --reset all buttons colors speedbuttons[i].color = speedButtonColor (i) end - speedbuttons[i].color = {0.75,0,0,0.66} + speedbuttons[i].color = {0.75,0,0,0.66 } + sceduleUpdate = true end local cb,i = clicked_button (buttons) @@ -98,6 +158,7 @@ function widget:MousePress(x,y,button) Spring.SendCommands ("skip 1") buttons[i].text = " ||" end + sceduleUpdate = true end end @@ -135,8 +196,7 @@ end --Feb 2011 by knorke local glPopMatrix = gl.PopMatrix local glPushMatrix = gl.PushMatrix -local glText = gl.Text -local vsx, vsy = widgetHandler:GetViewSizes() + --UI coordinaten zu scalierten screen koordinaten function sX (uix) return uix*vsx @@ -153,9 +213,17 @@ function uiY (sY) end function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + sceduleUpdate = true + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end end + ----zeichen funktionen--------- function uiRect (x,y,x2,y2) RectRound(sX(x), sY(y), sX(x2), sY(y2), 6) @@ -164,7 +232,9 @@ end function uiText (text, x,y,s,options) if (text==" " or text==" ") then return end --archivement: unlock +20 fps - glText (text, sX(x), sY(y), sX(s), options) + font:Begin() + font:Print(text, sX(x), sY(y), sX(s), options) + font:End() end -------------------------------- -----message boxxy----- @@ -184,11 +254,13 @@ end function drawmessage_simple (message, x, y, s) offx=0 - if (message.frame) then - glText (frame2time (message.frame), sX(x+offx), sY(y), sX(s/2), 'vo') + font:Begin() + if (message.frame) then + font:Print(frame2time (message.frame), sX(x+offx), sY(y), sX(s/2), 'vo') offx=offx+(2*s) - end - glText (message.text, sX(x+offx), sY(y), sX(s), 'vo') + end + font:Print(message.text, sX(x+offx), sY(y), sX(s), 'vo') + font:End() end --X, Y and size in UI scale @@ -198,8 +270,9 @@ function drawmessage (message, x, y, s) uiRect (x,y+s/2, x+1, y-s/2) end offx=0 - if (message.frame) then - glText (frame2time (message.frame), sX(x+offx), sY(y), sX(s/2), 'vo') + font:Begin() + if (message.frame) then + font:Print(frame2time (message.frame), sX(x+offx), sY(y), sX(s/2), 'vo') offx=offx+(2*s) end if (message.icon) then @@ -211,8 +284,9 @@ function drawmessage (message, x, y, s) gl.Texture(false) --gl.PopMatrix() offx=offx+(s) - end - glText (message.text, sX(x+offx), sY(y), sX(s), 'vo') + end + font:Print(message.text, sX(x+offx), sY(y), sX(s), 'vo') + font:End() end @@ -253,9 +327,9 @@ function draw_buttons (b) local mousex, mousey = Spring.GetMouseState() for i = 1, #b, 1 do if (b[i].color) then gl.Color (unpack(b[i].color)) else gl.Color (1 ,0,0,0.66) end - if (point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, uiX(mousex), uiY(mousey)) or i == active_button) then - gl.Color (0.4,0.4,0.4,0.6) - end + --if (point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, uiX(mousex), uiY(mousey)) or i == active_button) then + -- gl.Color (0.4,0.4,0.4,0.6) + --end if (b[i].name == selected_missionid) then gl.Color (0,1,1,0.66) end --highlight selected mission, bit unnice this way w/e uiRect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h) diff --git a/LuaUI/Widgets_Evo/gui_resourceBar.lua b/LuaUI/Widgets_Evo/gui_resourceBar.lua index 6b12d2442..a1eef5f0a 100644 --- a/LuaUI/Widgets_Evo/gui_resourceBar.lua +++ b/LuaUI/Widgets_Evo/gui_resourceBar.lua @@ -10,6 +10,18 @@ function widget:GetInfo() } end +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.33 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + --Disable Default Resources Bar Spring.SendCommands({"resbar 0"}) @@ -29,7 +41,7 @@ local maxBasicIncome = Spring.GetModOptions().maxbasicincome or 15 -- resource bars: ON means the bars show percentage, OFF means they simply change color depending on state local progressBars = true -local maxSupply = tonumber(Spring.GetModOptions().supplycap) or 400 +local maxSupply = tonumber(Spring.GetModOptions().supplycap) or 1000000 -- internal settings, do not touch local white = "\255\255\255\255" @@ -52,6 +64,10 @@ local metalWarning = false simplifiedResourceBar = Spring.GetConfigInt("evo_simplifiedresourcebar", 1) +local energyNotificationTimeout = 60 +local metalNotificationTimeout = 60 +local supplyNotificationTimeout = 60 + -- Avoids spamming of income increased notification local incomeIncreased = false @@ -155,8 +171,19 @@ function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differentl end function widget:GameFrame(n) - if n%450 == 4 then - local _, _, spectator = Spring.GetPlayerInfo(Spring.GetMyTeamID()) + if n%30 == 1 then + energyNotificationTimeout = energyNotificationTimeout - 1 + metalNotificationTimeout = metalNotificationTimeout - 1 + supplyNotificationTimeout = supplyNotificationTimeout - 1 + + --Spring.Echo("E " .. energyNotificationTimeout) + --Spring.Echo("M " .. metalNotificationTimeout) + --Spring.Echo("S " .. supplyNotificationTimeout) + end + + if n%30 == 1 then + local spectator = Spring.GetSpectatingState() + --Spring.Echo(spectator) resourcePrompts = Spring.GetConfigInt("evo_resourceprompts", 1) simplifiedResourceBar = Spring.GetConfigInt("evo_simplifiedresourcebar", 1) @@ -165,7 +192,7 @@ function widget:GameFrame(n) resourcePrompts = 1 end - if spectator == true then + if spectator then resourcePrompts = 0 end --Spring.Echo(resourcePrompts) @@ -183,27 +210,41 @@ function widget:GameFrame(n) end elseif increment > 0 then - if energyWarning == true then - if n%900 == 4 then + if n%30 == 1 then + if energyWarning == true then + --Spring.Echo("EnergyWarning") if resourcePrompts == 1 then - Spring.PlaySoundFile("sounds/ui/additionalgenerators.wav", 1) - Spring.Echo([[You must construct additional generators so that your units can fire their weapons!]]) + if energyNotificationTimeout <= 0 then + if metalNotificationTimeout <= 20 and supplyNotificationTimeout <= 20 then + energyNotificationTimeout = 30 + Spring.PlaySoundFile("sounds/ui/additionalgenerators.wav", 1) + Spring.Echo([[You must construct additional generators so you can build and evolve at full speed!]]) + end + end end end - end - if metalWarning == true then - if n%1800 == 4 then + if metalWarning == true then + --Spring.Echo("MetalWarning") if resourcePrompts == 1 then - Spring.PlaySoundFile("sounds/ui/useyourmetal.wav", 1) - Spring.Echo([[You are excessing metal! Consider using O.R.B.s to build units faster and spend metal more effectively!]]) + if metalNotificationTimeout <= 0 then + if energyNotificationTimeout <= 20 and supplyNotificationTimeout <= 20 then + metalNotificationTimeout = 30 + Spring.PlaySoundFile("sounds/ui/useyourmetal.wav", 1) + Spring.Echo([[You are excessing metal! Consider using O.R.B.s to build units faster and spend metal more effectively!]]) + end + end end end - end - if supplyWarning == true then - if n%700 == 4 then + if supplyWarning == true then + --Spring.Echo("SupplyWarning") if resourcePrompts == 1 then - Spring.PlaySoundFile("sounds/ui/constructadditionalpylons.wav", 1) - Spring.Echo([[You have no more available supply, build supply depots in order to increase the size of your army!]]) + if supplyNotificationTimeout <= 0 then + if energyNotificationTimeout <= 20 and metalNotificationTimeout <= 20 then + supplyNotificationTimeout = 30 + Spring.PlaySoundFile("sounds/ui/constructadditionalpylons.wav", 1) + Spring.Echo([[You have no more available supply, build supply depots in order to increase the size of your army!]]) + end + end end end end @@ -260,7 +301,14 @@ end local prevGameframe = 0 +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if Spring.GetGameFrame() ~= prevGameframe then -- check resource status first myTeamID = Spring.GetMyTeamID() @@ -269,7 +317,9 @@ function widget:DrawScreen() ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") - if (sm < 30 and su >= sm - 5) or (su > sm) or (sm >= 30 and su >= sm - 10 and su < sm and sm < maxSupply * 0.95) then + local cockblocked = (Spring.GetTeamRulesParam(myTeamID, "supply_blocked") == 1) + + if sm < maxSupply and (cockblocked or su > sm) then supplyWarning = true bgSupplyR = 1 bgSupplyG = increment/bgFlashPeriod @@ -334,8 +384,8 @@ end function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('resources') + if (WG['guishader'] ~= nil) then + WG['guishader'].RemoveRect('resources') end if displayList ~= nil then @@ -343,6 +393,8 @@ function widget:Shutdown() gl.DeleteList(displayList2) gl.DeleteList(displayList3) end + gl.DeleteFont(font) + gl.DeleteFont(font2) end --------------------------------------------------------------------------------------------------------- @@ -363,21 +415,30 @@ function generateDisplayList() gl.Scale(widgetScale, widgetScale, 1) -- background - gl.Color(0,0,0,0.77) + gl.Color(0,0,0,ui_opacity) RectRound(supplyOffset-bgmargin, -bgmargin, metalOffset+metalBarWidth+bgmargin, height+bgmargin, 10) + + if (WG['guishader'] ~= nil) then + local scaleDiffX = -((posx*widgetScale)-posx)/widgetScale + local scaleDiffY = -((posy*widgetScale)-posy)/widgetScale + WG['guishader'].InsertRect( + posx+(-(width*widgetScale)/3) + supplyOffset-bgmargin, + posy+(-((height+bgmargin-2) * (widgetScale-1))) - ((bgmargin)*widgetScale), + posx+(-(width*widgetScale)/3) + ((metalOffset+metalBarWidth+bgmargin)*widgetScale), + posy+(-((height+bgmargin-2) * (widgetScale-1))) + ((height+bgmargin)*widgetScale), + 'resources' + ) + end -- content area gl.Color(0.33,0.33,0.33,0.15) RectRound(supplyOffset-bgmargin2, -bgmargin2, metalOffset+metalBarWidth+bgmargin2, height+bgmargin2,9) - - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].InsertRect(supplyOffset-(bgmargin*0.8), -(bgmargin*0.8), metalOffset+metalBarWidth+(bgmargin*0.8), height+(bgmargin*0.8), 'resources') - end - - gl.Text(yellow .. "Energy", energyOffset+textOffsetX+29, textOffsetY, FontSize, "on") - gl.Text(green .. "Supply", supplyOffset+textOffsetX+29, textOffsetY, FontSize, "on") - gl.Text(skyblue .. "Metal", metalOffset+textOffsetX+29, textOffsetY, FontSize, "on") + font2:Begin() + font2:Print(yellow .. "Energy", energyOffset+textOffsetX+29, textOffsetY, FontSize, "on") + font2:Print(green .. "Supply", supplyOffset+textOffsetX+29, textOffsetY, FontSize, "on") + font2:Print(skyblue .. "Metal", metalOffset+textOffsetX+29, textOffsetY, FontSize, "on") + font2:End() gl.Texture(false) end) @@ -395,8 +456,8 @@ function generateDisplayList2() displayList2 = gl.CreateList(function () -- draw background (black / gray / black / ...) -- background flashes when the player messed up their eco - local glowSize = (height/6) * 3.3 - local glowAlpha = 0.1 + local glowSize = (height/6) * 5 + local glowAlpha = 0.15 gl.Color(bgSupplyR,bgSupplyG,0,0.33) gl.Texture(barTexture) @@ -443,6 +504,7 @@ function generateDisplayList2() gl.TexRect(supplyOffset,0,supplyOffset+(supplyBarWidth*percentage),height/6) if simplifiedResourceBar == 1 then + supplyUsedColor = green if su < (sm * 0.50) then supplyUsedColor = green elseif su > (sm * 0.50) then @@ -459,11 +521,15 @@ function generateDisplayList2() supplyAvailableColor = green end - supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. sm .. " " + supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. "∞" .. " " + --supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. sm .. " " + else - supplyStr = white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ") " + supplyStr = white .. su .. "/" .. "∞" .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. "∞" .. white .. ") " + --supplyStr = white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ") " end - gl.Text(supplyStr, supplyOffset+supplyBarWidth, textOffsetY, FontSize, "onr") + font2:Begin() + font2:Print(supplyStr, supplyOffset+supplyBarWidth, textOffsetY, FontSize, "onr") -- energy bar @@ -507,7 +573,7 @@ function generateDisplayList2() else energyStr = green .. "+" .. tostring(math.round(ei,1)) .. white .. "/" .. red .. "-" .. tostring(math.round(ep,1)) .. white .. " (" .. yellow .. tostring(math.round(ec)).. white .. "/" .. tostring(math.round(es)) .. ") " end - gl.Text(energyStr, energyOffset+energyBarWidth, textOffsetY, FontSize, "onr") + font2:Print(energyStr, energyOffset+energyBarWidth, textOffsetY, FontSize, "onr") -- metal bar r, g, b = 0, 0, 0 @@ -570,8 +636,8 @@ function generateDisplayList2() else metalStr = orange .. "±" .. tostring(math.round(mi - me)) .. green .. " +" .. tostring(math.round(mi,1)) .. white .. "/" .. red .. "-" .. tostring(math.round(mp)) .. white .. " (" .. skyblue .. tostring(math.round(mc)) .. white .. "/" .. tostring(math.round(ms)) .. ") " end - gl.Text(metalStr, metalOffset+metalBarWidth, textOffsetY, FontSize, "onr") - + font2:Print(metalStr, metalOffset+metalBarWidth, textOffsetY, FontSize, "onr") + font2:End() gl.Texture(false) end) @@ -606,7 +672,31 @@ function widget:ViewResize(newX,newY) --posx, posy = (vsx - width)/2, vsy - height - 10 posx, posy = (vsx/2), vsy - (height+bgmargin-2) tweakStartX, tweakStartY = vsx - width * 1.59, vsy - height + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + --tweakStartX, tweakStartY = vsx - ((width * 1.59)*widgetScale), vsy - (height*widgetScale) generateDisplayList() generateDisplayList3() end + + +local uiOpacitySec = 0 +function widget:Update(dt) + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + generateDisplayList() + generateDisplayList3() + end + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_selected_units_buttons.lua b/LuaUI/Widgets_Evo/gui_selected_units_buttons.lua index 7314fd644..b48cc149d 100644 --- a/LuaUI/Widgets_Evo/gui_selected_units_buttons.lua +++ b/LuaUI/Widgets_Evo/gui_selected_units_buttons.lua @@ -29,6 +29,15 @@ end -- Automatically generated local definitions +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + + local GL_ONE = GL.ONE local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA local GL_SRC_ALPHA = GL.SRC_ALPHA @@ -42,8 +51,6 @@ local glRect = gl.Rect local glRotate = gl.Rotate local glScale = gl.Scale local glTexRect = gl.TexRect -local glGetTextWidth = gl.GetTextWidth -local glGetTextHeight = gl.GetTextHeight local glText = gl.Text local glTexture = gl.Texture local glTranslate = gl.Translate @@ -53,6 +60,7 @@ local spGetModKeyState = Spring.GetModKeyState local spGetMouseState = Spring.GetMouseState local spGetMyTeamID = Spring.GetMyTeamID local spGetSelectedUnits = Spring.GetSelectedUnits +local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount local spGetSelectedUnitsCounts = Spring.GetSelectedUnitsCounts local spGetSelectedUnitsSorted = Spring.GetSelectedUnitsSorted local spGetTeamUnitsSorted = Spring.GetTeamUnitsSorted @@ -62,13 +70,14 @@ local spSendCommands = Spring.SendCommands local spIsGUIHidden = Spring.IsGUIHidden -include("colors.h.lua") - ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" -local highlightImg = ":n:"..LUAUI_DIRNAME.."Images/button-highlight.dds" +local ui_opacityMultiplier = 0.6 +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) * ui_opacityMultiplier + +local bgcorner = ":n:LuaUI/Images/bgcorner.png" +local highlightImg = ":n:LuaUI/Images/button-highlight.dds" local iconsPerRow = 16 -- not functional yet, I doubt I will put this in @@ -82,9 +91,11 @@ local countsTable = {} local activePress = false local mouseIcon = -1 local currentDef = nil +local prevUnitCount = spGetSelectedUnitsCounts() +local oldUnitpics = false -local iconSizeX = 64 -local iconSizeY = 64 +local iconSizeX = 76 +local iconSizeY = 76 local iconImgMult = 0.85 local usedIconSizeX = iconSizeX @@ -94,45 +105,68 @@ local rectMaxX = 0 local rectMinY = 0 local rectMaxY = 0 - -local enabled = true local backgroundDimentions = {} local iconMargin = usedIconSizeX / 25 -- changed in ViewResize anyway local fontSize = iconSizeY * 0.28 -- changed in ViewResize anyway local picList local playSounds = true -local leftclick = LUAUI_DIRNAME .. 'Sounds/buildbar_add.wav' -local middleclick = LUAUI_DIRNAME .. 'Sounds/buildbar_click.wav' -local rightclick = LUAUI_DIRNAME .. 'Sounds/buildbar_rem.wav' +local leftclick = 'LuaUI/Sounds/buildbar_add.wav' +local middleclick = 'LuaUI/Sounds/buildbar_click.wav' +local rightclick = 'LuaUI/Sounds/buildbar_rem.wav' +local guishaderDisabled = true +if spGetSelectedUnitsCount() > 0 then + local checkSelectedUnits = true +end ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- local function updateGuishader() - if (WG['guishader_api'] ~= nil) then - if not enabled then - WG['guishader_api'].RemoveRect('selectionbuttons') - else + if WG['guishader'] then + if not picList then + WG['guishader'].RemoveDlist('selectionbuttons') + guishaderDisabled = true + else if backgroundDimentions[1] ~= nil then - WG['guishader_api'].InsertRect( - backgroundDimentions[1], - backgroundDimentions[2], - backgroundDimentions[3], - backgroundDimentions[4], - 'selectionbuttons' - ) + if dlistGuishader ~= nil then + WG['guishader'].RemoveDlist('selectionbuttons') + gl.DeleteList(dlistGuishader) + end + dlistGuishader = gl.CreateList( function() + RectRound(backgroundDimentions[1], backgroundDimentions[2], backgroundDimentions[3], backgroundDimentions[4], usedIconSizeX / 8) + WG['guishader'].InsertDlist(dlistGuishader, 'selectionbuttons') + end) + guishaderDisabled = false end end end end +local selectedUnits = Spring.GetSelectedUnits() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() +local selectedUnitsCounts = Spring.GetSelectedUnitsCounts() +local selectionChanged = true +function widget:SelectionChanged(sel) + selectedUnits = sel + selectedUnitsCount = Spring.GetSelectedUnitsCount() + selectedUnitsCounts = Spring.GetSelectedUnitsCounts() + selectionChanged = true +end + + local vsx, vsy = widgetHandler:GetViewSizes() -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY - +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + iconsPerRow = math.floor(8 * (vsx / vsy)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + usedIconSizeX = math.floor((iconSizeX/2) + ((vsx*vsy) / 115000)) usedIconSizeY = math.floor((iconSizeY/2) + ((vsx*vsy) / 115000)) fontSize = usedIconSizeY * 0.28 @@ -159,60 +193,116 @@ end local prevMouseIcon local hoverClock = nil +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() - cacheUnitIcons() -- else white icon bug happens - enabled = false - if (not spIsGUIHidden()) then - if picList then - local unitCounts = spGetSelectedUnitsCounts() - local icon = -1 - for udid,count in pairs(unitCounts) do - icon = icon + 1 + if chobbyInterface then return end + cacheUnitIcons() -- else white icon bug happens + if picList then + if (spIsGUIHidden()) then return end + + if mouseIcon ~= prevMouseIcon then + gl.DeleteList(picList) + picList = gl.CreateList(DrawPicList) + prevMouseIcon = mouseIcon + end + gl.CallList(picList) + + -- draw the highlights + local x,y,lb,mb,rb = spGetMouseState() + mouseIcon = MouseOverIcon(x, y) + if (not widgetHandler:InTweakMode() and (mouseIcon >= 0)) then + if (lb or mb or rb) then + if lb then + DrawIconQuad(mouseIcon, leftmouseColor) -- click highlight + elseif mb then + DrawIconQuad(mouseIcon, middlemouseColor) -- click highlight + elseif rb then + DrawIconQuad(mouseIcon, rightmouseColor) -- click highlight end - if icon > 0 then - enabled = true - gl.CallList(picList) - -- draw the highlights - local x,y,lb,mb,rb = spGetMouseState() - mouseIcon = MouseOverIcon(x, y) - if (not widgetHandler:InTweakMode() and (mouseIcon >= 0)) then - if (lb or mb or rb) then - if lb then - DrawIconQuad(mouseIcon, leftmouseColor) -- click highlight - elseif mb then - DrawIconQuad(mouseIcon, middlemouseColor) -- click highlight - elseif rb then - DrawIconQuad(mouseIcon, rightmouseColor) -- click highlight + else + --DrawIconQuad(mouseIcon, hoverColor) -- hover highlight + end + if hoverClock == nil then hoverClock = os.clock() end + Spring.SetMouseCursor('cursornormal') + if WG['tooltip'] ~= nil and mouseIcon then + local unitName = ' --- ' + local i = 0 + for udid,count in pairs(selectedUnitsCounts) do + if type(udid) == 'number' then + if i == mouseIcon then + unitName = UnitDefs[udid].humanName + break end - else - --DrawIconQuad(mouseIcon, hoverColor) -- hover highlight - end - if hoverClock == nil then hoverClock = os.clock() end - if WG['tooltip'] ~= nil and os.clock() - hoverClock > 0.6 then - WG['tooltip'].ShowTooltip('selectedunitbuttons', "\255\215\255\215Selected units\n \255\255\255\255Left click\255\210\210\210: Remove all other unit types\n \255\255\255\255Left click + CTRL\255\210\210\210: Select all units of this type on map\n \255\255\255\255Left click + ALT\255\210\210\210: Remove all by 1 unit of this unit type\n \255\255\255\255Right click\255\210\210\210: Remove that unit type from the selection\n \255\255\255\255Right click + CTRL\255\210\210\210: Only remove 1 unit from that unit type\n \255\255\255\255Middle click\255\210\210\210: Move to the center location of the selected unit(s)\n \255\255\255\255Middle click + CTRL\255\210\210\210: Move to the center off whole selection") + i = i + 1 end - else - hoverClock = nil - end - if mouseIcon ~= prevMouseIcon then - gl.DeleteList(picList) - picList = gl.CreateList(DrawPicList) - prevMouseIcon = mouseIcon - end end - end - end - updateGuishader() + WG['tooltip'].ShowTooltip('selectedunitbuttons_unit', "\255\215\255\215"..unitName, x, backgroundDimentions[4]+(usedIconSizeY*0.37)) + end + if WG['tooltip'] ~= nil and os.clock() - hoverClock > 0.6 then + local text = "\255\215\255\215Selected units\n \255\255\255\255Left click\255\210\210\210: Select\n \255\255\255\255 + CTRL\255\210\210\210: Select units of this type on map\n \255\255\255\255 + ALT\255\210\210\210: Remove all by 1 unit of this unit type\n \255\255\255\255Right click\255\210\210\210: Remove\n \255\255\255\255 + CTRL\255\210\210\210: Remove only 1 unit from that unit type\n \255\255\255\255Middle click\255\210\210\210: Move to center location\n \255\255\255\255 + CTRL\255\210\210\210: Move to center off whole selection" + local textHeight, desc, numLines = font:GetTextHeight(text) + WG['tooltip'].ShowTooltip('selectedunitbuttons', text, vsx, backgroundDimentions[4]+(usedIconSizeY*1.3) + (textHeight*numLines*15*fontfileScale)) + end + else + hoverClock = nil + end + end end -function widget:CommandsChanged() - if picList then - gl.DeleteList(picList) +function widget:UnitDestroyed(unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeamID) + if unitCounts ~= nil and unitCounts[unitDefID] ~= nil then + if unitCounts[unitDefID] > 1 then + unitCounts[unitDefID] = unitCounts[unitDefID] - 1 + else + unitCounts[unitDefID] = nil + end + checkSelectedUnits = true + skipGetUnitCounts = true + end +end + +local uiOpacitySec = 0 +local selChangedSec = 0 +function widget:Update(dt) + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= (Spring.GetConfigFloat("ui_opacity",0.66) * ui_opacityMultiplier) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) * ui_opacityMultiplier + gl.DeleteList(picList) + picList = gl.CreateList(DrawPicList) + end + end + + selChangedSec = selChangedSec + dt + if selectionChanged and selChangedSec>0.1 then + selChangedSec = 0 + selectionChanged = nil + if picList then + gl.DeleteList(picList) + picList = nil + end + if selectedUnitsCount > 0 then + picList = gl.CreateList(DrawPicList) + end + updateGuishader() end - picList = gl.CreateList(DrawPicList) end + function widget:Initialize() + WG['selunitbuttons'] = {} + WG['selunitbuttons'].getOldUnitIcons = function() + return oldUnitpics + end + WG['selunitbuttons'].setOldUnitIcons = function(value) + oldUnitpics = value + end widget:ViewResize(vsx, vsy) end @@ -220,13 +310,23 @@ function widget:Shutdown() if picList then gl.DeleteList(picList) end + gl.DeleteFont(font) + WG['selunitbuttons'] = nil enabled = false updateGuishader() end +local startFromIcon = 0 function DrawPicList() - unitCounts = spGetSelectedUnitsCounts() - unitTypes = unitCounts.n; + if selectedUnitsCount == 0 then return end + --Spring.Echo(Spring.GetGameFrame()..' '..math.random()) + + unitTypes = selectedUnitsCounts.n; + displayedUnitTypes = unitTypes + if displayedUnitTypes > iconsPerRow then + displayedUnitTypes = iconsPerRow + end + if (unitTypes <= 0) then countsTable = {} activePress = false @@ -235,43 +335,66 @@ function DrawPicList() end local xmid = vsx * 0.5 - local width = math.floor(usedIconSizeX * unitTypes) + local width = math.floor(usedIconSizeX * displayedUnitTypes) rectMinX = math.floor(xmid - (0.5 * width)) rectMaxX = math.floor(xmid + (0.5 * width)) rectMinY = 0 rectMaxY = math.floor(rectMinY + usedIconSizeY) -- draw background bar - local icon = -1 - for udid,count in pairs(unitCounts) do - icon = icon + 1 - end local xmin = math.floor(rectMinX) - local xmax = math.floor(rectMinX + (usedIconSizeX * icon)) + local xmax = math.floor(rectMinX + (usedIconSizeX * displayedUnitTypes)) + + + if unitTypes > 16 then + -- back button + if startFromIcon > 0 then + xmin = xmin - usedIconSizeX + end + -- forward button + if startFromIcon + iconsPerRow < unitTypes then + xmax = xmax + usedIconSizeX + end + end + if ((xmax < 0) or (xmin > vsx)) then return end -- bail - local ymin = rectMinY local ymax = rectMaxY local xmid = (xmin + xmax) * 0.5 local ymid = (ymin + ymax) * 0.5 - + backgroundDimentions = {xmin-iconMargin-0.5, ymin, xmax+iconMargin+0.5, ymax+iconMargin-1} - gl.Color(0,0,0,0.66) - RectRound(backgroundDimentions[1],backgroundDimentions[2],backgroundDimentions[3],backgroundDimentions[4],usedIconSizeX / 7) - local borderPadding = iconMargin - glColor(1,1,1,0.025) - RectRound(backgroundDimentions[1]+borderPadding, backgroundDimentions[2]+borderPadding, backgroundDimentions[3]-borderPadding, backgroundDimentions[4]-borderPadding, usedIconSizeX / 9) + gl.Color(0,0,0,ui_opacity) + RectRound(backgroundDimentions[1],backgroundDimentions[2],backgroundDimentions[3],backgroundDimentions[4],usedIconSizeX / 8) + local borderPadding = iconMargin*1.4 + glColor(1,1,1,ui_opacity*0.055) + RectRound(backgroundDimentions[1]+borderPadding, backgroundDimentions[2]+borderPadding, backgroundDimentions[3]-borderPadding, backgroundDimentions[4]-borderPadding, usedIconSizeX / 14) + + -- back button + if startFromIcon > 0 then + + end + -- forward button + if startFromIcon + iconsPerRow < unitTypes then + + end -- draw the buildpics - unitCounts.n = nil - local row = 0 + local row = 0 local icon = 0 - for udid,count in pairs(unitCounts) do - if icon % iconsPerRow == 0 then - row = row + 1 - end - DrawUnitDefTexture(udid, icon, count, row) - icon = icon + 1 + local displayedIcon = 0 + for udid,count in pairs(selectedUnitsCounts) do + if type(udid) == 'number' then + if icon >= startFromIcon then + --if icon % iconsPerRow == 0 then + -- row = row + 1 + --end + DrawUnitDefTexture(udid, icon, count, row) + displayedIcon = displayedIcon + 1 + if displayedIcon >= iconsPerRow then break end + end + icon = icon + 1 + end end end @@ -279,17 +402,19 @@ end function DrawUnitDefTexture(unitDefID, iconPos, count, row) local usedIconImgMult = iconImgMult local ypad2 = -usedIconSizeY/50 - local color = {1, 1, 1, 0.9} - if mouseIcon ~= -1 then - color = {1, 1, 1, 0.75} - end - if iconPos == mouseIcon then - usedIconImgMult = iconImgMult*1.08 - color = {1, 1, 1, 1} - ypad2 = 0 + local color = {1, 1, 1, 0.9 } + if (not WG['topbar'] or not WG['topbar'].showingQuit()) then + if mouseIcon ~= -1 then + color = {1, 1, 1, 0.7} + end + if iconPos == mouseIcon then + usedIconImgMult = iconImgMult*1.1 + color = {1, 1, 1, 1} + ypad2 = 0 + end end - local yPad = (usedIconSizeY*(1-usedIconImgMult)) / 2 - local xPad = (usedIconSizeX*(1-usedIconImgMult)) / 2 + local yPad = (usedIconSizeY*(1-usedIconImgMult)) / 3 + local xPad = (usedIconSizeX*(1-usedIconImgMult)) / 3 local xmin = math.floor(rectMinX + (usedIconSizeX * iconPos)) + xPad local xmax = xmin + usedIconSizeX - xPad - xPad @@ -309,7 +434,10 @@ function DrawUnitDefTexture(unitDefID, iconPos, count, row) if count > 1 then -- draw the count text local offset = math.ceil((ymax - (ymin+iconMargin+iconMargin)) / 20) - glText(count, xmax-iconMargin-offset, ymin+iconMargin+iconMargin+offset+(fontSize/16)-(yPad/2) , fontSize, "or") + font:Begin() + font:SetTextColor(0.85,0.85,0.85,1) + font:Print(count, xmax-(iconMargin*1.3)-offset, ymin+(iconMargin*2.2)+offset+(fontSize/16)-(yPad/2) , fontSize, "or") + font:End() end end @@ -443,7 +571,9 @@ end ------------------------------------------------------------------------------- + function widget:MouseRelease(x, y, button) + if WG['smartselect'] and not WG['smartselect'].updateSelection then return end if (not activePress) then return -1 end @@ -470,9 +600,9 @@ function widget:MouseRelease(x, y, button) if (unitTable == nil) then return -1 end - + local alt, ctrl, meta, shift = spGetModKeyState() - + if (button == 1) then LeftMouseButton(unitDefID, unitTable) elseif (button == 2) then @@ -506,23 +636,16 @@ end ------------------------------------------------------------------------------- -function widget:IsAbove(x, y) - local icon = MouseOverIcon(x, y) - if (icon < 0) then - return false - end - return true -end +function widget:GetConfigData() + return {oldUnitpics=oldUnitpics} +end -function widget:GetTooltip(x, y) - local ud = currentDef - if (not ud) then - return '' +function widget:SetConfigData(data) --load config + if (data.oldUnitpics ~= nil) then + oldUnitpics = data.oldUnitpics end - return ud.humanName .. ' - ' .. ud.tooltip end - ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gui_selfd_icons.lua b/LuaUI/Widgets_Evo/gui_selfd_icons.lua index 7514369f5..22194d7f0 100644 --- a/LuaUI/Widgets_Evo/gui_selfd_icons.lua +++ b/LuaUI/Widgets_Evo/gui_selfd_icons.lua @@ -5,7 +5,7 @@ function widget:GetInfo() author = "Floris", date = "06.05.2014", license = "GNU GPL, v2 or later", - layer = 5, + layer = -50, enabled = true } end @@ -13,76 +13,67 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local myTeamID = Spring.GetLocalTeamID() - -- preferred to keep these values the same as fancy unit selections widget -local rectangleFactor = 3.3 -local scalefaktor = 2.9 local unitConf = {} - -local font = gl.LoadFont(LUAUI_DIRNAME..'Fonts/FreeSansBold.otf', 50, 4, 3) - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 45 +local fontfileOutlineSize = 4.5 +local fontfileOutlineStrength = 9 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local selfdUnits = {} -local glDrawFuncAtUnit = gl.DrawFuncAtUnit +local drawLists = {} +local glDrawListAtUnit = gl.DrawListAtUnit local spIsGUIHidden = Spring.IsGUIHidden local spGetUnitDefID = Spring.GetUnitDefID local spIsUnitInView = Spring.IsUnitInView local spGetUnitSelfDTime = Spring.GetUnitSelfDTime local spGetAllUnits = Spring.GetAllUnits -local spGetUnitCommands = Spring.GetUnitCommands +local spGetCommandQueue = Spring.GetCommandQueue +local spIsUnitAllied = Spring.IsUnitAllied +local spGetCameraDirection = Spring.GetCameraDirection + +local spec = Spring.GetSpectatingState() -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() -function DrawIcon(posY, posX, iconSize, text) - gl.Texture(':n:'..LUAUI_DIRNAME..'Images/skull.png') - gl.Color(0.9,0.9,0.9,1) - gl.Translate(posX*0.9,posY,posX*1.5) - gl.Billboard() - gl.TexRect(-(iconSize/2), 0, (iconSize/2), iconSize) - if string.len(text) > 0 and text ~= 0 then - font:Begin() - font:SetTextColor({0.88,0.88,0.88,1}) - font:SetOutlineColor({0,0,0,0.6}) - font:Print(text, -16, 1, 12, "con") - font:End() + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) end end - --- add unit-icon to unit -function AddSelfDUnit(unitID) - local ud = UnitDefs[spGetUnitDefID(unitID)] - - givenUnits[unitID] = {} - givenUnits[unitID].osClock = os.clock() - givenUnits[unitID].lastInViewClock = os.clock() - givenUnits[unitID].unitHeight = ud.height +function DrawIcon(text) + local iconSize = 0.9 + gl.PushMatrix() + gl.Texture(':n:LuaUI/Images/skull.dds') + gl.Translate(0.32,1,1.4) + gl.Billboard() + gl.TexRect(-(iconSize+0.085), 0, -0.08, iconSize) + font:Begin() + font:Print(text,0,(iconSize/4),0.66,"oc") + font:End() + gl.PopMatrix() end + function SetUnitConf() for udid, unitDef in pairs(UnitDefs) do local xsize, zsize = unitDef.xsize, unitDef.zsize - local scale = scalefaktor*( xsize^2 + zsize^2 )^0.5 - local shape, xscale, zscale - - if (unitDef.isBuilding or unitDef.isFactory or unitDef.speed==0) then - shape = 'square' - xscale, zscale = rectangleFactor * xsize, rectangleFactor * zsize - elseif (unitDef.isAirUnit) then - shape = 'triangle' - xscale, zscale = scale, scale - else - shape = 'circle' - xscale, zscale = scale, scale - end - unitConf[udid] = {shape=shape, xscale=xscale, zscale=zscale} + local scale = 6*( xsize^2 + zsize^2 )^0.5 + unitConf[udid] = 7 +(scale/2.5) end end @@ -90,18 +81,18 @@ end -- Engine Calls -------------------------------------------------------------------------------- -function widget:Initialize() - SetUnitConf() - +function init() + spec = Spring.GetSpectatingState() -- check all units for selfd cmd + selfdUnits = {} local units = spGetAllUnits() for _, unitID in ipairs(units) do - if spGetUnitSelfDTime(unitID) ~= nil then + if spGetUnitSelfDTime(unitID) ~= nil then if spGetUnitSelfDTime(unitID) > 0 then selfdUnits[unitID] = true end -- check for queued selfd - local unitQueue = spGetUnitCommands(unitID,20) or {} + local unitQueue = spGetCommandQueue(unitID,20) or {} if (#unitQueue > 0) then for _,cmd in ipairs(unitQueue) do if cmd.id == CMD.SELFD then @@ -113,29 +104,74 @@ function widget:Initialize() end end +function widget:PlayerChanged(playerID) + init() +end + +function widget:Initialize() + SetUnitConf() + init() +end + + +function widget:Shutdown() + for k,_ in pairs(drawLists) do + gl.DeleteList(drawLists[k]) + end + gl.DeleteFont(font) +end + + +local sec = 0 +local prevCam = {spGetCameraDirection()} +function widget:Update(dt) + sec = sec + dt + if sec > 0.15 then + sec = 0 + local camX, camY, camZ = spGetCameraDirection() + if camX ~= prevCam[1] or camY ~= prevCam[2] or camZ ~= prevCam[3] then + for k,_ in pairs(drawLists) do + gl.DeleteList(drawLists[k]) + drawLists[k] = nil + end + end + prevCam = {camX,camY,camZ} + end +end -- draw icons +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorld() + if chobbyInterface then return end if spIsGUIHidden() then return end - local gameSecs = Spring.GetGameSeconds() - - gl.DepthMask(true) + gl.DepthTest(true) - - for unitID, unitEndSecs in pairs(selfdUnits) do - if spIsUnitInView(unitID) then - - local unitDefs = unitConf[spGetUnitDefID(unitID)] - local unitScale = unitDefs.xscale*1.22 - (unitDefs.xscale/6.6) - local countdown = math.ceil(spGetUnitSelfDTime(unitID) / 2) - glDrawFuncAtUnit(unitID, false, DrawIcon, 10.1, unitScale, 18, countdown) + gl.Color(0.9,0.9,0.9,1) + + local unitScale, countdown + for unitID, unitDefID in pairs(selfdUnits) do + if spIsUnitAllied(unitID) or spec then + if spIsUnitInView(unitID) then + unitScale = unitConf[unitDefID] + countdown = math.ceil(spGetUnitSelfDTime(unitID) / 2) + if not drawLists[countdown] then + drawLists[countdown] = gl.CreateList(DrawIcon, countdown) + end + glDrawListAtUnit(unitID, drawLists[countdown], false, unitScale,unitScale,unitScale) + end + else + selfdUnits[unitID] = nil end end - + gl.Color(1,1,1,1) gl.Texture(false) gl.DepthTest(false) - gl.DepthMask(false) end @@ -144,7 +180,7 @@ function widget:UnitCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpti -- check for queued selfd (to check if queue gets cancelled) if selfdUnits[unitID] then local foundSelfdCmd = false - local unitQueue = spGetUnitCommands(unitID,20) or {} + local unitQueue = spGetCommandQueue(unitID,20) or {} if (#unitQueue > 0) then for _,cmd in ipairs(unitQueue) do if cmd.id == CMD.SELFD then @@ -162,7 +198,7 @@ function widget:UnitCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpti if spGetUnitSelfDTime(unitID) > 0 then -- since cmd hasnt been cancelled yet selfdUnits[unitID] = nil else - selfdUnits[unitID] = true + selfdUnits[unitID] = spGetUnitDefID(unitID) end end end diff --git a/LuaUI/Widgets_Evo/gui_smoothcam.lua b/LuaUI/Widgets_Evo/gui_smoothcam.lua deleted file mode 100644 index f0d171c78..000000000 --- a/LuaUI/Widgets_Evo/gui_smoothcam.lua +++ /dev/null @@ -1,30 +0,0 @@ -local versionNumber = "0.5" - -function widget:GetInfo() - return { - name = "SmoothCam", - desc = "[v" .. string.format("%s", versionNumber ) .. "] Moves camera smoothly", - author = "very_bad_soldier", - date = "August, 8, 2010", - license = "GNU GPL, v2 or later", - layer = 0, - handler = true, - enabled = true, - } -end - - --------------------------------------------------------------------------------- -----------------------------Configuration--------------------------------------- -local camSpeed = 0.35 --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -local spGetCameraState = Spring.GetCameraState -local spSetCameraState = Spring.SetCameraState --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -function widget:Update(dt) - local cs = spGetCameraState() - spSetCameraState(cs, camSpeed) -end - diff --git a/LuaUI/Widgets_Evo/gui_spectate_selected.lua b/LuaUI/Widgets_Evo/gui_spectate_selected.lua index e4df2cc88..f37636819 100644 --- a/LuaUI/Widgets_Evo/gui_spectate_selected.lua +++ b/LuaUI/Widgets_Evo/gui_spectate_selected.lua @@ -23,7 +23,7 @@ function widget:CommandsChanged() local selUnits = spGetSelectedUnits() if #selUnits > 0 then local selTeam = spGetUnitTeam(selUnits[1]) - if selTeam ~= spGetMyTeamID() then + if selTeam and selTeam ~= spGetMyTeamID() then spSendCommands('specteam ' .. selTeam) end end diff --git a/LuaUI/Widgets_Evo/gui_startradius.lua b/LuaUI/Widgets_Evo/gui_startradius.lua index f4ba2e291..adf2aa91c 100644 --- a/LuaUI/Widgets_Evo/gui_startradius.lua +++ b/LuaUI/Widgets_Evo/gui_startradius.lua @@ -79,13 +79,13 @@ local function DrawPoints() if (sx == sxin and sy == syin and sz == szin) then - DrawGroundCircle(sx, sy, sz, 1000, 128) + DrawGroundCircle(sx, sy, sz, 350, 128) count = count + 1 else - DrawGroundCircle(sx, sy, sz, 1000, 128) + DrawGroundCircle(sx, sy, sz, 350, 128) end diff --git a/LuaUI/Widgets_Evo/gui_tooltip.lua b/LuaUI/Widgets_Evo/gui_tooltip.lua index 1c7c92dad..ecca9325b 100644 --- a/LuaUI/Widgets_Evo/gui_tooltip.lua +++ b/LuaUI/Widgets_Evo/gui_tooltip.lua @@ -2,11 +2,11 @@ function widget:GetInfo() return { name = "Tooltip", - desc = "Shows detailed unit stats", + desc = "Shows tooltips", author = "Floris", date = "April 2017", license = "GNU GPL, v2 or later", - layer = -math.huge, + layer = -9999999999, enabled = true, -- loaded by default? } end @@ -33,9 +33,17 @@ Use 'ShowTooltip' to directly show a tooltip, the name you give should be unique ------------------------------------------------------------------------------------ local defaultDelay = 0.4 -local usedFontSize = 13 -local xOffset = 32 -local yOffset = -32-usedFontSize +local usedFontSize = 15 +local xOffset = 35 +local yOffset = -35-usedFontSize + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 4.5 +local fontfileOutlineStrength = 1.8 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) ------------------------------------------------------------------------------------ -- Speedups @@ -81,9 +89,10 @@ function widget:Initialize() end function widget:Shutdown() - if (WG['guishader_api'] ~= nil) then + gl.DeleteFont(font) + if WG['guishader'] then for name, tooltip in pairs(tooltips) do - WG['guishader_api'].RemoveRect('tooltip_'..name) + WG['guishader'].DeleteScreenDlist('tooltip_'..name) end end WG['tooltip'] = nil @@ -98,7 +107,11 @@ function init() WG['tooltip'].AddTooltip = function(name, area, value, delay) if (value ~= nil and area[1]~=nil and area[2]~=nil and area[3]~=nil and area[4]~=nil) or tooltips[name] ~= nil and tooltips[name].value ~= nil then if delay == nil then delay = defaultDelay end - tooltips[name] = {area=area, delay=delay} + if tooltips[name] == nil then + tooltips[name] = {} + end + tooltips[name].area = area + tooltips[name].delay = delay if value ~= nil then tooltips[name].value = tostring(value) end @@ -122,6 +135,14 @@ end function widget:ViewResize(x,y) + vsx,vsy = Spring.GetViewGeometry() + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + init() end @@ -133,11 +154,12 @@ end function lines(str) local t = {} - local function helper(line) table.insert(t, line) return "" end + local function helper(line) t[#t+1]=line return "" end helper((str:gsub("(.-)\r?\n", helper))) return t end + function drawTooltip(name, x, y) --Spring.Echo('Showing tooltip: '..name) @@ -145,7 +167,7 @@ function drawTooltip(name, x, y) local paddingW = paddingH * 1.33 local posX = x + paddingW local posY = y + paddingH - + local fontSize = usedFontSize*widgetScale local maxWidth = 0 local maxHeight = 0 @@ -154,12 +176,12 @@ function drawTooltip(name, x, y) -- get text dimentions for i, line in ipairs(lines) do - maxWidth = math.max(maxWidth, (gl.GetTextWidth(line)*fontSize), maxWidth) + maxWidth = math.max(maxWidth, (font:GetTextWidth(line)*fontSize), maxWidth) maxHeight = maxHeight + lineHeight end -- adjust position when needed if posX+maxWidth+paddingW+paddingW > vsx then - posX = posX - maxWidth - paddingW - paddingW - (xOffset*widgetScale) + posX = posX - maxWidth - paddingW - paddingW - (xOffset*widgetScale*2) end if posX - paddingW < 0 then posX = 0 + paddingW @@ -173,35 +195,52 @@ function drawTooltip(name, x, y) -- draw background local cornersize = 0 - glColor(0.8,0.8,0.8,0.8) + glColor(0.85,0.85,0.85,(WG['guishader'] and 0.66 or 0.8)) RectRound(posX-paddingW+cornersize, posY-maxHeight-paddingH+cornersize, posX+maxWidth+paddingW-cornersize, posY+paddingH-cornersize, 5*widgetScale) - cornersize = 1.75*widgetScale - glColor(0,0,0,0.3) - RectRound(posX-paddingW+cornersize, posY-maxHeight-paddingH+cornersize, posX+maxWidth+paddingW-cornersize, posY+paddingH-cornersize-0.06, 4*widgetScale) - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].InsertRect(posX-paddingW-cornersize, posY-maxHeight-paddingH-cornersize, posX+maxWidth+paddingW+cornersize, posY+paddingH+cornersize, 'tooltip_'..name) + if WG['guishader'] then + WG['guishader'].InsertScreenDlist( gl.CreateList( function() + RectRound(posX-paddingW+cornersize, posY-maxHeight-paddingH+cornersize, posX+maxWidth+paddingW-cornersize, posY+paddingH-cornersize, 5*widgetScale) + end), 'tooltip_'..name) end + cornersize = 2.25*widgetScale + glColor(0,0,0,(WG['guishader'] and 0.22 or 0.3)) + RectRound(posX-paddingW+cornersize, + posY-maxHeight-paddingH+cornersize, + posX+maxWidth+paddingW-cornersize, + posY+paddingH-cornersize-0.06, 4.3*widgetScale) -- draw text maxHeight = -fontSize*0.93 glTranslate(posX, posY, 0) - gl.BeginText() + font:Begin() + --font:SetTextColor(0.95,0.95,0.95,1) + --font:SetOutlineColor(0.3,0.3,0.3,0.3) for i, line in ipairs(lines) do - glText('\255\244\244\244'..line, 0, maxHeight, fontSize, "o") + font:Print('\255\244\244\244'..line, 0, maxHeight, fontSize, "o") maxHeight = maxHeight - lineHeight end - gl.EndText() + font:End() glTranslate(-posX, -posY, 0) end local cleanupGuishaderAreas = {} +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end + if (WG['topbar'] and WG['topbar'].showingQuit()) then + return + end local x, y = spGetMouseState() local now = os.clock() - if (WG['guishader_api'] ~= nil) then + if WG['guishader'] then for name, _ in pairs(cleanupGuishaderAreas) do - WG['guishader_api'].RemoveRect(name) + WG['guishader'].DeleteScreenDlist(name) cleanupGuishaderAreas[name] = nil end end @@ -229,8 +268,8 @@ function widget:DrawScreen() else if tooltip.displayTime ~= nil then tooltip.displayTime = nil - if (WG['guishader_api'] ~= nil) and not show then - WG['guishader_api'].RemoveRect('tooltip_'..name) + if WG['guishader'] then + WG['guishader'].DeleteScreenDlist('tooltip_'..name) end end end diff --git a/LuaUI/Widgets_Evo/gui_top_bar.lua b/LuaUI/Widgets_Evo/gui_top_bar.lua new file mode 100644 index 000000000..a54709d48 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_top_bar.lua @@ -0,0 +1,1888 @@ +function widget:GetInfo() + return { + name = "Top Bar", + desc = "Shows Resources, wind speed, commander counter, and various options.", + author = "Floris", + date = "Feb, 2017", + license = "GNU GPL, v2 or later", + layer = -9999999, + enabled = true, --enabled by default + handler = true, --can use widgetHandler:x() + } +end + +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.33 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +local height = 38 +local relXpos = 0.3 +local borderPadding = 5 +local showConversionSlider = true +local bladeSpeedMultiplier = 0.2 +local bladeSpeedMultiplier = 0.22 + +--local armcomDefID = UnitDefNames.armcom.id +--local corcomDefID = UnitDefNames.corcom.id + +local playSounds = true +local leftclick = 'LuaUI/Sounds/tock.wav' +local resourceclick = 'LuaUI/Sounds/buildbar_click.wav' +local middleclick = 'LuaUI/Sounds/buildbar_click.wav' +local rightclick = 'LuaUI/Sounds/buildbar_rem.wav' + +local bgcorner = "LuaUI/Images/bgcorner.png" +local barbg = ":n:LuaUI/Images/resbar.dds" +local barGlowCenterTexture = ":n:LuaUI/Images/barglow-center.png" +local barGlowEdgeTexture = ":n:LuaUI/Images/barglow-edge.png" +local bladesTexture = ":c:LuaUI/Images/blades.png" +local poleTexture = "LuaUI/Images/pole.png" +local comTexture = "LuaUI/Images/comIcon.png" +local glowTexture = "LuaUI/Images/glow.dds" + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (0.80 + (vsx*vsy / 6000000)) +local xPos = vsx*relXpos +local currentWind = 0 +local currentMetalmaker = '' +local gameStarted = false +local displayComCounter = false + +local glTranslate = gl.Translate +local glColor = gl.Color +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glTexture = gl.Texture +local glRect = gl.Rect +local glTexRect = gl.TexRect +local glText = gl.Text +local glRotate = gl.Rotate +local glCreateList = gl.CreateList +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList + +local spGetSpectatingState = Spring.GetSpectatingState +local spGetTeamResources = Spring.GetTeamResources +local spGetMyTeamID = Spring.GetMyTeamID +local sformat = string.format +local spGetMouseState = Spring.GetMouseState + +local spec = spGetSpectatingState() +local myAllyTeamID = Spring.GetMyAllyTeamID() +local myTeamID = Spring.GetMyTeamID() +local myPlayerID = Spring.GetMyPlayerID() +local isReplay = Spring.IsReplay() + +local spWind = Spring.GetWind +local minWind = Game.windMin +local maxWind = Game.windMax +local windRotation = 0 + +local startComs = 0 +local lastFrame = -1 +local gameFrame = 0 +local topbarArea = {} +local barContentArea = {} +local resbarArea = {metal={}, energy={}} +local resbarDrawinfo = {metal={}, energy={}} +local shareIndicatorArea = {metal={}, energy={}} +local dlistResbar = {metal={}, energy={}} +local energyconvArea = {} +local windArea = {} +local comsArea = {} +local metalmakerArea = {} +local rejoinArea = {} +local buttonsArea = {} +local dlistWindText = {} +local dlistResValues = {metal={},energy={}} +local currentResCap = {metal=1000,energy=1000} +local currentResValue = {metal=1000,energy=1000 } + +local r = {} +r['metal'] = {spGetTeamResources(spGetMyTeamID(),'metal') } +r['energy'] = {spGetTeamResources(spGetMyTeamID(),'energy') } + +local showOverflowTooltip = {} + +local allyComs = 0 +local enemyComs = 0 -- if we are counting ourselves because we are a spec +local enemyComCount = 0 -- if we are receiving a count from the gadget part (needs modoption on) +local prevEnemyComCount = 0 +local receiveCount = (tostring(Spring.GetModOptions().mo_enemycomcount) == "1") or false + +local guishaderEnabled = false +local guishaderCheckUpdateRate = 2 +local nextGuishaderCheck = guishaderCheckUpdateRate +local now = os.clock() +local gameFrame = Spring.GetGameFrame() + +local draggingShareIndicatorValue = {} + +local chobbyLoaded = false +if Spring.GetMenuName and string.find(string.lower(Spring.GetMenuName()), 'chobby') ~= nil then + chobbyLoaded = true + Spring.SendLuaMenuMsg("disableLobbyButton") +end +-------------------------------------------------------------------------------- +-- Rejoin +-------------------------------------------------------------------------------- +local serverFrameRate = 30 --//constant: assume server run at x1.0 gamespeed. +local oneSecondElapsed = 0 --//variable: a timer for 1 second, used in Update(). Update UI every 1 second. +local showRejoinUI = false --//variable:indicate whether UI is shown or hidden. +local averageLocalSpeed = {sumOfSpeed= 0, sumCounter= 0} --//variable: store the local-gameFrame speeds so that an average can be calculated. +local defaultAverage = 30 --//constant: Initial/Default average is set at 30gfps (x1.0 gameSpeed) +local simpleMovingAverageLocalSpeed = {storage={},index = 1, runningAverage=defaultAverage} --//variable: for calculating rolling average. Initial/Default average is set at 30gfps (x1.0 gameSpeed) + +--Variable for fixing GameProgress delay at rejoin------------------------------ +local myTimestamp = 0 --//variable: store my own timestamp at GameStart +local submittedTimestamp = {} --//variable: store all timestamp at GameStart submitted by original players (assuming we are rejoining) +local functionContainer = function(x) end --//variable object: store a function +local gameProgressActive = false --//variable: signal whether GameProgress has been updated. + +local serverFrameNum1 = 0 +local serverFrameNum2 = 0 +local myLastFrameNum = 0 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function isInBox(mx, my, box) + return mx > box[1] and my > box[2] and mx < box[3] and my < box[4] +end + +function widget:ViewResize(n_vsx,n_vsy) + vsx, vsy = gl.GetViewSizes() + widgetScale = (vsy / height) * 0.043 -- using 734 because redui-console uses this value too + xPos = vsx*relXpos + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end + + for n,_ in pairs(dlistWindText) do + glDeleteList(dlistWindText[n]) + end + dlistWindText = {} + for n,_ in pairs(dlistResValues['metal']) do + glDeleteList(dlistResValues['metal'][n]) + end + dlistResValues['metal'] = {} + for n,_ in pairs(dlistResValues['energy']) do + glDeleteList(dlistResValues['energy'][n]) + end + dlistResValues['energy'] = {} + + init() +end + +local function DrawRectRound(px,py,sx,sy,cs, tl,tr,br,bl) + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.07 -- texture offset, because else gaps could show + + -- bottom left + if ((py <= 0 or px <= 0) or (bl ~= nil and bl == 0)) and bl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- bottom right + if ((py <= 0 or sx >= vsx) or (br ~= nil and br == 0)) and br ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- top left + if ((sy >= vsy or px <= 0) or (tl ~= nil and tl == 0)) and tl ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- top right + if ((sy >= vsy or sx >= vsx) or (tr ~= nil and tr == 0)) and tr ~= 2 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end +function RectRound(px,py,sx,sy,cs, tl,tr,br,bl) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) + gl.Texture(false) +end + + +local function short(n,f) + if (f == nil) then + f = 0 + end + if (n > 9999999) then + return sformat("%."..f.."fm",n/1000000) + elseif (n > 9999) then + return sformat("%."..f.."fk",n/1000) + else + return sformat("%."..f.."f",n) + end +end + + +local function updateRejoin() + local area = rejoinArea + local catchup = gameFrame / serverFrameNum1 + + if serverFrameNum1 - gameFrame < 20 then + showRejoinUI = false + end + + if dlistRejoin ~= nil then + glDeleteList(dlistRejoin) + end + dlistRejoin = glCreateList( function() + + -- background + glColor(0,0,0,ui_opacity) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + local bgpadding = 3*widgetScale + glColor(1,1,1,0.055*ui_opacity) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3]-bgpadding, area[4], 5*widgetScale) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(area[1], area[2], area[3], area[4], 'topbar_rejoin') + end + + local barHeight = (height*widgetScale/10) + local barHeighPadding = 7*widgetScale --((height/2) * widgetScale) - (barHeight/2) + local barLeftPadding = 7* widgetScale + local barRightPadding = 7 * widgetScale + local barArea = {area[1]+barLeftPadding, area[2]+barHeighPadding, area[3]-barRightPadding, area[2]+barHeight+barHeighPadding} + local barWidth = barArea[3] - barArea[1] + + glColor(0.0,0.5,0,0.33) + glTexture(barbg) + glTexRect(barArea[1], barArea[2], barArea[3], barArea[4]) + + -- Bar value + glColor(0, 1, 0, 1) + glTexture(barbg) + glTexRect(barArea[1], barArea[2], barArea[1]+(catchup * barWidth), barArea[4]) + + -- Bar value glow + local glowSize = barHeight * 6 + glColor(0, 1, 0, 0.09) + glTexture(barGlowCenterTexture) + glTexRect(barArea[1], barArea[2] - glowSize, barArea[1]+(catchup * barWidth), barArea[4] + glowSize) + glTexture(barGlowEdgeTexture) + glTexRect(barArea[1]-(glowSize*2), barArea[2] - glowSize, barArea[1], barArea[4] + glowSize) + glTexRect((barArea[1]+(catchup * barWidth))+(glowSize*2), barArea[2] - glowSize, barArea[1]+(catchup * barWidth), barArea[4] + glowSize) + + -- Text + local fontsize = 12*widgetScale + glText('\255\225\255\225Catching up', area[1]+((area[3]-area[1])/2), area[2]+barHeight*2+fontsize, fontsize, 'cor') + + end) + if WG['tooltip'] ~= nil then + WG['tooltip'].AddTooltip('rejoin', area, "Displays the catchup progress") + end +end + + +local function updateButtons() + local area = buttonsArea + + local totalWidth = area[3] - area[1] + + local text = ' ' + if (WG['teamstats'] ~= nil) then text = text..'Stats ' end + if (WG['commands'] ~= nil) then text = text..'Cmd ' end + if (WG['keybinds'] ~= nil) then text = text..'Keys ' end + if (WG['changelog'] ~= nil) then text = text..'Changes ' end + if (WG['options'] ~= nil) then text = text..'Settings ' end + if chobbyLoaded then + text = text..'Lobby ' + else + text = text..'Quit ' + end + + local fontsize = totalWidth / font2:GetTextWidth(text) + if fontsize > (height*widgetScale)/3 then + fontsize = (height*widgetScale)/3 + end + + + -- add background blur + if dlistButtonsGuishader ~= nil then + if WG['guishader'] then + WG['guishader'].RemoveDlist('topbar_buttons') + end + glDeleteList(dlistButtonsGuishader) + end + dlistButtonsGuishader = glCreateList( function() + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + end) + + + if dlistButtons1 ~= nil then + glDeleteList(dlistButtons1) + end + dlistButtons1 = glCreateList( function() + + -- background + glColor(0,0,0,ui_opacity) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + local bgpadding = 3*widgetScale + glColor(1,1,1,ui_opacity*0.055) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3], area[4], bgpadding*1.25) + + if WG['guishader'] then + WG['guishader'].InsertDlist(dlistButtonsGuishader, 'topbar_buttons') + end + + if buttonsArea['buttons'] == nil then + buttonsArea['buttons'] = {} + + local margin = height*widgetScale / 11 + local offset = margin + local width = 0 + local buttons = 0 + + if (WG['teamstats'] ~= nil) then + buttons = buttons + 1 + if buttons > 1 then offset = offset+width end + width = font2:GetTextWidth(' Stats ') * fontsize + (buttons == 1 and 20 or 0) + buttonsArea['buttons']['stats'] = {area[1]+offset, area[2]+margin, area[1]+offset+width, area[4] } + end + if (WG['commands'] ~= nil) then + buttons = buttons + 1 + if buttons > 1 then offset = offset+width end + width = font2:GetTextWidth(' Cmd ') * fontsize + (buttons == 1 and 20 or 0) + buttonsArea['buttons']['commands'] = {area[1]+offset, area[2]+margin, area[1]+offset+width, area[4]} + end + if (WG['keybinds'] ~= nil) then + buttons = buttons + 1 + if buttons > 1 then offset = offset+width end + width = font2:GetTextWidth(' Keys ') * fontsize + (buttons == 1 and 20 or 0) + buttonsArea['buttons']['keybinds'] = {area[1]+offset, area[2]+margin, area[1]+offset+width, area[4]} + end + if (WG['changelog'] ~= nil) then + button = buttons + 1 + if buttons > 1 then offset = offset+width end + width = font2:GetTextWidth(' Changes ') * fontsize + (buttons == 1 and 20 or 0) + buttonsArea['buttons']['changelog'] = {area[1]+offset, area[2]+margin, area[1]+offset+width, area[4]} + end + if (WG['options'] ~= nil) then + buttons = buttons + 1 + if buttons > 1 then offset = offset+width end + width = font2:GetTextWidth(' Settings ') * fontsize + buttonsArea['buttons']['options'] = {area[1]+offset, area[2]+margin, area[1]+offset+width, area[4]} + end + if chobbyLoaded then + offset = offset+width + width = font2:GetTextWidth(' Lobby ') * fontsize + buttonsArea['buttons']['quit'] = {area[1]+offset, area[2]+margin, area[3], area[4]} + else + offset = offset+width + width = font2:GetTextWidth(' Quit ') * fontsize + buttonsArea['buttons']['quit'] = {area[1]+offset, area[2]+margin, area[3], area[4]} + end + end + end) + + if dlistButtons2 ~= nil then + glDeleteList(dlistButtons2) + end + dlistButtons2 = glCreateList( function() + font2:Begin() + font2:Print('\255\210\210\210'..text, area[1], area[2]+((area[4]-area[2])/2)-(fontsize/5), fontsize, 'o') + font2:End() + end) +end + + +local function updateMetalmaker() + local area = metalmakerArea + + if dlistMetalmaker1 ~= nil then + glDeleteList(dlistMetalmaker1) + end + dlistMetalmaker1 = glCreateList( function() + + -- background + glColor(0,0,0,0.7) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + local bgpadding = 3*widgetScale + glColor(1,1,1,0.03) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3]-bgpadding, area[4], 5*widgetScale) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(area[1], area[2], area[3], area[4], 'topbar_metalmaker') + end + end) + + if dlistMetalmaker2 ~= nil then + glDeleteList(dlistMetalmaker2) + end + dlistMetalmaker2 = glCreateList( function() + -- icon + local sizeHalf = (height/2.75)*widgetScale + --glTexture(comTexture) + --glTexRect(area[1]+((area[3]-area[1])/2)-sizeHalf, area[2]+((area[4]-area[2])/2)-sizeHalf, area[1]+((area[3]-area[1])/2)+sizeHalf, area[2]+((area[4]-area[2])/2)+sizeHalf) + --glTexture(false) + + -- Text + --local fontSize = (height/2.66)*widgetScale + --glText("\255\200\200\200"..currentMetalmaker, area[1]+((area[3]-area[1])/2), area[2]+((area[4]-area[2])/2.05)-(fontSize/5), fontSize, 'oc') + end) +end + + +local function updateComs(forceText) + local area = comsArea + + if dlistComs1 ~= nil then + glDeleteList(dlistComs1) + end + dlistComs1 = glCreateList( function() + + -- background + glColor(0,0,0,0.7) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + local bgpadding = 3*widgetScale + glColor(1,1,1,0.03) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3]-bgpadding, area[4], 5*widgetScale) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(area[1], area[2], area[3], area[4], 'topbar_coms') + end + end) + + if dlistComs2 ~= nil then + glDeleteList(dlistComs2) + end + dlistComs2 = glCreateList( function() + -- Commander icon + local sizeHalf = (height/2.75)*widgetScale + + glTexture(comTexture) + glTexRect(area[1]+((area[3]-area[1])/2)-sizeHalf, area[2]+((area[4]-area[2])/2)-sizeHalf, area[1]+((area[3]-area[1])/2)+sizeHalf, area[2]+((area[4]-area[2])/2)+sizeHalf) + glTexture(false) + + -- Text + if gameFrame > 0 or forceText then + local fontsize = (height/2.85)*widgetScale + local usedEnemyComs = enemyComs + if spec then + usedEnemyComs = enemyComs + elseif receiveCount then + usedEnemyComs = enemyComCount + else + usedEnemyComs = '?' -- dunno why it was set as 2 here before + end + glText('\255\255\000\000'..usedEnemyComs, area[3]-(2.8*widgetScale), area[2]+(4.5*widgetScale), fontsize, 'or') + + fontSize = (height/2.15)*widgetScale + glText("\255\000\255\000"..allyComs, area[1]+((area[3]-area[1])/2), area[2]+((area[4]-area[2])/2.05)-(fontSize/5), fontSize, 'oc') + end + end) + comcountChanged = nil + + if WG['tooltip'] ~= nil then + WG['tooltip'].AddTooltip('coms', area, "\255\215\255\215Commander Counter\n\255\240\240\240Displays the number of ally\nand enemy commanders") + end +end + + +local function updateWind() + local area = windArea + + local xPos = area[1] + local yPos = area[2] + ((area[4] - area[2])/3.5) + local oorx = 10*widgetScale + local oory = 13*widgetScale + + local bgpadding = 3*widgetScale + + local poleWidth = 6 * widgetScale + local poleHeight = 14 * widgetScale + + if dlistWind1 ~= nil then + glDeleteList(dlistWind1) + end + dlistWind1 = glCreateList( function() + + -- background + glColor(0,0,0,0.7) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + glColor(1,1,1,0.03) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3]-bgpadding, area[4], 5*widgetScale) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(area[1], area[2], area[3], area[4], 'topbar_wind') + end + + glPushMatrix() + glTranslate(xPos, yPos, 0) + glTranslate(11*widgetScale, -((height*widgetScale)/4.4), 0) -- Spacing of icon + glPushMatrix() -- Blades + glTranslate(1*widgetScale, 9*widgetScale, 0) + glTranslate(oorx, oory, 0) + end) + + if dlistWind2 ~= nil then + glDeleteList(dlistWind2) + end + dlistWind2 = glCreateList( function() + glTranslate(-oorx, -oory, 0) + glColor(1,1,1,0.3) + glTexture(bladesTexture) + glTexRect(0, 0, 27*widgetScale, 28*widgetScale) + glTexture(false) + glPopMatrix() + + x,y = 9*widgetScale, 2*widgetScale -- Pole + glTexture(poleTexture) + glTexRect(x, y, (7*widgetScale)+x, y+(18*widgetScale)) + glTexture(false) + glPopMatrix() + + -- min and max wind + local fontsize = (height/3.7)*widgetScale + glText("\255\130\130\130"..minWind, area[3]-(2.8*widgetScale), area[4]-(4.5*widgetScale)-(fontsize/2), fontsize, 'or') + glText("\255\130\130\130"..maxWind, area[3]-(2.8*widgetScale), area[2]+(4.5*widgetScale), fontsize, 'or') + glText("\255\130\130\130"..maxWind, area[3]-(2.8*widgetScale), area[2]+(4.5*widgetScale), fontsize, 'or') + + end) + + if WG['tooltip'] ~= nil then + WG['tooltip'].AddTooltip('wind', area, "\255\215\255\215Wind Display\n\255\240\240\240Displays current wind strength\n\255\240\240\240also minimum ("..minWind..") and maximum ("..maxWind.."\n\255\255\215\215Rather build solars when average\n\255\255\215\215wind is below 5 (arm) or 6 (core)") + end +end + + +local function updateResbarText(res) + if dlistResbar[res][3] ~= nil then + glDeleteList(dlistResbar[res][3]) + end + dlistResbar[res][3] = glCreateList( function() + -- Text: storage + glText("\255\150\150\150"..short(r[res][2]), resbarDrawinfo[res].textStorage[2], resbarDrawinfo[res].textStorage[3], resbarDrawinfo[res].textStorage[4], resbarDrawinfo[res].textStorage[5]) + -- Text: pull + glText("\255\210\100\100"..short(r[res][3]), resbarDrawinfo[res].textPull[2], resbarDrawinfo[res].textPull[3], resbarDrawinfo[res].textPull[4], resbarDrawinfo[res].textPull[5]) + -- Text: income + glText("\255\100\210\100"..short(r[res][4]), resbarDrawinfo[res].textIncome[2], resbarDrawinfo[res].textIncome[3], resbarDrawinfo[res].textIncome[4], resbarDrawinfo[res].textIncome[5]) + + -- display overflow notification + if not spec and r[res][1] >= r[res][2] and gameFrame > 90 then + if showOverflowTooltip[res] == nil then + showOverflowTooltip[res] = os.clock() + 1.5 + end + if showOverflowTooltip[res] < os.clock() then + local bgpadding = 2*widgetScale + local text = 'Overflowing' + local textWidth = (bgpadding*2) + 15 + (glGetTextWidth(text) * 10) * widgetScale + + -- background + glColor(0.3,0,0,0.55) + RectRound(resbarArea[res][3]-textWidth, resbarArea[res][4]-15.5*widgetScale, resbarArea[res][3], resbarArea[res][4], 4*widgetScale) + glColor(1,0.3,0.3,0.2) + RectRound(resbarArea[res][3]-textWidth+bgpadding, resbarArea[res][4]-15.5*widgetScale+bgpadding, resbarArea[res][3]-bgpadding, resbarArea[res][4]-bgpadding, 3*widgetScale) + + glText("\255\255\222\222"..text, resbarArea[res][3]-5*widgetScale, resbarArea[res][4]-10.5*widgetScale, 10*widgetScale, 'or') + end + else + showOverflowTooltip[res] = nil + end + end) +end + + +local function updateResbar(res) + local area = resbarArea[res] + + if dlistResbar[res][1] ~= nil then + glDeleteList(dlistResbar[res][1]) + glDeleteList(dlistResbar[res][2]) + end + local barHeight = (height*widgetScale/10) + local barHeighPadding = 7*widgetScale --((height/2) * widgetScale) - (barHeight/2) + --local barLeftPadding = 2 * widgetScale + local barLeftPadding = 33 * widgetScale + local barRightPadding = 7 * widgetScale + local barArea = {area[1]+(height*widgetScale)+barLeftPadding, area[2]+barHeighPadding, area[3]-barRightPadding, area[2]+barHeight+barHeighPadding} + local sliderHeightAdd = barHeight / 3.5 + local shareSliderWidth = barHeight + sliderHeightAdd + sliderHeightAdd + local barWidth = barArea[3] - barArea[1] + local glowSize = barHeight * 6 + + if resbarHover ~= nil and resbarHover == res then + sliderHeightAdd = barHeight/1.15 + shareSliderWidth = barHeight + sliderHeightAdd + sliderHeightAdd + end + + if res == 'metal' then + resbarDrawinfo[res].barColor = {1,1,1,1} + else + resbarDrawinfo[res].barColor = {1,1,0,1} + end + resbarDrawinfo[res].barArea = barArea + + resbarDrawinfo[res].barTexRect = {barArea[1], barArea[2], barArea[1]+((r[res][1]/r[res][2]) * barWidth), barArea[4]} + resbarDrawinfo[res].barGlowMiddleTexRect = {resbarDrawinfo[res].barTexRect[1], resbarDrawinfo[res].barTexRect[2] - glowSize, resbarDrawinfo[res].barTexRect[3], resbarDrawinfo[res].barTexRect[4] + glowSize} + resbarDrawinfo[res].barGlowLeftTexRect = {resbarDrawinfo[res].barTexRect[1]-(glowSize*2), resbarDrawinfo[res].barTexRect[2] - glowSize, resbarDrawinfo[res].barTexRect[1], resbarDrawinfo[res].barTexRect[4] + glowSize} + resbarDrawinfo[res].barGlowRightTexRect = {resbarDrawinfo[res].barTexRect[3]+(glowSize*2), resbarDrawinfo[res].barTexRect[2] - glowSize, resbarDrawinfo[res].barTexRect[3], resbarDrawinfo[res].barTexRect[4] + glowSize} + + resbarDrawinfo[res].textCurrent = {short(r[res][1]), barArea[1]+barWidth/2, barArea[2]+barHeight*2, (height/2.75)*widgetScale, 'ocd'} + resbarDrawinfo[res].textStorage = {"\255\150\150\150"..short(r[res][2]), barArea[3], barArea[2]+barHeight*2, (height/3.2)*widgetScale, 'ord'} + --resbarDrawinfo[res].textPull = {"\255\200\100\100"..short(r[3]), barArea[1]+((barArea[3]-barArea[1])*0.2), barArea[2]+barHeight*2, (height/3.2)*widgetScale, 'od'} + --resbarDrawinfo[res].textIncome = {"\255\100\200\100"..short(r[4]), barArea[1], barArea[2]+barHeight*2, (height/3.2)*widgetScale, 'od'} + resbarDrawinfo[res].textPull = {"\255\210\100\100"..short(r[res][3]), barArea[1]-(7*widgetScale), barArea[2]-barHeight/1.2, (height/3.2)*widgetScale, 'ord'} + resbarDrawinfo[res].textIncome = {"\255\100\210\100"..short(r[res][4]), barArea[1]-(7*widgetScale), barArea[2]+barHeight*2.7, (height/3.2)*widgetScale, 'ord'} + + dlistResbar[res][1] = glCreateList( function() + + -- background + glColor(0,0,0,0.7) + RectRound(area[1], area[2], area[3], area[4], 5.5*widgetScale) + local bgpadding = 3*widgetScale + glColor(1,1,1,0.03) + RectRound(area[1]+bgpadding, area[2]+bgpadding, area[3]-bgpadding, area[4], 5*widgetScale) + + if (WG['guishader'] ~= nil) then + guishaderEnabled = true + WG['guishader'].InsertRect(area[1], area[2], area[3], area[4], 'topbar_'..res) + end + + -- Icon + glColor(1,1,1,1) + local iconPadding = (area[4] - area[2]) / 9 + if res == 'metal' then + glTexture("LuaUI/Images/metal.png") + else + glTexture("LuaUI/Images/energy.png") + end + glTexRect(area[1]+iconPadding, area[2]+iconPadding, area[1]+(height*widgetScale)-iconPadding, area[4]-iconPadding) + glTexture(false) + + -- Bar background + if res == 'metal' then + glColor(0.5,0.5,0.5,0.33) + else + glColor(0.5,0.5,0,0.33) + end + glTexture(barbg) + glTexRect(barArea[1], barArea[2], barArea[3], barArea[4]) + end) + + dlistResbar[res][2] = glCreateList( function() + -- Metalmaker Conversion slider + if showConversionSlider and res == 'energy' then + local convValue = Spring.GetTeamRulesParam(spGetMyTeamID(), 'mmLevel') + if draggingConversionIndicatorValue ~= nil then + convValue = draggingConversionIndicatorValue/100 + end + if convValue == nil then + convValue = 1 + end + conversionIndicatorArea = {barArea[1]+(convValue * barWidth)-(shareSliderWidth/2), barArea[2]-sliderHeightAdd, barArea[1]+(convValue * barWidth)+(shareSliderWidth/2), barArea[4]+sliderHeightAdd} + glTexture(barbg) + if resbarHover ~= nil and resbarHover == res then + local padding = shareSliderWidth/8 + glColor(0.8, 0.8, 0.5, 1) + RectRound(conversionIndicatorArea[1], conversionIndicatorArea[2], conversionIndicatorArea[3], conversionIndicatorArea[4],2.5*widgetScale) + glColor(0.7, 0.7, 0.47, 1) + RectRound(conversionIndicatorArea[1]+padding, conversionIndicatorArea[2]+padding, conversionIndicatorArea[3]-padding, conversionIndicatorArea[4]-padding,2.5*widgetScale) + else + glColor(0.85, 0.85, 0.55, 1) + glTexRect(conversionIndicatorArea[1], conversionIndicatorArea[2], conversionIndicatorArea[3], conversionIndicatorArea[4]) + end + end + -- Share slider + local value = r[res][6] + if draggingShareIndicatorValue[res] ~= nil then + value = draggingShareIndicatorValue[res] + end + shareIndicatorArea[res] = {barArea[1]+(value * barWidth)-(shareSliderWidth/2), barArea[2]-sliderHeightAdd, barArea[1]+(value * barWidth)+(shareSliderWidth/2), barArea[4]+sliderHeightAdd} + glTexture(barbg) + if resbarHover ~= nil and resbarHover == res then + local padding = shareSliderWidth/8 + glColor(0.66, 0, 0, 1) + RectRound(shareIndicatorArea[res][1], shareIndicatorArea[res][2], shareIndicatorArea[res][3], shareIndicatorArea[res][4],2.5*widgetScale) + glColor(0.6, 0, 0, 1) + RectRound(shareIndicatorArea[res][1]+padding, shareIndicatorArea[res][2]+padding, shareIndicatorArea[res][3]-padding, shareIndicatorArea[res][4]-padding,2.5*widgetScale) + else + glColor(0.8, 0, 0, 1) + glTexRect(shareIndicatorArea[res][1], shareIndicatorArea[res][2], shareIndicatorArea[res][3], shareIndicatorArea[res][4]) + end + glTexture(false) + end) + + -- add tooltips + if WG['tooltip'] ~= nil then + if res == 'energy' then + WG['tooltip'].AddTooltip(res..'_share_slider', {resbarDrawinfo[res].barArea[1], shareIndicatorArea[res][2], conversionIndicatorArea[1], shareIndicatorArea[res][4]}, "\255\215\255\215"..res:sub(1,1):upper()..res:sub(2).." Share Slider\n\255\240\240\240Overflowing to your team when \n"..res.." goes beyond this point") + WG['tooltip'].AddTooltip(res..'_share_slider2', {conversionIndicatorArea[3], shareIndicatorArea[res][2], resbarDrawinfo[res].barArea[3], shareIndicatorArea[res][4]}, "\255\215\255\215"..res:sub(1,1):upper()..res:sub(2).." Share Slider\n\255\240\240\240Overflowing to your team when \n"..res.." goes beyond this point") + + WG['tooltip'].AddTooltip(res..'_metalmaker_slider', conversionIndicatorArea, "\255\215\255\215Energy Conversion slider\n\255\240\240\240Excess energy beyond this point will be\nconverted to metal\n(by your Energy Convertor units)") + else + WG['tooltip'].AddTooltip(res..'_share_slider', {resbarDrawinfo[res].barArea[1], shareIndicatorArea[res][2], resbarDrawinfo[res].barArea[3], shareIndicatorArea[res][4]}, "\255\215\255\215"..res:sub(1,1):upper()..res:sub(2).." Share Slider\n\255\240\240\240Overflowing to your team when \n"..res.." goes beyond this point") + end + --WG['tooltip'].AddTooltip(res..'_pull', {resbarDrawinfo[res].textPull[2]-(resbarDrawinfo[res].textPull[4]*0.5), resbarDrawinfo[res].textPull[3], resbarDrawinfo[res].textPull[2]+(resbarDrawinfo[res].textPull[4]*2), resbarDrawinfo[res].textPull[3]+resbarDrawinfo[res].textPull[4]}, ""..res.." usage") + --WG['tooltip'].AddTooltip(res..'_income', {resbarDrawinfo[res].textIncome[2]-(resbarDrawinfo[res].textIncome[4]*0.5), resbarDrawinfo[res].textIncome[3], resbarDrawinfo[res].textIncome[2]+(resbarDrawinfo[res].textIncome[4]*2), resbarDrawinfo[res].textIncome[3]+resbarDrawinfo[res].textIncome[4]}, ""..res.." income") + WG['tooltip'].AddTooltip(res..'_pull', {resbarDrawinfo[res].textPull[2]-(resbarDrawinfo[res].textPull[4]*2.5), resbarDrawinfo[res].textPull[3], resbarDrawinfo[res].textPull[2]+(resbarDrawinfo[res].textPull[4]*0.5), resbarDrawinfo[res].textPull[3]+resbarDrawinfo[res].textPull[4]}, ""..res.." usage") + WG['tooltip'].AddTooltip(res..'_income', {resbarDrawinfo[res].textIncome[2]-(resbarDrawinfo[res].textIncome[4]*2.5), resbarDrawinfo[res].textIncome[3], resbarDrawinfo[res].textIncome[2]+(resbarDrawinfo[res].textIncome[4]*0.5), resbarDrawinfo[res].textIncome[3]+resbarDrawinfo[res].textIncome[4]}, ""..res.." income") + WG['tooltip'].AddTooltip(res..'_storage', {resbarDrawinfo[res].textStorage[2]-(resbarDrawinfo[res].textStorage[4]*2.75), resbarDrawinfo[res].textStorage[3], resbarDrawinfo[res].textStorage[2], resbarDrawinfo[res].textStorage[3]+resbarDrawinfo[res].textStorage[4]}, ""..res.." storage") + WG['tooltip'].AddTooltip(res..'_curent', {resbarDrawinfo[res].textCurrent[2]-(resbarDrawinfo[res].textCurrent[4]*1.75), resbarDrawinfo[res].textCurrent[3], resbarDrawinfo[res].textCurrent[2]+(resbarDrawinfo[res].textCurrent[4]*1.75), resbarDrawinfo[res].textCurrent[3]+resbarDrawinfo[res].textCurrent[4]}, "\255\215\255\215"..string.upper(res).."\n\255\240\240\240Share "..res.." to a specific player by...\n1) Using the (adv)playerlist,\n dragging up the "..res.." icon at the rightside.\n2) An interface brought up with the H key.") + end +end + + +function init() + + r['metal'] = {spGetTeamResources(spGetMyTeamID(),'metal') } + r['energy'] = {spGetTeamResources(spGetMyTeamID(),'energy') } + + topbarArea = {xPos, vsy-(borderPadding*widgetScale)-(height*widgetScale), vsx, vsy} + barContentArea = {xPos+(borderPadding*widgetScale), vsy-(height*widgetScale), vsx, vsy} + + local filledWidth = 0 + local totalWidth = barContentArea[3] - barContentArea[1] + local areaSeparator = (borderPadding*widgetScale) + + if dlistBackground then + glDeleteList(dlistBackground) + end + dlistBackground = glCreateList( function() + + --glColor(0, 0, 0, 0.66) + --RectRound(topbarArea[1], topbarArea[2], topbarArea[3], topbarArea[4], 6*widgetScale) + -- + --glColor(1,1,1,0.025) + --RectRound(barContentArea[1], barContentArea[2], barContentArea[3], barContentArea[4]+(10*widgetScale), 5*widgetScale) + + --if (WG['guishader'] ~= nil) then + -- guishaderEnabled = true3 + -- WG['guishader'].InsertRect(topbarArea[1]+((borderPadding*widgetScale)/2), topbarArea[2], topbarArea[3], topbarArea[4], 'topbar') + --end + end) + + -- metal + --local width = (totalWidth/4) + --resbarArea['metal'] = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + --filledWidth = filledWidth + width + areaSeparator + --updateResbar('metal') + + --energy + --resbarArea['energy'] = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + --filledWidth = filledWidth + width + areaSeparator + --updateResbar('energy') + + -- wind + --width = ((height*1.18)*widgetScale) + --windArea = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + --filledWidth = filledWidth + width + areaSeparator + --updateWind() + + -- metalmaker + --if currentMetalmaker ~= '' then + -- width = ((height*1.18)*widgetScale) + -- metalmakerArea = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + -- filledWidth = filledWidth + width + areaSeparator + -- updateMetalmaker() + --end + + -- coms + --if displayComCounter then + -- comsArea = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + -- filledWidth = filledWidth + width + areaSeparator + -- updateComs() + --end + + -- rejoin + width = (totalWidth/4) / 3.3 + rejoinArea = {barContentArea[1]+filledWidth, barContentArea[2], barContentArea[1]+filledWidth+width, barContentArea[4]} + filledWidth = filledWidth + width + areaSeparator + + -- buttons + width = (totalWidth/4) + buttonsArea = {barContentArea[3]-width, barContentArea[2], barContentArea[3], barContentArea[4]} + filledWidth = filledWidth + width + areaSeparator + updateButtons() + + WG['topbar'].GetPosition = function() + return {topbarArea[1], topbarArea[2], topbarArea[3], topbarArea[4], widgetScale, barContentArea[2]} + end + + --updateResbarText('metal') + --updateResbarText('energy') +end + +function checkStatus() + myAllyTeamID = Spring.GetMyAllyTeamID() + myTeamID = Spring.GetMyTeamID() + myPlayerID = Spring.GetMyPlayerID() +end + + +--function widget:GameStart() +-- gameStarted = true +-- checkStatus() +-- +-- if displayComCounter then +-- countComs() +-- if comsArea[1] ~= nil then +-- updateComs(true) +-- end +-- end +-- +-- -- code for rejoin +-- --local currentTime = os.date("!*t") --ie: clock on "gui_epicmenu.lua" (widget by CarRepairer), UTC & format: http://lua-users.org/wiki/OsLibraryTutorial +-- --local systemSecond = currentTime.hour*3600 + currentTime.min*60 + currentTime.sec +-- --local timestampMsg = "rejnProg " .. systemSecond --currentTime --create a timestamp message +-- --Spring.SendLuaUIMsg(timestampMsg, 's') --this message will remain in server's cache as a LUA message which rejoiner can intercept. Thus allowing the game to leave a clue at game start for latecomer. The latecomer will compare the previous timestamp with present and deduce the catch-up time. +-- --Spring.SendLuaUIMsg(timestampMsg, 'a') --this message will remain in server's cache as a LUA message which rejoiner can intercept. Thus allowing the game to leave a clue at game start for latecomer. The latecomer will compare the previous timestamp with present and deduce the catch-up time. +-- --myTimestamp = systemSecond +--end + + +function widget:GameFrame(n) + spec = spGetSpectatingState() + + --if n == 1 then + -- currentMetalmaker = getCurrentMetalmaker() + -- if currentMetalmaker ~= '' then + -- init() + -- end + --end + + --windRotation = windRotation + (currentWind * bladeSpeedMultiplier) + gameFrame = n + + --functionContainer(n) --function that are able to remove itself. Reference: gui_take_reminder.lua (widget by EvilZerggin, modified by jK) + -- + --if n % 30 == 1 then + -- updateResbarText('metal') + -- updateResbarText('energy') + -- + -- -- metalmaker + -- if currentMetalmaker ~= '' then + -- currentMetalmaker = getCurrentMetalmaker() + -- if dlistMetalmaker3 ~= nil then + -- glDeleteList(dlistMetalmaker3) + -- end + -- dlistMetalmaker3 = glCreateList( function() + -- local fontSize = (height/2.66)*widgetScale + -- glText("\255\200\200\200"..currentMetalmaker, metalmakerArea[1]+((metalmakerArea[3]-metalmakerArea[1])/2), metalmakerArea[2]+((metalmakerArea[4]-metalmakerArea[2])/2.05)-(fontSize/5), fontSize, 'oc') + -- end) + -- if WG['tooltip'] ~= nil then + -- WG['tooltip'].AddTooltip('metalmaker', metalmakerArea, "\255\215\255\215Metalmaker conversion value\nDisplays the number of ......") + -- end + -- end + --end +end + +local sec = 0 +local uiOpacitySec = 0 +function widget:Update(dt) + if chobbyInterface then return end + uiOpacitySec = uiOpacitySec + dt + if uiOpacitySec>0.5 then + uiOpacitySec = 0 + if ui_opacity ~= Spring.GetConfigFloat("ui_opacity",0.66) then + ui_opacity = Spring.GetConfigFloat("ui_opacity",0.66) + updateButtons() + end + end + + local mx,my = spGetMouseState() + + --sec = sec + dt + --if sec>0.33 then + -- sec = 0 + -- r['metal'] = {spGetTeamResources(spGetMyTeamID(),'metal') } + -- r['energy'] = {spGetTeamResources(spGetMyTeamID(),'energy') } + --end + + + now = os.clock() + if now > nextGuishaderCheck then + nextGuishaderCheck = now+guishaderCheckUpdateRate + if guishaderEnabled == false and widgetHandler.orderList["GUI-Shader"] ~= nil and (widgetHandler.orderList["GUI-Shader"] > 0) then + guishaderEnabled = true + init() + elseif guishaderEnabled and widgetHandler.orderList["GUI-Shader"] ~= nil and (widgetHandler.orderList["GUI-Shader"] == 0) then + guishaderEnabled = false + end + end + + --if not spec then + -- if isInBox(mx, my, resbarArea['energy']) then + -- if resbarHover == nil then + -- resbarHover = 'energy' + -- updateResbar('energy') + -- end + -- elseif resbarHover ~= nil and resbarHover == 'energy' then + -- resbarHover = nil + -- updateResbar('energy') + -- end + -- if isInBox(mx, my, resbarArea['metal']) then + -- if resbarHover == nil then + -- resbarHover = 'metal' + -- updateResbar('metal') + -- end + -- elseif resbarHover ~= nil and resbarHover == 'metal' then + -- resbarHover = nil + -- updateResbar('metal') + -- end + --elseif spec and myTeamID ~= spGetMyTeamID() then -- check if the team that we are spectating changed + -- draggingShareIndicatorValue = {} + -- draggingConversionIndicatorValue = nil + -- updateResbar('metal') + -- updateResbar('energy') + --end + + -- wind + --if (gameFrame ~= lastFrame) then + -- currentWind = sformat('%.1f', select(4,spWind())) + --end + + + -- coms + --if displayComCounter then + -- if spec and myTeamID ~= spGetMyTeamID() then -- check if the team that we are spectating changed + -- checkStatus() + -- countComs() + -- end + -- if not spec and receiveCount then -- check if we have received a TeamRulesParam from the gadget part + -- local newEnemyComCount = Spring.GetTeamRulesParam(myTeamID, "enemyComCount") + -- if type(newEnemyComCount) == 'number' then + -- enemyComCount = newEnemyComCount + -- if enemyComCount ~= prevEnemyComCount then + -- comcountChanged = true + -- prevEnemyComCount = enemyComCount + -- end + -- end + -- end + -- if comcountChanged then + -- updateComs() + -- end + --end + + -- rejoin + --if (gameFrame ~= lastFrame) then + -- if showRejoinUI then + -- oneSecondElapsed = oneSecondElapsed + dt + -- if oneSecondElapsed >= 1 then --wait for 1 second period + -- -----var localize----- + -- -----localize + -- + -- local serverFrameNum = serverFrameNum1 or serverFrameNum2 --use FrameNum from GameProgress if available, else use FrameNum derived from LUA_msg. + -- serverFrameNum = serverFrameNum + serverFrameRate*oneSecondElapsed -- estimate Server's frame number after each widget:Update() while waiting for GameProgress() to refresh with actual value. + -- local frameDistanceToFinish = serverFrameNum-gameFrame + -- + -- local myGameFrameRate = (gameFrame - myLastFrameNum) / oneSecondElapsed + -- --Method1: simple average + -- --[[ + -- averageLocalSpeed.sumOfSpeed = averageLocalSpeed.sumOfSpeed + myGameFrameRate -- try to calculate the average of local gameFrame speed. + -- averageLocalSpeed.sumCounter = averageLocalSpeed.sumCounter + 1 + -- myGameFrameRate = averageLocalSpeed.sumOfSpeed/averageLocalSpeed.sumCounter -- using the average to calculate the estimate for time of completion. + -- --]] + -- --Method2: simple moving average + -- myGameFrameRate = SimpleMovingAverage(myGameFrameRate, simpleMovingAverageLocalSpeed) -- get our average frameRate + -- + -- local timeToComplete = frameDistanceToFinish/myGameFrameRate -- estimate the time to completion. + -- local timeToComplete_string = "?/?" + -- + -- local minute, second = math.modf(timeToComplete/60) --second divide by 60sec-per-minute, then saperate result from its remainder + -- second = 60*second --multiply remainder with 60sec-per-minute to get second back. + -- timeToComplete_string = string.format ("Time Remaining: %d:%02d" , minute, second) + -- + -- oneSecondElapsed = 0 + -- myLastFrameNum = gameFrame + -- + -- if serverFrameNum1 then + -- serverFrameNum1 = serverFrameNum --update serverFrameNum1 if value from GameProgress() is used, + -- else + -- serverFrameNum2 = serverFrameNum + -- end --update serverFrameNum2 if value from LuaRecvMsg() is used. + -- + -- end + -- + -- if gameFrame / serverFrameNum1 < 1 then + -- updateRejoin() + -- end + -- end + -- + ----elseif dlistRejoin ~= nil then + ---- glDeleteList(dlistRejoin) + --end + + if (gameFrame ~= lastFrame) then + lastFrame = gameFrame + end +end + +function drawResbarValues(res) + local barWidth = resbarDrawinfo[res].barArea[3] - resbarDrawinfo[res].barArea[1] + local glowSize = (resbarDrawinfo[res].barArea[4] - resbarDrawinfo[res].barArea[2]) * 5.5 + + local cappedCurRes = r[res][1] -- limit so when production dies the value wont be much larger than what you can store + if r[res][1] > r[res][2]*1.07 then + cappedCurRes = r[res][2]*1.07 + end + if res == 'energy' then + glColor(1,1,0, 0.04) + glTexture(glowTexture) + local iconPadding = (resbarArea[res][4] - resbarArea[res][2]) + glTexRect(resbarArea[res][1]+iconPadding, resbarArea[res][2]+iconPadding, resbarArea[res][1]+(height*widgetScale)-iconPadding, resbarArea[res][4]-iconPadding) + end + + -- Bar value + glColor(resbarDrawinfo[res].barColor) + glTexture(barbg) + glTexRect(resbarDrawinfo[res].barTexRect[1], resbarDrawinfo[res].barTexRect[2], resbarDrawinfo[res].barTexRect[1]+((cappedCurRes/r[res][2]) * barWidth), resbarDrawinfo[res].barTexRect[4]) + + -- Bar value glow + glColor(resbarDrawinfo[res].barColor[1], resbarDrawinfo[res].barColor[2], resbarDrawinfo[res].barColor[3], 0.09) + glTexture(barGlowCenterTexture) + glTexRect(resbarDrawinfo[res].barGlowMiddleTexRect[1], resbarDrawinfo[res].barGlowMiddleTexRect[2], resbarDrawinfo[res].barGlowMiddleTexRect[1] + ((cappedCurRes/r[res][2]) * barWidth), resbarDrawinfo[res].barGlowMiddleTexRect[4]) + glTexture(barGlowEdgeTexture) + glTexRect(resbarDrawinfo[res].barGlowLeftTexRect[1], resbarDrawinfo[res].barGlowLeftTexRect[2], resbarDrawinfo[res].barGlowLeftTexRect[3], resbarDrawinfo[res].barGlowLeftTexRect[4]) + glTexRect((resbarDrawinfo[res].barGlowMiddleTexRect[1]+((cappedCurRes/r[res][2]) * barWidth))+(glowSize*2), resbarDrawinfo[res].barGlowRightTexRect[2], resbarDrawinfo[res].barGlowMiddleTexRect[1]+((cappedCurRes/r[res][2]) * barWidth), resbarDrawinfo[res].barGlowRightTexRect[4]) + + currentResValue[res] = short(cappedCurRes) + if currentResCap[res] ~= r[res][2] then + currentResCap[res] = r[res][2] + for n,_ in pairs(dlistResValues[res]) do + glDeleteList(dlistResValues[res][n]) + end + dlistResValues[res] = {} + end + if not dlistResValues[res][currentResValue[res]] then + dlistResValues[res][currentResValue[res]] = glCreateList( function() + -- Text: current + glColor(1, 1, 1, 1) + glText(currentResValue[res], resbarDrawinfo[res].textCurrent[2], resbarDrawinfo[res].textCurrent[3], resbarDrawinfo[res].textCurrent[4], resbarDrawinfo[res].textCurrent[5]) + end) + end + glCallList(dlistResValues[res][currentResValue[res]]) +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + local now = os.clock() + + glPushMatrix() + if dlistBackground then + glCallList(dlistBackground) + end + + local x,y,b = spGetMouseState() + + --local res = 'metal' + --if dlistResbar[res][1] and dlistResbar[res][2] and dlistResbar[res][3] then + -- glCallList(dlistResbar[res][1]) + -- drawResbarValues(res) + -- glCallList(dlistResbar[res][3]) + -- glCallList(dlistResbar[res][2]) + -- --if showOverflowTooltip[res] ~= nil and showOverflowTooltip[res] < now then + -- -- local text = 'Overflowing' + -- -- local textWidth = (8*2.66) + (glGetTextWidth(text) * 13) * widgetScale + -- -- WG['tooltip'].ShowTooltip(res..'_overflow_warning', text, resbarDrawinfo[res].barTexRect[3]+(8*widgetScale)-textWidth, resbarDrawinfo[res].barTexRect[4]-(24*widgetScale)) + -- --end + --end + --res = 'energy' + --if dlistResbar[res][1] and dlistResbar[res][2] and dlistResbar[res][3] then + -- glCallList(dlistResbar[res][1]) + -- drawResbarValues(res) + -- glCallList(dlistResbar[res][3]) + -- glCallList(dlistResbar[res][2]) + -- --if showOverflowTooltip[res] ~= nil and showOverflowTooltip[res] < now then + -- -- local text = 'Overflowing' + -- -- local textWidth = (8*2.66) + (glGetTextWidth(text) * 13) * widgetScale + -- -- WG['tooltip'].ShowTooltip(res..'_overflow_warning', text, resbarDrawinfo[res].barTexRect[3]+(8*widgetScale)-textWidth, resbarDrawinfo[res].barTexRect[4]-(24*widgetScale)) + -- --end + --end + -- + --if dlistWind1 then + -- glPushMatrix() + -- glCallList(dlistWind1) + -- glRotate(windRotation, 0, 0, 1) + -- glCallList(dlistWind2) + -- glPopMatrix() + -- -- current wind + -- if gameFrame > 0 then + -- local fontSize = (height/2.66)*widgetScale + -- if not dlistWindText[currentWind] then + -- dlistWindText[currentWind] = glCreateList( function() + -- glText("\255\255\255\255"..currentWind, windArea[1]+((windArea[3]-windArea[1])/2), windArea[2]+((windArea[4]-windArea[2])/2.05)-(fontSize/5), fontSize, 'oc') -- Wind speed text + -- end) + -- end + -- glCallList(dlistWindText[currentWind]) + -- else + -- if now < 30 and WG['tooltip'] ~= nil then + -- if (minWind + maxWind)/2 < 5.5 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Wind isnt worth', windArea[1], windArea[2]-13*widgetScale) + -- elseif (minWind + maxWind)/2 >= 5.5 and (minWind + maxWind)/2 < 7 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Wind is viable', windArea[1], windArea[2]-13*widgetScale) + -- elseif (minWind + maxWind)/2 >= 7 and (minWind + maxWind)/2 < 8.5 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Average wind is okay', windArea[1], windArea[2]-13*widgetScale) + -- elseif (minWind + maxWind)/2 >= 8.5 and (minWind + maxWind)/2 < 10 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Average wind is good', windArea[1], windArea[2]-13*widgetScale) + -- elseif (minWind + maxWind)/2 >= 10 and (minWind + maxWind)/2 < 15 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Average wind is really good', windArea[1], windArea[2]-13*widgetScale) + -- elseif (minWind + maxWind)/2 >= 15 then + -- WG['tooltip'].ShowTooltip('topbar_windinfo', 'Wind is insanely good', windArea[1], windArea[2]-13*widgetScale) + -- end + -- end + -- end + --end + --if currentMetalmaker ~= '' and dlistMetalmaker1 and dlistMetalmaker2 and dlistMetalmaker3 then + -- glCallList(dlistMetalmaker1) + -- glCallList(dlistMetalmaker2) + -- glCallList(dlistMetalmaker3) + --end + -- + --if displayComCounter and dlistComs1 then + -- glCallList(dlistComs1) + -- if allyComs == 1 and (gameFrame % 12 < 6) then + -- glColor(1,0.6,0,0.6) + -- else + -- glColor(1,1,1,0.3) + -- end + -- glCallList(dlistComs2) + --end + -- + --if dlistRejoin and showRejoinUI then + -- glCallList(dlistRejoin) + --elseif dlistRejoin ~= nil then + -- if dlistRejoin ~= nil then + -- glDeleteList(dlistRejoin) + -- dlistRejoin = nil + -- end + -- if WG['guishader'] ~= nil then + -- WG['guishader'].RemoveRect('topbar_rejoin') + -- end + -- if WG['tooltip'] ~= nil then + -- WG['tooltip'].RemoveTooltip('rejoin') + -- end + --end + + if dlistButtons1 then + glCallList(dlistButtons1) + -- hovered? + if not showQuitscreen and buttonsArea['buttons'] ~= nil and IsOnRect(x, y, buttonsArea[1], buttonsArea[2], buttonsArea[3], buttonsArea[4]) then + buttonsAreaHovered = nil + for button, pos in pairs(buttonsArea['buttons']) do + if IsOnRect(x, y, pos[1], pos[2], pos[3], pos[4]) then + if b then + glColor(1,1,1,0.32) + else + glColor(1,1,1,0.25) + end + RectRound(buttonsArea['buttons'][button][1], buttonsArea['buttons'][button][2], buttonsArea['buttons'][button][3], buttonsArea['buttons'][button][4], 3.5*widgetScale) + break + end + end + end + glCallList(dlistButtons2) + end + + if dlistQuit ~= nil then + if WG['guishader'] then + WG['guishader'].removeRenderDlist(dlistQuit) + end + glDeleteList(dlistQuit) + dlistQuit = nil + end + if showQuitscreen ~= nil then + local fadeoutBonus = 0 + local fadeTime = 0.2 + local fadeProgress = (now - showQuitscreen) / fadeTime + if fadeProgress > 1 then fadeProgress = 1 end + + Spring.SetMouseCursor('cursornormal') + + dlistQuit = glCreateList( function() + if WG['guishader'] then + glColor(0,0,0,(0.18*fadeProgress)) + else + glColor(0,0,0,(0.35*fadeProgress)) + end + glRect( 0, 0, vsx, vsy) + + if hideQuitWindow == nil then -- when terminating spring, keep the faded screen + + local width = vsx/5.8 + local height = width/3.5 + local padding = width/70 + local buttonPadding = width/100 + local buttonMargin = width/32 + local buttonHeight = height*0.55 + + quitscreenArea = {(vsx/2)-(width/2), (vsy/1.8)-(height/2), (vsx/2)+(width/2), (vsy/1.8)+(height/2)} + quitscreenResignArea = {(vsx/2)-(width/2)+buttonMargin, (vsy/1.8)-(height/2)+buttonMargin, (vsx/2)-(buttonMargin/2), (vsy/1.8)-(height/2)+buttonHeight-buttonMargin} + quitscreenQuitArea = {(vsx/2)+(buttonMargin/2), (vsy/1.8)-(height/2)+buttonMargin, (vsx/2)+(width/2)-buttonMargin, (vsy/1.8)-(height/2)+buttonHeight-buttonMargin} + + -- window + glColor(1,1,1,0.5+(0.36*fadeProgress)) + RectRound(quitscreenArea[1], quitscreenArea[2], quitscreenArea[3], quitscreenArea[4], 5.5*widgetScale) + glColor(0,0,0,0.035+(0.035*fadeProgress)) + RectRound(quitscreenArea[1]+padding, quitscreenArea[2]+padding, quitscreenArea[3]-padding, quitscreenArea[4]-padding, padding) + + local fontSize = height/6 + font:Begin() + font:SetTextColor(0,0,0,1) + if not spec then + font:Print("Want to resign or quit to desktop?", quitscreenArea[1]+((quitscreenArea[3]-quitscreenArea[1])/2), quitscreenArea[4]-padding-padding-padding-fontSize, fontSize, "cn") + else + font:Print("Really want to quit?", quitscreenArea[1]+((quitscreenArea[3]-quitscreenArea[1])/2), quitscreenArea[4]-padding-padding-padding-padding-fontSize, fontSize, "cn") + end + + -- quit button + if IsOnRect(x, y, quitscreenQuitArea[1], quitscreenQuitArea[2], quitscreenQuitArea[3], quitscreenQuitArea[4]) then + glColor(0.66,0.05,0.05,0.4+(0.5*fadeProgress)) + else + glColor(0.45,0,0,0.35+(0.4*fadeProgress)) + end + RectRound(quitscreenQuitArea[1], quitscreenQuitArea[2], quitscreenQuitArea[3], quitscreenQuitArea[4], 3.5*widgetScale) + glColor(0,0,0,0.07+(0.05*fadeProgress)) + RectRound(quitscreenQuitArea[1]+buttonPadding, quitscreenQuitArea[2]+buttonPadding, quitscreenQuitArea[3]-buttonPadding, quitscreenQuitArea[4]-buttonPadding, 2.8*widgetScale) + font:End() + + fontSize = fontSize*0.9 + font2:Begin() + font2:SetTextColor(1,1,1,1) + font2:SetOutlineColor(0,0,0,0.23) + font2:Print("Quit", quitscreenQuitArea[1]+((quitscreenQuitArea[3]-quitscreenQuitArea[1])/2), quitscreenQuitArea[2]+((quitscreenQuitArea[4]-quitscreenQuitArea[2])/2)-(fontSize/3), fontSize, "con") + + -- resign button + if not spec then + if IsOnRect(x, y, quitscreenResignArea[1], quitscreenResignArea[2], quitscreenResignArea[3], quitscreenResignArea[4]) then + glColor(0.55,0.55,0.55,0.4+(0.5*fadeProgress)) + else + glColor(0.3,0.3,0.3,0.4+(0.4*fadeProgress)) + end + RectRound(quitscreenResignArea[1], quitscreenResignArea[2], quitscreenResignArea[3], quitscreenResignArea[4], 3.5*widgetScale) + glColor(0,0,0,0.07+(0.05*fadeProgress)) + RectRound(quitscreenResignArea[1]+buttonPadding, quitscreenResignArea[2]+buttonPadding, quitscreenResignArea[3]-buttonPadding, quitscreenResignArea[4]-buttonPadding, 2.8*widgetScale) + + font2:Print("Resign", quitscreenResignArea[1]+((quitscreenResignArea[3]-quitscreenResignArea[1])/2), quitscreenResignArea[2]+((quitscreenResignArea[4]-quitscreenResignArea[2])/2)-(fontSize/3), fontSize, "con") + end + font2:End() + end + end) + + -- background + if WG['guishader'] then + WG['guishader'].setScreenBlur(true) + WG['guishader'].insertRenderDlist(dlistQuit) + else + glCallList(dlistQuit) + end + end + glColor(1,1,1,1) + glPopMatrix() +end + + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY +end + + +local function adjustSliders(x, y) + if draggingShareIndicator ~= nil and not spec then + local shareValue = (x - resbarDrawinfo[draggingShareIndicator]['barArea'][1]) / (resbarDrawinfo[draggingShareIndicator]['barArea'][3] - resbarDrawinfo[draggingShareIndicator]['barArea'][1]) + if shareValue < 0 then shareValue = 0 end + if shareValue > 1 then shareValue = 1 end + Spring.SetShareLevel(draggingShareIndicator, shareValue) + draggingShareIndicatorValue[draggingShareIndicator] = shareValue + updateResbar(draggingShareIndicator) + end + if showConversionSlider and draggingConversionIndicator and not spec then + local convValue = math.floor((x - resbarDrawinfo['energy']['barArea'][1]) / (resbarDrawinfo['energy']['barArea'][3] - resbarDrawinfo['energy']['barArea'][1]) * 100) + if convValue < 12 then convValue = 12 end + if convValue > 88 then convValue = 88 end + Spring.SendLuaRulesMsg(sformat(string.char(137)..'%i', convValue)) + draggingConversionIndicatorValue = convValue + updateResbar('energy') + end +end + +--function widget:MouseMove(x, y) +-- adjustSliders(x, y) +--end + + +local function hideWindows() + if (WG['options'] ~= nil) then + WG['options'].toggle(false) + end + if (WG['changelog'] ~= nil) then + WG['changelog'].toggle(false) + end + if (WG['keybinds'] ~= nil) then + WG['keybinds'].toggle(false) + end + if (WG['commands'] ~= nil) then + WG['commands'].toggle(false) + end + if (WG['gameinfo'] ~= nil) then + WG['gameinfo'].toggle(false) + end + if (WG['teamstats'] ~= nil) then + WG['teamstats'].toggle(false) + end + showQuitscreen = nil + if WG['guishader'] then + WG['guishader'].setScreenBlur(false) + end +end + +local function applyButtonAction(button) + + if playSounds then + Spring.PlaySoundFile(leftclick, 0.8, 'ui') + end + + local isvisible = false + if button == 'quit' then + if chobbyLoaded then + Spring.SendLuaMenuMsg("showLobby") + else + local oldShowQuitscreen + if showQuitscreen ~= nil then + oldShowQuitscreen = showQuitscreen + isvisible = true + end + hideWindows() + if oldShowQuitscreen ~= nil then + if isvisible ~= true then + showQuitscreen = oldShowQuitscreen + if WG['guishader'] then + WG['guishader'].setScreenBlur(true) + end + end + else + showQuitscreen = os.clock() + end + end + elseif button == 'options' then + if (WG['options'] ~= nil) then + isvisible = WG['options'].isvisible() + end + hideWindows() + if (WG['options'] ~= nil and isvisible ~= true) then + WG['options'].toggle() + end + elseif button == 'changelog' then + if (WG['changelog'] ~= nil) then + isvisible = WG['changelog'].isvisible() + end + hideWindows() + if (WG['changelog'] ~= nil and isvisible ~= true) then + WG['changelog'].toggle() + end + elseif button == 'keybinds' then + if (WG['keybinds'] ~= nil) then + isvisible = WG['keybinds'].isvisible() + end + hideWindows() + if (WG['keybinds'] ~= nil and isvisible ~= true) then + WG['keybinds'].toggle() + end + elseif button == 'commands' then + if (WG['commands'] ~= nil) then + isvisible = WG['commands'].isvisible() + end + hideWindows() + if (WG['commands'] ~= nil and isvisible ~= true) then + WG['commands'].toggle() + end + elseif button == 'stats' then + if (WG['teamstats'] ~= nil) then + isvisible = WG['teamstats'].isvisible() + end + hideWindows() + if (WG['teamstats'] ~= nil and isvisible ~= true) then + WG['teamstats'].toggle() + end + end +end + +function widget:MouseWheel(up,value) --up = true/false , value = -1/1 + if showQuitscreen ~= nil and quitscreenArea ~= nil then + return true + end +end + +function widget:KeyPress(key) + if key == 27 then -- ESC + hideWindows() + end + if showQuitscreen ~= nil and quitscreenArea ~= nil then + return true + end +end + +function widget:MousePress(x, y, button) + if button == 1 then + --if not spec then + -- if IsOnRect(x, y, shareIndicatorArea['metal'][1], shareIndicatorArea['metal'][2], shareIndicatorArea['metal'][3], shareIndicatorArea['metal'][4]) then + -- draggingShareIndicator = 'metal' + -- end + -- if IsOnRect(x, y, resbarDrawinfo['metal'].barArea[1], shareIndicatorArea['metal'][2], resbarDrawinfo['metal'].barArea[3], shareIndicatorArea['metal'][4]) then + -- draggingShareIndicator = 'metal' + -- adjustSliders(x, y) + -- end + -- if IsOnRect(x, y, shareIndicatorArea['energy'][1], shareIndicatorArea['energy'][2], shareIndicatorArea['energy'][3], shareIndicatorArea['energy'][4]) then + -- draggingShareIndicator = 'energy' + -- end + -- if draggingShareIndicator == nil and showConversionSlider and IsOnRect(x, y, conversionIndicatorArea[1], conversionIndicatorArea[2], conversionIndicatorArea[3], conversionIndicatorArea[4]) then + -- draggingConversionIndicator = true + -- end + -- if draggingConversionIndicator == nil and IsOnRect(x, y, resbarDrawinfo['energy'].barArea[1], shareIndicatorArea['energy'][2], resbarDrawinfo['energy'].barArea[3], shareIndicatorArea['energy'][4]) then + -- draggingShareIndicator = 'energy' + -- adjustSliders(x, y) + -- end + -- if draggingShareIndicator or draggingConversionIndicator then + -- if playSounds then + -- Spring.PlaySoundFile(resourceclick, 0.7, 'ui') + -- end + -- return true + -- end + --end + + if buttonsArea['buttons'] ~= nil then + for button, pos in pairs(buttonsArea['buttons']) do + if IsOnRect(x, y, pos[1], pos[2], pos[3], pos[4]) then + applyButtonAction(button) + return true + end + end + end + + if showQuitscreen ~= nil and quitscreenArea ~= nil then + + if IsOnRect(x, y, quitscreenArea[1], quitscreenArea[2], quitscreenArea[3], quitscreenArea[4]) then + + if IsOnRect(x, y, quitscreenQuitArea[1], quitscreenQuitArea[2], quitscreenQuitArea[3], quitscreenQuitArea[4]) then + if playSounds then + Spring.PlaySoundFile(leftclick, 0.75, 'ui') + end + Spring.SendCommands("QuitForce") + showQuitscreen = nil + hideQuitWindow = os.clock() + return true + end + if not spec and IsOnRect(x, y, quitscreenResignArea[1], quitscreenResignArea[2], quitscreenResignArea[3], quitscreenResignArea[4]) then + if playSounds then + Spring.PlaySoundFile(leftclick, 0.75, 'ui') + end + Spring.SendCommands("spectator") + showQuitscreen = nil + if WG['guishader'] then + WG['guishader'].setScreenBlur(false) + end + return true + end + return true + else + showQuitscreen = nil + if WG['guishader'] then + WG['guishader'].setScreenBlur(false) + end + return true + end + + return true + end + else + if showQuitscreen ~= nil and quitscreenArea ~= nil then + return true + end + end +end + +--function widget:MouseRelease(x, y, button) +-- if showQuitscreen ~= nil and quitscreenArea ~= nil then +-- return true +-- end +-- if draggingShareIndicator ~= nil then +-- adjustSliders(x, y) +-- draggingShareIndicator = nil +-- end +-- if draggingConversionIndicator ~= nil then +-- adjustSliders(x, y) +-- draggingConversionIndicator = nil +-- end +-- +-- --if button == 1 then +-- -- if buttonsArea['buttons'] ~= nil then -- reapply again because else the other widgets disable when there is a click outside of their window +-- -- for button, pos in pairs(buttonsArea['buttons']) do +-- -- if IsOnRect(x, y, pos[1], pos[2], pos[3], pos[4]) then +-- -- applyButtonAction(button) +-- -- end +-- -- end +-- -- end +-- --end +--end + +function widget:PlayerChanged() + spec = spGetSpectatingState() + checkStatus() + --if displayComCounter then + -- countComs() + --end + --if spec then + -- resbarHover = nil + --end +end + + +function isCom(unitID,unitDefID) + if not unitDefID and unitID then + unitDefID = Spring.GetUnitDefID(unitID) + end + if not unitDefID or not UnitDefs[unitDefID] or not UnitDefs[unitDefID].customParams then + return false + end + return UnitDefs[unitDefID].customParams.iscommander ~= nil +end + + +function countComs() + -- recount my own ally team coms + local prevAllyComs = allyComs + local prevEnemyComs = enemyComs + allyComs = 0 + local myAllyTeamList = Spring.GetTeamList(myAllyTeamID) + for _,teamID in ipairs(myAllyTeamList) do + allyComs = allyComs + Spring.GetTeamUnitDefCount(teamID, armcomDefID) + Spring.GetTeamUnitDefCount(teamID, corcomDefID) + end + comcountChanged = true + + if spec then + -- recount enemy coms + enemyComs = 0 + local allyTeamList = Spring.GetAllyTeamList() + for _,allyTeamID in ipairs(allyTeamList) do + if allyTeamID ~= myAllyTeamID then + local teamList = Spring.GetTeamList(allyTeamID) + for _,teamID in ipairs(teamList) do + enemyComs = enemyComs + Spring.GetTeamUnitDefCount(teamID, armcomDefID) + Spring.GetTeamUnitDefCount(teamID, corcomDefID) + end + end + end + end + + if allyComs ~= prevAllyComs or enemyComs ~= prevEnemyComs then + comcountChanged = true + end +end + +--function widget:UnitCreated(unitID, unitDefID, unitTeam) +-- if not isCom(unitID,unitDefID) then +-- return +-- end +-- --record com created +-- local _,_,_,_,_,allyTeamID = Spring.GetTeamInfo(unitTeam) +-- if allyTeamID == myAllyTeamID then +-- allyComs = allyComs + 1 +-- elseif spec then +-- enemyComs = enemyComs + 1 +-- end +-- comcountChanged = true +--end +-- +--function widget:UnitDestroyed(unitID, unitDefID, unitTeam) +-- if not isCom(unitID,unitDefID) then +-- return +-- end +-- --record com died +-- local _,_,_,_,_,allyTeamID = Spring.GetTeamInfo(unitTeam) +-- if allyTeamID == myAllyTeamID then +-- allyComs = allyComs - 1 +-- elseif spec then +-- enemyComs = enemyComs - 1 +-- end +-- comcountChanged = true +--end + + + +-- used for rejoin progress functionality +local function ActivateGUI_n_TTS (frameDistanceToFinish, ui_active, altThreshold) + if frameDistanceToFinish >= (altThreshold or 120) then + if not ui_active then + ui_active = true + end + elseif frameDistanceToFinish < (altThreshold or 120) then + if ui_active then + ui_active = false + end + end + return ui_active +end + +-- used for rejoin progress functionality +--function widget:GameProgress(serverFrameNum) --this function run 3rd. It read the official serverFrameNumber +-- local ui_active = showRejoinUI +-- +-- local frameDistanceToFinish = serverFrameNum-gameFrame +-- ui_active = ActivateGUI_n_TTS (frameDistanceToFinish, ui_active) +-- +-- serverFrameNum1 = serverFrameNum +-- showRejoinUI = ui_active +-- gameProgressActive = true +--end +-- +---- used for rejoin progress functionality +--function widget:RecvLuaMsg(bigMsg, playerID) --this function run 2nd. It read the LUA timestamp +-- +-- if gameProgressActive or isReplay then --skip LUA message if gameProgress is already active OR game is a replay +-- return false +-- end +-- +-- local myMsg = (playerID == myPlayerID) +-- if (myMsg or spec) then +-- if bigMsg:sub(1,9) == "rejnProg " then --check for identifier +-- -----var localize----- +-- local ui_active = showRejoinUI +-- -----localize +-- +-- local timeMsg = bigMsg:sub(10) --saperate time-message from the identifier +-- local systemSecond = tonumber(timeMsg) +-- --Spring.Echo(systemSecond .. " B") +-- submittedTimestamp[#submittedTimestamp +1] = systemSecond --store all submitted timestamp from each players +-- local sumSecond= 0 +-- for i=1, #submittedTimestamp,1 do +-- sumSecond = sumSecond + submittedTimestamp[i] +-- end +-- --Spring.Echo(sumSecond .. " C") +-- local avgSecond = sumSecond/#submittedTimestamp +-- --Spring.Echo(avgSecond .. " D") +-- local secondDiff = myTimestamp - avgSecond +-- --Spring.Echo(secondDiff .. " E") +-- local frameDiff = secondDiff*30 +-- +-- serverFrameNum2 = frameDiff --this value represent the estimate difference in frame when everyone was submitting their timestamp at game start. Therefore the difference in frame will represent how much frame current player are ahead of us. +-- ui_active = ActivateGUI_n_TTS (frameDiff, ui_active, 1800) +-- +-- -----return +-- showRejoinUI = ui_active +-- end +-- end +--end + + +function getCurrentMetalmaker() + local value = Spring.GetTeamRulesParam(myTeamID, "MMFactor") + if value == nil then + return '' + else + value = value*0.5 + end + + local decimalValue, floatValue = math.modf(value) + if floatValue ~= 0 then + value = string.format("%."..string.len(string.sub('0.00', 3)).."f", value) -- do rounding via a string because floats show rounding errors at times + end + return value +end + + +-- used for rejoin progress functionality +local function RemoveLUARecvMsg(n) + if n > 150 then + isReplay = nil + --widgetHandler:RemoveCallIn("RecvLuaMsg") --remove unused method for increase efficiency after frame> timestampLimit (150frame or 5 second). + functionContainer = function(x) end --replace this function with an empty function/method + end +end + +-- used for rejoin progress functionality +function SimpleMovingAverage(myGameFrameRate, simpleMovingAverageLocalSpeed) + --//remember current frameRate, and advance table index by 1 + local index = (simpleMovingAverageLocalSpeed.index) --retrieve current index. + simpleMovingAverageLocalSpeed.storage[index] = myGameFrameRate --remember current frameRate at current index. + simpleMovingAverageLocalSpeed.index = simpleMovingAverageLocalSpeed.index +1 --advance index by 1. + --//wrap table index around. Create a circle + local poolingSize = 10 --//number of sample. note: simpleMovingAverage() is executed every second, so the value represent an average spanning 10 second. + if (simpleMovingAverageLocalSpeed.index == (poolingSize + 2)) then --when table out-of-bound: + simpleMovingAverageLocalSpeed.index = 1 --wrap the table index around (create a circle of 150 + 1 (ie: poolingSize plus 1 space) entry). + end + --//update averages + index = (simpleMovingAverageLocalSpeed.index) --retrieve an index advanced by 1. + local oldAverage = (simpleMovingAverageLocalSpeed.storage[index] or defaultAverage) --retrieve old average or use initial/default average as old average. + simpleMovingAverageLocalSpeed.runningAverage = simpleMovingAverageLocalSpeed.runningAverage + myGameFrameRate/poolingSize - oldAverage/poolingSize --calculate average: add new value, remove old value. Ref: http://en.wikipedia.org/wiki/Moving_average#Simple_moving_average + local avgGameFrameRate = simpleMovingAverageLocalSpeed.runningAverage -- replace myGameFrameRate with its average value. + + return avgGameFrameRate, simpleMovingAverageLocalSpeed +end + + +--function widget:GameProgress(serverFrameNum) --this function run 3rd. It read the official serverFrameNumber +-- local ui_active = showRejoinUI +-- +-- serverFrameNum1 = serverFrameNum +-- local frameDistanceToFinish = serverFrameNum-gameFrame +-- ui_active = ActivateGUI_n_TTS (frameDistanceToFinish, ui_active) +-- +-- showRejoinUI = ui_active +-- gameProgressActive = true +--end + + +function widget:Initialize() + gameFrame = Spring.GetGameFrame() + --Spring.SendCommands("resbar 0") + + -- determine if we want to show comcounter + --local allteams = Spring.GetTeamList() + --local teamN = table.maxn(allteams) - 1 --remove gaia + --if teamN > 2 then + -- displayComCounter = true + --end + -- + --if displayComCounter and gameFrame > 0 then + -- countComs() + --end + -- + --if gameFrame > 0 then + -- widget:GameStart() + --end + + -- used for rejoin progress functionality + --functionContainer = RemoveLUARecvMsg + + --currentMetalmaker = getCurrentMetalmaker() + + WG['topbar'] = {} + WG['topbar'].showingRejoining = function() + return showRejoinUI + end + WG['topbar'].showingQuit = function() + return showQuitscreen + end + + init() +end + +function widget:Shutdown() + --Spring.SendCommands("resbar 1") + if dlistBackground ~= nil then + --glDeleteList(dlistBackground) + --glDeleteList(dlistResbar['metal'][1]) + --glDeleteList(dlistResbar['metal'][2]) + --glDeleteList(dlistResbar['metal'][3]) + --glDeleteList(dlistResbar['energy'][1]) + --glDeleteList(dlistResbar['energy'][2]) + --glDeleteList(dlistResbar['energy'][3]) + --glDeleteList(dlistWind1) + --glDeleteList(dlistWind2) + --glDeleteList(dlistComs1) + --glDeleteList(dlistComs2) + glDeleteList(dlistButtons1) + glDeleteList(dlistButtons2) + --glDeleteList(dlistRejoin) + --if dlistMetalmaker1 then + -- glDeleteList(dlistMetalmaker1) + -- glDeleteList(dlistMetalmaker2) + --end + -- + --for n,_ in pairs(dlistWindText) do + -- glDeleteList(dlistWindText[n]) + --end + --for n,_ in pairs(dlistResValues['metal']) do + -- glDeleteList(dlistResValues['metal'][n]) + --end + --for n,_ in pairs(dlistResValues['energy']) do + -- glDeleteList(dlistResValues['energy'][n]) + --end + end + gl.DeleteFont(font) + gl.DeleteFont(font2) + if WG['guishader'] then + --WG['guishader'].RemoveDlist('topbar_energy') + --WG['guishader'].RemoveDlist('topbar_metal') + --WG['guishader'].RemoveDlist('topbar_wind') + --WG['guishader'].RemoveDlist('topbar_coms') + WG['guishader'].RemoveDlist('topbar_buttons') + --WG['guishader'].RemoveDlist('topbar_rejoin') + end + --if WG['tooltip'] ~= nil then + -- WG['tooltip'].RemoveTooltip('coms') + -- WG['tooltip'].RemoveTooltip('wind') + -- WG['tooltip'].RemoveTooltip('metalmaker') + -- WG['tooltip'].RemoveTooltip('rejoin') + -- local res = 'energy' + -- WG['tooltip'].RemoveTooltip(res..'_share_slider') + -- WG['tooltip'].RemoveTooltip(res..'_share_slider2') + -- WG['tooltip'].RemoveTooltip(res..'_metalmaker_slider') + -- WG['tooltip'].RemoveTooltip(res..'_pull') + -- WG['tooltip'].RemoveTooltip(res..'_income') + -- WG['tooltip'].RemoveTooltip(res..'_storage') + -- WG['tooltip'].RemoveTooltip(res..'_curent') + -- res = 'metal' + -- WG['tooltip'].RemoveTooltip(res..'_share_slider') + -- WG['tooltip'].RemoveTooltip(res..'_share_slider2') + -- WG['tooltip'].RemoveTooltip(res..'_pull') + -- WG['tooltip'].RemoveTooltip(res..'_income') + -- WG['tooltip'].RemoveTooltip(res..'_storage') + -- WG['tooltip'].RemoveTooltip(res..'_curent') + --end + WG['topbar'] = nil +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_unit_stats.lua b/LuaUI/Widgets_Evo/gui_unit_stats.lua index 94f10d60b..1b19429d3 100644 --- a/LuaUI/Widgets_Evo/gui_unit_stats.lua +++ b/LuaUI/Widgets_Evo/gui_unit_stats.lua @@ -7,7 +7,7 @@ function widget:GetInfo() date = "Jan 11, 2009", version = 1.3, license = "GNU GPL, v2 or later", - layer = 6, + layer = -9999999999, enabled = true, -- loaded by default? } end @@ -34,22 +34,37 @@ include("keysym.h.lua") ------------------------------------------------------------------------------------ -- Globals ------------------------------------------------------------------------------------ -local fontSize = 14 -local xOffset = 25 -local yOffset = 25 +local fontSize = 13 local useSelection = true -local customFontSize = 18 +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) -local cX, cY +local customFontSize = 13 + +local bgcornerSize = fontSize*0.45 +local bgpadding = fontSize*0.9 + +local cX, cY, cYstart + +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (0.60 + (vsx*vsy / 5000000)) +local xOffset = (32 + (fontSize*0.9))*widgetScale +local yOffset = -((32 - (fontSize*0.9))*widgetScale) ------------------------------------------------------------------------------------ -- Speedups ------------------------------------------------------------------------------------ -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local bgcorner = "LuaUI/Images/bgcorner.png" local white = '\255\255\255\255' +local grey = '\255\190\190\190' local green = '\255\1\255\1' local yellow = '\255\255\255\1' local orange = '\255\255\128\1' @@ -69,19 +84,19 @@ local char = string.char local glColor = gl.Color local glText = gl.Text +local glTexture = gl.Texture local glRect = gl.Rect +local glTexRect = gl.TexRect local spGetMyTeamID = Spring.GetMyTeamID local spGetTeamResources = Spring.GetTeamResources local spGetTeamInfo = Spring.GetTeamInfo local spGetPlayerInfo = Spring.GetPlayerInfo local spGetTeamColor = Spring.GetTeamColor - +local spIsUserWriting = Spring.IsUserWriting local spGetModKeyState = Spring.GetModKeyState local spGetMouseState = Spring.GetMouseState local spTraceScreenRay = Spring.TraceScreenRay -local spGetSelectedUnits = Spring.GetSelectedUnits -local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount local spGetUnitDefID = Spring.GetUnitDefID local spGetUnitExp = Spring.GetUnitExperience @@ -106,6 +121,8 @@ local maxWidth = 0 local textBuffer = {} local textBufferCount = 0 +local spec = Spring.GetSpectatingState() + ------------------------------------------------------------------------------------ -- Functions ------------------------------------------------------------------------------------ @@ -131,15 +148,17 @@ local function DrawText(t1, t2) textBufferCount = textBufferCount + 1 textBuffer[textBufferCount] = {t1,t2,cX,cY} cY = cY - fontSize - maxWidth = max(maxWidth, (gl.GetTextWidth(t1)*fontSize), (gl.GetTextWidth(t2)*fontSize)+(fontSize*6.5)) + maxWidth = max(maxWidth, (font:GetTextWidth(t1)*fontSize), (font:GetTextWidth(t2)*fontSize)+(fontSize*6.5)) end local function DrawTextBuffer() local num = #textBuffer + font:Begin() for i=1, num do - glText(textBuffer[i][1], textBuffer[i][3], textBuffer[i][4], fontSize, "o") - glText(textBuffer[i][2], textBuffer[i][3] + (fontSize*6.5), textBuffer[i][4], fontSize, "o") + font:Print(textBuffer[i][1], textBuffer[i][3], textBuffer[i][4], fontSize, "o") + font:Print(textBuffer[i][2], textBuffer[i][3] + (fontSize*6.5), textBuffer[i][4], fontSize, "o") end + font:End() end local function GetTeamColorCode(teamID) @@ -165,18 +184,22 @@ local function GetTeamName(teamID) if not teamID then return 'Error:NoTeamID' end - local _, teamLeader = spGetTeamInfo(teamID) + local _, teamLeader = spGetTeamInfo(teamID,false) if not teamLeader then return 'Error:NoLeader' end - local leaderName = spGetPlayerInfo(teamLeader) + local leaderName = spGetPlayerInfo(teamLeader,false) + + if Spring.GetGameRulesParam('ainame_'..teamID) then + leaderName = Spring.GetGameRulesParam('ainame_'..teamID) + end return leaderName or 'Error:NoName' end local guishaderEnabled = false -- not a config var function RemoveGuishader() - if guishaderEnabled and WG['guishader_api'] ~= nil then - WG['guishader_api'].RemoveRect('unit_stats_title') - WG['guishader_api'].RemoveRect('unit_stats_data') + if guishaderEnabled and WG['guishader'] then + WG['guishader'].DeleteScreenDlist('unit_stats_title') + WG['guishader'].DeleteScreenDlist('unit_stats_data') guishaderEnabled = false end end @@ -190,27 +213,64 @@ function widget:Initialize() end function widget:Shutdown() + gl.DeleteFont(font) RemoveGuishader() end +function widget:PlayerChanged() + spec = Spring.GetSpectatingState() +end + function init() vsx, vsy = gl.GetViewSizes() - fontSize = customFontSize * (0.55 + (vsx*vsy / 8500000)) + widgetScale = (0.60 + (vsx*vsy / 5000000)) + fontSize = customFontSize * widgetScale bgcornerSize = fontSize*0.45 bgpadding = fontSize*0.9 - xOffset = 50 + bgpadding - yOffset = 10 + bgpadding + + xOffset = (32 + bgpadding)*widgetScale + yOffset = -((32 + bgpadding)*widgetScale) end -function widget:ViewResize(x,y) +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end init() end +local selectedUnits = Spring.GetSelectedUnits() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() +if useSelection then + function widget:SelectionChanged(sel) + selectedUnits = sel + selectedUnitsCount = Spring.GetSelectedUnitsCount() + end +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end + if (WG['topbar'] and WG['topbar'].showingQuit()) then + return + end local alt, ctrl, meta, shift = spGetModKeyState() - if not meta then RemoveGuishader() return end - + if not meta or spIsUserWriting() then + WG.hoverID = nil + RemoveGuishader() + return + end local mx, my = spGetMouseState() local uID local rType, unitID = spTraceScreenRay(mx, my) @@ -218,280 +278,586 @@ function widget:DrawScreen() uID = unitID end if useSelection then - local selUnits = spGetSelectedUnits() - if #selUnits >= 1 then - uID = selUnits[1] + if selectedUnitsCount >= 1 then + uID = selectedUnits[1] end end - if not uID then + local useHoverID = false + local _, activeID = Spring.GetActiveCommand() + if not activeID then activeID = 0 end + if not uID and (not WG.hoverID) and not (activeID < 0) then RemoveGuishader() return + elseif WG.hoverID and not (activeID < 0) then + uID = nil + useHoverID = true + elseif activeID < 0 then + uID = nil + useHoverID = false end local useExp = ctrl - local uDefID = spGetUnitDefID(uID) + local uDefID = (uID and spGetUnitDefID(uID)) or (useHoverID and WG.hoverID) or (UnitDefs[-activeID] and -activeID) + if not uDefID then RemoveGuishader() return end local uDef = uDefs[uDefID] - local uCurHp, uMaxHp, _, _, buildProg = spGetUnitHealth(uID) - local uTeam = spGetUnitTeam(uID) + local titleFontSize = fontSize*1.12 + local cornersize = ceil(bgpadding*0.21) + + if uID then + local uDef = uDefs[uDefID] + local uCurHp, uMaxHp, _, _, buildProg = spGetUnitHealth(uID) + uTeam = spGetUnitTeam(uID) + + maxWidth = 0 + + cX = mx + xOffset + cY = my + yOffset + cYstart = cY + + + cY = cY - 2 * titleFontSize + textBuffer = {} + textBufferCount = 0 + + ------------------------------------------------------------------------------------ + -- Units under construction + ------------------------------------------------------------------------------------ + if buildProg and buildProg < 1 then + + local myTeamID = spGetMyTeamID() + local mCur, mStor, mPull, mInc, mExp, mShare, mSent, mRec = spGetTeamResources(myTeamID, 'metal') + local eCur, eStor, ePull, eInc, eExp, eShare, eSent, eRec = spGetTeamResources(myTeamID, 'energy') + + local mTotal = uDef.metalCost + local eTotal = uDef.energyCost + local buildRem = 1 - buildProg + local mRem = mTotal * buildRem + local eRem = eTotal * buildRem + local mEta = (mRem - mCur) / (mInc + mRec) + local eEta = (eRem - eCur) / (eInc + eRec) + + DrawText("Prog:", format("%d%%", 100 * buildProg)) + DrawText("Metal:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", mTotal * buildProg, mTotal, mRem, mEta)) + DrawText("Energy:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", eTotal * buildProg, eTotal, eRem, eEta)) + --DrawText("MaxBP:", format(white .. '%d', buildRem * uDef.buildTime / math.max(mEta, eEta))) + cY = cY - fontSize + end - maxWidth = 0 + ------------------------------------------------------------------------------------ + -- Generic information, cost, move, class + ------------------------------------------------------------------------------------ - cX = mx + xOffset - cY = my + yOffset - cYstart = cY - - local text = yellow .. uDef.humanName .. white .. " " .. uDef.name .. " (#" .. uID .. " , "..GetTeamColorCode(uTeam) .. GetTeamName(uTeam) .. white .. ")" - - local cornersize = 0 - glColor(0,0,0,0.73) - RectRound(cX-bgpadding+cornersize, cY-bgpadding+cornersize, cX+(gl.GetTextWidth(text)*fontSize)+bgpadding-cornersize, cY+(fontSize/2)+bgpadding-cornersize, bgcornerSize) - cornersize = ceil(bgpadding*0.21) - glColor(1,1,1,0.025) - RectRound(cX-bgpadding+cornersize, cY-bgpadding+cornersize, cX+(gl.GetTextWidth(text)*fontSize)+bgpadding-cornersize, cY+(fontSize/2)+bgpadding-cornersize, bgcornerSize) - - if (WG['guishader_api'] ~= nil) then - guishaderEnabled = true - WG['guishader_api'].InsertRect(cX-bgpadding, cY-bgpadding, cX+(gl.GetTextWidth(text)*fontSize)+bgpadding, cY+(fontSize/2)+bgpadding, 'unit_stats_title') - end - - glColor(1.0, 1.0, 1.0, 1.0) - glText(text, cX, cY, fontSize, "o") - cY = cY - 2 * fontSize - textBuffer = {} - textBufferCount = 0 - - ------------------------------------------------------------------------------------ - -- Units under construction - ------------------------------------------------------------------------------------ - if buildProg and buildProg < 1 then - - local myTeamID = spGetMyTeamID() - local mCur, mStor, mPull, mInc, mExp, mShare, mSent, mRec = spGetTeamResources(myTeamID, 'metal') - local eCur, eStor, ePull, eInc, eExp, eShare, eSent, eRec = spGetTeamResources(myTeamID, 'energy') - - local mTotal = uDef.metalCost - local eTotal = uDef.energyCost - local buildRem = 1 - buildProg - local mRem = mTotal * buildRem - local eRem = eTotal * buildRem - local mEta = (mRem - mCur) / (mInc + mRec) - local eEta = (eRem - eCur) / (eInc + eRec) - - DrawText("Prog:", format("%d%%", 100 * buildProg)) - DrawText("Metal:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", mTotal * buildProg, mTotal, mRem, mEta)) - DrawText("Energy:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", eTotal * buildProg, eTotal, eRem, eEta)) - --DrawText("MaxBP:", format(white .. '%d', buildRem * uDef.buildTime / math.max(mEta, eEta))) - cY = cY - fontSize - end + --DrawText('Height:', uDefs[spGetUnitDefID(uID)].height) - ------------------------------------------------------------------------------------ - -- Generic information, cost, move, class - ------------------------------------------------------------------------------------ - - --DrawText('Height:', uDefs[spGetUnitDefID(uID)].height) - - DrawText("Cost:", format(metalColor .. '%d' .. white .. ' / ' .. - energyColor .. '%d' .. white .. ' / ' .. - buildColor .. '%d', uDef.metalCost, uDef.energyCost, uDef.buildTime) - ) - - if not (uDef.isBuilding or uDef.isFactory) then - DrawText("Move:", format("%.1f / %.1f / %.0f (Speed / Accel / Turn)", uDef.speed, 900 * uDef.maxAcc, simSpeed * uDef.turnRate * (180 / 32767))) - end + DrawText("Cost:", format(metalColor .. '%d' .. white .. ' / ' .. + energyColor .. '%d' .. white .. ' / ' .. + buildColor .. '%d', uDef.metalCost, uDef.energyCost, uDef.buildTime) + ) + if not (uDef.isBuilding or uDef.isFactory) then + DrawText("Move:", format("%.1f / %.1f / %.0f (Speed / Accel / Turn)", uDef.speed, 900 * uDef.maxAcc, simSpeed * uDef.turnRate * (180 / 32767))) + end - if uDef.buildSpeed > 0 then DrawText('Build:', yellow .. uDef.buildSpeed) end - cY = cY - fontSize + if uDef.buildSpeed > 0 then DrawText('Build:', yellow .. uDef.buildSpeed) end - ------------------------------------------------------------------------------------ - -- Sensors and Jamming - ------------------------------------------------------------------------------------ - local losRadius = spGetUnitSensorRadius(uID, 'los') or 0 - local airLosRadius = spGetUnitSensorRadius(uID, 'airLos') or 0 - local radarRadius = spGetUnitSensorRadius(uID, 'radar') or 0 - local sonarRadius = spGetUnitSensorRadius(uID, 'sonar') or 0 - local jammingRadius = spGetUnitSensorRadius(uID, 'radarJammer') or 0 - local sonarJammingRadius = spGetUnitSensorRadius(uID, 'sonarJammer') or 0 - local seismicRadius = spGetUnitSensorRadius(uID, 'seismic') or 0 + cY = cY - fontSize - DrawText('Los:', losRadius .. (airLosRadius > losRadius and format(' (AirLos: %d)', airLosRadius) or '')) + ------------------------------------------------------------------------------------ + -- Sensors and Jamming + ------------------------------------------------------------------------------------ + local losRadius = spGetUnitSensorRadius(uID, 'los') or 0 + local airLosRadius = spGetUnitSensorRadius(uID, 'airLos') or 0 + local radarRadius = spGetUnitSensorRadius(uID, 'radar') or 0 + local sonarRadius = spGetUnitSensorRadius(uID, 'sonar') or 0 + local jammingRadius = spGetUnitSensorRadius(uID, 'radarJammer') or 0 + local sonarJammingRadius = spGetUnitSensorRadius(uID, 'sonarJammer') or 0 + local seismicRadius = spGetUnitSensorRadius(uID, 'seismic') or 0 - if radarRadius > 0 then DrawText('Radar:', '\255\77\255\77' .. radarRadius) end - if sonarRadius > 0 then DrawText('Sonar:', '\255\128\128\255' .. sonarRadius) end - if jammingRadius > 0 then DrawText('Jam:' , '\255\255\77\77' .. jammingRadius) end - if sonarJammingRadius > 0 then DrawText('Sonar Jam:', '\255\255\77\77' .. sonarJammingRadius) end - if seismicRadius > 0 then DrawText('Seis:' , '\255\255\26\255' .. seismicRadius) end + DrawText('Los:', losRadius .. (airLosRadius > losRadius and format(' (AirLos: %d)', airLosRadius) or '')) - if uDef.stealth then DrawText("Other:", "Stealth") end + if radarRadius > 0 then DrawText('Radar:', '\255\77\255\77' .. radarRadius) end + if sonarRadius > 0 then DrawText('Sonar:', '\255\128\128\255' .. sonarRadius) end + if jammingRadius > 0 then DrawText('Jam:' , '\255\255\77\77' .. jammingRadius) end + if sonarJammingRadius > 0 then DrawText('Sonar Jam:', '\255\255\77\77' .. sonarJammingRadius) end + if seismicRadius > 0 then DrawText('Seis:' , '\255\255\26\255' .. seismicRadius) end - cY = cY - fontSize + if uDef.stealth then DrawText("Other:", "Stealth") end - local uExp = spGetUnitExperience(uID) - ------------------------------------------------------------------------------------ - -- Armor - ------------------------------------------------------------------------------------ + cY = cY - fontSize - DrawText("Armor:", "class " .. Game.armorTypes[uDef.armorType or 0] or '???') + local uExp = spGetUnitExperience(uID) + ------------------------------------------------------------------------------------ + -- Armor + ------------------------------------------------------------------------------------ - local maxHP = uDef.health - if ctrl then - maxHP = uMaxHp - end - if uExp ~= 0 then - DrawText("Exp:", format("+%d%% health", (uMaxHp/uDef.health-1)*100)) - end - DrawText("Open:", format("maxHP: %d", maxHP) ) - if uDef.armoredMultiple ~= 1 then DrawText("Closed:", format(" +%d%%, maxHP: %d", (1/uDef.armoredMultiple-1) *100,maxHP/uDef.armoredMultiple)) end + DrawText("Armor:", "class " .. Game.armorTypes[uDef.armorType or 0] or '???') - cY = cY - fontSize + local maxHP = uDef.health + if ctrl then + maxHP = uMaxHp + end + if uExp ~= 0 then + DrawText("Exp:", format("+%d%% health", (uMaxHp/uDef.health-1)*100)) + end + DrawText("Open:", format("maxHP: %d", maxHP) ) + if uDef.armoredMultiple ~= 1 then DrawText("Closed:", format(" +%d%%, maxHP: %d", (1/uDef.armoredMultiple-1) *100,maxHP/uDef.armoredMultiple)) end + + cY = cY - fontSize - ------------------------------------------------------------------------------------ - -- Weapons - ------------------------------------------------------------------------------------ - local wepCounts = {} -- wepCounts[wepDefID] = # - local wepsCompact = {} -- uWepsCompact[1..n] = wepDefID - - local uWeps = uDef.weapons - local weaponNums = {} - for i = 1, #uWeps do - local wDefID = uWeps[i].weaponDef - local wCount = wepCounts[wDefID] - if wCount then - wepCounts[wDefID] = wCount + 1 - else - wepCounts[wDefID] = 1 - wepsCompact[#wepsCompact + 1] = wDefID - weaponNums[#wepsCompact] = i + ------------------------------------------------------------------------------------ + -- Weapons + ------------------------------------------------------------------------------------ + local wepCounts = {} -- wepCounts[wepDefID] = # + local wepsCompact = {} -- uWepsCompact[1..n] = wepDefID + + local uWeps = uDef.weapons + local weaponNums = {} + for i = 1, #uWeps do + local wDefID = uWeps[i].weaponDef + local wCount = wepCounts[wDefID] + if wCount then + wepCounts[wDefID] = wCount + 1 + else + wepCounts[wDefID] = 1 + wepsCompact[#wepsCompact + 1] = wDefID + weaponNums[#wepsCompact] = i + end + end + local selfDWeaponID = WeaponDefNames[uDef.selfDExplosion].id + local deathWeaponID = WeaponDefNames[uDef.deathExplosion].id + local selfDWeaponIndex + local deathWeaponIndex + + if shift then + wepCounts = {} + wepsCompact = {} + wepCounts[selfDWeaponID] = 1 + wepCounts[deathWeaponID] = 1 + deathWeaponIndex = #wepsCompact+1 + wepsCompact[deathWeaponIndex] = deathWeaponID + selfDWeaponIndex = #wepsCompact+1 + wepsCompact[selfDWeaponIndex] = selfDWeaponID end - end - local selfDWeaponID = WeaponDefNames[uDef.selfDExplosion].id - local deathWeaponID = WeaponDefNames[uDef.deathExplosion].id - local selfDWeaponIndex - local deathWeaponIndex - - if shift then - wepCounts = {} - wepsCompact = {} - wepCounts[selfDWeaponID] = 1 - wepCounts[deathWeaponID] = 1 - deathWeaponIndex = #wepsCompact+1 - wepsCompact[deathWeaponIndex] = deathWeaponID - selfDWeaponIndex = #wepsCompact+1 - wepsCompact[selfDWeaponIndex] = selfDWeaponID - end - for i = 1, #wepsCompact do + for i = 1, #wepsCompact do - local wDefId = wepsCompact[i] - local uWep = wDefs[wDefId] + local wDefId = wepsCompact[i] + local uWep = wDefs[wDefId] - if uWep.range > 16 then - local oBurst = uWep.salvoSize * uWep.projectiles - local oRld = max(1/30,uWep.stockpile and uWep.stockpileTime or uWep.reload) - if useExp and not (uWep.stockpile and uWep.stockpileTime) then - oRld = spGetUnitWeaponState(uID,weaponNums[i] or -1,"reloadTime") or oRld - end - local wepCount = wepCounts[wDefId] - - local typeName = uWep.type - if i == deathWeaponIndex then - typeName = "Death explosion" - oRld = 1 - elseif i == selfDWeaponIndex then - typeName = "Self Destruct" - oRld = uDef.selfDCountdown + if uWep.range > 16 then + local oBurst = uWep.salvoSize * uWep.projectiles + local oRld = max(1/30,uWep.stockpile and uWep.stockpileTime or uWep.reload) + if uID and useExp and not uWep.stockpile and uWep.stockpileTime then + oRld = spGetUnitWeaponState(uID,weaponNums[i] or -1,"reloadTime") or oRld + end + local wepCount = wepCounts[wDefId] + + local typeName = uWep.type + if i == deathWeaponIndex then + typeName = "Death explosion" + oRld = 1 + elseif i == selfDWeaponIndex then + typeName = "Self Destruct" + oRld = uDef.selfDCountdown + end + if wepCount > 1 then + DrawText("Weap:", format(yellow .. "%dx" .. white .. " %s", wepCount, typeName)) + else + DrawText("Weap:", typeName) + end + local reload = spGetUnitWeaponState(uID,weaponNums[i] or -1,"reloadTime") or uWep.reload + local accuracy = spGetUnitWeaponState(uID,weaponNums[i] or -1,"accuracy") or uWep.accuracy + local moveError = spGetUnitWeaponState(uID,weaponNums[i] or -1,"targetMoveError") or uWep.targetMoveError + local reloadBonus = reload ~= 0 and (uWep.reload/reload-1) or 0 + local accuracyBonus = accuracy ~= 0 and (uWep.accuracy/accuracy-1) or 0 + local moveErrorBonus = moveError ~= 0 and (uWep.targetMoveError/moveError-1) or 0 + local range = spGetUnitWeaponState(uID,weaponNums[i] or -1,"range") or uWep.range + local rangeBonus = range ~= 0 and (range/uWep.range-1) or 0 + if uExp ~= 0 then + DrawText("Exp:", format("+%d%% accuracy, +%d%% aim, +%d%% firerate, +%d%% range", accuracyBonus*100, moveErrorBonus*100, reloadBonus*100, rangeBonus*100 )) + end + local infoText = format("%d range, %d aoe, %d%% edge", useExp and range or uWep.range, uWep.damageAreaOfEffect, 100 * uWep.edgeEffectiveness) + if uWep.damages.paralyzeDamageTime > 0 then + infoText = format("%s, %ds paralyze", infoText, uWep.damages.paralyzeDamageTime) + end + if uWep.damages.impulseBoost > 0 then + infoText = format("%s, %d impulse", infoText, uWep.damages.impulseBoost*100) + end + if uWep.damages.craterBoost > 0 then + infoText = format("%s, %d crater", infoText, uWep.damages.craterBoost*100) + end + DrawText("Info:", infoText) + + local defaultDamage = uWep.damages[0] + for cat=0, #uWep.damages do + local oDmg = uWep.damages[cat] + local catName = Game.armorTypes[cat] + if catName and oDmg and (oDmg ~= defaultDamage or cat == 0) then + local dmgString + if oBurst > 1 then + dmgString = format(yellow .. "%d (x%d)" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oBurst, oRld, oBurst * oDmg / oRld) + else + dmgString = format(yellow .. "%d" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oRld, oDmg / oRld) + end + + if wepCount > 1 then + dmgString = dmgString .. white .. " (Each)" + end + + dmgString = dmgString .. white .. " (" .. catName .. ")" + + DrawText("Dmg:", dmgString) + end + end + + if uWep.metalCost > 0 or uWep.energyCost > 0 then + + -- Stockpiling weapons are weird + -- They take the correct amount of resources overall + -- They take the correct amount of time + -- They drain ((simSpeed+2)/simSpeed) times more resources than they should (And the listed drain is real, having lower income than listed drain WILL stall you) + local drainAdjust = uWep.stockpile and (simSpeed+2)/simSpeed or 1 + + DrawText('Cost:', format(metalColor .. '%d' .. white .. ', ' .. + energyColor .. '%d' .. white .. ' = ' .. + metalColor .. '-%d' .. white .. ', ' .. + energyColor .. '-%d' .. white .. ' per second', + uWep.metalCost, + uWep.energyCost, + drainAdjust * uWep.metalCost / oRld, + drainAdjust * uWep.energyCost / oRld)) + end + + + cY = cY - fontSize end - if wepCount > 1 then - DrawText("Weap:", format(yellow .. "%dx" .. white .. " %s", wepCount, typeName)) + end + + + + else + + + + local uDef = uDefs[uDefID] + local uMaxHp = uDef.health + local uTeam = Spring.GetMyTeamID() + + maxWidth = 0 + + cX = mx + xOffset + cY = my + yOffset + cYstart = cY + + local text = yellow .. uDef.humanName .. white .. " " .. uDef.name .. " ("..GetTeamColorCode(uTeam) .. GetTeamName(uTeam) .. white .. ")" + + cY = cY - 2 * fontSize + textBuffer = {} + textBufferCount = 0 + + ------------------------------------------------------------------------------------ + -- Units under construction + ------------------------------------------------------------------------------------ + if buildProg and buildProg < 1 then + + local myTeamID = spGetMyTeamID() + local mCur, mStor, mPull, mInc, mExp, mShare, mSent, mRec = spGetTeamResources(myTeamID, 'metal') + local eCur, eStor, ePull, eInc, eExp, eShare, eSent, eRec = spGetTeamResources(myTeamID, 'energy') + + local mTotal = uDef.metalCost + local eTotal = uDef.energyCost + local buildRem = 1 - buildProg + local mRem = mTotal * buildRem + local eRem = eTotal * buildRem + local mEta = (mRem - mCur) / (mInc + mRec) + local eEta = (eRem - eCur) / (eInc + eRec) + + DrawText("Prog:", format("%d%%", 100 * buildProg)) + DrawText("Metal:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", mTotal * buildProg, mTotal, mRem, mEta)) + DrawText("Energy:", format("%d / %d (" .. yellow .. "%d" .. white .. ", %ds)", eTotal * buildProg, eTotal, eRem, eEta)) + --DrawText("MaxBP:", format(white .. '%d', buildRem * uDef.buildTime / math.max(mEta, eEta))) + cY = cY - fontSize + end + + ------------------------------------------------------------------------------------ + -- Generic information, cost, move, class + ------------------------------------------------------------------------------------ + + --DrawText('Height:', uDefs[spGetUnitDefID(uID)].height) + + DrawText("Cost:", format(metalColor .. '%d' .. white .. ' / ' .. + energyColor .. '%d' .. white .. ' / ' .. + buildColor .. '%d', uDef.metalCost, uDef.energyCost, uDef.buildTime) + ) + + if not (uDef.isBuilding or uDef.isFactory) then + DrawText("Move:", format("%.1f / %.1f / %.0f (Speed / Accel / Turn)", uDef.speed, 900 * uDef.maxAcc, simSpeed * uDef.turnRate * (180 / 32767))) + end + + + + if uDef.buildSpeed > 0 then DrawText('Build:', yellow .. uDef.buildSpeed) end + + cY = cY - fontSize + + ------------------------------------------------------------------------------------ + -- Sensors and Jamming + ------------------------------------------------------------------------------------ + local losRadius = uDef.losRadius + local airLosRadius = uDef.airLosRadius + local radarRadius = uDef.radarRadius + local sonarRadius = uDef.sonarRadius + local jammingRadius = uDef.jammerRadius + local sonarJammingRadius = uDef.sonarJamRadius + local seismicRadius = uDef.seismicRadius + + DrawText('Los:', losRadius .. (airLosRadius > losRadius and format(' (AirLos: %d)', airLosRadius) or '')) + + if radarRadius > 0 then DrawText('Radar:', '\255\77\255\77' .. radarRadius) end + if sonarRadius > 0 then DrawText('Sonar:', '\255\128\128\255' .. sonarRadius) end + if jammingRadius > 0 then DrawText('Jam:' , '\255\255\77\77' .. jammingRadius) end + if sonarJammingRadius > 0 then DrawText('Sonar Jam:', '\255\255\77\77' .. sonarJammingRadius) end + if seismicRadius > 0 then DrawText('Seis:' , '\255\255\26\255' .. seismicRadius) end + + if uDef.stealth then DrawText("Other:", "Stealth") end + + cY = cY - fontSize + + ------------------------------------------------------------------------------------ + -- Armor + ------------------------------------------------------------------------------------ + + DrawText("Armor:", "class " .. Game.armorTypes[uDef.armorType or 0] or '???') + + local maxHP = uDef.health + if ctrl then + maxHP = uMaxHp + end + DrawText("Open:", format("maxHP: %d", maxHP) ) + if uDef.armoredMultiple ~= 1 then DrawText("Closed:", format(" +%d%%, maxHP: %d", (1/uDef.armoredMultiple-1) *100,maxHP/uDef.armoredMultiple)) end + + cY = cY - fontSize + + ------------------------------------------------------------------------------------ + -- Weapons + ------------------------------------------------------------------------------------ + local wepCounts = {} -- wepCounts[wepDefID] = # + local wepsCompact = {} -- uWepsCompact[1..n] = wepDefID + + local uWeps = uDef.weapons + local weaponNums = {} + for i = 1, #uWeps do + local wDefID = uWeps[i].weaponDef + local wCount = wepCounts[wDefID] + if wCount then + wepCounts[wDefID] = wCount + 1 else - DrawText("Weap:", typeName) - end - local reload = spGetUnitWeaponState(uID,weaponNums[i] or -1,"reloadTime") or uWep.reload - local accuracy = spGetUnitWeaponState(uID,weaponNums[i] or -1,"accuracy") or uWep.accuracy - local moveError = spGetUnitWeaponState(uID,weaponNums[i] or -1,"targetMoveError") or uWep.targetMoveError - local reloadBonus = reload ~= 0 and (uWep.reload/reload-1) or 0 - local accuracyBonus = accuracy ~= 0 and (uWep.accuracy/accuracy-1) or 0 - local moveErrorBonus = moveError ~= 0 and (uWep.targetMoveError/moveError-1) or 0 - local range = spGetUnitWeaponState(uID,weaponNums[i] or -1,"range") or uWep.range - local rangeBonus = range ~= 0 and (range/uWep.range-1) or 0 - if uExp ~= 0 then - DrawText("Exp:", format("+%d%% accuracy, +%d%% aim, +%d%% firerate, +%d%% range", accuracyBonus*100, moveErrorBonus*100, reloadBonus*100, rangeBonus*100 )) + wepCounts[wDefID] = 1 + wepsCompact[#wepsCompact + 1] = wDefID + weaponNums[#wepsCompact] = i end - local infoText = format("%d range, %d aoe, %d%% edge", useExp and range or uWep.range, uWep.damageAreaOfEffect, 100 * uWep.edgeEffectiveness) - if uWep.damages.paralyzeDamageTime > 0 then - infoText = format("%s, %ds paralyze", infoText, uWep.damages.paralyzeDamageTime) - end - if uWep.damages.impulseBoost > 0 then - infoText = format("%s, %d impulse", infoText, uWep.damages.impulseBoost*100) - end - if uWep.damages.craterBoost > 0 then - infoText = format("%s, %d crater", infoText, uWep.damages.craterBoost*100) - end - DrawText("Info:", infoText) - - local defaultDamage = uWep.damages[0] - for cat=0, #uWep.damages do - local oDmg = uWep.damages[cat] - local catName = Game.armorTypes[cat] - if catName and oDmg and (oDmg ~= defaultDamage or cat == 0) then - local dmgString - if oBurst > 1 then - dmgString = format(yellow .. "%d (x%d)" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oBurst, oRld, oBurst * oDmg / oRld) - else - dmgString = format(yellow .. "%d" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oRld, oDmg / oRld) - end + end + local selfDWeaponID = WeaponDefNames[uDef.selfDExplosion].id + local deathWeaponID = WeaponDefNames[uDef.deathExplosion].id + local selfDWeaponIndex + local deathWeaponIndex + + if shift then + wepCounts = {} + wepsCompact = {} + wepCounts[selfDWeaponID] = 1 + wepCounts[deathWeaponID] = 1 + deathWeaponIndex = #wepsCompact+1 + wepsCompact[deathWeaponIndex] = deathWeaponID + selfDWeaponIndex = #wepsCompact+1 + wepsCompact[selfDWeaponIndex] = selfDWeaponID + end - if wepCount > 1 then - dmgString = dmgString .. white .. " (Each)" - end + for i = 1, #wepsCompact do + + local wDefId = wepsCompact[i] + local uWep = wDefs[wDefId] - dmgString = dmgString .. white .. " (" .. catName .. ")" + if uWep.range > 16 then + local oBurst = uWep.salvoSize * uWep.projectiles + local oRld = max(0.00000000001,uWep.stockpile == true and uWep.stockpileTime/30 or uWep.reload) + local wepCount = wepCounts[wDefId] - DrawText("Dmg:", dmgString) + local typeName = uWep.type + if i == deathWeaponIndex then + typeName = "Death explosion" + oRld = 1 + elseif i == selfDWeaponIndex then + typeName = "Self Destruct" + oRld = uDef.selfDCountdown + end + if wepCount > 1 then + DrawText("Weap:", format(yellow .. "%dx" .. white .. " %s", wepCount, typeName)) + else + DrawText("Weap:", typeName) + end + local reload = uWep.reload + local accuracy = uWep.accuracy + local moveError = uWep.targetMoveError + local range = uWep.range + local reloadBonus = reload ~= 0 and (uWep.reload/reload-1) or 0 + local accuracyBonus = accuracy ~= 0 and (uWep.accuracy/accuracy-1) or 0 + local moveErrorBonus = moveError ~= 0 and (uWep.targetMoveError/moveError-1) or 0 + local rangeBonus = range ~= 0 and (range/uWep.range-1) or 0 + local infoText = format("%d range, %d aoe, %d%% edge", useExp and range or uWep.range, uWep.damageAreaOfEffect, 100 * uWep.edgeEffectiveness) + if uWep.damages.paralyzeDamageTime > 0 then + infoText = format("%s, %ds paralyze", infoText, uWep.damages.paralyzeDamageTime) + end + if uWep.damages.impulseBoost > 0 then + infoText = format("%s, %d impulse", infoText, uWep.damages.impulseBoost*100) + end + if uWep.damages.craterBoost > 0 then + infoText = format("%s, %d crater", infoText, uWep.damages.craterBoost*100) + end + DrawText("Info:", infoText) + + local defaultDamage = uWep.damages[0] + for cat=0, #uWep.damages do + local oDmg = uWep.damages[cat] + local catName = Game.armorTypes[cat] + if catName and oDmg and (oDmg ~= defaultDamage or cat == 0) then + local dmgString + if oBurst > 1 then + dmgString = format(yellow .. "%d (x%d)" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oBurst, oRld, oBurst * oDmg / oRld) + else + dmgString = format(yellow .. "%d" .. white .. " / " .. yellow .. "%.2f\s" .. white .. " = " .. yellow .. "%.2f \d\p\s", oDmg, oRld, oDmg / oRld) + end + + if wepCount > 1 then + dmgString = dmgString .. white .. " (Each)" + end + + dmgString = dmgString .. white .. " (" .. catName .. ")" + + DrawText("Dmg:", dmgString) + end end - end - if uWep.metalCost > 0 or uWep.energyCost > 0 then - - -- Stockpiling weapons are weird - -- They take the correct amount of resources overall - -- They take the correct amount of time - -- They drain ((simSpeed+2)/simSpeed) times more resources than they should (And the listed drain is real, having lower income than listed drain WILL stall you) - local drainAdjust = uWep.stockpile and (simSpeed+2)/simSpeed or 1 - - DrawText('Cost:', format(metalColor .. '%d' .. white .. ', ' .. - energyColor .. '%d' .. white .. ' = ' .. - metalColor .. '-%d' .. white .. ', ' .. - energyColor .. '-%d' .. white .. ' per second', - uWep.metalCost, - uWep.energyCost, - drainAdjust * uWep.metalCost / oRld, - drainAdjust * uWep.energyCost / oRld)) + if uWep.metalCost > 0 or uWep.energyCost > 0 then + + -- Stockpiling weapons are weird + -- They take the correct amount of resources overall + -- They take the correct amount of time + -- They drain ((simSpeed+2)/simSpeed) times more resources than they should (And the listed drain is real, having lower income than listed drain WILL stall you) + local drainAdjust = uWep.stockpile and (simSpeed+2)/simSpeed or 1 + + DrawText('Cost:', format(metalColor .. '%d' .. white .. ', ' .. + energyColor .. '%d' .. white .. ' = ' .. + metalColor .. '-%d' .. white .. ', ' .. + energyColor .. '-%d' .. white .. ' per second', + uWep.metalCost, + uWep.energyCost, + drainAdjust * uWep.metalCost / oRld, + drainAdjust * uWep.energyCost / oRld)) + end + + + cY = cY - fontSize end - - - cY = cY - fontSize end end - + -- background - glColor(0,0,0,0.57) + if WG.hoverID ~= nil then + glColor(0.11,0.11,0.11,0.9) + else + glColor(0,0,0,0.66) + end + + -- correct position when it goes below screen + if cY < 0 then + cYstart = cYstart - cY + local num = #textBuffer + for i=1, num do + textBuffer[i][4] = textBuffer[i][4] - (cY/2) + textBuffer[i][4] = textBuffer[i][4] - (cY/2) + end + cY = 0 + end + -- correct position when it goes off screen + if cX + maxWidth+bgpadding+bgpadding > vsx then + local cXnew = vsx-maxWidth-bgpadding-bgpadding + local num = #textBuffer + for i=1, num do + textBuffer[i][3] = textBuffer[i][3] - ((cX-cXnew)/2) + textBuffer[i][3] = textBuffer[i][3] - ((cX-cXnew)/2) + end + cX = cXnew + end + + -- title + local text = "\255\190\255\190" .. uDef.humanName + if uID then + text = text .. " " .. grey .. uDef.name .. " #" .. uID .. " "..GetTeamColorCode(uTeam) .. GetTeamName(uTeam) + end + local iconHalfSize = titleFontSize*0.75 + if not uID then + iconHalfSize = -bgpadding/2.5 + end cornersize = 0 - RectRound(floor(cX-bgpadding)+cornersize, ceil(cY+(fontSize/3)+bgpadding)+cornersize, ceil(cX+maxWidth+bgpadding)-cornersize, floor(cYstart-bgpadding)-cornersize, bgcornerSize) - cornersize = ceil(bgpadding*0.16) - glColor(1,1,1,0.017) - RectRound(floor(cX-bgpadding)+cornersize, ceil(cY+(fontSize/3)+bgpadding)+cornersize, ceil(cX+maxWidth+bgpadding)-cornersize, floor(cYstart-bgpadding)-cornersize, bgcornerSize) + if not uID then + glColor(0.1,0.1,0.1,(WG['guishader'] and 0.8 or 0.88)) + else + glColor(0,0,0,(WG['guishader'] and 0.7 or 0.75)) + end + RectRound(cX-bgpadding+cornersize, cYstart-bgpadding+cornersize, cX+(font:GetTextWidth(text)*titleFontSize)+iconHalfSize+iconHalfSize+bgpadding+(bgpadding/1.5)-cornersize, cYstart+(titleFontSize/2)+bgpadding-cornersize, bgcornerSize) + + if WG['guishader'] then + guishaderEnabled = true + WG['guishader'].InsertScreenDlist( gl.CreateList( function() + RectRound(cX-bgpadding+cornersize, cYstart-bgpadding+cornersize, cX+(font:GetTextWidth(text)*titleFontSize)+iconHalfSize+iconHalfSize+bgpadding+(bgpadding/1.5)-cornersize, cYstart+(titleFontSize/2)+bgpadding-cornersize, bgcornerSize) + end), 'unit_stats_title') + end + + cornersize = ceil(bgpadding*0.25) + glColor(1,1,1,0.023) + RectRound(cX-bgpadding+cornersize, cYstart-bgpadding+cornersize, cX+(font:GetTextWidth(text)*titleFontSize)+iconHalfSize+iconHalfSize+bgpadding+(bgpadding/1.5)-cornersize, cYstart+(titleFontSize/2)+bgpadding-cornersize, bgcornerSize*0.88) - DrawTextBuffer() - if (WG['guishader_api'] ~= nil) then + -- icon + if uID then + glColor(1,1,1,1) + glTexture('#' .. uDefID) + glTexRect(cX, cYstart+cornersize-iconHalfSize, cX+iconHalfSize+iconHalfSize, cYstart+cornersize+iconHalfSize) + glTexture(false) + end + + -- title text + glColor(1,1,1,1) + font:Begin() + font:Print(text, cX+iconHalfSize+iconHalfSize+(bgpadding/1.5), cYstart, titleFontSize, "o") + font:End() + + -- stats + cornersize = 0 + if not uID then + glColor(0.1,0.1,0.1,(WG['guishader'] and 0.8 or 0.88)) + else + glColor(0,0,0,(WG['guishader'] and 0.7 or 0.75)) + end + RectRound(floor(cX-bgpadding)+cornersize, ceil(cY+(fontSize/3)+bgpadding)+cornersize, ceil(cX+maxWidth+bgpadding)-cornersize, floor(cYstart-bgpadding)-cornersize, bgcornerSize) + + if WG['guishader'] then guishaderEnabled = true - WG['guishader_api'].InsertRect(cX-bgpadding, cY+(fontSize/3)+bgpadding, cX+maxWidth+bgpadding, cYstart-bgpadding, 'unit_stats_data') + WG['guishader'].InsertScreenDlist( gl.CreateList( function() + RectRound(floor(cX-bgpadding)+cornersize, ceil(cY+(fontSize/3)+bgpadding)+cornersize, ceil(cX+maxWidth+bgpadding)-cornersize, floor(cYstart-bgpadding)-cornersize, bgcornerSize) + end), 'unit_stats_data') end -end + cornersize = ceil(bgpadding*0.23) + glColor(1,1,1,0.025) + RectRound(floor(cX-bgpadding)+cornersize, ceil(cY+(fontSize/3)+bgpadding)+cornersize, ceil(cX+maxWidth+bgpadding)-cornersize, floor(cYstart-bgpadding)-cornersize, bgcornerSize*0.88) + + DrawTextBuffer() + +end ------------------------------------------------------------------------------------ diff --git a/LuaUI/Widgets_Evo/gui_vote_interface.lua b/LuaUI/Widgets_Evo/gui_vote_interface.lua new file mode 100644 index 000000000..cfc6dfb45 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_vote_interface.lua @@ -0,0 +1,386 @@ +function widget:GetInfo() + return { + name = "Vote interface", + desc = "", + author = "Floris", + date = "July 2018", + license = "", + layer = -2000, + enabled = true, + } +end + +local vsx, vsy = gl.GetViewSizes() +local customScale = 1.5 +local widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + +local bgcorner = "LuaUI/Images/bgcorner.png" + +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +-- being set at gamestart again: +local myPlayerID = Spring.GetMyPlayerID() +local myName,_,mySpec,myTeamID,myAllyTeamID = Spring.GetPlayerInfo(myPlayerID,false) +local startedAsPlayer = not mycSpec + +local function DrawRectRound(px,py,sx,sy,cs) + + local csx = cs + local csy = cs + if sx-px < (cs*2) then + csx = (sx-px)/2 + if csx < 0 then csx = 0 end + end + if sy-py < (cs*2) then + csy = (sy-py)/2 + if csy < 0 then csy = 0 end + end + cs = math.min(csx, csy) + + gl.TexCoord(0.8,0.8) + gl.Vertex(px+cs, py, 0) + gl.Vertex(sx-cs, py, 0) + gl.Vertex(sx-cs, sy, 0) + gl.Vertex(px+cs, sy, 0) + + gl.Vertex(px, py+cs, 0) + gl.Vertex(px+cs, py+cs, 0) + gl.Vertex(px+cs, sy-cs, 0) + gl.Vertex(px, sy-cs, 0) + + gl.Vertex(sx, py+cs, 0) + gl.Vertex(sx-cs, py+cs, 0) + gl.Vertex(sx-cs, sy-cs, 0) + gl.Vertex(sx, sy-cs, 0) + + local offset = 0.05 -- texture offset, because else gaps could show + local o = offset + + -- top left + if py <= 0 or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, py+cs, 0) + -- top right + if py <= 0 or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, py, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, py, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, py+cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, py+cs, 0) + -- bottom left + if sy >= vsy or px <= 0 then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(px, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(px+cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(px+cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(px, sy-cs, 0) + -- bottom right + if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end + gl.TexCoord(o,o) + gl.Vertex(sx, sy, 0) + gl.TexCoord(o,1-offset) + gl.Vertex(sx-cs, sy, 0) + gl.TexCoord(1-offset,1-offset) + gl.Vertex(sx-cs, sy-cs, 0) + gl.TexCoord(1-offset,o) + gl.Vertex(sx, sy-cs, 0) +end + +function RectRound(px,py,sx,sy,cs) + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY +end + +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) * customScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + gl.DeleteFont(font2) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:PlayerChanged(playerID) + mySpec = Spring.GetSpectatingState() +end + +--local sec = 0 +--function widget:Update(dt) +-- myName,_,mySpec,myTeamID,myAllyTeamID = Spring.GetPlayerInfo(1,false) +-- sec = sec + dt +-- if sec > 2 and not voteDlist then +-- StartVote('testvote yeah!', 'somebody') +-- end +--end + +function widget:Initialize() + if Spring.IsReplay() then + widgetHandler:RemoveWidget(self) + end +end + +function widget:GameFrame(n) + if n > 0 and not gameStarted then + gameStarted = true + myPlayerID = Spring.GetMyPlayerID() + myName,_,mySpec,myTeamID,myAllyTeamID = Spring.GetPlayerInfo(myPlayerID,false) + startedAsPlayer = not mySpec + end +end + +function isTeamPlayer(playerName) + local players = Spring.GetPlayerList() + for _,pID in ipairs(players) do + local name,_,spec,teamID,allyTeamID = Spring.GetPlayerInfo(pID,false) + if name == playerName then + if allyTeamID == myAllyTeamID then + return true + end + end + end + return false +end + +function widget:AddConsoleLine(lines, priority) + if startedAsPlayer and (not WG['topbar'] or (WG['topbar'] and WG['topbar'].showingRejoining and not WG['topbar'].showingRejoining())) then + lines = lines:match('^\[f=[0-9]+\] (.*)$') or lines + for line in lines:gmatch("[^\n]+") do + if (string.sub(line,1,1) == ">" and string.sub(line,3,3) ~= "<") then -- system message + if string.find(line," called a vote ") then -- vote called + local title = string.sub(line,string.find(line,' "')+2, string.find(line,'" ')-1)..'?' + title = title:sub(1,1):upper()..title:sub(2) + if not string.find(line,"\"resign ") or isTeamPlayer(string.sub(line,string.find(line,'"resign ')+8, string.find(line,' TEAM')-1)) then + StartVote(title, string.find(line, string.gsub(myName, "%p", "%%%1").." called a vote ")) + end + elseif voteDlist and (string.find(line," passed.") or string.find(line," failed") or string.find(line,"Vote cancelled") or string.find(line," cancelling \"")) then + EndVote() + end + end + end + end +end + +function EndVote() + if voteDlist then + gl.DeleteList(voteDlist) + voteDlist = nil + voteName = nil + voteOwner = nil + if WG['guishader'] then + WG['guishader'].DeleteDlist('voteinterface') + end + end +end + +function StartVote(name, owner) + if voteDlist then + gl.DeleteList(voteDlist) + end + if owner then + voteOwner = owner + end + voteDlist = gl.CreateList(function() + if name then + voteName = name + end + + local x,y,b = Spring.GetMouseState() + + local width = vsx/6.2 + local height = vsy/13 + + local fontSize = height/5 -- title only + local minWidth = font:GetTextWidth(' '..voteName..' ')*fontSize + if width < minWidth then + width = minWidth + end + + local padding = width/70 + local buttonPadding = width/100 + local buttonMargin = width/32 + local buttonHeight = height*0.55 + + local xpos = width/2 + local ypos = vsy-(height/2) + + if WG['topbar'] ~= nil then + local topbarArea = WG['topbar'].GetPosition() + --xpos = vsx-(width/2) + xpos = topbarArea[1] + (width/2) + ((vsx-topbarArea[1])/1.95) + ypos = topbarArea[6]-(5*topbarArea[5])-(height/2) + end + + hovered = nil + + windowArea = {xpos-(width/2), ypos-(height/2), xpos+(width/2), ypos+(height/2) } + closeButtonArea = {(xpos+(width/2))-(height/1.9), ypos+(height/5.5), xpos+(width/2), ypos+(height/2) } + yesButtonArea = {xpos-(width/2)+buttonMargin, ypos-(height/2)+buttonMargin, xpos-(buttonMargin/2), ypos-(height/2)+buttonHeight-buttonMargin } + noButtonArea = {xpos+(buttonMargin/2), ypos-(height/2)+buttonMargin, xpos+(width/2)-buttonMargin, ypos-(height/2)+buttonHeight-buttonMargin} + + -- window + gl.Color(0,0,0,0.82) + RectRound(windowArea[1], windowArea[2], windowArea[3], windowArea[4], 5.5*widgetScale) + gl.Color(1,1,1,0.05) + RectRound(windowArea[1]+padding, windowArea[2]+padding, windowArea[3]-padding, windowArea[4]-padding, 5*widgetScale) + + -- close + --gl.Color(0.1,0.1,0.1,0.55+(0.36)) + --RectRound(closeButtonArea[1], closeButtonArea[2], closeButtonArea[3], closeButtonArea[4], 3.5*widgetScale) + if IsOnRect(x, y, closeButtonArea[1], closeButtonArea[2], closeButtonArea[3], closeButtonArea[4]) then + hovered = 'esc' + gl.Color(1,1,1,0.55) + else + gl.Color(1,1,1,0.027) + end + RectRound(closeButtonArea[1]+padding, closeButtonArea[2]+padding, closeButtonArea[3]-padding, closeButtonArea[4]-padding, 3*widgetScale) + + fontSize = fontSize*0.85 + gl.Color(0,0,0,1) + + -- vote name + font:Begin() + font:Print("\255\190\190\190"..voteName, windowArea[1]+((windowArea[3]-windowArea[1])/2), windowArea[4]-padding-padding-padding-fontSize, fontSize, "con") + font:End() + + font2:Begin() + -- ESC + font2:Print("\255\0\0\0ESC", closeButtonArea[1]+((closeButtonArea[3]-closeButtonArea[1])/2), closeButtonArea[2]+((closeButtonArea[4]-closeButtonArea[2])/2)-(fontSize/3), fontSize, "cn") + + -- NO + if IsOnRect(x, y, noButtonArea[1], noButtonArea[2], noButtonArea[3], noButtonArea[4]) then + hovered = 'n' + gl.Color(0.7,0.1,0.1,0.8) + else + gl.Color(0.5,0,0,0.7) + end + RectRound(noButtonArea[1], noButtonArea[2], noButtonArea[3], noButtonArea[4], 5*widgetScale) + gl.Color(0,0,0,0.075) + RectRound(noButtonArea[1]+buttonPadding, noButtonArea[2]+buttonPadding, noButtonArea[3]-buttonPadding, noButtonArea[4]-buttonPadding, 4*widgetScale) + + fontSize = fontSize*0.85 + local noText = 'NO' + if voteOwner then + noText = 'End Vote' + end + font2:SetOutlineColor(0,0,0,0.4) + font2:Print(noText, noButtonArea[1]+((noButtonArea[3]-noButtonArea[1])/2), noButtonArea[2]+((noButtonArea[4]-noButtonArea[2])/2)-(fontSize/3), fontSize, "con") + + -- YES + if not voteOwner then + if IsOnRect(x, y, yesButtonArea[1], yesButtonArea[2], yesButtonArea[3], yesButtonArea[4]) then + hovered = 'y' + gl.Color(0.05,0.6,0.05,0.8) + else + gl.Color(0,0.5,0,0.35) + end + RectRound(yesButtonArea[1], yesButtonArea[2], yesButtonArea[3], yesButtonArea[4], 5*widgetScale) + gl.Color(0,0,0,0.075) + RectRound(yesButtonArea[1]+buttonPadding, yesButtonArea[2]+buttonPadding, yesButtonArea[3]-buttonPadding, yesButtonArea[4]-buttonPadding, 4*widgetScale) + + font2:Print("YES", yesButtonArea[1]+((yesButtonArea[3]-yesButtonArea[1])/2), yesButtonArea[2]+((yesButtonArea[4]-yesButtonArea[2])/2)-(fontSize/3), fontSize, "con") + end + font2:End() + end) + -- background blur + if WG['guishader'] then + dlistGuishader = gl.CreateList( function() + RectRound(windowArea[1],windowArea[2],windowArea[3],windowArea[4], 5.5*widgetScale) + end) + WG['guishader'].InsertDlist(dlistGuishader, 'voteinterface') + end +end + +function widget:KeyPress(key) + if key == 27 and voteDlist then -- ESC + if not voteOwner then + Spring.SendCommands("say !vote b") + end + EndVote() + end +end + +function widget:MousePress(x, y, button) + if voteDlist and button == 1 then + if IsOnRect(x, y, windowArea[1], windowArea[2], windowArea[3], windowArea[4]) then + if not voteOwner and IsOnRect(x, y, yesButtonArea[1], yesButtonArea[2], yesButtonArea[3], yesButtonArea[4]) then + Spring.SendCommands("say !vote y") + EndVote() + elseif IsOnRect(x, y, noButtonArea[1], noButtonArea[2], noButtonArea[3], noButtonArea[4]) then + if voteOwner then + Spring.SendCommands("say !endvote") + else + Spring.SendCommands("say !vote n") + end + EndVote() + elseif IsOnRect(x, y, closeButtonArea[1], closeButtonArea[2], closeButtonArea[3], closeButtonArea[4]) then + Spring.SendCommands("say !vote b") + EndVote() + end + return true + end + end +end + +function widget:Shutdown() + gl.DeleteFont(font) + EndVote() +end + +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + +function widget:DrawScreen() + if chobbyInterface then return end + if voteDlist then + local x,y,b = Spring.GetMouseState() + if (not WG['topbar'] or not WG['topbar'].showingQuit()) then + if IsOnRect(x, y, windowArea[1], windowArea[2], windowArea[3], windowArea[4]) then + if (not voteOwner and IsOnRect(x, y, yesButtonArea[1], yesButtonArea[2], yesButtonArea[3], yesButtonArea[4])) or + IsOnRect(x, y, noButtonArea[1], noButtonArea[2], noButtonArea[3], noButtonArea[4]) or + IsOnRect(x, y, closeButtonArea[1], closeButtonArea[2], closeButtonArea[3], closeButtonArea[4]) + then + StartVote() + elseif hovered then + StartVote() + end + elseif hovered then + StartVote() + end + end + gl.CallList(voteDlist) + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_widget_selector.lua b/LuaUI/Widgets_Evo/gui_widget_selector.lua index 646ec52a4..5be0e4f46 100644 --- a/LuaUI/Widgets_Evo/gui_widget_selector.lua +++ b/LuaUI/Widgets_Evo/gui_widget_selector.lua @@ -35,10 +35,17 @@ end -- relies on a gadget to implement "luarules reloadluaui" -- relies on custom stuff in widgetHandler to implement blankOutConfig and allowUserWidgets -include("colors.h.lua") include("keysym.h.lua") include("fonts.lua") +local WhiteStr = "\255\255\255\255" +local RedStr = "\255\255\001\001" +local GreenStr = "\255\001\255\001" +local BlueStr = "\255\001\001\255" +local CyanStr = "\255\001\255\255" +local YellowStr = "\255\255\255\001" +local MagentaStr = "\255\255\001\255" + local cutomScale = 1 local sizeMultiplier = 1 @@ -49,24 +56,28 @@ local fullWidgetsList = {} local vsx, vsy = widgetHandler:GetViewSizes() -local minMaxEntries = 15 +local minMaxEntries = 15 local curMaxEntries = 25 local startEntry = 1 local pageStep = math.floor(curMaxEntries / 2) - 1 -local fontSize = 12 -local fontSpace = 7 +local fontSize = 13.5 +local fontSpace = 8.5 local yStep = fontSize + fontSpace +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) -local entryFont = "LuaUI/Fonts/FreeMonoBold_12" -local headerFont = "LuaUI/Fonts/FreeMonoBold_12" -entryFont = ":n:" .. entryFont -headerFont = ":n:" .. headerFont - -local bgPadding = 6 -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local bgPadding = 5.5 +local bgcorner = "LuaUI/Images/bgcorner.png" local maxWidth = 0.01 local borderx = yStep * 0.75 @@ -94,29 +105,40 @@ local show = false local pagestepped = false - local buttons = { --see MouseRelease for which functions are called by which buttons - [1] = "Reload LuaUI", - [2] = "Unload ALL Widgets (DO NOT CLICK THIS)", - [3] = "Allow/Disallow User Widgets (DO NOT CLICK THIS)", + [1] = "Reload LuaUI", + [2] = "Unload ALL Widgets", + [3] = "Allow/Disallow User Widgets", [4] = "Reset LuaUI", [5] = "Factory Reset LuaUI", } -local titleFontSize = 16 -local buttonFontSize = 14 -local buttonHeight = 20 -local buttonTop = 20 -- offset between top of buttons and bottom of widget + +local allowuserwidgets = true +if Spring.GetModOptions and (tonumber(Spring.GetModOptions().allowuserwidgets) or 1) == 0 then + allowuserwidgets = false + buttons[3] = '' +end + +local titleFontSize = 20 +local buttonFontSize = 15 +local buttonHeight = 24 +local buttonTop = 28 -- offset between top of buttons and bottom of widget ------------------------------------------------------------------------------- function widget:Initialize() widgetHandler.knownChanged = true Spring.SendCommands('unbindkeyset f11') - - if widgetHandler.allowUserWidgets then - buttons[3] = "Disallow User Widgets" - else - buttons[3] = "Allow User Widgets" + + if allowuserwidgets then + if widgetHandler.allowUserWidgets then + buttons[3] = "Disallow User Widgets" + else + buttons[3] = "Allow User Widgets" + end + end + if Spring.GetGameFrame() <= 0 then + Spring.SendLuaRulesMsg('xmas'..((os.date("%m") == "12" and os.date("%d") >= "17") and '1' or '0')) end end @@ -147,41 +169,41 @@ local function DrawRectRound(px,py,sx,sy,cs) if py <= 0 or px <= 0 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) -- top right if py <= 0 or sx >= vsx then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) -- bottom left if sy >= vsy or px <= 0 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, sy-cs, 0) -- bottom right if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end @@ -284,9 +306,9 @@ local function UpdateList() widgetsList = {} for name,data in pairs(widgetHandler.knownWidgets) do if (name ~= myName) then - table.insert(fullWidgetsList, { name, data }) + fullWidgetsList[#fullWidgetsList+1] = { name, data } -- look for the maxWidth - local width = fontSize * gl.GetTextWidth(name) + local width = fontSize * font:GetTextWidth(name) if (width > maxWidth) then maxWidth = width end @@ -307,9 +329,12 @@ local function UpdateList() end -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + widgetScale = (0.5 + (vsx*vsy / 5700000)) + local fontfileScale = widgetScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) if customScale == nil then customScale = 1 @@ -341,29 +366,41 @@ function widget:KeyPress(key, mods, isRepeat) end local activeGuishader = false local scrollbarOffset = -15 +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if not show then - if activeGuishader and (WG['guishader_api'] ~= nil) then + if activeGuishader and (WG['guishader']) then activeGuishader = false - WG['guishader_api'].RemoveRect('widgetselector') + WG['guishader'].DeleteDlist('widgetselector') end return end UpdateList() - gl.BeginText() - if (WG['guishader_api'] == nil) then + if (WG['guishader'] == nil) then activeGuishader = false end - if (WG['guishader_api'] ~= nil) and not activeGuishader then + if (WG['guishader']) and not activeGuishader then activeGuishader = true - WG['guishader_api'].InsertRect(minx-(bgPadding*sizeMultiplier), miny-(bgPadding*sizeMultiplier), maxx+(bgPadding*sizeMultiplier), maxy+(bgPadding*sizeMultiplier),'widgetselector') + dlistGuishader = gl.CreateList( function() + RectRound(minx-(bgPadding*sizeMultiplier), miny-(bgPadding*sizeMultiplier), maxx+(bgPadding*sizeMultiplier), maxy+(bgPadding*sizeMultiplier), 8*sizeMultiplier) + end) + WG['guishader'].InsertDlist(dlistGuishader, 'widgetselector') end borderx = (yStep*sizeMultiplier) * 0.75 bordery = (yStep*sizeMultiplier) * 0.75 -- draw the header - gl.Text("Widget Selector", midx, maxy + ((8 + bgPadding)*sizeMultiplier), titleFontSize*sizeMultiplier, "oc") - + font2:Begin() + font2:Print("Widget Selector", midx, maxy + ((11 + bgPadding)*sizeMultiplier), titleFontSize*sizeMultiplier, "oc") + font2:End() + + font:Begin() local mx,my,lmb,mmb,rmb = Spring.GetMouseState() local tcol = WhiteStr @@ -371,16 +408,20 @@ function widget:DrawScreen() if maxx-10 < mx and mx < maxx and maxy < my and my < maxy + ((buttonFontSize + 7)*sizeMultiplier) then tcol = '\255\031\031\031' end - gl.Text(tcol.."+", maxx, maxy + ((7 + bgPadding)*sizeMultiplier), buttonFontSize*sizeMultiplier, "or") + font:Print(tcol.."+", maxx, maxy + ((7 + bgPadding)*sizeMultiplier), buttonFontSize*sizeMultiplier, "or") tcol = WhiteStr if minx < mx and mx < minx+10 and maxy < my and my < maxy + ((buttonFontSize + 7)*sizeMultiplier) then tcol = '\255\031\031\031' end - gl.Text(tcol.."-", minx, maxy + ((7 + bgPadding)*sizeMultiplier), buttonFontSize*sizeMultiplier, "ol") + font:Print(tcol.."-", minx, maxy + ((7 + bgPadding)*sizeMultiplier), buttonFontSize*sizeMultiplier, "ol") tcol = WhiteStr -- draw the box - gl.Color(0,0,0,0.8) + if WG['guishader'] then + gl.Color(0,0,0,0.8) + else + gl.Color(0,0,0,0.85) + end RectRound(minx-(bgPadding*sizeMultiplier), miny-(bgPadding*sizeMultiplier), maxx+(bgPadding*sizeMultiplier), maxy+(bgPadding*sizeMultiplier), 8*sizeMultiplier) gl.Color(0.33,0.33,0.33,0.2) @@ -392,7 +433,7 @@ function widget:DrawScreen() if minx < mx and mx < maxx and miny - (buttonTop*sizeMultiplier) - i*(buttonHeight*sizeMultiplier) < my and my < miny - (buttonTop*sizeMultiplier) - (i-1)*(buttonHeight*sizeMultiplier) then tcol = '\255\031\031\031' end - gl.Text(tcol .. buttons[i], (minx+maxx)/2, miny - (buttonTop*sizeMultiplier) - (i*(buttonHeight*sizeMultiplier)), buttonFontSize*sizeMultiplier, "oc") + font:Print(tcol .. buttons[i], (minx+maxx)/2, miny - (buttonTop*sizeMultiplier) - (i*(buttonHeight*sizeMultiplier)), buttonFontSize*sizeMultiplier, "oc") end @@ -433,7 +474,7 @@ function widget:DrawScreen() tmpName = color .. name end - gl.Text(color..tmpName, midx, posy + (fontSize*sizeMultiplier) * 0.5, fontSize*sizeMultiplier, "vc") + font:Print(color..tmpName, midx, posy + (fontSize*sizeMultiplier) * 0.5, fontSize*sizeMultiplier, "vc") posy = posy - (yStep*sizeMultiplier) end @@ -518,8 +559,8 @@ function widget:DrawScreen() gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) end end - - gl.EndText() + + font:End() end @@ -661,7 +702,7 @@ function widget:MouseRelease(x, y, mb) widgetHandler:SaveConfigData() return -1 end - if buttonID == 3 then + if buttonID == 3 and allowuserwidgets then -- tell the widget handler that we allow/disallow user widgets and reload if widgetHandler.allowUserWidgets then widgetHandler.__allowUserWidgets = false @@ -800,9 +841,11 @@ end function widget:Shutdown() Spring.SendCommands('bind f11 luaui selector') -- if this one is removed or crashes, then have the backup one take over. - if (WG['guishader_api'] ~= nil) then - WG['guishader_api'].RemoveRect('widgetselector') - end + if WG['guishader'] then + WG['guishader'].DeleteDlist('widgetselector') + end + gl.DeleteFont(font) + gl.DeleteFont(font2) end diff --git a/LuaUI/Widgets_Evo/keep_morphed_selected.lua b/LuaUI/Widgets_Evo/keep_morphed_selected.lua index dd32c9204..d0a6ddda6 100644 --- a/LuaUI/Widgets_Evo/keep_morphed_selected.lua +++ b/LuaUI/Widgets_Evo/keep_morphed_selected.lua @@ -2,24 +2,32 @@ function widget:GetInfo() return { name = "Keep Morpheds Selected", - desc = "Maintain unit selection through morphing", - author = "zwzsg", - version = "1.0", - date = "August, 5th, 2009", + desc = "Maintain unit selection and factory queue (for EvoRTS) through morphing", + author = "zwzsg, modified by CommonPlayer", + version = "1.1", + date = "August, 5th, 2009", --modified by CommonPlayer, May 2018 license = "Public Domain", layer = 0, enabled = true, } end +local spGetFullBuildQueue = Spring.GetFullBuildQueue + local Createds={} local Destroyeds={} +local DestroyedsHasQueue={} + function widget:UnitDestroyed(unitID,unitDefID,teamID) + local x,_,z=Spring.GetUnitPosition(unitID) + if Spring.IsUnitSelected(unitID) then - local x,_,z=Spring.GetUnitPosition(unitID) table.insert(Destroyeds,{u=unitID,x=x,z=z,t=teamID}) end + + local queue = spGetFullBuildQueue(unitID) + if queue[1] and UnitDefs[unitDefID].isFactory then table.insert(DestroyedsHasQueue, {u=unitID,x=x,z=z,t=teamID,queue=queue}) end end function widget:UnitCreated(unitID,unitDefID,teamID) @@ -29,6 +37,32 @@ end function widget:GameFrame(frameNum) local ToReSelect={} + + for _,c in ipairs(Createds) do + --Spring.Echo("#DesQuee" .. #DestroyedsHasQueue) + for _,d in ipairs(DestroyedsHasQueue) do + if c.x==d.x and c.z==d.z and c.t==d.t then + for i = 1, #d.queue do + for k, v in pairs(d.queue[i]) do + local oldName = UnitDefs[k].name + local newName = oldName .. "_up1" + if oldName:find("_up1") then newName = oldName:gsub("_up1", "_up2") + elseif oldName:find("_up2") then newName = oldName:gsub("_up2", "_up3") end + local uDefName = UnitDefNames[newName] + if uDefName then + for _ = 1, v do Spring.GiveOrderToUnit(c.u, -uDefName.id, {}, 0) end + --Spring.Echo(UnitDefs[k].name .. "___" .. v) + --Spring.Echo(uDefName.id) + else + for _ = 1, v do Spring.GiveOrderToUnit(c.u, -UnitDefs[k].id, {}, 0) end + end + end + end + end + end + end + + for _,c in ipairs(Createds) do for _,d in ipairs(Destroyeds) do if c.x==d.x and c.z==d.z and c.t==d.t then @@ -41,5 +75,6 @@ function widget:GameFrame(frameNum) end Createds={} Destroyeds={} + + DestroyedsHasQueue={} end - diff --git a/LuaUI/Widgets_Evo/map_startbox.lua b/LuaUI/Widgets_Evo/map_startbox.lua index cff62a5d9..511b31b1e 100644 --- a/LuaUI/Widgets_Evo/map_startbox.lua +++ b/LuaUI/Widgets_Evo/map_startbox.lua @@ -10,6 +10,7 @@ -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- function widget:GetInfo() return { @@ -31,7 +32,7 @@ if (Game.startPosType ~= 2) then end if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) end -------------------------------------------------------------------------------- @@ -43,6 +44,17 @@ end -- enable simple version by default though local drawGroundQuads = true +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 50 +local fontfileOutlineSize = 10 +local fontfileOutlineStrength = 1.7 +local fontfileOutlineStrength2 = 10 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local shadowFont = gl.LoadFont(fontfile, fontfileSize*fontfileScale, 35*fontfileScale, 1.5) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength2) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -52,18 +64,15 @@ local heightOffset = 50 local fontSize = 18 local fontShadow = true -- only shows if font has a white outline local shadowOpacity = 0.35 -local font = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", 55, 10, 10) -local shadowFont = gl.LoadFont(LUAUI_DIRNAME.."Fonts/FreeSansBold.otf", 55, 38, 1.6) -local infotext = "Pick a startspot within the green area, and click the Ready button." -local infotextFontsize = 20 -local infotextWidth = gl.GetTextWidth(infotext) * infotextFontsize +local infotext = "Pick a startspot within the green area, and click the Ready button. (F4 shows metal spots)" +local infotextFontsize = 13 local comnameList = {} local drawShadow = fontShadow local usedFontSize = fontSize -local vsx,vsy = Spring.GetViewGeometry() +local widgetScale = (1 + (vsx*vsy / 5500000)) local gl = gl -- use a local copy for faster access @@ -173,7 +182,7 @@ local function createComnameList(x, y, name, teamID, color) comnameList[teamID]['y'] = math.floor(y) comnameList[teamID]['list'] = gl.CreateList( function() local outlineColor = {0,0,0,1} - if (color[1] + color[2]*1.35 + color[3]*0.5) < 0.8 then + if (color[1] + color[2]*1.2 + color[3]*0.4) < 0.8 then outlineColor = {1,1,1,1} end if useThickLeterring then @@ -186,17 +195,19 @@ local function createComnameList(x, y, name, teamID, color) shadowFont:End() glTranslate(0, (usedFontSize/44), 0) end - font:SetTextColor(outlineColor) - font:SetOutlineColor(outlineColor) + font2:Begin() + font2:SetTextColor(outlineColor) + font2:SetOutlineColor(outlineColor) - font:Print(name, x-(usedFontSize/38), y-(usedFontSize/33), usedFontSize, "con") - font:Print(name, x+(usedFontSize/38), y-(usedFontSize/33), usedFontSize, "con") + font2:Print(name, x-(usedFontSize/38), y-(usedFontSize/33), usedFontSize, "con") + font2:Print(name, x+(usedFontSize/38), y-(usedFontSize/33), usedFontSize, "con") + font2:End() end - font:Begin() - font:SetTextColor(color) - font:SetOutlineColor(outlineColor) - font:Print(name, x, y, usedFontSize, "con") - font:End() + font2:Begin() + font2:SetTextColor(color) + font2:SetOutlineColor(outlineColor) + font2:Print(name, x, y, usedFontSize, "con") + font2:End() end) end @@ -211,23 +222,32 @@ local function DrawName(x, y, name, teamID, color) glCallList(comnameList[teamID]['list']) end + +function createInfotextList() + if infotextList then + gl.DeleteList(infotextList) + end + infotextList = gl.CreateList(function() + font:Begin() + font:SetTextColor(0.75,0.75,0.75,1) + font:Print(infotext, 0,0, infotextFontsize*widgetScale, "cno") + font:End() + end) +end + function widget:Initialize() -- only show at the beginning if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) return end - infotextList = gl.CreateList(function() - gl.Color(1,1,1,0.5) - gl.Text(infotext, 0,0, infotextFontsize, "cno") - end) + createInfotextList() -- get the gaia teamID and allyTeamID gaiaTeamID = Spring.GetGaiaTeamID() if (gaiaTeamID) then - local _,_,_,_,_,atid = Spring.GetTeamInfo(gaiaTeamID) - gaiaAllyTeamID = atid + gaiaAllyTeamID = select(6,Spring.GetTeamInfo(gaiaTeamID,false)) end -- flip and scale (using x & y for gl.Rect()) @@ -303,8 +323,7 @@ function widget:Initialize() end - -function widget:Shutdown() +function removeLists() gl.DeleteList(infotextList) gl.DeleteList(xformList) gl.DeleteList(coneList) @@ -313,14 +332,20 @@ function widget:Shutdown() removeTeamLists() end +function widget:Shutdown() + removeLists() + gl.DeleteFont(font) + gl.DeleteFont(shadowFont) +end + function removeTeamLists() for _, teamID in ipairs(Spring.GetTeamList()) do if comnameList[teamID] ~= nil then - gl.DeleteList(comnameList[teamID]['list']) - comnameList[teamID] = nil + gl.DeleteList(comnameList[teamID].list) end end + comnameList = {} end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -414,8 +439,7 @@ function widget:DrawWorld() -- show the team start positions for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local _,_,spec = Spring.GetPlayerInfo(leader) + local _,_,spec = Spring.GetPlayerInfo(select(2,Spring.GetTeamInfo(teamID,false)),false) if ((not spec) and (teamID ~= gaiaTeamID)) then local x, y, z = Spring.GetTeamStartPosition(teamID) local isNewbie = (Spring.GetTeamRulesParam(teamID, 'isNewbie') == 1) -- =1 means the startpoint will be replaced and chosen by initial_spawn @@ -430,7 +454,7 @@ function widget:DrawWorld() end end end - + --gl.Fog(true) end @@ -441,8 +465,7 @@ function widget:DrawScreenEffects() -- show the names over the team start positions --gl.Fog(false) for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local name,_,spec = Spring.GetPlayerInfo(leader) + local name,_,spec = Spring.GetPlayerInfo(select(2,Spring.GetTeamInfo(teamID,false)),false) local isNewbie = (Spring.GetTeamRulesParam(teamID, 'isNewbie') == 1) -- =1 means the startpoint will be replaced and chosen by initial_spawn if (name ~= nil) and ((not spec) and (teamID ~= gaiaTeamID)) and not isNewbie then local colorStr, outlineStr = GetTeamColorStr(teamID) @@ -461,7 +484,14 @@ function widget:DrawScreenEffects() end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end if not isSpec then gl.PushMatrix() gl.Translate(vsx/2, vsy/6.2, 0) @@ -477,7 +507,7 @@ end function widget:DrawInMiniMap(sx, sz) -- only show at the beginning if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() + widgetHandler:RemoveWidget(self) end gl.PushMatrix() @@ -488,8 +518,7 @@ function widget:DrawInMiniMap(sx, sz) local gaiaAllyTeamID local gaiaTeamID = Spring.GetGaiaTeamID() if (gaiaTeamID) then - local _,_,_,_,_,atid = Spring.GetTeamInfo(gaiaTeamID) - gaiaAllyTeamID = atid + gaiaAllyTeamID = select(6,Spring.GetTeamInfo(gaiaTeamID,false)) end -- show all start boxes @@ -519,8 +548,7 @@ function widget:DrawInMiniMap(sx, sz) -- show the team start positions for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local _,_,spec = Spring.GetPlayerInfo(leader) + local _,_,spec = Spring.GetPlayerInfo(select(2,Spring.GetTeamInfo(teamID,false)),false) if ((not spec) and (teamID ~= gaiaTeamID)) then local x, y, z = Spring.GetTeamStartPosition(teamID) local isNewbie = (Spring.GetTeamRulesParam(teamID, 'isNewbie') == 1) -- =1 means the startpoint will be replaced and chosen by initial_spawn @@ -550,8 +578,39 @@ function widget:ViewResize(x, y) vsx,vsy = x,y widgetScale = (0.75 + (vsx*vsy / 7500000)) removeTeamLists() - usedFontSize = fontSize/1.44 + (fontSize * ((vsx*vsy / 10000000))) + usedFontSize = fontSize * widgetScale + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + gl.DeleteFont(shadowFont) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength2) + shadowFont = gl.LoadFont(fontfile, fontfileSize*fontfileScale, 35*fontfileScale, 1.6) + createInfotextList() + end +end + + +-- reset needed when waterlevel has changed by gadget (modoption) +local resetsec = 0 +local resetted = false +local doWaterLevelCheck = false +if (Spring.GetModOptions() ~= nil and Spring.GetModOptions().map_waterlevel ~= 0) then + doWaterLevelCheck = true end +local groundHeightPoint = Spring.GetGroundHeight(0,0) +function widget:Update(dt) + if (doWaterLevelCheck and not resetted) or (Spring.IsCheatingEnabled() and Spring.GetGroundHeight(0,0) ~= groundHeightPoint)then + resetsec = resetsec + dt + if resetsec > 1 then + groundHeightPoint = Spring.GetGroundHeight(0,0) + resetted = true + removeLists() + widget:Initialize() + end + end +end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/red_ui_framework.lua b/LuaUI/Widgets_Evo/red_ui_framework.lua index ec770179c..2ab79df29 100644 --- a/LuaUI/Widgets_Evo/red_ui_framework.lua +++ b/LuaUI/Widgets_Evo/red_ui_framework.lua @@ -6,12 +6,22 @@ function widget:GetInfo() author = "Regret (enhanced by Floris)", date = "29 may 2015", license = "GNU GPL, v2 or later", - layer = -99999, --lowest go first + layer = -9999998, --lowest go first enabled = true, --loaded by default handler = true, --access to handler } end +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 32 +local fontfileOutlineSize = 9 +local fontfileOutlineStrength = 1.45 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) +local fontfile2 = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font2", "JosefinSans-Bold.ttf") +local font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local useRoundedRectangles = true local roundedSizeMultiplier = 1 local usedRoundedSize = roundedSize @@ -21,7 +31,6 @@ local DrawingTN = "Red_Drawing" --WG name for drawing function list local version = 9 local clock = os.clock -local glGetTextWidth = gl.GetTextWidth local sgsub = string.gsub local function getLineCount(text) _,linecount = sgsub(text,"\n","\n") @@ -38,8 +47,20 @@ local vsx,vsy = widgetHandler:GetViewSizes() if (vsx == 1) then --hax for windowed mode vsx,vsy = Spring.GetWindowGeometry() end + function widget:ViewResize(viewSizeX, viewSizeY) - vsx,vsy = widgetHandler:GetViewSizes() + vsx,vsy = Spring.GetViewGeometry() + + + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + font2 = gl.LoadFont(fontfile2, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + WG[TN].font = font + WG[TN].font2 = font2 + end + Main.vsx,Main.vsy = vsx,vsy Main.Screen.vsx,Main.Screen.vsy = vsx,vsy usedRoundedSize = 4 + math.floor((((vsx*vsy) / 900000))) * roundedSizeMultiplier @@ -50,7 +71,11 @@ end local type = type local function getTextWidth(o) - return glGetTextWidth(o.caption)*o.fontsize + if o.font2 then + return font2:GetTextWidth(o.caption)*o.fontsize + else + return font:GetTextWidth(o.caption)*o.fontsize + end end local function getTextHeight(o) @@ -137,7 +162,12 @@ local F = { if (o.caption) then local px2,py2 = px,py local text = o.caption - local width = glGetTextWidth(text) + local width + if o.font2 then + width = font2:GetTextWidth(text) + else + width = font:GetTextWidth(text) + end local linecount = getLineCount(text) local fontsize = sx/width local height = linecount*fontsize @@ -147,7 +177,7 @@ local F = { else py2 = py2 + (sy - height) /2 --center end - Text(px2+((sx*(1-iconscale))/2),py2+((sy*(1-iconscale))/2),fontsize*iconscale,text,o.options,captioncolor) + Text(px2+((sx*(1-iconscale))/2),py2+((sy*(1-iconscale))/2),fontsize*iconscale,text,o.options,captioncolor,o.font2) o.autofontsize = fontsize end @@ -178,7 +208,7 @@ local F = { local px,py = o.px,o.py local fontsize = o.fontsize - Text(px,py,fontsize,o.caption,o.options,color or captioncolor) + Text(px,py,fontsize,o.caption,o.options,color or captioncolor,o.font2) end, [3] = function(o) --area @@ -228,9 +258,9 @@ local F = { if o.roundedsize ~= nil then roundedSize = o.roundedsize end - RectRound(px,py,sx,sy,color,roundedSize,iconscale) + RectRound(px,py,sx,sy,color,roundedSize,iconscale,false,(o.guishader ~= nil and o.guishader)) if o.glone ~= nil and o.glone > 0 then - RectRound(px,py,sx,sy,{color[1],color[2],color[3],o.glone},roundedSize,iconscale,true) + RectRound(px,py,sx,sy,{color[1],color[2],color[3],o.glone},roundedSize,iconscale,true,(o.guishader ~= nil and o.guishader)) end end @@ -241,7 +271,12 @@ local F = { if (o.caption) then local px2,py2 = px,py local text = o.caption - local width = glGetTextWidth(text) + local width + if o.font2 then + width = font2:GetTextWidth(text) + else + width = font:GetTextWidth(text) + end local linecount = getLineCount(text) local fontsize = sx/width local height = linecount*fontsize @@ -251,7 +286,7 @@ local F = { else py2 = py2 + (sy - height) /2 --center end - Text(px2+((sx*(1-iconscale))/2),py2+((sy*(1-iconscale))/2),fontsize*iconscale,text,o.options,captioncolor) + Text(px2+((sx*(1-iconscale))/2),py2+((sy*(1-iconscale))/2),fontsize*iconscale,text,o.options,captioncolor,o.font2) o.autofontsize = fontsize end @@ -360,7 +395,7 @@ function widget:MousePress(mx,my,mb) dropClick = false end end - + return dropClick end @@ -455,8 +490,8 @@ local function processMouseEvents(o) local newpy = Mouse.y + o.wasclicked[2] if (o.obeyscreenedge) then - if (newpx<0) then newpx = 0 end - if (newpy<0) then newpy = 0 end + if (newpx<0) then newpx = -0.1 end + if (newpy<0) then newpy = -0.1 end if (newpx>(vsx-o.sx)) then newpx = vsx-o.sx end if (newpy>(vsy-o.sy)) then newpy = vsy-o.sy end elseif (o.movablearea) then @@ -580,9 +615,12 @@ end local ssub = string.sub function widget:Initialize() - WG[TN] = {{}} + + WG[TN] = {{} } Main = WG[TN] Main.Version = version + Main.font = font + Main.font2 = font2 Main.vsx,Main.vsy = vsx,vsy Main.Screen = {vsx=vsx,vsy=vsy} Main.Copytable = copytable @@ -660,6 +698,8 @@ function widget:Initialize() end function widget:Shutdown() + gl.DeleteFont(font) + gl.DeleteFont(font2) WG[TN] = nil if (LastProcessedWidget ~= "") then Spring.Echo(widget:GetInfo().name..">> last processed widget was \""..LastProcessedWidget.."\"") --for debugging @@ -669,7 +709,14 @@ end function widget:TweakDrawScreen() inTweak = true end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() + if chobbyInterface then return end inTweak = false end @@ -766,13 +813,15 @@ function widget:Update() end --process mouseevents backwards, so topmost drawn objects get to mouseevents first - local ro = objlst[#objlst-i+1] - if (not ro.scheduledfordeletion) then - if (ro.active ~= false) then - if (ro.onupdate) then - ro.onupdate(ro) + if not WG['topbar'] or not WG['topbar'].showingQuit() then + local ro = objlst[#objlst-i+1] + if (not ro.scheduledfordeletion) then + if (ro.active ~= false) then + if (ro.onupdate) then + ro.onupdate(ro) + end + processMouseEvents(ro) end - processMouseEvents(ro) end end end diff --git a/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua b/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua index 91cbdd2d7..9c9ad8245 100644 --- a/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua +++ b/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua @@ -6,53 +6,13 @@ function widget:GetInfo() author = "Regret", date = "29 may 2015", license = "GNU GPL, v2 or later", - layer = 0, + layer = -1, enabled = true, } end -local consoleBlur = false -local blurShaderStartColor = 0.31 -- will apply guishader if alpha >= ... - -function widget:TextCommand(command) - if (string.find(command, "consoleblur") == 1 and string.len(command) == 11) then - if (WG['guishader_api'] ~= nil) then - consoleBlur = not consoleBlur - processConsoleBlur() - if consoleBlur then - Spring.Echo("Console blur: enabled") - else - Spring.Echo("Console blur: disabled") - end - else - Spring.Echo("Console blur: enable 'GUI-Shader' widget first!") - end - end -end - -function processConsoleBlur() - if not consoleBlur then - blurShaderStartColor = 0.34 -- will add guishader if alpha >= ... - else - blurShaderStartColor = 0 - end -end - -function widget:GetConfigData(data) - savedTable = {} - savedTable.consoleBlur = consoleBlur - return savedTable -end - -function widget:SetConfigData(data) - if data.consoleBlur ~= nil then - consoleBlur = data.consoleBlur - processConsoleBlur() - end -end - local bgcornerSize = 8 -local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +local bgcorner = "LuaUI/Images/bgcorner.png" local TN = "Red_Drawing" --WG name for function list local version = 9 @@ -109,12 +69,18 @@ local function Color(c) glColor(c[1],c[2],c[3],c[4]) end -local function Text(px,py,fontsize,text,options,c) +local function Text(px,py,fontsize,text,options,c,usefont2) glPushMatrix() + local f = usefont2 and font2 or font + f:Begin() if (c) then - glColor(c[1],c[2],c[3],c[4]) + f:SetTextColor(c[1],c[2],c[3],c[4]) + f:SetOutlineColor(0,0,0,1) + --glColor(c[1],c[2],c[3],c[4]) else - glColor(1,1,1,1) + f:SetTextColor(1,1,1,1) + f:SetOutlineColor(0,0,0,1) + --glColor(1,1,1,1) end glTranslate(px,py+fontsize,0) if (options) then @@ -123,7 +89,10 @@ local function Text(px,py,fontsize,text,options,c) options = "d" end glScale(1,-1,1) --flip - glText(text,0,0,fontsize,options) + + --glText(text,0,0,fontsize,options) + f:Print(text,0,0,fontsize,options) + f:End() glPopMatrix() end @@ -188,78 +157,86 @@ local function DrawRectRound(px,py,sx,sy,cs) if py <= 0 or px <= 0 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, py+cs, 0) -- top right if py <= 0 or sx >= vsx then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, py, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, py, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, py+cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, py+cs, 0) -- bottom left if sy >= vsy or px <= 0 then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(px, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(px+cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(px+cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(px, sy-cs, 0) -- bottom right if sy >= vsy or sx >= vsx then o = 0.5 else o = offset end gl.TexCoord(o,o) gl.Vertex(sx, sy, 0) - gl.TexCoord(o,1-o) + gl.TexCoord(o,1-offset) gl.Vertex(sx-cs, sy, 0) - gl.TexCoord(1-o,1-o) + gl.TexCoord(1-offset,1-offset) gl.Vertex(sx-cs, sy-cs, 0) - gl.TexCoord(1-o,o) + gl.TexCoord(1-offset,o) gl.Vertex(sx, sy-cs, 0) end -local function RectRound(px,py,sx,sy,c,cs,scale,glone) +function RectRoundOrg(px,py,sx,sy,cs) + --local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + + gl.Texture(bgcorner) + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) + gl.Texture(false) +end + +local function RectRound(px,py,sx,sy,c,cs,scale,glone,guishader) if (c) then glColor(c[1],c[2],c[3],c[4]) else glColor(1,1,1,1) end - + if cs == nil then cs = 4 end - + if glone then glBlending(GL_SRC_ALPHA, GL_ONE) end -- add blur shader - if c and c[4] >= blurShaderStartColor then - newBlurRect[px..' '..py..' '..sx..' '..sy] = {px=px,py=py,sx=sx,sy=sy} + if c and guishader then + newBlurRect[px..' '..py..' '..sx..' '..sy] = {px=px,py=py,sx=sx,sy=sy,cs=cs} end - + if scale ~= nil and scale ~= 1 then px = px + ((sx * (1-scale))/2) py = py + ((sy * (1-scale))/2) sx = sx * scale sy = sy * scale end - + sx = px+sx sy = py+sy - + gl.Texture(bgcorner) glBeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs) gl.Texture(false) - + if glone then glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) end @@ -318,17 +295,20 @@ end function widget:ViewResize(viewSizeX, viewSizeY) vsx,vsy = widgetHandler:GetViewSizes() + font = WG['Red'].font + font2 = WG['Red'].font2 CreateStartList() end function widget:Initialize() + font = WG['Red'].font + font2 = WG['Red'].font2 vsx,vsy = widgetHandler:GetViewSizes() CreateStartList() local T = {} WG[TN] = T T.version = version - T.Color = function(a,b,c,d) --using (...) seems slower Todo[#Todo+1] = {1,a,b,c,d} end @@ -341,11 +321,11 @@ function widget:Initialize() T.Border = function(a,b,c,d,e,f) Todo[#Todo+1] = {4,a,b,c,d,e,f} end - T.Text = function(a,b,c,d,e,f) - Todo[#Todo+1] = {5,a,b,c,d,e,f} + T.Text = function(a,b,c,d,e,f,g) + Todo[#Todo+1] = {5,a,b,c,d,e,f,g} end - T.RectRound = function(a,b,c,d,e,f,g,h) - Todo[#Todo+1] = {6,a,b,c,d,e,f,g,h} + T.RectRound = function(a,b,c,d,e,f,g,h,i) + Todo[#Todo+1] = {6,a,b,c,d,e,f,g,h,i} end F[1] = Color @@ -354,95 +334,60 @@ function widget:Initialize() F[4] = Border F[5] = Text F[6] = RectRound - dList[1] = {} - dList[2] = {} - dList[3] = {} - dList[4] = {} - dList[5] = {} - dList[6] = {} end -local dlistCount = 0 +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawScreen() - + if chobbyInterface then return end + newBlurRect = {} - + glResetState() glResetMatrices() - + glCallList(StartList) - + + local id = '' + local t for i=1,#Todo do - local t = Todo[i] - - local id = '' - - -- using dlists worked only for text :S - --[[if t[1] == 1 then -- color - id = t[2][1]..'_'..t[2][2]..'_'..t[2][3]..'_'..t[2][4] - - elseif t[1] == 2 then -- rect - id = t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5] - if type(t[6]) == 'table' then - id = id .. t[6][1]..'_'..t[6][2]..'_'..t[6][3]..'_'..t[6][4] - end - id = id .. '_' ..(t[7] or '') - - elseif t[1] == 3 then -- texrect - id = t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5]..'_'..t[6] - if type(t[7]) == 'table' then - id = id .. t[7][1]..'_'..t[7][2]..'_'..t[7][3]..'_'..t[7][4] - end - id = id .. '_' ..(t[8] or '') - - elseif t[1] == 4 then -- border - id = t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5]..'_'..(t[6] or '') - if type(t[7]) == 'table' then - id = id .. t[7][1]..'_'..t[7][2]..'_'..t[7][3]..'_'..t[7][4] - end - - elseif t[1] == 6 then -- rectround - id = t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5] - if type(t[6]) == 'table' then - id = id .. t[6][1]..'_'..t[6][2]..'_'..t[6][3]..'_'..t[6][4] - if t[6][4] >= blurShaderStartColor then -- add blur shader - newBlurRect[t[2]..' '..t[3]..' '..t[4]..' '..t[5] ] = {px=t[2],py=t[3],sx=t[4],sy=t[5]} - end - end - id = id .. '_' ..(t[7] or '')..id .. '_' ..(t[8] or '')..id .. '_' ..(t[9] and '1' or '') - end]]-- - + t = Todo[i] + id = '' if t[1] == 5 then -- text - id = t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5]..'_'..t[6] + id = t[1]..'_'..t[2]..'_'..t[3]..'_'..t[4]..'_'..t[5] if type(t[7]) == 'table' then id = id .. t[7][1]..'_'..t[7][2]..'_'..t[7][3]..'_'..t[7][4] end - if dList[t[1]][id] == nil then - dlistCount = dlistCount + 1 - dList[t[1]][id] = glCreateList(function() - F[t[1]](t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9]) + end + + if id ~= '' then + if dList[id] == nil then + dList[id] = glCreateList(function() + F[t[1]](t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10]) end) end - glCallList(dList[t[1]][id]) + glCallList(dList[id]) else - F[t[1]](t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9]) + F[t[1]](t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10]) end - + Todo[i] = nil end - - + + glResetState() glResetMatrices() - - CleanedTodo = true - - if (WG['guishader_api'] ~= nil) then - + + if WG['guishader'] then + -- remove changed blur areas for id, rect in pairs(blurRect) do if newBlurRect[id] == nil and rect.id ~= nil then - WG['guishader_api'].RemoveRect('red_ui_'..rect.id) + WG['guishader'].DeleteDlist('red_ui_'..rect.id) blurRect[id] = nil else newBlurRect[id] = rect @@ -456,9 +401,10 @@ function widget:DrawScreen() local y = vsy-rect.py local x2 = (rect.px+rect.sx) local y2 = vsy-(rect.py+rect.sy) - + local rectid = rect.px..' '..rect.py..' '..rect.sx..' '..rect.sy - WG['guishader_api'].InsertRect(x,y,x2,y2,'red_ui_'..rectid) + + WG['guishader'].InsertDlist(glCreateList( function() RectRoundOrg(x,y2,x2,y,rect.cs) end), 'red_ui_'..rectid) newBlurRect[rectid].id = rectid end count = count + 1 @@ -473,13 +419,13 @@ end local sec = 0 local flushDistsTime = 20 function widget:Update(dt) - + if chobbyInterface then return end if (sIsGUIHidden()) then for i=1,#Todo do Todo[i] = nil end end - + sec=sec+dt if (sec>flushDistsTime) then sec = 0 @@ -488,24 +434,22 @@ function widget:Update(dt) end function removeDLists() - for t, idlist in pairs(dList) do - for id in pairs(idlist) do - glDeleteList(dList[t][id]) - end - dList[t] = {} + for t, l in pairs(dList) do + glDeleteList(dList[l]) end + dList = {} end function widget:Shutdown() glDeleteList(StartList) removeDLists() - if (WG['guishader_api'] ~= nil) then + if WG['guishader'] then -- remove blur areas for id, rect in pairs(blurRect) do if rect.id ~= nil then - WG['guishader_api'].RemoveRect('red_ui_'..rect.id) + WG['guishader'].DeleteDlist('red_ui_'..rect.id) blurRect[id] = nil end end diff --git a/LuaUI/Widgets_Evo/snd_ambientSoundPlayer.lua b/LuaUI/Widgets_Evo/snd_ambientSoundPlayer.lua new file mode 100644 index 000000000..7bf7a2ad1 --- /dev/null +++ b/LuaUI/Widgets_Evo/snd_ambientSoundPlayer.lua @@ -0,0 +1,66 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: snd_ambientSoundPlayer.lua +-- brief: Plays a looping background sound +-- author: Forboding Angel +-- +-- Copyright (C) 2019. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +math.randomseed( os.time() - os.clock() * 1000 ) +math.random() math.random() math.random() + +function widget:GetInfo() + return { + name = "Ambient Background Sound Player", + desc = "Plays a looping background sound", + author = "Forboding Angel", + date = "May 2019", + license = "GNU GPL, v2 or later", + layer = 9999999999, + enabled = true -- loaded by default? + } +end + +function widget:Initialize() + +end + +function widget:GameFrame(n) + + if n == 1 then + myTeamID = Spring.GetMyTeamID() + myFaction = Spring.GetTeamRulesParam(myTeamID, "faction", playerFaction) + if myFaction == nil then + Spring.Echo("[Ambient Background Sound Player] If you're seeing this message that means that the code which sets the player's faction is absolutely fucked somewhere. On the next line I will echo the myFaction variable (It will be nil). If it says anything other than the factions listed in game_spawn.lua (it will), at least it will provide a clue. Additionally I will manually set the player faction to Federation of Kala so that it doesn't crash and burn. Happy bug hunting!") + Spring.Echo(myFaction) + myFaction = "Federation of Kala" + else + Spring.Echo("[Ambient Background Sound Player] Player faction is " .. myFaction) + end + end + + if myFaction == "Federation of Kala" then + if n == 1 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/ambient-stereo-short.wav", 0.33, 'ui') + elseif (n % 50) == 4 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/ambient-stereo-short.wav", 0.33, 'ui') + end + elseif myFaction == "Loz Alliance" then + if n == 1 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/ambient-stereo-short.wav", 0.33, 'ui') + elseif (n % 50) == 4 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/ambient-stereo-short.wav", 0.33, 'ui') + end + elseif myFaction == "zaal" then + if n == 1 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/zaalambient.wav", 0.33, 'ui') + elseif (n % 50) == 4 then + Spring.PlaySoundFile("LuaUI/Sounds/ambient/zaalambient.wav", 0.33, 'ui') + end + end + +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/snd_volume_osd.lua b/LuaUI/Widgets_Evo/snd_volume_osd.lua deleted file mode 100644 index a415075fc..000000000 --- a/LuaUI/Widgets_Evo/snd_volume_osd.lua +++ /dev/null @@ -1,259 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: snd_volume_osd.lua --- brief: volume control OSD --- version: 1.2 --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Volume OSD", - desc = "A sound control OSD", - author = "Jools", - date = "Mar 26, 2013", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- SETTINGS, internal, don't edit --------------------------------------------------------------------------------- -local volume -local TextDraw = fontHandler.Draw -local vsx,vsy = gl.GetViewSizes() -local widgetPosX = vsx/3 -local widgetPosY = vsy/6 -local pressedToMove = false -local altdown -local dt = -1 --------------------------------------------------------------------------------- --- SETTINGS, configurable --------------------------------------------------------------------------------- -local TEST_SOUND = LUAUI_DIRNAME .. 'Sounds/volume_osd/pop.wav' -local textsize = 14 -local myFont = gl.LoadFont("FreeSansBold.otf",textsize, 1.9, 40) -local step = 2 -- how many steps to change sound volume on one key press -local pluskey = 270 -- numpad+ (look in uikeys.txt in spring folder for key symbols) -local minuskey = 269 -- numpad- -local pluskey2 = 61 -- +key (duplicate key for volume+, set to same as primary to disable) -local minuskey2 = 45 -- -key -local dtime = 3 --How long time the volume display is drawn, in seconds -local ftime = 2.5 --How long time before the volume display starts fading, in seconds -local widgetWidth = vsx/2.5 -- in pixels (changed from 400) -local widgetHeight = vsy/25.6 -- in pixels (changed from 40) -local rectangles = 50 -- number of boxes in volume bar -local boxspacing = 2 -- space between boxes -local red = 0.1 -- volume bar colour, 0 to 1. -local green = 0.7 -- volume bar colour, 0 to 1. -local blue = 0 -- volume bar colour, 0 to 1. -local lastVolume --------------------------------------------------------------------------------- - -function widget:Initialize() - volume = Spring.GetConfigInt("snd_volmaster", 60) -end - -function widget:KeyPress(key, mods, isRepeat) - if (key == pluskey or key == pluskey2) and (not mods.alt) and (not mods.shift) then -- KEY = Alt + pluskey - volume = Spring.GetConfigInt("snd_volmaster", 60) - volume = volume + step - - volume = math.max(volume,0) - volume = math.min(volume,100) - - if not lastVolume then - lastVolume = Spring.GetConfigInt("snd_volmaster") - end - - Spring.SetConfigInt("snd_volmaster", volume) - dt = os.clock() - return true - - elseif (key == minuskey or key == minuskey2) and (not mods.alt) and (not mods.shift) then -- KEY = Alt + minuskey - volume = Spring.GetConfigInt("snd_volmaster", 60) - volume = volume - step - - volume = math.max(volume,0) - volume = math.min(volume,100) - - if not lastVolume then - lastVolume = Spring.GetConfigInt("snd_volmaster") - end - - Spring.SetConfigInt("snd_volmaster", volume) - - dt = os.clock() - return true - elseif key == 0x134 then --ALT - altdown = true - end - return false -end - -function widget:KeyRelease(key) - if not altdown and (key == pluskey or key == minuskey or key == pluskey2 or key == minuskey2) then - if lastVolume and volume ~= lastVolume then - Spring.PlaySoundFile(TEST_SOUND, Spring.GetConfigInt("snd_volmaster") * 0.01) - lastVolume = nil - end - elseif key == 0x134 then --ALT - altdown = false - end - return false -end - -function widget:DrawScreen() - local y1 = widgetPosY - local y2 = widgetPosY + widgetHeight - local x1 = widgetPosX - local x2 = widgetPosX + widgetWidth - local ostime = os.clock() - local t = ostime - dt - local boxwidth = widgetWidth/rectangles - - if t < dtime and dt >= 0 then --dtime = 3 - local alpha - if t < ftime then --ftime = 2 - alpha = 1 - else - alpha = 3*(dtime-t)/dtime - end - myFont:Begin() - myFont:SetTextColor({0.5,1,0.5,alpha}) - myFont:Print(table.concat({"Master Volume: ",volume,"%"}),x1+5,y2+5,textsize,'xs') - myFont:End() - - gl.Color(0,0,0,0.1*alpha) -- draws background rectangle - gl.Rect(x1,y1,x2-1,y2) - gl.Color(0.3,0.3,0.3,0.6*alpha) -- draws empty rectangles - - for i = 1,rectangles do - local u1 = x1+(i-1)*boxwidth - local u2= u1+boxwidth-boxspacing - gl.Rect(u1,y1,u2,y2) - end - - local vol2 = math.floor(volume/(100/rectangles)) - gl.Color(0,0.8,0,alpha) -- draws filled rectangles - for i = 1,vol2 do - local u1 = x1+(i-1)*boxwidth - local u2= u1+boxwidth-boxspacing - gl.Color(red,green,blue,alpha) - gl.Rect(u1+1,y1+1,u1+2,y2-1) - gl.Color(red*1.2,green*1.2,blue*1.2,alpha) - gl.Rect(u1+2,y1+1,u2-1,y2-1) - end - end - gl.Color(1,1,1,1) - end - -function widget:TweakDrawScreen() - local y1 = widgetPosY - local y2 = widgetPosY + widgetHeight - local x1 = widgetPosX - local x2 = widgetPosX + widgetWidth - - myFont:Begin() - myFont:SetTextColor({0.5,1,0.5,1}) - myFont:Print(table.concat({"Volume: ",volume,"%"}),x1+5,y2+5,textsize,'xs') - myFont:End() - - gl.Color(0,0,0.5,1) - gl.Rect(x1-1,y1-1,x1,y2+1) - gl.Rect(x2-1,y1-1,x2,y2+1) - gl.Rect(x1-1,y1-1,x2,y1) - gl.Rect(x1-1,y2,x2,y2+1) - - gl.Color(0,0,0,0.2) -- draws empty rectangles - for i = 1,40 do - local u1 = x1+(i-1)*10 - local u2= u1+8 - gl.Rect(u1,y1,u2,y2) - end - - local vol2 = math.floor(volume/2.5) - gl.Color(0,0.8,0,1) -- draws filled rectangles - for i = 1,vol2 do - local u1 = x1+(i-1)*10 - local u2= u1+8 - gl.Rect(u1+1,y1+1,u2-1,y2-1) - end - gl.Color(1,1,1,1) -end - - ----------------- - -- AID -- - ----------------- - -function widget:TweakMouseMove(x,y,dx,dy,button) - if pressedToMove then - if moveStartX == nil then -- move widget on y axis - moveStartX = x - widgetPosX - end - if moveStartY == nil then -- move widget on y axis - moveStartY = y - widgetPosY - end - widgetPosX = widgetPosX + dx - widgetPosY = widgetPosY + dy - - if widgetPosY <= 0 then - widgetPosY = 0 - end - if widgetPosY + widgetHeight >= vsy then - widgetPosY = vsy - widgetHeight - end - if widgetPosX < 5 then - widgetPosX = 5 - end - if widgetPosX + widgetWidth + 5 > vsx then - widgetPosX = vsx - widgetWidth - 5 - end - end - -end - -function widget:TweakMousePress(x, y, button) - if button == 1 then - if IsOnButton(x,y,widgetPosX,widgetPosY,widgetPosX+widgetWidth,widgetPosY+widgetHeight) then - pressedToMove = true - return true - end - else - return false - end -end - -function widget:TweakMouseRelease(x,y,button) - pressedToMove = false -end - -function IsOnButton(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) - if BLcornerX == nil then return false end - -- check if the mouse is in a rectangle - - return x >= BLcornerX and x <= TRcornerX - and y >= BLcornerY - and y <= TRcornerY - -end - - ----------------- - -- SAVE/LOAD -- - ----------------- - -function widget:GetConfigData(data) -- save - return { - widgetPosX = widgetPosX, - widgetPosY = widgetPosY, - } -end - -function widget:SetConfigData(data) -- load - widgetPosX = data.widgetPosX or widgetPosX - widgetPosY = data.widgetPosY or widgetPosY -end diff --git a/LuaUI/Widgets_Evo/unit_air_allways_fly.lua b/LuaUI/Widgets_Evo/unit_air_allways_fly.lua index cfe077755..3a03b6ec6 100644 --- a/LuaUI/Widgets_Evo/unit_air_allways_fly.lua +++ b/LuaUI/Widgets_Evo/unit_air_allways_fly.lua @@ -9,7 +9,7 @@ function widget:GetInfo() license = "GNU GPL, v2 or later", version = 1, layer = 5, - enabled = true -- loaded by default? + enabled = false -- loaded by default? } end @@ -52,41 +52,41 @@ end function switchAirpadToFlyMode(unitID, unitDefID) - if (unitDefID == UnitDefNames["eairengineer"].id or - unitDefID == UnitDefNames["ebomber"].id or - unitDefID == UnitDefNames["edrone"].id or - unitDefID == UnitDefNames["edrone_up1"].id or - unitDefID == UnitDefNames["edrone_up2"].id or - unitDefID == UnitDefNames["edrone_up3"].id or - unitDefID == UnitDefNames["efighter"].id or - unitDefID == UnitDefNames["egunship2"].id or - unitDefID == UnitDefNames["escout"].id or - unitDefID == UnitDefNames["eraider"].id or - unitDefID == UnitDefNames["eraider_up1"].id or - unitDefID == UnitDefNames["eraider_up2"].id or - unitDefID == UnitDefNames["eraider_up3"].id or - unitDefID == UnitDefNames["etransport"].id or - unitDefID == UnitDefNames["ebomber_up1"].id or - unitDefID == UnitDefNames["efighter_up1"].id or - unitDefID == UnitDefNames["egunship2_up1"].id or - unitDefID == UnitDefNames["escout_up1"].id or - unitDefID == UnitDefNames["etransport_up1"].id or - unitDefID == UnitDefNames["ebomber_up2"].id or - unitDefID == UnitDefNames["efighter_up2"].id or - unitDefID == UnitDefNames["egunship2_up2"].id or - unitDefID == UnitDefNames["escout_up2"].id or - unitDefID == UnitDefNames["etransport_up2"].id or - unitDefID == UnitDefNames["ebomber_up3"].id or - unitDefID == UnitDefNames["efighter_up3"].id or - unitDefID == UnitDefNames["egunship2_up3"].id or - unitDefID == UnitDefNames["escout_up3"].id or - unitDefID == UnitDefNames["etransport_up3"].id or - unitDefID == UnitDefNames["ekrow"].id or - unitDefID == UnitDefNames["ekrow_up1"].id or - unitDefID == UnitDefNames["ekrow_up2"].id or - unitDefID == UnitDefNames["ekrow_up3"].id) then - spGiveOrderToUnit(unitID, CMD.IDLEMODE, { 0 }, {}) - end + -- if (unitDefID == UnitDefNames["eairengineer"].id or + -- unitDefID == UnitDefNames["ebomber"].id or + -- unitDefID == UnitDefNames["edrone"].id or + -- unitDefID == UnitDefNames["edrone_up1"].id or + -- unitDefID == UnitDefNames["edrone_up2"].id or + -- unitDefID == UnitDefNames["edrone_up3"].id or + -- unitDefID == UnitDefNames["efighter"].id or + -- unitDefID == UnitDefNames["egunship2"].id or + -- unitDefID == UnitDefNames["escout"].id or + -- unitDefID == UnitDefNames["eraider"].id or + -- unitDefID == UnitDefNames["eraider_up1"].id or + -- unitDefID == UnitDefNames["eraider_up2"].id or + -- unitDefID == UnitDefNames["eraider_up3"].id or + -- unitDefID == UnitDefNames["etransport"].id or + -- unitDefID == UnitDefNames["ebomber_up1"].id or + -- unitDefID == UnitDefNames["efighter_up1"].id or + -- unitDefID == UnitDefNames["egunship2_up1"].id or + -- unitDefID == UnitDefNames["escout_up1"].id or + -- unitDefID == UnitDefNames["etransport_up1"].id or + -- unitDefID == UnitDefNames["ebomber_up2"].id or + -- unitDefID == UnitDefNames["efighter_up2"].id or + -- unitDefID == UnitDefNames["egunship2_up2"].id or + -- unitDefID == UnitDefNames["escout_up2"].id or + -- unitDefID == UnitDefNames["etransport_up2"].id or + -- unitDefID == UnitDefNames["ebomber_up3"].id or + -- unitDefID == UnitDefNames["efighter_up3"].id or + -- unitDefID == UnitDefNames["egunship2_up3"].id or + -- unitDefID == UnitDefNames["escout_up3"].id or + -- unitDefID == UnitDefNames["etransport_up3"].id or + -- unitDefID == UnitDefNames["ekrow"].id or + -- unitDefID == UnitDefNames["ekrow_up1"].id or + -- unitDefID == UnitDefNames["ekrow_up2"].id or + -- unitDefID == UnitDefNames["ekrow_up3"].id) then + -- spGiveOrderToUnit(unitID, CMD.IDLEMODE, { 0 }, {}) + -- end end function widget:PlayerChanged(playerID) diff --git a/LuaUI/Widgets_Evo/unit_auto_group.lua b/LuaUI/Widgets_Evo/unit_auto_group.lua index e1c5afed2..3c70f1e57 100644 --- a/LuaUI/Widgets_Evo/unit_auto_group.lua +++ b/LuaUI/Widgets_Evo/unit_auto_group.lua @@ -32,11 +32,17 @@ include("keysym.h.lua") -- Added commands: help, loadgroups, cleargroups, verboseMode, addall. -- Licho, v1.0 : Creation. ---REMINDER : --- none -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local fontfile = LUAUI_DIRNAME .. "fonts/" .. Spring.GetConfigString("ui_font", "JosefinSans-SemiBold.ttf") +local vsx,vsy = Spring.GetViewGeometry() +local fontfileScale = (0.5 + (vsx*vsy / 5700000)) +local fontfileSize = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + local debug = false --of true generates debug messages local unit2group = {} -- list of unit types to group @@ -49,16 +55,7 @@ for _, v in ipairs( groupableBuildingTypes ) do end end - -local helpText = - 'Alt+0-9 sets autogroup# for selected unit type(s).\nNewly built units get added to group# equal to their autogroup#.'.. - '\nAlt+BACKQUOTE (~) deletes autogrouping for selected unit type(s).' - --'Ctrl+~ removes nearest selected unit from its group and selects it. ' - --'Extra function: Ctrl+q picks single nearest unit from current selection.', - -options_order = { 'help', 'cleargroups', 'loadgroups', 'addall', 'verbose', 'immediate', 'groupnumbers', } -options_path = 'Settings/Interface/AutoGroup' -options = { +local options = { loadgroups = { name = 'Preserve Auto Groups', desc = 'Preserve auto groupings for next game. Unchecking this clears the groups!', @@ -94,12 +91,6 @@ options = { value = true, }, - help = { - name = 'Help', - type = 'text', - value = helpText, - }, - cleargroups = { name = 'Clear Auto Groups', type = 'button', @@ -112,10 +103,7 @@ options = { local finiGroup = {} local myTeam = Spring.GetMyTeamID() -local selUnitDefs = {} -local loadGroups = true local createdFrame = {} -local textColor = {0.7, 1.0, 0.7, 1.0} -- r g b alpha local textSize = 13.0 -- gr = groupe selected/wanted @@ -124,7 +112,6 @@ local textSize = 13.0 local SetUnitGroup = Spring.SetUnitGroup local GetSelectedUnits = Spring.GetSelectedUnits local GetUnitDefID = Spring.GetUnitDefID -local GetAllUnits = Spring.GetAllUnits local GetUnitHealth = Spring.GetUnitHealth local GetMouseState = Spring.GetMouseState local SelectUnitArray = Spring.SelectUnitArray @@ -141,22 +128,63 @@ function printDebug( value ) if ( debug ) then Echo( value ) end end +function widget:ViewResize(n_vsx,n_vsy) + vsx,vsy = Spring.GetViewGeometry() + local newFontfileScale = (0.5 + (vsx*vsy / 5700000)) + if (fontfileScale ~= newFontfileScale) then + fontfileScale = newFontfileScale + gl.DeleteFont(font) + font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + end +end + +function widget:GameStart() + gameStarted = true + widget:PlayerChanged() +end + function widget:PlayerChanged(playerID) - if Spring.GetSpectatingState() then - widgetHandler:RemoveWidget() + if Spring.GetSpectatingState() and (Spring.GetGameFrame() > 0 or gameStarted) then + widgetHandler:RemoveWidget(self) + return end myTeam = Spring.GetMyTeamID() end function widget:Initialize() - if Spring.IsReplay() or Spring.GetGameFrame() > 0 then - widget:PlayerChanged() - end myTeam = Spring.GetMyTeamID() + + WG['autogroup'] = {} + WG['autogroup'].getImmediate = function() + return options.immediate.value + end + WG['autogroup'].setImmediate = function(value) + options.immediate.value = value + end + + dlists = {} + for i=0, 9 do + dlists[i] = gl.CreateList(function() + font:Begin() + font:Print("\255\200\255\200" .. i, 20.0, -10.0, textSize, "cns") + font:End() + end) + end + + if Spring.IsReplay() or Spring.GetGameFrame() > 0 then + widget:PlayerChanged() + end end -function widget:GameStart() - widget:PlayerChanged() +function widget:Shutdown() + WG['autogroup'] = nil + if dlists then + for i,_ in ipairs(dlists) do + gl.DeleteList(dlists[i]) + end + dlists = {} + end + gl.DeleteFont(font) end function widget:DrawWorld() @@ -164,15 +192,14 @@ function widget:DrawWorld() local existingGroups = GetGroupList() if options.groupnumbers.value then for inGroup, _ in pairs(existingGroups) do - units = GetGroupUnits(inGroup) + local units = GetGroupUnits(inGroup) for _, unit in ipairs(units) do if Spring.IsUnitInView(unit) then local ux, uy, uz = Spring.GetUnitViewPosition(unit) gl.PushMatrix() gl.Translate(ux, uy, uz) gl.Billboard() - gl.Color(textColor)--unused anyway when gl.Text have option 's' (and b & w) - gl.Text("" .. inGroup, 20.0, -10.0, textSize, "cns") + gl.CallList(dlists[inGroup]) gl.PopMatrix() end end @@ -185,7 +212,6 @@ function widget:UnitFinished(unitID, unitDefID, unitTeam) if (unitTeam == myTeam and unitID ~= nil) then if (createdFrame[unitID] == GetGameFrame()) then local gr = unit2group[unitDefID] ---printDebug(": Unit finished " .. unitID) -- if gr ~= nil then SetUnitGroup(unitID, gr) end else finiGroup[unitID] = 1 @@ -205,7 +231,6 @@ function widget:UnitFromFactory(unitID, unitDefID, unitTeam) createdFrame[unitID] = GetGameFrame() local gr = unit2group[unitDefID] if gr ~= nil then SetUnitGroup(unitID, gr) end ---printDebug(": Unit from factory " .. unitID) end end end @@ -213,13 +238,11 @@ end function widget:UnitDestroyed(unitID, unitDefID, teamID) finiGroup[unitID] = nil createdFrame[unitID] = nil ---printDebug(" : Unit destroyed ".. unitID) end function widget:UnitGiven(unitID, unitDefID, newTeamID, teamID) if (newTeamID == myTeam) then local gr = unit2group[unitDefID] ---printDebug(" : Unit given ".. unit2group[unitDefID]) if gr ~= nil then SetUnitGroup(unitID, gr) end end createdFrame[unitID] = nil @@ -229,7 +252,6 @@ end function widget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) if (teamID == myTeam) then local gr = unit2group[unitDefID] ---printDebug(" : Unit taken ".. unit2group[unitDefID]) if gr ~= nil then SetUnitGroup(unitID, gr) end end createdFrame[unitID] = nil @@ -239,10 +261,8 @@ end function widget:UnitIdle(unitID, unitDefID, unitTeam) if (unitTeam == myTeam and finiGroup[unitID]~=nil) then local gr = unit2group[unitDefID] - if gr ~= nil then SetUnitGroup(unitID, gr) ---printDebug(" : Unit idle " .. gr) - end - finiGroup[unitID] = nil + if gr ~= nil then SetUnitGroup(unitID, gr) end + finiGroup[unitID] = nil end end @@ -263,18 +283,28 @@ function widget:KeyPress(key, modifier, isRepeat) if (gr ~= nil) then if (gr == -1) then gr = nil end selUnitDefIDs = {} + local unit2groupDeleted = {} local exec = false --set to true when there is at least one unit to process - for _, unitID in ipairs(GetSelectedUnits()) do + local units = GetSelectedUnits() + for _, unitID in ipairs(units) do local udid = GetUnitDefID(unitID) if ( not UDefTab[udid]["isFactory"] and (groupableBuildings[udid] or not UDefTab[udid]["isBuilding"] )) then - selUnitDefIDs[udid] = true - unit2group[udid] = gr - --local x, y, z = Spring.GetUnitPosition(unitID) - --Spring.MarkerAddPoint( x, y, z ) - exec = true - --Echo(' : Add unit ' .. unitID .. 'to group ' .. gr) - if (gr==nil) then SetUnitGroup(unitID, -1) else - SetUnitGroup(unitID, gr) end + --if unit2group[udid] ~= nil then + -- unit2group[udid] = nil + -- unit2groupDeleted[udid] = true + -- SelectUnitArray({}) + -- for _, uID in ipairs(Spring.GetTeamUnits(myTeam)) do -- ungroup all units of this unitdef + -- if GetUnitDefID(uID) == udid then + -- SetUnitGroup(uID, -1) + -- end + -- end + --elseif unit2groupDeleted[udid] == nil then + selUnitDefIDs[udid] = true + unit2group[udid] = gr + exec = true + if (gr==nil) then SetUnitGroup(unitID, -1) else + SetUnitGroup(unitID, gr) end + --end end end if ( exec == false ) then @@ -316,12 +346,13 @@ function widget:KeyPress(key, modifier, isRepeat) local mindist = math.huge local muid = nil if (pos == nil) then return end - for _, uid in ipairs(GetSelectedUnits()) do - local x,_,z = GetUnitPosition(uid) + local units = GetSelectedUnits() + for _, unitID in ipairs(units) do + local x,_,z = GetUnitPosition(unitID) dist = (pos[1]-x)*(pos[1]-x) + (pos[3]-z)*(pos[3]-z) if (dist < mindist) then mindist = dist - muid = uid + muid = unitID end end if (muid ~= nil) then @@ -331,8 +362,9 @@ function widget:KeyPress(key, modifier, isRepeat) end --[[ if (key == KEYSYMS.Q) then - for _, uid in ipairs(GetSelectedUnits()) do - SetUnitGroup(uid,-1) + local units = GetSelectedUnits() + for _, unitID in ipairs(units) do + SetUnitGroup(unitID,-1) end end --]] @@ -340,21 +372,55 @@ function widget:KeyPress(key, modifier, isRepeat) return false end + +function tableMerge(t1, t2) + for k,v in pairs(t2) do + if type(v) == "table" then + if type(t1[k] or false) == "table" then + tableMerge(t1[k] or {}, t2[k] or {}) + else + t1[k] = v + end + else + t1[k] = v + end + end + return t1 +end + +function deepcopy(orig) + local orig_type = type(orig) + local copy + if orig_type == 'table' then + copy = {} + for orig_key, orig_value in next, orig, nil do + copy[deepcopy(orig_key)] = deepcopy(orig_value) + end + setmetatable(copy, deepcopy(getmetatable(orig))) + else -- number, string, boolean, etc + copy = orig + end + return copy +end + + function widget:GetConfigData() local groups = {} for id, gr in pairs(unit2group) do table.insert(groups, {UnitDefs[id].name, gr}) - end - local ret = - { - version = versionNum, - groups = groups, - } + end + local ret = + { + version = versionNum, + groups = groups, + options = options, + } return ret end function widget:SetConfigData(data) - if (data and type(data) == 'table' and data.version and (data.version+0) > 2.1) then + if (data and type(data) == 'table' and data.version and (data.version+0) > 2.1 and data.options) then + options = tableMerge(deepcopy(options), deepcopy(data.options)) local groupData = data.groups if groupData and type(groupData) == 'table' then for _, nam in ipairs(groupData) do diff --git a/LuaUI/Widgets_Evo/unit_automaticFightCommand.lua b/LuaUI/Widgets_Evo/unit_automaticFightCommand.lua index 0caf4d8f3..fd720d1f1 100644 --- a/LuaUI/Widgets_Evo/unit_automaticFightCommand.lua +++ b/LuaUI/Widgets_Evo/unit_automaticFightCommand.lua @@ -28,7 +28,30 @@ local hmsz = Game.mapSizeZ/2 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local targetUnits = {eorb = true, eorb_up1 = true, eorb_up2 = true, eorb_up3 = true, ehbotengineer = true, ehbotengineer_turret = true} +local targetUnits = { + eorb = true, + eorb_up1 = true, + eorb_up2 = true, + eorb_up3 = true, + ehbotengineer = true, + ehbotengineer_turret = true, + zarm = true, + ztenticle = true, + fedengineer = true, + lozengineer = true, + fedorb = true, + lozorb = true, + fedcommander = true + fedcommander_up1 = true, + fedcommander_up2 = true, + fedcommander_up3 = true, + fedcommander_up4 = true, + lozcommander = true, + lozcommander_up1 = true, + lozcommander_up2 = true, + lozcommander_up3 = true, + lozcommander_up4 = true +} local function IsTargetUnit(ud) return ud and targetUnits[ud.name] @@ -39,14 +62,14 @@ local function SetupUnit(unitID) local x, y, z = spGetUnitPosition(unitID) if x and y and z then if (x > hmsx) then -- avoid to issue commands outside map - x = x - 50 + x = x - 1 else - x = x + 50 + x = x + 1 end if (z > hmsz) then - z = z - 50 + z = z - 1 else - z = z + 50 + z = z + 1 end -- meta enables reclaim enemy units, alt autoresurrect ( if available ) spGiveOrderToUnit(unitID, CMD_FIGHT, { x, y, z }, {"meta"}) diff --git a/LuaUI/Widgets_Evo/unit_customrings.lua b/LuaUI/Widgets_Evo/unit_customrings.lua index c79047190..8b8c5f50d 100644 --- a/LuaUI/Widgets_Evo/unit_customrings.lua +++ b/LuaUI/Widgets_Evo/unit_customrings.lua @@ -26,80 +26,74 @@ end local ringsDefs = { [UnitDefNames.ecommander.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, - { color = {0,1,0,0.6}, lineWidth = 5, radius = 300, divs = 64 }, + -- { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, + --{ color = {0,1,0,0.6}, lineWidth = 5, radius = 300, divs = 64 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ecommandercloak.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ecommandershield.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ecommanderbuild.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1500 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1500 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ecommanderbattle.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 500 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ecommanderfactory.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 500 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 250 }, + --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, + }, + [UnitDefNames.ecommanderhealer.id] = { + -- { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, + { color = {0,1,0,0.6}, lineWidth = 5, radius = 1000, divs = 128 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.eorb.id] = { - { color = {1,0.5,0,0.8}, lineWidth = 2, radius = 498 }, + --{ color = {1,0.5,0,0.8}, lineWidth = 2, radius = 800 }, --{ color = {0.5,0,1,0.2}, lineWidth = 5, radius = 500 }, - { color = {0,1,0,0.6}, lineWidth = 10, radius = 510 }, + { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, }, [UnitDefNames.eorb_up1.id] = { - { color = {1,0.5,0,0.8}, lineWidth = 2, radius = 600 }, + --{ color = {1,0.5,0,0.8}, lineWidth = 2, radius = 800 }, --{ color = {0.5,0,1,0.2}, lineWidth = 5, radius = 500 }, - { color = {0,1,0,0.6}, lineWidth = 10, radius = 650 }, + { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, }, [UnitDefNames.eorb_up2.id] = { - { color = {1,0.5,0,0.8}, lineWidth = 2, radius = 700 }, + --{ color = {1,0.5,0,0.8}, lineWidth = 2, radius = 800 }, --{ color = {0.5,0,1,0.2}, lineWidth = 5, radius = 500 }, - { color = {0,1,0,0.6}, lineWidth = 10, radius = 800 }, + { color = {0,1,0,0.6}, lineWidth = 10, radius = 1050 }, }, [UnitDefNames.eorb_up3.id] = { - { color = {1,0.5,0,0.8}, lineWidth = 2, radius = 800 }, + --{ color = {1,0.5,0,0.8}, lineWidth = 2, radius = 800 }, --{ color = {0.5,0,1,0.2}, lineWidth = 5, radius = 500 }, { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, }, [UnitDefNames.ebox.id] = { { color = {0.5,0,1,0.2}, lineWidth = 5, radius = 500 }, - }, - [UnitDefNames.eengineer5.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 800 }, - --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, - }, - [UnitDefNames.eamphibengineer.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 800 }, - --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, - }, - [UnitDefNames.eallterrengineer.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 800 }, - --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, - }, - [UnitDefNames.eairengineer.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 600 }, }, [UnitDefNames.ehbotengineer.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 800 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 800 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, }, [UnitDefNames.ehbotengineer_turret.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1500 }, + --{ color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, - { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, + { color = {0,1,0,0.6}, lineWidth = 10, radius = 995 }, }, + [UnitDefNames.zarm.id] = { + { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, + }, + -- Shield Units [UnitDefNames.ekmar.id] = { - { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 400 }, + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 750 }, }, [UnitDefNames.eallterrshield.id] = { { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 300 }, @@ -137,7 +131,15 @@ function widget:UnitCreated(uId, uDefId) end end +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') + end +end + function widget:DrawWorldPreUnit() + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end for uId, rings in pairs(ringedUnits) do if (Spring.IsUnitAllied(uId)and Spring.IsUnitSelected(uId)) then local ux, uy, uz = Spring.GetUnitPosition(uId) diff --git a/LuaUI/Widgets_Evo/unit_ghostRadar.lua b/LuaUI/Widgets_Evo/unit_ghostRadar.lua index 21835ac1c..ea656ac93 100644 --- a/LuaUI/Widgets_Evo/unit_ghostRadar.lua +++ b/LuaUI/Widgets_Evo/unit_ghostRadar.lua @@ -1,11 +1,10 @@ -include("colors.h.lua") include("keysym.h.lua") -local versionNumber = "1.11" +local versionNumber = "1.21" function widget:GetInfo() return { - name = "Ghost Radar v" .. string.format("%s", versionNumber ), - desc = "allows ghosted radar dots", + name = "Ghost Radar", + desc = "Allows ghosted radar blips [v" .. string.format("%s", versionNumber ) .. "]", author = "very_bad_soldier", date = "July 21, 2008", license = "GNU GPL v2", @@ -14,25 +13,29 @@ function widget:GetInfo() } end +local lineWidth = 1.0 -- calcs dynamic now + local printDebug -local DrawGhosts -local udefTab = UnitDefs +local udefTab = UnitDefs local spGetUnitDefID = Spring.GetUnitDefID local spEcho = Spring.Echo local spGetUnitPosition = Spring.GetUnitPosition local spGetGameSeconds = Spring.GetGameSeconds local floor = math.floor +local pairs = pairs local spGetMyPlayerID = Spring.GetMyPlayerID local spGetPlayerInfo = Spring.GetPlayerInfo +local spIsUnitInView = Spring.IsUnitInView local glColor = gl.Color local glDepthTest = gl.DepthTest ---local glBlending = gl.Blending -local glUnitShape = gl.UnitShape +local glUnitShape = gl.UnitShape local glPopMatrix = gl.PopMatrix local glPushMatrix = gl.PushMatrix local glTranslate = gl.Translate +local glLoadIdentity = gl.LoadIdentity + ---------------------------------------------------------------- local debug = false @@ -47,22 +50,33 @@ function widget:UnitEnteredRadar(unitID, allyTeam) end function widget:UnitEnteredLos(unitID, allyTeam ) - if ( dots[unitID] == nil ) then - --we dont have information about this unit yet - local udefID = spGetUnitDefID(unitID) - local udef = udefTab[udefID] + --update unitID info, ID could have been reused already! + local udefID = spGetUnitDefID(unitID) + local udef = udefTab[udefID] - --skip buildings, they get ghosted anyway - if ( udef.isBuilding == false and udef.isFactory == false ) then - dots[unitID] = {} - dots[unitID]["unitDefId"] = udefID - dots[unitID]["teamId"] = allyTeam - dots[unitID]["radar"] = true - end + --skip buildings, they get ghosted anyway + if ( udef.isBuilding == false and udef.isFactory == false ) then + dots[unitID] = {} + dots[unitID]["unitDefId"] = udefID + dots[unitID]["teamId"] = allyTeam + dots[unitID]["radar"] = true + dots[unitID]["los"] = true + else + dots[unitID] = nil end - +end + + +function widget:UnitCreated(unitID, allyTeam) + --kill the dot info if this unitID gets reused on own team if ( dots[unitID] ~= nil ) then - dots[unitID]["los"] = true + dots[unitID] = nil + end +end + +function widget:UnitDestroyed(unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeamID) + if ( dots[unitID] ~= nil ) then + dots[unitID] = nil end end @@ -80,33 +94,23 @@ end function widget:DrawWorld() - DrawGhosts() -end - - -function DrawGhosts() - glColor(1.0, 1.0, 1.0, 0.35 ) - glDepthTest(true) + glColor(1.0, 1.0, 1.0, 0.35 ) + glDepthTest(true) for unitID, dot in pairs( dots ) do - if ( dot["radar"] == true ) and ( dot["los"] == false ) and ( dot["unitDefId"] ~= nil ) then - - local x, y, z = spGetUnitPosition(unitID) - -- printDebug("DRAW udef: " .. dot["unitDefId"] .. " x: " .. x .. " y: " .. y .. " z:" .. z ) - if ( x ~= nil ) then --i hope checking x instead of xyz is ok - glPushMatrix() - glTranslate( x, y + 5 , z) - - glUnitShape( dot["unitDefId"], dot["teamId"] ) - - glPopMatrix() - end + if ( dot["radar"] == true ) and ( dot["los"] == false ) and ( dot["unitDefId"] ~= nil ) then + local x, y, z = spGetUnitPosition(unitID) + if x and ( spIsUnitInView(unitID) ) then + glPushMatrix() + glLoadIdentity() + glTranslate( x, y + 5 , z) + glUnitShape( dot["unitDefId"], dot["teamId"], false, false, false) + glPopMatrix() end + end end glDepthTest(false) - -- glBlending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA); - -- glBlending(false) glColor(1, 1, 1, 1) end @@ -117,13 +121,8 @@ function widget:Update() -- update timers once every seconds if (time % updateInt == 0 and time ~= lastTime) then lastTime = time - --do update stuff: - local playerID = spGetMyPlayerID() - local _, _, spec, _, _, _, _, _ = spGetPlayerInfo(playerID) - - if ( spec == true ) then - spEcho(" Spectator mode. Widget removed.") - widgetHandler:RemoveWidget() + if select(3,spGetPlayerInfo(spGetMyPlayerID(),false)) then + widgetHandler:RemoveWidget(self) return false end end @@ -143,4 +142,4 @@ function printDebug( value ) spEcho( value ) end end -end \ No newline at end of file +end diff --git a/LuaUI/Widgets_Evo/unit_setUnitHoldFire.lua b/LuaUI/Widgets_Evo/unit_setUnitHoldFire.lua new file mode 100644 index 000000000..73101ef22 --- /dev/null +++ b/LuaUI/Widgets_Evo/unit_setUnitHoldFire.lua @@ -0,0 +1,81 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +function widget:GetInfo() + return { + name = "Set Unit to Hold Fire", + desc = "Sets certain units to Hold Fire automagically", + author = "[teh]decay", + date = "29 sept 2013", + license = "GNU GPL, v2 or later", + version = 1, + layer = 5, + enabled = true -- loaded by default? + } +end + +------------------------------- + +local spGiveOrderToUnit = Spring.GiveOrderToUnit +local spGetMyTeamId = Spring.GetMyTeamID +local spGetTeamUnits = Spring.GetTeamUnits +local spGetUnitDefID = Spring.GetUnitDefID +-------------------------------------------------------------------------------- + + +function widget:Update() + +end + +function widget:UnitCreated(unitID, unitDefID, teamID, builderID) + if(teamID == spGetMyTeamId()) then + switchUnitToHoldFire(unitID, unitDefID) + end +end + +function widget:UnitTaken(unitID, unitDefID, unitTeam, newTeam) + if(newTeam == spGetMyTeamId()) then + switchUnitToHoldFire(unitID, unitDefID) + end +end + + +function widget:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) + if(unitTeam == spGetMyTeamId()) then + switchUnitToHoldFire(unitID, unitDefID) + end +end + + +function switchUnitToHoldFire(unitID, unitDefID) + if (unitDefID == UnitDefNames["ecommandermeteor"].id) then + spGiveOrderToUnit(unitID, CMD.FIRE_STATE, { 0 }, {}) + end +end + +function widget:PlayerChanged(playerID) + local _, _, spec = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) + if spec then + widgetHandler:RemoveWidget() + return false + end +end + + +function widget:Initialize() + local _, _, spec, teamId = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) + if spec then + widgetHandler:RemoveWidget() + return false + end + + for _, unitID in ipairs(spGetTeamUnits(teamId)) do -- init existing labs + switchUnitToHoldFire(unitID, spGetUnitDefID(unitID)) + end + + return true +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + diff --git a/LuaUI/Widgets_Evo/unit_showbuilderqueue.lua b/LuaUI/Widgets_Evo/unit_showbuilderqueue.lua new file mode 100644 index 000000000..676da6926 --- /dev/null +++ b/LuaUI/Widgets_Evo/unit_showbuilderqueue.lua @@ -0,0 +1,216 @@ +function widget:GetInfo() + return { + name = "Show Builder Queue", -- old name: Show Build + desc = "Shows buildings about to be built", + author = "WarXperiment", + date = "February 15, 2010", + license = "GNU GPL, v2 or later", + version = "5", + layer = 55, + enabled = false, -- loaded by default? + } +end + +local showForCreatedUnits = false -- keep drawing unitshape for building when it has a nanoframe but isnt finished + +--Changelog +-- before v2 developed outside of BA by WarXperiment +-- v2 [teh]decay - fixed crash: Error in DrawWorld(): [string "LuaUI/Widgets/unit_showbuild.lua"]:82: bad argument #1 to 'GetTeamColor' (number expected, got no value) +-- v3 [teh]decay - updated for spring 98 engine -- project page on github: https://github.com/jamerlan/unit_showbuild +-- v4 Floris - lots of performance increases +-- v5 Floris - cleanup, polishing and fixes + +local command = {} +local commandOrdered = {} +local commandCreatedUnits = {} +local commandCreatedUnitsIDs = {} +local builders = {} +local myPlayerID = Spring.GetMyPlayerID() +local maxDisplayed = 150 + +local builderUnitDefs = {} +for udefID,def in ipairs(UnitDefs) do + if def.isBuilder and not def.isFactory and def.buildOptions[1] then + local buildOptions = {} + for _,unit in ipairs(def.buildOptions) do + buildOptions[unit] = true + end + builderUnitDefs[udefID] = buildOptions + end +end + +function updateBuilders() + for unitID, _ in pairs(builders) do + checkBuilder(unitID) + end +end + +function addBuilders() + command = {} + local allUnits = Spring.GetAllUnits() + for _, unitID in ipairs(allUnits) do + local uDefID = Spring.GetUnitDefID(unitID) + if builderUnitDefs[uDefID] then + builders[unitID] = true + checkBuilder(unitID) + end + end +end + +function widget:Initialize() + if Spring.GetGameFrame() > 0 then + addBuilders() + end +end + +function widget:PlayerChanged(playerID) + if playerID == myPlayerID and Spring.GetGameFrame() > 0 and Spring.GetSpectatingState() then + addBuilders() + updateBuilders() + end +end + +function clearBuilderCommands(unitID) + if commandOrdered[unitID] then + for id, _ in pairs(commandOrdered[unitID]) do + if command[id] and command[id][unitID] then + command[id][unitID] = nil + command[id].builders = command[id].builders - 1 + if command[id].builders == 0 then + command[id] = nil + end + end + end + commandOrdered[unitID] = nil + end +end + +local gameFrame = Spring.GetGameFrame() +function widget:GameFrame(gf) + gameFrame = gf +end + +local newUnitCommands = {} +function widget:UnitCommand(unitID, unitDefID, teamID, cmdID, _, _) + if builderUnitDefs[unitDefID] then + newUnitCommands[unitID] = os.clock() + 0.05 + end +end + +local sec = 0 +local lastUpdate = 0 +function widget:Update(dt) + sec = sec + dt + if sec > lastUpdate + 0.1 then + lastUpdate = sec + + -- process newly given commands (not done in widgetUnitCommand() because with huge build queue it eats memory and can crash lua) + local clock = os.clock() + for unitID, cmdClock in pairs(newUnitCommands) do + if clock > cmdClock then + checkBuilder(unitID) + newUnitCommands[unitID] = nil + end + end + end +end + +function checkBuilder(unitID) + clearBuilderCommands(unitID) + local queue = Spring.GetCommandQueue(unitID, 200) + if(queue and #queue > 0) then + for _, cmd in ipairs(queue) do + if ( cmd.id < 0 ) then + local myCmd = { + id = math.abs(cmd.id), + teamid = Spring.GetUnitTeam(unitID), + params = cmd.params + } + local y = cmd.params[2] + if UnitDefs[math.abs(cmd.id)].minWaterDepth < 0 then -- AI bots queue very high y pos so this corrects that + y = Spring.GetGroundHeight(cmd.params[1],cmd.params[3]) + else + y = - UnitDefs[math.abs(cmd.id)].waterline + end + myCmd.params[2] = y + local id = Spring.GetUnitTeam(unitID)..'_'..math.abs(cmd.id)..'_'..cmd.params[1]..'_'..myCmd.params[2]..'_'..cmd.params[3] + if showForCreatedUnits or commandCreatedUnits[id] == nil then + if command[id] == nil then + command[id] = {id = myCmd, builders = 0} + end + command[id][unitID] = true + command[id].builders = command[id].builders + 1 + if commandOrdered[unitID] == nil then + commandOrdered[unitID] = {} + end + commandOrdered[unitID][id] = true + end + end + end + end +end + +function widget:UnitFinished(unitID, unitDefID, unitTeam) + if commandCreatedUnitsIDs[unitID] then + commandCreatedUnits[commandCreatedUnitsIDs[unitID]] = nil + commandCreatedUnitsIDs[unitID] = nil + end +end + +function widget:UnitCreated(unitID, unitDefID, unitTeam, builderID) + local x,y,z = Spring.GetUnitPosition(unitID) + if UnitDefs[unitDefID].minWaterDepth < 0 then + y = Spring.GetGroundHeight(x,z) + else + y = - UnitDefs[unitDefID].waterline + end + if command[unitTeam..'_'..unitDefID..'_'..x..'_'..y..'_'..z] then + command[unitTeam..'_'..unitDefID..'_'..x..'_'..y..'_'..z] = nil + commandCreatedUnitsIDs[unitID] = unitTeam..'_'..unitDefID..'_'..x..'_'..y..'_'..z + commandCreatedUnits[unitTeam..'_'..unitDefID..'_'..x..'_'..y..'_'..z] = true + end + if builderUnitDefs[unitDefID] then + builders[unitID] = true + end +end + +function widget:UnitDestroyed(unitID, unitDefID, unitTeam, builderID) + if builders[unitID] then + builders[unitID] = nil + newUnitCommands[unitID] = nil + clearBuilderCommands(unitID) + end + if commandCreatedUnitsIDs[unitID] then + commandCreatedUnits[commandCreatedUnitsIDs[unitID]] = nil + end +end + + +function widget:DrawWorld() + if Spring.IsGUIHidden() then return end + + gl.DepthTest(true) + local commandVisible = 0 + for _, units in pairs(command) do + local myCmd = units.id + local params = myCmd.params + + local x, y, z = params[1], params[2], params[3] + local degrees = params[4] ~= nil and params[4] * 90 or 0 -- mex command doesnt supply param 4 + if Spring.IsAABBInView(x-1,y-1,z-1,x+1,y+1,z+1) then + gl.PushMatrix() + gl.LoadIdentity() + gl.Translate( x, y, z ) + gl.Rotate( degrees, 0, 1.0, 0 ) + gl.UnitShape(myCmd.id, myCmd.teamid, false, false, false) + gl.PopMatrix() + commandVisible = commandVisible + 1 + if commandVisible > maxDisplayed then + break + end + end + end + gl.DepthTest(false) + gl.Color(1, 1, 1, 1) +end + diff --git a/LuaUI/Widgets_Evo/unit_smart_select.lua b/LuaUI/Widgets_Evo/unit_smart_select.lua index 5392ebf76..420832f16 100644 --- a/LuaUI/Widgets_Evo/unit_smart_select.lua +++ b/LuaUI/Widgets_Evo/unit_smart_select.lua @@ -19,7 +19,7 @@ function widget:GetInfo() author = "aegis", date = "Jan 2, 2011", license = "Public Domain", - layer = 0, + layer = -99999999999, enabled = true } end @@ -32,6 +32,8 @@ end local selectBuildingsWithMobile = false local includeNanosAsMobile = true +local includeBuilders = true + -- only select new units identical to those already selected local sameSelectKey = 'z' @@ -66,7 +68,7 @@ local IsAboveMiniMap = Spring.IsAboveMiniMap local GetUnitDefID = Spring.GetUnitDefID local GetUnitPosition = Spring.GetUnitPosition -local GetUnitCommands = Spring.GetUnitCommands +local GetCommandQueue = Spring.GetCommandQueue local UnitDefs = UnitDefs local min = math.min @@ -160,13 +162,33 @@ local function GetUnitsInScreenRectangle(x1, y1, x2, y2, team) return result end + +local selectedUnits = Spring.GetSelectedUnits() +function widget:SelectionChanged(sel) + local equalSelection = true + for k,v in pairs(sel) do + if selectedUnits[k] ~= v then + equalSelection = false + break + end + end + selectedUnits = sel + if (referenceCoords ~= nil and GetActiveCommand() == 0) then + if not select(3,GetMouseState()) and referenceSelection ~= nil and lastSelection ~= nil and equalSelection then + WG['smartselect'].updateSelection = false -- widgethandler uses this to ignore the engine mouserelease selection + end + end +end + function widget:MousePress(x, y, button) if (button == 1) then - referenceSelection = GetSelectedUnits() + referenceSelection = selectedUnits referenceSelectionTypes = {} for i=1, #referenceSelection do udid = GetUnitDefID(referenceSelection[i]) - referenceSelectionTypes[udid] = 1 + if udid then + referenceSelectionTypes[udid] = 1 + end end referenceScreenCoords = {x, y} lastMeta = nil @@ -209,29 +231,26 @@ function widget:GetConfigData(data) savedTable = {} savedTable.selectBuildingsWithMobile = selectBuildingsWithMobile savedTable.includeNanosAsMobile = includeNanosAsMobile + savedTable.includeBuilders = includeBuilders return savedTable end function widget:SetConfigData(data) if data.selectBuildingsWithMobile ~= nil then selectBuildingsWithMobile = data.selectBuildingsWithMobile end - if data.includeNanosAsMobile ~= nil then includeNanosAsMobile = data.includeNanosAsMobile end + if data.includeNanosAsMobile ~= nil then includeNanosAsMobile = data.includeNanosAsMobile end + if data.includeBuilders ~= nil then includeBuilders = data.includeBuilders end end - function widget:Update() - --[[ - local newUpdate = GetTimer() - if (DiffTimers(newUpdate, lastUpdate) < 0.1) then - return - end - lastUpdate = newUpdate - --]] + WG['smartselect'].updateSelection = true if (referenceCoords ~= nil and GetActiveCommand() == 0) then - x, y, pressed = GetMouseState() + local x, y, pressed = GetMouseState() + local px, py, sx, sy = GetMiniMapGeometry() - - if (pressed) and (referenceSelection ~= nil) then + + if (pressed or lastSelection) and (referenceSelection ~= nil) then + local alt, ctrl, meta, shift = GetModKeyState() if (#referenceSelection == 0) then -- no point in inverting an empty selection @@ -240,7 +259,7 @@ function widget:Update() local sameSelect = GetKeyState(sameSelectKey) local idleSelect = GetKeyState(idleSelectKey) - + local sameLast = (referenceScreenCoords ~= nil) and (x == referenceScreenCoords[1] and y == referenceScreenCoords[2]) if (sameLast and lastCoords == referenceCoords) then return @@ -255,7 +274,7 @@ function widget:Update() local mouseSelection, originalMouseSelection local r = referenceScreenCoords - local playing = GetPlayerInfo(myPlayerID).spectating == false + local playing = GetPlayerInfo(myPlayerID,false).spectating == false local team = (playing and GetMyTeamID()) if (r ~= nil and IsAboveMiniMap(r[1], r[2])) then local mx, my = max(px, min(px+sx, x)), max(py, min(py+sy, y)) @@ -267,17 +286,21 @@ function widget:Update() end originalMouseSelection = mouseSelection - + -- filter gaia units local filteredselection = {} - for i=1, #mouseSelection do - if GetUnitTeam(mouseSelection[i]) ~= GaiaTeamID then - table.insert(filteredselection, mouseSelection[i]) + local filteredselectionCount = 0 + if not Spring.IsGodModeEnabled() then + for i=1, #mouseSelection do + if GetUnitTeam(mouseSelection[i]) ~= GaiaTeamID then + filteredselectionCount = filteredselectionCount + 1 + filteredselection[filteredselectionCount] = mouseSelection[i] + end end + mouseSelection = filteredselection end - mouseSelection = filteredselection filteredselection = nil - + local newSelection = {} local uid, udid, udef, tmp @@ -286,7 +309,7 @@ function widget:Update() for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) - if (mobileFilter[udid] or builderFilter[udid]) and (#GetUnitCommands(uid, 1) == 0) then + if (mobileFilter[udid] or builderFilter[udid]) and (GetCommandQueue(uid, 0) == 0) then tmp[#tmp+1] = uid end end @@ -345,13 +368,21 @@ function widget:Update() if (mobiles) then tmp = {} + local tmp2 = {} for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (buildingFilter[udid] == false) then - tmp[#tmp+1] = uid + if (includeBuilders or not builderFilter[udid]) then + tmp[#tmp+1] = uid + else + tmp2[#tmp2+1] = uid + end end end + if #tmp == 0 then + tmp = tmp2 + end mouseSelection = tmp end end @@ -394,20 +425,23 @@ function widget:Update() lastSelection = nil return end - lastSelection = GetSelectedUnits() - elseif (lastSelection ~= nil) then - SelectUnitArray(lastSelection) - lastSelection = nil - referenceSelection = nil - referenceSelectionTypes = nil - referenceCoords = nil - minimapRect = nil + + if pressed then + lastSelection = true --selectedUnits + else + lastSelection = nil + referenceSelection = nil + referenceSelectionTypes = nil + referenceCoords = nil + minimapRect = nil + end else referenceSelection = nil referenceSelectionTypes = nil referenceCoords = nil minimapRect = nil end + end end @@ -419,7 +453,7 @@ function init() mobileFilter = {} for udid, udef in pairs(UnitDefs) do - local mobile = (udef.canMove and udef.speed > 0.000001) or (includeNanosAsMobile and (UnitDefs[udid].name == "armnanotc" or UnitDefs[udid].name == "cornanotc" or UnitDefs[udid].name == "armnanotcplat" or UnitDefs[udid].name == "cornanotcplat")) + local mobile = (udef.canMove and udef.speed > 0.000001) or (includeNanosAsMobile and (UnitDefs[udid].name == "armnanotc" or UnitDefs[udid].name == "cornanotc")) local builder = (udef.canReclaim and udef.reclaimSpeed > 0) or --(udef.builder and udef.buildSpeed > 0) or -- udef.builder = deprecated it seems (udef.canResurrect and udef.resurrectSpeed > 0) or @@ -441,12 +475,19 @@ end function widget:Initialize() WG['smartselect'] = {} - WG['smartselect'].getIncludeBuildings = function() - return selectBuildingsWithMobile - end - WG['smartselect'].setIncludeBuildings = function(value) - selectBuildingsWithMobile = value - end + WG['smartselect'].getIncludeBuildings = function() + return selectBuildingsWithMobile + end + WG['smartselect'].setIncludeBuildings = function(value) + selectBuildingsWithMobile = value + end + WG['smartselect'].getIncludeBuilders = function() + return includeBuilders + end + WG['smartselect'].setIncludeBuilders = function(value) + includeBuilders = value + end + WG['smartselect'].updateSelection = false init() end @@ -459,11 +500,13 @@ local function DrawRectangle(r) glVertex(r[1], 0, r[2]) end -function widget:DrawWorld() - if (minimapRect ~= nil) then - glColor(1, 1, 1, 1) - glLineWidth(1.0) - glDepthTest(false) - glBeginEnd(GL_LINE_STRIP, DrawRectangle, minimapRect) - end -end + + +--function widget:DrawWorld() +-- if (minimapRect ~= nil) then +-- glColor(1, 1, 1, 1) +-- glLineWidth(1.0) +-- glDepthTest(false) +-- glBeginEnd(GL_LINE_STRIP, DrawRectangle, minimapRect) -- drawing coordinates display incorrect +-- end +--end diff --git a/LuaUI/main_evo.lua b/LuaUI/main_evo.lua index 4c4fc3b18..3612b56ab 100644 --- a/LuaUI/main_evo.lua +++ b/LuaUI/main_evo.lua @@ -15,6 +15,10 @@ Spring.SendCommands({"ctrlpanel " .. LUAUI_DIRNAME .. "ctrlpanel.txt"}) VFS.Include(LUAUI_DIRNAME .. 'utils.lua', utilFile) +WG = {} +Spring.Utilities = {} +VFS.Include("LuaRules/Utilities/glvolumes.lua") + include("setupdefs.lua") include("savetable.lua") diff --git a/LuaUI/widgets_evo.lua b/LuaUI/widgets_evo.lua index 5f5f32aa9..80af22e60 100644 --- a/LuaUI/widgets_evo.lua +++ b/LuaUI/widgets_evo.lua @@ -148,6 +148,7 @@ local flexCallIns = { 'UnitDecloaked', 'UnitMoveFailed', 'RecvLuaMsg', + 'SelectionChanged', 'StockpileChanged', 'DrawGenesis', 'DrawWorld', @@ -155,8 +156,11 @@ local flexCallIns = { 'DrawWorldShadow', 'DrawWorldReflection', 'DrawWorldRefraction', + 'DrawUnitsPostDeferred', + 'DrawFeaturesPostDeferred', 'DrawScreenEffects', 'DrawInMiniMap', + 'SunChanged', 'RecvSkirmishAIMessage', } local flexCallInMap = {} @@ -1191,6 +1195,9 @@ end function widgetHandler:CommandsChanged() + if widgetHandler:UpdateSelection() then -- for selectionchanged + return -- selection updated, don't call commands changed. + end self.inCommandsChanged = true self.customCommands = {} for _,w in ipairs(self.CommandsChangedList) do @@ -1301,6 +1308,22 @@ function widgetHandler:DrawWorldRefraction() end +function widgetHandler:DrawUnitsPostDeferred() + for _,w in ripairs(self.DrawUnitsPostDeferredList) do + w:DrawUnitsPostDeferred() + end + return +end + + +function widgetHandler:DrawFeaturesPostDeferred() + for _,w in ripairs(self.DrawFeaturesPostDeferredList) do + w:DrawFeaturesPostDeferred() + end + return +end + + function widgetHandler:DrawScreenEffects(vsx, vsy) for _,w in ripairs(self.DrawScreenEffectsList) do w:DrawScreenEffects(vsx, vsy) @@ -1316,6 +1339,13 @@ function widgetHandler:DrawInMiniMap(xSize, ySize) return end +function widgetHandler:SunChanged() + for _,w in ripairs(self.SunChangedList) do + w:SunChanged() + end + return +end + -------------------------------------------------------------------------------- -- @@ -1643,6 +1673,58 @@ function widgetHandler:GameFrame(frameNum) return end +-- local helper (not a real call-in) +local oldSelection = {} +function widgetHandler:UpdateSelection() + local changed + local newSelection = Spring.GetSelectedUnits() + if (#newSelection == #oldSelection) then + for i = 1, #oldSelection do + if (newSelection[i] ~= oldSelection[i]) then -- it seems the order stays + changed = true + break + end + end + else + changed = true + end + if (changed) then + local subselection = true + if #newSelection > #oldSelection then + subselection = false + else + local newSeen = 0 + local oldSelectionMap = {} + for i = 1, #oldSelection do + oldSelectionMap[oldSelection[i]] = true + end + for i = 1, #newSelection do + if not oldSelectionMap[newSelection[i]] then + subselection = false + break + end + end + end + if widgetHandler:SelectionChanged(newSelection, subselection) then + -- selection changed, don't set old selection to new selection as it is soon to change. + return true + end + end + oldSelection = newSelection + return false +end + +function widgetHandler:SelectionChanged(selectedUnits, subselection) + for _,w in ipairs(self.SelectionChangedList) do + if widgetHandler.WG['smartselect'] and not widgetHandler.WG['smartselect'].updateSelection then return end + local unitArray = w:SelectionChanged(selectedUnits, subselection) + if (unitArray) then + Spring.SelectUnitArray(unitArray) + return true + end + end + return false +end function widgetHandler:ShockFront(power, dx, dy, dz) for _,w in ipairs(self.ShockFrontList) do diff --git a/ModOptions.lua b/ModOptions.lua index 79ae8724a..10402d73d 100644 --- a/ModOptions.lua +++ b/ModOptions.lua @@ -33,25 +33,10 @@ local options= { -- Shard AI Options { key = 'aioptions', - name = 'Shard AI Options', + name = 'DAI (AI Opponent) Options', desc = 'Allows you to adjust ShardLua settings', type = 'section', }, - { - key="aidifficulty", - name="ShardLua AI Difficulty", - desc="Modifies how much Shard cheats", - type="list", - def="easy", - section="aioptions", - items={ - --{key="veryeasy", name="Very Easy", desc="Very Easy AI"}, - {key="easy", name="Easy", desc="Basic AI that isn't cheating (well, still does, but have no real advantage over player)"}, - --{key="medium", name="Medium", desc="Medium AI"}, - {key="hard", name="Hard", desc="Hard AI that have infinite resources and inscreased buildspeed"}, - --{key="insane", name="Insane", desc="Very Hard AI"}, - } - }, { key = 'aidebug', name = 'AI is spamming chat with debug values', @@ -64,6 +49,29 @@ local options= { {key="enabled", name="Enabled", desc="Cries in Spam"}, } }, + { + key = 'ai_enableincomemultiplier', + name = 'Enable DAI resource cheats', + desc = 'Enable DAI resource cheats', + type="list", + def="disabled", + section= "aioptions", + items={ + {key="disabled", name="Disabled", desc="Clean, non cheating AI"}, + {key="enabled", name="Enabled", desc="Laughs in hardcore"}, + } + }, + { + key = 'ai_incomemultiplier', + name = 'AI Income Percentage', + desc = 'Percentage of AI resource income compared to the default (100 = 100%, I.E. Normal. 200 = 200%, which would mean that the AI income would be double the player income)', + type = 'number', + section= 'aioptions', + def = 100, + min = 1, + max = 1000, + step = 1, + }, -- Resourcing { @@ -73,29 +81,93 @@ local options= { type = 'section', }, { - key = 'metalextractorcommunism', - name = 'Metal Extractor Communism', - desc = 'If enabled, then all metal income from Metal Extractors is split between allies. This means that it does not matter which ally owns the metal extractor, the entire team will benefit.', + key = 'mexlayout', + name = 'Default Metal Spot Layout', + desc = 'If enabled, the default layout for metal spots will be used, if disabled, the metal spots defined by the map will be used.', type="list", - def="disabled", + def="enabled", section= "resourcing", items={ - {key="disabled", name="Disabled", desc="Metal Extractor income will NOT be split between allies."}, - {key="enabled", name="Enabled", desc="Metal Extractor income will be split between allies."}, + {key="disabled", name="Disabled", desc="Use the Metal Map Layout defined in the map"}, + {key="enabled", name="Enabled", desc="Default Metal Map Layout"}, + } + }, + { + key = 'mexrandomlayout', + name = 'Metal Spot Layout to use', + desc = 'This allows you to choose between the different metal spot layouts that are available.', + type="list", + def="standard", + section= "resourcing", + items={ + {key="standard", name="Standard", desc="Random placing that is mirrored. Has various methods for different map shapes and is more careful with metal spot placement."}, + {key="ffa", name="Free For All", desc=""}, + {key="legacy1", name="Legacy 1", desc="Most uniform layout. Max metal ~49.1, Max metal spots 56."}, + {key="legacy2", name="Legacy 2", desc="Less uniform, more clustered layout. Max metal ~50, Max metal spots 56."}, + {key="legacy3", name="Legacy 3", desc="The Pitchfork! Dense metal layout with lower output per metal spot. Max metal ~51.1, Max metal spots 94."}, + {key="legacy4", name="Legacy 4", desc=""}, } }, { - key = 'mexincomemultiplier', - name = 'Metal Extractors Income Multiplier', - desc = 'Resource Node values are multiplied by this percentage.', + key = 'maximummexelevationdifference', + name = 'Standard Metal Spot Layout: Maximum elevation difference for Metal Spot locations', + desc = 'This is used as an attempt to avoid placement on cliffs (only works on Standard Metal Spot Layout)', type = 'number', section= 'resourcing', - def = 50, -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions + def = 50, min = 0, max = 200, step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + { + key = 'allowmexesinwater', + name = 'Standard Metal Spot Layout: Allow metal spots to be placed in water?', + desc = 'Should metal spots be placed in water? Sometimes turning this off can be beneficial if the water on a map does damage. (only works on Standard Metal Spot Layout)', + type="list", + def="disabled", + section= "resourcing", + items={ + {key="disabled", name="Disabled", desc="Disallow metal spots being placed in water."}, + {key="enabled", name="Enabled", desc="Allow metal spots to be placed in water."}, + } + }, + { + key = 'dynamicmexoutput', + name = 'Should metal spot output values be dynamic?', + desc = 'Uses a sine to determine metal spot values based upon distance from the edge of the map and distance to the center.', + type="list", + def="disabled", + section= "resourcing", + items={ + {key="disabled", name="Disabled", desc="All metal spot output values will be set to 1.0"}, + {key="enabled", name="Enabled", desc="All metal spot output values will be automatically calculated"}, + } + }, + { + key = 'mexspotspersidemultiplier', + name = 'Metal spot per side percentage modifier', + desc = 'This is a percentage modifier for the amount of metal spots on a map. A setting of 100 is literally 100%, so increasing to 200% will double the amount of metal spots that are placed on the map. Remember that the amount of metal spots is already scaled according to how many players are in the game.', + type = 'number', + section= 'resourcing', + def = 100, + min = 1, + max = 200, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'metalextractorcommunism', + name = 'Metal Extractor Communism', + desc = 'If enabled, then all metal income from Metal Extractors is split between allies. This means that it does not matter which ally owns the metal extractor, the entire team will benefit.', + type="list", + def="disabled", + section= "resourcing", + items={ + {key="disabled", name="Disabled", desc="Metal Extractor income will NOT be split between allies."}, + {key="enabled", name="Enabled", desc="Metal Extractor income will be split between allies."}, + } + }, { key = 'mincome', name = 'Automatic Metal Income', @@ -111,7 +183,7 @@ local options= { { key = 'basicincome', name = 'Basic Metal Income Amount', - desc = 'Determines the amount of metal income you start with per second. It increases every (2.5 minutes, is the default) by this amount until it hits income.', + desc = 'Determines the amount of metal income you start with per second.', type = 'number', section= 'resourcing', def = 1, @@ -132,13 +204,25 @@ local options= { step = 0.5, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + { + key = 'basicincomeincrease', + name = 'Basic Metal Income Increase', + desc = 'Your basic metal income increases every (1 minutes, is the default) by this amount until it hits income.', + type = 'number', + section= 'resourcing', + def = 1, + min = 0, + max = 5, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, { key = 'maxbasicincome', name = 'Maximum Basic Metal Income', desc = 'Determines the maximum amount that your basic metal income level can reach.', type = 'number', section= 'resourcing', - def = 5, + def = 10, min = 0, max = 30, step = 1, -- quantization is aligned to the def value @@ -157,10 +241,10 @@ local options= { desc = 'Determines the maximum army supply that is allowed.', type = 'number', section= 'supplyoptions', - def = 400, - min = 0, - max = 400, - step = 1, -- quantization is aligned to the def value + def = 1000000, + min = 50, + max = 1000000, + step = 50, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, { @@ -169,13 +253,44 @@ local options= { desc = 'How much supply is available from the beginning of the game without needing supply depots?', type = 'number', section= 'supplyoptions', - def = 0, - min = 0, + def = 10, + min = 10, max = 400, step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + { + key = 'mexcost', + name = 'Metal Extractor Costs', + desc = 'Allows you to set the cost of Metal Extractors', + type = 'section', + }, + { + key = 'metalextractorcostateran', + name = 'Ateran Metal Extractor Cost', + desc = 'How much metal does an Ateran Metal Extractor cost?', + type = 'number', + section= 'mexcost', + def = 50, + min = 1, + max = 500, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'metalextractorcostzaal', + name = 'Zaal Metal Extractor Cost', + desc = 'How much metal does an Zaal Metal Extractor cost?', + type = 'number', + section= 'mexcost', + def = 65, + min = 1, + max = 500, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + -- Gameplay Options { key = 'gameplayoptions', @@ -183,6 +298,55 @@ local options= { desc = 'Various gameplay options that will change how the game is played.', type = 'section', }, + { + key = 'unithealthmodifier', + name = 'Unit Health Modifier', + desc = 'This acts as a percentage of base unit health. Setting to 200 would double unit hitpoints.', + type = 'number', + section= 'gameplayoptions', + def = 500, + min = 1, + max = 2000, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'scavengers', + name = 'Scavenger amount', + desc = 'This multiplier will be applied on the amount of civilians a map will end up with', + type = 'number', + section= 'gameplayoptions', + def = 0, + min = 0, + max = 5, + step = 0.1, + }, + { + key = 'scavengerstech', + name = 'Scavengers Tech Speed', + desc = 'Determines how fast scav tech ramps up. Adaptive will adjust to players skill', + type = 'list', + section = 'gameplayoptions', + def = "adaptive", + items={ + {key="adaptive", name="Adaptive", desc="Adapts to players skill"}, + {key="easy", name="Easy", desc="Slow ramp up for newbies and noobs"}, + {key="medium", name="Medium", desc="Normal ramp up for slightly experienced players"}, + {key="hard", name="Hard", desc="Hard ramp up for experienced players"}, + {key="brutal", name="Brutal", desc="You'll die"}, + } + }, + { + key = 'lootboxes', + name = 'Lootboxes', + desc = '1 to enable, 0 to disable', + type = 'number', + section= 'gameplayoptions', + def = 1, + min = 0, + max = 1, + step = 1, + }, { key="deathmode", name="Game End Mode", @@ -398,194 +562,6 @@ local options= { -- (step <= 0) means that there is no quantization }, -- End Control Victory Options - --- Chicken Defense Options - { - key = 'chicken_defense_options', - name = 'Chicken Defense Options', - desc = 'Various gameplay options that will change how the Chicken Defense is played.', - type = 'section', - }, - { - key="mo_chickenstart", - name="Burrow Placement", - desc="Control where burrows spawn", - type="list", - def="alwaysbox", - section="chicken_defense_options", - items={ - {key="anywhere", name="Anywhere", desc="Burrows can spawn anywhere"}, - {key="avoid", name="Avoid Players", desc="Burrows do not spawn on player units"}, - {key="initialbox", name="Initial Start Box", desc="First wave spawns in chicken start box, following burrows avoid players"}, - {key="alwaysbox", name="Always Start Box", desc="Burrows always spawn in chicken start box"}, - } - }, - { - key="mo_queendifficulty", - name="Queen Difficulty", - desc="How hard is the Chicken Queen?", - type="list", - def="automatic", - section="chicken_defense_options", - items={ - {key="automatic", name="Automatic", desc="Automatically chooses queen difficulty based upon overall Chickens difficulty"}, - {key="ve_chickenq", name="Very Easy", desc="Cakewalk"}, - {key="e_chickenq", name="Easy", desc="Somewhat Challenging"}, - {key="n_chickenq", name="Normal", desc="A Good Challenge"}, - {key="h_chickenq", name="Hard", desc="Serious Business"}, - {key="vh_chickenq", name="Very Hard", desc="Extreme Challenge"}, - {key="epic_chickenq", name="Epic!", desc="Impossible!"}, - {key="asc", name="Ascending", desc="Each difficulty after the next"}, - } - }, - { - key = "mo_queentime", - name = "Max Queen Arrival (Minutes)", - desc = "Queen will spawn after given time.", - type = "number", - def = 40, - min = 1, - max = 90, - step = 1, - section= "chicken_defense_options", - }, - { - key = "mo_maxchicken", - name = "Chicken Limit", - desc = "Maximum number of chickens on map.", - type = "number", - def = 300, - min = 50, - max = 5000, - step = 25, - section= "chicken_defense_options", - }, - { - key = "mo_graceperiod", - name = "Grace Period (Seconds)", - desc = "Time before chickens become active.", - type = "number", - def = 300, - min = 5, - max = 900, - step = 5, - section= "chicken_defense_options", - }, - { - key = "mo_queenanger", - name = "Add Queen Anger", - desc = "Killing burrows adds to queen anger.", - type = "bool", - def = true, - section= "chicken_defense_options", - }, - --- Chicken Defense Custom Difficulty Settings - { - key = 'chicken_defense_custom_difficulty_settings', - name = 'Chicken Defense Custom Difficulty Settings', - desc = 'Use these settings to adjust the difficulty of Chicken Defense', - type = 'section', - }, - { - key = "mo_custom_burrowspawn", - name = "Burrow Spawn Rate (Seconds)", - desc = "Time between burrow spawns.", - type = "number", - def = 120, - min = 1, - max = 600, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_chickenspawn", - name = "Wave Spawn Rate (Seconds)", - desc = "Time between chicken waves.", - type = "number", - def = 90, - min = 10, - max = 600, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_minchicken", - name = "Min Chickens Per Player", - desc = "Minimum Number of chickens before spawn chance kicks in", - type = "number", - def = 8, - min = 1, - max = 250, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_spawnchance", - name = "Spawn Chance (Percent)", - desc = "Percent chance of each chicken spawn once greater thwn the min chickens per player limit", - type = "number", - def = 33, - min = 0, - max = 100, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_angerbonus", - name = "Burrow Kill Anger (Percent)", - desc = "Seconds added per burrow kill.", - type = "number", - def = 0.15, - min = 0, - max = 100, - step = 0.01, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_queenspawnmult", - name = "Queen Wave Size Mod", - desc = "Number of squads spawned by the queen at once.", - type = "number", - def = 1, - min = 0, - max = 5, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_expstep", - name = "Bonus Experience", - desc = "Exp each chicken will receive by the end of the game", - type = "number", - def = 1.5, - min = 0, - max = 2.5, - step = 0.1, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_lobberemp", - name = "Lobber EMP Duration", - desc = "Max duration of Lobber EMP artillery", - type = "number", - def = 4, - min = 0, - max = 30, - step = 0.5, - section= "chicken_defense_custom_difficulty_settings", - }, - { - key = "mo_custom_damagemod", - name = "Damage Mod", - desc = "Percent modifier for chicken damage", - type = "number", - def = 100, - min = 5, - max = 250, - step = 1, - section= "chicken_defense_custom_difficulty_settings", - }, } return options \ No newline at end of file diff --git a/ModelMaterials/0_angleshark.lua b/ModelMaterials/0_angleshark.lua deleted file mode 100644 index d077e1e22..000000000 --- a/ModelMaterials/0_angleshark.lua +++ /dev/null @@ -1,67 +0,0 @@ --- $Id$ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local unitInfo = {} - -local function DrawUnit(unitid, material, materialID) - local info = unitInfo[unitid] - if (not info) then - info = {dir=0, lx=0, lz=0} - unitInfo[unitid] = info - end - - local vx,vy,vz = Spring.GetUnitVelocity(unitid) - local speed = (vx*vx+vy*vy+vz*vz)^0.5 - - local curFrame = Spring.GetGameFrame() - if (info.n ~= curFrame) then - info.n = curFrame; - local lx = info.lx - local lz = info.lz - local dx,dy,dz = Spring.GetUnitDirection(unitid) - info.dir = info.dir*0.95 + (lx*dz - lz*dx) / ( (lx*lx+lz*lz)^0.5 + (dx*dx+dz*dz)^0.5 ); - info.lx,info.lz = dx,dz; - end - - gl.Uniform(material.frameLoc, Spring.GetGameFrame()%360) - gl.Uniform(material.speedLoc, info.dir,0,speed) - - return false --// engine should still draw it (we just set the uniforms for the shader) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local materials = { - shark = { - shader = include("ModelMaterials/Shaders/shark.lua"), - force = true, --// always use the shader even when normalmapping is disabled - usecamera = false, - culling = GL.BACK, - texunits = { - [0] = '%%UNITDEFID:0', - [1] = '%%UNITDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - }, - DrawUnit = DrawUnit - } -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- affected unitdefs - -local unitMaterials = { - angelshark = "shark", -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -return materials, unitMaterials - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/ModelMaterials/0_flags.lua b/ModelMaterials/0_flags.lua deleted file mode 100644 index 3ef352984..000000000 --- a/ModelMaterials/0_flags.lua +++ /dev/null @@ -1,105 +0,0 @@ --- $Id$ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local pieceDLs = {} - -local function UnitCreated(unitID, material, materialID) - local pieceMap = Spring.GetUnitPieceMap(unitID) - local flagPieces = {"gbrflag", "gerflag", "usflag", "rusflag"} - - for i=1,#flagPieces do - local pieceID = pieceMap[ flagPieces[i] ] - if (pieceID) then - local dl = pieceDLs[i] - if (not dl) then - dl = gl.CreateList(function() - gl.MultiTexCoord(4,100) - gl.UnitPiece(unitID, pieceID) - gl.MultiTexCoord(4,0) - end) - pieceDLs[i] = dl - end - Spring.UnitRendering.SetPieceList(unitID,materialID,pieceID,dl) - end - end -end - - -local function DrawUnit(unitID, material) - gl.Uniform(material.frameLoc, (Spring.GetGameFrame() + Spring.GetFrameTimeOffset())/10) - - --// engine should still draw it (we just set the uniforms for the shader) - return false -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local materials = { - flagShader = { - shaderDefinitions = { - "#define use_perspective_correct_shadows", - "#define use_normalmapping", - }, - shaderPlugins = { - VERTEX_GLOBAL_NAMESPACE = [[ - uniform float frame2; - ]], - VERTEX_PRE_TRANSFORM = [[ - if (gl_MultiTexCoord4.x > 10.0) { - float a; - vec3 n = vec3(0.0); - - a = (vertex.x * 0.5 + frame2); - vertex.z += 1.35 * sin(a) * max(vertex.x, -1.0); - n += vec3(-1.0, 0.0, cos(a)) * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - a = (vertex.x * 0.5 + frame2 + vertex.y * 0.5); - vertex.z += 0.2 * sin(a) * max(vertex.x, -1.0); - n += vec3(-1.0, 0.0, cos(a)) * 0.13 * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - a = (vertex.x * 0.5 + frame2 - 0.33); - vertex.y += 0.8 * sin(a) * max(vertex.x, -1.0); - n += vec3(0.0, cos(a), -1.0) * 0.8 * max(vertex.x, -1.0) / sqrt(1.0+cos(a)*cos(a)); - - normal = normalize(mix(normal,n,0.65)); - } - ]], - }, - shader = include("ModelMaterials/Shaders/default.lua"), - force = true, - usecamera = false, - culling = GL.BACK, - texunits = { - [0] = '%%UNITDEFID:0', - [1] = '%%UNITDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - [5] = 'unittextures/Flags_normals.dds', - }, - UnitCreated = UnitCreated, - DrawUnit = DrawUnit, - }, -} - - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- affected unitdefs - -local unitMaterials = {} - -unitMaterials.flag = { - "flagShader", -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -return materials, unitMaterials - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/ModelMaterials/1_normalmapping.lua b/ModelMaterials/1_normalmapping.lua index 7fa4478d8..a8d6b1aa2 100644 --- a/ModelMaterials/1_normalmapping.lua +++ b/ModelMaterials/1_normalmapping.lua @@ -2,38 +2,36 @@ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local materials = { - normalMappedS3o = { +local function SunChanged(curShaderObj) + curShaderObj:SetUniformAlways("shadowDensity", gl.GetSun("shadowDensity" ,"unit")) + + curShaderObj:SetUniformAlways("sunAmbient", gl.GetSun("ambient" ,"unit")) + curShaderObj:SetUniformAlways("sunDiffuse", gl.GetSun("diffuse" ,"unit")) + curShaderObj:SetUniformAlways("sunSpecular", gl.GetSun("specular" ,"unit")) + --gl.Uniform(gl.GetUniformLocation(curShader, "sunSpecularExp"), gl.GetSun("specularExponent" ,"unit")) +end + + + +local default_lua = VFS.Include("ModelMaterials/Shaders/default.lua") + +local matTemplate = { shaderDefinitions = { - "#define use_perspective_correct_shadows", "#define use_normalmapping", - --"#define flip_normalmap", - --"#define flipAlpha", - --"#define tex1Alpha", + "#define deferred_mode 0", + "#define SPECULARMULT 6.0", + "#define SPECULARSUNEXP 12.0", }, - shader = include("ModelMaterials/Shaders/default.lua"), - usecamera = false, - culling = GL.BACK, - predl = nil, - postdl = nil, - texunits = { - [0] = '%%UNITDEFID:0', - [1] = '%%UNITDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - [5] = '%NORMALTEX', - }, - }, - normalMappedS3oFlipped = { - shaderDefinitions = { - "#define use_perspective_correct_shadows", + deferredDefinitions = { "#define use_normalmapping", - "#define flip_normalmap", - --"#define flipAlpha", - --"#define tex1Alpha", + "#define deferred_mode 1", + "#define SPECULARMULT 6.0", + "#define SPECULARSUNEXP 12.0", + "#define MAT_IDX 1", }, - shader = include("ModelMaterials/Shaders/default.lua"), + + shader = default_lua, + deferred = default_lua, usecamera = false, culling = GL.BACK, predl = nil, @@ -42,13 +40,24 @@ local materials = { [0] = '%%UNITDEFID:0', [1] = '%%UNITDEFID:1', [2] = '$shadow', - [3] = '$specular', [4] = '$reflection', [5] = '%NORMALTEX', }, - }, + -- uniforms = { + -- } + --DrawUnit = DrawUnit, + SunChanged = SunChanged, } + +local materials = { + normalMappedS3o = Spring.Utilities.CopyTable(matTemplate, true), + normalMappedS3oFlipped = Spring.Utilities.CopyTable(matTemplate, true), +} + +table.insert(materials.normalMappedS3oFlipped.shaderDefinitions, "#define flip_normalmap") +table.insert(materials.normalMappedS3oFlipped.deferredDefinitions, "#define flip_normalmap") + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Automated normalmap detection @@ -127,6 +136,8 @@ end + + for i=1,#UnitDefs do local udef = UnitDefs[i] diff --git a/ModelMaterials/4_features_trees.lua b/ModelMaterials/4_features_trees.lua index 8cb81630d..907cfeed1 100644 --- a/ModelMaterials/4_features_trees.lua +++ b/ModelMaterials/4_features_trees.lua @@ -1,36 +1,105 @@ -- $Id$ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local frameLocID -local function DrawFeature(featureID, material) - if frameLocID == nil then - frameLocID = gl.GetUniformLocation(material.shader, "frameLoc") - end - local factor = 0.001 - local frame = factor * math.sin(math.fmod(featureID, 10) + Spring.GetGameFrame() / (math.fmod(featureID, 7) + 6)) - gl.Uniform(frameLocID, frame) +local function DrawFeature(featureID, featureDefID, material, drawMode, luaShaderObj) -- UNUSED! + local wx, wy, wz = Spring.GetWind() + luaShaderObj:SetUniformAlways("wind", wx, wy, wz) - --// engine should still draw it (we just set the uniforms for the shader) return false end +local function SunChanged(curShaderObj) + curShaderObj:SetUniformAlways("shadowDensity", gl.GetSun("shadowDensity" ,"unit")) + + curShaderObj:SetUniformAlways("sunAmbient", gl.GetSun("ambient" ,"unit")) + curShaderObj:SetUniformAlways("sunDiffuse", gl.GetSun("diffuse" ,"unit")) + curShaderObj:SetUniformAlways("sunSpecular", gl.GetSun("specular" ,"unit")) + --gl.Uniform(gl.GetUniformLocation(curShader, "sunSpecularExp"), gl.GetSun("specularExponent" ,"unit")) +end + + +local default_lua = VFS.Include("ModelMaterials/Shaders/default.lua") + local materials = { - feature_tree = { - shader = include("ModelMaterials/Shaders/feature_treeshader.lua"), - force = true, --// always use the shader even when normalmapping is disabled - usecamera = false, - culling = GL.BACK, - texunits = { - [0] = '%%FEATUREDEFID:0', - [1] = '%%FEATUREDEFID:1', - [2] = '$shadow', - [3] = '$specular', - [4] = '$reflection', - }, - DrawFeature = DrawFeature, - feature = true, --// This is used to define that this is a feature shader - }, + feature_tree = { + shader = default_lua, + deferred = default_lua, + shaderDefinitions = { + "#define use_normalmapping", + "#define deferred_mode 0", + }, + deferredDefinitions = { + --"#define use_normalmapping", --very expensive for trees (too much overdraw) + "#define deferred_mode 1", + }, + shaderPlugins = { + VERTEX_GLOBAL_NAMESPACE = [[ + vec2 getWind(int period) { + vec2 wind; + wind.x = sin(period * 5.0); + wind.y = cos(period * 5.0); + return wind * 12.0f; + } + ]], + VERTEX_PRE_TRANSFORM = [[ + // adapted from 0ad's model_common.vs + + vec2 curWind = getWind(simFrame / 750); + vec2 nextWind = getWind(simFrame / 750 + 1); + float tweenFactor = smoothstep(0.0f, 1.0f, max(simFrame % 750 - 600, 0) / 150.0f); + vec2 wind = mix(curWind, nextWind, tweenFactor); + + + + + // fractional part of model position, clamped to >.4 + vec4 modelPos = gl_ModelViewMatrix[3]; + modelPos = fract(modelPos); + modelPos = clamp(modelPos, 0.4, 1.0); + + // crude measure of wind intensity + float abswind = abs(wind.x) + abs(wind.y); + + vec4 cosVec; + float simTime = 0.02 * simFrame; + // these determine the speed of the wind's "cosine" waves. + cosVec.w = 0.0; + cosVec.x = simTime * modelPos[0] + vertex.x; + cosVec.y = simTime * modelPos[2] / 3.0 + modelPos.x; + cosVec.z = simTime * 1.0 + vertex.z; + + // calculate "cosines" in parallel, using a smoothed triangle wave + vec4 tri = abs(fract(cosVec + 0.5) * 2.0 - 1.0); + cosVec = tri * tri *(3.0 - 2.0 * tri); + + float limit = clamp((vertex.x * vertex.z * vertex.y) / 3000.0, 0.0, 0.2); + + float diff = cosVec.x * limit; + float diff2 = cosVec.y * clamp(vertex.y / 30.0, 0.05, 0.2); + + vertex.xyz += cosVec.z * limit * clamp(abswind, 1.2, 1.7); + + vertex.xz += diff + diff2 * wind; + ]], + FRAGMENT_POST_SHADING = [[ + //gl_FragColor.r=1.0; + ]] + }, + force = true, --// always use the shader even when normalmapping is disabled + feature = true, --// This is used to define that this is a feature shader + usecamera = false, + culling = GL.BACK, + texunits = { + [0] = '%%FEATUREDEFID:0', + [1] = '%%FEATUREDEFID:1', + [2] = '$shadow', + [4] = '$reflection', + [5] = '%NORMALTEX', + }, + --DrawFeature = DrawFeature, + SunChanged = SunChanged, + }, } -------------------------------------------------------------------------------- @@ -38,74 +107,67 @@ local materials = { -- affected unitdefs local featureMaterials = {} - --- All feature defs that contain the string in ""s will be affected by it --- Just to point out that this is a shitty, hacky, gawdawful workaround until I can implement customparam category searching - +local featureNameStubs = { + "ad0_", + "btree", + "art", + "bush", + "tree", + "vegetation", + "vegitation", + "baobab", + "aleppo", + "pine", + "senegal", + "palm", + "shrub", + "bloodthorn", + "birch", + "maple", + "oak", + "fern", + "grass", + "weed", + "plant", + "palmetto" + } -- This list should cover all vegetative features in spring features +local tex1_to_normaltex = {} +-- All feature defs that contain the string "aleppo" will be affected by it +local echoline = '' for id, featureDef in pairs(FeatureDefs) do + Spring.PreloadFeatureDefModel(id) + for _,stub in ipairs (featureNameStubs) do + if featureDef.model.textures and featureDef.model.textures.tex1 and featureDef.name and featureDef.name:find(stub) and featureDef.name:find(stub) == 1 then --also starts with + --if featureDef.customParam.normaltex then + echoline = echoline..(echoline ~= '' and ', ' or '')..featureDef.name + if featureDef.name:find('btree') == 1 then --beherith's old trees suffer if they get shitty normals + featureMaterials[featureDef.name] = {"feature_tree", NORMALTEX = "unittextures/blank_normal.tga"} + else + featureMaterials[featureDef.name] = {"feature_tree", NORMALTEX = "unittextures/default_tree_normal.tga"} + end + + --TODO: dont forget the feature normals! + --TODO: actually generate normals for all these old-ass features, and include them in BAR + --TODO: add a blank normal map to avoid major fuckups. + --Todo, grab the texture1 names for features in tex1_to_normaltex assignments, + --and hope that I dont have to actually load the models to do so - if featureDef.name:find("bush") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("tree") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("vegetation") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("baobab") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("aleppo") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("pine") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("senegal") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("palm") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("shrub") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("bloodthorn") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("birch") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("maple") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("oak") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("fern") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("grass") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("weed") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("plant") then - featureMaterials[featureDef.name] = "feature_tree" - - elseif featureDef.name:find("palmetto") then - featureMaterials[featureDef.name] = "feature_tree" - - end + end + end +end +if echoline ~= '' then + --Spring.Echo('Adding normal texture to trees: '..echoline) end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -return materials, featureMaterials +if Spring.GetConfigInt("TreeWind",1) == 0 then + return {}, {} +else + return materials, featureMaterials +end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/ModelMaterials/Shaders/car.lua b/ModelMaterials/Shaders/car.lua deleted file mode 100644 index 4402c7192..000000000 --- a/ModelMaterials/Shaders/car.lua +++ /dev/null @@ -1,217 +0,0 @@ -return { - vertex = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows - - %%VERTEX_GLOBAL_NAMESPACE%% - - uniform mat4 camera; //ViewMatrix (gl_ModelViewMatrix is ModelMatrix!) - //uniform mat4 cameraInv; - uniform vec3 cameraPos; - uniform vec3 sunPos; - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - - uniform vec3 nightColor; - - #ifdef use_shadows - uniform mat4 shadowMatrix; - varying vec4 shadowpos; - #ifndef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - #endif - - varying vec3 cameraDir; - varying vec3 teamColor; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - #else - varying vec3 normalv; - #endif - - void main(void) - { - vec4 vertex = gl_Vertex; - vec3 normal = gl_Normal; - - %%VERTEX_PRE_TRANSFORM%% - - #ifdef use_normalmapping - vec3 tangent = gl_MultiTexCoord5.xyz; - vec3 bitangent = gl_MultiTexCoord6.xyz; - t = gl_NormalMatrix * tangent; - b = gl_NormalMatrix * bitangent; - n = gl_NormalMatrix * normal; - #else - normalv = gl_NormalMatrix * normal; - #endif - - vec4 worldPos = gl_ModelViewMatrix * vertex; - gl_Position = gl_ProjectionMatrix * (camera * worldPos); - cameraDir = worldPos.xyz - cameraPos; - - #ifdef use_shadows - shadowpos = shadowMatrix * worldPos; - #ifndef use_perspective_correct_shadows - shadowpos.st = shadowpos.st * (inversesqrt(abs(shadowpos.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - #endif - - gl_TexCoord[0].st = gl_MultiTexCoord0.st; - teamColor = gl_TextureEnvColor[0].rgb; - - //float fogCoord = length(gl_Position.xyz); - //fogFactor = (gl_Fog.end - fogCoord) * gl_Fog.scale; //gl_Fog.scale := 1.0 / (gl_Fog.end - gl_Fog.start) - //fogFactor = clamp(fogFactor, 0.0, 1.0); - - %%VERTEX_POST_TRANSFORM%% - } - ]], - fragment = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows - - %%FRAGMENT_GLOBAL_NAMESPACE%% - - uniform sampler2D textureS3o1; - uniform sampler2D textureS3o2; - uniform samplerCube specularTex; - uniform samplerCube reflectTex; - - - uniform vec3 sunPos; // is sunDir! - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - - - uniform vec3 nightColor; - - #ifdef use_shadows - #ifdef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - varying vec4 shadowpos; - uniform sampler2DShadow shadowTex; - uniform float shadowDensity; - #endif - - varying vec3 teamColor; - varying vec3 cameraDir; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - uniform sampler2D normalMap; - #else - varying vec3 normalv; - #endif - - void main(void) - { - %%FRAGMENT_PRE_SHADING%% - - #ifdef use_normalmapping - vec2 tc = gl_TexCoord[0].st; - - #ifdef flip_normalmap - tc.t = 1.0 - tc.t; - //tc.s = 1.0 - tc.s; - #endif - - vec3 nvTS = normalize(texture2D(normalMap, tc).xyz - 0.5); - vec3 normal = normalize(mat3(t,b,n) * nvTS); - #else - vec3 normal = normalize(normalv); - #endif - float a = max( dot(normal, sunPos), 0.0); - vec3 light = a * sunDiffuse + sunAmbient; - - //vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - #ifdef flipTexture - vec4 extraColor = texture2D(textureS3o2, vec2(gl_TexCoord[0].s,1-gl_TexCoord[0].t)); - #else - vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - #endif - - vec3 reflectDir = reflect(cameraDir, normal); - vec3 specular = textureCube(specularTex, reflectDir).rgb * extraColor.g * 4.0; - vec3 reflection = textureCube(reflectTex, reflectDir).rgb; - - #ifdef use_shadows - vec4 shadowTC = shadowpos; - #ifdef use_perspective_correct_shadows - shadowTC.st = shadowTC.st * (inversesqrt( abs(shadowTC.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - float shadow = shadow2DProj(shadowTex, shadowTC).r; - shadow = 1.0 - (1.0 - shadow) * shadowDensity; - light = mix(sunAmbient, light, shadow); - specular *= shadow; - #endif - - reflection = mix(light, reflection, extraColor.g); // reflection - reflection += extraColor.rrr; // self-illum - - #ifdef flipTexture - gl_FragColor = texture2D(textureS3o1, vec2(gl_TexCoord[0].s,1-gl_TexCoord[0].t)); - #else - gl_FragColor = texture2D(textureS3o1, gl_TexCoord[0].st); - #endif - - #ifdef s3o - gl_FragColor.rgb = mix(gl_FragColor.rgb, teamColor.rgb, gl_FragColor.a); // teamcolor - gl_FragColor.rgb = gl_FragColor.rgb * reflection + specular; - gl_FragColor.a = extraColor.a; - - #else - gl_FragColor.rgb = mix(teamColor.rgb, gl_FragColor.rgb, extraColor.a); // teamcolor - gl_FragColor.rgb = gl_FragColor.rgb * reflection + specular; - - #endif - - - - #ifdef flipAlpha - gl_FragColor.a = 1-gl_FragColor.a; - #endif - - - - //gl_FragColor.rgb = mix(gl_FragColor.rgb, nightColor, 0.3); //night - gl_FragColor.rgb = gl_FragColor.rgb * nightColor; - - - %%FRAGMENT_POST_SHADING%% - } - ]], - uniformInt = { - textureS3o1 = 0, - textureS3o2 = 1, - shadowTex = 2, - specularTex = 3, - reflectTex = 4, - normalMap = 5, - --detailMap = 6, - }, - uniform = { - sunPos = {gl.GetSun("pos")}, - sunAmbient = {gl.GetSun("ambient" ,"unit")}, - sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, - shadowDensity = {gl.GetSun("shadowDensity" ,"unit")}, - shadowParams = {gl.GetShadowMapParams()}, - - nightColor = {1,1,1}, - --nightColor = {0.2, 0.4, 0.6}, - }, - uniformMatrix = { - shadowMatrix = {gl.GetMatrixData("shadow")}, - }, -} diff --git a/ModelMaterials/Shaders/default.lua b/ModelMaterials/Shaders/default.lua index 5cc7fda97..8e11e5230 100644 --- a/ModelMaterials/Shaders/default.lua +++ b/ModelMaterials/Shaders/default.lua @@ -1,48 +1,54 @@ return { vertex = [[ + //shader version is added via gadget + %%GLOBAL_NAMESPACE%% + //#define use_normalmapping //#define flip_normalmap //#define use_shadows %%VERTEX_GLOBAL_NAMESPACE%% - + #line 10010 + uniform mat4 camera; //ViewMatrix (gl_ModelViewMatrix is ModelMatrix!) uniform vec3 cameraPos; - uniform vec3 sunPos; + uniform vec3 sunDiffuse; uniform vec3 sunAmbient; uniform vec3 etcLoc; uniform int simFrame; + #ifdef flashlights - varying float selfIllumMod; + out float selfIllumMod; #endif //uniform float frameLoc; - - #ifdef use_treadoffset - uniform float treadOffset; - #endif - + //The api_custom_unit_shaders supplies this definition: - #ifdef use_shadows + #ifdef use_shadows uniform mat4 shadowMatrix; uniform vec4 shadowParams; #endif - + #ifdef use_vertex_ao - varying float aoTerm; + out float aoTerm; #endif - varying vec3 cameraDir; - + + out vec3 viewDir; + #ifdef use_normalmapping - varying mat3 tbnMatrix; + out mat3 tbnMatrix; #else - varying vec3 normalv; + out vec3 normalv; #endif + out vec2 tex_coord0; + out vec4 tex_coord1; + out vec4 worldPos; + void main(void) { vec4 vertex = gl_Vertex; vec3 normal = gl_Normal; - + %%VERTEX_PRE_TRANSFORM%% #ifdef use_normalmapping @@ -53,32 +59,43 @@ vertex = [[ normalv = gl_NormalMatrix * normal; #endif - vec4 worldPos = gl_ModelViewMatrix * vertex; + worldPos = gl_ModelViewMatrix * vertex; gl_Position = gl_ProjectionMatrix * (camera * worldPos); - cameraDir = worldPos.xyz - cameraPos; + viewDir = cameraPos - worldPos.xyz; #ifdef use_shadows - gl_TexCoord[1] =shadowMatrix *gl_ModelViewMatrix*gl_Vertex; - gl_TexCoord[1].st = gl_TexCoord[1].st * (inversesqrt( abs(gl_TexCoord[1].st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; + tex_coord1 = shadowMatrix * worldPos; + #if 1 + tex_coord1.xy = tex_coord1.xy + 0.5; + #else + tex_coord1.xy *= (inversesqrt(abs(tex_coord1.xy) + shadowParams.zz) + shadowParams.ww); + tex_coord1.xy += shadowParams.xy; + #endif #endif + #ifdef use_treadoffset - gl_TexCoord[0].st = gl_MultiTexCoord0.st; - if (gl_MultiTexCoord0.s < 0.74951171875 && gl_MultiTexCoord0.s > 0.6279296875 && gl_MultiTexCoord0.t > 0.5702890625 && gl_MultiTexCoord0.t <0.6220703125){ - gl_TexCoord[0].s = gl_MultiTexCoord0.s + etcLoc.z; + tex_coord0.st = gl_MultiTexCoord0.st; + const vec4 treadBoundaries = vec4(0.6279296875, 0.74951171875, 0.5702890625, 0.6220703125); + if (all(bvec4( + tex_coord0.s >= treadBoundaries.x, tex_coord0.s <= treadBoundaries.y, + tex_coord0.t >= treadBoundaries.z, tex_coord0.t <= treadBoundaries.w))) { + tex_coord0.s = gl_MultiTexCoord0.s + etcLoc.z; } #endif + #ifdef use_vertex_ao - aoTerm= max(0.4,fract(gl_MultiTexCoord0.s*16384.0)*1.3); // great + aoTerm = max(0.4, fract(gl_MultiTexCoord0.s * 16384.0) * 1.3); // great #endif #ifndef use_treadoffset - gl_TexCoord[0].st = gl_MultiTexCoord0.st; + tex_coord0.st = gl_MultiTexCoord0.st; #endif - + #ifdef flashlights - //float unique_value = sin((gl_ModelViewMatrix[3][0]+gl_ModelViewMatrix[3][2]))); - selfIllumMod = max(-0.2,sin(simFrame *0.063 + (gl_ModelViewMatrix[3][0]+gl_ModelViewMatrix[3][2])*0.1))+0.2; + // gl_ModelViewMatrix[3][0] + gl_ModelViewMatrix[3][2] are Tx, Tz elements of translation of matrix + selfIllumMod = max(-0.2, sin(simFrame * 0.063 + (gl_ModelViewMatrix[3][0] + gl_ModelViewMatrix[3][2]) * 0.1)) + 0.2; #endif + //float fogCoord = length(gl_Position.xyz); // maybe fog should be readded? //fogFactor = (gl_Fog.end - fogCoord) * gl_Fog.scale; //gl_Fog.scale := 1.0 / (gl_Fog.end - gl_Fog.start) //fogFactor = clamp(fogFactor, 0.0, 1.0); @@ -87,142 +104,287 @@ vertex = [[ } ]], - fragment = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows + +fragment = [[ + //shader version is added via gadget + %%GLOBAL_NAMESPACE%% + + #if (GL_FRAGMENT_PRECISION_HIGH == 1) + // ancient GL3 ATI drivers confuse GLSL for GLSL-ES and require this + precision highp float; + #else + precision mediump float; + #endif %%FRAGMENT_GLOBAL_NAMESPACE%% + #line 20120 + + #if (deferred_mode == 1) + #define GBUFFER_NORMTEX_IDX 0 + #define GBUFFER_DIFFTEX_IDX 1 + #define GBUFFER_SPECTEX_IDX 2 + #define GBUFFER_EMITTEX_IDX 3 + #define GBUFFER_MISCTEX_IDX 4 + + #define GBUFFER_COUNT 5 + #endif uniform sampler2D textureS3o1; uniform sampler2D textureS3o2; uniform samplerCube specularTex; uniform samplerCube reflectTex; - uniform vec3 sunPos; // is sunDir! + uniform vec3 sunPos; //light direction in fact + #define lightDir sunPos + uniform vec3 sunDiffuse; uniform vec3 sunAmbient; + uniform vec3 sunSpecular; + uniform vec3 etcLoc; + + #ifndef SPECULARSUNEXP + #define SPECULARSUNEXP 16.0 + #endif + #ifndef SPECULARMULT #define SPECULARMULT 2.0 #endif - + + #ifndef MAT_IDX + #define MAT_IDX 0 + #endif + + #ifndef SHADOW_SAMPLES + #define SHADOW_SAMPLES 6 // number of shadowmap samples per fragment + #define SHADOW_RANDOMNESS 0.4 // 0.0 - blocky look, 1.0 - random points look + #define SHADOW_SAMPLING_DISTANCE 2.0 // how far shadow samples go (in shadowmap texels) as if it was applied to 8192x8192 sized shadow map + #endif + #ifdef use_shadows uniform sampler2DShadow shadowTex; - uniform float shadowDensity; #endif + uniform float shadowDensity; + #ifdef use_vertex_ao - varying float aoTerm; + in float aoTerm; #endif + uniform vec4 teamColor; - varying vec3 cameraDir; + in vec3 viewDir; //varying float fogFactor; - + #ifdef flashlights - varying float selfIllumMod; + in float selfIllumMod; #endif - + #ifdef use_normalmapping - varying mat3 tbnMatrix; + in mat3 tbnMatrix; uniform sampler2D normalMap; + #define normalv tbnMatrix[2] #else - varying vec3 normalv; + in vec3 normalv; #endif - float GetShadowCoeff(vec4 shadowCoors){ - #ifdef use_shadows - float coeff = shadow2DProj(shadowTex, shadowCoors+vec4(0.0, 0.0, -0.00005, 0.0)).r; - coeff = (1.0 - coeff); - coeff *= shadowDensity; - return (1.0 - coeff); + + in vec2 tex_coord0; + in vec4 tex_coord1; + in vec4 worldPos; + + #if (deferred_mode == 1) + out vec4 fragData[GBUFFER_COUNT]; + #else + out vec4 fragData[1]; + #endif + + const float PI = acos(0.0) * 2.0; + + const mat3 RGB2YCBCR = mat3( + 0.2126, -0.114572, 0.5, + 0.7152, -0.385428, -0.454153, + 0.0722, 0.5, -0.0458471); + + const mat3 YCBCR2RGB = mat3( + 1.0, 1.0, 1.0, + 0.0, -0.187324, 1.8556, + 1.5748, -0.468124, -5.55112e-17); + + #define NORM2SNORM(value) (value * 2.0 - 1.0) + #define SNORM2NORM(value) (value * 0.5 + 0.5) + + // http://blog.marmakoide.org/?p=1 + const float goldenAngle = PI * (3.0 - sqrt(5.0)); + vec2 SpiralSNorm(int i, int N) { + float theta = float(i) * goldenAngle; + float r = sqrt(float(i)) / sqrt(float(N)); + return vec2 (r * cos(theta), r * sin(theta)); + } + + float hash12(vec2 p) { + const float HASHSCALE1 = 0.1031; + vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1); + p3 += dot(p3, p3.yzx + 19.19); + return fract((p3.x + p3.y) * p3.z); + } + +#ifdef use_shadows + float GetShadowPCFRandom(float NdotL) { + float shadow = 0.0; + + const float cb = 0.00005; + float bias = cb * tan(acos(NdotL)); + bias = clamp(bias, 0.0, 5.0 * cb); + + #if defined(SHADOW_SAMPLES) && (SHADOW_SAMPLES > 1) + + + float rndRotAngle = NORM2SNORM(hash12(gl_FragCoord.xy)) * PI / 2.0 * SHADOW_RANDOMNESS; + + vec2 vSinCos = vec2(sin(rndRotAngle), cos(rndRotAngle)); + mat2 rotMat = mat2(vSinCos.y, -vSinCos.x, vSinCos.x, vSinCos.y); + + vec2 filterSize = vec2(SHADOW_SAMPLING_DISTANCE / 8192.0); + + for (int i = 0; i < SHADOW_SAMPLES; ++i) { + // SpiralSNorm return low discrepancy sampling vec2 + vec2 offset = (rotMat * SpiralSNorm( i, SHADOW_SAMPLES )) * filterSize; + + vec4 shTexCoord = tex_coord1 + vec4(offset, -bias, 0.0); + shadow += textureProj( shadowTex, shTexCoord ); + } + + shadow /= float(SHADOW_SAMPLES); + shadow *= 1.0 - smoothstep(shadow, 1.0, 0.2); #else - return 1.0; + vec4 shTexCoord = tex_coord1; + shTexCoord.z -= bias; + shadow = textureProj( shadowTex, shTexCoord ); #endif + + return mix(1.0, shadow, shadowDensity); } - +#endif + void main(void){ %%FRAGMENT_PRE_SHADING%% + #line 20212 #ifdef use_normalmapping - vec2 tc = gl_TexCoord[0].st; + vec2 tc = tex_coord0.st; #ifdef flip_normalmap tc.t = 1.0 - tc.t; #endif - vec4 normaltex=texture2D(normalMap, tc); - vec3 nvTS = normalize((normaltex.xyz - 0.5) * 2.0); - vec3 normal = tbnMatrix * nvTS; + vec4 normaltex = texture(normalMap, tc); + vec3 nvTS = normalize(NORM2SNORM(normaltex.xyz)); + vec3 N = tbnMatrix * nvTS; #else - vec3 normal = normalize(normalv); + vec3 N = normalize(normalv); #endif - vec3 light = max(dot(normal, sunPos), 0.0) * sunDiffuse + sunAmbient; - vec4 diffuseIn = texture2D(textureS3o1, gl_TexCoord[0].st); - vec4 outColor = diffuseIn; - vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - vec3 reflectDir = reflect(cameraDir, normal); - - #if (deferred_mode == 0) - vec3 specular = textureCube(specularTex, reflectDir).rgb * extraColor.g * SPECULARMULT; - vec3 reflection = textureCube(reflectTex, reflectDir).rgb; + vec3 L = normalize(lightDir); //just in case + + float NdotLu = dot(N, L); + float NdotL = max(NdotLu, 0.0); + vec3 light = NdotL * sunDiffuse + sunAmbient; + + vec4 diffuseIn = texture(textureS3o1, tex_coord0.st); + + #ifdef LUMAMULT + vec3 yCbCr = RGB2YCBCR * diffuseIn.rgb; + yCbCr.x *= LUMAMULT; + diffuseIn.rgb = YCBCR2RGB * yCbCr; #endif - #if (deferred_mode == 1) - vec3 specular = vec3(1.0,1.0,1.0) * extraColor.g * SPECULARMULT; - vec3 reflection = vec3(0.0,0.0,0.0); + + vec4 outColor = diffuseIn; + vec4 extraColor = texture(textureS3o2, tex_coord0.st); + + vec3 V = normalize(viewDir); + vec3 Rv = -reflect(V, N); + + vec3 specularColor; + + // blinn-phong + vec3 H = normalize(L + V); + float HdotN = max(dot(H, N), 0.0); + specularColor = sunSpecular * pow(HdotN, SPECULARSUNEXP); + + specularColor *= extraColor.b * SPECULARMULT; //EvoRTS specific change, tex2.b is used as specular multiplier; tex2.g is used as a reflectivity + + vec3 reflection = texture(reflectTex, Rv).rgb; + + float nShadowMix = smoothstep(0.0, 0.35, NdotLu); + float nShadow = mix(1.0, nShadowMix, shadowDensity); + + #ifdef use_shadows + float gShadow = GetShadowPCFRandom(NdotL); + #else + float gShadow = 1.0; #endif - float shadow = GetShadowCoeff(gl_TexCoord[1] + vec4(0.0, 0.0, -0.00005, 0.0)); + + float shadow = min(nShadow, gShadow); + light = mix(sunAmbient, light, shadow); - specular *= shadow; + specularColor *= shadow; + + reflection = mix(light, reflection, extraColor.g); // reflection - reflection = mix(light, reflection, extraColor.g); // reflection #ifdef flashlights - extraColor.r =extraColor.r * selfIllumMod; + extraColor.r = extraColor.r * selfIllumMod; #endif + reflection += (extraColor.rrr); // self-illum outColor.rgb = mix(outColor.rgb, teamColor.rgb, outColor.a); //#if (deferred_mode == 0) - // diffuse + specular + envcube lighting + // diffuse + specularColor + envcube lighting // (reflection contains the NdotL term!) - outColor.rgb = outColor.rgb * reflection + specular; + outColor.rgb = outColor.rgb * reflection + specularColor; //#endif outColor.a = extraColor.a; //outColor.rgb = outColor.rgb + outColor.rgb * (normaltex.a - 0.5) * etcLoc.g; // no more wreck color blending #ifdef use_vertex_ao - outColor.rgb=outColor.rgb*aoTerm; + outColor.rgb = outColor.rgb * aoTerm; + #endif + + // debug hook + #if 0 + //outColor.rgb = vec3(normalv); + outColor.rgb = vec3(N); #endif #if (deferred_mode == 0) - gl_FragColor = outColor; + fragData[0] = outColor; #else - gl_FragData[0] = vec4((normal + 1.0) * 0.5, 1.0); - gl_FragData[1] = outColor; - gl_FragData[2] = vec4(specular, extraColor.a); - gl_FragData[3] = vec4(extraColor.rrr, 1.0); + fragData[GBUFFER_NORMTEX_IDX] = vec4(SNORM2NORM(N), 1.0); + fragData[GBUFFER_DIFFTEX_IDX] = outColor; + fragData[GBUFFER_SPECTEX_IDX] = vec4(specularColor, extraColor.a); + fragData[GBUFFER_EMITTEX_IDX] = vec4(extraColor.rrr, 1.0); + fragData[GBUFFER_MISCTEX_IDX] = vec4(float(MAT_IDX) / 255.0, 0.0, 0.0, 0.0); #endif %%FRAGMENT_POST_SHADING%% } ]], - uniformInt = { - textureS3o1 = 0, - textureS3o2 = 1, - shadowTex = 2, - specularTex = 3, - reflectTex = 4, - normalMap = 5, - --detailMap = 6, - }, - uniform = { - -- sunPos = {gl.GetSun("pos")}, -- material has sunPosLoc - sunAmbient = {gl.GetSun("ambient" ,"unit")}, - sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, - shadowDensity = {gl.GetSun("shadowDensity" ,"unit")}, - -- shadowParams = {gl.GetShadowMapParams()}, -- material has shadowParamsLoc - }, - uniformMatrix = { - -- shadowMatrix = {gl.GetMatrixData("shadow")}, -- material has shadow{Matrix}Loc - }, -} \ No newline at end of file + uniformInt = { + textureS3o1 = 0, + textureS3o2 = 1, + shadowTex = 2, + reflectTex = 4, + normalMap = 5, + }, + uniformFloat = { + -- sunPos = {gl.GetSun("pos")}, -- material has sunPosLoc + sunAmbient = {gl.GetSun("ambient" ,"unit")}, + sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, + sunSpecular = {gl.GetSun("specular" ,"unit")}, + --sunSpecularExp = gl.GetSun("specularExponent"), -- this might return crazy values like 100.0, which are unapplicable for Phong/Blinn-Phong + shadowDensity = gl.GetSun("shadowDensity" ,"unit"), + -- shadowParams = {gl.GetShadowMapParams()}, -- material has shadowParamsLoc + }, + uniformMatrix = { + -- shadowMatrix = {gl.GetMatrixData("shadow")}, -- material has shadow{Matrix}Loc + }, +} diff --git a/ModelMaterials/Shaders/feature_treeshader.lua b/ModelMaterials/Shaders/feature_treeshader.lua deleted file mode 100644 index 8b7182c17..000000000 --- a/ModelMaterials/Shaders/feature_treeshader.lua +++ /dev/null @@ -1,201 +0,0 @@ -return { - vertex = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows -#define use_perspective_correct_shadows - - - %%VERTEX_GLOBAL_NAMESPACE%% - - uniform mat4 camera; //ViewMatrix (gl_ModelViewMatrix is ModelMatrix!) - //uniform mat4 cameraInv; - uniform vec3 cameraPos; - uniform vec3 sunPos; - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - #ifdef use_shadows - uniform mat4 shadowMatrix; - varying vec4 shadowpos; - #ifndef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - #endif - - - uniform float frameLoc; - - varying vec3 cameraDir; - varying vec3 teamColor; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - #else - varying vec3 normalv; - #endif - - void main(void) - { - vec4 vertex = gl_Vertex; - vec3 normal = gl_Normal; - - float distanceFromTrunk=(abs(vertex.x)+abs(vertex.z))/10; - vertex.x += distanceFromTrunk * vertex.y * frameLoc; - vertex.z += distanceFromTrunk * vertex.y * frameLoc; - - %%VERTEX_PRE_TRANSFORM%% - - #ifdef use_normalmapping - vec3 tangent = gl_MultiTexCoord5.xyz; - vec3 bitangent = gl_MultiTexCoord6.xyz; - t = gl_NormalMatrix * tangent; - b = gl_NormalMatrix * bitangent; - n = gl_NormalMatrix * normal; - #else - normalv = gl_NormalMatrix * normal; - #endif - - vec4 worldPos = gl_ModelViewMatrix * vertex; - gl_Position = gl_ProjectionMatrix * (camera * worldPos); - cameraDir = worldPos.xyz - cameraPos; - - #ifdef use_shadows - shadowpos = shadowMatrix * worldPos; - #ifndef use_perspective_correct_shadows - shadowpos.st = shadowpos.st * (inversesqrt(abs(shadowpos.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - #endif - - gl_TexCoord[0].st = gl_MultiTexCoord0.st; - teamColor = gl_TextureEnvColor[0].rgb; - - //float fogCoord = length(gl_Position.xyz); - //fogFactor = (gl_Fog.end - fogCoord) * gl_Fog.scale; //gl_Fog.scale := 1.0 / (gl_Fog.end - gl_Fog.start) - //fogFactor = clamp(fogFactor, 0.0, 1.0); - - %%VERTEX_POST_TRANSFORM%% - } - ]], - fragment = [[ -//#define use_normalmapping -//#define flip_normalmap -//#define use_shadows -//#define flipAlpha -//#define tex1Alpha - - %%FRAGMENT_GLOBAL_NAMESPACE%% - - uniform sampler2D textureS3o1; - uniform sampler2D textureS3o2; - uniform samplerCube specularTex; - uniform samplerCube reflectTex; - - uniform vec3 sunPos; // is sunDir! - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - - #ifdef use_shadows - #ifdef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - varying vec4 shadowpos; - uniform sampler2DShadow shadowTex; - uniform float shadowDensity; - #endif - - varying vec3 teamColor; - varying vec3 cameraDir; - //varying float fogFactor; - - #ifdef use_normalmapping - varying vec3 t; - varying vec3 b; - varying vec3 n; - uniform sampler2D normalMap; - #else - varying vec3 normalv; - #endif - - void main(void) - { - %%FRAGMENT_PRE_SHADING%% - - #ifdef use_normalmapping - vec2 tc = gl_TexCoord[0].st; - #ifdef flip_normalmap - tc.t = 1.0 - tc.t; - #endif - vec3 nvTS = normalize(texture2D(normalMap, tc).xyz - 0.5); - vec3 normal = normalize(mat3(t,b,n) * nvTS); - #else - vec3 normal = normalize(normalv); - #endif - float a = max( dot(normal, sunPos), 0.0); - vec3 light = a * sunDiffuse + sunAmbient; - - vec4 albedoColor = texture2D(textureS3o1, gl_TexCoord[0].st); - vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - - #ifdef tex1Alpha - float aca = albedoColor.a; - albedoColor.a = extraColor.a; - extraColor.a = aca; - #endif - - vec3 reflectDir = reflect(cameraDir, normal); - vec3 specular = textureCube(specularTex, reflectDir).rgb * extraColor.g * 4.0; - vec3 reflection = textureCube(reflectTex, reflectDir).rgb; - - #ifdef use_shadows - vec4 shadowTC = shadowpos; - #ifdef use_perspective_correct_shadows - shadowTC.st = shadowTC.st * (inversesqrt( abs(shadowTC.st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - float shadow = shadow2DProj(shadowTex, shadowTC).r; - shadow = 1.0 - (1.0 - shadow) * shadowDensity; - light = mix(sunAmbient, light, shadow); - specular *= shadow; - #endif - - reflection = mix(light, reflection, extraColor.g); // reflection - reflection += extraColor.rrr; // self-illum - - gl_FragColor = albedoColor; - gl_FragColor.rgb = mix(gl_FragColor.rgb, teamColor.rgb, gl_FragColor.a); // teamcolor - gl_FragColor.rgb = gl_FragColor.rgb * reflection + specular; - - gl_FragColor.a = extraColor.a; - #ifdef flipAlpha - gl_FragColor.a = 1.0 - gl_FragColor.a; - #endif - - //gl_FragColor.rgb = mix(gl_Fog.color.rgb, gl_FragColor.rgb, fogFactor); // fog - //gl_FragColor.a = teamColor.a; // far fading - //gl_FragColor.rgb = normal; - - %%FRAGMENT_POST_SHADING%% - } - ]], - uniformInt = { - textureS3o1 = 0, - textureS3o2 = 1, - shadowTex = 2, - specularTex = 3, - reflectTex = 4, - normalMap = 5, - --detailMap = 6, - }, - uniform = { - sunPos = {gl.GetSun("pos")}, - sunAmbient = {gl.GetSun("ambient" ,"unit")}, - sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, - shadowDensity = {gl.GetSun("shadowDensity" ,"unit")}, - shadowParams = {gl.GetShadowMapParams()}, - }, - uniformMatrix = { - shadowMatrix = {gl.GetMatrixData("shadow")}, - }, -} \ No newline at end of file diff --git a/ModelMaterials/Shaders/shark.lua b/ModelMaterials/Shaders/shark.lua deleted file mode 100644 index e565158a3..000000000 --- a/ModelMaterials/Shaders/shark.lua +++ /dev/null @@ -1,107 +0,0 @@ -return { - vertex = [[ -//#define use_shadow - uniform mat4 camera; //ViewMatrix (gl_ModelViewMatrix is ModelMatrix!) - uniform vec3 cameraPos; - uniform vec3 sunPos; - uniform vec3 sunDiffuse; - uniform vec3 sunAmbient; - #ifdef use_shadow - uniform mat4 shadowMatrix; - uniform vec4 shadowParams; - #endif - - uniform float frame2; - uniform vec3 speed; - - varying vec3 normal; - varying vec3 cameraDir; - varying vec3 teamColor; - varying vec3 light; - - - void main(void) - { - gl_TexCoord[0].st = gl_MultiTexCoord0.st; - - vec4 v = gl_Vertex; - v += (1.0 + speed.z) * smoothstep(0.0,-20.0,gl_Vertex.z) * vec4(sin(radians(frame2*10.0+gl_Vertex.z*5.0)),0.0,0.0,0.0); - v += (1.0 + speed.z) * smoothstep(0.0,15.0,abs(gl_Vertex.x)) * smoothstep(0.0,10.0,abs(gl_Vertex.z)) * vec4(0.0,sin(radians(frame2*15.0+gl_Vertex.z*19.0))*1.2,0.0,0.0); - - v += vec4(-speed.x*150.0,0.0,0.0,0.0) * pow((1.0-clamp((gl_Vertex.z+80.0)/100.0,0.0,1.0)),2.5); - - vec4 worldPos = gl_ModelViewMatrix * v; - - normal = normalize(gl_NormalMatrix * gl_Normal); - cameraDir = worldPos.xyz - cameraPos; - - teamColor = gl_TextureEnvColor[0].rgb; - - float a = max( dot(normal, sunPos), 0.0); - light = a * sunDiffuse + sunAmbient; - - #ifdef use_shadow - gl_TexCoord[1] = shadowMatrix * worldPos; - gl_TexCoord[1].st = gl_TexCoord[1].st * (inversesqrt( abs(gl_TexCoord[1].st) + shadowParams.z) + shadowParams.w) + shadowParams.xy; - #endif - - gl_Position = gl_ProjectionMatrix * camera * worldPos; - } - ]], - fragment = [[ -//#define use_shadow - uniform sampler2D textureS3o1; - uniform sampler2D textureS3o2; - uniform samplerCube specularMap; - - #ifdef use_shadow - uniform sampler2DShadow shadowMap; - uniform float shadowDensity; - uniform vec3 sunAmbient; - #endif - - varying vec3 normal; - varying vec3 cameraDir; - varying vec3 teamColor; - varying vec3 light; - - void main(void) - { - gl_FragColor = texture2D(textureS3o1, gl_TexCoord[0].st); - vec4 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - - vec3 reflectDir = reflect(cameraDir, normalize(normal)); - vec3 specular = textureCube(specularMap, reflectDir).rgb; - - vec3 shade; - #ifdef use_shadow - float shadow = shadow2DProj(shadowMap, gl_TexCoord[1]).r; - shadow = 1.0 - (1.0 - shadow) * shadowDensity; - shade = mix(sunAmbient, light, shadow); - specular *= shadow; - #else - shade = light; - #endif - - gl_FragColor.rgb = mix(gl_FragColor.rgb, teamColor, gl_FragColor.a); //teamcolor - gl_FragColor.rgb = gl_FragColor.rgb * shade + specular; - gl_FragColor.a = extraColor.a; - } - ]], - uniformInt = { - textureS3o1 = 0, - textureS3o2 = 1, - shadowMap = 2, - specularMap = 3, - }, - uniform = { - sunPos = {gl.GetSun("pos")}, - sunAmbient = {gl.GetSun("ambient" ,"unit")}, - sunDiffuse = {gl.GetSun("diffuse" ,"unit")}, - shadowDensity = {gl.GetSun("shadowDensity" ,"unit")}, - shadowParams = {gl.GetShadowMapParams()}, - }, - uniformMatrix = { - shadowMatrix = {gl.GetMatrixData("shadow")}, - }, -} \ No newline at end of file diff --git a/Objects3D/ChickenDefenseModels/chickens.s3o b/Objects3D/ChickenDefenseModels/chickens.s3o index 2a2343f3c..05a82fb14 100644 Binary files a/Objects3D/ChickenDefenseModels/chickens.s3o and b/Objects3D/ChickenDefenseModels/chickens.s3o differ diff --git a/Objects3D/ChickenDefenseModels/roost.s3o b/Objects3D/ChickenDefenseModels/roost.s3o index 4d36a43c5..5e59350b4 100644 Binary files a/Objects3D/ChickenDefenseModels/roost.s3o and b/Objects3D/ChickenDefenseModels/roost.s3o differ diff --git a/Objects3D/ChickenDefenseModels/spike.s3o b/Objects3D/ChickenDefenseModels/spike.s3o index 150053de7..ba74e8949 100644 Binary files a/Objects3D/ChickenDefenseModels/spike.s3o and b/Objects3D/ChickenDefenseModels/spike.s3o differ diff --git a/Objects3D/Lootboxes/lootbox.s3o b/Objects3D/Lootboxes/lootbox.s3o new file mode 100644 index 000000000..07605db70 Binary files /dev/null and b/Objects3D/Lootboxes/lootbox.s3o differ diff --git a/Objects3D/Lootboxes/lootbox3x3.s3o b/Objects3D/Lootboxes/lootbox3x3.s3o new file mode 100644 index 000000000..dab6f635d Binary files /dev/null and b/Objects3D/Lootboxes/lootbox3x3.s3o differ diff --git a/Objects3D/Lootboxes/lootbox4x4.s3o b/Objects3D/Lootboxes/lootbox4x4.s3o new file mode 100644 index 000000000..2944ea156 Binary files /dev/null and b/Objects3D/Lootboxes/lootbox4x4.s3o differ diff --git a/Objects3D/Lootboxes/lootbox5x5.s3o b/Objects3D/Lootboxes/lootbox5x5.s3o new file mode 100644 index 000000000..0a0413764 Binary files /dev/null and b/Objects3D/Lootboxes/lootbox5x5.s3o differ diff --git a/Objects3D/Lootboxes/lootbox6x6.s3o b/Objects3D/Lootboxes/lootbox6x6.s3o new file mode 100644 index 000000000..5f4be4091 Binary files /dev/null and b/Objects3D/Lootboxes/lootbox6x6.s3o differ diff --git a/Objects3D/airscout.s3o b/Objects3D/airscout.s3o deleted file mode 100644 index 5270222ca..000000000 Binary files a/Objects3D/airscout.s3o and /dev/null differ diff --git a/Objects3D/ammobox.s3o b/Objects3D/ammobox.s3o deleted file mode 100644 index 29e8cad3b..000000000 Binary files a/Objects3D/ammobox.s3o and /dev/null differ diff --git a/Objects3D/armflash.s3o b/Objects3D/armflash.s3o deleted file mode 100644 index 81794161b..000000000 Binary files a/Objects3D/armflash.s3o and /dev/null differ diff --git a/Objects3D/eaatank.s3o b/Objects3D/eaatank.s3o deleted file mode 100644 index dc675bd81..000000000 Binary files a/Objects3D/eaatank.s3o and /dev/null differ diff --git a/Objects3D/eaatank2.s3o b/Objects3D/eaatank2.s3o deleted file mode 100644 index 6b6a5fd20..000000000 Binary files a/Objects3D/eaatank2.s3o and /dev/null differ diff --git a/Objects3D/eaaturret.s3o b/Objects3D/eaaturret.s3o deleted file mode 100644 index 9e35d320b..000000000 Binary files a/Objects3D/eaaturret.s3o and /dev/null differ diff --git a/Objects3D/eaaturret2.s3o b/Objects3D/eaaturret2.s3o deleted file mode 100644 index 7f8404b4a..000000000 Binary files a/Objects3D/eaaturret2.s3o and /dev/null differ diff --git a/Objects3D/eaircon.s3o b/Objects3D/eaircon.s3o deleted file mode 100644 index f537be6c3..000000000 Binary files a/Objects3D/eaircon.s3o and /dev/null differ diff --git a/Objects3D/eairemp.s3o b/Objects3D/eairemp.s3o new file mode 100644 index 000000000..828646a06 Binary files /dev/null and b/Objects3D/eairemp.s3o differ diff --git a/Objects3D/eairengineer.s3o b/Objects3D/eairengineer.s3o deleted file mode 100644 index 5d62bf3c9..000000000 Binary files a/Objects3D/eairengineer.s3o and /dev/null differ diff --git a/Objects3D/eairengineer2.s3o b/Objects3D/eairengineer2.s3o deleted file mode 100644 index d49bd7e0b..000000000 Binary files a/Objects3D/eairengineer2.s3o and /dev/null differ diff --git a/Objects3D/eairplant - chopped.s3o b/Objects3D/eairplant - chopped.s3o deleted file mode 100644 index 91b41cd32..000000000 Binary files a/Objects3D/eairplant - chopped.s3o and /dev/null differ diff --git a/Objects3D/eairplant.s3o b/Objects3D/eairplant.s3o deleted file mode 100644 index c400ac1b3..000000000 Binary files a/Objects3D/eairplant.s3o and /dev/null differ diff --git a/Objects3D/eairplant3.s3o b/Objects3D/eairplant3.s3o index 8a70f021a..15f93d5c5 100644 Binary files a/Objects3D/eairplant3.s3o and b/Objects3D/eairplant3.s3o differ diff --git a/Objects3D/eallterraa.s3o b/Objects3D/eallterraa.s3o deleted file mode 100644 index 5c813dac0..000000000 Binary files a/Objects3D/eallterraa.s3o and /dev/null differ diff --git a/Objects3D/eallterranarchid.s3o b/Objects3D/eallterranarchid.s3o index 614921373..6bca029ab 100644 Binary files a/Objects3D/eallterranarchid.s3o and b/Objects3D/eallterranarchid.s3o differ diff --git a/Objects3D/eallterrassault.s3o b/Objects3D/eallterrassault.s3o index f997c43bb..fc7e6e596 100644 Binary files a/Objects3D/eallterrassault.s3o and b/Objects3D/eallterrassault.s3o differ diff --git a/Objects3D/eallterrengineer.s3o b/Objects3D/eallterrengineer.s3o deleted file mode 100644 index ba54202de..000000000 Binary files a/Objects3D/eallterrengineer.s3o and /dev/null differ diff --git a/Objects3D/eallterrengineer1.s3o b/Objects3D/eallterrengineer1.s3o deleted file mode 100644 index b54f8298d..000000000 Binary files a/Objects3D/eallterrengineer1.s3o and /dev/null differ diff --git a/Objects3D/eallterrengineer2.s3o b/Objects3D/eallterrengineer2.s3o deleted file mode 100644 index f53e264b5..000000000 Binary files a/Objects3D/eallterrengineer2.s3o and /dev/null differ diff --git a/Objects3D/eallterrfac2.s3o b/Objects3D/eallterrfac2.s3o index cedfb6087..16127424a 100644 Binary files a/Objects3D/eallterrfac2.s3o and b/Objects3D/eallterrfac2.s3o differ diff --git a/Objects3D/eallterrheavy.s3o b/Objects3D/eallterrheavy.s3o deleted file mode 100644 index 791969f8e..000000000 Binary files a/Objects3D/eallterrheavy.s3o and /dev/null differ diff --git a/Objects3D/eallterrheavy2.s3o b/Objects3D/eallterrheavy2.s3o index 17154705e..d32f9d7a5 100644 Binary files a/Objects3D/eallterrheavy2.s3o and b/Objects3D/eallterrheavy2.s3o differ diff --git a/Objects3D/eallterrlight.s3o b/Objects3D/eallterrlight.s3o deleted file mode 100644 index 71ca30eb5..000000000 Binary files a/Objects3D/eallterrlight.s3o and /dev/null differ diff --git a/Objects3D/eallterrlight2.s3o b/Objects3D/eallterrlight2.s3o index 242b41ed8..c4894fcfa 100644 Binary files a/Objects3D/eallterrlight2.s3o and b/Objects3D/eallterrlight2.s3o differ diff --git a/Objects3D/eallterrmed.s3o b/Objects3D/eallterrmed.s3o deleted file mode 100644 index 10fdea19e..000000000 Binary files a/Objects3D/eallterrmed.s3o and /dev/null differ diff --git a/Objects3D/eallterrmed2.s3o b/Objects3D/eallterrmed2.s3o index 900d40237..0005e471c 100644 Binary files a/Objects3D/eallterrmed2.s3o and b/Objects3D/eallterrmed2.s3o differ diff --git a/Objects3D/eallterrriot.s3o b/Objects3D/eallterrriot.s3o deleted file mode 100644 index e6c1130ba..000000000 Binary files a/Objects3D/eallterrriot.s3o and /dev/null differ diff --git a/Objects3D/eallterrriot2.s3o b/Objects3D/eallterrriot2.s3o index 9280248e0..7a77bc9cc 100644 Binary files a/Objects3D/eallterrriot2.s3o and b/Objects3D/eallterrriot2.s3o differ diff --git a/Objects3D/eallterrshield.s3o b/Objects3D/eallterrshield.s3o index 53df34eed..995bd4a5b 100644 Binary files a/Objects3D/eallterrshield.s3o and b/Objects3D/eallterrshield.s3o differ diff --git a/Objects3D/eamphibaa.s3o b/Objects3D/eamphibaa.s3o index 37722f0cb..a01d73a44 100644 Binary files a/Objects3D/eamphibaa.s3o and b/Objects3D/eamphibaa.s3o differ diff --git a/Objects3D/eamphibaaturret.s3o b/Objects3D/eamphibaaturret.s3o new file mode 100644 index 000000000..e515453cb Binary files /dev/null and b/Objects3D/eamphibaaturret.s3o differ diff --git a/Objects3D/eamphibarty2.s3o b/Objects3D/eamphibarty2.s3o index e5694759b..502d531a3 100644 Binary files a/Objects3D/eamphibarty2.s3o and b/Objects3D/eamphibarty2.s3o differ diff --git a/Objects3D/eamphibbuggy2.s3o b/Objects3D/eamphibbuggy2.s3o index 203325ebf..65f5c95d8 100644 Binary files a/Objects3D/eamphibbuggy2.s3o and b/Objects3D/eamphibbuggy2.s3o differ diff --git a/Objects3D/eamphibdrone.s3o b/Objects3D/eamphibdrone.s3o deleted file mode 100644 index 616136ff7..000000000 Binary files a/Objects3D/eamphibdrone.s3o and /dev/null differ diff --git a/Objects3D/eamphibfac2.s3o b/Objects3D/eamphibfac2.s3o index e8960677d..c873a4b3f 100644 Binary files a/Objects3D/eamphibfac2.s3o and b/Objects3D/eamphibfac2.s3o differ diff --git a/Objects3D/eamphibleveler.s3o b/Objects3D/eamphibleveler.s3o index e2c94c96d..fd94df023 100644 Binary files a/Objects3D/eamphibleveler.s3o and b/Objects3D/eamphibleveler.s3o differ diff --git a/Objects3D/eamphibmedtank2.s3o b/Objects3D/eamphibmedtank2.s3o index f57e8ca0e..cebd097e4 100644 Binary files a/Objects3D/eamphibmedtank2.s3o and b/Objects3D/eamphibmedtank2.s3o differ diff --git a/Objects3D/eamphibriot.s3o b/Objects3D/eamphibriot.s3o deleted file mode 100644 index 134cb6ad5..000000000 Binary files a/Objects3D/eamphibriot.s3o and /dev/null differ diff --git a/Objects3D/eamphibriot2.s3o b/Objects3D/eamphibriot2.s3o index b6e1ded5c..025907c31 100644 Binary files a/Objects3D/eamphibriot2.s3o and b/Objects3D/eamphibriot2.s3o differ diff --git a/Objects3D/eamphibrock.s3o b/Objects3D/eamphibrock.s3o deleted file mode 100644 index 49ee140db..000000000 Binary files a/Objects3D/eamphibrock.s3o and /dev/null differ diff --git a/Objects3D/eamphibrock2.s3o b/Objects3D/eamphibrock2.s3o deleted file mode 100644 index 587a8e062..000000000 Binary files a/Objects3D/eamphibrock2.s3o and /dev/null differ diff --git a/Objects3D/eamphibrock3.s3o b/Objects3D/eamphibrock3.s3o deleted file mode 100644 index c0229fbd8..000000000 Binary files a/Objects3D/eamphibrock3.s3o and /dev/null differ diff --git a/Objects3D/eamphibrock4.s3o b/Objects3D/eamphibrock4.s3o index 5735c6a48..8ebd754a8 100644 Binary files a/Objects3D/eamphibrock4.s3o and b/Objects3D/eamphibrock4.s3o differ diff --git a/Objects3D/eantinuke.s3o b/Objects3D/eantinuke.s3o new file mode 100644 index 000000000..fc14e7862 Binary files /dev/null and b/Objects3D/eantinuke.s3o differ diff --git a/Objects3D/eartytank.s3o b/Objects3D/eartytank.s3o deleted file mode 100644 index 4a2323c81..000000000 Binary files a/Objects3D/eartytank.s3o and /dev/null differ diff --git a/Objects3D/eartytank2.s3o b/Objects3D/eartytank2.s3o index 2de7cec89..33d70bd6c 100644 Binary files a/Objects3D/eartytank2.s3o and b/Objects3D/eartytank2.s3o differ diff --git a/Objects3D/eartytankbase.s3o b/Objects3D/eartytankbase.s3o new file mode 100644 index 000000000..5268c33a4 Binary files /dev/null and b/Objects3D/eartytankbase.s3o differ diff --git a/Objects3D/eartyturret.s3o b/Objects3D/eartyturret.s3o index f451ee3a4..b7d2b97cb 100644 Binary files a/Objects3D/eartyturret.s3o and b/Objects3D/eartyturret.s3o differ diff --git a/Objects3D/ebarricade.s3o b/Objects3D/ebarricade.s3o deleted file mode 100644 index 2b9034098..000000000 Binary files a/Objects3D/ebarricade.s3o and /dev/null differ diff --git a/Objects3D/ebarricade2.s3o b/Objects3D/ebarricade2.s3o deleted file mode 100644 index 615cbe7eb..000000000 Binary files a/Objects3D/ebarricade2.s3o and /dev/null differ diff --git a/Objects3D/ebarricade3.s3o b/Objects3D/ebarricade3.s3o index 0df4a0cdb..b0e421280 100644 Binary files a/Objects3D/ebarricade3.s3o and b/Objects3D/ebarricade3.s3o differ diff --git a/Objects3D/ebasefactory - Copy.s3o b/Objects3D/ebasefactory - Copy.s3o deleted file mode 100644 index ec5c62cc4..000000000 Binary files a/Objects3D/ebasefactory - Copy.s3o and /dev/null differ diff --git a/Objects3D/ebasefactory.s3o b/Objects3D/ebasefactory.s3o deleted file mode 100644 index 27255c47a..000000000 Binary files a/Objects3D/ebasefactory.s3o and /dev/null differ diff --git a/Objects3D/ebomb.s3o b/Objects3D/ebomb.s3o deleted file mode 100644 index 722431f62..000000000 Binary files a/Objects3D/ebomb.s3o and /dev/null differ diff --git a/Objects3D/ebomb2.s3o b/Objects3D/ebomb2.s3o deleted file mode 100644 index 20646cd54..000000000 Binary files a/Objects3D/ebomb2.s3o and /dev/null differ diff --git a/Objects3D/ebomber.s3o b/Objects3D/ebomber.s3o deleted file mode 100644 index 440549292..000000000 Binary files a/Objects3D/ebomber.s3o and /dev/null differ diff --git a/Objects3D/ebomber2-small.s3o b/Objects3D/ebomber2-small.s3o new file mode 100644 index 000000000..7eacb17a0 Binary files /dev/null and b/Objects3D/ebomber2-small.s3o differ diff --git a/Objects3D/ebomber2.s3o b/Objects3D/ebomber2.s3o index 5436fc452..a8daccc5e 100644 Binary files a/Objects3D/ebomber2.s3o and b/Objects3D/ebomber2.s3o differ diff --git a/Objects3D/ebox.s3o b/Objects3D/ebox.s3o index b6fb35be3..4dc8eae9c 100644 Binary files a/Objects3D/ebox.s3o and b/Objects3D/ebox.s3o differ diff --git a/Objects3D/ebox_small.s3o b/Objects3D/ebox_small.s3o new file mode 100644 index 000000000..a246d8e6a Binary files /dev/null and b/Objects3D/ebox_small.s3o differ diff --git a/Objects3D/ecommander-meteor.s3o b/Objects3D/ecommander-meteor.s3o new file mode 100644 index 000000000..e2e9f5430 Binary files /dev/null and b/Objects3D/ecommander-meteor.s3o differ diff --git a/Objects3D/ecommander.s3o b/Objects3D/ecommander.s3o deleted file mode 100644 index 92aadb2df..000000000 Binary files a/Objects3D/ecommander.s3o and /dev/null differ diff --git a/Objects3D/ecommander2.s3o b/Objects3D/ecommander2.s3o deleted file mode 100644 index 1fb712e0c..000000000 Binary files a/Objects3D/ecommander2.s3o and /dev/null differ diff --git a/Objects3D/ecommander3.s3o b/Objects3D/ecommander3.s3o deleted file mode 100644 index ea3404baa..000000000 Binary files a/Objects3D/ecommander3.s3o and /dev/null differ diff --git a/Objects3D/ecommander4-battle-large.s3o b/Objects3D/ecommander4-battle-large.s3o new file mode 100644 index 000000000..0fba34008 Binary files /dev/null and b/Objects3D/ecommander4-battle-large.s3o differ diff --git a/Objects3D/ecommander4-battle.s3o b/Objects3D/ecommander4-battle.s3o index 950fd4dc6..cf5817de3 100644 Binary files a/Objects3D/ecommander4-battle.s3o and b/Objects3D/ecommander4-battle.s3o differ diff --git a/Objects3D/ecommander4.s3o b/Objects3D/ecommander4.s3o index bcd5d29c2..feaec1baf 100644 Binary files a/Objects3D/ecommander4.s3o and b/Objects3D/ecommander4.s3o differ diff --git a/Objects3D/ecruisesilo.s3o b/Objects3D/ecruisesilo.s3o deleted file mode 100644 index 15225f1f5..000000000 Binary files a/Objects3D/ecruisesilo.s3o and /dev/null differ diff --git a/Objects3D/edrone.s3o b/Objects3D/edrone.s3o deleted file mode 100644 index f6c0abc11..000000000 Binary files a/Objects3D/edrone.s3o and /dev/null differ diff --git a/Objects3D/edrone2.s3o b/Objects3D/edrone2.s3o index 537e676ff..123054c2e 100644 Binary files a/Objects3D/edrone2.s3o and b/Objects3D/edrone2.s3o differ diff --git a/Objects3D/eengineer3.s3o b/Objects3D/eengineer3.s3o deleted file mode 100644 index c6c972c20..000000000 Binary files a/Objects3D/eengineer3.s3o and /dev/null differ diff --git a/Objects3D/eengineer4.s3o b/Objects3D/eengineer4.s3o deleted file mode 100644 index 4b75f1ec9..000000000 Binary files a/Objects3D/eengineer4.s3o and /dev/null differ diff --git a/Objects3D/eengineer5.s3o b/Objects3D/eengineer5.s3o deleted file mode 100644 index 65575aafb..000000000 Binary files a/Objects3D/eengineer5.s3o and /dev/null differ diff --git a/Objects3D/eengineer6.s3o b/Objects3D/eengineer6.s3o deleted file mode 100644 index ffdb86c3f..000000000 Binary files a/Objects3D/eengineer6.s3o and /dev/null differ diff --git a/Objects3D/eexnukearty.s3o b/Objects3D/eexnukearty.s3o deleted file mode 100644 index ffbb809ab..000000000 Binary files a/Objects3D/eexnukearty.s3o and /dev/null differ diff --git a/Objects3D/eexperimentalfac.s3o b/Objects3D/eexperimentalfac.s3o deleted file mode 100644 index b489eacc8..000000000 Binary files a/Objects3D/eexperimentalfac.s3o and /dev/null differ diff --git a/Objects3D/efatso2.s3o b/Objects3D/efatso2.s3o deleted file mode 100644 index 34ec6c41f..000000000 Binary files a/Objects3D/efatso2.s3o and /dev/null differ diff --git a/Objects3D/efighter.s3o b/Objects3D/efighter.s3o deleted file mode 100644 index 661b9e3cf..000000000 Binary files a/Objects3D/efighter.s3o and /dev/null differ diff --git a/Objects3D/efighter2-small.s3o b/Objects3D/efighter2-small.s3o new file mode 100644 index 000000000..c3acf2359 Binary files /dev/null and b/Objects3D/efighter2-small.s3o differ diff --git a/Objects3D/efighter2.s3o b/Objects3D/efighter2.s3o index 9d95cd726..0becfad6d 100644 Binary files a/Objects3D/efighter2.s3o and b/Objects3D/efighter2.s3o differ diff --git a/Objects3D/efighter3-small.s3o b/Objects3D/efighter3-small.s3o new file mode 100644 index 000000000..33a3834ed Binary files /dev/null and b/Objects3D/efighter3-small.s3o differ diff --git a/Objects3D/eflakturret.s3o b/Objects3D/eflakturret.s3o new file mode 100644 index 000000000..9c886d0a0 Binary files /dev/null and b/Objects3D/eflakturret.s3o differ diff --git a/Objects3D/eflametank.s3o b/Objects3D/eflametank.s3o deleted file mode 100644 index caf248fbd..000000000 Binary files a/Objects3D/eflametank.s3o and /dev/null differ diff --git a/Objects3D/efusion.s3o b/Objects3D/efusion.s3o deleted file mode 100644 index 7e422b643..000000000 Binary files a/Objects3D/efusion.s3o and /dev/null differ diff --git a/Objects3D/efusion2-huge.s3o b/Objects3D/efusion2-huge.s3o new file mode 100644 index 000000000..ed5a1d08b Binary files /dev/null and b/Objects3D/efusion2-huge.s3o differ diff --git a/Objects3D/efusion2.s3o b/Objects3D/efusion2.s3o index df716c0d0..3c5bfb6cd 100644 Binary files a/Objects3D/efusion2.s3o and b/Objects3D/efusion2.s3o differ diff --git a/Objects3D/egeothermal.s3o b/Objects3D/egeothermal.s3o deleted file mode 100644 index 4abefc3e2..000000000 Binary files a/Objects3D/egeothermal.s3o and /dev/null differ diff --git a/Objects3D/egeothermal2.s3o b/Objects3D/egeothermal2.s3o index 4c49b3261..8d9d9c2ea 100644 Binary files a/Objects3D/egeothermal2.s3o and b/Objects3D/egeothermal2.s3o differ diff --git a/Objects3D/egunship2.s3o b/Objects3D/egunship2.s3o deleted file mode 100644 index f8d9b78e6..000000000 Binary files a/Objects3D/egunship2.s3o and /dev/null differ diff --git a/Objects3D/egunship3-small.s3o b/Objects3D/egunship3-small.s3o new file mode 100644 index 000000000..7e661eb5f Binary files /dev/null and b/Objects3D/egunship3-small.s3o differ diff --git a/Objects3D/egunship3.s3o b/Objects3D/egunship3.s3o index 0c3fcaf26..930391b75 100644 Binary files a/Objects3D/egunship3.s3o and b/Objects3D/egunship3.s3o differ diff --git a/Objects3D/ehbotengineer.s3o b/Objects3D/ehbotengineer.s3o deleted file mode 100644 index 5bd6786a3..000000000 Binary files a/Objects3D/ehbotengineer.s3o and /dev/null differ diff --git a/Objects3D/ehbotengineer2.s3o b/Objects3D/ehbotengineer2.s3o index 37e0c8bae..5b7919075 100644 Binary files a/Objects3D/ehbotengineer2.s3o and b/Objects3D/ehbotengineer2.s3o differ diff --git a/Objects3D/ehbotengineer_turret.s3o b/Objects3D/ehbotengineer_turret.s3o index 2f7449bbf..db3dd40e4 100644 Binary files a/Objects3D/ehbotengineer_turret.s3o and b/Objects3D/ehbotengineer_turret.s3o differ diff --git a/Objects3D/ehbotfac.s3o b/Objects3D/ehbotfac.s3o index 24bacf0a0..3ebad5882 100644 Binary files a/Objects3D/ehbotfac.s3o and b/Objects3D/ehbotfac.s3o differ diff --git a/Objects3D/ehbotkarganneth.s3o b/Objects3D/ehbotkarganneth.s3o index b655c2037..6a058200c 100644 Binary files a/Objects3D/ehbotkarganneth.s3o and b/Objects3D/ehbotkarganneth.s3o differ diff --git a/Objects3D/ehbotkarganneth_turret.s3o b/Objects3D/ehbotkarganneth_turret.s3o index 13b68f58a..157cbdc4a 100644 Binary files a/Objects3D/ehbotkarganneth_turret.s3o and b/Objects3D/ehbotkarganneth_turret.s3o differ diff --git a/Objects3D/ehbotpeewee.s3o b/Objects3D/ehbotpeewee.s3o deleted file mode 100644 index 9b3529b84..000000000 Binary files a/Objects3D/ehbotpeewee.s3o and /dev/null differ diff --git a/Objects3D/ehbotpeewee2.s3o b/Objects3D/ehbotpeewee2.s3o index 26683234c..210788af0 100644 Binary files a/Objects3D/ehbotpeewee2.s3o and b/Objects3D/ehbotpeewee2.s3o differ diff --git a/Objects3D/ehbotpeewee_turret.s3o b/Objects3D/ehbotpeewee_turret.s3o index 619f3b8b7..5b74c6f1f 100644 Binary files a/Objects3D/ehbotpeewee_turret.s3o and b/Objects3D/ehbotpeewee_turret.s3o differ diff --git a/Objects3D/ehbotrocko.s3o b/Objects3D/ehbotrocko.s3o index 4657c5b78..ffc1a1484 100644 Binary files a/Objects3D/ehbotrocko.s3o and b/Objects3D/ehbotrocko.s3o differ diff --git a/Objects3D/ehbotrocko_turret.s3o b/Objects3D/ehbotrocko_turret.s3o index d048e5443..f9a834a00 100644 Binary files a/Objects3D/ehbotrocko_turret.s3o and b/Objects3D/ehbotrocko_turret.s3o differ diff --git a/Objects3D/ehbotsniper.s3o b/Objects3D/ehbotsniper.s3o index d7b00ab8a..523f0f1e6 100644 Binary files a/Objects3D/ehbotsniper.s3o and b/Objects3D/ehbotsniper.s3o differ diff --git a/Objects3D/ehbotsniper_turret.s3o b/Objects3D/ehbotsniper_turret.s3o index edf49b669..86f09fdec 100644 Binary files a/Objects3D/ehbotsniper_turret.s3o and b/Objects3D/ehbotsniper_turret.s3o differ diff --git a/Objects3D/ehbotthud.s3o b/Objects3D/ehbotthud.s3o index 491645239..01d43ab52 100644 Binary files a/Objects3D/ehbotthud.s3o and b/Objects3D/ehbotthud.s3o differ diff --git a/Objects3D/ehbotthud_turret.s3o b/Objects3D/ehbotthud_turret.s3o index 44f3f8704..52a1a6004 100644 Binary files a/Objects3D/ehbotthud_turret.s3o and b/Objects3D/ehbotthud_turret.s3o differ diff --git a/Objects3D/eheavytank3.s3o b/Objects3D/eheavytank3.s3o deleted file mode 100644 index e59f243d0..000000000 Binary files a/Objects3D/eheavytank3.s3o and /dev/null differ diff --git a/Objects3D/eheavytank3_upgraded.s3o b/Objects3D/eheavytank3_upgraded.s3o deleted file mode 100644 index 6f73dd7f1..000000000 Binary files a/Objects3D/eheavytank3_upgraded.s3o and /dev/null differ diff --git a/Objects3D/eheavytank4.s3o b/Objects3D/eheavytank4.s3o index 70c1bad47..8f356fa49 100644 Binary files a/Objects3D/eheavytank4.s3o and b/Objects3D/eheavytank4.s3o differ diff --git a/Objects3D/eheavytank_t3.s3o b/Objects3D/eheavytank_t3.s3o deleted file mode 100644 index 3d7bdf1a1..000000000 Binary files a/Objects3D/eheavytank_t3.s3o and /dev/null differ diff --git a/Objects3D/eheavyturret.s3o b/Objects3D/eheavyturret.s3o deleted file mode 100644 index ebd3090d6..000000000 Binary files a/Objects3D/eheavyturret.s3o and /dev/null differ diff --git a/Objects3D/eheavyturret2.s3o b/Objects3D/eheavyturret2.s3o deleted file mode 100644 index e088dd562..000000000 Binary files a/Objects3D/eheavyturret2.s3o and /dev/null differ diff --git a/Objects3D/eheavyturret3.s3o b/Objects3D/eheavyturret3.s3o index 9f7044532..94a41848c 100644 Binary files a/Objects3D/eheavyturret3.s3o and b/Objects3D/eheavyturret3.s3o differ diff --git a/Objects3D/ehoverfactory.s3o b/Objects3D/ehoverfactory.s3o index be8529e27..e92fd263e 100644 Binary files a/Objects3D/ehoverfactory.s3o and b/Objects3D/ehoverfactory.s3o differ diff --git a/Objects3D/ejammer2.s3o b/Objects3D/ejammer2.s3o deleted file mode 100644 index 04c7212cd..000000000 Binary files a/Objects3D/ejammer2.s3o and /dev/null differ diff --git a/Objects3D/ejammer3.s3o b/Objects3D/ejammer3.s3o index 2520f428c..fe6388ca6 100644 Binary files a/Objects3D/ejammer3.s3o and b/Objects3D/ejammer3.s3o differ diff --git a/Objects3D/ekrabgroth.s3o b/Objects3D/ekrabgroth.s3o deleted file mode 100644 index 614921373..000000000 Binary files a/Objects3D/ekrabgroth.s3o and /dev/null differ diff --git a/Objects3D/ekrow.s3o b/Objects3D/ekrow.s3o index 2bf36032c..657b7d027 100644 Binary files a/Objects3D/ekrow.s3o and b/Objects3D/ekrow.s3o differ diff --git a/Objects3D/elacerator.s3o b/Objects3D/elacerator.s3o index bad5b6d8f..7ca14e116 100644 Binary files a/Objects3D/elacerator.s3o and b/Objects3D/elacerator.s3o differ diff --git a/Objects3D/elaserbattery.s3o b/Objects3D/elaserbattery.s3o new file mode 100644 index 000000000..89c89f738 Binary files /dev/null and b/Objects3D/elaserbattery.s3o differ diff --git a/Objects3D/elighttank3.s3o b/Objects3D/elighttank3.s3o deleted file mode 100644 index 811f939f4..000000000 Binary files a/Objects3D/elighttank3.s3o and /dev/null differ diff --git a/Objects3D/elighttank4.s3o b/Objects3D/elighttank4.s3o index c68335564..9da20287a 100644 Binary files a/Objects3D/elighttank4.s3o and b/Objects3D/elighttank4.s3o differ diff --git a/Objects3D/elighttank4_upgraded.s3o b/Objects3D/elighttank4_upgraded.s3o deleted file mode 100644 index d9c35525c..000000000 Binary files a/Objects3D/elighttank4_upgraded.s3o and /dev/null differ diff --git a/Objects3D/elightturret.s3o b/Objects3D/elightturret.s3o deleted file mode 100644 index ae04ec6fa..000000000 Binary files a/Objects3D/elightturret.s3o and /dev/null differ diff --git a/Objects3D/elightturret2.s3o b/Objects3D/elightturret2.s3o deleted file mode 100644 index f16a2dadb..000000000 Binary files a/Objects3D/elightturret2.s3o and /dev/null differ diff --git a/Objects3D/elightturret3.s3o b/Objects3D/elightturret3.s3o index e57813851..b3d9c06d6 100644 Binary files a/Objects3D/elightturret3.s3o and b/Objects3D/elightturret3.s3o differ diff --git a/Objects3D/elrpc.s3o b/Objects3D/elrpc.s3o deleted file mode 100644 index 9772f781a..000000000 Binary files a/Objects3D/elrpc.s3o and /dev/null differ diff --git a/Objects3D/emaker.s3o b/Objects3D/emaker.s3o deleted file mode 100644 index 3eab347dd..000000000 Binary files a/Objects3D/emaker.s3o and /dev/null differ diff --git a/Objects3D/emaker2.s3o b/Objects3D/emaker2.s3o deleted file mode 100644 index bfb503e0c..000000000 Binary files a/Objects3D/emaker2.s3o and /dev/null differ diff --git a/Objects3D/emaker3.s3o b/Objects3D/emaker3.s3o index 14f22db95..bd0b605e9 100644 Binary files a/Objects3D/emaker3.s3o and b/Objects3D/emaker3.s3o differ diff --git a/Objects3D/emediumgen.s3o b/Objects3D/emediumgen.s3o index 9bbffe43b..cdacf6974 100644 Binary files a/Objects3D/emediumgen.s3o and b/Objects3D/emediumgen.s3o differ diff --git a/Objects3D/emetalextractor.s3o b/Objects3D/emetalextractor.s3o deleted file mode 100644 index d7e1ed70e..000000000 Binary files a/Objects3D/emetalextractor.s3o and /dev/null differ diff --git a/Objects3D/emetalextractor2.s3o b/Objects3D/emetalextractor2.s3o index 75849aca5..a5401afa9 100644 Binary files a/Objects3D/emetalextractor2.s3o and b/Objects3D/emetalextractor2.s3o differ diff --git a/Objects3D/emetalextractor2_small.s3o b/Objects3D/emetalextractor2_small.s3o new file mode 100644 index 000000000..bfe71e115 Binary files /dev/null and b/Objects3D/emetalextractor2_small.s3o differ diff --git a/Objects3D/emetalextractor2_up1.s3o b/Objects3D/emetalextractor2_up1.s3o new file mode 100644 index 000000000..47e02f7e5 Binary files /dev/null and b/Objects3D/emetalextractor2_up1.s3o differ diff --git a/Objects3D/emetalextractor2_up2.s3o b/Objects3D/emetalextractor2_up2.s3o new file mode 100644 index 000000000..4492be82a Binary files /dev/null and b/Objects3D/emetalextractor2_up2.s3o differ diff --git a/Objects3D/emetalextractor2_up3.s3o b/Objects3D/emetalextractor2_up3.s3o new file mode 100644 index 000000000..9dd117b8d Binary files /dev/null and b/Objects3D/emetalextractor2_up3.s3o differ diff --git a/Objects3D/emetalextractor3.s3o b/Objects3D/emetalextractor3.s3o new file mode 100644 index 000000000..82ac128ff Binary files /dev/null and b/Objects3D/emetalextractor3.s3o differ diff --git a/Objects3D/emine.s3o b/Objects3D/emine.s3o index e99b70f58..7326e42e1 100644 Binary files a/Objects3D/emine.s3o and b/Objects3D/emine.s3o differ diff --git a/Objects3D/emissiletank.s3o b/Objects3D/emissiletank.s3o deleted file mode 100644 index 6b5c37db2..000000000 Binary files a/Objects3D/emissiletank.s3o and /dev/null differ diff --git a/Objects3D/emissiletank2.s3o b/Objects3D/emissiletank2.s3o index 512d703cc..946d58d6d 100644 Binary files a/Objects3D/emissiletank2.s3o and b/Objects3D/emissiletank2.s3o differ diff --git a/Objects3D/eorb.s3o b/Objects3D/eorb.s3o deleted file mode 100644 index e180901a8..000000000 Binary files a/Objects3D/eorb.s3o and /dev/null differ diff --git a/Objects3D/eorb2.s3o b/Objects3D/eorb2.s3o deleted file mode 100644 index f7c00fb09..000000000 Binary files a/Objects3D/eorb2.s3o and /dev/null differ diff --git a/Objects3D/eorb3.s3o b/Objects3D/eorb3.s3o deleted file mode 100644 index a338250bf..000000000 Binary files a/Objects3D/eorb3.s3o and /dev/null differ diff --git a/Objects3D/eorb4.s3o b/Objects3D/eorb4.s3o index 7446f3c29..5223c0adc 100644 Binary files a/Objects3D/eorb4.s3o and b/Objects3D/eorb4.s3o differ diff --git a/Objects3D/epowerplant.s3o b/Objects3D/epowerplant.s3o deleted file mode 100644 index ce9b09adf..000000000 Binary files a/Objects3D/epowerplant.s3o and /dev/null differ diff --git a/Objects3D/epowerplant3x3.s3o b/Objects3D/epowerplant3x3.s3o new file mode 100644 index 000000000..b875e526f Binary files /dev/null and b/Objects3D/epowerplant3x3.s3o differ diff --git a/Objects3D/epowerplant6x6.s3o b/Objects3D/epowerplant6x6.s3o index e8e371e56..82f0219b2 100644 Binary files a/Objects3D/epowerplant6x6.s3o and b/Objects3D/epowerplant6x6.s3o differ diff --git a/Objects3D/eradar2.s3o b/Objects3D/eradar2.s3o deleted file mode 100644 index a91ba9172..000000000 Binary files a/Objects3D/eradar2.s3o and /dev/null differ diff --git a/Objects3D/eradar3.s3o b/Objects3D/eradar3.s3o index df8c572f7..0954845ab 100644 Binary files a/Objects3D/eradar3.s3o and b/Objects3D/eradar3.s3o differ diff --git a/Objects3D/eradar3_large.s3o b/Objects3D/eradar3_large.s3o new file mode 100644 index 000000000..4ade9a77a Binary files /dev/null and b/Objects3D/eradar3_large.s3o differ diff --git a/Objects3D/eradar3_small.s3o b/Objects3D/eradar3_small.s3o new file mode 100644 index 000000000..141b60b38 Binary files /dev/null and b/Objects3D/eradar3_small.s3o differ diff --git a/Objects3D/eriottank2.s3o b/Objects3D/eriottank2.s3o deleted file mode 100644 index 528e817fa..000000000 Binary files a/Objects3D/eriottank2.s3o and /dev/null differ diff --git a/Objects3D/eriottank3.s3o b/Objects3D/eriottank3.s3o index a2ab84041..cc4f36445 100644 Binary files a/Objects3D/eriottank3.s3o and b/Objects3D/eriottank3.s3o differ diff --git a/Objects3D/eriottank3_upgraded.s3o b/Objects3D/eriottank3_upgraded.s3o deleted file mode 100644 index 047d761be..000000000 Binary files a/Objects3D/eriottank3_upgraded.s3o and /dev/null differ diff --git a/Objects3D/escout.s3o b/Objects3D/escout.s3o deleted file mode 100644 index 3afbe3ce3..000000000 Binary files a/Objects3D/escout.s3o and /dev/null differ diff --git a/Objects3D/escout2.s3o b/Objects3D/escout2.s3o index 78154a11e..806e2c26e 100644 Binary files a/Objects3D/escout2.s3o and b/Objects3D/escout2.s3o differ diff --git a/Objects3D/esilo.s3o b/Objects3D/esilo.s3o deleted file mode 100644 index afe4732c7..000000000 Binary files a/Objects3D/esilo.s3o and /dev/null differ diff --git a/Objects3D/esilo2.s3o b/Objects3D/esilo2.s3o index f382b551d..90a3af1e0 100644 Binary files a/Objects3D/esilo2.s3o and b/Objects3D/esilo2.s3o differ diff --git a/Objects3D/estorage.s3o b/Objects3D/estorage.s3o deleted file mode 100644 index 13c7e7d70..000000000 Binary files a/Objects3D/estorage.s3o and /dev/null differ diff --git a/Objects3D/estorage2.s3o b/Objects3D/estorage2.s3o index f8992d01f..9b07473da 100644 Binary files a/Objects3D/estorage2.s3o and b/Objects3D/estorage2.s3o differ diff --git a/Objects3D/estorage2_small.s3o b/Objects3D/estorage2_small.s3o new file mode 100644 index 000000000..c883e1009 Binary files /dev/null and b/Objects3D/estorage2_small.s3o differ diff --git a/Objects3D/esubmarine.s3o b/Objects3D/esubmarine.s3o deleted file mode 100644 index 3bad0910c..000000000 Binary files a/Objects3D/esubmarine.s3o and /dev/null differ diff --git a/Objects3D/esubplane.s3o b/Objects3D/esubplane.s3o deleted file mode 100644 index 3bad0910c..000000000 Binary files a/Objects3D/esubplane.s3o and /dev/null differ diff --git a/Objects3D/etransport.s3o b/Objects3D/etransport.s3o deleted file mode 100644 index 64c07c8c5..000000000 Binary files a/Objects3D/etransport.s3o and /dev/null differ diff --git a/Objects3D/etransport2-small.s3o b/Objects3D/etransport2-small.s3o index 0ebcc517e..c976db991 100644 Binary files a/Objects3D/etransport2-small.s3o and b/Objects3D/etransport2-small.s3o differ diff --git a/Objects3D/euwmetalextractor.s3o b/Objects3D/euwmetalextractor.s3o deleted file mode 100644 index 8401b0ad8..000000000 Binary files a/Objects3D/euwmetalextractor.s3o and /dev/null differ diff --git a/Objects3D/euwturret.s3o b/Objects3D/euwturret.s3o index 7e7d2cff0..7cb632257 100644 Binary files a/Objects3D/euwturret.s3o and b/Objects3D/euwturret.s3o differ diff --git a/Objects3D/experimentalfac.s3o b/Objects3D/experimentalfac.s3o deleted file mode 100644 index 6d31ee689..000000000 Binary files a/Objects3D/experimentalfac.s3o and /dev/null differ diff --git a/Objects3D/extankdestroyer.s3o b/Objects3D/extankdestroyer.s3o deleted file mode 100644 index 76322ab86..000000000 Binary files a/Objects3D/extankdestroyer.s3o and /dev/null differ diff --git a/Objects3D/f2engineer.s3o b/Objects3D/f2engineer.s3o new file mode 100644 index 000000000..0fa147e53 Binary files /dev/null and b/Objects3D/f2engineer.s3o differ diff --git a/Objects3D/faction/armanni.s3o b/Objects3D/faction/armanni.s3o new file mode 100644 index 000000000..eebeddad8 Binary files /dev/null and b/Objects3D/faction/armanni.s3o differ diff --git a/Objects3D/faction/armarad.s3o b/Objects3D/faction/armarad.s3o new file mode 100644 index 000000000..e9d55c079 Binary files /dev/null and b/Objects3D/faction/armarad.s3o differ diff --git a/Objects3D/faction/armbrtha.s3o b/Objects3D/faction/armbrtha.s3o new file mode 100644 index 000000000..34b801530 Binary files /dev/null and b/Objects3D/faction/armbrtha.s3o differ diff --git a/Objects3D/faction/armcir.s3o b/Objects3D/faction/armcir.s3o new file mode 100644 index 000000000..aa09397ae Binary files /dev/null and b/Objects3D/faction/armcir.s3o differ diff --git a/Objects3D/faction/armhlt.s3o b/Objects3D/faction/armhlt.s3o new file mode 100644 index 000000000..524fd6617 Binary files /dev/null and b/Objects3D/faction/armhlt.s3o differ diff --git a/Objects3D/faction/cordoom.s3o b/Objects3D/faction/cordoom.s3o new file mode 100644 index 000000000..e07b2a16b Binary files /dev/null and b/Objects3D/faction/cordoom.s3o differ diff --git a/Objects3D/faction/corgate.s3o b/Objects3D/faction/corgate.s3o new file mode 100644 index 000000000..d7cddf62b Binary files /dev/null and b/Objects3D/faction/corgate.s3o differ diff --git a/Objects3D/faction/corpun.s3o b/Objects3D/faction/corpun.s3o new file mode 100644 index 000000000..b2f6a8947 Binary files /dev/null and b/Objects3D/faction/corpun.s3o differ diff --git a/Objects3D/faction/corscreamer.s3o b/Objects3D/faction/corscreamer.s3o new file mode 100644 index 000000000..f2391c52e Binary files /dev/null and b/Objects3D/faction/corscreamer.s3o differ diff --git a/Objects3D/faction/done/armamd.s3o b/Objects3D/faction/done/armamd.s3o new file mode 100644 index 000000000..7f2a7c1f7 Binary files /dev/null and b/Objects3D/faction/done/armamd.s3o differ diff --git a/Objects3D/faction/done/armflea.s3o b/Objects3D/faction/done/armflea.s3o new file mode 100644 index 000000000..51a130189 Binary files /dev/null and b/Objects3D/faction/done/armflea.s3o differ diff --git a/Objects3D/faction/done/armrl.s3o b/Objects3D/faction/done/armrl.s3o new file mode 100644 index 000000000..2bdc6f176 Binary files /dev/null and b/Objects3D/faction/done/armrl.s3o differ diff --git a/Objects3D/faction/done/armrock.s3o b/Objects3D/faction/done/armrock.s3o new file mode 100644 index 000000000..268c4d716 Binary files /dev/null and b/Objects3D/faction/done/armrock.s3o differ diff --git a/Objects3D/faction/done/armwar.s3o b/Objects3D/faction/done/armwar.s3o new file mode 100644 index 000000000..2c3ac3e93 Binary files /dev/null and b/Objects3D/faction/done/armwar.s3o differ diff --git a/Objects3D/faction/done/corck.s3o b/Objects3D/faction/done/corck.s3o new file mode 100644 index 000000000..ce19fcc66 Binary files /dev/null and b/Objects3D/faction/done/corck.s3o differ diff --git a/Objects3D/faction/done/corcrash.s3o b/Objects3D/faction/done/corcrash.s3o new file mode 100644 index 000000000..340d40128 Binary files /dev/null and b/Objects3D/faction/done/corcrash.s3o differ diff --git a/Objects3D/faction/done/corsilo.s3o b/Objects3D/faction/done/corsilo.s3o new file mode 100644 index 000000000..5d67b416d Binary files /dev/null and b/Objects3D/faction/done/corsilo.s3o differ diff --git a/Objects3D/faction/done/coruwadves.s3o b/Objects3D/faction/done/coruwadves.s3o new file mode 100644 index 000000000..65c7b0258 Binary files /dev/null and b/Objects3D/faction/done/coruwadves.s3o differ diff --git a/Objects3D/faction/xantinuke.s3o b/Objects3D/faction/xantinuke.s3o new file mode 100644 index 000000000..eacda98c1 Binary files /dev/null and b/Objects3D/faction/xantinuke.s3o differ diff --git a/Objects3D/faction/xcommander.s3o b/Objects3D/faction/xcommander.s3o new file mode 100644 index 000000000..8b9715949 Binary files /dev/null and b/Objects3D/faction/xcommander.s3o differ diff --git a/Objects3D/faction/xcrasher.s3o b/Objects3D/faction/xcrasher.s3o new file mode 100644 index 000000000..ce516f238 Binary files /dev/null and b/Objects3D/faction/xcrasher.s3o differ diff --git a/Objects3D/faction/xflea.s3o b/Objects3D/faction/xflea.s3o new file mode 100644 index 000000000..1c99f76ca Binary files /dev/null and b/Objects3D/faction/xflea.s3o differ diff --git a/Objects3D/faction/xhammer.s3o b/Objects3D/faction/xhammer.s3o new file mode 100644 index 000000000..d3183cc22 Binary files /dev/null and b/Objects3D/faction/xhammer.s3o differ diff --git a/Objects3D/faction/xkconstructor.s3o b/Objects3D/faction/xkconstructor.s3o new file mode 100644 index 000000000..89771b1f3 Binary files /dev/null and b/Objects3D/faction/xkconstructor.s3o differ diff --git a/Objects3D/faction/xklab.s3o b/Objects3D/faction/xklab.s3o new file mode 100644 index 000000000..ca2db7639 Binary files /dev/null and b/Objects3D/faction/xklab.s3o differ diff --git a/Objects3D/faction/xllt.s3o b/Objects3D/faction/xllt.s3o new file mode 100644 index 000000000..72d02fb19 Binary files /dev/null and b/Objects3D/faction/xllt.s3o differ diff --git a/Objects3D/faction/xmetalextractor.s3o b/Objects3D/faction/xmetalextractor.s3o new file mode 100644 index 000000000..0f864ce0e Binary files /dev/null and b/Objects3D/faction/xmetalextractor.s3o differ diff --git a/Objects3D/faction/xmetalextractormoho.s3o b/Objects3D/faction/xmetalextractormoho.s3o new file mode 100644 index 000000000..d807b1705 Binary files /dev/null and b/Objects3D/faction/xmetalextractormoho.s3o differ diff --git a/Objects3D/faction/xnukesilo.s3o b/Objects3D/faction/xnukesilo.s3o new file mode 100644 index 000000000..f138e51e8 Binary files /dev/null and b/Objects3D/faction/xnukesilo.s3o differ diff --git a/Objects3D/faction/xrocketturret.s3o b/Objects3D/faction/xrocketturret.s3o new file mode 100644 index 000000000..8e4c3dea5 Binary files /dev/null and b/Objects3D/faction/xrocketturret.s3o differ diff --git a/Objects3D/faction/xrocko.s3o b/Objects3D/faction/xrocko.s3o new file mode 100644 index 000000000..924a4e8c1 Binary files /dev/null and b/Objects3D/faction/xrocko.s3o differ diff --git a/Objects3D/faction/xskulk.s3o b/Objects3D/faction/xskulk.s3o new file mode 100644 index 000000000..f2ef70547 Binary files /dev/null and b/Objects3D/faction/xskulk.s3o differ diff --git a/Objects3D/faction/xsolar.s3o b/Objects3D/faction/xsolar.s3o new file mode 100644 index 000000000..51cfb810e Binary files /dev/null and b/Objects3D/faction/xsolar.s3o differ diff --git a/Objects3D/faction/xstorage.s3o b/Objects3D/faction/xstorage.s3o new file mode 100644 index 000000000..0e907cfd8 Binary files /dev/null and b/Objects3D/faction/xstorage.s3o differ diff --git a/Objects3D/faction/xsupply.s3o b/Objects3D/faction/xsupply.s3o new file mode 100644 index 000000000..cd8f0d9eb Binary files /dev/null and b/Objects3D/faction/xsupply.s3o differ diff --git a/Objects3D/faction/xwarrior.s3o b/Objects3D/faction/xwarrior.s3o new file mode 100644 index 000000000..bae261e94 Binary files /dev/null and b/Objects3D/faction/xwarrior.s3o differ diff --git a/Objects3D/features/enginetreereplacement/enginetreereplacement.s3o b/Objects3D/features/enginetreereplacement/enginetreereplacement.s3o new file mode 100644 index 000000000..1faf66d5c Binary files /dev/null and b/Objects3D/features/enginetreereplacement/enginetreereplacement.s3o differ diff --git a/Objects3D/hoverfac.s3o b/Objects3D/hoverfac.s3o deleted file mode 100644 index a587a7d7a..000000000 Binary files a/Objects3D/hoverfac.s3o and /dev/null differ diff --git a/Objects3D/laserturret.s3o b/Objects3D/laserturret.s3o new file mode 100644 index 000000000..d32f9d7a5 Binary files /dev/null and b/Objects3D/laserturret.s3o differ diff --git a/Objects3D/lilypad.3ds b/Objects3D/lilypad.3ds deleted file mode 100644 index 32b664b6b..000000000 Binary files a/Objects3D/lilypad.3ds and /dev/null differ diff --git a/Objects3D/lilypad.s3o b/Objects3D/lilypad.s3o deleted file mode 100644 index 74a4a1d5a..000000000 Binary files a/Objects3D/lilypad.s3o and /dev/null differ diff --git a/Objects3D/lozcommandtank-battle.s3o b/Objects3D/lozcommandtank-battle.s3o new file mode 100644 index 000000000..1fc27c44f Binary files /dev/null and b/Objects3D/lozcommandtank-battle.s3o differ diff --git a/Objects3D/lozcommandtank.s3o b/Objects3D/lozcommandtank.s3o new file mode 100644 index 000000000..1504e266e Binary files /dev/null and b/Objects3D/lozcommandtank.s3o differ diff --git a/Objects3D/nanopylon.s3o b/Objects3D/nanopylon.s3o new file mode 100644 index 000000000..bd7355687 Binary files /dev/null and b/Objects3D/nanopylon.s3o differ diff --git a/Objects3D/scavs/big/eamphibbuggy2big.s3o b/Objects3D/scavs/big/eamphibbuggy2big.s3o new file mode 100644 index 000000000..c4bd457f2 Binary files /dev/null and b/Objects3D/scavs/big/eamphibbuggy2big.s3o differ diff --git a/Objects3D/scavs/boss/eallterranarchidboss.s3o b/Objects3D/scavs/boss/eallterranarchidboss.s3o new file mode 100644 index 000000000..74263de45 Binary files /dev/null and b/Objects3D/scavs/boss/eallterranarchidboss.s3o differ diff --git a/Objects3D/scavs/boss/eamphiblevelerboss.s3o b/Objects3D/scavs/boss/eamphiblevelerboss.s3o new file mode 100644 index 000000000..9d0c4fb05 Binary files /dev/null and b/Objects3D/scavs/boss/eamphiblevelerboss.s3o differ diff --git a/Objects3D/scavs/boss/ehbotkargannethboss.s3o b/Objects3D/scavs/boss/ehbotkargannethboss.s3o new file mode 100644 index 000000000..618c590a4 Binary files /dev/null and b/Objects3D/scavs/boss/ehbotkargannethboss.s3o differ diff --git a/Objects3D/scavs/boss/ekrowboss.s3o b/Objects3D/scavs/boss/ekrowboss.s3o new file mode 100644 index 000000000..f8e0635a2 Binary files /dev/null and b/Objects3D/scavs/boss/ekrowboss.s3o differ diff --git a/Objects3D/scavs/boss/elaceratorboss.s3o b/Objects3D/scavs/boss/elaceratorboss.s3o new file mode 100644 index 000000000..28d19bd06 Binary files /dev/null and b/Objects3D/scavs/boss/elaceratorboss.s3o differ diff --git a/Objects3D/scavs/cube.s3o b/Objects3D/scavs/cube.s3o new file mode 100644 index 000000000..db5f06ec1 Binary files /dev/null and b/Objects3D/scavs/cube.s3o differ diff --git a/Objects3D/scavs/scavbeacon.s3o b/Objects3D/scavs/scavbeacon.s3o new file mode 100644 index 000000000..8e477dc59 Binary files /dev/null and b/Objects3D/scavs/scavbeacon.s3o differ diff --git a/Objects3D/scavs/scavbeacondroppod.s3o b/Objects3D/scavs/scavbeacondroppod.s3o new file mode 100644 index 000000000..bd7cd29d1 Binary files /dev/null and b/Objects3D/scavs/scavbeacondroppod.s3o differ diff --git a/Objects3D/scavs/scavcrate.s3o b/Objects3D/scavs/scavcrate.s3o new file mode 100644 index 000000000..50082876f Binary files /dev/null and b/Objects3D/scavs/scavcrate.s3o differ diff --git a/Objects3D/taatank2.s3o b/Objects3D/taatank2.s3o deleted file mode 100644 index 7d5c85e3a..000000000 Binary files a/Objects3D/taatank2.s3o and /dev/null differ diff --git a/Objects3D/taircon.s3o b/Objects3D/taircon.s3o deleted file mode 100644 index aad5bddcd..000000000 Binary files a/Objects3D/taircon.s3o and /dev/null differ diff --git a/Objects3D/tbinoc.s3o b/Objects3D/tbinoc.s3o deleted file mode 100644 index 9a1ca1504..000000000 Binary files a/Objects3D/tbinoc.s3o and /dev/null differ diff --git a/Objects3D/techdodad.s3o b/Objects3D/techdodad.s3o new file mode 100644 index 000000000..c89e57424 Binary files /dev/null and b/Objects3D/techdodad.s3o differ diff --git a/Objects3D/tengineer3.s3o b/Objects3D/tengineer3.s3o deleted file mode 100644 index 26a3bd468..000000000 Binary files a/Objects3D/tengineer3.s3o and /dev/null differ diff --git a/Objects3D/tfact.s3o b/Objects3D/tfact.s3o deleted file mode 100644 index de230c137..000000000 Binary files a/Objects3D/tfact.s3o and /dev/null differ diff --git a/Objects3D/tfusion2.s3o b/Objects3D/tfusion2.s3o deleted file mode 100644 index 4a954e7b4..000000000 Binary files a/Objects3D/tfusion2.s3o and /dev/null differ diff --git a/Objects3D/tgeothermal.s3o b/Objects3D/tgeothermal.s3o deleted file mode 100644 index 7f25a1cc6..000000000 Binary files a/Objects3D/tgeothermal.s3o and /dev/null differ diff --git a/Objects3D/tlighttank3.s3o b/Objects3D/tlighttank3.s3o deleted file mode 100644 index d0f0ab828..000000000 Binary files a/Objects3D/tlighttank3.s3o and /dev/null differ diff --git a/Objects3D/tlightturret.s3o b/Objects3D/tlightturret.s3o deleted file mode 100644 index 01994b288..000000000 Binary files a/Objects3D/tlightturret.s3o and /dev/null differ diff --git a/Objects3D/tmetalextractor.s3o b/Objects3D/tmetalextractor.s3o deleted file mode 100644 index b7a82629f..000000000 Binary files a/Objects3D/tmetalextractor.s3o and /dev/null differ diff --git a/Objects3D/torpedo.s3o b/Objects3D/torpedo.s3o deleted file mode 100644 index f786c6811..000000000 Binary files a/Objects3D/torpedo.s3o and /dev/null differ diff --git a/Objects3D/transport2.s3o b/Objects3D/transport2.s3o deleted file mode 100644 index bc49768f1..000000000 Binary files a/Objects3D/transport2.s3o and /dev/null differ diff --git a/Objects3D/tslicer2.s3o b/Objects3D/tslicer2.s3o deleted file mode 100644 index 79872797b..000000000 Binary files a/Objects3D/tslicer2.s3o and /dev/null differ diff --git a/Objects3D/tsolar2.s3o b/Objects3D/tsolar2.s3o deleted file mode 100644 index 5ec57f06d..000000000 Binary files a/Objects3D/tsolar2.s3o and /dev/null differ diff --git a/Objects3D/tstorage.s3o b/Objects3D/tstorage.s3o deleted file mode 100644 index d077e642d..000000000 Binary files a/Objects3D/tstorage.s3o and /dev/null differ diff --git a/Objects3D/turret-laser.s3o b/Objects3D/turret-laser.s3o deleted file mode 100644 index d2ff94f33..000000000 Binary files a/Objects3D/turret-laser.s3o and /dev/null differ diff --git a/Objects3D/turretaddon.s3o b/Objects3D/turretaddon.s3o deleted file mode 100644 index 7712ac939..000000000 Binary files a/Objects3D/turretaddon.s3o and /dev/null differ diff --git a/Objects3D/units/scavboss/dummyfile.txt b/Objects3D/units/scavboss/dummyfile.txt new file mode 100644 index 000000000..7c4a013e5 --- /dev/null +++ b/Objects3D/units/scavboss/dummyfile.txt @@ -0,0 +1 @@ +aaa \ No newline at end of file diff --git a/Objects3D/unused legos/medium tank.s3o b/Objects3D/unused legos/medium tank.s3o index 21861384d..691676cbb 100644 Binary files a/Objects3D/unused legos/medium tank.s3o and b/Objects3D/unused legos/medium tank.s3o differ diff --git a/Objects3D/zaal/spike.s3o b/Objects3D/zaal/spike.s3o new file mode 100644 index 000000000..87f51022d Binary files /dev/null and b/Objects3D/zaal/spike.s3o differ diff --git a/Objects3D/zaal/zairbomber.s3o b/Objects3D/zaal/zairbomber.s3o new file mode 100644 index 000000000..4ea6ff98e Binary files /dev/null and b/Objects3D/zaal/zairbomber.s3o differ diff --git a/Objects3D/zaal/zairscout.s3o b/Objects3D/zaal/zairscout.s3o new file mode 100644 index 000000000..5eacedf98 Binary files /dev/null and b/Objects3D/zaal/zairscout.s3o differ diff --git a/Objects3D/zaal/zairtoairfighter.s3o b/Objects3D/zaal/zairtoairfighter.s3o new file mode 100644 index 000000000..1c4470a41 Binary files /dev/null and b/Objects3D/zaal/zairtoairfighter.s3o differ diff --git a/Objects3D/zaal/zairtogroundfighter.s3o b/Objects3D/zaal/zairtogroundfighter.s3o new file mode 100644 index 000000000..ba7a387b0 Binary files /dev/null and b/Objects3D/zaal/zairtogroundfighter.s3o differ diff --git a/Objects3D/zaal/zarm.s3o b/Objects3D/zaal/zarm.s3o new file mode 100644 index 000000000..adc65c019 Binary files /dev/null and b/Objects3D/zaal/zarm.s3o differ diff --git a/Objects3D/zaal/zarty.s3o b/Objects3D/zaal/zarty.s3o new file mode 100644 index 000000000..7b3e9c3a2 Binary files /dev/null and b/Objects3D/zaal/zarty.s3o differ diff --git a/Objects3D/zaal/zassault.s3o b/Objects3D/zaal/zassault.s3o new file mode 100644 index 000000000..0e0e3fdc8 Binary files /dev/null and b/Objects3D/zaal/zassault.s3o differ diff --git a/Objects3D/zaal/zespire1.s3o b/Objects3D/zaal/zespire1.s3o new file mode 100644 index 000000000..9c1d5221c Binary files /dev/null and b/Objects3D/zaal/zespire1.s3o differ diff --git a/Objects3D/zaal/zespire4.s3o b/Objects3D/zaal/zespire4.s3o new file mode 100644 index 000000000..1c95ed587 Binary files /dev/null and b/Objects3D/zaal/zespire4.s3o differ diff --git a/Objects3D/zaal/zespire5.s3o b/Objects3D/zaal/zespire5.s3o new file mode 100644 index 000000000..750a03d3b Binary files /dev/null and b/Objects3D/zaal/zespire5.s3o differ diff --git a/Objects3D/zaal/zfactory.s3o b/Objects3D/zaal/zfactory.s3o new file mode 100644 index 000000000..ab379b302 Binary files /dev/null and b/Objects3D/zaal/zfactory.s3o differ diff --git a/Objects3D/zaal/zfactory_up1.s3o b/Objects3D/zaal/zfactory_up1.s3o new file mode 100644 index 000000000..ac30daf31 Binary files /dev/null and b/Objects3D/zaal/zfactory_up1.s3o differ diff --git a/Objects3D/zaal/zfactory_up2.s3o b/Objects3D/zaal/zfactory_up2.s3o new file mode 100644 index 000000000..245b259d5 Binary files /dev/null and b/Objects3D/zaal/zfactory_up2.s3o differ diff --git a/Objects3D/zaal/zfactory_up3.s3o b/Objects3D/zaal/zfactory_up3.s3o new file mode 100644 index 000000000..dc6f4351a Binary files /dev/null and b/Objects3D/zaal/zfactory_up3.s3o differ diff --git a/Objects3D/zaal/zhive.s3o b/Objects3D/zaal/zhive.s3o new file mode 100644 index 000000000..7b05e61e3 Binary files /dev/null and b/Objects3D/zaal/zhive.s3o differ diff --git a/Objects3D/zaal/zkamikaze.s3o b/Objects3D/zaal/zkamikaze.s3o new file mode 100644 index 000000000..818cf43a8 Binary files /dev/null and b/Objects3D/zaal/zkamikaze.s3o differ diff --git a/Objects3D/zaal/zlightswarm.s3o b/Objects3D/zaal/zlightswarm.s3o new file mode 100644 index 000000000..4d4c37bc4 Binary files /dev/null and b/Objects3D/zaal/zlightswarm.s3o differ diff --git a/Objects3D/zaal/zmedswarm.s3o b/Objects3D/zaal/zmedswarm.s3o new file mode 100644 index 000000000..efcc1a67f Binary files /dev/null and b/Objects3D/zaal/zmedswarm.s3o differ diff --git a/Objects3D/zaal/zmex.s3o b/Objects3D/zaal/zmex.s3o new file mode 100644 index 000000000..23942dd01 Binary files /dev/null and b/Objects3D/zaal/zmex.s3o differ diff --git a/Objects3D/zaal/zpyro.s3o b/Objects3D/zaal/zpyro.s3o new file mode 100644 index 000000000..1ffedf734 Binary files /dev/null and b/Objects3D/zaal/zpyro.s3o differ diff --git a/Objects3D/zaal/zqueen.s3o b/Objects3D/zaal/zqueen.s3o new file mode 100644 index 000000000..e52cc9e24 Binary files /dev/null and b/Objects3D/zaal/zqueen.s3o differ diff --git a/Objects3D/zaal/zroost.s3o b/Objects3D/zaal/zroost.s3o new file mode 100644 index 000000000..5e59350b4 Binary files /dev/null and b/Objects3D/zaal/zroost.s3o differ diff --git a/Objects3D/zaal/zskirmisher.s3o b/Objects3D/zaal/zskirmisher.s3o new file mode 100644 index 000000000..561f9a6ba Binary files /dev/null and b/Objects3D/zaal/zskirmisher.s3o differ diff --git a/Objects3D/zaal/ztenticle.s3o b/Objects3D/zaal/ztenticle.s3o new file mode 100644 index 000000000..068d6fa3d Binary files /dev/null and b/Objects3D/zaal/ztenticle.s3o differ diff --git a/Objects3D/zaal/ztiberium.s3o b/Objects3D/zaal/ztiberium.s3o new file mode 100644 index 000000000..d07c8f058 Binary files /dev/null and b/Objects3D/zaal/ztiberium.s3o differ diff --git a/Objects3D/zaal/ztiberium_small.s3o b/Objects3D/zaal/ztiberium_small.s3o new file mode 100644 index 000000000..6aaaa326e Binary files /dev/null and b/Objects3D/zaal/ztiberium_small.s3o differ diff --git a/Objects3D/zaal/ztumor.s3o b/Objects3D/zaal/ztumor.s3o new file mode 100644 index 000000000..87e81e4f0 Binary files /dev/null and b/Objects3D/zaal/ztumor.s3o differ diff --git a/README.md b/README.md index 8d06cbe8d..de03ae6be 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,3 @@ Join our Discord community at: https://discord.gg/WUbAs2f -[![Join the chat at https://gitter.im/EvolutionRTS/GeneralDiscussion](https://badges.gitter.im/EvolutionRTS/Evolution-RTS.svg)](https://gitter.im/EvolutionRTS/GeneralDiscussion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -

Evolution RTS

- -Evolution RTS is a free an Open Source RTS game designed using the Spring Engine. It has been in development for over 5 years and receives updates often. Its gameplay is designed specifically to appeal to gamers of all skill levels. The gameplay is designed around the use of unit groups, and the mixture of your unit group often will determine how successful you are in battle, as opposed to churning out hundreds of the same unit continually. - -The economy and teching system is easy to learn and use. The game itself supplies many tools that make managing your economy easier so that you can focus more on crushing your enemy than of playing simcity in your base. Units interact using realistic physics and varied terrain (you can actually micro units in order to dodge projectiles!). - -

Below is a very short list of the features that Evolution RTS has to offer:

- -

Realistic Physics

-Projectiles and units use a realistic physics system which allow for unprecedented control and gameplay. Micro your units to avoid projectiles. Hide behind terrain for cover. - -

Epic and Macro scales

-Control the battlefield and a level that feels the most comfortable to you, whether zoomed in controlling individual units, zoomed out viewing the entire map and issuing orders on a macro scale, or somewhere in between! You are in complete control! - -

Fine tuning controls for builders

-Set builders on repeat so that they repeat the orders you give infinitely until they die. Adjust builder priority in order to control the amount of resources allocated to that specific builder’s construction project. - -

Unique Cover System allows you to easily set up ambushes

-Hide your army in rocks and foliage completely undetected and lie in wait to ambush your enemy! - -

Gameplay geared towards casual gamers in addition to hardcore rts fans, as opposed to only being fun to play at the higher levels

-Gameplay designed around being easy to learn yet hard to master. As a newbie you can be up and running in no time, and the gameplay ensures that just because you are new, you aren’t necessarily at a huge disadvantage. - -

Hundreds of units at once

-The Spring Engine allows for hundreds or thousands of units to be beating the daylights out of each other all at once. Gameplay scales seamlessly to fit! - -

Unique unit abilities

-Discover units with special abilities, such as the ORB with it’s incredible area healing abilities, or the Overseer with it’s EMP ability! - -

Simple Economy

-The economy is designed to be easy to learn, and use. There are only two resources in the game; Energy and Metal. Energy is used for utility purposes such as unit ammunition, powering shields, and building nuclear missiles, whereas metal is used to construct structures and units. Metal income is split between allies and resources that overflow the player’s capacity automatically flow into allies banks. - -

Easy to learn teching system

-Simple teching system that revolves around using the same buildings that supply energy as a means to increase your tech availability ensure seamless transitions into heavier unit technologies. - -

Incredible effects

-Full particle effects engine and beautiful effects painstakingly created down to the last detail ensure that every battle will be visually stunning! - -

Full Soundtrack

-Full in-game soundtrack that highlights the mood based upon whether you are building structures in your base or engaged in an all out no holds barred war for survival will keep you on your toes and fuel your need for dominance! Over 40+ tracks! - -

Easy battle formations

-Easy to use battle formations via selecting a group of units, right-clicking and dragging on the map make it easy for you to give complex orders to your units, even in the midst of a battle! - -

Intelligent Unit Targeting AI

-Units automatically target the best enemy units to attack on their own, leaving you to concentrate on formations, flanking, and commanding your army! - -

Give orders via the mini-map

-Full unit orders can be given via the minimap, so you can control your units intuitively no matter where your camera is pointing. - -

Place map markers with or without labels, and draw directly on the map

-Map markers, drawing, and labels make it easy for you and your allies to communicate your battle plans, and illustrate them! - -

Unit balance dependent on unit mixture instead of one unit owning an entire army all by itself

-Unit balance is designed so that composition matters more than simply churning out hordes of the most expensive unit. - -

Intelligent builder AI

-Builders have a plethora of tools and options available to use to help you with macro tasks so that you can focus on kicking robotic ass! - -

Completely customizeable GUI

-The in-game gui can easily be moved around, resized, and position exactly how you like it! Be your own boss! - -

Gorgeously detailed unit textures and designs

- -

Weekly scheduled gaming events that are streamed live!

-Streamed live every Saturday at 5pm GMT at http://www.evolutionrts.info/stream and http://www.twitch.tv/evolutionrts - -

Automatic ladder ranking and replay system -http://replays.springrts.com/ - -Completely free, forever! -Open Source! -http://www.source.evolutionrts.info - -Evolution RTS is a continually evolving and developing game; Come and join our community! We love having more people to talk to and play with! Pre-emptively, welcome to our community! +Evolution RTS is a free and Open Source RTS game designed using the Spring Engine. Unfortunately, keeping this readme up to date is nearly impossible, so I recommend that you visit the website at https://www.evolutionrts.info diff --git a/Scripts/Units/scavboss/exptype.h b/Scripts/Units/scavboss/exptype.h new file mode 100644 index 000000000..7a83187b2 --- /dev/null +++ b/Scripts/Units/scavboss/exptype.h @@ -0,0 +1,193 @@ +/* +** EXPtype.h -- Explosion Type information and GET/SET constants for scripts +** +** This Script contains constants compatible only with Spring RTS engine +** not for use with Total Annihilation or TA:Kindgoms +*/ + +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +// Indices for emit-sfx +#ifndef __SFXTYPE_H_ +#define SFXTYPE_VTOL 0 +//#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 // same as SFX_WAKE +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 // same as SFX_REVERSE_WAKE + +#define SFXTYPE_WHITESMOKE 257 +#define SFXTYPE_BLACKSMOKE 258 +#define SFXTYPE_SUBBUBBLES 259 +#endif + +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define NOCEGTRAIL 64 // Disables the cegtrail for the specific piece (defined in the unit fbi) +#define NOHEATCLOUD 128 // No engine default heat cloud for explosion +#define BITMAP 10000001 + +// Bitmap Explosion Types +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 + +//Customized effects (in FBI/TDF/LUA) +// Explosion generators +#define UNIT_SFX0 1024 +#define UNIT_SFX1 1025 +#define UNIT_SFX2 1026 +#define UNIT_SFX3 1027 +#define UNIT_SFX4 1028 +#define UNIT_SFX5 1029 +#define UNIT_SFX6 1030 +#define UNIT_SFX7 1031 +#define UNIT_SFX8 1032 +#define UNIT_SFX9 1033 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 +#define FIRE_W9 2056 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 +#define DETO_W9 4104 + + +// COB constants +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get +#define REVERSING 109 // get + +// Indices for SET, GET, and GET_UNIT_VALUE for LUA return values +#define LUA0 110 // (LUA0 returns the lua call status, 0 or 1) +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) get WEAPON_RELOADSTATE(weaponNum) for GET +#define WEAPON_RELOADTIME 126 // get (with fake set) get WEAPON_RELOADSTATE(-weaponNum,val) for SET +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define WEAPON_STOCKPILE_COUNT 139 // get (with fake set) + + +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get +#define KSIN 135 // get, kiloSine 1024*sin(x) as COB uses only integers +#define KCOS 136 // get, kiloCosine 1024*cos(x) + +#define KTAN 137 // get, kiloTangent 1024*tan(x) carefull with angles close to 90 deg. might cause overflow +#define SQRT 138 // get, square root (floored to integer) + +#define ENERGY_MAKE 140 // set or get (100*E production) + +#define METAL_MAKE 141 // set or get (100*M production) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif \ No newline at end of file diff --git a/Scripts/Units/scavboss/sfxtype.h b/Scripts/Units/scavboss/sfxtype.h new file mode 100644 index 000000000..e69de29bb diff --git a/Scripts/Units/scavboss/unitDefsTurretSpeeds.h b/Scripts/Units/scavboss/unitDefsTurretSpeeds.h new file mode 100644 index 000000000..c30940742 --- /dev/null +++ b/Scripts/Units/scavboss/unitDefsTurretSpeeds.h @@ -0,0 +1,68 @@ +/* unitDefsTurretSpeeds.h -- sets turret speed via unitDefs (through lua gadget Spring.CallCOBScript()) + The following variables are assumed to exist: + Weapon1TurretX, Weapon1TurretY + ... + Weapon10TurretX, Weapon10TurretY +*/ + +static-var Weapon1TurretX, Weapon1TurretY; +static-var Weapon2TurretX, Weapon2TurretY; +static-var Weapon3TurretX, Weapon3TurretY; +static-var Weapon4TurretX, Weapon4TurretY; +static-var Weapon5TurretX, Weapon5TurretY; +static-var Weapon6TurretX, Weapon6TurretY; +static-var Weapon7TurretX, Weapon7TurretY; +static-var Weapon8TurretX, Weapon8TurretY; +static-var Weapon9TurretX, Weapon9TurretY; +static-var Weapon10TurretX, Weapon10TurretY; + +SetWeapon1TurretSpeed(var1,var2) +{ + Weapon1TurretX = var1; + Weapon1TurretY = var2; +} +SetWeapon2TurretSpeed(var1,var2) +{ + Weapon2TurretX = var1; + Weapon2TurretY = var2; +} +SetWeapon3TurretSpeed(var1,var2) +{ + Weapon3TurretX = var1; + Weapon3TurretY = var2; +} +SetWeapon4TurretSpeed(var1,var2) +{ + Weapon4TurretX = var1; + Weapon4TurretY = var2; +} +SetWeapon5TurretSpeed(var1,var2) +{ + Weapon5TurretX = var1; + Weapon5TurretY = var2; +} +SetWeapon6TurretSpeed(var1,var2) +{ + Weapon6TurretX = var1; + Weapon6TurretY = var2; +} +SetWeapon7TurretSpeed(var1,var2) +{ + Weapon7TurretX = var1; + Weapon7TurretY = var2; +} +SetWeapon8TurretSpeed(var1,var2) +{ + Weapon8TurretX = var1; + Weapon8TurretY = var2; +} +SetWeapon9TurretSpeed(var1,var2) +{ + Weapon9TurretX = var1; + Weapon9TurretY = var2; +} +SetWeapon10TurretSpeed(var1,var2) +{ + Weapon10TurretX = var1; + Weapon10TurretY = var2; +} \ No newline at end of file diff --git a/Scripts/Units/scavboss/water2.h b/Scripts/Units/scavboss/water2.h new file mode 100644 index 000000000..b5a5be089 --- /dev/null +++ b/Scripts/Units/scavboss/water2.h @@ -0,0 +1,31 @@ +/* Rockunit.h -- Rock the unit when it fire a heavy weapon with lots of recoil */ + +#ifndef __ROCKUNIT_H_ +#define __ROCKUNIT_H_ + + +RockUnit(anglex,anglez) + { + + #define FIRST_SPEED 15 + #define SECOND_SPEED 12 + #define THIRD_SPEED 9 + + turn base to x-axis anglex speed ; + turn base to z-axis anglez speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (0-anglex) speed ; + turn base to z-axis (0-anglez) speed ; + + //wait-for-turn base around z-axis; + //wait-for-turn base around x-axis; + + //turn base to x-axis <0> speed ; + //turn base to z-axis <0> speed ; + + + } +#endif diff --git a/Scripts/Units/scavboss/water3.h b/Scripts/Units/scavboss/water3.h new file mode 100644 index 000000000..5066f3284 --- /dev/null +++ b/Scripts/Units/scavboss/water3.h @@ -0,0 +1,35 @@ +#ifndef __ROCKUNIT_H_ +#define __ROCKUNIT_H_ + + +RockUnit(anglex,anglez) + { + + #define FIRST_SPEED 10 + #define SECOND_SPEED 8 + #define THIRD_SPEED 6 + #define FIFTH_SPEED 4 + + turn base to x-axis anglex speed ; + turn base to z-axis anglez speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (0-anglex) speed ; + turn base to z-axis (0-anglez) speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (anglex/2) speed ; + turn base to z-axis (anglez/2) speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis <0> speed ; + turn base to z-axis <0> speed ; + } +#endif + diff --git a/Scripts/Units/scavboss/weapon1control.h b/Scripts/Units/scavboss/weapon1control.h new file mode 100644 index 000000000..c93a74dc8 --- /dev/null +++ b/Scripts/Units/scavboss/weapon1control.h @@ -0,0 +1,168 @@ +/* +HOW TO: +- Model MUST contain aimx1 and aimy1 pieces +- Script must have defined Weapon1TurretX and Weapon1TurretY static-vars (turret turn speeds) +- Script must have defined aimx1 and aimy1 pieces +- Change script as such: +Create() +{ + [...] + start-script InitialSetup1(); + [...] +} + +AimWeapon1(heading, pitch) +{ + [...] + start-script Weapon1Drawn(); -- can call a function that draws weapons and then calls Weapon1Drawn() when done if there is an actual animation (ie pw) + [...] -- Remove animations from aimWeapon scripts (use a DrawWeapon1() if an animation is needed, weapon1control will rotate the different aimpieces) + start-script Weapon1SetWtdAim(heading, pitch); + [...] + return (aim1); +} + +static-var Stunned; +ExecuteRestoreAfterDelay() +{ + if (Stunned) { + return (1); + } +} +SetStunned(State) +{ + Stunned = State; + if (!Stunned) { + start-script ExecuteRestoreAfterDelay(); + } +} +RestoreAfterDelay() +{ + [...] + sleep sleeptime; + start-script RestoreWeapon1(); + [...] -- other animations; + call-script Weapon1Restored(); + [...] -- tell script wpn has been restored if needed for walkscripts +} + +- Weapon1Control moves the aim pieces depending on turretSpeeds, sets pitch = 1 when pitch reached and head = 1 when head reached +- Weapon1Drawn allows unit to fire by setting wpnReady1 = 1 +- if pitch = 1, head = 1 and wpnReady = 1 then the weapon can shoot: aim1 = 1 and aimweapon returns aim1 +- Restore animations go in RestoreAfterDelay, RestoreWeapon1() restores aimy and aimx pieces orientation, Weapon1Restored() waits for these pieces to be restored +*/ + +static-var curHead1, wtdHead1, head1, curPitch1, wtdPitch1, pitch1, aim1, wpnReady1; + +Weapon1Control() +{ + while (TRUE) + { + if (curHead1 > <180>) + { + curHead1 = <-360> + curHead1; + } + if (curPitch1 > <180>) + { + curPitch1 = <-360> + curPitch1; + } + if (curHead1 < <-180>) + { + curHead1 = <360> + curHead1; + } + if (curPitch1 < <-180>) + { + curPitch1 = <360> + curPitch1; + } + if (Static_Var_3 == 1) + { + if (((get ABS(curHead1 - wtdHead1)) > <360>) OR(((get ABS(curHead1 - wtdHead1)) > (Weapon1TurretY / 30)) AND ((get ABS(curHead1 - wtdHead1)) < <360> - (Weapon1TurretY / 30)))) + { + head1 = 0; + if(curHead1 < wtdHead1) { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 + (Weapon1TurretY / 30); + else curHead1 = curHead1 - (Weapon1TurretY / 30); + } + + else { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 - (Weapon1TurretY / 30); + else curHead1 = curHead1 + (Weapon1TurretY / 30); + } + } + else + { + head1 = 1; + curHead1 = wtdHead1; + } + if (((get ABS(curPitch1 - wtdPitch1)) > <360>) OR(((get ABS(curPitch1 - wtdPitch1)) > (Weapon1TurretX / 30)) AND ((get ABS(curPitch1 - wtdPitch1)) < <360> - (Weapon1TurretX / 30)))) + { + pitch1 = 0; + if(curPitch1 < wtdPitch1) { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 + (Weapon1TurretX / 30); + else curPitch1 = curPitch1 - (Weapon1TurretX / 30); + } + + else { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 - (Weapon1TurretX / 30); + else curPitch1 = curPitch1 + (Weapon1TurretX / 30); + } + } + else + { + pitch1 = 1; + curPitch1 = wtdPitch1; + } + if (pitch1 == 1 AND head1 == 1 AND wpnReady1 == 1 AND wtdHead1 != 0) + { + aim1 = 1; + } + else + { + aim1 = 0; + } + turn aimy1 to y-axis curHead1 now; + turn aimx1 to x-axis curPitch1 now; + } + sleep 1; + } +} + +InitialSetup1() +{ + curHead1 = 0; + curPitch1 = 0; + wtdHead1 = 0; + wtdPitch1 = 0; + wpnReady1 = 0; + start-script Weapon1Control(); +} + +Weapon1Drawn() +{ + wpnReady1 = 1; +} + +RestoreWeapon1() +{ + wtdHead1 = 0; + wtdPitch1 = 0; +} + +Weapon1Restored() +{ + wpnReady1 = 0; + while (curHead1 != 0) + { + sleep 25; + } + return (TRUE); +} + +Weapon1SetWtdAim(pitch, heading) +{ + wtdHead1 = heading; + wtdPitch1 = <0> - pitch; +} \ No newline at end of file diff --git a/Scripts/Units/scavboss/yard.h b/Scripts/Units/scavboss/yard.h new file mode 100644 index 000000000..048994e28 --- /dev/null +++ b/Scripts/Units/scavboss/yard.h @@ -0,0 +1,35 @@ +#ifndef SCRIPTS_YARD_H +#define SCRIPTS_YARD_H + +// keep trying to open building's yard until we succeed +OpenYard() + { + set YARD_OPEN to TRUE; + + while(!(get YARD_OPEN)) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to TRUE; + } + + set BUGGER_OFF to FALSE; + } + + +// keep trying to close building's yard until we succeed +CloseYard() + { + set YARD_OPEN to FALSE; + + while(get YARD_OPEN) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to FALSE; + } + + set BUGGER_OFF to FALSE; + } + +#endif // SCRIPTS_YARD_H diff --git a/Scripts/airscout.bos b/Scripts/airscout.bos deleted file mode 100644 index 485648879..000000000 --- a/Scripts/airscout.bos +++ /dev/null @@ -1,96 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, flare1, flare2; - -static-var moving; - -#define jethtrail 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from flare1; - emit-sfx jethtrail from flare2; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - - -Create() - { - turn flare1 to y-axis <180> now; - turn flare2 to y-axis <180> now; - start-script Thrust(); - start-script SmokeUnit(); - } - - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/airscout.cob b/Scripts/airscout.cob deleted file mode 100644 index 5b971ddb5..000000000 Binary files a/Scripts/airscout.cob and /dev/null differ diff --git a/Scripts/annihilator.bos b/Scripts/annihilator.bos deleted file mode 100644 index 5ad545105..000000000 --- a/Scripts/annihilator.bos +++ /dev/null @@ -1,127 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece barricade; // these are the pieces of the model - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from barricade; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ - -sleep 75; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/annihilatortest.bos b/Scripts/annihilatortest.bos deleted file mode 100644 index 75fb14ba6..000000000 --- a/Scripts/annihilatortest.bos +++ /dev/null @@ -1,129 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1; // these are the pieces of the model - -static-var gun_1; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ - -sleep 75; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/annihilatortest.cob b/Scripts/annihilatortest.cob deleted file mode 100644 index d17d62cd4..000000000 Binary files a/Scripts/annihilatortest.cob and /dev/null differ diff --git a/Scripts/antiairtower.bos b/Scripts/antiairtower.bos deleted file mode 100644 index bd9423569..000000000 --- a/Scripts/antiairtower.bos +++ /dev/null @@ -1,128 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1; // these are the pieces of the model - -static-var gun_1; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -sleep 75; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/armflash.bos b/Scripts/armflash.bos deleted file mode 100644 index f91124eac..000000000 --- a/Scripts/armflash.bos +++ /dev/null @@ -1,174 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, sleeve, barrel1, barrel2, firepoint1, firepoint2, wheels1, wheels2, wheels3, wheels4, wheels5, dirt; // these are the pieces of the model - -static-var moving, gun_1, shooting_num; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - spin wheels1 around x-axis speed <500.005495>; - spin wheels2 around x-axis speed <500.005495>; - spin wheels3 around x-axis speed <500.005495>; - spin wheels4 around x-axis speed <500.005495>; - spin wheels5 around x-axis speed <500.005495>; - } - else - { - stop-spin wheels1 around x-axis decelerate <200.005495>; - stop-spin wheels2 around x-axis decelerate <200.005495>; - stop-spin wheels3 around x-axis decelerate <200.005495>; - stop-spin wheels4 around x-axis decelerate <200.005495>; - stop-spin wheels5 around x-axis decelerate <200.005495>; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - shooting_num=1; - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn sleeve to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn sleeve to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn sleeve around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - if(shooting_num==1) - { - emit-sfx 1024 from firepoint2; - } - - if(shooting_num==2) - { - emit-sfx 1024 from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 3) - { - shooting_num=1; - } -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = sleeve; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if (shooting_num==1) - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode sleeve type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode sleeve type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode sleeve type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode sleeve type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/armflash.cob b/Scripts/armflash.cob deleted file mode 100644 index c5251519d..000000000 Binary files a/Scripts/armflash.cob and /dev/null differ diff --git a/Scripts/artillarytank.bos b/Scripts/artillarytank.bos deleted file mode 100644 index a29ed40fc..000000000 --- a/Scripts/artillarytank.bos +++ /dev/null @@ -1,165 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, turret, barrel1, firepoint1; - -static-var Static_Var_1, Static_Var_2, Static_Var_3; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from turret; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( Static_Var_3 ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(Func_Var_1) -{ - Static_Var_2 = Func_Var_1; - if( Static_Var_2 == 2 ) - { - move hull to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } - else - { - move hull to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - if( Static_Var_2 == 4 ) - { - move hull to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - else - { - move hull to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } -} - -Create() -{ - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn turret to y-axis <0.000000> speed <60.000000>; -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - while( Static_Var_1 >= 1 ) - { - sleep 100; - } - signal 2; - set-signal-mask 2; - turn turret to y-axis Func_Var_1 speed <225.000000>; - wait-for-turn turret around y-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() -{ - if( Static_Var_1 == 0 ) - { - emit-sfx 1024 + 0 from firepoint1; - move barrel1 to z-axis [-3.000000] speed [500.000000]; - sleep 75; - move barrel1 to z-axis [0.000000] speed [1.000000]; - } - ++Static_Var_1; - if( Static_Var_1 >= 1 ) - { - Static_Var_1 = 0; - } -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = 1; -} - -QueryWeapon1(Func_Var_1) -{ - if( Static_Var_1 == 0 ) - { - Func_Var_1 = 3; - } -} - -SweetSpot(piecenum) -{ - piecenum = hull; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode hull type BITMAPONLY | BITMAP1; - explode barrel1 type BITMAPONLY | BITMAP1; - explode turret type BITMAPONLY | BITMAP4; - return (0); - } - if( severity <= 80 ) - { - corpsetype = 2; - explode hull type BITMAPONLY | BITMAP4; - explode barrel1 type FALL | BITMAP1; - explode turret type SHATTER | BITMAP4; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode hull type BITMAPONLY | BITMAP1; - explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode turret type SHATTER | BITMAP4; - return (0); - } - corpsetype = 3; - explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/barricade.bos b/Scripts/barricade.bos deleted file mode 100644 index 9370e52a8..000000000 --- a/Scripts/barricade.bos +++ /dev/null @@ -1,13 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, rotator; // these are the pieces of the model - - -Create() // tells it what to do on creation -{ - spin rotator around y-axis speed <20.005495>; -} - diff --git a/Scripts/barricade.cob b/Scripts/barricade.cob deleted file mode 100644 index 619ba65e9..000000000 Binary files a/Scripts/barricade.cob and /dev/null differ diff --git a/Scripts/burrow.bos b/Scripts/burrow.bos deleted file mode 100644 index 05607a5ce..000000000 --- a/Scripts/burrow.bos +++ /dev/null @@ -1,94 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -static-var Static_Var_1, tech; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1025 from firepoint1; -// } - sleep 500; - } -} - - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1026 from firepoint1; -// } - sleep 500; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn firepoint1 to x-axis <-90> now; - start-script SmokeUnit(); -} -/* -TechLost() -{ - set ACTIVATION to 0; - tech=FALSE; -} - -TechGranted() -{ - set ACTIVATION to 1; - tech=TRUE; -} -*/ -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; -} diff --git a/Scripts/burrow.cob b/Scripts/burrow.cob deleted file mode 100644 index 83e7063d8..000000000 Binary files a/Scripts/burrow.cob and /dev/null differ diff --git a/Scripts/cpweapon.bos b/Scripts/cpweapon.bos deleted file mode 100644 index 864ede030..000000000 --- a/Scripts/cpweapon.bos +++ /dev/null @@ -1,110 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, stock, barrels, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define gdmarty 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn stock to x-axis <0.000000> speed <30.000000>; -stop-spin barrels around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn stock to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn stock around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -spin barrels around z-axis speed <500.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = stock; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode turret type BITMAPONLY | BITMAP1; -explode barrels type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode turret type BITMAPONLY | BITMAP4; -explode barrels type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode turret type BITMAPONLY | BITMAP1; -explode barrels type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrels type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/cpweapon.cob b/Scripts/cpweapon.cob deleted file mode 100644 index 2058db233..000000000 Binary files a/Scripts/cpweapon.cob and /dev/null differ diff --git a/Scripts/eaatank.bos b/Scripts/eaatank.bos deleted file mode 100644 index 7da9960c7..000000000 --- a/Scripts/eaatank.bos +++ /dev/null @@ -1,152 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -#include "ROCKUNIT.H" - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx 1025 + 0 from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/eaatank.cob b/Scripts/eaatank.cob deleted file mode 100644 index c9e3d9d94..000000000 Binary files a/Scripts/eaatank.cob and /dev/null differ diff --git a/Scripts/eaatank2.bos b/Scripts/eaatank2.bos deleted file mode 100644 index 2146b4c48..000000000 --- a/Scripts/eaatank2.bos +++ /dev/null @@ -1,194 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, firepoint2, firepoint3, firepoint4, tanks, dirt; // these are the pieces of the model - -static-var terraintype, bmoving, moving, shooting_num; // these are the variables - -#include "ROCKUNIT.H" - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from tanks; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - shooting_num=1; - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <5000>; -turn barrel1 to x-axis <0> - pitch speed <5000>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - - if(shooting_num==1) - { - emit-sfx 1025 from firepoint2; - } - if(shooting_num==2) - { - emit-sfx 1025 from firepoint3; - } - if(shooting_num==3) - { - emit-sfx 1025 from firepoint4; - } - if(shooting_num==4) - { - emit-sfx 1025 from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 5) - { - shooting_num=1; - } -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } - - if (shooting_num==3) - { - piecenum=firepoint3; - } - - if (shooting_num==4) - { - piecenum=firepoint4; - } -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode tanks type EXPLODE_ON_HIT; -} diff --git a/Scripts/eaatank2.cob b/Scripts/eaatank2.cob deleted file mode 100644 index f8c94f3b8..000000000 Binary files a/Scripts/eaatank2.cob and /dev/null differ diff --git a/Scripts/eaaturret.bos b/Scripts/eaaturret.bos deleted file mode 100644 index 8c1662dd0..000000000 --- a/Scripts/eaaturret.bos +++ /dev/null @@ -1,137 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, sfxpoint1, lilypad; // these are the pieces of the model - -static-var CanFire, terraintype; - -// Signal definitions -#define SIG_AIM 2 // this is a aim define <- o_O This is a kill flag - -// Custom SFX -#define GDMARTY 1024+0 - -SmokeUnit()// this is a standard smoke point define -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.5] speed [50]; - show lilypad; - } - else - { - move base to y-axis [0] speed [50]; - hide lilypad; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - hide lilypad; - } - else - { - move base to y-axis [-0.85] speed [50]; - show lilypad; - } -} - -cannotfire() -{ - while( TRUE ) - { - if (!CanFire) - { - emit-sfx 1025 from sfxpoint1; - } - sleep 1500; - } -} - -Create() // tells it what to do on creation -{ - CanFire=TRUE; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); - start-script cannotfire(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ - sleep 3000; - turn turret to y-axis <0> speed <60>; - turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // aiming animation and firing authorization -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - while(!CanFire) - sleep 200; - turn turret to y-axis heading speed <5000>; - turn barrel1 to x-axis <0> - pitch speed <5000>; - wait-for-turn turret around y-axis; - wait-for-turn barrel1 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - emit-sfx GDMARTY from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ - piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is created at -{ - piecenum = firepoint1; -} - -/* -TechLost() -{ - CanFire=FALSE; - signal SIG_AIM; -} - -TechGranted() -{ - CanFire=TRUE; -} -*/ - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode turret type EXPLODE_ON_HIT; - explode barrel1 type EXPLODE_ON_HIT; -} diff --git a/Scripts/eaaturret.cob b/Scripts/eaaturret.cob deleted file mode 100644 index 024b6fc66..000000000 Binary files a/Scripts/eaaturret.cob and /dev/null differ diff --git a/Scripts/eaircon.bos b/Scripts/eaircon.bos deleted file mode 100644 index 96c1e05ea..000000000 --- a/Scripts/eaircon.bos +++ /dev/null @@ -1,208 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, fan1, fan2, firepoint1; - -static-var Static_Var_1, gun_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype; - -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from base; - sleep 200; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2049 from base; - sleep 10; - } -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - -QueryWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - - -Go() -{ - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -Create() -{ - call-script InitState(); - spin fan1 around y-axis speed <1000.005495>; - spin fan2 around y-axis speed <1000.005495>; - start-script SmokeUnit(); -} - - -StartBuilding(Func_Var_1) -{ - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = base; - Static_Var_5 = 1; - return (0); - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/eaircon.cob b/Scripts/eaircon.cob deleted file mode 100644 index 277f3243d..000000000 Binary files a/Scripts/eaircon.cob and /dev/null differ diff --git a/Scripts/eairemp.bos b/Scripts/eairemp.bos new file mode 100644 index 000000000..b271f60ee --- /dev/null +++ b/Scripts/eairemp.bos @@ -0,0 +1,130 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, frontengines, fengine1, fengine2, rearengines, rengine1, rengine2, missileleft, missileright, firepoint1; + +static-var moving, flames; + +#define jethtrail 1024+0 + +// Signal definitions +#define SIG_AIM 2 + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1025 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + + +Thrust() +{ + while( TRUE ) + { + if (moving) + { + emit-sfx jethtrail from fengine1; + emit-sfx jethtrail from fengine2; + emit-sfx jethtrail from rengine1; + emit-sfx jethtrail from rengine2; + } + sleep 5; + } +} + +StartMoving() +{ + moving=1; +} + +StopMoving() +{ + moving=0; +} + +MoveRate0() +{ + flames=0; + turn frontengines to x-axis <-90.000000> speed <150.000000>; + turn rearengines to x-axis <-90.000000> speed <150.000000>; +} +MoveRate1() +{ + flames=0; + turn frontengines to x-axis <-70.005495> speed <150.000000>; + turn rearengines to x-axis <-70.005495> speed <150.000000>; +} +MoveRate2() +{ + flames=1; + turn frontengines to x-axis <0.000000> speed <150.000000>; + turn rearengines to x-axis <0.000000> speed <150.000000>; +} + +Create() + { +// start-script Thrust(); + start-script SmokeUnit(); + } + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ + sleep 3000; +} + +AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + start-script RestoreAfterDelay(); + return (1); +} + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ +emit-sfx 1024 + 0 from firepoint1; +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ + piecenum = firepoint1; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ + piecenum = firepoint1; +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode frontengines type EXPLODE_ON_HIT; + explode rearengines type EXPLODE_ON_HIT; + explode missileright type EXPLODE_ON_HIT; + explode missileleft type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/eairemp.cob b/Scripts/eairemp.cob new file mode 100644 index 000000000..074df8d62 Binary files /dev/null and b/Scripts/eairemp.cob differ diff --git a/Scripts/eairengineer.bos b/Scripts/eairengineer.bos deleted file mode 100644 index dba8aed99..000000000 --- a/Scripts/eairengineer.bos +++ /dev/null @@ -1,174 +0,0 @@ -piece base, doorleft, doorright, nanopoint1, penis, wheel, frontwings, fengine1, fengine2, rearwings, rengine1, rengine2; - -#include "springdefs.h" -#define SIG_BUILD 8 -#define jethtrail 1024+0 -#define nanoflame 1025+0 - -static-var bMoving, terraintype, building, moving, flames; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from fengine1; - emit-sfx jethtrail from fengine2; - emit-sfx jethtrail from rengine1; - emit-sfx jethtrail from rengine2; - } - sleep 5; - } -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ -// start-script Thrust(); - start-script SmokeUnit(); -// turn fengine1 to y-axis <180> now; -// turn fengine2 to y-axis <180> now; -// turn rengine1 to y-axis <180> now; -// turn rengine2 to y-axis <180> now; - start-script buildflame(); -} - -QueryWeapon1(piecenum) -{ - piecenum=nanopoint1; -} - -AimFromWeapon1(piecenum) -{ - piecenum=penis; -} - -AimWeapon1(h,p) -{ - return 0; -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - turn doorleft to y-axis <90> speed <100.000000>; - turn doorright to y-axis <-90> speed <100.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; -// turn base to y-axis heading speed <160.000000>; -// turn base to x-axis heading speed <160.000000>; -// wait-for-turn base around y-axis; -// wait-for-turn base around x-axis; - move penis to z-axis [4] speed [1]; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - move penis to z-axis [0] speed [2]; - turn doorleft to y-axis <0> speed <50.000000>; - turn doorright to y-axis <0> speed <50.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; -// turn base to y-axis <0.000000> speed <160.000000>; -// turn base to x-axis <0.000000> speed <160.000000>; -// wait-for-turn base around y-axis; -// wait-for-turn base around x-axis; - -} - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -MoveRate0() -{ - flames=0; - turn frontwings to x-axis <-90.000000> speed <150.000000>; - turn rearwings to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - flames=0; - turn frontwings to x-axis <-70.005495> speed <150.000000>; - turn rearwings to x-axis <-70.005495> speed <150.000000>; -} -MoveRate2() -{ - flames=1; - turn frontwings to x-axis <0.000000> speed <150.000000>; - turn rearwings to x-axis <0.000000> speed <150.000000>; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode doorleft type EXPLODE_ON_HIT; - explode doorright type EXPLODE_ON_HIT; - explode penis type EXPLODE_ON_HIT; - explode wheel type EXPLODE_ON_HIT; - explode frontwings type EXPLODE_ON_HIT; - explode fengine1 type EXPLODE_ON_HIT; - explode fengine2 type EXPLODE_ON_HIT; - explode rearwings type EXPLODE_ON_HIT; - explode rengine1 type EXPLODE_ON_HIT; - explode rengine2 type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eairengineer.cob b/Scripts/eairengineer.cob deleted file mode 100644 index 4cc70a17a..000000000 Binary files a/Scripts/eairengineer.cob and /dev/null differ diff --git a/Scripts/eairengineer2.bos b/Scripts/eairengineer2.bos deleted file mode 100644 index 147d3edae..000000000 --- a/Scripts/eairengineer2.bos +++ /dev/null @@ -1,179 +0,0 @@ -piece base, nanopoint1, nanopoint2, frontwings, fengine1, fengine2, rearwings, rengine1, rengine2, righttip, lefttip; - -#include "springdefs.h" -#define SIG_BUILD 8 -#define jethtrail 1024+0 -#define nanoflame 1025+0 - -static-var bMoving, terraintype, building, moving, flames, spray; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from fengine1; - emit-sfx jethtrail from fengine2; - emit-sfx jethtrail from rengine1; - emit-sfx jethtrail from rengine2; - } - sleep 5; - } -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - emit-sfx nanoflame from nanopoint2; - - } - sleep 600; - } -} - -Create() -{ -// start-script Thrust(); - start-script SmokeUnit(); -// turn fengine1 to y-axis <180> now; -// turn fengine2 to y-axis <180> now; -// turn rengine1 to y-axis <180> now; -// turn rengine2 to y-axis <180> now; - spray = nanopoint1; - start-script buildflame(); -} - -QueryWeapon1(piecenum) -{ - if( spray == 0 ) - { - piecenum = nanopoint1; - } - if( spray == 1 ) - { - piecenum = nanopoint2; - } - ++spray; - if( spray >= 2 ) - { - spray = 0; - } -} - -AimFromWeapon1(piecenum) -{ - if( spray == 0 ) - { - piecenum = nanopoint1; - } - if( spray == 1 ) - { - piecenum = nanopoint2; - } - ++spray; - if( spray >= 2 ) - { - spray = 0; - } -} - -AimWeapon1(h,p) -{ - return 0; -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 1; - building = 1; - while (1) { - spin lefttip around y-axis speed <50.005495>; - spin righttip around y-axis speed <50.005495>; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - stop-spin lefttip around y-axis decelerate <15.000000>; - stop-spin righttip around y-axis decelerate <15.000000>; -} - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -MoveRate0() -{ - flames=0; - turn frontwings to x-axis <-90.000000> speed <150.000000>; - turn rearwings to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - flames=0; - turn frontwings to x-axis <-70.005495> speed <150.000000>; - turn rearwings to x-axis <-70.005495> speed <150.000000>; -} -MoveRate2() -{ - flames=1; - turn frontwings to x-axis <0.000000> speed <150.000000>; - turn rearwings to x-axis <0.000000> speed <150.000000>; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode lefttip type EXPLODE_ON_HIT; - explode righttip type EXPLODE_ON_HIT; - explode base type EXPLODE_ON_HIT; - explode frontwings type EXPLODE_ON_HIT; - explode rearwings type EXPLODE_ON_HIT; -} diff --git a/Scripts/eairengineer2.cob b/Scripts/eairengineer2.cob deleted file mode 100644 index e239a263e..000000000 Binary files a/Scripts/eairengineer2.cob and /dev/null differ diff --git a/Scripts/eairplant.bos b/Scripts/eairplant.bos deleted file mode 100644 index a014d817a..000000000 --- a/Scripts/eairplant.bos +++ /dev/null @@ -1,203 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, door1, door2, elevator, nano1, nano2, spinner, nanopoint, bottom, backbone, bottombackbone; - -static-var Aztec, spray, building; - -// Signal definitions (they must be distincts power of 2) -#define SIG_ACTIVATE 2 -#define SIG_BUILDING 4 -#define SIG_TECH 8 - -#define nanoflame 1024+0 - -SmokeUnit() -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - - -Activate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Wait for tech: - while(!Aztec) - sleep 400; - // Open animation: - move elevator to y-axis [37] speed [5]; - wait-for-move elevator along y-axis; - turn door2 to z-axis <90> speed <50>; - turn door1 to z-axis <-90> speed <50>; - wait-for-turn door2 around z-axis; - wait-for-turn door1 around z-axis; - // Try to open the yard - set YARD_OPEN to TRUE; - // If yard not open, tell units around to bugger off until yard is open - while( !get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to TRUE; - } - set BUGGER_OFF to FALSE; - // Now yard is open. - // Allow the nano to flow: - set INBUILDSTANCE to TRUE; - building = 1; - // Send spinner spinning: - spin spinner around y-axis speed <50>; -} - -Deactivate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Wait for tech: - while(!Aztec) - sleep 400; - // Switch off the nano faucet: - set INBUILDSTANCE to FALSE; - building = 0; - // Halt spinner spin - stop-spin spinner around y-axis decelerate <30>; - // Try to close the yard - set YARD_OPEN to FALSE; - // If yard not closed, tell units around to bugger off until yard is closed - while( get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to FALSE; - } - set BUGGER_OFF to FALSE; - // Now yard is closed. - // Close animation: - turn door2 to z-axis <0> speed <10>; - turn door1 to z-axis <0> speed <10>; - wait-for-turn door2 around z-axis; - wait-for-turn door1 around z-axis; - move elevator to y-axis [0] speed [5]; - wait-for-move elevator along y-axis; -} - -StartBuilding() -{ - signal SIG_BUILDING; // Kill any other StartBuilding - set-signal-mask SIG_BUILDING; // Be killable -} - -StopBuilding() -{ - signal SIG_BUILDING; // Kill StartBuilding -} - -QueryBuildInfo(piecenum) -{ - piecenum = nanopoint; -} - -TechLost() -{ - signal SIG_TECH; - set-signal-mask SIG_TECH; - Aztec=FALSE; - set INBUILDSTANCE to FALSE;// Cut the nano - start-script Activate();// Just so it can resume once TechGranted again - while(TRUE) - { - - explode nanopoint type FALL | SMOKE; - sleep 200; - } -} - -TechGranted() -{ - signal SIG_TECH;// Kill TechLost - Aztec=TRUE; -} - -buildingfx() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nano1; - emit-sfx nanoflame from nano2; - } - sleep 600; - } -} - -buildingfx2() -{ - while( TRUE ) - { - if (building) - { - emit-sfx 1025 from nanopoint; - } - sleep 300; - } -} - -Create() -{ - Aztec = TRUE; - spray = nanopoint; - while(get BUILD_PERCENT_LEFT) - { - sleep 400; - } - start-script SmokeUnit(); - start-script buildingfx(); - start-script buildingfx2(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray != 0 ) - { - piecenum = nano2; - } - spray = !spray; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode door1 type EXPLODE_ON_HIT; - explode door2 type EXPLODE_ON_HIT; - explode elevator type EXPLODE_ON_HIT; - explode spinner type EXPLODE_ON_HIT; - explode backbone type EXPLODE_ON_HIT; - explode bottombackbone type EXPLODE_ON_HIT; -} diff --git a/Scripts/eairplant.cob b/Scripts/eairplant.cob deleted file mode 100644 index 167c3183b..000000000 Binary files a/Scripts/eairplant.cob and /dev/null differ diff --git a/Scripts/eallterraa.bos b/Scripts/eallterraa.bos deleted file mode 100644 index e8b0650c7..000000000 --- a/Scripts/eallterraa.bos +++ /dev/null @@ -1,330 +0,0 @@ - -// One ninth of the full cycle duration, in millisecond -// The larger this value the slower the walk animation -#define WALK_PERIOD 50 - - -piece base,turret,barrel1,firepoint1, - rf1,rf2,lf1,lf2,rr1,rr2,lr1,lr2,rfdirt,rrdirt,lfdirt,lrdirt; - #define barrel barrel1 - -#include "ROCKUNIT.H" - -static-var maxreloadtime,moving; - -#define SIG_AIM1 2 -#define SIG_FIRE1 4 -#define SIG_MOVE 8 -#include "exptype.h" -#include "sfxtype.h" -#define SMOKEPIECE1 base -#include "SmokeUnit.h" - - - -#define FRONT_RIGHT_DOWN\ - turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDA\ - turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDB\ - turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_BACK\ - turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_UP\ - turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_FRONT\ - turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); - - - -#define FRONT_LEFT_DOWN\ - turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_MIDA\ - turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_LEFT_MIDB\ - turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_LEFT_BACK\ - turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_LEFT_UP\ - turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_FRONT\ - turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_RIGHT_DOWN\ - turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_MIDA\ - turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); - -#define REAR_RIGHT_MIDB\ - turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); - -#define REAR_RIGHT_BACK\ - turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); - -#define REAR_RIGHT_UP\ - turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_FRONT\ - turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_LEFT_DOWN\ - turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_LEFT_MIDA\ - turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); - -#define REAR_LEFT_MIDB\ - turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); - -#define REAR_LEFT_BACK\ - turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); - -#define REAR_LEFT_UP\ - turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_LEFT_FRONT\ - turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define WAIT_WALK\ - sleep WALK_PERIOD;\ - while(!moving)\ - {\ - sleep 111;\ - } - - - -DoTheWalking() -{ - while(TRUE) - { - WAIT_WALK//1 - FRONT_RIGHT_DOWN - emit-sfx 1025 + 0 from rfdirt; - FRONT_LEFT_BACK - REAR_RIGHT_BACK - REAR_LEFT_MIDA - WAIT_WALK//2 - FRONT_RIGHT_MIDA - WAIT_WALK//3 - FRONT_LEFT_UP - REAR_RIGHT_UP - REAR_LEFT_MIDB - WAIT_WALK//4 - FRONT_RIGHT_MIDB - FRONT_LEFT_FRONT - REAR_RIGHT_FRONT - WAIT_WALK//5 - FRONT_LEFT_DOWN - emit-sfx 1025 + 0 from lfdirt; - REAR_RIGHT_DOWN - emit-sfx 1025 + 0 from rrdirt; - REAR_LEFT_BACK - WAIT_WALK//6 - FRONT_RIGHT_BACK - FRONT_LEFT_MIDA - REAR_RIGHT_MIDA - WAIT_WALK//7 - REAR_LEFT_UP - WAIT_WALK//8 - FRONT_RIGHT_UP - FRONT_LEFT_MIDB - REAR_RIGHT_MIDB - REAR_LEFT_FRONT - WAIT_WALK//9 - FRONT_RIGHT_FRONT - REAR_LEFT_DOWN - emit-sfx 1025 + 0 from lrdirt; - } -} - -StartMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=TRUE; -} - -StopMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=FALSE; - - sleep 4*(WALK_PERIOD); - - turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around z-axis; - wait-for-turn rf2 around z-axis; - turn rf1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around y-axis; - turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around z-axis; - wait-for-turn lf2 around z-axis; - turn lf1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around y-axis; - turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around z-axis; - wait-for-turn rr2 around z-axis; - turn rr1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around y-axis; - turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around z-axis; - wait-for-turn lr2 around z-axis; - turn lr1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around y-axis; - turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); -} - - -Create() -{ - turn rf1 to y-axis <30> now; - turn lf1 to y-axis <-30> now; - turn rr1 to y-axis <-30> now; - turn lr1 to y-axis <30> now; - maxreloadtime=500; - moving=FALSE; - while(get BUILD_PERCENT_LEFT) - { - sleep 250; - } - start-script SmokeUnit(); - start-script DoTheWalking(); -// start-script Thrust(); -} - -SetMaxReloadTime(t) -{ - maxreloadtime=t; -} - -RestoreAfterDelay() -{ - sleep maxreloadtime*3/2; - turn turret to y-axis 0 speed <60>; - turn barrel1 to x-axis 0 speed <30>; - wait-for-turn turret around y-axis; - wait-for-turn barrel1 around x-axis; -} - -AimFromPrimary(p) -{ - p=turret; -} - -AimPrimary(heading,pitch) -{ - signal SIG_AIM1; - set-signal-mask SIG_AIM1; - turn turret to y-axis heading speed <5000>; - turn barrel1 to x-axis 0 - pitch speed <5000>; - wait-for-turn turret around y-axis; - wait-for-turn barrel1 around x-axis; - start-script RestoreAfterDelay(); - return(1); -} - -QueryPrimary(firefrom) -{ - firefrom=firepoint1; -} - -FirePrimary() -{ - signal SIG_FIRE1; - set-signal-mask SIG_FIRE1; - emit-sfx 1024 from firepoint1; -// move barrel to z-axis [-10] now; -// move barrel to z-axis [0] speed [4]; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode rf1 type EXPLODE_ON_HIT; - explode rf2 type EXPLODE_ON_HIT; - explode lf1 type EXPLODE_ON_HIT; - explode lf2 type EXPLODE_ON_HIT; - explode rr1 type EXPLODE_ON_HIT; - explode rr2 type EXPLODE_ON_HIT; - explode lr1 type EXPLODE_ON_HIT; - explode lr2 type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eallterraa.cob b/Scripts/eallterraa.cob deleted file mode 100644 index c0f541dd5..000000000 Binary files a/Scripts/eallterraa.cob and /dev/null differ diff --git a/Scripts/eallterranarchid.bos b/Scripts/eallterranarchid.bos index 96168476a..c5046c778 100644 --- a/Scripts/eallterranarchid.bos +++ b/Scripts/eallterranarchid.bos @@ -302,8 +302,8 @@ AimPrimary(heading,pitch) { signal SIG_AIM1; set-signal-mask SIG_AIM1; - turn turret1 to y-axis heading speed <255>; - turn barrel1 to x-axis 0 - pitch speed <150>; + turn turret1 to y-axis heading now; + turn barrel1 to x-axis 0 - pitch now; wait-for-turn turret1 around y-axis; wait-for-turn barrel1 around x-axis; start-script RestoreAfterDelay(); @@ -333,8 +333,8 @@ AimSecondary(heading,pitch) { signal SIG_AIM2; set-signal-mask SIG_AIM2; - turn turret2 to y-axis heading speed <255>; - turn barrel2 to x-axis 0 - pitch speed <150>; + turn turret2 to y-axis heading now; + turn barrel2 to x-axis 0 - pitch now; wait-for-turn turret2 around y-axis; wait-for-turn barrel2 around x-axis; // start-script RestoreAfterDelay(); @@ -372,8 +372,8 @@ AimTertiary(heading,pitch) { signal SIG_AIM3; set-signal-mask SIG_AIM3; - turn turret3 to y-axis heading speed <255>; - turn barrel3 to x-axis 0 - pitch speed <150>; + turn turret3 to y-axis heading now; + turn barrel3 to x-axis 0 - pitch now; wait-for-turn turret3 around y-axis; wait-for-turn barrel3 around x-axis; // start-script RestoreAfterDelay(); diff --git a/Scripts/eallterranarchid.cob b/Scripts/eallterranarchid.cob index 3279965e3..374ee0862 100644 Binary files a/Scripts/eallterranarchid.cob and b/Scripts/eallterranarchid.cob differ diff --git a/Scripts/eallterrengineer.bos b/Scripts/eallterrengineer.bos deleted file mode 100644 index 6ce8b4e29..000000000 --- a/Scripts/eallterrengineer.bos +++ /dev/null @@ -1,382 +0,0 @@ - -// One ninth of the full cycle duration, in millisecond -// The larger this value the slower the walk animation -#define WALK_PERIOD 50 - - -piece base, nanopoint1, penis, wheel, doorleft, doorright, dirt, rf1, rf2, lf1, lf2, rr1, rr2, lr1, lr2, rfdirt, rrdirt, lfdirt, lrdirt; - -static-var maxreloadtime, moving, bMoving, terraintype, building; - -#define SIG_AIM1 2 -#define SIG_FIRE1 4 -#define SIG_MOVE 8 -#define SMOKEPIECE1 base -#include "springdefs.h" -#define SIG_BUILD 16 -#define nanoflame 1024+0 - - -#define FRONT_RIGHT_DOWN\ - turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDA\ - turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDB\ - turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_BACK\ - turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_UP\ - turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_FRONT\ - turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); - - - -#define FRONT_LEFT_DOWN\ - turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_MIDA\ - turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_LEFT_MIDB\ - turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_LEFT_BACK\ - turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_LEFT_UP\ - turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_FRONT\ - turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_RIGHT_DOWN\ - turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_MIDA\ - turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); - -#define REAR_RIGHT_MIDB\ - turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); - -#define REAR_RIGHT_BACK\ - turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); - -#define REAR_RIGHT_UP\ - turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_FRONT\ - turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_LEFT_DOWN\ - turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_LEFT_MIDA\ - turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); - -#define REAR_LEFT_MIDB\ - turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); - -#define REAR_LEFT_BACK\ - turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); - -#define REAR_LEFT_UP\ - turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_LEFT_FRONT\ - turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define WAIT_WALK\ - sleep WALK_PERIOD;\ - while(!moving)\ - {\ - sleep 111;\ - } - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -DoTheWalking() -{ - while(TRUE) - { - WAIT_WALK//1 - FRONT_RIGHT_DOWN - emit-sfx 1025 + 0 from rfdirt; - FRONT_LEFT_BACK - REAR_RIGHT_BACK - REAR_LEFT_MIDA - WAIT_WALK//2 - FRONT_RIGHT_MIDA - WAIT_WALK//3 - FRONT_LEFT_UP - REAR_RIGHT_UP - REAR_LEFT_MIDB - WAIT_WALK//4 - FRONT_RIGHT_MIDB - FRONT_LEFT_FRONT - REAR_RIGHT_FRONT - WAIT_WALK//5 - FRONT_LEFT_DOWN - emit-sfx 1025 + 0 from lfdirt; - REAR_RIGHT_DOWN - emit-sfx 1025 + 0 from rrdirt; - REAR_LEFT_BACK - WAIT_WALK//6 - FRONT_RIGHT_BACK - FRONT_LEFT_MIDA - REAR_RIGHT_MIDA - WAIT_WALK//7 - REAR_LEFT_UP - WAIT_WALK//8 - FRONT_RIGHT_UP - FRONT_LEFT_MIDB - REAR_RIGHT_MIDB - REAR_LEFT_FRONT - WAIT_WALK//9 - FRONT_RIGHT_FRONT - REAR_LEFT_DOWN - emit-sfx 1025 + 0 from lrdirt; - } -} - -StartMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=TRUE; - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=FALSE; - - sleep 4*(WALK_PERIOD); - - turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around z-axis; - wait-for-turn rf2 around z-axis; - turn rf1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around y-axis; - turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around z-axis; - wait-for-turn lf2 around z-axis; - turn lf1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around y-axis; - turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around z-axis; - wait-for-turn rr2 around z-axis; - turn rr1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around y-axis; - turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around z-axis; - wait-for-turn lr2 around z-axis; - turn lr1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around y-axis; - turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ - turn rf1 to y-axis <30> now; - turn lf1 to y-axis <-30> now; - turn rr1 to y-axis <-30> now; - turn lr1 to y-axis <30> now; - maxreloadtime=500; - moving=FALSE; - while(get BUILD_PERCENT_LEFT) - { - sleep 250; - } - start-script SmokeUnit(); - start-script DoTheWalking(); -// start-script Thrust(); - start-script buildflame(); -} - -QueryWeapon1(piecenum) -{ - piecenum=nanopoint1; -} - -AimFromWeapon1(piecenum) -{ - piecenum=penis; -} - -AimWeapon1(h,p) -{ - return 0; -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - turn doorleft to y-axis <90> speed <100.000000>; - turn doorright to y-axis <-90> speed <100.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; - move penis to z-axis [4] speed [1]; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - move penis to z-axis [0] speed [2]; - turn doorleft to y-axis <0> speed <50.000000>; - turn doorright to y-axis <0> speed <50.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; - -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode rf1 type EXPLODE_ON_HIT; - explode rf2 type EXPLODE_ON_HIT; - explode lf1 type EXPLODE_ON_HIT; - explode lf2 type EXPLODE_ON_HIT; - explode rr1 type EXPLODE_ON_HIT; - explode rr2 type EXPLODE_ON_HIT; - explode lr1 type EXPLODE_ON_HIT; - explode lr2 type EXPLODE_ON_HIT; - explode penis type EXPLODE_ON_HIT; - explode wheel type EXPLODE_ON_HIT; - explode doorleft type EXPLODE_ON_HIT; - explode doorright type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eallterrengineer.cob b/Scripts/eallterrengineer.cob deleted file mode 100644 index 3af8c133e..000000000 Binary files a/Scripts/eallterrengineer.cob and /dev/null differ diff --git a/Scripts/eallterrengineer1.bos b/Scripts/eallterrengineer1.bos deleted file mode 100644 index 29fe8d6dc..000000000 --- a/Scripts/eallterrengineer1.bos +++ /dev/null @@ -1,338 +0,0 @@ - -// One ninth of the full cycle duration, in millisecond -// The larger this value the slower the walk animation -#define WALK_PERIOD 50 - - -piece base, nanopoint1, penis, rf1, rf2, lf1, lf2, rr1, rr2, lr1, lr2, rfdirt, rrdirt, lfdirt, lrdirt; - -static-var maxreloadtime, moving, bMoving, terraintype, building; - -#define SIG_BUILD 2 -#define SIG_MOVE 4 -#define SMOKEPIECE1 base -#include "springdefs.h" -#define nanoflame 1024+0 - - -#define FRONT_RIGHT_DOWN\ - turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDA\ - turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDB\ - turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_BACK\ - turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_UP\ - turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_FRONT\ - turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); - - - -#define FRONT_LEFT_DOWN\ - turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_MIDA\ - turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_LEFT_MIDB\ - turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_LEFT_BACK\ - turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_LEFT_UP\ - turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_FRONT\ - turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_RIGHT_DOWN\ - turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_MIDA\ - turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); - -#define REAR_RIGHT_MIDB\ - turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); - -#define REAR_RIGHT_BACK\ - turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); - -#define REAR_RIGHT_UP\ - turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_FRONT\ - turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_LEFT_DOWN\ - turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_LEFT_MIDA\ - turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); - -#define REAR_LEFT_MIDB\ - turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); - -#define REAR_LEFT_BACK\ - turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); - -#define REAR_LEFT_UP\ - turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_LEFT_FRONT\ - turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define WAIT_WALK\ - sleep WALK_PERIOD;\ - while(!moving)\ - {\ - sleep 111;\ - } - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -DoTheWalking() -{ - while(TRUE) - { - WAIT_WALK//1 - FRONT_RIGHT_DOWN - emit-sfx 1025 + 0 from rfdirt; - FRONT_LEFT_BACK - REAR_RIGHT_BACK - REAR_LEFT_MIDA - WAIT_WALK//2 - FRONT_RIGHT_MIDA - WAIT_WALK//3 - FRONT_LEFT_UP - REAR_RIGHT_UP - REAR_LEFT_MIDB - WAIT_WALK//4 - FRONT_RIGHT_MIDB - FRONT_LEFT_FRONT - REAR_RIGHT_FRONT - WAIT_WALK//5 - FRONT_LEFT_DOWN - emit-sfx 1025 + 0 from lfdirt; - REAR_RIGHT_DOWN - emit-sfx 1025 + 0 from rrdirt; - REAR_LEFT_BACK - WAIT_WALK//6 - FRONT_RIGHT_BACK - FRONT_LEFT_MIDA - REAR_RIGHT_MIDA - WAIT_WALK//7 - REAR_LEFT_UP - WAIT_WALK//8 - FRONT_RIGHT_UP - FRONT_LEFT_MIDB - REAR_RIGHT_MIDB - REAR_LEFT_FRONT - WAIT_WALK//9 - FRONT_RIGHT_FRONT - REAR_LEFT_DOWN - emit-sfx 1025 + 0 from lrdirt; - } -} - -StartMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=TRUE; - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=FALSE; - - sleep 4*(WALK_PERIOD); - - turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around z-axis; - wait-for-turn rf2 around z-axis; - turn rf1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around y-axis; - turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around z-axis; - wait-for-turn lf2 around z-axis; - turn lf1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around y-axis; - turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around z-axis; - wait-for-turn rr2 around z-axis; - turn rr1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around y-axis; - turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around z-axis; - wait-for-turn lr2 around z-axis; - turn lr1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around y-axis; - turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ - turn rf1 to y-axis <30> now; - turn lf1 to y-axis <-30> now; - turn rr1 to y-axis <-30> now; - turn lr1 to y-axis <30> now; - maxreloadtime=500; - moving=FALSE; - while(get BUILD_PERCENT_LEFT) - { - sleep 250; - } - start-script SmokeUnit(); - start-script DoTheWalking(); - start-script buildflame(); -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode rf1 type EXPLODE_ON_HIT; - explode rf2 type EXPLODE_ON_HIT; - explode lf1 type EXPLODE_ON_HIT; - explode lf2 type EXPLODE_ON_HIT; - explode rr1 type EXPLODE_ON_HIT; - explode rr2 type EXPLODE_ON_HIT; - explode lr1 type EXPLODE_ON_HIT; - explode lr2 type EXPLODE_ON_HIT; - explode penis type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eallterrengineer1.cob b/Scripts/eallterrengineer1.cob deleted file mode 100644 index a2064dfaa..000000000 Binary files a/Scripts/eallterrengineer1.cob and /dev/null differ diff --git a/Scripts/eallterrfac.bos b/Scripts/eallterrfac.bos deleted file mode 100644 index ecb0fdcd7..000000000 --- a/Scripts/eallterrfac.bos +++ /dev/null @@ -1,241 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, rightgenerator, leftgenerator, nanospin1, nanospin2, nanospin3, nanospin4, nanopoint1, nano1, nano2, nano3, nano4, sfxpoint1, sfxpoint2, frontleftsupport, frontrightsupport, rearleftsupport, rearrightsupport, pipesleft, pipesright; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building, terraintype; - -// Signal definitions -#define SIG_ACTIVATE 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -buildingfx() -{ - while( TRUE ) - { - if (building) - { - emit-sfx 1024 from nano1; - sleep 60; - emit-sfx 1024 from nano4; - sleep 60; - emit-sfx 1024 from nano3; - sleep 60; - emit-sfx 1024 from nano2; - sleep 60; - } - sleep 600; - } -} - -buildingfx2() -{ - while( TRUE ) - { - if (building) - { - emit-sfx 1025 from nanopoint1; - } - sleep 300; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1027 from sfxpoint1; - emit-sfx 1027 from sfxpoint2; -// } - sleep 500; - } -} - -OpenYard() -{ - set YARD_OPEN to 1; - while( !get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 1; - } - set BUGGER_OFF to 0; -} - -CloseYard() -{ - set YARD_OPEN to 0; - while( get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 0; - } - set BUGGER_OFF to 0; -} - -Go() -{ - call-script OpenYard(); - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - call-script CloseYard(); - -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - unitviewer = FALSE; - spray = 0; - call-script InitState(); - start-script SmokeUnit(); - start-script Buildingfx(); -// start-script Buildingfx2(); - start-script fx(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray == 1 ) - { - piecenum = nano2; - } - if( spray == 2 ) - { - piecenum = nano3; - } - if( spray == 3 ) - { - piecenum = nano4; - } - ++spray; - if( spray >= 4 ) - { - spray = 0; - } -} - - -Activate() -{ - signal SIG_ACTIVATE; - start-script RequestState(0); -} - -Deactivate() -{ - signal SIG_ACTIVATE; - set-signal-mask SIG_ACTIVATE; - - set-signal-mask 0; - start-script RequestState(1); -} - -StartBuilding() -{ -building = 1; -} - -StopBuilding() -{ -building = 0; -} - -QueryBuildInfo(piecenum) -{ - piecenum = nanopoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode nanospin1 type EXPLODE_ON_HIT; - explode nanospin2 type EXPLODE_ON_HIT; - explode nanospin3 type EXPLODE_ON_HIT; - explode nanospin4 type EXPLODE_ON_HIT; - explode frontleftsupport type EXPLODE_ON_HIT; - explode frontrightsupport type EXPLODE_ON_HIT; - explode rearleftsupport type EXPLODE_ON_HIT; - explode rearrightsupport type EXPLODE_ON_HIT; - explode rightgenerator type EXPLODE_ON_HIT; - explode leftgenerator type EXPLODE_ON_HIT; - -} diff --git a/Scripts/eallterrfac.cob b/Scripts/eallterrfac.cob deleted file mode 100644 index e7198bb38..000000000 Binary files a/Scripts/eallterrfac.cob and /dev/null differ diff --git a/Scripts/eamphibarty.bos b/Scripts/eamphibarty.bos deleted file mode 100644 index 14d96f2bd..000000000 --- a/Scripts/eamphibarty.bos +++ /dev/null @@ -1,165 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt, frontwheels, rearwheels; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var terraintype, bmoving, moving, underwater; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -/* - if ( get IN_WATER(0) == 1 ) - { - return (0); - } -*/ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ - - if ( get IN_WATER(0) == 0 ) - { - return (0); - } - -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibarty.cob b/Scripts/eamphibarty.cob deleted file mode 100644 index cf0a8247f..000000000 Binary files a/Scripts/eamphibarty.cob and /dev/null differ diff --git a/Scripts/eamphibdrone.bos b/Scripts/eamphibdrone.bos deleted file mode 100644 index 4d3dc371d..000000000 --- a/Scripts/eamphibdrone.bos +++ /dev/null @@ -1,146 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt, frontwheels, rearwheels; // these are the pieces of the model - -static-var terraintype, bmoving, moving, underwater; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eamphibdrone.cob b/Scripts/eamphibdrone.cob deleted file mode 100644 index 3fbf40706..000000000 Binary files a/Scripts/eamphibdrone.cob and /dev/null differ diff --git a/Scripts/eamphibengineer.bos b/Scripts/eamphibengineer.bos deleted file mode 100644 index 3db9b5391..000000000 --- a/Scripts/eamphibengineer.bos +++ /dev/null @@ -1,207 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, arm, spinwheels, frontwheels, rearwheels, nano1, dirt; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building, moving, underwater; - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - turn arm to x-axis <-90> speed <50>; - wait-for-turn base around y-axis; - wait-for-turn arm around x-axis; - spin spinwheels around x-axis speed <50.005495>; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn arm to x-axis <0> speed <50>; - stop-spin spinwheels around z-axis decelerate <2.000000>; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - underwater=1; - } - else - { - underwater=0; - } - if(terraintype == 4) - { - underwater=0; - } - else - { - underwater=1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nano1; - - } - sleep 600; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script Thrust(); - start-script SmokeUnit(); - turn nano1 to x-axis <90.000000> now; - start-script buildflame(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - piecenum = nano1; -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode arm type EXPLODE_ON_HIT; - explode spinwheels type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibengineer.cob b/Scripts/eamphibengineer.cob deleted file mode 100644 index 0b8fbc383..000000000 Binary files a/Scripts/eamphibengineer.cob and /dev/null differ diff --git a/Scripts/eamphibengineer2.bos b/Scripts/eamphibengineer2.bos deleted file mode 100644 index 4960c62ee..000000000 --- a/Scripts/eamphibengineer2.bos +++ /dev/null @@ -1,202 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, frontwheels, rearwheels, nanopoint1, dirt, penis; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building, moving, underwater; - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin penis around y-axis speed <50.005495>; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - stop-spin penis around y-axis decelerate <15.000000>; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - underwater=1; - } - else - { - underwater=0; - } - if(terraintype == 4) - { - underwater=0; - } - else - { - underwater=1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script Thrust(); - start-script SmokeUnit(); - start-script buildflame(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - piecenum = nanopoint1; -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode penis type EXPLODE_ON_HIT; - explode base type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibengineer2.cob b/Scripts/eamphibengineer2.cob deleted file mode 100644 index 2a850221b..000000000 Binary files a/Scripts/eamphibengineer2.cob and /dev/null differ diff --git a/Scripts/eamphibfac.bos b/Scripts/eamphibfac.bos deleted file mode 100644 index ce5afb951..000000000 --- a/Scripts/eamphibfac.bos +++ /dev/null @@ -1,204 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, door, spike, wheels, nanopoint, nano1; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building; - -// Signal definitions -#define SIG_ACTIVATE 2 - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -buildingfx() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nano1; - } - sleep 600; - } -} - -buildingfx2() -{ - while( TRUE ) - { - if (building) - { - emit-sfx 1025 from nanopoint; - } - sleep 300; - } -} - -OpenYard() -{ - spin wheels around z-axis speed <50.005495>; - move spike to y-axis [20] speed [5]; - turn door to x-axis <-90> speed <50>; - wait-for-move spike along y-axis; - wait-for-turn door around x-axis; - set YARD_OPEN to 1; - while( !get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 1; - } - set BUGGER_OFF to 0; -} - -CloseYard() -{ - stop-spin wheels around z-axis decelerate <2.000000>; - move spike to y-axis [0] speed [5]; - turn door to x-axis <0> speed <50>; - set YARD_OPEN to 0; - while( get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 0; - } - set BUGGER_OFF to 0; -} - -Go() -{ - call-script OpenYard(); - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - call-script CloseYard(); - -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - unitviewer = FALSE; - spray = nanopoint; - call-script InitState(); - start-script SmokeUnit(); - start-script Buildingfx(); - start-script Buildingfx2(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray != 0 ) - { - piecenum = nano1; - } - spray = !spray; -} - - -Activate() -{ - signal SIG_ACTIVATE; - start-script RequestState(0); -} - -Deactivate() -{ - signal SIG_ACTIVATE; - set-signal-mask SIG_ACTIVATE; - - set-signal-mask 0; - start-script RequestState(1); -} - -StartBuilding() -{ -building = 1; -} - -StopBuilding() -{ -building = 0; -} - -QueryBuildInfo(piecenum) -{ - piecenum = nanopoint; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode door type EXPLODE_ON_HIT; - explode spike type EXPLODE_ON_HIT; - explode wheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibfac.cob b/Scripts/eamphibfac.cob deleted file mode 100644 index aec580506..000000000 Binary files a/Scripts/eamphibfac.cob and /dev/null differ diff --git a/Scripts/eamphibrock.bos b/Scripts/eamphibrock.bos deleted file mode 100644 index df98b7d9f..000000000 --- a/Scripts/eamphibrock.bos +++ /dev/null @@ -1,168 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, sleeve, barrel1, firepoint1, dirt, frontwheels, middlewheels, rearwheels; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var terraintype, bmoving, moving, underwater; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1025 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin middlewheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin middlewheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn sleeve to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -/* - if ( get IN_WATER(0) == 1 ) - { - return (0); - } -*/ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn sleeve to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn sleeve around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -// emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = sleeve; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ - - if ( get IN_WATER(0) == 0 ) - { - return (0); - } - -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <500>; -turn sleeve to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn sleeve around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -// emit-sfx shot from firepoint1; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = sleeve; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; - explode middlewheels type EXPLODE_ON_HIT; - explode sleeve type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibrock.cob b/Scripts/eamphibrock.cob deleted file mode 100644 index 02d20ca21..000000000 Binary files a/Scripts/eamphibrock.cob and /dev/null differ diff --git a/Scripts/eamphibrock2.bos b/Scripts/eamphibrock2.bos deleted file mode 100644 index df1f0b217..000000000 --- a/Scripts/eamphibrock2.bos +++ /dev/null @@ -1,167 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt, frontwheels, middlewheels, rearwheels; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var terraintype, bmoving, moving, underwater; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1025 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - spin frontwheels around x-axis speed <500.005495>; - spin middlewheels around x-axis speed <500.005495>; - spin rearwheels around x-axis speed <500.005495>; - - } - else - { - stop-spin frontwheels around x-axis decelerate <200.000000>; - stop-spin middlewheels around x-axis decelerate <200.000000>; - stop-spin rearwheels around x-axis decelerate <200.000000>; - } - sleep 400; - } -} -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -/* - if ( get IN_WATER(0) == 1 ) - { - return (0); - } -*/ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -// emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ - - if ( get IN_WATER(0) == 0 ) - { - return (0); - } - -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0> - pitch speed <300>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -// emit-sfx shot from firepoint1; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; - explode middlewheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eamphibrock2.cob b/Scripts/eamphibrock2.cob deleted file mode 100644 index 67bf77532..000000000 Binary files a/Scripts/eamphibrock2.cob and /dev/null differ diff --git a/Scripts/eannihilator.cob b/Scripts/eannihilator.cob deleted file mode 100644 index d17d62cd4..000000000 Binary files a/Scripts/eannihilator.cob and /dev/null differ diff --git a/Scripts/eantiairtower.bos b/Scripts/eantiairtower.bos deleted file mode 100644 index 7aeebf479..000000000 --- a/Scripts/eantiairtower.bos +++ /dev/null @@ -1,128 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint; // these are the pieces of the model - -static-var gun_1; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -sleep 75; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eantiairtower.cob b/Scripts/eantiairtower.cob deleted file mode 100644 index 4355a3867..000000000 Binary files a/Scripts/eantiairtower.cob and /dev/null differ diff --git a/Scripts/eantiairtower2.bos b/Scripts/eantiairtower2.bos deleted file mode 100644 index 058a85cdb..000000000 --- a/Scripts/eantiairtower2.bos +++ /dev/null @@ -1,217 +0,0 @@ -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - -static-var firing; // these are the variables - -#define ELECTRICITY 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 -#define SIG_AIM_8 16 -#define SIG_AIM_16 32 -#define SIG_AIM_32 64 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -LightningThing() -{ -while (1) -{ -emit-sfx ELECTRICITY from firepoint1; -sleep 500; -} -} - -Create() // tells it what to do on creation -{ -start-script LightningThing(); -start-script SmokeUnit(); -} - - -AimWeapon1(heading, pitch) -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() -{ -} - -AimFromWeapon2(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon2(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon3(heading, pitch) -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon3() -{ -} - -AimFromWeapon3(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon3(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon4(heading, pitch) -{ -signal SIG_AIM_8; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon4() -{ -} - -AimFromWeapon4(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon4(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon5(heading, pitch) -{ -signal SIG_AIM_16; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon5() -{ -} - -AimFromWeapon5(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon5(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon6(heading, pitch) -{ -signal SIG_AIM_32; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon6() -{ -} - -AimFromWeapon6(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon6(piecenum) -{ -piecenum = firepoint1; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} \ No newline at end of file diff --git a/Scripts/eantiairtower2.cob b/Scripts/eantiairtower2.cob deleted file mode 100644 index b5413f42d..000000000 Binary files a/Scripts/eantiairtower2.cob and /dev/null differ diff --git a/Scripts/eantinukeai.bos b/Scripts/eantinukeai.bos deleted file mode 100644 index 2bfadf721..000000000 --- a/Scripts/eantinukeai.bos +++ /dev/null @@ -1,150 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, ring; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1024 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2050 from firepoint1; - sleep 30; - } -} - - -Create() // tells it what to do on creation -{ - start-script SmokeUnit(); -// start-script fx(); - - spin ring around y-axis speed <150.005495>; -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <-90> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = base; -} - -/* -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx 2049 from firepoint1; -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} -*/ - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode turret type EXPLODE_ON_HIT; - explode barrel1 type EXPLODE_ON_HIT; - explode ring type EXPLODE_ON_HIT; -} diff --git a/Scripts/eantinukeai.cob b/Scripts/eantinukeai.cob deleted file mode 100644 index 422cbeded..000000000 Binary files a/Scripts/eantinukeai.cob and /dev/null differ diff --git a/Scripts/eartillarytank.cob b/Scripts/eartillarytank.cob deleted file mode 100644 index e0f2c5bd3..000000000 Binary files a/Scripts/eartillarytank.cob and /dev/null differ diff --git a/Scripts/eartytank.bos b/Scripts/eartytank.bos deleted file mode 100644 index babbd1d62..000000000 --- a/Scripts/eartytank.bos +++ /dev/null @@ -1,157 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, sleeve, barrel1, firepoint1, dirt; - -#include "ROCKUNIT.H" - -static-var Static_Var_1, Static_Var_2, Static_Var_3, bMoving, moving; - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( Static_Var_3 ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - - -setSFXoccupy(Func_Var_1) -{ - Static_Var_2 = Func_Var_1; - if( Static_Var_2 == 2 ) - { - move base to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } - else - { - move base to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - if( Static_Var_2 == 4 ) - { - move base to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - else - { - move base to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } -} - -Create() -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn turret to y-axis <0.000000> speed <60.000000>; - turn sleeve to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn sleeve to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn sleeve around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() -{ - - emit-sfx 1024 + 0 from firepoint1; - move barrel1 to z-axis [-5.000000] speed [500.000000]; - sleep 75; - move barrel1 to z-axis [0.000000] speed [1.000000]; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/eartytank.cob b/Scripts/eartytank.cob deleted file mode 100644 index 42d8fdbef..000000000 Binary files a/Scripts/eartytank.cob and /dev/null differ diff --git a/Scripts/ebarricade.bos b/Scripts/ebarricade.bos deleted file mode 100644 index fa56f47db..000000000 --- a/Scripts/ebarricade.bos +++ /dev/null @@ -1,18 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, rotator; // these are the pieces of the model - - -Create() // tells it what to do on creation -{ - spin rotator around y-axis speed <20.005495>; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode rotator type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/ebarricade.cob b/Scripts/ebarricade.cob deleted file mode 100644 index ffc12ebab..000000000 Binary files a/Scripts/ebarricade.cob and /dev/null differ diff --git a/Scripts/ebarricade2.bos b/Scripts/ebarricade2.bos deleted file mode 100644 index e4ea4cbe4..000000000 --- a/Scripts/ebarricade2.bos +++ /dev/null @@ -1,74 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, ball, bottomring, topring, middlering; // these are the pieces of the model - -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1024 from ball; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ - spin ball around y-axis speed <20.005495>; - spin ball around z-axis speed <30.005495>; - spin middlering around y-axis speed <-20.005495>; - spin topring around y-axis speed <40.005495>; - spin bottomring around y-axis speed <30.005495>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = ball; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = ball; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode ball type EXPLODE_ON_HIT; - explode topring type EXPLODE_ON_HIT; - explode middlering type EXPLODE_ON_HIT; - explode bottomring type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/ebarricade2.cob b/Scripts/ebarricade2.cob deleted file mode 100644 index c8e056753..000000000 Binary files a/Scripts/ebarricade2.cob and /dev/null differ diff --git a/Scripts/ebomb.bos b/Scripts/ebomb.bos deleted file mode 100644 index 78b29bc08..000000000 --- a/Scripts/ebomb.bos +++ /dev/null @@ -1,35 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, nose; - -Create() -{ -spin base around z-axis speed <300.005495>; -spin nose around z-axis speed <600.005495>; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode nose type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} diff --git a/Scripts/ebomb.cob b/Scripts/ebomb.cob deleted file mode 100644 index 4706465d3..000000000 Binary files a/Scripts/ebomb.cob and /dev/null differ diff --git a/Scripts/ebomb2.bos b/Scripts/ebomb2.bos deleted file mode 100644 index 00c445066..000000000 --- a/Scripts/ebomb2.bos +++ /dev/null @@ -1,114 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, forwarddome, reardome, rearleftwing, frontleftwing, frontrightwing, rearrightwing, dirt; - -static-var terraintype, bmoving, moving, shooting_num; - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from forwarddome; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode forwarddome type EXPLODE_ON_HIT; - explode reardome type EXPLODE_ON_HIT; - explode rearleftwing type EXPLODE_ON_HIT; - explode rearrightwing type EXPLODE_ON_HIT; - explode frontleftwing type EXPLODE_ON_HIT; - explode frontrightwing type EXPLODE_ON_HIT; -} diff --git a/Scripts/ebomb2.cob b/Scripts/ebomb2.cob deleted file mode 100644 index 5a21df285..000000000 Binary files a/Scripts/ebomb2.cob and /dev/null differ diff --git a/Scripts/ebomber.bos b/Scripts/ebomber.bos deleted file mode 100644 index 4a6ec92eb..000000000 --- a/Scripts/ebomber.bos +++ /dev/null @@ -1,102 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, engine; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 - -#define jethtrail 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from engine; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - - - -Create() - { -// start-script Thrust(); -// turn engine to y-axis <180> now; - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode engine type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/ebomber.cob b/Scripts/ebomber.cob deleted file mode 100644 index 51642a918..000000000 Binary files a/Scripts/ebomber.cob and /dev/null differ diff --git a/Scripts/ecentralprocessing.bos b/Scripts/ecentralprocessing.bos deleted file mode 100644 index de28c9837..000000000 --- a/Scripts/ecentralprocessing.bos +++ /dev/null @@ -1,202 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, sfx, firepoint1, shield1, shield2; - -static-var Static_Var_1, gun_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype; - -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from sfx; - sleep 500; - } -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - -QueryWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - - -Go() -{ - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -Create() -{ - call-script InitState(); - move firepoint1 to y-axis [5000.000000] now; - spin base around y-axis speed <15.005495>; - move base to y-axis [100.000000] now; - start-script fx(); - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = base; -} - -StartBuilding(Func_Var_1) -{ - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = sfx; - Static_Var_5 = 1; - return (0); - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/ecentralprocessing.cob b/Scripts/ecentralprocessing.cob deleted file mode 100644 index 4ab12a820..000000000 Binary files a/Scripts/ecentralprocessing.cob and /dev/null differ diff --git a/Scripts/ecommander.bos b/Scripts/ecommander.bos deleted file mode 100644 index 48ac98dca..000000000 --- a/Scripts/ecommander.bos +++ /dev/null @@ -1,397 +0,0 @@ - -// One ninth of the full cycle duration, in millisecond -// The larger this value the slower the walk animation -#define WALK_PERIOD 50 - - -piece base, nanopoint1, penis, door, rf1, rf2, lf1, lf2, rr1, rr2, lr1, lr2, rfdirt, rrdirt, lfdirt, lrdirt, firepoint1; - -static-var maxreloadtime, moving, bMoving, terraintype, building; - -#define SIG_AIM1 2 -#define SIG_FIRE1 4 -#define SIG_MOVE 8 -#define SMOKEPIECE1 base -#include "springdefs.h" -#define SIG_BUILD 16 -#define SIG_AIM_2 32 -#define nanoflame 1024+0 - - -#define FRONT_RIGHT_DOWN\ - turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDA\ - turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDB\ - turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_BACK\ - turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_UP\ - turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_FRONT\ - turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); - - - -#define FRONT_LEFT_DOWN\ - turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_MIDA\ - turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_LEFT_MIDB\ - turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_LEFT_BACK\ - turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_LEFT_UP\ - turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_FRONT\ - turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_RIGHT_DOWN\ - turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_MIDA\ - turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); - -#define REAR_RIGHT_MIDB\ - turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); - -#define REAR_RIGHT_BACK\ - turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); - -#define REAR_RIGHT_UP\ - turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_FRONT\ - turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_LEFT_DOWN\ - turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_LEFT_MIDA\ - turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); - -#define REAR_LEFT_MIDB\ - turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); - -#define REAR_LEFT_BACK\ - turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); - -#define REAR_LEFT_UP\ - turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_LEFT_FRONT\ - turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define WAIT_WALK\ - sleep WALK_PERIOD;\ - while(!moving)\ - {\ - sleep 111;\ - } - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -DoTheWalking() -{ - while(TRUE) - { - WAIT_WALK//1 - FRONT_RIGHT_DOWN - emit-sfx 1025 + 0 from rfdirt; - FRONT_LEFT_BACK - REAR_RIGHT_BACK - REAR_LEFT_MIDA - WAIT_WALK//2 - FRONT_RIGHT_MIDA - WAIT_WALK//3 - FRONT_LEFT_UP - REAR_RIGHT_UP - REAR_LEFT_MIDB - WAIT_WALK//4 - FRONT_RIGHT_MIDB - FRONT_LEFT_FRONT - REAR_RIGHT_FRONT - WAIT_WALK//5 - FRONT_LEFT_DOWN - emit-sfx 1025 + 0 from lfdirt; - REAR_RIGHT_DOWN - emit-sfx 1025 + 0 from rrdirt; - REAR_LEFT_BACK - WAIT_WALK//6 - FRONT_RIGHT_BACK - FRONT_LEFT_MIDA - REAR_RIGHT_MIDA - WAIT_WALK//7 - REAR_LEFT_UP - WAIT_WALK//8 - FRONT_RIGHT_UP - FRONT_LEFT_MIDB - REAR_RIGHT_MIDB - REAR_LEFT_FRONT - WAIT_WALK//9 - FRONT_RIGHT_FRONT - REAR_LEFT_DOWN - emit-sfx 1025 + 0 from lrdirt; - } -} - -StartMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=TRUE; - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=FALSE; - - sleep 4*(WALK_PERIOD); - - turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around z-axis; - wait-for-turn rf2 around z-axis; - turn rf1 to y-axis <25> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around y-axis; - turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around z-axis; - wait-for-turn lf2 around z-axis; - turn lf1 to y-axis <-25> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around y-axis; - turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around z-axis; - wait-for-turn rr2 around z-axis; - turn rr1 to y-axis <-25> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around y-axis; - turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around z-axis; - wait-for-turn lr2 around z-axis; - turn lr1 to y-axis <25> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around y-axis; - turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); -} - -/* -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} -*/ - - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - - -Create() -{ - move firepoint1 to y-axis [1000] now; - turn rf1 to y-axis <25> now; - turn lf1 to y-axis <-25> now; - turn rr1 to y-axis <-25> now; - turn lr1 to y-axis <25> now; - maxreloadtime=500; - moving=FALSE; - while(get BUILD_PERCENT_LEFT) - { - sleep 250; - } - start-script SmokeUnit(); - start-script DoTheWalking(); -// start-script Thrust(); - start-script buildflame(); -} - -AimFromPrimary(p) -{ - p=firepoint1; -} - -AimPrimary(heading,pitch) -{ - signal SIG_AIM1; - set-signal-mask SIG_AIM1; - return(1); -} - -QueryPrimary(firefrom) -{ - firefrom=firepoint1; -} - -FirePrimary() -{ - signal SIG_FIRE1; - set-signal-mask SIG_FIRE1; -} - -//EMP Weapon End - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - turn door to x-axis <90> speed <150.000000>; - wait-for-turn door around y-axis; - move penis to z-axis [2] speed [1]; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - move penis to z-axis [0] speed [2]; - turn door to x-axis <0> speed <100.000000>; - wait-for-turn door around y-axis; - -} - -QueryNanoPiece(piecenum) -{ - piecenum = nanopoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode penis type EXPLODE_ON_HIT; - explode door type EXPLODE_ON_HIT; - explode rf1 type EXPLODE_ON_HIT; - explode rf2 type EXPLODE_ON_HIT; - explode lf1 type EXPLODE_ON_HIT; - explode lf2 type EXPLODE_ON_HIT; - explode rr1 type EXPLODE_ON_HIT; - explode rr2 type EXPLODE_ON_HIT; - explode lr1 type EXPLODE_ON_HIT; - explode lr2 type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/ecommander.cob b/Scripts/ecommander.cob deleted file mode 100644 index 5d13c0355..000000000 Binary files a/Scripts/ecommander.cob and /dev/null differ diff --git a/Scripts/ecommander4-battle.bos b/Scripts/ecommander4-battle.bos index 0921263cb..4385cb4e5 100644 --- a/Scripts/ecommander4-battle.bos +++ b/Scripts/ecommander4-battle.bos @@ -331,33 +331,8 @@ turn turret2 to y-axis <0> speed <60>; turn barrel2 to x-axis <0> speed <30>; } -AimFromPrimary(p) -{ - p=firepoint1; -} - -AimPrimary(heading,pitch) -{ - signal SIG_AIM1; - set-signal-mask SIG_AIM1; - return(1); -} - -QueryPrimary(firefrom) -{ - firefrom=firepoint1; -} - -FirePrimary() -{ - signal SIG_FIRE1; - set-signal-mask SIG_FIRE1; -} - -//EMP Weapon End - -AimSecondary(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +AimPrimary(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming { signal SIG_AIM_2; set-signal-mask SIG_AIM_2; @@ -369,17 +344,17 @@ start-script RestoreAfterDelay(); return (1); } -FireSecondary() // what do while firing, fires 1 barrel then the next , and resets +FirePrimary() // what do while firing, fires 1 barrel then the next , and resets { emit-sfx 1027 + 0 from firepoint2; } -AimFromSecondary(piecenum) // where it aims the weapon from +AimFromPrimary(piecenum) // where it aims the weapon from { piecenum = barrel2; } -QuerySecondary(piecenum) // where the shot is called from +QueryPrimary(piecenum) // where the shot is called from { piecenum = firepoint2; } diff --git a/Scripts/ecommander4-battle.cob b/Scripts/ecommander4-battle.cob index 56c778c15..234808d4a 100644 Binary files a/Scripts/ecommander4-battle.cob and b/Scripts/ecommander4-battle.cob differ diff --git a/Scripts/ecommander4-meteor.bos b/Scripts/ecommander4-meteor.bos new file mode 100644 index 000000000..892b8b60f --- /dev/null +++ b/Scripts/ecommander4-meteor.bos @@ -0,0 +1,398 @@ + +// One ninth of the full cycle duration, in millisecond +// The larger this value the slower the walk animation +#define WALK_PERIOD 50 + + +piece base, nanopoint1, rf1, rf2, lf1, lf2, rr1, rr2, lr1, lr2, rfdirt, rrdirt, lfdirt, lrdirt, firepoint1, mandible, topantenna, innerring, outerring, centerring, emit; + +static-var maxreloadtime, moving, bMoving, terraintype, building; + +#define SIG_AIM1 2 +#define SIG_FIRE1 4 +#define SIG_MOVE 8 +#define SMOKEPIECE1 base +#include "springdefs.h" +#define SIG_BUILD 16 +#define SIG_AIM_2 32 +#define nanoflame 1024+0 + + +#define FRONT_RIGHT_DOWN\ + turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ + turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ + turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); + +#define FRONT_RIGHT_MIDA\ + turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ + turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ + turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); + +#define FRONT_RIGHT_MIDB\ + turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ + turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ + turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); + +#define FRONT_RIGHT_BACK\ + turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ + turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ + turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); + +#define FRONT_RIGHT_UP\ + turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ + turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ + turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); + +#define FRONT_RIGHT_FRONT\ + turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ + turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ + turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); + + + +#define FRONT_LEFT_DOWN\ + turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ + turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ + turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); + +#define FRONT_LEFT_MIDA\ + turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ + turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ + turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); + +#define FRONT_LEFT_MIDB\ + turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ + turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ + turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); + +#define FRONT_LEFT_BACK\ + turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ + turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ + turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); + +#define FRONT_LEFT_UP\ + turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ + turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ + turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); + +#define FRONT_LEFT_FRONT\ + turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ + turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ + turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); + + + +#define REAR_RIGHT_DOWN\ + turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ + turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ + turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); + +#define REAR_RIGHT_MIDA\ + turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ + turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ + turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); + +#define REAR_RIGHT_MIDB\ + turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ + turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ + turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); + +#define REAR_RIGHT_BACK\ + turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ + turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ + turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); + +#define REAR_RIGHT_UP\ + turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ + turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ + turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); + +#define REAR_RIGHT_FRONT\ + turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ + turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ + turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); + + + +#define REAR_LEFT_DOWN\ + turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ + turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ + turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); + +#define REAR_LEFT_MIDA\ + turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ + turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ + turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); + +#define REAR_LEFT_MIDB\ + turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ + turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ + turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); + +#define REAR_LEFT_BACK\ + turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ + turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ + turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); + +#define REAR_LEFT_UP\ + turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ + turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ + turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); + +#define REAR_LEFT_FRONT\ + turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ + turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ + turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); + + + +#define WAIT_WALK\ + sleep WALK_PERIOD;\ + while(!moving)\ + {\ + sleep 111;\ + } + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1026 from nanopoint1; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + + +DoTheWalking() +{ + while(TRUE) + { + WAIT_WALK//1 + FRONT_RIGHT_DOWN + emit-sfx 1025 + 0 from rfdirt; + FRONT_LEFT_BACK + REAR_RIGHT_BACK + REAR_LEFT_MIDA + WAIT_WALK//2 + FRONT_RIGHT_MIDA + WAIT_WALK//3 + FRONT_LEFT_UP + REAR_RIGHT_UP + REAR_LEFT_MIDB + WAIT_WALK//4 + FRONT_RIGHT_MIDB + FRONT_LEFT_FRONT + REAR_RIGHT_FRONT + WAIT_WALK//5 + FRONT_LEFT_DOWN + emit-sfx 1025 + 0 from lfdirt; + REAR_RIGHT_DOWN + emit-sfx 1025 + 0 from rrdirt; + REAR_LEFT_BACK + WAIT_WALK//6 + FRONT_RIGHT_BACK + FRONT_LEFT_MIDA + REAR_RIGHT_MIDA + WAIT_WALK//7 + REAR_LEFT_UP + WAIT_WALK//8 + FRONT_RIGHT_UP + FRONT_LEFT_MIDB + REAR_RIGHT_MIDB + REAR_LEFT_FRONT + WAIT_WALK//9 + FRONT_RIGHT_FRONT + REAR_LEFT_DOWN + emit-sfx 1025 + 0 from lrdirt; + } +} + +StartMoving() +{ + signal SIG_MOVE; + set-signal-mask SIG_MOVE; + moving=TRUE; + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; + signal SIG_MOVE; + set-signal-mask SIG_MOVE; + moving=FALSE; + + sleep 4*(WALK_PERIOD); + + turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); + turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); + wait-for-turn rf1 around z-axis; + wait-for-turn rf2 around z-axis; + turn rf1 to y-axis <25> speed <30> *1000/(WALK_PERIOD); + wait-for-turn rf1 around y-axis; + turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); + + turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); + turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); + wait-for-turn lf1 around z-axis; + wait-for-turn lf2 around z-axis; + turn lf1 to y-axis <-25> speed <30> *1000/(WALK_PERIOD); + wait-for-turn lf1 around y-axis; + turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); + + turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); + turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); + wait-for-turn rr1 around z-axis; + wait-for-turn rr2 around z-axis; + turn rr1 to y-axis <-25> speed <30> *1000/(WALK_PERIOD); + wait-for-turn rr1 around y-axis; + turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); + + turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); + turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); + wait-for-turn lr1 around z-axis; + wait-for-turn lr2 around z-axis; + turn lr1 to y-axis <25> speed <30> *1000/(WALK_PERIOD); + wait-for-turn lr1 around y-axis; + turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); +} + +/* +Thrust() +{ + while( TRUE ) + { + if (moving) + { + emit-sfx 1025 + 0 from dirt; + } + sleep 400; + } +} +*/ + + +buildflame() +{ + while( TRUE ) + { + if (building) + { + emit-sfx nanoflame from nanopoint1; + + } + sleep 600; + } +} + + +Create() +{ + move firepoint1 to y-axis [5000] now; + turn rf1 to y-axis <25> now; + turn lf1 to y-axis <-25> now; + turn rr1 to y-axis <-25> now; + turn lr1 to y-axis <25> now; + maxreloadtime=500; + moving=FALSE; + while(get BUILD_PERCENT_LEFT) + { + sleep 250; + } + start-script SmokeUnit(); + start-script DoTheWalking(); +// start-script Thrust(); + start-script buildflame(); + spin topantenna around y-axis speed <8>; + spin topantenna around x-axis speed <2>; + spin innerring around y-axis speed <-3>; + spin centerring around y-axis speed <4>; + spin outerring around y-axis speed <-7>; +} + +AimFromPrimary(p) +{ + p=firepoint1; +} + +AimPrimary(heading,pitch) +{ + signal SIG_AIM1; + set-signal-mask SIG_AIM1; + return(1); +} + +QueryPrimary(firefrom) +{ + firefrom=firepoint1; +} + +FirePrimary() +{ + signal SIG_FIRE1; + set-signal-mask SIG_FIRE1; +} + +//EMP Weapon End + +StartBuilding(heading, pitch) +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 1; + building = 1; + while (1) { +// emit-sfx 2048 from nanopoint1; + sleep 30; + } +} + +StopBuilding() +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 0; + building = 0; +} + +QueryNanoPiece(piecenum) +{ + piecenum = nanopoint1; +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode rf1 type EXPLODE_ON_HIT; + explode rf2 type EXPLODE_ON_HIT; + explode lf1 type EXPLODE_ON_HIT; + explode lf2 type EXPLODE_ON_HIT; + explode rr1 type EXPLODE_ON_HIT; + explode rr2 type EXPLODE_ON_HIT; + explode lr1 type EXPLODE_ON_HIT; + explode lr2 type EXPLODE_ON_HIT; + explode mandible type EXPLODE_ON_HIT; + explode topantenna type EXPLODE_ON_HIT; + explode innerring type EXPLODE_ON_HIT; + explode centerring type EXPLODE_ON_HIT; + explode outerring type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/ecommander4-meteor.cob b/Scripts/ecommander4-meteor.cob new file mode 100644 index 000000000..468b343bb Binary files /dev/null and b/Scripts/ecommander4-meteor.cob differ diff --git a/Scripts/ecommandfact.cob b/Scripts/ecommandfact.cob deleted file mode 100644 index 6496ec6c0..000000000 Binary files a/Scripts/ecommandfact.cob and /dev/null differ diff --git a/Scripts/ecommandfactory.bos b/Scripts/ecommandfactory.bos deleted file mode 100644 index 59594a311..000000000 --- a/Scripts/ecommandfactory.bos +++ /dev/null @@ -1,239 +0,0 @@ - -#include "sfxtype.h" -#include "exptype.h" - -piece base, doors1, doors2, spikeleft1, spikeleft2, spikeleft3, spikeright1, spikeright2, spikeright3, spikes, topspin, wheelspin, sfxpoint1, nanopoint; - -static-var Maya; - -// Signal definitions (they must be distincts power of 2) -#define SIG_ACTIVATE 2 -#define SIG_BUILDING 4 - -#define NANOFLAME 1024+0 -#define FX1 2048 -#define FX2 2049 -#define FX3 2050 - -SmokeUnit() -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -Create() -{ - Maya=TRUE; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); - turn sfxpoint1 to x-axis <-90> now; -} - -QueryNanoPiece(piecenum) -{ - piecenum = spikes; -} - -Activate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Local variables - var FrameM14,r; - // Open animation: - turn doors1 to z-axis <-90> speed <100>; - turn doors2 to z-axis <90> speed <100>; - move spikes to y-axis [20] speed [5]; - // Try to open the yard - set YARD_OPEN to TRUE; - // If yard not open, tell units around to bugger off until yard is open - while( !get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to TRUE; - } - set BUGGER_OFF to FALSE; - // Now yard is open. - wait-for-move spikes along y-axis; - wait-for-turn doors1 around z-axis; - // Allow the nano to flow: - set INBUILDSTANCE to TRUE; - // Send wheel spinning: - spin wheelspin around x-axis speed <500>; - spin topspin around y-axis speed <50>; - - // The idle but activated animation - FrameM14=0; - while(TRUE) - { - if(Maya) - // Allow the nano to flow - set INBUILDSTANCE to TRUE; - while(Maya) - { - // Activated animation when having tech - emit-sfx FX1 from sfxpoint1; - sleep 5; - ++FrameM14; - if(FrameM14==15) - { - emit-sfx FX2 from sfxpoint1; - FrameM14=0; - } - } - if(!Maya) - // Cut the nano - set INBUILDSTANCE to FALSE; - while(!Maya) - { - // Activated animation when needing tech - r=rand(1,6); - if(r==1) - explode spikeleft1 type FALL | SMOKE; - if(r==2) - explode spikeleft2 type FALL | SMOKE; - if(r==3) - explode spikeleft3 type FALL | SMOKE; - if(r==4) - explode spikeright1 type FALL | SMOKE; - if(r==5) - explode spikeright2 type FALL | SMOKE; - if(r==6) - explode spikeright3 type FALL | SMOKE; - sleep 200; - } - } -} - -Deactivate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Switch off the nano faucet: - set INBUILDSTANCE to FALSE; - // Stop wheel spinning - stop-spin wheelspin around x-axis decelerate <30>; - stop-spin topspin around y-axis decelerate <10>; - // Try to close the yard - set YARD_OPEN to FALSE; - // If yard not closed, tell units around to bugger off until yard is closed - while( get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to FALSE; - } - set BUGGER_OFF to FALSE; - // Now yard is closed. - // Close animation: - turn doors1 to z-axis <0> speed <10>; - turn doors2 to z-axis <0> speed <10>; - move spikes to y-axis [0] speed [5]; -} - -StartBuilding() -{ - signal SIG_BUILDING; // Kill any other StartBuilding - set-signal-mask SIG_BUILDING; // Be killable - var f,r; - f=99999; - r=1; - turn spikeleft1 to y-axis (<-90>)-r*(<30>) now; - turn spikeleft2 to y-axis (<-90>)+r*(<30>) now; - turn spikeleft3 to y-axis (<-90>)-r*(<30>) now; - turn spikeright1 to y-axis (<90>)-r*(<30>) now; - turn spikeright2 to y-axis (<90>)+r*(<30>) now; - turn spikeright3 to y-axis (<90>)-r*(<30>) now; - while(TRUE) - { - emit-sfx NANOFLAME from spikeleft1; - emit-sfx NANOFLAME from spikeleft2; - emit-sfx NANOFLAME from spikeleft3; - emit-sfx NANOFLAME from spikeright1; - emit-sfx NANOFLAME from spikeright2; - emit-sfx NANOFLAME from spikeright3; - emit-sfx FX3 from spikeleft1; - emit-sfx FX3 from spikeleft2; - emit-sfx FX3 from spikeleft3; - emit-sfx FX3 from spikeright1; - emit-sfx FX3 from spikeright2; - emit-sfx FX3 from spikeright3; - sleep 5; - ++f; - if(f>59) - { - f=0; - turn spikeleft1 to y-axis (<-90>)+r*(<30>) speed <30>; - turn spikeleft2 to y-axis (<-90>)-r*(<30>) speed <30>; - turn spikeleft3 to y-axis (<-90>)+r*(<30>) speed <30>; - turn spikeright1 to y-axis (<90>)+r*(<30>) speed <30>; - turn spikeright2 to y-axis (<90>)-r*(<30>) speed <30>; - turn spikeright3 to y-axis (<90>)+r*(<30>) speed <30>; - r=0-r; - } - } -} - -StopBuilding() -{ - signal SIG_BUILDING; // Kill StartBuilding -} - -QueryBuildInfo(piecenum) -{ - piecenum = nanopoint; -} - -TechLost() -{ - Maya=FALSE; -} - -TechGranted() -{ - Maya=TRUE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} \ No newline at end of file diff --git a/Scripts/ecommandfactory.cob b/Scripts/ecommandfactory.cob deleted file mode 100644 index bc17c2c5c..000000000 Binary files a/Scripts/ecommandfactory.cob and /dev/null differ diff --git a/Scripts/ecommandtank.bos b/Scripts/ecommandtank.bos deleted file mode 100644 index a6c59ab8b..000000000 --- a/Scripts/ecommandtank.bos +++ /dev/null @@ -1,156 +0,0 @@ -#include "sfxtype.h" -#include "exptype.h" - -piece base, mast, firepoint1, load1, load2, load3, load4, load5, load6, load7, load8; // these are the pieces of the model -static-var frame, l1, l2, l3, l4, l5, l6, l7, l8; //couldn't get XOR working and didn't have much time - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from mast; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from mast; - sleep 100; - } -} - - -Create() // tells it what to do on creation -{ -start-script fx(); -start-script SmokeUnit(); -} - -TransportPickup(unitid) -{ -if (l8 != 0) return 0; -set BUSY to 1; -attach-unit unitid to base; -if (l1 == 0) {attach-unit unitid to load1; l1 = unitid; sleep 10; set BUSY to 0; return;} -if (l2 == 0) {attach-unit unitid to load2; l2 = unitid; sleep 10; set BUSY to 0; return;} -if (l3 == 0) {attach-unit unitid to load3; l3 = unitid; sleep 10; set BUSY to 0; return;} -if (l4 == 0) {attach-unit unitid to load4; l4 = unitid; sleep 10; set BUSY to 0; return;} -if (l5 == 0) {attach-unit unitid to load5; l5 = unitid; sleep 10; set BUSY to 0; return;} -if (l6 == 0) {attach-unit unitid to load6; l6 = unitid; sleep 10; set BUSY to 0; return;} -if (l7 == 0) {attach-unit unitid to load7; l7 = unitid; sleep 10; set BUSY to 0; return;} -if (l8 == 0) {attach-unit unitid to load8; l8 = unitid; sleep 10; set BUSY to 0; return;} -sleep 500; -drop-unit unitid; -set BUSY to 0; -} - -TransportDrop(unitid) -{ -if (l1 == unitid) l1 = 0; -if (l2 == unitid) l2 = 0; -if (l3 == unitid) l3 = 0; -if (l4 == unitid) l4 = 0; -if (l5 == unitid) l5 = 0; -if (l6 == unitid) l6 = 0; -if (l7 == unitid) l7 = 0; -if (l8 == unitid) l8 = 0; -drop-unit unitid; -} - -lua_frame() { - return 0; -} - -Deactivate() -{ -call-script lua_frame(); -frame = get 111; -get 81 (frame); -if (get 125 (1) < frame) { - emit-sfx 2048 from firepoint1; - get 125(-1, frame + get 126 (1)); -} -} - -Activate(){} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode mast type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode mast type FALL | BITMAP1; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode mast type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode mast type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} \ No newline at end of file diff --git a/Scripts/ecommandtank.cob b/Scripts/ecommandtank.cob deleted file mode 100644 index 9ad1e53b1..000000000 Binary files a/Scripts/ecommandtank.cob and /dev/null differ diff --git a/Scripts/ecommandtankweapon.bos b/Scripts/ecommandtankweapon.bos deleted file mode 100644 index ea4da0ccf..000000000 --- a/Scripts/ecommandtankweapon.bos +++ /dev/null @@ -1,110 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece turret, barrel1, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define gdmarty 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0.000000> speed <30.000000>; -stop-spin barrel1 around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0.000000> - pitch speed <500.000000>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -spin barrel1 around z-axis speed <500.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode turret type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode turret type BITMAPONLY | BITMAP4; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode turret type BITMAPONLY | BITMAP1; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel1 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/ecommandtankweapon.cob b/Scripts/ecommandtankweapon.cob deleted file mode 100644 index 23a0719f2..000000000 Binary files a/Scripts/ecommandtankweapon.cob and /dev/null differ diff --git a/Scripts/ecruisesilo.bos b/Scripts/ecruisesilo.bos deleted file mode 100644 index c2adb8134..000000000 --- a/Scripts/ecruisesilo.bos +++ /dev/null @@ -1,85 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, pipes, lilypad, firepoint1, sfxpoint1; // these are the pieces of the model - -static-var steaming; // these are the variables - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit()// this is a standard smoke point define -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -Steam() -{ - while( TRUE ) - { - if (steaming) - { - emit-sfx 1025 + 0 from sfxpoint1; - } - sleep 128; - } -} - -Create() // tells it what to do on creation -{ - start-script SmokeUnit(); - start-script Steam(); - steaming=TRUE; -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -start-script RestoreAfterDelay(); -start-script Steam(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode lilypad type EXPLODE_ON_HIT; - explode base type EXPLODE_ON_HIT; -} diff --git a/Scripts/ecruisesilo.cob b/Scripts/ecruisesilo.cob deleted file mode 100644 index 618ec7ca9..000000000 Binary files a/Scripts/ecruisesilo.cob and /dev/null differ diff --git a/Scripts/edrone.bos b/Scripts/edrone.bos deleted file mode 100644 index 3d0c6b7a9..000000000 --- a/Scripts/edrone.bos +++ /dev/null @@ -1,127 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, wingsfront, engine1, engine2, wingsrear, engine3; - -static-var moving, flames; - -#define jethtrail 1024+0 - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from engine1; - emit-sfx jethtrail from engine2; - emit-sfx jethtrail from engine3; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -MoveRate0() -{ - flames=0; - turn wingsfront to x-axis <-90.000000> speed <150.000000>; - turn wingsrear to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - flames=0; - turn wingsfront to x-axis <-70.005495> speed <150.000000>; - turn wingsrear to x-axis <-70.005495> speed <150.000000>; - -} -MoveRate2() -{ - flames=1; - turn wingsfront to x-axis <0.000000> speed <150.000000>; - turn wingsrear to x-axis <0.000000> speed <150.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Create() - { -// start-script Thrust(); -// turn engine1 to y-axis <180> now; -// turn engine2 to y-axis <180> now; -// turn engine3 to y-axis <180> now; - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 3; - explode base type EXPLODE_ON_HIT; - explode wingsfront type EXPLODE_ON_HIT; - explode engine1 type EXPLODE_ON_HIT; - explode engine2 type EXPLODE_ON_HIT; - explode wingsrear type EXPLODE_ON_HIT; - explode engine3 type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/edrone.cob b/Scripts/edrone.cob deleted file mode 100644 index 7c5253f32..000000000 Binary files a/Scripts/edrone.cob and /dev/null differ diff --git a/Scripts/eengineer.cob b/Scripts/eengineer.cob deleted file mode 100644 index bfc0f34fa..000000000 Binary files a/Scripts/eengineer.cob and /dev/null differ diff --git a/Scripts/eengineer2.cob b/Scripts/eengineer2.cob deleted file mode 100644 index bfc0f34fa..000000000 Binary files a/Scripts/eengineer2.cob and /dev/null differ diff --git a/Scripts/eengineer3.bos b/Scripts/eengineer3.bos deleted file mode 100644 index db7706938..000000000 --- a/Scripts/eengineer3.bos +++ /dev/null @@ -1,238 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, nano1, nano2, nano3, nano4; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building; - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Buildingfx() -{ - while(building) - { - - emit-sfx nanoflame from nano1; - emit-sfx nanoflame from nano2; - emit-sfx nanoflame from nano3; - emit-sfx nanoflame from nano4; - - sleep 5; - } -} - -Go() -{ - turn base to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn base around y-axis; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn base to y-axis <0.000000> speed <160.000000>; - wait-for-turn base around y-axis; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); - start-script Buildingfx(); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nano1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nano2; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nano3; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; -} diff --git a/Scripts/eengineer3.cob b/Scripts/eengineer3.cob deleted file mode 100644 index dbffbcaa5..000000000 Binary files a/Scripts/eengineer3.cob and /dev/null differ diff --git a/Scripts/eengineer3up1.cob b/Scripts/eengineer3up1.cob deleted file mode 100644 index dbffbcaa5..000000000 Binary files a/Scripts/eengineer3up1.cob and /dev/null differ diff --git a/Scripts/eengineer4.bos b/Scripts/eengineer4.bos deleted file mode 100644 index d41948a84..000000000 --- a/Scripts/eengineer4.bos +++ /dev/null @@ -1,253 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, middlespinnything, rightspinnything, nano1, nano2, dirt; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building, moving; - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Buildingfx() -{ - while(building) - { - - emit-sfx nanoflame from nano1; -// emit-sfx nanoflame from nano2; - - sleep 5; - } -} - -Go() -{ - turn base to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn base around y-axis; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn base to y-axis <0.000000> speed <160.000000>; - wait-for-turn base around y-axis; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script setSFXoccupy(); - start-script Thrust(); - start-script EmitWakes(); - start-script SmokeUnit(); - turn top to x-axis <90.000000> now; -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); - spin middlespinnything around y-axis speed <100>; - spin rightspinnything around x-axis speed <100>; - turn top to x-axis <0.000000> speed <300.000000>; - start-script Buildingfx(); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); - stop-spin middlespinnything around y-axis decelerate <15>; - stop-spin rightspinnything around x-axis decelerate <15>; - turn top to x-axis <90.000000> speed <30.000000>; -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nano1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nano2; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nano1; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; -} diff --git a/Scripts/eengineer4.cob b/Scripts/eengineer4.cob deleted file mode 100644 index 3d8c345e9..000000000 Binary files a/Scripts/eengineer4.cob and /dev/null differ diff --git a/Scripts/eengineer5.bos b/Scripts/eengineer5.bos deleted file mode 100644 index 87f07b312..000000000 --- a/Scripts/eengineer5.bos +++ /dev/null @@ -1,194 +0,0 @@ -piece base, doorleft, doorright, nanopoint1, penis, dirt, wheel; - -#include "springdefs.h" -#define SIG_BUILD 8 -#define nanoflame 1024+0 - -static-var bMoving, terraintype, building, moving; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from wheel; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -/* -Buildingfx() -{ - while(building) - { - -// emit-sfx nanoflame from nanopoint1; -// emit-sfx nanoflame from nano2; - - sleep 5; - } -} - -*/ - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ - start-script setSFXoccupy(); - start-script Thrust(); - start-script EmitWakes(); - start-script SmokeUnit(); - start-script buildflame(); -} - -QueryWeapon1(piecenum) -{ - piecenum=nanopoint1; -} - -AimFromWeapon1(piecenum) -{ - piecenum=penis; -} - -AimWeapon1(h,p) -{ - return 0; -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - turn doorleft to y-axis <90> speed <100.000000>; - turn doorright to y-axis <-90> speed <100.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; - move penis to z-axis [4] speed [1]; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - move penis to z-axis [0] speed [2]; - turn doorleft to y-axis <0> speed <50.000000>; - turn doorright to y-axis <0> speed <50.000000>; - wait-for-turn doorleft around y-axis; - wait-for-turn doorright around y-axis; - -} - -QueryNanoPiece(piecenum) -{ - piecenum = nanopoint1; -} - - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode doorleft type EXPLODE_ON_HIT; - explode doorright type EXPLODE_ON_HIT; - explode penis type EXPLODE_ON_HIT; - explode wheel type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eengineer5.cob b/Scripts/eengineer5.cob deleted file mode 100644 index 42e33258e..000000000 Binary files a/Scripts/eengineer5.cob and /dev/null differ diff --git a/Scripts/eengineer6.bos b/Scripts/eengineer6.bos deleted file mode 100644 index bdf108668..000000000 --- a/Scripts/eengineer6.bos +++ /dev/null @@ -1,184 +0,0 @@ -piece base, nanopoint1, penis, dirt, turret; - -#include "springdefs.h" -#define SIG_BUILD 8 -#define nanoflame 1024+0 - -static-var bMoving, terraintype, building, moving; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from turret; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -/* -Buildingfx() -{ - while(building) - { - -// emit-sfx nanoflame from nanopoint1; -// emit-sfx nanoflame from nano2; - - sleep 5; - } -} - -*/ - -buildflame() -{ - while( TRUE ) - { - if (building) - { - emit-sfx nanoflame from nanopoint1; - - } - sleep 600; - } -} - -Create() -{ - start-script setSFXoccupy(); - start-script Thrust(); - start-script EmitWakes(); - start-script SmokeUnit(); - start-script buildflame(); -} - -QueryWeapon1(piecenum) -{ - piecenum=nanopoint1; -} - -AimFromWeapon1(piecenum) -{ - piecenum=penis; -} - -AimWeapon1(h,p) -{ - return 0; -} - -StartBuilding(heading, pitch) -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - spin penis around y-axis speed <50.005495>; - set INBUILDSTANCE to 1; - building = 1; - while (1) { -// emit-sfx 2048 from nanopoint1; - sleep 30; - } -} - -StopBuilding() -{ - signal SIG_BUILD; - set-signal-mask SIG_BUILD; - set INBUILDSTANCE to 0; - building = 0; - stop-spin penis around z-axis decelerate <15.000000>; - -} - -QueryNanoPiece(piecenum) -{ - piecenum = nanopoint1; -} - - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode penis type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eengineer6.cob b/Scripts/eengineer6.cob deleted file mode 100644 index 3c90c8efd..000000000 Binary files a/Scripts/eengineer6.cob and /dev/null differ diff --git a/Scripts/eexecutioner.bos b/Scripts/eexecutioner.bos deleted file mode 100644 index 71505e7cd..000000000 --- a/Scripts/eexecutioner.bos +++ /dev/null @@ -1,110 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - - -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn turret to y-axis <0> speed <30>; -turn barrel1 to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <30>; -turn barrel1 to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eexecutioner.cob b/Scripts/eexecutioner.cob deleted file mode 100644 index 3a1d59213..000000000 Binary files a/Scripts/eexecutioner.cob and /dev/null differ diff --git a/Scripts/eexkrabgroth.bos b/Scripts/eexkrabgroth.bos deleted file mode 100644 index 13863fe5a..000000000 --- a/Scripts/eexkrabgroth.bos +++ /dev/null @@ -1,408 +0,0 @@ - -// One ninth of the full cycle duration, in millisecond -// The larger this value the slower the walk animation -#define WALK_PERIOD 250 - - -piece base,turret1,barrel1,firepoint1,turret2,barrel2,firepoint2,turret3,barrel3,firepoint3, - rf1,rf2,lf1,lf2,rr1,rr2,lr1,lr2,rfdirt,rrdirt,lfdirt,lrdirt; - #define barrel barrel1 - -static-var maxreloadtime,moving; - -#define SIG_AIM1 2 -#define SIG_FIRE1 2 -#define SIG_AIM2 4 -#define SIG_FIRE2 4 -#define SIG_AIM3 16 -#define SIG_FIRE3 16 -#define SIG_MOVE 8 -#include "exptype.h" -#include "sfxtype.h" -#define SMOKEPIECE1 base -#include "SmokeUnit.h" - - - -#define FRONT_RIGHT_DOWN\ - turn rf1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <-45> speed <45> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDA\ - turn rf1 to y-axis <50> speed <10> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <-8> speed <37> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_MIDB\ - turn rf1 to y-axis <30> speed <20> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <15> speed <23> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_BACK\ - turn rf1 to y-axis <0> speed <30> *500/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <9> *500/(WALK_PERIOD);\ - turn rf2 to z-axis <-32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_RIGHT_UP\ - turn rf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_RIGHT_FRONT\ - turn rf1 to y-axis <60> speed <60> *1000/(WALK_PERIOD);\ - turn rf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn rf2 to z-axis <45> speed <45> *1000/(WALK_PERIOD); - - - -#define FRONT_LEFT_DOWN\ - turn lf1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <45> speed <45> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-67> speed <22> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_MIDA\ - turn lf1 to y-axis <-50> speed <10> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <8> speed <37> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <-12> speed <55> *500/(WALK_PERIOD); - -#define FRONT_LEFT_MIDB\ - turn lf1 to y-axis <-30> speed <20> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-15> speed <23> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <20> speed <32> *500/(WALK_PERIOD); - -#define FRONT_LEFT_BACK\ - turn lf1 to y-axis <-0> speed <30> *500/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <9> *500/(WALK_PERIOD);\ - turn lf2 to z-axis <32> speed <12> *500/(WALK_PERIOD); - -#define FRONT_LEFT_UP\ - turn lf1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <0> speed <32> *1000/(WALK_PERIOD); - -#define FRONT_LEFT_FRONT\ - turn lf1 to y-axis <-60> speed <60> *1000/(WALK_PERIOD);\ - turn lf1 to z-axis <0> speed <24> *1000/(WALK_PERIOD);\ - turn lf2 to z-axis <-45> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_RIGHT_DOWN\ - turn rr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <10> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <-32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_MIDA\ - turn rr1 to y-axis <-30> speed <30> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <15> speed <9> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <-20> speed <12> *500/(WALK_PERIOD); - -#define REAR_RIGHT_MIDB\ - turn rr1 to y-axis <-50> speed <20> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-8> speed <23> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <12> speed <32> *500/(WALK_PERIOD); - -#define REAR_RIGHT_BACK\ - turn rr1 to y-axis <-60> speed <10> *500/(WALK_PERIOD);\ - turn rr1 to z-axis <-45> speed <37> *500/(WALK_PERIOD);\ - turn rr2 to z-axis <67> speed <55> *500/(WALK_PERIOD); - -#define REAR_RIGHT_UP\ - turn rr1 to y-axis <-60> speed <42> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_RIGHT_FRONT\ - turn rr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn rr1 to z-axis <24> speed <24> *1000/(WALK_PERIOD);\ - turn rr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define REAR_LEFT_DOWN\ - turn lr1 to y-axis <0> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <10> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <32> speed <32> *1000/(WALK_PERIOD); - -#define REAR_LEFT_MIDA\ - turn lr1 to y-axis <30> speed <30> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <-15> speed <9> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <20> speed <12> *500/(WALK_PERIOD); - -#define REAR_LEFT_MIDB\ - turn lr1 to y-axis <50> speed <20> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <8> speed <23> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-12> speed <32> *500/(WALK_PERIOD); - -#define REAR_LEFT_BACK\ - turn lr1 to y-axis <60> speed <10> *500/(WALK_PERIOD);\ - turn lr1 to z-axis <45> speed <37> *500/(WALK_PERIOD);\ - turn lr2 to z-axis <-67> speed <55> *500/(WALK_PERIOD); - -#define REAR_LEFT_UP\ - turn lr1 to y-axis <60> speed <42> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <0> speed <45> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <-45> speed <22> *1000/(WALK_PERIOD); - -#define REAR_LEFT_FRONT\ - turn lr1 to y-axis <0> speed <60> *1000/(WALK_PERIOD);\ - turn lr1 to z-axis <-24> speed <24> *1000/(WALK_PERIOD);\ - turn lr2 to z-axis <0> speed <45> *1000/(WALK_PERIOD); - - - -#define WAIT_WALK\ - sleep WALK_PERIOD;\ - while(!moving)\ - {\ - sleep 111;\ - } - - - -DoTheWalking() -{ - while(TRUE) - { - WAIT_WALK//1 - FRONT_RIGHT_DOWN - emit-sfx 1025 + 0 from rfdirt; - FRONT_LEFT_BACK - REAR_RIGHT_BACK - REAR_LEFT_MIDA - WAIT_WALK//2 - FRONT_RIGHT_MIDA - WAIT_WALK//3 - FRONT_LEFT_UP - REAR_RIGHT_UP - REAR_LEFT_MIDB - WAIT_WALK//4 - FRONT_RIGHT_MIDB - FRONT_LEFT_FRONT - REAR_RIGHT_FRONT - WAIT_WALK//5 - FRONT_LEFT_DOWN - emit-sfx 1025 + 0 from lfdirt; - REAR_RIGHT_DOWN - emit-sfx 1025 + 0 from rrdirt; - REAR_LEFT_BACK - WAIT_WALK//6 - FRONT_RIGHT_BACK - FRONT_LEFT_MIDA - REAR_RIGHT_MIDA - WAIT_WALK//7 - REAR_LEFT_UP - WAIT_WALK//8 - FRONT_RIGHT_UP - FRONT_LEFT_MIDB - REAR_RIGHT_MIDB - REAR_LEFT_FRONT - WAIT_WALK//9 - FRONT_RIGHT_FRONT - REAR_LEFT_DOWN - emit-sfx 1025 + 0 from lrdirt; - } -} - -StartMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=TRUE; -} - -StopMoving() -{ - signal SIG_MOVE; - set-signal-mask SIG_MOVE; - moving=FALSE; - - sleep 4*(WALK_PERIOD); - - turn rf1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around z-axis; - wait-for-turn rf2 around z-axis; - turn rf1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rf1 around y-axis; - turn rf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lf1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lf2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around z-axis; - wait-for-turn lf2 around z-axis; - turn lf1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lf1 around y-axis; - turn lf1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn rr1 to z-axis <45> speed <30> *1000/(WALK_PERIOD); - turn rr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around z-axis; - wait-for-turn rr2 around z-axis; - turn rr1 to y-axis <-30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn rr1 around y-axis; - turn rr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); - - turn lr1 to z-axis <-45> speed <30> *1000/(WALK_PERIOD); - turn lr2 to z-axis <0> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around z-axis; - wait-for-turn lr2 around z-axis; - turn lr1 to y-axis <30> speed <30> *1000/(WALK_PERIOD); - wait-for-turn lr1 around y-axis; - turn lr1 to z-axis <0> speed <40> *1000/(WALK_PERIOD); -} - - -Create() -{ - turn rf1 to y-axis <30> now; - turn lf1 to y-axis <-30> now; - turn rr1 to y-axis <-30> now; - turn lr1 to y-axis <30> now; - maxreloadtime=500; - moving=FALSE; - while(get BUILD_PERCENT_LEFT) - { - sleep 250; - } - start-script SmokeUnit(); - start-script DoTheWalking(); -// start-script Thrust(); -} - -SetMaxReloadTime(t) -{ - maxreloadtime=t; -} - -RestoreAfterDelay() -{ - sleep maxreloadtime*3/2; - turn turret1 to y-axis 0 speed <60>; - turn barrel1 to x-axis 0 speed <30>; - turn turret2 to y-axis 0 speed <60>; - turn barrel2 to x-axis 0 speed <30>; - turn turret3 to y-axis 0 speed <60>; - turn barrel3 to x-axis 0 speed <30>; - wait-for-turn turret1 around y-axis; - wait-for-turn barrel1 around x-axis; - wait-for-turn turret2 around y-axis; - wait-for-turn barrel2 around x-axis; - wait-for-turn turret3 around y-axis; - wait-for-turn barrel3 around x-axis; -} - -AimFromPrimary(p) -{ - p=turret1; -} - -AimPrimary(heading,pitch) -{ - signal SIG_AIM1; - set-signal-mask SIG_AIM1; - turn turret1 to y-axis heading speed <255>; - turn barrel1 to x-axis 0 - pitch speed <150>; - wait-for-turn turret1 around y-axis; - wait-for-turn barrel1 around x-axis; - start-script RestoreAfterDelay(); - return(1); -} - -QueryPrimary(firefrom) -{ - firefrom=firepoint1; -} - -FirePrimary() -{ - signal SIG_FIRE1; - set-signal-mask SIG_FIRE1; - emit-sfx 1024 + 0 from firepoint1; -// move barrel to z-axis [-10] now; -// move barrel to z-axis [0] speed [4]; -} - -AimFromSecondary(p) -{ - p=turret2; -} - -AimSecondary(heading,pitch) -{ - signal SIG_AIM2; - set-signal-mask SIG_AIM2; - turn turret2 to y-axis heading speed <255>; - turn barrel2 to x-axis 0 - pitch speed <150>; - wait-for-turn turret2 around y-axis; - wait-for-turn barrel2 around x-axis; -// start-script RestoreAfterDelay(); - return(1); -} - -QuerySecondary(firefrom) -{ - firefrom=firepoint2; -} - -FireSecondary() -{ - signal SIG_FIRE2; - set-signal-mask SIG_FIRE2; - emit-sfx 1024 + 0 from firepoint2; -// move barrel to z-axis [-10] now; -// move barrel to z-axis [0] speed [4]; -} - - -AimFromTertiary(p) -{ - p=turret3; -} - -AimTertiary(heading,pitch) -{ - signal SIG_AIM3; - set-signal-mask SIG_AIM3; - turn turret3 to y-axis heading speed <255>; - turn barrel3 to x-axis 0 - pitch speed <150>; - wait-for-turn turret3 around y-axis; - wait-for-turn barrel3 around x-axis; -// start-script RestoreAfterDelay(); - return(1); -} - -QueryTertiary(firefrom) -{ - firefrom=firepoint3; -} - -FireTertiary() -{ - signal SIG_FIRE3; - set-signal-mask SIG_FIRE3; - emit-sfx 1024 + 0 from firepoint3; -// move barrel to z-axis [-10] now; -// move barrel to z-axis [0] speed [4]; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret1 type EXPLODE_ON_HIT; - explode barrel2 type EXPLODE_ON_HIT; - explode turret2 type EXPLODE_ON_HIT; - explode barrel3 type EXPLODE_ON_HIT; - explode turret3 type EXPLODE_ON_HIT; - explode rf1 type EXPLODE_ON_HIT; - explode rf2 type EXPLODE_ON_HIT; - explode lf1 type EXPLODE_ON_HIT; - explode lf2 type EXPLODE_ON_HIT; - explode rr1 type EXPLODE_ON_HIT; - explode rr2 type EXPLODE_ON_HIT; - explode lr1 type EXPLODE_ON_HIT; - explode lr2 type EXPLODE_ON_HIT; - -} \ No newline at end of file diff --git a/Scripts/eexkrabgroth.cob b/Scripts/eexkrabgroth.cob deleted file mode 100644 index 2047541f0..000000000 Binary files a/Scripts/eexkrabgroth.cob and /dev/null differ diff --git a/Scripts/eexnukearty.bos b/Scripts/eexnukearty.bos deleted file mode 100644 index 4ef948036..000000000 --- a/Scripts/eexnukearty.bos +++ /dev/null @@ -1,152 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, bMoving, moving; - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from barrel1; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( Static_Var_3 ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - - -setSFXoccupy(Func_Var_1) -{ - Static_Var_2 = Func_Var_1; - if( Static_Var_2 == 2 ) - { - move base to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } - else - { - move base to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - if( Static_Var_2 == 4 ) - { - move base to y-axis [0.000000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 0; - } - else - { - move base to y-axis [-0.850000] speed [50.000000]; - set UNKNOWN_UNIT_VALUE(79) to 1; - } -} - -Create() -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn turret to y-axis <0.000000> speed <60.000000>; - turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <100>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() -{ - - emit-sfx 1024 + 0 from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/eexnukearty.cob b/Scripts/eexnukearty.cob deleted file mode 100644 index 3efe77e8e..000000000 Binary files a/Scripts/eexnukearty.cob and /dev/null differ diff --git a/Scripts/eexperimentalfac.bos b/Scripts/eexperimentalfac.bos deleted file mode 100644 index 6d221cf5b..000000000 --- a/Scripts/eexperimentalfac.bos +++ /dev/null @@ -1,182 +0,0 @@ - -#include "sfxtype.h" -#include "exptype.h" - -piece base, doorsright, doorsleft, frontsouthdoors, frontnorthdoors, rearsouthdoors, rearnorthdoors, nanopoint; - -static-var Maya; - -// Signal definitions (they must be distincts power of 2) -#define SIG_ACTIVATE 2 -#define SIG_BUILDING 4 - -#define NANO 1024+0 -#define FX1 2048 -#define FX2 2049 -#define FX3 2050 - -SmokeUnit() -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -Create() -{ - Maya=TRUE; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); -// turn sfxpoint1 to x-axis <-90> now; -} - -QueryNanoPiece(piecenum) -{ - piecenum = nanopoint; -} - -Activate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Local variables - var FrameM14,r; - // Open animation: - turn frontnorthdoors to x-axis <90> speed <100>; - turn frontsouthdoors to x-axis <-90> speed <100>; - turn rearnorthdoors to x-axis <90> speed <100>; - turn rearsouthdoors to x-axis <-90> speed <100>; - wait-for-turn frontnorthdoors around x-axis; - wait-for-turn frontsouthdoors around x-axis; - wait-for-turn rearnorthdoors around x-axis; - wait-for-turn rearsouthdoors around x-axis; - turn doorsright to z-axis <90> speed <100>; - turn doorsleft to z-axis <-90> speed <100>; - // Try to open the yard - set YARD_OPEN to TRUE; - // If yard not open, tell units around to bugger off until yard is open - while( !get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to TRUE; - } - set BUGGER_OFF to FALSE; - // Now yard is open. - // Allow the nano to flow: - set INBUILDSTANCE to TRUE; - - // The idle but activated animation - FrameM14=0; - while(TRUE) - { - if(Maya) - // Allow the nano to flow - set INBUILDSTANCE to TRUE; - while(Maya) - { - // Activated animation when having tech - sleep 5; - ++FrameM14; - if(FrameM14==15) - { - FrameM14=0; - } - } - if(!Maya) - // Cut the nano - set INBUILDSTANCE to FALSE; - while(!Maya) - { - // Activated animation when needing tech - sleep 200; - } - } -} - -Deactivate() -{ - // Kill any other Activate or Deactivate: - signal SIG_ACTIVATE; - // Flag self so it can be killed: - set-signal-mask SIG_ACTIVATE; - // Switch off the nano faucet: - set INBUILDSTANCE to FALSE; - // Stop wheel spinning - // Try to close the yard - set YARD_OPEN to FALSE; - // If yard not closed, tell units around to bugger off until yard is closed - while( get YARD_OPEN ) - { - set BUGGER_OFF to TRUE; - sleep 1500; - set YARD_OPEN to FALSE; - } - set BUGGER_OFF to FALSE; - // Now yard is closed. - // Close animation: - turn doorsright to z-axis <0> speed <75>; - turn doorsleft to z-axis <0> speed <75>; - wait-for-turn doorsright around z-axis; - wait-for-turn doorsleft around z-axis; - turn frontnorthdoors to x-axis <0> speed <75>; - turn frontsouthdoors to x-axis <0> speed <75>; - turn rearnorthdoors to x-axis <0> speed <75>; - turn rearsouthdoors to x-axis <0> speed <75>; -} - -StartBuilding() -{ - signal SIG_BUILDING; // Kill any other StartBuilding - set-signal-mask SIG_BUILDING; // Be killable - while(TRUE) - { - emit-sfx NANO from nanopoint; - sleep 300; - } -} - -StopBuilding() -{ - signal SIG_BUILDING; // Kill StartBuilding -} - -QueryBuildInfo(piecenum) -{ - piecenum = nanopoint; -} - -TechLost() -{ - Maya=FALSE; -} - -TechGranted() -{ - Maya=TRUE; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode frontsouthdoors type EXPLODE_ON_HIT; - explode frontnorthdoors type EXPLODE_ON_HIT; - explode rearsouthdoors type EXPLODE_ON_HIT; - explode rearnorthdoors type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eexperimentalfac.cob b/Scripts/eexperimentalfac.cob deleted file mode 100644 index 7a66125af..000000000 Binary files a/Scripts/eexperimentalfac.cob and /dev/null differ diff --git a/Scripts/eextankdestroyer.bos b/Scripts/eextankdestroyer.bos deleted file mode 100644 index cf44aaa43..000000000 --- a/Scripts/eextankdestroyer.bos +++ /dev/null @@ -1,165 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, barrel1, turret2, barrel2, firepoint1, firepoint2, dirt1, dirt2, frontwheels, rearwheels, rearmidwheels, frontmidwheels; // these are the pieces of the model - -static-var terraintype, bmoving, moving, underwater; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from turret1; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -StartMoving() -{ - bMoving = TRUE; - moving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; - moving = FALSE; -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt1; - emit-sfx 1025 + 0 from dirt2; - spin frontwheels around x-axis speed <150.005495>; - spin rearwheels around x-axis speed <100.005495>; - spin frontmidwheels around x-axis speed <100.005495>; - spin rearmidwheels around x-axis speed <100.005495>; - - } - else - { - stop-spin frontmidwheels around x-axis decelerate <20.000000>; - stop-spin rearmidwheels around x-axis decelerate <20.000000>; - stop-spin frontwheels around x-axis decelerate <20.000000>; - stop-spin rearwheels around x-axis decelerate <20.000000>; - } - sleep 400; - } -} -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -turn turret2 to y-axis <0> speed <60>; -turn barrel2 to x-axis <0> speed <30>; -} - -//***************** - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret1 to y-axis heading speed <200>; -turn barrel1 to x-axis <0> - pitch speed <200>; -wait-for-turn turret1 around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -//*********************** - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret2 to y-axis heading speed <300>; -turn barrel2 to x-axis <0> - pitch speed <300>; -wait-for-turn turret2 around y-axis; -wait-for-turn barrel2 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret1 type EXPLODE_ON_HIT; - explode barrel2 type EXPLODE_ON_HIT; - explode turret2 type EXPLODE_ON_HIT; - explode frontwheels type EXPLODE_ON_HIT; - explode rearwheels type EXPLODE_ON_HIT; - explode rearmidwheels type EXPLODE_ON_HIT; - explode frontmidwheels type EXPLODE_ON_HIT; -} diff --git a/Scripts/eextankdestroyer.cob b/Scripts/eextankdestroyer.cob deleted file mode 100644 index 89d2df58c..000000000 Binary files a/Scripts/eextankdestroyer.cob and /dev/null differ diff --git a/Scripts/efactory.cob b/Scripts/efactory.cob deleted file mode 100644 index 121233355..000000000 Binary files a/Scripts/efactory.cob and /dev/null differ diff --git a/Scripts/efatso.bos b/Scripts/efatso.bos deleted file mode 100644 index e20dbc171..000000000 --- a/Scripts/efatso.bos +++ /dev/null @@ -1,213 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, turret2, turret3, firepoint1, firepoint2, firepoint3; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -turn turret1 to x-axis <0> speed <30>; -turn turret2 to y-axis <0> speed <60>; -turn turret2 to x-axis <0> speed <30>; -turn turret3 to y-axis <0> speed <60>; -turn turret3 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret1 to y-axis heading speed <225>; -turn turret1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret1 around y-axis; -wait-for-turn turret1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret2 to y-axis heading speed <225>; -turn turret2 to x-axis <0> - pitch speed <150>; -wait-for-turn turret2 around y-axis; -wait-for-turn turret2 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM_4; -turn turret3 to y-axis heading speed <225>; -turn turret3 to x-axis <0> - pitch speed <150>; -wait-for-turn turret3 around y-axis; -wait-for-turn turret3 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = turret3; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type FALL | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/efatso.cob b/Scripts/efatso.cob deleted file mode 100644 index 6e1592754..000000000 Binary files a/Scripts/efatso.cob and /dev/null differ diff --git a/Scripts/efatso2.bos b/Scripts/efatso2.bos deleted file mode 100644 index 36a097585..000000000 --- a/Scripts/efatso2.bos +++ /dev/null @@ -1,177 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece firepoint1, firepoint2, base, turret, barrel1, dirt; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var terraintype, bmoving, moving, shooting_num; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - shooting_num=1; - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn turret to y-axis <0.000000> speed <35.005495>; - turn barrel1 to x-axis <0.000000> speed <15.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - - if(shooting_num==1) - { - emit-sfx 1024 from firepoint2; - } - - if(shooting_num==2) - { - emit-sfx 1024 from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 3) - { - shooting_num=1; - } -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if (shooting_num==1) - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/efatso2.cob b/Scripts/efatso2.cob deleted file mode 100644 index 3583217b3..000000000 Binary files a/Scripts/efatso2.cob and /dev/null differ diff --git a/Scripts/efet.bos b/Scripts/efet.bos deleted file mode 100644 index 9998590ae..000000000 --- a/Scripts/efet.bos +++ /dev/null @@ -1,109 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define trail 1024+0 // this is a custom explosion generator thinging - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx trail from base; - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/efet.cob b/Scripts/efet.cob deleted file mode 100644 index 91a2e5aa2..000000000 Binary files a/Scripts/efet.cob and /dev/null differ diff --git a/Scripts/efighter.bos b/Scripts/efighter.bos deleted file mode 100644 index f31829e80..000000000 --- a/Scripts/efighter.bos +++ /dev/null @@ -1,102 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, firepoint3, firepoint4, firepoint5, engine; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 - -#define gdmarty 1024+0 // this is a custom explosion generator thinging -#define flame 1025+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from engine; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Create() - { - start-script SmokeUnit(); -// turn engine to y-axis <180> now; -// start-script Thrust(); - } - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode engine type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/efighter.cob b/Scripts/efighter.cob deleted file mode 100644 index 537d36155..000000000 Binary files a/Scripts/efighter.cob and /dev/null differ diff --git a/Scripts/efighter3.bos b/Scripts/efighter3.bos deleted file mode 100644 index 6f420c92e..000000000 --- a/Scripts/efighter3.bos +++ /dev/null @@ -1,172 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, fengine1, fengine2, fengine3, fengine4, rearengines, rengine1, rengine2, leftwing, rightwing, turret1, turret2, barrel1, barrel2; - -static-var moving, flames, shooting_num; - -#define jethtrail 1025+0 - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (flames) - { - emit-sfx jethtrail from fengine1; - emit-sfx jethtrail from fengine2; - emit-sfx jethtrail from fengine3; - emit-sfx jethtrail from fengine4; - } - if (moving) - { - emit-sfx jethtrail from rengine1; - emit-sfx jethtrail from rengine2; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -MoveRate0() -{ - flames=0; - turn rearengines to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - flames=1; - turn rearengines to x-axis <-70.005495> speed <150.000000>; -} -MoveRate2() -{ - flames=1; - turn rearengines to x-axis <0.000000> speed <150.000000>; -} - -Create() - { -// start-script Thrust(); - shooting_num=1; - start-script SmokeUnit(); - } - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ - sleep 3000; - turn turret1 to y-axis <0> speed <60>; - turn barrel1 to x-axis <0> speed <30>; - turn turret2 to y-axis <0> speed <60>; - turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - turn turret1 to y-axis heading speed <1000>; - turn turret2 to y-axis heading speed <1000>; - turn barrel1 to x-axis <0> - pitch speed <1000>; - turn barrel2 to x-axis <0> - pitch speed <1000>; - //I'm betting that precisely no one is going to notice that it fires a moment before the barrel actually aims - //wait-for-turn turret1 around y-axis; - //wait-for-turn turret2 around y-axis; - //wait-for-turn barrel1 around x-axis; - //wait-for-turn barrel2 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - - if(shooting_num==1) - { - emit-sfx 1024 from firepoint2; - } - - if(shooting_num==2) - { - emit-sfx 1024 from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 3) - { - shooting_num=1; - } -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ - if (shooting_num==1) - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode rearengines type EXPLODE_ON_HIT; - explode leftwing type EXPLODE_ON_HIT; - explode turret1 type EXPLODE_ON_HIT; - explode turret2 type EXPLODE_ON_HIT; - explode rightwing type EXPLODE_ON_HIT; - explode barrel1 type EXPLODE_ON_HIT; - explode barrel2 type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/efighter3.cob b/Scripts/efighter3.cob deleted file mode 100644 index 9fe77342c..000000000 Binary files a/Scripts/efighter3.cob and /dev/null differ diff --git a/Scripts/eflakturret.bos b/Scripts/eflakturret.bos new file mode 100644 index 000000000..6638a246f --- /dev/null +++ b/Scripts/eflakturret.bos @@ -0,0 +1,148 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, beams, turret, barrel1, firepoint1, firepoint2, firepoint3, firepoint4, lilypad; // these are the pieces of the model + +static-var shooting_num, terraintype; + +// Signal definitions +#define SIG_AIM 2 // this is a aim define <- o_O This is a kill flag + + +// Custom SFX +#define GDMARTY 1024+0 + +SmokeUnit()// this is a standard smoke point define +{ + var healthpercent, sleeptime, smoketype; + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = SFXTYPE_BLACKSMOKE; + if( Rand( 1, 66 ) < healthpercent ) + smoketype = SFXTYPE_WHITESMOKE; + emit-sfx 1026 from turret; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + sleeptime = 200; + sleep sleeptime; + } +} + + +Create() // tells it what to do on creation +{ + shooting_num=1; + start-script SmokeUnit(); +} + + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +sleep 3000; +turn turret to y-axis <0> speed <60>; +turn barrel1 to x-axis <0> speed <30>; +} + +AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +/* + if ( get IN_WATER(0) == 1 ) + { + return (0); + } +*/ +signal SIG_AIM; +set-signal-mask SIG_AIM; +turn turret to y-axis heading speed <5000>; +turn barrel1 to x-axis <0> - pitch speed <5000>; +wait-for-turn turret around y-axis; +wait-for-turn barrel1 around x-axis; +start-script RestoreAfterDelay(); +return (1); +} + + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ + if(shooting_num==1) + { + emit-sfx 1024 from firepoint2; + } + + if(shooting_num==2) + { + emit-sfx 1024 from firepoint3; + } + + if(shooting_num==3) + { + emit-sfx 1024 from firepoint4; + } + + if(shooting_num==4) + { + emit-sfx 1024 from firepoint1; + } + + shooting_num=shooting_num+1; + + if( shooting_num == 5) + { + shooting_num=1; + } +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ +piecenum = barrel1; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ + if (shooting_num==1) + { + piecenum=firepoint1; + } + + if (shooting_num==2) + { + piecenum=firepoint2; + } + + if (shooting_num==3) + { + piecenum=firepoint3; + } + + if (shooting_num==4) + { + piecenum=firepoint4; + } +} +/* +TechLost() +{ + CanFire=FALSE; + signal SIG_AIM; + stop-spin turret around y-axis decelerate <10>; + stop-spin barrel1 around x-axis decelerate <10>; +} + +TechGranted() +{ + CanFire=TRUE; +} +*/ +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode beams type EXPLODE_ON_HIT; + explode lilypad type EXPLODE_ON_HIT; +} diff --git a/Scripts/eflakturret.cob b/Scripts/eflakturret.cob new file mode 100644 index 000000000..0ba4adcb9 Binary files /dev/null and b/Scripts/eflakturret.cob differ diff --git a/Scripts/eflametank.bos b/Scripts/eflametank.bos deleted file mode 100644 index da68a6ec5..000000000 --- a/Scripts/eflametank.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt, casing; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging -#define f3 1024+1 -// Signal definitions -#define SIG_AIM 2 - -lua_FlameShot(weapon) //flame effect? -{ - return 0; -} - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); - move casing to z-axis [-2] speed [1000]; -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -move casing to z-axis [-2] speed [1]; -} - -AimPrimary(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FirePrimary() // what do while firing, fires 1 barrel then the next , and resets -{ -move casing to z-axis [2] speed [10]; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; -} - -AimFromPrimary(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryPrimary(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Shot1() -{ - call-script lua_FlameShot(1); - return (TRUE); -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode casing type EXPLODE_ON_HIT; -} diff --git a/Scripts/eflametank.cob b/Scripts/eflametank.cob deleted file mode 100644 index 5295752c4..000000000 Binary files a/Scripts/eflametank.cob and /dev/null differ diff --git a/Scripts/eflamethrower.bos b/Scripts/eflamethrower.bos deleted file mode 100644 index 4b609ebc0..000000000 --- a/Scripts/eflamethrower.bos +++ /dev/null @@ -1,143 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// Signal definitions -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; - -turn turret1 to y-axis heading speed <225>; -wait-for-turn turret1 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type FALL | BITMAP1; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -return (0); -} -corpsetype = 3; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -} diff --git a/Scripts/eflamethrower.cob b/Scripts/eflamethrower.cob deleted file mode 100644 index b3f2f1157..000000000 Binary files a/Scripts/eflamethrower.cob and /dev/null differ diff --git a/Scripts/efusion.cob b/Scripts/efusion.cob deleted file mode 100644 index 570a17396..000000000 Binary files a/Scripts/efusion.cob and /dev/null differ diff --git a/Scripts/egunship.cob b/Scripts/egunship.cob deleted file mode 100644 index 4e70e0e02..000000000 Binary files a/Scripts/egunship.cob and /dev/null differ diff --git a/Scripts/egunship2.bos b/Scripts/egunship2.bos deleted file mode 100644 index 759b808c3..000000000 --- a/Scripts/egunship2.bos +++ /dev/null @@ -1,158 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, frontengines, fengine1, fengine2, rearengines, rengine1, rengine2, engine; - -static-var moving, flames; - -#define jethtrail 1024+0 - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving && flames) - { - emit-sfx jethtrail from engine; - } - if (moving) - { - emit-sfx jethtrail from fengine1; - emit-sfx jethtrail from fengine2; - emit-sfx jethtrail from rengine1; - emit-sfx jethtrail from rengine2; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -MoveRate0() -{ - flames=0; - turn frontengines to x-axis <-90.000000> speed <150.000000>; - turn rearengines to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - flames=0; - turn frontengines to x-axis <-70.005495> speed <150.000000>; - turn rearengines to x-axis <-70.005495> speed <150.000000>; -} -MoveRate2() -{ - flames=1; - turn frontengines to x-axis <0.000000> speed <150.000000>; - turn rearengines to x-axis <0.000000> speed <150.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -Create() - { -// start-script Thrust(); -// turn engine to y-axis <180> now; -// turn fengine1 to y-axis <180> now; -// turn fengine2 to y-axis <180> now; -// turn rengine1 to y-axis <180> now; -// turn rengine2 to y-axis <180> now; - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode frontengines type EXPLODE_ON_HIT; - explode fengine1 type EXPLODE_ON_HIT; - explode fengine2 type EXPLODE_ON_HIT; - explode rearengines type EXPLODE_ON_HIT; - explode rengine1 type EXPLODE_ON_HIT; - explode rengine2 type EXPLODE_ON_HIT; - explode engine type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/egunship2.cob b/Scripts/egunship2.cob deleted file mode 100644 index 6814abbe7..000000000 Binary files a/Scripts/egunship2.cob and /dev/null differ diff --git a/Scripts/eheavylaserplatform.cob b/Scripts/eheavylaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/eheavylaserplatform.cob and /dev/null differ diff --git a/Scripts/eheavylaserplatform2.cob b/Scripts/eheavylaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/eheavylaserplatform2.cob and /dev/null differ diff --git a/Scripts/eheavymissiletank.bos b/Scripts/eheavymissiletank.bos deleted file mode 100644 index 4d002a34a..000000000 --- a/Scripts/eheavymissiletank.bos +++ /dev/null @@ -1,173 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1, firepoint2; // these are the pieces of the model - - -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 - -static-var terraintype, bmoving; // these are the variables - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn turret to y-axis <0> speed <30>; -turn turret to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <30>; -turn turret to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <30>; -turn turret to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eheavymissiletank.cob b/Scripts/eheavymissiletank.cob deleted file mode 100644 index d6ca55719..000000000 Binary files a/Scripts/eheavymissiletank.cob and /dev/null differ diff --git a/Scripts/eheavytank.bos b/Scripts/eheavytank.bos deleted file mode 100644 index 38ad71dae..000000000 --- a/Scripts/eheavytank.bos +++ /dev/null @@ -1,155 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, flare1, flare2, flare3, flare4; // these are the pieces of the model - -static-var gun_1, terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from flare1; -emit-sfx gdmarty from flare2; -emit-sfx gdmarty from flare3; -emit-sfx gdmarty from flare4; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eheavytank.cob b/Scripts/eheavytank.cob deleted file mode 100644 index c2dbd4a98..000000000 Binary files a/Scripts/eheavytank.cob and /dev/null differ diff --git a/Scripts/eheavytank2.bos b/Scripts/eheavytank2.bos deleted file mode 100644 index 38ad71dae..000000000 --- a/Scripts/eheavytank2.bos +++ /dev/null @@ -1,155 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, flare1, flare2, flare3, flare4; // these are the pieces of the model - -static-var gun_1, terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from flare1; -emit-sfx gdmarty from flare2; -emit-sfx gdmarty from flare3; -emit-sfx gdmarty from flare4; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eheavytank2.cob b/Scripts/eheavytank2.cob deleted file mode 100644 index c2dbd4a98..000000000 Binary files a/Scripts/eheavytank2.cob and /dev/null differ diff --git a/Scripts/eheavytank4.bos b/Scripts/eheavytank4.bos deleted file mode 100644 index a6c8b02d8..000000000 --- a/Scripts/eheavytank4.bos +++ /dev/null @@ -1,152 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - - -piece base, turret, barrel1, firepoint1, dirt; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var gun_1, terraintype, bmoving, moving; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <5000>; -turn barrel1 to x-axis <0> - pitch speed <5000>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx 1024 + 0 from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/eheavytank4.cob b/Scripts/eheavytank4.cob deleted file mode 100644 index ad53c63e8..000000000 Binary files a/Scripts/eheavytank4.cob and /dev/null differ diff --git a/Scripts/eheavyturret.bos b/Scripts/eheavyturret.bos deleted file mode 100644 index 6cb9d6ef8..000000000 --- a/Scripts/eheavyturret.bos +++ /dev/null @@ -1,112 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - - -#define gdhcannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdhcannon from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP3; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type BITMAPONLY | BITMAP3; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type BITMAPONLY | BITMAP3; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type BITMAPONLY | BITMAP3; -explode base type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eheavyturret.cob b/Scripts/eheavyturret.cob deleted file mode 100644 index d6cdb3239..000000000 Binary files a/Scripts/eheavyturret.cob and /dev/null differ diff --git a/Scripts/ehoverfac.bos b/Scripts/ehoverfac.bos index fe06e81c1..d6047a7f5 100644 --- a/Scripts/ehoverfac.bos +++ b/Scripts/ehoverfac.bos @@ -38,28 +38,6 @@ SmokeUnit(healthpercent, sleeptime, smoketype) } } -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-5] speed [50]; - } - else - { - move base to y-axis [-5] speed [50]; - } - if(terraintype == 4) - { - move base to y-axis [-5] speed [50]; - } - else - { - move base to y-axis [-5] speed [50]; - } -} - buildingfx() { while( TRUE ) diff --git a/Scripts/ehoverfac.cob b/Scripts/ehoverfac.cob index 264ef8d14..67ee4dda3 100644 Binary files a/Scripts/ehoverfac.cob and b/Scripts/ehoverfac.cob differ diff --git a/Scripts/einterceptor.bos b/Scripts/einterceptor.bos deleted file mode 100644 index 47d419c97..000000000 --- a/Scripts/einterceptor.bos +++ /dev/null @@ -1,92 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -// Signal definitions -#define SIG_AIM 2 - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from base; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = base; -} - -Create() - { - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/einterceptor.cob b/Scripts/einterceptor.cob deleted file mode 100644 index 356f56868..000000000 Binary files a/Scripts/einterceptor.cob and /dev/null differ diff --git a/Scripts/einterceptor2.bos b/Scripts/einterceptor2.bos deleted file mode 100644 index 6db5a0b67..000000000 --- a/Scripts/einterceptor2.bos +++ /dev/null @@ -1,140 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, firepoint3; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 - -#define gdmarty 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM_4; -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - - - -Create() - { - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/einterceptor2.cob b/Scripts/einterceptor2.cob deleted file mode 100644 index 8e409fe6c..000000000 Binary files a/Scripts/einterceptor2.cob and /dev/null differ diff --git a/Scripts/ejammer.bos b/Scripts/ejammer.bos deleted file mode 100644 index 50940644e..000000000 --- a/Scripts/ejammer.bos +++ /dev/null @@ -1,65 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Create() -{ - spin top around y-axis speed <10.005495>; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} \ No newline at end of file diff --git a/Scripts/ejammer.cob b/Scripts/ejammer.cob deleted file mode 100644 index 8195d8857..000000000 Binary files a/Scripts/ejammer.cob and /dev/null differ diff --git a/Scripts/ejammer2.bos b/Scripts/ejammer2.bos deleted file mode 100644 index 1ae40c51a..000000000 --- a/Scripts/ejammer2.bos +++ /dev/null @@ -1,50 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, topspin, bottomspin; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Create() -{ - spin top around y-axis speed <-15.005495>; - spin topspin around y-axis speed <10.005495>; - spin bottomspin around y-axis speed <-5.005495>; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode topspin type EXPLODE_ON_HIT; - explode bottomspin type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/ejammer2.cob b/Scripts/ejammer2.cob deleted file mode 100644 index 4d93386f6..000000000 Binary files a/Scripts/ejammer2.cob and /dev/null differ diff --git a/Scripts/ejerik.bos b/Scripts/ejerik.bos deleted file mode 100644 index 21d03ac9c..000000000 --- a/Scripts/ejerik.bos +++ /dev/null @@ -1,296 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, firepoint3, firepoint4, firepoint5, firepoint6, firepoint7, firepoint8, missilefirepoint1, exhaust; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define flash 1024+0 -#define flame 1024+1 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from exhaust; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = missilefirepoint1; -} - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint3; -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - -AimWeapon4(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon4() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint4; -} - -AimFromWeapon4(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon4(piecenum) // where the shot is called from -{ -piecenum = firepoint4; -} - -AimWeapon5(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon5() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint5; -} - -AimFromWeapon5(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon5(piecenum) // where the shot is called from -{ -piecenum = firepoint5; -} - -AimWeapon6(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon6() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint6; -} - -AimFromWeapon6(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon6(piecenum) // where the shot is called from -{ -piecenum = firepoint6; -} - -AimWeapon7(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon7() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint7; -} - -AimFromWeapon7(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon7(piecenum) // where the shot is called from -{ -piecenum = firepoint7; -} - -AimWeapon8(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon8() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint8; -} - -AimFromWeapon8(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon8(piecenum) // where the shot is called from -{ -piecenum = firepoint8; -} - -AimWeapon9(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon9() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon9(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon9(piecenum) // where the shot is called from -{ -piecenum = missilefirepoint1; -} - -Create() - { - turn exhaust to y-axis <180> now; - start-script Thrust(); - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/ejerik.cob b/Scripts/ejerik.cob deleted file mode 100644 index 018227119..000000000 Binary files a/Scripts/ejerik.cob and /dev/null differ diff --git a/Scripts/elacerator.bos b/Scripts/elacerator.bos index 4ef948036..f85146de6 100644 --- a/Scripts/elacerator.bos +++ b/Scripts/elacerator.bos @@ -118,8 +118,8 @@ AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to d { signal SIG_AIM; set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <100>; -turn barrel1 to x-axis <0> - pitch speed <150>; +turn turret to y-axis heading now; +turn barrel1 to x-axis <0> - pitch now; wait-for-turn turret around y-axis; wait-for-turn barrel1 around x-axis; start-script RestoreAfterDelay(); diff --git a/Scripts/elacerator.cob b/Scripts/elacerator.cob index 3efe77e8e..19b8b40d2 100644 Binary files a/Scripts/elacerator.cob and b/Scripts/elacerator.cob differ diff --git a/Scripts/elaserbattery.bos b/Scripts/elaserbattery.bos new file mode 100644 index 000000000..3f491915d --- /dev/null +++ b/Scripts/elaserbattery.bos @@ -0,0 +1,116 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, beams, turret, barrel1, firepoint1, firepoint2, firepoint3, firepoint4, lilypad; // these are the pieces of the model + +static-var shooting_num, terraintype; + +// Signal definitions +#define SIG_AIM 2 // this is a aim define <- o_O This is a kill flag + + +// Custom SFX +#define GDMARTY 1024+0 + +SmokeUnit()// this is a standard smoke point define +{ + var healthpercent, sleeptime, smoketype; + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = SFXTYPE_BLACKSMOKE; + if( Rand( 1, 66 ) < healthpercent ) + smoketype = SFXTYPE_WHITESMOKE; + emit-sfx 1026 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + sleeptime = 200; + sleep sleeptime; + } +} + + +setSFXoccupy(setSFXoccupy_argument) +{ +terraintype = setSFXoccupy_argument; + + if(terraintype == 2) + { + move base to y-axis [-0.5] speed [50]; + show lilypad; + } + else + { + move base to y-axis [0] speed [50]; + hide lilypad; + } + if(terraintype == 4) + { + move base to y-axis [0] speed [50]; + hide lilypad; + } + else + { + move base to y-axis [-0.85] speed [50]; + show lilypad; + } +} + + + +Create() // tells it what to do on creation +{ + shooting_num=1; + start-script SmokeUnit(); +} + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +} + +AimWeapon1(heading, pitch) // aiming animation and firing authorization +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + return (1); +} + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ + piecenum = firepoint1; +} + +QueryWeapon1(piecenum) // where the shot is created at +{ + piecenum=firepoint1; +} +/* +TechLost() +{ + CanFire=FALSE; + signal SIG_AIM; + stop-spin turret around y-axis decelerate <10>; + stop-spin barrel1 around x-axis decelerate <10>; +} + +TechGranted() +{ + CanFire=TRUE; +} +*/ +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode beams type EXPLODE_ON_HIT; + explode lilypad type EXPLODE_ON_HIT; +} diff --git a/Scripts/elaserbattery.cob b/Scripts/elaserbattery.cob new file mode 100644 index 000000000..894d0c878 Binary files /dev/null and b/Scripts/elaserbattery.cob differ diff --git a/Scripts/elightlaserplatform.cob b/Scripts/elightlaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/elightlaserplatform.cob and /dev/null differ diff --git a/Scripts/elightlaserplatform2.cob b/Scripts/elightlaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/elightlaserplatform2.cob and /dev/null differ diff --git a/Scripts/elighttank.bos b/Scripts/elighttank.bos deleted file mode 100644 index cec9496e7..000000000 --- a/Scripts/elighttank.bos +++ /dev/null @@ -1,187 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, barrel2, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -turn barrel2 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel2 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/elighttank.cob b/Scripts/elighttank.cob deleted file mode 100644 index dcedf15d1..000000000 Binary files a/Scripts/elighttank.cob and /dev/null differ diff --git a/Scripts/elighttank2.bos b/Scripts/elighttank2.bos deleted file mode 100644 index cec9496e7..000000000 --- a/Scripts/elighttank2.bos +++ /dev/null @@ -1,187 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, barrel2, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -turn barrel2 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel2 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/elighttank2.cob b/Scripts/elighttank2.cob deleted file mode 100644 index dcedf15d1..000000000 Binary files a/Scripts/elighttank2.cob and /dev/null differ diff --git a/Scripts/elightturret.bos b/Scripts/elightturret.bos deleted file mode 100644 index b4570f908..000000000 --- a/Scripts/elightturret.bos +++ /dev/null @@ -1,112 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define gdmarty 1024+0 -#define gdmarty1 1025+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0.000000> speed <30.000000>; -stop-spin barrel1 around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -emit-sfx gdmarty from firepoint1; -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty1 from firepoint1; -spin barrel1 around z-axis speed <120.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode turret type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode turret type BITMAPONLY | BITMAP4; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode turret type BITMAPONLY | BITMAP1; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel1 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/elightturret.cob b/Scripts/elightturret.cob deleted file mode 100644 index 04faf7f5b..000000000 Binary files a/Scripts/elightturret.cob and /dev/null differ diff --git a/Scripts/elobberai.cob b/Scripts/elobberai.cob deleted file mode 100644 index 024b6fc66..000000000 Binary files a/Scripts/elobberai.cob and /dev/null differ diff --git a/Scripts/elrpc.bos b/Scripts/elrpc.bos deleted file mode 100644 index 1a9deeebb..000000000 --- a/Scripts/elrpc.bos +++ /dev/null @@ -1,113 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, sfxpoint1; // these are the pieces of the model - -static-var CanFire; - -// Signal definitions -#define SIG_AIM 2 // this is a aim define <- o_O This is a kill flag - -// Custom SFX -#define gdmarty 1024+0 -#define gdmarty1 1025+0 - -SmokeUnit()// this is a standard smoke point define -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1027 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -cannotfire() -{ - while( TRUE ) - { - if (!CanFire) - { - emit-sfx 1026 from sfxpoint1; - } - sleep 1500; - } -} - -Create() // tells it what to do on creation -{ - CanFire=FALSE; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); - start-script cannotfire(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ - sleep 3000; - turn turret to y-axis <0> speed <60>; - turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // aiming animation and firing authorization -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - while(!CanFire) - sleep 200; - turn turret to y-axis heading speed <225>; - turn barrel1 to x-axis <0> - pitch speed <150>; - wait-for-turn turret around y-axis; - wait-for-turn barrel1 around x-axis; - emit-sfx gdmarty from firepoint1; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - emit-sfx gdmarty1 from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ - piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is created at -{ - piecenum = firepoint1; -} - -TechLost() -{ - CanFire=FALSE; - signal SIG_AIM; - stop-spin turret around y-axis decelerate <10>; - stop-spin barrel1 around x-axis decelerate <10>; -} - -TechGranted() -{ - CanFire=TRUE; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode turret type EXPLODE_ON_HIT; - explode barrel1 type EXPLODE_ON_HIT; -} diff --git a/Scripts/elrpc.cob b/Scripts/elrpc.cob deleted file mode 100644 index cd5d37051..000000000 Binary files a/Scripts/elrpc.cob and /dev/null differ diff --git a/Scripts/emaker.bos b/Scripts/emaker.bos deleted file mode 100644 index d622b9a09..000000000 --- a/Scripts/emaker.bos +++ /dev/null @@ -1,108 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, wheel, door1, door2, top, sfxpoint1; - -static-var statechg_DesiredState, statechg_StateChanging, maeksmoke; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - - -Smoke() -{ - while( TRUE ) - { - if (maeksmoke) - { - emit-sfx 1025 from sfxpoint1; - sleep 500; - } - sleep 500; - } -} - -Smoke2() -{ - while( TRUE ) - { - if (maeksmoke) - { - emit-sfx 1026 from sfxpoint1; - sleep 500; - } - sleep 500; - } -} - -Create() -{ - call-script InitState(); - start-script SmokeUnit(); - start-script Smoke(); - start-script Smoke2(); - turn sfxpoint1 to x-axis <-90> now; -} - - - -Activate() -{ - maeksmoke=1; - turn door1 to x-axis <-90> speed <100>; - turn door2 to x-axis <90> speed <100>; - spin wheel around y-axis speed <100.005495>; - move top to y-axis [8] speed [3]; -} - -Deactivate() -{ - maeksmoke=0; - turn door1 to x-axis <0> speed <10>; - turn door2 to x-axis <0> speed <10>; - stop-spin wheel around y-axis decelerate <30.000000>; - move top to y-axis [0] speed [5]; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode wheel type EXPLODE_ON_HIT; - explode door1 type EXPLODE_ON_HIT; - explode door2 type EXPLODE_ON_HIT; - explode top type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/emaker.cob b/Scripts/emaker.cob deleted file mode 100644 index 06183dc35..000000000 Binary files a/Scripts/emaker.cob and /dev/null differ diff --git a/Scripts/emaker2.bos b/Scripts/emaker2.bos deleted file mode 100644 index 4493a100f..000000000 --- a/Scripts/emaker2.bos +++ /dev/null @@ -1,102 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, accents, rings, struts, sfxpoint1, sfxpoint2, sfxpoint3; - -static-var statechg_DesiredState, statechg_StateChanging, maeksmoke; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - - -Smoke() -{ - while( TRUE ) - { - if (maeksmoke) - { - emit-sfx 1025 from sfxpoint2; - emit-sfx 1025 from sfxpoint3; - sleep 100; - } - sleep 500; - } -} - -Smoke2() -{ - while( TRUE ) - { - if (maeksmoke) - { - emit-sfx 1026 from sfxpoint1; - sleep 500; - } - sleep 500; - } -} - -Create() -{ - call-script InitState(); - start-script SmokeUnit(); - start-script Smoke(); - start-script Smoke2(); - turn sfxpoint1 to x-axis <-90> now; - turn sfxpoint3 to x-axis <180> now; -} - - - -Activate() -{ - maeksmoke=1; -} - -Deactivate() -{ - maeksmoke=0; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode accents type EXPLODE_ON_HIT; - explode rings type EXPLODE_ON_HIT; - explode struts type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/emaker2.cob b/Scripts/emaker2.cob deleted file mode 100644 index 50a5b7796..000000000 Binary files a/Scripts/emaker2.cob and /dev/null differ diff --git a/Scripts/emaker3.bos b/Scripts/emaker3.bos index 31a8a2c13..cc604dfbf 100644 --- a/Scripts/emaker3.bos +++ b/Scripts/emaker3.bos @@ -49,9 +49,9 @@ Smoke() if (maeksmoke) { emit-sfx 1025 from sfxpoint2; - emit-sfx 1025 from sfxpoint3; - emit-sfx 1025 from sfxpoint4; - emit-sfx 1025 from sfxpoint5; + emit-sfx 1026 from sfxpoint3; + emit-sfx 1027 from sfxpoint4; + emit-sfx 1028 from sfxpoint5; sleep 100; } sleep 500; @@ -64,7 +64,7 @@ Smoke2() { if (maeksmoke) { - emit-sfx 1026 from sfxpoint1; + emit-sfx 1029 from sfxpoint1; sleep 500; } sleep 500; diff --git a/Scripts/emaker3.cob b/Scripts/emaker3.cob index 9979b0259..a6f4c6672 100644 Binary files a/Scripts/emaker3.cob and b/Scripts/emaker3.cob differ diff --git a/Scripts/emediumlaserplatform.cob b/Scripts/emediumlaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/emediumlaserplatform.cob and /dev/null differ diff --git a/Scripts/emediumlaserplatform2.cob b/Scripts/emediumlaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/emediumlaserplatform2.cob and /dev/null differ diff --git a/Scripts/emediumtank.bos b/Scripts/emediumtank.bos deleted file mode 100644 index 487feb544..000000000 --- a/Scripts/emediumtank.bos +++ /dev/null @@ -1,149 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/emediumtank.cob b/Scripts/emediumtank.cob deleted file mode 100644 index 38352bb5b..000000000 Binary files a/Scripts/emediumtank.cob and /dev/null differ diff --git a/Scripts/emediumtank2.bos b/Scripts/emediumtank2.bos deleted file mode 100644 index 487feb544..000000000 --- a/Scripts/emediumtank2.bos +++ /dev/null @@ -1,149 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/emediumtank2.cob b/Scripts/emediumtank2.cob deleted file mode 100644 index 38352bb5b..000000000 Binary files a/Scripts/emediumtank2.cob and /dev/null differ diff --git a/Scripts/emediumtank3.bos b/Scripts/emediumtank3.bos deleted file mode 100644 index 6b909046c..000000000 --- a/Scripts/emediumtank3.bos +++ /dev/null @@ -1,154 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, dirt; // these are the pieces of the model - -#include "ROCKUNIT.H" - -static-var terraintype, bmoving, moving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/emediumtank3.cob b/Scripts/emediumtank3.cob deleted file mode 100644 index 4f23899b0..000000000 Binary files a/Scripts/emediumtank3.cob and /dev/null differ diff --git a/Scripts/emetalextractormk1.bos b/Scripts/emetalextractormk1.bos new file mode 100644 index 000000000..3581cd736 --- /dev/null +++ b/Scripts/emetalextractormk1.bos @@ -0,0 +1,165 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, pivotpoint, sfxpoint1, armleft, armright, armfront, armrear, tech1, tech2, tech3, tech4; + +static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging, ball1state, ball2state, ball3state, ball4state, ballstate; + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Go() +{ + spin pivotpoint around y-axis speed <50> accelerate <10>; + ballstate = 1; + turn armfront to x-axis <60> speed <15>; + turn armrear to x-axis <-60> speed <15>; + turn armleft to z-axis <60> speed <15>; + turn armright to z-axis <-60> speed <15>; +} + +Stop() +{ + stop-spin pivotpoint around y-axis decelerate <25>; + wait-for-turn pivotpoint around y-axis; + ballstate = 0; + turn armfront to x-axis <0> speed <50>; + turn armrear to x-axis <0> speed <50>; + turn armleft to z-axis <0> speed <50>; + turn armright to z-axis <0> speed <50>; +} + +InitState() +{ + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState == 0 ) + { + call-script Go(); + currentstate = 0; + } + if( statechg_DesiredState == 1 ) + { + call-script Stop(); + currentstate = 1; + } + } + statechg_StateChanging = FALSE; +} + + + +fx() +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { +// if (tech) +// { + emit-sfx 1027 from tech1; +// } + sleep 500; + } +} + + +fx2() +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { +// if (tech) +// { + emit-sfx 1026 from sfxpoint1; +// } + sleep 500; + } +} + + +Create() +{ + start-script fx(); + start-script fx2(); + hide tech2; + hide tech3; + hide tech4; + Static_Var_1 = 0; + Static_Var_2 = 75; + Static_Var_3 = 50; + turn sfxpoint1 to x-axis <-90> now; + call-script InitState(); + start-script SmokeUnit(); +} + +Activate() +{ + start-script RequestState(0); +} + +Deactivate() +{ + start-script RequestState(1); +} + + +SetSpeed(Func_Var_1) +{ + Static_Var_1 = Func_Var_1 * 5; +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode armleft type EXPLODE_ON_HIT; + explode armright type EXPLODE_ON_HIT; + explode armfront type EXPLODE_ON_HIT; + explode armrear type EXPLODE_ON_HIT; +} diff --git a/Scripts/emetalextractormk1.cob b/Scripts/emetalextractormk1.cob new file mode 100644 index 000000000..7e91d06dd Binary files /dev/null and b/Scripts/emetalextractormk1.cob differ diff --git a/Scripts/emetalextractornk1.cob b/Scripts/emetalextractornk1.cob new file mode 100644 index 000000000..7e91d06dd Binary files /dev/null and b/Scripts/emetalextractornk1.cob differ diff --git a/Scripts/emex.cob b/Scripts/emex.cob deleted file mode 100644 index 01ae649c1..000000000 Binary files a/Scripts/emex.cob and /dev/null differ diff --git a/Scripts/emex2.bos b/Scripts/emex2.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/emex2.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/emex2.cob b/Scripts/emex2.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/emex2.cob and /dev/null differ diff --git a/Scripts/emex2up1.bos b/Scripts/emex2up1.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/emex2up1.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/emex2up1.cob b/Scripts/emex2up1.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/emex2up1.cob and /dev/null differ diff --git a/Scripts/emex2up2.bos b/Scripts/emex2up2.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/emex2up2.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/emex2up2.cob b/Scripts/emex2up2.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/emex2up2.cob and /dev/null differ diff --git a/Scripts/emex2up3.bos b/Scripts/emex2up3.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/emex2up3.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/emex2up3.cob b/Scripts/emex2up3.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/emex2up3.cob and /dev/null differ diff --git a/Scripts/emexmoho.cob b/Scripts/emexmoho.cob deleted file mode 100644 index 01ae649c1..000000000 Binary files a/Scripts/emexmoho.cob and /dev/null differ diff --git a/Scripts/emissilesiloemp.cob b/Scripts/emissilesiloemp.cob deleted file mode 100644 index 182790095..000000000 Binary files a/Scripts/emissilesiloemp.cob and /dev/null differ diff --git a/Scripts/emissiletank.bos b/Scripts/emissiletank.bos deleted file mode 100644 index 2f496c952..000000000 --- a/Scripts/emissiletank.bos +++ /dev/null @@ -1,170 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, firepoint2, sfxpoint1; // these are the pieces of the model - -static-var gun_1, terraintype, bmoving, moving, shooting_num; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from sfxpoint1; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn barrel1 to x-axis <-90> speed <800>; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - - if(shooting_num==1) - { - emit-sfx 1024 from firepoint2; - } - - if(shooting_num==2) - { - emit-sfx 1024 from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 3) - { - shooting_num=1; - } -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if (shooting_num==1) - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; -} diff --git a/Scripts/emissiletank.cob b/Scripts/emissiletank.cob deleted file mode 100644 index 92df7722d..000000000 Binary files a/Scripts/emissiletank.cob and /dev/null differ diff --git a/Scripts/emissletank.cob b/Scripts/emissletank.cob deleted file mode 100644 index 87170db17..000000000 Binary files a/Scripts/emissletank.cob and /dev/null differ diff --git a/Scripts/emptower.bos b/Scripts/emptower.bos deleted file mode 100644 index 058a85cdb..000000000 --- a/Scripts/emptower.bos +++ /dev/null @@ -1,217 +0,0 @@ -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - -static-var firing; // these are the variables - -#define ELECTRICITY 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 -#define SIG_AIM_8 16 -#define SIG_AIM_16 32 -#define SIG_AIM_32 64 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -LightningThing() -{ -while (1) -{ -emit-sfx ELECTRICITY from firepoint1; -sleep 500; -} -} - -Create() // tells it what to do on creation -{ -start-script LightningThing(); -start-script SmokeUnit(); -} - - -AimWeapon1(heading, pitch) -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() -{ -} - -AimFromWeapon2(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon2(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon3(heading, pitch) -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon3() -{ -} - -AimFromWeapon3(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon3(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon4(heading, pitch) -{ -signal SIG_AIM_8; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon4() -{ -} - -AimFromWeapon4(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon4(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon5(heading, pitch) -{ -signal SIG_AIM_16; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon5() -{ -} - -AimFromWeapon5(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon5(piecenum) -{ -piecenum = firepoint1; -} - - -AimWeapon6(heading, pitch) -{ -signal SIG_AIM_32; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon6() -{ -} - -AimFromWeapon6(piecenum) -{ -piecenum = firepoint1; -} - -QueryWeapon6(piecenum) -{ -piecenum = firepoint1; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} \ No newline at end of file diff --git a/Scripts/emptower.cob b/Scripts/emptower.cob deleted file mode 100644 index b5413f42d..000000000 Binary files a/Scripts/emptower.cob and /dev/null differ diff --git a/Scripts/engineer.bos b/Scripts/engineer.bos deleted file mode 100644 index 09d1977a4..000000000 --- a/Scripts/engineer.bos +++ /dev/null @@ -1,219 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece engineer, nano1, nano2, nano3; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype; - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from engineer; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - turn engineer to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn engineer around y-axis; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn engineer to y-axis <0.000000> speed <160.000000>; - wait-for-turn engineer around y-axis; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from engineer; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move engineer to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move engineer to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move engineer to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move engineer to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -StartBuilding(Func_Var_1) -{ - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nano1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nano2; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nano3; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -SweetSpot(piecenum) -{ - piecenum = engineer; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode engineer type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode engineer type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode engineer type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode engineer type BITMAPONLY | BITMAP2; -} diff --git a/Scripts/engineermarbuk.cob b/Scripts/engineermarbuk.cob deleted file mode 100644 index 384544336..000000000 Binary files a/Scripts/engineermarbuk.cob and /dev/null differ diff --git a/Scripts/eorb.bos b/Scripts/eorb.bos deleted file mode 100644 index d6365ddc9..000000000 --- a/Scripts/eorb.bos +++ /dev/null @@ -1,241 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, ring, turret, barrel1, nano1, sfxpoint1, dirt; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building, moving; - -#define nanoflame 1024+0 -#define SIG_AIM_2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Buildingfx() -{ - while(building) - { - - emit-sfx 2048 from nano1; - - sleep 5; - } -} - -buildflame() -{ - while(building) - { - - emit-sfx nanoflame from nano1; - - sleep 600; - } -} - -Go() -{ - turn turret to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn turret around y-axis; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn turret to y-axis <0.000000> speed <160.000000>; - wait-for-turn turret around y-axis; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = dirt; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = dirt; -} - - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script Thrust(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); - spin ring around y-axis speed <100>; - start-script Buildingfx(); - start-script buildflame(); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); - stop-spin ring around y-axis decelerate <15>; -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nano1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nano1; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nano1; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode base type EXPLODE_ON_HIT; - explode ring type EXPLODE_ON_HIT; -} diff --git a/Scripts/eorb.cob b/Scripts/eorb.cob deleted file mode 100644 index d178ede8a..000000000 Binary files a/Scripts/eorb.cob and /dev/null differ diff --git a/Scripts/eorb2.bos b/Scripts/eorb2.bos deleted file mode 100644 index 99283bf84..000000000 --- a/Scripts/eorb2.bos +++ /dev/null @@ -1,205 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, fins, nanopoint1; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building, moving; - -#define nanoflame 1024+0 -#define SIG_AIM_2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1026 from fins; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -buildflame() -{ - while(building) - { - - emit-sfx nanoflame from nanopoint1; - - sleep 600; - } -} - -Go() -{ -/* turn turret to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn turret around y-axis; */ - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ -/* turn turret to y-axis <0.000000> speed <160.000000>; - wait-for-turn turret around y-axis; */ - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from base; - } - sleep 400; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script Thrust(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); - spin fins around y-axis speed <100>; -/* start-script Buildingfx(); */ - start-script buildflame(); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); - stop-spin fins around y-axis decelerate <15>; -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nanopoint1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nanopoint1; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nanopoint1; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; - moving=1; -} - -StopMoving() -{ - bMoving = FALSE; - moving=0; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode fins type EXPLODE_ON_HIT; -} diff --git a/Scripts/eorb2.cob b/Scripts/eorb2.cob deleted file mode 100644 index 228cad683..000000000 Binary files a/Scripts/eorb2.cob and /dev/null differ diff --git a/Scripts/eradar.cob b/Scripts/eradar.cob deleted file mode 100644 index 1d1feecab..000000000 Binary files a/Scripts/eradar.cob and /dev/null differ diff --git a/Scripts/eradar2.bos b/Scripts/eradar2.bos deleted file mode 100644 index ff784ebd8..000000000 --- a/Scripts/eradar2.bos +++ /dev/null @@ -1,66 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top; - -static-var statechg_DesiredState, statechg_StateChanging; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -radaranimation() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - spin top around y-axis speed <25> accelerate <5>; -sleep 400; -} -} -} - - -Create() -{ - start-script radaranimation(); - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode top type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/eradar2.cob b/Scripts/eradar2.cob deleted file mode 100644 index 8ee5a3a75..000000000 Binary files a/Scripts/eradar2.cob and /dev/null differ diff --git a/Scripts/eresearch.cob b/Scripts/eresearch.cob deleted file mode 100644 index c0e97da71..000000000 Binary files a/Scripts/eresearch.cob and /dev/null differ diff --git a/Scripts/eriottank.bos b/Scripts/eriottank.bos deleted file mode 100644 index 2c929a67c..000000000 --- a/Scripts/eriottank.bos +++ /dev/null @@ -1,147 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1; // these are the pieces of the model - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -#define SIG_AIM 2 // this is a aim define - -static-var terraintype, bmoving; // these are the variables - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn turret to y-axis <0> speed <30>; -turn turret to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <30>; -turn turret to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/eriottank.cob b/Scripts/eriottank.cob deleted file mode 100644 index ef47a2920..000000000 Binary files a/Scripts/eriottank.cob and /dev/null differ diff --git a/Scripts/eriottank2.bos b/Scripts/eriottank2.bos deleted file mode 100644 index ab56a40d8..000000000 --- a/Scripts/eriottank2.bos +++ /dev/null @@ -1,182 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1, dirt, magazine, barrel1; // these are the pieces of the model - -#include "ROCKUNIT.H" - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -#define SIG_AIM 2 // this is a aim define - -static-var terraintype, bmoving, moving; // these are the variables - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1026 from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn turret to y-axis <0> speed <255>; -turn barrel1 to x-axis <0> speed <255>; -stop-spin magazine around z-axis decelerate <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <255>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -spin magazine around z-axis speed <100>; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -// start-script RestoreAfterDelay(); -spin magazine around z-axis speed <100>; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode barrel1 type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode magazine type EXPLODE_ON_HIT; -} diff --git a/Scripts/eriottank2.cob b/Scripts/eriottank2.cob deleted file mode 100644 index a329602c2..000000000 Binary files a/Scripts/eriottank2.cob and /dev/null differ diff --git a/Scripts/escout.bos b/Scripts/escout.bos deleted file mode 100644 index 3ae29cefd..000000000 --- a/Scripts/escout.bos +++ /dev/null @@ -1,75 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, flare; - -static-var moving; - -#define jethtrail 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from flare; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - - -Create() - { -// turn flare to y-axis <180> now; -// start-script Thrust(); - start-script SmokeUnit(); - } - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; -} \ No newline at end of file diff --git a/Scripts/escout.cob b/Scripts/escout.cob deleted file mode 100644 index d6f443de7..000000000 Binary files a/Scripts/escout.cob and /dev/null differ diff --git a/Scripts/eshieldgen.bos b/Scripts/eshieldgen.bos deleted file mode 100644 index 2bfadf721..000000000 --- a/Scripts/eshieldgen.bos +++ /dev/null @@ -1,150 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, ring; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx 1024 from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2050 from firepoint1; - sleep 30; - } -} - - -Create() // tells it what to do on creation -{ - start-script SmokeUnit(); -// start-script fx(); - - spin ring around y-axis speed <150.005495>; -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <-90> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = base; -} - -/* -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx 2049 from firepoint1; -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} -*/ - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode turret type EXPLODE_ON_HIT; - explode barrel1 type EXPLODE_ON_HIT; - explode ring type EXPLODE_ON_HIT; -} diff --git a/Scripts/eshieldgen.cob b/Scripts/eshieldgen.cob deleted file mode 100644 index 422cbeded..000000000 Binary files a/Scripts/eshieldgen.cob and /dev/null differ diff --git a/Scripts/eshieldgen2.bos b/Scripts/eshieldgen2.bos new file mode 100644 index 000000000..57fc4bc74 --- /dev/null +++ b/Scripts/eshieldgen2.bos @@ -0,0 +1,147 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, firepoint1, spinner; // these are the pieces of the model + +static-var terraintype, bmoving, moving; // these are the variables + +// #define gdscannon 1024+0 // this is a custom explosion generator thinging + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 // this is a aim define + +SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define +{ +while( get BUILD_PERCENT_LEFT ) +{ +sleep 400; +} +while( TRUE ) +{ +healthpercent = get HEALTH; +if( healthpercent < 66 ) +{ +smoketype = 256 | 2; +if( Rand( 1, 66 ) < healthpercent ) +{ +smoketype = 256 | 1; +} +emit-sfx 1024 from spinner; +} +sleeptime = healthpercent * 50; +if( sleeptime < 200 ) +{ +sleeptime = 200; +} +sleep sleeptime; +} +} + + +fx() +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + emit-sfx 2050 from firepoint1; + sleep 30; + } +} + + +Create() // tells it what to do on creation +{ + start-script SmokeUnit(); +// start-script fx(); + + spin spinner around y-axis speed <150.005495>; +} + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +sleep 3000; +} + +AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM; +set-signal-mask SIG_AIM; +return (1); +} + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ +piecenum = firepoint1; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ +piecenum = firepoint1; +} + +AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM; +set-signal-mask SIG_AIM; +return (1); +} + +FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets +{ +} + +AimFromWeapon2(piecenum) // where it aims the weapon from +{ +piecenum = base; +} + +QueryWeapon2(piecenum) // where the shot is called from +{ +piecenum = base; +} + +/* +AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM_2; +set-signal-mask SIG_AIM_2; +turn turret to y-axis heading speed <255>; +turn barrel1 to x-axis <0> - pitch speed <150>; +wait-for-turn turret around y-axis; +wait-for-turn barrel1 around x-axis; +start-script RestoreAfterDelay(); +return (1); +} + +FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets +{ +emit-sfx 2049 from firepoint1; +} + +AimFromWeapon3(piecenum) // where it aims the weapon from +{ +piecenum = barrel1; +} + +QueryWeapon3(piecenum) // where the shot is called from +{ +piecenum = firepoint1; +} +*/ + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode spinner type EXPLODE_ON_HIT; +} diff --git a/Scripts/eshieldgen2.cob b/Scripts/eshieldgen2.cob new file mode 100644 index 000000000..cacf2bf33 Binary files /dev/null and b/Scripts/eshieldgen2.cob differ diff --git a/Scripts/esilo.bos b/Scripts/esilo.bos deleted file mode 100644 index 848f7b3b7..000000000 --- a/Scripts/esilo.bos +++ /dev/null @@ -1,121 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, wheel1, wheel2, door1, door2, nuke, firepoint1, sfxpoint1; // these are the pieces of the model - -static-var CanFire; - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit()// this is a standard smoke point define -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -cannotfire() -{ - while( TRUE ) - { - if (!CanFire) - { - emit-sfx 1024 from sfxpoint1; - } - sleep 1500; - } -} - -Create() // tells it what to do on creation -{ - CanFire=FALSE; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); - start-script cannotfire(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -stop-spin wheel1 around z-axis decelerate <5.000000>; -stop-spin wheel2 around z-axis decelerate <5.000000>; - turn door1 to z-axis <0> speed <50>; - turn door2 to z-axis <0> speed <50>; - move nuke to y-axis [0] speed [10]; - wait-for-turn door1 around z-axis; - wait-for-turn door2 around z-axis; - wait-for-move nuke along y-axis; - show nuke; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; - while(!CanFire) - sleep 200; - turn door1 to z-axis <90> speed <100>; - turn door2 to z-axis <-90> speed <100>; - spin wheel1 around z-axis speed <100.005495>; - spin wheel2 around z-axis speed <100.005495>; - move nuke to y-axis [40] speed [10]; - wait-for-turn door1 around z-axis; - wait-for-turn door2 around z-axis; - wait-for-move nuke along y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -hide nuke; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -TechLost() -{ - CanFire=FALSE; - signal SIG_AIM; - -} - -TechGranted() -{ - CanFire=TRUE; -} - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode wheel1 type EXPLODE_ON_HIT; - explode wheel2 type EXPLODE_ON_HIT; - explode door1 type EXPLODE_ON_HIT; - explode door2 type EXPLODE_ON_HIT; - explode nuke type EXPLODE_ON_HIT; -} diff --git a/Scripts/esilo.cob b/Scripts/esilo.cob deleted file mode 100644 index f07bf2c20..000000000 Binary files a/Scripts/esilo.cob and /dev/null differ diff --git a/Scripts/esolar.bos b/Scripts/esolar.bos deleted file mode 100644 index 3ae3c8d89..000000000 --- a/Scripts/esolar.bos +++ /dev/null @@ -1,71 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece solar; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from solar; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Create() -{ - - start-script SmokeUnit(); -} - -SweetSpot(piecenum) -{ - piecenum = solar; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode solar type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode solar type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode solar type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode solar type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/esolar.cob b/Scripts/esolar.cob deleted file mode 100644 index 928ea393c..000000000 Binary files a/Scripts/esolar.cob and /dev/null differ diff --git a/Scripts/especialfactory.cob b/Scripts/especialfactory.cob deleted file mode 100644 index 6496ec6c0..000000000 Binary files a/Scripts/especialfactory.cob and /dev/null differ diff --git a/Scripts/estealthbomber.bos b/Scripts/estealthbomber.bos deleted file mode 100644 index 9270b3b84..000000000 --- a/Scripts/estealthbomber.bos +++ /dev/null @@ -1,143 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, flare1; - -static-var gun_1, gun_2, moving; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define jethtrail 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from flare1; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Create() - { - start-script Thrust(); - turn flare1 to y-axis <180> now; - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/estealthbomber.cob b/Scripts/estealthbomber.cob deleted file mode 100644 index f6336426c..000000000 Binary files a/Scripts/estealthbomber.cob and /dev/null differ diff --git a/Scripts/estealthbomber2.bos b/Scripts/estealthbomber2.bos deleted file mode 100644 index 37ea07c12..000000000 --- a/Scripts/estealthbomber2.bos +++ /dev/null @@ -1,143 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, flare1; - -static-var gun_1, gun_2, moving; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define jethtrail 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx jethtrail from flare1; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Create() - { - start-script Thrust(); - turn flare1 to y-axis <180> now; - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/estealthbomber2.cob b/Scripts/estealthbomber2.cob deleted file mode 100644 index f6336426c..000000000 Binary files a/Scripts/estealthbomber2.cob and /dev/null differ diff --git a/Scripts/estorage.bos b/Scripts/estorage.bos deleted file mode 100644 index 5f8031018..000000000 --- a/Scripts/estorage.bos +++ /dev/null @@ -1,86 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, sfxpoint1; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1024 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1025 from sfxpoint1; -// } - sleep 500; - } -} - - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1026 from sfxpoint1; -// } - sleep 500; - } -} - - -Create() -{ - start-script fx(); - start-script fx2(); - turn sfxpoint1 to x-axis <-90> now; - spin top around y-axis speed <50.005495>; - start-script SmokeUnit(); -} - - - -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; -} diff --git a/Scripts/estorage.cob b/Scripts/estorage.cob deleted file mode 100644 index 53869106b..000000000 Binary files a/Scripts/estorage.cob and /dev/null differ diff --git a/Scripts/estorage2.bos b/Scripts/estorage2.bos index 9e0fa44e5..12066ff44 100644 --- a/Scripts/estorage2.bos +++ b/Scripts/estorage2.bos @@ -46,7 +46,7 @@ fx() // if (tech) // { emit-sfx 1025 from sfxpoint1; - emit-sfx 1025 from sfxpoint3; + emit-sfx 1026 from sfxpoint3; // } sleep 500; } @@ -63,7 +63,7 @@ fx2() { // if (tech) // { - emit-sfx 1026 from sfxpoint2; + emit-sfx 1027 from sfxpoint2; // } sleep 500; } diff --git a/Scripts/estorage2.cob b/Scripts/estorage2.cob index 7f4558323..6aa111587 100644 Binary files a/Scripts/estorage2.cob and b/Scripts/estorage2.cob differ diff --git a/Scripts/esubmarine.bos b/Scripts/esubmarine.bos deleted file mode 100644 index 619667ddd..000000000 --- a/Scripts/esubmarine.bos +++ /dev/null @@ -1,124 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, rightwing, leftwing, rearrightwing, rearleftwing, firepoint1, engines; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 - -#define flame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from engines; - - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Create() - { - start-script SmokeUnit(); -// move base to y-axis [10] speed [5]; -// emit-sfx 1025 + 0 from base; - turn engines to y-axis <180> now; - turn rearrightwing to z-axis <90> speed <10>; - turn rearleftwing to z-axis <-90> speed <10>; - turn rightwing to y-axis <-90> speed <10>; - turn leftwing to y-axis <90> speed <10>; - start-script Thrust(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/esubmarine.cob b/Scripts/esubmarine.cob deleted file mode 100644 index b49f67ec7..000000000 Binary files a/Scripts/esubmarine.cob and /dev/null differ diff --git a/Scripts/esubplane.bos b/Scripts/esubplane.bos deleted file mode 100644 index ea5b95562..000000000 --- a/Scripts/esubplane.bos +++ /dev/null @@ -1,118 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, rightwing, leftwing, rearrightwing, rearleftwing, firepoint1, engines; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 - -#define flame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from engines; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Create() - { - start-script SmokeUnit(); -// turn engines to y-axis <180> now; -// start-script Thrust(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/esubplane.cob b/Scripts/esubplane.cob deleted file mode 100644 index cda8f5daa..000000000 Binary files a/Scripts/esubplane.cob and /dev/null differ diff --git a/Scripts/etransport.bos b/Scripts/etransport.bos deleted file mode 100644 index 498441bf4..000000000 --- a/Scripts/etransport.bos +++ /dev/null @@ -1,156 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, link, engine1, engine2, wingsfront, wingsrear, tail; - -static-var Static_Var_1, unitviewer, statechg_DesiredState, statechg_StateChanging, moving; - -// Signal definitions -#define SIG_MOVE 4 -#define flame 1024+0 - - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx 1025 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from engine1; - emit-sfx flame from engine2; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -MoveRate0() -{ - turn tail to x-axis <-90.000000> speed <150.000000>; - turn wingsfront to x-axis <-90.000000> speed <150.000000>; - turn wingsrear to x-axis <-90.000000> speed <150.000000>; -} -MoveRate1() -{ - - turn wingsfront to x-axis <-70.005495> speed <150.000000>; - turn wingsrear to x-axis <-70.005495> speed <150.000000>; -} -MoveRate2() -{ - turn tail to x-axis <0.000000> speed <150.000000>; - turn wingsfront to x-axis <0.000000> speed <150.000000>; - turn wingsrear to x-axis <0.000000> speed <150.000000>; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - unitviewer = FALSE; - call-script InitState(); -// turn engine1 to y-axis <180> now; -// turn engine2 to y-axis <180> now; - turn tail to x-axis <-90> now; - turn wingsfront to x-axis <-90> now; - turn wingsrear to x-axis <-90> now; -// start-script Thrust(); - start-script SmokeUnit(); -} - -QueryTransport(Func_Var_1) -{ - Func_Var_1 = 1; -} - -BeginTransport(Func_Var_1) -{ - move link to y-axis [0.000000] - Func_Var_1 now; -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -EndTransport() -{ -} - -Killed(severity, corpsetype) // how it explodes -{ - -} diff --git a/Scripts/etransport.cob b/Scripts/etransport.cob deleted file mode 100644 index 48b5dd614..000000000 Binary files a/Scripts/etransport.cob and /dev/null differ diff --git a/Scripts/euwfusion2.bos b/Scripts/euwfusion2.bos deleted file mode 100644 index 3a248bcdc..000000000 --- a/Scripts/euwfusion2.bos +++ /dev/null @@ -1,112 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -static-var Static_Var_1, tech; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 2048 from firepoint1; -// } - sleep 32; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 1024 from firepoint1; -// } - sleep 100; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn firepoint1 to x-axis <-90> now; - start-script SmokeUnit(); -} -/* -TechLost() -{ - set ACTIVATION to 0; - tech=FALSE; -} - -TechGranted() -{ - set ACTIVATION to 1; - tech=TRUE; -} -*/ -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/euwfusion2.cob b/Scripts/euwfusion2.cob deleted file mode 100644 index 001e614f5..000000000 Binary files a/Scripts/euwfusion2.cob and /dev/null differ diff --git a/Scripts/euwmetalextractor.bos b/Scripts/euwmetalextractor.bos deleted file mode 100644 index 966a0c9a1..000000000 --- a/Scripts/euwmetalextractor.bos +++ /dev/null @@ -1,168 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, pivotpoint, sfxpoint1; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging, ball1state, ball2state, ball3state, ball4state, ballstate; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin pivotpoint around y-axis speed <100> accelerate <10>; - ballstate = 1; -} - -Stop() -{ - stop-spin pivotpoint around y-axis decelerate <25>; - wait-for-turn pivotpoint around y-axis; - ballstate = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from sfxpoint1; - - sleep 32; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - - emit-sfx 1024 from sfxpoint1; - sleep 400; - } -} - - -Create() -{ - start-script fx(); - start-script fx2(); - Static_Var_1 = 0; - Static_Var_2 = 75; - Static_Var_3 = 50; - turn sfxpoint1 to x-axis <-90> now; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode pivotpoint type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode pivotpoint type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode pivotpoint type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode pivotpoint type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/euwmetalextractor.cob b/Scripts/euwmetalextractor.cob deleted file mode 100644 index 574f0d949..000000000 Binary files a/Scripts/euwmetalextractor.cob and /dev/null differ diff --git a/Scripts/euwsolar2.bos b/Scripts/euwsolar2.bos deleted file mode 100644 index 94236b0c0..000000000 --- a/Scripts/euwsolar2.bos +++ /dev/null @@ -1,113 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, nub, firepoint1; - -static-var Static_Var_1, tech; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - emit-sfx 2048 from firepoint1; -// } - sleep 32; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -// if (tech) -// { - spin nub around y-axis speed <50.005495>; - emit-sfx 1024 from firepoint1; -// } - sleep 100; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn firepoint1 to x-axis <-90> now; - start-script SmokeUnit(); -} -/* -TechLost() -{ - set ACTIVATION to 0; - tech=FALSE; -} - -TechGranted() -{ - set ACTIVATION to 1; - tech=TRUE; -} -*/ -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/euwsolar2.cob b/Scripts/euwsolar2.cob deleted file mode 100644 index 2905e07ef..000000000 Binary files a/Scripts/euwsolar2.cob and /dev/null differ diff --git a/Scripts/euwstorage.bos b/Scripts/euwstorage.bos deleted file mode 100644 index 22121644e..000000000 --- a/Scripts/euwstorage.bos +++ /dev/null @@ -1,98 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, sfxpoint1; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from sfxpoint1; - sleep 32; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from sfxpoint1; - sleep 100; - } -} - - -Create() -{ - start-script fx(); - start-script fx2(); - turn sfxpoint1 to x-axis <-90> now; - spin top around y-axis speed <50.005495>; - start-script SmokeUnit(); -} - - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/euwstorage.cob b/Scripts/euwstorage.cob deleted file mode 100644 index b9d5edd2b..000000000 Binary files a/Scripts/euwstorage.cob and /dev/null differ diff --git a/Scripts/euwturret.bos b/Scripts/euwturret.bos deleted file mode 100644 index 17b5a73ea..000000000 --- a/Scripts/euwturret.bos +++ /dev/null @@ -1,141 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel, firepoint1, firepoint2; // these are the pieces of the model - -static-var CanFire, shooting_num; - -// Signal definitions -#define SIG_AIM 2 // this is a aim define <- o_O This is a kill flag - - -// Custom SFX -#define GDMARTY 1024+0 - -SmokeUnit()// this is a standard smoke point define -{ - var healthpercent, sleeptime, smoketype; - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = SFXTYPE_BLACKSMOKE; - if( Rand( 1, 66 ) < healthpercent ) - smoketype = SFXTYPE_WHITESMOKE; - emit-sfx 1026 from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - sleeptime = 200; - sleep sleeptime; - } -} - -cannotfire() -{ - while( TRUE ) - { - if (!CanFire) - { - emit-sfx 1025 from base; - } - sleep 1500; - } -} - -Create() // tells it what to do on creation -{ - CanFire=TRUE; - shooting_num=1; - while( get BUILD_PERCENT_LEFT ) - sleep 400; - start-script SmokeUnit(); - start-script cannotfire(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ - sleep 3000; - turn turret to y-axis <0> speed <60>; - turn barrel to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // aiming animation and firing authorization -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - while(!CanFire) - sleep 200; - turn turret to y-axis heading speed <5000>; - turn barrel to x-axis <0> - pitch speed <5000>; - wait-for-turn turret around y-axis; - wait-for-turn barrel around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ - - if(shooting_num==1) - { - emit-sfx GDMARTY from firepoint2; - } - - if(shooting_num==2) - { - emit-sfx GDMARTY from firepoint1; - } - - shooting_num=shooting_num+1; - - if( shooting_num == 3) - { - shooting_num=1; - } - -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ - piecenum = barrel; -} - -QueryWeapon1(piecenum) // where the shot is created at -{ - - if (shooting_num==1) - { - piecenum=firepoint1; - } - - if (shooting_num==2) - { - piecenum=firepoint2; - } - -} -/* -TechLost() -{ - CanFire=FALSE; - signal SIG_AIM; - stop-spin turret around y-axis decelerate <10>; - stop-spin barrel around x-axis decelerate <10>; -} - -TechGranted() -{ - CanFire=TRUE; -} -*/ -Killed(severity, corpsetype) // how it explodes -{ - corpsetype = 1; - explode base type EXPLODE_ON_HIT; - explode turret type EXPLODE_ON_HIT; - explode barrel type EXPLODE_ON_HIT; -} diff --git a/Scripts/euwturret.cob b/Scripts/euwturret.cob deleted file mode 100644 index 7f114482d..000000000 Binary files a/Scripts/euwturret.cob and /dev/null differ diff --git a/Scripts/f2engineer_lus.lua b/Scripts/f2engineer_lus.lua new file mode 100644 index 000000000..85f1accf9 --- /dev/null +++ b/Scripts/f2engineer_lus.lua @@ -0,0 +1,65 @@ +base, spinner, nano1, dirt = piece('base', 'spinner', 'nano1', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, spinner}) + StartThread(BuildFX) + building = false +end + +common = include("headers/common_includes_lus.lua") + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + +function BuildFX() + while(building == true) do + EmitSfx (nano1, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(base, y_axis, 0, 5) + end +end + +local nanoPoints = {nano1} + +Spring.SetUnitNanoPieces(unitID, nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + SetUnitValue(COB.INBUILDSTANCE, true) + building = true + StartThread(BuildFX) +end + +function script.StopBuilding() + -- TODO: This is where you would add your pack-up animation + SetUnitValue(COB.INBUILDSTANCE, false) + building = false + StartThread(RestoreAfterDelay) +end + +function script.Killed() + Explode(spinner, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos +end \ No newline at end of file diff --git a/Scripts/f3.BOS b/Scripts/f3.BOS deleted file mode 100644 index b080b5f32..000000000 --- a/Scripts/f3.BOS +++ /dev/null @@ -1,63 +0,0 @@ -piece GP, base, turret, pillar, fire1; - -#define SIG_AIM_1 2 -#define SIG_AIM_2 4 - -#define f3 1024+0 -Create() -{ hide fire1; } - -AimFromWeapon1(piecenum) -{ piecenum=turret; } - -QueryWeapon1(piecenum) -{ piecenum=fire1; } - -QueryWeapon2(piecenum) -{ piecenum=fire1; } - -AimWeapon1(heading,pitch) -{ - signal SIG_AIM_1; - set-signal-mask SIG_AIM_1; - - turn pillar to y-axis heading speed <256>; - turn turret to x-axis (0-pitch) speed <150>; - wait-for-turn pillar around y-axis; - wait-for-turn turret around x-axis; - - return 1; -} - -FireWeapon1() -{ - sleep 60; - emit-sfx f3 from fire1; - sleep 60; - emit-sfx f3 from fire1; - sleep 60; - emit-sfx f3 from fire1; - sleep 60; - emit-sfx f3 from fire1; -} - -AimWeapon2(heading,pitch) -{ - signal SIG_AIM_2; - set-signal-mask SIG_AIM_2; - - return 1; -} - -FireWeapon2() -{ - show fire1; - sleep 120; - hide fire1; -} - -Killed(severity, corpsetype) -{ - corpsetype = 3; - return 0; -} \ No newline at end of file diff --git a/Scripts/faction/exptype.h b/Scripts/faction/exptype.h new file mode 100644 index 000000000..7a83187b2 --- /dev/null +++ b/Scripts/faction/exptype.h @@ -0,0 +1,193 @@ +/* +** EXPtype.h -- Explosion Type information and GET/SET constants for scripts +** +** This Script contains constants compatible only with Spring RTS engine +** not for use with Total Annihilation or TA:Kindgoms +*/ + +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +// Indices for emit-sfx +#ifndef __SFXTYPE_H_ +#define SFXTYPE_VTOL 0 +//#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 // same as SFX_WAKE +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 // same as SFX_REVERSE_WAKE + +#define SFXTYPE_WHITESMOKE 257 +#define SFXTYPE_BLACKSMOKE 258 +#define SFXTYPE_SUBBUBBLES 259 +#endif + +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define NOCEGTRAIL 64 // Disables the cegtrail for the specific piece (defined in the unit fbi) +#define NOHEATCLOUD 128 // No engine default heat cloud for explosion +#define BITMAP 10000001 + +// Bitmap Explosion Types +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 + +//Customized effects (in FBI/TDF/LUA) +// Explosion generators +#define UNIT_SFX0 1024 +#define UNIT_SFX1 1025 +#define UNIT_SFX2 1026 +#define UNIT_SFX3 1027 +#define UNIT_SFX4 1028 +#define UNIT_SFX5 1029 +#define UNIT_SFX6 1030 +#define UNIT_SFX7 1031 +#define UNIT_SFX8 1032 +#define UNIT_SFX9 1033 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 +#define FIRE_W9 2056 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 +#define DETO_W9 4104 + + +// COB constants +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get +#define REVERSING 109 // get + +// Indices for SET, GET, and GET_UNIT_VALUE for LUA return values +#define LUA0 110 // (LUA0 returns the lua call status, 0 or 1) +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) get WEAPON_RELOADSTATE(weaponNum) for GET +#define WEAPON_RELOADTIME 126 // get (with fake set) get WEAPON_RELOADSTATE(-weaponNum,val) for SET +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define WEAPON_STOCKPILE_COUNT 139 // get (with fake set) + + +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get +#define KSIN 135 // get, kiloSine 1024*sin(x) as COB uses only integers +#define KCOS 136 // get, kiloCosine 1024*cos(x) + +#define KTAN 137 // get, kiloTangent 1024*tan(x) carefull with angles close to 90 deg. might cause overflow +#define SQRT 138 // get, square root (floored to integer) + +#define ENERGY_MAKE 140 // set or get (100*E production) + +#define METAL_MAKE 141 // set or get (100*M production) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif \ No newline at end of file diff --git a/Scripts/faction/sfxtype.h b/Scripts/faction/sfxtype.h new file mode 100644 index 000000000..e69de29bb diff --git a/Scripts/faction/unitDefsTurretSpeeds.h b/Scripts/faction/unitDefsTurretSpeeds.h new file mode 100644 index 000000000..a96c7278d --- /dev/null +++ b/Scripts/faction/unitDefsTurretSpeeds.h @@ -0,0 +1,68 @@ +/* unitDefsTurretSpeeds.h -- sets turret speed via unitDefs (through lua gadget Spring.CallCOBScript()) + The following variables are assumed to exist: + Weapon1TurretX, Weapon1TurretY + ... + Weapon10TurretX, Weapon10TurretY +*/ + +static-var Weapon1TurretX, Weapon1TurretY; +static-var Weapon2TurretX, Weapon2TurretY; +static-var Weapon3TurretX, Weapon3TurretY; +static-var Weapon4TurretX, Weapon4TurretY; +static-var Weapon5TurretX, Weapon5TurretY; +static-var Weapon6TurretX, Weapon6TurretY; +static-var Weapon7TurretX, Weapon7TurretY; +static-var Weapon8TurretX, Weapon8TurretY; +static-var Weapon9TurretX, Weapon9TurretY; +static-var Weapon10TurretX, Weapon10TurretY; + +SetWeapon1TurretSpeed(var1,var2) +{ + Weapon1TurretX = 500; + Weapon1TurretY = 500; +} +SetWeapon2TurretSpeed(var1,var2) +{ + Weapon2TurretX = 500; + Weapon2TurretY = 500; +} +SetWeapon3TurretSpeed(var1,var2) +{ + Weapon3TurretX = 500; + Weapon3TurretY = 500; +} +SetWeapon4TurretSpeed(var1,var2) +{ + Weapon4TurretX = 500; + Weapon4TurretY = 500; +} +SetWeapon5TurretSpeed(var1,var2) +{ + Weapon5TurretX = 500; + Weapon5TurretY = 500; +} +SetWeapon6TurretSpeed(var1,var2) +{ + Weapon6TurretX = 500; + Weapon6TurretY = 500; +} +SetWeapon7TurretSpeed(var1,var2) +{ + Weapon7TurretX = 500; + Weapon7TurretY = 500; +} +SetWeapon8TurretSpeed(var1,var2) +{ + Weapon8TurretX = 500; + Weapon8TurretY = 500; +} +SetWeapon9TurretSpeed(var1,var2) +{ + Weapon9TurretX = 500; + Weapon9TurretY = 500; +} +SetWeapon10TurretSpeed(var1,var2) +{ + Weapon10TurretX = 500; + Weapon10TurretY = 500; +} \ No newline at end of file diff --git a/Scripts/faction/weapon1control.h b/Scripts/faction/weapon1control.h new file mode 100644 index 000000000..d1c1acd4f --- /dev/null +++ b/Scripts/faction/weapon1control.h @@ -0,0 +1,154 @@ +/* +HOW TO: +- Model MUST contain aimx1 and aimy1 pieces +- Script must have defined Weapon1TurretX and Weapon1TurretY static-vars (turret turn speeds) +- Script must have defined aimx1 and aimy1 pieces +- Change script as such: +Create() +{ + [...] + start-script InitialSetup1(); + [...] +} + +AimWeapon1(heading, pitch) +{ + [...] + start-script Weapon1Drawn(); -- can call a function that draws weapons and then calls Weapon1Drawn() when done if there is an actual animation (ie pw) + [...] -- Remove animations from aimWeapon scripts (use a DrawWeapon1() if an animation is needed, weapon1control will rotate the different aimpieces) + start-script Weapon1SetWtdAim(heading, pitch); + [...] + return (aim1); +} + +RestoreAfterDelay() +{ + [...] + sleep sleeptime; + start-script RestoreWeapon1(); + [...] -- other animations; + call-script Weapon1Restored(); + [...] -- tell script wpn has been restored if needed for walkscripts +} + +- Weapon1Control moves the aim pieces depending on turretSpeeds, sets pitch = 1 when pitch reached and head = 1 when head reached +- Weapon1Drawn allows unit to fire by setting wpnReady1 = 1 +- if pitch = 1, head = 1 and wpnReady = 1 then the weapon can shoot: aim1 = 1 and aimweapon returns aim1 +- Restore animations go in RestoreAfterDelay, RestoreWeapon1() restores aimy and aimx pieces orientation, Weapon1Restored() waits for these pieces to be restored +*/ + +static-var curHead1, wtdHead1, head1, curPitch1, wtdPitch1, pitch1, aim1, wpnReady1; + +Weapon1Control() +{ + while (TRUE) + { + if (curHead1 > <180>) + { + curHead1 = <-360> + curHead1; + } + if (curPitch1 > <180>) + { + curPitch1 = <-360> + curPitch1; + } + if (curHead1 < <-180>) + { + curHead1 = <360> + curHead1; + } + if (curPitch1 < <-180>) + { + curPitch1 = <360> + curPitch1; + } + if (Static_Var_3 == 1) + { + if (((get ABS(curHead1 - wtdHead1)) > <360>) OR(((get ABS(curHead1 - wtdHead1)) > (Weapon1TurretY / 30)) AND ((get ABS(curHead1 - wtdHead1)) < <360> - (Weapon1TurretY / 30)))) + { + head1 = 0; + if(curHead1 < wtdHead1) { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 + (Weapon1TurretY / 30); + else curHead1 = curHead1 - (Weapon1TurretY / 30); + } + + else { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 - (Weapon1TurretY / 30); + else curHead1 = curHead1 + (Weapon1TurretY / 30); + } + } + else + { + head1 = 1; + curHead1 = wtdHead1; + } + if (((get ABS(curPitch1 - wtdPitch1)) > <360>) OR(((get ABS(curPitch1 - wtdPitch1)) > (Weapon1TurretX / 30)) AND ((get ABS(curPitch1 - wtdPitch1)) < <360> - (Weapon1TurretX / 30)))) + { + pitch1 = 0; + if(curPitch1 < wtdPitch1) { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 + (Weapon1TurretX / 30); + else curPitch1 = curPitch1 - (Weapon1TurretX / 30); + } + + else { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 - (Weapon1TurretX / 30); + else curPitch1 = curPitch1 + (Weapon1TurretX / 30); + } + } + else + { + pitch1 = 1; + curPitch1 = wtdPitch1; + } + if (pitch1 == 1 AND head1 == 1 AND wpnReady1 == 1 AND wtdHead1 != 0) + { + aim1 = 1; + } + else + { + aim1 = 0; + } + turn aimy1 to y-axis curHead1 now; + turn aimx1 to x-axis curPitch1 now; + } + sleep 1; + } +} + +InitialSetup1() +{ + curHead1 = 0; + curPitch1 = 0; + wtdHead1 = 0; + wtdPitch1 = 0; + wpnReady1 = 0; + start-script Weapon1Control(); +} + +Weapon1Drawn() +{ + wpnReady1 = 1; +} + +RestoreWeapon1() +{ + wtdHead1 = 0; + wtdPitch1 = 0; +} + +Weapon1Restored() +{ + wpnReady1 = 0; + while (curHead1 != 0) + { + sleep 25; + } + return (TRUE); +} + +Weapon1SetWtdAim(pitch, heading) +{ + wtdHead1 = heading; + wtdPitch1 = <0> - pitch; +} \ No newline at end of file diff --git a/Scripts/faction/xantinuke.bos b/Scripts/faction/xantinuke.bos new file mode 100644 index 000000000..2a1d45a42 --- /dev/null +++ b/Scripts/faction/xantinuke.bos @@ -0,0 +1,208 @@ +// * Header Info * +// VersionSignature 4 +// NumberOfScripts 17 +// NumberOfPieces 9 +// LengthOfScripts 3ce +// NumberOfStaticVars 5 +// UKZero 0 +// OffsetToScriptCodeIndexArray f64 +// OffsetToScriptNameOffsetArray fa8 +// OffsetToPieceNameOffsetArray fec +// OffsetToScriptCode 2c +// OffsetToNameArray 1010 + +// OffsetToFirstName 1010 + +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, firepoint, door1, door2; + +static-var Static_Var_1, restore_delay, gun_1, statechg_DesiredState, statechg_StateChanging; + +// Signal definitions +#define SIG_AIM 2 + + +activatescr() +{ + if( TRUE ) + { + turn door1 to z-axis <0.000000> now; + turn door1 to z-axis <0> speed <500.000000>; + turn door2 to z-axis <0.000000> now; + turn door2 to z-axis <-0> speed <500.000000>; + } + + sleep 3; + return (0); +} + +deactivatescr() +{ + if( TRUE ) + { + turn door1 to z-axis <-0> now; + turn door1 to z-axis <0.000000> speed <500.000000>; + turn door2 to z-axis <90> now; + turn door2 to z-axis <0.000000> speed <500.000000>; + } + + sleep 14; + return (0); +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + var Func_Var_4; + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + Func_Var_4 = Rand( 1, 4 ); + if( Func_Var_4 == 1 ) + { + emit-sfx smoketype from door1; + } + if( Func_Var_4 == 2 ) + { + emit-sfx smoketype from door2; + } + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } + return (0); +} + +Go() +{ + call-script activatescr(); + Static_Var_1 = 1; + return (0); +} + +Stop() +{ + Static_Var_1 = 0; + call-script deactivatescr(); + return (0); +} + +InitState() +{ + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; + return (0); +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState == 0 ) + { + call-script Go(); + currentstate = 0; + } + if( statechg_DesiredState == 1 ) + { + call-script Stop(); + currentstate = 1; + } + } + statechg_StateChanging = FALSE; + return (0); +} + +Create() +{ + Static_Var_1 = 0; + gun_1 = firepoint; + restore_delay = 3000; + call-script InitState(); + start-script SmokeUnit(); + return (0); +} + +Activate() +{ + start-script RequestState(0); + return (0); +} + +Deactivate() +{ + start-script RequestState(1); + return (0); +} + +SetMaxReloadTime(Func_Var_1) +{ + restore_delay = Func_Var_1 * 2; + return (0); +} + +AimPrimary(heading, pitch) +{ + start-script RequestState(0); + signal SIG_AIM; + set-signal-mask SIG_AIM; + return (1); +} + +FirePrimary() +{ + gun_1 = firepoint; + return (0); +} + +QueryPrimary(piecenum) +{ + piecenum = firepoint; + return (0); +} + +AimFromPrimary(piecenum) +{ + piecenum = firepoint; + return (0); +} + +SweetSpot(piecenum) +{ + piecenum = base; + return (0); +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode door1 type EXPLODE_ON_HIT; + explode door2 type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xantinuke.cob b/Scripts/faction/xantinuke.cob new file mode 100644 index 000000000..94d87d7be Binary files /dev/null and b/Scripts/faction/xantinuke.cob differ diff --git a/Scripts/faction/xcommander.bos b/Scripts/faction/xcommander.bos new file mode 100644 index 000000000..16330bd90 --- /dev/null +++ b/Scripts/faction/xcommander.bos @@ -0,0 +1,742 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece torso, lfirept, rbigflash, nanospray, nanolathe, luparm, ruparm, pelvis, + rthigh, lthigh, biggun, lleg, l_foot, rleg, r_foot, head, teleport; + +static-var bMoving, bAiming, Busy, gun_3, gun_2, counter, + bIsBuilding, buildPitch, buildHeading, maxSpeed, currentSpeed, animSpeed, justMoved; + +// Signal definitions +#define SIG_AIM 2 + + +walk() +{ + + if (bMoving) + { + //step 1 + turn rthigh to x-axis <46> speed <197.142857> * animSpeed / 100; + turn rleg to x-axis <-31> speed <132.857143> * animSpeed / 100; + turn r_foot to x-axis <-14> speed <60.000000> * animSpeed / 100; + + turn lthigh to x-axis <-49> speed <60.000000> * animSpeed / 100; + turn lleg to x-axis <31> speed <85.714286> * animSpeed / 100; + turn l_foot to x-axis <0> speed <30.000000> * animSpeed / 100; + + turn luparm to x-axis <5> speed <21.428571> * animSpeed / 100; + turn nanolathe to x-axis <15> speed <64.285714> * animSpeed / 100; + turn ruparm to x-axis <-25> speed <107.142857> * animSpeed / 100; + turn biggun to x-axis <0> now; + + move pelvis to y-axis [-2] speed [8.571429] * animSpeed / 100; + turn torso to x-axis <0> now; + turn torso to y-axis <-3> speed <12.857143> * animSpeed / 100; + turn head to y-axis <2> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <-1> speed <4.285714> * animSpeed / 100; + + //sleep 215 * currentSpeed / 100; + sleep 215;// * currentSpeed / 100; + } + if (bMoving) + { + + + //step 2 + turn rthigh to x-axis <52> speed <25.714286> * animSpeed / 100; + turn rleg to x-axis <-5> speed <111.428571> * animSpeed / 100; + turn r_foot to x-axis <-8> speed <25.714286> * animSpeed / 100; + + turn lthigh to x-axis <-28> speed <90.000000> * animSpeed / 100; + turn lleg to x-axis <-35> speed <282.857143> * animSpeed / 100; + turn l_foot to x-axis <32> speed <137.142857> * animSpeed / 100; + + turn luparm to x-axis <15> speed <42.857143> * animSpeed / 100; + turn nanolathe to x-axis <45> speed <128.571429> * animSpeed / 100; + + turn ruparm to x-axis <-40> speed <64.285714> * animSpeed / 100; + turn biggun to x-axis <15> speed <64.285714> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn torso to x-axis <4> speed <17.142857> * animSpeed / 100; + turn torso to y-axis <-5> speed <8.571429> * animSpeed / 100; + turn head to y-axis <3> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <-2> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } + if (bMoving) + { + + //step 3 + turn rthigh to x-axis <-6> speed <248.571429> * animSpeed / 100; + turn rleg to x-axis <64> speed <295.714286> * animSpeed / 100; + turn r_foot to x-axis <-11> speed <12.857143> * animSpeed / 100; + + turn lthigh to x-axis <-20> speed <34.285714> * animSpeed / 100; + turn lleg to x-axis <-23> speed <51.428571> * animSpeed / 100; + turn l_foot to x-axis <43> speed <47.142857> * animSpeed / 100; + + turn luparm to x-axis <5> speed <42.857143> * animSpeed / 100; + turn nanolathe to x-axis <15> speed <128.571429> * animSpeed / 100; + turn ruparm to x-axis <-25> speed <64.285714> * animSpeed / 100; + turn biggun to x-axis <0> speed <64.285714> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn torso to x-axis <2> speed <8.571429> * animSpeed / 100; + turn torso to y-axis <-3> speed <8.571429> * animSpeed / 100; + turn head to y-axis <2> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <-1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 4 + turn rthigh to x-axis <-35> speed <124.285714> * animSpeed / 100; + turn rleg to x-axis <51> speed <55.714286> * animSpeed / 100; + turn r_foot to x-axis <-7> speed <17.142857> * animSpeed / 100; + turn lthigh to x-axis <0> speed <85.714286> * animSpeed / 100; + turn lleg to x-axis <0> speed <98.571429> * animSpeed / 100; + turn l_foot to x-axis <0> speed <184.285714> * animSpeed / 100; + + turn luparm to x-axis <0> speed <21.428571> * animSpeed / 100; + turn nanolathe to x-axis <0> speed <64.285714> * animSpeed / 100; + turn ruparm to x-axis <0> speed <107.142857> * animSpeed / 100; + turn biggun to x-axis <0> now; + + move pelvis to y-axis [0] speed [8.571429] * animSpeed / 100; + turn torso to x-axis <0> speed <8.571429> * animSpeed / 100; + turn torso to y-axis <0> speed <12.857143> * animSpeed / 100; + turn head to y-axis <0> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <0> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 5 + turn rthigh to x-axis <-49> speed <60.000000> * animSpeed / 100; + turn rleg to x-axis <31> speed <85.714286> * animSpeed / 100; + turn r_foot to x-axis <0> speed <30.000000> * animSpeed / 100; + + turn lthigh to x-axis <46> speed <197.142857> * animSpeed / 100; + turn lleg to x-axis <-31> speed <132.857143> * animSpeed / 100; + turn l_foot to x-axis <-14> speed <60.000000> * animSpeed / 100; + + turn luparm to x-axis <-25> speed <107.142857> * animSpeed / 100; + turn nanolathe to x-axis <0> now; + turn ruparm to x-axis <5> speed <21.428571> * animSpeed / 100; + turn biggun to x-axis <15> speed <64.285714> * animSpeed / 100; + + move pelvis to y-axis [-2] speed [8.571429] * animSpeed / 100; + turn torso to x-axis <0> now; + turn torso to y-axis <3> speed <12.857143> * animSpeed / 100; + turn head to y-axis <-2> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 6 + turn rthigh to x-axis <-28> speed <90.000000> * animSpeed / 100; + turn rleg to x-axis <-35> speed <282.857143> * animSpeed / 100; + turn r_foot to x-axis <32> speed <137.142857> * animSpeed / 100; + + turn lthigh to x-axis <52> speed <25.714286> * animSpeed / 100; + turn lleg to x-axis <-5> speed <111.428571> * animSpeed / 100; + turn l_foot to x-axis <-8> speed <25.714286> * animSpeed / 100; + + turn luparm to x-axis <-40> speed <64.285714> * animSpeed / 100; + turn nanolathe to x-axis <15> speed <64.285714> * animSpeed / 100; + turn ruparm to x-axis <15> speed <42.857143> * animSpeed / 100; + turn biggun to x-axis <45> speed <128.571429> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn torso to x-axis <4> speed <17.142857> * animSpeed / 100; + turn torso to y-axis <5> speed <8.571429> * animSpeed / 100; + turn head to y-axis <-3> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <2> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } + if (bMoving) + { + + //step 7 + turn rthigh to x-axis <-20> speed <34.285714> * animSpeed / 100; + turn rleg to x-axis <-23> speed <51.428571> * animSpeed / 100; + turn r_foot to x-axis <43> speed <47.142857> * animSpeed / 100; + + turn lthigh to x-axis <-6> speed <248.571429> * animSpeed / 100; + turn lleg to x-axis <64> speed <295.714286> * animSpeed / 100; + turn l_foot to x-axis <-11> speed <12.857143> * animSpeed / 100; + + turn luparm to x-axis <-25> speed <64.285714> * animSpeed / 100; + turn nanolathe to x-axis <0> speed <64.285714> * animSpeed / 100; + turn ruparm to x-axis <5> speed <42.857143> * animSpeed / 100; + turn biggun to x-axis <15> speed <128.571429> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn torso to x-axis <2> speed <8.571429> * animSpeed / 100; + turn torso to y-axis <3> speed <8.571429> * animSpeed / 100; + turn head to y-axis <-2> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } + + if (bMoving) + { + //step 0 + turn rthigh to x-axis <0> speed <85.714286> * animSpeed / 100; + turn rleg to x-axis <0> speed <98.571429> * animSpeed / 100; + turn r_foot to x-axis <0> speed <184.285714> * animSpeed / 100; + + turn lthigh to x-axis <-35> speed <124.285714> * animSpeed / 100; + turn lleg to x-axis <51> speed <55.714286> * animSpeed / 100; + turn l_foot to x-axis <-7> speed <17.142857> * animSpeed / 100; + + turn luparm to x-axis <0> speed <107.142857> * animSpeed / 100; + turn nanolathe to x-axis <0> now; + + turn ruparm to x-axis <0> speed <21.428571> * animSpeed / 100; + turn biggun to x-axis <0> speed <64.285714> * animSpeed / 100; + + move pelvis to y-axis [0] speed [8.571429] * animSpeed / 100; + turn torso to x-axis <0> speed <8.571429> * animSpeed / 100; + turn torso to y-axis <0> speed <12.857143> * animSpeed / 100; + turn head to y-axis <0> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <0> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + +} + +walklegs() +{ + + if (bMoving) + { + //step 0 + turn rthigh to x-axis <0> speed <85.714286> * animSpeed / 100; + turn rleg to x-axis <0> speed <98.571429> * animSpeed / 100; + turn r_foot to x-axis <0> speed <184.285714> * animSpeed / 100; + + turn lthigh to x-axis <-35> speed <124.285714> * animSpeed / 100; + turn lleg to x-axis <51> speed <55.714286> * animSpeed / 100; + turn l_foot to x-axis <-7> speed <17.142857> * animSpeed / 100; + + + move pelvis to y-axis [0] speed [8.571429] * animSpeed / 100; + turn head to y-axis <0> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <0> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + //step 1 + turn rthigh to x-axis <46> speed <197.142857> * animSpeed / 100; + turn rleg to x-axis <-31> speed <132.857143> * animSpeed / 100; + turn r_foot to x-axis <-14> speed <60.000000> * animSpeed / 100; + + turn lthigh to x-axis <-49> speed <60.000000> * animSpeed / 100; + turn lleg to x-axis <31> speed <85.714286> * animSpeed / 100; + turn l_foot to x-axis <0> speed <30.000000> * animSpeed / 100; + move pelvis to y-axis [-2] speed [8.571429] * animSpeed / 100; + turn head to y-axis <2> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <-1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 2 + turn rthigh to x-axis <52> speed <25.714286> * animSpeed / 100; + turn rleg to x-axis <-5> speed <111.428571> * animSpeed / 100; + turn r_foot to x-axis <-8> speed <25.714286> * animSpeed / 100; + + turn lthigh to x-axis <-28> speed <90.000000> * animSpeed / 100; + turn lleg to x-axis <-35> speed <282.857143> * animSpeed / 100; + turn l_foot to x-axis <32> speed <137.142857> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn head to y-axis <3> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <-2> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } + if (bMoving) + { + + //step 3 + turn rthigh to x-axis <-6> speed <248.571429> * animSpeed / 100; + turn rleg to x-axis <64> speed <295.714286> * animSpeed / 100; + turn r_foot to x-axis <-11> speed <12.857143> * animSpeed / 100; + + turn lthigh to x-axis <-20> speed <34.285714> * animSpeed / 100; + turn lleg to x-axis <-23> speed <51.428571> * animSpeed / 100; + turn l_foot to x-axis <43> speed <47.142857> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn head to y-axis <2> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <-1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 4 + turn rthigh to x-axis <-35> speed <124.285714> * animSpeed / 100; + turn rleg to x-axis <51> speed <55.714286> * animSpeed / 100; + turn r_foot to x-axis <-7> speed <17.142857> * animSpeed / 100; + turn lthigh to x-axis <0> speed <85.714286> * animSpeed / 100; + turn lleg to x-axis <0> speed <98.571429> * animSpeed / 100; + turn l_foot to x-axis <0> speed <184.285714> * animSpeed / 100; + + + move pelvis to y-axis [0] speed [8.571429] * animSpeed / 100; + turn head to y-axis <0> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <0> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 5 + turn rthigh to x-axis <-49> speed <60.000000> * animSpeed / 100; + turn rleg to x-axis <31> speed <85.714286> * animSpeed / 100; + turn r_foot to x-axis <0> speed <30.000000> * animSpeed / 100; + + turn lthigh to x-axis <46> speed <197.142857> * animSpeed / 100; + turn lleg to x-axis <-31> speed <132.857143> * animSpeed / 100; + turn l_foot to x-axis <-14> speed <60.000000> * animSpeed / 100; + + + move pelvis to y-axis [-2] speed [8.571429] * animSpeed / 100; + turn head to y-axis <-2> speed <8.571429> * animSpeed / 100; + turn pelvis to z-axis <1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + } + if (bMoving) + { + + + //step 6 + turn rthigh to x-axis <-28> speed <90.000000> * animSpeed / 100; + turn rleg to x-axis <-35> speed <282.857143> * animSpeed / 100; + turn r_foot to x-axis <32> speed <137.142857> * animSpeed / 100; + + turn lthigh to x-axis <52> speed <25.714286> * animSpeed / 100; + turn lleg to x-axis <-5> speed <111.428571> * animSpeed / 100; + turn l_foot to x-axis <-8> speed <25.714286> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn head to y-axis <-3> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <2> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } + if (bMoving) + { + + //step 7 + turn rthigh to x-axis <-20> speed <34.285714> * animSpeed / 100; + turn rleg to x-axis <-23> speed <51.428571> * animSpeed / 100; + turn r_foot to x-axis <43> speed <47.142857> * animSpeed / 100; + + turn lthigh to x-axis <-6> speed <248.571429> * animSpeed / 100; + turn lleg to x-axis <64> speed <295.714286> * animSpeed / 100; + turn l_foot to x-axis <-11> speed <12.857143> * animSpeed / 100; + + move pelvis to y-axis [-2] now; + turn head to y-axis <-2> speed <4.285714> * animSpeed / 100; + turn pelvis to z-axis <1> speed <4.285714> * animSpeed / 100; + + sleep 215 * currentSpeed / 100; + + } +} + +stand() +{ + + turn rthigh to x-axis <0> speed <200>; + turn rleg to x-axis <0> speed <200>; + turn r_foot to x-axis <0> speed <200>; + + turn lthigh to x-axis <0> speed <200>; + turn lleg to x-axis <0> speed <200>; + turn l_foot to x-axis <0> speed <200>; + + move pelvis to y-axis [0] speed [20]; + turn head to y-axis <-2> speed <4.285714>; + turn pelvis to z-axis <1> speed <4.285714>; + + sleep 200; + return (0); +} + +bigfire() +{ + turn ruparm to x-axis <40> now; + turn biggun to x-axis <-40> now; + turn ruparm to x-axis <0> speed <80>; + turn biggun to x-axis <0> speed <80>; + sleep 100; + return (0); +} + +UnitSpeed() +{ + while( TRUE ) + { + currentSpeed = (get CURRENT_SPEED) * 100 / maxSpeed; + + //get PRINT(currentSpeed, maxSpeed, animSpeed); + if( currentSpeed < 40 ) + { + currentSpeed = 40; + } + animSpeed=currentSpeed; + + currentSpeed = 10000/currentSpeed; + sleep 60; + } + return (0); +} + +MotionControl(Func_Var_1, Func_Var_2) +{ + while( TRUE ) + { + Func_Var_1 = bMoving; + Func_Var_2 = bAiming; + if( Func_Var_1 ) + { + gun_3 = torso; + if( Func_Var_2 ) + { + Busy = 1; + call-script walklegs(); + } + else + { + Busy = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Busy = 1; + if( justmoved ) + { + call-script stand(); + justmoved=FALSE; + } + else + { + sleep 30; + } + } + } + return (0); +} + +TeleportControl() +{ + move teleport to y-axis [700.000000] now; + turn teleport to x-axis <90.000000> now; + sleep 100; + emit-sfx 1025 from teleport; + sleep 2200; + emit-sfx 1026 from pelvis; + sleep 100; + while (counter < 23) + { + emit-sfx 2051 from teleport; + sleep 65; + ++counter; + } + sleep 1000; + move teleport to y-axis [0.000000] now; +} + +Create() +{ + hide rbigflash; + hide lfirept; + bMoving = FALSE; + bAiming = FALSE; + bIsBuilding = 0; + gun_2 = torso; + Busy = 1; + gun_3 = torso; + buildHeading = 0; + buildPitch = 0; + counter = 0; + //maxSpeed = get UNKNOWN_UNIT_VALUE(75); + maxSpeed = get MAX_SPEED; + currentSpeed = 100; + start-script MotionControl(); + start-script UnitSpeed(); + //call-script TeleportControl(); + return (0); +} + +StartMoving() +{ + bMoving = TRUE; + gun_3 = torso; + return (0); +} + +StopMoving() +{ + bMoving = FALSE; + return (0); +} + +SweetSpot(piecenum) +{ + piecenum = torso; + return (0); +} + +QueryNanoPiece(piecenum) +{ + piecenum = nanospray; + return (0); +} + +RestorePosition() +{ + gun_3 = torso; + turn torso to y-axis <0.000000> speed <90.000000>; + wait-for-turn torso around y-axis; + bAiming = FALSE; + return (0); +} + +ResumeBuilding() +{ + sleep 400; + if( bIsBuilding AND ( !gun_2 ) ) + { + turn torso to y-axis buildHeading speed <150.000000>; + turn luparm to x-axis <-30.000000> - buildPitch speed <45.000000>; + } + return (0); +} + +AimFromPrimary(piecenum) +{ + piecenum = torso; + return (0); +} + +QueryPrimary(piecenum) +{ + piecenum = lfirept; + return (0); +} + +AimPrimary(heading, pitch) +{ + if( gun_3 == 1 ) + { + return (0); + } + signal SIG_AIM; + set-signal-mask SIG_AIM; + bAiming = TRUE; + turn torso to y-axis heading speed <300.000000>; + turn luparm to x-axis <-5.000000> - pitch speed <250.000000>; + turn nanolathe to x-axis <000000> speed <250.000000>; + wait-for-turn torso around y-axis; + wait-for-turn luparm around x-axis; + gun_2 = lfirept; + if( bIsBuilding == 1 ) + { + start-script ResumeBuilding(); + } + return (1); +} + +FirePrimary() +{ + show lfirept; + sleep 100; + hide lfirept; + sleep 400; + gun_2 = torso; + return (0); +} + +AimFromTertiary(piecenum) +{ + piecenum = biggun; + return (0); +} + +QueryTertiary(piecenum) +{ + piecenum = rbigflash; + return (0); +} + +AimTertiary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + gun_3 = lfirept; + bAiming = TRUE; + turn torso to y-axis heading speed <300.000000>; + turn biggun to x-axis <0.000000> - pitch speed <150.000000>; + turn ruparm to x-axis <0> speed <300>; + wait-for-turn torso around y-axis; + wait-for-turn biggun around x-axis; + return (1); +} + +FireTertiary() +{ + emit-sfx 1024 + 0 from rbigflash; + gun_3 = torso; + call-script bigfire(); + return (0); +} + +AimFromSecondary(piecenum) +{ + piecenum = lfirept; + return (0); +} + +QuerySecondary(piecenum) +{ + piecenum = lfirept; + return (0); +} + +AimSecondary(heading, pitch) +{ + if( get PIECE_Y(head) > 0 ) + { + return (0); + } + if( gun_3 == 1 ) + { + return (0); + } + if( bIsBuilding ) + { + return (0); + } + signal SIG_AIM; + set-signal-mask SIG_AIM; + bAiming = TRUE; + turn torso to y-axis heading speed <300.000000>; + turn luparm to x-axis <-5.000000> - pitch speed <250.000000>; + turn nanolathe to x-axis <000000> speed <250.000000>; + wait-for-turn torso around y-axis; + wait-for-turn luparm around x-axis; + gun_2 = lfirept; + if( bIsBuilding == 1 ) + { + start-script ResumeBuilding(); + } + return (1); +} + +FireSecondary() +{ + show lfirept; + emit-sfx 1024 + 0 from lfirept; + sleep 100; + hide lfirept; + emit-sfx 1024 + 0 from lfirept; + sleep 400; + gun_2 = torso; + return (0); +} + +AimFromWeapon4(piecenum) +{ + piecenum = torso; +} + +QueryWeapon4(piecenum) +{ + piecenum = torso; +} + +StartBuilding(heading, pitch) +{ + gun_3 = torso; + signal SIG_AIM; + set-signal-mask SIG_AIM; + bAiming = TRUE; + bIsBuilding = 1; + while( !Busy ) + { + sleep 30; + } + buildHeading = heading; + buildPitch = pitch; + turn torso to y-axis heading speed <300.000000>; + turn luparm to x-axis <-30.000000> - pitch speed <90.000000>; + wait-for-turn torso around y-axis; + wait-for-turn luparm around x-axis; + set INBUILDSTANCE to 1; + return (0); +} + +TargetCleared(Func_Var_1) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + call-script RestorePosition(); + return (0); +} + +StopBuilding() +{ + bIsBuilding = 0; + set INBUILDSTANCE to 0; + signal SIG_AIM; + set-signal-mask SIG_AIM; + call-script RestorePosition(); + return (0); +} + +Killed( severity, corpsetype ) +{ + corpsetype = 1; + return(corpsetype); +} \ No newline at end of file diff --git a/Scripts/faction/xcommander.cob b/Scripts/faction/xcommander.cob new file mode 100644 index 000000000..ed07bbbb4 Binary files /dev/null and b/Scripts/faction/xcommander.cob differ diff --git a/Scripts/faction/xcrasher.bos b/Scripts/faction/xcrasher.bos new file mode 100644 index 000000000..f1c01b8b6 --- /dev/null +++ b/Scripts/faction/xcrasher.bos @@ -0,0 +1,285 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece firepoint1, firepoint2, torso, pelvis, lleg, rleg, lbarrel, + rbarrel,head,lthigh,rthigh; + +static-var gun_3, notMoving, restore_delay, currentSpeed, moveSpeed,wpn3_lasthead,shooting_num; + +// Signal definitions +#define SIG_MOVE 2 +#define SIG_WALK 4 +#define SIG_AIM_3 8 + + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = (get CURRENT_SPEED)*20/moveSpeed; + if (currentSpeed<4) currentSpeed=4; + sleep 142; + } +} + +walk() +{ + signal SIG_WALK; + set-signal-mask SIG_WALK; + notMoving = FALSE; + start-script UnitSpeed(); + while( TRUE ) + { + move pelvis to y-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + move lleg to z-axis [4.375000] speed [3.281250] *currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [-4.000000] speed [3.000000] *currentSpeed; + turn pelvis to x-axis <6.000000> speed <4.500000> *currentSpeed; + turn lleg to x-axis <-6.000000> speed <4.500000> *currentSpeed; + turn rleg to x-axis <0.000000> now; + sleep 1200 / currentSpeed; + + move pelvis to y-axis [-1.250000] speed [1.875000] *currentSpeed; + move lleg to y-axis [1.250000] speed [1.875000] *currentSpeed; + move rleg to y-axis [1.250000] speed [1.875000] *currentSpeed; + turn pelvis to x-axis <4.912088> speed <1.631868> *currentSpeed; + turn lleg to x-axis <-4.912088> speed <1.631868> *currentSpeed; + turn rleg to x-axis <1.049451> speed <1.574176> *currentSpeed; + sleep 600 / currentSpeed; + + move pelvis to y-axis [-0.750000] speed [0.750000] *currentSpeed; + move lleg to y-axis [0.750000] speed [0.750000] *currentSpeed; + move rleg to y-axis [0.750000] speed [0.750000] *currentSpeed; + turn pelvis to x-axis <2.093407> speed <4.228021> *currentSpeed; + turn lleg to x-axis <-2.093407> speed <4.228021> *currentSpeed; + turn rleg to x-axis <2.802198> speed <2.629121> *currentSpeed; + sleep 400 / currentSpeed; + + move pelvis to y-axis [-0.250000] speed [0.750000] *currentSpeed; + move lleg to y-axis [0.250000] speed [0.750000] *currentSpeed; + move rleg to y-axis [0.250000] speed [0.750000] *currentSpeed; + turn pelvis to x-axis <1.049451> speed <1.565934> *currentSpeed; + turn lleg to x-axis <-1.038462> speed <1.582418> *currentSpeed; + turn rleg to x-axis <3.159341> speed <0.535714> *currentSpeed; + sleep 200 / currentSpeed; + + move pelvis to y-axis [0.000000] speed [0.187500] *currentSpeed; + move lleg to y-axis [0.000000] speed [0.187500] *currentSpeed; + move rleg to y-axis [2.750000] speed [1.875000] *currentSpeed; + move rleg to z-axis [-4.625000] speed [0.468750] *currentSpeed; + turn pelvis to x-axis <0.000000> speed <0.787088> *currentSpeed; + turn lleg to x-axis <0.000000> speed <0.778846> *currentSpeed; + turn rleg to x-axis <0.000000> speed <2.369506> *currentSpeed; + sleep 1200 / currentSpeed; + + move lleg to z-axis [2.500000] speed [1.406250] *currentSpeed; + move rleg to z-axis [-0.875000] speed [2.812500] *currentSpeed; + sleep 1200 / currentSpeed; + + move lleg to y-axis [0.000000] now; + move lleg to z-axis [0.000000] speed [1.875000] *currentSpeed; + move rleg to z-axis [0.000000] speed [0.656250] *currentSpeed; + turn pelvis to x-axis <0.000000> now; + turn lleg to x-axis <0.000000> now; + turn rleg to x-axis <0.000000> now; + sleep 1200 / currentSpeed; + + move lleg to z-axis [-1.500000] speed [0.562500] *currentSpeed; + move rleg to z-axis [2.125000] speed [0.796875] *currentSpeed; + turn rleg to x-axis <-9.137363> speed <3.426511> *currentSpeed; + sleep 2000 / currentSpeed; + + move lleg to z-axis [-3.000000] speed [1.125000] *currentSpeed; + move rleg to y-axis [0.000000] speed [2.062500] *currentSpeed; + turn pelvis to x-axis <6.000000> speed <4.500000> *currentSpeed; + turn rleg to x-axis <-6.000000> speed <2.353022> *currentSpeed; + sleep 1200 / currentSpeed; + + move pelvis to y-axis [-1.224991] speed [1.837487] *currentSpeed; + move lleg to y-axis [1.250000] speed [1.875000] *currentSpeed; + move rleg to y-axis [1.250000] speed [1.875000] *currentSpeed; + turn pelvis to x-axis <4.560440> speed <2.159340> *currentSpeed; + turn lleg to x-axis <0.692308> speed <1.038462> *currentSpeed; + turn rleg to x-axis <-4.912088> speed <1.631868> *currentSpeed; + sleep 600 / currentSpeed; + + move pelvis to y-axis [-0.699997] speed [0.787491] *currentSpeed; + move lleg to y-axis [0.750000] speed [0.750000] *currentSpeed; + move rleg to y-axis [0.750000] speed [0.750000] *currentSpeed; + turn pelvis to x-axis <2.093407> speed <3.700549> *currentSpeed; + turn lleg to x-axis <2.802198> speed <3.164835> *currentSpeed; + turn rleg to x-axis <-2.093407> speed <4.228021> *currentSpeed; + sleep 400 / currentSpeed; + + move pelvis to y-axis [-0.250000] speed [0.674995] *currentSpeed; + move lleg to y-axis [0.250000] speed [0.750000] *currentSpeed; + move rleg to y-axis [0.250000] speed [0.750000] *currentSpeed; + turn pelvis to x-axis <1.049451> speed <1.565934> *currentSpeed; + turn lleg to x-axis <2.456044> speed <0.519231> *currentSpeed; + turn rleg to x-axis <-1.038462> speed <1.582418> *currentSpeed; + sleep 200 / currentSpeed; + + move lleg to y-axis [2.750000] speed [1.875000] *currentSpeed; + move lleg to z-axis [-3.875000] speed [0.656250] *currentSpeed; + move rleg to y-axis [1.250000] speed [0.750000] *currentSpeed; + turn pelvis to x-axis <0.000000> speed <0.787088> *currentSpeed; + turn lleg to x-axis <0.000000> speed <1.842033> *currentSpeed; + turn rleg to x-axis <0.000000> speed <0.778846> *currentSpeed; + sleep 1200 / currentSpeed; + + move lleg to z-axis [-1.750000] speed [1.593750] *currentSpeed; + move rleg to z-axis [0.500000] speed [1.218750] *currentSpeed; + sleep 1200 / currentSpeed; + + move lleg to z-axis [1.125000] speed [2.156250] *currentSpeed; + move rleg to y-axis [0.000000] speed [0.937500] *currentSpeed; + move rleg to z-axis [-0.750000] speed [0.937500] *currentSpeed; + turn rleg to x-axis <0.000000> now; + sleep 1200 / currentSpeed; + + move lleg to z-axis [2.500000] speed [0.515625] *currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [-3.250000] speed [0.937500] *currentSpeed; + turn lleg to x-axis <-10.192308> speed <3.822116> *currentSpeed; + turn rleg to x-axis <0.000000> now; + sleep 2000 / currentSpeed; + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + +StartMoving() +{ + signal SIG_MOVE; + if( notMoving ) start-script walk(); +} + +StopMoving() +{ + signal SIG_MOVE; + set-signal-mask SIG_MOVE; + sleep 120; + signal SIG_WALK; + notMoving = TRUE; +} + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM_3; + sleep restore_delay; + turn torso to y-axis <0.000000> speed <90.000000>; + wpn3_lasthead = 1000000; + return (0); +} + +Create() +{ + gun_3 = firepoint2; + restore_delay = 300; + notMoving = TRUE; + moveSpeed = get MAX_SPEED; + currentSpeed = 100; + start-script StopMoving(); + start-script SmokeUnit(); +} + +SetMaxReloadTime(Func_Var_1) +{ + restore_delay = Func_Var_1 * 5; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM_3; + turn torso to y-axis heading speed <5000.000000>; + turn head to x-axis <0.000000> - pitch speed <5000.000000>; + start-script RestoreAfterDelay(); + return (1); +} + +AimFromPrimary(piecenum) +{ + piecenum = head; +} + +QueryPrimary(piecenum) +{ + if (shooting_num==1) + { + piecenum=firepoint1; + } + + if (shooting_num==2) + { + piecenum=firepoint2; + } +} + +FirePrimary() +{ + if(shooting_num==1) + { + emit-sfx 1024 from firepoint2; + } + if(shooting_num==2) + { + emit-sfx 1024 from firepoint1; + } + shooting_num=shooting_num+1; + + if( shooting_num == 3) + { + shooting_num=1; + } +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode torso type EXPLODE_ON_HIT; + explode head type EXPLODE_ON_HIT; + explode rbarrel type EXPLODE_ON_HIT; + explode lbarrel type EXPLODE_ON_HIT; + explode lthigh type EXPLODE_ON_HIT; + explode lleg type EXPLODE_ON_HIT; + explode rthigh type EXPLODE_ON_HIT; + explode rleg type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xcrasher.cob b/Scripts/faction/xcrasher.cob new file mode 100644 index 000000000..43cf2b2cc Binary files /dev/null and b/Scripts/faction/xcrasher.cob differ diff --git a/Scripts/faction/xflea.bos b/Scripts/faction/xflea.bos new file mode 100644 index 000000000..f3e8cc9d3 --- /dev/null +++ b/Scripts/faction/xflea.bos @@ -0,0 +1,306 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, turret, lfupleg, lrupleg, rrupleg, + rfupleg, rrleg, rfleg, lrleg, lfleg; + +static-var bMoving, bAiming, Static_Var_3, restore_delay, wpn1_lasthead; + +// Signal definitions +#define SIG_AIM 2 + + +walk() +{ + if( bMoving ) + { + move lfupleg to y-axis [0.000000] now; + move lfupleg to y-axis [0.250000] speed [2.000000]; + move lrupleg to y-axis [0.000000] now; + move lrupleg to y-axis [0.900000] speed [8.000000]; + move rrupleg to y-axis [0.000000] now; + move rrupleg to y-axis [0.800000] speed [7.000000]; + turn base to x-axis <11.829670> now; + turn base to x-axis <22.000000> speed <94.000000>; + move base to y-axis [2] speed [20]; + turn lfupleg to x-axis <-50.208791> now; + turn lfupleg to x-axis <-22.000000> speed <254.000000>; + turn lrupleg to x-axis <23.203297> now; + turn lrupleg to x-axis <-28.005495> speed <473.000000>; + turn rfupleg to x-axis <-49.269231> now; + turn rfupleg to x-axis <-32.005495> speed <150.000000>; + turn rrupleg to x-axis <27.472527> now; + turn rrupleg to x-axis <-20.000000> speed <439.000000>; + turn rrleg to x-axis <45.010989> now; + turn rrleg to x-axis <-24.005495> speed <633.000000>; + turn rfleg to x-axis <0.000000> now; + turn rfleg to x-axis <12.000000> speed <111.000000>; + turn lrleg to x-axis <44.527473> now; + turn lrleg to x-axis <-9.000000> speed <495.000000>; + sleep 110; + } + if( bMoving ) + { + move lfupleg to y-axis [0.750000] speed [4.000000]; + move lrupleg to y-axis [1.600000] speed [6.000000]; + move rfupleg to y-axis [0.850000] speed [7.000000]; + move rrupleg to y-axis [1.450000] speed [5.000000]; + turn base to x-axis <0.000000> speed <188.000000>; + move base to y-axis [3] speed [10]; + turn lfupleg to x-axis <53.010989> speed <670.000000>; + turn lrupleg to x-axis <-39.005495> speed <96.000000>; + turn rfupleg to x-axis <51.010989> speed <742.000000>; + turn rrupleg to x-axis <-32.005495> speed <100.000000>; + turn rrleg to x-axis <14.000000> speed <348.000000>; + turn rfleg to x-axis <-52.010989> speed <570.000000>; + turn lrleg to x-axis <25.005495> speed <314.000000>; + turn lfleg to x-axis <-52.010989> speed <465.000000>; + sleep 113; + } + if( bMoving ) + { + move lrupleg to y-axis [1.819995] speed [4.000000]; + move rrupleg to y-axis [1.719995] speed [4.000000]; + turn base to x-axis <-12.000000> speed <241.000000>; + + move base to y-axis [2] speed [10]; + turn lfupleg to x-axis <87.016484> speed <604.000000>; + turn lrupleg to x-axis <-61.010989> speed <380.000000>; + turn rfupleg to x-axis <82.016484> speed <562.000000>; + turn rrupleg to x-axis <-61.010989> speed <528.000000>; + turn rrleg to x-axis <72.016484> speed <1036.000000>; + turn rfleg to x-axis <-58.010989> speed <105.000000>; + turn lrleg to x-axis <71.016484> speed <820.000000>; + sleep 56; + } + if( bMoving ) + { + move lrupleg to y-axis [1.650000] speed [3.000000]; + move rrupleg to y-axis [1.700000] speed [0.000000]; + turn base to x-axis <-26.005495> speed <232.000000>; + + move base to y-axis [0] speed [20]; + turn lfupleg to x-axis <121.027473> speed <584.000000>; + turn lrupleg to x-axis <-32.005495> speed <498.000000>; + turn rfupleg to x-axis <114.027473> speed <543.000000>; + turn rrupleg to x-axis <-31.005495> speed <526.000000>; + turn rrleg to x-axis <54.010989> speed <306.000000>; + turn rfleg to x-axis <-63.010989> speed <102.000000>; + turn lrleg to x-axis <57.010989> speed <245.000000>; + sleep 58; + } + if( bMoving ) + { + move lrupleg to y-axis [0.950000] speed [6.000000]; + move rrupleg to y-axis [1.100000] speed [5.000000]; + turn base to x-axis <0.000000> speed <232.000000>; + turn lfupleg to x-axis <60.010989> speed <545.000000>; + turn lrupleg to x-axis <3.000000> speed <321.000000>; + turn rfupleg to x-axis <53.010989> speed <545.000000>; + turn rrupleg to x-axis <-3.000000> speed <249.000000>; + turn rrleg to x-axis <30.005495> speed <219.000000>; + turn rfleg to x-axis <26.005495> speed <807.000000>; + turn lrleg to x-axis <22.000000> speed <308.000000>; + turn lfleg to x-axis <13.000000> speed <588.000000>; + sleep 112; + } +} + +walklegs() +{ + if( bMoving ) + { + move lfupleg to y-axis [0.000000] now; + move lfupleg to y-axis [0.250000] speed [2.000000]; + move lrupleg to y-axis [0.000000] now; + move lrupleg to y-axis [0.900000] speed [8.000000]; + move rrupleg to y-axis [0.000000] now; + move rrupleg to y-axis [0.800000] speed [7.000000]; + turn base to x-axis <11.829670> now; + turn base to x-axis <22.000000> speed <94.000000>; + move base to y-axis [2] speed [20]; + turn lfupleg to x-axis <-50.208791> now; + turn lfupleg to x-axis <-22.000000> speed <254.000000>; + turn lrupleg to x-axis <23.203297> now; + turn lrupleg to x-axis <-28.005495> speed <473.000000>; + turn rfupleg to x-axis <-49.269231> now; + turn rfupleg to x-axis <-32.005495> speed <150.000000>; + turn rrupleg to x-axis <27.472527> now; + turn rrupleg to x-axis <-20.000000> speed <439.000000>; + turn rrleg to x-axis <45.010989> now; + turn rrleg to x-axis <-24.005495> speed <633.000000>; + turn rfleg to x-axis <0.000000> now; + turn rfleg to x-axis <12.000000> speed <111.000000>; + turn lrleg to x-axis <44.527473> now; + turn lrleg to x-axis <-9.000000> speed <495.000000>; + sleep 110; + } + if( bMoving ) + { + move lfupleg to y-axis [0.750000] speed [4.000000]; + move lrupleg to y-axis [1.600000] speed [6.000000]; + move rfupleg to y-axis [0.850000] speed [7.000000]; + move rrupleg to y-axis [1.450000] speed [5.000000]; + turn base to x-axis <0.000000> speed <188.000000>; + move base to y-axis [3] speed [10]; + turn lfupleg to x-axis <53.010989> speed <670.000000>; + turn lrupleg to x-axis <-39.005495> speed <96.000000>; + turn rfupleg to x-axis <51.010989> speed <742.000000>; + turn rrupleg to x-axis <-32.005495> speed <100.000000>; + turn rrleg to x-axis <14.000000> speed <348.000000>; + turn rfleg to x-axis <-52.010989> speed <570.000000>; + turn lrleg to x-axis <25.005495> speed <314.000000>; + turn lfleg to x-axis <-52.010989> speed <465.000000>; + sleep 113; + } + if( bMoving ) + { + move lrupleg to y-axis [1.819995] speed [4.000000]; + move rrupleg to y-axis [1.719995] speed [4.000000]; + turn base to x-axis <-12.000000> speed <241.000000>; + + move base to y-axis [2] speed [10]; + turn lfupleg to x-axis <87.016484> speed <604.000000>; + turn lrupleg to x-axis <-61.010989> speed <380.000000>; + turn rfupleg to x-axis <82.016484> speed <562.000000>; + turn rrupleg to x-axis <-61.010989> speed <528.000000>; + turn rrleg to x-axis <72.016484> speed <1036.000000>; + turn rfleg to x-axis <-58.010989> speed <105.000000>; + turn lrleg to x-axis <71.016484> speed <820.000000>; + sleep 56; + } + if( bMoving ) + { + move lrupleg to y-axis [1.650000] speed [3.000000]; + move rrupleg to y-axis [1.700000] speed [0.000000]; + turn base to x-axis <-26.005495> speed <232.000000>; + + move base to y-axis [0] speed [20]; + turn lfupleg to x-axis <121.027473> speed <584.000000>; + turn lrupleg to x-axis <-32.005495> speed <498.000000>; + turn rfupleg to x-axis <114.027473> speed <543.000000>; + turn rrupleg to x-axis <-31.005495> speed <526.000000>; + turn rrleg to x-axis <54.010989> speed <306.000000>; + turn rfleg to x-axis <-63.010989> speed <102.000000>; + turn lrleg to x-axis <57.010989> speed <245.000000>; + sleep 58; + } + if( bMoving ) + { + move lrupleg to y-axis [0.950000] speed [6.000000]; + move rrupleg to y-axis [1.100000] speed [5.000000]; + turn base to x-axis <0.000000> speed <232.000000>; + turn lfupleg to x-axis <60.010989> speed <545.000000>; + turn lrupleg to x-axis <3.000000> speed <321.000000>; + turn rfupleg to x-axis <53.010989> speed <545.000000>; + turn rrupleg to x-axis <-3.000000> speed <249.000000>; + turn rrleg to x-axis <30.005495> speed <219.000000>; + turn rfleg to x-axis <26.005495> speed <807.000000>; + turn lrleg to x-axis <22.000000> speed <308.000000>; + turn lfleg to x-axis <13.000000> speed <588.000000>; + sleep 112; + } +} + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = bAiming; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + move lrupleg to y-axis [0.000000] speed [5.000000]; + move rfupleg to y-axis [0.000000] speed [5.000000]; + move rrupleg to y-axis [0.000000] speed [5.000000]; + turn lfupleg to x-axis <0.000000> speed <200.000000>; + turn lrupleg to x-axis <0.000000> speed <200.000000>; + turn rfupleg to x-axis <0.000000> speed <200.000000>; + turn rrupleg to x-axis <0.000000> speed <200.000000>; + turn rrleg to x-axis <0.000000> speed <200.000000>; + turn lrleg to x-axis <0.000000> speed <200.000000>; + move base to y-axis [0] speed [20]; + turn base to x-axis <0> speed <200>; + justmoved = FALSE; + } + sleep 100; + } + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from turret; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + bMoving = FALSE; + bAiming = FALSE; + Static_Var_3 = 1; + start-script SmokeUnit(); +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode turret type EXPLODE_ON_HIT; + explode lrleg type EXPLODE_ON_HIT; + explode lfleg type EXPLODE_ON_HIT; + explode rfleg type EXPLODE_ON_HIT; + explode rrleg type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/faction/xflea.cob b/Scripts/faction/xflea.cob new file mode 100644 index 000000000..25765627d Binary files /dev/null and b/Scripts/faction/xflea.cob differ diff --git a/Scripts/faction/xhammer.bos b/Scripts/faction/xhammer.bos new file mode 100644 index 000000000..df8ec921e --- /dev/null +++ b/Scripts/faction/xhammer.bos @@ -0,0 +1,624 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece pelvis, firepoint1, firepoint2, lvent, rvent, lthigh, rthigh, + torso, rleg, rfoot, lleg, lfoot, rarm, larm, rbarrel, lbarrel; + +static-var bMoving, Static_Var_2, Static_Var_3, Static_Var_4, gun_1, gun_2, + restore_delay, statechg_DesiredState, statechg_StateChanging, + moveSpeed, currentSpeed, restore, wpn1_lasthead, shooting_num; + +// Signal definitions +#define SIG_AIM 2 + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + +RockUnit(anglex, anglez) +{ + turn pelvis to x-axis anglex speed <50.000000>; + turn pelvis to z-axis <0> - anglez speed <50.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <20.000000>; + turn pelvis to x-axis <0.000000> speed <20.000000>; +} + + + +walk() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [4.267241] * currentSpeed / 100; + turn lthigh to x-axis <-62.934066> speed <537.109701> * currentSpeed / 100; + turn rthigh to x-axis <3.505495> speed <29.917587> * currentSpeed / 100; + turn torso to z-axis <-4.560440> speed <38.920997> * currentSpeed / 100; + turn rleg to x-axis <82.978022> speed <708.174498> * currentSpeed / 100; + turn rfoot to x-axis <-36.901099> speed <314.931793> * currentSpeed / 100; + turn lleg to x-axis <57.302198> speed <489.044621> * currentSpeed / 100; + turn lfoot to x-axis <5.258242> speed <44.876376> * currentSpeed / 100; + sleep 7000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.981928] * currentSpeed / 100; + turn lthigh to x-axis <-51.681319> speed <134.219512> * currentSpeed / 100; + turn rthigh to x-axis <-8.071429> speed <138.086202> * currentSpeed / 100; + turn torso to z-axis <0.000000> speed <54.395610> * currentSpeed / 100; + turn rleg to x-axis <105.835165> speed <272.633392> * currentSpeed / 100; + turn rfoot to x-axis <-27.071429> speed <117.245461> * currentSpeed / 100; + turn lleg to x-axis <45.346154> speed <142.608236> * currentSpeed / 100; + turn lfoot to x-axis <5.967033> speed <8.454254> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-39.368132> speed <146.868134> * currentSpeed / 100; + turn rthigh to x-axis <-20.027473> speed <142.608236> * currentSpeed / 100; + turn rleg to x-axis <118.846154> speed <155.191315> * currentSpeed / 100; + turn lleg to x-axis <38.670330> speed <79.627298> * currentSpeed / 100; + turn lfoot to x-axis <1.049451> speed <58.655496> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-29.170330> speed <121.636433> * currentSpeed / 100; + turn rthigh to x-axis <-30.236264> speed <121.767507> * currentSpeed / 100; + turn torso to z-axis <1.747253> speed <20.840729> * currentSpeed / 100; + turn rleg to x-axis <72.769231> speed <549.592214> * currentSpeed / 100; + turn rfoot to x-axis <-33.758242> speed <79.758372> * currentSpeed / 100; + turn lleg to x-axis <29.868132> speed <104.990073> * currentSpeed / 100; + turn lfoot to x-axis <-0.692308> speed <20.775198> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-20.390110> speed <104.727925> * currentSpeed / 100; + turn rthigh to x-axis <-56.258242> speed <310.382629> * currentSpeed / 100; + turn torso to z-axis <7.725275> speed <71.304118> * currentSpeed / 100; + turn rleg to x-axis <58.357143> speed <171.903218> * currentSpeed / 100; + turn lleg to x-axis <41.126374> speed <134.285055> * currentSpeed / 100; + turn lfoot to x-axis <-21.093407> speed <243.338410> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-16.516484> speed <46.203491> * currentSpeed / 100; + turn rthigh to x-axis <-57.659341> speed <16.711904> * currentSpeed / 100; + turn torso to z-axis <9.835165> speed <25.166158> * currentSpeed / 100; + turn rleg to x-axis <-10.192308> speed <817.638030> * currentSpeed / 100; + turn lleg to x-axis <59.412088> speed <218.106709> * currentSpeed / 100; + turn lfoot to x-axis <-31.637363> speed <125.765258> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-4.560440> speed <142.608236> * currentSpeed / 100; + turn rthigh to x-axis <-65.401099> speed <92.341451> * currentSpeed / 100; + turn torso to z-axis <10.192308> speed <4.259898> * currentSpeed / 100; + turn rleg to x-axis <35.857143> speed <549.264536> * currentSpeed / 100; + turn lleg to x-axis <53.434066> speed <71.304118> * currentSpeed / 100; + turn lfoot to x-axis <-33.758242> speed <25.297231> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <2.802198> speed <87.819417> * currentSpeed / 100; + turn rthigh to x-axis <-66.445055> speed <12.452005> * currentSpeed / 100; + turn torso to z-axis <7.027473> speed <37.749237> * currentSpeed / 100; + turn rleg to x-axis <43.236264> speed <88.016022> * currentSpeed / 100; + turn rfoot to x-axis <-7.725275> speed <310.513703> * currentSpeed / 100; + turn lleg to x-axis <57.313187> speed <46.269034> * currentSpeed / 100; + turn lfoot to x-axis <-29.527473> speed <50.463389> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.853448] * currentSpeed / 100; + turn lthigh to x-axis <5.269231> speed <21.054851> * currentSpeed / 100; + turn rthigh to x-axis <-61.527473> speed <41.969019> * currentSpeed / 100; + turn torso to z-axis <4.912088> speed <18.053717> * currentSpeed / 100; + turn rleg to x-axis <44.648352> speed <12.051441> * currentSpeed / 100; + turn rfoot to x-axis <16.868132> speed <209.892008> * currentSpeed / 100; + turn lleg to x-axis <78.401099> speed <179.974421> * currentSpeed / 100; + turn lfoot to x-axis <-34.791209> speed <44.923264> * currentSpeed / 100; + sleep 7000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-4.912088> speed <121.439829> * currentSpeed / 100; + turn rthigh to x-axis <-52.390110> speed <108.987824> * currentSpeed / 100; + turn torso to z-axis <0.000000> speed <58.589965> * currentSpeed / 100; + turn rleg to x-axis <43.236264> speed <16.842977> * currentSpeed / 100; + turn rfoot to x-axis <9.137363> speed <92.210377> * currentSpeed / 100; + turn lleg to x-axis <100.560440> speed <264.310212> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-21.445055> speed <197.200450> * currentSpeed / 100; + turn rthigh to x-axis <-36.214286> speed <192.940551> * currentSpeed / 100; + turn torso to z-axis <0.000000> now; + turn rfoot to x-axis <-7.027473> speed <192.809490> * currentSpeed / 100; + turn lleg to x-axis <103.725275> speed <37.749237> * currentSpeed / 100; + turn lfoot to x-axis <-52.736264> speed <214.043427> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-32.681319> speed <134.022908> * currentSpeed / 100; + turn rthigh to x-axis <-21.791209> speed <172.034292> * currentSpeed / 100; + turn torso to z-axis <-8.071429> speed <96.273671> * currentSpeed / 100; + turn rleg to x-axis <38.670330> speed <54.461140> * currentSpeed / 100; + turn rfoot to x-axis <-13.346154> speed <75.367400> * currentSpeed / 100; + turn lleg to x-axis <84.736264> speed <226.495432> * currentSpeed / 100; + turn lfoot to x-axis <-45.357143> speed <88.016022> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-68.912088> speed <432.150136> * currentSpeed / 100; + turn rthigh to x-axis <-10.890110> speed <130.025157> * currentSpeed / 100; + turn torso to z-axis <-10.192308> speed <25.297231> * currentSpeed / 100; + turn rleg to x-axis <37.615385> speed <12.583079> * currentSpeed / 100; + turn rfoot to x-axis <-21.445055> speed <96.601349> * currentSpeed / 100; + turn lleg to x-axis <79.104396> speed <67.175293> * currentSpeed / 100; + turn lfoot to x-axis <-37.967033> speed <88.147095> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-61.181319> speed <92.210377> * currentSpeed / 100; + turn rthigh to x-axis <3.505495> speed <171.706614> * currentSpeed / 100; + turn torso to z-axis <-8.769231> speed <16.974051> * currentSpeed / 100; + turn rleg to x-axis <26.357143> speed <134.285055> * currentSpeed / 100; + turn rfoot to x-axis <-22.846154> speed <16.711904> * currentSpeed / 100; + turn lleg to x-axis <9.835165> speed <826.223358> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + move pelvis to y-axis [-0.400000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-63.291209> speed <25.166158> * currentSpeed / 100; + turn rthigh to x-axis <17.214286> speed <163.514495> * currentSpeed / 100; + turn torso to z-axis <-7.027473> speed <20.775186> * currentSpeed / 100; + turn rleg to x-axis <29.170330> speed <33.554881> * currentSpeed / 100; + turn rfoot to x-axis <-21.093407> speed <20.906259> * currentSpeed / 100; + turn lleg to x-axis <28.824176> speed <226.495432> * currentSpeed / 100; + turn lfoot to x-axis <-1.390110> speed <436.278961> * currentSpeed / 100; + sleep 6000 / currentSpeed; +} + +walklegs() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [0.853448] * currentSpeed / 100; + turn lthigh to x-axis <-62.934066> speed <3.048031> * currentSpeed / 100; + turn rthigh to x-axis <3.505495> speed <116.997440> * currentSpeed / 100; + turn rleg to x-axis <82.978022> speed <459.220820> * currentSpeed / 100; + turn rfoot to x-axis <-36.901099> speed <134.910475> * currentSpeed / 100; + turn lleg to x-axis <57.302198> speed <243.045188> * currentSpeed / 100; + turn lfoot to x-axis <5.258242> speed <56.740246> * currentSpeed / 100; + sleep 7000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.981928] * currentSpeed / 100; + turn lthigh to x-axis <-51.681319> speed <134.219512> * currentSpeed / 100; + turn rthigh to x-axis <-8.071429> speed <138.086202> * currentSpeed / 100; + turn rleg to x-axis <105.835165> speed <272.633392> * currentSpeed / 100; + turn rfoot to x-axis <-27.071429> speed <117.245461> * currentSpeed / 100; + turn lleg to x-axis <45.346154> speed <142.608236> * currentSpeed / 100; + turn lfoot to x-axis <5.967033> speed <8.454254> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-39.368132> speed <146.868134> * currentSpeed / 100; + turn rthigh to x-axis <-20.027473> speed <142.608236> * currentSpeed / 100; + turn rleg to x-axis <118.846154> speed <155.191315> * currentSpeed / 100; + turn lleg to x-axis <38.670330> speed <79.627298> * currentSpeed / 100; + turn lfoot to x-axis <1.049451> speed <58.655496> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-29.170330> speed <121.636433> * currentSpeed / 100; + turn rthigh to x-axis <-30.236264> speed <121.767507> * currentSpeed / 100; + turn rleg to x-axis <72.769231> speed <549.592214> * currentSpeed / 100; + turn rfoot to x-axis <-33.758242> speed <79.758372> * currentSpeed / 100; + turn lleg to x-axis <29.868132> speed <104.990073> * currentSpeed / 100; + turn lfoot to x-axis <-0.692308> speed <20.775198> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-20.390110> speed <104.727925> * currentSpeed / 100; + turn rthigh to x-axis <-56.258242> speed <310.382629> * currentSpeed / 100; + turn rleg to x-axis <58.357143> speed <171.903218> * currentSpeed / 100; + turn lleg to x-axis <41.126374> speed <134.285055> * currentSpeed / 100; + turn lfoot to x-axis <-21.093407> speed <243.338410> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-16.516484> speed <46.203491> * currentSpeed / 100; + turn rthigh to x-axis <-57.659341> speed <16.711904> * currentSpeed / 100; + turn rleg to x-axis <-10.192308> speed <817.638030> * currentSpeed / 100; + turn lleg to x-axis <59.412088> speed <218.106709> * currentSpeed / 100; + turn lfoot to x-axis <-31.637363> speed <125.765258> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-4.560440> speed <142.608236> * currentSpeed / 100; + turn rthigh to x-axis <-65.401099> speed <92.341451> * currentSpeed / 100; + turn rleg to x-axis <35.857143> speed <549.264536> * currentSpeed / 100; + turn lleg to x-axis <53.434066> speed <71.304118> * currentSpeed / 100; + turn lfoot to x-axis <-33.758242> speed <25.297231> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <2.802198> speed <87.819417> * currentSpeed / 100; + turn rthigh to x-axis <-66.445055> speed <12.452005> * currentSpeed / 100; + turn rleg to x-axis <43.236264> speed <88.016022> * currentSpeed / 100; + turn rfoot to x-axis <-7.725275> speed <310.513703> * currentSpeed / 100; + turn lleg to x-axis <57.313187> speed <46.269034> * currentSpeed / 100; + turn lfoot to x-axis <-29.527473> speed <50.463389> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.853448] * currentSpeed / 100; + turn lthigh to x-axis <5.269231> speed <21.054851> * currentSpeed / 100; + turn rthigh to x-axis <-61.527473> speed <41.969019> * currentSpeed / 100; + turn rleg to x-axis <44.648352> speed <12.051441> * currentSpeed / 100; + turn rfoot to x-axis <16.868132> speed <209.892008> * currentSpeed / 100; + turn lleg to x-axis <78.401099> speed <179.974421> * currentSpeed / 100; + turn lfoot to x-axis <-34.791209> speed <44.923264> * currentSpeed / 100; + sleep 7000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-4.912088> speed <121.439829> * currentSpeed / 100; + turn rthigh to x-axis <-52.390110> speed <108.987824> * currentSpeed / 100; + turn rleg to x-axis <43.236264> speed <16.842977> * currentSpeed / 100; + turn rfoot to x-axis <9.137363> speed <92.210377> * currentSpeed / 100; + turn lleg to x-axis <100.560440> speed <264.310212> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-21.445055> speed <197.200450> * currentSpeed / 100; + turn rthigh to x-axis <-36.214286> speed <192.940551> * currentSpeed / 100; + turn rfoot to x-axis <-7.027473> speed <192.809490> * currentSpeed / 100; + turn lleg to x-axis <103.725275> speed <37.749237> * currentSpeed / 100; + turn lfoot to x-axis <-52.736264> speed <214.043427> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-32.681319> speed <134.022908> * currentSpeed / 100; + turn rthigh to x-axis <-21.791209> speed <172.034292> * currentSpeed / 100; + turn rleg to x-axis <38.670330> speed <54.461140> * currentSpeed / 100; + turn rfoot to x-axis <-13.346154> speed <75.367400> * currentSpeed / 100; + turn lleg to x-axis <84.736264> speed <226.495432> * currentSpeed / 100; + turn lfoot to x-axis <-45.357143> speed <88.016022> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.192771] * currentSpeed / 100; + turn lthigh to x-axis <-68.912088> speed <432.150136> * currentSpeed / 100; + turn rthigh to x-axis <-10.890110> speed <130.025157> * currentSpeed / 100; + turn rleg to x-axis <37.615385> speed <12.583079> * currentSpeed / 100; + turn rfoot to x-axis <-21.445055> speed <96.601349> * currentSpeed / 100; + turn lleg to x-axis <79.104396> speed <67.175293> * currentSpeed / 100; + turn lfoot to x-axis <-37.967033> speed <88.147095> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-61.181319> speed <92.210377> * currentSpeed / 100; + turn rthigh to x-axis <3.505495> speed <171.706614> * currentSpeed / 100; + turn rleg to x-axis <26.357143> speed <134.285055> * currentSpeed / 100; + turn rfoot to x-axis <-22.846154> speed <16.711904> * currentSpeed / 100; + turn lleg to x-axis <9.835165> speed <826.223358> * currentSpeed / 100; + sleep 6000 / currentSpeed; + } + move pelvis to y-axis [-0.400000] speed [1.789157] * currentSpeed / 100; + turn lthigh to x-axis <-63.291209> speed <25.166158> * currentSpeed / 100; + turn rthigh to x-axis <17.214286> speed <163.514495> * currentSpeed / 100; + turn rleg to x-axis <29.170330> speed <33.554881> * currentSpeed / 100; + turn rfoot to x-axis <-21.093407> speed <20.906259> * currentSpeed / 100; + turn lleg to x-axis <28.824176> speed <226.495432> * currentSpeed / 100; + turn lfoot to x-axis <-1.390110> speed <436.278961> * currentSpeed / 100; + sleep 6000 / currentSpeed; +} + +Go() +{ + Static_Var_2 = 1; + if( !Static_Var_4 ) + { + while( !Static_Var_3 ) + { + sleep 75; + } + move lvent to x-axis [-1.200000] speed [2.400000]; + move lvent to z-axis [-0.400000] speed [0.800000]; + move rvent to x-axis [1.200000] speed [2.400000]; + move rvent to z-axis [-0.400000] speed [0.800000]; + sleep 300; + Static_Var_4 = 1; + } +} + +Stop() +{ + if( Static_Var_4 ) + { + Static_Var_4 = 0; + move lvent to x-axis [0.000000] speed [2.400000]; + move lvent to z-axis [0.000000] speed [0.800000]; + move rvent to x-axis [0.000000] speed [2.400000]; + move rvent to z-axis [0.000000] speed [0.800000]; + sleep 300; + } + Static_Var_2 = 0; +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState ) + { + call-script Stop(); + currentstate = 1; + } + else + { + call-script Go(); + currentstate = 0; + } + } + statechg_StateChanging = FALSE; +} + + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = Static_Var_2; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + move pelvis to y-axis [0.000000] speed [1.000000]; + turn rthigh to x-axis <0.000000> speed <200.000000>; + turn rleg to x-axis <0.000000> speed <200.000000>; + turn lthigh to x-axis <0.000000> speed <200.000000>; + turn lleg to x-axis <0.000000> speed <200.000000>; + if( !aiming ) + { + turn torso to y-axis <0.000000> speed <90.000000>; + } + justmoved = FALSE; + } + sleep 50; + } + } +} + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = 2 * (get CURRENT_SPEED)*100/moveSpeed; + if (currentSpeed<40) currentSpeed=40; + sleep 142; + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script UnitSpeed(); + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx 1025 from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + bMoving = FALSE; + Static_Var_2 = 0; + Static_Var_3 = 1; + Static_Var_4 = 0; + gun_1 = pelvis; + restore_delay = 3000; + hide firepoint2; + hide firepoint1; + restore = TRUE; + moveSpeed = get MAX_SPEED; + currentSpeed = 100; + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; + start-script SmokeUnit(); +} + +SetMaxReloadTime(Func_Var_1) +{ + restore_delay = Func_Var_1 * 2; +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM; + while (restore == FALSE) // attempt to block restore when switching from 1 to 2 or 2 to 1. + { + sleep 50; + } + sleep 50; + if (restore == TRUE) + { + sleep restore_delay; + set-signal-mask 0; + turn torso to y-axis <0.000000> speed <90.000000>; + turn larm to x-axis <0.000000> speed <45.000000>; + turn rarm to x-axis <0.000000> speed <45.000000>; + wpn1_lasthead = 1000000; + start-script RequestState(1); + } +} + +AimPrimary(heading, pitch) +{ + start-script RequestState(0); + signal SIG_AIM; + turn torso to y-axis heading speed <5000.000000>; + turn larm to x-axis <0.000000> - pitch speed <5000.000000>; + turn rarm to x-axis <0.000000> - pitch speed <5000.000000>; + + start-script RestoreAfterDelay(); + return (1); +} + +AimFromPrimary(piecenum) +{ + piecenum = torso; +} + +QueryPrimary(piecenum) +{ + if (shooting_num==1) + { + piecenum=firepoint1; + } + + if (shooting_num==2) + { + piecenum=firepoint2; + } +} + +FirePrimary() +{ + if(shooting_num==1) + { + emit-sfx 1024 from firepoint2; + } + if(shooting_num==2) + { + emit-sfx 1024 from firepoint1; + } + shooting_num=shooting_num+1; + + if( shooting_num == 3) + { + shooting_num=1; + } +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode lthigh type EXPLODE_ON_HIT; + explode rthigh type EXPLODE_ON_HIT; + explode lleg type EXPLODE_ON_HIT; + explode rleg type EXPLODE_ON_HIT; + explode lbarrel type EXPLODE_ON_HIT; + explode rbarrel type EXPLODE_ON_HIT; + explode larm type EXPLODE_ON_HIT; + explode rarm type EXPLODE_ON_HIT; + explode torso type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xhammer.cob b/Scripts/faction/xhammer.cob new file mode 100644 index 000000000..e94d3f2f2 Binary files /dev/null and b/Scripts/faction/xhammer.cob differ diff --git a/Scripts/faction/xkconstructor.bos b/Scripts/faction/xkconstructor.bos new file mode 100644 index 000000000..0714f051b --- /dev/null +++ b/Scripts/faction/xkconstructor.bos @@ -0,0 +1,399 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +#define SIG_BUILD 4 + +piece torso, pelvis, lthigh, rthigh, rleg, lleg, beamhinge, + rfoot, lfoot, beamcase, nano; + +static-var notBuilding, bMoving, moveSpeed, currentSpeed, + statechg_DesiredState, statechg_StateChanging; + + +walk() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.500000]; + move lthigh to y-axis [0.000000] now; + move rthigh to y-axis [0.000000] now; + move rleg to y-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + turn lthigh to x-axis <-44.291209> speed <364.368135>; + turn rthigh to x-axis <12.291209> speed <184.368135>; + turn rleg to x-axis <17.571429> speed <263.571435>; + turn rfoot to x-axis <-24.956044> speed <374.340660>; + turn lleg to x-axis <36.203297> speed <343.049455>; + turn lfoot to x-axis <2.445055> speed <36.675825>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.250000]; + turn lthigh to x-axis <-46.758242> speed <37.005495>; + turn rthigh to x-axis <20.390110> speed <121.483515>; + turn rfoot to x-axis <-31.280220> speed <94.862640>; + turn lleg to x-axis <20.390110> speed <237.197805>; + turn lfoot to x-axis <14.401099> speed <179.340660>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [2.250000]; + turn lthigh to x-axis <-46.758242> speed <701.373630>; + turn rthigh to x-axis <30.582418> speed <152.884620>; + turn rleg to x-axis <22.137363> speed <68.489010>; + turn rfoot to x-axis <-34.456044> speed <47.637360>; + turn lleg to x-axis <3.505495> speed <253.269225>; + turn lfoot to x-axis <9.489011> speed <73.681320>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [1.000000]; + turn lthigh to x-axis <-44.291209> speed <24.670330>; + turn rthigh to x-axis <43.236264> speed <126.538460>; + turn rleg to x-axis <20.027473> speed <21.098900>; + turn rfoot to x-axis <-42.538462> speed <80.824180>; + turn lleg to x-axis <44.291209> speed <407.857140>; + turn lfoot to x-axis <0.000000> speed <94.890110>; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [1.500000]; + turn lthigh to x-axis <-36.560440> speed <115.961535>; + turn rthigh to x-axis <24.956044> speed <274.203300>; + turn rleg to x-axis <49.214286> speed <437.802195>; + turn rfoot to x-axis <-54.148352> speed <174.148350>; + turn lleg to x-axis <44.291209> speed <664.368135>; + turn lfoot to x-axis <-8.769231> speed <131.538465>; + sleep 5300 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.250000]; + turn lthigh to x-axis <-27.071429> speed <142.335165>; + turn rthigh to x-axis <9.137363> speed <237.280215>; + turn rleg to x-axis <60.467033> speed <168.791205>; + turn rfoot to x-axis <-56.258242> speed <31.648350>; + turn lleg to x-axis <44.291209> now; + turn lfoot to x-axis <-17.923077> speed <137.307690>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.900000] speed [9.750000]; + turn lthigh to x-axis <-16.516484> speed <158.324175>; + turn rthigh to x-axis <0.000000> speed <137.060445>; + turn rleg to x-axis <60.115385> speed <5.274720>; + turn rfoot to x-axis <-47.467033> speed <131.868135>; + turn lleg to x-axis <33.038462> speed <168.791205>; + turn lfoot to x-axis <-16.516484> speed <21.098895>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [13.500000]; + turn lthigh to x-axis <-4.912088> speed <174.065940>; + turn rthigh to x-axis <-19.681319> speed <295.219785>; + turn rleg to x-axis <60.824176> speed <10.631865>; + turn rfoot to x-axis <-36.560440> speed <163.598895>; + turn lleg to x-axis <22.505495> speed <157.994505>; + turn lfoot to x-axis <-17.571429> speed <15.824175>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [1.500000]; + turn lthigh to x-axis <4.912088> speed <147.362640>; + turn rthigh to x-axis <-46.401099> speed <400.796700>; + turn rfoot to x-axis <-19.681319> speed <253.186815>; + turn lleg to x-axis <23.203297> speed <10.467030>; + turn lfoot to x-axis <-25.313187> speed <116.126370>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.250000]; + turn lthigh to x-axis <16.170330> speed <168.873630>; + turn rthigh to x-axis <-46.049451> speed <5.274720>; + turn rleg to x-axis <18.615385> speed <633.131865>; + turn rfoot to x-axis <13.000000> speed <490.219785>; + turn lleg to x-axis <22.505495> speed <10.467030>; + turn lfoot to x-axis <-34.456044> speed <137.142855>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [2.250000]; + turn lthigh to x-axis <20.390110> speed <63.296700>; + turn rthigh to x-axis <-46.401099> speed <5.274720>; + turn rleg to x-axis <-8.423077> speed <405.576930>; + turn rfoot to x-axis <26.357143> speed <200.357145>; + turn lfoot to x-axis <-35.148352> speed <10.384620>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.500000] speed [1.000000]; + turn lthigh to x-axis <23.203297> speed <28.131870>; + turn rthigh to x-axis <-45.005495> speed <13.956040>; + turn rleg to x-axis <46.049451> speed <544.725280>; + turn rfoot to x-axis <-1.390110> speed <277.472530>; + turn lleg to x-axis <37.615385> speed <151.098900>; + turn lfoot to x-axis <-43.593407> speed <84.450550>; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [1.500000]; + turn lthigh to x-axis <15.456044> speed <116.208795>; + turn rthigh to x-axis <-39.725275> speed <79.203300>; + turn rfoot to x-axis <-6.313187> speed <73.846155>; + turn lleg to x-axis <63.291209> speed <385.137360>; + turn lfoot to x-axis <-52.736264> speed <137.142855>; + sleep 5300 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.250000] speed [2.250000]; + turn lthigh to x-axis <6.670330> speed <131.785710>; + turn rthigh to x-axis <-30.582418> speed <137.142855>; + turn rfoot to x-axis <-15.456044> speed <137.142855>; + turn lleg to x-axis <66.445055> speed <47.307690>; + turn lfoot to x-axis <-51.324176> speed <21.181320>; + sleep 4700 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [2.250000]; + turn lthigh to x-axis <-2.445055> speed <136.730775>; + turn rthigh to x-axis <-20.027473> speed <158.324175>; + turn rleg to x-axis <41.835165> speed <63.214290>; + turn rfoot to x-axis <-21.791209> speed <95.027475>; + turn lleg to x-axis <66.802198> speed <5.357145>; + turn lfoot to x-axis <-55.901099> speed <68.653845>; + sleep 4700 / currentSpeed; + } + move pelvis to y-axis [0.000000] speed [1.500000]; + turn lthigh to x-axis <-18.626374> speed <242.719785>; + turn rthigh to x-axis <2.802198> speed <342.445065>; + turn rleg to x-axis <17.571429> speed <363.956040>; + turn rfoot to x-axis <-20.736264> speed <15.824175>; + turn lleg to x-axis <54.148352> speed <189.807690>; + turn lfoot to x-axis <-36.560440> speed <290.109885>; + sleep 4700 / currentSpeed; +} + +MotionControl(Func_Var_1, Func_Var_2) +{ + while( TRUE ) + { + Func_Var_1 = bMoving; + //Func_Var_2 = notBuilding; + if( Func_Var_1 ) + { + call-script walk(); + /* + if( Func_Var_2 ) + { + call-script walk(); + } + else + { + call-script walk(); + } + */ + } + else + { + sleep 200; + } + } +} + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = (get CURRENT_SPEED)*100/moveSpeed; + if (currentSpeed<20) currentSpeed=20; + sleep 142; + } +} + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script UnitSpeed(); + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Go() +{ + turn beamcase to z-axis <-90> speed <180>; + wait-for-turn beamcase around z-axis; + + turn beamhinge to x-axis <90> speed <360>; + wait-for-turn beamhinge around x-axis; +} + +Stop() +{ + set INBUILDSTANCE to 0; + + turn beamhinge to x-axis <0> speed <360>; + wait-for-turn beamhinge around x-axis; + + turn beamcase to z-axis <0> speed <180>; + wait-for-turn beamcase around z-axis; + + + + turn torso to y-axis <0.000000> speed <160.000000>; + wait-for-turn torso around y-axis; +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState ) + { + call-script Stop(); + notBuilding = 1; + currentstate = 1; + } + else + { + call-script Go(); + notBuilding = 0; + currentstate = 0; + } + } + statechg_StateChanging = FALSE; +} + +Create() +{ + bMoving = FALSE; + notBuilding = 1; + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; + moveSpeed = get MAX_SPEED; + currentSpeed = 100; + start-script SmokeUnit(); +} + +Activate() +{ + start-script RequestState(0); +} + +Deactivate() +{ + start-script RequestState(1); +} + +StartBuilding(heading, pitch) +{ + start-script RequestState(0); + while( notBuilding ) sleep 100; + signal SIG_BUILD; + turn torso to y-axis heading speed <600.000000>; + wait-for-turn torso around y-axis; + set INBUILDSTANCE to 1; +} + +StopBuilding() +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + sleep 6000; + set-signal-mask 0; + signal SIG_BUILD; + start-script RequestState(1); +} + +StartMoving() +{ + bMoving = TRUE; + currentSpeed = 50; +} + +StopMoving() +{ + bMoving = FALSE; +} + +QueryNanoPiece(piecenum) +{ + piecenum = nano; +} + +/* +TargetHeading(Func_Var_1) +{ + Static_Var_1 = 0 - Func_Var_1; +} +*/ + +SweetSpot(piecenum) +{ + piecenum = torso; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode torso type EXPLODE_ON_HIT; + explode beamhinge type EXPLODE_ON_HIT; + explode beamcase type EXPLODE_ON_HIT; + explode lleg type EXPLODE_ON_HIT; + explode lfoot type EXPLODE_ON_HIT; + explode rleg type EXPLODE_ON_HIT; + explode rfoot type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xkconstructor.cob b/Scripts/faction/xkconstructor.cob new file mode 100644 index 000000000..8d2b6e577 Binary files /dev/null and b/Scripts/faction/xkconstructor.cob differ diff --git a/Scripts/faction/xklab.bos b/Scripts/faction/xklab.bos new file mode 100644 index 000000000..f2bb349b3 --- /dev/null +++ b/Scripts/faction/xklab.bos @@ -0,0 +1,184 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base,head1,head2,nano1,nano2,nano3,nano4,center1,center2,side1,side2,pad,nanojoined1,nanojoined2; + +static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building, terraintype; + +// Signal definitions +#define SIG_ACTIVATE 2 + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1026 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +OpenYard() +{ + set YARD_OPEN to 1; + while( !get YARD_OPEN ) + { + set BUGGER_OFF to 1; + sleep 1500; + set YARD_OPEN to 1; + } + set BUGGER_OFF to 0; +} + +CloseYard() +{ + set YARD_OPEN to 0; + while( get YARD_OPEN ) + { + set BUGGER_OFF to 1; + sleep 1500; + set YARD_OPEN to 0; + } + set BUGGER_OFF to 0; +} + +Go() +{ + call-script OpenYard(); + set INBUILDSTANCE to 1; +} + +Stop() +{ + set INBUILDSTANCE to 0; + call-script CloseYard(); + +} + +InitState() +{ + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState == 0 ) + { + call-script Go(); + currentstate = 0; + } + if( statechg_DesiredState == 1 ) + { + call-script Stop(); + currentstate = 1; + } + } + statechg_StateChanging = FALSE; +} + +Create() +{ + unitviewer = FALSE; + spray = 0; + call-script InitState(); + start-script SmokeUnit(); +} + +QueryNanoPiece(piecenum) +{ + if( spray == 0 ) + { + piecenum = nano1; + } + if( spray == 1 ) + { + piecenum = nano2; + } + if( spray == 2 ) + { + piecenum = nano3; + } + if( spray == 3 ) + { + piecenum = nano4; + } + ++spray; + if( spray >= 4 ) + { + spray = 0; + } +} + + +Activate() +{ + signal SIG_ACTIVATE; + start-script RequestState(0); +} + +Deactivate() +{ + signal SIG_ACTIVATE; + set-signal-mask SIG_ACTIVATE; + + set-signal-mask 0; + start-script RequestState(1); +} + +StartBuilding() +{ +building = 1; +} + +StopBuilding() +{ +building = 0; +} + +QueryBuildInfo(piecenum) +{ + piecenum = pad; +} + + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode head1 type EXPLODE_ON_HIT; + explode head2 type EXPLODE_ON_HIT; + explode side1 type EXPLODE_ON_HIT; + explode side2 type EXPLODE_ON_HIT; + explode center1 type EXPLODE_ON_HIT; + explode center2 type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xklab.cob b/Scripts/faction/xklab.cob new file mode 100644 index 000000000..464d229a1 Binary files /dev/null and b/Scripts/faction/xklab.cob differ diff --git a/Scripts/faction/xllt.bos b/Scripts/faction/xllt.bos new file mode 100644 index 000000000..a4a649ce2 --- /dev/null +++ b/Scripts/faction/xllt.bos @@ -0,0 +1,86 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, firepoint, turret, sleeve, barrel; + +// Signal definitions +#define SIG_AIM 2 + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + hide firepoint; + dont-cache firepoint; + dont-cache turret; + dont-cache sleeve; + dont-cache barrel; + dont-shade firepoint; + dont-shade turret; + dont-shade sleeve; + dont-shade barrel; + start-script SmokeUnit(); +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn turret to y-axis heading speed <5000.000000>; + turn sleeve to x-axis <0.000000> - pitch speed <5000.000000>; + wait-for-turn turret around y-axis; + wait-for-turn sleeve around x-axis; + return (1); +} + +FirePrimary() +{ + emit-sfx 1024 + 0 from firepoint; +} + +AimFromPrimary(piecenum) +{ + piecenum = sleeve; +} + +QueryPrimary(piecenum) +{ + piecenum = firepoint; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode turret type EXPLODE_ON_HIT; + explode sleeve type EXPLODE_ON_HIT; + explode barrel type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xllt.cob b/Scripts/faction/xllt.cob new file mode 100644 index 000000000..d6327dc10 Binary files /dev/null and b/Scripts/faction/xllt.cob differ diff --git a/Scripts/faction/xmetalextractor.bos b/Scripts/faction/xmetalextractor.bos new file mode 100644 index 000000000..dc3f42734 --- /dev/null +++ b/Scripts/faction/xmetalextractor.bos @@ -0,0 +1,103 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, arms1, arms2; + +static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging, ball1state, ball2state, ball3state, ball4state, ballstate; + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Go() +{ + spin arms1 around y-axis speed <50> accelerate <10>; + spin arms2 around y-axis speed <-75> accelerate <10>; +} + +Stop() +{ + stop-spin arms1 around y-axis decelerate <25>; + stop-spin arms2 around y-axis decelerate <25>; +} + +InitState() +{ + statechg_DesiredState = TRUE; + statechg_StateChanging = FALSE; +} + +RequestState(requestedstate, currentstate) +{ + if( statechg_StateChanging ) + { + statechg_DesiredState = requestedstate; + return (0); + } + statechg_StateChanging = TRUE; + currentstate = statechg_DesiredState; + statechg_DesiredState = requestedstate; + while( statechg_DesiredState != currentstate ) + { + if( statechg_DesiredState == 0 ) + { + call-script Go(); + currentstate = 0; + } + if( statechg_DesiredState == 1 ) + { + call-script Stop(); + currentstate = 1; + } + } + statechg_StateChanging = FALSE; +} + +Create() +{ + call-script InitState(); + start-script SmokeUnit(); +} + +Activate() +{ + start-script RequestState(0); +} + +Deactivate() +{ + start-script RequestState(1); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode arms1 type EXPLODE_ON_HIT; + explode arms2 type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xmetalextractor.cob b/Scripts/faction/xmetalextractor.cob new file mode 100644 index 000000000..e415a4aff Binary files /dev/null and b/Scripts/faction/xmetalextractor.cob differ diff --git a/Scripts/faction/xnukesilo.bos b/Scripts/faction/xnukesilo.bos new file mode 100644 index 000000000..82d410eaf --- /dev/null +++ b/Scripts/faction/xnukesilo.bos @@ -0,0 +1,84 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, firepoint; // these are the pieces of the model + +static-var steaming; // these are the variables + +// Signal definitions +#define SIG_AIM 2 + +SmokeUnit()// this is a standard smoke point define +{ + var healthpercent, sleeptime, smoketype; + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = SFXTYPE_BLACKSMOKE; + if( Rand( 1, 66 ) < healthpercent ) + smoketype = SFXTYPE_WHITESMOKE; + emit-sfx 1025 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + sleeptime = 200; + sleep sleeptime; + } +} + +Steam() +{ + while( TRUE ) + { + if (steaming) + { + emit-sfx 1026 + 0 from firepoint; + } + sleep 128; + } +} + +Create() // tells it what to do on creation +{ + start-script SmokeUnit(); + start-script Steam(); + steaming=TRUE; +} + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +sleep 3000; +} + +AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM; +set-signal-mask SIG_AIM; +start-script RestoreAfterDelay(); +start-script Steam(); +return (1); +} + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ +piecenum = base; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ +piecenum = firepoint; +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xnukesilo.cob b/Scripts/faction/xnukesilo.cob new file mode 100644 index 000000000..8e2a418ff Binary files /dev/null and b/Scripts/faction/xnukesilo.cob differ diff --git a/Scripts/faction/xrocketturret.bos b/Scripts/faction/xrocketturret.bos new file mode 100644 index 000000000..139024f5b --- /dev/null +++ b/Scripts/faction/xrocketturret.bos @@ -0,0 +1,95 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, firepoint1, turret, launcher, sleeve; + +static-var gun_1; + +// Signal definitions +#define SIG_AIM 2 + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx smoketype from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } + return (0); +} + +Create() +{ + start-script SmokeUnit(); + return (0); +} + +RestoreAfterDelay() +{ + sleep 3000; + stop-spin sleeve around x-axis decelerate <15.000000>; + turn turret to y-axis <0> speed <60>; + turn launcher to x-axis <0> speed <30>; +} + + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn turret to y-axis heading speed <5000.000000>; + turn launcher to x-axis <0.000000> - pitch speed <5000.000000>; + spin sleeve around z-axis speed <100.000000>; + wait-for-turn turret around y-axis; + wait-for-turn launcher around x-axis; + start-script RestoreAfterDelay(); + return (1); +} + +FirePrimary() +{ + emit-sfx 1024 from firepoint1; + return (0); +} + +AimFromPrimary(piecenum) +{ + piecenum = turret; + return (0); +} + +QueryPrimary(piecenum) +{ + piecenum = firepoint1; + return (0); +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; + explode turret type EXPLODE_ON_HIT; + explode launcher type EXPLODE_ON_HIT; + explode sleeve type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xrocketturret.cob b/Scripts/faction/xrocketturret.cob new file mode 100644 index 000000000..396f663e8 Binary files /dev/null and b/Scripts/faction/xrocketturret.cob differ diff --git a/Scripts/faction/xrocko.bos b/Scripts/faction/xrocko.bos new file mode 100644 index 000000000..9d925a519 --- /dev/null +++ b/Scripts/faction/xrocko.bos @@ -0,0 +1,538 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece torso, lbarrel, lmisspod, rshield, pelvis, rfoot, lfoot, lthigh, + rthigh, lleg, rleg, firepoint, exhaust; + +static-var bMoving, bAiming, Static_Var_3, restore_delay, moveSpeed, currentSpeed, wpn1_lasthead; + +// Signal definitions +#define SIG_AIM 4 + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + + + +walk() +{ + if( bMoving ) + { + move pelvis to y-axis [0.350000] speed [2.987069] * currentSpeed / 100; + move torso to y-axis [0.000000] now; + move rfoot to y-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lfoot to y-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + turn pelvis to y-axis <0.000000> now; + turn pelvis to z-axis <0.021978> speed <0.187571> * currentSpeed / 100; + turn torso to z-axis <-8.087912> speed <69.026146> * currentSpeed / 100; + turn lthigh to x-axis <-5.868132> speed <50.081471> * currentSpeed / 100; + turn rthigh to x-axis <8.379121> speed <71.511464> * currentSpeed / 100; + turn rfoot to x-axis <-8.379121> speed <71.511464> * currentSpeed / 100; + turn rfoot to z-axis <7.961538> speed <67.947609> * currentSpeed / 100; + turn lleg to x-axis <48.626374> speed <415.000951> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.250000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-2.934066> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.109890> speed <0.750283> * currentSpeed / 100; + turn torso to z-axis <-5.626374> speed <21.007954> * currentSpeed / 100; + turn lthigh to x-axis <-15.087912> speed <78.686053> * currentSpeed / 100; + turn rthigh to x-axis <10.060440> speed <14.349188> * currentSpeed / 100; + turn rfoot to x-axis <-6.285714> speed <17.866146> * currentSpeed / 100; + turn rfoot to z-axis <5.445055> speed <21.476881> * currentSpeed / 100; + turn lleg to x-axis <22.214286> speed <225.413510> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-6.285714> speed <28.604582> * currentSpeed / 100; + turn pelvis to z-axis <0.148352> speed <0.328253> * currentSpeed / 100; + turn torso to z-axis <-2.109890> speed <30.011372> * currentSpeed / 100; + turn lthigh to x-axis <-24.313187> speed <78.732950> * currentSpeed / 100; + turn rthigh to x-axis <12.153846> speed <17.866137> * currentSpeed / 100; + turn rfoot to x-axis <-9.219780> speed <25.040736> * currentSpeed / 100; + turn rfoot to z-axis <7.961538> speed <21.476881> * currentSpeed / 100; + turn lleg to x-axis <9.637363> speed <107.337532> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.050000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-9.219780> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.060440> speed <0.750283> * currentSpeed / 100; + turn torso to z-axis <1.406593> speed <30.011364> * currentSpeed / 100; + turn rleg to x-axis <18.021978> speed <153.808261> * currentSpeed / 100; + turn rfoot to x-axis <-12.994505> speed <32.215325> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.426724] * currentSpeed / 100; + move torso to y-axis [-0.399994] speed [3.413742] * currentSpeed / 100; + turn pelvis to y-axis <-12.153846> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.027473> speed <0.750292> * currentSpeed / 100; + turn torso to z-axis <4.219780> speed <24.009096> * currentSpeed / 100; + turn lthigh to x-axis <-27.247253> speed <25.040736> * currentSpeed / 100; + turn rthigh to x-axis <24.313187> speed <103.773686> * currentSpeed / 100; + turn rleg to x-axis <20.120879> speed <17.913034> * currentSpeed / 100; + turn rfoot to x-axis <-5.868132> speed <60.819907> * currentSpeed / 100; + turn rfoot to z-axis <0.000000> speed <67.947609> * currentSpeed / 100; + turn lleg to x-axis <30.598901> speed <178.895885> * currentSpeed / 100; + turn lfoot to x-axis <-3.351648> speed <28.604582> * currentSpeed / 100; + turn lfoot to z-axis <-2.510989> speed <21.429992> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move torso to y-axis [-0.199994] speed [3.960000] * currentSpeed / 100; + turn pelvis to y-axis <-10.043956> speed <41.775822> * currentSpeed / 100; + turn pelvis to z-axis <-0.027473> now; + sleep 2000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [1.280172] * currentSpeed / 100; + move torso to y-axis [0.000000] speed [1.706845] * currentSpeed / 100; + turn pelvis to y-axis <-6.285714> speed <32.074652> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> speed <0.093785> * currentSpeed / 100; + turn torso to z-axis <6.329670> speed <18.006820> * currentSpeed / 100; + turn lthigh to x-axis <-15.928571> speed <96.599096> * currentSpeed / 100; + turn rthigh to x-axis <15.087912> speed <78.732950> * currentSpeed / 100; + turn rleg to x-axis <26.406593> speed <53.645318> * currentSpeed / 100; + turn lfoot to x-axis <-14.247253> speed <92.988353> * currentSpeed / 100; + turn lfoot to z-axis <-6.285714> speed <32.215325> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.250000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-2.934066> speed <28.604582> * currentSpeed / 100; + turn pelvis to z-axis <0.087912> speed <1.078537> * currentSpeed / 100; + turn torso to z-axis <7.032967> speed <6.002276> * currentSpeed / 100; + turn lthigh to x-axis <-9.637363> speed <53.692206> * currentSpeed / 100; + turn rthigh to x-axis <5.027473> speed <85.860643> * currentSpeed / 100; + turn rleg to x-axis <9.637363> speed <143.116704> * currentSpeed / 100; + turn lleg to x-axis <23.054945> speed <64.383762> * currentSpeed / 100; + turn lfoot to x-axis <-12.571429> speed <14.302291> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.350000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <0.000000> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.054945> speed <1.219211> * currentSpeed / 100; + turn torso to z-axis <8.439560> speed <12.004544> * currentSpeed / 100; + turn lthigh to x-axis <16.763736> speed <225.319724> * currentSpeed / 100; + turn rthigh to x-axis <-5.868132> speed <92.988353> * currentSpeed / 100; + turn rleg to x-axis <0.000000> speed <82.249908> * currentSpeed / 100; + turn rfoot to x-axis <0.000000> speed <50.081471> * currentSpeed / 100; + turn lleg to x-axis <0.000000> speed <196.762031> * currentSpeed / 100; + turn lfoot to x-axis <-7.543956> speed <42.906882> * currentSpeed / 100; + turn lfoot to z-axis <-7.961538> speed <14.302291> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [1.706897] * currentSpeed / 100; + turn pelvis to y-axis <6.285714> speed <53.645318> * currentSpeed / 100; + turn pelvis to z-axis <-0.010989> speed <0.375142> * currentSpeed / 100; + turn torso to z-axis <2.109890> speed <54.020459> * currentSpeed / 100; + turn lthigh to x-axis <20.120879> speed <28.651479> * currentSpeed / 100; + turn rthigh to x-axis <-12.571429> speed <57.209173> * currentSpeed / 100; + turn lleg to x-axis <5.027473> speed <42.906882> * currentSpeed / 100; + turn lfoot to x-axis <-11.736264> speed <35.779180> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.050000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <9.219780> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.148352> speed <1.359893> * currentSpeed / 100; + turn torso to z-axis <-1.054945> speed <27.010230> * currentSpeed / 100; + turn rthigh to x-axis <-20.538462> speed <67.994506> * currentSpeed / 100; + turn lleg to x-axis <16.346154> speed <96.599088> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.426724] * currentSpeed / 100; + move torso to y-axis [-0.399994] speed [3.413742] * currentSpeed / 100; + turn pelvis to y-axis <12.153846> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> speed <1.594361> * currentSpeed / 100; + turn torso to z-axis <-4.923077> speed <33.012506> * currentSpeed / 100; + turn lthigh to x-axis <24.313187> speed <35.779180> * currentSpeed / 100; + turn rthigh to x-axis <-27.247253> speed <57.256061> * currentSpeed / 100; + turn rleg to x-axis <30.598901> speed <261.145793> * currentSpeed / 100; + turn rfoot to x-axis <-4.186813> speed <35.732283> * currentSpeed / 100; + turn rfoot to z-axis <4.186813> speed <35.732283> * currentSpeed / 100; + turn lleg to x-axis <20.956044> speed <39.343027> * currentSpeed / 100; + turn lfoot to x-axis <-7.543956> speed <35.779180> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move torso to y-axis [-0.199994] speed [3.960000] * currentSpeed / 100; + turn pelvis to y-axis <10.043956> speed <41.775822> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> now; + turn torso to z-axis <-4.571429> speed <6.962630> * currentSpeed / 100; + sleep 2000 / currentSpeed; + } + move torso to y-axis [0.000000] speed [1.706845] * currentSpeed / 100; + turn pelvis to y-axis <6.285714> speed <32.074652> * currentSpeed / 100; + turn pelvis to z-axis <0.038462> speed <0.656507> * currentSpeed / 100; + turn torso to z-axis <-6.329670> speed <15.005677> * currentSpeed / 100; + turn lthigh to x-axis <14.247253> speed <85.907540> * currentSpeed / 100; + turn rthigh to x-axis <-21.796703> speed <46.517625> * currentSpeed / 100; + turn rfoot to x-axis <-7.543956> speed <28.651479> * currentSpeed / 100; + turn rfoot to z-axis <5.868132> speed <14.349188> * currentSpeed / 100; + turn lleg to x-axis <33.950549> speed <110.901379> * currentSpeed / 100; + sleep 8000 / currentSpeed; +} + +walklegs() +{ + if( bMoving ) + { + move pelvis to y-axis [0.350000] speed [2.987069] * currentSpeed / 100; + move rfoot to y-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lfoot to y-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + turn pelvis to y-axis <0.000000> speed <53.645318> * currentSpeed / 100; + turn pelvis to z-axis <0.021978> speed <0.140682> * currentSpeed / 100; + turn lthigh to x-axis <-5.868132> speed <171.674406> * currentSpeed / 100; + turn rthigh to x-axis <8.379121> speed <257.535050> * currentSpeed / 100; + turn rfoot to x-axis <-8.379121> speed <7.127701> * currentSpeed / 100; + turn rfoot to z-axis <7.961538> speed <17.866137> * currentSpeed / 100; + turn lleg to x-axis <48.626374> speed <125.250575> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.250000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-2.934066> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.109890> speed <0.750283> * currentSpeed / 100; + turn lthigh to x-axis <-15.087912> speed <78.686053> * currentSpeed / 100; + turn rthigh to x-axis <10.060440> speed <14.349188> * currentSpeed / 100; + turn rfoot to x-axis <-6.285714> speed <17.866146> * currentSpeed / 100; + turn rfoot to z-axis <5.445055> speed <21.476881> * currentSpeed / 100; + turn lleg to x-axis <22.214286> speed <225.413510> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-6.285714> speed <28.604582> * currentSpeed / 100; + turn pelvis to z-axis <0.148352> speed <0.328253> * currentSpeed / 100; + turn lthigh to x-axis <-24.313187> speed <78.732950> * currentSpeed / 100; + turn rthigh to x-axis <12.153846> speed <17.866137> * currentSpeed / 100; + turn rfoot to x-axis <-9.219780> speed <25.040736> * currentSpeed / 100; + turn rfoot to z-axis <7.961538> speed <21.476881> * currentSpeed / 100; + turn lleg to x-axis <9.637363> speed <107.337532> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.050000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-9.219780> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.060440> speed <0.750283> * currentSpeed / 100; + turn rleg to x-axis <18.021978> speed <107.337532> * currentSpeed / 100; + turn rfoot to x-axis <-12.994505> speed <32.215325> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.426724] * currentSpeed / 100; + turn pelvis to y-axis <-12.153846> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.027473> speed <0.750292> * currentSpeed / 100; + turn lthigh to x-axis <-27.247253> speed <25.040736> * currentSpeed / 100; + turn rthigh to x-axis <24.313187> speed <103.773686> * currentSpeed / 100; + turn rleg to x-axis <20.120879> speed <17.913034> * currentSpeed / 100; + turn rfoot to x-axis <-5.868132> speed <60.819907> * currentSpeed / 100; + turn rfoot to z-axis <0.000000> speed <67.947609> * currentSpeed / 100; + turn lleg to x-axis <30.598901> speed <178.895885> * currentSpeed / 100; + turn lfoot to x-axis <-3.351648> speed <35.779180> * currentSpeed / 100; + turn lfoot to z-axis <-2.510989> speed <46.517616> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [1.280172] * currentSpeed / 100; + turn pelvis to y-axis <-6.285714> speed <50.081471> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> speed <0.093785> * currentSpeed / 100; + turn lthigh to x-axis <-15.928571> speed <96.599096> * currentSpeed / 100; + turn rthigh to x-axis <15.087912> speed <78.732950> * currentSpeed / 100; + turn rleg to x-axis <26.406593> speed <53.645318> * currentSpeed / 100; + turn lfoot to x-axis <-14.247253> speed <92.988353> * currentSpeed / 100; + turn lfoot to z-axis <-6.285714> speed <32.215325> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.250000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <-2.934066> speed <28.604582> * currentSpeed / 100; + turn pelvis to z-axis <0.087912> speed <1.078537> * currentSpeed / 100; + turn lthigh to x-axis <-9.637363> speed <53.692206> * currentSpeed / 100; + turn rthigh to x-axis <5.027473> speed <85.860643> * currentSpeed / 100; + turn rleg to x-axis <9.637363> speed <143.116704> * currentSpeed / 100; + turn lleg to x-axis <23.054945> speed <64.383762> * currentSpeed / 100; + turn lfoot to x-axis <-12.571429> speed <14.302291> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.350000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <0.000000> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.054945> speed <1.219211> * currentSpeed / 100; + turn lthigh to x-axis <16.763736> speed <225.319724> * currentSpeed / 100; + turn rthigh to x-axis <-5.868132> speed <92.988353> * currentSpeed / 100; + turn rleg to x-axis <0.000000> speed <82.249908> * currentSpeed / 100; + turn rfoot to x-axis <0.000000> speed <50.081471> * currentSpeed / 100; + turn lleg to x-axis <0.000000> speed <196.762031> * currentSpeed / 100; + turn lfoot to x-axis <-7.543956> speed <42.906882> * currentSpeed / 100; + turn lfoot to z-axis <-7.961538> speed <14.302291> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.150000] speed [1.706897] * currentSpeed / 100; + turn pelvis to y-axis <6.285714> speed <53.645318> * currentSpeed / 100; + turn pelvis to z-axis <-0.010989> speed <0.375142> * currentSpeed / 100; + turn lthigh to x-axis <20.120879> speed <28.651479> * currentSpeed / 100; + turn rthigh to x-axis <-12.571429> speed <57.209173> * currentSpeed / 100; + turn lleg to x-axis <5.027473> speed <42.906882> * currentSpeed / 100; + turn lfoot to x-axis <-11.736264> speed <35.779180> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.050000] speed [0.853448] * currentSpeed / 100; + turn pelvis to y-axis <9.219780> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <0.148352> speed <1.359893> * currentSpeed / 100; + turn rthigh to x-axis <-20.538462> speed <67.994506> * currentSpeed / 100; + turn lleg to x-axis <16.346154> speed <96.599088> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.426724] * currentSpeed / 100; + turn pelvis to y-axis <12.153846> speed <25.040736> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> speed <1.594361> * currentSpeed / 100; + turn lthigh to x-axis <24.313187> speed <35.779180> * currentSpeed / 100; + turn rthigh to x-axis <-27.247253> speed <57.256061> * currentSpeed / 100; + turn rleg to x-axis <30.598901> speed <261.145793> * currentSpeed / 100; + turn rfoot to x-axis <-4.186813> speed <35.732283> * currentSpeed / 100; + turn rfoot to z-axis <4.186813> speed <35.732283> * currentSpeed / 100; + turn lleg to x-axis <20.956044> speed <39.343027> * currentSpeed / 100; + turn lfoot to x-axis <-7.543956> speed <35.779180> * currentSpeed / 100; + sleep 8000 / currentSpeed; + } + if( bMoving ) + { + turn pelvis to y-axis <10.043956> speed <41.775822> * currentSpeed / 100; + turn pelvis to z-axis <-0.038462> now; + sleep 2000 / currentSpeed; + } + turn pelvis to y-axis <6.285714> speed <32.074652> * currentSpeed / 100; + turn pelvis to z-axis <0.038462> speed <0.656507> * currentSpeed / 100; + turn lthigh to x-axis <14.247253> speed <85.907540> * currentSpeed / 100; + turn rthigh to x-axis <-21.796703> speed <46.517625> * currentSpeed / 100; + turn rfoot to x-axis <-7.543956> speed <28.651479> * currentSpeed / 100; + turn rfoot to z-axis <5.868132> speed <14.349188> * currentSpeed / 100; + turn lleg to x-axis <33.950549> speed <110.901379> * currentSpeed / 100; + sleep 8000 / currentSpeed; +} + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = bAiming; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + move pelvis to y-axis [0.000000] speed [1.000000]; + turn rthigh to x-axis <0.000000> speed <200.043956>; + turn rleg to x-axis <0.000000> speed <200.043956>; + turn rfoot to x-axis <0.000000> speed <200.043956>; + turn lthigh to x-axis <0.000000> speed <200.043956>; + turn lleg to x-axis <0.000000> speed <200.043956>; + turn lfoot to x-axis <0.000000> speed <200.043956>; + turn torso to x-axis <0.000000> speed <90.021978>; + turn torso to z-axis <0.000000> speed <90.021978>; + if( !aiming ) + { + turn torso to y-axis <0.000000> speed <90.021978>; + turn lmisspod to x-axis <0.000000> speed <200.043956>; + } + justmoved = FALSE; + } + sleep 100; + } + } +} + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = 2 * (get CURRENT_SPEED)*100/moveSpeed; + if (currentSpeed<40) currentSpeed=40; + sleep 142; + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script UnitSpeed(); + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + bMoving = FALSE; + bAiming = FALSE; + Static_Var_3 = 1; + restore_delay = 3000; + moveSpeed = get MAX_SPEED; + currentSpeed = 100; + start-script SmokeUnit(); +} + +SetMaxReloadTime(Func_Var_1) +{ + restore_delay = Func_Var_1 * 2; +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + +SweetSpot(piecenum) +{ + piecenum = torso; +} + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM; + sleep restore_delay; + turn torso to y-axis <0.000000> speed <90.021978>; + turn lmisspod to x-axis <0.000000> speed <90.010989>; + wait-for-turn torso around y-axis; + wait-for-turn lmisspod around x-axis; + wpn1_lasthead = 1000000; + bAiming = FALSE; +} + +AimFromPrimary(piecenum) +{ + piecenum = torso; +} + +QueryPrimary(piecenum) +{ + piecenum = lbarrel; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + bAiming = TRUE; + while( !Static_Var_3 ) + { + return(0); + } + turn torso to y-axis heading speed <5000.027473>; + turn lmisspod to x-axis <-90> - pitch speed <5000.021978>; + if (((get ABS(wpn1_lasthead - heading)) > 65536) OR(((get ABS(wpn1_lasthead - heading)) > 1300) AND ((get ABS(wpn1_lasthead - heading)) < 64236))) + { + wpn1_lasthead = 1000000; + wait-for-turn torso around y-axis; + wait-for-turn lmisspod around x-axis; + } + start-script RestoreAfterDelay(); + wpn1_lasthead = heading; + return (1); +} + +FirePrimary() +{ + emit-sfx 1024 + 0 from firepoint; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode torso type EXPLODE_ON_HIT; + explode rshield type EXPLODE_ON_HIT; + explode lmisspod type EXPLODE_ON_HIT; + explode lbarrel type EXPLODE_ON_HIT; + explode rthigh type EXPLODE_ON_HIT; + explode rleg type EXPLODE_ON_HIT; + explode rfoot type EXPLODE_ON_HIT; + explode lthigh type EXPLODE_ON_HIT; + explode lleg type EXPLODE_ON_HIT; + explode lfoot type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xrocko.cob b/Scripts/faction/xrocko.cob new file mode 100644 index 000000000..83b0ca23b Binary files /dev/null and b/Scripts/faction/xrocko.cob differ diff --git a/Scripts/faction/xskulk.bos b/Scripts/faction/xskulk.bos new file mode 100644 index 000000000..303bb6dc7 --- /dev/null +++ b/Scripts/faction/xskulk.bos @@ -0,0 +1,671 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece torso, ruparm, luparm, rfire, lfire, rloarm, lloarm, pelvis, + rleg, rfoot, lleg, lfoot, lthigh, rthigh,lknee,rknee, aimy1, aimx1; + +static-var bMoving, bAiming, Static_Var_3, gun_1, moveSpeed, currentSpeed, animSpeed, wpn1_lasthead, shooting_num; + +// Signal definitions +#define SIG_AIM 4 + + +walk() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.337500] * currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + move lleg to z-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + move luparm to x-axis [0.000000] now; + move luparm to y-axis [0.000000] now; + move luparm to z-axis [0.000000] now; + move ruparm to x-axis [0.000000] now; + move ruparm to y-axis [0.000000] now; + move ruparm to z-axis [0.000000] now; + move rloarm to x-axis [0.000000] now; + move rfire to x-axis [0.000000] now; + move lloarm to x-axis [0.000000] now; + move lfire to x-axis [0.000000] now; + turn pelvis to x-axis <-0.423077> speed <0.317308> * currentSpeed; + turn torso to x-axis <12.648352> speed <9.486264> * currentSpeed; + turn lthigh to x-axis <11.060440> speed <8.295330> * currentSpeed; + turn rthigh to x-axis <-42.060440> speed <31.545330> * currentSpeed; + turn rleg to x-axis <-4.857143> speed <3.642857> * currentSpeed; + turn rfoot to x-axis <46.934066> speed <35.200550> * currentSpeed; + turn lleg to x-axis <61.000000> speed <45.750000> * currentSpeed; + turn lfoot to x-axis <-50.390110> speed <37.792583> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <34.093407> speed <17.274725> * currentSpeed; + turn rthigh to x-axis <-27.890110> speed <10.627747> * currentSpeed; + turn rleg to x-axis <-6.637363> speed <1.335165> * currentSpeed; + turn rfoot to x-axis <37.637363> speed <6.972527> * currentSpeed; + turn lleg to x-axis <33.615385> speed <20.538461> * currentSpeed; + turn lfoot to x-axis <-24.604396> speed <19.339285> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <28.747253> speed <4.009615> * currentSpeed; + turn rthigh to x-axis <-19.027473> speed <6.646978> * currentSpeed; + turn rleg to x-axis <-4.412088> speed <1.668956> * currentSpeed; + turn rfoot to x-axis <27.890110> speed <7.310440> * currentSpeed; + turn lleg to x-axis <13.725275> speed <14.917583> * currentSpeed; + turn lfoot to x-axis <-25.978022> speed <1.030219> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <12.813187> speed <11.950550> * currentSpeed; + turn rthigh to x-axis <0.000000> speed <14.270605> * currentSpeed; + turn rleg to x-axis <3.082418> speed <5.620879> * currentSpeed; + turn rfoot to x-axis <2.203297> speed <19.265110> * currentSpeed; + turn lleg to x-axis <-12.335165> speed <19.545330> * currentSpeed; + turn lfoot to x-axis <7.648352> speed <25.219780> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.302198> speed <0.259615> * currentSpeed; + turn lthigh to x-axis <-19.467033> speed <24.210165> * currentSpeed; + turn rthigh to x-axis <1.758242> speed <1.318682> * currentSpeed; + turn rleg to x-axis <8.401099> speed <3.989011> * currentSpeed; + turn rfoot to x-axis <-6.181319> speed <6.288462> * currentSpeed; + turn lleg to x-axis <-16.813187> speed <3.358516> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <26.142857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.302198> now; + turn lthigh to x-axis <-32.324176> speed <9.642857> * currentSpeed; + turn rthigh to x-axis <13.280220> speed <8.641484> * currentSpeed; + turn rleg to x-axis <23.159341> speed <11.068682> * currentSpeed; + turn rfoot to x-axis <-33.170330> speed <20.241758> * currentSpeed; + turn lfoot to x-axis <7.357143> speed <26.361264> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> speed <0.259615> * currentSpeed; + turn lthigh to x-axis <-36.291209> speed <2.975275> * currentSpeed; + turn rleg to x-axis <43.571429> speed <15.309066> * currentSpeed; + turn rfoot to x-axis <-43.148352> speed <7.483517> * currentSpeed; + turn lleg to x-axis <-10.082418> speed <5.048077> * currentSpeed; + turn lfoot to x-axis <28.236264> speed <15.659341> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> now; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-42.060440> speed <4.326923> * currentSpeed; + turn rthigh to x-axis <12.824176> speed <0.342033> * currentSpeed; + turn rleg to x-axis <60.692308> speed <12.840659> * currentSpeed; + turn rfoot to x-axis <-44.824176> speed <1.256868> * currentSpeed; + turn lleg to x-axis <-4.412088> speed <4.252748> * currentSpeed; + turn lfoot to x-axis <46.934066> speed <14.023352> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-32.758242> speed <6.976648> * currentSpeed; + turn rthigh to x-axis <34.093407> speed <15.951923> * currentSpeed; + turn rleg to x-axis <23.615385> speed <27.807692> * currentSpeed; + turn rfoot to x-axis <-10.791209> speed <25.524725> * currentSpeed; + turn lleg to x-axis <-5.747253> speed <1.001374> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <3.321428> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-25.225275> speed <5.649725> * currentSpeed; + turn rthigh to x-axis <28.769231> speed <3.993132> * currentSpeed; + turn rleg to x-axis <10.527473> speed <9.815934> * currentSpeed; + turn rfoot to x-axis <-20.978022> speed <7.640110> * currentSpeed; + turn lleg to x-axis <-3.978022> speed <1.326923> * currentSpeed; + turn lfoot to x-axis <33.648352> speed <6.642857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-12.390110> speed <9.626374> * currentSpeed; + turn rthigh to x-axis <-0.423077> speed <21.894231> * currentSpeed; + turn rleg to x-axis <-11.659341> speed <16.640110> * currentSpeed; + turn rfoot to x-axis <22.978022> speed <32.967033> * currentSpeed; + turn lleg to x-axis <4.115385> speed <6.070055> * currentSpeed; + turn lfoot to x-axis <14.016484> speed <14.723901> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <0.000000> speed <9.292582> * currentSpeed; + turn rthigh to x-axis <-19.467033> speed <14.282967> * currentSpeed; + turn rleg to x-axis <-20.302198> speed <6.482143> * currentSpeed; + turn rfoot to x-axis <23.445055> speed <0.350275> * currentSpeed; + turn lleg to x-axis <24.203297> speed <15.065934> * currentSpeed; + turn lfoot to x-axis <-20.736264> speed <26.064561> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <9.280220> speed <6.960165> * currentSpeed; + turn rthigh to x-axis <-28.769231> speed <6.976649> * currentSpeed; + turn rleg to x-axis <-25.225275> speed <3.692308> * currentSpeed; + turn rfoot to x-axis <26.115385> speed <2.002747> * currentSpeed; + turn lleg to x-axis <31.868132> speed <5.748626> * currentSpeed; + turn lfoot to x-axis <-37.637363> speed <12.675824> * currentSpeed; + sleep animSpeed; + } + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <11.060440> speed <1.335165> * currentSpeed; + turn rthigh to x-axis <-37.192308> speed <6.317308> * currentSpeed; + turn rleg to x-axis <-9.280220> speed <11.958791> * currentSpeed; + turn rfoot to x-axis <6.104396> speed <15.008242> * currentSpeed; + turn lleg to x-axis <47.604396> speed <11.802198> * currentSpeed; + turn lfoot to x-axis <-47.412088> speed <7.331044> * currentSpeed; + sleep animSpeed; +} + +walklegs() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + move lleg to z-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + move luparm to x-axis [0.000000] now; + move luparm to y-axis [0.000000] now; + move luparm to z-axis [0.000000] now; + move ruparm to x-axis [0.000000] now; + move ruparm to y-axis [0.000000] now; + move ruparm to z-axis [0.000000] now; + move rloarm to x-axis [0.000000] now; + move rfire to x-axis [0.000000] now; + move lloarm to x-axis [0.000000] now; + move lfire to x-axis [0.000000] now; + turn pelvis to x-axis <-0.423077> now; + turn lthigh to x-axis <11.060440> now; + turn rthigh to x-axis <-42.060440> speed <3.651099> * currentSpeed; + turn rleg to x-axis <-4.857143> speed <3.317308> * currentSpeed; + turn rfoot to x-axis <46.934066> speed <30.622253> * currentSpeed; + turn lleg to x-axis <61.000000> speed <10.046703> * currentSpeed; + turn lfoot to x-axis <-50.390110> speed <2.233517> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <34.093407> speed <17.274725> * currentSpeed; + turn rthigh to x-axis <-27.890110> speed <10.627747> * currentSpeed; + turn rleg to x-axis <-6.637363> speed <1.335165> * currentSpeed; + turn rfoot to x-axis <37.637363> speed <6.972527> * currentSpeed; + turn lleg to x-axis <33.615385> speed <20.538461> * currentSpeed; + turn lfoot to x-axis <-24.604396> speed <19.339285> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <28.747253> speed <4.009615> * currentSpeed; + turn rthigh to x-axis <-19.027473> speed <6.646978> * currentSpeed; + turn rleg to x-axis <-4.412088> speed <1.668956> * currentSpeed; + turn rfoot to x-axis <27.890110> speed <7.310440> * currentSpeed; + turn lleg to x-axis <13.725275> speed <14.917583> * currentSpeed; + turn lfoot to x-axis <-25.978022> speed <1.030219> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <12.813187> speed <11.950550> * currentSpeed; + turn rthigh to x-axis <0.000000> speed <14.270605> * currentSpeed; + turn rleg to x-axis <3.082418> speed <5.620879> * currentSpeed; + turn rfoot to x-axis <2.203297> speed <19.265110> * currentSpeed; + turn lleg to x-axis <-12.335165> speed <19.545330> * currentSpeed; + turn lfoot to x-axis <7.648352> speed <25.219780> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <-19.467033> speed <24.210165> * currentSpeed; + turn rthigh to x-axis <1.758242> speed <1.318682> * currentSpeed; + turn rleg to x-axis <8.401099> speed <3.989011> * currentSpeed; + turn rfoot to x-axis <-6.181319> speed <6.288462> * currentSpeed; + turn lleg to x-axis <-16.813187> speed <3.358516> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <26.142857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <-32.324176> speed <9.642857> * currentSpeed; + turn rthigh to x-axis <13.280220> speed <8.641484> * currentSpeed; + turn rleg to x-axis <23.159341> speed <11.068682> * currentSpeed; + turn rfoot to x-axis <-33.170330> speed <20.241758> * currentSpeed; + turn lfoot to x-axis <7.357143> speed <26.361264> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <-36.291209> speed <2.975275> * currentSpeed; + turn rleg to x-axis <43.571429> speed <15.309066> * currentSpeed; + turn rfoot to x-axis <-43.148352> speed <7.483517> * currentSpeed; + turn lleg to x-axis <-10.082418> speed <5.048077> * currentSpeed; + turn lfoot to x-axis <28.236264> speed <15.659341> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> now; + turn lthigh to x-axis <-42.060440> speed <4.326923> * currentSpeed; + turn rthigh to x-axis <12.824176> speed <0.342033> * currentSpeed; + turn rleg to x-axis <60.692308> speed <12.840659> * currentSpeed; + turn rfoot to x-axis <-44.824176> speed <1.256868> * currentSpeed; + turn lleg to x-axis <-4.412088> speed <4.252748> * currentSpeed; + turn lfoot to x-axis <46.934066> speed <14.023352> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <-32.758242> speed <6.976648> * currentSpeed; + turn rthigh to x-axis <34.093407> speed <15.951923> * currentSpeed; + turn rleg to x-axis <23.615385> speed <27.807692> * currentSpeed; + turn rfoot to x-axis <-10.791209> speed <25.524725> * currentSpeed; + turn lleg to x-axis <-5.747253> speed <1.001374> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <3.321428> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <-25.225275> speed <5.649725> * currentSpeed; + turn rthigh to x-axis <28.769231> speed <3.993132> * currentSpeed; + turn rleg to x-axis <10.527473> speed <9.815934> * currentSpeed; + turn rfoot to x-axis <-20.978022> speed <7.640110> * currentSpeed; + turn lleg to x-axis <-3.978022> speed <1.326923> * currentSpeed; + turn lfoot to x-axis <33.648352> speed <6.642857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <-12.390110> speed <9.626374> * currentSpeed; + turn rthigh to x-axis <-0.423077> speed <21.894231> * currentSpeed; + turn rleg to x-axis <-11.659341> speed <16.640110> * currentSpeed; + turn rfoot to x-axis <22.978022> speed <32.967033> * currentSpeed; + turn lleg to x-axis <4.115385> speed <6.070055> * currentSpeed; + turn lfoot to x-axis <14.016484> speed <14.723901> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <0.000000> speed <9.292582> * currentSpeed; + turn rthigh to x-axis <-19.467033> speed <14.282967> * currentSpeed; + turn rleg to x-axis <-20.302198> speed <6.482143> * currentSpeed; + turn rfoot to x-axis <23.445055> speed <0.350275> * currentSpeed; + turn lleg to x-axis <24.203297> speed <15.065934> * currentSpeed; + turn lfoot to x-axis <-20.736264> speed <26.064561> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <9.280220> speed <6.960165> * currentSpeed; + turn rthigh to x-axis <-28.769231> speed <6.976649> * currentSpeed; + turn rleg to x-axis <-25.225275> speed <3.692308> * currentSpeed; + turn rfoot to x-axis <26.115385> speed <2.002747> * currentSpeed; + turn lleg to x-axis <31.868132> speed <5.748626> * currentSpeed; + turn lfoot to x-axis <-37.637363> speed <12.675824> * currentSpeed; + sleep animSpeed; + } + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <11.060440> speed <1.335165> * currentSpeed; + turn rthigh to x-axis <-37.192308> speed <6.317308> * currentSpeed; + turn rleg to x-axis <-9.280220> speed <11.958791> * currentSpeed; + turn rfoot to x-axis <6.104396> speed <15.008242> * currentSpeed; + turn lleg to x-axis <47.604396> speed <11.802198> * currentSpeed; + turn lfoot to x-axis <-47.412088> speed <7.331044> * currentSpeed; + sleep animSpeed; +} + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = (get CURRENT_SPEED)*100/moveSpeed; + if (currentSpeed<20) currentSpeed=20; + animSpeed = 3700 / currentSpeed; + sleep 142; + } +} + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = bAiming; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + move pelvis to y-axis [0.000000] speed [1.000000]; + turn rthigh to x-axis <0.000000> speed <200.000000>; + turn rleg to x-axis <0.000000> speed <200.000000>; + turn rfoot to x-axis <0.000000> speed <200.000000>; + turn lthigh to x-axis <0.000000> speed <200.000000>; + turn lleg to x-axis <0.000000> speed <200.000000>; + turn lfoot to x-axis <0.000000> speed <200.000000>; + if( !aiming ) + { + turn torso to y-axis <0.000000> speed <90.000000>; + turn rloarm to x-axis <0.000000> speed <200.000000>; + turn ruparm to x-axis <0.000000> speed <200.000000>; + turn lloarm to x-axis <0.000000> speed <200.000000>; + turn luparm to x-axis <0.000000> speed <200.000000>; + } + justmoved = FALSE; + } + sleep 100; + } + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script UnitSpeed(); + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + hide rfire; + hide lfire; + bMoving = FALSE; + bAiming = FALSE; + Static_Var_3 = 1; + gun_1 = torso; + shooting_num=1; + currentSpeed = 100; + moveSpeed = get MAX_SPEED; + animSpeed = 38; + //start-script InitialSetup1(); + start-script SmokeUnit(); +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + +SweetSpot(piecenum) +{ + piecenum = torso; +} + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM; + sleep 2750; + bAiming = FALSE; + turn torso to y-axis <0> speed <60>; + turn rloarm to x-axis <0> speed <30>; + turn lloarm to x-axis <0> speed <30>; +} + +AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM; +set-signal-mask SIG_AIM; +turn torso to y-axis heading speed <5000>; +turn rloarm to x-axis <0> - pitch speed <5000>; +turn lloarm to x-axis <0> - pitch speed <5000>; +wait-for-turn torso around y-axis; +wait-for-turn rloarm around x-axis; +wait-for-turn lloarm around x-axis; +start-script RestoreAfterDelay(); +return (1); +} + +FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets +{ + + if(shooting_num==1) + { + emit-sfx 1024 from rfire; + } + + if(shooting_num==2) + { + emit-sfx 1024 from lfire; + } + + shooting_num=shooting_num+1; + + if( shooting_num == 3) + { + shooting_num=1; + } +} + +AimFromWeapon1(piecenum) // where it aims the weapon from +{ +piecenum = torso; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ + if (shooting_num==1) + { + piecenum=lfire; + } + + if (shooting_num==2) + { + piecenum=rfire; + } +} + +Killed(severity, corpsetype) +{ + hide rfire; + hide lfire; + if( severity <= 25 ) + { + corpsetype = 1 ; + explode pelvis type BITMAPONLY | NOHEATCLOUD; + explode torso type BITMAPONLY | NOHEATCLOUD; + //explode ruparm type BITMAPONLY | NOHEATCLOUD; + //explode rloarm type BITMAPONLY | NOHEATCLOUD; + //explode rfire type BITMAPONLY | NOHEATCLOUD; + //explode luparm type BITMAPONLY | NOHEATCLOUD; + //explode lloarm type BITMAPONLY | NOHEATCLOUD; + //explode lfire type BITMAPONLY | NOHEATCLOUD; + //explode rthigh type BITMAPONLY | NOHEATCLOUD; + //explode rknee type BITMAPONLY | NOHEATCLOUD; + //explode rleg type BITMAPONLY | NOHEATCLOUD; + //explode rfoot type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lthigh type BITMAPONLY | NOHEATCLOUD; + //explode lknee type BITMAPONLY | NOHEATCLOUD; + //explode lleg type BITMAPONLY | NOHEATCLOUD; + //explode lfoot type BITMAPONLY | NOHEATCLOUD; + return(corpsetype); + } + if( severity <= 50 ) + { + corpsetype = 2 ; + explode pelvis type BITMAPONLY | NOHEATCLOUD; + explode torso type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode ruparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfire type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode luparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lfire type FALL | NOHEATCLOUD; + explode rthigh type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rknee type FALL | NOHEATCLOUD; + //explode rleg type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfoot type FALL | NOHEATCLOUD; + explode lthigh type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type FALL | NOHEATCLOUD; + explode lleg type FALL | NOHEATCLOUD; + explode lfoot type FIRE | SMOKE | FALL | NOHEATCLOUD; + return(corpsetype); + } + if( severity <= 99 ) + { + corpsetype = 3 ; + explode pelvis type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode torso type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode ruparm type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfire type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode luparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lloarm type SMOKE | FALL | NOHEATCLOUD; + //explode lfire type SMOKE | FALL | NOHEATCLOUD; + //explode rthigh type SMOKE | FALL | NOHEATCLOUD; + //explode rknee type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rleg type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rfoot type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode lthigh type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lleg type SMOKE | FALL | NOHEATCLOUD; + explode lfoot type SMOKE | FALL | NOHEATCLOUD; + return(corpsetype); + } + corpsetype = 3 ; + explode pelvis type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode torso type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + explode ruparm type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode rfire type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode luparm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode lloarm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode lfire type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rthigh type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode rknee type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rleg type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + explode rfoot type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lthigh type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lleg type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lfoot type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + return corpsetype; +} diff --git a/Scripts/faction/xskulk.bosoriginal b/Scripts/faction/xskulk.bosoriginal new file mode 100644 index 000000000..2907d98d8 --- /dev/null +++ b/Scripts/faction/xskulk.bosoriginal @@ -0,0 +1,644 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" +#include "unitDefsTurretSpeeds.h" + +piece torso, ruparm, luparm, rfire, lfire, rloarm, lloarm, pelvis, + rleg, rfoot, lleg, lfoot, lthigh, rthigh,lknee,rknee, aimy1, aimx1; + +static-var bMoving, bAiming, Static_Var_3, gun_1, moveSpeed, currentSpeed, animSpeed, wpn1_lasthead; + +#include "weapon1control.h" + +// Signal definitions +#define SIG_AIM 4 + + +walk() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.337500] * currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + move lleg to z-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + move luparm to x-axis [0.000000] now; + move luparm to y-axis [0.000000] now; + move luparm to z-axis [0.000000] now; + move ruparm to x-axis [0.000000] now; + move ruparm to y-axis [0.000000] now; + move ruparm to z-axis [0.000000] now; + move rloarm to x-axis [0.000000] now; + move rfire to x-axis [0.000000] now; + move lloarm to x-axis [0.000000] now; + move lfire to x-axis [0.000000] now; + turn pelvis to x-axis <-0.423077> speed <0.317308> * currentSpeed; + turn torso to x-axis <12.648352> speed <9.486264> * currentSpeed; + turn lthigh to x-axis <11.060440> speed <8.295330> * currentSpeed; + turn rthigh to x-axis <-42.060440> speed <31.545330> * currentSpeed; + turn rleg to x-axis <-4.857143> speed <3.642857> * currentSpeed; + turn rfoot to x-axis <46.934066> speed <35.200550> * currentSpeed; + turn lleg to x-axis <61.000000> speed <45.750000> * currentSpeed; + turn lfoot to x-axis <-50.390110> speed <37.792583> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <34.093407> speed <17.274725> * currentSpeed; + turn rthigh to x-axis <-27.890110> speed <10.627747> * currentSpeed; + turn rleg to x-axis <-6.637363> speed <1.335165> * currentSpeed; + turn rfoot to x-axis <37.637363> speed <6.972527> * currentSpeed; + turn lleg to x-axis <33.615385> speed <20.538461> * currentSpeed; + turn lfoot to x-axis <-24.604396> speed <19.339285> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <28.747253> speed <4.009615> * currentSpeed; + turn rthigh to x-axis <-19.027473> speed <6.646978> * currentSpeed; + turn rleg to x-axis <-4.412088> speed <1.668956> * currentSpeed; + turn rfoot to x-axis <27.890110> speed <7.310440> * currentSpeed; + turn lleg to x-axis <13.725275> speed <14.917583> * currentSpeed; + turn lfoot to x-axis <-25.978022> speed <1.030219> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <12.813187> speed <11.950550> * currentSpeed; + turn rthigh to x-axis <0.000000> speed <14.270605> * currentSpeed; + turn rleg to x-axis <3.082418> speed <5.620879> * currentSpeed; + turn rfoot to x-axis <2.203297> speed <19.265110> * currentSpeed; + turn lleg to x-axis <-12.335165> speed <19.545330> * currentSpeed; + turn lfoot to x-axis <7.648352> speed <25.219780> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.302198> speed <0.259615> * currentSpeed; + turn lthigh to x-axis <-19.467033> speed <24.210165> * currentSpeed; + turn rthigh to x-axis <1.758242> speed <1.318682> * currentSpeed; + turn rleg to x-axis <8.401099> speed <3.989011> * currentSpeed; + turn rfoot to x-axis <-6.181319> speed <6.288462> * currentSpeed; + turn lleg to x-axis <-16.813187> speed <3.358516> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <26.142857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.302198> now; + turn lthigh to x-axis <-32.324176> speed <9.642857> * currentSpeed; + turn rthigh to x-axis <13.280220> speed <8.641484> * currentSpeed; + turn rleg to x-axis <23.159341> speed <11.068682> * currentSpeed; + turn rfoot to x-axis <-33.170330> speed <20.241758> * currentSpeed; + turn lfoot to x-axis <7.357143> speed <26.361264> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> speed <0.259615> * currentSpeed; + turn lthigh to x-axis <-36.291209> speed <2.975275> * currentSpeed; + turn rleg to x-axis <43.571429> speed <15.309066> * currentSpeed; + turn rfoot to x-axis <-43.148352> speed <7.483517> * currentSpeed; + turn lleg to x-axis <-10.082418> speed <5.048077> * currentSpeed; + turn lfoot to x-axis <28.236264> speed <15.659341> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> now; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-42.060440> speed <4.326923> * currentSpeed; + turn rthigh to x-axis <12.824176> speed <0.342033> * currentSpeed; + turn rleg to x-axis <60.692308> speed <12.840659> * currentSpeed; + turn rfoot to x-axis <-44.824176> speed <1.256868> * currentSpeed; + turn lleg to x-axis <-4.412088> speed <4.252748> * currentSpeed; + turn lfoot to x-axis <46.934066> speed <14.023352> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-32.758242> speed <6.976648> * currentSpeed; + turn rthigh to x-axis <34.093407> speed <15.951923> * currentSpeed; + turn rleg to x-axis <23.615385> speed <27.807692> * currentSpeed; + turn rfoot to x-axis <-10.791209> speed <25.524725> * currentSpeed; + turn lleg to x-axis <-5.747253> speed <1.001374> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <3.321428> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-25.225275> speed <5.649725> * currentSpeed; + turn rthigh to x-axis <28.769231> speed <3.993132> * currentSpeed; + turn rleg to x-axis <10.527473> speed <9.815934> * currentSpeed; + turn rfoot to x-axis <-20.978022> speed <7.640110> * currentSpeed; + turn lleg to x-axis <-3.978022> speed <1.326923> * currentSpeed; + turn lfoot to x-axis <33.648352> speed <6.642857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <-12.390110> speed <9.626374> * currentSpeed; + turn rthigh to x-axis <-0.423077> speed <21.894231> * currentSpeed; + turn rleg to x-axis <-11.659341> speed <16.640110> * currentSpeed; + turn rfoot to x-axis <22.978022> speed <32.967033> * currentSpeed; + turn lleg to x-axis <4.115385> speed <6.070055> * currentSpeed; + turn lfoot to x-axis <14.016484> speed <14.723901> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <0.000000> speed <9.292582> * currentSpeed; + turn rthigh to x-axis <-19.467033> speed <14.282967> * currentSpeed; + turn rleg to x-axis <-20.302198> speed <6.482143> * currentSpeed; + turn rfoot to x-axis <23.445055> speed <0.350275> * currentSpeed; + turn lleg to x-axis <24.203297> speed <15.065934> * currentSpeed; + turn lfoot to x-axis <-20.736264> speed <26.064561> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <9.280220> speed <6.960165> * currentSpeed; + turn rthigh to x-axis <-28.769231> speed <6.976649> * currentSpeed; + turn rleg to x-axis <-25.225275> speed <3.692308> * currentSpeed; + turn rfoot to x-axis <26.115385> speed <2.002747> * currentSpeed; + turn lleg to x-axis <31.868132> speed <5.748626> * currentSpeed; + turn lfoot to x-axis <-37.637363> speed <12.675824> * currentSpeed; + sleep animSpeed; + } + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn torso to x-axis <12.648352> now; + turn lthigh to x-axis <11.060440> speed <1.335165> * currentSpeed; + turn rthigh to x-axis <-37.192308> speed <6.317308> * currentSpeed; + turn rleg to x-axis <-9.280220> speed <11.958791> * currentSpeed; + turn rfoot to x-axis <6.104396> speed <15.008242> * currentSpeed; + turn lleg to x-axis <47.604396> speed <11.802198> * currentSpeed; + turn lfoot to x-axis <-47.412088> speed <7.331044> * currentSpeed; + sleep animSpeed; +} + +walklegs() +{ + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + move rleg to y-axis [0.000000] now; + move rleg to z-axis [0.000000] now; + move rfoot to z-axis [0.000000] now; + move lleg to y-axis [0.000000] now; + move lleg to z-axis [0.000000] now; + move lfoot to z-axis [0.000000] now; + move luparm to x-axis [0.000000] now; + move luparm to y-axis [0.000000] now; + move luparm to z-axis [0.000000] now; + move ruparm to x-axis [0.000000] now; + move ruparm to y-axis [0.000000] now; + move ruparm to z-axis [0.000000] now; + move rloarm to x-axis [0.000000] now; + move rfire to x-axis [0.000000] now; + move lloarm to x-axis [0.000000] now; + move lfire to x-axis [0.000000] now; + turn pelvis to x-axis <-0.423077> now; + turn lthigh to x-axis <11.060440> now; + turn rthigh to x-axis <-42.060440> speed <3.651099> * currentSpeed; + turn rleg to x-axis <-4.857143> speed <3.317308> * currentSpeed; + turn rfoot to x-axis <46.934066> speed <30.622253> * currentSpeed; + turn lleg to x-axis <61.000000> speed <10.046703> * currentSpeed; + turn lfoot to x-axis <-50.390110> speed <2.233517> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <34.093407> speed <17.274725> * currentSpeed; + turn rthigh to x-axis <-27.890110> speed <10.627747> * currentSpeed; + turn rleg to x-axis <-6.637363> speed <1.335165> * currentSpeed; + turn rfoot to x-axis <37.637363> speed <6.972527> * currentSpeed; + turn lleg to x-axis <33.615385> speed <20.538461> * currentSpeed; + turn lfoot to x-axis <-24.604396> speed <19.339285> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <28.747253> speed <4.009615> * currentSpeed; + turn rthigh to x-axis <-19.027473> speed <6.646978> * currentSpeed; + turn rleg to x-axis <-4.412088> speed <1.668956> * currentSpeed; + turn rfoot to x-axis <27.890110> speed <7.310440> * currentSpeed; + turn lleg to x-axis <13.725275> speed <14.917583> * currentSpeed; + turn lfoot to x-axis <-25.978022> speed <1.030219> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <12.813187> speed <11.950550> * currentSpeed; + turn rthigh to x-axis <0.000000> speed <14.270605> * currentSpeed; + turn rleg to x-axis <3.082418> speed <5.620879> * currentSpeed; + turn rfoot to x-axis <2.203297> speed <19.265110> * currentSpeed; + turn lleg to x-axis <-12.335165> speed <19.545330> * currentSpeed; + turn lfoot to x-axis <7.648352> speed <25.219780> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <-19.467033> speed <24.210165> * currentSpeed; + turn rthigh to x-axis <1.758242> speed <1.318682> * currentSpeed; + turn rleg to x-axis <8.401099> speed <3.989011> * currentSpeed; + turn rfoot to x-axis <-6.181319> speed <6.288462> * currentSpeed; + turn lleg to x-axis <-16.813187> speed <3.358516> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <26.142857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <-32.324176> speed <9.642857> * currentSpeed; + turn rthigh to x-axis <13.280220> speed <8.641484> * currentSpeed; + turn rleg to x-axis <23.159341> speed <11.068682> * currentSpeed; + turn rfoot to x-axis <-33.170330> speed <20.241758> * currentSpeed; + turn lfoot to x-axis <7.357143> speed <26.361264> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <-36.291209> speed <2.975275> * currentSpeed; + turn rleg to x-axis <43.571429> speed <15.309066> * currentSpeed; + turn rfoot to x-axis <-43.148352> speed <7.483517> * currentSpeed; + turn lleg to x-axis <-10.082418> speed <5.048077> * currentSpeed; + turn lfoot to x-axis <28.236264> speed <15.659341> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.450000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> now; + turn lthigh to x-axis <-42.060440> speed <4.326923> * currentSpeed; + turn rthigh to x-axis <12.824176> speed <0.342033> * currentSpeed; + turn rleg to x-axis <60.692308> speed <12.840659> * currentSpeed; + turn rfoot to x-axis <-44.824176> speed <1.256868> * currentSpeed; + turn lleg to x-axis <-4.412088> speed <4.252748> * currentSpeed; + turn lfoot to x-axis <46.934066> speed <14.023352> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <-32.758242> speed <6.976648> * currentSpeed; + turn rthigh to x-axis <34.093407> speed <15.951923> * currentSpeed; + turn rleg to x-axis <23.615385> speed <27.807692> * currentSpeed; + turn rfoot to x-axis <-10.791209> speed <25.524725> * currentSpeed; + turn lleg to x-axis <-5.747253> speed <1.001374> * currentSpeed; + turn lfoot to x-axis <42.505495> speed <3.321428> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.300000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <-25.225275> speed <5.649725> * currentSpeed; + turn rthigh to x-axis <28.769231> speed <3.993132> * currentSpeed; + turn rleg to x-axis <10.527473> speed <9.815934> * currentSpeed; + turn rfoot to x-axis <-20.978022> speed <7.640110> * currentSpeed; + turn lleg to x-axis <-3.978022> speed <1.326923> * currentSpeed; + turn lfoot to x-axis <33.648352> speed <6.642857> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.100000] speed [0.150000] * currentSpeed; + turn pelvis to x-axis <-6.181319> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <-12.390110> speed <9.626374> * currentSpeed; + turn rthigh to x-axis <-0.423077> speed <21.894231> * currentSpeed; + turn rleg to x-axis <-11.659341> speed <16.640110> * currentSpeed; + turn rfoot to x-axis <22.978022> speed <32.967033> * currentSpeed; + turn lleg to x-axis <4.115385> speed <6.070055> * currentSpeed; + turn lfoot to x-axis <14.016484> speed <14.723901> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [0.000000] speed [0.075000] * currentSpeed; + turn pelvis to x-axis <-4.857143> speed <0.993132> * currentSpeed; + turn lthigh to x-axis <0.000000> speed <9.292582> * currentSpeed; + turn rthigh to x-axis <-19.467033> speed <14.282967> * currentSpeed; + turn rleg to x-axis <-20.302198> speed <6.482143> * currentSpeed; + turn rfoot to x-axis <23.445055> speed <0.350275> * currentSpeed; + turn lleg to x-axis <24.203297> speed <15.065934> * currentSpeed; + turn lfoot to x-axis <-20.736264> speed <26.064561> * currentSpeed; + sleep animSpeed; + } + if( bMoving ) + { + move pelvis to y-axis [-0.350000] speed [0.262500] * currentSpeed; + turn pelvis to x-axis <-3.082418> speed <1.331044> * currentSpeed; + turn lthigh to x-axis <9.280220> speed <6.960165> * currentSpeed; + turn rthigh to x-axis <-28.769231> speed <6.976649> * currentSpeed; + turn rleg to x-axis <-25.225275> speed <3.692308> * currentSpeed; + turn rfoot to x-axis <26.115385> speed <2.002747> * currentSpeed; + turn lleg to x-axis <31.868132> speed <5.748626> * currentSpeed; + turn lfoot to x-axis <-37.637363> speed <12.675824> * currentSpeed; + sleep animSpeed; + } + move pelvis to y-axis [-0.400000] speed [0.037500] * currentSpeed; + turn pelvis to x-axis <-0.423077> speed <1.994506> * currentSpeed; + turn lthigh to x-axis <11.060440> speed <1.335165> * currentSpeed; + turn rthigh to x-axis <-37.192308> speed <6.317308> * currentSpeed; + turn rleg to x-axis <-9.280220> speed <11.958791> * currentSpeed; + turn rfoot to x-axis <6.104396> speed <15.008242> * currentSpeed; + turn lleg to x-axis <47.604396> speed <11.802198> * currentSpeed; + turn lfoot to x-axis <-47.412088> speed <7.331044> * currentSpeed; + sleep animSpeed; +} + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + + +UnitSpeed() +{ + while(TRUE) + { + currentSpeed = (get CURRENT_SPEED)*100/moveSpeed; + if (currentSpeed<20) currentSpeed=20; + animSpeed = 3700 / currentSpeed; + sleep 142; + } +} + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = bAiming; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + move pelvis to y-axis [0.000000] speed [1.000000]; + turn rthigh to x-axis <0.000000> speed <200.000000>; + turn rleg to x-axis <0.000000> speed <200.000000>; + turn rfoot to x-axis <0.000000> speed <200.000000>; + turn lthigh to x-axis <0.000000> speed <200.000000>; + turn lleg to x-axis <0.000000> speed <200.000000>; + turn lfoot to x-axis <0.000000> speed <200.000000>; + if( !aiming ) + { + turn torso to y-axis <0.000000> speed <90.000000>; + turn rloarm to x-axis <0.000000> speed <200.000000>; + turn ruparm to x-axis <0.000000> speed <200.000000>; + turn lloarm to x-axis <0.000000> speed <200.000000>; + turn luparm to x-axis <0.000000> speed <200.000000>; + } + justmoved = FALSE; + } + sleep 100; + } + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script UnitSpeed(); + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + hide rfire; + hide lfire; + bMoving = FALSE; + bAiming = FALSE; + Static_Var_3 = 1; + gun_1 = torso; + currentSpeed = 100; + moveSpeed = get MAX_SPEED; + animSpeed = 38; + start-script InitialSetup1(); + start-script SmokeUnit(); +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + +SweetSpot(piecenum) +{ + piecenum = torso; +} + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM; + sleep 2750; + start-script RestoreWeapon1(); + call-script Weapon1Restored(); + bAiming = FALSE; +} + +AimFromPrimary(piecenum) +{ + piecenum = aimy1; +} + +QueryPrimary(piecenum) +{ + piecenum = rfire + gun_1; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + bAiming = TRUE; + start-script Weapon1Drawn(); + start-script Weapon1SetWtdAim(heading, pitch); + start-script RestoreAfterDelay(); + return (aim1); +} + +FirePrimary() +{ + gun_1 = !gun_1; +} + +Killed(severity, corpsetype) +{ + hide rfire; + hide lfire; + if( severity <= 25 ) + { + corpsetype = 1 ; + explode pelvis type BITMAPONLY | NOHEATCLOUD; + explode torso type BITMAPONLY | NOHEATCLOUD; + //explode ruparm type BITMAPONLY | NOHEATCLOUD; + //explode rloarm type BITMAPONLY | NOHEATCLOUD; + //explode rfire type BITMAPONLY | NOHEATCLOUD; + //explode luparm type BITMAPONLY | NOHEATCLOUD; + //explode lloarm type BITMAPONLY | NOHEATCLOUD; + //explode lfire type BITMAPONLY | NOHEATCLOUD; + //explode rthigh type BITMAPONLY | NOHEATCLOUD; + //explode rknee type BITMAPONLY | NOHEATCLOUD; + //explode rleg type BITMAPONLY | NOHEATCLOUD; + //explode rfoot type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lthigh type BITMAPONLY | NOHEATCLOUD; + //explode lknee type BITMAPONLY | NOHEATCLOUD; + //explode lleg type BITMAPONLY | NOHEATCLOUD; + //explode lfoot type BITMAPONLY | NOHEATCLOUD; + return(corpsetype); + } + if( severity <= 50 ) + { + corpsetype = 2 ; + explode pelvis type BITMAPONLY | NOHEATCLOUD; + explode torso type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode ruparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfire type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode luparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lfire type FALL | NOHEATCLOUD; + explode rthigh type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rknee type FALL | NOHEATCLOUD; + //explode rleg type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfoot type FALL | NOHEATCLOUD; + explode lthigh type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type FALL | NOHEATCLOUD; + explode lleg type FALL | NOHEATCLOUD; + explode lfoot type FIRE | SMOKE | FALL | NOHEATCLOUD; + return(corpsetype); + } + if( severity <= 99 ) + { + corpsetype = 3 ; + explode pelvis type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode torso type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode ruparm type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rfire type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode luparm type FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode lloarm type SMOKE | FALL | NOHEATCLOUD; + //explode lfire type SMOKE | FALL | NOHEATCLOUD; + //explode rthigh type SMOKE | FALL | NOHEATCLOUD; + //explode rknee type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rleg type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode rfoot type EXPLODE_ON_HIT | SMOKE | FALL | NOHEATCLOUD; + explode lthigh type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lleg type SMOKE | FALL | NOHEATCLOUD; + explode lfoot type SMOKE | FALL | NOHEATCLOUD; + return(corpsetype); + } + corpsetype = 3 ; + explode pelvis type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode torso type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + explode ruparm type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rloarm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode rfire type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode luparm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode lloarm type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode lfire type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + //explode rthigh type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + //explode rknee type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode rleg type EXPLODE_ON_HIT | FIRE | FALL | NOHEATCLOUD; + explode rfoot type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lthigh type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lknee type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lleg type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + explode lfoot type EXPLODE_ON_HIT | FIRE | SMOKE | FALL | NOHEATCLOUD; + return corpsetype; +} diff --git a/Scripts/faction/xskulk.cob b/Scripts/faction/xskulk.cob new file mode 100644 index 000000000..ee5213a29 Binary files /dev/null and b/Scripts/faction/xskulk.cob differ diff --git a/Scripts/faction/xsolar.bos b/Scripts/faction/xsolar.bos new file mode 100644 index 000000000..7daee4bbb --- /dev/null +++ b/Scripts/faction/xsolar.bos @@ -0,0 +1,44 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + start-script SmokeUnit(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/faction/xsolar.cob b/Scripts/faction/xsolar.cob new file mode 100644 index 000000000..d126d83c9 Binary files /dev/null and b/Scripts/faction/xsolar.cob differ diff --git a/Scripts/faction/xstorage.bos b/Scripts/faction/xstorage.bos new file mode 100644 index 000000000..6ddfb9499 --- /dev/null +++ b/Scripts/faction/xstorage.bos @@ -0,0 +1,69 @@ +// * Header Info * +// VersionSignature 4 +// NumberOfScripts 4 +// NumberOfPieces 5 +// LengthOfScripts 161 +// NumberOfStaticVars 0 +// UKZero 0 +// OffsetToScriptCodeIndexArray 5b0 +// OffsetToScriptNameOffsetArray 5c0 +// OffsetToPieceNameOffsetArray 5d0 +// OffsetToScriptCode 2c +// OffsetToNameArray 5e4 + +// OffsetToFirstName 5e4 + +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + + +SmokeUnit(healthpercent, sleeptime, smoketype) +/* 3:*/{ +/* 6:*/ while( get BUILD_PERCENT_LEFT ) +/* 8:*/ { +/* a:*/ sleep 400; +/* d:*/ } +/* f:*/ while( TRUE ) +/* 11:*/ { +/* 14:*/ healthpercent = get HEALTH; +/* 1b:*/ if( healthpercent < 66 ) +/* 1d:*/ { +/* 22:*/ smoketype = 256 | 2; +/* 2c:*/ if( Rand( 1, 66 ) < healthpercent ) +/* 2e:*/ { +/* 33:*/ smoketype = 256 | 1; +/* 35:*/ } +/* 37:*/ emit-sfx smoketype from base; +/* 39:*/ } +/* 3e:*/ sleeptime = healthpercent * 50; +/* 45:*/ if( sleeptime < 200 ) +/* 47:*/ { +/* 49:*/ sleeptime = 200; +/* 4b:*/ } +/* 4d:*/ sleep sleeptime; +/* 50:*/ } +/* 52:*/ return (0); +/* 53:*/ // Build by COBBLER Ver4.0 Copyright @1998 DIGITAL CONCEPT SOFTWARE (MANU@inext.fr) / http://www.annihilationcenter.com/DCS/ +/* 80:*/} + +Create() +/* 78:*/{ +/* 7c:*/ start-script SmokeUnit(); +/* 81:*/ return (0); +/* 82:*/} + +SweetSpot(piecenum) +/* 83:*/{ +/* 85:*/ piecenum = base; +/* 89:*/ return (0); +/* 8a:*/} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode base type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xstorage.cob b/Scripts/faction/xstorage.cob new file mode 100644 index 000000000..aa7430f5a Binary files /dev/null and b/Scripts/faction/xstorage.cob differ diff --git a/Scripts/faction/xwarrior.bos b/Scripts/faction/xwarrior.bos new file mode 100644 index 000000000..e294936ca --- /dev/null +++ b/Scripts/faction/xwarrior.bos @@ -0,0 +1,451 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece torso,firepoint2, firepoint1 , pelvis, lthigh, rthigh, luparm, + ruparm, rarm, larm, rleg, rfoot, lleg, lfoot; + +static-var bMoving, bAiming, Static_Var_3, restore_delay, gun_1, wpn1_lasthead; + +// Signal definitions +#define SIG_AIM 4 + +HitByWeapon(anglex, anglez) +{ + turn pelvis to z-axis anglez speed <105.000000>; + turn pelvis to x-axis <0> - anglex speed <105.000000>; + wait-for-turn pelvis around z-axis; + wait-for-turn pelvis around x-axis; + turn pelvis to z-axis <0.000000> speed <30.000000>; + turn pelvis to x-axis <0.000000> speed <30.000000>; +} + + +walk() +{ + + //maxvelocity = 1.4, speed = 45 elmos/sec + //animspeed 36 elmos per cycle + + + if( bMoving ) + { + //step 0 + + turn rthigh to x-axis <0> speed <277.500000>; + turn rleg to x-axis <0> speed <142.500000>; + turn rfoot to x-axis <0> speed <202.500000>; + turn lthigh to x-axis <9> speed <427.500000>; + turn lleg to x-axis <34> speed <450.000000>; + turn lfoot to x-axis <-40> speed <427.500000>; + + turn luparm to x-axis <-10> speed <75.000000>; + turn larm to x-axis <5> speed <75.000000>; + turn ruparm to x-axis <10> speed <75.000000>; + turn rarm to x-axis <25> speed <75.000000>; + + move pelvis to y-axis [0] speed [11.250000]; + turn torso to y-axis <-5> speed <37.500000>; + + sleep 130; + } + if( bMoving ) + { + //step 1 + + turn rthigh to x-axis <51> speed <382.500000>; + turn rleg to x-axis <-36> speed <270.000000>; + turn rfoot to x-axis <14> speed <105.000000>; + turn lthigh to x-axis <-44> speed <397.500000>; + turn lleg to x-axis <34> now; + turn lfoot to x-axis <0> speed <300.000000>; + + turn luparm to x-axis <10> speed <150.000000>; + turn larm to x-axis <25> speed <150.000000>; + turn ruparm to x-axis <-10> speed <150.000000>; + turn rarm to x-axis <5> speed <150.000000>; + + move pelvis to y-axis [-1] speed [7.500000]; + turn torso to y-axis <5> speed <75.000000>; + + sleep 130; + } + + if( bMoving ) + { + //step 2 + + turn rthigh to x-axis <66> speed <112.500000>; + turn rleg to x-axis <-26> speed <75.000000>; + turn rfoot to x-axis <17> speed <22.500000>; + turn lthigh to x-axis <-37> speed <52.500000>; + turn lleg to x-axis <-19> speed <397.500000>; + turn lfoot to x-axis <27> speed <202.500000>; + + turn luparm to x-axis <20> speed <75.000000>; + turn larm to x-axis <35> speed <75.000000>; + turn ruparm to x-axis <-20> speed <75.000000>; + turn rarm to x-axis <-5> speed <75.000000>; + + move pelvis to y-axis [-1.5] speed [3.750000]; + turn torso to y-axis <10> speed <37.500000>; + + sleep 130; + } + + if( bMoving ) + { + //step 3 + + turn rthigh to x-axis <9> speed <427.500000>; + turn rleg to x-axis <34> speed <450.000000>; + turn rfoot to x-axis <-40> speed <427.500000>; + turn lthigh to x-axis <0> speed <277.500000>; + turn lleg to x-axis <0> speed <142.500000>; + turn lfoot to x-axis <0> speed <202.500000>; + + turn luparm to x-axis <10> speed <75.000000>; + turn larm to x-axis <25> speed <75.000000>; + turn ruparm to x-axis <-10> speed <75.000000>; + turn rarm to x-axis <5> speed <75.000000>; + + move pelvis to y-axis [0] speed [11.250000]; + turn torso to y-axis <5> speed <37.500000>; + + sleep 130; + } + + if( bMoving ) + { + //step 4 + + turn rthigh to x-axis <-44> speed <397.500000>; + turn rleg to x-axis <34> now; + turn rfoot to x-axis <0> speed <300.000000>; + turn lthigh to x-axis <51> speed <382.500000>; + turn lleg to x-axis <-36> speed <270.000000>; + turn lfoot to x-axis <14> speed <105.000000>; + + turn luparm to x-axis <-10> speed <150.000000>; + turn larm to x-axis <5> speed <150.000000>; + turn ruparm to x-axis <10> speed <150.000000>; + turn rarm to x-axis <25> speed <150.000000>; + + move pelvis to y-axis [-1] speed [7.500000]; + turn torso to y-axis <-5> speed <75.000000>; + + sleep 130; + } + + if( bMoving ) + { + //step 5 + + turn rthigh to x-axis <-37> speed <52.500000>; + turn rleg to x-axis <-19> speed <397.500000>; + turn rfoot to x-axis <27> speed <202.500000>; + turn lthigh to x-axis <66> speed <112.500000>; + turn lleg to x-axis <-26> speed <75.000000>; + turn lfoot to x-axis <17> speed <22.500000>; + + turn luparm to x-axis <-20> speed <75.000000>; + turn larm to x-axis <-5> speed <75.000000>; + turn ruparm to x-axis <20> speed <75.000000>; + turn rarm to x-axis <35> speed <75.000000>; + + move pelvis to y-axis [-1.5] speed [3.750000]; + turn torso to y-axis <-10> speed <37.500000>; + + sleep 130; + } + +} + +walklegs() +{ + + + if( bMoving ) + { + //step 0 + + turn rthigh to x-axis <0> speed <277.500000>; + turn rleg to x-axis <0> speed <142.500000>; + turn rfoot to x-axis <0> speed <202.500000>; + turn lthigh to x-axis <9> speed <427.500000>; + turn lleg to x-axis <34> speed <450.000000>; + turn lfoot to x-axis <-40> speed <427.500000>; + move pelvis to y-axis [0] speed [11.250000]; + + sleep 130; + } + if( bMoving ) + { + //step 1 + + turn rthigh to x-axis <51> speed <382.500000>; + turn rleg to x-axis <-36> speed <270.000000>; + turn rfoot to x-axis <14> speed <105.000000>; + turn lthigh to x-axis <-44> speed <397.500000>; + turn lleg to x-axis <34> now; + turn lfoot to x-axis <0> speed <300.000000>; + + move pelvis to y-axis [-1] speed [7.500000]; + + sleep 130; + } + + if( bMoving ) + { + //step 2 + + turn rthigh to x-axis <66> speed <112.500000>; + turn rleg to x-axis <-26> speed <75.000000>; + turn rfoot to x-axis <17> speed <22.500000>; + turn lthigh to x-axis <-37> speed <52.500000>; + turn lleg to x-axis <-19> speed <397.500000>; + turn lfoot to x-axis <27> speed <202.500000>; + + move pelvis to y-axis [-1.5] speed [3.750000]; + + sleep 130; + } + + if( bMoving ) + { + //step 3 + + turn rthigh to x-axis <9> speed <427.500000>; + turn rleg to x-axis <34> speed <450.000000>; + turn rfoot to x-axis <-40> speed <427.500000>; + turn lthigh to x-axis <0> speed <277.500000>; + turn lleg to x-axis <0> speed <142.500000>; + turn lfoot to x-axis <0> speed <202.500000>; + + move pelvis to y-axis [0] speed [11.250000]; + + sleep 130; + } + + if( bMoving ) + { + //step 4 + + turn rthigh to x-axis <-44> speed <397.500000>; + turn rleg to x-axis <34> now; + turn rfoot to x-axis <0> speed <300.000000>; + turn lthigh to x-axis <51> speed <382.500000>; + turn lleg to x-axis <-36> speed <270.000000>; + turn lfoot to x-axis <14> speed <105.000000>; + move pelvis to y-axis [-1] speed [7.500000]; + + sleep 130; + } + + if( bMoving ) + { + //step 5 + + turn rthigh to x-axis <-37> speed <52.500000>; + turn rleg to x-axis <-19> speed <397.500000>; + turn rfoot to x-axis <27> speed <202.500000>; + turn lthigh to x-axis <66> speed <112.500000>; + turn lleg to x-axis <-26> speed <75.000000>; + turn lfoot to x-axis <17> speed <22.500000>; + + move pelvis to y-axis [-1.5] speed [3.750000]; + + sleep 130; + } +} + +MotionControl(moving, aiming, justmoved) +{ + justmoved = TRUE; + while( TRUE ) + { + moving = bMoving; + aiming = bAiming; + if( moving ) + { + if( aiming ) + { + Static_Var_3 = 1; + call-script walklegs(); + } + else + { + Static_Var_3 = 0; + call-script walk(); + } + justmoved = TRUE; + } + else + { + Static_Var_3 = 1; + if( justmoved ) + { + turn rthigh to x-axis <0> speed <277.500000>; + turn rleg to x-axis <0> speed <142.500000>; + turn rfoot to x-axis <0> speed <202.500000>; + turn lthigh to x-axis <0> speed <277.500000>; + turn lleg to x-axis <0> speed <142.500000>; + turn lfoot to x-axis <0> speed <202.500000>; + + + move pelvis to y-axis [0] speed [11.250000]; + if( !aiming ) + { + turn luparm to x-axis <0> speed <75.000000>; + turn larm to x-axis <0> speed <75.000000>; + turn ruparm to x-axis <0> speed <75.000000>; + turn rarm to x-axis <0> speed <75.000000>; + turn torso to y-axis <0> speed <37.500000>; + } + justmoved = FALSE; + } + sleep 100; + } + } +} + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 500; + } + start-script MotionControl(); + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 258; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 257; + } + emit-sfx smoketype from torso; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + hide firepoint2; + hide firepoint1; + bMoving = FALSE; + bAiming = FALSE; + Static_Var_3 = 1; + restore_delay = 3000; + gun_1 = firepoint2; + start-script SmokeUnit(); +} + +SetMaxReloadTime(Func_Var_1) +{ + restore_delay = Func_Var_1 * 2; +} + +StartMoving() +{ + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; +} + +SweetSpot(piecenum) +{ + piecenum = torso; +} + +RestoreAfterDelay() +{ + set-signal-mask SIG_AIM; + sleep restore_delay; + turn torso to y-axis <0.000000> speed <90.000000>; + turn ruparm to x-axis <0.000000> speed <45.000000>; + turn rarm to y-axis <0.000000> speed <45.000000>; + turn luparm to x-axis <0.000000> speed <45.000000>; + wait-for-turn torso around y-axis; + wait-for-turn ruparm around x-axis; + wait-for-turn rarm around y-axis; + wait-for-turn luparm around x-axis; + wpn1_lasthead = 1000000; + bAiming = FALSE; +} + +AimFromPrimary(piecenum) +{ + piecenum = torso; +} + +QueryPrimary(piecenum) +{ + piecenum = firepoint2 + gun_1; +} + +FirePrimary() +{ + if( gun_1 ) + { + emit-sfx 1024 from firepoint2; + } + else + { + emit-sfx 1024 from firepoint1; + } + gun_1 = !gun_1; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + bAiming = TRUE; + while( !Static_Var_3 ) + { + return(0); + } + turn torso to y-axis heading speed <5000.000000>; + turn ruparm to x-axis <0.000000> - pitch speed <5000.000000>; + turn rarm to x-axis <0.000000> speed <5000.000000>; + turn luparm to x-axis <0.000000> - pitch speed <5000.000000>; + turn larm to x-axis <0.000000> speed <5000.000000>; + if (((get ABS(wpn1_lasthead - heading)) > 65536) OR(((get ABS(wpn1_lasthead - heading)) > 1300) AND ((get ABS(wpn1_lasthead - heading)) < 64236))) + { + wpn1_lasthead = 1000000; + wait-for-turn torso around y-axis; + wait-for-turn luparm around x-axis; + wait-for-turn ruparm around x-axis; + } + start-script RestoreAfterDelay(); + wpn1_lasthead = heading; + return (1); +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + explode rthigh type EXPLODE_ON_HIT; + explode rleg type EXPLODE_ON_HIT; + explode rfoot type EXPLODE_ON_HIT; + explode lthigh type EXPLODE_ON_HIT; + explode lleg type EXPLODE_ON_HIT; + explode lfoot type EXPLODE_ON_HIT; + explode torso type EXPLODE_ON_HIT; + explode luparm type EXPLODE_ON_HIT; + explode larm type EXPLODE_ON_HIT; + explode ruparm type EXPLODE_ON_HIT; + explode rarm type EXPLODE_ON_HIT; +} diff --git a/Scripts/faction/xwarrior.cob b/Scripts/faction/xwarrior.cob new file mode 100644 index 000000000..93b869cfb Binary files /dev/null and b/Scripts/faction/xwarrior.cob differ diff --git a/Scripts/factory.bos b/Scripts/factory.bos deleted file mode 100644 index e5ecf64b8..000000000 --- a/Scripts/factory.bos +++ /dev/null @@ -1,195 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece factory, shield, nano1, nano2; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging; - -// Signal definitions -#define SIG_ACTIVATE 2 - - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from factory; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -OpenYard() -{ - set YARD_OPEN to 1; - while( !get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 1; - } - set BUGGER_OFF to 0; -} - -CloseYard() -{ - set YARD_OPEN to 0; - while( get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 0; - } - set BUGGER_OFF to 0; -} - -Go() -{ - call-script OpenYard(); - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - call-script CloseYard(); -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - unitviewer = FALSE; - spray = factory; - call-script InitState(); - start-script SmokeUnit(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray != 0 ) - { - piecenum = nano2; - } - spray = !spray; -} - -Demo() -{ - unitviewer = TRUE; -} - -Activate() -{ - signal SIG_ACTIVATE; - start-script RequestState(0); -} - -Deactivate() -{ - signal SIG_ACTIVATE; - set-signal-mask SIG_ACTIVATE; - if( !unitviewer ) - { - sleep 5000; - } - set-signal-mask 0; - start-script RequestState(1); -} - -StartBuilding() -{ -} - -StopBuilding() -{ -} - -QueryBuildInfo(piecenum) -{ - piecenum = shield; -} - -SweetSpot(piecenum) -{ - piecenum = factory; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode factory type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode factory type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode factory type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode factory type BITMAPONLY | BITMAP1; - -} diff --git a/Scripts/fatso.bos b/Scripts/fatso.bos deleted file mode 100644 index 1fc88346e..000000000 --- a/Scripts/fatso.bos +++ /dev/null @@ -1,204 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, turret2, turret3, firepoint1, firepoint2, firepoint3; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -turn turret2 to y-axis <0> speed <60>; -turn turret3 to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret1 to y-axis heading speed <225>; -wait-for-turn turret1 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret2 to y-axis heading speed <225>; -wait-for-turn turret2 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM_4; -turn turret3 to y-axis heading speed <225>; -wait-for-turn turret3 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = turret3; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type FALL | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret2 type BITMAPONLY | BITMAP3; -explode turret3 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/fatso.cob b/Scripts/fatso.cob deleted file mode 100644 index ca41ea29c..000000000 Binary files a/Scripts/fatso.cob and /dev/null differ diff --git a/Scripts/fusion.bos b/Scripts/fusion.bos deleted file mode 100644 index 4eba1191b..000000000 --- a/Scripts/fusion.bos +++ /dev/null @@ -1,85 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece fusion, sfx; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from fusion; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from sfx; - sleep 100; - } -} - -Create() -{ - start-script fx(); - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = fusion; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode fusion type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode fusion type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode fusion type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode fusion type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/geovent.bos b/Scripts/geovent.bos deleted file mode 100644 index af562a0f0..000000000 --- a/Scripts/geovent.bos +++ /dev/null @@ -1,73 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, bottomfan, topfan; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Create() -{ - spin topfan around y-axis speed <50.005495>; - spin bottomfan around y-axis speed <-50.005495>; - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/geovent.cob b/Scripts/geovent.cob deleted file mode 100644 index 4046f5601..000000000 Binary files a/Scripts/geovent.cob and /dev/null differ diff --git a/Scripts/glsl_test.bos b/Scripts/glsl_test.bos deleted file mode 100644 index 99c27b857..000000000 --- a/Scripts/glsl_test.bos +++ /dev/null @@ -1,61 +0,0 @@ -// Argh's Skyscraper1 Script - -// This script is hereby released under GPL v. 2 or later by Wolfe Games, 2007 -// All contents were created by Wolfe Games. - -// This Include is absolutely VITAL. -// You must call it FIRST. PERIOD. -// Don't say I didn't warn you ;-) -#include "STANDARD_COMMANDS_WORLDovm_builder.h" - -piece base, orbiter, orbit, light; - -lua_CreateLightMe(arg) { return (0); } -lua_DestroyLightMe(arg) { return (0); } - -StartBuilding(heading,pitch) -{ -set INBUILDSTANCE to 1; - return (0); -} - -StopBuilding() -{ -set INBUILDSTANCE to 0; - return (0); -} - -QueryNanoPiece(piecenum) -{ - piecenum = base; -} - -randomLight() -{ - var R,G,B,A; - while(TRUE) - { - R = rand(0,255); - G = rand(0,255); - B = rand(0,255); - A = rand(64,200); - call-script lua_CreateLightMe(light, R, G, B, A); - sleep 1000; - } -} - -Create() -{ -set INBUILDSTANCE to 1; - spin orbiter around y-axis speed <-45>; - spin orbit around y-axis speed <30>; - start-script randomLight(); - - return (0); -} - -Killed() -{ - call-script lua_DestroyLightMe(); - return (0); -} \ No newline at end of file diff --git a/Scripts/glsl_test.cob b/Scripts/glsl_test.cob deleted file mode 100644 index 6d2a12709..000000000 Binary files a/Scripts/glsl_test.cob and /dev/null differ diff --git a/Scripts/goldtree.bos b/Scripts/goldtree.bos deleted file mode 100644 index f16048dad..000000000 --- a/Scripts/goldtree.bos +++ /dev/null @@ -1,112 +0,0 @@ -piece gp,base; -static-var shooting_num,shooting_num3,shooting_num4,missile_num,happened,notdead,burning; - -#define zapImpact 1024+0 -#define RED_EXPLOSION 1024+1 -#define BIGBOMB_EXPLOSION 1024+2 -#define COMM_EXPLOSION 1024+3 - -static-var ISBUILDING; - -#define CRASHLANDING 4096+4 - -#define SMOKEPIECE1 base - -#define SIG_AIM 2 - -#include "\headers\smoke.h" - -Thrusters(sleeptime, smoketype) -{ - smoketype = 256 | 2; - - while( get BUILD_PERCENT_LEFT ) - { sleep 400; } - - while( TRUE ) - { - emit-sfx zapImpact from base; - sleep 150; - } -} - -//------------------------------------------------------ -//start ups :) -//------------------------------------------------------ -Create() - { - ISBUILDING = FALSE; - - start-script SmokeUnit(); - start-script Thrusters(); - } - - -SweetSpot(piecenum) - { piecenum=gp; } - -QueryNanoPiece(piecenum) - { piecenum=base; } -/*============================================== -//nano functions -==============================================*/ - -StartBuilding(heading,pitch) - { - ISBUILDING = TRUE; - while (!ISBUILDING) - { sleep 100; } - set INBUILDSTANCE to TRUE; - } - -TargetCleared(which) - { - signal SIG_AIM; - set-signal-mask SIG_AIM; - sleep 500; - ISBUILDING = FALSE; - } - -StopBuilding() - { - set INBUILDSTANCE to FALSE; - signal SIG_AIM; - set-signal-mask SIG_AIM; - sleep 500; - ISBUILDING = FALSE; - } - -/*=============================================\ -| Death function | -\=============================================*/ - Killed( severity, corpsetype ) - { - //RED_EXPLOSION - //BIGBOMB_EXPLOSION - //COMM_EXPLOSION - if (severity <= 25) - { - corpsetype = 1; - //explode base type SHATTER | BITMAP3; - return( 0 ); - } - - if (severity <= 50) - { - corpsetype = 2; - //explode base type SHATTER | BITMAP3; - return( 0 ); - } - - if (severity <= 99) - { - corpsetype = 3; - //explode base type SHATTER | BITMAP3; - return( 0 ); - } - - corpsetype = 3; -// explode base type SHATTER | BITMAP3; - return( 0 ); - return( 0 ); - } \ No newline at end of file diff --git a/Scripts/goldtree.cob b/Scripts/goldtree.cob deleted file mode 100644 index 5bb3c3475..000000000 Binary files a/Scripts/goldtree.cob and /dev/null differ diff --git a/Scripts/heavytank.bos b/Scripts/heavytank.bos deleted file mode 100644 index 3501478f8..000000000 --- a/Scripts/heavytank.bos +++ /dev/null @@ -1,174 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var gun_1, terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move hull to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move hull to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -emit-sfx gdmarty from firepoint1; -move barrel1 to z-axis [-2] speed [500]; -sleep 75; -move barrel1 to z-axis [0] speed [1]; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = hull; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode hull type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/lightlaserplatform.bos b/Scripts/lightlaserplatform.bos deleted file mode 100644 index 924869a12..000000000 --- a/Scripts/lightlaserplatform.bos +++ /dev/null @@ -1,118 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, ring, sfx; // these are the pieces of the model - -static-var gun_1; // these are the variables - -#define BLUE_EXPLOSION_SMALL 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -spin ring around y-axis speed <50.005495>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -emit-sfx BLUE_EXPLOSION_SMALL from sfx; -spin base around y-axis speed <-25.005495>; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = sfx; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode ring type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode ring type FALL | BITMAP1; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode ring type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode ring type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/lightlaserplatform2.bos b/Scripts/lightlaserplatform2.bos deleted file mode 100644 index 8ca828f14..000000000 --- a/Scripts/lightlaserplatform2.bos +++ /dev/null @@ -1,108 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - -static-var gun_1; // these are the variables - -#define BLUE_EXPLOSION_SMALL 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -emit-sfx BLUE_EXPLOSION_SMALL from firepoint1; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/lightlaserplatform2.cob b/Scripts/lightlaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/lightlaserplatform2.cob and /dev/null differ diff --git a/Scripts/lighttank.bos b/Scripts/lighttank.bos deleted file mode 100644 index de773f41c..000000000 --- a/Scripts/lighttank.bos +++ /dev/null @@ -1,179 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, turret, barrel1, firepoint1, barrel2, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move hull to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move hull to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode hull type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/lootboxes/exptype.h b/Scripts/lootboxes/exptype.h new file mode 100644 index 000000000..7a83187b2 --- /dev/null +++ b/Scripts/lootboxes/exptype.h @@ -0,0 +1,193 @@ +/* +** EXPtype.h -- Explosion Type information and GET/SET constants for scripts +** +** This Script contains constants compatible only with Spring RTS engine +** not for use with Total Annihilation or TA:Kindgoms +*/ + +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +// Indices for emit-sfx +#ifndef __SFXTYPE_H_ +#define SFXTYPE_VTOL 0 +//#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 // same as SFX_WAKE +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 // same as SFX_REVERSE_WAKE + +#define SFXTYPE_WHITESMOKE 257 +#define SFXTYPE_BLACKSMOKE 258 +#define SFXTYPE_SUBBUBBLES 259 +#endif + +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define NOCEGTRAIL 64 // Disables the cegtrail for the specific piece (defined in the unit fbi) +#define NOHEATCLOUD 128 // No engine default heat cloud for explosion +#define BITMAP 10000001 + +// Bitmap Explosion Types +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 + +//Customized effects (in FBI/TDF/LUA) +// Explosion generators +#define UNIT_SFX0 1024 +#define UNIT_SFX1 1025 +#define UNIT_SFX2 1026 +#define UNIT_SFX3 1027 +#define UNIT_SFX4 1028 +#define UNIT_SFX5 1029 +#define UNIT_SFX6 1030 +#define UNIT_SFX7 1031 +#define UNIT_SFX8 1032 +#define UNIT_SFX9 1033 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 +#define FIRE_W9 2056 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 +#define DETO_W9 4104 + + +// COB constants +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get +#define REVERSING 109 // get + +// Indices for SET, GET, and GET_UNIT_VALUE for LUA return values +#define LUA0 110 // (LUA0 returns the lua call status, 0 or 1) +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) get WEAPON_RELOADSTATE(weaponNum) for GET +#define WEAPON_RELOADTIME 126 // get (with fake set) get WEAPON_RELOADSTATE(-weaponNum,val) for SET +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define WEAPON_STOCKPILE_COUNT 139 // get (with fake set) + + +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get +#define KSIN 135 // get, kiloSine 1024*sin(x) as COB uses only integers +#define KCOS 136 // get, kiloCosine 1024*cos(x) + +#define KTAN 137 // get, kiloTangent 1024*tan(x) carefull with angles close to 90 deg. might cause overflow +#define SQRT 138 // get, square root (floored to integer) + +#define ENERGY_MAKE 140 // set or get (100*E production) + +#define METAL_MAKE 141 // set or get (100*M production) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif \ No newline at end of file diff --git a/Scripts/lootboxes/lootboxgold.bos b/Scripts/lootboxes/lootboxgold.bos new file mode 100644 index 000000000..784a3de5f --- /dev/null +++ b/Scripts/lootboxes/lootboxgold.bos @@ -0,0 +1,40 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, dbl, dtr, dbr, dtl, emit, blinka, blinkb, blinkc, blinkd; + +Lights() +{ + while( TRUE ) + { + emit-sfx 1024 + 0 from blinka; + sleep 90; + emit-sfx 1024 + 0 from blinkb; + sleep 90; + emit-sfx 1024 + 0 from blinkc; + sleep 90; + emit-sfx 1024 + 0 from blinkd; + sleep 3000; + } + sleep 2000; + start-script Lights(); +} + +Beacon() +{ + while( TRUE ) + { + emit-sfx 1024 + 1 from emit; + sleep 5000; + } + sleep 2000; + start-script Beacon(); +} + +Create() +{ + start-script Lights(); + start-script Beacon(); +} \ No newline at end of file diff --git a/Scripts/lootboxes/lootboxgold.cob b/Scripts/lootboxes/lootboxgold.cob new file mode 100644 index 000000000..cfcdd269f Binary files /dev/null and b/Scripts/lootboxes/lootboxgold.cob differ diff --git a/Scripts/lootboxes/sfxtype.h b/Scripts/lootboxes/sfxtype.h new file mode 100644 index 000000000..e69de29bb diff --git a/Scripts/lozcommandtank.bos b/Scripts/lozcommandtank.bos new file mode 100644 index 000000000..fc86e4833 --- /dev/null +++ b/Scripts/lozcommandtank.bos @@ -0,0 +1,184 @@ + +// One ninth of the full cycle duration, in millisecond +// The larger this value the slower the walk animation +#define WALK_PERIOD 50 + + +piece base, nano, nanopoint1, rearwheels, frontwheels, sidetanks, reartanks, turret, barrel1, firepoint1, dirt; + +static-var maxreloadtime, moving, bMoving, terraintype, building; + +#define SIG_AIM1 2 +#define SIG_FIRE1 4 +#define SIG_MOVE 8 +#define SMOKEPIECE1 base +#include "springdefs.h" +#define SIG_BUILD 16 +#define SIG_AIM_2 32 +#define nanoflame 1024+0 + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1026 from turret; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + + + +StartMoving() +{ + signal SIG_MOVE; + set-signal-mask SIG_MOVE; + moving=TRUE; + bMoving = TRUE; +} + +StopMoving() +{ + bMoving = FALSE; + signal SIG_MOVE; + set-signal-mask SIG_MOVE; + moving=FALSE; +} + + +Thrust() +{ + while( TRUE ) + { + if (moving) + { + emit-sfx 1025 + 0 from dirt; + spin frontwheels around x-axis speed <500.005495>; + spin rearwheels around x-axis speed <500.005495>; + + } + else + { + stop-spin frontwheels around x-axis decelerate <200.000000>; + stop-spin rearwheels around x-axis decelerate <200.000000>; + } + sleep 400; + } +} + + +buildflame() +{ + while( TRUE ) + { + if (building) + { + emit-sfx nanoflame from nanopoint1; + + } + sleep 600; + } +} + + +Create() +{ + moving=FALSE; + while(get BUILD_PERCENT_LEFT) + { + sleep 250; + } + start-script SmokeUnit(); + start-script Thrust(); + start-script buildflame(); +} + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +sleep 3000; +turn turret to y-axis <0> speed <60>; +turn barrel1 to x-axis <0> speed <30>; +} + + +AimPrimary(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming +{ +signal SIG_AIM_2; +set-signal-mask SIG_AIM_2; +turn turret to y-axis heading speed <5000>; +turn barrel1 to x-axis <0> - pitch speed <5000>; +wait-for-turn turret around y-axis; +wait-for-turn barrel1 around x-axis; +start-script RestoreAfterDelay(); +return (1); +} + +FirePrimary() // what do while firing, fires 1 barrel then the next , and resets +{ +emit-sfx 1027 + 0 from firepoint1; +} + +AimFromPrimary(piecenum) // where it aims the weapon from +{ +piecenum = barrel1; +} + +QueryPrimary(piecenum) // where the shot is called from +{ +piecenum = firepoint1; +} + + +StartBuilding(heading, pitch) +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 1; + building = 1; + while (1) { +// emit-sfx 2048 from nanopoint1; + sleep 30; + } +} + +StopBuilding() +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 0; + building = 0; +} + +QueryNanoPiece(piecenum) +{ + piecenum = nanopoint1; +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode frontwheels type EXPLODE_ON_HIT; + explode rearwheels type EXPLODE_ON_HIT; + explode reartanks type EXPLODE_ON_HIT; + explode sidetanks type EXPLODE_ON_HIT; + explode nano type EXPLODE_ON_HIT; + explode barrel1 type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/lozcommandtank.cob b/Scripts/lozcommandtank.cob new file mode 100644 index 000000000..ddf26e520 Binary files /dev/null and b/Scripts/lozcommandtank.cob differ diff --git a/Scripts/mediumtank.bos b/Scripts/mediumtank.bos deleted file mode 100644 index ba0d950e5..000000000 --- a/Scripts/mediumtank.bos +++ /dev/null @@ -1,149 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/metalsenthesizer.bos b/Scripts/metalsenthesizer.bos deleted file mode 100644 index 2b63abf66..000000000 --- a/Scripts/metalsenthesizer.bos +++ /dev/null @@ -1,119 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base; - -static-var statechg_DesiredState, statechg_StateChanging; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - -} - -Stop() -{ - -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/metalsenthesizer.cob b/Scripts/metalsenthesizer.cob deleted file mode 100644 index b89c781c5..000000000 Binary files a/Scripts/metalsenthesizer.cob and /dev/null differ diff --git a/Scripts/mex.bos b/Scripts/mex.bos deleted file mode 100644 index 209075f3a..000000000 --- a/Scripts/mex.bos +++ /dev/null @@ -1,136 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece mexbase, mextop; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from mexbase; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin mextop around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin mextop around y-axis decelerate Static_Var_3; - wait-for-turn mextop around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - Static_Var_2 = 50; - Static_Var_3 = 182; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -SweetSpot(piecenum) -{ - piecenum = mexbase; -} - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 45; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode mextop type BITMAPONLY | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode mextop type SHATTER | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode mextop type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode mextop type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode mexbase type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/mexmoho.bos b/Scripts/mexmoho.bos deleted file mode 100644 index 209075f3a..000000000 --- a/Scripts/mexmoho.bos +++ /dev/null @@ -1,136 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece mexbase, mextop; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from mexbase; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin mextop around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin mextop around y-axis decelerate Static_Var_3; - wait-for-turn mextop around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - Static_Var_2 = 50; - Static_Var_3 = 182; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -SweetSpot(piecenum) -{ - piecenum = mexbase; -} - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 45; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode mextop type BITMAPONLY | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode mextop type SHATTER | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode mextop type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode mexbase type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode mextop type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode mexbase type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/missilesiloemp.bos b/Scripts/missilesiloemp.bos deleted file mode 100644 index 4b513d524..000000000 --- a/Scripts/missilesiloemp.bos +++ /dev/null @@ -1,89 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/missletank.bos b/Scripts/missletank.bos deleted file mode 100644 index edce05a63..000000000 --- a/Scripts/missletank.bos +++ /dev/null @@ -1,192 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, firepoint1, firepoint2; // these are the pieces of the model - -static-var gun_1, gun_2, terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from hull; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move hull to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move hull to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); - start-script setSFXoccupy(); - start-script EmitWakes(); -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -// emit-sfx gdscannon from firepoint1; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = hull; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = hull; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_2 >= 1) -{ -sleep 100; -} -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_2 == 0 ) -{ -// emit-sfx gdscannon from firepoint2; -} -gun_2 = gun_2 + 1; -if( gun_2 >= 1 ) -{ -gun_2=0; -} -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = hull; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -if( gun_2 == 0 ) -{ -piecenum = firepoint2; -} -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode hull type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode hull type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode hull type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode hull type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/neutralradar.BOS b/Scripts/neutralradar.BOS deleted file mode 100644 index c5228e813..000000000 --- a/Scripts/neutralradar.BOS +++ /dev/null @@ -1,63 +0,0 @@ -piece gp, base, turret, dish; - -// State variables -static-var ISMOVING, ISAIMING, speedMult; - -#define SMOKEPIECE1 base - -#include "\headers\smoke.h" -#include "\headers\walk.h" - -//------------------------------------------------------ -//start ups :) -//------------------------------------------------------ -Create() - { - // Initial State - ISMOVING = FALSE; - ISAIMING = FALSE; - - speedMult = 2.4; - - start-script SmokeUnit(); - start-script MotionControl(); - } - -SweetSpot(piecenum) - { piecenum=GP; } - -Killed( severity, corpsetype ) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type FALL; - explode cod type BITMAPONLY; - explode head type FALL; - return( 0 ); - } - - if (severity <= 50) - { - corpsetype = 2; - explode base type FALL; - explode cod type FALL; - explode head type FALL; - return( 0 ); - } - - if (severity <= 99) - { - corpsetype = 3; - explode base type BITMAPONLY; - explode cod type BITMAPONLY; - explode head type BITMAPONLY; - return( 0 ); - } - - corpsetype = 3; - explode base type BITMAPONLY;; - explode cod type BITMAPONLY; - explode head type FALL; - return( 0 ); - } \ No newline at end of file diff --git a/Scripts/neutralradar.cob b/Scripts/neutralradar.cob deleted file mode 100644 index 10b9d2f2b..000000000 Binary files a/Scripts/neutralradar.cob and /dev/null differ diff --git a/Scripts/plasmabattery.bos b/Scripts/plasmabattery.bos deleted file mode 100644 index 500affb98..000000000 --- a/Scripts/plasmabattery.bos +++ /dev/null @@ -1,182 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, bottomturret, topturret, topbarrel, firepoint1, bottombarrel, firepoint2; // these are the pieces of the model - -static-var gun_1, gun_2; // these are the variables - -#define gdhcannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from topturret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn topturret to y-axis <0> speed <60>; -turn bottomturret to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn topturret to y-axis heading speed <225>; -wait-for-turn topturret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -emit-sfx gdhcannon from firepoint2; -move topbarrel to z-axis [-2] speed [500]; -sleep 75; -move topbarrel to z-axis [0] speed [1]; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = topturret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint2; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_2 >= 1) -{ -sleep 100; -} -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn bottomturret to y-axis heading speed <225>; -wait-for-turn bottomturret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_2 == 0 ) -{ -emit-sfx gdhcannon from firepoint2; -move bottombarrel to z-axis [-2] speed [500]; -sleep 75; -move bottombarrel to z-axis [0] speed [1]; -} -gun_2 = gun_2 + 1; -if( gun_2 >= 1 ) -{ -gun_2=0; -} -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = bottomturret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -if( gun_2 == 0 ) -{ -piecenum = firepoint1; -} -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode topbarrel type BITMAPONLY | BITMAP1; -explode bottombarrel type BITMAPONLY | BITMAP3; -explode bottomturret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode topbarrel type FALL | BITMAP1; -explode bottombarrel type BITMAPONLY | BITMAP3; -explode bottomturret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode topbarrel type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode bottombarrel type BITMAPONLY | BITMAP3; -explode bottomturret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode topbarrel type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode bottombarrel type BITMAPONLY | BITMAP3; -explode bottomturret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/plasmabattery.cob b/Scripts/plasmabattery.cob deleted file mode 100644 index b019a59d8..000000000 Binary files a/Scripts/plasmabattery.cob and /dev/null differ diff --git a/Scripts/radar.bos b/Scripts/radar.bos deleted file mode 100644 index d7c25c5bf..000000000 --- a/Scripts/radar.bos +++ /dev/null @@ -1,71 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece radar; - -static-var statechg_DesiredState, statechg_StateChanging; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from radar; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Create() -{ - start-script SmokeUnit(); -} - -SweetSpot(piecenum) -{ - piecenum = radar; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode radar type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode radar type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode radar type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode radar type BITMAPONLY | BITMAP1; -} \ No newline at end of file diff --git a/Scripts/research.bos b/Scripts/research.bos deleted file mode 100644 index 67b0a9ec1..000000000 --- a/Scripts/research.bos +++ /dev/null @@ -1,92 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, sfx; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = sfx; -} - -QueryWeapon1(Func_Var_1) -{ - Func_Var_1 = sfx; -} - - -Create() -{ - move sfx to y-axis [5000.000000] now; - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/scavs/beacon.bos b/Scripts/scavs/beacon.bos new file mode 100644 index 000000000..cb8960b35 --- /dev/null +++ b/Scripts/scavs/beacon.bos @@ -0,0 +1,37 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, topantenna, innerring, outerring, centerring, emit; + +Standby() +{ + while( TRUE ) + { + emit-sfx 1024 + 0 from emit; + sleep 1150; + } + sleep 50; + start-script Standby(); +} + +Create() +{ + spin topantenna around y-axis speed <8>; + spin topantenna around x-axis speed <2>; + spin innerring around y-axis speed <-3>; + spin centerring around y-axis speed <4>; + spin outerring around y-axis speed <-7>; + start-script Standby(); +} + + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; + explode topantenna type EXPLODE_ON_HIT; + explode innerring type EXPLODE_ON_HIT; + explode centerring type EXPLODE_ON_HIT; + explode outerring type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/scavs/beacon.cob b/Scripts/scavs/beacon.cob new file mode 100644 index 000000000..043cc41dd Binary files /dev/null and b/Scripts/scavs/beacon.cob differ diff --git a/Scripts/scavs/droppod.bos b/Scripts/scavs/droppod.bos new file mode 100644 index 000000000..1864cc305 --- /dev/null +++ b/Scripts/scavs/droppod.bos @@ -0,0 +1,56 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, emit, launcher, arm; + + +Create() +{ + hide launcher; + hide emit; + hide base; + hide arm; + dont-shade base; + dont-cache base; + set ARMORED to 0; + move launcher to y-axis [10000.000000] speed [50000.000000]; + move launcher to x-axis [0.000000] speed [50000.000000]; + move launcher to z-axis [0.000000] speed [50000.000000]; + turn launcher to y-axis <90.000000> speed <10000.000000>; + turn launcher to x-axis <90.000000> speed <10000.000000>; + turn launcher to z-axis <90.000000> speed <10000.000000>; + sleep 100; + spin arm around y-axis speed <21.978022>; + turn arm to x-axis Rand( <0.005495>, <40.989011> ) speed <1000.000000>; + sleep Rand( 1, 100 ); + emit-sfx 2048 from launcher; + sleep 3000; + //show base; +} + +Killed(severity, corpsetype) +{ + emit-sfx 1025 from emit; +} + +QueryNanoPiece(piecenum) +{ + piecenum = base; +} + +QueryWeapon1(piecenum) +{ + piecenum = base; +} + +AimFromWeapon1(piecenum) +{ + piecenum = base; +} + +QueryLandingPad(Func_Var_1) +{ + Func_Var_1 = 1; +} diff --git a/Scripts/scavs/droppod.cob b/Scripts/scavs/droppod.cob new file mode 100644 index 000000000..a82e73aef Binary files /dev/null and b/Scripts/scavs/droppod.cob differ diff --git a/Scripts/scavs/exptype.h b/Scripts/scavs/exptype.h new file mode 100644 index 000000000..7a83187b2 --- /dev/null +++ b/Scripts/scavs/exptype.h @@ -0,0 +1,193 @@ +/* +** EXPtype.h -- Explosion Type information and GET/SET constants for scripts +** +** This Script contains constants compatible only with Spring RTS engine +** not for use with Total Annihilation or TA:Kindgoms +*/ + +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +// Indices for emit-sfx +#ifndef __SFXTYPE_H_ +#define SFXTYPE_VTOL 0 +//#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 // same as SFX_WAKE +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 // same as SFX_REVERSE_WAKE + +#define SFXTYPE_WHITESMOKE 257 +#define SFXTYPE_BLACKSMOKE 258 +#define SFXTYPE_SUBBUBBLES 259 +#endif + +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define NOCEGTRAIL 64 // Disables the cegtrail for the specific piece (defined in the unit fbi) +#define NOHEATCLOUD 128 // No engine default heat cloud for explosion +#define BITMAP 10000001 + +// Bitmap Explosion Types +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 + +//Customized effects (in FBI/TDF/LUA) +// Explosion generators +#define UNIT_SFX0 1024 +#define UNIT_SFX1 1025 +#define UNIT_SFX2 1026 +#define UNIT_SFX3 1027 +#define UNIT_SFX4 1028 +#define UNIT_SFX5 1029 +#define UNIT_SFX6 1030 +#define UNIT_SFX7 1031 +#define UNIT_SFX8 1032 +#define UNIT_SFX9 1033 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 +#define FIRE_W9 2056 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 +#define DETO_W9 4104 + + +// COB constants +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get +#define REVERSING 109 // get + +// Indices for SET, GET, and GET_UNIT_VALUE for LUA return values +#define LUA0 110 // (LUA0 returns the lua call status, 0 or 1) +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) get WEAPON_RELOADSTATE(weaponNum) for GET +#define WEAPON_RELOADTIME 126 // get (with fake set) get WEAPON_RELOADSTATE(-weaponNum,val) for SET +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define WEAPON_STOCKPILE_COUNT 139 // get (with fake set) + + +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get +#define KSIN 135 // get, kiloSine 1024*sin(x) as COB uses only integers +#define KCOS 136 // get, kiloCosine 1024*cos(x) + +#define KTAN 137 // get, kiloTangent 1024*tan(x) carefull with angles close to 90 deg. might cause overflow +#define SQRT 138 // get, square root (floored to integer) + +#define ENERGY_MAKE 140 // set or get (100*E production) + +#define METAL_MAKE 141 // set or get (100*M production) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif \ No newline at end of file diff --git a/Scripts/scavs/sfxtype.h b/Scripts/scavs/sfxtype.h new file mode 100644 index 000000000..e69de29bb diff --git a/Scripts/scavs/unitDefsTurretSpeeds.h b/Scripts/scavs/unitDefsTurretSpeeds.h new file mode 100644 index 000000000..c30940742 --- /dev/null +++ b/Scripts/scavs/unitDefsTurretSpeeds.h @@ -0,0 +1,68 @@ +/* unitDefsTurretSpeeds.h -- sets turret speed via unitDefs (through lua gadget Spring.CallCOBScript()) + The following variables are assumed to exist: + Weapon1TurretX, Weapon1TurretY + ... + Weapon10TurretX, Weapon10TurretY +*/ + +static-var Weapon1TurretX, Weapon1TurretY; +static-var Weapon2TurretX, Weapon2TurretY; +static-var Weapon3TurretX, Weapon3TurretY; +static-var Weapon4TurretX, Weapon4TurretY; +static-var Weapon5TurretX, Weapon5TurretY; +static-var Weapon6TurretX, Weapon6TurretY; +static-var Weapon7TurretX, Weapon7TurretY; +static-var Weapon8TurretX, Weapon8TurretY; +static-var Weapon9TurretX, Weapon9TurretY; +static-var Weapon10TurretX, Weapon10TurretY; + +SetWeapon1TurretSpeed(var1,var2) +{ + Weapon1TurretX = var1; + Weapon1TurretY = var2; +} +SetWeapon2TurretSpeed(var1,var2) +{ + Weapon2TurretX = var1; + Weapon2TurretY = var2; +} +SetWeapon3TurretSpeed(var1,var2) +{ + Weapon3TurretX = var1; + Weapon3TurretY = var2; +} +SetWeapon4TurretSpeed(var1,var2) +{ + Weapon4TurretX = var1; + Weapon4TurretY = var2; +} +SetWeapon5TurretSpeed(var1,var2) +{ + Weapon5TurretX = var1; + Weapon5TurretY = var2; +} +SetWeapon6TurretSpeed(var1,var2) +{ + Weapon6TurretX = var1; + Weapon6TurretY = var2; +} +SetWeapon7TurretSpeed(var1,var2) +{ + Weapon7TurretX = var1; + Weapon7TurretY = var2; +} +SetWeapon8TurretSpeed(var1,var2) +{ + Weapon8TurretX = var1; + Weapon8TurretY = var2; +} +SetWeapon9TurretSpeed(var1,var2) +{ + Weapon9TurretX = var1; + Weapon9TurretY = var2; +} +SetWeapon10TurretSpeed(var1,var2) +{ + Weapon10TurretX = var1; + Weapon10TurretY = var2; +} \ No newline at end of file diff --git a/Scripts/scavs/water2.h b/Scripts/scavs/water2.h new file mode 100644 index 000000000..b5a5be089 --- /dev/null +++ b/Scripts/scavs/water2.h @@ -0,0 +1,31 @@ +/* Rockunit.h -- Rock the unit when it fire a heavy weapon with lots of recoil */ + +#ifndef __ROCKUNIT_H_ +#define __ROCKUNIT_H_ + + +RockUnit(anglex,anglez) + { + + #define FIRST_SPEED 15 + #define SECOND_SPEED 12 + #define THIRD_SPEED 9 + + turn base to x-axis anglex speed ; + turn base to z-axis anglez speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (0-anglex) speed ; + turn base to z-axis (0-anglez) speed ; + + //wait-for-turn base around z-axis; + //wait-for-turn base around x-axis; + + //turn base to x-axis <0> speed ; + //turn base to z-axis <0> speed ; + + + } +#endif diff --git a/Scripts/scavs/water3.h b/Scripts/scavs/water3.h new file mode 100644 index 000000000..5066f3284 --- /dev/null +++ b/Scripts/scavs/water3.h @@ -0,0 +1,35 @@ +#ifndef __ROCKUNIT_H_ +#define __ROCKUNIT_H_ + + +RockUnit(anglex,anglez) + { + + #define FIRST_SPEED 10 + #define SECOND_SPEED 8 + #define THIRD_SPEED 6 + #define FIFTH_SPEED 4 + + turn base to x-axis anglex speed ; + turn base to z-axis anglez speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (0-anglex) speed ; + turn base to z-axis (0-anglez) speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis (anglex/2) speed ; + turn base to z-axis (anglez/2) speed ; + + wait-for-turn base around z-axis; + wait-for-turn base around x-axis; + + turn base to x-axis <0> speed ; + turn base to z-axis <0> speed ; + } +#endif + diff --git a/Scripts/scavs/weapon1control.h b/Scripts/scavs/weapon1control.h new file mode 100644 index 000000000..d1c1acd4f --- /dev/null +++ b/Scripts/scavs/weapon1control.h @@ -0,0 +1,154 @@ +/* +HOW TO: +- Model MUST contain aimx1 and aimy1 pieces +- Script must have defined Weapon1TurretX and Weapon1TurretY static-vars (turret turn speeds) +- Script must have defined aimx1 and aimy1 pieces +- Change script as such: +Create() +{ + [...] + start-script InitialSetup1(); + [...] +} + +AimWeapon1(heading, pitch) +{ + [...] + start-script Weapon1Drawn(); -- can call a function that draws weapons and then calls Weapon1Drawn() when done if there is an actual animation (ie pw) + [...] -- Remove animations from aimWeapon scripts (use a DrawWeapon1() if an animation is needed, weapon1control will rotate the different aimpieces) + start-script Weapon1SetWtdAim(heading, pitch); + [...] + return (aim1); +} + +RestoreAfterDelay() +{ + [...] + sleep sleeptime; + start-script RestoreWeapon1(); + [...] -- other animations; + call-script Weapon1Restored(); + [...] -- tell script wpn has been restored if needed for walkscripts +} + +- Weapon1Control moves the aim pieces depending on turretSpeeds, sets pitch = 1 when pitch reached and head = 1 when head reached +- Weapon1Drawn allows unit to fire by setting wpnReady1 = 1 +- if pitch = 1, head = 1 and wpnReady = 1 then the weapon can shoot: aim1 = 1 and aimweapon returns aim1 +- Restore animations go in RestoreAfterDelay, RestoreWeapon1() restores aimy and aimx pieces orientation, Weapon1Restored() waits for these pieces to be restored +*/ + +static-var curHead1, wtdHead1, head1, curPitch1, wtdPitch1, pitch1, aim1, wpnReady1; + +Weapon1Control() +{ + while (TRUE) + { + if (curHead1 > <180>) + { + curHead1 = <-360> + curHead1; + } + if (curPitch1 > <180>) + { + curPitch1 = <-360> + curPitch1; + } + if (curHead1 < <-180>) + { + curHead1 = <360> + curHead1; + } + if (curPitch1 < <-180>) + { + curPitch1 = <360> + curPitch1; + } + if (Static_Var_3 == 1) + { + if (((get ABS(curHead1 - wtdHead1)) > <360>) OR(((get ABS(curHead1 - wtdHead1)) > (Weapon1TurretY / 30)) AND ((get ABS(curHead1 - wtdHead1)) < <360> - (Weapon1TurretY / 30)))) + { + head1 = 0; + if(curHead1 < wtdHead1) { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 + (Weapon1TurretY / 30); + else curHead1 = curHead1 - (Weapon1TurretY / 30); + } + + else { + if(get ABS(curHead1 - wtdHead1)< <180>) + curHead1 = curHead1 - (Weapon1TurretY / 30); + else curHead1 = curHead1 + (Weapon1TurretY / 30); + } + } + else + { + head1 = 1; + curHead1 = wtdHead1; + } + if (((get ABS(curPitch1 - wtdPitch1)) > <360>) OR(((get ABS(curPitch1 - wtdPitch1)) > (Weapon1TurretX / 30)) AND ((get ABS(curPitch1 - wtdPitch1)) < <360> - (Weapon1TurretX / 30)))) + { + pitch1 = 0; + if(curPitch1 < wtdPitch1) { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 + (Weapon1TurretX / 30); + else curPitch1 = curPitch1 - (Weapon1TurretX / 30); + } + + else { + if(get ABS(curPitch1 - wtdPitch1)< <180>) + curPitch1 = curPitch1 - (Weapon1TurretX / 30); + else curPitch1 = curPitch1 + (Weapon1TurretX / 30); + } + } + else + { + pitch1 = 1; + curPitch1 = wtdPitch1; + } + if (pitch1 == 1 AND head1 == 1 AND wpnReady1 == 1 AND wtdHead1 != 0) + { + aim1 = 1; + } + else + { + aim1 = 0; + } + turn aimy1 to y-axis curHead1 now; + turn aimx1 to x-axis curPitch1 now; + } + sleep 1; + } +} + +InitialSetup1() +{ + curHead1 = 0; + curPitch1 = 0; + wtdHead1 = 0; + wtdPitch1 = 0; + wpnReady1 = 0; + start-script Weapon1Control(); +} + +Weapon1Drawn() +{ + wpnReady1 = 1; +} + +RestoreWeapon1() +{ + wtdHead1 = 0; + wtdPitch1 = 0; +} + +Weapon1Restored() +{ + wpnReady1 = 0; + while (curHead1 != 0) + { + sleep 25; + } + return (TRUE); +} + +Weapon1SetWtdAim(pitch, heading) +{ + wtdHead1 = heading; + wtdPitch1 = <0> - pitch; +} \ No newline at end of file diff --git a/Scripts/scavs/yard.h b/Scripts/scavs/yard.h new file mode 100644 index 000000000..048994e28 --- /dev/null +++ b/Scripts/scavs/yard.h @@ -0,0 +1,35 @@ +#ifndef SCRIPTS_YARD_H +#define SCRIPTS_YARD_H + +// keep trying to open building's yard until we succeed +OpenYard() + { + set YARD_OPEN to TRUE; + + while(!(get YARD_OPEN)) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to TRUE; + } + + set BUGGER_OFF to FALSE; + } + + +// keep trying to close building's yard until we succeed +CloseYard() + { + set YARD_OPEN to FALSE; + + while(get YARD_OPEN) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to FALSE; + } + + set BUGGER_OFF to FALSE; + } + +#endif // SCRIPTS_YARD_H diff --git a/Scripts/smokestack.BOS b/Scripts/smokestack.BOS deleted file mode 100644 index 0773eadec..000000000 --- a/Scripts/smokestack.BOS +++ /dev/null @@ -1,29 +0,0 @@ -piece gp, smoke1, smoke2, base; - -#include "\headers\definitions.h" -#define smoke 1024+0 - - Flamingass() - { - while(TRUE) - { - emit-sfx smoke from smoke1; - sleep 20; - emit-sfx smoke from smoke2; - sleep 20; - } - - } - -Create() - { - start-script Flamingass(); - } - - - - -Killed( severity, corpsetype ) - { - - } \ No newline at end of file diff --git a/Scripts/smokestack.cob b/Scripts/smokestack.cob deleted file mode 100644 index 5726f6602..000000000 Binary files a/Scripts/smokestack.cob and /dev/null differ diff --git a/Scripts/smokestacktall.BOS b/Scripts/smokestacktall.BOS deleted file mode 100644 index 29249ebc3..000000000 --- a/Scripts/smokestacktall.BOS +++ /dev/null @@ -1,27 +0,0 @@ -piece GP, smoke1, base; - -#include "\headers\definitions.h" -#define smoke 1024+0 - - Flamingass() - { - while(TRUE) - { - emit-sfx smoke from smoke1; - sleep 20; - } - - } - -Create() - { - start-script Flamingass(); - } - - - - -Killed( severity, corpsetype ) - { - - } \ No newline at end of file diff --git a/Scripts/smokestacktall.cob b/Scripts/smokestacktall.cob deleted file mode 100644 index 729faae82..000000000 Binary files a/Scripts/smokestacktall.cob and /dev/null differ diff --git a/Scripts/solar.bos b/Scripts/solar.bos deleted file mode 100644 index 31e864972..000000000 --- a/Scripts/solar.bos +++ /dev/null @@ -1,72 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece solar; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from solar; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Create() -{ - spin solar around y-axis speed <50.005495>; - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = solar; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode solar type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode solar type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode solar type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode solar type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/specialfactory.bos b/Scripts/specialfactory.bos deleted file mode 100644 index 802b22e87..000000000 --- a/Scripts/specialfactory.bos +++ /dev/null @@ -1,193 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece specialfactory, shield, nano1, nano2; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging; - -// Signal definitions -#define SIG_ACTIVATE 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from specialfactory; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -OpenYard() -{ - set YARD_OPEN to 1; - while( !get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 1; - } - set BUGGER_OFF to 0; -} - -CloseYard() -{ - set YARD_OPEN to 0; - while( get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 0; - } - set BUGGER_OFF to 0; -} - -Go() -{ - call-script OpenYard(); - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - call-script CloseYard(); -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - unitviewer = FALSE; - spray = specialfactory; - call-script InitState(); - start-script SmokeUnit(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray != 0 ) - { - piecenum = nano2; - } - spray = !spray; -} - -Demo() -{ - unitviewer = TRUE; -} - -Activate() -{ - signal SIG_ACTIVATE; - start-script RequestState(0); -} - -Deactivate() -{ - signal SIG_ACTIVATE; - set-signal-mask SIG_ACTIVATE; - if( !unitviewer ) - { - sleep 5000; - } - set-signal-mask 0; - start-script RequestState(1); -} - -StartBuilding() -{ -} - -StopBuilding() -{ -} - -QueryBuildInfo(piecenum) -{ - piecenum = shield; -} - -SweetSpot(piecenum) -{ - piecenum = specialfactory; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode specialfactory type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode specialfactory type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode specialfactory type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode specialfactory type BITMAPONLY | BITMAP1; -} diff --git a/Scripts/storage.bos b/Scripts/storage.bos deleted file mode 100644 index 69a3ff079..000000000 --- a/Scripts/storage.bos +++ /dev/null @@ -1,71 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece storage; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from storage; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Create() -{ - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = storage; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode storage type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode storage type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode storage type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode storage type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/storage.cob b/Scripts/storage.cob deleted file mode 100644 index d8d92debb..000000000 Binary files a/Scripts/storage.cob and /dev/null differ diff --git a/Scripts/taatank.bos b/Scripts/taatank.bos deleted file mode 100644 index 1ca20b515..000000000 --- a/Scripts/taatank.bos +++ /dev/null @@ -1,154 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -stop-spin barrel1 around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -spin barrel1 around z-axis speed <500.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/taatank.cob b/Scripts/taatank.cob deleted file mode 100644 index a905e99fb..000000000 Binary files a/Scripts/taatank.cob and /dev/null differ diff --git a/Scripts/taatank2.bos b/Scripts/taatank2.bos deleted file mode 100644 index e07260053..000000000 --- a/Scripts/taatank2.bos +++ /dev/null @@ -1,177 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, rotator, dirt; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from dirt; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -stop-spin barrel1 around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn rotator to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn rotator around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -spin barrel1 around z-axis speed <500.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/taatank2.cob b/Scripts/taatank2.cob deleted file mode 100644 index 49ae3cf9e..000000000 Binary files a/Scripts/taatank2.cob and /dev/null differ diff --git a/Scripts/taircon.bos b/Scripts/taircon.bos deleted file mode 100644 index 0b084d3f3..000000000 --- a/Scripts/taircon.bos +++ /dev/null @@ -1,194 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, fan1, fan2, firepoint1; - -static-var Static_Var_1, gun_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype; - -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from base; - sleep 200; - } -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - -QueryWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - -Go() -{ - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -Create() -{ - call-script InitState(); - spin fan1 around y-axis speed <1000.005495>; - spin fan2 around y-axis speed <1000.005495>; - start-script SmokeUnit(); -} - - -StartBuilding(Func_Var_1) -{ - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = base; - Static_Var_5 = 1; - return (0); - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/taircon.cob b/Scripts/taircon.cob deleted file mode 100644 index 0d2d21676..000000000 Binary files a/Scripts/taircon.cob and /dev/null differ diff --git a/Scripts/tannihilator.cob b/Scripts/tannihilator.cob deleted file mode 100644 index d17d62cd4..000000000 Binary files a/Scripts/tannihilator.cob and /dev/null differ diff --git a/Scripts/tantiairtower.bos b/Scripts/tantiairtower.bos deleted file mode 100644 index 7aeebf479..000000000 --- a/Scripts/tantiairtower.bos +++ /dev/null @@ -1,128 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, firepoint; // these are the pieces of the model - -static-var gun_1; // these are the variables - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn turret to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -sleep 75; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint; -} -} - -SweetSpot(piecenum) // not sure what this is for -{ -piecenum = base; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tantiairtower.cob b/Scripts/tantiairtower.cob deleted file mode 100644 index 4355a3867..000000000 Binary files a/Scripts/tantiairtower.cob and /dev/null differ diff --git a/Scripts/tantiairtower2.bos b/Scripts/tantiairtower2.bos deleted file mode 100644 index 4279fe7e9..000000000 --- a/Scripts/tantiairtower2.bos +++ /dev/null @@ -1,108 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define gdmarty 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -turn turret1 to x-axis <0.000000> speed <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret1 to y-axis heading speed <225>; -turn turret1 to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret1 around y-axis; -wait-for-turn turret1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret1 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tantiairtower2.cob b/Scripts/tantiairtower2.cob deleted file mode 100644 index 7016f9d78..000000000 Binary files a/Scripts/tantiairtower2.cob and /dev/null differ diff --git a/Scripts/tartillarytank.bos b/Scripts/tartillarytank.bos deleted file mode 100644 index caa614ec6..000000000 --- a/Scripts/tartillarytank.bos +++ /dev/null @@ -1,151 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var gun_1, terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - explode barrel1 type BITMAPONLY | BITMAP1; - explode turret type BITMAPONLY | BITMAP4; - return (0); - } - if( severity <= 80 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP4; - explode barrel1 type FALL | BITMAP1; - explode turret type SHATTER | BITMAP4; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode turret type SHATTER | BITMAP4; - return (0); - } - corpsetype = 3; - explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tartillarytank.cob b/Scripts/tartillarytank.cob deleted file mode 100644 index a5ff1e0b1..000000000 Binary files a/Scripts/tartillarytank.cob and /dev/null differ diff --git a/Scripts/tassimilator.bos b/Scripts/tassimilator.bos deleted file mode 100644 index 188150e8d..000000000 --- a/Scripts/tassimilator.bos +++ /dev/null @@ -1,149 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define BLUE_EXPLOSION_SMALL 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -turn turret1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; - -turn turret1 to y-axis heading speed <225>; -turn turret1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret1 around x-axis; -wait-for-turn turret1 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx BLUE_EXPLOSION_SMALL from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type FALL | BITMAP1; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -return (0); -} -corpsetype = 3; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -} diff --git a/Scripts/tassimilator.cob b/Scripts/tassimilator.cob deleted file mode 100644 index 5cd79ba83..000000000 Binary files a/Scripts/tassimilator.cob and /dev/null differ diff --git a/Scripts/tbinoc.bos b/Scripts/tbinoc.bos deleted file mode 100644 index 7543a444b..000000000 --- a/Scripts/tbinoc.bos +++ /dev/null @@ -1,128 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, sfxpoint1; - -static-var terraintype, bmoving, moving; // these are the variables - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1024 + 0 from sfxpoint1; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} \ No newline at end of file diff --git a/Scripts/tbinoc.cob b/Scripts/tbinoc.cob deleted file mode 100644 index 4b9914a41..000000000 Binary files a/Scripts/tbinoc.cob and /dev/null differ diff --git a/Scripts/tcentralprocessing.bos b/Scripts/tcentralprocessing.bos deleted file mode 100644 index de28c9837..000000000 --- a/Scripts/tcentralprocessing.bos +++ /dev/null @@ -1,202 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, sfx, firepoint1, shield1, shield2; - -static-var Static_Var_1, gun_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype; - -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from sfx; - sleep 500; - } -} - -AimWeapon1(Func_Var_1, Func_Var_2) -{ - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - -QueryWeapon1(Func_Var_1) -{ - Func_Var_1 = firepoint1; -} - - -Go() -{ - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -Create() -{ - call-script InitState(); - move firepoint1 to y-axis [5000.000000] now; - spin base around y-axis speed <15.005495>; - move base to y-axis [100.000000] now; - start-script fx(); - start-script SmokeUnit(); -} - - -SweetSpot(piecenum) -{ - piecenum = base; -} - -StartBuilding(Func_Var_1) -{ - Static_Var_1 = Func_Var_1; - start-script RequestState(0); -} - -StopBuilding() -{ - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = sfx; - Static_Var_5 = 1; - return (0); - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tcentralprocessing.cob b/Scripts/tcentralprocessing.cob deleted file mode 100644 index 4ab12a820..000000000 Binary files a/Scripts/tcentralprocessing.cob and /dev/null differ diff --git a/Scripts/tcommandfact.cob b/Scripts/tcommandfact.cob deleted file mode 100644 index 6496ec6c0..000000000 Binary files a/Scripts/tcommandfact.cob and /dev/null differ diff --git a/Scripts/tdecimator.bos b/Scripts/tdecimator.bos deleted file mode 100644 index ea8204e45..000000000 --- a/Scripts/tdecimator.bos +++ /dev/null @@ -1,136 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - - -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn turret to y-axis <0> speed <30>; -turn barrel1 to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <30>; -turn barrel1 to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <30>; -turn barrel1 to x-axis <0> - pitch speed <10>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tdecimator.cob b/Scripts/tdecimator.cob deleted file mode 100644 index 9c62bf960..000000000 Binary files a/Scripts/tdecimator.cob and /dev/null differ diff --git a/Scripts/tengineer.cob b/Scripts/tengineer.cob deleted file mode 100644 index bfc0f34fa..000000000 Binary files a/Scripts/tengineer.cob and /dev/null differ diff --git a/Scripts/tengineer2.cob b/Scripts/tengineer2.cob deleted file mode 100644 index bfc0f34fa..000000000 Binary files a/Scripts/tengineer2.cob and /dev/null differ diff --git a/Scripts/tengineer3.bos b/Scripts/tengineer3.bos deleted file mode 100644 index db7706938..000000000 --- a/Scripts/tengineer3.bos +++ /dev/null @@ -1,238 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, nano1, nano2, nano3, nano4; - -static-var Static_Var_1, Static_Var_3, Static_Var_5, statechg_DesiredState, statechg_StateChanging, bMoving, terraintype, building; - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Buildingfx() -{ - while(building) - { - - emit-sfx nanoflame from nano1; - emit-sfx nanoflame from nano2; - emit-sfx nanoflame from nano3; - emit-sfx nanoflame from nano4; - - sleep 5; - } -} - -Go() -{ - turn base to y-axis Static_Var_1 speed <160.000000>; - wait-for-turn base around y-axis; - Static_Var_3 = 1; - if( Static_Var_3 ) - { - - } - sleep 15; - set INBUILDSTANCE to 1; -} - -Stop() -{ - turn base to y-axis <0.000000> speed <160.000000>; - wait-for-turn base around y-axis; - set INBUILDSTANCE to 0; - if( Static_Var_3 ) - { - - } - sleep 20; - Static_Var_3 = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() -{ - Static_Var_3 = 0; - Static_Var_1 = 0; - call-script InitState(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -StartBuilding(Func_Var_1) -{ - building=1; - Static_Var_1 = Func_Var_1; - start-script RequestState(0); - start-script Buildingfx(); -} - -StopBuilding() -{ - building=0; - start-script RequestState(1); -} - -QueryNanoPiece(piecenum) -{ - if( Static_Var_5 == 0 ) - { - piecenum = nano1; - Static_Var_5 = 1; - - } - if( Static_Var_5 == 1 ) - { - piecenum = nano2; - Static_Var_5 = 2; - return (0); - } - if( Static_Var_5 == 2 ) - { - piecenum = nano3; - Static_Var_5 = 0; - - } -} - -TargetHeading(Func_Var_1) -{ - Static_Var_1 = 0 - Func_Var_1; -} - -StartMoving() -{ - bMoving = TRUE; -} - -StopMoving() -{ - bMoving = FALSE; -} - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP2; -} diff --git a/Scripts/tengineer3.cob b/Scripts/tengineer3.cob deleted file mode 100644 index dbffbcaa5..000000000 Binary files a/Scripts/tengineer3.cob and /dev/null differ diff --git a/Scripts/tengineer3up1.cob b/Scripts/tengineer3up1.cob deleted file mode 100644 index dbffbcaa5..000000000 Binary files a/Scripts/tengineer3up1.cob and /dev/null differ diff --git a/Scripts/tfact.bos b/Scripts/tfact.bos deleted file mode 100644 index ee481f759..000000000 --- a/Scripts/tfact.bos +++ /dev/null @@ -1,210 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, nano1, nano2, sfxpoint1, sfxpoint2, sfxpoint3, sfxpoint4, sfxpoint5, sfxpoint6; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building; - -// Signal definitions -#define SIG_ACTIVATE 2 - -#define nanoflame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Buildingfx() -{ - while(building) - { - - emit-sfx nanoflame from sfxpoint1; - emit-sfx nanoflame from sfxpoint2; - emit-sfx nanoflame from sfxpoint3; - emit-sfx nanoflame from sfxpoint4; - emit-sfx nanoflame from sfxpoint5; - emit-sfx nanoflame from sfxpoint6; - - sleep 5; - } -} - - -OpenYard() -{ - set YARD_OPEN to 1; - while( !get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 1; - } - set BUGGER_OFF to 0; -} - -CloseYard() -{ - set YARD_OPEN to 0; - while( get YARD_OPEN ) - { - set BUGGER_OFF to 1; - sleep 1500; - set YARD_OPEN to 0; - } - set BUGGER_OFF to 0; -} - -Go() -{ - call-script OpenYard(); - set INBUILDSTANCE to 1; -} - -Stop() -{ - set INBUILDSTANCE to 0; - call-script CloseYard(); - -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - building=1; - start-script Buildingfx(); - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - building=0; - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - unitviewer = FALSE; - spray = base; - turn sfxpoint1 to y-axis <90> now; - turn sfxpoint2 to y-axis <90> now; - turn sfxpoint3 to y-axis <90> now; - turn sfxpoint4 to y-axis <-90> now; - turn sfxpoint5 to y-axis <-90> now; - turn sfxpoint6 to y-axis <-90> now; - call-script InitState(); - start-script SmokeUnit(); -} - -QueryNanoPiece(piecenum) -{ - if( spray == 0 ) - { - piecenum = nano1; - } - if( spray != 0 ) - { - piecenum = nano2; - } - spray = !spray; -} - - -Activate() -{ - signal SIG_ACTIVATE; - start-script RequestState(0); -} - -Deactivate() -{ - signal SIG_ACTIVATE; - set-signal-mask SIG_ACTIVATE; - - set-signal-mask 0; - start-script RequestState(1); -} - -StartBuilding() -{ -} - -StopBuilding() -{ -} - -QueryBuildInfo(piecenum) -{ - piecenum = base; -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} diff --git a/Scripts/tfact.cob b/Scripts/tfact.cob deleted file mode 100644 index f1e4d3ed0..000000000 Binary files a/Scripts/tfact.cob and /dev/null differ diff --git a/Scripts/tfactory.cob b/Scripts/tfactory.cob deleted file mode 100644 index 121233355..000000000 Binary files a/Scripts/tfactory.cob and /dev/null differ diff --git a/Scripts/tfusion.cob b/Scripts/tfusion.cob deleted file mode 100644 index 570a17396..000000000 Binary files a/Scripts/tfusion.cob and /dev/null differ diff --git a/Scripts/tfusion2.bos b/Scripts/tfusion2.bos deleted file mode 100644 index c16568f48..000000000 --- a/Scripts/tfusion2.bos +++ /dev/null @@ -1,123 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, sfxpoint1, sfxpoint2, sfxpoint3, sfxpoint4, sfxpoint5, sfxpoint6, sfxpoint7, sfxpoint8; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from sfxpoint1; - emit-sfx 2050 from sfxpoint2; - emit-sfx 2050 from sfxpoint3; - emit-sfx 2052 from sfxpoint8; - sleep 5; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2049 from sfxpoint1; - sleep 400; - } -} - -fx3() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2051 from sfxpoint3; - emit-sfx 2051 from sfxpoint4; - emit-sfx 2051 from sfxpoint5; - emit-sfx 2051 from sfxpoint6; - emit-sfx 2051 from sfxpoint7; - sleep 200; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - start-script fx3(); - turn sfxpoint1 to x-axis <-90> now; - turn sfxpoint3 to x-axis <-90> now; - turn sfxpoint4 to x-axis <-90> now; - turn sfxpoint5 to x-axis <-90> now; - turn sfxpoint6 to x-axis <-90> now; - turn sfxpoint7 to x-axis <-90> now; - turn sfxpoint2 to x-axis <90> now; - spin top around y-axis speed <50.005495>; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tfusion2.cob b/Scripts/tfusion2.cob deleted file mode 100644 index 8c5f65f3a..000000000 Binary files a/Scripts/tfusion2.cob and /dev/null differ diff --git a/Scripts/tgeothermal.bos b/Scripts/tgeothermal.bos deleted file mode 100644 index 85fef8d53..000000000 --- a/Scripts/tgeothermal.bos +++ /dev/null @@ -1,96 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, sfxpoint1; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from sfxpoint1; - sleep 5; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2049 from sfxpoint1; - sleep 400; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn sfxpoint1 to x-axis <-90> now; - spin top around y-axis speed <50.005495>; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tgeothermal.cob b/Scripts/tgeothermal.cob deleted file mode 100644 index 9d1e2d2d1..000000000 Binary files a/Scripts/tgeothermal.cob and /dev/null differ diff --git a/Scripts/tgunship.bos b/Scripts/tgunship.bos deleted file mode 100644 index 038350ced..000000000 --- a/Scripts/tgunship.bos +++ /dev/null @@ -1,117 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2; - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -Create() - { - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/tgunship.cob b/Scripts/tgunship.cob deleted file mode 100644 index 4e70e0e02..000000000 Binary files a/Scripts/tgunship.cob and /dev/null differ diff --git a/Scripts/theavylaserplatform.cob b/Scripts/theavylaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/theavylaserplatform.cob and /dev/null differ diff --git a/Scripts/theavylaserplatform2.cob b/Scripts/theavylaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/theavylaserplatform2.cob and /dev/null differ diff --git a/Scripts/theavyraidtank.bos b/Scripts/theavyraidtank.bos deleted file mode 100644 index 4ba0121e8..000000000 --- a/Scripts/theavyraidtank.bos +++ /dev/null @@ -1,133 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define ELECTRICITY 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx ELECTRICITY from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = firepoint1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/theavyraidtank.cob b/Scripts/theavyraidtank.cob deleted file mode 100644 index fdc33b6ac..000000000 Binary files a/Scripts/theavyraidtank.cob and /dev/null differ diff --git a/Scripts/theavytank.bos b/Scripts/theavytank.bos deleted file mode 100644 index 7b6c6adfd..000000000 --- a/Scripts/theavytank.bos +++ /dev/null @@ -1,201 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, barrel1, firepoint1, firepoint2, firepoint3; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging -#define f3 1024+1 - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn barrel1 to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn barrel1 to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn barrel1 around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() -{ - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint3; -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel1 type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/theavytank.cob b/Scripts/theavytank.cob deleted file mode 100644 index 1508840e1..000000000 Binary files a/Scripts/theavytank.cob and /dev/null differ diff --git a/Scripts/theavytank2.cob b/Scripts/theavytank2.cob deleted file mode 100644 index e0f2c5bd3..000000000 Binary files a/Scripts/theavytank2.cob and /dev/null differ diff --git a/Scripts/thellfire-backup.bos b/Scripts/thellfire-backup.bos deleted file mode 100644 index 0af7c8bf7..000000000 --- a/Scripts/thellfire-backup.bos +++ /dev/null @@ -1,213 +0,0 @@ -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, firepoint2, firepoint3, firepoint4, firepoint5, firepoint6, firepoint7, firepoint8, firepoint9; // these are the pieces of the model - -static-var terraintype, bmoving, firing; // these are the variables - -// #define hellfirelaser 2048+0 - -// Signal definitions -#define SIG_AIM 2 -#define SIG_FIRE 4 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -FireScriptThing() -{ -while(1){ - if (firing == 1){ - emit-sfx 2048 from firepoint2; - emit-sfx 2049 from firepoint9; - emit-sfx 2050 from firepoint8; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint3; - emit-sfx 2049 from firepoint2; - emit-sfx 2050 from firepoint9; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint4; - emit-sfx 2049 from firepoint3; - emit-sfx 2050 from firepoint2; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint5; - emit-sfx 2049 from firepoint4; - emit-sfx 2050 from firepoint3; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint6; - emit-sfx 2049 from firepoint5; - emit-sfx 2050 from firepoint4; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint7; - emit-sfx 2049 from firepoint6; - emit-sfx 2050 from firepoint5; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint8; - emit-sfx 2049 from firepoint7; - emit-sfx 2050 from firepoint6; - } - sleep 30; - if (firing == 1){ - emit-sfx 2048 from firepoint9; - emit-sfx 2049 from firepoint8; - emit-sfx 2050 from firepoint7; - } - sleep 30; -} -} - -Create() // tells it what to do on creation -{ -start-script setSFXoccupy(); -start-script EmitWakes(); -start-script SmokeUnit(); -start-script FireScriptThing(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -stop-spin barrel1 around z-axis decelerate <5.000000>; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <100>; -turn turret to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -spin barrel1 around z-axis speed <100.005495>; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -signal SIG_FIRE; -set-signal-mask SIG_FIRE; -firing = 1; -sleep 1000; -firing = 0; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} \ No newline at end of file diff --git a/Scripts/thellfire.bos b/Scripts/thellfire.bos deleted file mode 100644 index b7600f0fe..000000000 --- a/Scripts/thellfire.bos +++ /dev/null @@ -1,213 +0,0 @@ -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, firepoint2, firepoint3, firepoint4, firepoint5, firepoint6, firepoint7, firepoint8, firepoint9; // these are the pieces of the model - -static-var terraintype, bmoving, firing; // these are the variables - -// #define hellfirelaser 2048+0 - -// Signal definitions -#define SIG_AIM 2 -#define SIG_FIRE 4 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -FireScriptThing() -{ -while(1){ - if (firing == 1){ - emit-sfx 2049 from firepoint2; - emit-sfx 2049 from firepoint9; - emit-sfx 2049 from firepoint8; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint3; - emit-sfx 2049 from firepoint2; - emit-sfx 2049 from firepoint9; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint4; - emit-sfx 2049 from firepoint3; - emit-sfx 2049 from firepoint2; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint5; - emit-sfx 2049 from firepoint4; - emit-sfx 2049 from firepoint3; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint6; - emit-sfx 2049 from firepoint5; - emit-sfx 2049 from firepoint4; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint7; - emit-sfx 2049 from firepoint6; - emit-sfx 2049 from firepoint5; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint8; - emit-sfx 2049 from firepoint7; - emit-sfx 2049 from firepoint6; - } - sleep 150; - if (firing == 1){ - emit-sfx 2049 from firepoint9; - emit-sfx 2049 from firepoint8; - emit-sfx 2049 from firepoint7; - } - sleep 150; -} -} - -Create() // tells it what to do on creation -{ -start-script setSFXoccupy(); -start-script EmitWakes(); -start-script SmokeUnit(); -start-script FireScriptThing(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -stop-spin barrel1 around z-axis decelerate <5.000000>; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <30>; -turn turret to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn turret around x-axis; -spin barrel1 around z-axis speed <-100.005495>; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -signal SIG_FIRE; -set-signal-mask SIG_FIRE; -firing = 1; -sleep 1000; -firing = 0; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} \ No newline at end of file diff --git a/Scripts/thellfire.cob b/Scripts/thellfire.cob deleted file mode 100644 index 1598134d6..000000000 Binary files a/Scripts/thellfire.cob and /dev/null differ diff --git a/Scripts/tinfantryelectric.bos b/Scripts/tinfantryelectric.bos deleted file mode 100644 index 743241475..000000000 --- a/Scripts/tinfantryelectric.bos +++ /dev/null @@ -1,215 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - - -static-var moving, walking, aiming; -piece torso, leftgun, firepointleft, rightgun, firepointright, leftlegtop, leftlegbottom, rightlegtop, rightlegbottom; - -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 -#define THIGH_F <-15> -#define THIGH_B <10> -#define THIGHSPEED_F <50> -#define THIGHSPEED_B <50> -#define SHIN_F <0> -#define SHIN_B <20> -#define SHINSPEED_F <80> -#define SHINSPEED_B <80> -#define TORSO <15> -#define torsoSPEED <50> -#define WALKBOB [1] -#define BOBSPEED [4] -#define ELECTRICITY 1024+0 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from torso; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Walk() { - if(walking) return 0; //semaphore - walking=1; - - turn leftlegtop to x-axis 0 now; - turn leftlegbottom to x-axis 0 now; - turn rightlegtop to x-axis <0> now; - turn rightlegbottom to x-axis <0> now; - turn torso to z-axis TORSO now; - while(moving) { - if (moving) { - turn rightlegtop to x-axis THIGH_F speed THIGHSPEED_F; - turn rightlegbottom to x-axis SHIN_B speed SHINSPEED_B; - wait-for-turn leftlegtop around x-axis; - } - if (moving) { - turn leftlegtop to x-axis THIGH_B speed THIGHSPEED_B; - turn torso to z-axis 0 - torso speed torsoSPEED; - wait-for-turn rightlegbottom around x-axis; - } - if (moving) { - turn rightlegbottom to x-axis SHIN_F speed SHINSPEED_F; - wait-for-turn rightlegtop around x-axis; - } - if (moving) { - turn rightlegtop to x-axis THIGH_B speed THIGHSPEED_B; - turn torso to z-axis torso speed torsoSPEED; - wait-for-turn leftlegtop around x-axis; - } - if (moving) { - turn leftlegtop to x-axis THIGH_F speed THIGHSPEED_F; - turn leftlegbottom to x-axis SHIN_B speed SHINSPEED_B; - wait-for-turn leftlegbottom around x-axis; - } - if (moving) { - turn leftlegbottom to x-axis SHIN_F speed SHINSPEED_F; - wait-for-turn rightlegtop around x-axis; - } - } - walking=0; - turn rightlegtop to x-axis 0 speed THIGHSPEED_F; - turn leftlegtop to x-axis 0 speed THIGHSPEED_F; - turn rightlegbottom to x-axis 0 speed SHINSPEED_F; - turn leftlegbottom to x-axis 0 speed SHINSPEED_F; - turn torso to z-axis 0 speed torsoSPEED; -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from firepointleft; - emit-sfx 1024 from firepointright; - sleep 150; - } -} - -Create() -{ -moving = 0; -start-script Walk(); -start-script SmokeUnit(); -start-script fx(); -} - -StartMoving() { moving=1; - start-script Walk(); } -StopMoving() { moving=0; } - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn torso to y-axis <0> speed <30>; -turn leftgun to x-axis <0> speed <10>; -turn rightgun to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn torso to y-axis heading speed <30>; -turn leftgun to x-axis <0> - pitch speed <10>; -wait-for-turn torso around y-axis; -wait-for-turn leftgun around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = torso; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepointleft; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn torso to y-axis heading speed <30>; -turn rightgun to x-axis <0> - pitch speed <10>; -wait-for-turn torso around y-axis; -wait-for-turn rightgun around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = torso; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepointright; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode leftgun type BITMAPONLY | BITMAP1; -explode rightgun type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode leftgun type BITMAPONLY | BITMAP4; -explode rightgun type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode leftgun type BITMAPONLY | BITMAP1; -explode rightgun type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode torso type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tinfantryelectric.cob b/Scripts/tinfantryelectric.cob deleted file mode 100644 index dd44c23d5..000000000 Binary files a/Scripts/tinfantryelectric.cob and /dev/null differ diff --git a/Scripts/tinfantrylaser.bos b/Scripts/tinfantrylaser.bos deleted file mode 100644 index 743241475..000000000 --- a/Scripts/tinfantrylaser.bos +++ /dev/null @@ -1,215 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - - -static-var moving, walking, aiming; -piece torso, leftgun, firepointleft, rightgun, firepointright, leftlegtop, leftlegbottom, rightlegtop, rightlegbottom; - -#define SIG_AIM 2 // this is a aim define -#define SIG_AIM_2 4 -#define THIGH_F <-15> -#define THIGH_B <10> -#define THIGHSPEED_F <50> -#define THIGHSPEED_B <50> -#define SHIN_F <0> -#define SHIN_B <20> -#define SHINSPEED_F <80> -#define SHINSPEED_B <80> -#define TORSO <15> -#define torsoSPEED <50> -#define WALKBOB [1] -#define BOBSPEED [4] -#define ELECTRICITY 1024+0 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from torso; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Walk() { - if(walking) return 0; //semaphore - walking=1; - - turn leftlegtop to x-axis 0 now; - turn leftlegbottom to x-axis 0 now; - turn rightlegtop to x-axis <0> now; - turn rightlegbottom to x-axis <0> now; - turn torso to z-axis TORSO now; - while(moving) { - if (moving) { - turn rightlegtop to x-axis THIGH_F speed THIGHSPEED_F; - turn rightlegbottom to x-axis SHIN_B speed SHINSPEED_B; - wait-for-turn leftlegtop around x-axis; - } - if (moving) { - turn leftlegtop to x-axis THIGH_B speed THIGHSPEED_B; - turn torso to z-axis 0 - torso speed torsoSPEED; - wait-for-turn rightlegbottom around x-axis; - } - if (moving) { - turn rightlegbottom to x-axis SHIN_F speed SHINSPEED_F; - wait-for-turn rightlegtop around x-axis; - } - if (moving) { - turn rightlegtop to x-axis THIGH_B speed THIGHSPEED_B; - turn torso to z-axis torso speed torsoSPEED; - wait-for-turn leftlegtop around x-axis; - } - if (moving) { - turn leftlegtop to x-axis THIGH_F speed THIGHSPEED_F; - turn leftlegbottom to x-axis SHIN_B speed SHINSPEED_B; - wait-for-turn leftlegbottom around x-axis; - } - if (moving) { - turn leftlegbottom to x-axis SHIN_F speed SHINSPEED_F; - wait-for-turn rightlegtop around x-axis; - } - } - walking=0; - turn rightlegtop to x-axis 0 speed THIGHSPEED_F; - turn leftlegtop to x-axis 0 speed THIGHSPEED_F; - turn rightlegbottom to x-axis 0 speed SHINSPEED_F; - turn leftlegbottom to x-axis 0 speed SHINSPEED_F; - turn torso to z-axis 0 speed torsoSPEED; -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 1024 from firepointleft; - emit-sfx 1024 from firepointright; - sleep 150; - } -} - -Create() -{ -moving = 0; -start-script Walk(); -start-script SmokeUnit(); -start-script fx(); -} - -StartMoving() { moving=1; - start-script Walk(); } -StopMoving() { moving=0; } - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 10000; -turn torso to y-axis <0> speed <30>; -turn leftgun to x-axis <0> speed <10>; -turn rightgun to x-axis <0> speed <10>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn torso to y-axis heading speed <30>; -turn leftgun to x-axis <0> - pitch speed <10>; -wait-for-turn torso around y-axis; -wait-for-turn leftgun around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = torso; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepointleft; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn torso to y-axis heading speed <30>; -turn rightgun to x-axis <0> - pitch speed <10>; -wait-for-turn torso around y-axis; -wait-for-turn rightgun around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = torso; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepointright; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode leftgun type BITMAPONLY | BITMAP1; -explode rightgun type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode leftgun type BITMAPONLY | BITMAP4; -explode rightgun type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode leftgun type BITMAPONLY | BITMAP1; -explode rightgun type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode torso type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tinfantrylaser.cob b/Scripts/tinfantrylaser.cob deleted file mode 100644 index dd44c23d5..000000000 Binary files a/Scripts/tinfantrylaser.cob and /dev/null differ diff --git a/Scripts/tinterceptor.bos b/Scripts/tinterceptor.bos deleted file mode 100644 index 47d419c97..000000000 --- a/Scripts/tinterceptor.bos +++ /dev/null @@ -1,92 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -// Signal definitions -#define SIG_AIM 2 - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from base; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = base; -} - -Create() - { - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/tinterceptor.cob b/Scripts/tinterceptor.cob deleted file mode 100644 index 356f56868..000000000 Binary files a/Scripts/tinterceptor.cob and /dev/null differ diff --git a/Scripts/tinterceptor2.bos b/Scripts/tinterceptor2.bos deleted file mode 100644 index 94f179ce3..000000000 --- a/Scripts/tinterceptor2.bos +++ /dev/null @@ -1,211 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, firepoint3, firepoint4, exhaust; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 - -#define flash 1024+0 -#define flame 1024+1 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from exhaust; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint3; -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - -AimWeapon4(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon4() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx flash from firepoint4; -} - -AimFromWeapon4(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon4(piecenum) // where the shot is called from -{ -piecenum = firepoint4; -} - - -AimWeapon5(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon5() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon5(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon5(piecenum) // where the shot is called from -{ -piecenum = base; -} - - - -Create() - { - turn exhaust to y-axis <180> now; - start-script Thrust(); - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/tinterceptor2.cob b/Scripts/tinterceptor2.cob deleted file mode 100644 index 658172458..000000000 Binary files a/Scripts/tinterceptor2.cob and /dev/null differ diff --git a/Scripts/tlasermech.bos b/Scripts/tlasermech.bos deleted file mode 100644 index 31574f67e..000000000 --- a/Scripts/tlasermech.bos +++ /dev/null @@ -1,392 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece torso, upleg1, lowleg1, foot1, upleg2, lowleg2, foot2, firepoint1, firepoint2, arm1, arm2; - -static-var moving; - -#define f3 1024+0 - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 -#define SIG_AIM_8 16 - -Walkscript() -{ - while(1) - { - if (moving) - // Step 1 - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 2 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 3 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 4 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 5 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 6 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - //Step 7 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 8 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - } -} - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from torso; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -Create() -{ - turn upleg1 to x-axis <-35.0> speed <500.000000>; - turn lowleg1 to x-axis <10.0> speed <500.000000>; - turn foot1 to x-axis <25.0> speed <500.000000>; - turn upleg2 to x-axis <-35.0> speed <500.000000>; - turn lowleg2 to x-axis <10.0> speed <500.000000>; - turn foot2 to x-axis <25.0> speed <500.000000>; - moving = FALSE; - start-script Walkscript(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn torso to y-axis <0.0> speed <70.0>; - turn arm1 to x-axis <0.0> speed <50.0>; - turn arm2 to x-axis <0.0> speed <50.0>; -} - -AimWeapon1(heading, pitch) -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - turn torso to y-axis heading speed <150.0>; - turn arm1 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm1 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() -{ - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; - sleep 1; - emit-sfx f3 from firepoint1; -} - -AimFromWeapon1(piecenum) -{ - piecenum = torso; -} - -QueryWeapon1(piecenum) -{ - piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) -{ - signal SIG_AIM_2; - set-signal-mask SIG_AIM_2; - turn torso to y-axis heading speed <150.0>; - turn arm2 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm2 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon2() -{ - sleep 1; - emit-sfx f3 from firepoint2; - sleep 1; - emit-sfx f3 from firepoint2; - sleep 1; - emit-sfx f3 from firepoint2; - sleep 1; - emit-sfx f3 from firepoint2; -} - -AimFromWeapon2(piecenum) -{ - piecenum = torso; -} - -QueryWeapon2(piecenum) -{ - piecenum = firepoint2; -} - - -StartMoving() -{ - moving = TRUE; -} - -StopMoving() -{ - moving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode torso type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode torso type FALL | BITMAP3; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode torso type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; - return (0); - } - corpsetype = 3; - explode torso type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; -} diff --git a/Scripts/tlasermech.cob b/Scripts/tlasermech.cob deleted file mode 100644 index 70bbeacd1..000000000 Binary files a/Scripts/tlasermech.cob and /dev/null differ diff --git a/Scripts/tlightlaserplatform.cob b/Scripts/tlightlaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/tlightlaserplatform.cob and /dev/null differ diff --git a/Scripts/tlightlaserplatform2.bos b/Scripts/tlightlaserplatform2.bos deleted file mode 100644 index 8ca828f14..000000000 --- a/Scripts/tlightlaserplatform2.bos +++ /dev/null @@ -1,108 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; // these are the pieces of the model - -static-var gun_1; // these are the variables - -#define BLUE_EXPLOSION_SMALL 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -Create() // tells it what to do on creation -{ -start-script SmokeUnit(); -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -while( gun_1 >= 1) -{ -sleep 100; -} -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -if( gun_1 == 0 ) -{ -emit-sfx BLUE_EXPLOSION_SMALL from firepoint1; -} -gun_1 = gun_1 + 1; -if( gun_1 >= 1 ) -{ -gun_1=0; -} -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -if( gun_1 == 0 ) -{ -piecenum = firepoint1; -} -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tlightlaserplatform2.cob b/Scripts/tlightlaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/tlightlaserplatform2.cob and /dev/null differ diff --git a/Scripts/tlightmech.bos b/Scripts/tlightmech.bos deleted file mode 100644 index 64bd1b315..000000000 --- a/Scripts/tlightmech.bos +++ /dev/null @@ -1,425 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece torso, upleg1, lowleg1, foot1, upleg2, lowleg2, foot2, firepoint1, firepoint2, firepoint3, firepoint4, arm1, arm2; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_4 8 -#define SIG_AIM_8 16 - -Walkscript() -{ - while(1) - { - if (moving) - // Step 1 - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 2 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 3 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 4 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 5 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 6 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - //Step 7 - if (moving) - { - - turn upleg1 to x-axis <-35> speed <300.000000>; - turn lowleg1 to x-axis <10> speed <300.000000>; - turn foot1 to x-axis <25> speed <300.000000>; - - - turn upleg2 to x-axis <5> speed <200.000000>; - turn lowleg2 to x-axis <-45> speed <200.000000>; - turn foot2 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - // Step 8 - if (moving) - { - - turn upleg2 to x-axis <-35> speed <300.000000>; - turn lowleg2 to x-axis <10> speed <300.000000>; - turn foot2 to x-axis <25> speed <300.000000>; - - - turn upleg1 to x-axis <5> speed <200.000000>; - turn lowleg1 to x-axis <-45> speed <200.000000>; - turn foot1 to x-axis <30> speed <100.000000>; - - - sleep 400; - } - while(!moving) - { - sleep 50; - turn upleg1 to x-axis <-35.0> speed <300.000000>; - turn lowleg1 to x-axis <10.0> speed <300.000000>; - turn foot1 to x-axis <25.0> speed <300.000000>; - turn upleg2 to x-axis <-35.0> speed <300.000000>; - turn lowleg2 to x-axis <10.0> speed <300.000000>; - turn foot2 to x-axis <25.0> speed <300.000000>; - sleep 50; - } - } -} - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from torso; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -Create() -{ - turn upleg1 to x-axis <-35.0> speed <500.000000>; - turn lowleg1 to x-axis <10.0> speed <500.000000>; - turn foot1 to x-axis <25.0> speed <500.000000>; - turn upleg2 to x-axis <-35.0> speed <500.000000>; - turn lowleg2 to x-axis <10.0> speed <500.000000>; - turn foot2 to x-axis <25.0> speed <500.000000>; - moving = FALSE; - start-script Walkscript(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() -{ - sleep 3000; - turn torso to y-axis <0.0> speed <70.0>; - turn arm1 to x-axis <0.0> speed <50.0>; - turn arm2 to x-axis <0.0> speed <50.0>; -} - -AimWeapon1(heading, pitch) -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - turn torso to y-axis heading speed <150.0>; - turn arm1 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm1 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() -{ -} - -AimFromWeapon1(piecenum) -{ - piecenum = torso; -} - -QueryWeapon1(piecenum) -{ - piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) -{ - signal SIG_AIM_2; - set-signal-mask SIG_AIM_2; - turn torso to y-axis heading speed <150.0>; - turn arm1 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm1 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon2() -{ -} - -AimFromWeapon2(piecenum) -{ - piecenum = torso; -} - -QueryWeapon2(piecenum) -{ - piecenum = firepoint2; -} - -AimWeapon3(heading, pitch) -{ - signal SIG_AIM_4; - set-signal-mask SIG_AIM_4; - turn torso to y-axis heading speed <150.0>; - turn arm2 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm2 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon3() -{ -} - -AimFromWeapon3(piecenum) -{ - piecenum = torso; -} - -QueryWeapon3(piecenum) -{ - piecenum = firepoint3; -} - -AimWeapon4(heading, pitch) -{ - signal SIG_AIM_8; - set-signal-mask SIG_AIM_8; - turn torso to y-axis heading speed <150.0>; - turn arm2 to x-axis <0.0> - pitch speed <100.0>; - wait-for-turn torso around y-axis; - wait-for-turn arm2 around x-axis; - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon4() -{ -} - -AimFromWeapon4(piecenum) -{ - piecenum = torso; -} - -QueryWeapon4(piecenum) -{ - piecenum = firepoint4; -} - -StartMoving() -{ - moving = TRUE; -} - -StopMoving() -{ - moving = FALSE; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode torso type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode torso type FALL | BITMAP3; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode torso type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; - return (0); - } - corpsetype = 3; - explode torso type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; -} diff --git a/Scripts/tlightmech.cob b/Scripts/tlightmech.cob deleted file mode 100644 index 7746c7fe6..000000000 Binary files a/Scripts/tlightmech.cob and /dev/null differ diff --git a/Scripts/tlighttank-nemo.bos b/Scripts/tlighttank-nemo.bos deleted file mode 100644 index 80a8bf70a..000000000 --- a/Scripts/tlighttank-nemo.bos +++ /dev/null @@ -1,166 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var terraintype, bMoving, bAiming; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging -#define beam 2048+1 -// Signal definitions -#define SIG_AIM 2 // this is an aim define -#define SIG_AIM2 4 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -BeamControl() -{ - while (1) - { - while (bAiming==1) - { - emit-sfx beam from firepoint1; - sleep 20; - } - sleep 1000; - } -} - - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); - start-script BeamControl(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -bAiming=0; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -bAiming=1; -turn turret to y-axis heading speed <600>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (0); -} - -FireWeapon1(heading) -{ - return (0); -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tlighttank-nemo.cob b/Scripts/tlighttank-nemo.cob deleted file mode 100644 index 32faf5846..000000000 Binary files a/Scripts/tlighttank-nemo.cob and /dev/null differ diff --git a/Scripts/tlighttank.bos b/Scripts/tlighttank.bos deleted file mode 100644 index 264eea3eb..000000000 --- a/Scripts/tlighttank.bos +++ /dev/null @@ -1,150 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <600>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tlighttank.cob b/Scripts/tlighttank.cob deleted file mode 100644 index 01199dcec..000000000 Binary files a/Scripts/tlighttank.cob and /dev/null differ diff --git a/Scripts/tlighttank2.bos b/Scripts/tlighttank2.bos deleted file mode 100644 index de773f41c..000000000 --- a/Scripts/tlighttank2.bos +++ /dev/null @@ -1,179 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, turret, barrel1, firepoint1, barrel2, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move hull to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move hull to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = barrel2; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode hull type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tlighttank2.cob b/Scripts/tlighttank2.cob deleted file mode 100644 index 9e2615069..000000000 Binary files a/Scripts/tlighttank2.cob and /dev/null differ diff --git a/Scripts/tlighttank3.bos b/Scripts/tlighttank3.bos deleted file mode 100644 index bf1cc8078..000000000 --- a/Scripts/tlighttank3.bos +++ /dev/null @@ -1,177 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, sfxpoint1; // these are the pieces of the model - -static-var terraintype, bmoving, moving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx 1025 + 0 from sfxpoint1; - } - sleep 400; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -Create() // tells it what to do on creation -{ - start-script Thrust(); - start-script setSFXoccupy(); - start-script EmitWakes(); - start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = barrel1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tlighttank3.cob b/Scripts/tlighttank3.cob deleted file mode 100644 index d50f9b761..000000000 Binary files a/Scripts/tlighttank3.cob and /dev/null differ diff --git a/Scripts/tlightturret.bos b/Scripts/tlightturret.bos deleted file mode 100644 index 864ede030..000000000 --- a/Scripts/tlightturret.bos +++ /dev/null @@ -1,110 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, stock, barrels, firepoint1; // these are the pieces of the model - - -// Signal definitions -#define SIG_AIM 2 // this is a aim define - -#define gdmarty 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - - -Create() // tells it what to do on creation -{ - -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn stock to x-axis <0.000000> speed <30.000000>; -stop-spin barrels around z-axis decelerate <30.000000>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn stock to x-axis <0.000000> - pitch speed <150.000000>; -wait-for-turn turret around y-axis; -wait-for-turn stock around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -spin barrels around z-axis speed <500.005495>; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = stock; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode turret type BITMAPONLY | BITMAP1; -explode barrels type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode turret type BITMAPONLY | BITMAP4; -explode barrels type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode turret type BITMAPONLY | BITMAP1; -explode barrels type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrels type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tlightturret.cob b/Scripts/tlightturret.cob deleted file mode 100644 index 95406d0ae..000000000 Binary files a/Scripts/tlightturret.cob and /dev/null differ diff --git a/Scripts/tmediumlaserplatform.cob b/Scripts/tmediumlaserplatform.cob deleted file mode 100644 index 3cef92462..000000000 Binary files a/Scripts/tmediumlaserplatform.cob and /dev/null differ diff --git a/Scripts/tmediumlaserplatform2.cob b/Scripts/tmediumlaserplatform2.cob deleted file mode 100644 index 09066877b..000000000 Binary files a/Scripts/tmediumlaserplatform2.cob and /dev/null differ diff --git a/Scripts/tmediumtank.bos b/Scripts/tmediumtank.bos deleted file mode 100644 index 22210a8ec..000000000 --- a/Scripts/tmediumtank.bos +++ /dev/null @@ -1,178 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, barrel2, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -turn barrel2 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <500>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <225>; -turn barrel2 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel2 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx gdmarty from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tmediumtank.cob b/Scripts/tmediumtank.cob deleted file mode 100644 index 2ef91a3b5..000000000 Binary files a/Scripts/tmediumtank.cob and /dev/null differ diff --git a/Scripts/tmediumtank2.cob b/Scripts/tmediumtank2.cob deleted file mode 100644 index e0f2c5bd3..000000000 Binary files a/Scripts/tmediumtank2.cob and /dev/null differ diff --git a/Scripts/tmetalextractor.bos b/Scripts/tmetalextractor.bos deleted file mode 100644 index 0b569850c..000000000 --- a/Scripts/tmetalextractor.bos +++ /dev/null @@ -1,197 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1, firepoint2, ball1, ball2, ball3, ball4, bottom, middle, top, fireball1, fireball2, fireball3, fireball4; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging, ball1state, ball2state, ball3state, ball4state, ballstate; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; - ballstate = 1; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; - ballstate = 0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -mexanimation() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx 1024 from firepoint2; -sleep 400; -} -} -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from fireball1; - emit-sfx 2048 from fireball2; - emit-sfx 2048 from fireball3; - emit-sfx 2048 from fireball4; - - - sleep 5; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - - emit-sfx 2049 from fireball1; - emit-sfx 2049 from fireball2; - emit-sfx 2049 from fireball3; - emit-sfx 2049 from fireball4; - sleep 400; - } -} - - -Create() -{ - start-script mexanimation(); - start-script fx(); - start-script fx2(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - turn firepoint1 to x-axis <-90> now; - turn fireball1 to x-axis <-90> now; - turn fireball2 to x-axis <-90> now; - turn fireball3 to x-axis <-90> now; - turn fireball4 to x-axis <-90> now; - spin bottom around y-axis speed <-10.000000>; - spin middle around y-axis speed <-20.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/tmetalextractor.cob b/Scripts/tmetalextractor.cob deleted file mode 100644 index 9f43e523c..000000000 Binary files a/Scripts/tmetalextractor.cob and /dev/null differ diff --git a/Scripts/tmex.cob b/Scripts/tmex.cob deleted file mode 100644 index 01ae649c1..000000000 Binary files a/Scripts/tmex.cob and /dev/null differ diff --git a/Scripts/tmex2.bos b/Scripts/tmex2.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/tmex2.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/tmex2.cob b/Scripts/tmex2.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/tmex2.cob and /dev/null differ diff --git a/Scripts/tmex2up1.bos b/Scripts/tmex2up1.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/tmex2up1.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/tmex2up1.cob b/Scripts/tmex2up1.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/tmex2up1.cob and /dev/null differ diff --git a/Scripts/tmex2up2.bos b/Scripts/tmex2up2.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/tmex2up2.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/tmex2up2.cob b/Scripts/tmex2up2.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/tmex2up2.cob and /dev/null differ diff --git a/Scripts/tmex2up3.bos b/Scripts/tmex2up3.bos deleted file mode 100644 index 8a5743891..000000000 --- a/Scripts/tmex2up3.bos +++ /dev/null @@ -1,171 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top, firepoint1, firepoint2; - -static-var Static_Var_1, Static_Var_2, Static_Var_3, statechg_DesiredState, statechg_StateChanging; - -#define topsfx 1024+0 // this is a custom explosion generator thinging -#define basesfx 1025+0 // this is a custom explosion generator thinging - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Go() -{ - spin top around y-axis speed Static_Var_1 accelerate Static_Var_2; -} - -Stop() -{ - stop-spin top around y-axis decelerate Static_Var_3; - wait-for-turn top around y-axis; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script Go(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script Stop(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - - -TopEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx topsfx from firepoint1; -sleep 500; -} -} -} - -BaseEffect() -{ -while (1) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { -emit-sfx basesfx from firepoint2; -sleep 500; -} -} -} - - -Create() -{ - start-script TopEffect(); - start-script BaseEffect(); - Static_Var_1 = 0; - Static_Var_2 = 25; - Static_Var_3 = 50; - spin base around y-axis speed <-10.000000>; - call-script InitState(); - start-script SmokeUnit(); -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - - -SetSpeed(Func_Var_1) -{ - Static_Var_1 = Func_Var_1 * 5; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode top type BITMAPONLY | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode top type SHATTER | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode top type SHATTER | EXPLODE_ON_HIT | BITMAP1; - explode base type BITMAPONLY | BITMAP2; - return (0); - } - corpsetype = 3; - explode top type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP2; -} diff --git a/Scripts/tmex2up3.cob b/Scripts/tmex2up3.cob deleted file mode 100644 index e21862f99..000000000 Binary files a/Scripts/tmex2up3.cob and /dev/null differ diff --git a/Scripts/tmexmoho.cob b/Scripts/tmexmoho.cob deleted file mode 100644 index 01ae649c1..000000000 Binary files a/Scripts/tmexmoho.cob and /dev/null differ diff --git a/Scripts/tmine.bos b/Scripts/tmine.bos deleted file mode 100644 index dce627e99..000000000 --- a/Scripts/tmine.bos +++ /dev/null @@ -1,33 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull; - -Create() -{ -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode hull type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode hull type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode hull type BITMAPONLY | BITMAP1; -} diff --git a/Scripts/tmine.cob b/Scripts/tmine.cob deleted file mode 100644 index fa0da8a05..000000000 Binary files a/Scripts/tmine.cob and /dev/null differ diff --git a/Scripts/tmissilearty.bos b/Scripts/tmissilearty.bos deleted file mode 100644 index 3a992963e..000000000 --- a/Scripts/tmissilearty.bos +++ /dev/null @@ -1,534 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, barrels, firepoint1, firepoint2, firepoint3, firepoint4, firepoint5, firepoint6, firepoint7, firepoint8, firepoint9, firepoint10, firepoint11, firepoint12, firepoint13, firepoint14, firepoint15, firepoint16, firepoint17, firepoint18, firepoint19, firepoint20, firepoint21, firepoint22, firepoint23, firepoint24, firepoint25, firepoint26, firepoint27, firepoint28, firepoint29, firepoint30, firepoint31, firepoint32, exhaustpoint1, exhaustpoint2, exhaustpoint3, exhaustpoint4, exhaustpoint5, exhaustpoint6, exhaustpoint7, exhaustpoint8, exhaustpoint9, exhaustpoint10, exhaustpoint11, exhaustpoint12, exhaustpoint13, exhaustpoint14, exhaustpoint15, exhaustpoint16, exhaustpoint17, exhaustpoint18, exhaustpoint19, exhaustpoint20, exhaustpoint21, exhaustpoint22, exhaustpoint23, exhaustpoint24, exhaustpoint25, exhaustpoint26, exhaustpoint27, exhaustpoint28, exhaustpoint29, exhaustpoint30, exhaustpoint31, exhaustpoint32; - -static-var moving, gun_1, missilefire, missile, bmoving, terraintype; - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 -#define SIG_AIM_3 8 - -#define rocketlaunchback 1024+0 - -#define SFACTOR -2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - - gun_1 = 0; - missile = 0; - moving = FALSE; - start-script SmokeUnit(); -} - -SlowReload() -{ - if( missilefire > 0 AND missilefire < 32 ) - { - while( missilefire > 0 AND missile == 0 ) - { - --missilefire; - sleep 666; - } - } -} - -Reload() -{ - sleep 18000; - gun_1 = 0; -} - -RestoreAfterDelay() -{ - sleep 3000; - turn barrels to y-axis <0> speed <60>; - turn barrels to x-axis <0> speed <30>; - if( gun_1 == 0 ) - { - start-script SlowReload(); - } - missile = 0; -} - -//Weapon1 - -AimWeapon1(heading, pitch) -{ - signal SIG_AIM; - set-signal-mask SIG_AIM; - turn barrels to y-axis heading speed <225>; - turn barrels to x-axis <0> - pitch speed <150>; - wait-for-turn barrels around y-axis; - wait-for-turn barrels around x-axis; - missile = 1; - while( gun_1 == 1 ) - { - sleep 100; - } - while( moving ) - { - sleep 100; - } - start-script RestoreAfterDelay(); - return (1); -} - -FireWeapon1() -{ - if( missilefire >= 0 AND missilefire < 32 ) - { - if( missilefire == 0 ) - { - - emit-sfx rocketlaunchback from exhaustpoint1; - sleep 100; - } - if( missilefire == 1 ) - { - - emit-sfx rocketlaunchback from exhaustpoint2; - sleep 100; - - } - if( missilefire == 2 ) - { - - emit-sfx rocketlaunchback from exhaustpoint3; - sleep 100; - } - if( missilefire == 3 ) - { - - emit-sfx rocketlaunchback from exhaustpoint4; - sleep 100; - } - if( missilefire == 4 ) - { - - emit-sfx rocketlaunchback from exhaustpoint5; - sleep 100; - } - if( missilefire == 5 ) - { - - emit-sfx rocketlaunchback from exhaustpoint6; - sleep 100; - } - if( missilefire == 6 ) - { - - emit-sfx rocketlaunchback from exhaustpoint7; - sleep 100; - } - if( missilefire == 7 ) - { - - emit-sfx rocketlaunchback from exhaustpoint8; - sleep 100; - } - if( missilefire == 8 ) - { - - emit-sfx rocketlaunchback from exhaustpoint9; - sleep 100; - } - if( missilefire == 9 ) - { - - emit-sfx rocketlaunchback from exhaustpoint10; - sleep 100; - } - if( missilefire == 10 ) - { - - emit-sfx rocketlaunchback from exhaustpoint11; - sleep 100; - } - if( missilefire == 11 ) - { - - emit-sfx rocketlaunchback from exhaustpoint12; - sleep 100; - } - if( missilefire == 12 ) - { - - emit-sfx rocketlaunchback from exhaustpoint13; - sleep 100; - } - if( missilefire == 13 ) - { - - emit-sfx rocketlaunchback from exhaustpoint14; - sleep 100; - } - if( missilefire == 14 ) - { - - emit-sfx rocketlaunchback from exhaustpoint15; - sleep 100; - } - if( missilefire == 15 ) - { - - emit-sfx rocketlaunchback from exhaustpoint16; - sleep 100; - } - if( missilefire == 16 ) - { - - emit-sfx rocketlaunchback from exhaustpoint17; - sleep 100; - } - if( missilefire == 17 ) - { - - emit-sfx rocketlaunchback from exhaustpoint18; - sleep 100; - } - if( missilefire == 18 ) - { - - emit-sfx rocketlaunchback from exhaustpoint19; - sleep 100; - } - if( missilefire == 19 ) - { - - emit-sfx rocketlaunchback from exhaustpoint20; - sleep 100; - } - if( missilefire == 20 ) - { - - emit-sfx rocketlaunchback from exhaustpoint21; - sleep 100; - } - if( missilefire == 21 ) - { - - emit-sfx rocketlaunchback from exhaustpoint22; - sleep 100; - } - if( missilefire == 22 ) - { - - emit-sfx rocketlaunchback from exhaustpoint23; - sleep 100; - } - if( missilefire == 23 ) - { - - emit-sfx rocketlaunchback from exhaustpoint24; - sleep 100; - } - if( missilefire == 24 ) - { - - emit-sfx rocketlaunchback from exhaustpoint25; - sleep 100; - } - if( missilefire == 25 ) - { - - emit-sfx rocketlaunchback from exhaustpoint26; - sleep 100; - } - if( missilefire == 26 ) - { - - emit-sfx rocketlaunchback from exhaustpoint27; - sleep 100; - } - if( missilefire == 27 ) - { - - emit-sfx rocketlaunchback from exhaustpoint28; - sleep 100; - } - if( missilefire == 28 ) - { - - emit-sfx rocketlaunchback from exhaustpoint29; - sleep 100; - } - if( missilefire == 29 ) - { - - emit-sfx rocketlaunchback from exhaustpoint30; - sleep 100; - } - if( missilefire == 30 ) - { - - emit-sfx rocketlaunchback from exhaustpoint31; - sleep 100; - } - if( missilefire == 31 ) - { - gun_1 = 1; - start-script Reload(); - emit-sfx rocketlaunchback from exhaustpoint32; - sleep 100; - } - } - ++missilefire; - if( missilefire >= 32 ) - { - missilefire = 0; - } -} - -AimFromWeapon1(piecenum) -{ - piecenum = barrels; -} - - -QueryWeapon1(piecenum) -{ - if( missilefire >= 0 AND missilefire < 32 ) - { - if( missilefire == 0 ) - { - piecenum = firepoint1; - } - if( missilefire == 1 ) - { - piecenum = firepoint2; - } - if( missilefire == 2 ) - { - piecenum = firepoint3; - } - if( missilefire == 3 ) - { - piecenum = firepoint4; - } - if( missilefire == 4 ) - { - piecenum = firepoint5; - } - if( missilefire == 5 ) - { - piecenum = firepoint6; - } - if( missilefire == 6 ) - { - piecenum = firepoint7; - } - if( missilefire == 7 ) - { - piecenum = firepoint8; - } - if( missilefire == 8 ) - { - piecenum = firepoint9; - } - if( missilefire == 9 ) - { - piecenum = firepoint10; - } - if( missilefire == 10 ) - { - piecenum = firepoint11; - } - if( missilefire == 11 ) - { - piecenum = firepoint12; - } - if( missilefire == 12 ) - { - piecenum = firepoint13; - } - if( missilefire == 13 ) - { - piecenum = firepoint14; - } - if( missilefire == 14 ) - { - piecenum = firepoint15; - } - if( missilefire == 15 ) - { - piecenum = firepoint16; - } - if( missilefire == 16 ) - { - piecenum = firepoint17; - } - if( missilefire == 17 ) - { - piecenum = firepoint18; - } - if( missilefire == 18 ) - { - piecenum = firepoint19; - } - if( missilefire == 19 ) - { - piecenum = firepoint20; - } - if( missilefire == 20 ) - { - piecenum = firepoint21; - } - if( missilefire == 21 ) - { - piecenum = firepoint22; - } - if( missilefire == 22 ) - { - piecenum = firepoint23; - } - if( missilefire == 23 ) - { - piecenum = firepoint24; - } - if( missilefire == 24 ) - { - piecenum = firepoint25; - } - if( missilefire == 25 ) - { - piecenum = firepoint26; - } - if( missilefire == 26 ) - { - piecenum = firepoint27; - } - if( missilefire == 27 ) - { - piecenum = firepoint28; - } - if( missilefire == 28 ) - { - piecenum = firepoint29; - } - if( missilefire == 29 ) - { - piecenum = firepoint30; - } - if( missilefire == 30 ) - { - piecenum = firepoint31; - } - if( missilefire == 31 ) - { - piecenum = firepoint32; - } - } -} - -StartMoving() -{ - moving = TRUE; -} - -StopMoving() -{ - moving = FALSE; -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - explode barrels type BITMAPONLY | BITMAP3; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type FALL | BITMAP3; - explode barrels type BITMAPONLY | BITMAP3; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; - explode barrels type BITMAPONLY | BITMAP3; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; - explode barrels type BITMAPONLY | BITMAP3; -} diff --git a/Scripts/tmissilearty.cob b/Scripts/tmissilearty.cob deleted file mode 100644 index 2180ca06a..000000000 Binary files a/Scripts/tmissilearty.cob and /dev/null differ diff --git a/Scripts/tmissilesiloemp.cob b/Scripts/tmissilesiloemp.cob deleted file mode 100644 index 182790095..000000000 Binary files a/Scripts/tmissilesiloemp.cob and /dev/null differ diff --git a/Scripts/tmissletank.bos b/Scripts/tmissletank.bos deleted file mode 100644 index 1cbe53bdc..000000000 --- a/Scripts/tmissletank.bos +++ /dev/null @@ -1,175 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, barrel1, firepoint1, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -#define gdmarty 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn barrel1 to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <225>; -turn barrel1 to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn barrel1 around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tmissletank.cob b/Scripts/tmissletank.cob deleted file mode 100644 index 813773a86..000000000 Binary files a/Scripts/tmissletank.cob and /dev/null differ diff --git a/Scripts/tmobileradar.bos b/Scripts/tmobileradar.bos deleted file mode 100644 index 7318ffe23..000000000 --- a/Scripts/tmobileradar.bos +++ /dev/null @@ -1,107 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, top; - -static-var terraintype, bmoving; // these are the variables - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - - -Create() -{ - start-script setSFXoccupy(); - start-script EmitWakes(); - spin top around y-axis speed <10.005495>; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type BITMAPONLY | BITMAP1; -} \ No newline at end of file diff --git a/Scripts/tmobileradar.cob b/Scripts/tmobileradar.cob deleted file mode 100644 index 79a76d253..000000000 Binary files a/Scripts/tmobileradar.cob and /dev/null differ diff --git a/Scripts/tomega.bos b/Scripts/tomega.bos deleted file mode 100644 index 4b609ebc0..000000000 --- a/Scripts/tomega.bos +++ /dev/null @@ -1,143 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret1, firepoint1; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// Signal definitions -#define SIG_AIM 2 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from base; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret1 to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; - -turn turret1 to y-axis heading speed <225>; -wait-for-turn turret1 around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret1; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type BITMAPONLY | BITMAP1; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode turret1 type FALL | BITMAP1; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -return (0); -} -corpsetype = 3; -explode turret1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode base type BITMAPONLY | BITMAP3; -} diff --git a/Scripts/tomega.cob b/Scripts/tomega.cob deleted file mode 100644 index b3f2f1157..000000000 Binary files a/Scripts/tomega.cob and /dev/null differ diff --git a/Scripts/tradar.cob b/Scripts/tradar.cob deleted file mode 100644 index 1d1feecab..000000000 Binary files a/Scripts/tradar.cob and /dev/null differ diff --git a/Scripts/transport.bos b/Scripts/transport.bos deleted file mode 100644 index f5b8fd1f1..000000000 --- a/Scripts/transport.bos +++ /dev/null @@ -1,130 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, link; - -static-var Static_Var_1, unitviewer, statechg_DesiredState, statechg_StateChanging; - -// Signal definitions -#define SIG_MOVE 4 - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - unitviewer = FALSE; - call-script InitState(); - start-script SmokeUnit(); -} - -QueryTransport(Func_Var_1) -{ - Func_Var_1 = 1; -} - -BeginTransport(Func_Var_1) -{ - move link to y-axis [0.000000] - Func_Var_1 now; -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -EndTransport() -{ -} - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP4; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; -} diff --git a/Scripts/transport.cob b/Scripts/transport.cob deleted file mode 100644 index 0d15faa0a..000000000 Binary files a/Scripts/transport.cob and /dev/null differ diff --git a/Scripts/transport2.bos b/Scripts/transport2.bos deleted file mode 100644 index 158de124f..000000000 --- a/Scripts/transport2.bos +++ /dev/null @@ -1,184 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, link, engines, enginefire1, enginefirepoint2; - -static-var Static_Var_1, unitviewer, statechg_DesiredState, statechg_StateChanging, moving; - -// Signal definitions -#define SIG_MOVE 4 -#define flame 1024+0 - - -activatescr() -{ - if( TRUE ) - { - emit-sfx flame from enginefire1; - emit-sfx flame from enginefirepoint2; - turn engines to x-axis <0> speed <50.192308>; - } - sleep 5; -} - -deactivatescr() -{ - if( TRUE ) - { - emit-sfx flame from enginefire1; - emit-sfx flame from enginefirepoint2; - turn engines to x-axis <-90> speed <50.192308>; - } - sleep 5; -} - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from enginefire1; - emit-sfx flame from enginefirepoint2; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - call-script activatescr(); - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - call-script deactivatescr(); - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - unitviewer = FALSE; - call-script InitState(); - turn enginefire1 to y-axis <180> now; - turn enginefirepoint2 to y-axis <180> now; - turn engines to x-axis <-90> now; - start-script Thrust(); - start-script SmokeUnit(); -} - -QueryTransport(Func_Var_1) -{ - Func_Var_1 = 1; -} - -BeginTransport(Func_Var_1) -{ - move link to y-axis [0.000000] - Func_Var_1 now; -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -EndTransport() -{ -} - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP4; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; -} diff --git a/Scripts/transport2.bosbackup b/Scripts/transport2.bosbackup deleted file mode 100644 index bdc860138..000000000 --- a/Scripts/transport2.bosbackup +++ /dev/null @@ -1,157 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, link, engines, enginefire1, enginefirepoint2; - -static-var Static_Var_1, unitviewer, statechg_DesiredState, statechg_StateChanging, moving; - -// Signal definitions -#define SIG_MOVE 4 -#define flame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from enginefire1; - emit-sfx flame from enginefirepoint2; - - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - -InitState() -{ - statechg_DesiredState = TRUE; - statechg_StateChanging = FALSE; -} - -RequestState(requestedstate, currentstate) -{ - if( statechg_StateChanging ) - { - statechg_DesiredState = requestedstate; - return (0); - } - statechg_StateChanging = TRUE; - currentstate = statechg_DesiredState; - statechg_DesiredState = requestedstate; - while( statechg_DesiredState != currentstate ) - { - if( statechg_DesiredState == 0 ) - { - currentstate = 0; - } - if( statechg_DesiredState == 1 ) - { - currentstate = 1; - } - } - statechg_StateChanging = FALSE; -} - -Create() -{ - Static_Var_1 = 0; - unitviewer = FALSE; - call-script InitState(); - turn enginefire1 to y-axis <180> now; - turn enginefirepoint2 to y-axis <180> now; - start-script Thrust(); - start-script SmokeUnit(); -} - -QueryTransport(Func_Var_1) -{ - Func_Var_1 = 1; -} - -BeginTransport(Func_Var_1) -{ - move link to y-axis [0.000000] - Func_Var_1 now; -} - -Activate() -{ - start-script RequestState(0); -} - -Deactivate() -{ - start-script RequestState(1); -} - -EndTransport() -{ -} - -SweetSpot(piecenum) -{ - piecenum = base; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP4; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type SHATTER | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3; -} diff --git a/Scripts/transport2.cob b/Scripts/transport2.cob deleted file mode 100644 index 4a89ad0de..000000000 Binary files a/Scripts/transport2.cob and /dev/null differ diff --git a/Scripts/tresearch.cob b/Scripts/tresearch.cob deleted file mode 100644 index c0e97da71..000000000 Binary files a/Scripts/tresearch.cob and /dev/null differ diff --git a/Scripts/trocketmech.cob b/Scripts/trocketmech.cob deleted file mode 100644 index 14f062d71..000000000 Binary files a/Scripts/trocketmech.cob and /dev/null differ diff --git a/Scripts/tslicer.bos b/Scripts/tslicer.bos deleted file mode 100644 index 83c61288e..000000000 --- a/Scripts/tslicer.bos +++ /dev/null @@ -1,261 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece hull, turret, barrel1, firepoint1, barrel2, firepoint2, barrel3, firepoint3, barrel4, firepoint4, barrel5, firepoint5; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define -#define SIG_AIM_4 8 -#define SIG_AIM_8 16 -#define SIG_AIM_16 32 -#define SIG_AIM_32 64 - - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from hull; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from hull; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move hull to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move hull to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move hull to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -{ -piecenum = firepoint1; -} -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - -AimWeapon3(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_4; -set-signal-mask SIG_AIM_2; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon3() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon3(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon3(piecenum) // where the shot is called from -{ -piecenum = firepoint3; -} - - - -AimWeapon4(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_8; -set-signal-mask SIG_AIM_4; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon4() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon4(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon4(piecenum) // where the shot is called from -{ -piecenum = firepoint4; -} - - -AimWeapon5(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_16; -set-signal-mask SIG_AIM_8; -turn turret to y-axis heading speed <900>; -wait-for-turn turret around y-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon5() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon5(piecenum) // where it aims the weapon from -{ -piecenum = turret; -} - -QueryWeapon5(piecenum) // where the shot is called from -{ -piecenum = firepoint5; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type BITMAPONLY | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode hull type BITMAPONLY | BITMAP4; -explode barrel1 type FALL | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode hull type BITMAPONLY | BITMAP1; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode barrel1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode barrel2 type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tslicer.cob b/Scripts/tslicer.cob deleted file mode 100644 index 0243ab5f3..000000000 Binary files a/Scripts/tslicer.cob and /dev/null differ diff --git a/Scripts/tslicer2.bos b/Scripts/tslicer2.bos deleted file mode 100644 index e347c008b..000000000 --- a/Scripts/tslicer2.bos +++ /dev/null @@ -1,183 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, turret, guns, firepoint1, firepoint2; // these are the pieces of the model - -static-var terraintype, bmoving; // these are the variables - -// #define gdscannon 1024+0 // this is a custom explosion generator thinging - -// Signal definitions -#define SIG_AIM 2 -#define SIG_AIM_2 4 // this is a aim define - -#define shot 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) // this is a standard smoke point define -{ -while( get BUILD_PERCENT_LEFT ) -{ -sleep 400; -} -while( TRUE ) -{ -healthpercent = get HEALTH; -if( healthpercent < 66 ) -{ -smoketype = 256 | 2; -if( Rand( 1, 66 ) < healthpercent ) -{ -smoketype = 256 | 1; -} -emit-sfx smoketype from turret; -} -sleeptime = healthpercent * 50; -if( sleeptime < 200 ) -{ -sleeptime = 200; -} -sleep sleeptime; -} -} - -EmitWakes() -{ - while( TRUE ) - { - if( bMoving ) - { - emit-sfx 2 from base; - } - sleep 300; - } -} - -setSFXoccupy(setSFXoccupy_argument) -{ -terraintype = setSFXoccupy_argument; - - if(terraintype == 2) - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } - else - { - move base to y-axis [0.0] speed [50]; - set UPRIGHT to 0; - } - if(terraintype == 4) - { - move base to y-axis [0] speed [50]; - set UPRIGHT to 0; - } - else - { - move base to y-axis [-0.85] speed [50]; - set UPRIGHT to 1; - } -} - -Create() // tells it what to do on creation -{ - start-script setSFXoccupy(); - start-script EmitWakes(); -start-script SmokeUnit(); -} - -RestoreAfterDelay() // restore function to turn the turret and so forth back to start -{ -sleep 3000; -turn turret to y-axis <0> speed <60>; -turn turret to x-axis <0> speed <30>; -} - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn guns to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn guns around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint1; -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = guns; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = firepoint1; -} - - -AimWeapon2(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM_2; -set-signal-mask SIG_AIM; -turn turret to y-axis heading speed <255>; -turn guns to x-axis <0> - pitch speed <150>; -wait-for-turn turret around y-axis; -wait-for-turn guns around x-axis; -start-script RestoreAfterDelay(); -return (1); -} - -FireWeapon2() // what do while firing, fires 1 barrel then the next , and resets -{ -emit-sfx shot from firepoint2; -} - -AimFromWeapon2(piecenum) // where it aims the weapon from -{ -piecenum = guns; -} - -QueryWeapon2(piecenum) // where the shot is called from -{ -piecenum = firepoint2; -} - - - -Killed(severity, corpsetype) // how it explodes -{ -if( severity <= 25 ) -{ -corpsetype = 1; -explode base type BITMAPONLY | BITMAP1; -explode guns type BITMAPONLY | BITMAP1; -explode turret type BITMAPONLY | BITMAP4; -return (0); -} -if( severity <= 80 ) -{ -corpsetype = 2; -explode base type BITMAPONLY | BITMAP4; -explode guns type FALL | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -if( severity <= 99 ) -{ -corpsetype = 3; -explode base type BITMAPONLY | BITMAP1; -explode guns type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -explode turret type SHATTER | BITMAP4; -return (0); -} -corpsetype = 3; -explode guns type BITMAPONLY | BITMAP3; -explode turret type SHATTER | EXPLODE_ON_HIT | BITMAP4; -} diff --git a/Scripts/tslicer2.cob b/Scripts/tslicer2.cob deleted file mode 100644 index 337c66f7a..000000000 Binary files a/Scripts/tslicer2.cob and /dev/null differ diff --git a/Scripts/tsolar.bos b/Scripts/tsolar.bos deleted file mode 100644 index b7219a76f..000000000 --- a/Scripts/tsolar.bos +++ /dev/null @@ -1,70 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece solar; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from solar; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -Create() -{ - start-script SmokeUnit(); -} - -SweetSpot(piecenum) -{ - piecenum = solar; -} - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode solar type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode solar type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode solar type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode solar type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tsolar.cob b/Scripts/tsolar.cob deleted file mode 100644 index 928ea393c..000000000 Binary files a/Scripts/tsolar.cob and /dev/null differ diff --git a/Scripts/tsolar2.bos b/Scripts/tsolar2.bos deleted file mode 100644 index d5d56955c..000000000 --- a/Scripts/tsolar2.bos +++ /dev/null @@ -1,96 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from firepoint1; - sleep 5; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - - emit-sfx 2049 from firepoint1; - sleep 400; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn firepoint1 to x-axis <-90> now; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tsolar2.cob b/Scripts/tsolar2.cob deleted file mode 100644 index 4fdf8953c..000000000 Binary files a/Scripts/tsolar2.cob and /dev/null differ diff --git a/Scripts/tspecialfactory.cob b/Scripts/tspecialfactory.cob deleted file mode 100644 index 6496ec6c0..000000000 Binary files a/Scripts/tspecialfactory.cob and /dev/null differ diff --git a/Scripts/tstealthbomber.cob b/Scripts/tstealthbomber.cob deleted file mode 100644 index 42f0353e0..000000000 Binary files a/Scripts/tstealthbomber.cob and /dev/null differ diff --git a/Scripts/tstealthbomber2.bos b/Scripts/tstealthbomber2.bos deleted file mode 100644 index e3286e714..000000000 --- a/Scripts/tstealthbomber2.bos +++ /dev/null @@ -1,117 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, exhaust; - -static-var moving; - -// Signal definitions -#define SIG_AIM 2 - -#define flame 1024+0 - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - - -Thrust() -{ - while( TRUE ) - { - if (moving) - { - emit-sfx flame from exhaust; - } - sleep 5; - } -} - -StartMoving() -{ - moving=1; -} - -StopMoving() -{ - moving=0; -} - - -AimWeapon1(heading, pitch) // single weapon with 2 fires this tell sit what to do while aiming -{ -signal SIG_AIM; -set-signal-mask SIG_AIM; -return (1); -} - -FireWeapon1() // what do while firing, fires 1 barrel then the next , and resets -{ -} - -AimFromWeapon1(piecenum) // where it aims the weapon from -{ -piecenum = base; -} - -QueryWeapon1(piecenum) // where the shot is called from -{ -piecenum = exhaust; -} - -Create() - { - turn exhaust to y-axis <180> now; - start-script Thrust(); - start-script SmokeUnit(); - } - -Killed(severity, corpsetype) - { - if (severity <= 25) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP2; - return(0); - } - if (severity <= 50) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return(0); - } - if (severity <= 99) - { - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP2; - return(0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; - return(0); - } \ No newline at end of file diff --git a/Scripts/tstealthbomber2.cob b/Scripts/tstealthbomber2.cob deleted file mode 100644 index 6e3d0494b..000000000 Binary files a/Scripts/tstealthbomber2.cob and /dev/null differ diff --git a/Scripts/tstorage.bos b/Scripts/tstorage.bos deleted file mode 100644 index d5d56955c..000000000 --- a/Scripts/tstorage.bos +++ /dev/null @@ -1,96 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, firepoint1; - -static-var Static_Var_1; - - -SmokeUnit(healthpercent, sleeptime, smoketype) -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - healthpercent = get HEALTH; - if( healthpercent < 66 ) - { - smoketype = 256 | 2; - if( Rand( 1, 66 ) < healthpercent ) - { - smoketype = 256 | 1; - } - emit-sfx smoketype from base; - } - sleeptime = healthpercent * 50; - if( sleeptime < 200 ) - { - sleeptime = 200; - } - sleep sleeptime; - } -} - -fx() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - emit-sfx 2048 from firepoint1; - sleep 5; - } -} - -fx2() -{ - while( get BUILD_PERCENT_LEFT ) - { - sleep 400; - } - while( TRUE ) - { - - emit-sfx 2049 from firepoint1; - sleep 400; - } -} - -Create() -{ - start-script fx(); - start-script fx2(); - turn firepoint1 to x-axis <-90> now; - start-script SmokeUnit(); -} - - -Killed(severity, corpsetype) -{ - if( severity <= 25 ) - { - corpsetype = 1; - explode base type BITMAPONLY | BITMAP1; - return (0); - } - if( severity <= 50 ) - { - corpsetype = 2; - explode base type SHATTER | BITMAP1; - return (0); - } - if( severity <= 99 ) - { - corpsetype = 3; - explode base type SHATTER | EXPLODE_ON_HIT | BITMAP1; - return (0); - } - corpsetype = 3; - explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1; -} diff --git a/Scripts/tstorage.cob b/Scripts/tstorage.cob deleted file mode 100644 index 4fdf8953c..000000000 Binary files a/Scripts/tstorage.cob and /dev/null differ diff --git a/Scripts/zaal/constants.h b/Scripts/zaal/constants.h new file mode 100644 index 000000000..5405aeeec --- /dev/null +++ b/Scripts/zaal/constants.h @@ -0,0 +1,146 @@ +//just replaced it with rattle's. plus no dealing with a pissy Argh claiming that now we have to GPL EEEVVVRRYYTHING +//Argh, if you read this: honestly, wtf were you thinking trying to GPL a list of #defines? +// With the original cavedog comments STILL IN THEM!? +// You could at least have made it less bloody obvious that it was a direct copy/paste. +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ +#endif + +#define SFXTYPE_VTOL 1 +#define SFXTYPE_THRUST 2 +#define SFXTYPE_WAKE1 3 +#define SFXTYPE_WAKE2 4 +#define SFXTYPE_REVERSEWAKE1 5 +#define SFXTYPE_REVERSEWAKE2 6 + +#define SFXTYPE_POINTBASED 256 +#define SFXTYPE_WHITESMOKE 256|1 +#define SFXTYPE_BLACKSMOKE 256|2 +#define SFXTYPE_SUBBUBBLES 256|3 + +#define SHATTER 1 +#define EXPLODE_ON_HIT 2 +#define FALL 4 +#define SMOKE 8 +#define FIRE 16 +#define BITMAPONLY 32 +#define BITMAP 10000001 + +// Explosion generators +#define UNIT_SFX1 1024 +#define UNIT_SFX2 1025 +#define UNIT_SFX3 1026 +#define UNIT_SFX4 1027 +#define UNIT_SFX5 1028 +#define UNIT_SFX6 1029 +#define UNIT_SFX7 1030 +#define UNIT_SFX8 1031 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 + +// COB constants, as in CobInstance.cpp +// Indices for set/get value +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +/*#define WEAPON_AIM_ABORTED 21 +#define WEAPON_READY 22 +#define WEAPON_LAUNCH_NOW 23 +#define FINISHED_DYING 26 +#define ORIENTATION 27*/ +#define IN_WATER 28 +#define CURRENT_SPEED 29 +//#define MAGIC_DEATH 31 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get + +// NOTE: [LUA0 - LUA9] are defined in CobThread.cpp as [110 - 119] + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) +#define WEAPON_RELOADTIME 126 // get (with fake set) +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get diff --git a/Scripts/zaal/exptype.h b/Scripts/zaal/exptype.h new file mode 100644 index 000000000..932fb4f47 --- /dev/null +++ b/Scripts/zaal/exptype.h @@ -0,0 +1,192 @@ +/* +** EXPtype.h -- Explosion Type information and GET/SET constants for scripts +** +** This Script contains constants compatible only with Spring RTS engine +** not for use with Total Annihilation or TA:Kindgoms +*/ + +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +// Indices for emit-sfx +#ifndef __SFXTYPE_H_ +#define SFXTYPE_VTOL 0 +//#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 // same as SFX_WAKE +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 // same as SFX_REVERSE_WAKE + +#define SFXTYPE_WHITESMOKE 257 +#define SFXTYPE_BLACKSMOKE 258 +#define SFXTYPE_SUBBUBBLES 259 +#endif + +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define NOCEGTRAIL 64 // Disables the cegtrail for the specific piece (defined in the unit fbi) +#define BITMAP 10000001 + +// Bitmap Explosion Types +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 + +//Customized effects (in FBI/TDF/LUA) +// Explosion generators +#define UNIT_SFX0 1024 +#define UNIT_SFX1 1025 +#define UNIT_SFX2 1026 +#define UNIT_SFX3 1027 +#define UNIT_SFX4 1028 +#define UNIT_SFX5 1029 +#define UNIT_SFX6 1030 +#define UNIT_SFX7 1031 +#define UNIT_SFX8 1032 +#define UNIT_SFX9 1033 + +// Weapons +#define FIRE_W1 2048 +#define FIRE_W2 2049 +#define FIRE_W3 2050 +#define FIRE_W4 2051 +#define FIRE_W5 2052 +#define FIRE_W6 2053 +#define FIRE_W7 2054 +#define FIRE_W8 2055 +#define FIRE_W9 2056 + +#define DETO_W1 4096 +#define DETO_W2 4097 +#define DETO_W3 4098 +#define DETO_W4 4099 +#define DETO_W5 4100 +#define DETO_W6 4101 +#define DETO_W7 4102 +#define DETO_W8 4103 +#define DETO_W9 4104 + + +// COB constants +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define SONAR_STEALTH 108 // set or get +#define REVERSING 109 // get + +// Indices for SET, GET, and GET_UNIT_VALUE for LUA return values +#define LUA0 110 // (LUA0 returns the lua call status, 0 or 1) +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 + +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) get WEAPON_RELOADSTATE(weaponNum) for GET +#define WEAPON_RELOADTIME 126 // get (with fake set) get WEAPON_RELOADSTATE(-weaponNum,val) for SET +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) +#define WEAPON_STOCKPILE_COUNT 139 // get (with fake set) + + +#define MIN 131 // get +#define MAX 132 // get +#define ABS 133 // get +#define GAME_FRAME 134 // get +#define KSIN 135 // get, kiloSine 1024*sin(x) as COB uses only integers +#define KCOS 136 // get, kiloCosine 1024*cos(x) + +#define KTAN 137 // get, kiloTangent 1024*tan(x) carefull with angles close to 90 deg. might cause overflow +#define SQRT 138 // get, square root (floored to integer) + +#define ENERGY_MAKE 140 // set or get (100*E production) + +#define METAL_MAKE 141 // set or get (100*M production) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif \ No newline at end of file diff --git a/Scripts/zaal/sfxtype.h b/Scripts/zaal/sfxtype.h new file mode 100644 index 000000000..610241a23 --- /dev/null +++ b/Scripts/zaal/sfxtype.h @@ -0,0 +1,51 @@ +/* +** SFXtype.h -- Special Effects Type information for scripts +** +** Copyright 1997 Cavedog Entertainment +*/ + +#ifndef __SFXTYPE_H_ +#define __SFXTYPE_H_ + +/* +Special Effect Particles referenced in the scripting language +with the command "emit-sfx". This file is included by any +scripts that use the command, as well as TAObjScr.cpp in the game, +so it can start the proper effect. +*/ + +// IMPORTANT: If you change these defines, copy the file to +// v:\totala\cdimage\scripts so the scripts have +// access to the proper data, and recompile them. + + +// Vector-based special effects + +#define SFXTYPE_VTOL 0 +#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 + + + +// Point-based (piece origin) special effects + +#define SFXTYPE_POINTBASED 256 + +#define SFXTYPE_WHITESMOKE (SFXTYPE_POINTBASED | 1) +#define SFXTYPE_BLACKSMOKE (SFXTYPE_POINTBASED | 2) +#define SFXTYPE_SUBBUBBLES +// New in TA:K +#define SFXTYPE_SMALLDAMAGEFLAME (SFXTYPE_POINTBASED | 4) + + +// Sound priorities in TA:K +#define PLAYSOUND_PRIORITY_BATTLE 4 + + +// SFX Occupy States +#define SFXOCCUPY_AIR 5 + +#endif \ No newline at end of file diff --git a/Scripts/zaal/smokeunit.h b/Scripts/zaal/smokeunit.h new file mode 100644 index 000000000..0bec00f0e --- /dev/null +++ b/Scripts/zaal/smokeunit.h @@ -0,0 +1,100 @@ +/* SmokeUnit.h -- Process unit smoke when damaged */ + +#ifndef SMOKE_H_ +#define SMOKE_H_ + +#include "SFXtype.h" +#include "EXPtype.h" + +// Figure out how many smoking pieces are defined + +#ifdef SMOKEPIECE4 + #define NUM_SMOKE_PIECES 4 +#else + #ifdef SMOKEPIECE3 + #define NUM_SMOKE_PIECES 3 + #else + #ifdef SMOKEPIECE2 + #define NUM_SMOKE_PIECES 2 + #else + #define NUM_SMOKE_PIECES 1 + #ifndef SMOKEPIECE1 + #define SMOKEPIECE1 SMOKEPIECE + #endif + #endif + #endif +#endif + + +SmokeUnit() +{ + var healthpercent; + var sleeptime; + var smoketype; + +#if NUM_SMOKE_PIECES > 1 + var choice; +#endif + + // Wait until the unit is actually built + while (get BUILD_PERCENT_LEFT) + { + sleep 400; + } + + // Smoke loop + while (TRUE) + { + // How is the unit doing? + healthpercent = get HEALTH; + + if (healthpercent < 66) + { + // Emit a puff of smoke + + smoketype = SFXTYPE_BLACKSMOKE; + + if (rand( 1, 66 ) < healthpercent) + { + smoketype = SFXTYPE_WHITESMOKE; + } + + // Figure out which piece the smoke will emit from, and spit it out + +#if NUM_SMOKE_PIECES == 1 + emit-sfx 1026 from SMOKEPIECE1; +#else + choice = rand( 1, NUM_SMOKE_PIECES ); + + if (choice == 1) + { emit-sfx 1026 from SMOKEPIECE1; } + if (choice == 2) + { emit-sfx 1026 from SMOKEPIECE2; } + #if NUM_SMOKE_PIECES >= 3 + if (choice == 3) + { emit-sfx 1026 from SMOKEPIECE3; } + #if NUM_SMOKE_PIECES >= 4 + if (choice == 4) + { emit-sfx 1026 from SMOKEPIECE4; } + #endif + #endif +#endif + } + + // Delay between puffs + + sleeptime = healthpercent * 50; + if (sleeptime < 200) + { + sleeptime = 200; // Fastest rate is five times per second + } + + sleep sleeptime; + } +} + + +// Clean up pre-processor +#undef NUM_SMOKE_PIECES + +#endif diff --git a/Scripts/zaal/springdefs.h b/Scripts/zaal/springdefs.h new file mode 100644 index 000000000..cada4991d --- /dev/null +++ b/Scripts/zaal/springdefs.h @@ -0,0 +1,164 @@ +//============================================================================== +// +// Constants and macros for Spring /units/*.BOS +// +// Made by merging the exptype.h and sfxtype.h that are tradionally shipped with Scriptor +// Which are themselves edited from the ones inside Cavedog's Totala1.hpi +// And the #define from https://spring.clan-sy.com/svn/spring/trunk/rts/Sim/Units/COB/CobInstance.cpp +// +//============================================================================== + +#ifndef SPRING_SCRIPTS_H +#define SPRING_SCRIPTS_H + + +// To use with the "emit-sfx" command: + +// Vector-based special effects +#define SFXTYPE_VTOL 0 +#define SFXTYPE_THRUST 1 +#define SFXTYPE_WAKE1 2 +#define SFXTYPE_WAKE2 3 +#define SFXTYPE_REVERSEWAKE1 4 +#define SFXTYPE_REVERSEWAKE2 5 + +// Point-based (piece origin) special effects +#define SFXTYPE_POINTBASED 256 +#define SFXTYPE_WHITESMOKE (SFXTYPE_POINTBASED | 1) +#define SFXTYPE_BLACKSMOKE (SFXTYPE_POINTBASED | 2) +#define SFXTYPE_SUBBUBBLES (SFXTYPE_POINTBASED | 3) +// TA:K sfx, maybe not implemented in Spring +#define SFXTYPE_SMALLDAMAGEFLAME (SFXTYPE_POINTBASED | 4) +#define SFXTYPE_MEDIUMDAMAGEFLAME (SFXTYPE_POINTBASED | 5) +#define SFXTYPE_LARGEDAMAGEFLAME (SFXTYPE_POINTBASED | 6) + +// Probably not implemented in Spring, TA:K stuff +#define PLAYSOUND_PRIORITY_BATTLE 4 + +// Probably not implemented in Spring, probably TA:K stuff +#define SFXOCCUPY_AIR 5 // SFX Occupy States + +// To use with the "explode" command: +#define SHATTER 1 // The piece will shatter instead of remaining whole +#define EXPLODE_ON_HIT 2 // The piece will explode when it hits the ground +#define FALL 4 // The piece will fall due to gravity instead of just flying off +#define SMOKE 8 // A smoke trail will follow the piece through the air +#define FIRE 16 // A fire trail will follow the piece through the air +#define BITMAPONLY 32 // The piece will not fly off or shatter or anything. Only a bitmap explosion will be rendered. +#define BITMAP1 256 +#define BITMAP2 512 +#define BITMAP3 1024 +#define BITMAP4 2048 +#define BITMAP5 4096 +#define BITMAPNUKE 8192 +#define BITMAPMASK 16128 // Mask of the possible bitmap bits + +// Probably not implemented in Spring, TA:K stuff +#define EXPTYPE_SMALLEXPLOSION 256 +#define EXPTYPE_MEDIUMEXPLOSION 512 +#define EXPTYPE_LARGEEXPLOSION 1024 +#define EXPTYPE_XLARGEEXPLOSION 2048 +#define EXPTYPE_BLOODEXPLOSION 4096 +#define EXPTYPE_SMALLSMOKE 8192 +#define EXPTYPE_MEDIUMSMOKE 16384 +#define EXPTYPE_XLARGESMOKE 65536 + +// Probably not implemented in Spring, TA:K stuff (DT stands for Damage Type) +#define DT_FIRE 2 +#define DT_EXPLOSION 3 +#define DT_PARALYZER 4 + +// Indices for set/get value +#define ACTIVATION 1 // set or get +#define STANDINGMOVEORDERS 2 // set or get +#define STANDINGFIREORDERS 3 // set or get +#define HEALTH 4 // get (0-100%) +#define INBUILDSTANCE 5 // set or get +#define BUSY 6 // set or get (used by misc. special case missions like transport ships) +#define PIECE_XZ 7 // get +#define PIECE_Y 8 // get +#define UNIT_XZ 9 // get +#define UNIT_Y 10 // get +#define UNIT_HEIGHT 11 // get +#define XZ_ATAN 12 // get atan of packed x,z coords +#define XZ_HYPOT 13 // get hypot of packed x,z coords +#define ATAN 14 // get ordinary two-parameter atan +#define HYPOT 15 // get ordinary two-parameter hypot +#define GROUND_HEIGHT 16 // get land height, 0 if below water +#define BUILD_PERCENT_LEFT 17 // get 0 = unit is built and ready, 1-100 = How much is left to build +#define YARD_OPEN 18 // set or get (change which plots we occupy when building opens and closes) +#define BUGGER_OFF 19 // set or get (ask other units to clear the area) +#define ARMORED 20 // set or get + +#define WEAPON_AIM_ABORTED 21 // Not implemented in Spring, TAK stuff +#define WEAPON_READY 22 // Not implemented in Spring, TAK stuff +#define WEAPON_LAUNCH_NOW 23 // Not implemented in Spring, TAK stuff +#define FINISHED_DYING 26 // Not implemented in Spring, TAK stuff +#define ORIENTATION 27 // Not implemented in Spring, TAK stuff +#define IN_WATER 28 +#define CURRENT_SPEED 29 +#define MAGIC_DEATH 31 // Not implemented in Spring, TAK stuff +#define VETERAN_LEVEL 32 +#define ON_ROAD 34 + +#define MAX_ID 70 +#define MY_ID 71 +#define UNIT_TEAM 72 +#define UNIT_BUILD_PERCENT_LEFT 73 +#define UNIT_ALLIED 74 +#define MAX_SPEED 75 +#define CLOAKED 76 +#define WANT_CLOAK 77 +#define GROUND_WATER_HEIGHT 78 // get land height, negative if below water +#define UPRIGHT 79 // set or get +#define POW 80 // get +#define PRINT 81 // get, so multiple args can be passed +#define HEADING 82 // get +#define TARGET_ID 83 // get +#define LAST_ATTACKER_ID 84 // get +#define LOS_RADIUS 85 // set or get +#define AIR_LOS_RADIUS 86 // set or get +#define RADAR_RADIUS 87 // set or get +#define JAMMER_RADIUS 88 // set or get +#define SONAR_RADIUS 89 // set or get +#define SONAR_JAM_RADIUS 90 // set or get +#define SEISMIC_RADIUS 91 // set or get +#define DO_SEISMIC_PING 92 // get +#define CURRENT_FUEL 93 // set or get +#define TRANSPORT_ID 94 // get +#define SHIELD_POWER 95 // set or get +#define STEALTH 96 // set or get +#define CRASHING 97 // set or get, returns whether aircraft isCrashing state +#define CHANGE_TARGET 98 // set, the value it's set to determines the affected weapon +#define CEG_DAMAGE 99 // set +#define COB_ID 100 // get +#define PLAY_SOUND 101 // get, so multiple args can be passed +#define KILL_UNIT 102 // get KILL_UNIT(unitId, SelfDestruct=true, Reclaimed=false) +#define ALPHA_THRESHOLD 103 // set or get +#define SET_WEAPON_UNIT_TARGET 106 // get (fake set) +#define SET_WEAPON_GROUND_TARGET 107 // get (fake set) +#define LUA0 110 +#define LUA1 111 +#define LUA2 112 +#define LUA3 113 +#define LUA4 114 +#define LUA5 115 +#define LUA6 116 +#define LUA7 117 +#define LUA8 118 +#define LUA9 119 +#define FLANK_B_MODE 120 // set or get +#define FLANK_B_DIR 121 // set or get, set is through get for multiple args +#define FLANK_B_MOBILITY_ADD 122 // set or get +#define FLANK_B_MAX_DAMAGE 123 // set or get +#define FLANK_B_MIN_DAMAGE 124 // set or get +#define WEAPON_RELOADSTATE 125 // get (with fake set) +#define WEAPON_RELOADTIME 126 // get (with fake set) +#define WEAPON_ACCURACY 127 // get (with fake set) +#define WEAPON_SPRAY 128 // get (with fake set) +#define WEAPON_RANGE 129 // get (with fake set) +#define WEAPON_PROJECTILE_SPEED 130 // get (with fake set) + +// NOTE: shared variables use codes [1024 - 5119] + +#endif // SPRING_SCRIPTS_H diff --git a/Scripts/zaal/zairbomber.bos b/Scripts/zaal/zairbomber.bos new file mode 100644 index 000000000..f8a8cde77 --- /dev/null +++ b/Scripts/zaal/zairbomber.bos @@ -0,0 +1,109 @@ +piece body,head,tail,lwing,rwing,lblade,mblade,rblade,rsack,lsack; + +static-var bMoving; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +fly() +{ + if (bMoving) + { + turn lwing to z-axis <-40> speed<60>; + turn rwing to z-axis <40> speed<60>; + wait-for-turn lwing around z-axis; + turn lwing to z-axis <40> speed<120>; + turn rwing to z-axis <-40> speed<120>; + wait-for-turn lwing around z-axis; + start-script fly(); + } +} + +stopfly () +{ + turn lwing to z-axis <0> speed <200>; + turn rwing to z-axis <0> speed <200>; +} + +StartMoving() +{ + bMoving = TRUE; + start-script fly(); +} + +StopMoving() +{ + bMoving = FALSE; + start-script stopfly(); +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to x-axis 0 -pitch speed <200>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lsack to y-axis <40> speed [1]; + turn rsack to y-axis <-40> speed [1]; + move rsack to x-axis [-1] speed [1]; + move lsack to x-axis [1] speed [1]; + move mblade to z-axis [-8] speed [100]; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed [0.3]; + turn rsack to y-axis <0> speed [0.3]; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + move mblade to z-axis <0> speed [3]; + } + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + emit-sfx 1024 from lwing; + emit-sfx 1024 from rwing; + explode body type SHATTER | NOHEATCLOUD; + explode head type FALL | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + explode lwing type FALL | NOHEATCLOUD; + explode rwing type FALL | NOHEATCLOUD; + explode mblade type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zairbomber.cob b/Scripts/zaal/zairbomber.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/zaal/zairbomber.cob differ diff --git a/Scripts/zaal/zairscout.bos b/Scripts/zaal/zairscout.bos new file mode 100644 index 000000000..f8a8cde77 --- /dev/null +++ b/Scripts/zaal/zairscout.bos @@ -0,0 +1,109 @@ +piece body,head,tail,lwing,rwing,lblade,mblade,rblade,rsack,lsack; + +static-var bMoving; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +fly() +{ + if (bMoving) + { + turn lwing to z-axis <-40> speed<60>; + turn rwing to z-axis <40> speed<60>; + wait-for-turn lwing around z-axis; + turn lwing to z-axis <40> speed<120>; + turn rwing to z-axis <-40> speed<120>; + wait-for-turn lwing around z-axis; + start-script fly(); + } +} + +stopfly () +{ + turn lwing to z-axis <0> speed <200>; + turn rwing to z-axis <0> speed <200>; +} + +StartMoving() +{ + bMoving = TRUE; + start-script fly(); +} + +StopMoving() +{ + bMoving = FALSE; + start-script stopfly(); +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to x-axis 0 -pitch speed <200>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lsack to y-axis <40> speed [1]; + turn rsack to y-axis <-40> speed [1]; + move rsack to x-axis [-1] speed [1]; + move lsack to x-axis [1] speed [1]; + move mblade to z-axis [-8] speed [100]; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed [0.3]; + turn rsack to y-axis <0> speed [0.3]; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + move mblade to z-axis <0> speed [3]; + } + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + emit-sfx 1024 from lwing; + emit-sfx 1024 from rwing; + explode body type SHATTER | NOHEATCLOUD; + explode head type FALL | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + explode lwing type FALL | NOHEATCLOUD; + explode rwing type FALL | NOHEATCLOUD; + explode mblade type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zairscout.cob b/Scripts/zaal/zairscout.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/zaal/zairscout.cob differ diff --git a/Scripts/zaal/zairtoairfighter.bos b/Scripts/zaal/zairtoairfighter.bos new file mode 100644 index 000000000..1e8802701 --- /dev/null +++ b/Scripts/zaal/zairtoairfighter.bos @@ -0,0 +1,118 @@ +piece body,head,tail,lwing,rwing,lblade,mblade,rblade,rsack,lsack; + +static-var bMoving; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + + +fly() +{ + if (bMoving) + { + turn lwing to z-axis <-40> speed<120>; + turn rwing to z-axis <40> speed<120>; + wait-for-turn lwing around z-axis; + turn lwing to z-axis <40> speed<240>; + turn rwing to z-axis <-40> speed<240>; + wait-for-turn lwing around z-axis; + start-script fly(); + } +} + +stopfly () +{ + turn lwing to z-axis <0> speed <200>; + turn rwing to z-axis <0> speed <200>; +} + + +Go() +{ + call-script fly(); +} + +Stop() +{ + call-script stopfly(); +} + +StartMoving() +{ + bMoving = TRUE; + start-script fly(); +} + +StopMoving() +{ + bMoving = FALSE; + start-script stopfly(); +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + + RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to x-axis 0 -pitch speed <200>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lsack to y-axis <40> speed [1]; + turn rsack to y-axis <-40> speed [1]; + move rsack to x-axis [-1] speed [1]; + move lsack to x-axis [1] speed [1]; + move mblade to z-axis [-8] speed [100]; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed [0.3]; + turn rsack to y-axis <0> speed [0.3]; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + move mblade to z-axis <0> speed [3]; + } + +SweetSpot(piecenum) + { piecenum=body; } + + + +HitByWeaponId() + { + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + explode head type FALL; + explode lwing type FALL; + explode rwing type FALL; + explode mblade type FALL | EXPLODE_ON_HIT; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zairtoairfighter.cob b/Scripts/zaal/zairtoairfighter.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/zaal/zairtoairfighter.cob differ diff --git a/Scripts/zaal/zairtogroundfighter.cob b/Scripts/zaal/zairtogroundfighter.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/zaal/zairtogroundfighter.cob differ diff --git a/Scripts/zaal/zarm_lus.lua b/Scripts/zaal/zarm_lus.lua new file mode 100644 index 000000000..19f09c95b --- /dev/null +++ b/Scripts/zaal/zarm_lus.lua @@ -0,0 +1,85 @@ +base, point1 = piece('base', 'point1', 'point2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base}) + StartThread(BuildFX) + building = false + Move(base, y_axis, -1, 50) +end + +common = include("headers/common_includes_lus.lua") + +function BuildFX() + while(building == true) do + --EmitSfx (point1, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(point1, y_axis, 0, 5) + end +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return point1 +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return point1 +end + + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + --EmitSfx (point1, 1024) +end + +------------------------------------------- +------------------------------------------- + +local nanoPoints = {} +-- FIXME: this example has 2 nano pieces to alternate between +for i = 1, 2 do + -- FIXME: the pieces are named nanoPiece1 and nanoPiece2 in the model + nanoPoints[i] = piece("point" .. i) +end +Spring.SetUnitNanoPieces(unitID, nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + Turn(point1, y_axis, heading, 100) + SetUnitValue(COB.INBUILDSTANCE, true) + building = true + StartThread(BuildFX) +end +function script.StopBuilding() + -- TODO: This is where you would add your pack-up animation + SetUnitValue(COB.INBUILDSTANCE, false) + building = false + StartThread(RestoreAfterDelay) +end + +function script.Killed() + --Explode(base, SFX.EXPLODE_ON_HIT) + return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos +end \ No newline at end of file diff --git a/Scripts/zaal/zarty.bos b/Scripts/zaal/zarty.bos new file mode 100644 index 000000000..8d827818d --- /dev/null +++ b/Scripts/zaal/zarty.bos @@ -0,0 +1,235 @@ +piece body,head,tail,lthighf,lkneef,lshinf,lfootf,rthighf,rkneef,rshinf,rfootf,rblade,lblade,lthighb,lkneeb,lshinb,lfootb,rthighb,rkneeb,rshinb,rfootb; + +static-var aMoving, bMoving; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + move body to y-axis [100.000000] speed [60.000000]; + turn lthighf to x-axis <70> speed<115>; + turn lkneef to x-axis <-40> speed<145>; + turn lshinf to x-axis <20> speed<145>; + turn lfootf to x-axis <-50> speed<310>; + + turn rthighf to x-axis <-20> speed<310>; + turn rkneef to x-axis <-60> speed<310>; + turn rshinf to x-axis <50> speed<310>; + turn rfootf to x-axis <30> speed<310>; + + turn lthighb to x-axis <70> speed<115>; + turn lkneeb to x-axis <-40> speed<145>; + turn lshinb to x-axis <20> speed<145>; + turn lfootb to x-axis <-50> speed<310>; + + turn rthighb to x-axis <-20> speed<310>; + turn rkneeb to x-axis <-60> speed<310>; + turn rshinb to x-axis <50> speed<310>; + turn rfootb to x-axis <30> speed<310>; + + turn body to z-axis <5> speed <20>; + turn lthighf to z-axis <-5> speed <20>; + turn rthighf to z-axis <-5> speed <20>; + turn lthighb to z-axis <-5> speed <20>; + turn rthighb to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthighf around x-axis;} + if (aMoving) { + move body to y-axis [0.000000] speed [120.000000]; + turn lthighf to x-axis <-10> speed<160>; + turn lkneef to x-axis <15> speed<145>; + turn lshinf to x-axis <-60> speed<250>; + turn lfootf to x-axis <30> speed<145>; + + turn rthighf to x-axis <40> speed<145>; + turn rkneef to x-axis <-35> speed<145>; + turn rshinf to x-axis <-40> speed<145>; + turn rfootf to x-axis <35> speed<145>; + + turn lthighb to x-axis <-10> speed<160>; + turn lkneeb to x-axis <15> speed<145>; + turn lshinb to x-axis <-60> speed<250>; + turn lfootb to x-axis <30> speed<145>; + + turn rthighb to x-axis <40> speed<145>; + turn rkneeb to x-axis <-35> speed<145>; + turn rshinb to x-axis <-40> speed<145>; + turn rfootb to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshinf around x-axis;} + if (aMoving) { + move body to y-axis [100.000000] speed [60.000000]; + turn rthighf to x-axis <70> speed<115>; + turn rkneef to x-axis <-40> speed<145>; + turn rshinf to x-axis <20> speed<145>; + turn rfootf to x-axis <-50> speed<310>; + + turn lthighf to x-axis <-20> speed<310>; + turn lkneef to x-axis <-60> speed<310>; + turn lshinf to x-axis <50> speed<310>; + turn lfootf to x-axis <30> speed<310>; + + turn rthighb to x-axis <70> speed<115>; + turn rkneeb to x-axis <-40> speed<145>; + turn rshinb to x-axis <20> speed<145>; + turn rfootb to x-axis <-50> speed<310>; + + turn lthighb to x-axis <-20> speed<310>; + turn lkneeb to x-axis <-60> speed<310>; + turn lshinb to x-axis <50> speed<310>; + turn lfootb to x-axis <30> speed<310>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthighf to z-axis <5> speed <20>; + turn rthighf to z-axis <5> speed <20>; + turn lthighb to z-axis <5> speed <20>; + turn rthighb to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthighf around x-axis;} + if (aMoving) { + move body to y-axis [0.000000] speed [120.000000]; + turn rthighf to x-axis <-10> speed<160>; + turn rkneef to x-axis <15> speed<145>; + turn rshinf to x-axis <-60> speed<250>; + turn rfootf to x-axis <30> speed<145>; + + turn lthighf to x-axis <40> speed<145>; + turn lkneef to x-axis <-35> speed<145>; + turn lshinf to x-axis <-40> speed<145>; + turn lfootf to x-axis <35> speed<145>; + + turn rthighb to x-axis <-10> speed<160>; + turn rkneeb to x-axis <15> speed<145>; + turn rshinb to x-axis <-60> speed<250>; + turn rfootb to x-axis <30> speed<145>; + + turn lthighb to x-axis <40> speed<145>; + turn lkneeb to x-axis <-35> speed<145>; + turn lshinb to x-axis <-40> speed<145>; + turn lfootb to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshinf around x-axis; + + } + + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + move body to y-axis [0.000000] speed [200.000000]; + turn lfootf to x-axis <0> speed <200>; + turn rfootf to x-axis <0> speed <200>; + turn rthighf to x-axis <0> speed <200>; + turn lthighf to x-axis <0> speed <200>; + turn lshinf to x-axis <0> speed <200>; + turn rshinf to x-axis <0> speed <200>; + turn lkneef to x-axis <0> speed <200>; + turn rkneef to x-axis <0> speed <200>; + turn lfootb to x-axis <0> speed <200>; + turn rfootb to x-axis <0> speed <200>; + turn rthighb to x-axis <0> speed <200>; + turn lthighb to x-axis <0> speed <200>; + turn lshinb to x-axis <0> speed <200>; + turn rshinb to x-axis <0> speed <200>; + turn lkneeb to x-axis <0> speed <200>; + turn rkneeb to x-axis <0> speed <200>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lblade to y-axis <40> speed [1]; + turn rblade to y-axis <-40> speed [1]; + wait-for-turn lblade around y-axis; + turn lblade to y-axis <0> speed [0.3]; + turn rblade to y-axis <0> speed [0.3]; + } + + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zarty.cob b/Scripts/zaal/zarty.cob new file mode 100644 index 000000000..25463e2ae Binary files /dev/null and b/Scripts/zaal/zarty.cob differ diff --git a/Scripts/zaal/zassault.bos b/Scripts/zaal/zassault.bos new file mode 100644 index 000000000..9efdb687b --- /dev/null +++ b/Scripts/zaal/zassault.bos @@ -0,0 +1,250 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lforearml,lbladel,rforearml,rbladel,lforearmu,lbladeu,rforearmu,rbladeu; + +static-var gun_1, aMoving, bMoving, aapitch, aaheading; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<70>; + turn lknee to x-axis <-40> speed<88>; + turn lshin to x-axis <20> speed<88>; + turn lfoot to x-axis <-50> speed<127>; + + turn rthigh to x-axis <-20> speed<127>; + turn rknee to x-axis <-60> speed<127>; + turn rshin to x-axis <50> speed<127>; + turn rfoot to x-axis <30> speed<127>; + + turn body to z-axis <5> speed <20>; + turn lthigh to z-axis <-5> speed <20>; + turn rthigh to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthigh around x-axis; + } + if (aMoving) { + turn lthigh to x-axis <-10> speed<97>; + turn lknee to x-axis <15> speed<88>; + turn lshin to x-axis <-60> speed<151>; + turn lfoot to x-axis <30> speed<88>; + + turn rthigh to x-axis <40> speed<88>; + turn rknee to x-axis <-35> speed<88>; + turn rshin to x-axis <-40> speed<88>; + turn rfoot to x-axis <35> speed<88>; + + move body to y-axis <0> speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshin around x-axis; + } + if (aMoving) { + turn rthigh to x-axis <70> speed<70>; + turn rknee to x-axis <-40> speed<88>; + turn rshin to x-axis <20> speed<88>; + turn rfoot to x-axis <-50> speed<127>; + + turn lthigh to x-axis <-20> speed<127>; + turn lknee to x-axis <-60> speed<127>; + turn lshin to x-axis <50> speed<127>; + turn lfoot to x-axis <30> speed<127>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthigh to z-axis <5> speed <20>; + turn rthigh to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthigh around x-axis; + } + if (aMoving) { + turn rthigh to x-axis <-10> speed<97>; + turn rknee to x-axis <15> speed<88>; + turn rshin to x-axis <-60> speed<151>; + turn rfoot to x-axis <30> speed<88>; + + turn lthigh to x-axis <40> speed<88>; + turn lknee to x-axis <-35> speed<88>; + turn lshin to x-axis <-40> speed<88>; + turn lfoot to x-axis <35> speed<88>; + + + move body to y-axis <0> speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshin around x-axis; + } + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <200>; + turn rfoot to x-axis <0> speed <200>; + turn rthigh to x-axis <0> speed <200>; + turn lthigh to x-axis <0> speed <200>; + turn lshin to x-axis <0> speed <200>; + turn rshin to x-axis <0> speed <200>; + turn lknee to x-axis <0> speed <200>; + turn rknee to x-axis <0> speed <200>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + +Create() +{ + gun_1 = 1; + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +AimFromSecondary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +QuerySecondary(piecenum) + { piecenum=head; } + + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + return(TRUE); + } + +AimSecondary(heading,pitch) + { + aapitch = pitch; + aaheading = heading; + return(TRUE); + } + +Shot1() + { + ++gun_1; + if (gun_1 > 4) + { + gun_1 = 1; + } + if (gun_1 == 1) + { + turn lforearmu to y-axis <-140> speed <600>; + turn lbladeu to y-axis <140> speed <600>; + wait-for-turn lbladeu around y-axis; + turn lforearmu to y-axis <0> speed <120>; + turn lbladeu to y-axis <0> speed <120>; + } + if (gun_1 == 2) + { + turn lforearml to y-axis <-140> speed <600>; + turn lbladel to y-axis <140> speed <600>; + wait-for-turn lbladel around y-axis; + turn lforearml to y-axis <0> speed <120>; + turn lbladel to y-axis <0> speed <120>; + } + if (gun_1 == 3) + { + turn rforearmu to y-axis <140> speed <600>; + turn rbladeu to y-axis <-140> speed <600>; + wait-for-turn rbladeu around y-axis; + turn rforearmu to y-axis <0> speed <120>; + turn rbladeu to y-axis <0> speed <120>; + } + if (gun_1 == 4) + { + turn rforearml to y-axis <140> speed <600>; + turn rbladel to y-axis <-140> speed <600>; + wait-for-turn rbladel around y-axis; + turn rforearml to y-axis <0> speed <120>; + turn rbladel to y-axis <0> speed <120>; + } + } + +Shot2() + { + turn head to x-axis 0 -aapitch speed <400>; + turn head to y-axis aaheading speed <300>; + wait-for-turn head around x-axis; + turn lforearmu to y-axis <-140> speed <600>; + turn lbladeu to y-axis <140> speed <600>; + turn lforearml to y-axis <-140> speed <600>; + turn lbladel to y-axis <140> speed <600>; + turn rforearmu to y-axis <140> speed <600>; + turn rbladeu to y-axis <-140> speed <600>; + turn rforearml to y-axis <140> speed <600>; + turn rbladel to y-axis <-140> speed <600>; + emit-sfx 1024+3 from lforearmu; + emit-sfx 1024+3 from lforearml; + emit-sfx 1024+3 from rforearmu; + emit-sfx 1024+3 from rforearml; + wait-for-turn lbladeu around y-axis; + wait-for-turn lbladel around y-axis; + wait-for-turn rbladeu around y-axis; + wait-for-turn rbladel around y-axis; + turn lforearmu to y-axis <0> speed <120>; + turn lbladeu to y-axis <0> speed <120>; + turn lforearml to y-axis <0> speed <120>; + turn lbladel to y-axis <0> speed <120>; + turn rforearmu to y-axis <0> speed <120>; + turn rbladeu to y-axis <0> speed <120>; + turn rforearml to y-axis <0> speed <120>; + turn rbladel to y-axis <0> speed <120>; + turn head to y-axis 0 speed <120>; + turn head to x-axis 0 speed <120>; + } + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zassault.cob b/Scripts/zaal/zassault.cob new file mode 100644 index 000000000..1fa57561c Binary files /dev/null and b/Scripts/zaal/zassault.cob differ diff --git a/Scripts/zaal/zconstructor.bos b/Scripts/zaal/zconstructor.bos new file mode 100644 index 000000000..ece50a29f --- /dev/null +++ b/Scripts/zaal/zconstructor.bos @@ -0,0 +1,196 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack,nano1; + +static-var aMoving, bMoving, bAiming, bCanAim, shooting_num, base_speed, restore_delay, building; + +// Signal definitions +#define SIG_BUILD 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 +#define SIG_RESTORE 32 + +#include "sfxtype.h" +#include "exptype.h" + + + + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<115>; + turn lknee to x-axis <-40> speed<145>; + turn lshin to x-axis <20> speed<145>; + turn lfoot to x-axis <-50> speed<210>; + + turn rthigh to x-axis <-20> speed<210>; + turn rknee to x-axis <-60> speed<210>; + turn rshin to x-axis <50> speed<210>; + turn rfoot to x-axis <30> speed<210>; + + turn body to z-axis <5> speed <20>; + turn lthigh to z-axis <-5> speed <20>; + turn rthigh to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthigh around x-axis; + } + if (aMoving) { + + turn lthigh to x-axis <-10> speed<160>; + turn lknee to x-axis <15> speed<145>; + turn lshin to x-axis <-60> speed<250>; + turn lfoot to x-axis <30> speed<145>; + + turn rthigh to x-axis <40> speed<145>; + turn rknee to x-axis <-35> speed<145>; + turn rshin to x-axis <-40> speed<145>; + turn rfoot to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshin around x-axis; + emit-sfx 1024 from head; + } + if (aMoving) { + + turn rthigh to x-axis <70> speed<115>; + turn rknee to x-axis <-40> speed<145>; + turn rshin to x-axis <20> speed<145>; + turn rfoot to x-axis <-50> speed<210>; + + turn lthigh to x-axis <-20> speed<210>; + turn lknee to x-axis <-60> speed<210>; + turn lshin to x-axis <50> speed<210>; + turn lfoot to x-axis <30> speed<210>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthigh to z-axis <5> speed <20>; + turn rthigh to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthigh around x-axis; + + } + if (aMoving) { + + turn rthigh to x-axis <-10> speed<160>; + turn rknee to x-axis <15> speed<145>; + turn rshin to x-axis <-60> speed<250>; + turn rfoot to x-axis <30> speed<145>; + + turn lthigh to x-axis <40> speed<145>; + turn lknee to x-axis <-35> speed<145>; + turn lshin to x-axis <-40> speed<145>; + turn lfoot to x-axis <35> speed<145>; + + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshin around x-axis; + emit-sfx 1024 from head; + } + + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <100>; + turn rfoot to x-axis <0> speed <100>; + turn rthigh to x-axis <0> speed <100>; + turn lthigh to x-axis <0> speed <100>; + turn lshin to x-axis <0> speed <100>; + turn rshin to x-axis <0> speed <100>; + turn lfoot to y-axis <0> speed <100>; + turn rfoot to y-axis <0> speed <100>; + turn rthigh to y-axis <0> speed <100>; + turn lthigh to y-axis <0> speed <100>; + turn lshin to y-axis <0> speed <100>; + turn rshin to y-axis <0> speed <100>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + + +Activate() +{ + +} + +Deactivate() +{ + +} + +RestoreAfterDelay() +{ + sleep 1000; + +} + +Create() +{ + start-script RestoreAfterDelay(); +} + +StartBuilding(heading, pitch) +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 1; + building = 1; + while (1) { +// emit-sfx 2048 from nanopoint1; + sleep 30; + } +} + +StopBuilding() +{ + signal SIG_BUILD; + set-signal-mask SIG_BUILD; + set INBUILDSTANCE to 0; + building = 0; +} + +QueryNanoPiece(piecenum) +{ + piecenum = nano1; +} + +SweetSpot(piecenum) + { piecenum=body; } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zconstructor.cob b/Scripts/zaal/zconstructor.cob new file mode 100644 index 000000000..d5a0c70a0 Binary files /dev/null and b/Scripts/zaal/zconstructor.cob differ diff --git a/Scripts/zaal/zespire1.bos b/Scripts/zaal/zespire1.bos new file mode 100644 index 000000000..406924272 --- /dev/null +++ b/Scripts/zaal/zespire1.bos @@ -0,0 +1,43 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + start-script SmokeUnit(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/zaal/zespire1.cob b/Scripts/zaal/zespire1.cob new file mode 100644 index 000000000..d126d83c9 Binary files /dev/null and b/Scripts/zaal/zespire1.cob differ diff --git a/Scripts/zaal/zespire4.bos b/Scripts/zaal/zespire4.bos new file mode 100644 index 000000000..406924272 --- /dev/null +++ b/Scripts/zaal/zespire4.bos @@ -0,0 +1,43 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + start-script SmokeUnit(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/zaal/zespire4.cob b/Scripts/zaal/zespire4.cob new file mode 100644 index 000000000..d126d83c9 Binary files /dev/null and b/Scripts/zaal/zespire4.cob differ diff --git a/Scripts/zaal/zespire5.bos b/Scripts/zaal/zespire5.bos new file mode 100644 index 000000000..406924272 --- /dev/null +++ b/Scripts/zaal/zespire5.bos @@ -0,0 +1,43 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + start-script SmokeUnit(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/zaal/zespire5.cob b/Scripts/zaal/zespire5.cob new file mode 100644 index 000000000..d126d83c9 Binary files /dev/null and b/Scripts/zaal/zespire5.cob differ diff --git a/Scripts/zaal/zfactory.bos b/Scripts/zaal/zfactory.bos new file mode 100644 index 000000000..633808cab --- /dev/null +++ b/Scripts/zaal/zfactory.bos @@ -0,0 +1,143 @@ + +#include "sfxtype.h" +#include "exptype.h" + +piece base, nano1, nano2, nano3, nano4; + +static-var Maya, building, spray; + +// Signal definitions (they must be distincts power of 2) +#define SIG_ACTIVATE 2 +#define SIG_BUILDING 4 + +SmokeUnit() +{ + var healthpercent, sleeptime, smoketype; + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = SFXTYPE_BLACKSMOKE; + if( Rand( 1, 66 ) < healthpercent ) + smoketype = SFXTYPE_WHITESMOKE; + emit-sfx 1025 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + sleeptime = 200; + sleep sleeptime; + } +} + + + +Create() +{ + spray = 0; + while( get BUILD_PERCENT_LEFT ) + sleep 400; + start-script SmokeUnit(); +} + + +QueryNanoPiece(piecenum) +{ + if( spray == 0 ) + { + piecenum = nano1; + } + if( spray == 1 ) + { + piecenum = nano2; + } + if( spray == 2 ) + { + piecenum = nano3; + } + if( spray == 3 ) + { + piecenum = nano4; + } + ++spray; + if( spray >= 4 ) + { + spray = 0; + } +} + +Activate() +{ + // Kill any other Activate or Deactivate: + signal SIG_ACTIVATE; + // Flag self so it can be killed: + set-signal-mask SIG_ACTIVATE; + // Local variables + // Open animation: + // Try to open the yard + set YARD_OPEN to TRUE; + // If yard not open, tell units around to bugger off until yard is open + while( !get YARD_OPEN ) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to TRUE; + } + set BUGGER_OFF to FALSE; + // Now yard is open. + // Allow the nano to flow: + set INBUILDSTANCE to TRUE; + // Send wheel spinning: + // The idle but activated animation +} + +Deactivate() +{ + // Kill any other Activate or Deactivate: + signal SIG_ACTIVATE; + // Flag self so it can be killed: + set-signal-mask SIG_ACTIVATE; + // Switch off the nano faucet: + set INBUILDSTANCE to FALSE; + // Stop wheel spinning + // Try to close the yard + set YARD_OPEN to FALSE; + // If yard not closed, tell units around to bugger off until yard is closed + while( get YARD_OPEN ) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to FALSE; + } + set BUGGER_OFF to FALSE; + // Now yard is closed. + // Close animation: +} + +StartBuilding() +{ + signal SIG_BUILDING; // Kill any other StartBuilding + set-signal-mask SIG_BUILDING; // Be killable + building = 1; + while(TRUE) + { + sleep 600; + } +} + +StopBuilding() +{ + signal SIG_BUILDING; // Kill StartBuilding + building = 0; +} + +QueryBuildInfo(piecenum) +{ + piecenum = base; +} + + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} \ No newline at end of file diff --git a/Scripts/zaal/zfactory.cob b/Scripts/zaal/zfactory.cob new file mode 100644 index 000000000..848092d56 Binary files /dev/null and b/Scripts/zaal/zfactory.cob differ diff --git a/Scripts/zaal/zhive.bos b/Scripts/zaal/zhive.bos new file mode 100644 index 000000000..5b25590e8 --- /dev/null +++ b/Scripts/zaal/zhive.bos @@ -0,0 +1,136 @@ + +#include "sfxtype.h" +#include "exptype.h" + +piece base, nanopoint1, nanopoint2, mouth; + +static-var Maya, building, spray; + +// Signal definitions (they must be distincts power of 2) +#define SIG_ACTIVATE 2 +#define SIG_BUILDING 4 + +SmokeUnit() +{ + var healthpercent, sleeptime, smoketype; + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = SFXTYPE_BLACKSMOKE; + if( Rand( 1, 66 ) < healthpercent ) + smoketype = SFXTYPE_WHITESMOKE; + emit-sfx 1025 from mouth; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + sleeptime = 200; + sleep sleeptime; + } +} + + +buildingfx() +{ + while( TRUE ) + { + if (building) + { + emit-sfx 1024 from mouth; + } + sleep 300; + } +} + +Create() +{ + spray = 0; + while( get BUILD_PERCENT_LEFT ) + sleep 400; + start-script SmokeUnit(); + start-script Buildingfx(); +} + + +QueryNanoPiece(piecenum) +{ + piecenum = nanopoint2; +} + +Activate() +{ + // Kill any other Activate or Deactivate: + signal SIG_ACTIVATE; + // Flag self so it can be killed: + set-signal-mask SIG_ACTIVATE; + // Local variables + // Open animation: + // Try to open the yard + set YARD_OPEN to TRUE; + // If yard not open, tell units around to bugger off until yard is open + while( !get YARD_OPEN ) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to TRUE; + } + set BUGGER_OFF to FALSE; + // Now yard is open. + // Allow the nano to flow: + set INBUILDSTANCE to TRUE; + // Send wheel spinning: + // The idle but activated animation +} + +Deactivate() +{ + // Kill any other Activate or Deactivate: + signal SIG_ACTIVATE; + // Flag self so it can be killed: + set-signal-mask SIG_ACTIVATE; + // Switch off the nano faucet: + set INBUILDSTANCE to FALSE; + // Stop wheel spinning + // Try to close the yard + set YARD_OPEN to FALSE; + // If yard not closed, tell units around to bugger off until yard is closed + while( get YARD_OPEN ) + { + set BUGGER_OFF to TRUE; + sleep 1500; + set YARD_OPEN to FALSE; + } + set BUGGER_OFF to FALSE; + // Now yard is closed. + // Close animation: +} + +StartBuilding() +{ + signal SIG_BUILDING; // Kill any other StartBuilding + set-signal-mask SIG_BUILDING; // Be killable + building = 1; + while(TRUE) + { + emit-sfx 1024 from nanopoint2; + sleep 600; + } +} + +StopBuilding() +{ + signal SIG_BUILDING; // Kill StartBuilding + building = 0; +} + +QueryBuildInfo(piecenum) +{ + piecenum = nanopoint1; +} + + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} \ No newline at end of file diff --git a/Scripts/zaal/zhive.cob b/Scripts/zaal/zhive.cob new file mode 100644 index 000000000..258caf262 Binary files /dev/null and b/Scripts/zaal/zhive.cob differ diff --git a/Scripts/zaal/zkamikaze.bos b/Scripts/zaal/zkamikaze.bos new file mode 100644 index 000000000..7da71aa81 --- /dev/null +++ b/Scripts/zaal/zkamikaze.bos @@ -0,0 +1,238 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack; + +static-var aMoving, bMoving, bAiming, bCanAim, shooting_num, base_speed, restore_delay; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 +#define SIG_RESTORE 32 + +#include "sfxtype.h" +#include "exptype.h" + + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<115>; + turn lknee to x-axis <-40> speed<145>; + turn lshin to x-axis <20> speed<145>; + turn lfoot to x-axis <-50> speed<210>; + + turn rthigh to x-axis <-20> speed<210>; + turn rknee to x-axis <-60> speed<210>; + turn rshin to x-axis <50> speed<210>; + turn rfoot to x-axis <30> speed<210>; + + turn body to z-axis <5> speed <20>; + turn lthigh to z-axis <-5> speed <20>; + turn rthigh to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthigh around x-axis; + } + if (aMoving) { + + turn lthigh to x-axis <-10> speed<160>; + turn lknee to x-axis <15> speed<145>; + turn lshin to x-axis <-60> speed<250>; + turn lfoot to x-axis <30> speed<145>; + + turn rthigh to x-axis <40> speed<145>; + turn rknee to x-axis <-35> speed<145>; + turn rshin to x-axis <-40> speed<145>; + turn rfoot to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshin around x-axis; + emit-sfx 1024 from head; + } + if (aMoving) { + + turn rthigh to x-axis <70> speed<115>; + turn rknee to x-axis <-40> speed<145>; + turn rshin to x-axis <20> speed<145>; + turn rfoot to x-axis <-50> speed<210>; + + turn lthigh to x-axis <-20> speed<210>; + turn lknee to x-axis <-60> speed<210>; + turn lshin to x-axis <50> speed<210>; + turn lfoot to x-axis <30> speed<210>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthigh to z-axis <5> speed <20>; + turn rthigh to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthigh around x-axis; + + } + if (aMoving) { + + turn rthigh to x-axis <-10> speed<160>; + turn rknee to x-axis <15> speed<145>; + turn rshin to x-axis <-60> speed<250>; + turn rfoot to x-axis <30> speed<145>; + + turn lthigh to x-axis <40> speed<145>; + turn lknee to x-axis <-35> speed<145>; + turn lshin to x-axis <-40> speed<145>; + turn lfoot to x-axis <35> speed<145>; + + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshin around x-axis; + emit-sfx 1024 from head; + } + + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <100>; + turn rfoot to x-axis <0> speed <100>; + turn rthigh to x-axis <0> speed <100>; + turn lthigh to x-axis <0> speed <100>; + turn lshin to x-axis <0> speed <100>; + turn rshin to x-axis <0> speed <100>; + turn lfoot to y-axis <0> speed <100>; + turn rfoot to y-axis <0> speed <100>; + turn rthigh to y-axis <0> speed <100>; + turn lthigh to y-axis <0> speed <100>; + turn lshin to y-axis <0> speed <100>; + turn rshin to y-axis <0> speed <100>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + + +Activate() +{ + +} + +Deactivate() +{ + +} + +RestoreAfterDelay() +{ + sleep 1000; + +} + +Create() +{ + emit-sfx 1024+2 from body; + + start-script RestoreAfterDelay(); +} + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +AimFromSecondary(piecenum) + { piecenum=head; } + +QuerySecondary(piecenum) + { piecenum=head; } + + +AimPrimary(heading,pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + while( 255 > heading ) + { + set UNKNOWN_UNIT_VALUE(82) to 0 - 1000 + get UNKNOWN_UNIT_VALUE(82); + heading = heading + 1000; + sleep 1; + } + while( heading > 255 ) + { + set UNKNOWN_UNIT_VALUE(82) to 1000 + get UNKNOWN_UNIT_VALUE(82); + heading = heading - 1000; + sleep 1; + } + return (1); +} + +AimSecondary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <175>; + turn head to x-axis 0 -pitch speed <175>; + wait-for-turn head around y-axis; + wait-for-turn head around x-axis; + return(1); + } + +Shot2() + { + turn lsack to y-axis <30> speed <200>; + turn rsack to y-axis <-30> speed <200>; + move rsack to x-axis [-1] speed [9]; + move lsack to x-axis [1] speed [9];; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed <20>; + turn rsack to y-axis <0> speed <20>; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + } + +SweetSpot(piecenum) + { piecenum=body; } + +HitByWeaponId() + { + emit-sfx 1024+1 from head; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1024+2 from head; + explode head type FALL | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + explode lthigh type FALL | NOHEATCLOUD; + explode rthigh type FALL | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zkamikaze.cob b/Scripts/zaal/zkamikaze.cob new file mode 100644 index 000000000..6adf136bf Binary files /dev/null and b/Scripts/zaal/zkamikaze.cob differ diff --git a/Scripts/zaal/zlightswarm.bos b/Scripts/zaal/zlightswarm.bos new file mode 100644 index 000000000..10e57c76b --- /dev/null +++ b/Scripts/zaal/zlightswarm.bos @@ -0,0 +1,186 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lforearm,lupperarm,lblade,rforearm,rupperarm,rblade; + +static-var aMoving, bMoving, lasthit; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<230>; + turn lknee to x-axis <-40> speed<270>; + turn lshin to x-axis <20> speed<270>; + turn lfoot to x-axis <-50> speed<420>; + + turn rthigh to x-axis <-20> speed<420>; + turn rknee to x-axis <-60> speed<420>; + turn rshin to x-axis <50> speed<420>; + turn rfoot to x-axis <30> speed<420>; + + turn body to z-axis <5> speed <40>; + turn lthigh to z-axis <-5> speed <40>; + turn rthigh to z-axis <-5> speed <40>; + move body to y-axis [0.7] speed <8000>; + turn tail to y-axis <10> speed <80>; + turn head to x-axis <-10> speed <40>; + turn tail to x-axis <10> speed <40>; + wait-for-turn lthigh around x-axis; + } + if (aMoving) { + turn lthigh to x-axis <-10> speed<320>; + turn lknee to x-axis <15> speed<270>; + turn lshin to x-axis <-60> speed<500>; + turn lfoot to x-axis <30> speed<270>; + + turn rthigh to x-axis <40> speed<270>; + turn rknee to x-axis <-35> speed<270>; + turn rshin to x-axis <-40> speed<270>; + turn rfoot to x-axis <35> speed<270>; + + move body to y-axis <0> speed <8000>; + turn head to x-axis <10> speed <40>; + turn tail to x-axis <-10> speed <40>; + wait-for-turn lshin around x-axis; + } + if (aMoving) { + turn rthigh to x-axis <70> speed<230>; + turn rknee to x-axis <-40> speed<270>; + turn rshin to x-axis <20> speed<270>; + turn rfoot to x-axis <-50> speed<420>; + + turn lthigh to x-axis <-20> speed<420>; + turn lknee to x-axis <-60> speed<420>; + turn lshin to x-axis <50> speed<420>; + turn lfoot to x-axis <30> speed<420>; + + turn tail to y-axis <-10> speed <80>; + turn body to z-axis <-5> speed <40>; + turn lthigh to z-axis <5> speed <40>; + turn rthigh to z-axis <5> speed <40>; + move body to y-axis [0.7] speed <8000>; + turn head to x-axis <-10> speed <40>; + turn tail to x-axis <10> speed <40>; + wait-for-turn rthigh around x-axis; + } + if (aMoving) { + turn rthigh to x-axis <-10> speed<320>; + turn rknee to x-axis <15> speed<270>; + turn rshin to x-axis <-60> speed<500>; + turn rfoot to x-axis <30> speed<270>; + + turn lthigh to x-axis <40> speed<270>; + turn lknee to x-axis <-35> speed<270>; + turn lshin to x-axis <-40> speed<270>; + turn lfoot to x-axis <35> speed<270>; + + + move body to y-axis <0> speed <8000>; + turn head to x-axis <10> speed <40>; + turn tail to x-axis <-10> speed <40>; + wait-for-turn rshin around x-axis; + } + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <200>; + turn rfoot to x-axis <0> speed <200>; + turn rthigh to x-axis <0> speed <200>; + turn lthigh to x-axis <0> speed <200>; + turn lshin to x-axis <0> speed <200>; + turn rshin to x-axis <0> speed <200>; + turn lknee to x-axis <0> speed <200>; + turn rknee to x-axis <0> speed <200>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + +HitByWeaponId() +{ + return 100; +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lforearm to y-axis <-140> speed <600>; + turn rforearm to y-axis <140> speed <600>; + turn lblade to y-axis <140> speed <600>; + turn rblade to y-axis <-140> speed <600>; + wait-for-turn rblade around y-axis; + turn lforearm to y-axis <0> speed <120>; + turn rforearm to y-axis <0> speed <120>; + turn lblade to y-axis <0> speed <120>; + turn rblade to y-axis <0> speed <120>; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + explode head type FALL; + explode tail type FALL; + explode lblade type FALL; + explode rblade type FALL; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zlightswarm.cob b/Scripts/zaal/zlightswarm.cob new file mode 100644 index 000000000..5210f6130 Binary files /dev/null and b/Scripts/zaal/zlightswarm.cob differ diff --git a/Scripts/zaal/zmedswarm.bos b/Scripts/zaal/zmedswarm.bos new file mode 100644 index 000000000..ba681560b --- /dev/null +++ b/Scripts/zaal/zmedswarm.bos @@ -0,0 +1,182 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece body, head, tail, lthigh, lknee, lshin, lfoot, rthigh, + rknee, rshin, rfoot, lforearm, lupperarm, lblade, rforearm, rupperarm, + rblade; + +static-var bMoving, Static_Var_2, Static_Var_3; + +// Signal definitions +#define SIG_AIM 2 + + +walk() +{ + while( bMoving ) + { + Static_Var_2 = 1; + if( bMoving ) + { + turn lthigh to x-axis <70.000000> speed <230.000000>; + turn lknee to x-axis <-40.000000> speed <270.000000>; + turn lshin to x-axis <20.000000> speed <270.000000>; + turn lfoot to x-axis <-50.000000> speed <420.000000>; + turn rthigh to x-axis <-20.000000> speed <420.000000>; + turn rknee to x-axis <-60.000000> speed <420.000000>; + turn rshin to x-axis <50.000000> speed <420.000000>; + turn rfoot to x-axis <30.000000> speed <420.000000>; + turn body to z-axis <5.000000> speed <40.000000>; + turn lthigh to z-axis <-5.000000> speed <40.000000>; + turn rthigh to z-axis <-5.000000> speed <40.000000>; + move body to y-axis [0.700000] speed [8.886719]; + turn tail to y-axis <10.000000> speed <80.000000>; + turn head to x-axis <-10.000000> speed <40.000000>; + turn tail to x-axis <10.000000> speed <40.000000>; + wait-for-turn lthigh around x-axis; + } + if( bMoving ) + { + turn lthigh to x-axis <-10.000000> speed <320.000000>; + turn lknee to x-axis <15.000000> speed <270.000000>; + turn lshin to x-axis <-60.000000> speed <500.000000>; + turn lfoot to x-axis <30.000000> speed <270.000000>; + turn rthigh to x-axis <40.000000> speed <270.000000>; + turn rknee to x-axis <-35.000000> speed <270.000000>; + turn rshin to x-axis <-40.000000> speed <270.000000>; + turn rfoot to x-axis <35.000000> speed <270.000000>; + move body to y-axis [0.000000] speed [8.886719]; + turn head to x-axis <10.000000> speed <40.000000>; + turn tail to x-axis <-10.000000> speed <40.000000>; + wait-for-turn lshin around x-axis; + } + if( bMoving ) + { + turn rthigh to x-axis <70.000000> speed <230.000000>; + turn rknee to x-axis <-40.000000> speed <270.000000>; + turn rshin to x-axis <20.000000> speed <270.000000>; + turn rfoot to x-axis <-50.000000> speed <420.000000>; + turn lthigh to x-axis <-20.000000> speed <420.000000>; + turn lknee to x-axis <-60.000000> speed <420.000000>; + turn lshin to x-axis <50.000000> speed <420.000000>; + turn lfoot to x-axis <30.000000> speed <420.000000>; + turn tail to y-axis <-10.000000> speed <80.000000>; + turn body to z-axis <-5.000000> speed <40.000000>; + turn lthigh to z-axis <5.000000> speed <40.000000>; + turn rthigh to z-axis <5.000000> speed <40.000000>; + move body to y-axis [0.700000] speed [8.886719]; + turn head to x-axis <-10.000000> speed <40.000000>; + turn tail to x-axis <10.000000> speed <40.000000>; + wait-for-turn rthigh around x-axis; + } + if( bMoving ) + { + turn rthigh to x-axis <-10.000000> speed <320.000000>; + turn rknee to x-axis <15.000000> speed <270.000000>; + turn rshin to x-axis <-60.000000> speed <500.000000>; + turn rfoot to x-axis <30.000000> speed <270.000000>; + turn lthigh to x-axis <40.000000> speed <270.000000>; + turn lknee to x-axis <-35.000000> speed <270.000000>; + turn lshin to x-axis <-40.000000> speed <270.000000>; + turn lfoot to x-axis <35.000000> speed <270.000000>; + move body to y-axis [0.000000] speed [8.886719]; + turn head to x-axis <10.000000> speed <40.000000>; + turn tail to x-axis <-10.000000> speed <40.000000>; + wait-for-turn rshin around x-axis; + } + } +} + +Halt() +{ + sleep 150; + if( !bMoving ) + { + Static_Var_2 = 0; + turn lfoot to x-axis <0.000000> speed <200.000000>; + turn rfoot to x-axis <0.000000> speed <200.000000>; + turn rthigh to x-axis <0.000000> speed <200.000000>; + turn lthigh to x-axis <0.000000> speed <200.000000>; + turn lshin to x-axis <0.000000> speed <200.000000>; + turn rshin to x-axis <0.000000> speed <200.000000>; + turn lknee to x-axis <0.000000> speed <200.000000>; + turn rknee to x-axis <0.000000> speed <200.000000>; + } +} + +StartMoving() +{ + bMoving = TRUE; + if( !Static_Var_2 ) + { + start-script walk(); + } +} + +StopMoving() +{ + bMoving = FALSE; + start-script Halt(); +} + +HitByWeaponId() +{ + return (100); +} + +Create() +{ + emit-sfx 1024 + 2 from body; +} + +SweetSpot(piecenum) +{ + piecenum = body; +} + +AimFromPrimary(piecenum) +{ + piecenum = head; +} + +QueryPrimary(piecenum) +{ + piecenum = head; +} + +RestoreAfterDelay() +{ + sleep 1000; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis <0.000000> - pitch speed <5000>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + return (1); +} + +Shot1() +{ + turn lforearm to y-axis <-140.000000> speed <700.000000>; + turn rforearm to y-axis <140.000000> speed <700.000000>; + turn lblade to y-axis <140.000000> speed <700.000000>; + turn rblade to y-axis <-140.000000> speed <700.000000>; + wait-for-turn rblade around y-axis; + turn lforearm to y-axis <0.000000> speed <400.000000>; + turn rforearm to y-axis <0.000000> speed <400.000000>; + turn lblade to y-axis <0.000000> speed <400.000000>; + turn rblade to y-axis <0.000000> speed <400.000000>; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + emit-sfx 1025 from body; +} diff --git a/Scripts/zaal/zmedswarm.cob b/Scripts/zaal/zmedswarm.cob new file mode 100644 index 000000000..38c302ee6 Binary files /dev/null and b/Scripts/zaal/zmedswarm.cob differ diff --git a/Scripts/zaal/zmex.bos b/Scripts/zaal/zmex.bos new file mode 100644 index 000000000..811851b82 --- /dev/null +++ b/Scripts/zaal/zmex.bos @@ -0,0 +1,63 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, mouth; + +static-var none; + + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +fx() +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { +// if (tech) +// { + emit-sfx 1024 from mouth; +// } + sleep 500; + } +} + +Create() +{ + start-script SmokeUnit(); + start-script fx(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/zaal/zmex.cob b/Scripts/zaal/zmex.cob new file mode 100644 index 000000000..136e2a16c Binary files /dev/null and b/Scripts/zaal/zmex.cob differ diff --git a/Scripts/zaal/zpyro.bos b/Scripts/zaal/zpyro.bos new file mode 100644 index 000000000..bd7e02fcb --- /dev/null +++ b/Scripts/zaal/zpyro.bos @@ -0,0 +1,235 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack; + +static-var aMoving, bMoving, bAiming, bCanAim, shooting_num, base_speed, restore_delay; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 +#define SIG_RESTORE 32 + +#include "sfxtype.h" +#include "exptype.h" + + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<115>; + turn lknee to x-axis <-40> speed<145>; + turn lshin to x-axis <20> speed<145>; + turn lfoot to x-axis <-50> speed<210>; + + turn rthigh to x-axis <-20> speed<210>; + turn rknee to x-axis <-60> speed<210>; + turn rshin to x-axis <50> speed<210>; + turn rfoot to x-axis <30> speed<210>; + + turn body to z-axis <5> speed <20>; + turn lthigh to z-axis <-5> speed <20>; + turn rthigh to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthigh around x-axis; + } + if (aMoving) { + + turn lthigh to x-axis <-10> speed<160>; + turn lknee to x-axis <15> speed<145>; + turn lshin to x-axis <-60> speed<250>; + turn lfoot to x-axis <30> speed<145>; + + turn rthigh to x-axis <40> speed<145>; + turn rknee to x-axis <-35> speed<145>; + turn rshin to x-axis <-40> speed<145>; + turn rfoot to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshin around x-axis;} + if (aMoving) { + + turn rthigh to x-axis <70> speed<115>; + turn rknee to x-axis <-40> speed<145>; + turn rshin to x-axis <20> speed<145>; + turn rfoot to x-axis <-50> speed<210>; + + turn lthigh to x-axis <-20> speed<210>; + turn lknee to x-axis <-60> speed<210>; + turn lshin to x-axis <50> speed<210>; + turn lfoot to x-axis <30> speed<210>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthigh to z-axis <5> speed <20>; + turn rthigh to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthigh around x-axis;} + if (aMoving) { + + turn rthigh to x-axis <-10> speed<160>; + turn rknee to x-axis <15> speed<145>; + turn rshin to x-axis <-60> speed<250>; + turn rfoot to x-axis <30> speed<145>; + + turn lthigh to x-axis <40> speed<145>; + turn lknee to x-axis <-35> speed<145>; + turn lshin to x-axis <-40> speed<145>; + turn lfoot to x-axis <35> speed<145>; + + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshin around x-axis; + + } + + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <100>; + turn rfoot to x-axis <0> speed <100>; + turn rthigh to x-axis <0> speed <100>; + turn lthigh to x-axis <0> speed <100>; + turn lshin to x-axis <0> speed <100>; + turn rshin to x-axis <0> speed <100>; + turn lfoot to y-axis <0> speed <100>; + turn rfoot to y-axis <0> speed <100>; + turn rthigh to y-axis <0> speed <100>; + turn lthigh to y-axis <0> speed <100>; + turn lshin to y-axis <0> speed <100>; + turn rshin to y-axis <0> speed <100>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + + +Activate() +{ + +} + +Deactivate() +{ + +} + +RestoreAfterDelay() +{ + sleep 1000; + +} + +Create() +{ + emit-sfx 1024+2 from body; + + start-script RestoreAfterDelay(); +} + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +AimFromSecondary(piecenum) + { piecenum=head; } + +QuerySecondary(piecenum) + { piecenum=head; } + + +AimPrimary(heading,pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + while( 255 > heading ) + { + set UNKNOWN_UNIT_VALUE(82) to 0 - 1000 + get UNKNOWN_UNIT_VALUE(82); + heading = heading + 1000; + sleep 1; + } + while( heading > 255 ) + { + set UNKNOWN_UNIT_VALUE(82) to 1000 + get UNKNOWN_UNIT_VALUE(82); + heading = heading - 1000; + sleep 1; + } + return (1); +} + +AimSecondary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + wait-for-turn head around y-axis; + wait-for-turn head around x-axis; + return(1); + } + +Shot2() + { + turn lsack to y-axis <30> speed <200>; + turn rsack to y-axis <-30> speed <200>; + move rsack to x-axis [-1] speed [9]; + move lsack to x-axis [1] speed [9];; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed <20>; + turn rsack to y-axis <0> speed <20>; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + emit-sfx 1027 from head; + } + +SweetSpot(piecenum) + { piecenum=body; } + +HitByWeaponId() + { + emit-sfx 1024 from head; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from head; + explode head type EXPLODE_ON_HIT; + explode tail type EXPLODE_ON_HIT; + explode lthigh type EXPLODE_ON_HIT; + explode rthigh type EXPLODE_ON_HIT; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zpyro.cob b/Scripts/zaal/zpyro.cob new file mode 100644 index 000000000..0cf174b1e Binary files /dev/null and b/Scripts/zaal/zpyro.cob differ diff --git a/Scripts/zaal/zqueen.bos b/Scripts/zaal/zqueen.bos new file mode 100644 index 000000000..37008dfcb --- /dev/null +++ b/Scripts/zaal/zqueen.bos @@ -0,0 +1,417 @@ +piece body,head,tail,lthighf,lkneef,lshinf,lfootf,rthighf,rkneef,rshinf,rfootf,lthighb,lkneeb,lshinb,lfootb,rthighb,rkneeb,rshinb,rfootb,lforearml,lbladel,rforearml,rbladel,lforearmu,lbladeu,rforearmu,rbladeu,spike1,spike2,spike3,firepoint; + +static-var aMoving, bMoving, gun_1, shot5pitch, shot5heading; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 +#define CHANGE_TARGET 98 + +#include "sfxtype.h" +#include "exptype.h" + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthighf to x-axis <70> speed<115>; + turn lkneef to x-axis <-40> speed<145>; + turn lshinf to x-axis <20> speed<145>; + turn lfootf to x-axis <-50> speed<210>; + + turn rthighf to x-axis <-20> speed<210>; + turn rkneef to x-axis <-60> speed<210>; + turn rshinf to x-axis <50> speed<210>; + turn rfootf to x-axis <30> speed<210>; + + turn rthighb to x-axis <70> speed<115>; + turn rkneeb to x-axis <-40> speed<145>; + turn rshinb to x-axis <20> speed<145>; + turn rfootb to x-axis <-50> speed<210>; + + turn lthighb to x-axis <-20> speed<210>; + turn lkneeb to x-axis <-60> speed<210>; + turn lshinb to x-axis <50> speed<210>; + turn lfootb to x-axis <30> speed<210>; + + turn body to z-axis <5> speed <20>; + turn lthighf to z-axis <-5> speed <20>; + turn rthighf to z-axis <-5> speed <20>; + turn lthighb to z-axis <-5> speed <20>; + turn rthighb to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthighf around x-axis;} + + if (aMoving) { + turn lthighf to x-axis <-10> speed<160>; + turn lkneef to x-axis <15> speed<145>; + turn lshinf to x-axis <-60> speed<250>; + turn lfootf to x-axis <30> speed<145>; + + turn rthighf to x-axis <40> speed<145>; + turn rkneef to x-axis <-35> speed<145>; + turn rshinf to x-axis <-40> speed<145>; + turn rfootf to x-axis <35> speed<145>; + + turn rthighb to x-axis <-10> speed<160>; + turn rkneeb to x-axis <15> speed<145>; + turn rshinb to x-axis <-60> speed<250>; + turn rfootb to x-axis <30> speed<145>; + + turn lthighb to x-axis <40> speed<145>; + turn lkneeb to x-axis <-35> speed<145>; + turn lshinb to x-axis <-40> speed<145>; + turn lfootb to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshinf around x-axis;} + if (aMoving) { + + turn rthighf to x-axis <70> speed<115>; + turn rkneef to x-axis <-40> speed<145>; + turn rshinf to x-axis <20> speed<145>; + turn rfootf to x-axis <-50> speed<210>; + + turn lthighf to x-axis <-20> speed<210>; + turn lkneef to x-axis <-60> speed<210>; + turn lshinf to x-axis <50> speed<210>; + turn lfootf to x-axis <30> speed<210>; + + turn lthighb to x-axis <70> speed<115>; + turn lkneeb to x-axis <-40> speed<145>; + turn lshinb to x-axis <20> speed<145>; + turn lfootb to x-axis <-50> speed<210>; + + turn rthighb to x-axis <-20> speed<210>; + turn rkneeb to x-axis <-60> speed<210>; + turn rshinb to x-axis <50> speed<210>; + turn rfootb to x-axis <30> speed<210>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthighf to z-axis <5> speed <20>; + turn rthighf to z-axis <5> speed <20>; + turn lthighb to z-axis <5> speed <20>; + turn rthighb to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthighf around x-axis;} + if (aMoving) { + + turn rthighf to x-axis <-10> speed<160>; + turn rkneef to x-axis <15> speed<145>; + turn rshinf to x-axis <-60> speed<250>; + turn rfootf to x-axis <30> speed<145>; + + turn lthighf to x-axis <40> speed<145>; + turn lkneef to x-axis <-35> speed<145>; + turn lshinf to x-axis <-40> speed<145>; + turn lfootf to x-axis <35> speed<145>; + + turn lthighb to x-axis <-10> speed<160>; + turn lkneeb to x-axis <15> speed<145>; + turn lshinb to x-axis <-60> speed<250>; + turn lfootb to x-axis <30> speed<145>; + + turn rthighb to x-axis <40> speed<145>; + turn rkneeb to x-axis <-35> speed<145>; + turn rshinb to x-axis <-40> speed<145>; + turn rfootb to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshinf around x-axis; + + } + + } + + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfootf to x-axis <0> speed <200>; + turn rfootf to x-axis <0> speed <200>; + turn rthighf to x-axis <0> speed <200>; + turn lthighf to x-axis <0> speed <200>; + turn lshinf to x-axis <0> speed <200>; + turn rshinf to x-axis <0> speed <200>; + turn lkneef to x-axis <0> speed <200>; + turn rkneef to x-axis <0> speed <200>; + turn lfootb to x-axis <0> speed <200>; + turn rfootb to x-axis <0> speed <200>; + turn rthighb to x-axis <0> speed <200>; + turn lthighb to x-axis <0> speed <200>; + turn lshinb to x-axis <0> speed <200>; + turn rshinb to x-axis <0> speed <200>; + turn lkneeb to x-axis <0> speed <200>; + turn rkneeb to x-axis <0> speed <200>; + } +} + + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + + +Create() +{ + emit-sfx 1026 from body; + emit-sfx 1026 from head; + emit-sfx 1026 from tail; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=firepoint; } + +QueryPrimary(piecenum) + { piecenum=firepoint; } + +AimFromWeapon2(piecenum) + { piecenum=spike1; } + +QueryWeapon2(piecenum) + { piecenum=spike1; } + +AimFromWeapon3(piecenum) + { piecenum=spike2; } + +QueryWeapon3(piecenum) + { piecenum=spike2; } + +AimFromWeapon4(piecenum) + { piecenum=spike3; } + +QueryWeapon4(piecenum) + { piecenum=spike3; } + +AimFromWeapon5(piecenum) + { piecenum=firepoint; } + +QueryWeapon5(piecenum) + { piecenum=firepoint; } + + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <350>; + turn head to x-axis 0 -pitch speed <300>; + + wait-for-turn head around y-axis; + + return(TRUE); + } + +AimWeapon2() + { + return(TRUE); + } + +AimWeapon3() + { + return(TRUE); + } + +AimWeapon4() + { + return(TRUE); + } + +AimWeapon5(heading,pitch) + { + shot5pitch = pitch; + shot5heading = heading; + return(TRUE); + } + + +Shot1() + { + ++gun_1; + if (gun_1 > 4) + { + gun_1 = 1; + } + if (gun_1 == 1) + { + turn lforearmu to y-axis <-140> speed <600>; + turn lbladeu to y-axis <140> speed <600>; + wait-for-turn lbladeu around y-axis; + turn lforearmu to y-axis <0> speed <120>; + turn lbladeu to y-axis <0> speed <120>; + } + if (gun_1 == 2) + { + turn lforearml to y-axis <-140> speed <600>; + turn lbladel to y-axis <140> speed <600>; + wait-for-turn lbladel around y-axis; + turn lforearml to y-axis <0> speed <120>; + turn lbladel to y-axis <0> speed <120>; + } + if (gun_1 == 3) + { + turn rforearmu to y-axis <140> speed <600>; + turn rbladeu to y-axis <-140> speed <600>; + wait-for-turn rbladeu around y-axis; + turn rforearmu to y-axis <0> speed <120>; + turn rbladeu to y-axis <0> speed <120>; + } + if (gun_1 == 4) + { + turn rforearml to y-axis <140> speed <600>; + turn rbladel to y-axis <-140> speed <600>; + wait-for-turn rbladel around y-axis; + turn rforearml to y-axis <0> speed <120>; + turn rbladel to y-axis <0> speed <120>; + } + } + + +Shot2() +{ + set CHANGE_TARGET to 2; +} + +Shot3() +{ + set CHANGE_TARGET to 3; +} + +Shot4() +{ +set CHANGE_TARGET to 4; +} + +Shot5() +{ + turn head to x-axis 0 -shot5pitch speed <400>; + turn head to y-axis shot5heading speed <300>; + wait-for-turn head around x-axis; + turn lforearmu to y-axis <-140> speed <600>; + turn lbladeu to y-axis <140> speed <600>; + turn lforearml to y-axis <-140> speed <600>; + turn lbladel to y-axis <140> speed <600>; + turn rforearmu to y-axis <140> speed <600>; + turn rbladeu to y-axis <-140> speed <600>; + turn rforearml to y-axis <140> speed <600>; + turn rbladel to y-axis <-140> speed <600>; + wait-for-turn lbladeu around y-axis; + wait-for-turn lbladel around y-axis; + wait-for-turn rbladeu around y-axis; + wait-for-turn rbladel around y-axis; + turn lforearmu to y-axis <0> speed <120>; + turn lbladeu to y-axis <0> speed <120>; + turn lforearml to y-axis <0> speed <120>; + turn lbladel to y-axis <0> speed <120>; + turn rforearmu to y-axis <0> speed <120>; + turn rbladeu to y-axis <0> speed <120>; + turn rforearml to y-axis <0> speed <120>; + turn rbladel to y-axis <0> speed <120>; +} + + +HitByWeaponId(z,x,weapon_id,shot_power) + { + if (weapon_id == 51) + { + emit-sfx 1025 from head; + emit-sfx 1025 from body; + emit-sfx 1024 from rthighf; + emit-sfx 1025 from rthighb; + emit-sfx 1024 from lthighf; + emit-sfx 1025 from lthighb; + } + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + emit-sfx 1025 from head; + emit-sfx 1025 from rbladeu; + emit-sfx 1025 from lbladel; + emit-sfx 1025 from tail; + emit-sfx 1025 from rthighf; + emit-sfx 1025 from rthighb; + emit-sfx 1025 from lthighf; + emit-sfx 1025 from lthighb; + emit-sfx 1024 from rfootf; + emit-sfx 1024 from rfootb; + emit-sfx 1024 from lfootf; + emit-sfx 1024 from lfootb; + sleep 50; + emit-sfx 2048+4 from body; + emit-sfx 2048+4 from head; + emit-sfx 2048+4 from tail; + emit-sfx 2048+4 from lthighf; + emit-sfx 2048+4 from rthighf; + emit-sfx 2048+4 from rthighb; + emit-sfx 2048+4 from lthighb; + emit-sfx 2048+4 from spike1; + emit-sfx 2048+4 from spike2; + emit-sfx 2048+4 from spike3; + explode head type FALL | FIRE | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lforearml type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lbladel type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rforearml type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rbladel type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lforearmu type FALL | EXPLODE_ON_HIT | NOHEATCLOUD;; + explode lbladeu type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rforearmu type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rbladeu type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode spike1 type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode spike2 type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode spike3 type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode tail type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode body type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lthighf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lkneef type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lshinf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lfootf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rthighf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rkneef type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rshinf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rfootf type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lthighb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lkneeb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lshinb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lfootb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rthighb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rkneeb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rshinb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rfootb type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zqueen.cob b/Scripts/zaal/zqueen.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/zaal/zqueen.cob differ diff --git a/Scripts/zaal/zskirmisher.bos b/Scripts/zaal/zskirmisher.bos new file mode 100644 index 000000000..160308788 --- /dev/null +++ b/Scripts/zaal/zskirmisher.bos @@ -0,0 +1,223 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack,rblade,lblade,mblade,spike1,spike2,spike3; + +static-var aMoving, bMoving; + +// Signal definitions +#define SIG_AIM 2 +#define SIG_AIM_2 4 +#define SIG_MOVE 16 + +#include "sfxtype.h" +#include "exptype.h" + +walk() +{ + while (aMoving) + { + bMoving = TRUE; + if (aMoving) { + turn lthigh to x-axis <70> speed<115>; + turn lknee to x-axis <-40> speed<145>; + turn lshin to x-axis <20> speed<145>; + turn lfoot to x-axis <-50> speed<210>; + + turn rthigh to x-axis <-20> speed<210>; + turn rknee to x-axis <-60> speed<210>; + turn rshin to x-axis <50> speed<210>; + turn rfoot to x-axis <30> speed<210>; + + turn body to z-axis <5> speed <20>; + turn lthigh to z-axis <-5> speed <20>; + turn rthigh to z-axis <-5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn tail to y-axis <10> speed <40>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn lthigh around x-axis;} + if (aMoving) { + turn lthigh to x-axis <-10> speed<160>; + turn lknee to x-axis <15> speed<145>; + turn lshin to x-axis <-60> speed<250>; + turn lfoot to x-axis <30> speed<145>; + + turn rthigh to x-axis <40> speed<145>; + turn rknee to x-axis <-35> speed<145>; + turn rshin to x-axis <-40> speed<145>; + turn rfoot to x-axis <35> speed<145>; + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn lshin around x-axis;} + if (aMoving) { + turn rthigh to x-axis <70> speed<115>; + turn rknee to x-axis <-40> speed<145>; + turn rshin to x-axis <20> speed<145>; + turn rfoot to x-axis <-50> speed<210>; + + turn lthigh to x-axis <-20> speed<210>; + turn lknee to x-axis <-60> speed<210>; + turn lshin to x-axis <50> speed<210>; + turn lfoot to x-axis <30> speed<210>; + + turn tail to y-axis <-10> speed <40>; + turn body to z-axis <-5> speed <20>; + turn lthigh to z-axis <5> speed <20>; + turn rthigh to z-axis <5> speed <20>; + move body to y-axis [0.7] speed <4000>; + turn head to x-axis <-10> speed <20>; + turn tail to x-axis <10> speed <20>; + wait-for-turn rthigh around x-axis;} + if (aMoving) { + + turn rthigh to x-axis <-10> speed<160>; + turn rknee to x-axis <15> speed<145>; + turn rshin to x-axis <-60> speed<250>; + turn rfoot to x-axis <30> speed<145>; + + turn lthigh to x-axis <40> speed<145>; + turn lknee to x-axis <-35> speed<145>; + turn lshin to x-axis <-40> speed<145>; + turn lfoot to x-axis <35> speed<145>; + + + move body to y-axis [0] speed <4000>; + turn head to x-axis <10> speed <20>; + turn tail to x-axis <-10> speed <20>; + wait-for-turn rshin around x-axis; + } + + } + return 0; +} + +Halt() +{ + sleep 150; + if(!aMoving) + { + bMoving = FALSE; + turn lfoot to x-axis <0> speed <200>; + turn rfoot to x-axis <0> speed <200>; + turn rthigh to x-axis <0> speed <200>; + turn lthigh to x-axis <0> speed <200>; + turn lshin to x-axis <0> speed <200>; + turn rshin to x-axis <0> speed <200>; + turn lknee to x-axis <0> speed <200>; + turn rknee to x-axis <0> speed <200>; + } +} + +StartMoving() +{ + aMoving = TRUE; + if (!bMoving) + { + start-script Walk(); + } +} + +StopMoving() +{ + aMoving = FALSE; + start-script Halt(); +} + +Create() +{ + emit-sfx 1024+2 from body; +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +AimFromSecondary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +QuerySecondary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + } + +AimPrimary(heading,pitch) + { + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +AimSecondary(heading,pitch) + { + if ( get IN_WATER(0) == 0 ) + { + return (0); + } + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <5000>; + turn head to x-axis 0 -pitch speed <5000>; + + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); + } + +Shot1() + { + turn lsack to y-axis <40> speed [1]; + turn rsack to y-axis <-40> speed [1]; + move rsack to x-axis [-1] speed [1]; + move lsack to x-axis [1] speed [1]; + move mblade to z-axis [-8] speed [100]; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed [0.3]; + turn rsack to y-axis <0> speed [0.3]; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + move mblade to z-axis <0> speed [3]; + } + +Shot2() + { + turn lsack to y-axis <40> speed [1]; + turn rsack to y-axis <-40> speed [1]; + move rsack to x-axis [-1] speed [1]; + move lsack to x-axis [1] speed [1]; + move mblade to z-axis [-8] speed [100]; + wait-for-turn lsack around y-axis; + turn lsack to y-axis <0> speed [0.3]; + turn rsack to y-axis <0> speed [0.3]; + move rsack to x-axis [0] speed [0.3]; + move lsack to x-axis [0] speed [0.3]; + move mblade to z-axis <0> speed [3]; + } + + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/zaal/zskirmisher.cob b/Scripts/zaal/zskirmisher.cob new file mode 100644 index 000000000..00de212d4 Binary files /dev/null and b/Scripts/zaal/zskirmisher.cob differ diff --git a/Scripts/zaal/ztenticle_lus.lua b/Scripts/zaal/ztenticle_lus.lua new file mode 100644 index 000000000..19f09c95b --- /dev/null +++ b/Scripts/zaal/ztenticle_lus.lua @@ -0,0 +1,85 @@ +base, point1 = piece('base', 'point1', 'point2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base}) + StartThread(BuildFX) + building = false + Move(base, y_axis, -1, 50) +end + +common = include("headers/common_includes_lus.lua") + +function BuildFX() + while(building == true) do + --EmitSfx (point1, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(point1, y_axis, 0, 5) + end +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return point1 +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return point1 +end + + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + --EmitSfx (point1, 1024) +end + +------------------------------------------- +------------------------------------------- + +local nanoPoints = {} +-- FIXME: this example has 2 nano pieces to alternate between +for i = 1, 2 do + -- FIXME: the pieces are named nanoPiece1 and nanoPiece2 in the model + nanoPoints[i] = piece("point" .. i) +end +Spring.SetUnitNanoPieces(unitID, nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + Turn(point1, y_axis, heading, 100) + SetUnitValue(COB.INBUILDSTANCE, true) + building = true + StartThread(BuildFX) +end +function script.StopBuilding() + -- TODO: This is where you would add your pack-up animation + SetUnitValue(COB.INBUILDSTANCE, false) + building = false + StartThread(RestoreAfterDelay) +end + +function script.Killed() + --Explode(base, SFX.EXPLODE_ON_HIT) + return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos +end \ No newline at end of file diff --git a/Scripts/zaal/ztiberium.bos b/Scripts/zaal/ztiberium.bos new file mode 100644 index 000000000..406924272 --- /dev/null +++ b/Scripts/zaal/ztiberium.bos @@ -0,0 +1,43 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base; + +SmokeUnit(healthpercent, sleeptime, smoketype) +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + healthpercent = get HEALTH; + if( healthpercent < 66 ) + { + smoketype = 256 | 2; + if( Rand( 1, 66 ) < healthpercent ) + { + smoketype = 256 | 1; + } + emit-sfx 1024 from base; + } + sleeptime = healthpercent * 50; + if( sleeptime < 200 ) + { + sleeptime = 200; + } + sleep sleeptime; + } +} + +Create() +{ + start-script SmokeUnit(); +} + +Killed(severity, corpsetype) // how it explodes +{ + corpsetype = 1; +} diff --git a/Scripts/zaal/ztiberium.cob b/Scripts/zaal/ztiberium.cob new file mode 100644 index 000000000..d126d83c9 Binary files /dev/null and b/Scripts/zaal/ztiberium.cob differ diff --git a/Scripts/zaal/ztumor_lus.lua b/Scripts/zaal/ztumor_lus.lua new file mode 100644 index 000000000..62db939f6 --- /dev/null +++ b/Scripts/zaal/ztumor_lus.lua @@ -0,0 +1,58 @@ +base, point1 = piece('base', 'nanopoint1') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base}) + StartThread(BuildFX) + building = false + Move(base, y_axis, -1, 50) +end + +common = include("headers/common_includes_lus.lua") + +function BuildFX() + while(building == true) do + --EmitSfx (point1, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(point1, y_axis, 0, 5) + end +end + +------------------------------------------- +------------------------------------------- + +------------------------------------------- +------------------------------------------- + +local nanoPoints = piece("nanopoint1") + +Spring.SetUnitNanoPieces(nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + Turn(point1, y_axis, heading, 100) + SetUnitValue(COB.INBUILDSTANCE, true) + building = true + StartThread(BuildFX) +end +function script.StopBuilding() + -- TODO: This is where you would add your pack-up animation + SetUnitValue(COB.INBUILDSTANCE, false) + building = false + StartThread(RestoreAfterDelay) +end + +function script.Killed() + --Explode(base, SFX.EXPLODE_ON_HIT) + return 1 -- spawn ARMSTUMP_DEAD corpse / This is the equivalent of corpsetype = 1; in bos +end \ No newline at end of file diff --git a/Unit Reassignments.txt b/Unit Reassignments.txt new file mode 100644 index 000000000..d0daae0a3 --- /dev/null +++ b/Unit Reassignments.txt @@ -0,0 +1,38 @@ +No buildings in/on water anymore + +Faction 1 - Remove Hovertank and replace with normal tank + +f1landfac + +Tech1 +eallterrlight +ehbotpeewee +eallterrriot_shotgun +ehbotthud +eallterrassault + +Tech2 +eallterrmed +ehbotsniper +eallterrheavy +ehbotrocko +eallterrshield + + +Faction 2 - Remove Waterweapon1 - Reintroduce slow movement underwater + +ebasefactory + +Tech 1 +eamphibbuggy +elighttank3 +eriottank_shotgun +eamphibneedle +eartytank +ebox + +Tech 2 +eamphibmedtank +eheavytank3 +eamphibrock +emissiletank3 \ No newline at end of file diff --git a/unitpics/!Add Constripes.exe b/UnitPic Tools/!Add Constripes.exe similarity index 100% rename from unitpics/!Add Constripes.exe rename to UnitPic Tools/!Add Constripes.exe diff --git a/unitpics/!Photoshop Actionset for buildpics - Buildpics.atn b/UnitPic Tools/!Photoshop Actionset for buildpics - Buildpics.atn similarity index 100% rename from unitpics/!Photoshop Actionset for buildpics - Buildpics.atn rename to UnitPic Tools/!Photoshop Actionset for buildpics - Buildpics.atn diff --git a/unitpics/!Resize buildpics.exe b/UnitPic Tools/!Resize buildpics.exe similarity index 100% rename from unitpics/!Resize buildpics.exe rename to UnitPic Tools/!Resize buildpics.exe diff --git a/unitpics/!buildpic background image.png b/UnitPic Tools/!buildpic background image.png similarity index 100% rename from unitpics/!buildpic background image.png rename to UnitPic Tools/!buildpic background image.png diff --git a/UnitPic Tools/constripe frame.png b/UnitPic Tools/constripe frame.png new file mode 100644 index 000000000..4a76eddb6 Binary files /dev/null and b/UnitPic Tools/constripe frame.png differ diff --git a/UnitPic Tools/lozengineer.png b/UnitPic Tools/lozengineer.png new file mode 100644 index 000000000..b3a034ca8 Binary files /dev/null and b/UnitPic Tools/lozengineer.png differ diff --git a/UnitTextures/ad0_pine_1.tga b/UnitTextures/ad0_pine_1.tga new file mode 100644 index 000000000..08be10220 Binary files /dev/null and b/UnitTextures/ad0_pine_1.tga differ diff --git a/UnitTextures/ad0_pine_2.tga b/UnitTextures/ad0_pine_2.tga new file mode 100644 index 000000000..faacff02c Binary files /dev/null and b/UnitTextures/ad0_pine_2.tga differ diff --git a/UnitTextures/bfaction_normals.dds b/UnitTextures/bfaction_normals.dds new file mode 100644 index 000000000..cc8d42749 Binary files /dev/null and b/UnitTextures/bfaction_normals.dds differ diff --git a/UnitTextures/bfaction_tex1.dds b/UnitTextures/bfaction_tex1.dds new file mode 100644 index 000000000..7aada7911 Binary files /dev/null and b/UnitTextures/bfaction_tex1.dds differ diff --git a/UnitTextures/bfaction_tex2.dds b/UnitTextures/bfaction_tex2.dds new file mode 100644 index 000000000..c5e23dbc1 Binary files /dev/null and b/UnitTextures/bfaction_tex2.dds differ diff --git a/UnitTextures/chickengroundplate.dds b/UnitTextures/chickengroundplate.dds new file mode 100644 index 000000000..5574b10ff Binary files /dev/null and b/UnitTextures/chickengroundplate.dds differ diff --git a/UnitTextures/desktop.ini b/UnitTextures/desktop.ini new file mode 100644 index 000000000..95f0b5ac1 Binary files /dev/null and b/UnitTextures/desktop.ini differ diff --git a/UnitTextures/greenchicken_normals.dds b/UnitTextures/greenchicken_normals.dds new file mode 100644 index 000000000..eb6da4b44 Binary files /dev/null and b/UnitTextures/greenchicken_normals.dds differ diff --git a/UnitTextures/greenchickenglowy.dds b/UnitTextures/greenchickenglowy.dds new file mode 100644 index 000000000..b0bee0b12 Binary files /dev/null and b/UnitTextures/greenchickenglowy.dds differ diff --git a/UnitTextures/lego2skin_explorer.dds b/UnitTextures/lego2skin_explorer.dds index 932459071..cd3a069cf 100644 Binary files a/UnitTextures/lego2skin_explorer.dds and b/UnitTextures/lego2skin_explorer.dds differ diff --git a/UnitTextures/lego2skin_explorerglowy.dds b/UnitTextures/lego2skin_explorerglowy.dds index 501168768..af8644b20 100644 Binary files a/UnitTextures/lego2skin_explorerglowy.dds and b/UnitTextures/lego2skin_explorerglowy.dds differ diff --git a/UnitTextures/scavbeacon.dds b/UnitTextures/scavbeacon.dds new file mode 100644 index 000000000..224f384c9 Binary files /dev/null and b/UnitTextures/scavbeacon.dds differ diff --git a/UnitTextures/scavbeacon2.dds b/UnitTextures/scavbeacon2.dds new file mode 100644 index 000000000..eb8c973a1 Binary files /dev/null and b/UnitTextures/scavbeacon2.dds differ diff --git a/UnitTextures/scavbeacon_normals.dds b/UnitTextures/scavbeacon_normals.dds new file mode 100644 index 000000000..6f8dadfd7 Binary files /dev/null and b/UnitTextures/scavbeacon_normals.dds differ diff --git a/UnitTextures/scavbeacondropped.png b/UnitTextures/scavbeacondropped.png new file mode 100644 index 000000000..3b229e8fe Binary files /dev/null and b/UnitTextures/scavbeacondropped.png differ diff --git a/UnitTextures/scavbeacondropped2.png b/UnitTextures/scavbeacondropped2.png new file mode 100644 index 000000000..d4ee0d7ec Binary files /dev/null and b/UnitTextures/scavbeacondropped2.png differ diff --git a/UnitTextures/scavcrate.png b/UnitTextures/scavcrate.png new file mode 100644 index 000000000..93fffa315 Binary files /dev/null and b/UnitTextures/scavcrate.png differ diff --git a/UnitTextures/scavcrate2.png b/UnitTextures/scavcrate2.png new file mode 100644 index 000000000..200a72c50 Binary files /dev/null and b/UnitTextures/scavcrate2.png differ diff --git a/UnitTextures/tatex/Thumbs.db b/UnitTextures/tatex/Thumbs.db deleted file mode 100644 index 7374d74cc..000000000 Binary files a/UnitTextures/tatex/Thumbs.db and /dev/null differ diff --git a/UnitTextures/texgroups.cfg b/UnitTextures/texgroups.cfg new file mode 100644 index 000000000..95f0b5ac1 Binary files /dev/null and b/UnitTextures/texgroups.cfg differ diff --git a/UnitTextures/z_glowy.dds b/UnitTextures/z_glowy.dds new file mode 100644 index 000000000..ae0493f0a Binary files /dev/null and b/UnitTextures/z_glowy.dds differ diff --git a/UnitTextures/z_normals.dds b/UnitTextures/z_normals.dds new file mode 100644 index 000000000..eb6da4b44 Binary files /dev/null and b/UnitTextures/z_normals.dds differ diff --git a/UnitTextures/zarm.dds b/UnitTextures/zarm.dds new file mode 100644 index 000000000..dfe34e2c9 Binary files /dev/null and b/UnitTextures/zarm.dds differ diff --git a/UnitTextures/zarm_normals.dds b/UnitTextures/zarm_normals.dds new file mode 100644 index 000000000..71259b916 Binary files /dev/null and b/UnitTextures/zarm_normals.dds differ diff --git a/UnitTextures/zarmglowy.dds b/UnitTextures/zarmglowy.dds new file mode 100644 index 000000000..596b5b7ba Binary files /dev/null and b/UnitTextures/zarmglowy.dds differ diff --git a/UnitTextures/zblack.dds b/UnitTextures/zblack.dds new file mode 100644 index 000000000..41d544235 Binary files /dev/null and b/UnitTextures/zblack.dds differ diff --git a/UnitTextures/zblue.dds b/UnitTextures/zblue.dds new file mode 100644 index 000000000..1b503226b Binary files /dev/null and b/UnitTextures/zblue.dds differ diff --git a/UnitTextures/zcrimson.dds b/UnitTextures/zcrimson.dds new file mode 100644 index 000000000..144945089 Binary files /dev/null and b/UnitTextures/zcrimson.dds differ diff --git a/UnitTextures/zespire1.dds b/UnitTextures/zespire1.dds new file mode 100644 index 000000000..c424ae6a8 Binary files /dev/null and b/UnitTextures/zespire1.dds differ diff --git a/UnitTextures/zespire1_glowy.dds b/UnitTextures/zespire1_glowy.dds new file mode 100644 index 000000000..9e268ce5f Binary files /dev/null and b/UnitTextures/zespire1_glowy.dds differ diff --git a/UnitTextures/zespire1_normals.dds b/UnitTextures/zespire1_normals.dds new file mode 100644 index 000000000..41a942e07 Binary files /dev/null and b/UnitTextures/zespire1_normals.dds differ diff --git a/UnitTextures/zespire4.dds b/UnitTextures/zespire4.dds new file mode 100644 index 000000000..da49ec168 Binary files /dev/null and b/UnitTextures/zespire4.dds differ diff --git a/UnitTextures/zespire4_glowy.dds b/UnitTextures/zespire4_glowy.dds new file mode 100644 index 000000000..5e99d1cd3 Binary files /dev/null and b/UnitTextures/zespire4_glowy.dds differ diff --git a/UnitTextures/zespire4_normals.dds b/UnitTextures/zespire4_normals.dds new file mode 100644 index 000000000..6f8276bd2 Binary files /dev/null and b/UnitTextures/zespire4_normals.dds differ diff --git a/UnitTextures/zespire5.dds b/UnitTextures/zespire5.dds new file mode 100644 index 000000000..5cac43f5d Binary files /dev/null and b/UnitTextures/zespire5.dds differ diff --git a/UnitTextures/zespire5_glowy.dds b/UnitTextures/zespire5_glowy.dds new file mode 100644 index 000000000..f454271b2 Binary files /dev/null and b/UnitTextures/zespire5_glowy.dds differ diff --git a/UnitTextures/zespire5_normals.dds b/UnitTextures/zespire5_normals.dds new file mode 100644 index 000000000..7d7e005fb Binary files /dev/null and b/UnitTextures/zespire5_normals.dds differ diff --git a/UnitTextures/zgreen.dds b/UnitTextures/zgreen.dds new file mode 100644 index 000000000..3abfeb888 Binary files /dev/null and b/UnitTextures/zgreen.dds differ diff --git a/UnitTextures/zgreengray.dds b/UnitTextures/zgreengray.dds new file mode 100644 index 000000000..652837f14 Binary files /dev/null and b/UnitTextures/zgreengray.dds differ diff --git a/UnitTextures/zgroundtexture-hirez.dds b/UnitTextures/zgroundtexture-hirez.dds new file mode 100644 index 000000000..26047898b Binary files /dev/null and b/UnitTextures/zgroundtexture-hirez.dds differ diff --git a/UnitTextures/zgroundtexture-hirez2.dds b/UnitTextures/zgroundtexture-hirez2.dds new file mode 100644 index 000000000..4b8467ca3 Binary files /dev/null and b/UnitTextures/zgroundtexture-hirez2.dds differ diff --git a/UnitTextures/zgroundtexture.dds b/UnitTextures/zgroundtexture.dds new file mode 100644 index 000000000..3f1e06d05 Binary files /dev/null and b/UnitTextures/zgroundtexture.dds differ diff --git a/UnitTextures/zgroundtexture2.dds b/UnitTextures/zgroundtexture2.dds new file mode 100644 index 000000000..569ad18ef Binary files /dev/null and b/UnitTextures/zgroundtexture2.dds differ diff --git a/UnitTextures/zhive.dds b/UnitTextures/zhive.dds new file mode 100644 index 000000000..d6257522d Binary files /dev/null and b/UnitTextures/zhive.dds differ diff --git a/UnitTextures/zhive_normals.dds b/UnitTextures/zhive_normals.dds new file mode 100644 index 000000000..74970c493 Binary files /dev/null and b/UnitTextures/zhive_normals.dds differ diff --git a/UnitTextures/zhiveglowy.dds b/UnitTextures/zhiveglowy.dds new file mode 100644 index 000000000..b7b74441e Binary files /dev/null and b/UnitTextures/zhiveglowy.dds differ diff --git a/UnitTextures/zpurple.dds b/UnitTextures/zpurple.dds new file mode 100644 index 000000000..0eb4204a1 Binary files /dev/null and b/UnitTextures/zpurple.dds differ diff --git a/UnitTextures/zred.dds b/UnitTextures/zred.dds new file mode 100644 index 000000000..074a96b4b Binary files /dev/null and b/UnitTextures/zred.dds differ diff --git a/UnitTextures/zred2.dds b/UnitTextures/zred2.dds new file mode 100644 index 000000000..a53daebb3 Binary files /dev/null and b/UnitTextures/zred2.dds differ diff --git a/UnitTextures/ztiberium.dds b/UnitTextures/ztiberium.dds new file mode 100644 index 000000000..5da86ec06 Binary files /dev/null and b/UnitTextures/ztiberium.dds differ diff --git a/UnitTextures/ztiberium_glowy.dds b/UnitTextures/ztiberium_glowy.dds new file mode 100644 index 000000000..1f5ce95f9 Binary files /dev/null and b/UnitTextures/ztiberium_glowy.dds differ diff --git a/UnitTextures/ztiberium_normals.dds b/UnitTextures/ztiberium_normals.dds new file mode 100644 index 000000000..edb9265fc Binary files /dev/null and b/UnitTextures/ztiberium_normals.dds differ diff --git a/UnitTextures/ztumor.dds b/UnitTextures/ztumor.dds new file mode 100644 index 000000000..4f784ab20 Binary files /dev/null and b/UnitTextures/ztumor.dds differ diff --git a/UnitTextures/ztumor.psd b/UnitTextures/ztumor.psd new file mode 100644 index 000000000..4b4b051fa Binary files /dev/null and b/UnitTextures/ztumor.psd differ diff --git a/UnitTextures/ztumor_glowy.dds b/UnitTextures/ztumor_glowy.dds new file mode 100644 index 000000000..676fa2532 Binary files /dev/null and b/UnitTextures/ztumor_glowy.dds differ diff --git a/UnitTextures/ztumor_normals.dds b/UnitTextures/ztumor_normals.dds new file mode 100644 index 000000000..e2cbbc702 Binary files /dev/null and b/UnitTextures/ztumor_normals.dds differ diff --git a/UnitTextures/zwhite.dds b/UnitTextures/zwhite.dds new file mode 100644 index 000000000..4ac8aa44e Binary files /dev/null and b/UnitTextures/zwhite.dds differ diff --git a/UnitTextures/zyellow.dds b/UnitTextures/zyellow.dds new file mode 100644 index 000000000..679332224 Binary files /dev/null and b/UnitTextures/zyellow.dds differ diff --git a/Units-Configs-Basedefs/basedefs/Faction 2/f2engineer_basedef.lua b/Units-Configs-Basedefs/basedefs/Faction 2/f2engineer_basedef.lua new file mode 100644 index 000000000..7b9d58713 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/Faction 2/f2engineer_basedef.lua @@ -0,0 +1,103 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildpic = "lozengineer.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + canBuild = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canreclaim = true, + category = "LIGHT NOTAIR SUPPORT", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericGreen", + footprintX = 2, + footprintZ = 2, + iconType = "engineer", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = maxDamage, + maxVelocity = 4.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, --Because he was the first one to get the "Lobster" pun + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericGreen", + showNanoSpray = false, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.3, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 250, + unitname = unitName, + workerTime = 1, + capturespeed = 1, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildListLoz, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = [[tech0]], + canbetransported = "true", + death_sounds = "generic", + armortype = armortype, + nofriendlyfire = "1", + noenergycost = true, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "Loz Alliance", + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/air/eairemp_basedef.lua b/Units-Configs-Basedefs/basedefs/air/eairemp_basedef.lua new file mode 100644 index 000000000..a9957bc82 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/eairemp_basedef.lua @@ -0,0 +1,193 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 86, + builder = false, + buildTime = 2.5, + buildpic = "escout.png", + canAttack = true, + canFly = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "AIRLIGHT VTOL", + collide = false, + cruiseAlt = 160, + description = [[EMP Attack Craft]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericBlue", + footprintX = 2, + footprintZ = 2, + hoverAttack = false, + floater = true, + iconType = "scout", + idleAutoHeal = .5, + idleTime = 2200, + loopbackattack = true, + maxAcc = 1, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxDamage = 640, + maxSlope = 90, + maxVelocity = 10, + verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + repairable = false, + selfDestructAs = "smallExplosionGenericBlue", + side = "ARM", + sightDistance = 1500, + smoothAnim = true, + stealth = false, + transportbyenemy = false; + turnRate = 5000, + turnRadius = 250, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + explosiongenerators = { + "custom:gdhcannon", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "missile", + badTargetCategory = "ARMORED LIGHT VTOL", + mainDir = "0 0 1", + maxAngleDif = 90, + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 1, + isupgraded = isUpgraded, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + missile = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + commandfire = true, + cegTag = "emptrail-optimized", + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + energypershot = 0, + edgeEffectiveness = 0.1, + fireStarter = 70, + + id = 136, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "missile.s3o", + name = "Rockets", + range = 750, + reloadtime = 30, + weaponType = "MissileLauncher", + + paralyzer = true, + paralyzetime = 10, + + smokeTrail = false, + soundHit = "explosions/unitexplodebig.wav", + soundHitWet = "explosions/subhitbomb.wav", + soundHitVolume = 10, + soundStart = "weapons/bomberlaunch.wav", + soundStartVolume = 10, + + startVelocity = 500, + tolerance = 5000, + turnRate = 10000, + tracks = false, + turret = false, + weaponAcceleration = 10, + waterweapon = true, + flightTime = 10, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 5000, + }, + }, + + airraider = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + colorMap = "1 0.5 1 1 1 0.5 1 1 1 0.5 1 1 1 0.5 1 0.01", + stages = 1, + cegTag = "airraidershot", + explosionGenerator = "custom:genericshellexplosion-medium-blue", + energypershot = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + name = unitName .. "Weapon", + paralyzer = true, + paralyzetime = 2.5, + range = 300, + reloadtime = 0.1, + size = 3, + weaponType = "Cannon", + soundstart = "weapons/tmediumtankfire.wav", + sprayangle = 2500, + tolerance = 10000, + turret = true, + weaponVelocity = 750, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + damagetype = "antilightarmored", + }, + damage = { + default = 15, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua b/Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua index 3ea9af83b..41a49c78e 100644 --- a/Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua @@ -1,7 +1,7 @@ unitDef = { activatewhenbuilt = true, buildCostEnergy = 0, - buildCostMetal = 30, + buildCostMetal = buildCostMetal, builder = true, buildTime = 2.5, buildpic = "eairplant.png", @@ -18,8 +18,8 @@ unitDef = { energyMake = 0, explodeAs = "hugeBuildingExplosionGenericRed", floater = true, - footprintX = 18, - footprintZ = 18, + footprintX = 9, + footprintZ = 9, iconType = "factory", idleAutoHeal = .5, idleTime = 2200, @@ -72,12 +72,12 @@ unitDef = { }, }, customParams = { - unittype = "building", + unittype = "factory", death_sounds = "generic", armortype = "building", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- ProvideTech = "1 Powergrid", -- ProvideTechRange = "1500", diff --git a/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua b/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua index 4ede2f3fa..c5b0c6d5f 100644 --- a/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua @@ -1,11 +1,10 @@ unitDef = { - acceleration = 0.5, + --acceleration = 0.5, airStrafe = false, airHoverFactor = 0, - BadTargetCategory = "VTOL", - brakeRate = 1, + --brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 90, + buildCostMetal = 60, builder = false, buildTime = 2.5, buildpic = "ebomber.png", @@ -15,37 +14,42 @@ unitDef = { canMove = true, canPatrol = true, canstop = true, - category = "ARMORED VTOL", + category = "AIRARMORED VTOL", collide = true, - cruiseAlt = 140, - description = [[Unit Type: Bomber • Uses +]] .. supply .. [[ Supply]], + cruiseAlt = 400, + description = [[Bomber]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGeneric", - footprintX = 7, - footprintZ = 7, + footprintX = 2, + footprintZ = 2, floater = true, - hoverAttack = true, + hoverAttack = false, iconType = "air_bomb", idleAutoHeal = .5, idleTime = 2200, - loopbackattack = false, - maxDamage = 337, + loopbackattack = true, + maxacc = 1, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxDamage = 670, maxSlope = 90, - maxVelocity = 4.5, + maxVelocity = 13, verticalSpeed = 15, maxWaterDepth = 0, metalStorage = 0, name = humanName, - noChaseCategory = "VTOL", objectName = objectName, script = script, - radarDistance = 0, repairable = false, selfDestructAs = "largeExplosionGeneric", side = "CORE", - sightDistance = 1050, + sightDistance = 400, smoothAnim = true, stealth = false, transportbyenemy = false; @@ -75,7 +79,8 @@ unitDef = { }, weapons = { [1] = { - def = "missile", + def = "bomb", + onlyTargetCategory = "BUILDING", noChaseCategory = "VTOL LIGHT ARMORED", }, }, @@ -91,19 +96,21 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 0, }, } weaponDefs = { + missile = { - AreaOfEffect = 1, + AreaOfEffect = 300, avoidFriendly = false, avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrailgunship", + cegTag = "bombertrail-optimized", explosionGenerator = "custom:genericshellexplosion-large-red", energypershot = 0, edgeEffectiveness = 0.1, @@ -117,33 +124,77 @@ weaponDefs = { metalpershot = 0, model = "missile.s3o", name = "Rockets", - range = 1050, - reloadtime = 3, + range = 800, + reloadtime = 6, weaponType = "MissileLauncher", smokeTrail = false, - soundHit = "explosions/unitexplodebig.wav", + soundHit = "other/18402_inferno_xplo.wav", soundHitWet = "explosions/subhitbomb.wav", soundHitVolume = 10, soundStart = "weapons/bomberlaunch.wav", soundStartVolume = 10, - startVelocity = 500, + startVelocity = 200, tolerance = 8000, - turnRate = 10000, + turnRate = 15000, tracks = false, - turret = true, - weaponAcceleration = 10, + turret = false, + weaponAcceleration = 50, waterweapon = true, flightTime = 10, weaponVelocity = 800, customparams = { isupgraded = isUpgraded, - damagetype = "ebomber", + damagetype = "antibuilding", nofriendlyfire = 1, }, damage = { - default = 300, + default = 500, }, }, + + bomb = { + AreaOfEffect = 150, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + cylinderTargeting = 0, + burst = 10, + burstrate = 0.1, + cegTag = "genericshellexplosion-large-sparks-burn", + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-red", + fallOffRate = 1, + fireStarter = 50, + impulseFactor = 0, + minintensity = "1", + name = "Cluster Bomb", + range = 1000, + reloadtime = 6, + WeaponType = "Cannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/bombdrop.wav", + soundHit = "other/18402_inferno_xplo.wav", + soundHitWet = "explosions/subhitbomb.wav", + sprayangle = 5000, + size = 4, + --texture1 = "shot", + --texture2 = "empty", + thickness = 15, + tolerance = 7500, + turret = false, + weaponVelocity = 150, + customparams = { + damagetype = "antibuilding", + isupgraded = isUpgraded, + nofriendlyfire = 1, + }, + damage = { + default = 100, + }, + }, } diff --git a/Units-Configs-Basedefs/basedefs/air/edrone_basedef.lua b/Units-Configs-Basedefs/basedefs/air/edrone_basedef.lua index 7b18dd242..abdf4aa3a 100644 --- a/Units-Configs-Basedefs/basedefs/air/edrone_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/edrone_basedef.lua @@ -1,10 +1,10 @@ unitDef = { acceleration = 0.5, - airStrafe = false, + airStrafe = true, bankscale = "1", - brakeRate = 1, + brakeRate = 0.7, buildCostEnergy = 0, - buildCostMetal = 45, + buildCostMetal = 33, buildTime = 2.5, buildpic = "edrone.png", canAttack = true, @@ -15,10 +15,10 @@ unitDef = { canMove = true, canPatrol = true, canstop = "1", - category = "LIGHT VTOL DRONE", + category = "AIRLIGHT VTOL DRONE", collide = false, - cruiseAlt = 120, - description = [[Drone Harassment Specialist • Uses +]] .. supply .. [[ Supply]], + cruiseAlt = 75, + description = [[Harassment Specialist Drone]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -27,16 +27,16 @@ unitDef = { flareDropVector = "0 0 -1", flareefficieny = "0.3", flareReload = 3, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, hoverAttack = true, iconType = "drone", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 280, + maxDamage = 560, maxSlope = 90, - maxVelocity = 7, - verticalSpeed = 15, + maxVelocity = 11, + --verticalSpeed = 15, maxWaterDepth = 0, metalStorage = 0, moverate1 = "8", @@ -89,7 +89,8 @@ unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", + retreatRangeDAI = 0, }, } @@ -99,53 +100,52 @@ unitDef = { weaponDefs = { droneweapon = { --accuracy = 500, - AreaOfEffect = 1, - avoidFriendly = false, + AreaOfEffect = 25, avoidFeature = false, - collideFriendly = false, + avoidFriendly = false, collideFeature = false, + collideFriendly = false, + coreThickness = 0.5, beamTime = 0.1, beamTTL = 10, beamDecay = 1, - - coreThickness = 0.5, - craterBoost = 0, - craterMult = 0, - --duration = 0.2, + burnblow = true, + largeBeamLaser = true, + laserflaresize = 7, + minIntensity = 1, + --cegTag = "railgun", + duration = 0.6, + edgeeffectiveness = 1, energypershot = 0, explosionGenerator = "custom:genericshellexplosion-small-sparks-burn", fallOffRate = 0.1, + fireStarter = 50, impulseFactor = 0, + fallOffRate = 0, interceptedByShieldType = 4, - largeBeamLaser = true, - laserflaresize = 5, - minIntensity = 1, - + minintensity = 1, name = unitName .. "Weapon", - noSelfDamage = true, - range = 500, - reloadtime = 1, + range = 300, + reloadtime = 0.5, WeaponType = "BeamLaser", + waterweapon = true, rgbColor = "0.1 0.5 0.2", rgbColor2 = "0 1 0", - - --soundHit = "weapons/18393_inferno_reject.wav", - soundStart = "weapons/18389_inferno_medlas.wav", soundTrigger = true, - startVelocity = 1000, - targetMoveError = 0, + soundstart = "weapons/18389_inferno_medlas.wav", + --soundHit = "explosions/artyhit.wav", texture1 = "lightning", texture2 = "laserend", thickness = 5, + tolerance = 10000, turret = true, - weaponVelocity = 1000, - waterweapon = true, + weaponVelocity = 750, customparams = { - damagetype = "edrone", + damagetype = "light", isupgraded = isUpgraded, }, damage = { - default = 30, + default = 15, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua b/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua index 448bb3fb9..88769940e 100644 --- a/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua @@ -1,11 +1,10 @@ unitDef = { - acceleration = 0.5, + --acceleration = 0.5, airStrafe = false, airHoverFactor = 0, - bankscale = "1", - brakeRate = 1, + --brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 80, + buildCostMetal = 53, buildTime = 2.5, buildpic = "efighter.png", canAttack = true, @@ -14,28 +13,32 @@ unitDef = { canLoopbackAttack = true, canMove = true, canPatrol = true, - canstop = "1", - category = "LIGHT VTOL", + canstop = true, + category = "AIRLIGHT VTOL", collide = true, - cruiseAlt = 75, - description = [[Light Gunship • Uses +]] .. supply .. [[ Supply]], + cruiseAlt = 140, + description = [[Light Gunship]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericWhite", - footprintX = 5, - footprintZ = 5, - hoverAttack = true, floater = true, + footprintX = 2, + footprintZ = 2, + hoverAttack = false, iconType = "air_lit", idleAutoHeal = .5, idleTime = 2200, - maxAcc = 0.25, - maxBank = 5, - maxDamage = 406, + maxacc = 1, + maxDamage = 812, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + maxSlope = 90, - maxVelocity = 6, - verticalSpeed = 15, + maxVelocity = 12, maxWaterDepth = 255, metalStorage = 0, moverate1 = "8", @@ -46,14 +49,14 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericWhite", side = "ARM", - sightDistance = 500, + sightDistance = 1000, smoothAnim = true, sonarDistance = 0, transportbyenemy = false; turnRate = 5000, + turnradius = 250, unitname = unitName, upright = true, - workerTime = 0, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -92,40 +95,51 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 0, }, } weaponDefs = { aircannon = { - AreaOfEffect = 25, - avoidFriendly = false, + AreaOfEffect = 100, avoidFeature = false, + avoidFriendly = false, + collideFeature = false, collideFriendly = false, - collideFeature = false, - cegTag = "fightershot", - explosionGenerator = "custom:genericshellexplosion-small", + coreThickness = 0.5, + burnblow = true, + --cegTag = "railgun", + duration = 0.05, energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + fallOffRate = 1, + fireStarter = 50, impulseFactor = 0, - interceptedByShieldType = 4, - name = unitName .. "Weapon", - range = 400, - reloadtime = 0.5, - size = 8, - weaponType = "Cannon", - soundstart = "weapons/18379_inferno_hilas.wav", - soundStart = "weapons/triotfire.wav", - tolerance = 10000, - turret = true, - weaponVelocity = 1000, - waterweapon = true, + minintensity = "1", + name = "Laser", + range = 500, + reloadtime = 0.1, + WeaponType = "Cannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "other/ejerikfiresingle.wav", + sprayangle = 1000, + size = 4, + --texture1 = "shot", + --texture2 = "empty", + thickness = 15, + tolerance = 7500, + turret = false, + weaponVelocity = 1250, customparams = { - damagetype = "efighter", + damagetype = "light", isupgraded = isUpgraded, }, damage = { - default = 100, + default = 25, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua b/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua index 145dce4bb..59bdf7340 100644 --- a/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua @@ -1,43 +1,44 @@ unitDef = { - acceleration = 0.5, + --acceleration = 0.5, airStrafe = false, airHoverFactor = 0, - brakeRate = 1, + --brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 115, + buildCostMetal = 76, buildTime = 2.5, buildpic = "egunship2.png", canAttack = true, - canDropFlare = false, canFly = true, canGuard = true, canLoopbackAttack = true, canMove = true, canPatrol = true, canstop = true, - category = "LIGHT VTOL", + category = "AIRARMORED VTOL", collide = true, - cruiseAlt = 90, - description = [[Anti-Armor Gunship • Uses +]] .. supply .. [[ Supply]], + cruiseAlt = 125, + description = [[Anti-Armor Gunship]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericRed", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, floater = true, - footprintX = 4, - footprintZ = 4, - hoverAttack = true, + footprintX = 2, + footprintZ = 2, + hoverAttack = false, iconType = "air_arm", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 468, + maxacc = 1, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxDamage = 940, maxSlope = 90, - maxVelocity = 5, - verticalSpeed = 15, + maxVelocity = 15, maxWaterDepth = 0, metalStorage = 0, moverate1 = "8", @@ -48,10 +49,12 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericRed", side = "CORE", - sightDistance = 800, + sightDistance = 1400, smoothAnim = true, + sonarDistance = 0, transportbyenemy = false; turnRate = 5000, + turnradius = 250, unitname = unitName, upright = true, sfxtypes = { @@ -77,10 +80,9 @@ unitDef = { weapons = { [1] = { def = "gunshipweapon", + BadTargetCategory = "BUILDING WALL", mainDir = "0 0 1", - maxAngleDif = 180, - BadTargetCategory = "LIGHT BUILDING WALL", - noChaseCategory = "VTOL", + maxAngleDif = 90, }, }, customParams = { @@ -95,8 +97,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 0, }, } @@ -108,7 +111,7 @@ weaponDefs = { avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrailgunshiplesssmokey", + cegTag = "gunshiptrail-optimized", explosionGenerator = "custom:genericshellexplosion-medium", energypershot = 0, edgeEffectiveness = 0.1, @@ -119,7 +122,7 @@ weaponDefs = { interceptedByShieldType = 4, model = "missilesmalllauncher.s3o", name = "Rockets", - range = 380, + range = 700, reloadtime = 1, weaponType = "MissileLauncher", waterweapon = true, @@ -129,16 +132,16 @@ weaponDefs = { soundHitVolume = 10, soundStart = "weapons/18395_inferno_rltx.wav", soundStartVolume = 10, - startVelocity = 500, - tolerance = 8000, + startVelocity = 50, + tolerance = 5000, turnRate = 20000, - turret = true, - weaponAcceleration = 500, - flightTime = 5, - weaponVelocity = 2000, + turret = false, + weaponAcceleration = 100, + flightTime = 2.5, + weaponVelocity = 700, customparams = { isupgraded = isUpgraded, - damagetype = "egunship2", + damagetype = "antilightarmored", }, damage = { default = 150, diff --git a/Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua b/Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua index 4e78ae60b..c97a1b0b1 100644 --- a/Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua @@ -1,11 +1,11 @@ unitDef = { - acceleration = 0.5, + --acceleration = 0.5, airStrafe = false, airHoverFactor = 0, BadTargetCategory = "VTOL", - brakeRate = 1, + --brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 1750, + buildCostMetal = 875, builder = false, buildTime = 2.5, buildpic = "ekrow.png", @@ -15,10 +15,10 @@ unitDef = { canMove = true, canPatrol = true, canstop = true, - category = "ARMORED VTOL", + category = "AIRARMORED VTOL", collide = true, - cruiseAlt = 180, - description = [[Unit Type: Endbringer Flying Fortress]], + cruiseAlt = 150, + description = [[Endbringer Flying Fortress]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -31,7 +31,7 @@ unitDef = { idleAutoHeal = .5, idleTime = 2200, loopbackattack = false, - maxDamage = 12000, + maxDamage = 24000, maxSlope = 90, maxVelocity = 2.5, verticalSpeed = 15, @@ -49,7 +49,7 @@ unitDef = { smoothAnim = true, stealth = false, transportbyenemy = false; - turnRate = 5000, + turnRate = 100, unitname = unitName, upright = true, workerTime = 0, @@ -78,6 +78,8 @@ unitDef = { def = "aircannon", noChaseCategory = "VTOL LIGHT ARMORED", badTargetCategory = "VTOL LIGHT ARMORED", + mainDir = "0 -1 0", + maxAngleDif = 170, }, }, customParams = { @@ -86,15 +88,15 @@ unitDef = { -- needed_cover = 2, death_sounds = "generic", nofriendlyfire = "1", - ProvideTech = techprovided, RequireTech = tech, armortype = armortype, nofriendlyfire = "1", --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 0, }, } @@ -114,6 +116,7 @@ weaponDefs = { laserflaresize = 7, minIntensity = 1, --cegTag = "railgun", + heightmod = 1, duration = 0.6, edgeeffectiveness = 1, energypershot = 0, @@ -141,11 +144,11 @@ weaponDefs = { turret = true, weaponVelocity = 750, customparams = { - damagetype = "ekrow", + damagetype = "antibuilding", isupgraded = isUpgraded, }, damage = { default = 300, }, - }, + }, } diff --git a/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua b/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua index 77b6cfee6..a9d96035c 100644 --- a/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua @@ -1,53 +1,54 @@ unitDef = { - acceleration = 0.5, + --acceleration = 0.5, airStrafe = false, airHoverFactor = 0, - brakeRate = 1, + --brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 65, + buildCostMetal = 86, builder = false, buildTime = 2.5, buildpic = "escout.png", + canAttack = true, canFly = true, canGuard = true, canMove = true, canPatrol = true, canstop = "1", - category = "LIGHT VTOL", + category = "AIRLIGHT VTOL", collide = false, - cruiseAlt = 125, - description = [[EMP Gunship • Uses +]] .. supply .. [[ Supply]], + cruiseAlt = 800, + description = [[EMP Attack Craft]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "smallExplosionGenericBlue", - footprintX = 4, - footprintZ = 4, - hoverAttack = true, + footprintX = 2, + footprintZ = 2, + hoverAttack = false, floater = true, iconType = "scout", idleAutoHeal = .5, idleTime = 2200, - isTargetingUpgrade = false, - maxDamage = 350, + loopbackattack = true, + maxAcc = 1, + maxDamage = 320, maxSlope = 90, - maxVelocity = 6.5, + maxVelocity = 10, verticalSpeed = 15, maxWaterDepth = 0, metalStorage = 0, name = humanName, objectName = objectName, script = script, - --radarDistance = 1500, - --SonarDistance = 1500, - --SeismicDistance = 1500, repairable = false, selfDestructAs = "smallExplosionGenericBlue", side = "ARM", - sightDistance = 300, + sightDistance = 1500, smoothAnim = true, + stealth = false, transportbyenemy = false; turnRate = 5000, + turnRadius = 250, unitname = unitName, upright = true, workerTime = 0, @@ -72,8 +73,10 @@ unitDef = { }, weapons = { [1] = { - def = "airraider", + def = "missile", badTargetCategory = "ARMORED LIGHT VTOL", + mainDir = "0 0 1", + maxAngleDif = 90, }, }, customParams = { @@ -86,14 +89,68 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 0, }, } weaponDefs = { + missile = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "missiletrailgunship", + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + energypershot = 0, + edgeEffectiveness = 0.1, + fireStarter = 70, + + id = 136, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "missile.s3o", + name = "Rockets", + range = 750, + reloadtime = 30, + weaponType = "MissileLauncher", + + paralyzer = true, + paralyzetime = 10, + + smokeTrail = false, + soundHit = "explosions/unitexplodebig.wav", + soundHitWet = "explosions/subhitbomb.wav", + soundHitVolume = 10, + soundStart = "weapons/bomberlaunch.wav", + soundStartVolume = 10, + + startVelocity = 500, + tolerance = 5000, + turnRate = 10000, + tracks = false, + turret = false, + weaponAcceleration = 10, + waterweapon = true, + flightTime = 10, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "eraider", + nofriendlyfire = 1, + }, + damage = { + default = 5000, + }, + }, + airraider = { - AreaOfEffect = 100, + AreaOfEffect = 50, avoidFriendly = false, avoidFeature = false, collideFriendly = false, @@ -101,7 +158,6 @@ weaponDefs = { colorMap = "1 0.5 1 1 1 0.5 1 1 1 0.5 1 1 1 0.5 1 0.01", stages = 1, cegTag = "airraidershot", - edgeeffectiveness = 1, explosionGenerator = "custom:genericshellexplosion-medium-blue", energypershot = 0, impulseFactor = 0, @@ -121,10 +177,10 @@ weaponDefs = { waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eraider", + damagetype = "light", }, damage = { - default = 30, + default = 15, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua b/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua index 88d2c149a..2ca663e36 100644 --- a/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua @@ -13,7 +13,7 @@ unitDef = { canMove = true, canPatrol = true, canstop = "1", - category = "LIGHT VTOL", + category = "AIRLIGHT VTOL", collide = false, cruiseAlt = 135, description = [[Air Scout/Radar Plane]], @@ -21,14 +21,20 @@ unitDef = { energyStorage = 0, energyUse = 0, explodeAs = "smallExplosionGenericBlue", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, hoverAttack = true, floater = true, iconType = "scout", idleAutoHeal = .5, idleTime = 2200, isTargetingUpgrade = false, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + maxDamage = 160, maxSlope = 90, maxVelocity = 10, @@ -81,7 +87,8 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 5000, }, } diff --git a/Units-Configs-Basedefs/basedefs/air/escoutdrone_basedef.lua b/Units-Configs-Basedefs/basedefs/air/escoutdrone_basedef.lua new file mode 100644 index 000000000..170822fd7 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/escoutdrone_basedef.lua @@ -0,0 +1,101 @@ +unitDef = { + acceleration = 0.5, + airStrafe = true, + bankscale = "1", + brakeRate = 0.7, + buildCostEnergy = 0, + buildCostMetal = 10, + buildTime = 2.5, + buildpic = "edrone.png", + canAttack = true, + canDropFlare = false, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "AIRLIGHT VTOL DRONE", + collide = false, + cruiseAlt = 75, + description = [[Scouting Drone]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericPurple", + flareDelay = 0.1, + flareDropVector = "0 0 -1", + flareefficieny = "0.3", + flareReload = 3, + footprintX = 2, + footprintZ = 2, + hoverAttack = true, + iconType = "drone", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = 220, + maxSlope = 90, + maxVelocity = 15, + --verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericPurple", + side = "CORE", + sightDistance = 1000, + SonarDistance = 1000, + smoothAnim = true, + stealth = true, + turnRate = 5000, + unitname = unitName, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:jetstrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "droneweapon", + -- badTargetCategory = "LIGHT ARMORED", + -- }, + }, + customParams = { + unittype = "mobile", + --isupgraded = isUpgraded, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + --supply_cost = supply, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + retreatRangeDAI = 5000, + }, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/air/etransport_basedef.lua b/Units-Configs-Basedefs/basedefs/air/etransport_basedef.lua index ead3df65a..663be4c6d 100644 --- a/Units-Configs-Basedefs/basedefs/air/etransport_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/air/etransport_basedef.lua @@ -4,7 +4,7 @@ unitDef = { airHoverFactor = 0, brakeRate = 2, buildCostEnergy = 0, - buildCostMetal = 20, + buildCostMetal = 60, builder = false, buildTime = 2.5, buildpic = "etransport.png", @@ -15,7 +15,7 @@ unitDef = { canload = true, canPatrol = false, canstop = "1", - category = "ARMORED VTOL", + category = "AIRARMORED VTOL", collide = true, cruiseAlt = 110, description = [[Fast Armored Transport]], @@ -23,15 +23,21 @@ unitDef = { energyUse = 0, explodeAs = "mediumExplosionGenericPurple", fallSpeed = 1000, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, hoverAttack = true, holdSteady = true, -- hoverAttack = true, icontype = "etransport", - maxDamage = 200, + maxDamage = 500, maxSlope = 90, maxVelocity = 7, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + verticalSpeed = 30, name = humanName, objectName = objectName, @@ -43,7 +49,7 @@ unitDef = { sightDistance = 500, smoothAnim = true, transportbyenemy = false; - transportCapacity = 1, + transportCapacity = 32, transportMass = 10000, transportSize = 8, transportUnloadMethod = 0, @@ -82,7 +88,7 @@ unitDef = { --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua index d8e8ed461..9e25942b9 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua @@ -3,7 +3,7 @@ unitDef = { acceleration = 0.18, brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 1750, + buildCostMetal = 875, builder = false, buildTime = 5, buildpic = "eallterranarchid.png", @@ -20,7 +20,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 150, decloakOnFire = true, decloakSpherical = true, @@ -75,7 +75,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:flamethrowerrange750", "custom:blacksmoke", }, @@ -104,14 +104,14 @@ unitDef = { unittype = "mobile", isupgraded = isUpgraded, death_sounds = "nuke", - ProvideTech = techprovided, RequireTech = tech, armortype = armortype, --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -152,7 +152,7 @@ weaponDefs = { weaponVelocity = 800, customparams = { isupgraded = isUpgraded, - damagetype = "eallterranarchid", + damagetype = "antibuilding", }, damage = { default = 440, @@ -190,7 +190,7 @@ weaponDefs = { weaponVelocity = 400, customparams = { isupgraded = isUpgraded, - damagetype = "eallterranarchidflame", + damagetype = "antiarmored", }, damage = { default = 6, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua index 6b70f68cc..fe084ec16 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua @@ -19,7 +19,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 70, decloakOnFire = true, decloakSpherical = true, @@ -27,14 +27,14 @@ unitDef = { -- End Cloaking - description = [[Self-Propelled Precision Artillery • Uses +]] .. supply .. [[ Supply]], + description = [[Self-Propelled Precision Artillery]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "hugeExplosionGeneric", firestandorders = "1", - footprintX = 6, - footprintZ = 6, + footprintX = 3, + footprintZ = 3, iconType = "arty_arm", idleAutoHeal = .5, idleTime = 2200, @@ -44,7 +44,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "ALLTERRTANK6", + movementClass = "ALLTERRTANK3", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -53,7 +53,7 @@ unitDef = { repairable = false, selfDestructAs = "hugeExplosionGeneric", shootme = "1", - sightDistance = 1200, + sightDistance = 400, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -72,7 +72,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -88,6 +88,7 @@ unitDef = { weapons = { [1] = { def = "assaulttankcannon", + badTargetCategory = "VTOL LIGHT ARMORED BIO", }, }, customParams = { @@ -102,8 +103,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -117,7 +119,7 @@ weaponDefs = { beamTime = 0.1, coreThickness = 0.6, -- cegTag = "mediumcannonweapon3", - duration = 0.2, + duration = 0.3, energypershot = 0, explosionGenerator = "custom:genericshellexplosion-large-purple", fallOffRate = 0, @@ -139,10 +141,10 @@ weaponDefs = { thickness = 9, tolerance = 1000, turret = true, - weaponVelocity = 2000, + weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eallterrassault", + damagetype = "antibuildingarty", }, damage = { default = 150, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua index 0bda47f01..149b8a60a 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua @@ -18,8 +18,8 @@ unitDef = { -- Cloaking cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, + cloakCost = 0, + cloakCostMoving = 0, minCloakDistance = 70, decloakOnFire = true, decloakSpherical = true, @@ -27,14 +27,14 @@ unitDef = { -- End Cloaking - description = [[Main Battle Tank • Uses +]] .. supply .. [[ Supply]], + description = [[Main Battle Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGenericGreen", firestandorders = "1", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "td_arm_all", idleAutoHeal = .5, idleTime = 2200, @@ -45,7 +45,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "ALLTERRTANK4", + movementClass = "ALLTERRTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -73,7 +73,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -104,8 +104,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -144,10 +145,10 @@ weaponDefs = { thickness = 9, tolerance = 1000, turret = true, - weaponVelocity = 1000, + weaponVelocity = 1500, customparams = { isupgraded = isUpgraded, - damagetype = "eallterrheavy", + damagetype = "antilightarmored", }, damage = { default = 125, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua index 6ef0ae7ac..7b732e5d2 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua @@ -18,7 +18,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 70, decloakOnFire = true, decloakSpherical = true, @@ -26,14 +26,14 @@ unitDef = { -- End Cloaking - description = [[Raider • Uses +]] .. supply .. [[ Supply]], + description = [[Raider]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "smallExplosionGeneric", firestandorders = "1", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "raider", idleAutoHeal = .5, idleTime = 2200, @@ -44,7 +44,7 @@ unitDef = { turninplacespeedlimit = 5.5, maxWaterDepth = 10, metalStorage = 0, - movementClass = "ALLTERRTANK4", + movementClass = "ALLTERRTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -52,7 +52,7 @@ unitDef = { radarDistance = 0, repairable = false, selfDestructAs = "smallExplosionGeneric", - sightDistance = 500, + sightDistance = 650, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -70,7 +70,7 @@ unitDef = { explosiongenerators = { "custom:factorysparks", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -101,8 +101,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -140,7 +141,7 @@ unitDef = { weaponVelocity = 2000, customparams = { isupgraded = isUpgraded, - damagetype = "eallterrlight", + damagetype = "light", }, damage = { default = 50, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua index e78c2b0f5..c3210ac0c 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua @@ -18,7 +18,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 70, decloakOnFire = true, decloakSpherical = true, @@ -26,18 +26,18 @@ unitDef = { -- End Cloaking - description = [[Heavy Anti-Armor Tank Destroyer • Uses +]] .. supply .. [[ Supply]], + description = [[Heavy Anti-Armor Tank Destroyer]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "td_arm_arm", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 500, + maxDamage = 250, maxSlope = 180, maxVelocity = 3.5, maxReverseVelocity = 1, @@ -45,7 +45,7 @@ unitDef = { maxWaterDepth = 10, metalStorage = 0, mobilestandorders = "1", - movementClass = "ALLTERRTANK4", + movementClass = "ALLTERRTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -71,7 +71,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -102,8 +102,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -145,10 +146,10 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eallterrmed", + damagetype = "antiarmored", }, damage = { - default = 200, + default = 150, }, }, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua index f4924c74e..c5ad79489 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua @@ -20,7 +20,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 70, decloakOnFire = true, decloakSpherical = true, @@ -28,13 +28,13 @@ unitDef = { -- End Cloaking - description = [[EMP/Riot Tank • Uses +]] .. supply .. [[ Supply]], + description = [[EMP/Riot Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericRed", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "riot_lit", idleAutoHeal = .5, idleTime = 2200, @@ -46,7 +46,7 @@ unitDef = { turninplacespeedlimit = 3.3, maxWaterDepth = 10, metalStorage = 0, - movementClass = "ALLTERRTANK4", + movementClass = "ALLTERRTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -72,7 +72,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -109,8 +109,9 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, }, } @@ -153,7 +154,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eallterrriot", + damagetype = "light", nofriendlyfire = 1, }, damage = { @@ -186,7 +187,7 @@ weaponDefs = { weaponVelocity = 400, customparams = { isupgraded = isUpgraded, - damagetype = "eriottank2shotgun", + damagetype = "light", }, damage = { default = 300, diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua new file mode 100644 index 000000000..83feba2a4 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua @@ -0,0 +1,204 @@ +unitDef = { + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 27, + builder = false, + buildTime = 5, + buildpic = "eallterrriot.png", + canAttack = true, + + -- canDgun = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RIOT", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 70, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Shotgun/Riot Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericRed", + footprintX = 2, + footprintZ = 2, + iconType = "riot_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 400, + maxSlope = 180, + maxVelocity = 4.5, + maxReverseVelocity = 1, + turninplacespeedlimit = 3.3, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ALLTERRTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericRed", + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- onlyTargetCategory = "BIO LIGHT ARMORED BUILDING", + -- badTargetCategory = "WALL", + -- }, + [1] = { + def = "riottankshotgun", + onlyTargetCategory = "BIO LIGHT ARMORED BUILDING", + badTargetCategory = "WALL BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 2, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + decloakradiushalved = true, + }, +} + +weaponDefs = { + riottankempweapon = { + + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-blue", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "Laser", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 450, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, + + riottankshotgun = { + areaofeffect = 75, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + --burstrate = 0.2, + --burst = 5, + + cegTag = "bruisercannon", + edgeeffectiveness = 1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + noSelfDamage = true, + noexplode = true, + projectiles = 5, + range = 500, + reloadtime = 5, + sprayangle = 3500, + size = 2, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/Shotgun Boom 103.wav", + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = true, + single_hit = true, + }, + damage = { + default = 150, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua index 1caf58128..eff573e2c 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua @@ -18,7 +18,7 @@ unitDef = { cancloak = true, cloakCost = 0, - cloakCostMoving = 1, + cloakCostMoving = 0, minCloakDistance = 150, decloakOnFire = false, decloakSpherical = true, @@ -26,14 +26,14 @@ unitDef = { -- Starting out cloaked will dramatically increase the initial cost, however, it is much more convenient from a micromanagement standpoint. -- End Cloaking - description = [[Shield/Cloak Field Emitter • Uses +]] .. supply .. [[ Supply]], + description = [[Shield/Cloak Field Emitter]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "hugeExplosionGenericPurple", fireState = "0", - footprintX = 5, - footprintZ = 5, + footprintX = 2, + footprintZ = 2, iconType = "shield_lit", idleAutoHeal = .5, idleTime = 2200, @@ -44,7 +44,7 @@ unitDef = { turninplacespeedlimit = 4, maxWaterDepth = 10, metalStorage = 0, - movementClass = "ALLTERRTANK5", + movementClass = "ALLTERRTANK2", moveState = "0", name = humanName, noChaseCategory = "VTOL", @@ -71,7 +71,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirtsmall", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -99,12 +99,15 @@ unitDef = { armortype = armortype, nofriendlyfire = "1", supply_cost = supply, - shield_power = 1500, + shield_power = 500, shield_radius = 300, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + retreatRangeDAI = 600, + + decloakradiushalved = true, area_cloak = 1, -- Can this unit emit a cloaking field? area_cloak_upkeep = 5, -- How much energy does it cost to maintain the cloaking field? @@ -131,9 +134,9 @@ weaponDefs = { ShieldStartingPower = 0, Shieldenergyuse = 0, Shieldradius = 300, - Shieldpower = 1500, - Shieldpowerregen = 15, - Shieldpowerregenenergy = 0, + Shieldpower = 500, + Shieldpowerregen = 25, + Shieldpowerregenenergy = 25, Shieldintercepttype = 4, Shieldgoodcolor = "0.0 0.2 1.0", Shieldbadcolor = "1.0 0 0", diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua index 48e51dee9..c3f4b816e 100644 --- a/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua @@ -37,8 +37,8 @@ unitDef = { energyUse = 0, energyMake = 0, explodeAs = "largeExplosionGenericGreen", - footprintX = 22, - footprintZ = 22, + footprintX = 11, + footprintZ = 11, iconType = "factory", idleAutoHeal = .5, idleTime = 2200, @@ -60,7 +60,7 @@ unitDef = { unitname = unitName, -- unitRestricted = 1, workerTime = 1, - yardMap = "oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyyyooo", + yardMap = "ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ", -- usePieceCollisionVolumes = true, sfxtypes = { pieceExplosionGenerators = { @@ -83,13 +83,14 @@ unitDef = { }, }, customParams = { - unittype = "building", + unittype = "factory", death_sounds = "generic", armortype = "building", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", + decloakradiushalved = true, -- ProvideTech = "1 Powergrid", -- ProvideTechRange = "1500", -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua index 75bfd0ad4..6122e2db2 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua @@ -12,32 +12,32 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB SUPPORT", - description = [[Self-Propelled Laser Artillery • Uses +]] .. supply .. [[ Supply]], + description = [[Self-Propelled Laser Artillery]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGenericBlue", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "arty_lit", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, maxDamage = 300, maxSlope = 28, - maxVelocity = 3, + maxVelocity = 3.5, maxReverseVelocity = 1, minWaterDepth = 10, metalStorage = 0, - movementClass = "TANK4", + movementClass = "TANK2", name = humanName, objectName = objectName, script = script, radarDistance = 0, repairable = false, selfDestructAs = "largeExplosionGenericBlue", - sightDistance = 1100, - SonarDistance = 1100, + sightDistance = 365, + SonarDistance = 365, stealth = true, seismicSignature = 2, sonarStealth = false, @@ -58,7 +58,7 @@ unitDef = { explosiongenerators = { "custom:factorysparks", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -74,6 +74,7 @@ unitDef = { weapons = { [1] = { def = "assimilatorbeamweapon", + badTargetCategory = "VTOL LIGHT ARMORED BIO", }, }, customParams = { @@ -88,7 +89,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -131,7 +132,7 @@ weaponDefs = { waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibarty", + damagetype = "antibuildingarty", }, damage = { default = 100, diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibbuggy_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibbuggy_basedef.lua index 7697b4c18..d34e194bd 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibbuggy_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibbuggy_basedef.lua @@ -12,7 +12,7 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB RAID", - description = [[Raider • Uses +]] .. supply .. [[ Supply]], + description = [[Raider]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -25,7 +25,7 @@ unitDef = { leaveTracks = false, maxDamage = 120, maxSlope = 28, - maxVelocity = 6.0, + maxVelocity = 6.5, maxReverseVelocity = 2, maxWaterDepth = 5000, metalStorage = 0, @@ -37,8 +37,8 @@ unitDef = { radarDistance = 0, repairable = false, selfDestructAs = "smallExplosionGenericRed", - sightDistance = 500, - sonarDistance = 500, + sightDistance = 650, + sonarDistance = 650, stealth = true, seismicSignature = 2, sonarStealth = false, @@ -60,7 +60,7 @@ unitDef = { explosiongenerators = { "custom:factorysparks", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -91,7 +91,7 @@ unitDef = { supply_cost = 1, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -136,7 +136,8 @@ weaponDefs = { waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibbuggy", + damagetype = "light", + nofriendlyfire = 1, }, damage = { default = 13.5, -- multiply * 1.2 for correct dps output diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibfac_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibfac_basedef.lua index 0c88dc9bf..cea468d3a 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibfac_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibfac_basedef.lua @@ -23,8 +23,8 @@ unitDef = { energyUse = 0, energyMake = 0, explodeAs = "hugeBuildingExplosionGenericBlue", - footprintX = 16, - footprintZ = 16, + footprintX = 8, + footprintZ = 8, iconType = "factory", idleAutoHeal = .5, idleTime = 2200, @@ -48,7 +48,7 @@ unitDef = { unitname = unitName, -- unitRestricted = 1, workerTime = 1, - yardMap = "yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo yyyyyyyyoooooooo", + yardMap = "cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc ", -- usePieceCollisionVolumes = true, useGroundDecal = true, @@ -77,12 +77,12 @@ unitDef = { }, }, customParams = { - unittype = "building", + unittype = "factory", death_sounds = "generic", armortype = "building", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- ProvideTech = "1 Powergrid", -- ProvideTechRange = "1500", diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua index fcf262744..7ab5284d5 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua @@ -2,7 +2,7 @@ unitDef = { acceleration = 0.18, brakeRate = 0.1, buildCostEnergy = 0, - buildCostMetal = 1750, + buildCostMetal = 875, builder = false, buildTime = 5, buildpic = "eamphibleveler.png", @@ -25,7 +25,7 @@ unitDef = { leaveTracks = false, maxDamage = 20000, maxSlope = 28, - maxVelocity = 4, + maxVelocity = 4.5, maxReverseVelocity = 1, maxWaterDepth = 5000, metalStorage = 0, @@ -56,7 +56,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -81,13 +81,12 @@ unitDef = { isupgraded = isUpgraded, unittype = "mobile", death_sounds = "nuke", - ProvideTech = techprovided, RequireTech = tech, armortype = armortype, --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -125,7 +124,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibleveler", + damagetype = "antiarmored", }, damage = { default = 250, @@ -164,7 +163,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibleveler", + damagetype = "light", }, damage = { default = 6, diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibmedtank_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibmedtank_basedef.lua index 8a9de51ae..efacc9bbf 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibmedtank_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibmedtank_basedef.lua @@ -13,24 +13,24 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB SKIRMISHER", - description = [[Light Main Battle Tank • Uses +]] .. supply .. [[ Supply]], + description = [[Light Main Battle Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericGreen", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, iconType = "td_lit_all", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, maxDamage = 360, maxSlope = 28, - maxVelocity = 4.5, + maxVelocity = 5, maxReverseVelocity = 1, maxWaterDepth = 5000, metalStorage = 0, - movementClass = "TANK3", + movementClass = "TANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -61,7 +61,7 @@ unitDef = { explosiongenerators = { "custom:factorysparks", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -92,7 +92,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -139,10 +139,10 @@ weaponDefs = { waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibmedtank", + damagetype = "light", }, damage = { - default = 12.5, -- multiply * 1.2 for correct dps output + default = 16, -- multiply * 1.2 for correct dps output }, }, } diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibneedle_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibneedle_basedef.lua index 927a64fea..7694a919f 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibneedle_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibneedle_basedef.lua @@ -13,24 +13,24 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB RAID", - description = [[Light Tank Destroyer • Uses +]] .. supply .. [[ Supply]], + description = [[Light Tank Destroyer]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "td_lit_lit", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, maxDamage = 340, maxSlope = 28, - maxVelocity = 5.5, + maxVelocity = 6, maxReverseVelocity = 2, maxWaterDepth = 5000, metalStorage = 0, - movementClass = "TANK4", + movementClass = "TANK2", name = humanName, objectName = objectName, script = script, @@ -60,7 +60,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -91,7 +91,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -137,7 +137,7 @@ weaponDefs = { waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibneedle", + damagetype = "light", }, damage = { default = 20, -- multiply * 1.2 for correct dps output diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_basedef.lua index 93a482a7b..620955d9e 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_basedef.lua @@ -14,24 +14,24 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB RIOT", - description = [[EMP/Riot Tank • Uses +]] .. supply .. [[ Supply]], + description = [[EMP/Riot Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericWhite", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, iconType = "riot_lit", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, maxDamage = 340, maxSlope = 28, - maxVelocity = 5, + maxVelocity = 5.5, maxReverseVelocity = 1, maxWaterDepth = 5000, metalStorage = 0, - movementClass = "TANK3", + movementClass = "TANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -62,7 +62,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -97,7 +97,7 @@ unitDef = { supply_cost = 3, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -141,7 +141,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibriot", + damagetype = "light", nofriendlyfire = 1, }, damage = { @@ -174,7 +174,7 @@ weaponDefs = { weaponVelocity = 400, customparams = { isupgraded = isUpgraded, - damagetype = "eriottank2shotgun", + damagetype = "light", }, damage = { default = 300, diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua new file mode 100644 index 000000000..2345dab85 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua @@ -0,0 +1,191 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 23, + builder = false, + buildTime = 5, + buildpic = "eamphibriot.png", + canAttack = true, + + -- canDgun = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB RIOT", + description = [[Shotgun/Riot Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericWhite", + footprintX = 2, + footprintZ = 2, + iconType = "riot_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 340, + maxSlope = 28, + maxVelocity = 5.5, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericWhite", + side = "CORE", + sightDistance = 500, + sonarDistance = 500, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 3.7, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 430, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- badTargetCategory = "WALL", + -- }, + [1] = { + def = "riottankshotgun", + badTargetCategory = "WALL BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 2, + death_sounds = "generic", + RequireTech = tech, + armortype = "light", + nofriendlyfire = "1", + supply_cost = 3, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + riottankempweapon = { + + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-blue", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "Laser", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 400, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, + + riottankshotgun = { + AreaOfEffect = 75, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + --burstrate = 0.2, + --burst = 5, + + cegTag = "bruisercannon", + edgeeffectiveness = 1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + noSelfDamage = true, + noexplode = true, + projectiles = 5, + range = 500, + reloadtime = 5, + sprayangle = 3500, + size = 2, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/Shotgun Boom 101.wav", + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = true, + single_hit = true, + }, + damage = { + default = 150, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibrock_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibrock_basedef.lua index 7d7e4cb99..af788216e 100644 --- a/Units-Configs-Basedefs/basedefs/amphib/eamphibrock_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibrock_basedef.lua @@ -12,24 +12,24 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT AMPHIB SUPPORT", - description = [[Anti-Armor Missile Support Tank • Uses +]] .. supply .. [[ Supply]], + description = [[Anti-Armor Missile Support Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGeneric", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "mtd_lit_arm", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, maxDamage = 320, maxSlope = 28, - maxVelocity = 3.4, + maxVelocity = 4, maxReverseVelocity = 1, maxWaterDepth = 5000, metalStorage = 0, - movementClass = "TANK4", + movementClass = "TANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -59,7 +59,7 @@ unitDef = { }, explosiongenerators = { - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:jethtrail", }, @@ -96,7 +96,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -109,7 +109,7 @@ weaponDefs = { avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrailsmall", + cegTag = "amphibrocktrail-optimized", explosionGenerator = "custom:genericshellexplosion-medium-red", energypershot = 0, fireStarter = 70, @@ -126,16 +126,14 @@ weaponDefs = { soundHit = "explosions/explode5.wav", startVelocity = 250, tolerance = 8000, - turnrate = 5000, - predictBoost = 0.5, + turnrate = 30000, turret = true, - weaponAcceleration = 50, + weaponAcceleration = 400, flightTime = 5, - trajectoryHeight = 1.5, - weaponVelocity = 500, + weaponVelocity = 3000, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibrock", + damagetype = "antiarmoredair", }, damage = { default = 200, @@ -167,17 +165,14 @@ weaponDefs = { soundHit = "explosions/explode5.wav", startVelocity = 250, tolerance = 8000, - turnrate = 10000, - predictBoost = 0.5, + turnrate = 30000, turret = true, - weaponAcceleration = 50, + weaponAcceleration = 400, flightTime = 5, - trajectoryHeight = 1.5, - sprayangle = 10000, - weaponVelocity = 500, + weaponVelocity = 3000, customparams = { isupgraded = isUpgraded, - damagetype = "eamphibrock", + damagetype = "antiarmoredair", }, damage = { default = 200, diff --git a/Units-Configs-Basedefs/basedefs/buildings/eartyturret_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/eartyturret_basedef.lua index ceb475c0a..662ff9aa7 100644 --- a/Units-Configs-Basedefs/basedefs/buildings/eartyturret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/buildings/eartyturret_basedef.lua @@ -54,7 +54,7 @@ unitDef = { [1] = { def = "artyweapon", badtargetcategory = "LIGHT ARMORED VTOL", - onlyTargetCategory = "BUILDING BIO", + --onlyTargetCategory = "BUILDING BIO", }, }, customParams = { @@ -68,7 +68,7 @@ unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -90,13 +90,16 @@ weaponDefs = { avoidNeutral = false, explosionGenerator = "custom:NUKEDATBEWMSMALL", energypershot = 0, - edgeEffectiveness = 1, + edgeEffectiveness = 0.1, impulseFactor = 0, interceptedByShieldType = 4, + + minIntensity = 1, + name = "Plasma Cannon", range = 8000, - reloadtime = 40, + reloadtime = 30, size = 16, weaponType = "Cannon", soundHit = "explosions/artyhit.wav", @@ -105,8 +108,9 @@ weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eartytank", + damagetype = "antibuilding", isupgraded = isUpgraded, + --effectedByunitHealthModifier = true, }, damage = { default = 1000, diff --git a/Units-Configs-Basedefs/basedefs/buildings/eflakturret_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/eflakturret_basedef.lua new file mode 100644 index 000000000..5cf9f0876 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/eflakturret_basedef.lua @@ -0,0 +1,134 @@ +unitDef = { + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = 50, + builder = false, + buildTime = 5, + buildpic = "elaserbattery.png", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + collisionVolumeTest = "1", + description = [[Anti-AIR Flak Defense Platform]], + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumBuildingExplosionGeneric", + footprintX = 3, + footprintZ = 3, + floater = true, + idleAutoHeal = .5, + idleTime = 2200, + iconType = "turret_lit", + maxDamage = 625, + maxSlope = 60, + maxWaterDepth = 999999, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + onlytargetcategory2 = "NOTAIR", + onlytargetcategory3 = "NOTAIR", + onlytargetcategory4 = "NOTAIR", + onlytargetcategory5 = "NOTAIR", + onlytargetcategory6 = "NOTAIR", + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumBuildingExplosionGeneric", + side = "CORE", + sightDistance = 100, + airsightdistance = 1500, + smoothAnim = true, + unitname = unitName, + workerTime = 0, + yardMap = "oooo oooo oooo oooo", + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:needspower", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/turretselect", + }, + }, + weapons = { + [1] = { + def = "aircannon", + onlyTargetCategory = "VTOL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "turret", + RequireTech = tech, + needed_cover = 2, + --supply_cost = supply, + death_sounds = "generic", + armortype = armortype, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 8, + BuildingGroundDecalSizeY = 8, + BuildingGroundDecalDecaySpeed = 0.9, +} + +weaponDefs = { + aircannon = { + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + canAttackGround = false, + coreThickness = 0.5, + burnblow = true, + --cegTag = "railgun", + duration = 0.05, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-purple", + edgeEffectiveness = 1, + fallOffRate = 1, + fireStarter = 50, + impulseFactor = 0, + minintensity = "1", + name = "Laser", + range = 1500, + reloadtime = 1, + WeaponType = "Cannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + projectiles = 4, + soundTrigger = true, + soundstart = "weapons/Assault Rifle Shot_05.wav", + soundhit = "deathsounds/generic/Explosion Fireworks_01.wav", + sprayangle = 3000, + size = 5, + --texture1 = "shot", + --texture2 = "empty", + tolerance = 7500, + turret = true, + weaponVelocity = 3000, + customparams = { + damagetype = "antiair", + isupgraded = isUpgraded, + effectedByunitHealthModifier = true, + }, + damage = { + default = 125, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/buildings/eheavyturret2_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/eheavyturret2_basedef.lua index c28a4c262..a1fdcf179 100644 --- a/Units-Configs-Basedefs/basedefs/buildings/eheavyturret2_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/buildings/eheavyturret2_basedef.lua @@ -1,7 +1,7 @@ unitDef = { buildAngle = 8192, buildCostEnergy = 0, - buildCostMetal = 160, + buildCostMetal = 60, builder = false, buildTime = 5, buildpic = "eheavyturret2.png", @@ -12,17 +12,17 @@ unitDef = { canAttack = true, canstop = "1", category = "BUILDING NOTAIR", - description = [[Heavy Plasma Battery (Anti-Armor) • Uses +]] .. supply .. [[ Supply]], + description = [[Heavy Plasma Battery (Anti-Armor)]], energyStorage = 0, energyUse = 0, explodeAs = "largeBuildingExplosionGenericRed", - footprintX = 6, - footprintZ = 6, + footprintX = 3, + footprintZ = 3, floater = true, idleAutoHeal = .5, idleTime = 2200, iconType = "turret_arm", - maxDamage = 2000, + maxDamage = 1200, maxSlope = 60, maxWaterDepth = 999999, metalStorage = 0, @@ -37,7 +37,7 @@ unitDef = { repairable = false, selfDestructAs = "largeBuildingExplosionGenericRed", side = "CORE", - sightDistance = 1000, + sightDistance = 750, smoothAnim = true, unitname = unitName, workerTime = 0, @@ -64,7 +64,7 @@ unitDef = { weapons = { [1] = { def = "eheavyturretweapon2", - badTargetCategory = "LIGHT VTOL", + badTargetCategory = "LIGHT VTOL BUILDING", onlyTargetCategory = "BIO ARMORED LIGHT", }, }, @@ -72,13 +72,13 @@ unitDef = { isupgraded = isUpgraded, unittype = "turret", needed_cover = 5, - supply_cost = supply, + --supply_cost = supply, RequireTech = tech, death_sounds = "generic", armortype = armortype, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, useGroundDecal = true, @@ -91,27 +91,24 @@ unitDef = { weaponDefs = { eheavyturretweapon2 = { - AreaOfEffect = 50, + AreaOfEffect = 250, avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - + avoidFriendly = false, collideFeature = false, collideFriendly = false, coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", duration = 0.25, energypershot = 0, + edgeeffectiveness = 0, explosionGenerator = "custom:genericshellexplosion-medium", fallOffRate = 0, fireStarter = 100, impulseFactor = 0, - interceptedByShieldType = 4, - + interceptedByShieldType = 4, minintensity = "1", name = "Laser", - range = 1000, - reloadtime = 1, + range = 750, + reloadtime = 2, WeaponType = "LaserCannon", rgbColor = "1 0.5 0", rgbColor2 = "1 1 1", @@ -123,13 +120,15 @@ weaponDefs = { thickness = 9, tolerance = 1000, turret = true, - weaponVelocity = 1000, + weaponVelocity = 3000, + waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "eheavyturret2", + damagetype = "turretantilightarmored", + effectedByunitHealthModifier = true, }, damage = { - default = 300, + default = 500, }, }, } \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/buildings/elaserbattery_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/elaserbattery_basedef.lua new file mode 100644 index 000000000..7ec880e9a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/elaserbattery_basedef.lua @@ -0,0 +1,137 @@ +unitDef = { + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = 50, + builder = false, + buildTime = 5, + buildpic = "elaserbattery.png", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + collisionVolumeTest = "1", + description = [[Anti-AIR Laser Defense Platform]], + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumBuildingExplosionGeneric", + footprintX = 3, + footprintZ = 3, + floater = true, + idleAutoHeal = .5, + idleTime = 2200, + iconType = "turret_lit", + maxDamage = 625, + maxSlope = 60, + maxWaterDepth = 999999, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + onlytargetcategory2 = "NOTAIR", + onlytargetcategory3 = "NOTAIR", + onlytargetcategory4 = "NOTAIR", + onlytargetcategory5 = "NOTAIR", + onlytargetcategory6 = "NOTAIR", + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumBuildingExplosionGeneric", + side = "CORE", + sightDistance = 100, + airsightdistance = 1000, + smoothAnim = true, + unitname = unitName, + workerTime = 0, + yardMap = "oooo oooo oooo oooo", + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:electricity", + "custom:needspower", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/turretselect", + }, + }, + weapons = { + [1] = { + def = "lighteweapon", + onlyTargetCategory = "VTOL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "turret", + RequireTech = tech, + needed_cover = 2, + --supply_cost = supply, + death_sounds = "generic", + armortype = armortype, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 8, + BuildingGroundDecalSizeY = 8, + BuildingGroundDecalDecaySpeed = 0.9, +} + +weaponDefs = { + lighteweapon = { + predictboost = 0.3, + AreaOfEffect = 0, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + collideFeature = false, + collideFriendly = false, + canAttackGround = false, + coreThickness = 0.5, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", + fallOffRate = 1, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0.1, + + largebeamlaser = true, + laserflaresize = 8, + minintensity = 1, + name = "Laser", + range = 1000, + reloadtime = 0.1, + WeaponType = "BeamLaser", + rgbColor = "0.25 0 0.6", + rgbColor2 = "0.8 0.8 0.8", + soundTrigger = true, + soundstart = "weapons/aegis.wav", + -- soundHit = "weapons/amphibmedtankshothit.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", + thickness = 6, + tolerance = 3000, + turret = true, + weaponVelocity = 1000, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + damagetype = "antiair", + effectedByunitHealthModifier = true, + }, + damage = { + default = 30, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/buildings/elightturret2_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/elightturret2_basedef.lua index 5c5eb669e..efa83eeb5 100644 --- a/Units-Configs-Basedefs/basedefs/buildings/elightturret2_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/buildings/elightturret2_basedef.lua @@ -1,7 +1,7 @@ unitDef = { buildAngle = 2048, buildCostEnergy = 0, - buildCostMetal = 50, + buildCostMetal = 27, builder = false, buildTime = 5, buildpic = "elightturret2.png", @@ -9,17 +9,17 @@ unitDef = { canstop = "1", category = "BUILDING NOTAIR", collisionVolumeTest = "1", - description = [[Anti-Raid Defense Platform (Anti-Light) • Uses +]] .. supply .. [[ Supply]], + description = [[Anti-Raid Defense Platform (Anti-Light)]], energyStorage = 0, energyUse = 0, explodeAs = "mediumBuildingExplosionGeneric", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, floater = true, idleAutoHeal = .5, idleTime = 2200, iconType = "turret_lit", - maxDamage = 1250, + maxDamage = 625, maxSlope = 60, maxWaterDepth = 999999, metalStorage = 0, @@ -35,7 +35,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumBuildingExplosionGeneric", side = "CORE", - sightDistance = 1000, + sightDistance = 650, smoothAnim = true, unitname = unitName, workerTime = 0, @@ -48,7 +48,7 @@ unitDef = { }, explosiongenerators = { - "custom:electricity", + "custom:gdhcannon", "custom:needspower", "custom:blacksmoke", }, @@ -62,7 +62,7 @@ unitDef = { weapons = { [1] = { def = "lighteweapon", - badTargetCategory = "VTOL ARMORED", + badTargetCategory = "VTOL ARMORED BUILDING", onlyTargetCategory = "BIO LIGHT VTOL ARMORED", }, }, @@ -71,12 +71,12 @@ unitDef = { unittype = "turret", RequireTech = tech, needed_cover = 2, - supply_cost = supply, + --supply_cost = supply, death_sounds = "generic", armortype = armortype, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, useGroundDecal = true, @@ -88,35 +88,42 @@ unitDef = { weaponDefs = { lighteweapon = { - AreaOfEffect = 0, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - craterBoost = 0, - craterMult = 0, - beamTTL = 10, - explosionGenerator = "custom:genericshellexplosion-medium-lightning", - energypershot = 0, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, + AreaOfEffect = 25, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + cegTag = "railgun", + coreThickness = 0.5, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-blue", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, - noSelfDamage = true, - range = 1000, - reloadtime = 1, - WeaponType = "LightningCannon", - rgbColor = "0.1 0.2 0.5", - rgbColor2 = "0 0 1", - soundStart = "weapons/jacobs.wav", - - texture1 = "lightning", - thickness = 10, - turret = true, - weaponVelocity = 400, + minintensity = "1", + name = "Laser", + range = 650, + reloadtime = 0.5, + WeaponType = "LaserCannon", + rgbColor = "0 0 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/lightturret.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 12, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + waterweapon = true, customparams = { isupgraded = isUpgraded, - damagetype = "elightturret2", + damagetype = "turretantilight", + unittype = "turret", + effectedByunitHealthModifier = true, }, damage = { default = 100, diff --git a/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua index b12392cf3..bb415c0eb 100644 --- a/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua @@ -15,13 +15,13 @@ unitDef = { energyUse = energyUse, explodeAs = "largeBuildingExplosionGenericRed", makesMetal = 0, - footprintX = 7, - footprintZ = 7, + footprintX = 9, + footprintZ = 9, iconType = "eco", idleAutoHeal = .5, idleTime = 2200, maxDamage = buildCostMetal * 12.5, - maxSlope = 60, + maxSlope = 90, maxWaterDepth = 5000, metalStorage = 0, metalMake = 0, @@ -32,13 +32,13 @@ unitDef = { radarDistance = 0, repairable = false, selfDestructAs = "largeBuildingExplosionGenericRed", - selfDestructCountdown = 1, + selfDestructCountdown = 15, side = "CORE", sightDistance = 200, smoothAnim = true, unitName = unitName, workerTime = 0, - yardMap = "ooooooo ooooooo ooooooo ooooooo ooooooo ooooooo ooooooo", + yardMap = "yyyyyyyyy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yyyyyyyyy", sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -67,11 +67,11 @@ unitDef = { needed_cover = 3, death_sounds = "generic", armortype = armortype, + noenergycost = true, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", - helptext = [[]], }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", diff --git a/Units-Configs-Basedefs/basedefs/buildings/eradar2_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/eradar2_basedef.lua new file mode 100644 index 000000000..adc30b62e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/eradar2_basedef.lua @@ -0,0 +1,76 @@ +unitDef = { + activateWhenBuilt = true, + buildAngle = 16384, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = false, + buildTime = 5, + category = "BUILDING NOTAIR", + description = [[Radar Dome/Sensor Tower]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeBuildingExplosionGenericWhite", + footprintX = 6, + footprintZ = 6, + floater = true, + iconType = "radar", + idleAutoHeal = .5, + idleTime = 2200, + isTargetingUpgrade = false, + maxDamage = 250, + maxSlope = 75, + maxWaterDepth = 999999, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = "eradar3.cob", + onoffable = false, + radarDistance = radarDistance, + radarEmitHeight = radarEmitHeight, + repairable = false, + selfDestructAs = "largeBuildingExplosionGenericWhite", + side = "CORE", + sightDistance = sightDistance, + smoothAnim = true, + sonarDistance = sonarDistance, + seismicDistance = seismicDistance, + unitname = "eradar2", + workerTime = 0, + yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:blacksmoke", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdradar", + }, + }, + customParams = { + RequireTech = tech, + unittype = "building", + needed_cover = 2, + death_sounds = "generic", + armortype = armortype, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + helptext = [[]], + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 8, + BuildingGroundDecalSizeY = 8, + BuildingGroundDecalDecaySpeed = 0.9, +} diff --git a/Units-Configs-Basedefs/basedefs/buildings/euwturret_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/euwturret_basedef.lua index e76207b6b..db1d837dd 100644 --- a/Units-Configs-Basedefs/basedefs/buildings/euwturret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/buildings/euwturret_basedef.lua @@ -1,4 +1,4 @@ -unitDef = { +unitDef = { buildAngle = 2048, buildCostEnergy = 0, @@ -80,7 +80,7 @@ unitDef = { armortype = armortype, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } diff --git a/Units-Configs-Basedefs/basedefs/chickens/croost_basedef.lua b/Units-Configs-Basedefs/basedefs/chickens/croost_basedef.lua new file mode 100644 index 000000000..703cfa00a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/chickens/croost_basedef.lua @@ -0,0 +1,106 @@ +unitDef = { + + activateWhenBuilt = true, + acceleration = 1, + brakeRate = 0.24, + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildingMask = 0, + buildDistance = 1500, + builder = true, + buildTime = 5, + buildPic = "chicken_unitpics/roost.png", + capturable = false, + CanAttack = false, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + category = "BUILDING NOTAIR ECO", + description = [[Generates Metal from Resource Nodes]], + energyStorage = 0, + energyUse = energyUse, + explodeAs = "largeBuildingExplosionGenericRed", + makesMetal = 0, + footprintX = 2, + footprintZ = 2, + iconType = "eco", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = 1000, + maxSlope = 90, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + movementClass = "HOVERHBOT4", + pushResistant = true, + script = script, + onoffable = false, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeBuildingExplosionGenericRed", + selfDestructCountdown = 15, + side = "CORE", + sightDistance = 200, + smoothAnim = true, + unitName = unitName, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 0.5, + yardMap = "yyyyyyyyy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yyyyyyyyy", + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:blacksmoke", + --primaryCEG, + --"custom:skyhatelaser", + }, + }, + buildoptions = Shared.buildListChicken, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdmex", + }, + }, + weapons = { + }, + customParams = { + --RequireTech = tech, + unittype = "building", + metal_extractor = metalMultiplier, + iseco = 1, + needed_cover = 3, + death_sounds = "generic", + armortype = armortype, + noenergycost = true, + --normaltex = "unittextures/lego2skin_explorernormal.dds", + --buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "chickens", + --corpse = "energycore", + helptext = [[]], + customgrounddecal = true, + }, + useGroundDecal = true, + BuildingGroundDecalType = "chickengroundplate.dds", + BuildingGroundDecalSizeX = 18, + BuildingGroundDecalSizeY = 18, + BuildingGroundDecalDecaySpeed = 0.9, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/commander_basedef.lua b/Units-Configs-Basedefs/basedefs/commander_basedef.lua new file mode 100644 index 000000000..cba38873f --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/commander_basedef.lua @@ -0,0 +1,381 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 350, + builder = true, + buildTime = 2.5, + buildpic = buildpicture, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = footprintx, + footprintZ = footprintz, + + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = maxdamage, + maxSlope = 180, + maxVelocity = maxvelocity, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = movementclass, + moveState = "0", + name = humanname, + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = objectname, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 1, -- 0.03125 = 1 hp per second + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + "custom:gdhcannon", + }, + }, + buildoptions = buildlist, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = weapon1, + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplygiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, +} + +-------------------------------------------------------------------------------- + +weaponDefs = { + + machinegun = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 200, + }, + }, + + machinegun_up1 = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0.5 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 300, + }, + }, + + machinegun_up2 = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 1 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 450, + }, + }, + + machinegun_up3 = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 675, + }, + }, + + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, + + heavybeamweapon = { + AreaOfEffect = 10, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + largebeamlaser = true, + beamTime = 0.5, + cameraShake = 0, + coreThickness = 0.5, + -- cegTag = "mediumcannonweapon3", + -- duration = 0.2, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + minintensity = 1, + name = "Laser", + range = 800, + reloadtime = 0.5, + WeaponType = "BeamLaser", + rgbColor = "0 0 1", + rgbColor2 = "0.5 0.5 0.5", + soundTrigger = true, + soundstart = "weapons/Sci Fi Beam 3-short.wav", + -- soundHit = "explosions/mediumcannonhit.wav", + -- sweepfire = true, + texture1 = "lightning", + texture2 = "laserend", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "antilightarmored", + }, + damage = { + default = 500, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/eorb_basedef.lua b/Units-Configs-Basedefs/basedefs/eorb_basedef.lua index 799220351..dc6434014 100644 --- a/Units-Configs-Basedefs/basedefs/eorb_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/eorb_basedef.lua @@ -24,16 +24,16 @@ unitDef = { canHover = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "LIGHT NOTAIR SUPPORT", - description = [[Field Medic / Construction Assistant / Energy Core Reclamation]], + description = [[Field Medic / Construction Assistant]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericGreen", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, fireState = "0", iconType = "orb", idleAutoHeal = .5, @@ -46,7 +46,7 @@ unitDef = { maxWaterDepth = 5000, metalmake = 0, metalStorage = 0, - movementClass = "HOVERHBOT3", + movementClass = "HOVERHBOT2", moveState = "2", name = humanName, objectName = objectName, @@ -71,7 +71,7 @@ unitDef = { upright = true, workerTime = workerTime, capturespeed = 0, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, repairspeed = 0.3125, sfxtypes = { @@ -82,10 +82,11 @@ unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, + buildoptions = buildlist, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -105,10 +106,12 @@ unitDef = { death_sounds = "generic", energycorecollect = true, armortype = armortype, --- supply_cost = supply, + noenergycost = true, + area_mex_def = "emetalextractor", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", + retreatRangeDAI = buildDistance*2, -- groundtexselectimg = ":nc:bitmaps/icons/repairzone.png", -- groundtexselectxsize = 1000, diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua index 9fc0c8aa1..8db03603a 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua @@ -20,8 +20,8 @@ unitDef = { energyUse = 0, energyMake = 0, explodeAs = "hugeBuildingExplosionGeneric", - footprintX = 20, - footprintZ = 20, + footprintX = 10, + footprintZ = 10, floater = true, iconType = "factory", idleAutoHeal = .5, @@ -45,7 +45,7 @@ unitDef = { unitname = unitName, -- unitRestricted = 1, workerTime = 1, - yardMap = "oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo", + yardMap = "cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc ", -- usePieceCollisionVolumes = true, -- modelCenterOffset = {108, 10, 0}, sfxtypes = { @@ -71,12 +71,12 @@ unitDef = { weapons = { }, customParams = { - unittype = "building", + unittype = "factory", death_sounds = "generic", armortype = "building", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", helptext = [[]], corpse = "energycore", }, diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua index f6d99054c..d7868b392 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua @@ -7,7 +7,7 @@ unitDef = { acceleration = 1, brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 1500, + buildCostMetal = 750, builder = false, buildTime = 5, buildpic = [[ehbotkarganneth.png]], @@ -62,7 +62,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -101,7 +101,7 @@ unitDef = { -- supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -122,24 +122,28 @@ weaponDefs = { fallOffRate = 0, fireStarter = 50, interceptedByShieldType = 4, + impulsefactor = 0, minintensity = "1", - name = "Machine Gun", + name = "Gatling Laser Cannon", + largebeamlaser = true, + laserflaresize = 5, range = 1000, reloadtime = 0.1, - WeaponType = "LaserCannon", + WeaponType = "BeamLaser", rgbColor = "1 0 0", rgbColor2 = "1 1 1", soundTrigger = true, - soundstart = "weapons/tgunshipfire.wav", - texture1 = "shot", - texture2 = "empty", + soundstart = "weapons/plasma2.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", thickness = 8, tolerance = 1000, turret = true, weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "ehbotkarganneth", + damagetype = "antiarmored", }, damage = { default = 40, diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua index ff2c7b965..459209ae2 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua @@ -19,13 +19,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR RAID", - description = [[Raider • Uses +]] .. supply .. [[ Supply]], + description = [[Raider]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "smallExplosionGenericBlue", - footprintX = 5, - footprintZ = 5, + footprintX = 2, + footprintZ = 2, iconType = "raider", idleAutoHeal = .5, idleTime = 2200, @@ -36,7 +36,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERHBOT5", + movementClass = "HOVERHBOT2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -62,7 +62,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -101,7 +101,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -114,7 +114,7 @@ weaponDefs = { collideFriendly = false, collideFeature = false, cegTag = "railgun", - rgbColor = "0 0 1", + rgbColor = "1 0 0", rgbColor2 = "1 1 1", explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", edgeEffectiveness = 1, @@ -125,27 +125,25 @@ weaponDefs = { interceptedByShieldType = 4, name = "E.M.G.", range = 650, - reloadtime = 1, - projectiles = 5, + reloadtime = 0.5, + --projectiles = 5, weaponType = "LaserCannon", - soundStart = "weapons/shotgun-reload.wav", - soundTrigger = true, - sprayAngle = 500, + soundStart = "weapons/plasma3c.wav", texture1 = "shot", texture2 = "empty", - coreThickness = 0.3, + coreThickness = 0.6, thickness = 6, tolerance = 10000, turret = true, weaponTimer = 1, - weaponVelocity = 2000, + weaponVelocity = 1500, customparams = { - damagetype = "ehbotpeewee", + damagetype = "light", single_hit = true, isupgraded = isUpgraded, }, damage = { - default = 10, + default = 45, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua index 019f8ace7..fe4928009 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua @@ -19,13 +19,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR RAID", - description = [[Long-Range Light Main Battle Tank • Uses +]] .. supply .. [[ Supply]], + description = [[Long-Range Light Main Battle Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericRed", - footprintX = 5, - footprintZ = 5, + footprintX = 2, + footprintZ = 2, --highTrajectory = 2, iconType = "mtd_lit_all", idleAutoHeal = .5, @@ -37,7 +37,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERHBOT5", + movementClass = "HOVERHBOT2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -46,7 +46,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericRed", side = "CORE", - sightDistance = 1000, + sightDistance = 300, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -63,7 +63,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -102,7 +102,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -110,12 +110,12 @@ unitDef = { weaponDefs = { rockets = { accuracy = 1000, - AreaOfEffect = 500, + AreaOfEffect = 250, avoidFriendly = false, avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrailsmall", + cegTag = "ehbotrocko-optimized", explosionGenerator = "custom:genericshellexplosion-large-red", energypershot = 0, fireStarter = 70, @@ -123,7 +123,7 @@ weaponDefs = { interceptedByShieldType = 4, model = "missilesmalllauncher.s3o", name = "Rockets", - range = 1000, + range = 850, reloadtime = 2.5, weaponType = "MissileLauncher", smokeTrail = false, @@ -131,14 +131,14 @@ weaponDefs = { soundHit = "explosions/explode5.wav", startVelocity = 250, tolerance = 8000, - turnrate = 1500, + turnrate = 30000, turret = true, tracks = true, - weaponAcceleration = 100, - flightTime = 3, - weaponVelocity = 1500, + weaponAcceleration = 400, + flightTime = 5, + weaponVelocity = 3000, customparams = { - damagetype = "ehbotrocko", + damagetype = "antilightarmored", isupgraded = isUpgraded, }, damage = { diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua index b4e794e01..7b88bb421 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua @@ -19,13 +19,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR RAID", - description = [[Light Anti-Armor Tank Destroyer • Uses +]] .. supply .. [[ Supply]], + description = [[Light Anti-Armor Tank Destroyer]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericPurple", - footprintX = 5, - footprintZ = 5, + footprintX = 2, + footprintZ = 2, --highTrajectory = 2, iconType = "td_lit_arm", idleAutoHeal = .5, @@ -37,7 +37,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERHBOT5", + movementClass = "HOVERHBOT2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -46,7 +46,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericPurple", side = "CORE", - sightDistance = 900, + sightDistance = 300, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -63,7 +63,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -102,14 +102,13 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } weaponDefs = { sniper = { - AreaOfEffect = 10, avoidFeature = false, avoidFriendly = false, @@ -130,7 +129,7 @@ weaponDefs = { minintensity = "1", name = "Laser", range = 900, - reloadtime = 5, + reloadtime = 7.5, WeaponType = "LaserCannon", rgbColor = "0 0.5 1", rgbColor2 = "1 1 1", @@ -144,7 +143,7 @@ weaponDefs = { turret = true, weaponVelocity = 3000, customparams = { - damagetype = "ehbotsniper", + damagetype = "antilightarmored", isupgraded = isUpgraded, }, damage = { diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua index f7928bf99..1737d887d 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua @@ -19,13 +19,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR RAID", - description = [[Light Tank Destroyer • Uses +]] .. supply .. [[ Supply]], + description = [[Light Tank Destroyer]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGeneric", - footprintX = 5, - footprintZ = 5, + footprintX = 2, + footprintZ = 2, highTrajectory = 2, iconType = "td_lit_lit", idleAutoHeal = .5, @@ -37,7 +37,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERHBOT5", + movementClass = "HOVERHBOT2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -63,7 +63,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -102,14 +102,14 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } weaponDefs = { plasmacannon = { - AreaOfEffect = 75, + AreaOfEffect = 25, avoidFriendly = false, avoidFeature = false, collideFriendly = false, @@ -118,7 +118,7 @@ weaponDefs = { --burst = burst, --burstrate = 0.1, edgeEffectiveness = 1, - explosionGenerator = "custom:genericshellexplosion-medium", + explosionGenerator = "custom:genericshellexplosion-small", energypershot = 0, --duration = 0.25, highTrajectory = 2, @@ -128,7 +128,7 @@ weaponDefs = { --noExplode = true, range = 800, reloadtime = 2, - size = 16, + size = 8, --projectiles = projectiles, weaponType = "Cannon", soundStart = "weapons/bruisercannon.wav", @@ -140,7 +140,7 @@ weaponDefs = { weaponTimer = 1, weaponVelocity = 600, customparams = { - damagetype = "ehbotthud", + damagetype = "antilight", isupgraded = isUpgraded, }, damage = { diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua index 228648a83..0ba9b754f 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua @@ -8,19 +8,19 @@ unitDef = { acceleration = 1, brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 1500, + buildCostMetal = 750, builder = false, buildTime = 5, buildpic = [[ehbotkarganneth_turret.png]], canAttack = true, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, canstop = "1", category = "LIGHT NOTAIR", - description = [[Endbringer Class Freedom Dispenser Turret]], + description = [[Endbringer Class Freedom Dispensation Turret]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -31,7 +31,7 @@ unitDef = { idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 35000, + maxDamage = 17500, maxSlope = 26, maxVelocity = 0.001, maxReverseVelocity = 0.001, @@ -63,7 +63,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -87,7 +87,7 @@ unitDef = { def = "machinegun", -- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! -- maxAngleDif = 70, - badTargetCategory = "WALL BUILDING", + --onlyTargetCategory = "LIGHT ARMORED BIO", }, }, customParams = { @@ -102,7 +102,7 @@ unitDef = { -- supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -123,27 +123,31 @@ weaponDefs = { fallOffRate = 0, fireStarter = 50, interceptedByShieldType = 4, + impulsefactor = 0, minintensity = "1", - name = "Machine Gun", + name = "Gatling Laser Cannon", + largebeamlaser = true, + laserflaresize = 5, range = 1000, reloadtime = 0.1, - WeaponType = "LaserCannon", + WeaponType = "BeamLaser", rgbColor = "1 0 0", rgbColor2 = "1 1 1", soundTrigger = true, - soundstart = "weapons/tgunshipfire.wav", - texture1 = "shot", - texture2 = "empty", + soundstart = "weapons/plasma2.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", thickness = 8, tolerance = 1000, turret = true, weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "ehbotkarganneth", + damagetype = "antiarmored", }, damage = { - default = 40, + default = 40*1.33, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua index 4416b114d..295f6a95f 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua @@ -6,32 +6,32 @@ unitDef = { builder = false, buildTime = 5, canAttack = true, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, canstop = "1", - category = "BUILDING NOTAIR", - description = [[Anti-Raider Turret • Uses +]] .. supply .. [[ Supply]], + category = "LIGHT NOTAIR", + description = [[Anti-Raider Turret]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "smallExplosionGenericBlue", floater = true, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, iconType = "turret_lit", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 1200, + maxDamage = 300, maxSlope = 26, maxVelocity = 0.001, maxReverseVelocity = 0.001, maxWaterDepth = 5000, metalStorage = 0, - movementClass = "HOVERHBOT3", + movementClass = "HOVERHBOT5", pushResistant = true, name = humanName, noChaseCategory = "VTOL", @@ -59,7 +59,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -83,8 +83,8 @@ unitDef = { def = "flashweapon", -- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! -- maxAngleDif = 70, - onlyTargetCategory = "LIGHT ARMORED BIO BUILDING", - badTargetCategory = "VTOL ARMORED WALL BUILDING", + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "VTOL ARMORED WALL", }, }, customParams = { @@ -99,7 +99,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -112,7 +112,7 @@ weaponDefs = { collideFriendly = false, collideFeature = false, cegTag = "railgun", - rgbColor = "0 0 1", + rgbColor = "1 0 0", rgbColor2 = "1 1 1", explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", edgeEffectiveness = 1, @@ -123,27 +123,25 @@ weaponDefs = { interceptedByShieldType = 4, name = "E.M.G.", range = 650, - reloadtime = 1, - projectiles = 5, + reloadtime = 0.5, + --projectiles = 5, weaponType = "LaserCannon", - soundStart = "weapons/shotgun-reload.wav", - soundTrigger = true, - sprayAngle = 500, + soundStart = "weapons/plasma3c.wav", texture1 = "shot", texture2 = "empty", - coreThickness = 0.3, + coreThickness = 0.6, thickness = 6, tolerance = 10000, turret = true, weaponTimer = 1, - weaponVelocity = 2000, + weaponVelocity = 1500, customparams = { - damagetype = "ehbotpeewee", + damagetype = "light", single_hit = true, isupgraded = isUpgraded, }, damage = { - default = 10, + default = 45*1.33, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua index 1b3ab9e37..9d86b69c4 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua @@ -6,27 +6,27 @@ unitDef = { builder = false, buildTime = 5, canAttack = true, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, canstop = "1", - category = "BUILDING NOTAIR", - description = [[Tank Destroyer Artillery Turret • Uses +]] .. supply .. [[ Supply]], + category = "LIGHT NOTAIR", + description = [[Long-Range Light Main Battle Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericRed", floater = true, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, --highTrajectory = 2, iconType = "turret_arm", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 1400, + maxDamage = 350, maxSlope = 26, maxVelocity = 0.001, maxReverseVelocity = 0.001, @@ -42,7 +42,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericRed", side = "CORE", - sightDistance = 1000, + sightDistance = 300, smoothAnim = true, stealth = false, seismicSignature = 2, @@ -60,7 +60,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -84,8 +84,8 @@ unitDef = { def = "rockets", -- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! -- maxAngleDif = 70, - onlyTargetCategory = "LIGHT ARMORED BIO BUILDING", - badTargetCategory = "BUILDING", + --onlyTargetCategory = "LIGHT ARMORED BIO", + --badTargetCategory = "BUILDING", }, }, customParams = { @@ -100,7 +100,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -108,12 +108,12 @@ unitDef = { weaponDefs = { rockets = { accuracy = 1000, - AreaOfEffect = 500, + AreaOfEffect = 250, avoidFriendly = false, avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrailsmall", + cegTag = "ehbotrocko-optimized", explosionGenerator = "custom:genericshellexplosion-large-red", energypershot = 0, fireStarter = 70, @@ -121,7 +121,7 @@ weaponDefs = { interceptedByShieldType = 4, model = "missilesmalllauncher.s3o", name = "Rockets", - range = 1000, + range = 850, reloadtime = 2.5, weaponType = "MissileLauncher", smokeTrail = false, @@ -136,11 +136,11 @@ weaponDefs = { flightTime = 3, weaponVelocity = 1500, customparams = { - damagetype = "ehbotrocko", + damagetype = "antilightarmored", isupgraded = isUpgraded, }, damage = { - default = 100, + default = 100*1.33, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua index 4013e217b..b48c996e6 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua @@ -6,27 +6,27 @@ unitDef = { builder = false, buildTime = 5, canAttack = true, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, canstop = "1", - category = "BUILDING NOTAIR", - description = [[Tank Sniper Turret • Uses +]] .. supply .. [[ Supply]], + category = "LIGHT NOTAIR", + description = [[Tank Sniper Turret]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericPurple", floater = true, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, --highTrajectory = 2, iconType = "turret_arm", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 1200, + maxDamage = 300, maxSlope = 26, maxVelocity = 0.001, maxReverseVelocity = 0.001, @@ -42,7 +42,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGenericPurple", side = "CORE", - sightDistance = 900, + sightDistance = 300, smoothAnim = true, stealth = false, seismicSignature = 2, @@ -60,7 +60,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -84,8 +84,8 @@ unitDef = { def = "sniper", -- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! -- maxAngleDif = 70, - onlyTargetCategory = "LIGHT ARMORED BIO BUILDING", - badTargetCategory = "LIGHT BUILDING", + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "LIGHT", }, }, customParams = { @@ -100,7 +100,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -128,7 +128,7 @@ weaponDefs = { minintensity = "1", name = "Laser", range = 900, - reloadtime = 5, + reloadtime = 7.5, WeaponType = "LaserCannon", rgbColor = "0 0.5 1", rgbColor2 = "1 1 1", @@ -142,11 +142,11 @@ weaponDefs = { turret = true, weaponVelocity = 3000, customparams = { - damagetype = "ehbotsniper", + damagetype = "antilightarmored", isupgraded = isUpgraded, }, damage = { - default = 500, + default = 500*1.33, }, }, diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua index 041b3ed12..2f948ddfc 100644 --- a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua @@ -6,27 +6,27 @@ unitDef = { builder = false, buildTime = 5, canAttack = true, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, canstop = "1", - category = "BUILDING NOTAIR", - description = [[Tank Destroyer Turret • Uses +]] .. supply .. [[ Supply]], + category = "LIGHT NOTAIR", + description = [[Tank Destroyer Turret]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGeneric", floater = true, - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, highTrajectory = 2, iconType = "turret_lit", idleAutoHeal = .5, idleTime = 2200, leaveTracks = false, - maxDamage = 1300, + maxDamage = 325, maxSlope = 26, maxVelocity = 0.001, maxReverseVelocity = 0.001, @@ -60,7 +60,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:airfactoryhtrail", }, @@ -84,8 +84,8 @@ unitDef = { def = "plasmacannon", -- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! -- maxAngleDif = 70, - onlyTargetCategory = "LIGHT ARMORED BIO BUILDING", - badTargetCategory = "VTOL ARMORED WALL BUILDING", + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "VTOL ARMORED WALL", }, }, customParams = { @@ -100,14 +100,14 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } weaponDefs = { plasmacannon = { - AreaOfEffect = 75, + AreaOfEffect = 25, avoidFriendly = false, avoidFeature = false, collideFriendly = false, @@ -116,7 +116,7 @@ weaponDefs = { --burst = burst, --burstrate = 0.1, edgeEffectiveness = 1, - explosionGenerator = "custom:genericshellexplosion-medium", + explosionGenerator = "custom:genericshellexplosion-small", energypershot = 0, --duration = 0.25, highTrajectory = 2, @@ -126,7 +126,7 @@ weaponDefs = { --noExplode = true, range = 800, reloadtime = 2, - size = 16, + size = 8, --projectiles = projectiles, weaponType = "Cannon", soundStart = "weapons/bruisercannon.wav", @@ -138,11 +138,11 @@ weaponDefs = { weaponTimer = 1, weaponVelocity = 600, customparams = { - damagetype = "ehbotthud", + damagetype = "antilight", isupgraded = isUpgraded, }, damage = { - default = 150, + default = 150*1.33, }, }, } diff --git a/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua index 11cb9d5cb..5166c2ad5 100644 --- a/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua @@ -13,13 +13,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR SUPPORT", - description = [[Self-Propelled Saturation Artillery � Uses +]] .. supply .. [[ Supply]], + description = [[Self-Propelled Long-Range Artillery]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGeneric", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, iconType = "arty_lit", idleAutoHeal = .5, idleTime = 2200, @@ -29,7 +29,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERTANK3", + movementClass = "HOVERTANK2", name = humanName, --Because he was the first one to get the "Lobster" pun noChaseCategory = "VTOL", objectName = objectName, @@ -38,7 +38,7 @@ unitDef = { repairable = false, selfDestructAs = "mediumExplosionGeneric", side = "CORE", - sightDistance = 1300, + sightDistance = 425, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -58,7 +58,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -74,7 +74,7 @@ unitDef = { weapons = { [1] = { def = "Artilleryweapon", - badTargetCategory = "VTOL", + badTargetCategory = "VTOL LIGHT ARMORED BIO", }, -- [2] = { -- def = "SaturationArtilleryweapon", @@ -94,7 +94,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -114,7 +114,7 @@ weaponDefs = { cegTag = "artyshot2", avoidNeutral = false, - explosionGenerator = "custom:genericshellexplosion-medium", + explosionGenerator = "custom:genericshellexplosion-small", energypershot = 0, impulseFactor = 0, @@ -132,7 +132,7 @@ weaponDefs = { weaponVelocity = 500, customparams = { isupgraded = isUpgraded, - damagetype = "eartytank", + damagetype = "antibuildingarty", }, damage = { default = 200, @@ -169,7 +169,7 @@ weaponDefs = { weaponVelocity = 500, customparams = { isupgraded = isUpgraded, - damagetype = "eartytank", + damagetype = "antibuildingarty", }, damage = { default = 20, diff --git a/Units-Configs-Basedefs/basedefs/hover/eartytanksaturation_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eartytanksaturation_basedef.lua new file mode 100644 index 000000000..e5cc800e2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/eartytanksaturation_basedef.lua @@ -0,0 +1,144 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = 36, + builder = false, + buildTime = 5, + buildpic = "eartytank.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR SUPPORT", + description = [[Self-Propelled Long-Range Saturation Artillery]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGeneric", + footprintX = 2, + footprintZ = 2, + iconType = "arty_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxVelocity = 2.3, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, --Because he was the first one to get the "Lobster" pun + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGeneric", + side = "CORE", + sightDistance = 425, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.3, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 250, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "SaturationArtilleryweapon", + badTargetCategory = "VTOL LIGHT ARMORED BIO", + }, + -- [2] = { + -- def = "SaturationArtilleryweapon", + -- badTargetCategory = "VTOL", + -- }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + canareaattack ="1", + needed_cover = 3, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + + +-------------------------------------------------------------------------------- + +weaponDefs = { + SaturationArtilleryweapon = { + + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "artyshot3", + avoidNeutral = false, + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + + burst = 20, + burstRate = 0.25, + + impulseFactor = 0, + interceptedByShieldType = 4, + --highTrajectory = 1, + size = 4, + name = "Plasma Cannon", + range = 1300, + reloadtime = 30, + weaponType = "Cannon", + soundHit = "explosions/artyhit.wav", + soundStart = "weapons/arty2.wav", + sprayAngle = 1500, + + turret = true, + weaponVelocity = 500, + customparams = { + isupgraded = isUpgraded, + damagetype = "antibuildingarty", + }, + damage = { + default = 100, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hover/ebasefactory_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/ebasefactory_basedef.lua index 9ee30f9b7..967c8bbc2 100644 --- a/Units-Configs-Basedefs/basedefs/hover/ebasefactory_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/ebasefactory_basedef.lua @@ -20,8 +20,8 @@ unitDef = { energyUse = 0, energyMake = 0, explodeAs = "hugeBuildingExplosionGeneric", - footprintX = 20, - footprintZ = 20, + footprintX = 10, + footprintZ = 10, floater = true, iconType = "factory", idleAutoHeal = .5, @@ -45,7 +45,7 @@ unitDef = { unitname = unitName, -- unitRestricted = 1, workerTime = 1, - yardMap = "oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo oooyyyyyyyyyyyyyyooo", + yardMap = "cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc ", -- usePieceCollisionVolumes = true, -- modelCenterOffset = {108, 10, 0}, sfxtypes = { @@ -71,17 +71,13 @@ unitDef = { weapons = { }, customParams = { - unittype = "building", + unittype = "factory", death_sounds = "generic", armortype = "building", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 26, - BuildingGroundDecalSizeY = 26, - BuildingGroundDecalDecaySpeed = 0.9, } diff --git a/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua index 459de019a..0b1e3ca52 100644 --- a/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua @@ -13,13 +13,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "ARMORED NOTAIR SKIRMISHER", - description = [[Main Battle Tank � Uses +]] .. supply .. [[ Supply]], + description = [[Main Battle Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGenericRed", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "td_arm_all", idleAutoHeal = .5, idleTime = 2200, @@ -30,7 +30,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERTANK4", + movementClass = "HOVERTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -60,7 +60,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -92,7 +92,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", } } @@ -121,7 +121,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eheavytank3", + damagetype = "antilightarmored", }, damage = { default = 150, diff --git a/Units-Configs-Basedefs/basedefs/hover/elacerator_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/elacerator_basedef.lua index 071ac5728..6381e3383 100644 --- a/Units-Configs-Basedefs/basedefs/hover/elacerator_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/elacerator_basedef.lua @@ -2,7 +2,7 @@ unitDef = { acceleration = 0.18, brakeRate = 0.2, buildCostEnergy = 0, - buildCostMetal = 1750, + buildCostMetal = 875, builder = false, buildTime = 5, buildpic = "elacerator.png", @@ -58,7 +58,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -80,13 +80,12 @@ unitDef = { isupgraded = isUpgraded, unittype = "mobile", death_sounds = "nuke", - ProvideTech = techprovided, RequireTech = tech, armortype = armortype, --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -101,7 +100,7 @@ weaponDefs = { collideFeature = false, cegTag = "nukeartyshot", - explosionGenerator = "custom:nukeartyexpl", + explosionGenerator = "custom:genericshellexplosion-large-red", edgeEffectiveness = 0.1, energypershot = 0, id = 172, @@ -120,7 +119,7 @@ weaponDefs = { weaponVelocity = 800, customparams = { isupgraded = isUpgraded, - damagetype = "elacerator", + damagetype = "antibuilding", }, damage = { default = 280, diff --git a/Units-Configs-Basedefs/basedefs/hover/elighttank3_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/elighttank3_basedef.lua index b5255857a..7466baccc 100644 --- a/Units-Configs-Basedefs/basedefs/hover/elighttank3_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/elighttank3_basedef.lua @@ -13,7 +13,7 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR RAID", - description = [[Raider • Uses +]] .. supply .. [[ Supply]], + description = [[Raider]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -39,7 +39,7 @@ unitDef = { repairable = false, selfDestructAs = "smallExplosionGenericBlue", side = "CORE", - sightDistance = 550, + sightDistance = 650, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -56,7 +56,7 @@ unitDef = { sfxtypes = { explosiongenerators = { "custom:electricity", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, pieceExplosionGenerators = { @@ -92,7 +92,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -104,7 +104,7 @@ unitDef = { weaponDefs = { lighttankweapon = { - AreaOfEffect = 0, + AreaOfEffect = 25, avoidFriendly = false, avoidFeature = false, collideFriendly = false, @@ -112,8 +112,9 @@ weaponDefs = { craterBoost = 0, craterMult = 0, beamTTL = 10, - explosionGenerator = "custom:genericshellexplosion-medium-lightning", + explosionGenerator = "custom:genericshellexplosion-small-lightning", energypershot = 0, + edgeeffectiveness = 1, impulseBoost = 0, impulseFactor = 0, interceptedByShieldType = 4, @@ -125,7 +126,7 @@ weaponDefs = { WeaponType = "LightningCannon", rgbColor = "0.1 0.2 0.5", rgbColor2 = "0 0 1", - soundStart = "weapons/jacobs.wav", + soundStart = "weapons/lightningstrike.wav", texture1 = "lightning", thickness = 5, @@ -133,7 +134,7 @@ weaponDefs = { weaponVelocity = 400, customparams = { isupgraded = isUpgraded, - damagetype = "elighttank3", + damagetype = "antilightbuilding", }, damage = { default = 60, diff --git a/Units-Configs-Basedefs/basedefs/hover/emissiletank_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/emissiletank_basedef.lua index 36ae83df7..daf2fcce2 100644 --- a/Units-Configs-Basedefs/basedefs/hover/emissiletank_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/emissiletank_basedef.lua @@ -14,13 +14,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "LIGHT NOTAIR SUPPORT", - description = [[Missile Support Tank • Uses +]] .. supply .. [[ Supply]], + description = [[Missile Support Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGeneric", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "mtd_lit_all", idleAutoHeal = .5, idleTime = 2200, @@ -31,7 +31,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERTANK4", + movementClass = "HOVERTANK2", name = humanName, objectName = objectName, script = script, @@ -60,7 +60,7 @@ unitDef = { explosiongenerators = { "custom:factorysparks", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -76,7 +76,6 @@ unitDef = { weapons = { [1] = { def = "missletankweapon", - onlyTargetCategory = "BIO LIGHT ARMORED BUILDING", badTargetCategory = "BUILDING LIGHT", }, }, @@ -93,7 +92,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -110,7 +109,7 @@ weaponDefs = { avoidFeature = false, collideFriendly = false, collideFeature = false, - cegTag = "missiletrail", + cegTag = "emissiletanktrail-optimized", craterBoost = 0, craterMult = 0, explosionGenerator = "custom:genericshellexplosion-medium-red", @@ -133,15 +132,15 @@ weaponDefs = { soundStart = "weapons/missile_launch1.wav", tracks = true, - turnrate = 17500, + turnrate = 30000, weaponAcceleration = 400, weaponTimer = 1, weaponType = "StarburstLauncher", - weaponVelocity = 1000, + weaponVelocity = 3000, customparams = { isupgraded = isUpgraded, - damagetype = "emissiletank", + damagetype = "antilightarmored", }, damage = { default = 150, diff --git a/Units-Configs-Basedefs/basedefs/hover/eriottank2_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eriottank2_basedef.lua index 4c4b271d9..6ede05de5 100644 --- a/Units-Configs-Basedefs/basedefs/hover/eriottank2_basedef.lua +++ b/Units-Configs-Basedefs/basedefs/hover/eriottank2_basedef.lua @@ -13,13 +13,13 @@ unitDef = { canPatrol = true, canstop = "1", category = "ARMORED NOTAIR RIOT", - description = [[EMP/Riot Tank • Uses +]] .. supply .. [[ Supply]], + description = [[EMP/Riot Tank]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericBlue", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, iconType = "riot_lit", idleAutoHeal = .5, idleTime = 2200, @@ -30,7 +30,7 @@ unitDef = { maxReverseVelocity = 1, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERTANK3", + movementClass = "HOVERTANK2", name = humanName, noChaseCategory = "VTOL", objectName = objectName, @@ -60,7 +60,7 @@ unitDef = { explosiongenerators = { "custom:gdhcannon", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -95,7 +95,7 @@ unitDef = { supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", }, } @@ -143,7 +143,7 @@ weaponDefs = { weaponVelocity = 1000, customparams = { isupgraded = isUpgraded, - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, }, damage = { @@ -176,7 +176,7 @@ weaponDefs = { weaponVelocity = 400, customparams = { isupgraded = isUpgraded, - damagetype = "eriottank2shotgun", + damagetype = "light", }, damage = { default = 300, diff --git a/Units-Configs-Basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua new file mode 100644 index 000000000..0c73a2647 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua @@ -0,0 +1,193 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 25, + builder = false, + buildTime = 5, + buildpic = "eriottank2.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR RIOT", + description = [[Shotgun/Riot Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericBlue", + footprintX = 2, + footprintZ = 2, + iconType = "riot_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 26, + maxVelocity = 4, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericBlue", + side = "CORE", + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 3.3, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 430, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- badTargetCategory = "WALL", + -- }, + [1] = { + def = "riottankshotgun", + badTargetCategory = "WALL BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 2, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + + +-------------------------------------------------------------------------------- +-- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) + +weaponDefs = { + riottankempweapon = { + + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-blue", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 500, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, + + riottankshotgun = { + AreaOfEffect = 75, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + --burstrate = 0.2, + --burst = 5, + + cegTag = "bruisercannon", + edgeeffectiveness = 1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + noSelfDamage = true, + noexplode = true, + projectiles = 5, + range = 500, + reloadtime = 5, + sprayangle = 3500, + size = 2, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/Shotgun Boom 102.wav", + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + nofriendlyfire = true, + single_hit = true, + }, + damage = { + default = 150, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/scavs/boss/ekrowboss_basedef.lua b/Units-Configs-Basedefs/basedefs/scavs/boss/ekrowboss_basedef.lua new file mode 100644 index 000000000..95bf31280 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/scavs/boss/ekrowboss_basedef.lua @@ -0,0 +1,154 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + BadTargetCategory = "VTOL", + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1750, + builder = false, + buildTime = 2.5, + buildpic = "ekrow.png", + canAttack = true, + canFly = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRARMORED VTOL", + collide = true, + cruiseAlt = 150, + description = [[Endbringer Flying Fortress]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "hugeExplosionGeneric", + footprintX = 10, + footprintZ = 10, + floater = true, + hoverAttack = true, + iconType = "krow", + idleAutoHeal = .5, + idleTime = 2200, + loopbackattack = false, + maxDamage = 24000, + maxSlope = 90, + maxVelocity = 2.5, + verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeExplosionGeneric", + side = "CORE", + sightDistance = 1050, + smoothAnim = true, + stealth = false, + transportbyenemy = false; + turnRate = 100, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "aircannon", + noChaseCategory = "VTOL LIGHT ARMORED", + badTargetCategory = "VTOL LIGHT ARMORED", + mainDir = "0 -1 0", + maxAngleDif = 170, + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + -- needed_cover = 2, + death_sounds = "generic", + nofriendlyfire = "1", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + --supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + aircannon = { + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.5, + beamTime = 0.1, + beamTTL = 10, + beamDecay = 1, + burnblow = true, + largeBeamLaser = true, + laserflaresize = 7, + minIntensity = 1, + --cegTag = "railgun", + heightmod = 1, + duration = 0.6, + edgeeffectiveness = 1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-red", + fallOffRate = 0.1, + fireStarter = 50, + impulseFactor = 0, + fallOffRate = 0, + interceptedByShieldType = 4, + minintensity = 1, + name = "Laser", + range = 750, + reloadtime = 1, + WeaponType = "BeamLaser", + waterweapon = true, + rgbColor = "0.4 0.2 0.5", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/eturretfire.wav", + soundHit = "explosions/artyhit.wav", + texture1 = "lightning", + texture2 = "laserend", + thickness = 25, + tolerance = 10000, + turret = true, + weaponVelocity = 750, + customparams = { + damagetype = "antibuilding", + isupgraded = isUpgraded, + }, + damage = { + default = 300, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zairbomber_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zairbomber_basedef.lua new file mode 100644 index 000000000..d8bc01b38 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zairbomber_basedef.lua @@ -0,0 +1,135 @@ +unitDef = { + acceleration = 1, + airStrafe = false, + airHoverFactor = 0, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 60, + buildTime = 2.5, + buildpic = "zaal_unitpics/zairbomber.png", + canAttack = true, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRLIGHT VTOL", + collide = true, + cruiseAlt = 140, + description = [[Heavy Bomber]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 7, + footprintZ = 7, + hoverAttack = false, + iconType = "zbomber", + idleAutoHeal = 2.5, + idleTime = 5, + maxacc = 1, + maxDamage = 812, + maxSlope = 90, + maxVelocity = 12, + maxWaterDepth = 255, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "ARM", + sightDistance = 1000, + smoothAnim = true, + sonarDistance = 0, + transportbyenemy = false; + turnRate = 5000, + turnradius = 250, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + onlytargetcategory = "BUILDING", + def = "WEAPON", + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + factionname = "zaal", + corpse = "energycore", + normaltex = "unittextures/z_normals.dds", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 150, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + burst = 12, + burstrate = 0.2, + --cegTag = "zaalspiketrail-optimized", + explosionGenerator = "custom:genericshellexplosion-medium-red", + energypershot = 0, + fireStarter = 70, + tracks = false, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "ChickenDefenseModels/chickeneggyellow.s3o", + name = "Spikes", + range = 700, + reloadtime = 9, + weaponType = "MissileLauncher", + smokeTrail = false, + soundStart = "weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 4.wav", + --soundHit = "explosions/explode5.wav", + startVelocity = 250, + tolerance = 8000, + turnrate = 0, + predictBoost = 0.5, + turret = true, + weaponAcceleration = 50, + flightTime = 5, + sprayangle = 3000, + weaponVelocity = 1000, + waterWeapon = true, + customparams = { + damagetype = "antibuilding", + nofriendlyfire = 1, + }, + damage = { + default = 250, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zairscout_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zairscout_basedef.lua new file mode 100644 index 000000000..72c8c2cf4 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zairscout_basedef.lua @@ -0,0 +1,89 @@ +unitDef = { + acceleration = 1, + airStrafe = true, + bankscale = "1", + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 5, + buildTime = 2.5, + buildpic = "zaal_unitpics/zairscout.png", + canAttack = true, + canDropFlare = false, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "AIRLIGHT VTOL", + collide = false, + cruiseAlt = 75, + description = [[Fast Scout]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_SMALL", + footprintX = 5, + footprintZ = 5, + hoverAttack = true, + iconType = "zairscout", + idleAutoHeal = 2.5, + idleTime = 5, + maxDamage = 560, + maxSlope = 90, + maxVelocity = 11, + --verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_SMALL", + side = "CORE", + sightDistance = 1500, + SonarDistance = 1500, + smoothAnim = true, + stealth = true, + turnRate = 5000, + unitname = unitName, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + }, + customParams = { + unittype = "mobile", + death_sounds = "bug", + normaltex = "unittextures/z_normals.dds", + RequireTech = tech, + armortype = armortype, + supply_cost = supply, + nofriendlyfire = "1", + factionname = "zaal", + retreatRangeDAI = 5000, + }, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/zaal/zairtoairfighter_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zairtoairfighter_basedef.lua new file mode 100644 index 000000000..4cbde37f2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zairtoairfighter_basedef.lua @@ -0,0 +1,135 @@ +unitDef = { + acceleration = 1, + airStrafe = false, + airHoverFactor = 0, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 30, + buildTime = 2.5, + buildpic = "zaal_unitpics/zairtoairfighter.png", + canAttack = true, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRLIGHT VTOL", + collide = true, + cruiseAlt = 140, + description = [[Air Superiority]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 3, + footprintZ = 3, + hoverAttack = false, + iconType = "zairtoairfighter", + idleAutoHeal = 2.5, + idleTime = 5, + maxacc = 1, + maxDamage = 812, + maxSlope = 90, + maxVelocity = 20, + maxWaterDepth = 255, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "ARM", + sightDistance = 1000, + smoothAnim = true, + sonarDistance = 0, + transportbyenemy = false; + turnRate = 5000, + turnradius = 250, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + onlytargetcategory = "VTOL", + def = "WEAPON", + maindir = "0 0 1", + maxangledif = 90, + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + factionname = "zaal", + corpse = "energycore", + normaltex = "unittextures/z_normals.dds", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + weapon = { + interceptedByShieldType = 4, + areaofeffect = 32, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "zaalspiketrail-optimized", + burnblow = true, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + impulseboost = 1, + impulsefactor = 1, + interceptedbyshieldtype = 4, + model = "ChickenDefenseModels/spike.s3o", + name = "Spike", + noselfdamage = true, + predictboost = 1, + range = 600, + reloadtime = 1, + smoketrail = true, + soundstart = "ChickenDefenseSounds/talonattack", + startvelocity = 600, + texture1 = "", + texture2 = "sporetrail", + turret = true, + weaponacceleration = 250, + weapontimer = 1, + weaponvelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zairtogroundfighter_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zairtogroundfighter_basedef.lua new file mode 100644 index 000000000..49b9314f0 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zairtogroundfighter_basedef.lua @@ -0,0 +1,133 @@ +unitDef = { + acceleration = 1, + airStrafe = false, + airHoverFactor = 0, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 53, + buildTime = 2.5, + buildpic = "zaal_unitpics/zairtogroundfighter.png", + canAttack = true, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRLIGHT VTOL", + collide = true, + cruiseAlt = 140, + description = [[Air to Ground Fighter]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 3, + footprintZ = 3, + hoverAttack = false, + iconType = "zairtogroundfighter", + idleAutoHeal = 2.5, + idleTime = 5, + maxacc = 1, + maxDamage = 812, + maxSlope = 90, + maxVelocity = 15, + maxWaterDepth = 255, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "ARM", + sightDistance = 1000, + smoothAnim = true, + sonarDistance = 0, + transportbyenemy = false; + turnRate = 5000, + turnradius = 250, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + badtargetcategory = "VTOL BUILDING", + def = "WEAPON", + maindir = "0 0 1", + maxangledif = 180, + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + factionname = "zaal", + corpse = "energycore", + normaltex = "unittextures/z_normals.dds", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + weapon = { + interceptedByShieldType = 4, + accuracy = 1100, + areaofeffect = 24, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + burnblow = true, + cegTag = "zaalspiketrail-optimized", + craterboost = 0, + cratermult = 0, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + impulseboost = 0, + impulsefactor = 0, + interceptedbyshieldtype = 4, + model = "ChickenDefenseModels/spike.s3o", + name = "Spike", + noselfdamage = true, + range = 350, + reloadtime = 2, + soundstart = "ChickenDefenseSounds/talonattack", + startvelocity = 200, + submissile = 1, + turret = true, + waterWeapon = true, + weaponacceleration = 100, + weapontimer = 1, + weaponvelocity = 350, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zarm_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zarm_basedef.lua new file mode 100644 index 000000000..3527ddae7 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zarm_basedef.lua @@ -0,0 +1,153 @@ +unitDef = { + + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildpic = "zaal_unitpics/zarm.png", + blocking = true, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + cantBeTransported = true, + canGuard = true, + canHover = false, + canMove = false, + canPatrol = false, + canreclaim = true, + canstop = true, + category = "BUILDING", + description = [[Provides Tech/Builds Construction Bugs]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 6, + footprintZ = 6, + iconType = "engineer", + autoHeal = 10, + idleAutoHeal = 25, + idleTime = 5, + levelground = true, + maxDamage = 500, + maxSlope = 90, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + --movementClass = "ZAALKBOT6", + moveState = 2, + name = humanName, + noChaseCategory = "VTOL LIGHT ARMORED BUILDING", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + showNanoSpray = true, + side = "ARM", + sightDistance = 500, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + unitname = unitName, + upright = true, + yardmap = "oooooo oooooo oooooo oooooo oooooo oooooo", + workerTime = 2, + TerraformSpeed = 2147000, + usePieceCollisionVolumes = true, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + buildoptions = Shared.buildListZaalArm, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "BugSelect", + }, + }, + weapons = { + [1] = { + def = "spores1", + --onlyTargetCategory = "VTOL", + }, + }, + customParams = { + iscommander = true, + shownametag = true, + noalert = false, + unittype = "building", + ProvideTech = techprovided, + canbetransported = "false", + needed_cover = 1, + death_sounds = "bug", + armortype = armortype, + normaltex = "unittextures/zarm_normals.dds", + factionname = "zaal", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, + BuildingGroundDecalDecaySpeed = 0.9, +} + +weaponDefs = { + spores1 = { + areaofeffect = 1, + cegTag = "gunshiptrail-optimized", + explosiongenerator = "custom:chickenspike-large-sparks-burn", + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + --canAttackGround = false, + flighttime = 5, + impulsefactor = 0, + name = "Missiles", + noselfdamage = true, + proximitypriority = 3, + range = 2500, + reloadtime = 2.5, + smoketrail = false, + soundhit = "ChickenDefenseSounds/e25", + soundstart = "weapons/zaal/large monster attack/large monster attack 5.wav", + startvelocity = 200, + tolerance = 10000, + tracks = true, + turnrate = 48000, + turret = true, + waterweapon = true, + weaponacceleration = 200, + weapontype = "MissileLauncher", + weaponvelocity = 2500, + customparams = { + damagetype = "antilightarmored", + nofriendlyfire = 1, + }, + damage = { + default = 1000, + }, + }, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/zaal/zarty_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zarty_basedef.lua new file mode 100644 index 000000000..022029891 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zarty_basedef.lua @@ -0,0 +1,142 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 25, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zarty.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR SUPPORT", + description = [[Self-Propelled Long-Range Artillery]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_SMALL", + footprintX = 3, + footprintZ = 3, + iconType = "zarty", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 300, + maxVelocity = 3.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK3", + name = humanName, --Because he was the first one to get the "Lobster" pun + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_SMALL", + side = "CORE", + sightDistance = 425, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.3, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 250, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "Artilleryweapon", + onlyTargetCategory = "BUILDING", + }, + -- [2] = { + -- def = "SaturationArtilleryweapon", + -- badTargetCategory = "VTOL", + -- }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + + +-------------------------------------------------------------------------------- + +weaponDefs = { + Artilleryweapon = { + + accuracy = 1500, + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "artyshot2", + avoidNeutral = false, + explosionGenerator = "custom:genericshellexplosion-large", + energypershot = 0, + fireSubmersed = false, + + impulseFactor = 0, + interceptedByShieldType = 4, + highTrajectory = 1, + name = "Plasma Cannon", + range = 1500, + reloadtime = 5, + rgbcolor = "0.1 0.6 1", + size = 16, + weaponType = "Cannon", + soundHit = "deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_25.wav", + soundStart = "weapons/zaal/Large monster Growls/Large monster Growls 5.wav", + + turret = true, + waterWeapon = true, + weaponVelocity = 500, + customparams = { + damagetype = "antibuilding", + nofriendlyfire = 1, + }, + damage = { + default = 600, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zassault_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zassault_basedef.lua new file mode 100644 index 000000000..c03dc54e3 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zassault_basedef.lua @@ -0,0 +1,140 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 100, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zassault.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR", + description = [[Armored Assault Defense Buster]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_LARGE", + footprintX = 4, + footprintZ = 4, + iconType = "zassault", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 1750, + maxSlope = 26, + maxVelocity = 4, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_LARGE", + side = "CORE", + sightDistance = 700, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "WEAPON", + --maindir = "0 0 1", + --maxangledif = 180, + badTargetCategory = "NOTAIR", + onlyTargetCategory = "NOTAIR BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 200, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.3, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-blue", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 250, + reloadtime = 10, + WeaponType = "LaserCannon", + rgbColor = "1 1 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 1.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + waterWeapon = true, + customparams = { + damagetype = "antilightarmored", + nofriendlyfire = 1, + }, + damage = { + default = 1500, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zconstructor_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zconstructor_basedef.lua new file mode 100644 index 000000000..fc8fe1c65 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zconstructor_basedef.lua @@ -0,0 +1,100 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 10, + builder = true, + buildTime = 5, + buildDistance = buildDistance, + buildpic = "zaal_unitpics/zkamikaze.png", + CanAttack = false, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + cantBeTransported = true, + canGuard = true, + canHover = false, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "LIGHT NOTAIR", + description = [[Construction Bug]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_SMALL", + footprintX = 2, + footprintZ = 2, + iconType = "raider", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 50, + maxSlope = 26, + maxVelocity = 10, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ZAALKBOT2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + showNanoSpray = false, + selfDestructAs = "BUG_DEATH_SMALL", + side = "CORE", + sightDistance = 200, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0.5, + TerraformSpeed = 2147000, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + buildoptions = Shared.buildListZaalConstructor, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + area_mex_def = "zmex", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + noenergycost = true, + armortype = armortype, + --nofriendlyfire = "1", + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zespire1_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zespire1_basedef.lua new file mode 100644 index 000000000..889209b23 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zespire1_basedef.lua @@ -0,0 +1,73 @@ +unitDef = { + + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildDistance = 0, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zespire1.png", + blocking = true, + cantBeTransported = true, + canMove = false, + category = "BUILDING", + description = [[Creates Energy]], + energyMake = energyMake, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = false, + footprintX = 8, + footprintZ = 8, + icontype = "generator", + idleAutoHeal = 5, + idleTime = 300, + levelground = true, + maxDamage = 500, + maxSlope = 90, + maxWaterDepth = 99999999999, + metalmake = 0, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + sightDistance = 250, + smoothAnim = true, + stealth = false, + unitname = unitName, + upright = true, + yardmap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + customParams = { + unittype = "building", + needed_cover = 1, + death_sounds = "bug", + armortype = armortype, + normaltex = "unittextures/zespire1_normals.dds", + factionname = "zaal", + supply_granted = supplygranted, + RequireTech = tech, + noenergycost = true, + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, + BuildingGroundDecalDecaySpeed = 0.9, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/zaal/zhive_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zhive_basedef.lua new file mode 100644 index 000000000..bc4191c76 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zhive_basedef.lua @@ -0,0 +1,84 @@ +unitDef = { + activatewhenbuilt = true, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 5, + buildpic = "zaal_unitpics/zhatch.png", + canAttack = true, + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canRepair = true, + canstop = true, + category = "BUILDING NOTAIR", + description = [[Builds new Units - Upgrade to unlock new Tech levels]], +-- energyStorage = energyStorage, +-- energyUse = energyUse, +-- energyMake = energyMake, + explodeAs = "BUG_DEATH_LARGE", + footprintX = 24, + footprintZ = 24, + floater = true, + iconType = "energy", + idleAutoHeal = 5, + idleTime = 300, + maxDamage = 1, + maxSlope = 90, + maxWaterDepth = 99999999999, +-- metalStorage = metalStorage, +-- metalMake = metalMultiplier, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_LARGE", + showNanoSpray = true, + side = "CORE", + sightDistance = 250, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + workerTime = 1, + yardMap = [[yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyyy]], + --usePieceCollisionVolumes = true, + -- modelCenterOffset = {108, 10, 0}, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + buildoptions = Shared.buildListZaal, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "BugSelect", + }, + }, + weapons = { + }, + customParams = { + noalert = true, + --ProvideTech = techprovided, + unittype = "building", + death_sounds = "bug", + armortype = "building", + normaltex = "unittextures/zarm_normals.dds", + factionname = "zaal", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 28, + BuildingGroundDecalSizeY = 28, + BuildingGroundDecalDecaySpeed = 0.9, +} diff --git a/Units-Configs-Basedefs/basedefs/zaal/zkamikaze_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zkamikaze_basedef.lua new file mode 100644 index 000000000..430dccb73 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zkamikaze_basedef.lua @@ -0,0 +1,91 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 10, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zkamikaze.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Kamikaze Bug]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_KAMIKAZE", + footprintX = 4, + footprintZ = 4, + iconType = "raider", + idleAutoHeal = 2.5, + idleTime = 5, + kamikaze = true, + kamikazedistance = 50, + leaveTracks = false, + maxDamage = 50, + maxSlope = 26, + maxVelocity = 20, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_KAMIKAZE", + side = "CORE", + sightDistance = 700, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + --nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zlightswarm_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zlightswarm_basedef.lua new file mode 100644 index 000000000..2ceb1e366 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zlightswarm_basedef.lua @@ -0,0 +1,140 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 20, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zlightswarm.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Light Swarmer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_SMALL", + footprintX = 4, + footprintZ = 4, + iconType = "zlightswarm", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 225, + maxSlope = 26, + maxVelocity = 10, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_SMALL", + side = "CORE", + sightDistance = 300, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "WEAPON", + --maindir = "0 0 1", + --maxangledif = 180, + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + --isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + retreatRangeDAI = 20, + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 1, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.3, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-blue", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 300, + reloadtime = 0.5, + WeaponType = "LaserCannon", + rgbColor = "0.5 0.8 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/zaal/lingspit.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 6, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + waterWeapon = true, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 50, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zmedswarm_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zmedswarm_basedef.lua new file mode 100644 index 000000000..e2f9d5304 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zmedswarm_basedef.lua @@ -0,0 +1,139 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 30, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zmedswarm.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Medium Swarmer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + footprintX = 4, + footprintZ = 4, + iconType = "zmedswarm", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 300, + maxSlope = 26, + maxVelocity = 7.5, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "CORE", + sightDistance = 400, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "WEAPON", + --maindir = "0 0 1", + --maxangledif = 180, + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 1, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.3, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-red", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 400, + reloadtime = 0.75, + WeaponType = "LaserCannon", + rgbColor = "1 0.8 0.5", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/zaal/roachspit.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 6, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + waterWeapon = true, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 100, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zmex_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zmex_basedef.lua new file mode 100644 index 000000000..e99913a40 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zmex_basedef.lua @@ -0,0 +1,75 @@ +unitDef = { + + activatewhenbuilt = true, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildingMask = 0, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zmex.png", + canAttack = false, + category = "BUILDING NOTAIR", + description = [[Generates Metal from Resource Nodes]], + energyStorage = 0, + energyUse = energyUse, + energyMake = 0, + explodeAs = "BUG_DEATH_LARGE", + footprintX = 9, + footprintZ = 9, + iconType = "eco", + idleAutoHeal = 5, + idleTime = 300, + maxDamage = 1, + maxSlope = 90, + maxWaterDepth = 99999999999, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + onoffable = true, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_LARGE", + sightDistance = 250, + smoothAnim = true, + unitname = unitName, + yardMap = "ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo ooooooooo", + usePieceCollisionVolumes = false, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + primaryCEG, + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "BugSelect", + }, + }, + weapons = { + }, + customParams = { + RequireTech = tech, + unittype = "building", + metal_extractor = metalMultiplier, + noenergycost = true, + iseco = 1, + death_sounds = "bug", + armortype = "building", + normaltex = "unittextures/zhive_normals.dds", + factionname = "zaal", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture2.dds", + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, + BuildingGroundDecalDecaySpeed = 0.9, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zpyro_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zpyro_basedef.lua new file mode 100644 index 000000000..b8ea4e349 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zpyro_basedef.lua @@ -0,0 +1,140 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 45, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zpyro.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR SKIRMISHER", + description = [[Defense Assault]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH", + footprintX = 4, + footprintZ = 4, + iconType = "zpyro", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 500, + maxSlope = 26, + maxVelocity = 6, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH", + side = "CORE", + sightDistance = 250, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "WEAPON", + --maindir = "0 0 1", + --maxangledif = 180, + badTargetCategory = "NOTAIR LIGHT ARMORED", + onlyTargetCategory = "BUILDING NOTAIR", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 100, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.3, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-blue", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 250, + reloadtime = 7.5, + WeaponType = "LaserCannon", + rgbColor = "1 1 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/zaal/Medium monster attack/Medium monster attack 4.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 20, + tolerance = 1000, + turret = true, + waterWeapon = true, + weaponVelocity = 2000, + customparams = { + damagetype = "antilightbuilding", + nofriendlyfire = 1, + }, + damage = { + default = 600, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zqueen_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zqueen_basedef.lua new file mode 100644 index 000000000..417699d82 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zqueen_basedef.lua @@ -0,0 +1,340 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 500, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zqueen.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR", + description = [[Queen]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_LARGE", + footprintX = 4, + footprintZ = 4, + iconType = "zqueen", + idleAutoHeal = 10, + idleTime = 5, + leaveTracks = false, + maxDamage = 5000, + maxSlope = 26, + maxVelocity = 3.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_LARGE", + side = "CORE", + sightDistance = 700, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "MELEE", + maindir = "0 0 1", + maxangledif = 155, + }, + [2] = { + badtargetcategory = "NOTAIR", + def = "SPORES1", + }, + [3] = { + def = "SPORES2", + }, + [4] = { + def = "SPORES3", + }, + [5] = { + def = "GOO", + maindir = "0 0 1", + maxangledif = 180, + onlytargetcategory = "NOTAIR BUILDING", + badtargetcategory = "NOTAIR", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bugqueen", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + +weaponDefs = { + goo = { + interceptedByShieldType = 4, + accuracy = 300, + areaofeffect = 200, + avoidfeature = 0, + avoidfriendly = 0, + burst = 8, + burstrate = 0.01, + cegtag = "missiletrailgunshiplesssmokey", + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0.33, + explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", + impulseboost = 0, + impulsefactor = 0, + intensity = 0.7, + interceptedbyshieldtype = 1, + model = "ChickenDefenseModels/SGreyRock1.S3O", + name = "Blob", + noselfdamage = true, + proximitypriority = -4, + range = 1200, + reloadtime = 5, + rgbcolor = "0.1 0.6 1", + size = 8, + sizedecay = 0, + soundhit = "ChickenDefenseSounds/e16", + soundstart = "weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 10.wav", + soundTrigger = true, + sprayangle = 6000, + tolerance = 5000, + turret = true, + weapontimer = 0.2, + weaponvelocity = 400, + customparams = { + damagetype = "antilightarmored", + nofriendlyfire = 1, + }, + damage = { + default = 200, + }, + }, + melee = { + interceptedByShieldType = 4, + areaofeffect = 200, + avoidfeature = 0, + avoidfriendly = 0, + camerashake = 0, + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + impulseboost = 1.5, + impulsefactor = 1.5, + name = "ChickenClaws", + noselfdamage = true, + proximitypriority = -3, + range = 280, + reloadtime = 2.5, + model = "ChickenDefenseModels/spike.s3o", + soundstart = "weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 7.wav", + tolerance = 5000, + turret = true, + waterweapon = true, + weapontype = "Cannon", + weaponvelocity = 2500, + customparams = { + damagetype = "antilightarmored", + nofriendlyfire = 1, + }, + damage = { + default = 600, + }, + }, + spores1 = { + interceptedByShieldType = 4, + areaofeffect = 72, + avoidfriendly = 0, + burnblow = 1, + burst = 3, + burstrate = 0.11, + collidefriendly = false, + craterboost = 0, + cratermult = 0, + dance = 20, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + firestarter = 0, + flighttime = 5, + groundbounce = 1, + heightmod = 0.5, + impulseboost = 0, + impulsefactor = 0.4, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "ChickenDefenseModels/spike.s3o", + name = "Missiles", + noselfdamage = true, + proximitypriority = 3, + range = 700, + reloadtime = 1.5, + smoketrail = true, + soundhit = "ChickenDefenseSounds/e25", + soundstart = "weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 1.wav", + startvelocity = 200, + texture1 = "", + texture2 = "sporetrail", + tolerance = 10000, + tracks = true, + trajectoryheight = 2, + turnrate = 48000, + turret = true, + waterweapon = true, + weaponacceleration = 200, + weapontype = "MissileLauncher", + weaponvelocity = 1000, + wobble = 64000, + customparams = { + damagetype = "antiarmoredair", + nofriendlyfire = 1, + }, + damage = { + default = 145, + }, + }, + spores2 = { + interceptedByShieldType = 4, + areaofeffect = 72, + avoidfeature = 0, + avoidfriendly = false, + burnblow = 1, + burst = 3, + burstrate = 0.09, + collidefriendly = false, + craterboost = 0, + cratermult = 0, + dance = 20, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + firestarter = 0, + flighttime = 5, + groundbounce = 1, + heightmod = 0.5, + impulseboost = 0, + impulsefactor = 0.4, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "ChickenDefenseModels/spike.s3o", + name = "Missiles", + noselfdamage = true, + range = 700, + reloadtime = 1.25, + smoketrail = true, + soundhit = "ChickenDefenseSounds/e25", + soundstart = "weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 2.wav", + startvelocity = 200, + texture1 = "", + texture2 = "sporetrail", + tolerance = 10000, + tracks = true, + trajectoryheight = 2, + turnrate = 48000, + turret = true, + waterweapon = true, + weaponacceleration = 200, + weapontype = "MissileLauncher", + weaponvelocity = 1000, + wobble = 64000, + customparams = { + damagetype = "antiarmoredair", + nofriendlyfire = 1, + }, + damage = { + default = 145, + }, + }, + spores3 = { + interceptedByShieldType = 4, + areaofeffect = 72, + avoidfriendly = false, + burnblow = 1, + burst = 3, + burstrate = 0.1, + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + dance = 20, + explosiongenerator = "custom:chickenspike-large-sparks-burn", + firestarter = 0, + flighttime = 5, + groundbounce = 1, + heightmod = 0.5, + impulseboost = 0, + impulsefactor = 0.4, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "ChickenDefenseModels/spike.s3o", + name = "Missiles", + noselfdamage = true, + proximitypriority = -3, + range = 700, + reloadtime = 1.75, + smoketrail = true, + soundhit = "ChickenDefenseSounds/e25", + soundstart = "weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 3.wav", + startvelocity = 200, + texture1 = "", + texture2 = "sporetrail", + tolerance = 10000, + tracks = true, + trajectoryheight = 2, + turnrate = 48000, + turret = true, + waterweapon = true, + weaponacceleration = 200, + weapontype = "MissileLauncher", + weaponvelocity = 1000, + wobble = 64000, + customparams = { + damagetype = "antiarmoredair", + nofriendlyfire = 1, + }, + damage = { + default = 145, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/zskirmisher_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/zskirmisher_basedef.lua new file mode 100644 index 000000000..bd35f97a7 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/zskirmisher_basedef.lua @@ -0,0 +1,139 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 35, + builder = false, + buildTime = 5, + buildpic = "zaal_unitpics/zskirmisher.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SKIRMISHER", + description = [[Armored Skirmisher]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + footprintX = 4, + footprintZ = 4, + iconType = "zskirmisher", + idleAutoHeal = 2.5, + idleTime = 5, + leaveTracks = false, + maxDamage = 400, + maxSlope = 26, + maxVelocity = 6.5, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "ZAALKBOT4", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "CORE", + sightDistance = 450, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.8, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 350, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + "custom:blood_explode", + "custom:emptydirt", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "WEAPON", + --maindir = "0 0 1", + --maxangledif = 180, + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "bug", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + normaltex = "unittextures/z_normals.dds", + factionname = "zaal", + --corpse = "energycore", + }, +} + +weaponDefs = { + weapon = { + AreaOfEffect = 1, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.3, + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-green", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 450, + reloadtime = 2, + WeaponType = "LaserCannon", + rgbColor = "0.5 1 0.5", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/zaal/large monster attack/large monster attack 1.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 6, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + waterWeapon = true, + customparams = { + damagetype = "antilightarmored", + nofriendlyfire = 1, + }, + damage = { + default = 300, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/zaal/ztenticle_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/ztenticle_basedef.lua new file mode 100644 index 000000000..02ae7dd4e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/ztenticle_basedef.lua @@ -0,0 +1,104 @@ +unitDef = { + + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildpic = "zaal_unitpics/ztenticle.png", + blocking = true, + CanAttack = false, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + cantBeTransported = true, + canGuard = true, + canHover = false, + canMove = false, + canPatrol = false, + canreclaim = true, + canstop = true, + category = "BUILDING", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 3, + footprintZ = 3, + iconType = "engineer", + autoHeal = 10, + idleAutoHeal = 25, + idleTime = 5, + levelground = true, + maxDamage = 500, + maxSlope = 90, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + --movementClass = "ZAALKBOT6", + moveState = 2, + name = humanName, + noChaseCategory = "VTOL LIGHT ARMORED BUILDING", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + showNanoSpray = true, + side = "ARM", + sightDistance = 500, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + unitname = unitName, + upright = true, + yardmap = "ooo ooo ooo", + workerTime = 1, + TerraformSpeed = 2147000, + usePieceCollisionVolumes = true, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "BugSelect", + }, + }, + customParams = { + unittype = "building", + ProvideTech = techprovided, + canbetransported = "false", + needed_cover = 1, + death_sounds = "bug", + armortype = armortype, + normaltex = "unittextures/zarm_normals.dds", + factionname = "zaal", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, + BuildingGroundDecalDecaySpeed = 0.9, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/zaal/ztiberium_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/ztiberium_basedef.lua new file mode 100644 index 000000000..6da997f27 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/ztiberium_basedef.lua @@ -0,0 +1,77 @@ +unitDef = { + activateWhenBuilt = true, + buildAngle = 8196, + buildCostEnergy = 0, + buildCostMetal = 15, + builder = false, + buildTime = 5, + canAttack = false, + category = "BUILDING NOTAIR ECO", + description = [[Provides +]] .. supplygranted .. [[ Supply • Provides +]] .. storage .. [[ Metal/Energy Storage]], + energyStorage = storage, + metalStorage = storage, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + footprintX = 4, + footprintZ = 4, + idleAutoHeal = .5, + idleTime = 2200, + icontype = "storage", + maxDamage = 500, + maxSlope = 90, + maxWaterDepth = 99999999999, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + side = "CORE", + sightDistance = 250, + smoothAnim = true, + unitname = unitName, + workerTime = 0, + yardMap = [[oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo]], + + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + select = { + BugSelect, + }, + }, + weapons = { + }, + customParams = { + unittype = "building", + iseco = 1, + needed_cover = 2, + supply_granted = supplygranted, + death_sounds = "bug", + armortype = "building", + noenergycost = true, + normaltex = "unittextures/ztiberium_normals.dds", + factionname = "zaal", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 8, + BuildingGroundDecalSizeY = 8, + BuildingGroundDecalDecaySpeed = 0.9, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/zaal/ztumor_basedef.lua b/Units-Configs-Basedefs/basedefs/zaal/ztumor_basedef.lua new file mode 100644 index 000000000..8c6a22e63 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/zaal/ztumor_basedef.lua @@ -0,0 +1,118 @@ +unitDef = { + + buildCostEnergy = 0, + buildCostMetal = 5, + buildDistance = buildDistance, + builder = true, + buildTime = 10, + buildpic = "zaal_unitpics/ztumor.png", + blocking = false, + CanAttack = true, + CanAssist = false, + canBeAssisted = false, + CanCapture = false, + CanRepair = false, + canRestore = false, + cantBeTransported = true, + canGuard = false, + canHover = false, + canMove = false, + canPatrol = false, + canreclaim = false, + canstop = true, + category = "BUILDING", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 0, + decloakOnFire = false, + decloakSpherical = true, + initCloaked = true, + + -- End Cloaking + + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "BUG_DEATH_MEDIUM", + floater = true, + footprintX = 2, + footprintZ = 2, + iconType = "boxsmall", + levelground = false, + maxDamage = 100, + maxSlope = 90, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + --movementClass = "ZAALKBOT6", + moveState = 2, + name = humanName, + noChaseCategory = "VTOL LIGHT ARMORED BUILDING", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "BUG_DEATH_MEDIUM", + showNanoSpray = false, + sightDistance = 0, + smoothAnim = true, + stealth = false, + seismicDistance = buildDistance, + seismicSignature = 2, + unitname = unitName, + upright = false, + yardmap = "oooo oooo oooo oooo", + workerTime = 1, + TerraformSpeed = 2147000, + usePieceCollisionVolumes = false, + sfxtypes = { + pieceExplosionGenerators = { + "blood_spray", + }, + + explosiongenerators = { + "custom:blood_spray", + }, + }, + buildoptions = Shared.buildListZaalTumor, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "BugSelect", + }, + }, + customParams = { + unittype = "building", + --area_mex_def = "zhatch", + --ProvideTech = techprovided, + unitdefbuildtime = true, + decloakradiusmodifier = 1, + canbetransported = "false", + needed_cover = 1, + death_sounds = "bug", + armortype = armortype, + normaltex = "unittextures/ztumor_normals.dds", + factionname = "zaal", + }, + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture.dds", + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, + BuildingGroundDecalDecaySpeed = 0.9, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ChickenDefenseUnits/chicken1.lua b/Units/ChickenDefenseUnits/chicken1.lua deleted file mode 100644 index 47efea7cc..000000000 --- a/Units/ChickenDefenseUnits/chicken1.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chicken1 = { - acceleration = 0.15, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chicken1.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1.5, - footprintz = 1.5, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 30, - maxdamage = 475, - maxslope = 18, - maxvelocity = 2.7, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken.s3o", - script = "ChickenDefenseScripts/chicken1.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 300, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 1.2, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 54, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1b.lua b/Units/ChickenDefenseUnits/chicken1b.lua deleted file mode 100644 index b7fae2407..000000000 --- a/Units/ChickenDefenseUnits/chicken1b.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chicken1b = { - acceleration = 0.3, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chicken1b.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 35, - maxdamage = 445, - maxslope = 18, - maxvelocity = 2.9, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1b.s3o", - script = "ChickenDefenseScripts/chicken1b.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1b", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 1.2, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 54, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1c.lua b/Units/ChickenDefenseUnits/chicken1c.lua deleted file mode 100644 index 39d789a6e..000000000 --- a/Units/ChickenDefenseUnits/chicken1c.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chicken1c = { - acceleration = 0.15, - bmcode = "1", - brakerate = 0.5, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chicken1c.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 40, - maxdamage = 425, - maxslope = 18, - maxvelocity = 3.3, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1c.s3o", - script = "ChickenDefenseScripts/chicken1c.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1c", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 1.2, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 60, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1d.lua b/Units/ChickenDefenseUnits/chicken1d.lua deleted file mode 100644 index 8d814591e..000000000 --- a/Units/ChickenDefenseUnits/chicken1d.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chicken1d = { - acceleration = 0.3, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chicken1d.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 45, - maxdamage = 385, - maxslope = 18, - maxvelocity = 3.5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1d.s3o", - script = "ChickenDefenseScripts/chicken1d.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1d", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 1.15, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 54, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1x.lua b/Units/ChickenDefenseUnits/chicken1x.lua deleted file mode 100644 index 8e5150bbd..000000000 --- a/Units/ChickenDefenseUnits/chicken1x.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - chicken1x = { - acceleration = 0.3, - autoheal = 3, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chicken1x.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer Assault", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 90, - maxdamage = 1000, - maxslope = 18, - maxvelocity = 4.5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1x.s3o", - script = "ChickenDefenseScripts/chicken1x.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1x", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.9, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 54, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1y.lua b/Units/ChickenDefenseUnits/chicken1y.lua deleted file mode 100644 index bda8db13d..000000000 --- a/Units/ChickenDefenseUnits/chicken1y.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - chicken1y = { - acceleration = 0.3, - autoheal = 3, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chicken1y.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer Assault", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 80, - maxdamage = 975, - maxslope = 18, - maxvelocity = 4.75, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1y.s3o", - script = "ChickenDefenseScripts/chicken1y.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1y", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.87, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 54, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken1z.lua b/Units/ChickenDefenseUnits/chicken1z.lua deleted file mode 100644 index 1b00d7cae..000000000 --- a/Units/ChickenDefenseUnits/chicken1z.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - chicken1z = { - acceleration = 0.5, - autoheal = 3, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chicken1z.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 26 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Swarmer Assault", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 70, - maxdamage = 950, - maxslope = 18, - maxvelocity = 5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken1z.s3o", - script = "ChickenDefenseScripts/chicken1z.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 300, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken1z", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.83, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 40, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken2.lua b/Units/ChickenDefenseUnits/chicken2.lua deleted file mode 100644 index 5d42011da..000000000 --- a/Units/ChickenDefenseUnits/chicken2.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chicken2 = { - acceleration = 0.35, - bmcode = "1", - brakerate = 0.3, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildtime = 1, - buildpic = "chicken_unitpics/chicken2.png", - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "20 29 44", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Advanced Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 2, - footprintz = 2, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 200, - maxdamage = 2650, - maxslope = 18, - maxvelocity = 5.2, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken2.s3o", - script = "ChickenDefenseScripts/chicken2.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 356, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken2", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.7, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 150, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken2b.lua b/Units/ChickenDefenseUnits/chicken2b.lua deleted file mode 100644 index aaa24e8e4..000000000 --- a/Units/ChickenDefenseUnits/chicken2b.lua +++ /dev/null @@ -1,113 +0,0 @@ -return { - chicken2b = { - acceleration = 0.7, - autoheal = 20, - bmcode = "1", - brakerate = 5, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chicken2b.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "20 29 44", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Apex Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 2, - footprintz = 2, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 1200, - maxdamage = 3600, - maxslope = 18, - maxvelocity = 5.6, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken2b.s3o", - script = "ChickenDefenseScripts/chicken2b.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 375, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chicken2b", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 32, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.5, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 150, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken_dodo1.lua b/Units/ChickenDefenseUnits/chicken_dodo1.lua deleted file mode 100644 index 4d7eb6909..000000000 --- a/Units/ChickenDefenseUnits/chicken_dodo1.lua +++ /dev/null @@ -1,82 +0,0 @@ -return { - chicken_dodo1 = { - acceleration = 6, - activatewhenbuilt = true, - autoheal = 50, - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildtime = 1, - buildpic = "chicken_unitpics/chicken_dodo1.png", - canguard = true, - canhover = "1", - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collide = false, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "10 14 22", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Chicken Bomb", - explodeas = "DODO_DEATH1", - floater = false, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "raider", - kamikaze = true, - kamikazedistance = 40, - leavetracks = true, - maneuverleashlength = "640", - mass = 5000, - maxdamage = 200, - maxslope = 18, - maxvelocity = 7, - maxwaterdepth = 0, - movementclass = "CHICKENHOVERDODO", - name = "Dodo", - noautofire = false, - nochasecategory = "VTOL SINK HOVER", - objectname = "ChickenDefenseModels/chicken_dodo.s3o", - script = "ChickenDefenseScripts/chicken_dodo1.cob", - seismicsignature = 2, - selfdestructas = "DODO_DEATH1", - selfdestructcountdown = 0, - side = "THUNDERBIRDS", - sightdistance = 36, - smoothanim = true, - stealth = 1, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 1, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 10, - turninplace = true, - turnrate = 5000, - unitname = "chicken_dodo1", - upright = false, - waterline = 1, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chicken_dodo2.lua b/Units/ChickenDefenseUnits/chicken_dodo2.lua deleted file mode 100644 index d8193c1d6..000000000 --- a/Units/ChickenDefenseUnits/chicken_dodo2.lua +++ /dev/null @@ -1,82 +0,0 @@ -return { - chicken_dodo2 = { - acceleration = 6, - activatewhenbuilt = true, - autoheal = 135, - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chicken_dodo2.png", - buildtime = 1, - canguard = true, - canhover = "1", - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collide = 0, - collisionvolumeoffsets = "0 3 0", - collisionvolumescales = "18 28 41", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Chicken Bomb", - explodeas = "DODO_DEATH2", - floater = false, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "raider", - kamikaze = true, - kamikazedistance = 72, - leavetracks = true, - maneuverleashlength = "640", - mass = 10000, - maxdamage = 1350, - maxslope = 18, - maxvelocity = 8, - maxwaterdepth = 0, - movementclass = "CHICKENHOVERDODO", - name = "Alpha Dodo", - noautofire = false, - nochasecategory = "VTOL SINK HOVER", - objectname = "ChickenDefenseModels/big_chicken_dodo.s3o", - script = "ChickenDefenseScripts/chicken_dodo2.cob", - seismicsignature = 4, - selfdestructas = "DODO_DEATH2", - selfdestructcountdown = 0, - side = "THUNDERBIRDS", - sightdistance = 100, - smoothanim = true, - stealth = 1, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 1, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 10, - turninplace = true, - turnrate = 5000, - unitname = "chicken_dodo2", - upright = false, - waterline = 1, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickena1.lua b/Units/ChickenDefenseUnits/chickena1.lua deleted file mode 100644 index 274ff5e7a..000000000 --- a/Units/ChickenDefenseUnits/chickena1.lua +++ /dev/null @@ -1,156 +0,0 @@ -return { - chickena1 = { - acceleration = 0.36, - airsightdistance = 650, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildtime = 1, - buildpic = "chicken_unitpics/chickena1.png", - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 2 0", - collisionvolumescales = "27 38 60", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 1500, - maxdamage = 4250, - maxslope = 18, - maxvelocity = 1.125, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT4", - name = "Cockatrice", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickena.s3o", - script = "ChickenDefenseScripts/chickena1.cob", - onlytargetcategory2 = "VTOL", - seismicsignature = 0, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 430, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 7, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 34, - turninplace = true, - turnrate = 5000, - unitname = "chickena1", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blob_fire", - }, - }, - weapondefs = { - aaweapon = { - interceptedByShieldType = 4, - areaofeffect = 124, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:blood_explode_blue", - firestarter = 0, - flighttime = 5, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "BlobMissile", - noselfdamage = true, - range = 550, - reloadtime = 7, - smoketrail = true, - soundhit = "ChickenDefenseSounds/junohit2edit", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - weaponacceleration = 75, - weapontype = "MissileLauncher", - weaponvelocity = 700, - wobble = 32000, - damage = { - default = 175, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 42, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 2.2, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.53, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 700, - damage = { - default = 96, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 125, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "AAWEAPON", - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickena1b.lua b/Units/ChickenDefenseUnits/chickena1b.lua deleted file mode 100644 index d8d0375c5..000000000 --- a/Units/ChickenDefenseUnits/chickena1b.lua +++ /dev/null @@ -1,156 +0,0 @@ -return { - chickena1b = { - acceleration = 0.26, - airsightdistance = 650, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickena1b.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 2 0", - collisionvolumescales = "27 38 60", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 1500, - maxdamage = 4250, - maxslope = 18, - maxvelocity = 1.1, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT4", - name = "Cockatrice", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenab.s3o", - script = "ChickenDefenseScripts/chickena1b.cob", - onlytargetcategory2 = "VTOL", - seismicsignature = 0, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 430, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 7, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 34, - turninplace = true, - turnrate = 5000, - unitname = "chickena1b", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blob_fire", - }, - }, - weapondefs = { - aaweapon = { - interceptedByShieldType = 4, - areaofeffect = 124, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:blood_explode_blue", - firestarter = 0, - flighttime = 5, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "BlobMissile", - noselfdamage = true, - range = 550, - reloadtime = 7, - smoketrail = true, - soundhit = "ChickenDefenseSounds/junohit2edit", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - weaponacceleration = 75, - weapontype = "MissileLauncher", - weaponvelocity = 700, - wobble = 32000, - damage = { - default = 175, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 42, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 2.2, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.75, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 700, - damage = { - default = 110, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 125, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "AAWEAPON", - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickena1c.lua b/Units/ChickenDefenseUnits/chickena1c.lua deleted file mode 100644 index 51c30a2d6..000000000 --- a/Units/ChickenDefenseUnits/chickena1c.lua +++ /dev/null @@ -1,156 +0,0 @@ -return { - chickena1c = { - acceleration = 0.36, - airsightdistance = 650, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickena1c.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 2 0", - collisionvolumescales = "27 38 60", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 1500, - maxdamage = 4250, - maxslope = 18, - maxvelocity = 1.15, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT4", - name = "Cockatrice", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenac.s3o", - script = "ChickenDefenseScripts/chickena1c.cob", - onlytargetcategory2 = "VTOL", - seismicsignature = 0, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 430, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 7, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 34, - turninplace = true, - turnrate = 5000, - unitname = "chickena1c", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blob_fire", - }, - }, - weapondefs = { - aaweapon = { - interceptedByShieldType = 4, - areaofeffect = 124, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:blood_explode_blue", - firestarter = 0, - flighttime = 5, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "BlobMissile", - noselfdamage = true, - range = 550, - reloadtime = 7, - smoketrail = true, - soundhit = "ChickenDefenseSounds/junohit2edit", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - weaponacceleration = 75, - weapontype = "MissileLauncher", - weaponvelocity = 700, - wobble = 32000, - damage = { - default = 175, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 42, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 2.2, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.9, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 700, - damage = { - default = 165, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 125, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "AAWEAPON", - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickena2.lua b/Units/ChickenDefenseUnits/chickena2.lua deleted file mode 100644 index acd50429c..000000000 --- a/Units/ChickenDefenseUnits/chickena2.lua +++ /dev/null @@ -1,160 +0,0 @@ -return { - chickena2 = { - acceleration = 0.36, - airsightdistance = 1800, - autoheal = 25, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 75, - buildpic = "chicken_unitpics/chickena2.png", - builder = false, - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 10 2", - collisionvolumescales = "37 55 90", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Advanced Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 3000, - maxdamage = 44000, - maxslope = 18, - maxvelocity = 0.9, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT4", - name = "Alpha Cockatrice", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickena2.s3o", - script = "ChickenDefenseScripts/chickena2.cob", - onlytargetcategory2 = "VTOL", - seismicsignature = 0, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 600, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 7, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 38, - turninplace = true, - turnrate = 5000, - unitname = "chickena2", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blob_fire", - }, - }, - weapondefs = { - aaweapon = { - interceptedByShieldType = 4, - areaofeffect = 200, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - edgeeffectiveness = 0.05, - explosiongenerator = "custom:blood_explode_blue", - firestarter = 0, - flighttime = 2.5, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 2, - metalpershot = 0, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "BlobMissile", - noselfdamage = true, - proximitypriority = 4, - range = 2000, - reloadtime = 8, - smoketrail = true, - soundhit = "ChickenDefenseSounds/junohit2edit", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - weaponacceleration = 75, - weapontype = "MissileLauncher", - weaponvelocity = 700, - wobble = 32000, - damage = { - default = 400, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 42, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 2.2, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.8, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 700, - damage = { - default = 300, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 125, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "AAWEAPON", - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickena2b.lua b/Units/ChickenDefenseUnits/chickena2b.lua deleted file mode 100644 index 682856131..000000000 --- a/Units/ChickenDefenseUnits/chickena2b.lua +++ /dev/null @@ -1,160 +0,0 @@ -return { - chickena2b = { - acceleration = 0.36, - airsightdistance = 1800, - autoheal = 40, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 75, - buildpic = "chicken_unitpics/chickena2b.png", - builder = false, - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 10 2", - collisionvolumescales = "37 55 90", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Advanced Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 3000, - maxdamage = 39000, - maxslope = 18, - maxvelocity = 0.925, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT4", - name = "Alpha Cockatrice", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickena2b.s3o", - script = "ChickenDefenseScripts/chickena2b.cob", - onlytargetcategory2 = "VTOL", - seismicsignature = 0, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 600, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 7, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 38, - turninplace = true, - turnrate = 5000, - unitname = "chickena2b", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blob_fire", - }, - }, - weapondefs = { - aaweapon = { - interceptedByShieldType = 4, - areaofeffect = 200, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - edgeeffectiveness = 0.05, - explosiongenerator = "custom:blood_explode_blue", - firestarter = 0, - flighttime = 2.5, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 2, - metalpershot = 0, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "BlobMissile", - noselfdamage = true, - proximitypriority = -4, - range = 2000, - reloadtime = 8, - smoketrail = true, - soundhit = "ChickenDefenseSounds/junohit2edit", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - weaponacceleration = 75, - weapontype = "MissileLauncher", - weaponvelocity = 700, - wobble = 32000, - damage = { - default = 400, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 42, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 2.2, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.8, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 700, - damage = { - default = 300, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 125, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "AAWEAPON", - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenc1.lua b/Units/ChickenDefenseUnits/chickenc1.lua deleted file mode 100644 index 5ee8a98f6..000000000 --- a/Units/ChickenDefenseUnits/chickenc1.lua +++ /dev/null @@ -1,117 +0,0 @@ -return { - chickenc1 = { - acceleration = 1.25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenc1.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 11 3", - collisionvolumescales = "25 38 64", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "All-Terrain Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 700, - maxdamage = 4250, - maxreversevelocity = 2, - maxslope = 18, - maxvelocity = 2.5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT3", - name = "Basilisk", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenc.s3o", - script = "ChickenDefenseScripts/chickenc1.cob", - seismicsignature = 3, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 512, - smoothanim = true, - sonardistance = 450, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0.5, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrackPointy", - trackwidth = 70, - turninplace = true, - turnrate = 5000, - unitname = "chickenc1", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 256, - areaofeffect = 96, - avoidfeature = 0, - burst = 3, - burstrate = 0.01, - camerashake = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:blood_explode_blue", - impulseboost = 0.22, - impulsefactor = 0.22, - intensity = 0.7, - interceptedbyshieldtype = 1, - name = "Blob", - noselfdamage = true, - range = 300, - reloadtime = 3.6, - rgbcolor = "0.0 0.6 0.6", - size = 8, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/junohit2edit", - sprayangle = 512, - targetmoveerror = 0.4, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 500, - damage = { - default = 335, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 110, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenc2.lua b/Units/ChickenDefenseUnits/chickenc2.lua deleted file mode 100644 index 6c295d7b8..000000000 --- a/Units/ChickenDefenseUnits/chickenc2.lua +++ /dev/null @@ -1,116 +0,0 @@ -return { - chickenc2 = { - acceleration = 1.25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenc2.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 11 3", - collisionvolumescales = "25 38 64", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "All-Terrain Assault", - explodeas = "BIGBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_arm_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 900, - maxdamage = 10000, - maxslope = 18, - maxvelocity = 4.25, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT3", - name = "Manticore", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenc2.s3o", - script = "ChickenDefenseScripts/chickenc2.cob", - seismicsignature = 3, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 512, - smoothanim = true, - sonardistance = 450, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0.5, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrackPointy", - trackwidth = 70, - turninplace = true, - turnrate = 5000, - unitname = "chickenc2", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 128, - areaofeffect = 160, - avoidfeature = 0, - camerashake = 0, - cegtag = "ROCKTRAILsm", - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.15, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0.22, - impulsefactor = 0.22, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - range = 350, - reloadtime = 1.8, - rgbcolor = "0.0 0.6 0.6", - size = 8, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/e16", - sprayangle = 256, - targetmoveerror = 0.2, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 500, - damage = { - default = 1300, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 110, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenc3.lua b/Units/ChickenDefenseUnits/chickenc3.lua deleted file mode 100644 index f3b5f0a3e..000000000 --- a/Units/ChickenDefenseUnits/chickenc3.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenc3 = { - acceleration = 1.25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickenc3.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 28 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "All-Terrain Swarmer", - explodeas = "BUG_DEATH", - footprintx = 2, - footprintz = 2, - icontype = "raider", - leavetracks = true, - maneuverleashlength = "640", - mass = 89, - maxdamage = 900, - maxreversevelocity = 3, - maxslope = 18, - maxvelocity = 3.25, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Weevil", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenc3.s3o", - script = "ChickenDefenseScripts/chickenc3.cob", - seismicsignature = 1, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 350, - smoothanim = true, - sonardistance = 450, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0.5, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrackPointy", - trackwidth = 35, - turninplace = true, - turnrate = 5000, - unitname = "chickenc3", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 512, - areaofeffect = 120, - avoidfeature = 0, - camerashake = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.25, - explosiongenerator = "custom:blood_explode_blue", - impulseboost = 0.22, - impulsefactor = 0.22, - intensity = 0.7, - interceptedbyshieldtype = 1, - name = "Blob", - noselfdamage = true, - range = 225, - reloadtime = 3.5, - rgbcolor = "0.15 0.6 0.6", - model = "ChickenDefenseModels/spike.s3o", - size = 8, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/junohit2edit", - targetmoveerror = 0.4, - tolerance = 5000, - turret = true, - weapontimer = 0.5, - weaponvelocity = 200, - damage = { - default = 300, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 110, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenc3b.lua b/Units/ChickenDefenseUnits/chickenc3b.lua deleted file mode 100644 index e95eb3ab9..000000000 --- a/Units/ChickenDefenseUnits/chickenc3b.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenc3b = { - acceleration = 1.25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickenc3b.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 28 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "All-Terrain Swarmer", - explodeas = "BUG_DEATH", - footprintx = 2, - footprintz = 2, - icontype = "raider", - leavetracks = true, - maneuverleashlength = "640", - mass = 89, - maxdamage = 800, - maxreversevelocity = 3, - maxslope = 18, - maxvelocity = 3.5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Weevil", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenc3b.s3o", - script = "ChickenDefenseScripts/chickenc3b.cob", - seismicsignature = 1, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 350, - smoothanim = true, - sonardistance = 450, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0.5, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrackPointy", - trackwidth = 35, - turninplace = true, - turnrate = 5000, - unitname = "chickenc3b", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 512, - areaofeffect = 120, - avoidfeature = 0, - camerashake = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.25, - explosiongenerator = "custom:blood_explode_blue", - impulseboost = 0.22, - impulsefactor = 0.22, - intensity = 0.7, - interceptedbyshieldtype = 1, - name = "Blob", - noselfdamage = true, - range = 240, - reloadtime = 3.5, - rgbcolor = "0 0.6 0.65", - model = "ChickenDefenseModels/spike.s3o", - size = 8, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/junohit2edit", - targetmoveerror = 0.4, - tolerance = 5000, - turret = true, - weapontimer = 0.5, - weaponvelocity = 200, - damage = { - default = 300, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 110, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenc3c.lua b/Units/ChickenDefenseUnits/chickenc3c.lua deleted file mode 100644 index 062eb88f4..000000000 --- a/Units/ChickenDefenseUnits/chickenc3c.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenc3c = { - acceleration = 1.25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickenc3c.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 -3", - collisionvolumescales = "18 28 40", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "All-Terrain Swarmer", - explodeas = "BUG_DEATH", - footprintx = 2, - footprintz = 2, - icontype = "raider", - leavetracks = true, - maneuverleashlength = "640", - mass = 89, - maxdamage = 920, - maxreversevelocity = 3, - maxslope = 18, - maxvelocity = 3.2, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Weevil", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenc3c.s3o", - script = "ChickenDefenseScripts/chickenc3c.cob", - seismicsignature = 1, - selfdestructas = "BIGBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 370, - smoothanim = true, - sonardistance = 450, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0.5, - trackstrength = 9, - trackstretch = 1, - tracktype = "ChickenTrackPointy", - trackwidth = 35, - turninplace = true, - turnrate = 5000, - unitname = "chickenc3c", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 512, - areaofeffect = 120, - avoidfeature = 0, - camerashake = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.25, - explosiongenerator = "custom:blood_explode_blue", - impulseboost = 0.22, - impulsefactor = 0.22, - intensity = 0.7, - interceptedbyshieldtype = 1, - name = "Blob", - noselfdamage = true, - range = 245, - reloadtime = 3.6, - rgbcolor = "0.3 0.5 0.6", - model = "ChickenDefenseModels/spike.s3o", - size = 8, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/junohit2edit", - targetmoveerror = 0.4, - tolerance = 5000, - turret = true, - weapontimer = 0.5, - weaponvelocity = 200, - damage = { - default = 300, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 110, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickend1.lua b/Units/ChickenDefenseUnits/chickend1.lua deleted file mode 100644 index 9c12c3132..000000000 --- a/Units/ChickenDefenseUnits/chickend1.lua +++ /dev/null @@ -1,119 +0,0 @@ -return { - chickend1 = { - acceleration = 0.01, - activatewhenbuilt = true, - autoheal = 1, - bmcode = "0", - brakerate = 0.01, - buildcostenergy = 1, - buildcostmetal = 120, - builddistance = 200, - builder = true, - buildpic = "chicken_unitpics/chickend1.png", - buildtime = 1, - canattack = true, - canreclaim = true, - canrestore = false, - canstop = "1", - category = "BIO", --WEAPON NOTAIR NOTSUB NOTSHIP ALL NOTHOVER SURFACE", - collisionvolumeoffsets = "0 15 0", - collisionvolumescales = "14 50 14", - collisionvolumetype = "box", - corpse = "chicken_egg", - description = "Defense", - energystorage = 500, - explodeas = "custom:blood_explode", - extractsmetal = 0.001, - footprintx = 1, - footprintz = 1, - icontype = "turret_lit", - idleautoheal = 15, - idletime = 300, - levelground = false, - mass = 700, - maxdamage = 1125, - maxslope = 255, - maxvelocity = 0, - maxwaterdepth = 0, - movementclass = "CHICKENNANO", - name = "Chicken Tube", - noautofire = false, - nochasecategory = "MOBILE", - objectname = "ChickenDefenseModels/tube.s3o", - script = "ChickenDefenseScripts/chickend1.cob", - reclaimspeed = 200, - repairspeed = 125, - seismicsignature = 0, - selfdestructas = "custom:blood_explode", - side = "THUNDERBIRDS", - sightdistance = 370, - smoothanim = true, - tedclass = "METAL", - turnrate = 5000, - unitname = "chickend1", - upright = false, - waterline = 1, - workertime = 125, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 32, - avoidfriendly = false, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 2, - metalpershot = 0, - model = "ChickenDefenseModels/AgamAutoBurst.s3o", - name = "Missiles", - noselfdamage = true, - range = 420, - reloadtime = 2.2, - smoketrail = true, - startvelocity = 100, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 24000, - turret = true, - waterweapon = true, - weaponacceleration = 100, - weapontype = "MissileLauncher", - weaponvelocity = 500, - wobble = 32000, - damage = { - default = 400, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenf1.lua b/Units/ChickenDefenseUnits/chickenf1.lua deleted file mode 100644 index cebd04f84..000000000 --- a/Units/ChickenDefenseUnits/chickenf1.lua +++ /dev/null @@ -1,108 +0,0 @@ -return { - chickenf1 = { - acceleration = 0.8, - airhoverfactor = 0, - attackrunlength = 32, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 50, - builder = false, - buildpic = "chicken_unitpics/chickenf1.png", - buildtime = 1, - canattack = true, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = "1", - cansubmerge = true, - category = "BIO VTOL", - collide = false, - collisionvolumeoffsets = "0 8 -2", - collisionvolumescales = "70 14 48", - collisionvolumetype = "box", - corpse = "chicken_egg", - cruisealt = 240, - defaultmissiontype = "Standby", - description = "Flying Chicken Bomber", - explodeas = "TALON_DEATH", - footprintx = 3, - footprintz = 3, - hidedamage = 1, - icontype = "air_bomb", - idleautoheal = 5, - idletime = 0, - maneuverleashlength = "20000", - mass = 227.5, - maxdamage = 1350, - maxvelocity = 6.2, - moverate1 = "32", - name = "Talon", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenf.s3o", - script = "ChickenDefenseScripts/chickenf1.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1000, - smoothanim = true, - steeringmode = "2", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenf1", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 1000, - areaofeffect = 128, - avoidfeature = false, - avoidfriendly = false, - burst = 8, - burstrate = 0.24, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.15, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 1, - impulsefactor = 1, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/chickeneggyellow.s3o", - name = "GooBombs", - noselfdamage = true, - range = 800, - reloadtime = 7, - soundhit = "ChickenDefenseSounds/junohit2edit", - sprayangle = 2000, - weapontype = "AircraftBomb", - damage = { - default = 310, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenf1b.lua b/Units/ChickenDefenseUnits/chickenf1b.lua deleted file mode 100644 index 98a6940a7..000000000 --- a/Units/ChickenDefenseUnits/chickenf1b.lua +++ /dev/null @@ -1,108 +0,0 @@ -return { - chickenf1b = { - acceleration = 0.8, - airhoverfactor = 0, - attackrunlength = 32, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 50, - builder = false, - buildpic = "chicken_unitpics/chickenf1b.png", - buildtime = 1, - canattack = true, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = "1", - cansubmerge = true, - category = "BIO VTOL", - collide = false, - collisionvolumeoffsets = "0 8 -2", - collisionvolumescales = "70 14 48", - collisionvolumetype = "box", - corpse = "chicken_egg", - cruisealt = 270, - defaultmissiontype = "Standby", - description = "Flying Chicken Bomber", - explodeas = "TALON_DEATH", - footprintx = 3, - footprintz = 3, - hidedamage = 1, - icontype = "air_bomb", - idleautoheal = 5, - idletime = 0, - maneuverleashlength = "20000", - mass = 227.5, - maxdamage = 1600, - maxvelocity = 4.8, - moverate1 = "32", - name = "Talon", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenf1b.s3o", - script = "ChickenDefenseScripts/chickenf1b.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1000, - smoothanim = true, - steeringmode = "2", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenf1b", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 1000, - areaofeffect = 150, - avoidfeature = false, - avoidfriendly = false, - burst = 11, - burstrate = 0.41, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.1, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 1, - impulsefactor = 1, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/chickeneggyellow.s3o", - name = "GooBombs", - noselfdamage = true, - range = 700, - reloadtime = 9, - soundhit = "ChickenDefenseSounds/junohit2edit", - sprayangle = 2000, - weapontype = "AircraftBomb", - damage = { - default = 250, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenf2.lua b/Units/ChickenDefenseUnits/chickenf2.lua deleted file mode 100644 index e107cfa0b..000000000 --- a/Units/ChickenDefenseUnits/chickenf2.lua +++ /dev/null @@ -1,110 +0,0 @@ -return { - chickenf2 = { - acceleration = 1, - airhoverfactor = 0, - attackrunlength = 32, - bmcode = "1", - brakerate = 0.4, - buildcostenergy = 1, - buildcostmetal = 5, - builder = false, - buildpic = "chicken_unitpics/chickenf2.png", - buildtime = 1, - canattack = true, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = "1", - cansubmerge = true, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 8 -2", - collisionvolumescales = "70 14 48", - collisionvolumetype = "box", - corpse = "chicken_egg", - cruisealt = 325, - defaultmissiontype = "Standby", - description = "Flying Chicken Scout", - explodeas = "TALON_DEATH", - footprintx = 3, - footprintz = 3, - hidedamage = 1, - icontype = "scout", - idleautoheal = 15, - idletime = 900, - maneuverleashlength = "20000", - mass = 227.5, - maxdamage = 1800, - maxvelocity = 4.6, - moverate1 = "32", - name = "Buzzard", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenf1.s3o", - radardistance = 500, - script = "ChickenDefenseScripts/chickenf2.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - side = "THUNDERBIRDS", - sightdistance = 500, - smoothanim = true, - steeringmode = "2", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenf2", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 300, - areaofeffect = 200, - avoidfeature = false, - avoidfriendly = false, - burst = 1, - burstrate = 1, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "", - impulseboost = 1, - impulsefactor = 1, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/chickeneggred.s3o", - mygravity = 0.5, - name = "GooBombs", - noselfdamage = true, - range = 800, - reloadtime = 30, - soundhit = "ChickenDefenseSounds/junohit2edit", - sprayangle = 400, - weapontype = "AircraftBomb", - damage = { - default = 250, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh1.lua b/Units/ChickenDefenseUnits/chickenh1.lua deleted file mode 100644 index db85f1c33..000000000 --- a/Units/ChickenDefenseUnits/chickenh1.lua +++ /dev/null @@ -1,88 +0,0 @@ -return { - chickenh1 = { - acceleration = 0.05, - activatewhenbuilt = true, - autoheal = 32, - bmcode = 1, - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 40, - builddistance = 200, - builder = 1, - buildpic = "chicken_unitpics/chickenh1.png", - buildtime = 1, - canassist = 0, - canbuild = 1, - canguard = 1, - canmove = 1, - canpatrol = 1, - canrepair = 1, - canstop = 1, - category = "BIO", - collide = 0, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "10 14 22", - collisionvolumetype = "box", - defaultmissiontype = "Standby", - description = "Chicken Healer", - energymake = 25, - explodeas = "WEAVER_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "orb", - kamikaze = true, - kamikazedistance = 60, - leavetracks = true, - maneuverleashlength = 640, - mass = 50, - maxdamage = 225, - maxslope = 18, - maxvelocity = 2.6, - maxwaterdepth = 5000, - metalstorage = 1000, - mobilestandorders = 1, - movementclass = "CHICKENHKBOT2", - name = "Weaver", - noautofire = 0, - objectname = "ChickenDefenseModels/chicken_drone.s3o", - script = "ChickenDefenseScripts/chickenh1.cob", - reclaimspeed = 400, - repairspeed = 2, - seismicsignature = 1, - selfdestructas = "WEAVER_DEATH", - side = "THUNDERBIRDS", - sightdistance = 256, - smoothanim = true, - standingmoveorder = 1, - stealth = 1, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 1, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 10, - turninplace = true, - turnrate = 5000, - unitname = "chickenh1", - upright = false, - waterline = 8, - workertime = 200, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh1b.lua b/Units/ChickenDefenseUnits/chickenh1b.lua deleted file mode 100644 index c791cd175..000000000 --- a/Units/ChickenDefenseUnits/chickenh1b.lua +++ /dev/null @@ -1,88 +0,0 @@ -return { - chickenh1b = { - acceleration = 0.1, - activatewhenbuilt = true, - autoheal = 24, - bmcode = 1, - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 40, - builddistance = 180, - builder = 1, - buildpic = "chicken_unitpics/chickenh1b.png", - buildtime = 1, - canassist = 0, - canbuild = 1, - canguard = 1, - canmove = 1, - canpatrol = 1, - canrepair = 1, - canstop = 1, - category = "BIO", - collide = 0, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "10 14 22", - collisionvolumetype = "box", - defaultmissiontype = "Standby", - description = "Chicken Healer", - energymake = 15, - explodeas = "WEAVER_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "orb", - kamikaze = true, - kamikazedistance = 60, - leavetracks = true, - maneuverleashlength = 640, - mass = 60, - maxdamage = 330, - maxslope = 18, - maxvelocity = 2.15, - maxwaterdepth = 5000, - metalstorage = 1000, - mobilestandorders = 1, - movementclass = "CHICKENHKBOT2", - name = "Weaver", - noautofire = 0, - objectname = "ChickenDefenseModels/chicken_droneb.s3o", - script = "ChickenDefenseScripts/chickenh1b.cob", - reclaimspeed = 400, - repairspeed = 1.5, - seismicsignature = 1, - selfdestructas = "WEAVER_DEATH", - side = "THUNDERBIRDS", - sightdistance = 350, - smoothanim = true, - standingmoveorder = 1, - stealth = 1, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 1, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 10, - turninplace = true, - turnrate = 5000, - unitname = "chickenh1b", - upright = false, - waterline = 8, - workertime = 150, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh2.lua b/Units/ChickenDefenseUnits/chickenh2.lua deleted file mode 100644 index e90707faa..000000000 --- a/Units/ChickenDefenseUnits/chickenh2.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chickenh2 = { - acceleration = 0.56, - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenh2.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 10 2", - collisionvolumescales = "37 55 90", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Chicken Spawner", - explodeas = "BIGBUG_DEATH", - floater = false, - footprintx = 2, - footprintz = 2, - hidedamage = 1, - icontype = "energy", - leavetracks = true, - maneuverleashlength = 640, - mass = 1500, - maxdamage = 6000, - maxslope = 18, - maxvelocity = 3, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Progenitor", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/s_chickenboss_white.s3o", - script = "ChickenDefenseScripts/chickenh2.cob", - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 700, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chickenh2", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 1, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 400, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh3.lua b/Units/ChickenDefenseUnits/chickenh3.lua deleted file mode 100644 index 9b57b4d8d..000000000 --- a/Units/ChickenDefenseUnits/chickenh3.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chickenh3 = { - acceleration = 0.36, - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenh3.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 2 0", - collisionvolumescales = "30 38 60", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Progenitor Hatchling", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 2, - footprintz = 2, - hidedamage = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 700, - maxdamage = 1800, - maxslope = 18, - maxvelocity = 4.5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/s_chickenboss2_white.s3o", - script = "ChickenDefenseScripts/chickenh3.cob", - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 500, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chickenh3", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.75, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 200, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh4.lua b/Units/ChickenDefenseUnits/chickenh4.lua deleted file mode 100644 index 8e7895555..000000000 --- a/Units/ChickenDefenseUnits/chickenh4.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chickenh4 = { - acceleration = 0.56, - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickenh4.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collide = 0, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "10 14 22", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Hatchling Swarmer", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - icontype = "raider", - leavetracks = true, - maneuverleashlength = 640, - mass = 100, - maxdamage = 490, - maxslope = 18, - maxvelocity = 8.2, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Chicken", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/s_chicken_white.s3o", - script = "ChickenDefenseScripts/chickenh4.cob", - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 300, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chickenh4", - upright = false, - waterline = 8, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 24, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 0.4, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 70, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenh5.lua b/Units/ChickenDefenseUnits/chickenh5.lua deleted file mode 100644 index 834563cea..000000000 --- a/Units/ChickenDefenseUnits/chickenh5.lua +++ /dev/null @@ -1,159 +0,0 @@ -return { - chickenh5 = { - acceleration = 0.8, - autoheal = 8, - bmcode = "1", - brakerate = 0.8, - buildcostenergy = 1, - buildcostmetal = 251, - builddistance = 425, - builder = true, - buildpic = "chicken_unitpics/chickenh5.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canreclaim = false, - canrestore = false, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 10 2", - collisionvolumescales = "37 55 90", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Chicken Overseer", - explodeas = "BIGBUG_DEATH", - floater = false, - footprintx = 3, - footprintz = 3, - hidedamage = 1, - icontype = "chickencommander", - leavetracks = true, - maneuverleashlength = 640, - mass = 3000, - maxdamage = 8000, - maxslope = 18, - maxvelocity = 3.7, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Patriarch", - nanocolor = "0.7 0.15 0.15", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/brain_bug.s3o", - script = "ChickenDefenseScripts/chickenh5.cob", - repairspeed = 450, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 760, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 18, - turninplace = true, - turnrate = 5000, - unitname = "chickenh5", - upright = false, - waterline = 8, - workertime = 450, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:BRAIN_SPHERE_EMIT", - }, - }, - weapondefs = { - controlblob = { - areaofeffect = 80, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - cegtag = "blood_trail", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.25, - explosiongenerator = "custom:control_explode", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 4, - name = "ControlBlob", - noselfdamage = true, - predictboost = 1, - proximitypriority = -2, - range = 590, - reloadtime = 9.5, - rgbcolor = "0.7 0.15 0.15", - size = 18, - sizedecay = -0.3, - soundhit = "ChickenDefenseSounds/junohit2edit", - tolerance = 5000, - turret = true, - weapontimer = 3, - weaponvelocity = 420, - damage = { - default = 225, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 72, - avoidfeature = 0, - avoidfriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 2.2, - impulsefactor = 1, - interceptedbyshieldtype = 4, - name = "Claws", - noselfdamage = true, - range = 200, - reloadtime = 4, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/smallchickenattack", - targetborder = 1, - tolerance = 5000, - turret = true, - waterweapon = true, - weapontimer = 0.1, - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - chicken = 200, - default = 900, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - def = "CONTROLBLOB", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenp1.lua b/Units/ChickenDefenseUnits/chickenp1.lua deleted file mode 100644 index a11fabcee..000000000 --- a/Units/ChickenDefenseUnits/chickenp1.lua +++ /dev/null @@ -1,143 +0,0 @@ -return { - chickenp1 = { - acceleration = 1, - activatewhenbuilt = true, - autoheal = 27, - bmcode = "1", - brakerate = 0.6, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "", - buildpic = "chicken_unitpics/chickenp1.png", - buildtime = 1, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 2 0", - collisionvolumescales = "30 38 60", - collisionvolumetype = "box", - defaultmissiontype = "Standby", - description = "Chicken Flamer", - explodeas = "FLAMEBUG_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_lit_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 1800, - maxdamage = 2700, - maxvelocity = 3, - movementclass = "CHICKENHKBOT3", - name = "Bombardier", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_listener.s3o", - script = "ChickenDefenseScripts/chickenp1.cob", - seismicsignature = 0, - selfdestructas = "FLAMEBUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 300, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 50, - turninplace = true, - turnrate = 5000, - unitname = "chickenp1", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - chaseweapon = { - interceptedByShieldType = 4, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0, - name = "Claws", - noselfdamage = true, - proximitypriority = -4, - range = 200, - reloadtime = 30, - size = 0.00001, - targetborder = 1, - tolerance = 5000, - turret = "true", - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 0.001, - }, - }, - flamer = { - areaofeffect = 64, - avoidfeature = 0, - avoidfriendly = 0, - burst = 12, - burstrate = 0.01, - craterboost = 0, - cratermult = 0, - firestarter = 100, - flamegfxtime = 1.9, - groundbounce = 1, - impulseboost = 0, - impulsefactor = 0, - intensity = 0.9, - name = "FlameThrower", - noselfdamage = true, - proximitypriority = 4, - range = 410, - reloadtime = 0.7, - rgbcolor = "1 0.95 0.9", - rgbcolor2 = "0.9 0.85 0.8", - sizegrowth = 1.2, - soundstart = "ChickenDefenseSounds/Flamhvy1", - soundtrigger = 0, - sprayangle = 1800, - targetmoveerror = 0.001, - tolerance = 2500, - turret = "true", - weapontimer = 1, - weapontype = "Flame", - weaponvelocity = 300, - damage = { - default = 32, - }, - }, - }, - weapons = { - [1] = { - def = "CHASEWEAPON", - maindir = "0 0 1", - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "VTOL", - def = "FLAMER", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenr1.lua b/Units/ChickenDefenseUnits/chickenr1.lua deleted file mode 100644 index dad564dcb..000000000 --- a/Units/ChickenDefenseUnits/chickenr1.lua +++ /dev/null @@ -1,123 +0,0 @@ -return { - chickenr1 = { - acceleration = 0.1, - bmcode = "1", - brakerate = 0.36, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenr1.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 1 0", - collisionvolumescales = "25 34 44", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Artillery", - explodeas = "LOBBER_MORPH", - footprintx = 3, - footprintz = 3, - hidedamage = 1, - hightrajectory = 1, - icontype = "arty_arm", - idleautoheal = 20, - idletime = 300, - leavetracks = true, - maneuverleashlength = "640", - mass = 4000, - maxdamage = 2500, - maxslope = 18, - maxvelocity = 1.4, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Lobber", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenr.s3o", - script = "ChickenDefenseScripts/chickenr1.cob", - seismicsignature = 4, - selfdestructas = "LOBBER_MORPH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 6, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 30, - turninplace = true, - turnrate = 5000, - unitname = "chickenr1", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goolauncher = { - interceptedByShieldType = 4, - accuracy = 512, - areaofeffect = 128, - avoidfeature = 0, - avoidfriendly = 0, - burst = 3, - burstrate = 0.8, - cegtag = "blob_trail", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:ELECTRIC_EXPLOSION", - impulseboost = 0, - impulsefactor = 0.4, - intensity = 0.7, - interceptedbyshieldtype = 1, - name = "GOOLAUNCHER", - noselfdamage = true, - proximitypriority = -4, - range = 1250, - reloadtime = 36, - rgbcolor = "0.2 0.5 0.9", - size = 9, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/junohit2edit", - sprayangle = 512, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 600, - damage = { - default = 600, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "MOBILE", - def = "GOOLAUNCHER", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenr2.lua b/Units/ChickenDefenseUnits/chickenr2.lua deleted file mode 100644 index ff91ba927..000000000 --- a/Units/ChickenDefenseUnits/chickenr2.lua +++ /dev/null @@ -1,144 +0,0 @@ -return { - chickenr2 = { - acceleration = 0.9, - activatewhenbuilt = true, - autoheal = 50, - bmcode = "1", - brakerate = 0.7, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickenr2.png", - buildtime = 1, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -2 0", - collisionvolumescales = "25 31 44", - collisionvolumetype = "box", - defaultmissiontype = "Standby", - description = "Chicken Assault", - explodeas = "WEAVER_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "td_lit_all", - leavetracks = true, - maneuverleashlength = "640", - mass = 600, - maxdamage = 4500, - maxvelocity = 4.5, - movementclass = "CHICKENHKBOT3", - name = "Enraged Lobber", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenr.s3o", - script = "ChickenDefenseScripts/chickenr2.cob", - seismicsignature = 4, - selfdestructas = "WEAVER_DEATH", - side = "THUNDERBIRDS", - sightdistance = 200, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 0, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 35, - turninplace = true, - turnrate = 5000, - unitname = "chickenr2", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:ANGRYLOBBERTRAIL", - [2] = "custom:blood_spray", - [3] = "custom:blood_explode", - [4] = "custom:dirt", - }, - }, - weapondefs = { - chaseweapon = { - interceptedByShieldType = 4, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0, - name = "Claws", - noselfdamage = true, - proximitypriority = -4, - range = 200, - reloadtime = 30, - size = 0.001, - targetborder = 1, - tolerance = 5000, - turret = "true", - weapontype = "Cannon", - weaponvelocity = 500, - damage = { - default = 0.001, - }, - }, - flamer = { - areaofeffect = 64, - avoidfeature = 0, - avoidfriendly = 0, - burst = 12, - burstrate = 0.01, - colormap = "0.3 0.5 1.0 0.7 0.6 0.9 1 0.01", - craterboost = 0, - cratermult = 0, - firestarter = 100, - flamegfxtime = 0.7, - groundbounce = 1, - impulseboost = 0, - impulsefactor = 0, - intensity = 0.9, - name = "PlasmaThrower", - noselfdamage = true, - proximitypriority = 4, - range = 310, - reloadtime = 0.7, - sizegrowth = 1.2, - soundstart = "ChickenDefenseSounds/Flamhvy1", - soundtrigger = 0, - sprayangle = 1200, - targetmoveerror = 0.001, - tolerance = 2500, - turret = "true", - weapontimer = 1, - weapontype = "Flame", - weaponvelocity = 300, - damage = { - default = 40, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "CHASEWEAPON", - maindir = "0 0 1", - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - [2] = { - badtargetcategory = "VTOL", - def = "FLAMER", - maindir = "0 0 1", - maxangledif = 180, - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenr3.lua b/Units/ChickenDefenseUnits/chickenr3.lua deleted file mode 100644 index ed634dfb9..000000000 --- a/Units/ChickenDefenseUnits/chickenr3.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - chickenr3 = { - acceleration = 1, - bmcode = "1", - brakerate = 8, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/chickenr3.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "84 215 84", - collisionvolumetest = 1, - collisionvolumetype = "CylY", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Meteor Launcher", - explodeas = "LOBBER_MORPH", - footprintx = 4, - footprintz = 4, - hidedamage = 1, - hightrajectory = 1, - icontype = "lacerator", - idleautoheal = 20, - idletime = 300, - leavetracks = true, - maneuverleashlength = "640", - mass = 40000, - maxdamage = 90000, - maxslope = 18, - maxvelocity = 2, - maxwaterdepth = 15, - movementclass = "CHICKQUEEN", - name = "Chicken Colonizer", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_colonizer.s3o", - script = "ChickenDefenseScripts/chickenr3.cob", - seismicsignature = 4, - selfdestructas = "LOBBER_MORPH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 6, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 70, - turninplace = true, - turnrate = 5000, - unitname = "chickenr3", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - meteorlauncher = { - interceptedByShieldType = 4, - areaofeffect = 750, - avoidfriendly = 0, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:nukedatbewm-roost", - firestarter = 70, - hightrajectory = 1, - model = "ChickenDefenseModels/greyrock2.s3o", - name = "METEORLAUNCHER", - proximitypriority = -6, - range = 18000, - reloadtime = 15, - soundhit = "ChickenDefenseSounds/nuke4", - targetable = 1, - turret = 1, - weaponvelocity = 1500, - damage = { - default = 2900, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "MOBILE", - def = "METEORLAUNCHER", - maindir = "0 0 1", - onlytargetcategory = "NOTAIR LIGHT ARMORED BUILDING", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickens1.lua b/Units/ChickenDefenseUnits/chickens1.lua deleted file mode 100644 index 82fa7f86b..000000000 --- a/Units/ChickenDefenseUnits/chickens1.lua +++ /dev/null @@ -1,155 +0,0 @@ -return { - chickens1 = { - acceleration = 1.5, - bmcode = "1", - brakerate = 1.25, - buildcostenergy = 1, - buildcostmetal = 45, - builder = false, - buildpic = "chicken_unitpics/chickens1.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - collisionvolumeoffsets = "0 -3 0", - collisionvolumescales = "21 30 46", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Spike Spitter", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 2, - footprintz = 2, - icontype = "td_lit_lit", - idleautoheal = 18, - idletime = 20, - leavetracks = true, - maneuverleashlength = "750", - mass = 900, - maxdamage = 820, - maxslope = 18, - maxvelocity = 5, - maxwaterdepth = 15, - movementclass = "CHICKENHKBOT2", - name = "Spiker", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickens.s3o", - script = "ChickenDefenseScripts/chickens1.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 390, - smoothanim = true, - sonardistance = 720, - steeringmode = "2", - tedclass = "AKBOT2", - trackoffset = 6, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 28, - turninplace = true, - turnrate = 1800, - unitname = "chickens1", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - waterweapon = { - interceptedByShieldType = 4, - areaofeffect = 16, - avoidfriendly = 0, - burnblow = 1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firesubmersed = true, - impulseboost = 0.123, - impulsefactor = 0.123, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Sea Spike", - noselfdamage = 1, - range = 690, - reloadtime = 9, - startvelocity = 150, - tolerance = 32767, - tracks = 1, - turnrate = 5000, - turret = 1, - waterweapon = true, - weaponacceleration = 25, - weapontimer = 4, - weaponvelocity = 220, - damage = { - default = 775, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 16, - avoidfeature = 0, - avoidfriendly = 0, - burnblow = true, - collidefeature = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:dirt", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 375, - reloadtime = 2, - startvelocity = 300, - submissile = 1, - targetmoveerror = 0.5, - turret = true, - waterweapon = false, - weaponacceleration = 70, - weapontimer = 1, - weapontype = "Cannon", - weaponvelocity = 325, - damage = { - default = 325, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - [2] = { - def = "WATERWEAPON", - maindir = "0 0 1", - maxangledif = 160, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickens2.lua b/Units/ChickenDefenseUnits/chickens2.lua deleted file mode 100644 index 16a2512cf..000000000 --- a/Units/ChickenDefenseUnits/chickens2.lua +++ /dev/null @@ -1,159 +0,0 @@ -return { - chickens2 = { - acceleration = 3, - bmcode = "1", - brakerate = 3, - buildcostenergy = 1, - buildcostmetal = 75, - builder = false, - buildpic = "chicken_unitpics/chickens2.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - category = "BIO", - cloakable = 1, - cloakcost = 0, - cloakcostmoving = 0, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "24 34 53", - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Ghost Spiker", - explodeas = "BUG_DEATH", - floater = false, - footprintx = 3, - footprintz = 3, - icontype = "td_lit_lit", - idleautoheal = 20, - idletime = 300, - initcloaked = 1, - leavetracks = true, - maneuverleashlength = "750", - mass = 300, - maxdamage = 5000, - maxslope = 18, - maxvelocity = 9, - maxwaterdepth = 15, - mincloakdistance = 200, - movementclass = "CHICKENHKBOT2", - name = "Advanced Spiker", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickens2.s3o", - script = "ChickenDefenseScripts/chickens2.cob", - seismicsignature = 0, - selfdestructas = "BUG_DEATH", - side = "THUNDERBIRDS", - sightdistance = 720, - smoothanim = true, - sonardistance = 720, - steeringmode = "2", - tedclass = "AKBOT2", - trackoffset = 6, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 30, - turninplace = true, - turnrate = 5000, - unitname = "chickens2", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - waterweapon = { - interceptedByShieldType = 4, - areaofeffect = 16, - avoidfriendly = 0, - burnblow = 1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:dirt", - impulseboost = 0.123, - impulsefactor = 0.123, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Sea Spike", - noselfdamage = 1, - range = 690, - reloadtime = 5, - startvelocity = 150, - tolerance = 32767, - tracks = 1, - turnrate = 1500, - turret = 1, - waterweapon = 1, - weaponacceleration = 25, - weapontimer = 4, - weaponvelocity = 220, - damage = { - default = 1500, - }, - }, - weapon = { - interceptedByShieldType = 4, - areaofeffect = 16, - avoidfeature = 0, - avoidfriendly = 0, - burnblow = true, - collidefeature = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 470, - reloadtime = 3.25, - smoketrail = true, - startvelocity = 600, - texture1 = "", - texture2 = "sporetrail", - turret = true, - waterweapon = false, - weapontimer = 1, - weapontype = "MissileLauncher", - weaponvelocity = 600, - damage = { - default = 1130, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "VTOL", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - [2] = { - def = "WATERWEAPON", - maindir = "0 0 1", - maxangledif = 160, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickens3.lua b/Units/ChickenDefenseUnits/chickens3.lua deleted file mode 100644 index 1d5962621..000000000 --- a/Units/ChickenDefenseUnits/chickens3.lua +++ /dev/null @@ -1,106 +0,0 @@ -return { - chickens3 = { - acceleration = 0.5, - airstrafe = true, - autoheal = 7, - brakerate = 3.5, - buildcostenergy = 1, - buildcostmetal = 50, - builder = false, - buildpic = "chicken_pidgeon.png", - buildpic = "chicken_unitpics/chickens3.png", - buildtime = 1, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 150, - defaultmissiontype = "VTOL_standby", - description = "Spiker Air Assault", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - hoverattack = true, - icontype = "air_arm", - idleautoheal = 2, - idletime = 0, - mass = 280, - maxdamage = 1900, - maxvelocity = 7, - name = "Fang", - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/spiker_gunship.s3o", - script = "ChickenDefenseScripts/chickens3.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - side = "THUNDERBIRDS", - sightdistance = 550, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turnrate = 5000, - unitname = "chickens3", - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 1100, - areaofeffect = 24, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 350, - reloadtime = 1.95, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 200, - submissile = 1, - turret = true, - weaponacceleration = 100, - weapontimer = 1, - weaponvelocity = 350, - damage = { - default = 200, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "WEAPON", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenw1.lua b/Units/ChickenDefenseUnits/chickenw1.lua deleted file mode 100644 index 0b19d6891..000000000 --- a/Units/ChickenDefenseUnits/chickenw1.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenw1 = { - acceleration = 2, - airsightdistance = 600, - amphibious = true, - bankscale = "1", - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chickenw1.png", - buildtime = 1, - cancrash = false, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - cansubmerge = false, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 100, - defaultmissiontype = "VTOL_standby", - description = "Flying Spike Spitter", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "air_arm", - idleautoheal = 2, - idletime = 0, - maneuverleashlength = "1280", - mass = 90, - maxdamage = 295, - maxvelocity = 10, - moverate1 = "32", - name = "Claw", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_pidgeon.s3o", - script = "ChickenDefenseScripts/chickenw1.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - separation = "0.2", - side = "THUNDERBIRDS", - sightdistance = 360, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenw1", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 200, - areaofeffect = 32, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 400, - reloadtime = 2.2, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 200, - submissile = 1, - turret = true, - waterweapon = true, - weaponacceleration = 100, - weapontimer = 1, - weaponvelocity = 425, - damage = { - default = 140, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "WEAPON", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenw1b.lua b/Units/ChickenDefenseUnits/chickenw1b.lua deleted file mode 100644 index 3b325c7b0..000000000 --- a/Units/ChickenDefenseUnits/chickenw1b.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenw1b = { - acceleration = 2, - airsightdistance = 600, - amphibious = true, - bankscale = "1", - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chickens1b.png", - buildtime = 1, - cancrash = false, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - cansubmerge = false, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 125, - defaultmissiontype = "VTOL_standby", - description = "Flying Spike Spitter", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "air_arm", - idleautoheal = 2, - idletime = 0, - maneuverleashlength = "1280", - mass = 90, - maxdamage = 330, - maxvelocity = 9, - moverate1 = "32", - name = "Claw", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_pidgeonb.s3o", - script = "ChickenDefenseScripts/chickenw1b.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - separation = "0.2", - side = "THUNDERBIRDS", - sightdistance = 360, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenw1b", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 200, - areaofeffect = 32, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 400, - reloadtime = 2, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 200, - submissile = 1, - turret = true, - waterweapon = true, - weaponacceleration = 100, - weapontimer = 1, - weaponvelocity = 425, - damage = { - default = 120, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "WEAPON", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenw1c.lua b/Units/ChickenDefenseUnits/chickenw1c.lua deleted file mode 100644 index 2eda0379c..000000000 --- a/Units/ChickenDefenseUnits/chickenw1c.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenw1c = { - acceleration = 2, - airsightdistance = 600, - amphibious = true, - bankscale = "1", - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chickenw1c.png", - buildtime = 1, - cancrash = false, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - cansubmerge = false, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 150, - defaultmissiontype = "VTOL_standby", - description = "Flying Spike Spitter", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "air_arm", - idleautoheal = 2, - idletime = 0, - maneuverleashlength = "1280", - mass = 90, - maxdamage = 295, - maxvelocity = 8, - moverate1 = "32", - name = "Claw", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_pidgeonc.s3o", - script = "ChickenDefenseScripts/chickenw1c.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - separation = "0.2", - side = "THUNDERBIRDS", - sightdistance = 360, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenw1c", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 200, - areaofeffect = 32, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 400, - reloadtime = 3, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 200, - submissile = 1, - turret = true, - waterweapon = true, - weaponacceleration = 100, - weapontimer = 1, - weaponvelocity = 425, - damage = { - default = 190, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "WEAPON", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenw1d.lua b/Units/ChickenDefenseUnits/chickenw1d.lua deleted file mode 100644 index 310580ea6..000000000 --- a/Units/ChickenDefenseUnits/chickenw1d.lua +++ /dev/null @@ -1,115 +0,0 @@ -return { - chickenw1d = { - acceleration = 2, - airsightdistance = 600, - amphibious = true, - bankscale = "1", - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 20, - builder = false, - buildpic = "chicken_unitpics/chickenw1d.png", - buildtime = 1, - cancrash = false, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - cansubmerge = false, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 175, - defaultmissiontype = "VTOL_standby", - description = "Flying Spike Spitter", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "air_arm", - idleautoheal = 2, - idletime = 0, - maneuverleashlength = "1280", - mass = 90, - maxdamage = 255, - maxvelocity = 7, - moverate1 = "32", - name = "Claw", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chicken_pidgeond.s3o", - script = "ChickenDefenseScripts/chickenw1d.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - separation = "0.2", - side = "THUNDERBIRDS", - sightdistance = 360, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenw1d", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - accuracy = 200, - areaofeffect = 32, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - range = 400, - reloadtime = 1.1, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 200, - submissile = 1, - turret = true, - waterweapon = true, - weaponacceleration = 100, - weapontimer = 1, - weaponvelocity = 425, - damage = { - default = 70, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "WEAPON", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/chickenw2.lua b/Units/ChickenDefenseUnits/chickenw2.lua deleted file mode 100644 index 399d3668e..000000000 --- a/Units/ChickenDefenseUnits/chickenw2.lua +++ /dev/null @@ -1,117 +0,0 @@ -return { - chickenw2 = { - acceleration = 2, - airsightdistance = 1500, - amphibious = true, - autoheal = 10, - bankscale = "1", - bmcode = "1", - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 50, - builder = false, - buildpic = "chicken_unitpics/chickenw2.png", - buildtime = 1, - cancrash = false, - canfly = true, - canguard = true, - canland = true, - canmove = true, - canpatrol = true, - canstop = true, - cansubmerge = false, - category = "BIO VTOL", --VTOL MOBILE WEAPON NOTSUB NOTSHIP NOTHOVER ALL", - collide = false, - collisionvolumeoffsets = "0 7 -6", - collisionvolumescales = "48 12 22", - collisionvolumetype = "box", - cruisealt = 150, - defaultmissiontype = "VTOL_standby", - description = "Fighter", - explodeas = "TALON_DEATH", - floater = true, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "air_lit", - maneuverleashlength = "1280", - mass = 200, - maxdamage = 1100, - maxvelocity = 11, - moverate1 = "32", - name = "Crow", - noautofire = false, - nochasecategory = "NOTAIR", - objectname = "ChickenDefenseModels/chicken_crow.s3o", - script = "ChickenDefenseScripts/chickenw2.cob", - seismicsignature = 0, - selfdestructas = "TALON_DEATH", - separation = "0.2", - side = "THUNDERBIRDS", - sightdistance = 0, - smoothanim = true, - steeringmode = "1", - tedclass = "VTOL", - turninplace = true, - turnrate = 5000, - unitname = "chickenw2", - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 32, - avoidfriendly = false, - burnblow = true, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1, - impulsefactor = 1, - interceptedbyshieldtype = 4, - model = "ChickenDefenseModels/spike.s3o", - name = "Spike", - noselfdamage = true, - predictboost = 1, - range = 600, - reloadtime = 1.6, - smoketrail = true, - soundstart = "ChickenDefenseSounds/talonattack", - startvelocity = 600, - texture1 = "", - texture2 = "sporetrail", - turret = true, - weaponacceleration = 250, - weapontimer = 1, - weaponvelocity = 1000, - damage = { - default = 200, - }, - }, - }, - weapons = { - [1] = { - badtargetcategory = "NOTAIR", - def = "WEAPON", - maindir = "0 0 1", - maxangledif = 90, - onlytargetcategory = "VTOL", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/e_chickenq.lua b/Units/ChickenDefenseUnits/e_chickenq.lua deleted file mode 100644 index 6f90a7be9..000000000 --- a/Units/ChickenDefenseUnits/e_chickenq.lua +++ /dev/null @@ -1,303 +0,0 @@ -return { - e_chickenq = { - acceleration = 1.2, - airsightdistance = 2400, - autoheal = 10, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/e_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionspherescale = 1.75, - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "60 130 140", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell! (Easy)", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 333332, - maxslope = 40, - maxvelocity = 2.8, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/e_chickenq.s3o", - script = "ChickenDefenseScripts/e_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "e_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 6, - burstrate = 0.01, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 2000, - reloadtime = 5, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 400, - damage = { - default = 900, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - range = 280, - reloadtime = 1.65, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 1750, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfriendly = 0, - burnblow = 1, - burst = 3, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 700, - reloadtime = 1.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 3, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 1.25, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfriendly = false, - burnblow = 1, - burst = 3, - burstrate = 0.1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 1.75, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "WEAPON", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/epic_chickenq.lua b/Units/ChickenDefenseUnits/epic_chickenq.lua deleted file mode 100644 index 76b7a7eb4..000000000 --- a/Units/ChickenDefenseUnits/epic_chickenq.lua +++ /dev/null @@ -1,306 +0,0 @@ -return { - epic_chickenq = { - acceleration = 3, - airsightdistance = 4000, - autoheal = 90, - bmcode = "1", - brakerate = 3, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/epic_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionspherescale = 1.75, - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "69 160 180", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell!", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 1000000, - maxslope = 40, - maxvelocity = 4.25, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Epic Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/epic_chickenq.s3o", - script = "ChickenDefenseScripts/epic_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 2000, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "epic_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - [4] = "custom:blood_spray", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - accuracy = 1200, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 22, - burstrate = 0.05, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.5, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 1200, - reloadtime = 6.5, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 900, - damage = { - default = 1300, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - proximitypriority = -9, - range = 320, - reloadtime = 0.45, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 1400, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfriendly = 0, - burnblow = 1, - burst = 1, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 2000, - reloadtime = 0.15, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 300, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 285, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 9, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 6, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 700, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 64, - avoidfriendly = false, - burnblow = 1, - burst = 45, - burstrate = 0.2, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 30, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 400, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 285, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "NOTAIR", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/h_chickenq.lua b/Units/ChickenDefenseUnits/h_chickenq.lua deleted file mode 100644 index bbca9082a..000000000 --- a/Units/ChickenDefenseUnits/h_chickenq.lua +++ /dev/null @@ -1,305 +0,0 @@ -return { - h_chickenq = { - acceleration = 1.6, - airsightdistance = 2400, - autoheal = 40, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/h_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionspherescale = 1.75, - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "60 130 140", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell! (Hard)", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 666664, - maxslope = 40, - maxvelocity = 2.8, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/h_chickenq.s3o", - script = "ChickenDefenseScripts/h_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "h_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - accuracy = 600, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 10, - burstrate = 0.01, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 1200, - reloadtime = 5, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 600, - damage = { - default = 900, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - proximitypriority = -3, - range = 280, - reloadtime = 0.55, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 850, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfriendly = 0, - burnblow = 1, - burst = 3, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 700, - reloadtime = 1.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 255, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 2, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 0.75, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 255, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfriendly = false, - burnblow = 1, - burst = 3, - burstrate = 0.1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 1.75, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 255, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "WEAPON", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/n_chickenq.lua b/Units/ChickenDefenseUnits/n_chickenq.lua deleted file mode 100644 index a05b75827..000000000 --- a/Units/ChickenDefenseUnits/n_chickenq.lua +++ /dev/null @@ -1,304 +0,0 @@ -return { - n_chickenq = { - acceleration = 1.6, - airsightdistance = 2400, - autoheal = 25, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/n_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "60 130 140", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell!", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 500000, - maxslope = 40, - maxvelocity = 2.7, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/chickenq.s3o", - script = "ChickenDefenseScripts/n_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "n_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - accuracy = 300, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 8, - burstrate = 0.01, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 1200, - reloadtime = 5, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 400, - damage = { - default = 600, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - proximitypriority = -3, - range = 280, - reloadtime = 0.6, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 750, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 72, - avoidfriendly = 0, - burnblow = 1, - burst = 3, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 700, - reloadtime = 1.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 72, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 3, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 1.25, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 72, - avoidfriendly = false, - burnblow = 1, - burst = 3, - burstrate = 0.1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 1.75, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 145, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "WEAPON", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/roost.lua b/Units/ChickenDefenseUnits/roost.lua deleted file mode 100644 index b9588ed5b..000000000 --- a/Units/ChickenDefenseUnits/roost.lua +++ /dev/null @@ -1,97 +0,0 @@ -return { - roost = { - acceleration = 0, - activatewhenbuilt = true, - autoheal = 1.8, - bmcode = "0", - brakerate = 0, - buildcostenergy = 1, - buildcostmetal = 1, - builddistance = 90, - builder = true, - buildpic = "chicken_unitpics/roost.png", - buildtime = 1, - category = "BIO", - collisionvolumeoffsets = "0 0 0", - collisionvolumescales = "56 11 56", - collisionvolumetype = "box", - description = "Spawns Chicken", - energystorage = 1000000, - metalstorage = 1000000, - energymake = 1000000, - metalmake = 1000000, - explodeas = "ROOST_DEATH", - footprintx = 2, - footprintz = 2, - icontype = "energy", - idleautoheal = 10, - idletime = 90, - isairbase = true, - levelground = false, - mass = 165.75, - maxdamage = 1800, - maxvelocity = 0, - name = "Roost", - noautofire = false, - objectname = "ChickenDefenseModels/roost.s3o", - script = "ChickenDefenseScripts/roost.cob", - radardistance = 900, - seismicsignature = 4, - selfdestructas = "ROOST_DEATH", - side = "ARM", - sightdistance = 450, - smoothanim = true, - tedclass = "ENERGY", - turnrate = 0, - unitname = "roost", - upright = false, - waterline = 0, - workertime = 1500, - yardmap = "ooooooooo", - featuredefs = {}, - sfxtypes = { - explosiongenerators = { - [1] = "custom:dirt", - }, - }, - weapondefs = { - weapon = { - interceptedByShieldType = 4, - areaofeffect = 450, - avoidfriendly = 0, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0, - explosiongenerator = "custom:nukedatbewm-roost", - firestarter = 70, - flighttime = 100, - metalpershot = 0, - model = "ChickenDefenseModels/greyrock2.s3o", - name = "Asteroid", - range = 29999, - reloadtime = 5, - smoketrail = 1, - soundhit = "ChickenDefenseSounds/nuke4", - startvelocity = 2000, - turret = 1, - weaponacceleration = 120, - weapontimer = 10, - weaponvelocity = 2000, - wobble = 0, - damage = { - default = 6000, - }, - }, - }, - weapons = { - [1] = { - def = "WEAPON", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/ve_chickenq.lua b/Units/ChickenDefenseUnits/ve_chickenq.lua deleted file mode 100644 index dc14bc39c..000000000 --- a/Units/ChickenDefenseUnits/ve_chickenq.lua +++ /dev/null @@ -1,303 +0,0 @@ -return { - ve_chickenq = { - acceleration = 1.2, - airsightdistance = 2400, - autoheal = 5, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/ve_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionspherescale = 1.75, - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "60 130 140", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell! (Very Easy)", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 166666, - maxslope = 40, - maxvelocity = 2.9, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/ve_chickenq.s3o", - script = "ChickenDefenseScripts/ve_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "ve_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 5, - burstrate = 0.01, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 750, - reloadtime = 5, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 400, - damage = { - default = 1200, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - range = 260, - reloadtime = 1.65, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 1500, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfriendly = 0, - burnblow = 1, - burst = 2, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 700, - reloadtime = 1.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 90, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 2, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 1.25, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 90, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfriendly = false, - burnblow = 1, - burst = 2, - burstrate = 0.1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 1.75, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 1000, - wobble = 64000, - damage = { - default = 90, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "WEAPON", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/ChickenDefenseUnits/vh_chickenq.lua b/Units/ChickenDefenseUnits/vh_chickenq.lua deleted file mode 100644 index 82b7d992d..000000000 --- a/Units/ChickenDefenseUnits/vh_chickenq.lua +++ /dev/null @@ -1,305 +0,0 @@ -return { - vh_chickenq = { - acceleration = 1.8, - airsightdistance = 2400, - autoheal = 75, - bmcode = "1", - brakerate = 2, - buildcostenergy = 1, - buildcostmetal = 500, - builder = false, - buildpic = "chicken_unitpics/vh_chickenq.png", - buildtime = 1, - canattack = true, - canguard = true, - canmove = true, - canpatrol = true, - canstop = "1", - cantbetransported = true, - category = "BIO", - collisionspherescale = 1.75, - collisionvolumeoffsets = "0 -52 15", - collisionvolumescales = "60 130 140", - collisionvolumetest = 1, - collisionvolumetype = "box", - corpse = "chicken_egg", - defaultmissiontype = "Standby", - description = "Clucking Hell! (Very Hard)", - explodeas = "QUEEN_DEATH", - footprintx = 3, - footprintz = 3, - icontype = "chikenqueen", - leavetracks = true, - maneuverleashlength = 2000, - mass = 2000000, - maxdamage = 833330, - maxslope = 40, - maxvelocity = 2.9, - maxwaterdepth = 70, - movementclass = "CHICKQUEEN", - name = "Chicken Queen", - noautofire = false, - nochasecategory = "VTOL", - objectname = "ChickenDefenseModels/vh_chickenq.s3o", - script = "ChickenDefenseScripts/vh_chickenq.cob", - pushresistant = true, - seismicsignature = 4, - selfdestructas = "QUEEN_DEATH", - side = "THUNDERBIRDS", - sightdistance = 1250, - smoothanim = true, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 18, - trackstrength = 8, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 100, - turninplace = true, - turnrate = 5000, - unitname = "vh_chickenq", - upright = false, - workertime = 0, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - weapondefs = { - goo = { - interceptedByShieldType = 4, - accuracy = 1200, - areaofeffect = 200, - avoidfeature = 0, - avoidfriendly = 0, - burst = 10, - burstrate = 0.01, - cegtag = "nuketrail-roost", - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - edgeeffectiveness = 0.33, - explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", - impulseboost = 0, - impulsefactor = 0, - intensity = 0.7, - interceptedbyshieldtype = 1, - model = "ChickenDefenseModels/SGreyRock1.S3O", - name = "Blob", - noselfdamage = true, - proximitypriority = -4, - range = 1200, - reloadtime = 4, - rgbcolor = "0.1 0.6 1", - size = 8, - sizedecay = 0, - soundhit = "ChickenDefenseSounds/e16", - soundstart = "ChickenDefenseSounds/bigchickenroar", - sprayangle = 6000, - tolerance = 5000, - turret = true, - weapontimer = 0.2, - weaponvelocity = 800, - damage = { - default = 1000, - }, - }, - melee = { - interceptedByShieldType = 4, - areaofeffect = 60, - avoidfeature = 0, - avoidfriendly = 0, - camerashake = 0, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - impulseboost = 1.5, - impulsefactor = 1.5, - name = "ChickenClaws", - noselfdamage = true, - proximitypriority = -3, - range = 280, - reloadtime = 0.45, - model = "ChickenDefenseModels/spike.s3o", - soundstart = "ChickenDefenseSounds/bigchickenbreath", - tolerance = 5000, - turret = true, - waterweapon = true, - weapontype = "Cannon", - weaponvelocity = 2500, - damage = { - default = 900, - }, - }, - spores1 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfriendly = 0, - burnblow = 1, - burst = 3, - burstrate = 0.11, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = 3, - range = 700, - reloadtime = 1.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 285, - }, - }, - spores2 = { - interceptedByShieldType = 4, - areaofeffect = 96, - avoidfeature = 0, - avoidfriendly = false, - burnblow = 1, - burst = 2, - burstrate = 0.09, - collidefriendly = false, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - range = 700, - reloadtime = 0.7, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 285, - }, - }, - spores3 = { - interceptedByShieldType = 4, - areaofeffect = 64, - avoidfriendly = false, - burnblow = 1, - burst = 1, - burstrate = 0.1, - collidefriendly = 0, - craterboost = 0, - cratermult = 0, - dance = 20, - explosiongenerator = "custom:chickenspike-large-sparks-burn", - firestarter = 0, - flighttime = 5, - groundbounce = 1, - heightmod = 0.5, - impulseboost = 0, - impulsefactor = 0.4, - interceptedbyshieldtype = 4, - metalpershot = 0, - model = "ChickenDefenseModels/spike.s3o", - name = "Missiles", - noselfdamage = true, - proximitypriority = -3, - range = 700, - reloadtime = 0.5, - smoketrail = true, - soundhit = "ChickenDefenseSounds/e25", - startvelocity = 200, - texture1 = "", - texture2 = "sporetrail", - tolerance = 10000, - tracks = true, - trajectoryheight = 2, - turnrate = 48000, - turret = true, - waterweapon = true, - weaponacceleration = 200, - weapontype = "MissileLauncher", - weaponvelocity = 4000, - wobble = 64000, - damage = { - default = 285, - }, - }, - }, - weapons = { - [1] = { - def = "MELEE", - maindir = "0 0 1", - maxangledif = 155, - }, - [2] = { - badtargetcategory = "NOTAIR", - def = "SPORES1", - }, - [3] = { - badtargetcategory = "WEAPON", - def = "SPORES2", - }, - [4] = { - badtargetcategory = "NOWEAPON", - def = "SPORES3", - }, - [5] = { - def = "GOO", - maindir = "0 0 1", - maxangledif = 180, - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/Federation of Kala - Faction 1/f1landfac.lua b/Units/Federation of Kala - Faction 1/f1landfac.lua new file mode 100644 index 000000000..500e7c3ed --- /dev/null +++ b/Units/Federation of Kala - Faction 1/f1landfac.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- f1landfac -- +-------------------------------------------------------------------------------- + +unitName = "f1landfac" + +-------------------------------------------------------------------------------- + +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Land Factory]] + +objectName = "eallterrfac2.s3o" +script = "eallterrfac2.cob" + +AllTerrainFactoryBuildList = Shared.buildListf1landfac + +VFS.Include("units-configs-basedefs/basedefs/allterrain/eminifac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/Federation of Kala - Faction 1/fedcommander.lua b/Units/Federation of Kala - Faction 1/fedcommander.lua new file mode 100644 index 000000000..d519aa1de --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedcommander.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- fedcommander -- +-------------------------------------------------------------------------------- + +unitName = [[fedcommander]] + +-------------------------------------------------------------------------------- + +humanname = [[Federation of Kala Command Unit]] +buildpicture = [[ecommander.png]] + +armortype = [[light]] +supplygiven = [[0]] +techprovided = [[tech0, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 2000 +maxvelocity = 3 +workertime = 1 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[ecommander4-battle.s3o]] +script = [[ecommander4-battle.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListFed + +weapon1 = [[machinegun]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Federation of Kala - Faction 1/fedcommander_up1.lua b/Units/Federation of Kala - Faction 1/fedcommander_up1.lua new file mode 100644 index 000000000..a87ffbac0 --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedcommander_up1.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- fedcommander_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[fedcommander_up1]] + +-------------------------------------------------------------------------------- + +humanname = [[Federation of Kala Command Unit]] +buildpicture = [[ecommander.png]] + +armortype = [[light]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 5000 +maxvelocity = 3 +workertime = 2 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[ecommander4-battle.s3o]] +script = [[ecommander4-battle.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListFed + +weapon1 = [[machinegun_up1]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Federation of Kala - Faction 1/fedcommander_up2.lua b/Units/Federation of Kala - Faction 1/fedcommander_up2.lua new file mode 100644 index 000000000..963973cea --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedcommander_up2.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- fedcommander_up2 -- +-------------------------------------------------------------------------------- + +unitName = [[fedcommander_up2]] + +-------------------------------------------------------------------------------- + +humanname = [[Federation of Kala Command Unit]] +buildpicture = [[ecommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 10000 +maxvelocity = 3 +workertime = 3 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[ecommander4-battle.s3o]] +script = [[ecommander4-battle.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListFed + +weapon1 = [[machinegun_up2]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Federation of Kala - Faction 1/fedcommander_up3.lua b/Units/Federation of Kala - Faction 1/fedcommander_up3.lua new file mode 100644 index 000000000..ad8734c6b --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedcommander_up3.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- fedcommander_up3 -- +-------------------------------------------------------------------------------- + +unitName = [[fedcommander_up3]] + +-------------------------------------------------------------------------------- + +humanname = [[Federation of Kala Command Unit]] +buildpicture = [[ecommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, tech3, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 15000 +maxvelocity = 3 +workertime = 4 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[ecommander4-battle.s3o]] +script = [[ecommander4-battle.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListFed + +weapon1 = [[machinegun_up3]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Federation of Kala - Faction 1/fedcommander_up4.lua b/Units/Federation of Kala - Faction 1/fedcommander_up4.lua new file mode 100644 index 000000000..2ab6d4885 --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedcommander_up4.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- fedcommander_up4 -- +-------------------------------------------------------------------------------- + +unitName = [[fedcommander_up4]] + +-------------------------------------------------------------------------------- + +humanname = [[Federation of Kala BattleMech Command Unit]] +buildpicture = [[ecommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, tech3, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 20000 +maxvelocity = 3 +workertime = 5 + +movementclass = [[COMMANDERTANK6]] + +objectname = [[ecommander4-battle-large.s3o]] +script = [[ecommander4-battle.cob]] + +footprintx = 6 +footprintz = 6 + +buildlist = Shared.buildListFed + +weapon1 = [[heavybeamweapon]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Federation of Kala - Faction 1/fedengineer.lua b/Units/Federation of Kala - Faction 1/fedengineer.lua new file mode 100644 index 000000000..bf8bf40f4 --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedengineer.lua @@ -0,0 +1,131 @@ +-- UNITDEF -- FEDENGINEER -- +-------------------------------------------------------------------------------- + +local unitName = "fedengineer" + +-------------------------------------------------------------------------------- + +local buildCostMetal = 40 +local maxDamage = 400 +local buildDistance = 350 + +local armortype = [[light]] +--local supply = [[2]] + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + + acceleration = 1, + brakeRate = 0.24, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildpic = "ehbotengineer.png", + CanAttack = false, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "LIGHT NOTAIR SUPPORT", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericGreen", + footprintX = 2, + footprintZ = 2, + iconType = "engineer", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = maxDamage, + maxSlope = 90, + maxVelocity = 4.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalmake = 0, + metalStorage = 0, + movementClass = "HOVERHBOT2", + moveState = "2", + name = "The Lifter", + objectName = "ehbotengineer2.s3o", + script = "ehbotengineer_lus.lua", + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericGreen", + showNanoSpray = false, + side = "ARM", + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 1020, + unitname = unitName, + upright = true, + workerTime = 1, + capturespeed = 1, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildListFed, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = [[tech0]], + canbetransported = "true", + needed_cover = 1, + death_sounds = "generic", + armortype = armortype, + noenergycost = true, +-- supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/Federation of Kala - Faction 1/fedengineer_turret.lua b/Units/Federation of Kala - Faction 1/fedengineer_turret.lua new file mode 100644 index 000000000..a4f7f73b8 --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedengineer_turret.lua @@ -0,0 +1,129 @@ +-- UNITDEF -- FEDENGINEER_turret -- +-------------------------------------------------------------------------------- + +local unitName = "fedengineer_turret" + +-------------------------------------------------------------------------------- + +local buildCostMetal = 90 +local maxDamage = 400 +local buildDistance = 800 + +local armortype = [[light]] +--local supply = [[2]] + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + + acceleration = 1, + brakeRate = 0.24, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildpic = "ehbotengineer_turret.png", + CanAttack = false, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + cantBeTransported = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "LIGHT NOTAIR SUPPORT", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericGreen", + floater = true, + footprintX = 2, + footprintZ = 2, + iconType = "engineer", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = maxDamage, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "HOVERHBOT2", + moveState = "0", + pushResistant = true, + name = "The Lifter Turret", + objectName = "ehbotengineer_turret.s3o", + script = "ehbotengineer_turret_lus.lua", + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericGreen", + showNanoSpray = false, + side = "ARM", + sightDistance = buildDistance, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + -- turnInPlace = false, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 1020, + unitname = unitName, + upright = true, + workerTime = 1, + capturespeed = 1, + TerraformSpeed = 100000, + ReclaimSpeed = 0, + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildListTurret, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + canbetransported = "true", + needed_cover = 1, + death_sounds = "generic", + armortype = armortype, +-- supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + }, +} + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/Federation of Kala - Faction 1/fedorb.lua b/Units/Federation of Kala - Faction 1/fedorb.lua new file mode 100644 index 000000000..7e5cda2da --- /dev/null +++ b/Units/Federation of Kala - Faction 1/fedorb.lua @@ -0,0 +1,29 @@ +-------------------------------------------------------------------------------- + +unitName = [[fedorb]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[O.R.B.]] + +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] + +workerTime = 1 +buildDistance = 350 + +tech = [[tech0]] +armortype = [[light]] + +buildlist = Shared.fedOrb + +VFS.Include("units-configs-basedefs/basedefs/eorb_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/f2landfac.lua b/Units/Loz Alliance - Faction 2/f2landfac.lua new file mode 100644 index 000000000..3084be068 --- /dev/null +++ b/Units/Loz Alliance - Faction 2/f2landfac.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- f2landfac -- +-------------------------------------------------------------------------------- + +unitName = "f2landfac" + +-------------------------------------------------------------------------------- + +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Land Factory]] + +objectName = "ehoverfactory.s3o" +script = "ehoverfac.cob" + +hoverFactoryBuildList = Shared.buildListf2landfac + +VFS.Include("units-configs-basedefs/basedefs/hover/ebasefactory_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/Loz Alliance - Faction 2/lozcommander.lua b/Units/Loz Alliance - Faction 2/lozcommander.lua new file mode 100644 index 000000000..35fb813d4 --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozcommander.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- lozcommander -- +-------------------------------------------------------------------------------- + +unitName = [[lozcommander]] + +-------------------------------------------------------------------------------- + +humanname = [[Loz Alliance Command Unit]] +buildpicture = [[lozcommander.png]] + +armortype = [[light]] +supplygiven = [[0]] +techprovided = [[tech0, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 2000 +maxvelocity = 3 +workertime = 1 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[lozcommandtank.s3o]] +script = [[lozcommandtank.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListLoz + +weapon1 = [[machinegun]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/lozcommander_up1.lua b/Units/Loz Alliance - Faction 2/lozcommander_up1.lua new file mode 100644 index 000000000..766a128e9 --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozcommander_up1.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- lozcommander_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[lozcommander_up1]] + +-------------------------------------------------------------------------------- + +humanname = [[Loz Alliance Command Unit]] +buildpicture = [[lozcommander.png]] + +armortype = [[light]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 5000 +maxvelocity = 3 +workertime = 2 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[lozcommandtank.s3o]] +script = [[lozcommandtank.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListLoz + +weapon1 = [[machinegun_up1]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/lozcommander_up2.lua b/Units/Loz Alliance - Faction 2/lozcommander_up2.lua new file mode 100644 index 000000000..21cc0678f --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozcommander_up2.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- lozcommander_up2 -- +-------------------------------------------------------------------------------- + +unitName = [[lozcommander_up2]] + +-------------------------------------------------------------------------------- + +humanname = [[Loz Alliance Command Unit]] +buildpicture = [[lozcommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 10000 +maxvelocity = 3 +workertime = 3 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[lozcommandtank.s3o]] +script = [[lozcommandtank.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListLoz + +weapon1 = [[machinegun_up2]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/lozcommander_up3.lua b/Units/Loz Alliance - Faction 2/lozcommander_up3.lua new file mode 100644 index 000000000..450f6b89e --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozcommander_up3.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- lozcommander_up3 -- +-------------------------------------------------------------------------------- + +unitName = [[lozcommander_up3]] + +-------------------------------------------------------------------------------- + +humanname = [[Loz Alliance Command Unit]] +buildpicture = [[lozcommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, tech3, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 15000 +maxvelocity = 3 +workertime = 4 + +movementclass = [[COMMANDERTANK4]] + +objectname = [[lozcommandtank.s3o]] +script = [[lozcommandtank.cob]] + +footprintx = 4 +footprintz = 4 + +buildlist = Shared.buildListLoz + +weapon1 = [[machinegun_up3]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/lozcommander_up4.lua b/Units/Loz Alliance - Faction 2/lozcommander_up4.lua new file mode 100644 index 000000000..659d98e1a --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozcommander_up4.lua @@ -0,0 +1,39 @@ +-- UNITDEF -- lozcommander_up4 -- +-------------------------------------------------------------------------------- + +unitName = [[lozcommander_up4]] + +-------------------------------------------------------------------------------- + +humanname = [[Loz Alliance BattleMech Command Unit]] +buildpicture = [[lozcommander.png]] + +armortype = [[armored]] +supplygiven = [[0]] +techprovided = [[tech0, tech1, tech2, tech3, -overseer]] +techrequired = [[0 overseer]] + +maxdamage = 20000 +maxvelocity = 3 +workertime = 5 + +movementclass = [[COMMANDERTANK6]] + +objectname = [[lozcommandtank-battle.s3o]] +script = [[lozcommandtank.cob]] + +footprintx = 6 +footprintz = 6 + +buildlist = Shared.buildListLoz + +weapon1 = [[heavybeamweapon]] + +VFS.Include("units-configs-basedefs/basedefs/commander_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/Loz Alliance - Faction 2/lozengineer.lua b/Units/Loz Alliance - Faction 2/lozengineer.lua new file mode 100644 index 000000000..887c96b22 --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozengineer.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- lozengineer -- +-------------------------------------------------------------------------------- + +unitName = "lozengineer" + +-------------------------------------------------------------------------------- + +buildCostMetal = 40 +buildDistance = 350 + +maxDamage = 500 + +humanName = [[Architect]] + +objectName = [[f2engineer.s3o]] +script = [[f2engineer_lus.lua]] + +armortype = [[light]] + +VFS.Include("units-configs-basedefs/basedefs/Faction 2/f2engineer_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/Loz Alliance - Faction 2/lozorb.lua b/Units/Loz Alliance - Faction 2/lozorb.lua new file mode 100644 index 000000000..57b3fc328 --- /dev/null +++ b/Units/Loz Alliance - Faction 2/lozorb.lua @@ -0,0 +1,29 @@ +-------------------------------------------------------------------------------- + +unitName = [[lozorb]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[O.R.B.]] + +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] + +workerTime = 1 +buildDistance = 350 + +tech = [[tech0]] +armortype = [[light]] + +buildlist = Shared.lozOrb + +VFS.Include("units-configs-basedefs/basedefs/eorb_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/aiunits/Buildings/ejammerai.lua b/Units/aiunits/Buildings/ejammerai.lua deleted file mode 100644 index 1e9de666b..000000000 --- a/Units/aiunits/Buildings/ejammerai.lua +++ /dev/null @@ -1,101 +0,0 @@ --- UNITDEF -- EJAMMER2 -- --------------------------------------------------------------------------------- - -local unitName = "ejammerai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] - -local techrequired = [[tech2]] - -local buildCostMetal = 20 -local maxDamage = buildCostMetal * 12.5 - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 16384, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR", - description = [[Radar Jamming Tower • Generates a Cloaking Field]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallBuildingExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, - iconType = "radarjam", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 60, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Radar Jamming/Cloaking Tower", - objectName = "ejammer3.s3o", - script = "ejammer3.cob", - onoffable = true, - radarDistanceJam = 500, - repairable = false, - selfDestructAs = "smallBuildingExplosionGenericPurple", - side = "CORE", - sightDistance = 500, - smoothAnim = true, - sonarDistance = 0, - unitname = "ejammer2", - workerTime = 0, - yardMap = "oooo oooo oooo oooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - explosiongenerators = { - "custom:blacksmoke", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdradar", - }, - }, - customParams = { - RequireTech = techrequired, - unittype = "building", - cannotcloak = true, - needed_cover = 3, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - corpse = "energycore", - - area_cloak = 0, -- Can this unit emit a cloaking field? - area_cloak_upkeep = 5, -- How much energy does it cost to maintain the cloaking field? - area_cloak_radius = 500, -- How large is the cloaking field? - --area_cloak_grow_rate = 200, -- When the cloaking field is turned on, how fast does the field expand to it's full size? - --area_cloak_shrink_rate = 200, -- When the cloaking field is turned off, how fast does the field shrink to nothingness? - area_cloak_decloak_distance = 150, -- How close does something have to be in order to decloak a unit within a cloaking shield? - area_cloak_init = true, -- Start up the cloak shield the moment the unit is built? - area_cloak_draw = true, -- No idea what this does - area_cloak_self = false, -- Does the cloak shield cloak the unit emitting it? - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 6, - BuildingGroundDecalSizeY = 6, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/elobberai.lua b/Units/aiunits/Buildings/elobberai.lua deleted file mode 100644 index 3b1acbc6e..000000000 --- a/Units/aiunits/Buildings/elobberai.lua +++ /dev/null @@ -1,154 +0,0 @@ --- UNITDEF -- EARTYTURRET -- --------------------------------------------------------------------------------- - -local unitName = "elobberai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] ---local supply = [[0]] -local techrequired = [[tech3]] - -local weapon1Damage = 1000 -local weapon1AOE = 500 ---local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) - -local buildCostMetal = 500 -local maxDamage = buildCostMetal * 12.5 - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - description = [[Long Range Artillery Turret Mark AI]], - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumBuildingExplosionGeneric", - floater = true, - footprintX = 8, - footprintZ = 8, - icontype = "turret_arty", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 60, - maxWaterDepth = 99999999999, - metalStorage = 0, - name = "Lobster", - noAutoFire = false, - objectName = "eartyturret.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumBuildingExplosionGeneric", - sightDistance = 500, - smoothAnim = true, - unitname = "eartyturret", - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/turretselect", - }, - }, - weapons = { - [1] = { - def = "artyweapon", - badtargetcategory = "LIGHT ARMORED VTOL", - onlyTargetCategory = "BUILDING", - - }, - }, - customParams = { - RequireTech = techrequired, - unittype = "turret", - --supply_cost = supply, - needed_cover = 1, - death_sounds = "generic", - armortype = armortype, - nofriendlyfire = "1", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - helptext = "helptext?", - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - artyweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - commandFire = false, - - cegTag = "artyshot2", - avoidNeutral = false, - explosionGenerator = "custom:NUKEDATBEWMSMALL", - energypershot = 50, - edgeEffectiveness = 1, - - impulseFactor = 0, - interceptedByShieldType = 4, - name = "Plasma Cannon", - range = 8000, - reloadtime = 40, - size = 16, - weaponType = "Cannon", - soundHit = "explosions/artyhit.wav", - soundStart = "weapons/arty2.wav", - - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eartytank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/esiloai.lua b/Units/aiunits/Buildings/esiloai.lua deleted file mode 100644 index 6576ca86e..000000000 --- a/Units/aiunits/Buildings/esiloai.lua +++ /dev/null @@ -1,186 +0,0 @@ --- UNITDEF -- ESILO -- --------------------------------------------------------------------------------- - -local unitName = "esiloai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] ---local supply = [[50]] -local techrequired = [[tech3]] - -local weapon1Damage = 3000 -local weapon1AOE = 1500 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) ---local stockpiletime = 60 - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local buildCostMetal = 1750 -local maxDamage = buildCostMetal * 12.5 - -local unitDef = { - - buildAngle = 8192, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - description = [[Nuclear Missile Silo Mark AI]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "nukemissile", - floater = true, - fireState = 2, - footprintX = 16, - footprintZ = 16, - iconType = "esilo", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 30, - maxWaterDepth = 5000, - metalStorage = 0, - name = [[Eradicator: Nuclear Strike Facility]], - objectName = "esilo2.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - script = "esilo2.cob", - selfDestructAs = "nukemissile", - side = "ARM", - sightDistance = 600, - smoothAnim = true, - unitlimit = "2", - unitname = "esilo", - workerTime = 0, - yardMap = "oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:needspower", - "custom:blacksmoke", - "custom:steam", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/turretselect", - }, - }, - weapons = { - [1] = { - def = "nukemissile", - badTargetCategory = "LIGHT ARMORED", - onlyTargetCategory = "BUILDING", - - }, - }, - customParams = { - ProvideTech = techprovided, - RequireTech = techrequired, - unittype = "turret", - needed_cover = 8, - --supply_cost = supply, - death_sounds = "nuke", - armortype = "building", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - corpse = "energycore", - helptext = [[Armortype: ]] ..armortype.. [[ - -]] .. weapon1Damage .. [[ Damage vs Light/Armored/Buildings - -Energy cost to fire: ]] - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 18, - BuildingGroundDecalSizeY = 18, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - nukemissile = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - cegTag = "NUKETRAIL", - collideFriendly = false, - collideFeature = false, - commandFire = false, - craterBoost = 0, - craterMult = 0, - edgeeffectiveness = 1, - energypershot = 50, - explosionGenerator = "custom:nukedatbewm", - fireStarter = 100, - flightTime = 400, - - id = 124, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - metalpershot = 0, - model = "enuke.s3o", - name = "Nuke", - range = 32000, - reloadtime = 200, - weaponType = "MissileLauncher", - - - smokeTrail = false, - soundHit = "explosions/explosion_enormous.wav", - soundStart = "weapons/nukelaunch.wav", - --- stockpile = true, --- stockpileTime = stockpiletime, - startVelocity = 10, - tracks = true, - turnRate = 3000, - targetable = 1, - - weaponAcceleration = 60, - weaponTimer = 5, - weaponType = "StarburstLauncher", - weaponVelocity = 1000, - customparams = { - damagetype = "default", - death_sounds = "nuke", - oldcosttofireforumula = true, - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/etech1ai.lua b/Units/aiunits/Buildings/etech1ai.lua deleted file mode 100644 index 65f1ea10e..000000000 --- a/Units/aiunits/Buildings/etech1ai.lua +++ /dev/null @@ -1,107 +0,0 @@ --- UNITDEF -- ETECH1 -- --------------------------------------------------------------------------------- - -local unitName = "etech1ai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local energyproduced = [[0]] -local techprovided = [[tech0, tech1, 1 tech1ai, -1 tech0ai]] -local tech = [[tech0, tech0ai]] ---local supplygranted = [[25]] - -local buildCostMetal = 100 -local maxDamage = buildCostMetal * 12.5 - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - canAttack = false, - category = "BUILDING NOTAIR ECO", - damageModifier = 0.33333, - description = "", - energyStorage = 0, - energyMake = energyproduced, - explodeAs = "hugeBuildingExplosionGenericBlue", - footprintX = 6, - footprintZ = 6, - icontype = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 60, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Tech Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", - onoffable = false, - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeBuildingExplosionGenericBlue", - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = unitName, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo ", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionnuclearblue", - "custom:skyhatelaser", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdenergy", - }, - }, - customParams = { - unittype = "building", - iseco = 1, - needed_cover = 4, - death_sounds = "generic", - ProvideTech = techprovided, --- ProvideTechRange = powerradius, - RequireTech = tech, - armortype = armortype, --- supply_granted = supplygranted, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", --- groundtexselectimg = ":nc:bitmaps/power/power.png", --- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", --- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", --- groundtexselectimg3 = ":nc:bitmaps/power/power3.png", --- groundtexselectimg4 = ":nc:bitmaps/power/power4.png", --- groundtexselectimg5 = ":nc:bitmaps/power/power5.png", --- groundtexselectimg6 = ":nc:bitmaps/power/power6.png", --- groundtexselectxsize = 500, -- optional --- groundtexselectzsize = 500, -- optional - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/etech2ai.lua b/Units/aiunits/Buildings/etech2ai.lua deleted file mode 100644 index 6fac829fd..000000000 --- a/Units/aiunits/Buildings/etech2ai.lua +++ /dev/null @@ -1,109 +0,0 @@ --- UNITDEF -- ETECH2 -- --------------------------------------------------------------------------------- - -local unitName = "etech2ai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local energyproduced = [[0]] -local techprovided = [[tech0, tech1, tech2, 1 tech2ai, -1 tech1ai]] - -local tech = [[tech1, tech1ai]] ---local supplygranted = [[25]] - -local buildCostMetal = 500 -local maxDamage = buildCostMetal * 12.5 - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - canAttack = false, - category = "BUILDING NOTAIR ECO", - damageModifier = 0.33333, - description = "", - energyStorage = 0, - energyMake = energyproduced, - explodeAs = "hugeBuildingExplosionGenericPurple", - footprintX = 6, - footprintZ = 6, - icontype = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 60, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Tech Level 2 Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", - onoffable = false, - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeBuildingExplosionGenericPurple", - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = unitName, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo ", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionnuclearpurple", - "custom:skyhatelaser", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdenergy", - }, - }, - customParams = { - unittype = "building", - iseco = 1, - needed_cover = 4, - death_sounds = "generic", - ProvideTech = techprovided, - RequireTech = tech, --- ProvideTechRange = powerradius, - -- RequireTech = "1 Powergrid", - armortype = armortype, --- supply_granted = supplygranted, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", --- groundtexselectimg = ":nc:bitmaps/power/power.png", --- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", --- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", --- groundtexselectimg3 = ":nc:bitmaps/power/power3.png", --- groundtexselectimg4 = ":nc:bitmaps/power/power4.png", --- groundtexselectimg5 = ":nc:bitmaps/power/power5.png", --- groundtexselectimg6 = ":nc:bitmaps/power/power6.png", --- groundtexselectxsize = 500, -- optional --- groundtexselectzsize = 500, -- optional - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/etech3ai.lua b/Units/aiunits/Buildings/etech3ai.lua deleted file mode 100644 index 7d7819705..000000000 --- a/Units/aiunits/Buildings/etech3ai.lua +++ /dev/null @@ -1,109 +0,0 @@ --- UNITDEF -- ETECH3 -- --------------------------------------------------------------------------------- - -local unitName = "etech3ai" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local energyproduced = [[0]] -local techprovided = [[tech0, tech1, tech2, tech3, 1000 endbringer, -1 tech2ai]] - -local tech = [[tech2, tech2ai]] ---local supplygranted = [[25]] - -local buildCostMetal = 1200 -local maxDamage = buildCostMetal * 12.5 - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - canAttack = false, - category = "BUILDING NOTAIR ECO", - damageModifier = 0.33333, - description = "", - energyStorage = 0, - energyMake = energyproduced, - explodeAs = "hugeBuildingExplosionGenericGreen", - footprintX = 6, - footprintZ = 6, - icontype = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = maxDamage, - maxSlope = 60, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Tech Level 3 Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", - onoffable = false, - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeBuildingExplosionGenericGreen", - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = unitName, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo ", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionnucleargreen", - "custom:skyhatelaser", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdenergy", - }, - }, - customParams = { - unittype = "building", - iseco = 1, - needed_cover = 4, - death_sounds = "generic", - ProvideTech = techprovided, - RequireTech = tech, --- ProvideTechRange = powerradius, - -- RequireTech = "1 Powergrid", - armortype = armortype, --- supply_granted = supplygranted, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", --- groundtexselectimg = ":nc:bitmaps/power/power.png", --- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", --- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", --- groundtexselectimg3 = ":nc:bitmaps/power/power3.png", --- groundtexselectimg4 = ":nc:bitmaps/power/power4.png", --- groundtexselectimg5 = ":nc:bitmaps/power/power5.png", --- groundtexselectimg6 = ":nc:bitmaps/power/power6.png", --- groundtexselectxsize = 500, -- optional --- groundtexselectzsize = 500, -- optional - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Buildings/eturretheavyai.lua b/Units/aiunits/Buildings/eturretheavyai.lua deleted file mode 100644 index d597be86e..000000000 --- a/Units/aiunits/Buildings/eturretheavyai.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EHEAVYTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[eturretheavyai]] - --------------------------------------------------------------------------------- - -buildCostMetal = 160 - -isUpgraded = [[0]] - -humanName = [[Immolator Mark AI]] - -objectName = [[eheavyturret3.s3o]] -script = [[eheavyturret2.cob]] - -tech = [[tech2]] -armortype = [[building]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/aiunits/Buildings/eturretheavyai_up3.lua b/Units/aiunits/Buildings/eturretheavyai_up3.lua deleted file mode 100644 index 2dbd047b6..000000000 --- a/Units/aiunits/Buildings/eturretheavyai_up3.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EHEAVYTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[eturretheavyai_up3]] - --------------------------------------------------------------------------------- - -buildCostMetal = 160 - -isUpgraded = [[3]] - -humanName = [[Immolator Mark AI]] - -objectName = [[eheavyturret3.s3o]] -script = [[eheavyturret2.cob]] - -tech = [[tech2]] -armortype = [[building]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/aiunits/Buildings/eturretlightai.lua b/Units/aiunits/Buildings/eturretlightai.lua deleted file mode 100644 index 45e8eff34..000000000 --- a/Units/aiunits/Buildings/eturretlightai.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ELIGHTTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[eturretlightai]] - --------------------------------------------------------------------------------- - -buildCostMetal = 100 - -isUpgraded = [[0]] - -humanName = [[Lightning Rod Mark AI]] - -objectName = [[elightturret3.s3o]] -script = [[elightturret2.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/aiunits/Buildings/eturretlightai_up3.lua b/Units/aiunits/Buildings/eturretlightai_up3.lua deleted file mode 100644 index 9af60f7db..000000000 --- a/Units/aiunits/Buildings/eturretlightai_up3.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ELIGHTTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[eturretlightai_up3]] - --------------------------------------------------------------------------------- - -buildCostMetal = 100 - -isUpgraded = [[3]] - -humanName = [[Lightning Rod Mark AI]] - -objectName = [[elightturret3.s3o]] -script = [[elightturret2.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/aiunits/Mobile/chickeneco.lua b/Units/aiunits/Mobile/chickeneco.lua deleted file mode 100644 index 2c31e99d8..000000000 --- a/Units/aiunits/Mobile/chickeneco.lua +++ /dev/null @@ -1,89 +0,0 @@ -return { - chickeneco = { - acceleration = 0.05, - activatewhenbuilt = true, - autoheal = 32, - bmcode = 1, - brakerate = 0.2, - buildcostenergy = 1, - buildcostmetal = 5, - builder = false, - buildpic = "chicken_unitpics/chickenh1.png", - buildtime = 1, - canassist = 0, - canbuild = 0, - canguard = 0, - canmove = true, - canpatrol = 1, - canrepair = 1, - canstop = 1, - category = "BIO", - collide = 0, - collisionvolumeoffsets = "0 -1 0", - collisionvolumescales = "10 14 22", - collisionvolumetype = "box", - defaultmissiontype = "Standby", - description = "Chicken Healer", - energymake = 500, - energystorage = 2000, - explodeas = "WEAVER_DEATH", - floater = false, - footprintx = 1, - footprintz = 1, - hidedamage = 1, - icontype = "builder", - kamikaze = true, - kamikazedistance = 60, - leavetracks = true, - maneuverleashlength = 640, - mass = 50, - maxdamage = 100, - maxslope = 18, - maxvelocity = 1, - maxwaterdepth = 5000, - metalstorage = 2000, - mobilestandorders = 1, - movementclass = "CHICKENHKBOT2", - name = "Weaver", - noautofire = 0, - objectname = "ChickenDefenseModels/chicken_drone.s3o", - script = "ChickenDefenseScripts/chickenh1.cob", - radardistance = 500, - reclaimspeed = 400, - repairspeed = 200, - seismicsignature = 1, - selfdestructas = "WEAVER_DEATH", - side = "THUNDERBIRDS", - sightdistance = 500, - smoothanim = true, - standingmoveorder = 1, - stealth = 1, - steeringmode = "2", - tedclass = "KBOT", - trackoffset = 1, - trackstrength = 6, - trackstretch = 1, - tracktype = "ChickenTrack", - trackwidth = 10, - turninplace = true, - turnrate = 5000, - unitname = "chickenh1", - upright = false, - waterline = 8, - workertime = 200, - featuredefs = { - dead = {}, - heap = {}, - }, - sfxtypes = { - explosiongenerators = { - [1] = "custom:blood_spray", - [2] = "custom:blood_explode", - [3] = "custom:dirt", - }, - }, - customparams = { - unittype = "mobile", - }, - }, -} diff --git a/Units/aiunits/Mobile/elifterai.lua b/Units/aiunits/Mobile/elifterai.lua deleted file mode 100644 index cfe271d29..000000000 --- a/Units/aiunits/Mobile/elifterai.lua +++ /dev/null @@ -1,143 +0,0 @@ --- UNITDEF -- EHBOTENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "elifterai" - --------------------------------------------------------------------------------- - -local buildCostMetal = 40 -local maxDamage = 400 -local buildDistance = 600 - -local armortype = [[light]] ---local supply = [[2]] - - aiDifficulty = Spring.GetModOptions().aidifficulty - - if aiDifficulty == nil then - aiDifficulty = "easy" - end - - if aiDifficulty == "easy" then - workerTime = 1 - elseif aiDifficulty == "hard" then - workerTime = 1 - end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildDistance = buildDistance, - builder = true, - buildTime = 5, - capturable = false, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 6, - footprintZ = 6, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = maxDamage, - maxSlope = 90, - maxVelocity = 4.5, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalmake = 0, - metalStorage = 0, - movementClass = "HOVERHBOT6", - moveState = "2", - name = "The Lifter Mark AI", - objectName = "ehbotengineer2.s3o", - script = "ehbotengineer_lus.lua", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = false, - side = "ARM", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 1020, - unitname = unitName, - upright = true, - workerTime = workerTime, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 100, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildListAIOverseer, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - unittype = "mobile", - area_mex_def = "emetalextractor", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype .. [[ - -Moving an Engineer in proximity to a Energy Core will spawn a small gunship drone from that core.]], - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Mobile/eunitfactoryai.lua b/Units/aiunits/Mobile/eunitfactoryai.lua deleted file mode 100644 index fc2895d9f..000000000 --- a/Units/aiunits/Mobile/eunitfactoryai.lua +++ /dev/null @@ -1,131 +0,0 @@ --- UNITDEF -- EAIRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eunitfactoryai" - --------------------------------------------------------------------------------- - -local buildCostMetal = 80 -local maxDamage = 450 - -local armortype = [[light]] ---local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.5, - airStrafe = true, - brakeRate = 0.5, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildTime = 2.5, - builder = true, - buildDistance = 600, - capturable = false, - canAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - canDropFlare = true, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT VTOL", - collide = true, - cruiseAlt = 300, - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, - floater = true, - footprintX = 4, - footprintZ = 4, - hoverAttack = true, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - maxBank = 5, - maxDamage = maxDamage, - maxSlope = 90, - maxVelocity = 7, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - moverate1 = "8", - moveState = "2", - name = "Unit Factory Mark AI", - objectName = "eairengineer2.s3o", - script = "eairengineer2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = true, - sightDistance = 600, - smoothAnim = true, - turnRate = 5000, - unitname = unitName, - unitnumber = "148", - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:nanoorb", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildListAIOverseer, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - unittype = "mobile", - area_mex_def = "emetalextractor", - -- needed_cover = 2, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - helptext = [[Armortype: ]] .. armortype, - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/aiunits/Mobile/ecommanderbattleai.lua b/Units/aiunits/ecommanderbattleai.lua similarity index 82% rename from Units/aiunits/Mobile/ecommanderbattleai.lua rename to Units/aiunits/ecommanderbattleai.lua index 542896780..17be64ed9 100644 --- a/Units/aiunits/Mobile/ecommanderbattleai.lua +++ b/Units/aiunits/ecommanderbattleai.lua @@ -4,53 +4,9 @@ local unitName = "ecommanderbattleai" -------------------------------------------------------------------------------- -aiDifficulty = Spring.GetModOptions().aidifficulty -shardChicken = Spring.GetModOptions().shardchicken - -if aiDifficulty == nil then - aiDifficulty = "easy" -end - -if shardChicken == nil then - shardChicken = "disabled" -end ---Spring.Echo("AI difficulty is set to: " .. aiDifficulty) - -if shardChicken == "enabled" then - description = [[Chicken Overseer, builds chickens]] - energyMake = 500 - metalMake = 1000 - workerTime = 100 - maxDamage = 50000 -elseif shardChicken == "disabled" then - if aiDifficulty == "easy" then - description = [[Easy AI • Builds Units • Provides support in battles]] - energyMake = 0 - metalMake = 0 - workerTime = 1 - maxDamage = 20000 - elseif aiDifficulty == "hard" then - description = [[Hard AI • Builds Units • Provides support in battles]] - energyMake = 20 - metalMake = 20 - workerTime = 1 - maxDamage = 100000 - end - end - -if shardChicken == "disabled" then - objectName = "ecommander4-battle.s3o" - script = "ecommander4-battle.cob" - movementClass = "COMMANDERTANK4" - elseif shardChicken == "enabled" then - objectName = "ChickenDefenseModels/brain_bug.s3o" - script = "ChickenDefenseScripts/chickenh5.cob" - movementClass = "CHICKENHKBOT2" -end - local armortype = [[armored]] -local supplyGiven = [[10]] -local techprovided = [[tech0, 1 tech0ai]] +local supplyGiven = [[0]] +local techprovided = [[tech0, tech1, tech2, tech3, 1 tech0ai]] local techrequired = [[0 overseer]] local weapon1Damage = 200 @@ -90,8 +46,8 @@ local unitDef = { canreclaim = false, canstop = true, category = "NOTAIR SUPPORT ARMORED", - description = description, - energyMake = energyMake, + description = [[AI Overseer • Builds Units • Provides support in battles]], + energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", @@ -102,19 +58,19 @@ local unitDef = { idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = maxDamage, + maxDamage = 5000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, maxWaterDepth = 5000, - metalmake = metalMake, + metalmake = 0, metalStorage = 9500, - movementClass = movementClass, + movementClass = "COMMANDERTANK4", moveState = "0", name = "The Battle Overseer (AI)", noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", - objectName = objectName, - script = script, + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", radarDistance = 1000, repairable = false, selfDestructAs = "commnuke", @@ -128,7 +84,7 @@ local unitDef = { turnRate = 5000, unitname = unitName, upright = false, - workerTime = workerTime, + workerTime = 1, capturespeed = 0.25, TerraformSpeed = 100000, ReclaimSpeed = 0, @@ -142,12 +98,12 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", "custom:gdhcannon", }, }, - buildoptions = Shared.buildListAIOverseer, + buildoptions = Shared.buildList, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -160,9 +116,6 @@ local unitDef = { }, weapons = { [1] = { - def = "riottankempweapon", - }, - [2] = { def = "machinegun", }, }, @@ -181,7 +134,7 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", }, } @@ -227,7 +180,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, }, @@ -260,7 +213,7 @@ local weaponDefs = { weaponVelocity = 10000, waterweapon = true, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, }, @@ -314,7 +267,7 @@ local weaponDefs = { weaponVelocity = 1000, waterweapon = true, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, @@ -357,7 +310,7 @@ local weaponDefs = { weaponVelocity = 1000, waterweapon = true, customparams = { - damagetype = "ecommanderbattle", + damagetype = "light", nocosttofire = true, }, damage = { diff --git a/Units/aiunits/ecommanderbuildai.lua b/Units/aiunits/ecommanderbuildai.lua new file mode 100644 index 000000000..2ab3e6c75 --- /dev/null +++ b/Units/aiunits/ecommanderbuildai.lua @@ -0,0 +1,290 @@ +-- UNITDEF -- ECOMMANDERBUILD -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderbuildai" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 1500, + builder = true, + buildTime = 2.5, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Builds Units x3 as fast]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 20000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Builder Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4.s3o", + script = "ecommander3.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 3, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 1.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "riottankempweapon", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + helptext = [[Armortype: ]] ..armortype.. [[ +x3 Buildpower + +1000 EMP Damage vs Light/Armored/Building + +Reclaims any energy cores within it's proximity.]], + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + riottankempweapon = { + + AreaOfEffect = weapon1AOE, + avoidFeature = false, + avoidFriendly = false, + avoidGround = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-medium-lightning", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 500, + reloadtime = 0.5, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = weapon1Damage, + }, + }, + + emp = { + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + tolerance = 1000, + energypershot = 0, + explosionScar = false, + impulseFactor = 0, + name = "Emp Blast Weapon", + noSelfDamage = true, + paralyzer = true, + paralyzetime = 5, + range = 500, + reloadtime = 5, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = 1000, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/aiunits/ecommandercloakai.lua b/Units/aiunits/ecommandercloakai.lua new file mode 100644 index 000000000..1e81ab080 --- /dev/null +++ b/Units/aiunits/ecommandercloakai.lua @@ -0,0 +1,296 @@ +-- UNITDEF -- ECOMMANDERCLOAK -- +-------------------------------------------------------------------------------- + +local unitName = "ecommandercloakai" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 1000, + builder = true, + buildTime = 2.5, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Builds Units • Provides Cloak Field]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 30000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Cloaking Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4.s3o", + script = "ecommander3.cob", + radarDistance = 0, + radarDistanceJam = 800, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 650, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + + area_cloak = 1, -- Can this unit emit a cloaking field? + area_cloak_upkeep = 0, -- How much energy does it cost to maintain the cloaking field? + area_cloak_radius = 1000, -- How large is the cloaking field? + --area_cloak_grow_rate = 200, -- When the cloaking field is turned on, how fast does the field expand to it's full size? + --area_cloak_shrink_rate = 200, -- When the cloaking field is turned off, how fast does the field shrink to nothingness? + area_cloak_decloak_distance = 150, -- How close does something have to be in order to decloak a unit within a cloaking shield? + area_cloak_init = true, -- Start up the cloak shield the moment the unit is built? + area_cloak_draw = true, -- No idea what this does + area_cloak_self = true, -- Does the cloak shield cloak the unit emitting it? + + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + riottankempweapon = { + + AreaOfEffect = weapon1AOE, + avoidFeature = false, + avoidFriendly = false, + avoidGround = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-medium-lightning", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = weapon1Damage, + }, + }, + + emp = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + tolerance = 1000, + energypershot = 0, + explosionScar = false, + impulseFactor = 0, + name = "Emp Blast Weapon", + noSelfDamage = true, + paralyzer = true, + paralyzetime = 5, + range = 500, + reloadtime = 10, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = 1000, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/aiunits/ecommanderfactoryai.lua b/Units/aiunits/ecommanderfactoryai.lua new file mode 100644 index 000000000..ebd3b3d4b --- /dev/null +++ b/Units/aiunits/ecommanderfactoryai.lua @@ -0,0 +1,284 @@ +-- UNITDEF -- ECOMMANDERFACTORY -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderfactoryai" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[15]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 500, + builder = true, + buildTime = 2.5, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Creates buildings and mobile units • Gives ]] ..supplyGiven.. [[ Supply]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 30000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Factory Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4.s3o", + script = "ecommander3.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 3, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 1.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildListFactory, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "riottankempweapon", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + riottankempweapon = { + + AreaOfEffect = weapon1AOE, + avoidFeature = false, + avoidFriendly = false, + avoidGround = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-medium-lightning", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 500, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = weapon1Damage, + }, + }, + + emp = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + tolerance = 1000, + energypershot = 0, + explosionScar = false, + impulseFactor = 0, + name = "Emp Blast Weapon", + noSelfDamage = true, + paralyzer = true, + paralyzetime = 5, + range = 500, + reloadtime = 10, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = 1000, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/aiunits/ecommanderhealerai.lua b/Units/aiunits/ecommanderhealerai.lua new file mode 100644 index 000000000..6ba73bd90 --- /dev/null +++ b/Units/aiunits/ecommanderhealerai.lua @@ -0,0 +1,284 @@ +-- UNITDEF -- ECOMMANDER -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderhealerai" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 1000, + builder = true, + buildTime = 2.5, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Builds Units]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 10000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Healer Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4.s3o", + script = "ecommander3.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "riottankempweapon", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + riottankempweapon = { + + AreaOfEffect = weapon1AOE, + avoidFeature = false, + avoidFriendly = false, + avoidGround = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-medium-lightning", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 500, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = weapon1Damage, + }, + }, + + emp = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + tolerance = 1000, + energypershot = 0, + explosionScar = false, + impulseFactor = 0, + name = "Emp Blast Weapon", + noSelfDamage = true, + paralyzer = true, + paralyzetime = 5, + range = 500, + reloadtime = 10, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = 1000, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/aiunits/ecommandershieldai.lua b/Units/aiunits/ecommandershieldai.lua new file mode 100644 index 000000000..4038038f4 --- /dev/null +++ b/Units/aiunits/ecommandershieldai.lua @@ -0,0 +1,324 @@ +-- UNITDEF -- ECOMMANDERSHIELD -- +-------------------------------------------------------------------------------- + +local unitName = "ecommandershieldai" + +-------------------------------------------------------------------------------- + +local armortype = [[armored]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local shield1Power = 5000 +local shield1PowerRegen = 50 +local shield1PowerRegenEnergy = 0 + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 1000, + builder = true, + buildTime = 2.5, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Builds Units • Provides large shielding]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 15000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Shielded Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4.s3o", + script = "ecommander3shield.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- }, + [1] = { + def = "shield", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + helptext = [[Armortype: ]] ..armortype.. [[ + +Generates a large shield + +Reclaims any energy cores within it's proximity.]], + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + riottankempweapon = { + + AreaOfEffect = weapon1AOE, + avoidFeature = false, + avoidFriendly = false, + avoidGround = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.05, + edgeeffectiveness = 0.1, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-medium-lightning", + fallOffRate = 1, + fireStarter = 100, + impulseFactor = 0, + + minintensity = 1, + name = "EMP Blast Wave", + noexplode = true, + paralyzer = true, + paralyzetime = 2.5, + range = 500, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.2 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/fnubeamfire.wav", + soundHit = "explosions/phasegun1hit.wav", + texture1 = "wave", + texture2 = "empty", + thickness = 40, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = weapon1Damage, + }, + }, + + emp = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:genericshellexplosion-large-blue-emp", + tolerance = 1000, + energypershot = 0, + explosionScar = false, + impulseFactor = 0, + name = "Emp Blast Weapon", + noSelfDamage = true, + paralyzer = true, + paralyzetime = 5, + range = 500, + reloadtime = 10, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + + --Upgrades-- + upgradeClass = "groundweapons", + }, + damage = { + default = 1000, + }, + }, + shield = { + + Smartshield = true, + Exteriorshield = true, + Visibleshield = false, + Visibleshieldrepulse = false, + ShieldStartingPower = 0, + Shieldenergyuse = 0, + Shieldradius = 500, + Shieldpower = shield1Power, + Shieldpowerregen = shield1PowerRegen, + Shieldpowerregenenergy = shield1PowerRegenEnergy, + Shieldintercepttype = 4, + Shieldgoodcolor = "0.0 0.2 1.0", + Shieldbadcolor = "1.0 0 0", + Shieldalpha = 0.2, + + texture1 = "shield4", + + visibleShieldHitFrames = 1, + weaponType = [[Shield]], + customparams = { + nocosttofire = true, + }, + damage = { + default = 1, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/arm/armflash.lua b/Units/arm/armflash.lua deleted file mode 100644 index ba8a5b9e0..000000000 --- a/Units/arm/armflash.lua +++ /dev/null @@ -1,148 +0,0 @@ --- UNITDEF -- ARMFLASH -- --------------------------------------------------------------------------------- - -local unitName = "armflash" - --------------------------------------------------------------------------------- - -local unitDef = { - --Begin tags entered from Notepad++ en masse - pieceTrailCEGTag = "deathceg", - pieceTrailCEGRange = 2, - --End tags entered from Notepad++ - acceleration = 0.18, - bmcode = "1", - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 1000, - builder = false, - buildTime = 5, - canAttack = true, - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR", - copyright = "Copyright 1997 Humongous Entertainment. All rights reserved.", - defaultmissiontype = "Standby", - description = "Assault Tank Upgrade 2", - designation = "", - energyMake = 0.5, - energyStorage = 0, - energyUse = 0.5, - explodeAs = "mediumExplosionGeneric", - firestandorders = "1", - footprintX = 2, - footprintZ = 2, - frenchdescription = "Char d'assaut", - frenchname = "Agitator", - germandescription = "Gefechtspanzer", - germanname = "Instigator", - idleAutoHeal = .5, - idleTime = 2200, - italiandescription = "Carro armato d'assalto", - italianname = "Instigator", - leaveTracks = false, - maneuverleashlength = "640", - maxDamage = 10000, - maxSlope = 28, - maxVelocity = 3.5, - maxWaterDepth = 5000, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "TANK2", - movestate = 0, - name = "Flash", - noAutoFire = false, - noChaseCategory = "VTOL GROUND", - objectName = "armflash.s3o", - ovradjust = "1", - radarDistance = 0, - selfDestructAs = "mediumExplosionGeneric", - shootme = "1", - side = "CORE", - sightDistance = 600, - smoothAnim = true, - spanishdescription = "Tanque de asalto", - spanishname = "Instigator", - standingfireorder = "2", - standingmoveorder = "1", - steeringmode = "1", - threed = "1", - trackOffset = 3, - trackStrength = 5, - trackStretch = 1, - trackType = "VehTrack", - trackWidth = 24, - turnRate = 1000, - unitname = "armflash", - unitnumber = "108", - upright = false, - version = "1", - workerTime = 0, - zbuffer = "1", - sfxtypes = { - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "flashweapon", - onlyTargetCategory = "NOTAIR AMPHIB", - }, - }, - customParams = { - death_sounds = "generic", - RequireTech = "4 Power", - armortype = "armored", - normaltex = "unittextures/armregskinnormal.png", - corpse = "energycore", - }, -} - --------------------------------------------------------------------------------- - -local weaponDefs = { - flashweapon = { - AreaOfEffect = 8, - avoidFriendly = false, - collideFriendly = false, - rgbColor = "0.8 0.5 0", - rgbColor2 = "0.5 0.5 0.5", - explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", - id = 19, - name = "E.M.G.", - range = 510, - reloadtime = 0.1, - weaponType = "Cannon", - soundStart = "weapons/tgunshipfire.wav", - soundTrigger = true, - sprayAngle = 1024, - tolerance = 1000, - turret = true, - weaponTimer = 1, - weaponVelocity = 400, - damage = { - default = 7, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/chicken/burrow.lua b/Units/chicken/burrow.lua deleted file mode 100644 index c5e3fcd56..000000000 --- a/Units/chicken/burrow.lua +++ /dev/null @@ -1,84 +0,0 @@ --- UNITDEF -- BURROW -- --------------------------------------------------------------------------------- - -local unitName = "burrow" - --------------------------------------------------------------------------------- - -local unitDef = { - --Begin tags entered from Notepad++ en masse - pieceTrailCEGTag = "deathceg", - pieceTrailCEGRange = 2, - --End tags entered from Notepad++ - activateWhenBuilt = true, - buildAngle = 2500, - buildCostEnergy = 0, - buildCostMetal = 500, - builder = false, - buildTime = 10, - canAttack = false, - category = "NOTAIR ECO BUILDING", - description = "Produces Unlimited Energy and Metal", - energyMake = 998, - energyStorage = 900, - energyUse = 0, - explodeAs = "FUSIONPOP", - footprintX = 8, - footprintZ = 8, - iconType = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 2500, - maxSlope = 60, - maxWaterDepth = 5000, - metalmake = 998, - metalStorage = 900, - name = "Plot Device", - objectName = "efusion2.s3o", - radarDistance = 1000, - reclaimable = false, - selfDestructAs = "FUSIONPOP", - side = "ARM", - sightDistance = 1000, - smoothAnim = true, - unitname = "burrow", - workerTime = 0, - - sfxtypes = { - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionburrow", - "custom:skyhatelaser", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdenergy", - }, - }, - weapons = { - }, - customParams = { - death_sounds = "generic", - ProvideTech = "50 Power", - armortype = "building", - supply_granted = 200, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/chicken/queen.lua b/Units/chicken/queen.lua deleted file mode 100644 index a05823cd7..000000000 --- a/Units/chicken/queen.lua +++ /dev/null @@ -1,257 +0,0 @@ --- UNITDEF -- EEXKRABGOTH -- --------------------------------------------------------------------------------- - -local unitName = "queen" - --------------------------------------------------------------------------------- - -local unitDef = { - - acceleration = 0.18, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 1000, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - cantBeTransported = true, - category = "ARMORED NOTAIR SKIRMISHER", - description =[[Primary Laser: - 600 Damage/s vs Building - 60 Damage/s vs Light/Armored - - Secondary Concussion Cannons: - 320 Damage/s vs Light/Armored - 32 Damage/s vs Buildings]], - energyMake = 998, - energyStorage = 900, - energyUse = 0, - explodeAs = "nukemissile", - firestandorders = "1", - footprintX = 12, - footprintZ = 12, - iconType = "allterr", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 50000, - maxVelocity = 2.5, - maxReverseVelocity = 1, - maxWaterDepth = 80, - metalmake = 998, - metalStorage = 900, - movementClass = "EXPERIMENTALTANK12", - name = "Queen", - noChaseCategory = "VTOL", - objectName = "ekrabgroth.s3o", - pushResistant = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "krabblast", - shootme = "1", - sightDistance = 1500, - smoothAnim = true, - turnInPlace = true, - turnRate = 1000, - unitname = "queen", - unitnumber = "110", - unitRestricted = 1, - upright = false, - -- usePieceCollisionVolumes = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:flamethrowerrange500", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavybeamweapon", - onlyTargetCategory = "BIO BUILDING", - }, - [2] = { - def = "concussioncannon", - onlyTargetCategory = "BIO LIGHT ARMORED", - }, - [3] = { - def = "concussioncannon", - onlyTargetCategory = "BIO LIGHT ARMORED", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = "40 Power", - armortype = "armored", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - }, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - heavybeamweapon = { - - AreaOfEffect = 0, - avoidFeature = false, - avoidFriendly = false, - beamTime = 1, - - cameraShake = 1, - collideFeature = false, - collideFriendly = false, - coreThickness = 1, - -- cegTag = "mediumcannonweapon3", - -- duration = 0.2, - energypershot = 30, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 1500, - reloadtime = 1, - WeaponType = "BeamLaser", - rgbColor = "1 0 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "weapons/krabprimary.wav", - sweepfire = true, - -- soundHit = "explosions/mediumcannonhit.wav", - -- sweepfire = true, - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 800, - customparams = { - damagetype = "queenbeam", - }, - damage = { - default = 600, - }, - }, - concussioncannon = { - accuracy = 1, - AreaOfEffect = 150, - avoidFriendly = false, - avoidFeature = false, - - collideFriendly = false, - collideFeature = false, - cylinderTargeting = true, - burnblow = true, - - explosionGenerator = "custom:genericshellexplosion-large", - energypershot = 4, - fireStarter = 80, - id = 1, - impulseFactor = 0.1, - interceptedByShieldType = 4, - name = "Concussion Cannon", - - range = 1500, - reloadtime = 0.5, - weaponType = "Cannon", - soundHit = "explode2", - soundStart = "weapons/krabsecondary.wav", - - tolerance = 500, - turret = true, - weaponVelocity = 5000, - customparams = { - damagetype = "queencannon", - }, - damage = { - default = 160, - }, - }, - - nukemissile = { - AreaOfEffect = 2000, - avoidFriendly = false, - cegTag = "NUKETRAIL", - collideFriendly = false, - commandfire = true, - craterBoost = 0, - craterMult = 0, - energypershot = 12000, - explosionGenerator = "custom:NUKEDATBEWM", - fireStarter = 100, - flightTime = 400, - - id = 124, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 2, - - metalpershot = 0, - model = "enuke.s3o", - name = "Nuke", - range = 32000, - reloadtime = 15, - weaponType = "MissileLauncher", - - - smokeTrail = false, - soundHit = "explosions/explosion_enormous.wav", - soundStart = "weapons/nukelaunch.wav", - - stockpile = true, - stockpileTime = 240, - startVelocity = 500, - tracks = true, - turnRate = 30000, - targetable = 1, - - weaponAcceleration = 0, - weaponTimer = 10, - weaponType = "StarburstLauncher", - weaponVelocity = 500, - customparams = { - damagetype = "default", - death_sounds = "nuke", - }, - damage = { - default = 50000, - }, - }, - -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- - diff --git a/Units/dev/atm.lua b/Units/dev/atm.lua new file mode 100644 index 000000000..b011361c1 --- /dev/null +++ b/Units/dev/atm.lua @@ -0,0 +1,85 @@ +-- UNITDEF -- ATM -- +-------------------------------------------------------------------------------- + +local unitName = "atm" + +-------------------------------------------------------------------------------- + +local unitDef = { + --Begin tags entered from Notepad++ en masse + pieceTrailCEGTag = "deathceg", + pieceTrailCEGRange = 2, + --End tags entered from Notepad++ + activateWhenBuilt = true, + buildAngle = 2500, + buildCostEnergy = 0, + buildCostMetal = 500, + builder = false, + buildTime = 10, + canAttack = false, + category = "NOTAIR ECO BUILDING", + description = "Produces Unlimited Energy and Metal", + energyMake = 998, + energyStorage = 900, + energyUse = 0, + explodeAs = "FUSIONPOP", + footprintX = 8, + footprintZ = 8, + iconType = "energy", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = 2500, + maxSlope = 60, + maxWaterDepth = 5000, + metalmake = 998, + metalStorage = 900, + name = "ATM Machine", + objectName = "efusion2.s3o", + script = "efusion2.cob", + radarDistance = 1000, + reclaimable = false, + selfDestructAs = "FUSIONPOP", + side = "ARM", + sightDistance = 1000, + smoothAnim = true, + unitname = "atm", + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:blacksmoke", + "custom:fusionreactionburrow", + "custom:skyhatelaser", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdenergy", + }, + }, + weapons = { + }, + customParams = { + death_sounds = "generic", + ProvideTech = "50 Power, tech0, tech1, tech2, tech3", + armortype = "building", + supply_granted = 200, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, +} + + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairemp.lua b/Units/eair/eairemp.lua new file mode 100644 index 000000000..44b1b91de --- /dev/null +++ b/Units/eair/eairemp.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- eairemp -- +-------------------------------------------------------------------------------- + +unitName = "eairemp" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Gridlock]] + +objectName = "eairemp.s3o" +script = "eairemp.cob" + + +tech = [[tech3]] +armortype = [[air]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/air/eairemp_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairemp_up1.lua b/Units/eair/eairemp_up1.lua new file mode 100644 index 000000000..a5951b5a3 --- /dev/null +++ b/Units/eair/eairemp_up1.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- eairemp_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eairemp_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Gridlock MK II]] + +objectName = "eairemp.s3o" +script = "eairemp.cob" + + +tech = [[tech3]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/air/eairemp_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairemp_up2.lua b/Units/eair/eairemp_up2.lua new file mode 100644 index 000000000..b72ae1e25 --- /dev/null +++ b/Units/eair/eairemp_up2.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- eairemp_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eairemp_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Gridlock MK III]] + +objectName = "eairemp.s3o" +script = "eairemp.cob" + + +tech = [[tech3]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/air/eairemp_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairemp_up3.lua b/Units/eair/eairemp_up3.lua new file mode 100644 index 000000000..13c65a9ee --- /dev/null +++ b/Units/eair/eairemp_up3.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- eairemp_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eairemp_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Gridlock MK IV]] + +objectName = "eairemp.s3o" +script = "eairemp.cob" + + +tech = [[tech3]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/air/eairemp_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairengineer.lua b/Units/eair/eairengineer.lua deleted file mode 100644 index b87bbb726..000000000 --- a/Units/eair/eairengineer.lua +++ /dev/null @@ -1,130 +0,0 @@ --- UNITDEF -- EAIRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eairengineer" - --------------------------------------------------------------------------------- - -local buildCostMetal = 80 -local maxDamage = 450 - -local armortype = [[light]] ---local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.5, - airStrafe = true, - brakeRate = 0.5, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildTime = 2.5, - builder = true, - buildDistance = 600, - canAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - canDropFlare = true, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT VTOL", - collide = true, - cruiseAlt = 300, - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, - floater = true, - footprintX = 4, - footprintZ = 4, - hoverAttack = true, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - maxBank = 5, - maxDamage = maxDamage, - maxSlope = 90, - maxVelocity = 7, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - moverate1 = "8", - moveState = "2", - name = "The Originator", - objectName = "eairengineer2.s3o", - script = "eairengineer2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = true, - sightDistance = 600, - smoothAnim = true, - turnRate = 5000, - unitname = unitName, - unitnumber = "148", - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:nanoorb", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildList, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - unittype = "mobile", - area_mex_def = "emetalextractor", - -- needed_cover = 2, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype, - corpse = "energycore", - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/eairplant.lua b/Units/eair/eairplant.lua index 6f44f5c29..e8ccc02c2 100644 --- a/Units/eair/eairplant.lua +++ b/Units/eair/eairplant.lua @@ -5,7 +5,7 @@ unitName = "eairplant" -------------------------------------------------------------------------------- -buildCostMetal = 30 +buildCostMetal = 60 maxDamage = buildCostMetal * 12.5 humanName = [[VTOL Factory]] diff --git a/Units/eair/upgrade1/eairplant_up1.lua b/Units/eair/eairplant_up1.lua similarity index 100% rename from Units/eair/upgrade1/eairplant_up1.lua rename to Units/eair/eairplant_up1.lua diff --git a/Units/eair/upgrade1/upgrade2/eairplant_up2.lua b/Units/eair/eairplant_up2.lua similarity index 100% rename from Units/eair/upgrade1/upgrade2/eairplant_up2.lua rename to Units/eair/eairplant_up2.lua diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/eairplant_up3.lua b/Units/eair/eairplant_up3.lua similarity index 100% rename from Units/eair/upgrade1/upgrade2/upgrade3/eairplant_up3.lua rename to Units/eair/eairplant_up3.lua diff --git a/Units/eair/ebomber.lua b/Units/eair/ebomber.lua index 6efb2a3d8..a0abd0dff 100644 --- a/Units/eair/ebomber.lua +++ b/Units/eair/ebomber.lua @@ -9,12 +9,12 @@ isUpgraded = [[0]] humanName = [[Kamper]] -objectName = "ebomber2.s3o" +objectName = "ebomber2-small.s3o" script = "ebomber2.cob" tech = [[tech2]] -armortype = [[light]] +armortype = [[air]] supply = [[5]] VFS.Include("Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua") diff --git a/Units/eair/upgrade1/ebomber2_up1.lua b/Units/eair/ebomber2_up1.lua similarity index 95% rename from Units/eair/upgrade1/ebomber2_up1.lua rename to Units/eair/ebomber2_up1.lua index 0a37aacce..3c9eb0e88 100644 --- a/Units/eair/upgrade1/ebomber2_up1.lua +++ b/Units/eair/ebomber2_up1.lua @@ -9,7 +9,7 @@ isUpgraded = [[1]] humanName = [[Kamper Mark II]] -objectName = "ebomber2.s3o" +objectName = "ebomber2-small.s3o" script = "ebomber2.cob" diff --git a/Units/eair/upgrade1/upgrade2/ebomber2_up2.lua b/Units/eair/ebomber2_up2.lua similarity index 95% rename from Units/eair/upgrade1/upgrade2/ebomber2_up2.lua rename to Units/eair/ebomber2_up2.lua index 43279a24d..d4693989f 100644 --- a/Units/eair/upgrade1/upgrade2/ebomber2_up2.lua +++ b/Units/eair/ebomber2_up2.lua @@ -9,7 +9,7 @@ isUpgraded = [[2]] humanName = [[Kamper Mark III]] -objectName = "ebomber2.s3o" +objectName = "ebomber2-small.s3o" script = "ebomber2.cob" diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/ebomber2_up3.lua b/Units/eair/ebomber2_up3.lua similarity index 95% rename from Units/eair/upgrade1/upgrade2/upgrade3/ebomber2_up3.lua rename to Units/eair/ebomber2_up3.lua index 51af4e0b7..7ededa36d 100644 --- a/Units/eair/upgrade1/upgrade2/upgrade3/ebomber2_up3.lua +++ b/Units/eair/ebomber2_up3.lua @@ -9,7 +9,7 @@ isUpgraded = [[3]] humanName = [[Kamper Mark IV]] -objectName = "ebomber2.s3o" +objectName = "ebomber2-small.s3o" script = "ebomber2.cob" diff --git a/Units/eair/edrone.lua b/Units/eair/edrone.lua deleted file mode 100644 index bcbe68481..000000000 --- a/Units/eair/edrone.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EDRONE -- --------------------------------------------------------------------------------- - -unitName = "edrone" - --------------------------------------------------------------------------------- - -isUpgraded = [[0]] - -humanName = [[Mosquito]] - -objectName = "edrone2.s3o" -script = "edrone2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[1]] - -VFS.Include("units-configs-basedefs/basedefs/air/edrone_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/efighter.lua b/Units/eair/efighter.lua index 64cf6e8c0..9e325db28 100644 --- a/Units/eair/efighter.lua +++ b/Units/eair/efighter.lua @@ -9,12 +9,12 @@ isUpgraded = [[0]] humanName = [[Koyote]] -objectName = "efighter3.s3o" -script = "efighter3.cob" +objectName = "efighter2-small.s3o" +script = "efighter2.cob" -tech = [[tech1]] -armortype = [[light]] +tech = [[tech2]] +armortype = [[air]] supply = [[2]] VFS.Include("units-configs-basedefs/basedefs/air/efighter_basedef.lua") diff --git a/Units/eair/upgrade1/efighter_up1.lua b/Units/eair/efighter_up1.lua similarity index 86% rename from Units/eair/upgrade1/efighter_up1.lua rename to Units/eair/efighter_up1.lua index 44b62071b..93c0aca1a 100644 --- a/Units/eair/upgrade1/efighter_up1.lua +++ b/Units/eair/efighter_up1.lua @@ -9,11 +9,11 @@ isUpgraded = [[1]] humanName = [[Koyote Mark II]] -objectName = "efighter3.s3o" -script = "efighter3.cob" +objectName = "efighter2-small.s3o" +script = "efighter2.cob" -tech = [[tech1]] +tech = [[tech2]] armortype = [[light]] supply = [[2]] @@ -25,4 +25,4 @@ unitDef.weaponDefs = weaponDefs return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eair/upgrade1/upgrade2/efighter_up2.lua b/Units/eair/efighter_up2.lua similarity index 86% rename from Units/eair/upgrade1/upgrade2/efighter_up2.lua rename to Units/eair/efighter_up2.lua index 77511dd26..e8e8686e5 100644 --- a/Units/eair/upgrade1/upgrade2/efighter_up2.lua +++ b/Units/eair/efighter_up2.lua @@ -9,19 +9,20 @@ isUpgraded = [[2]] humanName = [[Koyote Mark III]] -objectName = "efighter3.s3o" -script = "efighter3.cob" +objectName = "efighter2-small.s3o" +script = "efighter2.cob" -tech = [[tech1]] +tech = [[tech2]] armortype = [[light]] supply = [[2]] VFS.Include("units-configs-basedefs/basedefs/air/efighter_basedef.lua") unitDef.weaponDefs = weaponDefs + -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/efighter_up3.lua b/Units/eair/efighter_up3.lua similarity index 86% rename from Units/eair/upgrade1/upgrade2/upgrade3/efighter_up3.lua rename to Units/eair/efighter_up3.lua index 8ebe5229d..f575c5e22 100644 --- a/Units/eair/upgrade1/upgrade2/upgrade3/efighter_up3.lua +++ b/Units/eair/efighter_up3.lua @@ -9,19 +9,20 @@ isUpgraded = [[3]] humanName = [[Koyote Mark IV]] -objectName = "efighter3.s3o" -script = "efighter3.cob" +objectName = "efighter2-small.s3o" +script = "efighter2.cob" -tech = [[tech1]] +tech = [[tech2]] armortype = [[light]] supply = [[2]] VFS.Include("units-configs-basedefs/basedefs/air/efighter_basedef.lua") unitDef.weaponDefs = weaponDefs + -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eair/egunship2.lua b/Units/eair/egunship2.lua index a7f968831..5acab7c7e 100644 --- a/Units/eair/egunship2.lua +++ b/Units/eair/egunship2.lua @@ -9,12 +9,12 @@ isUpgraded = [[0]] humanName = [[Wildkat]] -objectName = "egunship3.s3o" +objectName = "egunship3-small.s3o" script = "egunship3.cob" tech = [[tech2]] -armortype = [[armored]] +armortype = [[air]] supply = [[4]] VFS.Include("Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua") diff --git a/Units/eair/upgrade1/egunship2_up1.lua b/Units/eair/egunship2_up1.lua similarity index 95% rename from Units/eair/upgrade1/egunship2_up1.lua rename to Units/eair/egunship2_up1.lua index b323933ad..5fa577ca3 100644 --- a/Units/eair/upgrade1/egunship2_up1.lua +++ b/Units/eair/egunship2_up1.lua @@ -9,7 +9,7 @@ isUpgraded = [[1]] humanName = [[Wildkat Mark II]] -objectName = "egunship3.s3o" +objectName = "egunship3-small.s3o" script = "egunship3.cob" diff --git a/Units/eair/upgrade1/upgrade2/egunship2_up2.lua b/Units/eair/egunship2_up2.lua similarity index 95% rename from Units/eair/upgrade1/upgrade2/egunship2_up2.lua rename to Units/eair/egunship2_up2.lua index 204dfc06e..4ca8f6209 100644 --- a/Units/eair/upgrade1/upgrade2/egunship2_up2.lua +++ b/Units/eair/egunship2_up2.lua @@ -9,7 +9,7 @@ isUpgraded = [[2]] humanName = [[Wildkat Mark III]] -objectName = "egunship3.s3o" +objectName = "egunship3-small.s3o" script = "egunship3.cob" diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/egunship2_up3.lua b/Units/eair/egunship2_up3.lua similarity index 95% rename from Units/eair/upgrade1/upgrade2/upgrade3/egunship2_up3.lua rename to Units/eair/egunship2_up3.lua index 6532ce1b6..545b7828f 100644 --- a/Units/eair/upgrade1/upgrade2/upgrade3/egunship2_up3.lua +++ b/Units/eair/egunship2_up3.lua @@ -9,7 +9,7 @@ isUpgraded = [[3]] humanName = [[Wildkat Mark IV]] -objectName = "egunship3.s3o" +objectName = "egunship3-small.s3o" script = "egunship3.cob" diff --git a/Units/eair/ekrow.lua b/Units/eair/ekrow.lua index a168ae729..5da3bde41 100644 --- a/Units/eair/ekrow.lua +++ b/Units/eair/ekrow.lua @@ -13,9 +13,8 @@ objectName = "ekrow.s3o" script = "ekrow.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] -armortype = [[armored]] +tech = [[tech3]] +armortype = [[air]] VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") diff --git a/Units/eair/upgrade1/ekrow_up1.lua b/Units/eair/ekrow_up1.lua similarity index 90% rename from Units/eair/upgrade1/ekrow_up1.lua rename to Units/eair/ekrow_up1.lua index 085f7e6c3..c157dc3c4 100644 --- a/Units/eair/upgrade1/ekrow_up1.lua +++ b/Units/eair/ekrow_up1.lua @@ -13,8 +13,7 @@ objectName = "ekrow.s3o" script = "ekrow.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[light]] VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") diff --git a/Units/eair/upgrade1/upgrade2/ekrow_up2.lua b/Units/eair/ekrow_up2.lua similarity index 90% rename from Units/eair/upgrade1/upgrade2/ekrow_up2.lua rename to Units/eair/ekrow_up2.lua index 3796268e2..4dde44435 100644 --- a/Units/eair/upgrade1/upgrade2/ekrow_up2.lua +++ b/Units/eair/ekrow_up2.lua @@ -13,8 +13,7 @@ objectName = "ekrow.s3o" script = "ekrow.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[light]] VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/ekrow_up3.lua b/Units/eair/ekrow_up3.lua similarity index 90% rename from Units/eair/upgrade1/upgrade2/upgrade3/ekrow_up3.lua rename to Units/eair/ekrow_up3.lua index 0715816f5..aeaee9656 100644 --- a/Units/eair/upgrade1/upgrade2/upgrade3/ekrow_up3.lua +++ b/Units/eair/ekrow_up3.lua @@ -13,8 +13,7 @@ objectName = "ekrow.s3o" script = "ekrow.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[light]] VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") diff --git a/Units/eair/eraider.lua b/Units/eair/eraider.lua deleted file mode 100644 index 7776e1420..000000000 --- a/Units/eair/eraider.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ERAIDER -- --------------------------------------------------------------------------------- - -unitName = "eraider" - --------------------------------------------------------------------------------- - -isUpgraded = [[0]] - -humanName = [[Gridlock]] - -objectName = "eraider.s3o" -script = "eraider.cob" - - -tech = [[tech1]] -armortype = [[light]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/air/eraider_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/escout.lua b/Units/eair/escout.lua deleted file mode 100644 index cb6725588..000000000 --- a/Units/eair/escout.lua +++ /dev/null @@ -1,27 +0,0 @@ --- UNITDEF -- ESCOUT -- --------------------------------------------------------------------------------- - -unitName = "escout" - --------------------------------------------------------------------------------- - -isUpgraded = [[0]] - -humanName = [[AirSkout]] - -objectName = "escout2.s3o" -script = "escout2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/air/escout_basedef.lua") - --- unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/escoutdrone.lua b/Units/eair/escoutdrone.lua new file mode 100644 index 000000000..6c6a9ecde --- /dev/null +++ b/Units/eair/escoutdrone.lua @@ -0,0 +1,23 @@ +-- UNITDEF -- ESCOUTDRONE -- +-------------------------------------------------------------------------------- + +unitName = "escoutdrone" + +-------------------------------------------------------------------------------- + +humanName = [[Mosquito]] + +objectName = "edrone2.s3o" +script = "edrone2.cob" + +armortype = [[air]] + +tech = [[tech0]] + +VFS.Include("units-configs-basedefs/basedefs/air/escoutdrone_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/esubplane.lua b/Units/eair/esubplane.lua deleted file mode 100644 index 95743fa3b..000000000 --- a/Units/eair/esubplane.lua +++ /dev/null @@ -1,166 +0,0 @@ --- UNITDEF -- ESUBPLANE -- --------------------------------------------------------------------------------- - -local unitName = "esubplane" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.2, - airStrafe = true, - brakeRate = 7, - buildCostEnergy = 0, - buildCostMetal = 25, - buildTime = 2.5, - canAttack = true, - canDropFlare = false, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canstop = true, - category = "LIGHT VTOL", - collide = true, - --Collision Volumes... Because the engine devs are silly. - collisionVolumeScales = [[35 35 35]], - --End Collision volumes - cruiseAlt = 350, - description = "Stealth Sonar Plane - Can morph into a submarine", - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "BIG_UNIT", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, - floater = true, - footprintX = 3, - footprintZ = 3, - hoverAttack = true, - iconType = "air", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 280, - maxSlope = 10, - maxVelocity = 18, - verticalSpeed = 15, - maxWaterDepth = 6000, - amphibious = true, - canSubmerge = true, - metalStorage = 0, - name = "SeaGull", - noChaseCategory = "VTOL", - objectName = "esubplane.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "BIG_UNIT", - sightDistance = 800, - sonardistance = 1000, - smoothAnim = true, - stealth = false, - turnRate = 920, - unitname = "esubplane", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "esubplanetorpedo", - onlyTargetCategory = "BIO BUILDING AMPHIB", - noChaseCategory = "VTOL", - }, - }, - - customParams = { - unittype = "mobile", - -- needed_cover = 2, - death_sounds = "generic", - twokhotkey = 't', - nofriendlyfire = "1", - RequireTech = "10 Power", - armortype = "armored", - normaltex = "unittextures/esubplanenormal.png", - corpse = "energycore", - }, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - esubplanetorpedo = { - AreaOfEffect = 10, - avoidFriendly = false, - avoidFeature = false, - canattackground = false, - cegTag = "torpedotrailuwturret", - collideFriendly = false, - collideFeature = false, - cylinderTargeting = true, - explosionGenerator = "custom:torpedoexplosion", - energypershot = 3, - fireStarter = 80, - impulseFactor = 0.1, - interceptedByShieldType = 4, - model = "missilesmall.s3o", - name = "Underwater Torpedo", - - range = 1000, - reloadtime = 1, - weaponType = "TorpedoLauncher", - soundHit = "weapons/torpedolaunch.wav", - soundStart = "weapons/18393_inferno_reject.wav", - tolerance = 3000, - turret = true, - startVelocity = 200, - acceleration = 2000, - weaponVelocity = 10000, - tracks = true, - turnrate = 100000, - flighttime = 4, - sprayangle = 5000, - waterweapon = true, - - customparams = { - damagetype = "euwturret", - }, - damage = { - default = 60, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/etransport_up1.lua b/Units/eair/etransport_up1.lua similarity index 100% rename from Units/eair/upgrade1/etransport_up1.lua rename to Units/eair/etransport_up1.lua diff --git a/Units/eair/upgrade1/upgrade2/etransport_up2.lua b/Units/eair/etransport_up2.lua similarity index 100% rename from Units/eair/upgrade1/upgrade2/etransport_up2.lua rename to Units/eair/etransport_up2.lua diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/etransport_up3.lua b/Units/eair/etransport_up3.lua similarity index 100% rename from Units/eair/upgrade1/upgrade2/upgrade3/etransport_up3.lua rename to Units/eair/etransport_up3.lua diff --git a/Units/eair/upgrade1/edrone_up1.lua b/Units/eair/upgrade1/edrone_up1.lua deleted file mode 100644 index b7e44f797..000000000 --- a/Units/eair/upgrade1/edrone_up1.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EDRONE_up1 -- --------------------------------------------------------------------------------- - -unitName = "edrone_up1" - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[Mosquito MK II]] - -objectName = "edrone2.s3o" -script = "edrone2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[1]] - -VFS.Include("units-configs-basedefs/basedefs/air/edrone_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/eraider_up1.lua b/Units/eair/upgrade1/eraider_up1.lua deleted file mode 100644 index 0b2e22628..000000000 --- a/Units/eair/upgrade1/eraider_up1.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ERAIDER_up1 -- --------------------------------------------------------------------------------- - -unitName = "eraider_up1" - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[Gridlock MK II]] - -objectName = "eraider.s3o" -script = "eraider.cob" - - -tech = [[tech1]] -armortype = [[light]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/air/eraider_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/escout_up1.lua b/Units/eair/upgrade1/escout_up1.lua deleted file mode 100644 index 19f257d8a..000000000 --- a/Units/eair/upgrade1/escout_up1.lua +++ /dev/null @@ -1,27 +0,0 @@ --- UNITDEF -- ESCOUT -- --------------------------------------------------------------------------------- - -unitName = "escout_up1" - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[AirSkout Mark II]] - -objectName = "escout2.s3o" -script = "escout2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/air/escout_basedef.lua") - --- unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/edrone_up2.lua b/Units/eair/upgrade1/upgrade2/edrone_up2.lua deleted file mode 100644 index 10afe5569..000000000 --- a/Units/eair/upgrade1/upgrade2/edrone_up2.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EDRONE_up2 -- --------------------------------------------------------------------------------- - -unitName = "edrone_up2" - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[Mosquito MK III]] - -objectName = "edrone2.s3o" -script = "edrone2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[1]] - -VFS.Include("units-configs-basedefs/basedefs/air/edrone_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/eraider_up2.lua b/Units/eair/upgrade1/upgrade2/eraider_up2.lua deleted file mode 100644 index 880542487..000000000 --- a/Units/eair/upgrade1/upgrade2/eraider_up2.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ERAIDER_up2 -- --------------------------------------------------------------------------------- - -unitName = "eraider_up2" - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[Gridlock MK III]] - -objectName = "eraider.s3o" -script = "eraider.cob" - - -tech = [[tech1]] -armortype = [[light]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/air/eraider_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/escout_up2.lua b/Units/eair/upgrade1/upgrade2/escout_up2.lua deleted file mode 100644 index 1d2fb1bef..000000000 --- a/Units/eair/upgrade1/upgrade2/escout_up2.lua +++ /dev/null @@ -1,27 +0,0 @@ --- UNITDEF -- ESCOUT -- --------------------------------------------------------------------------------- - -unitName = "escout_up2" - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[AirSkout Mark III]] - -objectName = "escout2.s3o" -script = "escout2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/air/escout_basedef.lua") - --- unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/edrone_up3.lua b/Units/eair/upgrade1/upgrade2/upgrade3/edrone_up3.lua deleted file mode 100644 index d63351d57..000000000 --- a/Units/eair/upgrade1/upgrade2/upgrade3/edrone_up3.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- EDRONE_up3 -- --------------------------------------------------------------------------------- - -unitName = "edrone_up3" - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[Mosquito MK IV]] - -objectName = "edrone2.s3o" -script = "edrone2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[1]] - -VFS.Include("units-configs-basedefs/basedefs/air/edrone_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/eraider_up3.lua b/Units/eair/upgrade1/upgrade2/upgrade3/eraider_up3.lua deleted file mode 100644 index 692a6a96e..000000000 --- a/Units/eair/upgrade1/upgrade2/upgrade3/eraider_up3.lua +++ /dev/null @@ -1,28 +0,0 @@ --- UNITDEF -- ERAIDER_up3 -- --------------------------------------------------------------------------------- - -unitName = "eraider_up3" - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[Gridlock MK IV]] - -objectName = "eraider.s3o" -script = "eraider.cob" - - -tech = [[tech1]] -armortype = [[light]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/air/eraider_basedef.lua") - -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/upgrade1/upgrade2/upgrade3/escout_up3.lua b/Units/eair/upgrade1/upgrade2/upgrade3/escout_up3.lua deleted file mode 100644 index cd585f624..000000000 --- a/Units/eair/upgrade1/upgrade2/upgrade3/escout_up3.lua +++ /dev/null @@ -1,27 +0,0 @@ --- UNITDEF -- ESCOUT -- --------------------------------------------------------------------------------- - -unitName = "escout_up3" - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[AirSkout Mark IV]] - -objectName = "escout2.s3o" -script = "escout2.cob" - - -tech = [[tech0]] -armortype = [[light]] -supply = [[0]] - -VFS.Include("units-configs-basedefs/basedefs/air/escout_basedef.lua") - --- unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterraa.lua b/Units/eallterrain/eallterraa.lua deleted file mode 100644 index 493a7e6cc..000000000 --- a/Units/eallterrain/eallterraa.lua +++ /dev/null @@ -1,180 +0,0 @@ --- UNITDEF -- EALLTERRAA -- --------------------------------------------------------------------------------- - -local unitName = "eallterraa" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 26, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SKIRMISHER", - - -- Cloaking - - cancloak = true, - cloakCost = 0, - cloakCostMoving = 1, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description =[[Armored Dedicated Anti-Air • Uses +3 Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericPurple", - firestandorders = "1", - footprintX = 6, - footprintZ = 6, - iconType = "aa", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 600, - maxVelocity = 3, - turninplacespeedlimit = 2.8, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK6", - name = "Shredder", - noChaseCategory = "VTOL", - objectName = "eallterraa.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericPurple", - shootme = "1", - sightDistance = 750, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterraa", - unitnumber = "110", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavytankweapon", - onlyTargetCategory = "BIO VTOL", - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 3, - death_sounds = "generic", - RequireTech = "3 Power", - armortype = "armored", - nofriendlyfire = "1", - supply_cost = 3, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - corpse = "energycore", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weapon1Damage = 200 -local weapon1AOE = 50 - -local weaponDefs = { - heavytankweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - burnblow = true, - canAttackGround = false, - coreThickness = 0.5, - cegTag = "railgun", - duration = 0.1, - energypershot = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1), - explosionGenerator = "custom:BulletImpact3", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - minintensity = "1", - name = "Laser", - range = 800, - reloadtime = 1, - WeaponType = "LaserCannon", - rgbColor = "0 0 1", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "weapons/railgun.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 15, - tolerance = 1000, - turret = true, - weaponVelocity = 5000, - customparams = { - damagetype = "eallterraa", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- - diff --git a/Units/eallterrain/eallterranarchid.lua b/Units/eallterrain/eallterranarchid.lua index f3d4c6d92..bf8179cf8 100644 --- a/Units/eallterrain/eallterranarchid.lua +++ b/Units/eallterrain/eallterranarchid.lua @@ -12,8 +12,7 @@ humanName = [[Anarchid]] objectName = "eallterranarchid.s3o" script = "eallterranarchid.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[35]] diff --git a/Units/eallterrain/upgraded1/eallterranarchid_up1.lua b/Units/eallterrain/eallterranarchid_up1.lua similarity index 92% rename from Units/eallterrain/upgraded1/eallterranarchid_up1.lua rename to Units/eallterrain/eallterranarchid_up1.lua index 6f7ebcdaa..2f87a19b9 100644 --- a/Units/eallterrain/upgraded1/eallterranarchid_up1.lua +++ b/Units/eallterrain/eallterranarchid_up1.lua @@ -12,8 +12,7 @@ humanName = [[Anarchid Mark II]] objectName = "eallterranarchid.s3o" script = "eallterranarchid.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[35]] diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterranarchid_up2.lua b/Units/eallterrain/eallterranarchid_up2.lua similarity index 92% rename from Units/eallterrain/upgraded1/upgraded2/eallterranarchid_up2.lua rename to Units/eallterrain/eallterranarchid_up2.lua index 65a86bba6..d16b804bc 100644 --- a/Units/eallterrain/upgraded1/upgraded2/eallterranarchid_up2.lua +++ b/Units/eallterrain/eallterranarchid_up2.lua @@ -12,8 +12,7 @@ humanName = [[Anarchid Mark III]] objectName = "eallterranarchid.s3o" script = "eallterranarchid.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] ---supply = [[35]] diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterranarchid_up3.lua b/Units/eallterrain/eallterranarchid_up3.lua similarity index 92% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterranarchid_up3.lua rename to Units/eallterrain/eallterranarchid_up3.lua index f81ca0ee3..3d6e463e5 100644 --- a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterranarchid_up3.lua +++ b/Units/eallterrain/eallterranarchid_up3.lua @@ -12,8 +12,7 @@ humanName = [[Anarchid Mark IV]] objectName = "eallterranarchid.s3o" script = "eallterranarchid.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[35]] diff --git a/Units/eallterrain/eallterrassault.lua b/Units/eallterrain/eallterrassault.lua index 8cc6bfa58..00a53a3e5 100644 --- a/Units/eallterrain/eallterrassault.lua +++ b/Units/eallterrain/eallterrassault.lua @@ -12,7 +12,7 @@ humanName = [[Anvil]] objectName = "eallterrassault.s3o" script = "eallterrassault.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[armored]] supply = [[8]] diff --git a/Units/eallterrain/upgraded1/eallterrassault_up1.lua b/Units/eallterrain/eallterrassault_up1.lua similarity index 97% rename from Units/eallterrain/upgraded1/eallterrassault_up1.lua rename to Units/eallterrain/eallterrassault_up1.lua index 6aa9087ce..60004af75 100644 --- a/Units/eallterrain/upgraded1/eallterrassault_up1.lua +++ b/Units/eallterrain/eallterrassault_up1.lua @@ -12,7 +12,7 @@ humanName = [[Anvil Mark II]] objectName = "eallterrassault.s3o" script = "eallterrassault.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[armored]] supply = [[8]] diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrassault_up2.lua b/Units/eallterrain/eallterrassault_up2.lua similarity index 97% rename from Units/eallterrain/upgraded1/upgraded2/eallterrassault_up2.lua rename to Units/eallterrain/eallterrassault_up2.lua index 09b2e83ea..002e3ef1b 100644 --- a/Units/eallterrain/upgraded1/upgraded2/eallterrassault_up2.lua +++ b/Units/eallterrain/eallterrassault_up2.lua @@ -12,7 +12,7 @@ humanName = [[Anvil Mark III]] objectName = "eallterrassault.s3o" script = "eallterrassault.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[armored]] supply = [[8]] diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrassault_up3.lua b/Units/eallterrain/eallterrassault_up3.lua similarity index 97% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrassault_up3.lua rename to Units/eallterrain/eallterrassault_up3.lua index 8dd2ab63e..6730e15ca 100644 --- a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrassault_up3.lua +++ b/Units/eallterrain/eallterrassault_up3.lua @@ -12,7 +12,7 @@ humanName = [[Anvil Mark IV]] objectName = "eallterrassault.s3o" script = "eallterrassault.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[armored]] supply = [[8]] diff --git a/Units/eallterrain/eallterrengineer.lua b/Units/eallterrain/eallterrengineer.lua deleted file mode 100644 index 83e3ba8c6..000000000 --- a/Units/eallterrain/eallterrengineer.lua +++ /dev/null @@ -1,137 +0,0 @@ --- UNITDEF -- EALLTERRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eallterrengineer" - --------------------------------------------------------------------------------- - -local buildCostMetal = 40 -local maxDamage = 600 - -local armortype = [[light]] ---local supply = [[2]] - - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - - canGuard = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - - -- Cloaking - - cancloak = true, - cloakCost = 0, - cloakCostMoving = 1, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 4, - footprintZ = 4, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = maxDamage, - maxSlope = 180, - maxVelocity = 3, - maxReverseVelocity = 1, - turninplacespeedlimit = 3, - maxWaterDepth = 5000, - metalmake = 0, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "COMMANDERTANK4", - moveState = "2", - name = "The Architect", - objectName = "eallterrengineer2.s3o", - script = "eallterrengineer1.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = true, - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrengineer", - unitnumber = "20", - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildList, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - unittype = "mobile", - area_mex_def = "emetalextractor", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/con_legonormal.png", - corpse = "energycore", - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eallterrain/upgraded1/eallterrheavy_up1.lua b/Units/eallterrain/eallterrheavy_up1.lua similarity index 100% rename from Units/eallterrain/upgraded1/eallterrheavy_up1.lua rename to Units/eallterrain/eallterrheavy_up1.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrheavy_up2.lua b/Units/eallterrain/eallterrheavy_up2.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/eallterrheavy_up2.lua rename to Units/eallterrain/eallterrheavy_up2.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrheavy_up3.lua b/Units/eallterrain/eallterrheavy_up3.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrheavy_up3.lua rename to Units/eallterrain/eallterrheavy_up3.lua diff --git a/Units/eallterrain/eallterrlight.lua b/Units/eallterrain/eallterrlight.lua index 4f178f942..f7ec6a305 100644 --- a/Units/eallterrain/eallterrlight.lua +++ b/Units/eallterrain/eallterrlight.lua @@ -12,7 +12,7 @@ humanName = [[Recluse]] objectName = "eallterrlight2.s3o" script = "eallterrlight.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[2]] diff --git a/Units/eallterrain/upgraded1/eallterrlight_up1.lua b/Units/eallterrain/eallterrlight_up1.lua similarity index 97% rename from Units/eallterrain/upgraded1/eallterrlight_up1.lua rename to Units/eallterrain/eallterrlight_up1.lua index 0126efdd5..1df1aefc4 100644 --- a/Units/eallterrain/upgraded1/eallterrlight_up1.lua +++ b/Units/eallterrain/eallterrlight_up1.lua @@ -12,7 +12,7 @@ humanName = [[Recluse Mark II]] objectName = "eallterrlight2.s3o" script = "eallterrlight.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[2]] diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrlight_up2.lua b/Units/eallterrain/eallterrlight_up2.lua similarity index 97% rename from Units/eallterrain/upgraded1/upgraded2/eallterrlight_up2.lua rename to Units/eallterrain/eallterrlight_up2.lua index d92aa96df..d07e6e2cd 100644 --- a/Units/eallterrain/upgraded1/upgraded2/eallterrlight_up2.lua +++ b/Units/eallterrain/eallterrlight_up2.lua @@ -12,7 +12,7 @@ humanName = [[Recluse Mark III]] objectName = "eallterrlight2.s3o" script = "eallterrlight.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[2]] diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrlight_up3.lua b/Units/eallterrain/eallterrlight_up3.lua similarity index 97% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrlight_up3.lua rename to Units/eallterrain/eallterrlight_up3.lua index 5584be33c..3db5ad6a1 100644 --- a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrlight_up3.lua +++ b/Units/eallterrain/eallterrlight_up3.lua @@ -12,7 +12,7 @@ humanName = [[Recluse Mark IV]] objectName = "eallterrlight2.s3o" script = "eallterrlight.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[2]] diff --git a/Units/eallterrain/upgraded1/eallterrmed_up1.lua b/Units/eallterrain/eallterrmed_up1.lua similarity index 100% rename from Units/eallterrain/upgraded1/eallterrmed_up1.lua rename to Units/eallterrain/eallterrmed_up1.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrmed_up2.lua b/Units/eallterrain/eallterrmed_up2.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/eallterrmed_up2.lua rename to Units/eallterrain/eallterrmed_up2.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrmed_up3.lua b/Units/eallterrain/eallterrmed_up3.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrmed_up3.lua rename to Units/eallterrain/eallterrmed_up3.lua diff --git a/Units/eallterrain/eallterrriot_shotgun.lua b/Units/eallterrain/eallterrriot_shotgun.lua new file mode 100644 index 000000000..da8faaa4d --- /dev/null +++ b/Units/eallterrain/eallterrriot_shotgun.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot_shotgun -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_shotgun" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Mossberg]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrriot_shotgun_up1.lua b/Units/eallterrain/eallterrriot_shotgun_up1.lua new file mode 100644 index 000000000..28660568a --- /dev/null +++ b/Units/eallterrain/eallterrriot_shotgun_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot_shotgun_up1 -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_shotgun_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Mossberg]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrriot_shotgun_up2.lua b/Units/eallterrain/eallterrriot_shotgun_up2.lua new file mode 100644 index 000000000..a985965dc --- /dev/null +++ b/Units/eallterrain/eallterrriot_shotgun_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot_shotgun_up2 -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_shotgun_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Mossberg]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrriot_shotgun_up3.lua b/Units/eallterrain/eallterrriot_shotgun_up3.lua new file mode 100644 index 000000000..151f008ee --- /dev/null +++ b/Units/eallterrain/eallterrriot_shotgun_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot_shotgun_up3 -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_shotgun_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Mossberg]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/upgraded1/eallterrriot_up1.lua b/Units/eallterrain/eallterrriot_up1.lua similarity index 100% rename from Units/eallterrain/upgraded1/eallterrriot_up1.lua rename to Units/eallterrain/eallterrriot_up1.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrriot_up2.lua b/Units/eallterrain/eallterrriot_up2.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/eallterrriot_up2.lua rename to Units/eallterrain/eallterrriot_up2.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrriot_up3.lua b/Units/eallterrain/eallterrriot_up3.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrriot_up3.lua rename to Units/eallterrain/eallterrriot_up3.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/eallterrshield_up2.lua b/Units/eallterrain/eallterrshield_up2.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/eallterrshield_up2.lua rename to Units/eallterrain/eallterrshield_up2.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrshield_up3.lua b/Units/eallterrain/eallterrshield_up3.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eallterrshield_up3.lua rename to Units/eallterrain/eallterrshield_up3.lua diff --git a/Units/eallterrain/upgraded1/ealltershield_up1.lua b/Units/eallterrain/ealltershield_up1.lua similarity index 100% rename from Units/eallterrain/upgraded1/ealltershield_up1.lua rename to Units/eallterrain/ealltershield_up1.lua diff --git a/Units/eallterrain/eminifac.lua b/Units/eallterrain/eminifac.lua index e76b92e4b..a5fa7397e 100644 --- a/Units/eallterrain/eminifac.lua +++ b/Units/eallterrain/eminifac.lua @@ -5,7 +5,7 @@ unitName = "eminifac" -------------------------------------------------------------------------------- -buildCostMetal = 30 +buildCostMetal = 60 maxDamage = buildCostMetal * 12.5 humanName = [[All-Terrain Strider Factory]] diff --git a/Units/eallterrain/upgraded1/eminifac_up1.lua b/Units/eallterrain/eminifac_up1.lua similarity index 100% rename from Units/eallterrain/upgraded1/eminifac_up1.lua rename to Units/eallterrain/eminifac_up1.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/eminifac_up2.lua b/Units/eallterrain/eminifac_up2.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/eminifac_up2.lua rename to Units/eallterrain/eminifac_up2.lua diff --git a/Units/eallterrain/upgraded1/upgraded2/upgraded3/eminifac_up3.lua b/Units/eallterrain/eminifac_up3.lua similarity index 100% rename from Units/eallterrain/upgraded1/upgraded2/upgraded3/eminifac_up3.lua rename to Units/eallterrain/eminifac_up3.lua diff --git a/Units/eamphib/eamphibaa.lua b/Units/eamphib/eamphibaa.lua deleted file mode 100644 index 065906e04..000000000 --- a/Units/eamphib/eamphibaa.lua +++ /dev/null @@ -1,241 +0,0 @@ --- UNITDEF -- eamphibaa -- --------------------------------------------------------------------------------- - -local unitName = "eamphibaa" - --------------------------------------------------------------------------------- - -local tech = [[tech1]] -local armortype = [[light]] -local supply = [[4]] - -local weapon1Damage = 0 -local weapon1AOE = 0 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 24, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB RAID", - description = [[Unit Type: Tank Destroyer -Armortype: ]] ..armortype.. [[ - -135 Damage/s vs Light -80 Damages/s vs Armored/Building - -125 Damage vs Light/Armored -70 Damage vs Building - -Can fire while underwater - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire * 10) .. [[/s - -Requires +]] .. tech .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, - iconType = "aa", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 340, - maxSlope = 28, - maxVelocity = 3.8, - maxReverseVelocity = 2, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK4", - name = "Ikinz", - objectName = "eamphibaa.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericPurple", - sightDistance = 850, --- SonarDistance = 850, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 6.0, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 475, - unitname = "eamphibaa", - workerTime = 0, - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "medtankbeamlaser", - badTargetCategory = "BUILDING WALL", - }, - --[[ - [2] = { - def = "TORP", - }, - ]]-- - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = tech, - armortype = "light", - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - - medtankbeamlaser = { - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.2, - duration = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - impulsefactor = 0, - - largebeamlaser = true, - laserflaresize = 5, - leadlimit = 15, - minintensity = 1, - name = "Laser", - range = 850, - reloadtime = 0.1, - WeaponType = "BeamLaser", - rgbColor = "0.25 0 0.6", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "weapons/plasma2.wav", - -- soundHit = "weapons/amphibmedtankshothit.wav", - scrollspeed = 5, - texture1 = "lightning", - texture2 = "laserend", - thickness = 10, - tolerance = 3000, - turret = true, - weaponVelocity = 1000, - waterweapon = true, - customparams = { - damagetype = "eamphibmedtank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, -- multiply * 1.2 for correct dps output - }, - }, - - antiaircannon = { - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.4, - burnblow = true, - -- cegTag = "mediumcannonweapon3", - duration = 0.05, - energypershot = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1), - explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 800, - reloadtime = 0.1, - WeaponType = "LaserCannon", - rgbColor = "1 0.5 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "weapons/tmediumtankfire.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 6, - tolerance = 1000, - turret = true, - weaponVelocity = 2500, - customparams = { - damagetype = "eamphibaa", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibarty.lua b/Units/eamphib/eamphibarty.lua index b4546486f..ab453151a 100644 --- a/Units/eamphib/eamphibarty.lua +++ b/Units/eamphib/eamphibarty.lua @@ -12,7 +12,7 @@ humanName = [[Assimilator]] objectName = "eamphibarty2.s3o" script = "eamphibarty2.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[5]] diff --git a/Units/eamphib/upgrade1/eamphibarty_up1.lua b/Units/eamphib/eamphibarty_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibarty_up1.lua rename to Units/eamphib/eamphibarty_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibarty_up2.lua b/Units/eamphib/eamphibarty_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibarty_up2.lua rename to Units/eamphib/eamphibarty_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibarty_up3.lua b/Units/eamphib/eamphibarty_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibarty_up3.lua rename to Units/eamphib/eamphibarty_up3.lua diff --git a/Units/eamphib/eamphibbuggy.lua b/Units/eamphib/eamphibbuggy.lua index 6457906d2..b8d94a86d 100644 --- a/Units/eamphib/eamphibbuggy.lua +++ b/Units/eamphib/eamphibbuggy.lua @@ -12,7 +12,7 @@ humanName = [[Snake]] objectName = "eamphibbuggy2.s3o" script = "eamphibbuggy_lus.lua" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[1]] diff --git a/Units/eamphib/upgrade1/eamphibbuggy_up1.lua b/Units/eamphib/eamphibbuggy_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibbuggy_up1.lua rename to Units/eamphib/eamphibbuggy_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibbuggy_up2.lua b/Units/eamphib/eamphibbuggy_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibbuggy_up2.lua rename to Units/eamphib/eamphibbuggy_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibbuggy_up3.lua b/Units/eamphib/eamphibbuggy_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibbuggy_up3.lua rename to Units/eamphib/eamphibbuggy_up3.lua diff --git a/Units/eamphib/eamphibengineer.lua b/Units/eamphib/eamphibengineer.lua deleted file mode 100644 index 2b2e54443..000000000 --- a/Units/eamphib/eamphibengineer.lua +++ /dev/null @@ -1,128 +0,0 @@ --- UNITDEF -- EAMPHIBENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eamphibengineer" - --------------------------------------------------------------------------------- - -local buildCostMetal = 35 -local maxDamage = 600 - -local armortype = [[light]] ---local supply = [[2]] - - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - - canGuard = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT AMPHIB SUPPORT", - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 4, - footprintZ = 4, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = maxDamage, - maxSlope = 28, - maxVelocity = 4, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalmake = 0, - metalStorage = 0, - movementClass = "TANK4", - moveState = "2", - name = "The Developer", - objectName = "eamphibengineer2.s3o", - script = "eamphibengineer2.cob", - radarDistance = 0, - radarDistanceJam = 20, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = true, - side = "ARM", - sightDistance = 500, --- SonarDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 4, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 1020, - unitname = unitName, - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildList, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - area_mex_def = "emetalextractor", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype, - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibfac.lua b/Units/eamphib/eamphibfac.lua index 33ee5b086..99d0a99ee 100644 --- a/Units/eamphib/eamphibfac.lua +++ b/Units/eamphib/eamphibfac.lua @@ -5,7 +5,7 @@ unitName = "eamphibfac" -------------------------------------------------------------------------------- -buildCostMetal = 30 +buildCostMetal = 60 maxDamage = buildCostMetal * 12.5 humanName = [[Amphibious Tank Factory]] diff --git a/Units/eamphib/upgrade1/eamphibfac_up1.lua b/Units/eamphib/eamphibfac_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibfac_up1.lua rename to Units/eamphib/eamphibfac_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibfac_up2.lua b/Units/eamphib/eamphibfac_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibfac_up2.lua rename to Units/eamphib/eamphibfac_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibfac_up3.lua b/Units/eamphib/eamphibfac_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibfac_up3.lua rename to Units/eamphib/eamphibfac_up3.lua diff --git a/Units/eamphib/eamphibleveler.lua b/Units/eamphib/eamphibleveler.lua index 4d5eb2b72..b8659d237 100644 --- a/Units/eamphib/eamphibleveler.lua +++ b/Units/eamphib/eamphibleveler.lua @@ -12,8 +12,7 @@ humanName = [[Leveler]] objectName = "eamphibleveler.s3o" script = "eamphibleveler.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[30]] diff --git a/Units/eamphib/upgrade1/eamphibleveler_up1.lua b/Units/eamphib/eamphibleveler_up1.lua similarity index 91% rename from Units/eamphib/upgrade1/eamphibleveler_up1.lua rename to Units/eamphib/eamphibleveler_up1.lua index 9b3ffcf73..108f54712 100644 --- a/Units/eamphib/upgrade1/eamphibleveler_up1.lua +++ b/Units/eamphib/eamphibleveler_up1.lua @@ -12,8 +12,7 @@ humanName = [[Leveler Mark II]] objectName = "eamphibleveler.s3o" script = "eamphibleveler.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[30]] diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibleveler_up2.lua b/Units/eamphib/eamphibleveler_up2.lua similarity index 91% rename from Units/eamphib/upgrade1/upgrade2/eamphibleveler_up2.lua rename to Units/eamphib/eamphibleveler_up2.lua index 1eb00e878..4a37333c3 100644 --- a/Units/eamphib/upgrade1/upgrade2/eamphibleveler_up2.lua +++ b/Units/eamphib/eamphibleveler_up2.lua @@ -12,8 +12,7 @@ humanName = [[Leveler Mark III]] objectName = "eamphibleveler.s3o" script = "eamphibleveler.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[30]] diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibleveler_up3.lua b/Units/eamphib/eamphibleveler_up3.lua similarity index 91% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibleveler_up3.lua rename to Units/eamphib/eamphibleveler_up3.lua index 4c1eae0dc..ea71e1947 100644 --- a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibleveler_up3.lua +++ b/Units/eamphib/eamphibleveler_up3.lua @@ -12,8 +12,7 @@ humanName = [[Leveler Mark IV]] objectName = "eamphibleveler.s3o" script = "eamphibleveler.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[30]] diff --git a/Units/eamphib/upgrade1/eamphibmedtank_up1.lua b/Units/eamphib/eamphibmedtank_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibmedtank_up1.lua rename to Units/eamphib/eamphibmedtank_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibmedtank_up2.lua b/Units/eamphib/eamphibmedtank_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibmedtank_up2.lua rename to Units/eamphib/eamphibmedtank_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibmedtank_up3.lua b/Units/eamphib/eamphibmedtank_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibmedtank_up3.lua rename to Units/eamphib/eamphibmedtank_up3.lua diff --git a/Units/eamphib/upgrade1/eamphibneedle_up1.lua b/Units/eamphib/eamphibneedle_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibneedle_up1.lua rename to Units/eamphib/eamphibneedle_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibneedle_up2.lua b/Units/eamphib/eamphibneedle_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibneedle_up2.lua rename to Units/eamphib/eamphibneedle_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibneedle_up3.lua b/Units/eamphib/eamphibneedle_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibneedle_up3.lua rename to Units/eamphib/eamphibneedle_up3.lua diff --git a/Units/eamphib/eamphibriot.lua b/Units/eamphib/eamphibriot.lua index d0ec63b77..de23002fb 100644 --- a/Units/eamphib/eamphibriot.lua +++ b/Units/eamphib/eamphibriot.lua @@ -12,7 +12,7 @@ humanName = [[Dicer]] objectName = "eamphibriot2.s3o" script = "eamphibriot.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[3]] diff --git a/Units/eamphib/eamphibriot_shotgun.lua b/Units/eamphib/eamphibriot_shotgun.lua new file mode 100644 index 000000000..abce08ee1 --- /dev/null +++ b/Units/eamphib/eamphibriot_shotgun.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_shotgun-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_shotgun" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Dicer]] + +objectName = "eamphibriot2.s3o" +script = "eamphibriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot_shotgun_up1.lua b/Units/eamphib/eamphibriot_shotgun_up1.lua new file mode 100644 index 000000000..7f913ad04 --- /dev/null +++ b/Units/eamphib/eamphibriot_shotgun_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_shotgun_up1-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_shotgun_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Dicer Mark II]] + +objectName = "eamphibriot2.s3o" +script = "eamphibriot.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot_shotgun_up2.lua b/Units/eamphib/eamphibriot_shotgun_up2.lua new file mode 100644 index 000000000..576f1f315 --- /dev/null +++ b/Units/eamphib/eamphibriot_shotgun_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_shotgun_up2-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_shotgun_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Dicer Mark III]] + +objectName = "eamphibriot2.s3o" +script = "eamphibriot.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot_shotgun_up3.lua b/Units/eamphib/eamphibriot_shotgun_up3.lua new file mode 100644 index 000000000..b171c8feb --- /dev/null +++ b/Units/eamphib/eamphibriot_shotgun_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_shotgun_up3-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_shotgun_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Dicer Mark IV]] + +objectName = "eamphibriot2.s3o" +script = "eamphibriot.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibriot_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/upgrade1/eamphibriot_up1.lua b/Units/eamphib/eamphibriot_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibriot_up1.lua rename to Units/eamphib/eamphibriot_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibriot_up2.lua b/Units/eamphib/eamphibriot_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibriot_up2.lua rename to Units/eamphib/eamphibriot_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibriot_up3.lua b/Units/eamphib/eamphibriot_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibriot_up3.lua rename to Units/eamphib/eamphibriot_up3.lua diff --git a/Units/eamphib/upgrade1/eamphibrock_up1.lua b/Units/eamphib/eamphibrock_up1.lua similarity index 100% rename from Units/eamphib/upgrade1/eamphibrock_up1.lua rename to Units/eamphib/eamphibrock_up1.lua diff --git a/Units/eamphib/upgrade1/upgrade2/eamphibrock_up2.lua b/Units/eamphib/eamphibrock_up2.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/eamphibrock_up2.lua rename to Units/eamphib/eamphibrock_up2.lua diff --git a/Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibrock_up3.lua b/Units/eamphib/eamphibrock_up3.lua similarity index 100% rename from Units/eamphib/upgrade1/upgrade2/upgrade3/eamphibrock_up3.lua rename to Units/eamphib/eamphibrock_up3.lua diff --git a/Units/eamphib/esubmarine.lua b/Units/eamphib/esubmarine.lua deleted file mode 100644 index 0f43f9d88..000000000 --- a/Units/eamphib/esubmarine.lua +++ /dev/null @@ -1,145 +0,0 @@ --- UNITDEF -- ESUBMARINE -- --------------------------------------------------------------------------------- - -local unitName = "esubmarine" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 90, - builder = false, - buildTime = 2.5, - canAttack = true, - - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT SUB", - description = "Anti-Amphibious Submarine", - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "MEDIUM_UNIT", - footprintX = 4, - footprintZ = 4, - iconType = "sub", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 300, - maxSlope = 60, - maxVelocity = 4.0, - maxReverseVelocity = 1, - minWaterDepth = 10, - metalStorage = 0, - movementClass = "UBOAT4", - name = "Lurker", - noChaseCategory = "VTOL", - objectName = "esubplane.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "MEDIUM_UNIT", - side = "CORE", - sightDistance = 500, - SonarDistance = 700, - smoothAnim = true, - turnInPlace = false, - turnRate = 430, - unitname = "esubmarine", - workerTime = 0, - waterline = 30, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:dirt", - "custom:warp", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "TORP", - onlyTargetCategory = "BIO AMPHIB SUB", - BadTargetCategory = "VTOL", - noChaseCategory = "VTOL", - }, - }, - - customParams = { - canbetransported = "true", - death_sounds = "generic", - armortype = "light", - normaltex = "unittextures/esubplanenormal.png", - corpse = "energycore", - }, - -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - TORP = { - AreaOfEffect = 10, - avoidFriendly = false, - avoidFeature = false, - - cegTag = "torpedotrail", - collideFriendly = false, - cylinderTargeting = true, - explosionGenerator = "custom:torpedoexplosion", - id = 5, - - model = "missile.s3o", - name = "Bombs", - noSelfDamage = true, - range = 300, - reloadtime = 8, - soundHit = "weapons/subhit.wav", - soundStart = "weapons/torpedolaunch.wav", - startVelocity = 100, - turret = true, - tracks = true, - tolerance = 1000, - turnrate = 900, - weaponVelocity = 400, - WeaponType = "TorpedoLauncher", - WeaponAcceleration = 100, - flighttime = 10, - waterweapon = true, - damage = { - default = 100, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebox.lua b/Units/ebox.lua index ce8897f9b..03c3d4822 100644 --- a/Units/ebox.lua +++ b/Units/ebox.lua @@ -19,7 +19,7 @@ local unitDef = { acceleration = 1, brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 35, + buildCostMetal = 15, buildDistance = 400, builder = false, buildTime = 5, @@ -36,8 +36,8 @@ local unitDef = { energyStorage = 0, energyUse = 0, explodeAs = "largeExplosionGenericWhite", - footprintX = 6, - footprintZ = 6, + footprintX = 2, + footprintZ = 2, iconType = "box", idleAutoHeal = .5, idleTime = 2200, @@ -48,16 +48,16 @@ local unitDef = { maxReverseVelocity = 4, maxWaterDepth = 10, metalStorage = 0, - movementClass = "HOVERTANK6", + movementClass = "HOVERTANK2", name = "B.O.X.", noChaseCategory = "VTOL", - objectName = "ebox.s3o", + objectName = "ebox_small.s3o", script = "ebox_lus.lua", radarDistance = 1250, repairable = false, selfDestructAs = "largeExplosionGenericWhite", side = "CORE", - sightDistance = 500, + sightDistance = 750, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -74,7 +74,7 @@ local unitDef = { "deathceg4", }, explosiongenerators = { - "custom:dirt", + "custom:emptydirt", }, }, @@ -98,8 +98,9 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", helptext = [[]], + retreatRangeDAI = 1250, }, } diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/eheavyturret2_up3.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/eheavyturret2_up3.lua deleted file mode 100644 index eadea1868..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/eheavyturret2_up3.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EHEAVYTURRET2_up3 -- --------------------------------------------------------------------------------- - -unitName = [[eheavyturret2_up3]] - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[Immolator Mark IV]] - -objectName = [[eheavyturret3.s3o]] -script = [[eheavyturret2.cob]] - -tech = [[tech2]] -armortype = [[building]] -supply = [[5]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/elightturret2_up3.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/elightturret2_up3.lua deleted file mode 100644 index 516ca7e36..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/elightturret2_up3.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- ELIGHTTURRET2_up3 -- --------------------------------------------------------------------------------- - -unitName = [[elightturret2_up3]] - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[Lightning Rod Mark IV]] - -objectName = [[elightturret3.s3o]] -script = [[elightturret2.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[3]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/emetalextractor_up3.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/emetalextractor_up3.lua deleted file mode 100644 index 36884f721..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/emetalextractor_up3.lua +++ /dev/null @@ -1,32 +0,0 @@ --- UNITDEF -- EMETALEXTRACTOR_up3 -- --------------------------------------------------------------------------------- - -unitName = [[emetalextractor_up3]] - --------------------------------------------------------------------------------- - -metalMultiplier = tonumber(Spring.GetModOptions().mexincomemultiplier) or 50 -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions -metalMultiplier = metalMultiplier * 4 -metalMultiplier = metalMultiplier * 0.01 - -buildCostMetal = 300 -energyUse = 0 - -primaryCEG = "custom:fusionreactionnucleargreen" - -humanName = [[Metal Extractor Mk IV]] - -objectName = [[emetalextractor2.s3o]] -script = [[emetalextractor.cob]] - -tech = [[tech3]] -armortype = [[building]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/euwturret_up3.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/euwturret_up3.lua deleted file mode 100644 index 568858f46..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/euwturret_up3.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EUWTURRET_up3 -- --------------------------------------------------------------------------------- - -unitName = [[euwturret_up3]] - --------------------------------------------------------------------------------- - -isUpgraded = [[3]] - -humanName = [[Rooter Mark IV]] - -objectName = [[euwturret.s3o]] -script = [[euwturret.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/euwturret_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/eheavyturret2_up2.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/eheavyturret2_up2.lua deleted file mode 100644 index fc38602fb..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/eheavyturret2_up2.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EHEAVYTURRET2_up2 -- --------------------------------------------------------------------------------- - -unitName = [[eheavyturret2_up2]] - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[Immolator Mark III]] - -objectName = [[eheavyturret3.s3o]] -script = [[eheavyturret2.cob]] - -tech = [[tech2]] -armortype = [[building]] -supply = [[5]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/elightturret2_up2.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/elightturret2_up2.lua deleted file mode 100644 index e7a3a0a42..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/elightturret2_up2.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- ELIGHTTURRET2_up2 -- --------------------------------------------------------------------------------- - -unitName = [[elightturret2_up2]] - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[Lightning Rod Mark III]] - -objectName = [[elightturret3.s3o]] -script = [[elightturret2.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[3]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/emetalextractor_up2.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/emetalextractor_up2.lua deleted file mode 100644 index d90a8423c..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/emetalextractor_up2.lua +++ /dev/null @@ -1,32 +0,0 @@ --- UNITDEF -- EMETALEXTRACTOR_up2 -- --------------------------------------------------------------------------------- - -unitName = [[emetalextractor_up2]] - --------------------------------------------------------------------------------- - -metalMultiplier = tonumber(Spring.GetModOptions().mexincomemultiplier) or 50 -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions -metalMultiplier = metalMultiplier * 3 -metalMultiplier = metalMultiplier * 0.01 - -buildCostMetal = 200 -energyUse = 0 - -primaryCEG = "custom:fusionreactionnuclearpurple" - -humanName = [[Metal Extractor Mk III]] - -objectName = [[emetalextractor2.s3o]] -script = [[emetalextractor.cob]] - -tech = [[tech2]] -armortype = [[building]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/euwturret_up2.lua b/Units/ebuilding/Upgrade 1/Upgrade 2/euwturret_up2.lua deleted file mode 100644 index b77ac6dae..000000000 --- a/Units/ebuilding/Upgrade 1/Upgrade 2/euwturret_up2.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EUWTURRET_up2 -- --------------------------------------------------------------------------------- - -unitName = [[euwturret_up2]] - --------------------------------------------------------------------------------- - -isUpgraded = [[2]] - -humanName = [[Rooter Mark III]] - -objectName = [[euwturret.s3o]] -script = [[euwturret.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/euwturret_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/eheavyturret2_up1.lua b/Units/ebuilding/Upgrade 1/eheavyturret2_up1.lua deleted file mode 100644 index f4e5f2f4d..000000000 --- a/Units/ebuilding/Upgrade 1/eheavyturret2_up1.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EHEAVYTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[eheavyturret2_up1]] - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[Immolator Mark II]] - -objectName = [[eheavyturret3.s3o]] -script = [[eheavyturret2.cob]] - -tech = [[tech2]] -armortype = [[building]] -supply = [[5]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/elightturret2_up1.lua b/Units/ebuilding/Upgrade 1/elightturret2_up1.lua deleted file mode 100644 index f233f7ae2..000000000 --- a/Units/ebuilding/Upgrade 1/elightturret2_up1.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- ELIGHTTURRET2_up1 -- --------------------------------------------------------------------------------- - -unitName = [[elightturret2_up1]] - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[Lightning Rod Mark II]] - -objectName = [[elightturret3.s3o]] -script = [[elightturret2.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[3]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/emetalextractor_up1.lua b/Units/ebuilding/Upgrade 1/emetalextractor_up1.lua deleted file mode 100644 index 8cf94136f..000000000 --- a/Units/ebuilding/Upgrade 1/emetalextractor_up1.lua +++ /dev/null @@ -1,32 +0,0 @@ --- UNITDEF -- EMETALEXTRACTOR_up1 -- --------------------------------------------------------------------------------- - -unitName = [[emetalextractor_up1]] - --------------------------------------------------------------------------------- - -metalMultiplier = tonumber(Spring.GetModOptions().mexincomemultiplier) or 50 -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions -metalMultiplier = metalMultiplier * 2 -metalMultiplier = metalMultiplier * 0.01 - -buildCostMetal = 100 -energyUse = 0 - -primaryCEG = "custom:fusionreactionnuclearblue" - -humanName = [[Metal Extractor Mk II]] - -objectName = [[emetalextractor2.s3o]] -script = [[emetalextractor.cob]] - -tech = [[tech1]] -armortype = [[building]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/Upgrade 1/euwturret_up1.lua b/Units/ebuilding/Upgrade 1/euwturret_up1.lua deleted file mode 100644 index 19435eaa7..000000000 --- a/Units/ebuilding/Upgrade 1/euwturret_up1.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EUWTURRET_up1 -- --------------------------------------------------------------------------------- - -unitName = [[euwturret_up1]] - --------------------------------------------------------------------------------- - -isUpgraded = [[1]] - -humanName = [[Rooter Mark II]] - -objectName = [[euwturret.s3o]] -script = [[euwturret.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/euwturret_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eartyturret.lua b/Units/ebuilding/eartyturret.lua index 5e96d1c71..e79acafa2 100644 --- a/Units/ebuilding/eartyturret.lua +++ b/Units/ebuilding/eartyturret.lua @@ -12,7 +12,7 @@ script = [[eartyturret.cob]] tech = [[tech3]] armortype = [[building]] -AreaOfEffect = 0 +AreaOfEffect = 500 VFS.Include("units-configs-basedefs/basedefs/buildings/eartyturret_basedef.lua") diff --git a/Units/ebuilding/Upgrade 1/eartyturret_up1.lua b/Units/ebuilding/eartyturret_up1.lua similarity index 100% rename from Units/ebuilding/Upgrade 1/eartyturret_up1.lua rename to Units/ebuilding/eartyturret_up1.lua diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/eartyturret_up2.lua b/Units/ebuilding/eartyturret_up2.lua similarity index 100% rename from Units/ebuilding/Upgrade 1/Upgrade 2/eartyturret_up2.lua rename to Units/ebuilding/eartyturret_up2.lua diff --git a/Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/eartyturret_up3.lua b/Units/ebuilding/eartyturret_up3.lua similarity index 100% rename from Units/ebuilding/Upgrade 1/Upgrade 2/Upgrade 3/eartyturret_up3.lua rename to Units/ebuilding/eartyturret_up3.lua diff --git a/Units/ebuilding/ebarricade.lua b/Units/ebuilding/ebarricade.lua deleted file mode 100644 index c4e2375b7..000000000 --- a/Units/ebuilding/ebarricade.lua +++ /dev/null @@ -1,90 +0,0 @@ --- UNITDEF -- EBARRICADE -- --------------------------------------------------------------------------------- - -local unitName = "ebarricade" - --------------------------------------------------------------------------------- - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 4096, - buildCostEnergy = 0, - buildCostMetal = 5, - builder = false, - buildTime = 1, - canAttack = false, - canstop = "1", - category = "BUILDING NOTAIR WALL", - collisionVolumeOffsets = "0 0 0", - collisionVolumeScales = "48 72 48", - collisionVolumeTest = 1, - collisionVolumeType = "box", - damageModifier = 0.2, - description = "Organic Barricade - Regenerates Health :: Armortype: Armored Building", - energyStorage = 0, - energyUse = 0, - explodeAs = "ESTOR_BUILDING", - footprintX = 3, - footprintZ = 3, - autoHeal = 20, - iconType = "barricade", - idleTime = 0, - maxDamage = 1000, - maxSlope = 60, - maxWaterDepth = 0, - mass = 1000, - metalStorage = 0, - name = "Thorn", - objectName = "ebarricade.s3o", - repairable = false, - selfDestructAs = "ESTOR_BUILDING", - selfDestructCountdown = 0, - side = "ARM", - sightDistance = 0, - smoothAnim = true, - TEDClass = "FORT", - unitname = "ebarricade", - workerTime = 0, - yardMap = "ooo ooo ooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/turretselect", - }, - }, - customParams = { - unittype = "building", - needed_cover = 1, - death_sounds = "generic", - armortype = "building", - normaltex = "unittextures/ebarricadenormal.png", - helptext = [[Organic Barricade - - Regenerates Hitpoints as it takes damage. Provides cover for your units or structures. - - +20 Hitpoints regenerated per second]], - }, - buildingGroundDecalDecaySpeed=30, - buildingGroundDecalSizeX =5, - buildingGroundDecalSizeY =5, - useBuildingGroundDecal = true, - buildingGroundDecalType =[[ebarricade_aoplane.dds]], -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/ecruisesilo.lua b/Units/ebuilding/ecruisesilo.lua deleted file mode 100644 index 7d1146dbf..000000000 --- a/Units/ebuilding/ecruisesilo.lua +++ /dev/null @@ -1,167 +0,0 @@ --- UNITDEF -- ECRUISESILO -- --------------------------------------------------------------------------------- - -local unitName = "ecruisesilo" - --------------------------------------------------------------------------------- - -local armortype = [[building]] - -local weapon1Damage = 1250 -local weapon1AOE = 250 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local stockpiletime = 35 - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - activateWhenBuilt = true, - buildCostEnergy = 0, - buildCostMetal = 500, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - - description = [[Long Range Tactical Cruise Missile -Armortype: ]] ..armortype.. [[ - -]] .. weapon1Damage .. [[ Damage vs Light/Armored/Buildings in a small area - -Energy cost while stockpiling missiles: ]] .. roundToFirstDecimal(energycosttofire / stockpiletime) .. [[/s]], - energyStorage = 0, - energyUse = 0, - explodeAs = "cruisemissile", - floater = true, - firestate = [[0]], - footprintX = 10, - footprintZ = 10, - iconType = "elrpc", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 1500, - maxSlope = 30, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Executioner", - noChaseCategory = "VTOL", - objectName = "ecruisesilo.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "cruisemissile", - side = "ARM", - sightDistance = 900, - smoothAnim = true, - unitname = "ecruisesilo", - workerTime = 0, - yardMap = "oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo oooooooooo ", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - "custom:steam", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/turretselect", - }, - }, - weapons = { - [1] = { - def = "cruisemissile", - }, - }, - customParams = { - unittype = "turret", - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - helptext = [[]], - corpse = "energycore", - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 12, - BuildingGroundDecalSizeY = 12, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - cruisemissile = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - cegTag = "cruisemissiletrail", - collideFriendly = false, - collideFeature = false, - commandfire = true, - craterBoost = 0, - craterMult = 0, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:ebombexpl", - fireStarter = 100, - flightTime = 400, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - metalpershot = 0, - model = "ecruisemissile.s3o", - name = "Cruise Missile", - range = 6000, - reloadtime = 5, - weaponType = "MissileLauncher", - - - smokeTrail = false, - soundHit = "explosions/explode4.wav", - soundStart = "weapons/cruisemissilelaunch.wav", - - stockpile = true, - stockpileTime = stockpiletime, - startVelocity = 10, - turnRate = 6000, - tracks = true, - - weaponAcceleration = 60, - weaponTimer = 5, - weaponType = "StarburstLauncher", - weaponVelocity = 1000, - customparams = { - damagetype = "default", - death_sounds = "nuke", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/eflakturret.lua b/Units/ebuilding/eflakturret.lua new file mode 100644 index 000000000..d7beba03b --- /dev/null +++ b/Units/ebuilding/eflakturret.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EFLAKTURRET -- +-------------------------------------------------------------------------------- + +unitName = [[eflakturret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Fortifier]] + +objectName = [[eflakturret.s3o]] +script = [[eflakturret.cob]] + +tech = [[tech2]] +armortype = [[building]] +--supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/buildings/eflakturret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/efusion2.lua b/Units/ebuilding/efusion2.lua index 181e23258..9652d7e8d 100644 --- a/Units/ebuilding/efusion2.lua +++ b/Units/ebuilding/efusion2.lua @@ -6,10 +6,10 @@ local unitName = "efusion2" -------------------------------------------------------------------------------- local armortype = [[building]] -local techrequired = [[tech2]] -local energyproduced = [[20]] +local techrequired = [[tech3]] +local energyproduced = [[50]] -local buildCostMetal = 175 +local buildCostMetal = 400 local maxDamage = buildCostMetal * 12.5 local unitDef = { @@ -25,8 +25,8 @@ local unitDef = { energyStorage = 0, energyMake = energyproduced, explodeAs = "hugeBuildingExplosionGenericBlueEMP", - footprintX = 8, - footprintZ = 8, + footprintX = 12, + footprintZ = 12, iconType = "generator", idleAutoHeal = .5, idleTime = 2200, @@ -34,8 +34,8 @@ local unitDef = { maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Advanced Energy Generator", - objectName = "efusion2.s3o", + name = "Cold Fusion Energy Generator", + objectName = "efusion2-huge.s3o", onoffable = false, radarDistance = 0, repairable = false, @@ -44,7 +44,7 @@ local unitDef = { sightDistance = 367, smoothAnim = true, unitname = "efusion2", - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", + yardMap = "oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo", sfxtypes = { pieceExplosionGenerators = { @@ -54,7 +54,7 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionnuclear", + "custom:fusionreactionnuclear-huge-4color", "custom:skyhatelaser", }, }, @@ -73,10 +73,11 @@ local unitDef = { death_sounds = "generic", RequireTech = techrequired, armortype = armortype, + noenergycost = true, -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -91,8 +92,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, + BuildingGroundDecalSizeX = 14, + BuildingGroundDecalSizeY = 14, BuildingGroundDecalDecaySpeed = 0.9, } diff --git a/Units/ebuilding/egeothermal.lua b/Units/ebuilding/egeothermal.lua index b258e1a38..883985992 100644 --- a/Units/ebuilding/egeothermal.lua +++ b/Units/ebuilding/egeothermal.lua @@ -6,9 +6,10 @@ local unitName = "egeothermal" -------------------------------------------------------------------------------- local armortype = [[building]] -local energyproduced = [[20]] +local techrequired = [[tech2]] +local energyproduced = [[30]] -local buildCostMetal = 100 +local buildCostMetal = 280 local maxDamage = buildCostMetal * 12.5 local unitDef = { @@ -34,8 +35,9 @@ local unitDef = { maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Geothermal Energy Generator", + name = "Fusion Energy Generator", objectName = "egeothermal2.s3o", + script = "egeothermal.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -45,7 +47,7 @@ local unitDef = { smoothAnim = true, unitname = "egeothermal", workerTime = 0, - yardMap = "oooo oGGo oGGo oooo", + yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", sfxtypes = { pieceExplosionGenerators = { @@ -54,7 +56,7 @@ local unitDef = { }, explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactiongeo", + "custom:fusionreactionnuclear-2color", "custom:skyhatelaser", }, }, @@ -72,13 +74,15 @@ local unitDef = { iseco = 1, needed_cover = 2, death_sounds = "generic", + RequireTech = techrequired, -- ProvideTech = techprovided, -- ProvideTechRange = powerradius, armortype = armortype, + noenergycost = true, -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -93,8 +97,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 6, - BuildingGroundDecalSizeY = 6, + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, BuildingGroundDecalDecaySpeed = 0.9, } diff --git a/Units/ebuilding/eheavyturret2.lua b/Units/ebuilding/eheavyturret2.lua index 0151d4fb6..f3f9a6cda 100644 --- a/Units/ebuilding/eheavyturret2.lua +++ b/Units/ebuilding/eheavyturret2.lua @@ -14,7 +14,7 @@ script = [[eheavyturret2.cob]] tech = [[tech2]] armortype = [[building]] -supply = [[5]] +--supply = [[5]] VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") diff --git a/Units/ebuilding/ejammer2.lua b/Units/ebuilding/ejammer2.lua index d9469408f..525b8433d 100644 --- a/Units/ebuilding/ejammer2.lua +++ b/Units/ebuilding/ejammer2.lua @@ -20,13 +20,13 @@ local unitDef = { builder = false, buildTime = 5, category = "BUILDING NOTAIR", - description = [[Radar Jamming Tower • Generates a Cloaking Field]], + description = [[Radar Jamming Tower • Generates a Cloaking Field]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "smallBuildingExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "radarjam", idleAutoHeal = .5, idleTime = 2200, @@ -75,6 +75,7 @@ local unitDef = { normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", corpse = "energycore", + factionname = "ateran", area_cloak = 1, -- Can this unit emit a cloaking field? area_cloak_upkeep = 5, -- How much energy does it cost to maintain the cloaking field? diff --git a/Units/ebuilding/ekmar.lua b/Units/ebuilding/ekmar.lua index f9841aa99..5b756a7ad 100644 --- a/Units/ebuilding/ekmar.lua +++ b/Units/ebuilding/ekmar.lua @@ -9,10 +9,9 @@ local armortype = [[building]] local techrequired = [[tech2]] -local shield1Power = 2000 -local shield1PowerRegen = 30 -local shield1PowerRegenEnergy = shield1PowerRegen / 10 - +local shield1Power = 2500 +local shield1PowerRegen = 25 +local shield1PowerRegenEnergy = 25 local buildCostMetal = 50 local maxDamage = buildCostMetal * 12.5 @@ -31,8 +30,8 @@ local unitDef = { energyStorage = 0, energyUse = 0, explodeAs = "mediumBuildingExplosionGenericBlue", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, floater = true, iconType = "baseshield", idleAutoHeal = .5, @@ -87,10 +86,10 @@ local unitDef = { death_sounds = "generic", armortype = armortype, shield_power = shield1Power, - shield_radius = 400, + shield_radius = 1000, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -111,7 +110,7 @@ local weaponDefs = { Visibleshieldrepulse = false, ShieldStartingPower = 0, Shieldenergyuse = 0, - Shieldradius = 400, + Shieldradius = 750, Shieldpower = shield1Power, Shieldpowerregen = shield1PowerRegen, Shieldpowerregenenergy = shield1PowerRegenEnergy, diff --git a/Units/ebuilding/elaserbattery.lua b/Units/ebuilding/elaserbattery.lua new file mode 100644 index 000000000..5fe5b00f2 --- /dev/null +++ b/Units/ebuilding/elaserbattery.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ELASERBATTERY -- +-------------------------------------------------------------------------------- + +unitName = [[elaserbattery]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Aegis]] + +objectName = [[elaserbattery.s3o]] +script = [[elaserbattery.cob]] + +tech = [[tech1]] +armortype = [[building]] +--supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/buildings/elaserbattery_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/elightturret2.lua b/Units/ebuilding/elightturret2.lua index fcecad0ec..8482c0007 100644 --- a/Units/ebuilding/elightturret2.lua +++ b/Units/ebuilding/elightturret2.lua @@ -7,14 +7,14 @@ unitName = [[elightturret2]] isUpgraded = [[0]] -humanName = [[Lightning Rod]] +humanName = [[Pincushion]] objectName = [[elightturret3.s3o]] script = [[elightturret2.cob]] -tech = [[tech1]] +tech = [[tech0]] armortype = [[building]] -supply = [[3]] +--supply = [[3]] VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") diff --git a/Units/ebuilding/elrpc.lua b/Units/ebuilding/elrpc.lua deleted file mode 100644 index 1e9d3b129..000000000 --- a/Units/ebuilding/elrpc.lua +++ /dev/null @@ -1,151 +0,0 @@ --- UNITDEF -- ELRPC -- --------------------------------------------------------------------------------- - -local unitName = "elrpc" - --------------------------------------------------------------------------------- - -local unitDef = { - - activateWhenBuilt = true, - buildCostEnergy = 0, - buildCostMetal = 750, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - - collisionVolumeOffsets = "0 0 0", - collisionVolumeScales = "120 310 120", - collisionVolumeTest = 1, - collisionVolumeType = "box", - - description = [[Long Range Plasma Cannon - 100e Per Shot - Building - 2000 Damage vs Buildings - 500 Damage vs Light/Armored]], - energyStorage = 0, - energyUse = 0, - explodeAs = "LARGE_BUILDING", - footprintX = 8, - footprintZ = 8, - iconType = "elrpc", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 4800, - maxSlope = 30, - maxWaterDepth = 0, - metalStorage = 0, - name = "Executioner", - noChaseCategory = "VTOL", - objectName = "elrpc.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - side = "ARM", - sightDistance = 900, - smoothAnim = true, - unitname = "elrpc", - workerTime = 0, - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:electricity", - "custom:factorysparks", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/turretselect", - }, - }, - weapons = { - [1] = { - def = "lrpcweapon", - onlyTargetCategory = "NOTAIR AMPHIB", - badTargetCategory = "LIGHT ARMORED WALL", - }, - }, - customParams = { - unittype = "turret", - canareaattack ="1", - death_sounds = "generic", - RequireTech = "0 Power", - armortype = "building", - normaltex = "unittextures/elrpcnormal.png", - helptext = [[]], - corpse = "energycore", - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- -local weapon1Damage = 2000 - -local weaponDefs = { - lrpcweapon = { - accuracy = 500, - AreaOfEffect = 500, - avoidFriendly = false, - cegTag = "BURNGREEN", - collideFriendly = false, - explosionGenerator = "custom:genericshellexplosion-large-green", - fireStarter = 70, - - id = 136, - impulsefactor = 0, - interceptedByShieldType = 4, - - energypershot = weapon1Damage / 20, - edgeEffectiveness = 0.1, - model = "rocket.s3o", - name = "Rockets", - range = 6000, - reloadtime = 35, - weaponType = "Cannon", - - - smokeTrail = false, - soundHit = "explosions/lrpchit.wav", - soundStart = "weapons/lrpcshot2.wav", - - tolerance = 8000, - turnRate = 4680, - turret = true, - weaponTimer = 5, - weaponVelocity = 800, - customparams = { - damagetype = "elrpc", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/emaker.lua b/Units/ebuilding/emaker.lua deleted file mode 100644 index 649edd090..000000000 --- a/Units/ebuilding/emaker.lua +++ /dev/null @@ -1,99 +0,0 @@ --- UNITDEF -- EMAKER -- --------------------------------------------------------------------------------- - -local unitName = "emaker" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local metal = [[0.5]] -local supply = [[0]] - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 8192, - buildCostEnergy = 0, - buildCostMetal = 150, - builder = false, - buildTime = 5, - canAttack = false, - category = "BUILDING NOTAIR", - damageModifier = 0.5, - description = [[Armortype: ]] ..armortype.. [[ - -Generates +]] .. metal .. [[ metal per second - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "largeBuildingExplosionGenericPurple", - footprintX = 8, - footprintZ = 8, - iconType = "eco", - idleAutoHeal = .5, - idleTime = 2200, - makesMetal = metal, - maxDamage = 1700, - maxSlope = 30, - maxWaterDepth = 5000, - metalStorage = 0, - name = "Metal Fabricator", - objectName = "emaker3.s3o", - script = "emaker3.cob", - onoffable = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "largeBuildingExplosionGenericPurple", - side = "ARM", - sightDistance = 360, - smoothAnim = true, - unitname = "emaker", - workerTime = 0, - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionmakernew", - "custom:skyhatelaser", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdmex", - }, - }, - weapons = { - }, - customParams = { - unittype = "building", - iseco = 1, - needed_cover = 8, --- supply_cost = supply, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - corpse = "energycore", - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 12, - BuildingGroundDecalSizeY = 12, - BuildingGroundDecalDecaySpeed = 0.9, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/emediumgen.lua b/Units/ebuilding/emediumgen.lua index 06e90fda2..2ce9ab364 100644 --- a/Units/ebuilding/emediumgen.lua +++ b/Units/ebuilding/emediumgen.lua @@ -29,8 +29,8 @@ Provides +]] .. powerprovided, energyStorage = 0, energyMake = energyproduced, explodeAs = "largeBuildingExplosionGenericBlueEMP", - footprintX = 6, - footprintZ = 6, + footprintX = 3, + footprintZ = 3, icontype = "generator", idleAutoHeal = .5, idleTime = 2200, @@ -84,7 +84,7 @@ Provides +]] .. powerprovided, -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", diff --git a/Units/ebuilding/emetalextractor.lua b/Units/ebuilding/emetalextractor.lua index 384cb9783..9d8e6221d 100644 --- a/Units/ebuilding/emetalextractor.lua +++ b/Units/ebuilding/emetalextractor.lua @@ -5,17 +5,18 @@ unitName = [[emetalextractor]] -------------------------------------------------------------------------------- -metalMultiplier = tonumber(Spring.GetModOptions().mexincomemultiplier) or 50 -- Make sure to change this default number in the luamex config options, mex unitdef, and in modoptions -metalMultiplier = metalMultiplier * 0.01 +ateranMexCost = Spring.GetModOptions().metalextractorcostateran or 50 -buildCostMetal = 20 +metalMultiplier = 1 + +buildCostMetal = ateranMexCost energyUse = 0 -primaryCEG = "custom:fusionreactionnuclearorange" +primaryCEG = "custom:fusionreactionnuclear-1color" humanName = [[Metal Extractor]] -objectName = [[emetalextractor2.s3o]] +objectName = [[emetalextractor2_small.s3o]] script = [[emetalextractor.cob]] tech = [[tech0]] diff --git a/Units/ebuilding/emetalextractor_up1.lua b/Units/ebuilding/emetalextractor_up1.lua new file mode 100644 index 000000000..0bf8c1b86 --- /dev/null +++ b/Units/ebuilding/emetalextractor_up1.lua @@ -0,0 +1,30 @@ +-- UNITDEF -- EMETALEXTRACTOR_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[emetalextractor_up1]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 2 + +buildCostMetal = 150 +energyUse = 2 + +primaryCEG = "custom:fusionreactionnuclear-2color" + +humanName = [[Metal Extractor Mk II]] + +objectName = [[emetalextractor2_up1.s3o]] +script = [[emetalextractor.cob]] + +tech = [[tech1]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/emetalextractor_up2.lua b/Units/ebuilding/emetalextractor_up2.lua new file mode 100644 index 000000000..80fb77189 --- /dev/null +++ b/Units/ebuilding/emetalextractor_up2.lua @@ -0,0 +1,30 @@ +-- UNITDEF -- EMETALEXTRACTOR_up2 -- +-------------------------------------------------------------------------------- + +unitName = [[emetalextractor_up2]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 4 + +buildCostMetal = 300 +energyUse = 25 + +primaryCEG = "custom:fusionreactionnuclear-3color" + +humanName = [[Metal Extractor Mk III]] + +objectName = [[emetalextractor2_up2.s3o]] +script = [[emetalextractor.cob]] + +tech = [[tech2]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/emetalextractor_up3.lua b/Units/ebuilding/emetalextractor_up3.lua new file mode 100644 index 000000000..1e5ae3181 --- /dev/null +++ b/Units/ebuilding/emetalextractor_up3.lua @@ -0,0 +1,30 @@ +-- UNITDEF -- EMETALEXTRACTOR_up3 -- +-------------------------------------------------------------------------------- + +unitName = [[emetalextractor_up3]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 8 + +buildCostMetal = 600 +energyUse = 50 + +primaryCEG = "custom:fusionreactionnuclear-4color" + +humanName = [[Metal Extractor Mk IV]] + +objectName = [[emetalextractor2_up3.s3o]] +script = [[emetalextractor.cob]] + +tech = [[tech3]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/buildings/emetalextractor_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/emine.lua b/Units/ebuilding/emine.lua index 3075c09c8..120e22ed7 100644 --- a/Units/ebuilding/emine.lua +++ b/Units/ebuilding/emine.lua @@ -8,9 +8,8 @@ local unitName = "emine" local armortype = [[building]] --local supply = [[1]] -local weapon1Damage = 305 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +local weapon1Damage = 1000 +local weapon1AOE = 25 local function roundToFirstDecimal(energycosttofire) return math.floor(energycosttofire*10 + 0.5)*0.1 @@ -21,10 +20,10 @@ local unitDef = { blocking = false, buildAngle = 1024, buildCostEnergy = 0, - buildCostMetal = 10, + buildCostMetal = 5, builder = false, buildTime = 5, - category = "BUILDING NOTAIR", + category = "LIGHT NOTAIR", -- Cloaking @@ -32,7 +31,7 @@ local unitDef = { cloakCost = 0, cloakCostMoving = 0, minCloakDistance = 0, - decloakOnFire = false, + decloakOnFire = true, decloakSpherical = true, initCloaked = true, @@ -66,7 +65,7 @@ local unitDef = { smoothAnim = true, sonarDistance = 0, seismicDistance = 0, - stealth = true, + stealth = false, unitname = "emine", workerTime = 0, yardMap = "oo oo", @@ -107,13 +106,7 @@ local unitDef = { --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[ -Armortype: ]] ..armortype.. [[ - -Fires a projectile dealing ]] .. weapon1Damage .. [[ damage - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), + factionname = "ateran", }, useGroundDecal = false, BuildingGroundDecalType = "factorygroundplate.dds", @@ -134,7 +127,7 @@ local weaponDefs = { collideFeature = false, canAttackGround = false, cegTag = "missiletrail", - flightTime = 5, + flightTime = 2.5, tolerance = 1000, turret = true, @@ -142,7 +135,7 @@ local weaponDefs = { model = "missilesmallvlaunch.s3o", edgeeffectiveness = 1, - energypershot = energycosttofire, + energypershot = 0, range =400, reloadtime =8, weaponvelocity =2500, @@ -158,10 +151,11 @@ local weaponDefs = { weaponVelocity = 2500, soundHit ="explosions/minedetonation.wav", soundStart = "weapons/minewhir.wav", - explosiongenerator ="custom:genericshellexplosion-large-white", + explosiongenerator ="custom:genericshellexplosion-small-white", customparams = { - damagetype = "emine", + damagetype = "light", nofriendlyfire = "true", + effectedByunitHealthModifier = true, }, damage = { diff --git a/Units/ebuilding/eradar2.lua b/Units/ebuilding/eradar2.lua index 91592623a..1ee47c0ba 100644 --- a/Units/ebuilding/eradar2.lua +++ b/Units/ebuilding/eradar2.lua @@ -1,96 +1,28 @@ --- UNITDEF -- ERADAR2 -- +-- UNITDEF -- eradar2 -- -------------------------------------------------------------------------------- -local unitName = "eradar2" +unitName = [[eradar2]] --------------------------------------------------------------------------------- - -local armortype = [[building]] +buildCostMetal = 5 -local techrequired = [[tech1]] +humanName = [[Radar Tower]] +objectName = [[eradar3_small.s3o]] -local buildCostMetal = 30 -local maxDamage = buildCostMetal * 12.5 +radarDistance = 1000 +radarEmitHeight = 64 -local unitDef = { - activateWhenBuilt = true, - buildAngle = 16384, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR", - description = [[Radar Dome/Sensor Tower]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeBuildingExplosionGenericWhite", - footprintX = 6, - footprintZ = 6, - floater = true, - iconType = "radar", - idleAutoHeal = .5, - idleTime = 2200, - isTargetingUpgrade = false, - maxDamage = maxDamage, - maxSlope = 75, - maxWaterDepth = 999999, - metalStorage = 0, - name = "Radar Dome", - objectName = "eradar3.s3o", - script = "eradar3.cob", - onoffable = true, - radarDistance = 2500, - repairable = false, - selfDestructAs = "largeBuildingExplosionGenericWhite", - side = "CORE", - sightDistance = 500, - smoothAnim = true, - sonarDistance = 2500, - seismicDistance = 2500, - unitname = "eradar2", - workerTime = 0, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", +sightDistance = 750 +sonarDistance = 750 +seismicDistance = 750 - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - }, - }, +tech = [[tech0]] +armortype = [[building]] - sounds = { - underattack = "other/unitsunderattack1", - select = { - "other/gdradar", - }, - }, - customParams = { - RequireTech = techrequired, - unittype = "building", - needed_cover = 2, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} +VFS.Include("units-configs-basedefs/basedefs/buildings/eradar2_basedef.lua") -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eradar2_up1.lua b/Units/ebuilding/eradar2_up1.lua new file mode 100644 index 000000000..52d2660a1 --- /dev/null +++ b/Units/ebuilding/eradar2_up1.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- eradar2_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[eradar2_up1]] + +buildCostMetal = 40 + +humanName = [[Radar Tower]] +objectName = [[eradar3_large.s3o]] + +radarDistance = 3000 +radarEmitHeight = 128 + +sightDistance = 1500 +sonarDistance = 1500 +seismicDistance = 1500 + +tech = [[tech2]] +armortype = [[building]] + + +VFS.Include("units-configs-basedefs/basedefs/buildings/eradar2_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eshieldgen.lua b/Units/ebuilding/eshieldgen.lua index d4eaed5b5..5014ec1bd 100644 --- a/Units/ebuilding/eshieldgen.lua +++ b/Units/ebuilding/eshieldgen.lua @@ -40,8 +40,9 @@ local unitDef = { maxSlope = 30, maxWaterDepth = 0, metalStorage = 0, - name = "Protector", - objectName = "eshieldgen.s3o", + name = "Tuning Fork", + objectName = "eantinuke.s3o", + script = "eshieldgen2.cob", onlytargetcategory2 = "NOTAIR", onlytargetcategory3 = "NOTAIR", onlytargetcategory4 = "NOTAIR", @@ -89,8 +90,9 @@ local unitDef = { death_sounds = "generic", --ProvideTechRange = "300", armortype = armortype, - normaltex = "unittextures/eshieldgennormal.png", + normaltex = "unittextures/lego2skin_explorernormal.dds", corpse = "energycore", + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", diff --git a/Units/ebuilding/esilo.lua b/Units/ebuilding/esilo.lua index 91be0bb08..e8a48b31b 100644 --- a/Units/ebuilding/esilo.lua +++ b/Units/ebuilding/esilo.lua @@ -32,7 +32,7 @@ local unitDef = { canAttack = true, canstop = "1", category = "BUILDING NOTAIR", - description = [[Launching a Nuke requires 750 Energy!!!]], + description = [[ ]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -50,11 +50,6 @@ local unitDef = { metalStorage = 0, name = [[Eradicator: Nuclear Strike Facility]], objectName = "esilo2.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", radarDistance = 0, repairable = false, script = "esilo2.cob", @@ -103,11 +98,7 @@ local unitDef = { normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", corpse = "energycore", - helptext = [[Armortype: ]] ..armortype.. [[ - -]] .. weapon1Damage .. [[ Damage vs Light/Armored/Buildings - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -140,7 +131,7 @@ local weaponDefs = { id = 124, impulseBoost = 0, impulseFactor = 0, - interceptedByShieldType = 4, + --interceptedByShieldType = 4, metalpershot = 0, model = "enuke.s3o", @@ -166,9 +157,11 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "antibuilding", death_sounds = "nuke", oldcosttofireforumula = true, + effectedByunitHealthModifier = true, + friendlyfireexception = true, }, damage = { default = weapon1Damage, diff --git a/Units/ebuilding/esolar2.lua b/Units/ebuilding/esolar2.lua index b8669b032..51cfe9ce3 100644 --- a/Units/ebuilding/esolar2.lua +++ b/Units/ebuilding/esolar2.lua @@ -24,8 +24,8 @@ local unitDef = { energyStorage = 0, energyMake = energyproduced, explodeAs = "mediumBuildingExplosionGenericBlueEMP", - footprintX = 6, - footprintZ = 6, + footprintX = 2, + footprintZ = 2, icontype = "generator", idleAutoHeal = .5, idleTime = 2200, @@ -33,8 +33,9 @@ local unitDef = { maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Basic Energy Generator", - objectName = "epowerplant6x6.s3o", + name = "Fission Energy Generator", + objectName = "epowerplant3x3.s3o", + script = "esolar2.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -43,7 +44,7 @@ local unitDef = { sightDistance = 367, smoothAnim = true, unitname = "esolar2", - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", + yardMap = "ooo ooo ooo", sfxtypes = { pieceExplosionGenerators = { @@ -53,7 +54,7 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionbasic", + "custom:fusionreactionnuclear-small-2color", "custom:skyhatelaser", }, }, @@ -73,12 +74,12 @@ local unitDef = { death_sounds = "generic", -- ProvideTech = powerprovided, -- ProvideTechRange = powerradius, - -- RequireTech = "1 Powergrid", armortype = armortype, + noenergycost = true, -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -93,8 +94,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, + BuildingGroundDecalSizeX = 5, + BuildingGroundDecalSizeY = 5, BuildingGroundDecalDecaySpeed = 0.9, } -------------------------------------------------------------------------------- diff --git a/Units/ebuilding/estorage.lua b/Units/ebuilding/estorage.lua index e87d626f9..dce2a5938 100644 --- a/Units/ebuilding/estorage.lua +++ b/Units/ebuilding/estorage.lua @@ -6,10 +6,10 @@ local unitName = "estorage" -------------------------------------------------------------------------------- local armortype = [[building]] -local storage = 25 -local supplygranted = 10 +local storage = 50 +local supplygranted = 25 -local buildCostMetal = 25 +local buildCostMetal = 15 local maxDamage = buildCostMetal * 12.5 local unitDef = { @@ -32,8 +32,8 @@ local unitDef = { metalStorage = storage, energyUse = 0, explodeAs = "smallBuildingExplosionGenericPurple", - footprintX = 4, - footprintZ = 8, + footprintX = 2, + footprintZ = 4, idleAutoHeal = .5, idleTime = 2200, icontype = "storage", @@ -42,7 +42,7 @@ local unitDef = { maxWaterDepth = 5000, --metalStorage = storage, name = "Supply/Storage Depot", - objectName = "estorage2.s3o", + objectName = "estorage2_small.s3o", script = "estorage2.cob", radarDistance = 0, repairable = false, @@ -52,7 +52,7 @@ local unitDef = { smoothAnim = true, unitname = "estorage", workerTime = 0, - yardMap = "yyooooyy yyooooyy yyooooyy yyooooyy yyooooyy yyooooyy yyooooyy yyooooyy ", + yardMap = "oo oo oo oo oo oo oo oo", sfxtypes = { pieceExplosionGenerators = { @@ -62,7 +62,8 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionstoragenew", + "custom:fusionreactionstoragenew-small", + "custom:fusionreactionstoragenew-blue-small", "custom:skyhatelaser", }, }, @@ -82,16 +83,17 @@ local unitDef = { supply_granted = supplygranted, death_sounds = "generic", armortype = "building", + noenergycost = true, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", helptext = [[]], corpse = "energycore", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, + BuildingGroundDecalSizeX = 4, + BuildingGroundDecalSizeY = 6, BuildingGroundDecalDecaySpeed = 0.9, } diff --git a/Units/ebuilding/etech1.lua b/Units/ebuilding/etech1.lua index 3d339b657..8dc5459bc 100644 --- a/Units/ebuilding/etech1.lua +++ b/Units/ebuilding/etech1.lua @@ -20,15 +20,16 @@ local unitDef = { buildCostMetal = buildCostMetal, builder = false, buildTime = 5, + buildpic = "emaker.png", canAttack = false, category = "BUILDING NOTAIR ECO", damageModifier = 0.33333, - description = "", + description = "Unlocks Tech 1 - Can be evolved to unlock Tech 2", energyStorage = 0, energyMake = energyproduced, explodeAs = "hugeBuildingExplosionGenericBlue", - footprintX = 6, - footprintZ = 6, + footprintX = 4, + footprintZ = 4, icontype = "energy", idleAutoHeal = .5, idleTime = 2200, @@ -37,8 +38,8 @@ local unitDef = { maxWaterDepth = 5000, metalStorage = 0, name = "Tech Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", + objectName = "emaker3.s3o", + script = "emaker3.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -57,7 +58,10 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionnuclearblue", + "custom:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", "custom:skyhatelaser", }, }, @@ -80,7 +84,7 @@ local unitDef = { -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -95,8 +99,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, BuildingGroundDecalDecaySpeed = 0.9, } -------------------------------------------------------------------------------- diff --git a/Units/ebuilding/etech2.lua b/Units/ebuilding/etech2.lua index 23fa093c5..6235a5f05 100644 --- a/Units/ebuilding/etech2.lua +++ b/Units/ebuilding/etech2.lua @@ -22,15 +22,16 @@ local unitDef = { buildCostMetal = buildCostMetal, builder = false, buildTime = 5, + buildpic = "emaker.png", canAttack = false, category = "BUILDING NOTAIR ECO", damageModifier = 0.33333, - description = "", + description = "Unlocks Tech 2 - Can be evolved to unlock Tech 3", energyStorage = 0, energyMake = energyproduced, explodeAs = "hugeBuildingExplosionGenericPurple", - footprintX = 6, - footprintZ = 6, + footprintX = 4, + footprintZ = 4, icontype = "energy", idleAutoHeal = .5, idleTime = 2200, @@ -39,8 +40,8 @@ local unitDef = { maxWaterDepth = 5000, metalStorage = 0, name = "Tech Level 2 Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", + objectName = "emaker3.s3o", + script = "emaker3.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -59,7 +60,10 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionnuclearpurple", + "custom:fusionreactionmaker-orange", + "custom:fusionreactionmaker-purple", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-purple", "custom:skyhatelaser", }, }, @@ -83,7 +87,7 @@ local unitDef = { -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -98,8 +102,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, BuildingGroundDecalDecaySpeed = 0.9, } -------------------------------------------------------------------------------- diff --git a/Units/ebuilding/etech3.lua b/Units/ebuilding/etech3.lua index 987275b65..23947c5e5 100644 --- a/Units/ebuilding/etech3.lua +++ b/Units/ebuilding/etech3.lua @@ -7,7 +7,7 @@ local unitName = "etech3" local armortype = [[building]] local energyproduced = [[0]] -local techprovided = [[tech0, tech1, tech2, tech3, 1000 endbringer]] +local techprovided = [[tech0, tech1, tech2, tech3]] local tech = [[tech1, tech2]] --local supplygranted = [[25]] @@ -22,15 +22,16 @@ local unitDef = { buildCostMetal = buildCostMetal, builder = false, buildTime = 5, + buildpic = "emaker.png", canAttack = false, category = "BUILDING NOTAIR ECO", damageModifier = 0.33333, - description = "", + description = "Unlocks Tech 3", energyStorage = 0, energyMake = energyproduced, explodeAs = "hugeBuildingExplosionGenericGreen", - footprintX = 6, - footprintZ = 6, + footprintX = 4, + footprintZ = 4, icontype = "energy", idleAutoHeal = .5, idleTime = 2200, @@ -39,8 +40,8 @@ local unitDef = { maxWaterDepth = 5000, metalStorage = 0, name = "Tech Level 3 Facility", - objectName = "emediumgen.s3o", - script = "emediumgen.cob", + objectName = "emaker3.s3o", + script = "emaker3.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -59,7 +60,10 @@ local unitDef = { explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionnucleargreen", + "custom:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-purple", + "custom:fusionreactionmaker-green", "custom:skyhatelaser", }, }, @@ -83,7 +87,7 @@ local unitDef = { -- supply_granted = supplygranted, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", corpse = "energycore", -- groundtexselectimg = ":nc:bitmaps/power/power.png", -- groundtexselectimg1 = ":nc:bitmaps/power/power1.png", @@ -98,8 +102,8 @@ local unitDef = { }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, BuildingGroundDecalDecaySpeed = 0.9, } -------------------------------------------------------------------------------- diff --git a/Units/ebuilding/euwturret.lua b/Units/ebuilding/euwturret.lua deleted file mode 100644 index f365d62b7..000000000 --- a/Units/ebuilding/euwturret.lua +++ /dev/null @@ -1,26 +0,0 @@ --- UNITDEF -- EUWTURRET -- --------------------------------------------------------------------------------- - -unitName = [[euwturret]] - --------------------------------------------------------------------------------- - -isUpgraded = [[0]] - -humanName = [[Rooter]] - -objectName = [[euwturret.s3o]] -script = [[euwturret.cob]] - -tech = [[tech1]] -armortype = [[building]] -supply = [[2]] - -VFS.Include("units-configs-basedefs/basedefs/buildings/euwturret_basedef.lua") - -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ecommander.lua b/Units/ecommander.lua index 32261d5b7..8c75f03e6 100644 --- a/Units/ecommander.lua +++ b/Units/ecommander.lua @@ -6,13 +6,10 @@ local unitName = "ecommander" -------------------------------------------------------------------------------- local armortype = [[light]] -local supplyGiven = [[10]] +local supplyGiven = [[0]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) local unitDef = { @@ -26,36 +23,37 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 1000, + buildDistance = 350, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", - description = [[Builds Units • Gives ]] ..supplyGiven.. [[ Supply]], + description = [[Builds Units]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = 5000, + maxDamage = 2000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -64,10 +62,10 @@ local unitDef = { metalStorage = 0, movementClass = "COMMANDERTANK4", moveState = "0", - name = "The Healer Overseer", + name = "The Overseer", noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", - objectName = "ecommander4.s3o", - script = "ecommander3.cob", + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", radarDistance = 0, repairable = false, selfDestructAs = "commnuke", @@ -83,10 +81,9 @@ local unitDef = { upright = false, workerTime = 1, capturespeed = 0.25, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + TerraformSpeed = 2147000, + ReclaimSpeed = 1, -- 0.03125 = 1 hp per second + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -95,8 +92,9 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", + "custom:gdhcannon", }, }, buildoptions = Shared.buildList, @@ -112,7 +110,7 @@ local unitDef = { }, weapons = { [1] = { - def = "riottankempweapon", + def = "machinegun", }, }, customParams = { @@ -130,7 +128,7 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", }, } @@ -138,90 +136,46 @@ local unitDef = { local weaponDefs = { - riottankempweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, + machinegun = { + AreaOfEffect = 50, avoidFriendly = false, - avoidGround = false, - collideFeature = false, + avoidFeature = false, collideFriendly = false, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.05, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium-lightning", - fallOffRate = 1, - fireStarter = 100, - impulseFactor = 0, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, - minintensity = 1, - name = "EMP Blast Wave", - noexplode = true, - paralyzer = true, - paralyzetime = 2.5, - range = 500, + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, reloadtime = 1, WeaponType = "LaserCannon", - rgbColor = "0 0.2 1", + rgbColor = "1 0.2 0", rgbColor2 = "1 1 1", soundTrigger = true, - soundstart = "weapons/fnubeamfire.wav", - soundHit = "explosions/phasegun1hit.wav", - texture1 = "wave", + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", texture2 = "empty", - thickness = 40, + thickness = 7, tolerance = 1000, turret = true, - weaponVelocity = 1000, + weaponVelocity = 1500, customparams = { - damagetype = "eriottank2", - nofriendlyfire = 1, - nocosttofire = true, - - --Upgrades-- - upgradeClass = "groundweapons", + damagetype = "light", + nocosttofire = true, }, damage = { - default = weapon1Damage, + default = 200, }, }, - emp = { - AreaOfEffect = 500, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - explosionGenerator = "custom:genericshellexplosion-large-blue-emp", - tolerance = 1000, - energypershot = 0, - explosionScar = false, - impulseFactor = 0, - name = "Emp Blast Weapon", - noSelfDamage = true, - paralyzer = true, - paralyzetime = 5, - range = 500, - reloadtime = 10, - weaponType = "Cannon", - soundhit = "explosions/emp.wav", - size = 0, - turret = true, - weaponVelocity = 10000, - customparams = { - damagetype = "default", - nofriendlyfire = 1, - nocosttofire = true, - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = 1000, - }, - }, commnuke = { AreaOfEffect = 500, avoidFriendly = false, @@ -267,7 +221,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, diff --git a/Units/ecommanderbattle.lua b/Units/ecommanderbattle.lua index 283b1b4c2..c920721fe 100644 --- a/Units/ecommanderbattle.lua +++ b/Units/ecommanderbattle.lua @@ -6,7 +6,7 @@ local unitName = "ecommanderbattle" -------------------------------------------------------------------------------- local armortype = [[armored]] ---local supplyGiven = [[10]] +local supplyGiven = [[0]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] @@ -14,8 +14,8 @@ local weapon1Damage = 200 local weapon1AOE = 250 local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local weapon2Damage = 25 -local weapon2AOE = 10 +local weapon2Damage = 75 +local weapon2AOE = 25 local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) @@ -30,36 +30,38 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 1000, + buildDistance = 350, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT ARMORED", - description = [[Builds Units • Provides support in battles]], + description = [[Experimental Assault Overseer]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", - idleAutoHeal = .5, - idleTime = 2200, + autoHeal = 0.5, + idleAutoHeal = 50, + idleTime = 300, levelground = true, - maxDamage = 5000, + maxDamage = 15000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -77,7 +79,7 @@ local unitDef = { selfDestructAs = "commnuke", showPlayerName = true, showNanoSpray = true, - sightDistance = 550, + sightDistance = 650, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -87,10 +89,10 @@ local unitDef = { upright = false, workerTime = 1, capturespeed = 0.25, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -99,12 +101,12 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", - "custom:gdhcannon", + "custom:electricity", }, }, - buildoptions = Shared.buildList, + --buildoptions = Shared.buildList, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -120,25 +122,26 @@ local unitDef = { -- def = "riottankempweapon", -- }, [1] = { - def = "machinegun", + def = "heavybeamweapon", + badTargetCategory = "BUILDING WALL", }, }, customParams = { unittype = "mobile", - area_mex_def = "emetalextractor", + --area_mex_def = "emetalextractor", ProvideTech = techprovided, RequireTech = techrequired, canbetransported = "true", iscommander = true, needed_cover = 2, --- supply_granted = supplyGiven, + supply_granted = supplyGiven, death_sounds = "generic", armortype = armortype, nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", }, } @@ -184,7 +187,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -219,7 +222,7 @@ local weaponDefs = { turret = true, weaponVelocity = 10000, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -275,7 +278,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, @@ -303,7 +306,7 @@ local weaponDefs = { minintensity = "1", name = "Machine Gun", - range = 550, + range = 650, reloadtime = 0.1, WeaponType = "LaserCannon", rgbColor = "1 0.5 0", @@ -317,7 +320,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "ecommanderbattle", + damagetype = "antiarmored", nocosttofire = true, }, @@ -325,6 +328,92 @@ local weaponDefs = { default = weapon2Damage, }, }, + sniper = { + AreaOfEffect = 25, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.2, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-purple", + fallOffRate = 0, + fireStarter = 100, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 0.5 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Blaster 4.wav", + soundHit = "explosions/explode5.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 5, + tolerance = 1000, + turret = true, + weaponVelocity = 3000, + customparams = { + damagetype = "antilightarmored", + }, + damage = { + default = 750, + }, + }, + + heavybeamweapon = { + AreaOfEffect = 10, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + largebeamlaser = true, + beamTime = 0.5, + cameraShake = 0, + coreThickness = 0.5, + -- cegTag = "mediumcannonweapon3", + -- duration = 0.2, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + minintensity = 1, + name = "Laser", + range = 800, + reloadtime = 0.5, + WeaponType = "BeamLaser", + rgbColor = "0.25 0 0.25", + rgbColor2 = "0.5 0.5 0.5", + soundTrigger = true, + soundstart = "weapons/Sci Fi Beam 3-short.wav", + -- soundHit = "explosions/mediumcannonhit.wav", + -- sweepfire = true, + texture1 = "shot", + texture2 = "empty", + thickness = 5, + tolerance = 1000, + turret = true, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "antilightarmored", + }, + damage = { + default = 500, + }, + }, + } unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- diff --git a/Units/ecommanderbuild.lua b/Units/ecommanderbuild.lua index 3c92c938c..533e94fc3 100644 --- a/Units/ecommanderbuild.lua +++ b/Units/ecommanderbuild.lua @@ -6,13 +6,13 @@ local unitName = "ecommanderbuild" -------------------------------------------------------------------------------- local armortype = [[light]] ---local supplyGiven = [[10]] +local supplyGiven = [[0]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) local unitDef = { @@ -26,36 +26,37 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 1500, + buildDistance = 600, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", - description = [[Builds Units x3 as fast]], + description = [[Builds Units x8 as fast]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = 5000, + maxDamage = 6000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -66,8 +67,8 @@ local unitDef = { moveState = "0", name = "The Builder Overseer", noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", - objectName = "ecommander4.s3o", - script = "ecommander3.cob", + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", radarDistance = 0, repairable = false, selfDestructAs = "commnuke", @@ -81,12 +82,12 @@ local unitDef = { turnRate = 5000, unitname = unitName, upright = false, - workerTime = 3, + workerTime = 8, capturespeed = 0.25, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + repairspeed = 1.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -95,8 +96,9 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", + "custom:gdhcannon", }, }, buildoptions = Shared.buildList, @@ -112,7 +114,7 @@ local unitDef = { }, weapons = { [1] = { - def = "riottankempweapon", + def = "machinegun", }, }, customParams = { @@ -123,14 +125,14 @@ local unitDef = { canbetransported = "true", iscommander = true, needed_cover = 2, --- supply_granted = supplyGiven, + supply_granted = supplyGiven, death_sounds = "generic", armortype = armortype, nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", helptext = [[Armortype: ]] ..armortype.. [[ x3 Buildpower @@ -144,6 +146,46 @@ Reclaims any energy cores within it's proximity.]], local weaponDefs = { + machinegun = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "1 0.2 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 200, + }, + }, + riottankempweapon = { AreaOfEffect = weapon1AOE, @@ -182,7 +224,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -217,7 +259,7 @@ local weaponDefs = { turret = true, weaponVelocity = 10000, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -273,7 +315,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, diff --git a/Units/ecommandercloak.lua b/Units/ecommandercloak.lua index 0f1af13cf..8ebf3556e 100644 --- a/Units/ecommandercloak.lua +++ b/Units/ecommandercloak.lua @@ -6,13 +6,13 @@ local unitName = "ecommandercloak" -------------------------------------------------------------------------------- local armortype = [[light]] -local supplyGiven = [[10]] +local supplyGiven = [[0]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) local unitDef = { @@ -26,36 +26,37 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 1000, + buildDistance = 350, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", - description = [[Builds Units • Provides Cloak Field • Gives ]] ..supplyGiven.. [[ Supply]], + description = [[Provides Massive Cloak Field]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = 5000, + maxDamage = 10000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -74,7 +75,7 @@ local unitDef = { selfDestructAs = "commnuke", showPlayerName = true, showNanoSpray = true, - sightDistance = 500, + sightDistance = 650, smoothAnim = true, stealth = true, seismicSignature = 2, @@ -84,10 +85,10 @@ local unitDef = { upright = false, workerTime = 1, capturespeed = 0.25, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -96,11 +97,11 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, - buildoptions = Shared.buildList, + --buildoptions = Shared.buildList, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -112,13 +113,13 @@ local unitDef = { }, }, weapons = { - [1] = { - def = "riottankempweapon", - }, + -- [1] = { + -- def = "riottankempweapon", + -- }, }, customParams = { unittype = "mobile", - area_mex_def = "emetalextractor", + --area_mex_def = "emetalextractor", ProvideTech = techprovided, RequireTech = techrequired, canbetransported = "true", @@ -131,12 +132,7 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] ..armortype.. [[ - -Generates a large cloaking and Jamming field - -Reclaims any energy cores within it's proximity.]], + factionname = "ateran", area_cloak = 1, -- Can this unit emit a cloaking field? area_cloak_upkeep = 0, -- How much energy does it cost to maintain the cloaking field? @@ -178,7 +174,7 @@ local weaponDefs = { noexplode = true, paralyzer = true, paralyzetime = 2.5, - range = 500, + range = 650, reloadtime = 1, WeaponType = "LaserCannon", rgbColor = "0 0.2 1", @@ -193,7 +189,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -228,7 +224,7 @@ local weaponDefs = { turret = true, weaponVelocity = 10000, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -284,7 +280,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, diff --git a/Units/ecommanderfactory.lua b/Units/ecommanderfactory.lua index 7c3d81417..394559e95 100644 --- a/Units/ecommanderfactory.lua +++ b/Units/ecommanderfactory.lua @@ -6,13 +6,13 @@ local unitName = "ecommanderfactory" -------------------------------------------------------------------------------- local armortype = [[light]] -local supplyGiven = [[25]] +local supplyGiven = [[15]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) local unitDef = { @@ -26,21 +26,22 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 500, + buildDistance = 250, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", description = [[Creates buildings and mobile units • Gives ]] ..supplyGiven.. [[ Supply]], @@ -50,12 +51,12 @@ local unitDef = { explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = 5000, + maxDamage = 15000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -66,8 +67,8 @@ local unitDef = { moveState = "0", name = "The Factory Overseer", noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", - objectName = "ecommander4.s3o", - script = "ecommander3.cob", + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", radarDistance = 0, repairable = false, selfDestructAs = "commnuke", @@ -81,12 +82,12 @@ local unitDef = { turnRate = 5000, unitname = unitName, upright = false, - workerTime = 3, + workerTime = 8, capturespeed = 0.25, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + repairspeed = 1.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -95,11 +96,12 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", + "custom:gdhcannon", }, }, - buildoptions = Shared.buildListFactory, + buildoptions = Shared.buildListeCommanderFactory, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -112,12 +114,12 @@ local unitDef = { }, weapons = { [1] = { - def = "riottankempweapon", + def = "machinegun", }, }, customParams = { unittype = "mobile", - area_mex_def = "emetalextractor", + --area_mex_def = "emetalextractor", ProvideTech = techprovided, RequireTech = techrequired, canbetransported = "true", @@ -130,12 +132,7 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] ..armortype.. [[ - -Can build light and riot units anywhere. - -Reclaims any energy cores within it's proximity.]], + factionname = "ateran", }, } @@ -143,6 +140,46 @@ Reclaims any energy cores within it's proximity.]], local weaponDefs = { + machinegun = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "1 0.2 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 200, + }, + }, + riottankempweapon = { AreaOfEffect = weapon1AOE, @@ -181,7 +218,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -216,7 +253,7 @@ local weaponDefs = { turret = true, weaponVelocity = 10000, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -272,7 +309,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, diff --git a/Units/ecommanderhealer.lua b/Units/ecommanderhealer.lua new file mode 100644 index 000000000..05cdb517a --- /dev/null +++ b/Units/ecommanderhealer.lua @@ -0,0 +1,238 @@ +-- UNITDEF -- ECOMMANDERHEALER -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderhealer" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 350, + builder = true, + buildTime = 2.5, + buildpic = "ecommanderbattle.png", + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = false, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "NOTAIR SUPPORT LIGHT", + description = [[Provides a Large Healing Area of Effect]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 6000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Healer Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 2147000, + ReclaimSpeed = 1, -- 0.03125 = 1 hp per second + repairspeed = 0.5, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + "custom:gdhcannon", + }, + }, + buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "machinegun", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + + machinegun = { + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Overseer Pulse Laser", + range = 650, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "1 0.2 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/Sci Fi Sniper 10.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 7, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = 200, + }, + }, + + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + commandfire = true, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ecommandermeteor.lua b/Units/ecommandermeteor.lua new file mode 100644 index 000000000..faf5506e1 --- /dev/null +++ b/Units/ecommandermeteor.lua @@ -0,0 +1,229 @@ +-- UNITDEF -- ECOMMANDERMETEOR -- +-------------------------------------------------------------------------------- + +local unitName = "ecommandermeteor" + +-------------------------------------------------------------------------------- + +local armortype = [[armored]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer, tech3]] + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 350, + builder = true, + buildTime = 2.5, + buildpic = "ecommanderbattle.png", + capturable = false, + CanAttack = true, + CanAssist = false, + canBeAssisted = true, + CanCapture = false, + CanRepair = false, + canRestore = false, + + canGuard = true, + canMove = false, + canPatrol = false, + canreclaim = false, + canstop = true, + category = "NOTAIR BUILDING", + description = [[Astrological Control Center]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 8, + footprintZ = 8, + + iconType = "commander", + idleAutoHeal = 5, + idleTime = 300, + levelground = true, + maxDamage = 20000, + maxSlope = 180, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + moveState = "0", + name = "The Meteor Overseer", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + fireState = 0, + objectName = "ecommander-meteor.s3o", + script = "ecommander4-meteor.cob", + radarDistance = 0, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 250, + smoothAnim = true, + stealth = true, + unitname = unitName, + upright = false, + yardmap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + "custom:gdhcannon", + }, + }, + --buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- }, + [1] = { + def = "meteor", + badtargetcategory = "VTOL LIGHT ARMORED", + }, + }, + customParams = { + unittype = "mobile", + area_mex_def = "emetalextractor", + ProvideTech = techprovided, + RequireTech = techrequired, + canbetransported = "true", + iscommander = true, + needed_cover = 2, + supply_granted = supplyGiven, + death_sounds = "generic", + + armortype = armortype, + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, +} + +-------------------------------------------------------------------------------- + +local weaponDefs = { + meteor = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + commandFire = true, + burst = 100, + burstrate = 0.1, + --projectiles = 5, + cegTag = "METEORTRAIL", + commandfire = true, + explosionGenerator = "custom:genericshellexplosion-large", + energypershot = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + name = unitName .. "Weapon", + range = 50000, + reloadtime = 120, + size = 16, + weaponType = "Cannon", + soundHit = "explosions/explode3.wav", + soundStart = "weapons/meteorwhoosh.wav", + sprayangle = 1000, + tolerance = 2000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "antibuilding", + friendlyfireexception = true, + }, + damage = { + default = 100, + }, + }, + commnuke = { + AreaOfEffect = 500, + avoidFriendly = false, + avoidFeature = false, + cegTag = "NUKETRAIL", + collideFriendly = false, + collideFeature = false, + craterBoost = 0, + craterMult = 0, + edgeeffectiveness = 0.1, + energypershot = 0, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + fireStarter = 100, + flightTime = 400, + + id = 124, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "enuke.s3o", + name = "Nuke", + range = 32000, + reloadtime = 60, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", + +-- stockpile = true, +-- stockpileTime = stockpiletime, + startVelocity = 10, + tracks = true, + turnRate = 3000, + targetable = 1, + + weaponAcceleration = 30, + weaponTimer = 15, + weaponType = "StarburstLauncher", + weaponVelocity = 1000, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ecommandershield.lua b/Units/ecommandershield.lua index 1f0c3ea52..48dee7a5c 100644 --- a/Units/ecommandershield.lua +++ b/Units/ecommandershield.lua @@ -6,12 +6,12 @@ local unitName = "ecommandershield" -------------------------------------------------------------------------------- local armortype = [[armored]] -local supplyGiven = [[10]] +local supplyGiven = [[0]] local techprovided = [[tech0, -overseer]] local techrequired = [[0 overseer]] local shield1Power = 5000 -local shield1PowerRegen = 40 +local shield1PowerRegen = 50 local shield1PowerRegenEnergy = 0 local weapon1Damage = 200 @@ -30,36 +30,37 @@ local unitDef = { brakeRate = 1, buildCostEnergy = 0, buildCostMetal = 1000, - buildDistance = 1000, + buildDistance = 350, builder = true, buildTime = 2.5, + buildpic = "ecommanderbattle.png", capturable = false, CanAttack = true, CanAssist = true, canBeAssisted = true, - CanCapture = true, + CanCapture = false, CanRepair = true, canRestore = false, canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", - description = [[Builds Units • Provides large shielding • Gives ]] ..supplyGiven.. [[ Supply]], + description = [[Provides large shielding • Self-Heals out of combat 40hp/s when idle]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", - idleAutoHeal = .5, - idleTime = 2200, + idleAutoHeal = 40, + idleTime = 5, levelground = true, - maxDamage = 5000, + maxDamage = 8000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -87,10 +88,10 @@ local unitDef = { upright = false, workerTime = 1, capturespeed = 0.25, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, -- 0.03125 = 1 hp per second - repairspeed = 0.15625, + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -99,11 +100,11 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, - buildoptions = Shared.buildList, + --buildoptions = Shared.buildList, sounds = { build = "miscfx/buildstart.wav", underattack = "other/unitsunderattack1", @@ -124,7 +125,7 @@ local unitDef = { }, customParams = { unittype = "mobile", - area_mex_def = "emetalextractor", + --area_mex_def = "emetalextractor", ProvideTech = techprovided, RequireTech = techrequired, canbetransported = "true", @@ -137,7 +138,7 @@ local unitDef = { nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", + factionname = "ateran", helptext = [[Armortype: ]] ..armortype.. [[ Generates a large shield @@ -188,7 +189,7 @@ local weaponDefs = { turret = true, weaponVelocity = 1000, customparams = { - damagetype = "eriottank2", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -223,7 +224,7 @@ local weaponDefs = { turret = true, weaponVelocity = 10000, customparams = { - damagetype = "default", + damagetype = "light", nofriendlyfire = 1, nocosttofire = true, @@ -307,7 +308,7 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", nocosttofire = true, }, diff --git a/Units/ehbot/mobile/ehbotfac.lua b/Units/ehbot/mobile/ehbotfac.lua index 13845e7f4..535de8b8e 100644 --- a/Units/ehbot/mobile/ehbotfac.lua +++ b/Units/ehbot/mobile/ehbotfac.lua @@ -5,7 +5,7 @@ unitName = "ehbotfac" -------------------------------------------------------------------------------- -buildCostMetal = 30 +buildCostMetal = 60 maxDamage = buildCostMetal * 12.5 humanName = [[H-Bot Factory]] diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotfac_up1.lua b/Units/ehbot/mobile/ehbotfac_up1.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/ehbotfac_up1.lua rename to Units/ehbot/mobile/ehbotfac_up1.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotfac_up2.lua b/Units/ehbot/mobile/ehbotfac_up2.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotfac_up2.lua rename to Units/ehbot/mobile/ehbotfac_up2.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotfac_up3.lua b/Units/ehbot/mobile/ehbotfac_up3.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotfac_up3.lua rename to Units/ehbot/mobile/ehbotfac_up3.lua diff --git a/Units/ehbot/mobile/ehbotkarganneth.lua b/Units/ehbot/mobile/ehbotkarganneth.lua index 63704ad24..28d49450b 100644 --- a/Units/ehbot/mobile/ehbotkarganneth.lua +++ b/Units/ehbot/mobile/ehbotkarganneth.lua @@ -12,7 +12,7 @@ humanName = [[Karganneth]] objectName = "ehbotkarganneth.s3o" script = "ehbotkarganneth_lus.lua" -tech = [[endbringer]] +tech = [[tech3]] armortype = [[armored]] VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua") diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotkarganneth_up1.lua b/Units/ehbot/mobile/ehbotkarganneth_up1.lua similarity index 96% rename from Units/ehbot/mobile/Upgrade 1/ehbotkarganneth_up1.lua rename to Units/ehbot/mobile/ehbotkarganneth_up1.lua index 062cff4a1..c38a6e3fa 100644 --- a/Units/ehbot/mobile/Upgrade 1/ehbotkarganneth_up1.lua +++ b/Units/ehbot/mobile/ehbotkarganneth_up1.lua @@ -12,7 +12,7 @@ humanName = [[Karganneth MK II]] objectName = "ehbotkarganneth.s3o" script = "ehbotkarganneth_lus.lua" -tech = [[endbringer]] +tech = [[tech3]] armortype = [[armored]] VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua") diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotkarganneth_up2.lua b/Units/ehbot/mobile/ehbotkarganneth_up2.lua similarity index 97% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotkarganneth_up2.lua rename to Units/ehbot/mobile/ehbotkarganneth_up2.lua index ec24a796f..364948b8c 100644 --- a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotkarganneth_up2.lua +++ b/Units/ehbot/mobile/ehbotkarganneth_up2.lua @@ -12,7 +12,7 @@ humanName = [[Karganneth MK III]] objectName = "ehbotkarganneth.s3o" script = "ehbotkarganneth_lus.lua" -tech = [[endbringer]] +tech = [[tech3]] armortype = [[armored]] VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua") diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_up3.lua b/Units/ehbot/mobile/ehbotkarganneth_up3.lua similarity index 96% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_up3.lua rename to Units/ehbot/mobile/ehbotkarganneth_up3.lua index ee75719b5..2b2a2a54b 100644 --- a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_up3.lua +++ b/Units/ehbot/mobile/ehbotkarganneth_up3.lua @@ -12,7 +12,7 @@ humanName = [[Karganneth MK IV]] objectName = "ehbotkarganneth.s3o" script = "ehbotkarganneth_lus.lua" -tech = [[endbringer]] +tech = [[tech3]] armortype = [[armored]] VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua") diff --git a/Units/ehbot/mobile/ehbotpeewee.lua b/Units/ehbot/mobile/ehbotpeewee.lua index 6d414040e..98df1b864 100644 --- a/Units/ehbot/mobile/ehbotpeewee.lua +++ b/Units/ehbot/mobile/ehbotpeewee.lua @@ -12,7 +12,7 @@ humanName = [[A.K.]] objectName = "ehbotpeewee2.s3o" script = "ehbotpeewee_lus.lua" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[6]] diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotpeewee_up1.lua b/Units/ehbot/mobile/ehbotpeewee_up1.lua similarity index 97% rename from Units/ehbot/mobile/Upgrade 1/ehbotpeewee_up1.lua rename to Units/ehbot/mobile/ehbotpeewee_up1.lua index a09e8b0d1..ce06e4129 100644 --- a/Units/ehbot/mobile/Upgrade 1/ehbotpeewee_up1.lua +++ b/Units/ehbot/mobile/ehbotpeewee_up1.lua @@ -12,7 +12,7 @@ humanName = [[A.K. MK II]] objectName = "ehbotpeewee2.s3o" script = "ehbotpeewee_lus.lua" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[6]] diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotpeewee_up2.lua b/Units/ehbot/mobile/ehbotpeewee_up2.lua similarity index 97% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotpeewee_up2.lua rename to Units/ehbot/mobile/ehbotpeewee_up2.lua index fa8361d33..22bad81a7 100644 --- a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotpeewee_up2.lua +++ b/Units/ehbot/mobile/ehbotpeewee_up2.lua @@ -12,7 +12,7 @@ humanName = [[A.K. MK III]] objectName = "ehbotpeewee2.s3o" script = "ehbotpeewee_lus.lua" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[6]] diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_up3.lua b/Units/ehbot/mobile/ehbotpeewee_up3.lua similarity index 97% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_up3.lua rename to Units/ehbot/mobile/ehbotpeewee_up3.lua index 9c228b348..f0c448a01 100644 --- a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_up3.lua +++ b/Units/ehbot/mobile/ehbotpeewee_up3.lua @@ -12,7 +12,7 @@ humanName = [[A.K. MK IV]] objectName = "ehbotpeewee2.s3o" script = "ehbotpeewee_lus.lua" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[6]] diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotrocko_up1.lua b/Units/ehbot/mobile/ehbotrocko_up1.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/ehbotrocko_up1.lua rename to Units/ehbot/mobile/ehbotrocko_up1.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotrocko_up2.lua b/Units/ehbot/mobile/ehbotrocko_up2.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotrocko_up2.lua rename to Units/ehbot/mobile/ehbotrocko_up2.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotrocko_up3.lua b/Units/ehbot/mobile/ehbotrocko_up3.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotrocko_up3.lua rename to Units/ehbot/mobile/ehbotrocko_up3.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotsniper_u2.lua b/Units/ehbot/mobile/ehbotsniper_u2.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotsniper_u2.lua rename to Units/ehbot/mobile/ehbotsniper_u2.lua diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotsniper_up1.lua b/Units/ehbot/mobile/ehbotsniper_up1.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/ehbotsniper_up1.lua rename to Units/ehbot/mobile/ehbotsniper_up1.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotsniper_up3.lua b/Units/ehbot/mobile/ehbotsniper_up3.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotsniper_up3.lua rename to Units/ehbot/mobile/ehbotsniper_up3.lua diff --git a/Units/ehbot/mobile/Upgrade 1/ehbotthud_up1.lua b/Units/ehbot/mobile/ehbotthud_up1.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/ehbotthud_up1.lua rename to Units/ehbot/mobile/ehbotthud_up1.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotthud_up2.lua b/Units/ehbot/mobile/ehbotthud_up2.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/ehbotthud_up2.lua rename to Units/ehbot/mobile/ehbotthud_up2.lua diff --git a/Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotthud_up3.lua b/Units/ehbot/mobile/ehbotthud_up3.lua similarity index 100% rename from Units/ehbot/mobile/Upgrade 1/Upgrade 2/Upgrade 3/ehbotthud_up3.lua rename to Units/ehbot/mobile/ehbotthud_up3.lua diff --git a/Units/ehbot/turret/ehbotkarganneth_turret.lua b/Units/ehbot/turret/ehbotkarganneth_turret.lua index a4788d612..e2215360b 100644 --- a/Units/ehbot/turret/ehbotkarganneth_turret.lua +++ b/Units/ehbot/turret/ehbotkarganneth_turret.lua @@ -12,8 +12,8 @@ humanName = [[Karganneth (Deployed)]] objectName = [[ehbotkarganneth_turret.s3o]] script = [[ehbotkarganneth_turret_lus.lua]] -tech = [[endbringer]] -armortype = [[building]] +tech = [[tech3]] +armortype = [[armored]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/ehbotkarganneth_turret_up1.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up1.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/ehbotkarganneth_turret_up1.lua rename to Units/ehbot/turret/ehbotkarganneth_turret_up1.lua index 8efdc57ed..7932345ad 100644 --- a/Units/ehbot/turret/Upgrade 1/ehbotkarganneth_turret_up1.lua +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up1.lua @@ -12,8 +12,8 @@ humanName = [[Karganneth (Deployed) MK II]] objectName = [[ehbotkarganneth_turret.s3o]] script = [[ehbotkarganneth_turret_lus.lua]] -tech = [[endbringer]] -armortype = [[building]] +tech = [[tech3]] +armortype = [[armored]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotkarganneth_turret_up2.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up2.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotkarganneth_turret_up2.lua rename to Units/ehbot/turret/ehbotkarganneth_turret_up2.lua index 4abec2969..9e88bb5c7 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotkarganneth_turret_up2.lua +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up2.lua @@ -12,8 +12,8 @@ humanName = [[Karganneth (Deployed) MK III]] objectName = [[ehbotkarganneth_turret.s3o]] script = [[ehbotkarganneth_turret_lus.lua]] -tech = [[endbringer]] -armortype = [[building]] +tech = [[tech3]] +armortype = [[armored]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_turret_up3.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up3.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_turret_up3.lua rename to Units/ehbot/turret/ehbotkarganneth_turret_up3.lua index 73f5a61c2..413109f39 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotkarganneth_turret_up3.lua +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up3.lua @@ -12,8 +12,8 @@ humanName = [[Karganneth (Deployed) MK IV]] objectName = [[ehbotkarganneth_turret.s3o]] script = [[ehbotkarganneth_turret_lus.lua]] -tech = [[endbringer]] -armortype = [[building]] +tech = [[tech3]] +armortype = [[armored]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") diff --git a/Units/ehbot/turret/ehbotpeewee_turret.lua b/Units/ehbot/turret/ehbotpeewee_turret.lua index 618013a87..6c1b33433 100644 --- a/Units/ehbot/turret/ehbotpeewee_turret.lua +++ b/Units/ehbot/turret/ehbotpeewee_turret.lua @@ -12,8 +12,8 @@ humanName = [[A.K. (Deployed)]] objectName = [[ehbotpeewee_turret.s3o]] script = [[ehbotpeewee_turret_lus.lua]] -tech = [[tech0]] -armortype = [[building]] +tech = [[tech1]] +armortype = [[light]] supply = [[6]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/ehbotpeewee_turret_up1.lua b/Units/ehbot/turret/ehbotpeewee_turret_up1.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/ehbotpeewee_turret_up1.lua rename to Units/ehbot/turret/ehbotpeewee_turret_up1.lua index eab510c44..aad9e5048 100644 --- a/Units/ehbot/turret/Upgrade 1/ehbotpeewee_turret_up1.lua +++ b/Units/ehbot/turret/ehbotpeewee_turret_up1.lua @@ -12,8 +12,8 @@ humanName = [[A.K. Mk II (Deployed)]] objectName = [[ehbotpeewee_turret.s3o]] script = [[ehbotpeewee_turret_lus.lua]] -tech = [[tech0]] -armortype = [[building]] +tech = [[tech1]] +armortype = [[light]] supply = [[6]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotpeewee_turret_up2.lua b/Units/ehbot/turret/ehbotpeewee_turret_up2.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotpeewee_turret_up2.lua rename to Units/ehbot/turret/ehbotpeewee_turret_up2.lua index f5307e385..3a61f66f7 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotpeewee_turret_up2.lua +++ b/Units/ehbot/turret/ehbotpeewee_turret_up2.lua @@ -12,8 +12,8 @@ humanName = [[A.K. Mk III (Deployed)]] objectName = [[ehbotpeewee_turret.s3o]] script = [[ehbotpeewee_turret_lus.lua]] -tech = [[tech0]] -armortype = [[building]] +tech = [[tech1]] +armortype = [[light]] supply = [[6]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_turret_up3.lua b/Units/ehbot/turret/ehbotpeewee_turret_up3.lua similarity index 94% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_turret_up3.lua rename to Units/ehbot/turret/ehbotpeewee_turret_up3.lua index 60147d166..246f019fa 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotpeewee_turret_up3.lua +++ b/Units/ehbot/turret/ehbotpeewee_turret_up3.lua @@ -12,8 +12,8 @@ humanName = [[A.K. Mk IV (Deployed)]] objectName = [[ehbotpeewee_turret.s3o]] script = [[ehbotpeewee_turret_lus.lua]] -tech = [[tech0]] -armortype = [[building]] +tech = [[tech1]] +armortype = [[light]] supply = [[6]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") diff --git a/Units/ehbot/turret/ehbotrocko_turret.lua b/Units/ehbot/turret/ehbotrocko_turret.lua index aafa66e76..b4480dad9 100644 --- a/Units/ehbot/turret/ehbotrocko_turret.lua +++ b/Units/ehbot/turret/ehbotrocko_turret.lua @@ -13,7 +13,7 @@ objectName = [[ehbotrocko_turret.s3o]] script = [[ehbotrocko_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[15]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/ehbotrocko_turret_up1.lua b/Units/ehbot/turret/ehbotrocko_turret_up1.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/ehbotrocko_turret_up1.lua rename to Units/ehbot/turret/ehbotrocko_turret_up1.lua index aa1dc8dfc..394fd42f4 100644 --- a/Units/ehbot/turret/Upgrade 1/ehbotrocko_turret_up1.lua +++ b/Units/ehbot/turret/ehbotrocko_turret_up1.lua @@ -13,7 +13,7 @@ objectName = [[ehbotrocko_turret.s3o]] script = [[ehbotrocko_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[15]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotrocko_turret_up2.lua b/Units/ehbot/turret/ehbotrocko_turret_up2.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotrocko_turret_up2.lua rename to Units/ehbot/turret/ehbotrocko_turret_up2.lua index 334fad91e..84c371c7a 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotrocko_turret_up2.lua +++ b/Units/ehbot/turret/ehbotrocko_turret_up2.lua @@ -13,7 +13,7 @@ objectName = [[ehbotrocko_turret.s3o]] script = [[ehbotrocko_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[15]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotrocko_turret_up3.lua b/Units/ehbot/turret/ehbotrocko_turret_up3.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotrocko_turret_up3.lua rename to Units/ehbot/turret/ehbotrocko_turret_up3.lua index 5ca09a60f..30aba9e33 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotrocko_turret_up3.lua +++ b/Units/ehbot/turret/ehbotrocko_turret_up3.lua @@ -13,7 +13,7 @@ objectName = [[ehbotrocko_turret.s3o]] script = [[ehbotrocko_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[15]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") diff --git a/Units/ehbot/turret/ehbotsniper_turret.lua b/Units/ehbot/turret/ehbotsniper_turret.lua index e480d1f8f..e4b45bc14 100644 --- a/Units/ehbot/turret/ehbotsniper_turret.lua +++ b/Units/ehbot/turret/ehbotsniper_turret.lua @@ -13,7 +13,7 @@ objectName = [[ehbotsniper_turret.s3o]] script = [[ehbotsniper_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[9]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/ehbotsniper_turret_up1.lua b/Units/ehbot/turret/ehbotsniper_turret_up1.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/ehbotsniper_turret_up1.lua rename to Units/ehbot/turret/ehbotsniper_turret_up1.lua index 5400bca6f..4daf75d48 100644 --- a/Units/ehbot/turret/Upgrade 1/ehbotsniper_turret_up1.lua +++ b/Units/ehbot/turret/ehbotsniper_turret_up1.lua @@ -13,7 +13,7 @@ objectName = [[ehbotsniper_turret.s3o]] script = [[ehbotsniper_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[9]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotsniper_turret_up2.lua b/Units/ehbot/turret/ehbotsniper_turret_up2.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotsniper_turret_up2.lua rename to Units/ehbot/turret/ehbotsniper_turret_up2.lua index 5360cfffa..5fb323d85 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotsniper_turret_up2.lua +++ b/Units/ehbot/turret/ehbotsniper_turret_up2.lua @@ -13,7 +13,7 @@ objectName = [[ehbotsniper_turret.s3o]] script = [[ehbotsniper_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[9]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotsniper_turret_up3.lua b/Units/ehbot/turret/ehbotsniper_turret_up3.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotsniper_turret_up3.lua rename to Units/ehbot/turret/ehbotsniper_turret_up3.lua index 1087a74b4..ddae46628 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotsniper_turret_up3.lua +++ b/Units/ehbot/turret/ehbotsniper_turret_up3.lua @@ -13,7 +13,7 @@ objectName = [[ehbotsniper_turret.s3o]] script = [[ehbotsniper_turret_lus.lua]] tech = [[tech2]] -armortype = [[building]] +armortype = [[light]] supply = [[9]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") diff --git a/Units/ehbot/turret/ehbotthud_turret.lua b/Units/ehbot/turret/ehbotthud_turret.lua index 9499bff00..6274895b2 100644 --- a/Units/ehbot/turret/ehbotthud_turret.lua +++ b/Units/ehbot/turret/ehbotthud_turret.lua @@ -13,7 +13,7 @@ objectName = [[ehbotthud_turret.s3o]] script = [[ehbotthud_turret_lus.lua]] tech = [[tech1]] -armortype = [[building]] +armortype = [[light]] supply = [[7]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/ehbotthud_turret_up1.lua b/Units/ehbot/turret/ehbotthud_turret_up1.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/ehbotthud_turret_up1.lua rename to Units/ehbot/turret/ehbotthud_turret_up1.lua index c1d974903..ee6207a0c 100644 --- a/Units/ehbot/turret/Upgrade 1/ehbotthud_turret_up1.lua +++ b/Units/ehbot/turret/ehbotthud_turret_up1.lua @@ -13,7 +13,7 @@ objectName = [[ehbotthud_turret.s3o]] script = [[ehbotthud_turret_lus.lua]] tech = [[tech1]] -armortype = [[building]] +armortype = [[light]] supply = [[7]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotthud_turret_up2.lua b/Units/ehbot/turret/ehbotthud_turret_up2.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotthud_turret_up2.lua rename to Units/ehbot/turret/ehbotthud_turret_up2.lua index be97e7356..c9068b1a2 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/ehbotthud_turret_up2.lua +++ b/Units/ehbot/turret/ehbotthud_turret_up2.lua @@ -13,7 +13,7 @@ objectName = [[ehbotthud_turret.s3o]] script = [[ehbotthud_turret_lus.lua]] tech = [[tech1]] -armortype = [[building]] +armortype = [[light]] supply = [[7]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") diff --git a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotthud_turret_up3.lua b/Units/ehbot/turret/ehbotthud_turret_up3.lua similarity index 96% rename from Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotthud_turret_up3.lua rename to Units/ehbot/turret/ehbotthud_turret_up3.lua index 1498f3844..a0ff7abba 100644 --- a/Units/ehbot/turret/Upgrade 1/Upgrade 2/Upgrade 3/ehbotthud_turret_up3.lua +++ b/Units/ehbot/turret/ehbotthud_turret_up3.lua @@ -13,7 +13,7 @@ objectName = [[ehbotthud_turret.s3o]] script = [[ehbotthud_turret_lus.lua]] tech = [[tech1]] -armortype = [[building]] +armortype = [[light]] supply = [[7]] VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") diff --git a/Units/ehbot/mobile/ehbotengineer.lua b/Units/ehbotengineer.lua similarity index 88% rename from Units/ehbot/mobile/ehbotengineer.lua rename to Units/ehbotengineer.lua index c5ad8a90e..1fabe17d4 100644 --- a/Units/ehbot/mobile/ehbotengineer.lua +++ b/Units/ehbotengineer.lua @@ -7,7 +7,7 @@ local unitName = "ehbotengineer" local buildCostMetal = 40 local maxDamage = 400 -local buildDistance = 800 +local buildDistance = 350 local armortype = [[light]] --local supply = [[2]] @@ -39,7 +39,7 @@ local unitDef = { canHover = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "LIGHT NOTAIR SUPPORT", description = [[Builds Units]], @@ -47,8 +47,8 @@ local unitDef = { energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericGreen", - footprintX = 6, - footprintZ = 6, + footprintX = 2, + footprintZ = 2, iconType = "engineer", idleAutoHeal = .5, idleTime = 2200, @@ -60,7 +60,7 @@ local unitDef = { maxWaterDepth = 10, metalmake = 0, metalStorage = 0, - movementClass = "HOVERHBOT6", + movementClass = "HOVERHBOT2", moveState = "2", name = "The Lifter", objectName = "ehbotengineer2.s3o", @@ -82,9 +82,9 @@ local unitDef = { upright = true, workerTime = 1, capturespeed = 1, - TerraformSpeed = 100000, + TerraformSpeed = 2147000, ReclaimSpeed = 0, - repairspeed = 0.15625, + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -93,7 +93,7 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -110,17 +110,16 @@ local unitDef = { customParams = { unittype = "mobile", area_mex_def = "emetalextractor", + ProvideTech = [[tech0]], canbetransported = "true", needed_cover = 1, death_sounds = "generic", armortype = armortype, + noenergycost = true, -- supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype .. [[ - -Moving an Engineer in proximity to a Energy Core will spawn a small gunship drone from that core.]], + factionname = "ateran", }, } diff --git a/Units/ehbot/turret/ehbotengineer_turret.lua b/Units/ehbotengineer_turret.lua similarity index 86% rename from Units/ehbot/turret/ehbotengineer_turret.lua rename to Units/ehbotengineer_turret.lua index 45afbb89a..cbff6d4e9 100644 --- a/Units/ehbot/turret/ehbotengineer_turret.lua +++ b/Units/ehbotengineer_turret.lua @@ -6,10 +6,10 @@ local unitName = "ehbotengineer_turret" -------------------------------------------------------------------------------- local buildCostMetal = 90 -local maxDamage = 400 * 4 -local buildDistance = 1500 +local maxDamage = 400 +local buildDistance = 800 -local armortype = [[building]] +local armortype = [[light]] --local supply = [[2]] local unitDef = { @@ -33,22 +33,22 @@ local unitDef = { CanCapture = false, CanRepair = true, canRestore = false, - + cantBeTransported = true, canGuard = true, canHover = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, - category = "BUILDING NOTAIR SUPPORT", + category = "LIGHT NOTAIR SUPPORT", description = [[Builds Units]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "mediumExplosionGenericGreen", floater = true, - footprintX = 4, - footprintZ = 4, + footprintX = 2, + footprintZ = 2, iconType = "engineer", idleAutoHeal = .5, idleTime = 2200, @@ -60,7 +60,7 @@ local unitDef = { maxWaterDepth = 5000, metalmake = 0, metalStorage = 0, - movementClass = "HOVERHBOT4", + movementClass = "HOVERHBOT2", moveState = "0", pushResistant = true, name = "The Lifter Turret", @@ -85,7 +85,7 @@ local unitDef = { capturespeed = 1, TerraformSpeed = 100000, ReclaimSpeed = 0, - repairspeed = 0.15625, + repairspeed = 0.5, sfxtypes = { pieceExplosionGenerators = { "deathceg3", @@ -94,7 +94,7 @@ local unitDef = { explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", }, }, @@ -118,10 +118,6 @@ local unitDef = { -- supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype .. [[ - -Moving an Engineer in proximity to a Energy Core will spawn a small gunship drone from that core.]], }, } diff --git a/Units/ehover/eartytank.lua b/Units/ehover/eartytank.lua index fdf725820..6f312f6e3 100644 --- a/Units/ehover/eartytank.lua +++ b/Units/ehover/eartytank.lua @@ -12,7 +12,7 @@ humanName = "ShadowFury" objectName = "eartytank2.s3o" script = "eartytank2.cob" -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[8]] diff --git a/Units/ehover/eartytank_saturation.lua b/Units/ehover/eartytank_saturation.lua new file mode 100644 index 000000000..094936c25 --- /dev/null +++ b/Units/ehover/eartytank_saturation.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_saturation -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_saturation" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "HellFury" + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytanksaturation_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eartytank_saturation_up1.lua b/Units/ehover/eartytank_saturation_up1.lua new file mode 100644 index 000000000..b87fe493d --- /dev/null +++ b/Units/ehover/eartytank_saturation_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_saturation_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_saturation_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = "HellFury MK II" + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytanksaturation_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eartytank_saturation_up2.lua b/Units/ehover/eartytank_saturation_up2.lua new file mode 100644 index 000000000..7b66a81ae --- /dev/null +++ b/Units/ehover/eartytank_saturation_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_saturation_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_saturation_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = "HellFury MK III" + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytanksaturation_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eartytank_saturation_up3.lua b/Units/ehover/eartytank_saturation_up3.lua new file mode 100644 index 000000000..8e652a24c --- /dev/null +++ b/Units/ehover/eartytank_saturation_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_saturation_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_saturation_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = "HellFury MK IV" + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytanksaturation_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/upgrade1/eartytank_up1.lua b/Units/ehover/eartytank_up1.lua similarity index 100% rename from Units/ehover/upgrade1/eartytank_up1.lua rename to Units/ehover/eartytank_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/eartytank_up2.lua b/Units/ehover/eartytank_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/eartytank_up2.lua rename to Units/ehover/eartytank_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/eartytank_up3.lua b/Units/ehover/eartytank_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/eartytank_up3.lua rename to Units/ehover/eartytank_up3.lua diff --git a/Units/ehover/ebasefactory.lua b/Units/ehover/ebasefactory.lua index 443c2e966..13b4d3f97 100644 --- a/Units/ehover/ebasefactory.lua +++ b/Units/ehover/ebasefactory.lua @@ -5,7 +5,7 @@ unitName = "ebasefactory" -------------------------------------------------------------------------------- -buildCostMetal = 30 +buildCostMetal = 60 maxDamage = buildCostMetal * 12.5 humanName = "Hover Factory" diff --git a/Units/ehover/upgrade1/ebasefactory_up1.lua b/Units/ehover/ebasefactory_up1.lua similarity index 100% rename from Units/ehover/upgrade1/ebasefactory_up1.lua rename to Units/ehover/ebasefactory_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/ebasefactory_up2.lua b/Units/ehover/ebasefactory_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/ebasefactory_up2.lua rename to Units/ehover/ebasefactory_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/ebasefactory_up3.lua b/Units/ehover/ebasefactory_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/ebasefactory_up3.lua rename to Units/ehover/ebasefactory_up3.lua diff --git a/Units/ehover/upgrade1/eheavytank3_up1.lua b/Units/ehover/eheavytank3_up1.lua similarity index 100% rename from Units/ehover/upgrade1/eheavytank3_up1.lua rename to Units/ehover/eheavytank3_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/eheavytank3_up2.lua b/Units/ehover/eheavytank3_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/eheavytank3_up2.lua rename to Units/ehover/eheavytank3_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/eheavytank3_up3.lua b/Units/ehover/eheavytank3_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/eheavytank3_up3.lua rename to Units/ehover/eheavytank3_up3.lua diff --git a/Units/ehover/elacerator.lua b/Units/ehover/elacerator.lua index f50079a63..2253f2383 100644 --- a/Units/ehover/elacerator.lua +++ b/Units/ehover/elacerator.lua @@ -12,8 +12,7 @@ humanName = "Lacerator" objectName = "elacerator.s3o" script = "elacerator.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[25]] diff --git a/Units/ehover/upgrade1/elacerator_up1.lua b/Units/ehover/elacerator_up1.lua similarity index 91% rename from Units/ehover/upgrade1/elacerator_up1.lua rename to Units/ehover/elacerator_up1.lua index 74b6b2fc7..767964bc9 100644 --- a/Units/ehover/upgrade1/elacerator_up1.lua +++ b/Units/ehover/elacerator_up1.lua @@ -12,8 +12,7 @@ humanName = [[Lacerator Mark II]] objectName = "elacerator.s3o" script = "elacerator.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[25]] diff --git a/Units/ehover/upgrade1/upgrade2/elacerator_up2.lua b/Units/ehover/elacerator_up2.lua similarity index 91% rename from Units/ehover/upgrade1/upgrade2/elacerator_up2.lua rename to Units/ehover/elacerator_up2.lua index f4dcb4f22..0d8183d22 100644 --- a/Units/ehover/upgrade1/upgrade2/elacerator_up2.lua +++ b/Units/ehover/elacerator_up2.lua @@ -12,8 +12,7 @@ humanName = [[Lacerator Mark III]] objectName = "elacerator.s3o" script = "elacerator.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[25]] diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/elacerator_up3.lua b/Units/ehover/elacerator_up3.lua similarity index 91% rename from Units/ehover/upgrade1/upgrade2/upgrade3/elacerator_up3.lua rename to Units/ehover/elacerator_up3.lua index b695840fb..c4602eb27 100644 --- a/Units/ehover/upgrade1/upgrade2/upgrade3/elacerator_up3.lua +++ b/Units/ehover/elacerator_up3.lua @@ -12,8 +12,7 @@ humanName = [[Lacerator Mark IV]] objectName = "elacerator.s3o" script = "elacerator.cob" -techprovided = [[-1 endbringer]] -tech = [[tech3, 1 endbringer]] +tech = [[tech3]] armortype = [[armored]] --supply = [[25]] diff --git a/Units/ehover/elighttank3.lua b/Units/ehover/elighttank3.lua index 914617287..6acd89a19 100644 --- a/Units/ehover/elighttank3.lua +++ b/Units/ehover/elighttank3.lua @@ -12,7 +12,7 @@ humanName = [[Kite]] objectName = [[elighttank4.s3o]] script = [[elighttank3_lus.lua]] -tech = [[tech0]] +tech = [[tech1]] armortype = [[light]] supply = [[3]] diff --git a/Units/ehover/upgrade1/elighttank3_up1.lua b/Units/ehover/elighttank3_up1.lua similarity index 100% rename from Units/ehover/upgrade1/elighttank3_up1.lua rename to Units/ehover/elighttank3_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/elighttank3_up2.lua b/Units/ehover/elighttank3_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/elighttank3_up2.lua rename to Units/ehover/elighttank3_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/elighttank3_up3.lua b/Units/ehover/elighttank3_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/elighttank3_up3.lua rename to Units/ehover/elighttank3_up3.lua diff --git a/Units/ehover/upgrade1/emissiletank_up1.lua b/Units/ehover/emissiletank_up1.lua similarity index 100% rename from Units/ehover/upgrade1/emissiletank_up1.lua rename to Units/ehover/emissiletank_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/emissiletank_up2.lua b/Units/ehover/emissiletank_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/emissiletank_up2.lua rename to Units/ehover/emissiletank_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/emissiletank_up3.lua b/Units/ehover/emissiletank_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/emissiletank_up3.lua rename to Units/ehover/emissiletank_up3.lua diff --git a/Units/ehover/eriottank2_shotgun.lua b/Units/ehover/eriottank2_shotgun.lua new file mode 100644 index 000000000..69fc63b7c --- /dev/null +++ b/Units/ehover/eriottank2_shotgun.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ERIOTTANK2_shotgun -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_shotgun" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Spas" + +objectName = "eriottank3.s3o" +script = "eriottank3.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + + +VFS.Include("units-configs-basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2_shotgun_up1.lua b/Units/ehover/eriottank2_shotgun_up1.lua new file mode 100644 index 000000000..da1e07cc0 --- /dev/null +++ b/Units/ehover/eriottank2_shotgun_up1.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ERIOTTANK2_shotgun_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_shotgun_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Spas Mark II]] + +objectName = "eriottank3.s3o" +script = "eriottank3.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + + +VFS.Include("units-configs-basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2_shotgun_up2.lua b/Units/ehover/eriottank2_shotgun_up2.lua new file mode 100644 index 000000000..948f56227 --- /dev/null +++ b/Units/ehover/eriottank2_shotgun_up2.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ERIOTTANK2_shotgun_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_shotgun_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Spas Mark III]] + +objectName = "eriottank3.s3o" +script = "eriottank3.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + + +VFS.Include("units-configs-basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2_shotgun_up3.lua b/Units/ehover/eriottank2_shotgun_up3.lua new file mode 100644 index 000000000..23edc2c5a --- /dev/null +++ b/Units/ehover/eriottank2_shotgun_up3.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ERIOTTANK2_shotgun_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_shotgun_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Spas Mark IV]] + +objectName = "eriottank3.s3o" +script = "eriottank3.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + + +VFS.Include("units-configs-basedefs/basedefs/hover/eriottank2_shotgun_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/upgrade1/eriottank2_up1.lua b/Units/ehover/eriottank2_up1.lua similarity index 100% rename from Units/ehover/upgrade1/eriottank2_up1.lua rename to Units/ehover/eriottank2_up1.lua diff --git a/Units/ehover/upgrade1/upgrade2/eriottank2_up2.lua b/Units/ehover/eriottank2_up2.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/eriottank2_up2.lua rename to Units/ehover/eriottank2_up2.lua diff --git a/Units/ehover/upgrade1/upgrade2/upgrade3/eriottank2_up3.lua b/Units/ehover/eriottank2_up3.lua similarity index 100% rename from Units/ehover/upgrade1/upgrade2/upgrade3/eriottank2_up3.lua rename to Units/ehover/eriottank2_up3.lua diff --git a/Units/ehover/unused/eaatank.lua b/Units/ehover/unused/eaatank.lua deleted file mode 100644 index 2167117d3..000000000 --- a/Units/ehover/unused/eaatank.lua +++ /dev/null @@ -1,197 +0,0 @@ --- UNITDEF -- EAATANK -- --------------------------------------------------------------------------------- - -unitName = "eaatank" - --------------------------------------------------------------------------------- - -tech = [[tech1]] -armortype = [[light]] -supply = [[5]] - -weapon1Damage = 105 -weapon1AOE = 50 -burstProjectiles = 4 -energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) * burstProjectiles - -function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - bmcode = "1", - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 28, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SUPPORT", - defaultmissiontype = "Standby", - description = [[Unit Type: Anti-Air Support Tank -Armortype: ]] ..armortype.. [[ - -105 Damage vs Armored -70 Damage vs Light/Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. tech .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGeneric", - firestandorders = "1", - footprintX = 4, - footprintZ = 4, - iconType = "aa", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 600, - maxSlope = 26, - maxVelocity = 2.9, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "HOVERTANK4", - name = "Paladin", - noAutoFire = false, - noChaseCategory = "VTOL AMPHIB NOTAIR SUPPORT", - objectName = "eaatank2.s3o", - script = "eaatank2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGeneric", - sightDistance = 750, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 2.9, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - tolerance = 1000, - unitname = "eaatank", - upright = true, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:dirt", - "custom:gdhcannon", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "eaatankantiairmissile", - onlyTargetCategory = "BIO VTOL", - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = tech, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - corpse = "energycore", - helptext = [[]], -}, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -weaponDefs = { -eaatankantiairmissile = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - burst = burstProjectiles, - burstrate = 0.5, - cegTag = "missiletrailaa", - canAttackGround = false, - edgeEffectiveness = 0.5, - explosionGenerator = "custom:BulletImpact3", - energypershot = energycosttofire, - fireStarter = 80, - impulseFactor = 0, - interceptedByShieldType = 4, - model = "missilesmall.s3o", - name = "AA Missile", - range = 1000, - reloadtime = 4, - weaponType = "MissileLauncher", - soundHit = "explosions/mediumcannonhit.wav", - soundStart = "weapons/missilefiring.wav", - tolerance = 3000, - turret = true, - startVelocity = 750, - acceleration = 2000, - weaponVelocity = 10000, - tracks = true, - turnrate = 100000, - flighttime = 2, - sprayangle = 5000, - - customParams = { - canbetransported = "true", - damagetype = "eaatank", - nofriendlyfire = 1, - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, -}, - -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/unused/ebomb.lua b/Units/ehover/unused/ebomb.lua deleted file mode 100644 index d7c7713c4..000000000 --- a/Units/ehover/unused/ebomb.lua +++ /dev/null @@ -1,163 +0,0 @@ --- UNITDEF -- EBOMB -- --------------------------------------------------------------------------------- - -unitName = "ebomb" - --------------------------------------------------------------------------------- - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 35, - builder = false, - buildTime = 5, - canAttack = true, - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR", - description = [[Hovering Bomb - Armored - 500 Damage vs Buildings - 250 Damage vs Light/Armored - - Requires +5 Power - Uses +5 Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "ebombboom", - footprintX = 3, - footprintZ = 3, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - kamikaze = true, - kamikazeDistance = 100, - leaveTracks = false, - maxDamage = 160, - maxSlope = 26, - maxVelocity = 10, - maxReverseVelocity = 5, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK3", - name = "Shellshock", - noChaseCategory = "VTOL", - objectName = "ebomb2.s3o", - script = "ebomb2.cob", - onlytargetcategory1 = "NOTAIR", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "ebombboom", - selfDestructCountdown = 0, - side = "CORE", - sightDistance = 175, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = false, - turnInPlace = true, - turnRate = 5000, - unitname = "ebomb", - upright = true, - workerTime = 0, - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - explosiongenerators = { - "custom:dirt", - }, - }, - - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "ebombboom", - onlyTargetCategoy = "BUILDING", - badTargetCategory = "WALL", - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = "5 Power", - armortype = "armored", - nofriendlyfire = "1", - supply_cost = 5, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - --------------------------------------------------------------------------------- - -weaponDefs = { - ebombboom = { - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - edgeeffectiveness = 0.5, - name ="hoverbomb", - weaponType = "Cannon", - - turret =1, - impulseFactor = 0, - range =100, - reloadtime =3.6, - weaponvelocity =250, - AreaOfEffect =1000, - soundstart ="explosions/unitexplodemedium.wav", - soundhit ="explosions/unitexplodemedium.wav", - explosiongenerator ="custom:ebombexpl", - customparams = { - damagetype = "ebomb", - nofriendlyfire = "true", - nofriendlyfire = "1", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - - damage = { - default = 500, - }, - }, -} -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/unused/eengineer5.lua b/Units/ehover/unused/eengineer5.lua deleted file mode 100644 index 2410fcd04..000000000 --- a/Units/ehover/unused/eengineer5.lua +++ /dev/null @@ -1,130 +0,0 @@ --- UNITDEF -- EENGINEER5 -- --------------------------------------------------------------------------------- - -unitName = "eengineer5" - --------------------------------------------------------------------------------- - -buildCostMetal = 40 -maxDamage = 600 - -armortype = [[light]] ---supply = [[2]] - - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = buildCostMetal, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canRestore = false, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - description = [[Builds Units]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 4, - footprintZ = 4, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = maxDamage, - maxSlope = 26, - maxVelocity = 3, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalmake = 0, - metalStorage = 0, - movementClass = "HOVERTANK4", - moveState = "2", - name = "The Erector", - objectName = "eengineer6.s3o", - script = "eengineer6.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = false, - side = "ARM", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 1020, - unitname = "eengineer5", - upright = true, - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - buildoptions = Shared.buildList, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - unittype = "mobile", - area_mex_def = "emetalextractor", - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - armortype = armortype, --- supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[Armortype: ]] .. armortype .. [[ - -Moving an Engineer in proximity to a Energy Core will spawn a small gunship drone from that core.]], - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/unused/efatso2.lua b/Units/ehover/unused/efatso2.lua deleted file mode 100644 index 133cda4a1..000000000 --- a/Units/ehover/unused/efatso2.lua +++ /dev/null @@ -1,170 +0,0 @@ --- UNITDEF -- EFATSO2 -- --------------------------------------------------------------------------------- - -unitName = "efatso2" - --------------------------------------------------------------------------------- - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 24, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR ASSAULT", - description = [[Armored Dedicated Anti-Base Tank - Armored - 350 Damage vs Building - 43.75 Damage vs Light/Armored - - This unit can only fire at buildings! - - Requires +10 Power - Uses +10 Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericWhite", - footprintX = 5, - footprintZ = 5, - iconType = "hover", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 2500, - maxSlope = 26, - maxVelocity = 2.5, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK5", - name = "Fatso", - noChaseCategory = "VTOL", - objectName = "efatso2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericWhite", - side = "CORE", - sightDistance = 800, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 2.2, - turnInPlace = true, - turnRate = 5000, - -- turnRate = 1000, - unitname = "efatso2", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "eheavyturretweapon", - onlyTargetCategory = "BIO BUILDING", - }, - [2] = { - def = "eheavyturretweapon", - onlyTargetCategory = "BIO BUILDING", - slaveTo = 1, - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 5, - death_sounds = "generic", - RequireTech = "5 Power", - armortype = "armored", - nofriendlyfire = "1", - supply_cost = 5, - normaltex = "unittextures/efatso2normal.png", - corpse = "energycore", - helptext = [[The Fatso is the pinnacle of anti-base technology. It has enough hitpoints to allow it to take a beating and keep barreling down upon base structures and defenses, however, this amazing power comes at a cost. It is incapable of properly defending itself as it's weapon is slow to recharge and it simply is too slow to outmaneuver skirmish units. Bring an escort.]], -}, -} - - --------------------------------------------------------------------------------- -weapon1Damage = 350 - -weaponDefs = { -eheavyturretweapon = { - - accuracy = 1, - AreaOfEffect = 1, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "factorysparks", - collideFriendly = false, - explosionGenerator = "custom:genericshellexplosion-medium-white", - energypershot = weapon1Damage / 20, - id = 71, - interceptedByShieldType = 4, - - impulseBoost = 0, - impulseFactor = 0, - name = "Plasma Cannon", - range = 750, - reloadtime = 1.25, - weaponType = "Cannon", - soundHit = "explosions/eturrethit.wav", - soundStart = "weapons/eturretfire.wav", - tolerance = 5000, - - turret = true, - weaponVelocity = 315, - customParams = { - canbetransported = "true", - damagetype = "efatso", - }, - damage = { - default = weapon1Damage, - }, -}, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/unused/eflametank.lua b/Units/ehover/unused/eflametank.lua deleted file mode 100644 index 62ae9d9aa..000000000 --- a/Units/ehover/unused/eflametank.lua +++ /dev/null @@ -1,172 +0,0 @@ --- UNITDEF -- EFLAMETANK -- --------------------------------------------------------------------------------- - -unitName = "eflametank" - --------------------------------------------------------------------------------- - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 25, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - description = [[Flamethrower Raider - Light - 200 Damage/s vs Buildings - 100 Damage/s vs Light/Armored - - Energy Drain: 12.5/s - - Requires +3 Power - Uses +3 Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericRed", - footprintX = 3, - footprintZ = 3, - iconType = "hover", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 400, - maxSlope = 26, - maxVelocity = 5, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK3", - name = "Firestorm", - noChaseCategory = "VTOL", - objectName = "eflametank.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericRed", - side = "CORE", - sightDistance = 750, - seismicDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 5, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 950, - unitname = "eflametank", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:dirt", - "custom:flamethrowerrange500", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "lightlaser", - onlyTargetCategory = "BIO NOTAIR AMPHIB", - badTargetCategory = "ARMORED LIGHT WALL", - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = "3 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 3, - normaltex = "unittextures/eflametanknormal.png", - corpse = "energycore", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- -weapon1Damage = 25 - -weaponDefs = { - lightlaser = { - - accuracy = 0, - AreaOfEffect = 1, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - explosionGenerator = "custom:burnblack", - coreThickness = 0, - duration = 1, - energypershot = weapon1Damage / 20, - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - soundstart = "weapons/flamethrower1.wav", - - minintensity = 1, - impulseFactor = 0, - name = "Something with Flames", - range = 500, - reloadtime = 0.1, - WeaponType = [[LaserCannon]], - rgbColor = "0 0 0", - rgbColor2 = "0 0 0", - thickness = 0, - tolerance = 1000, - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "eflametank", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/unused/emediumtank3.lua b/Units/ehover/unused/emediumtank3.lua deleted file mode 100644 index 010f55906..000000000 --- a/Units/ehover/unused/emediumtank3.lua +++ /dev/null @@ -1,162 +0,0 @@ --- UNITDEF -- EMEDIUMTANK3 -- --------------------------------------------------------------------------------- - -unitName = "emediumtank3" - --------------------------------------------------------------------------------- - -unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 27, - builder = false, - buildTime = 5, - canAttack = true, - - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SKIRMISHER", - description = [[Light Tank Destroyer - Light - 200 Damage vs Armored - 100 Damage vs Light/Building - - Requires +4 Power - Uses +4 supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGeneric", - footprintX = 3, - footprintZ = 3, - iconType = "hover", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 450, - maxSlope = 26, - maxVelocity = 4.0, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK3", - name = "Bruiser", - noChaseCategory = "VTOL", - objectName = "emediumtank3.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGeneric", - side = "CORE", - sightDistance = 600, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 4, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - unitname = "emediumtank3", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "other/unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "mediumtankcannon", - onlyTargetCategory = "BIO NOTAIR AMPHIB", - badTargetCategory = "BUILDING LIGHT WALL", - }, - }, - customParams = { - unittype = "mobile", - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = "4 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 4, - normaltex = "unittextures/emediumtank3normal.png", - corpse = "energycore", - helptext = [[The brusier is a lightly armored tank destroyer, excellent versus raiders and other light units. Pair with light raiders and heavy tank destroyers for best results. - - It's description is a bit deceptive if you read it incorrectly. In truth, it decimates armored units. It is moderately effective vs light units and buildings.]], -}, -} - - --------------------------------------------------------------------------------- -weapon1Damage = 200 - -weaponDefs = { -mediumtankcannon = { - - AreaOfEffect = 1, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "bruisercannon", - explosionGenerator = "custom:genericshellexplosion-small", - energypershot = weapon1Damage / 20, - id = 51, - interceptedByShieldType = 4, - impulseFactor = 0, - name = "Light Cannon", - range = 600, - reloadtime = 1.0, - weaponType = "Cannon", - soundHit = "explosions/mediumcannonhit.wav", - soundStart = "weapons/bruisercannon.wav", - - turret = true, - weaponVelocity = 400, - customParams = { - canbetransported = "true", - damagetype = "emediumtank3", - }, - damage = { - default = weapon1Damage, - }, -}, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/energycore.lua b/Units/energycore.lua index df2b242ec..1712b2c5e 100644 --- a/Units/energycore.lua +++ b/Units/energycore.lua @@ -6,9 +6,9 @@ local unitDef = { buildCostMetal = 5, buildTime = 5, description = [[Energy Core - � Can be reclaimed for 5 Metal and 5 Energy by moving an O.R.B. in range + � Can be reclaimed for 5 Metal and 5 Energy by moving an O.R.B. in range - � Can be converted to MidKnight Gunship Drone by moving a B.O.X. in range + � Can be converted to MidKnight Gunship Drone by moving a B.O.X. in range ]], objectName = "ammobox2.s3o", -- for christmas: 'xmasball.3so' script = 'energycore.lua', -- for christmas: 'xmasball.lua' diff --git a/Units/eorb.lua b/Units/eorb.lua index 5c18f6456..5f332034d 100644 --- a/Units/eorb.lua +++ b/Units/eorb.lua @@ -6,13 +6,13 @@ unitName = [[eorb]] isUpgraded = [[0]] -humanName = [[O.R.B. MK I]] +humanName = [[O.R.B.]] objectName = [[eorb4.s3o]] script = [[eorb3.cob]] -workerTime = 0.5 -buildDistance = 500 +workerTime = 1 +buildDistance = 350 tech = [[tech0]] armortype = [[light]] diff --git a/Units/eorb_up1.lua b/Units/eorb_up1.lua index e26949bbc..4be7a1e61 100644 --- a/Units/eorb_up1.lua +++ b/Units/eorb_up1.lua @@ -11,8 +11,8 @@ humanName = [[O.R.B. MK II]] objectName = [[eorb4.s3o]] script = [[eorb3.cob]] -workerTime = 1 -buildDistance = 600 +workerTime = 1.33 +buildDistance = 800 tech = [[tech0]] armortype = [[light]] diff --git a/Units/eorb_up2.lua b/Units/eorb_up2.lua index dc3afcdd0..b0c24e410 100644 --- a/Units/eorb_up2.lua +++ b/Units/eorb_up2.lua @@ -11,8 +11,8 @@ humanName = [[O.R.B. MK III]] objectName = [[eorb4.s3o]] script = [[eorb3.cob]] -workerTime = 1.5 -buildDistance = 700 +workerTime = 1.66 +buildDistance = 800 tech = [[tech0]] armortype = [[light]] diff --git a/Units/lootboxes/lootboxbronze.lua b/Units/lootboxes/lootboxbronze.lua new file mode 100644 index 000000000..92d38eee2 --- /dev/null +++ b/Units/lootboxes/lootboxbronze.lua @@ -0,0 +1,71 @@ +return { + lootboxbronze = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1, + brakerate = 0, + buildcostenergy = 25000, + buildcostmetal = 375, + buildtime = 5000, + canfight = false, + canguard = false, + canhover = true, + canmove = false, + canpatrol = false, + canrepeat = false, + canselfdestruct = false, + canstop = false, + cantbetransported = false, + capturable = true, + category = "BUILDING", + + description = "Bronze Lootbox: While you maintain control of it, this lootbox will provide extra resources.", + energymake = 20, + explodeas = "lootboxExplosion1", + floater = true, + footprintx = 3, + footprintz = 3, + icontype = "lootbox", + idleautoheal = 10, + idletime = 1800, + levelground = false, + mass = 4000, + maxdamage = 3000, + maxslope = 10, + maxvelocity = 0.00000001, + maxwaterdepth = 0, + metalmake = 1, + movestate = 0, + name = "Lootbox", + noautofire = false, + objectname = "lootboxes/lootbox3x3.s3o", + pushResistant = true, + script = "lootboxes/lootboxgold.cob", + seismicsignature = 0, + selfdestructas = "lootboxExplosion1", + selfdestructcountdown = 9, + sightdistance = 96, + transportbyenemy = true, + turninplace = false, + turnrate = 0, + unitname = "lootboxgold", + upright = true, + usebuildinggrounddecal = true, + --waterline = 0, + yardmap = "ooo ooo ooo", + customparams = { + normaltex = "unittextures/bfaction_normals.dds", + subfolder = "other/lootboxes", + }, + sfxtypes = { + explosiongenerators = { + [1] = "custom:LootboxLightGold", + [2] = "custom:LootboxBeaconBronze", + }, + pieceexplosiongenerators = { + [1] = "deathceg3", + [2] = "deathceg4", + }, + }, + }, +} diff --git a/Units/lootboxes/lootboxgold.lua b/Units/lootboxes/lootboxgold.lua new file mode 100644 index 000000000..6c354fc00 --- /dev/null +++ b/Units/lootboxes/lootboxgold.lua @@ -0,0 +1,70 @@ +return { + lootboxgold = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1, + brakerate = 1, + buildcostenergy = 25000, + buildcostmetal = 1500, + buildtime = 5000, + canfight = false, + canguard = false, + canmove = false, + canpatrol = false, + canrepeat = false, + canselfdestruct = false, + canstop = false, + cantbetransported = false, + capturable = true, + category = "BUILDING", + + description = "Gold Lootbox: While you maintain control of it, this lootbox will provide extra resources.", + energymake = 40, + explodeas = "lootboxExplosion3", + floater = true, + footprintx = 5, + footprintz = 5, + icontype = "lootbox", + idleautoheal = 10, + idletime = 1800, + levelground = false, + mass = 4000, + maxdamage = 5000, + maxslope = 10, + maxvelocity = 0.00000001, + maxwaterdepth = 0, + metalmake = 3, + movestate = 0, + name = "Lootbox", + noautofire = false, + objectname = "lootboxes/lootbox5x5.s3o", + pushResistant = true, + script = "lootboxes/lootboxgold.cob", + seismicsignature = 0, + selfdestructas = "lootboxExplosion3", + selfdestructcountdown = 9, + sightdistance = 96, + transportbyenemy = true, + turninplace = false, + turnrate = 0, + unitname = "lootboxgold", + upright = true, + usebuildinggrounddecal = true, + --waterline = 0, + yardmap = "ooooo ooooo ooooo ooooo ooooo", + customparams = { + normaltex = "unittextures/bfaction_normals.dds", + subfolder = "other/lootboxes", + }, + sfxtypes = { + explosiongenerators = { + [1] = "custom:LootboxLightGold", + [2] = "custom:LootboxBeaconGold", + }, + pieceexplosiongenerators = { + [1] = "deathceg3", + [2] = "deathceg4", + }, + }, + }, +} diff --git a/Units/lootboxes/lootboxplatinum.lua b/Units/lootboxes/lootboxplatinum.lua new file mode 100644 index 000000000..6594c8633 --- /dev/null +++ b/Units/lootboxes/lootboxplatinum.lua @@ -0,0 +1,70 @@ +return { + lootboxplatinum = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1, + brakerate = 1, + buildcostenergy = 25000, + buildcostmetal = 2500, + buildtime = 5000, + canfight = false, + canguard = false, + canmove = false, + canpatrol = false, + canrepeat = false, + canselfdestruct = false, + canstop = false, + cantbetransported = false, + capturable = true, + category = "BUILDING", + + description = "Platinum Lootbox: While you maintain control of it, this lootbox will provide extra resources.", + energymake = 80, + explodeas = "lootboxExplosion4", + floater = true, + footprintx = 6, + footprintz = 6, + icontype = "lootbox", + idleautoheal = 10, + idletime = 1800, + levelground = false, + mass = 4000, + maxdamage = 6000, + maxslope = 10, + maxvelocity = 0.00000001, + maxwaterdepth = 0, + metalmake = 4, + movestate = 0, + name = "Lootbox", + noautofire = false, + objectname = "lootboxes/lootbox6x6.s3o", + pushResistant = true, + script = "lootboxes/lootboxgold.cob", + seismicsignature = 0, + selfdestructas = "lootboxExplosion4", + selfdestructcountdown = 9, + sightdistance = 96, + transportbyenemy = true, + turninplace = false, + turnrate = 0, + unitname = "lootboxgold", + upright = true, + usebuildinggrounddecal = true, + --waterline = 0, + yardmap = "oooooo oooooo oooooo oooooo oooooo oooooo", + customparams = { + normaltex = "unittextures/bfaction_normals.dds", + subfolder = "other/lootboxes", + }, + sfxtypes = { + explosiongenerators = { + [1] = "custom:LootboxLightGold", + [2] = "custom:LootboxBeaconPlatinum", + }, + pieceexplosiongenerators = { + [1] = "deathceg3", + [2] = "deathceg4", + }, + }, + }, +} diff --git a/Units/lootboxes/lootboxsilver.lua b/Units/lootboxes/lootboxsilver.lua new file mode 100644 index 000000000..7f285116a --- /dev/null +++ b/Units/lootboxes/lootboxsilver.lua @@ -0,0 +1,70 @@ +return { + lootboxsilver = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1, + brakerate = 1, + buildcostenergy = 25000, + buildcostmetal = 750, + buildtime = 5000, + canfight = false, + canguard = false, + canmove = false, + canpatrol = false, + canrepeat = false, + canselfdestruct = false, + canstop = false, + cantbetransported = false, + capturable = true, + category = "BUILDING", + + description = "Silver Lootbox: While you maintain control of it, this lootbox will provide extra resources.", + energymake = 30, + explodeas = "lootboxExplosion2", + floater = true, + footprintx = 4, + footprintz = 4, + icontype = "lootbox", + idleautoheal = 10, + idletime = 1800, + levelground = false, + mass = 4000, + maxdamage = 4000, + maxslope = 10, + maxvelocity = 0.00000001, + maxwaterdepth = 0, + metalmake = 2, + movestate = 0, + name = "Lootbox", + noautofire = false, + objectname = "lootboxes/lootbox4x4.s3o", + pushResistant = true, + script = "lootboxes/lootboxgold.cob", + seismicsignature = 0, + selfdestructas = "lootboxExplosion2", + selfdestructcountdown = 9, + sightdistance = 96, + transportbyenemy = true, + turninplace = false, + turnrate = 0, + unitname = "lootboxgold", + upright = true, + usebuildinggrounddecal = true, + --waterline = 0, + yardmap = "oooo oooo oooo oooo", + customparams = { + normaltex = "unittextures/bfaction_normals.dds", + subfolder = "other/lootboxes", + }, + sfxtypes = { + explosiongenerators = { + [1] = "custom:LootboxLightGold", + [2] = "custom:LootboxBeaconSilver", + }, + pieceexplosiongenerators = { + [1] = "deathceg3", + [2] = "deathceg4", + }, + }, + }, +} diff --git a/Units/lootboxes/lootdroppod_gold.lua b/Units/lootboxes/lootdroppod_gold.lua new file mode 100644 index 000000000..38f751846 --- /dev/null +++ b/Units/lootboxes/lootdroppod_gold.lua @@ -0,0 +1,110 @@ +return { + lootdroppod_gold = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1.8, + bmcode = "0", + brakerate = 0, + buildcostenergy = 25000, + buildcostmetal = 400, + builddistance = 90, + buildtime = 10500, + canmove = false, + capturable = false, + category = "ALL NOTLAND NOTSUB NOWEAPON NOTSHIP NOTAIR NOTHOVER SURFACE EMPABLE", + collisionvolumeoffsets = "0 0 0", + collisionvolumescales = "0 0 0", + collisionvolumetype = "box", + description = "Drops LOOT in your battle", + energystorage = 1000, + explodeas = "", + footprintx = 0, + footprintz = 0, + idleautoheal = 10, + idletime = 90, + levelground = false, + mass = 165.75, + maxdamage = 1800, + maxvelocity = 0, + name = "Lootbox Droppod", + noautofire = false, + objectname = "scavs/cube.s3o", + pushResistant = true, + radardistance = 900, + script = "scavs/droppod.cob", + seismicsignature = 4, + selfdestructas = "", + selfdestructcountdown = 0, + side = "ARM", + sightdistance = 450, + smoothanim = true, + tedclass = "ENERGY", + turninplace = true, + turninplaceanglelimit = 90, + turnrate = 0, + unitname = "lootdroppod_gold", + upright = false, + waterline = 0, + workertime = 1500, + yardmap = "", + customparams = { + isairbase = true, + normaltex = "unittextures/bfaction_normals.dds", + subfolder = "other/lootboxes", + }, + featuredefs = {}, + sfxtypes = { + explosiongenerators = { + [1] = "custom:dirtpoof", + }, + }, + weapondefs = { + weapon = { + alwaysvisible = true, + areaofeffect = 500, + avoidfriendly = 0, + cegtag = "lootbox-trail", + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0.3, + explosiongenerator = "custom:dirtpoof", + firestarter = 70, + flighttime = 800, + impulsefactor = 0.1, + interceptedbyshieldtype = 4, + metalpershot = 0, + --model = "Lootboxes/lootbox.s3o", + name = "Lootbox", + range = 59999, + reloadtime = 5, + rgbcolor = "0.95 0.78 0", + smoketrail = 1, + soundhit = "voice/scavengers/scavspawn", + startvelocity = 1, + targetborder = 0.75, + turret = 1, + weaponacceleration = 50, + weapontimer = 2, + weapontype = "MissileLauncher", + weaponvelocity = 100, + wobble = 50, + customparams = { + expl_light_color = "0.95 0.78 0", + expl_light_life_mult = 2.4, + expl_light_mult = 1.4, + expl_light_radius_mult = 1.6, + }, + damage = { + chicken = 1, + default = 1, + }, + }, + }, + weapons = { + [1] = { + def = "WEAPON", + }, + }, + }, +} diff --git a/Units/other/Scavengers/big/eamphibbuggybig.lua b/Units/other/Scavengers/big/eamphibbuggybig.lua new file mode 100644 index 000000000..2b019bcc5 --- /dev/null +++ b/Units/other/Scavengers/big/eamphibbuggybig.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBBUGGY -- +-------------------------------------------------------------------------------- + +unitName = "eamphibbuggybig" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = [[Big Snake]] + +objectName = "scavs/big/eamphibbuggy2big.s3o" +script = "eamphibbuggy_lus.lua" + +tech = [[tech3]] +armortype = [[light]] +supply = [[1]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibbuggy_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/other/Scavengers/boss/eallterranarchidboss.lua b/Units/other/Scavengers/boss/eallterranarchidboss.lua new file mode 100644 index 000000000..c75bd11d7 --- /dev/null +++ b/Units/other/Scavengers/boss/eallterranarchidboss.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterranarchid -- Anarchid -- +-------------------------------------------------------------------------------- + +unitName = "eallterranarchidboss" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = [[Mega Anarchid]] + +objectName = "scavs/boss/eallterranarchidboss.s3o" +script = "eallterranarchid.cob" + +tech = [[tech3]] +armortype = [[armored]] +--supply = [[35]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/other/Scavengers/boss/eamphiblevelerboss.lua b/Units/other/Scavengers/boss/eamphiblevelerboss.lua new file mode 100644 index 000000000..935b2d535 --- /dev/null +++ b/Units/other/Scavengers/boss/eamphiblevelerboss.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibleveler -- +-------------------------------------------------------------------------------- + +unitName = "eamphiblevelerboss" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = [[Mega Leveler]] + +objectName = "scavs/boss/eamphiblevelerboss.s3o" +script = "eamphibleveler.cob" + +tech = [[tech3]] +armortype = [[armored]] +--supply = [[30]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibleveler_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/other/Scavengers/boss/ehbotkargannethboss.lua b/Units/other/Scavengers/boss/ehbotkargannethboss.lua new file mode 100644 index 000000000..a4d3b9a0b --- /dev/null +++ b/Units/other/Scavengers/boss/ehbotkargannethboss.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth -- +-------------------------------------------------------------------------------- + +unitName = "ehbotkargannethboss" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = [[Mega Karganneth]] + +objectName = "scavs/boss/ehbotkargannethboss.s3o" +script = "ehbotkarganneth_lus.lua" + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/other/Scavengers/boss/ekrowboss.lua b/Units/other/Scavengers/boss/ekrowboss.lua new file mode 100644 index 000000000..c0249cb4f --- /dev/null +++ b/Units/other/Scavengers/boss/ekrowboss.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- EKROW -- +-------------------------------------------------------------------------------- + +unitName = "ekrowboss" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = [[Mega Krow]] + +objectName = "scavs/boss/ekrowboss.s3o" +script = "ekrow.cob" + + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/other/Scavengers/boss/elaceratorboss.lua b/Units/other/Scavengers/boss/elaceratorboss.lua new file mode 100644 index 000000000..ad169bac1 --- /dev/null +++ b/Units/other/Scavengers/boss/elaceratorboss.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- elacerator -- +-------------------------------------------------------------------------------- + +unitName = "elaceratorboss" + +-------------------------------------------------------------------------------- + +isUpgraded = [[boss]] + +humanName = "Mega Lacerator" + +objectName = "scavs/boss/elaceratorboss.s3o" +script = "elacerator.cob" + +tech = [[tech3]] +armortype = [[armored]] +--supply = [[25]] + +VFS.Include("units-configs-basedefs/basedefs/hover/elacerator_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/other/Scavengers/scavengerdroppod.lua b/Units/other/Scavengers/scavengerdroppod.lua new file mode 100644 index 000000000..c6e66f735 --- /dev/null +++ b/Units/other/Scavengers/scavengerdroppod.lua @@ -0,0 +1,112 @@ +return { + scavengerdroppod = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1.8, + bmcode = "0", + blocking = false, + brakerate = 0, + buildcostenergy = 25000, + buildcostmetal = 400, + builddistance = 90, + --builder = true, + --buildpic = "chickens/roost.PNG", + buildtime = 10500, + category = "ALL NOTLAND NOTSUB NOWEAPON NOTSHIP NOTAIR NOTHOVER SURFACE EMPABLE", + canmove = false, + capturable = false, + collisionvolumeoffsets = "0 0 0", + collisionvolumescales = "0 0 0", + collisionvolumetype = "box", + description = "Spawning droppod for Scavengers", + energystorage = 1000, + explodeas = "", + footprintx = 0, + footprintz = 0, + idleautoheal = 10, + idletime = 90, + levelground = false, + mass = 165.75, + maxdamage = 1800, + maxvelocity = 0, + name = "Scavenger Droppod", + noautofire = false, + objectname = "scavs/cube.s3o", + radardistance = 900, + script = "scavs/droppod.cob", + seismicsignature = 4, + selfdestructcountdown = 0, + selfdestructas = "", + side = "ARM", + sightdistance = 450, + smoothanim = true, + tedclass = "ENERGY", + turninplace = true, + turninplaceanglelimit = 90, + turnrate = 0, + unitname = "scavengerdroppod_scav", + upright = false, + waterline = 0, + workertime = 1500, + yardmap = "", + customparams = { + subfolder = "scavengers", + isairbase = true, + normaltex = "unittextures/Core_normal.dds", + }, + featuredefs = {}, + sfxtypes = { + explosiongenerators = { + [1] = "custom:dirtpoof", + }, + }, + weapondefs = { + weapon = { + alwaysVisible = true, + areaofeffect = 500, + avoidfriendly = 0, + cegtag = "scaspawn-trail", + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0.3, + explosiongenerator = "custom:dirtpoof", + firestarter = 70, + flighttime = 100, + impulsefactor = 0.1, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "scavs/scavbeacondroppod.s3o", + name = "Droppod", + range = 29999, + reloadtime = 5, + rgbcolor = "0.85 0 1", + smoketrail = 1, + soundhit = "voice/scavengers/scavspawn", + startvelocity = 1, + targetborder = 0.75, + turret = 1, + weaponacceleration = 1800, + weapontimer = 2, + weapontype = "MissileLauncher", + weaponvelocity = 1500, + wobble = 50, + customparams = { + expl_light_color = "0.85 0.10 1", + expl_light_life_mult = 1.2, + expl_light_mult = 1.0, + expl_light_radius_mult = 1.0, + }, + damage = { + chicken = 0, + default = 0, + }, + }, + }, + weapons = { + [1] = { + def = "WEAPON", + }, + }, + }, +} diff --git a/Units/other/Scavengers/scavengerdroppodbeacon.lua b/Units/other/Scavengers/scavengerdroppodbeacon.lua new file mode 100644 index 000000000..d4d366663 --- /dev/null +++ b/Units/other/Scavengers/scavengerdroppodbeacon.lua @@ -0,0 +1,123 @@ +return { + scavengerdroppodbeacon = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 10, + --bmcode = "0", + blocking = false, + brakerate = 0, + buildcostenergy = 25000, + buildcostmetal = 400, + builddistance = 90, + --builder = true, + --buildpic = "chickens/roost.PNG", + buildtime = 10500, + category = "BUILDING", + canmove = false, + canSelfDestruct = false, + capturable = false, + cantbetransported = false, + collisionvolumeoffsets = "0 0 0", + collisionvolumescales = "0 0 0", + collisionvolumetype = "box", + description = "Spawner", + energystorage = 1000, + explodeas = "mediumScavengerExplosionNuke", + footprintx = 10, + footprintz = 10, + idleautoheal = 10, + idletime = 90, + levelground = true, + mass = 165.75, + maxdamage = 2000, + maxvelocity = 0, + name = "Scavenger Spawn Beacon", + noautofire = false, + objectname = "scavs/scavbeacon.s3o", + radardistance = 0, + script = "scavs/beacon.cob", + seismicsignature = 4, + selfdestructcountdown = 1, + --selfdestructas = "ROOST_DEATH", + side = "ARM", + sightdistance = 0, + smoothanim = true, + tedclass = "ENERGY", + transportByEnemy = true, + turninplace = true, + turninplaceanglelimit = 90, + turnrate = 0, + unitname = "scavengerbeacon_scav", + upright = true, + waterline = 0, + workertime = 1500, + yardmap = "yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy yyyyyyyyyy", + -- + useGroundDecal = true, + BuildingGroundDecalType = "zgroundtexture2.dds", + BuildingGroundDecalSizeX = 18, + BuildingGroundDecalSizeY = 18, + BuildingGroundDecalDecaySpeed = 0.9, + -- + customparams = { + subfolder = "scavengers", + isairbase = true, + normaltex = "unittextures/scavbeacon_normals.dds", + armortype = "building", + }, + featuredefs = {}, + sfxtypes = { + explosiongenerators = { + [1] = "custom:PurpleLight", + }, + }, + weapondefs = { + weapon = { + alwaysVisible = true, + areaofeffect = 500, + avoidfriendly = 0, + cegtag = "scaspawn-trail", + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0.3, + explosiongenerator = "custom:genericshellexplosion", + firestarter = 70, + flighttime = 100, + impulsefactor = 0.1, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "scavs/scavbeacondroppod.s3o", + name = "Droppod", + range = 256, + reloadtime = 5, + rgbcolor = "1 0 0", + smoketrail = 1, + soundhit = "voice/scavengers/scavspawn", + startvelocity = 1, + targetborder = 0.75, + turret = 1, + weaponacceleration = 1800, + weapontimer = 2, + weapontype = "MissileLauncher", + weaponvelocity = 1500, + wobble = 50, + customparams = { + expl_light_color = "1 0 0", + expl_light_life_mult = 1.2, + expl_light_mult = 1.0, + expl_light_radius_mult = 1.0, + }, + damage = { + chicken = 0, + default = 0, + }, + }, + }, + weapons = { + [1] = { + def = "WEAPON", + }, + }, + }, +} diff --git a/Units/other/Scavengers/scavengerdroppodfriendly.lua b/Units/other/Scavengers/scavengerdroppodfriendly.lua new file mode 100644 index 000000000..041437357 --- /dev/null +++ b/Units/other/Scavengers/scavengerdroppodfriendly.lua @@ -0,0 +1,110 @@ +return { + scavengerdroppodfriendly = { + acceleration = 0, + activatewhenbuilt = true, + autoheal = 1.8, + blocking = false, + bmcode = "0", + brakerate = 0, + buildcostenergy = 25000, + buildcostmetal = 400, + builddistance = 90, + buildtime = 10500, + canmove = false, + capturable = false, + category = "ALL NOTLAND NOTSUB NOWEAPON NOTSHIP NOTAIR NOTHOVER SURFACE EMPABLE", + collisionvolumeoffsets = "0 0 0", + collisionvolumescales = "0 0 0", + collisionvolumetype = "box", + description = "Spawning droppod for reinforments", + energystorage = 1000, + explodeas = "", + footprintx = 0, + footprintz = 0, + idleautoheal = 10, + idletime = 90, + levelground = false, + mass = 165.75, + maxdamage = 1800, + maxvelocity = 0, + name = "Friendly Droppod", + noautofire = false, + objectname = "scavs/cube.s3o", + radardistance = 900, + script = "scavs/droppod.cob", + seismicsignature = 4, + selfdestructas = "", + selfdestructcountdown = 0, + side = "ARM", + sightdistance = 450, + smoothanim = true, + tedclass = "ENERGY", + turninplace = true, + turninplaceanglelimit = 90, + turnrate = 0, + unitname = "scavengerfriendlydroppod", + upright = false, + waterline = 0, + workertime = 1500, + yardmap = "", + customparams = { + isairbase = true, + normaltex = "unittextures/Core_normal.dds", + subfolder = "other/scavengers", + }, + featuredefs = {}, + sfxtypes = { + explosiongenerators = { + [1] = "custom:dirtpoof", + }, + }, + weapondefs = { + weapon = { + alwaysvisible = true, + areaofeffect = 500, + avoidfriendly = 0, + cegtag = "scaspawn-greentrail", + collidefriendly = 0, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0.3, + explosiongenerator = "custom:dirtpoof", + firestarter = 70, + flighttime = 250, + impulsefactor = 0.1, + interceptedbyshieldtype = 4, + metalpershot = 0, + model = "scavs/scavbeacondroppod.s3o", + name = "Droppod", + range = 29999, + reloadtime = 5, + rgbcolor = "0 1 0", + smoketrail = 1, + soundhit = "voice/scavengers/scavspawn", + startvelocity = 1, + targetborder = 0.75, + turret = 1, + weaponacceleration = 450, + weapontimer = 2, + weapontype = "MissileLauncher", + weaponvelocity = 900, + wobble = 50, + customparams = { + expl_light_color = "0.1 0.95 0.1", + expl_light_life_mult = 1.1, + expl_light_mult = 0.65, + expl_light_radius_mult = 0.5, + }, + damage = { + chicken = 0, + default = 0, + }, + }, + }, + weapons = { + [1] = { + def = "WEAPON", + }, + }, + }, +} diff --git a/Units/zaal/buildings/zarm.lua b/Units/zaal/buildings/zarm.lua new file mode 100644 index 000000000..facba73af --- /dev/null +++ b/Units/zaal/buildings/zarm.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zarm -- +-------------------------------------------------------------------------------- + +unitName = "zarm" + +-------------------------------------------------------------------------------- + +buildDistance = 65000 + +humanName = "Arm" + +objectName = "zaal/zarm.s3o" +script = "zaal/zarm_lus.lua" + +armortype = [[building]] +techprovided = [[tech0]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zarm_up1.lua b/Units/zaal/buildings/zarm_up1.lua new file mode 100644 index 000000000..bae284f90 --- /dev/null +++ b/Units/zaal/buildings/zarm_up1.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zarm_up1 -- +-------------------------------------------------------------------------------- + +unitName = "zarm_up1" + +-------------------------------------------------------------------------------- + +buildDistance = 65000 + +humanName = "Arm" + +objectName = "zaal/zarm.s3o" +script = "zaal/zarm_lus.lua" + +armortype = [[building]] +techprovided = [[tech0, tech1]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zarm_up2.lua b/Units/zaal/buildings/zarm_up2.lua new file mode 100644 index 000000000..384fbfbea --- /dev/null +++ b/Units/zaal/buildings/zarm_up2.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zarm_up2 -- +-------------------------------------------------------------------------------- + +unitName = "zarm_up2" + +-------------------------------------------------------------------------------- + +buildDistance = 65000 + +humanName = "Arm" + +objectName = "zaal/zarm.s3o" +script = "zaal/zarm_lus.lua" + +armortype = [[building]] +techprovided = [[tech0, tech1, tech2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zarm_up3.lua b/Units/zaal/buildings/zarm_up3.lua new file mode 100644 index 000000000..88fd3ca5e --- /dev/null +++ b/Units/zaal/buildings/zarm_up3.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zarm_up3 -- +-------------------------------------------------------------------------------- + +unitName = "zarm_up3" + +-------------------------------------------------------------------------------- + +buildDistance = 65000 + +humanName = "Arm" + +objectName = "zaal/zarm.s3o" +script = "zaal/zarm_lus.lua" + +armortype = [[building]] +techprovided = [[tech0, tech1, tech2, tech3]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zespire1.lua b/Units/zaal/buildings/zespire1.lua new file mode 100644 index 000000000..aaf7b9497 --- /dev/null +++ b/Units/zaal/buildings/zespire1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zespire1 -- +-------------------------------------------------------------------------------- + +unitName = "zespire1" + +-------------------------------------------------------------------------------- +buildCostMetal = 50 + +supplygranted = 0 +energyMake = 5 + +humanName = "Basic Energy Spire" + +objectName = "zaal/zespire1.s3o" +script = "zaal/zespire1.cob" + +armortype = [[building]] +tech = [[tech0]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zespire1_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zespire4.lua b/Units/zaal/buildings/zespire4.lua new file mode 100644 index 000000000..46630de60 --- /dev/null +++ b/Units/zaal/buildings/zespire4.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zespire4 -- +-------------------------------------------------------------------------------- + +unitName = "zespire4" + +-------------------------------------------------------------------------------- +buildCostMetal = 200 + +supplygranted = 0 +energyMake = 20 + +humanName = "Budding Energy Spire" + +objectName = "zaal/zespire4.s3o" +script = "zaal/zespire1.cob" + +armortype = [[building]] +tech = [[tech2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zespire1_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zespire5.lua b/Units/zaal/buildings/zespire5.lua new file mode 100644 index 000000000..5a6d788c7 --- /dev/null +++ b/Units/zaal/buildings/zespire5.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zespire5 -- +-------------------------------------------------------------------------------- + +unitName = "zespire5" + +-------------------------------------------------------------------------------- +buildCostMetal = 400 + +supplygranted = 0 +energyMake = 40 + +humanName = "Mature Energy Spire" + +objectName = "zaal/zespire5.s3o" +script = "zaal/zespire1.cob" + +armortype = [[building]] +tech = [[tech3]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zespire1_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/zhatch.lua b/Units/zaal/buildings/zhatch.lua new file mode 100644 index 000000000..4f63f7aec --- /dev/null +++ b/Units/zaal/buildings/zhatch.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ZHATCH -- +-------------------------------------------------------------------------------- + +unitName = [[zhatch]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 1 + +buildCostMetal = 50 + +humanName = [[Zaal Hatchery]] + +objectName = [[zaal/zfactory_up2.s3o]] +script = [[zaal/zfactory.cob]] + +--techprovided = [[tech1, tech0]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zhive_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/zhatch_up1.lua b/Units/zaal/buildings/zhatch_up1.lua new file mode 100644 index 000000000..eb3eba689 --- /dev/null +++ b/Units/zaal/buildings/zhatch_up1.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ZHATCH_UP1 -- +-------------------------------------------------------------------------------- + +unitName = [[zhatch_up1]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 1 + +buildCostMetal = 150 + +humanName = [[Zaal Lair]] + +objectName = [[zaal/zfactory_up1.s3o]] +script = [[zaal/zfactory.cob]] + +techprovided = [[tech2, tech1, tech0]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zhive_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) \ No newline at end of file diff --git a/Units/zaal/buildings/zhatch_up2.lua b/Units/zaal/buildings/zhatch_up2.lua new file mode 100644 index 000000000..f5496d73b --- /dev/null +++ b/Units/zaal/buildings/zhatch_up2.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ZHATCH_UP2 -- +-------------------------------------------------------------------------------- + +unitName = [[zhatch_up2]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 1 + +buildCostMetal = 300 + +humanName = [[Zaal Hive]] + +objectName = [[zaal/zfactory_up2.s3o]] +script = [[zaal/zfactory.cob]] + +techprovided = [[tech3, tech2, tech1, tech0]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zhive_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/zmex.lua b/Units/zaal/buildings/zmex.lua new file mode 100644 index 000000000..69687bb74 --- /dev/null +++ b/Units/zaal/buildings/zmex.lua @@ -0,0 +1,35 @@ +-- UNITDEF -- ZMEX -- +-------------------------------------------------------------------------------- + +unitName = [[zmex]] + +-------------------------------------------------------------------------------- + +zaalMexCost = Spring.GetModOptions().metalextractorcostzaal or 65 + +metalMultiplier = 1 + +energyUse = 0 + +buildCostMetal = zaalMexCost + +yardMap = [[oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo]] + +primaryCEG = "custom:fusionreactionnuclear-1color" + +humanName = [[Zaal Metal Extractor]] + +objectName = [[zaal/zmex.s3o]] +script = [[zaal/zmex.cob]] + +tech = [[tech0]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zmex_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/zmex_up1.lua b/Units/zaal/buildings/zmex_up1.lua new file mode 100644 index 000000000..f773f31a1 --- /dev/null +++ b/Units/zaal/buildings/zmex_up1.lua @@ -0,0 +1,31 @@ +-- UNITDEF -- ZMEX_UP1 -- +-------------------------------------------------------------------------------- + +unitName = [[zmex_up1]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 1.33 + +energyUse = 2 + +buildCostMetal = 100 + +primaryCEG = "custom:fusionreactionnuclear-2color" + +humanName = [[Zaal Metal Extractor Mk II]] + +objectName = [[zaal/zmex.s3o]] +script = [[zaal/zmex.cob]] + +tech = [[tech1]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zmex_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/zmex_up2.lua b/Units/zaal/buildings/zmex_up2.lua new file mode 100644 index 000000000..ca540f3d1 --- /dev/null +++ b/Units/zaal/buildings/zmex_up2.lua @@ -0,0 +1,31 @@ +-- UNITDEF -- ZMEX_UP2 -- +-------------------------------------------------------------------------------- + +unitName = [[zmex_up2]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 1.66 + +energyUse = 5 + +buildCostMetal = 150 + +primaryCEG = "custom:fusionreactionnuclear-3color" + +humanName = [[Zaal Metal Extractor Mk III]] + +objectName = [[zaal/zmex.s3o]] +script = [[zaal/zmex.cob]] + +tech = [[tech2]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zmex_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/zmex_up3.lua b/Units/zaal/buildings/zmex_up3.lua new file mode 100644 index 000000000..2a2af4d68 --- /dev/null +++ b/Units/zaal/buildings/zmex_up3.lua @@ -0,0 +1,31 @@ +-- UNITDEF -- ZMEX_UP3 -- +-------------------------------------------------------------------------------- + +unitName = [[zmex_up3]] + +-------------------------------------------------------------------------------- + +metalMultiplier = 2 + +energyUse = 10 + +buildCostMetal = 200 + +primaryCEG = "custom:fusionreactionnuclear-4color" + +humanName = [[Zaal Metal Extractor Mk IV]] + +objectName = [[zaal/zmex.s3o]] +script = [[zaal/zmex.cob]] + +tech = [[tech3]] +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zmex_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/zaal/buildings/ztenticle.lua b/Units/zaal/buildings/ztenticle.lua new file mode 100644 index 000000000..cf14bb942 --- /dev/null +++ b/Units/zaal/buildings/ztenticle.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ztenticle -- +-------------------------------------------------------------------------------- + +unitName = "ztenticle" + +-------------------------------------------------------------------------------- + +buildDistance = 65000 +buildCostMetal = 40 + +humanName = "Tenticle" + +objectName = "zaal/ztenticle.s3o" +script = "zaal/ztenticle_lus.lua" + +armortype = [[building]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/ztenticle_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/ztiberium.lua b/Units/zaal/buildings/ztiberium.lua new file mode 100644 index 000000000..865b81eaa --- /dev/null +++ b/Units/zaal/buildings/ztiberium.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- ztiberium -- +-------------------------------------------------------------------------------- + +unitName = "ztiberium" + +-------------------------------------------------------------------------------- +supplygranted = 25 +storage = 50 + +humanName = "Tiberium Supply/Storage" + +objectName = "zaal/ztiberium_small.s3o" +script = "zaal/ztiberium.cob" + +armortype = [[building]] +tech = [[tech0]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/ztiberium_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/buildings/ztumor.lua b/Units/zaal/buildings/ztumor.lua new file mode 100644 index 000000000..b6a3dc4db --- /dev/null +++ b/Units/zaal/buildings/ztumor.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ztumor -- +-------------------------------------------------------------------------------- + +unitName = "ztumor" + +-------------------------------------------------------------------------------- + +buildDistance = 1500 + +humanName = "Tumor" + +objectName = "zaal/ztumor.s3o" +script = "zaal/ztumor_lus.lua" + +armortype = [[building]] +--techprovided = [[tech0]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/ztumor_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/air/zairbomber.lua b/Units/zaal/units/air/zairbomber.lua new file mode 100644 index 000000000..7753d5bc8 --- /dev/null +++ b/Units/zaal/units/air/zairbomber.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- zairbomber -- +-------------------------------------------------------------------------------- + +unitName = "zairbomber" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Scourge]] + +objectName = "zaal/zairbomber.s3o" +script = "zaal/zairbomber.cob" + + +tech = [[tech2]] +armortype = [[air]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zairbomber_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/air/zairscout.lua b/Units/zaal/units/air/zairscout.lua new file mode 100644 index 000000000..82feebd2c --- /dev/null +++ b/Units/zaal/units/air/zairscout.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zairscout -- +-------------------------------------------------------------------------------- + +unitName = "zairscout" + +-------------------------------------------------------------------------------- + +humanName = [[Sparrow]] + +objectName = "zaal/zairscout.s3o" +script = "zaal/zairscout.cob" + +armortype = [[air]] + +tech = [[tech1]] + +supply = [[1]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zairscout_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/air/zairtoairfighter.lua b/Units/zaal/units/air/zairtoairfighter.lua new file mode 100644 index 000000000..2693e5a97 --- /dev/null +++ b/Units/zaal/units/air/zairtoairfighter.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- zairtoairfighter -- +-------------------------------------------------------------------------------- + +unitName = "zairtoairfighter" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Corruptor]] + +objectName = "zaal/zairtoairfighter.s3o" +script = "zaal/zairtoairfighter.cob" + + +tech = [[tech2]] +armortype = [[air]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zairtoairfighter_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/air/zairtogroundfighter.lua b/Units/zaal/units/air/zairtogroundfighter.lua new file mode 100644 index 000000000..22953d376 --- /dev/null +++ b/Units/zaal/units/air/zairtogroundfighter.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- zairtogroundfighter -- +-------------------------------------------------------------------------------- + +unitName = "zairtogroundfighter" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Mutalisk]] + +objectName = "zaal/zairtogroundfighter.s3o" +script = "zaal/zairtogroundfighter.cob" + + +tech = [[tech3]] +armortype = [[air]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zairtogroundfighter_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zarty.lua b/Units/zaal/units/land/zarty.lua new file mode 100644 index 000000000..1f06961b6 --- /dev/null +++ b/Units/zaal/units/land/zarty.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zarty -- +-------------------------------------------------------------------------------- + +unitName = "zarty" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Lurker" + +objectName = "zaal/zarty.s3o" +script = "zaal/zarty.cob" + +tech = [[tech3]] +armortype = [[armored]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zarty_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zassault.lua b/Units/zaal/units/land/zassault.lua new file mode 100644 index 000000000..c034b0837 --- /dev/null +++ b/Units/zaal/units/land/zassault.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zassault -- +-------------------------------------------------------------------------------- + +unitName = "zassault" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Ultralisk" + +objectName = "zaal/zassault.s3o" +script = "zaal/zassault.cob" + +tech = [[tech3]] +armortype = [[armored]] +supply = [[7]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zassault_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zconstructor.lua b/Units/zaal/units/land/zconstructor.lua new file mode 100644 index 000000000..41980f97c --- /dev/null +++ b/Units/zaal/units/land/zconstructor.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zconstructor -- +-------------------------------------------------------------------------------- + +unitName = "zconstructor" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +buildDistance = 400 + +humanName = "Worker Drone" + +objectName = "zaal/zkamikaze.s3o" +script = "zaal/zconstructor.cob" + +armortype = [[light]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zconstructor_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zkamikaze.lua b/Units/zaal/units/land/zkamikaze.lua new file mode 100644 index 000000000..fec2ffdce --- /dev/null +++ b/Units/zaal/units/land/zkamikaze.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zkamikaze -- +-------------------------------------------------------------------------------- + +unitName = "zkamikaze" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Kamikaze" + +objectName = "zaal/zkamikaze.s3o" +script = "zaal/zkamikaze.cob" + +tech = [[tech3]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zkamikaze_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zlightswarm.lua b/Units/zaal/units/land/zlightswarm.lua new file mode 100644 index 000000000..3f9b9ec2f --- /dev/null +++ b/Units/zaal/units/land/zlightswarm.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zlightswarm -- +-------------------------------------------------------------------------------- + +unitName = "zlightswarm" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "ZaalLing" + +objectName = "zaal/zlightswarm.s3o" +script = "zaal/zlightswarm.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zlightswarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zmedswarm.lua b/Units/zaal/units/land/zmedswarm.lua new file mode 100644 index 000000000..01c7a1701 --- /dev/null +++ b/Units/zaal/units/land/zmedswarm.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zmedswarm -- +-------------------------------------------------------------------------------- + +unitName = "zmedswarm" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Roach" + +objectName = "zaal/zmedswarm.s3o" +script = "zaal/zmedswarm.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zmedswarm_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zpyro.lua b/Units/zaal/units/land/zpyro.lua new file mode 100644 index 000000000..3bbccb1f3 --- /dev/null +++ b/Units/zaal/units/land/zpyro.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- zpyro -- +-------------------------------------------------------------------------------- + +unitName = "zpyro" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Trike" + +objectName = "zaal/zpyro.s3o" +script = "zaal/zpyro.cob" + +tech = [[tech1]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zpyro_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zqueen.lua b/Units/zaal/units/land/zqueen.lua new file mode 100644 index 000000000..39263f0d6 --- /dev/null +++ b/Units/zaal/units/land/zqueen.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- zqueen -- +-------------------------------------------------------------------------------- + +unitName = "zqueen" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Queen" + +objectName = "zaal/zqueen.s3o" +script = "zaal/zqueen.cob" + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zqueen_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/zaal/units/land/zskirmisher.lua b/Units/zaal/units/land/zskirmisher.lua new file mode 100644 index 000000000..b2e581675 --- /dev/null +++ b/Units/zaal/units/land/zskirmisher.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ZSKIRMISHER -- +-------------------------------------------------------------------------------- + +unitName = "zskirmisher" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = "Ravager" + +objectName = "zaal/zskirmisher.s3o" +script = "zaal/zskirmisher.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[6]] + +VFS.Include("units-configs-basedefs/basedefs/zaal/zskirmisher_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/UnitTextures/Editor_Daemon.dds b/UnusedUnittextures/Editor_Daemon.dds similarity index 100% rename from UnitTextures/Editor_Daemon.dds rename to UnusedUnittextures/Editor_Daemon.dds diff --git a/UnitTextures/Editor_Daemon_ColorAlpha.dds b/UnusedUnittextures/Editor_Daemon_ColorAlpha.dds similarity index 100% rename from UnitTextures/Editor_Daemon_ColorAlpha.dds rename to UnusedUnittextures/Editor_Daemon_ColorAlpha.dds diff --git a/UnitTextures/amphibfactdecal - Copy.png b/UnusedUnittextures/amphibfactdecal - Copy.png similarity index 100% rename from UnitTextures/amphibfactdecal - Copy.png rename to UnusedUnittextures/amphibfactdecal - Copy.png diff --git a/UnitTextures/amphibfactdecal.png b/UnusedUnittextures/amphibfactdecal.png similarity index 100% rename from UnitTextures/amphibfactdecal.png rename to UnusedUnittextures/amphibfactdecal.png diff --git a/UnitTextures/armregskin.png b/UnusedUnittextures/armregskin.png similarity index 100% rename from UnitTextures/armregskin.png rename to UnusedUnittextures/armregskin.png diff --git a/UnitTextures/armregskinglowy.png b/UnusedUnittextures/armregskinglowy.png similarity index 100% rename from UnitTextures/armregskinglowy.png rename to UnusedUnittextures/armregskinglowy.png diff --git a/UnitTextures/armregskinnormal.png b/UnusedUnittextures/armregskinnormal.png similarity index 100% rename from UnitTextures/armregskinnormal.png rename to UnusedUnittextures/armregskinnormal.png diff --git a/UnitTextures/backup legotex/lego2skin_explorer.png b/UnusedUnittextures/backup legotex/lego2skin_explorer.png similarity index 100% rename from UnitTextures/backup legotex/lego2skin_explorer.png rename to UnusedUnittextures/backup legotex/lego2skin_explorer.png diff --git a/UnitTextures/backup legotex/lego2skin_explorerglowy.png b/UnusedUnittextures/backup legotex/lego2skin_explorerglowy.png similarity index 100% rename from UnitTextures/backup legotex/lego2skin_explorerglowy.png rename to UnusedUnittextures/backup legotex/lego2skin_explorerglowy.png diff --git a/UnitTextures/backup legotex/lego2skin_explorernormal.png b/UnusedUnittextures/backup legotex/lego2skin_explorernormal.png similarity index 100% rename from UnitTextures/backup legotex/lego2skin_explorernormal.png rename to UnusedUnittextures/backup legotex/lego2skin_explorernormal.png diff --git a/UnitTextures/barricade.png b/UnusedUnittextures/barricade.png similarity index 100% rename from UnitTextures/barricade.png rename to UnusedUnittextures/barricade.png diff --git a/UnitTextures/barricadeglowy.png b/UnusedUnittextures/barricadeglowy.png similarity index 100% rename from UnitTextures/barricadeglowy.png rename to UnusedUnittextures/barricadeglowy.png diff --git a/UnitTextures/con_lego.png b/UnusedUnittextures/con_lego.png similarity index 100% rename from UnitTextures/con_lego.png rename to UnusedUnittextures/con_lego.png diff --git a/UnitTextures/con_legoglowy.png b/UnusedUnittextures/con_legoglowy.png similarity index 100% rename from UnitTextures/con_legoglowy.png rename to UnusedUnittextures/con_legoglowy.png diff --git a/UnitTextures/con_legonormal.png b/UnusedUnittextures/con_legonormal.png similarity index 100% rename from UnitTextures/con_legonormal.png rename to UnusedUnittextures/con_legonormal.png diff --git a/UnitTextures/eaatank.png b/UnusedUnittextures/eaatank.png similarity index 100% rename from UnitTextures/eaatank.png rename to UnusedUnittextures/eaatank.png diff --git a/UnitTextures/eaatankglowy.png b/UnusedUnittextures/eaatankglowy.png similarity index 100% rename from UnitTextures/eaatankglowy.png rename to UnusedUnittextures/eaatankglowy.png diff --git a/UnitTextures/eaatanknormal.png b/UnusedUnittextures/eaatanknormal.png similarity index 100% rename from UnitTextures/eaatanknormal.png rename to UnusedUnittextures/eaatanknormal.png diff --git a/UnitTextures/eaaturret.png b/UnusedUnittextures/eaaturret.png similarity index 100% rename from UnitTextures/eaaturret.png rename to UnusedUnittextures/eaaturret.png diff --git a/UnitTextures/eaaturret_aoplane.dds b/UnusedUnittextures/eaaturret_aoplane.dds similarity index 100% rename from UnitTextures/eaaturret_aoplane.dds rename to UnusedUnittextures/eaaturret_aoplane.dds diff --git a/UnitTextures/eaaturretglowy.png b/UnusedUnittextures/eaaturretglowy.png similarity index 100% rename from UnitTextures/eaaturretglowy.png rename to UnusedUnittextures/eaaturretglowy.png diff --git a/UnitTextures/eaaturretnormal.png b/UnusedUnittextures/eaaturretnormal.png similarity index 100% rename from UnitTextures/eaaturretnormal.png rename to UnusedUnittextures/eaaturretnormal.png diff --git a/UnitTextures/eairplant.png b/UnusedUnittextures/eairplant.png similarity index 100% rename from UnitTextures/eairplant.png rename to UnusedUnittextures/eairplant.png diff --git a/UnitTextures/eairplant_aoplane.dds b/UnusedUnittextures/eairplant_aoplane.dds similarity index 100% rename from UnitTextures/eairplant_aoplane.dds rename to UnusedUnittextures/eairplant_aoplane.dds diff --git a/UnitTextures/eairplantglowy.png b/UnusedUnittextures/eairplantglowy.png similarity index 100% rename from UnitTextures/eairplantglowy.png rename to UnusedUnittextures/eairplantglowy.png diff --git a/UnitTextures/eairplantnormal.png b/UnusedUnittextures/eairplantnormal.png similarity index 100% rename from UnitTextures/eairplantnormal.png rename to UnusedUnittextures/eairplantnormal.png diff --git a/UnitTextures/eallterrheavy.png b/UnusedUnittextures/eallterrheavy.png similarity index 100% rename from UnitTextures/eallterrheavy.png rename to UnusedUnittextures/eallterrheavy.png diff --git a/UnitTextures/eallterrheavyglowy.png b/UnusedUnittextures/eallterrheavyglowy.png similarity index 100% rename from UnitTextures/eallterrheavyglowy.png rename to UnusedUnittextures/eallterrheavyglowy.png diff --git a/UnitTextures/eallterrheavynormal.png b/UnusedUnittextures/eallterrheavynormal.png similarity index 100% rename from UnitTextures/eallterrheavynormal.png rename to UnusedUnittextures/eallterrheavynormal.png diff --git a/UnitTextures/eallterrlight.png b/UnusedUnittextures/eallterrlight.png similarity index 100% rename from UnitTextures/eallterrlight.png rename to UnusedUnittextures/eallterrlight.png diff --git a/UnitTextures/eallterrlightglowy.png b/UnusedUnittextures/eallterrlightglowy.png similarity index 100% rename from UnitTextures/eallterrlightglowy.png rename to UnusedUnittextures/eallterrlightglowy.png diff --git a/UnitTextures/eallterrlightnormal.png b/UnusedUnittextures/eallterrlightnormal.png similarity index 100% rename from UnitTextures/eallterrlightnormal.png rename to UnusedUnittextures/eallterrlightnormal.png diff --git a/UnitTextures/eallterrmed.png b/UnusedUnittextures/eallterrmed.png similarity index 100% rename from UnitTextures/eallterrmed.png rename to UnusedUnittextures/eallterrmed.png diff --git a/UnitTextures/eallterrmedglowy.png b/UnusedUnittextures/eallterrmedglowy.png similarity index 100% rename from UnitTextures/eallterrmedglowy.png rename to UnusedUnittextures/eallterrmedglowy.png diff --git a/UnitTextures/eallterrmednormal.png b/UnusedUnittextures/eallterrmednormal.png similarity index 100% rename from UnitTextures/eallterrmednormal.png rename to UnusedUnittextures/eallterrmednormal.png diff --git a/UnitTextures/eallterrriot.png b/UnusedUnittextures/eallterrriot.png similarity index 100% rename from UnitTextures/eallterrriot.png rename to UnusedUnittextures/eallterrriot.png diff --git a/UnitTextures/eallterrriotglowy.png b/UnusedUnittextures/eallterrriotglowy.png similarity index 100% rename from UnitTextures/eallterrriotglowy.png rename to UnusedUnittextures/eallterrriotglowy.png diff --git a/UnitTextures/eallterrriotnormal.png b/UnusedUnittextures/eallterrriotnormal.png similarity index 100% rename from UnitTextures/eallterrriotnormal.png rename to UnusedUnittextures/eallterrriotnormal.png diff --git a/UnitTextures/eamphibarty.png b/UnusedUnittextures/eamphibarty.png similarity index 100% rename from UnitTextures/eamphibarty.png rename to UnusedUnittextures/eamphibarty.png diff --git a/UnitTextures/eamphibartyglowy.png b/UnusedUnittextures/eamphibartyglowy.png similarity index 100% rename from UnitTextures/eamphibartyglowy.png rename to UnusedUnittextures/eamphibartyglowy.png diff --git a/UnitTextures/eamphibartynormal.png b/UnusedUnittextures/eamphibartynormal.png similarity index 100% rename from UnitTextures/eamphibartynormal.png rename to UnusedUnittextures/eamphibartynormal.png diff --git a/UnitTextures/eamphibbuggy.png b/UnusedUnittextures/eamphibbuggy.png similarity index 100% rename from UnitTextures/eamphibbuggy.png rename to UnusedUnittextures/eamphibbuggy.png diff --git a/UnitTextures/eamphibbuggyglowy.png b/UnusedUnittextures/eamphibbuggyglowy.png similarity index 100% rename from UnitTextures/eamphibbuggyglowy.png rename to UnusedUnittextures/eamphibbuggyglowy.png diff --git a/UnitTextures/eamphibbuggynormal.png b/UnusedUnittextures/eamphibbuggynormal.png similarity index 100% rename from UnitTextures/eamphibbuggynormal.png rename to UnusedUnittextures/eamphibbuggynormal.png diff --git a/UnitTextures/eamphibengineer.png b/UnusedUnittextures/eamphibengineer.png similarity index 100% rename from UnitTextures/eamphibengineer.png rename to UnusedUnittextures/eamphibengineer.png diff --git a/UnitTextures/eamphibengineerglowy.png b/UnusedUnittextures/eamphibengineerglowy.png similarity index 100% rename from UnitTextures/eamphibengineerglowy.png rename to UnusedUnittextures/eamphibengineerglowy.png diff --git a/UnitTextures/eamphibengineernormal.png b/UnusedUnittextures/eamphibengineernormal.png similarity index 100% rename from UnitTextures/eamphibengineernormal.png rename to UnusedUnittextures/eamphibengineernormal.png diff --git a/UnitTextures/eamphibfac.png b/UnusedUnittextures/eamphibfac.png similarity index 100% rename from UnitTextures/eamphibfac.png rename to UnusedUnittextures/eamphibfac.png diff --git a/UnitTextures/eamphibfac_aoplane.dds b/UnusedUnittextures/eamphibfac_aoplane.dds similarity index 100% rename from UnitTextures/eamphibfac_aoplane.dds rename to UnusedUnittextures/eamphibfac_aoplane.dds diff --git a/UnitTextures/eamphibfacglowy.png b/UnusedUnittextures/eamphibfacglowy.png similarity index 100% rename from UnitTextures/eamphibfacglowy.png rename to UnusedUnittextures/eamphibfacglowy.png diff --git a/UnitTextures/eamphibfacnormal.png b/UnusedUnittextures/eamphibfacnormal.png similarity index 100% rename from UnitTextures/eamphibfacnormal.png rename to UnusedUnittextures/eamphibfacnormal.png diff --git a/UnitTextures/eamphibmedtank.png b/UnusedUnittextures/eamphibmedtank.png similarity index 100% rename from UnitTextures/eamphibmedtank.png rename to UnusedUnittextures/eamphibmedtank.png diff --git a/UnitTextures/eamphibmedtankglowy.png b/UnusedUnittextures/eamphibmedtankglowy.png similarity index 100% rename from UnitTextures/eamphibmedtankglowy.png rename to UnusedUnittextures/eamphibmedtankglowy.png diff --git a/UnitTextures/eamphibmedtanknormal.png b/UnusedUnittextures/eamphibmedtanknormal.png similarity index 100% rename from UnitTextures/eamphibmedtanknormal.png rename to UnusedUnittextures/eamphibmedtanknormal.png diff --git a/UnitTextures/eamphibriot.png b/UnusedUnittextures/eamphibriot.png similarity index 100% rename from UnitTextures/eamphibriot.png rename to UnusedUnittextures/eamphibriot.png diff --git a/UnitTextures/eamphibriotglowy.png b/UnusedUnittextures/eamphibriotglowy.png similarity index 100% rename from UnitTextures/eamphibriotglowy.png rename to UnusedUnittextures/eamphibriotglowy.png diff --git a/UnitTextures/eamphibriotnormal.png b/UnusedUnittextures/eamphibriotnormal.png similarity index 100% rename from UnitTextures/eamphibriotnormal.png rename to UnusedUnittextures/eamphibriotnormal.png diff --git a/UnitTextures/eamphibrock.png b/UnusedUnittextures/eamphibrock.png similarity index 100% rename from UnitTextures/eamphibrock.png rename to UnusedUnittextures/eamphibrock.png diff --git a/UnitTextures/eamphibrockglowy.png b/UnusedUnittextures/eamphibrockglowy.png similarity index 100% rename from UnitTextures/eamphibrockglowy.png rename to UnusedUnittextures/eamphibrockglowy.png diff --git a/UnitTextures/eamphibrocknormal.png b/UnusedUnittextures/eamphibrocknormal.png similarity index 100% rename from UnitTextures/eamphibrocknormal.png rename to UnusedUnittextures/eamphibrocknormal.png diff --git a/UnitTextures/eartytank.png b/UnusedUnittextures/eartytank.png similarity index 100% rename from UnitTextures/eartytank.png rename to UnusedUnittextures/eartytank.png diff --git a/UnitTextures/eartytankglowy.png b/UnusedUnittextures/eartytankglowy.png similarity index 100% rename from UnitTextures/eartytankglowy.png rename to UnusedUnittextures/eartytankglowy.png diff --git a/UnitTextures/eartytanknormal.png b/UnusedUnittextures/eartytanknormal.png similarity index 100% rename from UnitTextures/eartytanknormal.png rename to UnusedUnittextures/eartytanknormal.png diff --git a/UnitTextures/ebarricade.png b/UnusedUnittextures/ebarricade.png similarity index 100% rename from UnitTextures/ebarricade.png rename to UnusedUnittextures/ebarricade.png diff --git a/UnitTextures/ebarricade_aoplane.dds b/UnusedUnittextures/ebarricade_aoplane.dds similarity index 100% rename from UnitTextures/ebarricade_aoplane.dds rename to UnusedUnittextures/ebarricade_aoplane.dds diff --git a/UnitTextures/ebarricadeglowy.png b/UnusedUnittextures/ebarricadeglowy.png similarity index 100% rename from UnitTextures/ebarricadeglowy.png rename to UnusedUnittextures/ebarricadeglowy.png diff --git a/UnitTextures/ebarricadenormal.png b/UnusedUnittextures/ebarricadenormal.png similarity index 100% rename from UnitTextures/ebarricadenormal.png rename to UnusedUnittextures/ebarricadenormal.png diff --git a/UnitTextures/ebasefactory.png b/UnusedUnittextures/ebasefactory.png similarity index 100% rename from UnitTextures/ebasefactory.png rename to UnusedUnittextures/ebasefactory.png diff --git a/UnitTextures/ebasefactory_aoplane.dds b/UnusedUnittextures/ebasefactory_aoplane.dds similarity index 100% rename from UnitTextures/ebasefactory_aoplane.dds rename to UnusedUnittextures/ebasefactory_aoplane.dds diff --git a/UnitTextures/ebasefactoryglowy.png b/UnusedUnittextures/ebasefactoryglowy.png similarity index 100% rename from UnitTextures/ebasefactoryglowy.png rename to UnusedUnittextures/ebasefactoryglowy.png diff --git a/UnitTextures/ebasefactorynormal.png b/UnusedUnittextures/ebasefactorynormal.png similarity index 100% rename from UnitTextures/ebasefactorynormal.png rename to UnusedUnittextures/ebasefactorynormal.png diff --git a/UnitTextures/ebomb.png b/UnusedUnittextures/ebomb.png similarity index 100% rename from UnitTextures/ebomb.png rename to UnusedUnittextures/ebomb.png diff --git a/UnitTextures/ebomber.png b/UnusedUnittextures/ebomber.png similarity index 100% rename from UnitTextures/ebomber.png rename to UnusedUnittextures/ebomber.png diff --git a/UnitTextures/ebomberglowy.png b/UnusedUnittextures/ebomberglowy.png similarity index 100% rename from UnitTextures/ebomberglowy.png rename to UnusedUnittextures/ebomberglowy.png diff --git a/UnitTextures/ebombernormal.png b/UnusedUnittextures/ebombernormal.png similarity index 100% rename from UnitTextures/ebombernormal.png rename to UnusedUnittextures/ebombernormal.png diff --git a/UnitTextures/ebombglowy.png b/UnusedUnittextures/ebombglowy.png similarity index 100% rename from UnitTextures/ebombglowy.png rename to UnusedUnittextures/ebombglowy.png diff --git a/UnitTextures/ebombnormal.png b/UnusedUnittextures/ebombnormal.png similarity index 100% rename from UnitTextures/ebombnormal.png rename to UnusedUnittextures/ebombnormal.png diff --git a/UnitTextures/ecommandfactory_aoplane.dds b/UnusedUnittextures/ecommandfactory_aoplane.dds similarity index 100% rename from UnitTextures/ecommandfactory_aoplane.dds rename to UnusedUnittextures/ecommandfactory_aoplane.dds diff --git a/UnitTextures/edrone.png b/UnusedUnittextures/edrone.png similarity index 100% rename from UnitTextures/edrone.png rename to UnusedUnittextures/edrone.png diff --git a/UnitTextures/edroneglowy.png b/UnusedUnittextures/edroneglowy.png similarity index 100% rename from UnitTextures/edroneglowy.png rename to UnusedUnittextures/edroneglowy.png diff --git a/UnitTextures/edronenormal.png b/UnusedUnittextures/edronenormal.png similarity index 100% rename from UnitTextures/edronenormal.png rename to UnusedUnittextures/edronenormal.png diff --git a/UnitTextures/eengineer4.png b/UnusedUnittextures/eengineer4.png similarity index 100% rename from UnitTextures/eengineer4.png rename to UnusedUnittextures/eengineer4.png diff --git a/UnitTextures/eengineer4glowy.png b/UnusedUnittextures/eengineer4glowy.png similarity index 100% rename from UnitTextures/eengineer4glowy.png rename to UnusedUnittextures/eengineer4glowy.png diff --git a/UnitTextures/efatso2.png b/UnusedUnittextures/efatso2.png similarity index 100% rename from UnitTextures/efatso2.png rename to UnusedUnittextures/efatso2.png diff --git a/UnitTextures/efatso2glowy.png b/UnusedUnittextures/efatso2glowy.png similarity index 100% rename from UnitTextures/efatso2glowy.png rename to UnusedUnittextures/efatso2glowy.png diff --git a/UnitTextures/efatso2normal.png b/UnusedUnittextures/efatso2normal.png similarity index 100% rename from UnitTextures/efatso2normal.png rename to UnusedUnittextures/efatso2normal.png diff --git a/UnitTextures/efighter.png b/UnusedUnittextures/efighter.png similarity index 100% rename from UnitTextures/efighter.png rename to UnusedUnittextures/efighter.png diff --git a/UnitTextures/efighterglowy.png b/UnusedUnittextures/efighterglowy.png similarity index 100% rename from UnitTextures/efighterglowy.png rename to UnusedUnittextures/efighterglowy.png diff --git a/UnitTextures/efighternormal.png b/UnusedUnittextures/efighternormal.png similarity index 100% rename from UnitTextures/efighternormal.png rename to UnusedUnittextures/efighternormal.png diff --git a/UnitTextures/eflametank.png b/UnusedUnittextures/eflametank.png similarity index 100% rename from UnitTextures/eflametank.png rename to UnusedUnittextures/eflametank.png diff --git a/UnitTextures/eflametankglowy.png b/UnusedUnittextures/eflametankglowy.png similarity index 100% rename from UnitTextures/eflametankglowy.png rename to UnusedUnittextures/eflametankglowy.png diff --git a/UnitTextures/eflametanknormal.png b/UnusedUnittextures/eflametanknormal.png similarity index 100% rename from UnitTextures/eflametanknormal.png rename to UnusedUnittextures/eflametanknormal.png diff --git a/UnitTextures/efusion2.png b/UnusedUnittextures/efusion2.png similarity index 100% rename from UnitTextures/efusion2.png rename to UnusedUnittextures/efusion2.png diff --git a/UnitTextures/efusion2_aoplane.dds b/UnusedUnittextures/efusion2_aoplane.dds similarity index 100% rename from UnitTextures/efusion2_aoplane.dds rename to UnusedUnittextures/efusion2_aoplane.dds diff --git a/UnitTextures/efusion2glowy.png b/UnusedUnittextures/efusion2glowy.png similarity index 100% rename from UnitTextures/efusion2glowy.png rename to UnusedUnittextures/efusion2glowy.png diff --git a/UnitTextures/efusion2normal.png b/UnusedUnittextures/efusion2normal.png similarity index 100% rename from UnitTextures/efusion2normal.png rename to UnusedUnittextures/efusion2normal.png diff --git a/UnitTextures/egeothermal.png b/UnusedUnittextures/egeothermal.png similarity index 100% rename from UnitTextures/egeothermal.png rename to UnusedUnittextures/egeothermal.png diff --git a/UnitTextures/egeothermal_aoplane.dds b/UnusedUnittextures/egeothermal_aoplane.dds similarity index 100% rename from UnitTextures/egeothermal_aoplane.dds rename to UnusedUnittextures/egeothermal_aoplane.dds diff --git a/UnitTextures/egeothermalglowy.png b/UnusedUnittextures/egeothermalglowy.png similarity index 100% rename from UnitTextures/egeothermalglowy.png rename to UnusedUnittextures/egeothermalglowy.png diff --git a/UnitTextures/egeothermalnormal.png b/UnusedUnittextures/egeothermalnormal.png similarity index 100% rename from UnitTextures/egeothermalnormal.png rename to UnusedUnittextures/egeothermalnormal.png diff --git a/UnitTextures/egunship2.png b/UnusedUnittextures/egunship2.png similarity index 100% rename from UnitTextures/egunship2.png rename to UnusedUnittextures/egunship2.png diff --git a/UnitTextures/egunship2glowy.png b/UnusedUnittextures/egunship2glowy.png similarity index 100% rename from UnitTextures/egunship2glowy.png rename to UnusedUnittextures/egunship2glowy.png diff --git a/UnitTextures/egunship2normal.png b/UnusedUnittextures/egunship2normal.png similarity index 100% rename from UnitTextures/egunship2normal.png rename to UnusedUnittextures/egunship2normal.png diff --git a/UnitTextures/eheavytank3.png b/UnusedUnittextures/eheavytank3.png similarity index 100% rename from UnitTextures/eheavytank3.png rename to UnusedUnittextures/eheavytank3.png diff --git a/UnitTextures/eheavytank3glowy.png b/UnusedUnittextures/eheavytank3glowy.png similarity index 100% rename from UnitTextures/eheavytank3glowy.png rename to UnusedUnittextures/eheavytank3glowy.png diff --git a/UnitTextures/eheavytank3normal.png b/UnusedUnittextures/eheavytank3normal.png similarity index 100% rename from UnitTextures/eheavytank3normal.png rename to UnusedUnittextures/eheavytank3normal.png diff --git a/UnitTextures/eheavyturret2.png b/UnusedUnittextures/eheavyturret2.png similarity index 100% rename from UnitTextures/eheavyturret2.png rename to UnusedUnittextures/eheavyturret2.png diff --git a/UnitTextures/eheavyturret2_aoplane.dds b/UnusedUnittextures/eheavyturret2_aoplane.dds similarity index 100% rename from UnitTextures/eheavyturret2_aoplane.dds rename to UnusedUnittextures/eheavyturret2_aoplane.dds diff --git a/UnitTextures/eheavyturret2glowy.png b/UnusedUnittextures/eheavyturret2glowy.png similarity index 100% rename from UnitTextures/eheavyturret2glowy.png rename to UnusedUnittextures/eheavyturret2glowy.png diff --git a/UnitTextures/eheavyturret2normal.png b/UnusedUnittextures/eheavyturret2normal.png similarity index 100% rename from UnitTextures/eheavyturret2normal.png rename to UnusedUnittextures/eheavyturret2normal.png diff --git a/UnitTextures/ejammer2.png b/UnusedUnittextures/ejammer2.png similarity index 100% rename from UnitTextures/ejammer2.png rename to UnusedUnittextures/ejammer2.png diff --git a/UnitTextures/ejammer2_aoplane.dds b/UnusedUnittextures/ejammer2_aoplane.dds similarity index 100% rename from UnitTextures/ejammer2_aoplane.dds rename to UnusedUnittextures/ejammer2_aoplane.dds diff --git a/UnitTextures/ejammer2glowy.png b/UnusedUnittextures/ejammer2glowy.png similarity index 100% rename from UnitTextures/ejammer2glowy.png rename to UnusedUnittextures/ejammer2glowy.png diff --git a/UnitTextures/ejammer2normal.png b/UnusedUnittextures/ejammer2normal.png similarity index 100% rename from UnitTextures/ejammer2normal.png rename to UnusedUnittextures/ejammer2normal.png diff --git a/UnitTextures/elighttank3 - (2).png b/UnusedUnittextures/elighttank3 - (2).png similarity index 100% rename from UnitTextures/elighttank3 - (2).png rename to UnusedUnittextures/elighttank3 - (2).png diff --git a/UnitTextures/elighttank3.png b/UnusedUnittextures/elighttank3.png similarity index 100% rename from UnitTextures/elighttank3.png rename to UnusedUnittextures/elighttank3.png diff --git a/UnitTextures/elighttank3glowy.png b/UnusedUnittextures/elighttank3glowy.png similarity index 100% rename from UnitTextures/elighttank3glowy.png rename to UnusedUnittextures/elighttank3glowy.png diff --git a/UnitTextures/elighttank3normal.png b/UnusedUnittextures/elighttank3normal.png similarity index 100% rename from UnitTextures/elighttank3normal.png rename to UnusedUnittextures/elighttank3normal.png diff --git a/UnitTextures/elightturret2.png b/UnusedUnittextures/elightturret2.png similarity index 100% rename from UnitTextures/elightturret2.png rename to UnusedUnittextures/elightturret2.png diff --git a/UnitTextures/elightturret2_aoplane.dds b/UnusedUnittextures/elightturret2_aoplane.dds similarity index 100% rename from UnitTextures/elightturret2_aoplane.dds rename to UnusedUnittextures/elightturret2_aoplane.dds diff --git a/UnitTextures/elightturret2glowy.png b/UnusedUnittextures/elightturret2glowy.png similarity index 100% rename from UnitTextures/elightturret2glowy.png rename to UnusedUnittextures/elightturret2glowy.png diff --git a/UnitTextures/elightturret2normal.png b/UnusedUnittextures/elightturret2normal.png similarity index 100% rename from UnitTextures/elightturret2normal.png rename to UnusedUnittextures/elightturret2normal.png diff --git a/UnitTextures/elightturretglowy.png b/UnusedUnittextures/elightturretglowy.png similarity index 100% rename from UnitTextures/elightturretglowy.png rename to UnusedUnittextures/elightturretglowy.png diff --git a/UnitTextures/elrpc.png b/UnusedUnittextures/elrpc.png similarity index 100% rename from UnitTextures/elrpc.png rename to UnusedUnittextures/elrpc.png diff --git a/UnitTextures/elrpc_aoplane.dds b/UnusedUnittextures/elrpc_aoplane.dds similarity index 100% rename from UnitTextures/elrpc_aoplane.dds rename to UnusedUnittextures/elrpc_aoplane.dds diff --git a/UnitTextures/elrpcglowy.png b/UnusedUnittextures/elrpcglowy.png similarity index 100% rename from UnitTextures/elrpcglowy.png rename to UnusedUnittextures/elrpcglowy.png diff --git a/UnitTextures/elrpcnormal.png b/UnusedUnittextures/elrpcnormal.png similarity index 100% rename from UnitTextures/elrpcnormal.png rename to UnusedUnittextures/elrpcnormal.png diff --git a/UnitTextures/emaker.png b/UnusedUnittextures/emaker.png similarity index 100% rename from UnitTextures/emaker.png rename to UnusedUnittextures/emaker.png diff --git a/UnitTextures/emaker_aoplane.dds b/UnusedUnittextures/emaker_aoplane.dds similarity index 100% rename from UnitTextures/emaker_aoplane.dds rename to UnusedUnittextures/emaker_aoplane.dds diff --git a/UnitTextures/emakerglowy.png b/UnusedUnittextures/emakerglowy.png similarity index 100% rename from UnitTextures/emakerglowy.png rename to UnusedUnittextures/emakerglowy.png diff --git a/UnitTextures/emakernormal.png b/UnusedUnittextures/emakernormal.png similarity index 100% rename from UnitTextures/emakernormal.png rename to UnusedUnittextures/emakernormal.png diff --git a/UnitTextures/emediumtank3.png b/UnusedUnittextures/emediumtank3.png similarity index 100% rename from UnitTextures/emediumtank3.png rename to UnusedUnittextures/emediumtank3.png diff --git a/UnitTextures/emediumtank3glowy.png b/UnusedUnittextures/emediumtank3glowy.png similarity index 100% rename from UnitTextures/emediumtank3glowy.png rename to UnusedUnittextures/emediumtank3glowy.png diff --git a/UnitTextures/emediumtank3normal.png b/UnusedUnittextures/emediumtank3normal.png similarity index 100% rename from UnitTextures/emediumtank3normal.png rename to UnusedUnittextures/emediumtank3normal.png diff --git a/UnitTextures/emetalextractor.png b/UnusedUnittextures/emetalextractor.png similarity index 100% rename from UnitTextures/emetalextractor.png rename to UnusedUnittextures/emetalextractor.png diff --git a/UnitTextures/emetalextractor_aoplane.dds b/UnusedUnittextures/emetalextractor_aoplane.dds similarity index 100% rename from UnitTextures/emetalextractor_aoplane.dds rename to UnusedUnittextures/emetalextractor_aoplane.dds diff --git a/UnitTextures/emetalextractorglowy.png b/UnusedUnittextures/emetalextractorglowy.png similarity index 100% rename from UnitTextures/emetalextractorglowy.png rename to UnusedUnittextures/emetalextractorglowy.png diff --git a/UnitTextures/emetalextractornormal.png b/UnusedUnittextures/emetalextractornormal.png similarity index 100% rename from UnitTextures/emetalextractornormal.png rename to UnusedUnittextures/emetalextractornormal.png diff --git a/UnitTextures/eminifac.png b/UnusedUnittextures/eminifac.png similarity index 100% rename from UnitTextures/eminifac.png rename to UnusedUnittextures/eminifac.png diff --git a/UnitTextures/eminifac_aoplane.dds b/UnusedUnittextures/eminifac_aoplane.dds similarity index 100% rename from UnitTextures/eminifac_aoplane.dds rename to UnusedUnittextures/eminifac_aoplane.dds diff --git a/UnitTextures/eminifacglowy.png b/UnusedUnittextures/eminifacglowy.png similarity index 100% rename from UnitTextures/eminifacglowy.png rename to UnusedUnittextures/eminifacglowy.png diff --git a/UnitTextures/eminifacnormal.png b/UnusedUnittextures/eminifacnormal.png similarity index 100% rename from UnitTextures/eminifacnormal.png rename to UnusedUnittextures/eminifacnormal.png diff --git a/UnitTextures/emissiletank.png b/UnusedUnittextures/emissiletank.png similarity index 100% rename from UnitTextures/emissiletank.png rename to UnusedUnittextures/emissiletank.png diff --git a/UnitTextures/emissiletankglowy.png b/UnusedUnittextures/emissiletankglowy.png similarity index 100% rename from UnitTextures/emissiletankglowy.png rename to UnusedUnittextures/emissiletankglowy.png diff --git a/UnitTextures/emissiletanknormal.png b/UnusedUnittextures/emissiletanknormal.png similarity index 100% rename from UnitTextures/emissiletanknormal.png rename to UnusedUnittextures/emissiletanknormal.png diff --git a/UnitTextures/eorb.png b/UnusedUnittextures/eorb.png similarity index 100% rename from UnitTextures/eorb.png rename to UnusedUnittextures/eorb.png diff --git a/UnitTextures/eorbglowy.png b/UnusedUnittextures/eorbglowy.png similarity index 100% rename from UnitTextures/eorbglowy.png rename to UnusedUnittextures/eorbglowy.png diff --git a/UnitTextures/eorbnormal.png b/UnusedUnittextures/eorbnormal.png similarity index 100% rename from UnitTextures/eorbnormal.png rename to UnusedUnittextures/eorbnormal.png diff --git a/UnitTextures/eradar2.png b/UnusedUnittextures/eradar2.png similarity index 100% rename from UnitTextures/eradar2.png rename to UnusedUnittextures/eradar2.png diff --git a/UnitTextures/eradar2_aoplane.dds b/UnusedUnittextures/eradar2_aoplane.dds similarity index 100% rename from UnitTextures/eradar2_aoplane.dds rename to UnusedUnittextures/eradar2_aoplane.dds diff --git a/UnitTextures/eradar2glowy.png b/UnusedUnittextures/eradar2glowy.png similarity index 100% rename from UnitTextures/eradar2glowy.png rename to UnusedUnittextures/eradar2glowy.png diff --git a/UnitTextures/eradar2normal.png b/UnusedUnittextures/eradar2normal.png similarity index 100% rename from UnitTextures/eradar2normal.png rename to UnusedUnittextures/eradar2normal.png diff --git a/UnitTextures/eriottank2.png b/UnusedUnittextures/eriottank2.png similarity index 100% rename from UnitTextures/eriottank2.png rename to UnusedUnittextures/eriottank2.png diff --git a/UnitTextures/eriottank2glowy.png b/UnusedUnittextures/eriottank2glowy.png similarity index 100% rename from UnitTextures/eriottank2glowy.png rename to UnusedUnittextures/eriottank2glowy.png diff --git a/UnitTextures/eriottank2normal.png b/UnusedUnittextures/eriottank2normal.png similarity index 100% rename from UnitTextures/eriottank2normal.png rename to UnusedUnittextures/eriottank2normal.png diff --git a/UnitTextures/escout.png b/UnusedUnittextures/escout.png similarity index 100% rename from UnitTextures/escout.png rename to UnusedUnittextures/escout.png diff --git a/UnitTextures/escoutglowy.png b/UnusedUnittextures/escoutglowy.png similarity index 100% rename from UnitTextures/escoutglowy.png rename to UnusedUnittextures/escoutglowy.png diff --git a/UnitTextures/escoutnormal.png b/UnusedUnittextures/escoutnormal.png similarity index 100% rename from UnitTextures/escoutnormal.png rename to UnusedUnittextures/escoutnormal.png diff --git a/UnitTextures/eshieldgen.png b/UnusedUnittextures/eshieldgen.png similarity index 100% rename from UnitTextures/eshieldgen.png rename to UnusedUnittextures/eshieldgen.png diff --git a/UnitTextures/eshieldgen_aoplane.dds b/UnusedUnittextures/eshieldgen_aoplane.dds similarity index 100% rename from UnitTextures/eshieldgen_aoplane.dds rename to UnusedUnittextures/eshieldgen_aoplane.dds diff --git a/UnitTextures/eshieldgenglowy.png b/UnusedUnittextures/eshieldgenglowy.png similarity index 100% rename from UnitTextures/eshieldgenglowy.png rename to UnusedUnittextures/eshieldgenglowy.png diff --git a/UnitTextures/eshieldgennormal.png b/UnusedUnittextures/eshieldgennormal.png similarity index 100% rename from UnitTextures/eshieldgennormal.png rename to UnusedUnittextures/eshieldgennormal.png diff --git a/UnusedUnittextures/esilo.png b/UnusedUnittextures/esilo.png new file mode 100644 index 000000000..b844179de Binary files /dev/null and b/UnusedUnittextures/esilo.png differ diff --git a/UnitTextures/esilo_aoplane.dds b/UnusedUnittextures/esilo_aoplane.dds similarity index 100% rename from UnitTextures/esilo_aoplane.dds rename to UnusedUnittextures/esilo_aoplane.dds diff --git a/UnusedUnittextures/esiloglowy.png b/UnusedUnittextures/esiloglowy.png new file mode 100644 index 000000000..f48899be4 Binary files /dev/null and b/UnusedUnittextures/esiloglowy.png differ diff --git a/UnitTextures/esilonormal.png b/UnusedUnittextures/esilonormal.png similarity index 100% rename from UnitTextures/esilonormal.png rename to UnusedUnittextures/esilonormal.png diff --git a/UnitTextures/esolar2.png b/UnusedUnittextures/esolar2.png similarity index 100% rename from UnitTextures/esolar2.png rename to UnusedUnittextures/esolar2.png diff --git a/UnitTextures/esolar2_aoplane.dds b/UnusedUnittextures/esolar2_aoplane.dds similarity index 100% rename from UnitTextures/esolar2_aoplane.dds rename to UnusedUnittextures/esolar2_aoplane.dds diff --git a/UnitTextures/esolar2glowy.png b/UnusedUnittextures/esolar2glowy.png similarity index 100% rename from UnitTextures/esolar2glowy.png rename to UnusedUnittextures/esolar2glowy.png diff --git a/UnitTextures/esolar2normal.png b/UnusedUnittextures/esolar2normal.png similarity index 100% rename from UnitTextures/esolar2normal.png rename to UnusedUnittextures/esolar2normal.png diff --git a/UnitTextures/estorage.png b/UnusedUnittextures/estorage.png similarity index 100% rename from UnitTextures/estorage.png rename to UnusedUnittextures/estorage.png diff --git a/UnitTextures/estorage_aoplane.dds b/UnusedUnittextures/estorage_aoplane.dds similarity index 100% rename from UnitTextures/estorage_aoplane.dds rename to UnusedUnittextures/estorage_aoplane.dds diff --git a/UnitTextures/estorageglowy.png b/UnusedUnittextures/estorageglowy.png similarity index 100% rename from UnitTextures/estorageglowy.png rename to UnusedUnittextures/estorageglowy.png diff --git a/UnitTextures/estoragenormal.png b/UnusedUnittextures/estoragenormal.png similarity index 100% rename from UnitTextures/estoragenormal.png rename to UnusedUnittextures/estoragenormal.png diff --git a/UnitTextures/esubplane.png b/UnusedUnittextures/esubplane.png similarity index 100% rename from UnitTextures/esubplane.png rename to UnusedUnittextures/esubplane.png diff --git a/UnitTextures/esubplaneglowy.png b/UnusedUnittextures/esubplaneglowy.png similarity index 100% rename from UnitTextures/esubplaneglowy.png rename to UnusedUnittextures/esubplaneglowy.png diff --git a/UnitTextures/esubplanenormal.png b/UnusedUnittextures/esubplanenormal.png similarity index 100% rename from UnitTextures/esubplanenormal.png rename to UnusedUnittextures/esubplanenormal.png diff --git a/UnitTextures/etransport.png b/UnusedUnittextures/etransport.png similarity index 100% rename from UnitTextures/etransport.png rename to UnusedUnittextures/etransport.png diff --git a/UnitTextures/etransport2.png b/UnusedUnittextures/etransport2.png similarity index 100% rename from UnitTextures/etransport2.png rename to UnusedUnittextures/etransport2.png diff --git a/UnitTextures/etransport2glowy.png b/UnusedUnittextures/etransport2glowy.png similarity index 100% rename from UnitTextures/etransport2glowy.png rename to UnusedUnittextures/etransport2glowy.png diff --git a/UnitTextures/etransport2normal.png b/UnusedUnittextures/etransport2normal.png similarity index 100% rename from UnitTextures/etransport2normal.png rename to UnusedUnittextures/etransport2normal.png diff --git a/UnitTextures/etransportglowy.png b/UnusedUnittextures/etransportglowy.png similarity index 100% rename from UnitTextures/etransportglowy.png rename to UnusedUnittextures/etransportglowy.png diff --git a/UnitTextures/euwfusion2_aoplane.dds b/UnusedUnittextures/euwfusion2_aoplane.dds similarity index 100% rename from UnitTextures/euwfusion2_aoplane.dds rename to UnusedUnittextures/euwfusion2_aoplane.dds diff --git a/UnitTextures/euwmetalextractor_aoplane.dds b/UnusedUnittextures/euwmetalextractor_aoplane.dds similarity index 100% rename from UnitTextures/euwmetalextractor_aoplane.dds rename to UnusedUnittextures/euwmetalextractor_aoplane.dds diff --git a/UnitTextures/euwsolar2_aoplane.dds b/UnusedUnittextures/euwsolar2_aoplane.dds similarity index 100% rename from UnitTextures/euwsolar2_aoplane.dds rename to UnusedUnittextures/euwsolar2_aoplane.dds diff --git a/UnitTextures/euwstorage_aoplane.dds b/UnusedUnittextures/euwstorage_aoplane.dds similarity index 100% rename from UnitTextures/euwstorage_aoplane.dds rename to UnusedUnittextures/euwstorage_aoplane.dds diff --git a/UnitTextures/experimentalfacgroundplate.png b/UnusedUnittextures/experimentalfacgroundplate.png similarity index 100% rename from UnitTextures/experimentalfacgroundplate.png rename to UnusedUnittextures/experimentalfacgroundplate.png diff --git a/UnitTextures/genericfacdecal.png b/UnusedUnittextures/genericfacdecal.png similarity index 100% rename from UnitTextures/genericfacdecal.png rename to UnusedUnittextures/genericfacdecal.png diff --git a/UnitTextures/glowy.png b/UnusedUnittextures/glowy.png similarity index 100% rename from UnitTextures/glowy.png rename to UnusedUnittextures/glowy.png diff --git a/UnitTextures/glsl_test_NormalMap.dds b/UnusedUnittextures/glsl_test_NormalMap.dds similarity index 100% rename from UnitTextures/glsl_test_NormalMap.dds rename to UnusedUnittextures/glsl_test_NormalMap.dds diff --git a/UnitTextures/groundplate.png b/UnusedUnittextures/groundplate.png similarity index 100% rename from UnitTextures/groundplate.png rename to UnusedUnittextures/groundplate.png diff --git a/UnitTextures/groundplate2.png b/UnusedUnittextures/groundplate2.png similarity index 100% rename from UnitTextures/groundplate2.png rename to UnusedUnittextures/groundplate2.png diff --git a/UnitTextures/hoverfactdecal.png b/UnusedUnittextures/hoverfactdecal.png similarity index 100% rename from UnitTextures/hoverfactdecal.png rename to UnusedUnittextures/hoverfactdecal.png diff --git a/UnitTextures/lego2skin_explorer - 2048.dds b/UnusedUnittextures/lego2skin_explorer - 2048.dds similarity index 100% rename from UnitTextures/lego2skin_explorer - 2048.dds rename to UnusedUnittextures/lego2skin_explorer - 2048.dds diff --git a/UnusedUnittextures/lego2skin_explorer-old.dds b/UnusedUnittextures/lego2skin_explorer-old.dds new file mode 100644 index 000000000..932459071 Binary files /dev/null and b/UnusedUnittextures/lego2skin_explorer-old.dds differ diff --git a/UnusedUnittextures/lego2skin_explorerglowy-old.dds b/UnusedUnittextures/lego2skin_explorerglowy-old.dds new file mode 100644 index 000000000..501168768 Binary files /dev/null and b/UnusedUnittextures/lego2skin_explorerglowy-old.dds differ diff --git a/UnitTextures/powergrounddecal.png b/UnusedUnittextures/powergrounddecal.png similarity index 100% rename from UnitTextures/powergrounddecal.png rename to UnusedUnittextures/powergrounddecal.png diff --git a/UnitTextures/taatank2.png b/UnusedUnittextures/taatank2.png similarity index 100% rename from UnitTextures/taatank2.png rename to UnusedUnittextures/taatank2.png diff --git a/UnitTextures/taatank2glowy.png b/UnusedUnittextures/taatank2glowy.png similarity index 100% rename from UnitTextures/taatank2glowy.png rename to UnusedUnittextures/taatank2glowy.png diff --git a/UnitTextures/tbinoc.png b/UnusedUnittextures/tbinoc.png similarity index 100% rename from UnitTextures/tbinoc.png rename to UnusedUnittextures/tbinoc.png diff --git a/UnitTextures/tbinocglowy.png b/UnusedUnittextures/tbinocglowy.png similarity index 100% rename from UnitTextures/tbinocglowy.png rename to UnusedUnittextures/tbinocglowy.png diff --git a/UnitTextures/tfact.png b/UnusedUnittextures/tfact.png similarity index 100% rename from UnitTextures/tfact.png rename to UnusedUnittextures/tfact.png diff --git a/UnitTextures/tfactglowy.png b/UnusedUnittextures/tfactglowy.png similarity index 100% rename from UnitTextures/tfactglowy.png rename to UnusedUnittextures/tfactglowy.png diff --git a/UnitTextures/tfusion2.png b/UnusedUnittextures/tfusion2.png similarity index 100% rename from UnitTextures/tfusion2.png rename to UnusedUnittextures/tfusion2.png diff --git a/UnitTextures/tfusion2glowy.png b/UnusedUnittextures/tfusion2glowy.png similarity index 100% rename from UnitTextures/tfusion2glowy.png rename to UnusedUnittextures/tfusion2glowy.png diff --git a/UnitTextures/tgeothermal.png b/UnusedUnittextures/tgeothermal.png similarity index 100% rename from UnitTextures/tgeothermal.png rename to UnusedUnittextures/tgeothermal.png diff --git a/UnitTextures/tgeothermalglowy.png b/UnusedUnittextures/tgeothermalglowy.png similarity index 100% rename from UnitTextures/tgeothermalglowy.png rename to UnusedUnittextures/tgeothermalglowy.png diff --git a/UnitTextures/tlighttank3.png b/UnusedUnittextures/tlighttank3.png similarity index 100% rename from UnitTextures/tlighttank3.png rename to UnusedUnittextures/tlighttank3.png diff --git a/UnitTextures/tlighttank3glowy.png b/UnusedUnittextures/tlighttank3glowy.png similarity index 100% rename from UnitTextures/tlighttank3glowy.png rename to UnusedUnittextures/tlighttank3glowy.png diff --git a/UnitTextures/tlightturret.png b/UnusedUnittextures/tlightturret.png similarity index 100% rename from UnitTextures/tlightturret.png rename to UnusedUnittextures/tlightturret.png diff --git a/UnitTextures/tlightturretglowy.png b/UnusedUnittextures/tlightturretglowy.png similarity index 100% rename from UnitTextures/tlightturretglowy.png rename to UnusedUnittextures/tlightturretglowy.png diff --git a/UnitTextures/tmetalextractor.png b/UnusedUnittextures/tmetalextractor.png similarity index 100% rename from UnitTextures/tmetalextractor.png rename to UnusedUnittextures/tmetalextractor.png diff --git a/UnitTextures/tmetalextractorglowy.png b/UnusedUnittextures/tmetalextractorglowy.png similarity index 100% rename from UnitTextures/tmetalextractorglowy.png rename to UnusedUnittextures/tmetalextractorglowy.png diff --git a/UnitTextures/towerdecal.png b/UnusedUnittextures/towerdecal.png similarity index 100% rename from UnitTextures/towerdecal.png rename to UnusedUnittextures/towerdecal.png diff --git a/UnitTextures/towerdecal2.png b/UnusedUnittextures/towerdecal2.png similarity index 100% rename from UnitTextures/towerdecal2.png rename to UnusedUnittextures/towerdecal2.png diff --git a/UnitTextures/tsolar2.png b/UnusedUnittextures/tsolar2.png similarity index 100% rename from UnitTextures/tsolar2.png rename to UnusedUnittextures/tsolar2.png diff --git a/UnitTextures/tsolar2glowy.png b/UnusedUnittextures/tsolar2glowy.png similarity index 100% rename from UnitTextures/tsolar2glowy.png rename to UnusedUnittextures/tsolar2glowy.png diff --git a/UnitTextures/tstorage.png b/UnusedUnittextures/tstorage.png similarity index 100% rename from UnitTextures/tstorage.png rename to UnusedUnittextures/tstorage.png diff --git a/UnitTextures/tstorage2.png b/UnusedUnittextures/tstorage2.png similarity index 100% rename from UnitTextures/tstorage2.png rename to UnusedUnittextures/tstorage2.png diff --git a/UnitTextures/tstorageglowy.png b/UnusedUnittextures/tstorageglowy.png similarity index 100% rename from UnitTextures/tstorageglowy.png rename to UnusedUnittextures/tstorageglowy.png diff --git a/Weapons/ChickenDefenseWeapons/bug_death.lua b/Weapons/ChickenDefenseWeapons/bug_death.lua index 86cd80ccd..924ea5be2 100644 --- a/Weapons/ChickenDefenseWeapons/bug_death.lua +++ b/Weapons/ChickenDefenseWeapons/bug_death.lua @@ -1,19 +1,86 @@ return { - bug_death = { - areaofeffect = "16", - craterboost = "0", - cratermult = "0", - impulseboost = "0", - impulsefactor = "0.4", + bug_death_small = { + areaofeffect = 100, + craterboost = 0, + cratermult = 0, + impulseboost = 0, + impulsefactor = 0, + explosiongenerator = "custom:chickenunitexplosion-small-red", + name = "bug_death", + range = 450, + reloadtime = 0, + --soundhit = "ChickenDefenseSounds/bugdie", + turret = 1, + weaponvelocity = 250, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 0, + }, + }, + bug_death_medium = { + areaofeffect = 100, + craterboost = 0, + cratermult = 0, + impulseboost = 0, + impulsefactor = 0, + explosiongenerator = "custom:chickenunitexplosion-medium-red", + name = "bug_death", + range = 450, + reloadtime = 0, + --soundhit = "ChickenDefenseSounds/bugdie", + turret = 1, + weaponvelocity = 250, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 0, + }, + }, + bug_death_large = { + areaofeffect = 100, + craterboost = 0, + cratermult = 0, + impulseboost = 0, + impulsefactor = 0, + explosiongenerator = "custom:chickenunitexplosion-large-red", + name = "bug_death", + range = 450, + reloadtime = 0, + --soundhit = "ChickenDefenseSounds/bugdie", + turret = 1, + weaponvelocity = 250, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 0, + }, + }, + bug_death_kamikaze = { + areaofeffect = 100, + craterboost = 0, + cratermult = 0, + impulseboost = 0, + impulsefactor = 0, explosiongenerator = "custom:chickenunitexplosion-medium-red", name = "bug_death", - range = "450", - reloadtime = "3.6", - soundhit = "ChickenDefenseSounds/bugdie", - turret = "1", - weaponvelocity = "250", + range = 100, + reloadtime = 0, + --soundhit = "ChickenDefenseSounds/bugdie", + turret = 1, + weaponvelocity = 250, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, damage = { - default = "0.001", + default = 100, }, }, } diff --git a/Weapons/NOWEAPON.lua b/Weapons/NOWEAPON.lua new file mode 100644 index 000000000..397e63807 --- /dev/null +++ b/Weapons/NOWEAPON.lua @@ -0,0 +1,14 @@ +unitDeaths = { + + NOWEAPON = { + weaponType = "Cannon", + impulseFactor = 0, + AreaOfEffect=0, + explosiongenerator="custom:empty", + cameraShake=0, + damage = { + default = 0, + }, + }, +} +return lowerkeys(unitDeaths) \ No newline at end of file diff --git a/Weapons/scavenger_explosions.lua b/Weapons/scavenger_explosions.lua new file mode 100644 index 000000000..ae80f3262 --- /dev/null +++ b/Weapons/scavenger_explosions.lua @@ -0,0 +1,49 @@ +-------------------------------------------------------------------------------- +-- These represent both the area of effect and the camerashake amount +local smallExplosion = 200 +local smallExplosionImpulseFactor = 0 +local mediumExplosion = 400 +local mediumExplosionImpulseFactor = 0 +local largeExplosion = 600 +local largeExplosionImpulseFactor = 0 +local hugeExplosion = 1000 +local hugeExplosionImpulseFactor = 0 + + +unitDeaths = { + + mediumScavengerExplosionGeneric = { + weaponType = "Cannon", + impulseFactor = mediumExplosionImpulseFactor, + AreaOfEffect=mediumExplosion, + explosiongenerator="custom:genericscavengerbuildingexplosion-medium-purple", + cameraShake=mediumExplosion, + damage = { + default = 0, + }, + }, + + mediumScavengerExplosionNuke = { + weaponType = "Cannon", + impulseFactor = mediumExplosionImpulseFactor, + AreaOfEffect=mediumExplosion, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + cameraShake=mediumExplosion, + damage = { + default = 5000, + }, + }, + + bossScavengerExplosionNuke = { + weaponType = "Cannon", + impulseFactor = hugeExplosionImpulseFactor, + AreaOfEffect = 1500, + explosionGenerator = "custom:NUKEDATBEWM", + cameraShake = hugeExplosion, + damage = { + default = 9999999, + }, + }, + +} +return lowerkeys(unitDeaths) \ No newline at end of file diff --git a/bitmaps/default/metal_basic.dds b/bitmaps/default/metal_basic.dds new file mode 100644 index 000000000..681d444ec Binary files /dev/null and b/bitmaps/default/metal_basic.dds differ diff --git a/bitmaps/default/metalshimmer_color.dds b/bitmaps/default/metalshimmer_color.dds new file mode 100644 index 000000000..0fbda6f48 Binary files /dev/null and b/bitmaps/default/metalshimmer_color.dds differ diff --git a/bitmaps/default/metalshimmer_color2.dds b/bitmaps/default/metalshimmer_color2.dds new file mode 100644 index 000000000..3a29478fb Binary files /dev/null and b/bitmaps/default/metalshimmer_color2.dds differ diff --git a/bitmaps/default/metalshimmer_color3.dds b/bitmaps/default/metalshimmer_color3.dds new file mode 100644 index 000000000..06410ccb5 Binary files /dev/null and b/bitmaps/default/metalshimmer_color3.dds differ diff --git a/bitmaps/default/metalshimmer_color4.dds b/bitmaps/default/metalshimmer_color4.dds new file mode 100644 index 000000000..ea205a95e Binary files /dev/null and b/bitmaps/default/metalshimmer_color4.dds differ diff --git a/bitmaps/default/metalshimmer_color5.dds b/bitmaps/default/metalshimmer_color5.dds new file mode 100644 index 000000000..a4ef2f780 Binary files /dev/null and b/bitmaps/default/metalshimmer_color5.dds differ diff --git a/bitmaps/default/metalshimmer_color6.dds b/bitmaps/default/metalshimmer_color6.dds new file mode 100644 index 000000000..abfb6342b Binary files /dev/null and b/bitmaps/default/metalshimmer_color6.dds differ diff --git a/bitmaps/default/metalshimmer_color7.dds b/bitmaps/default/metalshimmer_color7.dds new file mode 100644 index 000000000..b20d8ecd8 Binary files /dev/null and b/bitmaps/default/metalshimmer_color7.dds differ diff --git a/bitmaps/default/metalshimmer_color8.dds b/bitmaps/default/metalshimmer_color8.dds new file mode 100644 index 000000000..f5c436bb9 Binary files /dev/null and b/bitmaps/default/metalshimmer_color8.dds differ diff --git a/bitmaps/default/metalshimmer_color9.dds b/bitmaps/default/metalshimmer_color9.dds new file mode 100644 index 000000000..eefd5f0d1 Binary files /dev/null and b/bitmaps/default/metalshimmer_color9.dds differ diff --git a/bitmaps/loadpictures/start1.jpg b/bitmaps/loadpictures/start1.jpg index f8f62ec7f..882f9eb04 100644 Binary files a/bitmaps/loadpictures/start1.jpg and b/bitmaps/loadpictures/start1.jpg differ diff --git a/bitmaps/loadpictures/start10.jpg b/bitmaps/loadpictures/start10.jpg index c156637da..05f4d336b 100644 Binary files a/bitmaps/loadpictures/start10.jpg and b/bitmaps/loadpictures/start10.jpg differ diff --git a/bitmaps/loadpictures/start11.jpg b/bitmaps/loadpictures/start11.jpg index d6f5b6b6d..13dfe5790 100644 Binary files a/bitmaps/loadpictures/start11.jpg and b/bitmaps/loadpictures/start11.jpg differ diff --git a/bitmaps/loadpictures/start12.jpg b/bitmaps/loadpictures/start12.jpg index 332ea5487..5da54c557 100644 Binary files a/bitmaps/loadpictures/start12.jpg and b/bitmaps/loadpictures/start12.jpg differ diff --git a/bitmaps/loadpictures/start13.jpg b/bitmaps/loadpictures/start13.jpg index d3d174430..01e69f324 100644 Binary files a/bitmaps/loadpictures/start13.jpg and b/bitmaps/loadpictures/start13.jpg differ diff --git a/bitmaps/loadpictures/start14.jpg b/bitmaps/loadpictures/start14.jpg index 0386d6137..d8205c2db 100644 Binary files a/bitmaps/loadpictures/start14.jpg and b/bitmaps/loadpictures/start14.jpg differ diff --git a/bitmaps/loadpictures/start15.jpg b/bitmaps/loadpictures/start15.jpg index f35584b84..91c78e088 100644 Binary files a/bitmaps/loadpictures/start15.jpg and b/bitmaps/loadpictures/start15.jpg differ diff --git a/bitmaps/loadpictures/start16.jpg b/bitmaps/loadpictures/start16.jpg index b20695b72..9204d0c39 100644 Binary files a/bitmaps/loadpictures/start16.jpg and b/bitmaps/loadpictures/start16.jpg differ diff --git a/bitmaps/loadpictures/start17.jpg b/bitmaps/loadpictures/start17.jpg index a8013b18c..ddfac663a 100644 Binary files a/bitmaps/loadpictures/start17.jpg and b/bitmaps/loadpictures/start17.jpg differ diff --git a/bitmaps/loadpictures/start18.jpg b/bitmaps/loadpictures/start18.jpg index 30df7bdd0..fdfc034c4 100644 Binary files a/bitmaps/loadpictures/start18.jpg and b/bitmaps/loadpictures/start18.jpg differ diff --git a/bitmaps/loadpictures/start19.jpg b/bitmaps/loadpictures/start19.jpg index c84c77318..6f0bd7cd1 100644 Binary files a/bitmaps/loadpictures/start19.jpg and b/bitmaps/loadpictures/start19.jpg differ diff --git a/bitmaps/loadpictures/start2.jpg b/bitmaps/loadpictures/start2.jpg index 5ac93cfe2..7d3c12f12 100644 Binary files a/bitmaps/loadpictures/start2.jpg and b/bitmaps/loadpictures/start2.jpg differ diff --git a/bitmaps/loadpictures/start20.jpg b/bitmaps/loadpictures/start20.jpg index 8c0a62fda..4459250af 100644 Binary files a/bitmaps/loadpictures/start20.jpg and b/bitmaps/loadpictures/start20.jpg differ diff --git a/bitmaps/loadpictures/start21.jpg b/bitmaps/loadpictures/start21.jpg index 15346840a..52226a460 100644 Binary files a/bitmaps/loadpictures/start21.jpg and b/bitmaps/loadpictures/start21.jpg differ diff --git a/bitmaps/loadpictures/start22.jpg b/bitmaps/loadpictures/start22.jpg index cd10dd4c5..0c4f709de 100644 Binary files a/bitmaps/loadpictures/start22.jpg and b/bitmaps/loadpictures/start22.jpg differ diff --git a/bitmaps/loadpictures/start23.jpg b/bitmaps/loadpictures/start23.jpg index 07af967c0..51b444d6e 100644 Binary files a/bitmaps/loadpictures/start23.jpg and b/bitmaps/loadpictures/start23.jpg differ diff --git a/bitmaps/loadpictures/start24.jpg b/bitmaps/loadpictures/start24.jpg index 9e08c073e..4625e0c9f 100644 Binary files a/bitmaps/loadpictures/start24.jpg and b/bitmaps/loadpictures/start24.jpg differ diff --git a/bitmaps/loadpictures/start25.jpg b/bitmaps/loadpictures/start25.jpg index 7bbbbe3f2..e2585b70b 100644 Binary files a/bitmaps/loadpictures/start25.jpg and b/bitmaps/loadpictures/start25.jpg differ diff --git a/bitmaps/loadpictures/start26.jpg b/bitmaps/loadpictures/start26.jpg index bcdc52592..6cea7fbe0 100644 Binary files a/bitmaps/loadpictures/start26.jpg and b/bitmaps/loadpictures/start26.jpg differ diff --git a/bitmaps/loadpictures/start27.jpg b/bitmaps/loadpictures/start27.jpg index 90c50519c..8acb0da91 100644 Binary files a/bitmaps/loadpictures/start27.jpg and b/bitmaps/loadpictures/start27.jpg differ diff --git a/bitmaps/loadpictures/start28.jpg b/bitmaps/loadpictures/start28.jpg index 7ffdaeada..3c9d887d1 100644 Binary files a/bitmaps/loadpictures/start28.jpg and b/bitmaps/loadpictures/start28.jpg differ diff --git a/bitmaps/loadpictures/start3.jpg b/bitmaps/loadpictures/start3.jpg index 7f385c497..f97818761 100644 Binary files a/bitmaps/loadpictures/start3.jpg and b/bitmaps/loadpictures/start3.jpg differ diff --git a/bitmaps/loadpictures/start4.jpg b/bitmaps/loadpictures/start4.jpg index 42cd01bf2..ee4a460e6 100644 Binary files a/bitmaps/loadpictures/start4.jpg and b/bitmaps/loadpictures/start4.jpg differ diff --git a/bitmaps/loadpictures/start5.jpg b/bitmaps/loadpictures/start5.jpg index 114ad7686..256529448 100644 Binary files a/bitmaps/loadpictures/start5.jpg and b/bitmaps/loadpictures/start5.jpg differ diff --git a/bitmaps/loadpictures/start6.jpg b/bitmaps/loadpictures/start6.jpg index d35a30810..baf3d127f 100644 Binary files a/bitmaps/loadpictures/start6.jpg and b/bitmaps/loadpictures/start6.jpg differ diff --git a/bitmaps/loadpictures/start7.jpg b/bitmaps/loadpictures/start7.jpg index b378f6e61..f251e3cb7 100644 Binary files a/bitmaps/loadpictures/start7.jpg and b/bitmaps/loadpictures/start7.jpg differ diff --git a/bitmaps/loadpictures/start8.jpg b/bitmaps/loadpictures/start8.jpg index c2c9c2675..0bae58c3b 100644 Binary files a/bitmaps/loadpictures/start8.jpg and b/bitmaps/loadpictures/start8.jpg differ diff --git a/bitmaps/loadpictures/start9.jpg b/bitmaps/loadpictures/start9.jpg index 65e208d39..92f1cb88e 100644 Binary files a/bitmaps/loadpictures/start9.jpg and b/bitmaps/loadpictures/start9.jpg differ diff --git a/bitmaps/projectiletextures/circlefx0.png b/bitmaps/projectiletextures/circlefx0.png new file mode 100644 index 000000000..26b5524f6 Binary files /dev/null and b/bitmaps/projectiletextures/circlefx0.png differ diff --git a/bitmaps/projectiletextures/circlefx1.png b/bitmaps/projectiletextures/circlefx1.png new file mode 100644 index 000000000..c45077162 Binary files /dev/null and b/bitmaps/projectiletextures/circlefx1.png differ diff --git a/bitmaps/projectiletextures/circlefx2.png b/bitmaps/projectiletextures/circlefx2.png new file mode 100644 index 000000000..0f6118278 Binary files /dev/null and b/bitmaps/projectiletextures/circlefx2.png differ diff --git a/bitmaps/projectiletextures/circlefx3.png b/bitmaps/projectiletextures/circlefx3.png new file mode 100644 index 000000000..9c3eb1c42 Binary files /dev/null and b/bitmaps/projectiletextures/circlefx3.png differ diff --git a/bitmaps/projectiletextures/flashside2-blue.tga b/bitmaps/projectiletextures/flashside2-blue.tga new file mode 100644 index 000000000..0e823fa2c Binary files /dev/null and b/bitmaps/projectiletextures/flashside2-blue.tga differ diff --git a/bitmaps/projectiletextures/flashside2-orange.tga b/bitmaps/projectiletextures/flashside2-orange.tga new file mode 100644 index 000000000..268cf6c35 Binary files /dev/null and b/bitmaps/projectiletextures/flashside2-orange.tga differ diff --git a/bitmaps/projectiletextures/flashside2-purple.tga b/bitmaps/projectiletextures/flashside2-purple.tga new file mode 100644 index 000000000..e04dc4cce Binary files /dev/null and b/bitmaps/projectiletextures/flashside2-purple.tga differ diff --git a/bitmaps/projectiletextures/flashside2-red.tga b/bitmaps/projectiletextures/flashside2-red.tga new file mode 100644 index 000000000..f78e08092 Binary files /dev/null and b/bitmaps/projectiletextures/flashside2-red.tga differ diff --git a/bitmaps/projectiletextures/smoke_puff.png b/bitmaps/projectiletextures/smoke_puff.png new file mode 100644 index 000000000..ebf191938 Binary files /dev/null and b/bitmaps/projectiletextures/smoke_puff.png differ diff --git a/commandlist.txt b/commandlist.txt index 3bb3c7615..1bbc39b11 100644 --- a/commandlist.txt +++ b/commandlist.txt @@ -1,4 +1,4 @@ -Spring Engine (v103) (This is a generic list, some commands may be applicable): +Spring Engine commands: /Atm (synced) Gives 1000 metal and 1000 energy to the issuing players team /Cheat (synced) Enables/Disables cheating, which is required for a lot of other commands to be usable @@ -8,8 +8,8 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /Give (synced) Places one or multiple units of a single or multiple types on the map, instantly; by default to your own team /GlobalLOS (synced) Enables/Disables global line-of-sight, which makes the whole map permanently visible to everyone or to a specific allyteam /GodMode (synced) Enables/Disables god-mode, which allows all players (even spectators) to control all units (even during replays, which will DESYNC them) -/LuaGaia (synced) Allows one to reload or disable Lua-Gaia, or alternatively to send a chat message to Lua-Gaia -/LuaRules (synced) Allows one to reload or disable Lua-rules, or alternatively to send a chat message to Lua-rules +/LuaGaia (synced) Allows reloading or disabling LuaGaia, and to send a chat message to LuaGaia scripts +/LuaRules (synced) Allows reloading or disabling LuaRules, and to send a chat message to LuaRules scripts /NoCost (synced) Enables/Disables everything-for-free, which allows everyone to build everything for zero resource costs /NoHelp (synced) Enables/Disables widgets (LuaUI control) /NoSpecDraw (synced) Allows/Disallows spectators to draw on the map @@ -18,7 +18,6 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /ReloadCOB (synced) Reloads COB scripts /Skip (synced) Fast-forwards to a given frame, or stops fast-forwarding /Take (synced) Transfers all units of allied teams without any active players to the team of the issuing player - /AdvMapShading (unsynced) Set or toggle advanced map shading mode /AdvModelShading (unsynced) Set or toggle advanced model shading mode /AIControl (unsynced) Creates a new instance of a Skirmish AI, to let it controll a specific team @@ -44,10 +43,12 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /Crash (unsynced) Invoke an artificial crash through a NULL-pointer dereference (SIGSEGV) /CreateVideo (unsynced) Start/Stop capturing a video of the game in progress /Cross (unsynced) Allows one to exchange and modify the appearance of the cross/mouse-pointer in first-person-control view -/CtrlPanel (unsynced) Reloads ctrlpanel.txt -/Debug (unsynced) Enable/Disable debug info rendering mode +/CtrlPanel (unsynced) Reloads GUI config +/Debug (unsynced) Enable/Disable debug rendering mode /DebugColVol (unsynced) Enable/Disable drawing of collision volumes /DebugDrawAI (unsynced) Enables/Disables debug drawing for AIs +/DebugGL (unsynced) Enable/Disable OpenGL debug-context output +/DebugGLErrors (unsynced) Enable/Disable OpenGL debug-errors /DebugInfo (unsynced) Print debug info to the chat/log-file about either: sound, profiling /DebugPath (unsynced) Enable/Disable drawing of pathfinder debug-data /DebugTraceRay (unsynced) Enable/Disable drawing of traceray debug-data @@ -60,10 +61,9 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /DivByZero (unsynced) Invoke an artificial crash by performing a division-by-Zero /DrawInMap (unsynced) Enables drawing on the map /DrawLabel (unsynced) Draws a label on the map at the current mouse-pointer position -/DrawTrees (unsynced) Enable/Disable rendering of engine trees +/DrawTrees (unsynced) Enable/Disable engine-tree rendering /DumpState (unsynced) dump game-state to file /DynamicSky (unsynced) Enable/Disable dynamic-sky rendering -/DynamicSun (unsynced) Enable/Disable dynamic-sun rendering /Echo (unsynced) Write a string to the log file /EndGraph (unsynced) Enables/Disables the statistics graphs shown at the end of the game /Exception (unsynced) Invoke an artificial crash by throwing an std::runtime_error @@ -76,6 +76,7 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /Give (unsynced) Places one or multiple units of a single or multiple types on the map, instantly; by default to your own team /GrabInput (unsynced) Prevents/Enables the mouse from leaving the game window (windowed mode only) /GroundDecals (unsynced) Disable/Enable ground-decals rendering. Ground-decals are things like scars appearing on the map after an explosion. +/GroundDetail (unsynced) Set the level of ground detail /Group (unsynced) Allows modifying the members of a group /Group0 (unsynced) Allows modifying the members of group 0 /Group1 (unsynced) Allows modifying the members of group 1 @@ -95,18 +96,21 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /InputTextGeo (unsynced) Move and/or resize the input-text field (the "Say: " thing) /LastMsgPos (unsynced) Moves the camera to show the position of the last message /LessClouds (unsynced) Decreases the density of clouds (higher performance) -/LessTrees (unsynced) Decreases the distance to the camera, in which trees are still shown (higher performance) +/LessTrees (unsynced) Decreases distance from the camera at which trees are still drawn /LODScale (unsynced) Set the scale for either of: LOD (level-of-detail), shadow-LOD, reflection-LOD, refraction-LOD /LuaGaia (unsynced) Redirects command /LuaGaia to its synced processor /LuaRules (unsynced) Redirects command /LuaRules to its synced processor +/LuaSave (unsynced) Save the game state to a specific file, add -y to overwrite when file is already present /LuaUI (unsynced) Allows one to reload or disable LuaUI, or alternatively to send a chat message to LuaUI -/MapBorder (unsynced) Set or toggle map border rendering +/MapBorder (unsynced) Set or toggle map-border rendering /MapMarks (unsynced) Enables/Disables map marks rendering +/mapmeshdrawer (unsynced) Switch map-mesh rendering modes: 0=GCM, 1=HLOD, 2=ROAM +/MapShadowPolyOffset (unsynced) /MaxNanoParticles (unsynced) Set the maximum number of nano-particles (Graphic setting) /MaxParticles (unsynced) Set the maximum number of particles (Graphics setting) /MiniMap (unsynced) FIXME document subcommands /MoreClouds (unsynced) Increases the density of clouds (lower performance) -/MoreTrees (unsynced) Increases the distance to the camera, in which trees are still shown (lower performance) +/MoreTrees (unsynced) Increases distance from the camera at which trees are still drawn /Mouse1 (unsynced) Simulates a mouse button press of button 1 /Mouse2 (unsynced) Simulates a mouse button press of button 2 /Mouse3 (unsynced) Simulates a mouse button press of button 3 @@ -132,9 +136,8 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /ReloadShaders (unsynced) Reloads all engine shaders /ResBar (unsynced) Shows/Hides team resource storage indicator bar /Resync (unsynced) Redirects command /Resync to its synced processor -/roam (unsynced) Disables/Enables ROAM mesh rendering: 0=off, 1=on /SafeGL (unsynced) Enables/Disables OpenGL safe-mode -/Save (unsynced) Save the game state to a specific file (BROKEN) +/Save (unsynced) Save the game state to a specific file, add -y to overwrite when file is already present /SaveGame (unsynced) Save the game state to QuickSave.ssf (BROKEN) /Say (unsynced) Say something in (public) chat /ScreenShot (unsynced) Take a screen-shot of the current view @@ -157,7 +160,7 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /SoundChannelEnable (unsynced) Enable/Disable specific sound channels: UnitReply, General, Battle, UserInterface, Music /SoundDevice (unsynced) Switch the sound output system (currently only OpenAL / NullAudio) /SpecFullView (unsynced) Sets or toggles between full LOS or ally-team LOS, if the local user is a spectator -/Spectator (unsynced) Lets the local user give up controll over a team, and start spectating +/Spectator (unsynced) Lets the local user give up control over a team, and start spectating /SpecTeam (unsynced) Lets the local user specify the team to follow, if he is a spectator /Speed (unsynced) Shows/Hides the simulation speed indicator /SpeedControl (unsynced) Sets how server adjusts speed according to player's load (CPU), 1: use average, 2: use highest, @@ -175,6 +178,10 @@ Spring Engine (v103) (This is a generic list, some commands may be applicable): /ViewSelection (unsynced) Moves the camera to the center of the currently selected units /VSync (unsynced) Enables/Disables vertical-sync (Graphics setting) /W (unsynced) Say something in private to a specific player, by player-name -/Water (unsynced) Set water rendering mode: 0=basic, 1=reflective, 2=dynamic, 3=reflective&refractive?, 4=bump-mapped +/Water (unsynced) Set water rendering mode: 0=basic, 1=reflective, 2=dynamic, 3=reflective&refractive, 4=bump-mapped /WByNum (unsynced) Say something in private to a specific player, by player-ID -/WireMap (unsynced) Enable/Disable drawing of the map as wire-frame (no textures) (Graphic setting) \ No newline at end of file +/WireMap (unsynced) Toggle wireframe-mode drawing of map geometry +/WireModel (unsynced) Toggle wireframe-mode drawing of model geometry +/WireSky (unsynced) Toggle wireframe-mode drawing of skydome geometry +/WireTree (unsynced) Toggle wireframe-mode drawing of tree geometry +/WireWater (unsynced) Toggle wireframe-mode drawing of water geometry \ No newline at end of file diff --git a/dummyfile.txt b/dummyfile.txt index 0b134c80c..b868c9703 100644 --- a/dummyfile.txt +++ b/dummyfile.txt @@ -1 +1 @@ -This is for a junk commit \ No newline at end of file +This is for a junk commit \ No newline at end of file diff --git a/fonts/JosefinSans-SemiBold.ttf b/fonts/JosefinSans-SemiBold.ttf new file mode 100644 index 000000000..1ca56c76e Binary files /dev/null and b/fonts/JosefinSans-SemiBold.ttf differ diff --git a/goldwave settings/lasers.jpg b/goldwave settings/lasers.jpg new file mode 100644 index 000000000..0d00560ab Binary files /dev/null and b/goldwave settings/lasers.jpg differ diff --git a/icons/z/source/PNGs/Arty.png b/icons/z/source/PNGs/Arty.png new file mode 100644 index 000000000..f1d2a1009 Binary files /dev/null and b/icons/z/source/PNGs/Arty.png differ diff --git a/icons/z/source/PNGs/Endbringer.png b/icons/z/source/PNGs/Endbringer.png new file mode 100644 index 000000000..2cd52167c Binary files /dev/null and b/icons/z/source/PNGs/Endbringer.png differ diff --git a/icons/z/source/PNGs/Swarm.png b/icons/z/source/PNGs/Swarm.png new file mode 100644 index 000000000..91e5370cd Binary files /dev/null and b/icons/z/source/PNGs/Swarm.png differ diff --git a/icons/z/source/PNGs/ZaalAirToAirFighter.png b/icons/z/source/PNGs/ZaalAirToAirFighter.png new file mode 100644 index 000000000..d86e186e8 Binary files /dev/null and b/icons/z/source/PNGs/ZaalAirToAirFighter.png differ diff --git a/icons/z/source/PNGs/ZaalAirToGroundFighter.png b/icons/z/source/PNGs/ZaalAirToGroundFighter.png new file mode 100644 index 000000000..a12bf7aaa Binary files /dev/null and b/icons/z/source/PNGs/ZaalAirToGroundFighter.png differ diff --git a/icons/z/source/PNGs/ZaalArmoredAssault.png b/icons/z/source/PNGs/ZaalArmoredAssault.png new file mode 100644 index 000000000..3938109a9 Binary files /dev/null and b/icons/z/source/PNGs/ZaalArmoredAssault.png differ diff --git a/icons/z/source/PNGs/ZaalArty.png b/icons/z/source/PNGs/ZaalArty.png new file mode 100644 index 000000000..d7cbb6d9e Binary files /dev/null and b/icons/z/source/PNGs/ZaalArty.png differ diff --git a/icons/z/source/PNGs/ZaalBase.png b/icons/z/source/PNGs/ZaalBase.png new file mode 100644 index 000000000..d5af0a651 Binary files /dev/null and b/icons/z/source/PNGs/ZaalBase.png differ diff --git a/icons/z/source/PNGs/ZaalBomber.png b/icons/z/source/PNGs/ZaalBomber.png new file mode 100644 index 000000000..1e1cc1f7b Binary files /dev/null and b/icons/z/source/PNGs/ZaalBomber.png differ diff --git a/icons/z/source/PNGs/ZaalMediumSwarmer.png b/icons/z/source/PNGs/ZaalMediumSwarmer.png new file mode 100644 index 000000000..166afcdfc Binary files /dev/null and b/icons/z/source/PNGs/ZaalMediumSwarmer.png differ diff --git a/icons/z/source/PNGs/ZaalQueen.png b/icons/z/source/PNGs/ZaalQueen.png new file mode 100644 index 000000000..1e04f55a9 Binary files /dev/null and b/icons/z/source/PNGs/ZaalQueen.png differ diff --git a/icons/z/source/PNGs/ZaalScout.png b/icons/z/source/PNGs/ZaalScout.png new file mode 100644 index 000000000..b07b80ae0 Binary files /dev/null and b/icons/z/source/PNGs/ZaalScout.png differ diff --git a/icons/z/source/PNGs/ZaalSkirmisher.png b/icons/z/source/PNGs/ZaalSkirmisher.png new file mode 100644 index 000000000..0a27bd344 Binary files /dev/null and b/icons/z/source/PNGs/ZaalSkirmisher.png differ diff --git a/icons/z/source/PNGs/ZaalSwarmer2.png b/icons/z/source/PNGs/ZaalSwarmer2.png new file mode 100644 index 000000000..2b0d12ed2 Binary files /dev/null and b/icons/z/source/PNGs/ZaalSwarmer2.png differ diff --git a/icons/z/source/PNGs/armor1.png b/icons/z/source/PNGs/armor1.png new file mode 100644 index 000000000..db0aa3436 Binary files /dev/null and b/icons/z/source/PNGs/armor1.png differ diff --git a/icons/z/source/PNGs/armor2.png b/icons/z/source/PNGs/armor2.png new file mode 100644 index 000000000..82396aba4 Binary files /dev/null and b/icons/z/source/PNGs/armor2.png differ diff --git a/icons/z/source/PNGs/armor3.png b/icons/z/source/PNGs/armor3.png new file mode 100644 index 000000000..d50c96934 Binary files /dev/null and b/icons/z/source/PNGs/armor3.png differ diff --git a/icons/z/source/ZaalAirBase.xcf b/icons/z/source/ZaalAirBase.xcf new file mode 100644 index 000000000..9198a6fb7 Binary files /dev/null and b/icons/z/source/ZaalAirBase.xcf differ diff --git a/icons/z/source/ZaalAirBomber.xcf b/icons/z/source/ZaalAirBomber.xcf new file mode 100644 index 000000000..8217ff44a Binary files /dev/null and b/icons/z/source/ZaalAirBomber.xcf differ diff --git a/icons/z/source/ZaalAirToAirFighter.xcf b/icons/z/source/ZaalAirToAirFighter.xcf new file mode 100644 index 000000000..f8d1b5d47 Binary files /dev/null and b/icons/z/source/ZaalAirToAirFighter.xcf differ diff --git a/icons/z/source/ZaalAirToGroundFighter.xcf b/icons/z/source/ZaalAirToGroundFighter.xcf new file mode 100644 index 000000000..dc89b06b9 Binary files /dev/null and b/icons/z/source/ZaalAirToGroundFighter.xcf differ diff --git a/icons/z/source/ZaalArmoredAssault.xcf b/icons/z/source/ZaalArmoredAssault.xcf new file mode 100644 index 000000000..7039f09f3 Binary files /dev/null and b/icons/z/source/ZaalArmoredAssault.xcf differ diff --git a/icons/z/source/ZaalArty.xcf b/icons/z/source/ZaalArty.xcf new file mode 100644 index 000000000..03c65443b Binary files /dev/null and b/icons/z/source/ZaalArty.xcf differ diff --git a/icons/z/source/ZaalBase.xcf b/icons/z/source/ZaalBase.xcf new file mode 100644 index 000000000..66c9fb966 Binary files /dev/null and b/icons/z/source/ZaalBase.xcf differ diff --git a/icons/z/source/ZaalMediumSwarmer.xcf b/icons/z/source/ZaalMediumSwarmer.xcf new file mode 100644 index 000000000..4feec5d92 Binary files /dev/null and b/icons/z/source/ZaalMediumSwarmer.xcf differ diff --git a/icons/z/source/ZaalQueen.xcf b/icons/z/source/ZaalQueen.xcf new file mode 100644 index 000000000..d887131b9 Binary files /dev/null and b/icons/z/source/ZaalQueen.xcf differ diff --git a/icons/z/source/ZaalSkirmisher.xcf b/icons/z/source/ZaalSkirmisher.xcf new file mode 100644 index 000000000..ada72fb3d Binary files /dev/null and b/icons/z/source/ZaalSkirmisher.xcf differ diff --git a/icons/z/source/ZaalSwarmer.xcf b/icons/z/source/ZaalSwarmer.xcf new file mode 100644 index 000000000..af39ffcef Binary files /dev/null and b/icons/z/source/ZaalSwarmer.xcf differ diff --git a/icons/z/zairscout.png b/icons/z/zairscout.png new file mode 100644 index 000000000..b07b80ae0 Binary files /dev/null and b/icons/z/zairscout.png differ diff --git a/icons/z/zairtoairfighter.png b/icons/z/zairtoairfighter.png new file mode 100644 index 000000000..d86e186e8 Binary files /dev/null and b/icons/z/zairtoairfighter.png differ diff --git a/icons/z/zairtogroundfighter.png b/icons/z/zairtogroundfighter.png new file mode 100644 index 000000000..a12bf7aaa Binary files /dev/null and b/icons/z/zairtogroundfighter.png differ diff --git a/icons/z/zarty.png b/icons/z/zarty.png new file mode 100644 index 000000000..d7cbb6d9e Binary files /dev/null and b/icons/z/zarty.png differ diff --git a/icons/z/zassault.png b/icons/z/zassault.png new file mode 100644 index 000000000..3938109a9 Binary files /dev/null and b/icons/z/zassault.png differ diff --git a/icons/z/zbomber.png b/icons/z/zbomber.png new file mode 100644 index 000000000..1e1cc1f7b Binary files /dev/null and b/icons/z/zbomber.png differ diff --git a/icons/z/zmedswarm.png b/icons/z/zmedswarm.png new file mode 100644 index 000000000..166afcdfc Binary files /dev/null and b/icons/z/zmedswarm.png differ diff --git a/icons/z/zpyro.png b/icons/z/zpyro.png new file mode 100644 index 000000000..8015a4f19 Binary files /dev/null and b/icons/z/zpyro.png differ diff --git a/icons/z/zqueen.png b/icons/z/zqueen.png new file mode 100644 index 000000000..1e04f55a9 Binary files /dev/null and b/icons/z/zqueen.png differ diff --git a/icons/z/zskirmisher.png b/icons/z/zskirmisher.png new file mode 100644 index 000000000..0a27bd344 Binary files /dev/null and b/icons/z/zskirmisher.png differ diff --git a/icons/z/zswarm.png b/icons/z/zswarm.png new file mode 100644 index 000000000..2b0d12ed2 Binary files /dev/null and b/icons/z/zswarm.png differ diff --git a/license.txt b/license.txt deleted file mode 100644 index 56f1d46e1..000000000 --- a/license.txt +++ /dev/null @@ -1 +0,0 @@ -All assets are CC BY SA except where otherwise marked (Most LUA falls under GPL, for example). \ No newline at end of file diff --git a/lups/particleclasses/unitjitter.lua b/lups/particleclasses/unitjitter.lua index 4eac73a41..d27a2397b 100644 --- a/lups/particleclasses/unitjitter.lua +++ b/lups/particleclasses/unitjitter.lua @@ -261,7 +261,8 @@ function UnitJitter:CreateParticle() end function UnitJitter:Visible() - if self.allyTeam == LocalAllyTeamID then + if LocalAllyTeamID == -2 -- spec full view + or LocalAllyTeamID == self.allyTeam then return Spring.IsUnitVisible(self.unit, 0, true) -- Don't draw for icons end diff --git a/modinfo.lua b/modinfo.lua index 1c9a0417d..3a800d498 100644 --- a/modinfo.lua +++ b/modinfo.lua @@ -13,13 +13,15 @@ return { name='Evolution RTS -', description='EvoRTS', shortname='EvoRTS', - version='$VERSION', + version='dev', mutator='Official', game='Evolution RTS', shortGame='EvoRTS', modtype=1, depend = { - "Spring Features v1.9", + "Evolution RTS Music Addon v3", + -- "Spring Features v1.9", + -- "Evolution RTS Music Addon v1", -- "Shard LuaAI $VERSION", -- "Evolution RTS Shard LuaAI $VERSION", }, diff --git a/sounds/acknowledgements/dothis.wav b/sounds/acknowledgements/dothis.wav new file mode 100644 index 000000000..e2ac0f66a Binary files /dev/null and b/sounds/acknowledgements/dothis.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Death 1.wav b/sounds/deathsounds/bug/Huge monster Death 1.wav new file mode 100644 index 000000000..6dfcb4a9b Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Death 1.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Death 2.wav b/sounds/deathsounds/bug/Huge monster Death 2.wav new file mode 100644 index 000000000..a0b2d6797 Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Death 2.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 1.wav b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 1.wav new file mode 100644 index 000000000..9f28afec5 Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 1.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 2.wav b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 2.wav new file mode 100644 index 000000000..fde421881 Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 2.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 3.wav b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 3.wav new file mode 100644 index 000000000..2eba3c5ea Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 3.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 4.wav b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 4.wav new file mode 100644 index 000000000..d2a131537 Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 4.wav differ diff --git a/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 5.wav b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 5.wav new file mode 100644 index 000000000..087f97da0 Binary files /dev/null and b/sounds/deathsounds/bug/Huge monster Grunt (Gets hit) 5.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Death 1.wav b/sounds/deathsounds/bug/Medium monster Death 1.wav new file mode 100644 index 000000000..e7b0a019e Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Death 1.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Death 2.wav b/sounds/deathsounds/bug/Medium monster Death 2.wav new file mode 100644 index 000000000..454f18be6 Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Death 2.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 1.wav b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 1.wav new file mode 100644 index 000000000..73b9cfd5b Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 1.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 2.wav b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 2.wav new file mode 100644 index 000000000..8f8c1727d Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 2.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 3.wav b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 3.wav new file mode 100644 index 000000000..05c520bea Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 3.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 4.wav b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 4.wav new file mode 100644 index 000000000..e32629e6b Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 4.wav differ diff --git a/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 5.wav b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 5.wav new file mode 100644 index 000000000..d7e9dc964 Binary files /dev/null and b/sounds/deathsounds/bug/Medium monster Grunt (Gets hit) 5.wav differ diff --git a/sounds/deathsounds/bug/Small monster Death 1.wav b/sounds/deathsounds/bug/Small monster Death 1.wav new file mode 100644 index 000000000..91d8b8307 Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Death 1.wav differ diff --git a/sounds/deathsounds/bug/Small monster Death 2.wav b/sounds/deathsounds/bug/Small monster Death 2.wav new file mode 100644 index 000000000..c895b305e Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Death 2.wav differ diff --git a/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 1.wav b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 1.wav new file mode 100644 index 000000000..9bb7088f1 Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 1.wav differ diff --git a/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 2.wav b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 2.wav new file mode 100644 index 000000000..3e05c4bfa Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 2.wav differ diff --git a/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 3.wav b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 3.wav new file mode 100644 index 000000000..79745d353 Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 3.wav differ diff --git a/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 4.wav b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 4.wav new file mode 100644 index 000000000..bd8e18236 Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 4.wav differ diff --git a/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 5.wav b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 5.wav new file mode 100644 index 000000000..fa575ca1b Binary files /dev/null and b/sounds/deathsounds/bug/Small monster Grunt (Gets hit) 5.wav differ diff --git a/sounds/deathsounds/bug/bugdie-12.wav b/sounds/deathsounds/bug/bugdie-12.wav new file mode 100644 index 000000000..a100d7957 Binary files /dev/null and b/sounds/deathsounds/bug/bugdie-12.wav differ diff --git a/sounds/deathsounds/bug/bugdie.wav b/sounds/deathsounds/bug/bugdie.wav new file mode 100644 index 000000000..f7695c1e3 Binary files /dev/null and b/sounds/deathsounds/bug/bugdie.wav differ diff --git a/sounds/deathsounds/bug/bugdie12.wav b/sounds/deathsounds/bug/bugdie12.wav new file mode 100644 index 000000000..750bf94f3 Binary files /dev/null and b/sounds/deathsounds/bug/bugdie12.wav differ diff --git a/sounds/deathsounds/bug/large monster Death 1.wav b/sounds/deathsounds/bug/large monster Death 1.wav new file mode 100644 index 000000000..0bffbb517 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Death 1.wav differ diff --git a/sounds/deathsounds/bug/large monster Death 2.wav b/sounds/deathsounds/bug/large monster Death 2.wav new file mode 100644 index 000000000..9a69fdf42 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Death 2.wav differ diff --git a/sounds/deathsounds/bug/large monster Grunt (Gets hit) 1.wav b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 1.wav new file mode 100644 index 000000000..3bebfcb51 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 1.wav differ diff --git a/sounds/deathsounds/bug/large monster Grunt (Gets hit) 2.wav b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 2.wav new file mode 100644 index 000000000..4d2f80d46 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 2.wav differ diff --git a/sounds/deathsounds/bug/large monster Grunt (Gets hit) 3.wav b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 3.wav new file mode 100644 index 000000000..918ece451 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 3.wav differ diff --git a/sounds/deathsounds/bug/large monster Grunt (Gets hit) 4.wav b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 4.wav new file mode 100644 index 000000000..3a35c9750 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 4.wav differ diff --git a/sounds/deathsounds/bug/large monster Grunt (Gets hit) 5.wav b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 5.wav new file mode 100644 index 000000000..a5c13e051 Binary files /dev/null and b/sounds/deathsounds/bug/large monster Grunt (Gets hit) 5.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 1.wav b/sounds/deathsounds/bugqueen/DEATH 1.wav new file mode 100644 index 000000000..d533a9c3b Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 1.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 10.wav b/sounds/deathsounds/bugqueen/DEATH 10.wav new file mode 100644 index 000000000..35b0a683c Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 10.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 2.wav b/sounds/deathsounds/bugqueen/DEATH 2.wav new file mode 100644 index 000000000..6794993c9 Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 2.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 3.wav b/sounds/deathsounds/bugqueen/DEATH 3.wav new file mode 100644 index 000000000..9b7911547 Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 3.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 4.wav b/sounds/deathsounds/bugqueen/DEATH 4.wav new file mode 100644 index 000000000..5eee4fd92 Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 4.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 5.wav b/sounds/deathsounds/bugqueen/DEATH 5.wav new file mode 100644 index 000000000..450c67e4d Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 5.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 6.wav b/sounds/deathsounds/bugqueen/DEATH 6.wav new file mode 100644 index 000000000..15a8f108a Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 6.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 7.wav b/sounds/deathsounds/bugqueen/DEATH 7.wav new file mode 100644 index 000000000..8fe5e5944 Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 7.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 8.wav b/sounds/deathsounds/bugqueen/DEATH 8.wav new file mode 100644 index 000000000..676977bbd Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 8.wav differ diff --git a/sounds/deathsounds/bugqueen/DEATH 9.wav b/sounds/deathsounds/bugqueen/DEATH 9.wav new file mode 100644 index 000000000..366d9ca5b Binary files /dev/null and b/sounds/deathsounds/bugqueen/DEATH 9.wav differ diff --git a/sounds/deathsounds/generic/Explosion Barrel_01.wav b/sounds/deathsounds/generic/Explosion Barrel_01.wav new file mode 100644 index 000000000..f0500f521 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Barrel_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion C4_01.wav b/sounds/deathsounds/generic/Explosion C4_01.wav new file mode 100644 index 000000000..a9665b159 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion C4_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion C4_02.wav b/sounds/deathsounds/generic/Explosion C4_02.wav new file mode 100644 index 000000000..3d7899ca6 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion C4_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Car_01.wav b/sounds/deathsounds/generic/Explosion Car_01.wav new file mode 100644 index 000000000..23fffc0e4 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Car_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Car_02.wav b/sounds/deathsounds/generic/Explosion Car_02.wav new file mode 100644 index 000000000..c88996a86 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Car_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Car_03.wav b/sounds/deathsounds/generic/Explosion Car_03.wav new file mode 100644 index 000000000..aff4750bb Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Car_03.wav differ diff --git a/sounds/deathsounds/generic/Explosion Car_04.wav b/sounds/deathsounds/generic/Explosion Car_04.wav new file mode 100644 index 000000000..160154cf8 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Car_04.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_01.wav b/sounds/deathsounds/generic/Explosion Classic_01.wav new file mode 100644 index 000000000..ae54a53fe Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_02.wav b/sounds/deathsounds/generic/Explosion Classic_02.wav new file mode 100644 index 000000000..e1c2299ad Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_03.wav b/sounds/deathsounds/generic/Explosion Classic_03.wav new file mode 100644 index 000000000..e42340694 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_03.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_04.wav b/sounds/deathsounds/generic/Explosion Classic_04.wav new file mode 100644 index 000000000..072936a33 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_04.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_05.wav b/sounds/deathsounds/generic/Explosion Classic_05.wav new file mode 100644 index 000000000..48565804b Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_05.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_06.wav b/sounds/deathsounds/generic/Explosion Classic_06.wav new file mode 100644 index 000000000..ce3d61149 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_06.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_07.wav b/sounds/deathsounds/generic/Explosion Classic_07.wav new file mode 100644 index 000000000..526a06686 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_07.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_08.wav b/sounds/deathsounds/generic/Explosion Classic_08.wav new file mode 100644 index 000000000..d1047cd14 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_08.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_09.wav b/sounds/deathsounds/generic/Explosion Classic_09.wav new file mode 100644 index 000000000..34919088d Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_09.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_10.wav b/sounds/deathsounds/generic/Explosion Classic_10.wav new file mode 100644 index 000000000..120d19481 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_10.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_11.wav b/sounds/deathsounds/generic/Explosion Classic_11.wav new file mode 100644 index 000000000..e81e9e338 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_11.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_12.wav b/sounds/deathsounds/generic/Explosion Classic_12.wav new file mode 100644 index 000000000..4dbdff109 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_12.wav differ diff --git a/sounds/deathsounds/generic/Explosion Classic_13.wav b/sounds/deathsounds/generic/Explosion Classic_13.wav new file mode 100644 index 000000000..5c892f077 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Classic_13.wav differ diff --git a/sounds/deathsounds/generic/Explosion Fireworks_01.wav b/sounds/deathsounds/generic/Explosion Fireworks_01.wav new file mode 100644 index 000000000..25d275c02 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Fireworks_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Fireworks_02.wav b/sounds/deathsounds/generic/Explosion Fireworks_02.wav new file mode 100644 index 000000000..5064a497e Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Fireworks_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_01.wav b/sounds/deathsounds/generic/Explosion Flesh_01.wav new file mode 100644 index 000000000..a898e68b2 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_02.wav b/sounds/deathsounds/generic/Explosion Flesh_02.wav new file mode 100644 index 000000000..456451911 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_03.wav b/sounds/deathsounds/generic/Explosion Flesh_03.wav new file mode 100644 index 000000000..7e57f7834 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_03.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_04.wav b/sounds/deathsounds/generic/Explosion Flesh_04.wav new file mode 100644 index 000000000..eccb5b331 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_04.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_05.wav b/sounds/deathsounds/generic/Explosion Flesh_05.wav new file mode 100644 index 000000000..3bf89b3d0 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_05.wav differ diff --git a/sounds/deathsounds/generic/Explosion Flesh_06.wav b/sounds/deathsounds/generic/Explosion Flesh_06.wav new file mode 100644 index 000000000..39d338daa Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Flesh_06.wav differ diff --git a/sounds/deathsounds/generic/Explosion Gas_01.wav b/sounds/deathsounds/generic/Explosion Gas_01.wav new file mode 100644 index 000000000..503c4c6c9 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Gas_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Gas_02.wav b/sounds/deathsounds/generic/Explosion Gas_02.wav new file mode 100644 index 000000000..54e61d506 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Gas_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Glass_01.wav b/sounds/deathsounds/generic/Explosion Glass_01.wav new file mode 100644 index 000000000..294297713 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Glass_01.wav differ diff --git a/sounds/deathsounds/generic/Explosion Glass_02.wav b/sounds/deathsounds/generic/Explosion Glass_02.wav new file mode 100644 index 000000000..d5dcf11c6 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Glass_02.wav differ diff --git a/sounds/deathsounds/generic/Explosion Glass_03.wav b/sounds/deathsounds/generic/Explosion Glass_03.wav new file mode 100644 index 000000000..fbd984a86 Binary files /dev/null and b/sounds/deathsounds/generic/Explosion Glass_03.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_01.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_01.wav new file mode 100644 index 000000000..9779c5a92 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_01.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_02.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_02.wav new file mode 100644 index 000000000..75d9d79c0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_02.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_03.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_03.wav new file mode 100644 index 000000000..93b4af5bb Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_03.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_04.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_04.wav new file mode 100644 index 000000000..4a32d746b Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_04.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_05.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_05.wav new file mode 100644 index 000000000..f6c2b151f Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_05.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_06.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_06.wav new file mode 100644 index 000000000..1bb9ee1de Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_06.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_07.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_07.wav new file mode 100644 index 000000000..f463ac490 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_07.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_08.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_08.wav new file mode 100644 index 000000000..0a8be7f51 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_08.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_09.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_09.wav new file mode 100644 index 000000000..a467d8c1d Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_09.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_10.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_10.wav new file mode 100644 index 000000000..b6c0afb42 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_10.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_11.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_11.wav new file mode 100644 index 000000000..b88b82179 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_11.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_12.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_12.wav new file mode 100644 index 000000000..ca1597ce0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_12.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_13.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_13.wav new file mode 100644 index 000000000..fd09f3ad8 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_13.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_14.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_14.wav new file mode 100644 index 000000000..85c9d6248 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_14.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_15.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_15.wav new file mode 100644 index 000000000..537451e78 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_15.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_16.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_16.wav new file mode 100644 index 000000000..1611a1fb3 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_16.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_17.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_17.wav new file mode 100644 index 000000000..fb873b229 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_17.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_18.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_18.wav new file mode 100644 index 000000000..e8d8860ad Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_18.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_19.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_19.wav new file mode 100644 index 000000000..7a73a9280 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_19.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_20.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_20.wav new file mode 100644 index 000000000..03db3df8d Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_20.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_21.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_21.wav new file mode 100644 index 000000000..b828126bf Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_21.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_22.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_22.wav new file mode 100644 index 000000000..cde9c2088 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_22.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_23.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_23.wav new file mode 100644 index 000000000..0bae15651 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_23.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_24.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_24.wav new file mode 100644 index 000000000..44d02bfce Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_24.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_25.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_25.wav new file mode 100644 index 000000000..08605716d Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_25.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_26.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_26.wav new file mode 100644 index 000000000..8441a5c6a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_26.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_27.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_27.wav new file mode 100644 index 000000000..ce386ba20 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_27.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_28.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_28.wav new file mode 100644 index 000000000..41b870f01 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_CloseExplosion_28.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_01.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_01.wav new file mode 100644 index 000000000..ee2b144e4 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_01.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_02.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_02.wav new file mode 100644 index 000000000..52d996d66 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_02.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_03.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_03.wav new file mode 100644 index 000000000..9d9ef7661 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_03.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_04.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_04.wav new file mode 100644 index 000000000..18e808e18 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_04.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_05.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_05.wav new file mode 100644 index 000000000..3c7296219 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_05.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_06.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_06.wav new file mode 100644 index 000000000..aebfeba9a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_06.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_07.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_07.wav new file mode 100644 index 000000000..0a6011455 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_07.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_08.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_08.wav new file mode 100644 index 000000000..46028dcdf Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_08.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_09.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_09.wav new file mode 100644 index 000000000..e77c108c2 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_09.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_10.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_10.wav new file mode 100644 index 000000000..4d6d8a762 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_10.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_11.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_11.wav new file mode 100644 index 000000000..ba177ae38 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_11.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_12.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_12.wav new file mode 100644 index 000000000..726bdba0a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_12.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_13.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_13.wav new file mode 100644 index 000000000..91ab5add9 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_13.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_14.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_14.wav new file mode 100644 index 000000000..6b2896d98 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_14.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_15.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_15.wav new file mode 100644 index 000000000..172d27c0a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_15.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_16.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_16.wav new file mode 100644 index 000000000..6adfb121d Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_16.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_17.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_17.wav new file mode 100644 index 000000000..29ce9b40e Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_17.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_18.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_18.wav new file mode 100644 index 000000000..e4d405ed0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_18.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_19.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_19.wav new file mode 100644 index 000000000..994ffb867 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_19.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_20.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_20.wav new file mode 100644 index 000000000..044fc9742 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_20.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_21.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_21.wav new file mode 100644 index 000000000..6838ba8ed Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_21.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_22.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_22.wav new file mode 100644 index 000000000..9b65c25a0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_22.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_23.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_23.wav new file mode 100644 index 000000000..4f4da3a92 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_23.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_24.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_24.wav new file mode 100644 index 000000000..6f19d169f Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_24.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_25.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_25.wav new file mode 100644 index 000000000..4c4d92fbf Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_25.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_26.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_26.wav new file mode 100644 index 000000000..a6c6f008a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_26.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_27.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_27.wav new file mode 100644 index 000000000..a6933c493 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_27.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_28.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_28.wav new file mode 100644 index 000000000..50b59fd48 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_DistantExplosion_28.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_01.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_01.wav new file mode 100644 index 000000000..4f7fa33ec Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_01.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_02.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_02.wav new file mode 100644 index 000000000..45970742c Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_02.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_03.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_03.wav new file mode 100644 index 000000000..6c50e1ae4 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_03.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_04.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_04.wav new file mode 100644 index 000000000..ec74f6965 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_04.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_05.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_05.wav new file mode 100644 index 000000000..4209819d3 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_05.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_06.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_06.wav new file mode 100644 index 000000000..8ffc4da51 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_06.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_07.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_07.wav new file mode 100644 index 000000000..25095ea77 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_07.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_08.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_08.wav new file mode 100644 index 000000000..fa2d416fd Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_08.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_09.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_09.wav new file mode 100644 index 000000000..a17863862 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_09.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_10.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_10.wav new file mode 100644 index 000000000..ba07c608a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_10.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_11.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_11.wav new file mode 100644 index 000000000..107a5fc1c Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_11.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_12.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_12.wav new file mode 100644 index 000000000..f00d12d26 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_12.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_13.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_13.wav new file mode 100644 index 000000000..6e7125935 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_13.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_14.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_14.wav new file mode 100644 index 000000000..485892f11 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_14.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_15.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_15.wav new file mode 100644 index 000000000..5a0ba3927 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_15.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_16.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_16.wav new file mode 100644 index 000000000..d7b2036cb Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_16.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_17.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_17.wav new file mode 100644 index 000000000..4e39c89b0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_17.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_18.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_18.wav new file mode 100644 index 000000000..8050d98a0 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_18.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_19.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_19.wav new file mode 100644 index 000000000..15bcb0a31 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_19.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_20.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_20.wav new file mode 100644 index 000000000..3d0a8de19 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_20.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_21.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_21.wav new file mode 100644 index 000000000..449709519 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_21.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_22.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_22.wav new file mode 100644 index 000000000..a7af8923c Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_22.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_23.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_23.wav new file mode 100644 index 000000000..406fd101e Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_23.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_24.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_24.wav new file mode 100644 index 000000000..fb9887c40 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_24.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_25.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_25.wav new file mode 100644 index 000000000..7a98b901a Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_25.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_26.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_26.wav new file mode 100644 index 000000000..b0fb9f493 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_26.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_27.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_27.wav new file mode 100644 index 000000000..1127a3ce4 Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_27.wav differ diff --git a/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_28.wav b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_28.wav new file mode 100644 index 000000000..76898400b Binary files /dev/null and b/sounds/deathsounds/generic/TomWinandySFX_Explosions Volume I_MediumExplosion_28.wav differ diff --git a/sounds/deathsounds/generic/explo1.wav b/sounds/deathsounds/generic/explo1.wav new file mode 100644 index 000000000..28f43ef99 Binary files /dev/null and b/sounds/deathsounds/generic/explo1.wav differ diff --git a/sounds/deathsounds/generic/explo10.wav b/sounds/deathsounds/generic/explo10.wav new file mode 100644 index 000000000..d5c608fcf Binary files /dev/null and b/sounds/deathsounds/generic/explo10.wav differ diff --git a/sounds/deathsounds/generic/explo11.wav b/sounds/deathsounds/generic/explo11.wav new file mode 100644 index 000000000..cb3225743 Binary files /dev/null and b/sounds/deathsounds/generic/explo11.wav differ diff --git a/sounds/deathsounds/generic/explo12.wav b/sounds/deathsounds/generic/explo12.wav new file mode 100644 index 000000000..ca91a7798 Binary files /dev/null and b/sounds/deathsounds/generic/explo12.wav differ diff --git a/sounds/deathsounds/generic/explo13.wav b/sounds/deathsounds/generic/explo13.wav new file mode 100644 index 000000000..4d8a9ed42 Binary files /dev/null and b/sounds/deathsounds/generic/explo13.wav differ diff --git a/sounds/deathsounds/generic/explo14.wav b/sounds/deathsounds/generic/explo14.wav new file mode 100644 index 000000000..c1a401f7d Binary files /dev/null and b/sounds/deathsounds/generic/explo14.wav differ diff --git a/sounds/deathsounds/generic/explo15.wav b/sounds/deathsounds/generic/explo15.wav new file mode 100644 index 000000000..a5e1cf39f Binary files /dev/null and b/sounds/deathsounds/generic/explo15.wav differ diff --git a/sounds/deathsounds/generic/explo16.wav b/sounds/deathsounds/generic/explo16.wav new file mode 100644 index 000000000..984c92f79 Binary files /dev/null and b/sounds/deathsounds/generic/explo16.wav differ diff --git a/sounds/deathsounds/generic/explo17.wav b/sounds/deathsounds/generic/explo17.wav new file mode 100644 index 000000000..69035df62 Binary files /dev/null and b/sounds/deathsounds/generic/explo17.wav differ diff --git a/sounds/deathsounds/generic/explo18.wav b/sounds/deathsounds/generic/explo18.wav new file mode 100644 index 000000000..e814dce36 Binary files /dev/null and b/sounds/deathsounds/generic/explo18.wav differ diff --git a/sounds/deathsounds/generic/explo19.wav b/sounds/deathsounds/generic/explo19.wav new file mode 100644 index 000000000..9378c0b29 Binary files /dev/null and b/sounds/deathsounds/generic/explo19.wav differ diff --git a/sounds/deathsounds/generic/explo2.wav b/sounds/deathsounds/generic/explo2.wav new file mode 100644 index 000000000..9ff0b7d09 Binary files /dev/null and b/sounds/deathsounds/generic/explo2.wav differ diff --git a/sounds/deathsounds/generic/explo20.wav b/sounds/deathsounds/generic/explo20.wav new file mode 100644 index 000000000..ffbc42ba5 Binary files /dev/null and b/sounds/deathsounds/generic/explo20.wav differ diff --git a/sounds/deathsounds/generic/explo21.wav b/sounds/deathsounds/generic/explo21.wav new file mode 100644 index 000000000..3d6339a27 Binary files /dev/null and b/sounds/deathsounds/generic/explo21.wav differ diff --git a/sounds/deathsounds/generic/explo22.wav b/sounds/deathsounds/generic/explo22.wav new file mode 100644 index 000000000..6ebfe8fea Binary files /dev/null and b/sounds/deathsounds/generic/explo22.wav differ diff --git a/sounds/deathsounds/generic/explo23.wav b/sounds/deathsounds/generic/explo23.wav new file mode 100644 index 000000000..c2c32aa5c Binary files /dev/null and b/sounds/deathsounds/generic/explo23.wav differ diff --git a/sounds/deathsounds/generic/explo24.wav b/sounds/deathsounds/generic/explo24.wav new file mode 100644 index 000000000..dbe38ef74 Binary files /dev/null and b/sounds/deathsounds/generic/explo24.wav differ diff --git a/sounds/deathsounds/generic/explo25.wav b/sounds/deathsounds/generic/explo25.wav new file mode 100644 index 000000000..0b83a5290 Binary files /dev/null and b/sounds/deathsounds/generic/explo25.wav differ diff --git a/sounds/deathsounds/generic/explo26.wav b/sounds/deathsounds/generic/explo26.wav new file mode 100644 index 000000000..54b287c84 Binary files /dev/null and b/sounds/deathsounds/generic/explo26.wav differ diff --git a/sounds/deathsounds/generic/explo27.wav b/sounds/deathsounds/generic/explo27.wav new file mode 100644 index 000000000..63c1e5e5a Binary files /dev/null and b/sounds/deathsounds/generic/explo27.wav differ diff --git a/sounds/deathsounds/generic/explo28.wav b/sounds/deathsounds/generic/explo28.wav new file mode 100644 index 000000000..8a16578f2 Binary files /dev/null and b/sounds/deathsounds/generic/explo28.wav differ diff --git a/sounds/deathsounds/generic/explo29.wav b/sounds/deathsounds/generic/explo29.wav new file mode 100644 index 000000000..c59f8e0a7 Binary files /dev/null and b/sounds/deathsounds/generic/explo29.wav differ diff --git a/sounds/deathsounds/generic/explo3.wav b/sounds/deathsounds/generic/explo3.wav new file mode 100644 index 000000000..bbebc3998 Binary files /dev/null and b/sounds/deathsounds/generic/explo3.wav differ diff --git a/sounds/deathsounds/generic/explo30.wav b/sounds/deathsounds/generic/explo30.wav new file mode 100644 index 000000000..8591457d4 Binary files /dev/null and b/sounds/deathsounds/generic/explo30.wav differ diff --git a/sounds/deathsounds/generic/explo4.wav b/sounds/deathsounds/generic/explo4.wav new file mode 100644 index 000000000..0bf55dd7c Binary files /dev/null and b/sounds/deathsounds/generic/explo4.wav differ diff --git a/sounds/deathsounds/generic/explo5.wav b/sounds/deathsounds/generic/explo5.wav new file mode 100644 index 000000000..8a18ad0d8 Binary files /dev/null and b/sounds/deathsounds/generic/explo5.wav differ diff --git a/sounds/deathsounds/generic/explo6.wav b/sounds/deathsounds/generic/explo6.wav new file mode 100644 index 000000000..d2a3134f0 Binary files /dev/null and b/sounds/deathsounds/generic/explo6.wav differ diff --git a/sounds/deathsounds/generic/explo7.wav b/sounds/deathsounds/generic/explo7.wav new file mode 100644 index 000000000..3546c72a1 Binary files /dev/null and b/sounds/deathsounds/generic/explo7.wav differ diff --git a/sounds/deathsounds/generic/explo8.wav b/sounds/deathsounds/generic/explo8.wav new file mode 100644 index 000000000..ca87db12a Binary files /dev/null and b/sounds/deathsounds/generic/explo8.wav differ diff --git a/sounds/deathsounds/generic/explo9.wav b/sounds/deathsounds/generic/explo9.wav new file mode 100644 index 000000000..6bf5df6b5 Binary files /dev/null and b/sounds/deathsounds/generic/explo9.wav differ diff --git a/sounds/deathsounds/nuke/nukeexplo1.wav b/sounds/deathsounds/nuke/nukeexplo1.wav new file mode 100644 index 000000000..3761e860f Binary files /dev/null and b/sounds/deathsounds/nuke/nukeexplo1.wav differ diff --git a/sounds/miscfx/buildstart-mechanical.wav b/sounds/miscfx/buildstart-mechanical.wav new file mode 100644 index 000000000..af3aa8825 Binary files /dev/null and b/sounds/miscfx/buildstart-mechanical.wav differ diff --git a/sounds/miscfx/buildstart-nano.wav b/sounds/miscfx/buildstart-nano.wav new file mode 100644 index 000000000..f7d26332f Binary files /dev/null and b/sounds/miscfx/buildstart-nano.wav differ diff --git a/sounds/ui/evolutionfinished.wav b/sounds/ui/evolutionfinished.wav new file mode 100644 index 000000000..1087535a2 Binary files /dev/null and b/sounds/ui/evolutionfinished.wav differ diff --git a/sounds/ui/zaal/bugselect.wav b/sounds/ui/zaal/bugselect.wav new file mode 100644 index 000000000..0bb4c86d5 Binary files /dev/null and b/sounds/ui/zaal/bugselect.wav differ diff --git a/sounds/unitselections/amphibselect.wav b/sounds/unitselections/amphibselect.wav new file mode 100644 index 000000000..42aa31a06 Binary files /dev/null and b/sounds/unitselections/amphibselect.wav differ diff --git a/sounds/unitselections/engineidle.wav b/sounds/unitselections/engineidle.wav new file mode 100644 index 000000000..2dedf9ccf Binary files /dev/null and b/sounds/unitselections/engineidle.wav differ diff --git a/sounds/unitselections/enginestart.wav b/sounds/unitselections/enginestart.wav new file mode 100644 index 000000000..c7096928c Binary files /dev/null and b/sounds/unitselections/enginestart.wav differ diff --git a/sounds/voice/scavengers/BotrailcannonDetected.wav b/sounds/voice/scavengers/BotrailcannonDetected.wav new file mode 100644 index 000000000..7280a6c38 Binary files /dev/null and b/sounds/voice/scavengers/BotrailcannonDetected.wav differ diff --git a/sounds/voice/scavengers/DemonDetected.wav b/sounds/voice/scavengers/DemonDetected.wav new file mode 100644 index 000000000..2b0fb97fe Binary files /dev/null and b/sounds/voice/scavengers/DemonDetected.wav differ diff --git a/sounds/voice/scavengers/EpicDragonDetected.wav b/sounds/voice/scavengers/EpicDragonDetected.wav new file mode 100644 index 000000000..518304b9e Binary files /dev/null and b/sounds/voice/scavengers/EpicDragonDetected.wav differ diff --git a/sounds/voice/scavengers/EpicGruntDetected.wav b/sounds/voice/scavengers/EpicGruntDetected.wav new file mode 100644 index 000000000..48f50f2d6 Binary files /dev/null and b/sounds/voice/scavengers/EpicGruntDetected.wav differ diff --git a/sounds/voice/scavengers/EpicPawnDetected.wav b/sounds/voice/scavengers/EpicPawnDetected.wav new file mode 100644 index 000000000..9177aab12 Binary files /dev/null and b/sounds/voice/scavengers/EpicPawnDetected.wav differ diff --git a/sounds/voice/scavengers/EpicTzarDetected.wav b/sounds/voice/scavengers/EpicTzarDetected.wav new file mode 100644 index 000000000..d4e6d4fdd Binary files /dev/null and b/sounds/voice/scavengers/EpicTzarDetected.wav differ diff --git a/sounds/voice/scavengers/RatteDetected.wav b/sounds/voice/scavengers/RatteDetected.wav new file mode 100644 index 000000000..6ecbf8a21 Binary files /dev/null and b/sounds/voice/scavengers/RatteDetected.wav differ diff --git a/sounds/voice/scavengers/SuperKrogDetected.wav b/sounds/voice/scavengers/SuperKrogDetected.wav new file mode 100644 index 000000000..a615f3069 Binary files /dev/null and b/sounds/voice/scavengers/SuperKrogDetected.wav differ diff --git a/sounds/voice/scavengers/SuperKrowDetected.wav b/sounds/voice/scavengers/SuperKrowDetected.wav new file mode 100644 index 000000000..fbc1ad99f Binary files /dev/null and b/sounds/voice/scavengers/SuperKrowDetected.wav differ diff --git a/sounds/voice/scavengers/SuperPeeWeeDetected.wav b/sounds/voice/scavengers/SuperPeeWeeDetected.wav new file mode 100644 index 000000000..3a44c0fd1 Binary files /dev/null and b/sounds/voice/scavengers/SuperPeeWeeDetected.wav differ diff --git a/sounds/voice/scavengers/SuperStumpyDetected.wav b/sounds/voice/scavengers/SuperStumpyDetected.wav new file mode 100644 index 000000000..df9448f29 Binary files /dev/null and b/sounds/voice/scavengers/SuperStumpyDetected.wav differ diff --git a/sounds/voice/scavengers/additionalforcesjoining.wav b/sounds/voice/scavengers/additionalforcesjoining.wav new file mode 100644 index 000000000..ee5e86b2a Binary files /dev/null and b/sounds/voice/scavengers/additionalforcesjoining.wav differ diff --git a/sounds/voice/scavengers/additionalunitsdropping.wav b/sounds/voice/scavengers/additionalunitsdropping.wav new file mode 100644 index 000000000..4a7b100e5 Binary files /dev/null and b/sounds/voice/scavengers/additionalunitsdropping.wav differ diff --git a/sounds/voice/scavengers/classifiedAsScavengers.wav b/sounds/voice/scavengers/classifiedAsScavengers.wav new file mode 100644 index 000000000..5a5bc6f4b Binary files /dev/null and b/sounds/voice/scavengers/classifiedAsScavengers.wav differ diff --git a/sounds/voice/scavengers/droppingUnits.wav b/sounds/voice/scavengers/droppingUnits.wav new file mode 100644 index 000000000..a5e897a81 Binary files /dev/null and b/sounds/voice/scavengers/droppingUnits.wav differ diff --git a/sounds/voice/scavengers/droppodsDetectedInArea.wav b/sounds/voice/scavengers/droppodsDetectedInArea.wav new file mode 100644 index 000000000..05bfb0aba Binary files /dev/null and b/sounds/voice/scavengers/droppodsDetectedInArea.wav differ diff --git a/sounds/voice/scavengers/droppodsDetectedNearby.wav b/sounds/voice/scavengers/droppodsDetectedNearby.wav new file mode 100644 index 000000000..13f42627c Binary files /dev/null and b/sounds/voice/scavengers/droppodsDetectedNearby.wav differ diff --git a/sounds/voice/scavengers/newunitsdropshipped.wav b/sounds/voice/scavengers/newunitsdropshipped.wav new file mode 100644 index 000000000..48896d74e Binary files /dev/null and b/sounds/voice/scavengers/newunitsdropshipped.wav differ diff --git a/sounds/voice/scavengers/reinforcementshavearrived.wav b/sounds/voice/scavengers/reinforcementshavearrived.wav new file mode 100644 index 000000000..8276a92a7 Binary files /dev/null and b/sounds/voice/scavengers/reinforcementshavearrived.wav differ diff --git a/sounds/voice/scavengers/scav-event-airtransport.wav b/sounds/voice/scavengers/scav-event-airtransport.wav new file mode 100644 index 000000000..2b9ab1454 Binary files /dev/null and b/sounds/voice/scavengers/scav-event-airtransport.wav differ diff --git a/sounds/voice/scavengers/scav-event-cloud.wav b/sounds/voice/scavengers/scav-event-cloud.wav new file mode 100644 index 000000000..3b69354a4 Binary files /dev/null and b/sounds/voice/scavengers/scav-event-cloud.wav differ diff --git a/sounds/voice/scavengers/scav-event-malfunctions.wav b/sounds/voice/scavengers/scav-event-malfunctions.wav new file mode 100644 index 000000000..bf2727a14 Binary files /dev/null and b/sounds/voice/scavengers/scav-event-malfunctions.wav differ diff --git a/sounds/voice/scavengers/scav-event-miniboss.wav b/sounds/voice/scavengers/scav-event-miniboss.wav new file mode 100644 index 000000000..c2ee7e2bd Binary files /dev/null and b/sounds/voice/scavengers/scav-event-miniboss.wav differ diff --git a/sounds/voice/scavengers/scav-event-paralysis.wav b/sounds/voice/scavengers/scav-event-paralysis.wav new file mode 100644 index 000000000..0d5dee64b Binary files /dev/null and b/sounds/voice/scavengers/scav-event-paralysis.wav differ diff --git a/sounds/voice/scavengers/scav-event-rebellion.wav b/sounds/voice/scavengers/scav-event-rebellion.wav new file mode 100644 index 000000000..e6a31410d Binary files /dev/null and b/sounds/voice/scavengers/scav-event-rebellion.wav differ diff --git a/sounds/voice/scavengers/scav-event-swarmdetected.wav b/sounds/voice/scavengers/scav-event-swarmdetected.wav new file mode 100644 index 000000000..a751893e0 Binary files /dev/null and b/sounds/voice/scavengers/scav-event-swarmdetected.wav differ diff --git a/sounds/voice/scavengers/scavShutdownDetected.wav b/sounds/voice/scavengers/scavShutdownDetected.wav new file mode 100644 index 000000000..ecd4d51c3 Binary files /dev/null and b/sounds/voice/scavengers/scavShutdownDetected.wav differ diff --git a/sounds/voice/scavengers/scavadditionalcomdetected.wav b/sounds/voice/scavengers/scavadditionalcomdetected.wav new file mode 100644 index 000000000..7df5be596 Binary files /dev/null and b/sounds/voice/scavengers/scavadditionalcomdetected.wav differ diff --git a/sounds/voice/scavengers/scavanotherscavcomdetected.wav b/sounds/voice/scavengers/scavanotherscavcomdetected.wav new file mode 100644 index 000000000..49e962d02 Binary files /dev/null and b/sounds/voice/scavengers/scavanotherscavcomdetected.wav differ diff --git a/sounds/voice/scavengers/scavbossdetected.wav b/sounds/voice/scavengers/scavbossdetected.wav new file mode 100644 index 000000000..3456257d6 Binary files /dev/null and b/sounds/voice/scavengers/scavbossdetected.wav differ diff --git a/sounds/voice/scavengers/scavcomdetected.wav b/sounds/voice/scavengers/scavcomdetected.wav new file mode 100644 index 000000000..6df3c7178 Binary files /dev/null and b/sounds/voice/scavengers/scavcomdetected.wav differ diff --git a/sounds/voice/scavengers/scavcomnewdetect.wav b/sounds/voice/scavengers/scavcomnewdetect.wav new file mode 100644 index 000000000..f10dccb48 Binary files /dev/null and b/sounds/voice/scavengers/scavcomnewdetect.wav differ diff --git a/sounds/voice/scavengers/scavcomspotted.wav b/sounds/voice/scavengers/scavcomspotted.wav new file mode 100644 index 000000000..241808e58 Binary files /dev/null and b/sounds/voice/scavengers/scavcomspotted.wav differ diff --git a/sounds/voice/scavengers/scavdrop.wav b/sounds/voice/scavengers/scavdrop.wav new file mode 100644 index 000000000..d60eec7aa Binary files /dev/null and b/sounds/voice/scavengers/scavdrop.wav differ diff --git a/sounds/voice/scavengers/scavdroplootspawn.wav b/sounds/voice/scavengers/scavdroplootspawn.wav new file mode 100644 index 000000000..827847ccf Binary files /dev/null and b/sounds/voice/scavengers/scavdroplootspawn.wav differ diff --git a/sounds/voice/scavengers/scavdropspawn.wav b/sounds/voice/scavengers/scavdropspawn.wav new file mode 100644 index 000000000..a1dcf5dd5 Binary files /dev/null and b/sounds/voice/scavengers/scavdropspawn.wav differ diff --git a/sounds/voice/scavengers/scavdropspawnbeacon.wav b/sounds/voice/scavengers/scavdropspawnbeacon.wav new file mode 100644 index 000000000..5ca7e7ab0 Binary files /dev/null and b/sounds/voice/scavengers/scavdropspawnbeacon.wav differ diff --git a/sounds/voice/scavengers/scavdropspawnprinter.wav b/sounds/voice/scavengers/scavdropspawnprinter.wav new file mode 100644 index 000000000..1ab70c6ec Binary files /dev/null and b/sounds/voice/scavengers/scavdropspawnprinter.wav differ diff --git a/sounds/voice/scavengers/scavfinal01remain.wav b/sounds/voice/scavengers/scavfinal01remain.wav new file mode 100644 index 000000000..b5f224957 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal01remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal02remain.wav b/sounds/voice/scavengers/scavfinal02remain.wav new file mode 100644 index 000000000..e348dc0e0 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal02remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal03remain.wav b/sounds/voice/scavengers/scavfinal03remain.wav new file mode 100644 index 000000000..e30629230 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal03remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal04remain.wav b/sounds/voice/scavengers/scavfinal04remain.wav new file mode 100644 index 000000000..028f4166d Binary files /dev/null and b/sounds/voice/scavengers/scavfinal04remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal05remain.wav b/sounds/voice/scavengers/scavfinal05remain.wav new file mode 100644 index 000000000..b8c3e02f8 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal05remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal06remain.wav b/sounds/voice/scavengers/scavfinal06remain.wav new file mode 100644 index 000000000..3316c899c Binary files /dev/null and b/sounds/voice/scavengers/scavfinal06remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal07remain.wav b/sounds/voice/scavengers/scavfinal07remain.wav new file mode 100644 index 000000000..5aa1883e4 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal07remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal08remain.wav b/sounds/voice/scavengers/scavfinal08remain.wav new file mode 100644 index 000000000..667400062 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal08remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal09remain.wav b/sounds/voice/scavengers/scavfinal09remain.wav new file mode 100644 index 000000000..f59cadf6a Binary files /dev/null and b/sounds/voice/scavengers/scavfinal09remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal10remain.wav b/sounds/voice/scavengers/scavfinal10remain.wav new file mode 100644 index 000000000..457d87ac1 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal10remain.wav differ diff --git a/sounds/voice/scavengers/scavfinal12remain.wav b/sounds/voice/scavengers/scavfinal12remain.wav new file mode 100644 index 000000000..dd1d3f118 Binary files /dev/null and b/sounds/voice/scavengers/scavfinal12remain.wav differ diff --git a/sounds/voice/scavengers/scavfinalattack.wav b/sounds/voice/scavengers/scavfinalattack.wav new file mode 100644 index 000000000..f79cdfa25 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalattack.wav differ diff --git a/sounds/voice/scavengers/scavfinalboss.wav b/sounds/voice/scavengers/scavfinalboss.wav new file mode 100644 index 000000000..415ba5545 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalboss.wav differ diff --git a/sounds/voice/scavengers/scavfinalcountdown.wav b/sounds/voice/scavengers/scavfinalcountdown.wav new file mode 100644 index 000000000..c9b5a79c9 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalcountdown.wav differ diff --git a/sounds/voice/scavengers/scavfinalretreating.wav b/sounds/voice/scavengers/scavfinalretreating.wav new file mode 100644 index 000000000..32c8af636 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalretreating.wav differ diff --git a/sounds/voice/scavengers/scavfinalretreatingyes.wav b/sounds/voice/scavengers/scavfinalretreatingyes.wav new file mode 100644 index 000000000..4c5464ca8 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalretreatingyes.wav differ diff --git a/sounds/voice/scavengers/scavfinalsurvive10min.wav b/sounds/voice/scavengers/scavfinalsurvive10min.wav new file mode 100644 index 000000000..cf64a2578 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalsurvive10min.wav differ diff --git a/sounds/voice/scavengers/scavfinalsurvive15min.wav b/sounds/voice/scavengers/scavfinalsurvive15min.wav new file mode 100644 index 000000000..c8775147b Binary files /dev/null and b/sounds/voice/scavengers/scavfinalsurvive15min.wav differ diff --git a/sounds/voice/scavengers/scavfinalvictory.wav b/sounds/voice/scavengers/scavfinalvictory.wav new file mode 100644 index 000000000..e379716d5 Binary files /dev/null and b/sounds/voice/scavengers/scavfinalvictory.wav differ diff --git a/sounds/voice/scavengers/scavheavyairdetected.wav b/sounds/voice/scavengers/scavheavyairdetected.wav new file mode 100644 index 000000000..bf98ad595 Binary files /dev/null and b/sounds/voice/scavengers/scavheavyairdetected.wav differ diff --git a/sounds/voice/scavengers/scavheavyshipsdetected.wav b/sounds/voice/scavengers/scavheavyshipsdetected.wav new file mode 100644 index 000000000..8d6faa23a Binary files /dev/null and b/sounds/voice/scavengers/scavheavyshipsdetected.wav differ diff --git a/sounds/voice/scavengers/scavlootdrop.wav b/sounds/voice/scavengers/scavlootdrop.wav new file mode 100644 index 000000000..7178aa371 Binary files /dev/null and b/sounds/voice/scavengers/scavlootdrop.wav differ diff --git a/sounds/voice/scavengers/scavnewcomentered.wav b/sounds/voice/scavengers/scavnewcomentered.wav new file mode 100644 index 000000000..f733c7f93 Binary files /dev/null and b/sounds/voice/scavengers/scavnewcomentered.wav differ diff --git a/sounds/voice/scavengers/scavpreparingfinalattack.wav b/sounds/voice/scavengers/scavpreparingfinalattack.wav new file mode 100644 index 000000000..e7be7a320 Binary files /dev/null and b/sounds/voice/scavengers/scavpreparingfinalattack.wav differ diff --git a/sounds/voice/scavengers/scavspawn.wav b/sounds/voice/scavengers/scavspawn.wav new file mode 100644 index 000000000..a1a91b79a Binary files /dev/null and b/sounds/voice/scavengers/scavspawn.wav differ diff --git a/sounds/voice/scavengers/scavtech3.wav b/sounds/voice/scavengers/scavtech3.wav new file mode 100644 index 000000000..c5cb2af95 Binary files /dev/null and b/sounds/voice/scavengers/scavtech3.wav differ diff --git a/sounds/voice/scavengers/scavtech3b.wav b/sounds/voice/scavengers/scavtech3b.wav new file mode 100644 index 000000000..6fd5c2a7c Binary files /dev/null and b/sounds/voice/scavengers/scavtech3b.wav differ diff --git a/sounds/voice/scavengers/scavtech3c.wav b/sounds/voice/scavengers/scavtech3c.wav new file mode 100644 index 000000000..9dd699313 Binary files /dev/null and b/sounds/voice/scavengers/scavtech3c.wav differ diff --git a/sounds/voice/scavengers/scavtech3d.wav b/sounds/voice/scavengers/scavtech3d.wav new file mode 100644 index 000000000..c493e4a63 Binary files /dev/null and b/sounds/voice/scavengers/scavtech3d.wav differ diff --git a/sounds/voice/scavengers/scavtech3e.wav b/sounds/voice/scavengers/scavtech3e.wav new file mode 100644 index 000000000..c981538b8 Binary files /dev/null and b/sounds/voice/scavengers/scavtech3e.wav differ diff --git a/sounds/voice/scavengers/unidentifiedObjectsDetected.wav b/sounds/voice/scavengers/unidentifiedObjectsDetected.wav new file mode 100644 index 000000000..502721fd6 Binary files /dev/null and b/sounds/voice/scavengers/unidentifiedObjectsDetected.wav differ diff --git a/sounds/voice/scavengers/waitingForIntel.wav b/sounds/voice/scavengers/waitingForIntel.wav new file mode 100644 index 000000000..39c6f7b4d Binary files /dev/null and b/sounds/voice/scavengers/waitingForIntel.wav differ diff --git a/sounds/voice/scavengers/warning.wav b/sounds/voice/scavengers/warning.wav new file mode 100644 index 000000000..6b161dc9b Binary files /dev/null and b/sounds/voice/scavengers/warning.wav differ diff --git a/sounds/weapons/Assault Rifle Shot_05.wav b/sounds/weapons/Assault Rifle Shot_05.wav new file mode 100644 index 000000000..ad4d46315 Binary files /dev/null and b/sounds/weapons/Assault Rifle Shot_05.wav differ diff --git a/sounds/weapons/Machine Gun Shot_05.wav b/sounds/weapons/Machine Gun Shot_05.wav new file mode 100644 index 000000000..ff9c53f0b Binary files /dev/null and b/sounds/weapons/Machine Gun Shot_05.wav differ diff --git a/sounds/weapons/Sci Fi Beam 3-short.wav b/sounds/weapons/Sci Fi Beam 3-short.wav new file mode 100644 index 000000000..90a765134 Binary files /dev/null and b/sounds/weapons/Sci Fi Beam 3-short.wav differ diff --git a/sounds/weapons/Sci Fi Beam 3.wav b/sounds/weapons/Sci Fi Beam 3.wav new file mode 100644 index 000000000..2868a0a00 Binary files /dev/null and b/sounds/weapons/Sci Fi Beam 3.wav differ diff --git a/sounds/weapons/Sci Fi Blaster 4.wav b/sounds/weapons/Sci Fi Blaster 4.wav new file mode 100644 index 000000000..cd593acd7 Binary files /dev/null and b/sounds/weapons/Sci Fi Blaster 4.wav differ diff --git a/sounds/weapons/Sci Fi Sniper 10.wav b/sounds/weapons/Sci Fi Sniper 10.wav new file mode 100644 index 000000000..5c09315e3 Binary files /dev/null and b/sounds/weapons/Sci Fi Sniper 10.wav differ diff --git a/sounds/weapons/Shotgun Boom 101.wav b/sounds/weapons/Shotgun Boom 101.wav new file mode 100644 index 000000000..de85512e9 Binary files /dev/null and b/sounds/weapons/Shotgun Boom 101.wav differ diff --git a/sounds/weapons/Shotgun Boom 102.wav b/sounds/weapons/Shotgun Boom 102.wav new file mode 100644 index 000000000..6628ddcb0 Binary files /dev/null and b/sounds/weapons/Shotgun Boom 102.wav differ diff --git a/sounds/weapons/Shotgun Boom 103.wav b/sounds/weapons/Shotgun Boom 103.wav new file mode 100644 index 000000000..81b13969f Binary files /dev/null and b/sounds/weapons/Shotgun Boom 103.wav differ diff --git a/sounds/weapons/aegis.wav b/sounds/weapons/aegis.wav new file mode 100644 index 000000000..64148a034 Binary files /dev/null and b/sounds/weapons/aegis.wav differ diff --git a/sounds/weapons/bombdrop.wav b/sounds/weapons/bombdrop.wav new file mode 100644 index 000000000..e537d6b0a Binary files /dev/null and b/sounds/weapons/bombdrop.wav differ diff --git a/sounds/weapons/ebomberlaser.wav b/sounds/weapons/ebomberlaser.wav new file mode 100644 index 000000000..41d42b027 Binary files /dev/null and b/sounds/weapons/ebomberlaser.wav differ diff --git a/sounds/weapons/efighterlaser.wav b/sounds/weapons/efighterlaser.wav new file mode 100644 index 000000000..0ebc82cbb Binary files /dev/null and b/sounds/weapons/efighterlaser.wav differ diff --git a/sounds/weapons/egunship2laser.wav b/sounds/weapons/egunship2laser.wav new file mode 100644 index 000000000..4e921cbe3 Binary files /dev/null and b/sounds/weapons/egunship2laser.wav differ diff --git a/sounds/weapons/lightning-metal-hit.wav b/sounds/weapons/lightning-metal-hit.wav new file mode 100644 index 000000000..9cd00ae2e Binary files /dev/null and b/sounds/weapons/lightning-metal-hit.wav differ diff --git a/sounds/weapons/lightningstrike.wav b/sounds/weapons/lightningstrike.wav new file mode 100644 index 000000000..5d4d8377b Binary files /dev/null and b/sounds/weapons/lightningstrike.wav differ diff --git a/sounds/weapons/lightturret.wav b/sounds/weapons/lightturret.wav new file mode 100644 index 000000000..a0e362a8b Binary files /dev/null and b/sounds/weapons/lightturret.wav differ diff --git a/sounds/weapons/meteorwhoosh.wav b/sounds/weapons/meteorwhoosh.wav new file mode 100644 index 000000000..43d0049ec Binary files /dev/null and b/sounds/weapons/meteorwhoosh.wav differ diff --git a/sounds/weapons/plasma3.wav b/sounds/weapons/plasma3.wav new file mode 100644 index 000000000..872e4297f Binary files /dev/null and b/sounds/weapons/plasma3.wav differ diff --git a/sounds/weapons/plasma3c.wav b/sounds/weapons/plasma3c.wav new file mode 100644 index 000000000..0017bdf94 Binary files /dev/null and b/sounds/weapons/plasma3c.wav differ diff --git a/sounds/weapons/shotgun-reload.wav b/sounds/weapons/shotgun-reload.wav index 89c38ccb1..26d27a9ec 100644 Binary files a/sounds/weapons/shotgun-reload.wav and b/sounds/weapons/shotgun-reload.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 1.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 1.wav new file mode 100644 index 000000000..b65561fe5 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 1.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 2.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 2.wav new file mode 100644 index 000000000..e435298eb Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 2.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 3.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 3.wav new file mode 100644 index 000000000..391a550bf Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 3.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 4.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 4.wav new file mode 100644 index 000000000..fa27ed7e7 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 4.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 5.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 5.wav new file mode 100644 index 000000000..fc31c4292 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY BREATHING FIRE/BABY BREATHING FIRE 5.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 1.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 1.wav new file mode 100644 index 000000000..580751deb Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 1.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 2.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 2.wav new file mode 100644 index 000000000..92c549a40 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 2.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 3.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 3.wav new file mode 100644 index 000000000..abd43be00 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 3.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 4.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 4.wav new file mode 100644 index 000000000..c0a151e3a Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 4.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 5.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 5.wav new file mode 100644 index 000000000..146054541 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY FOOTSTEPS/BABY FOOTSTEPS 5.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 1.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 1.wav new file mode 100644 index 000000000..1afe6f524 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 1.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 2.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 2.wav new file mode 100644 index 000000000..649395fe5 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 2.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 3.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 3.wav new file mode 100644 index 000000000..dd49a6f13 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 3.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 4.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 4.wav new file mode 100644 index 000000000..185f441c3 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 4.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 5.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 5.wav new file mode 100644 index 000000000..197acf44c Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY ROAR/BABY ROAR 5.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 1.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 1.wav new file mode 100644 index 000000000..7382ecdfd Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 1.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 2.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 2.wav new file mode 100644 index 000000000..b7a66a712 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 2.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 3.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 3.wav new file mode 100644 index 000000000..cc48551c3 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 3.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 4.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 4.wav new file mode 100644 index 000000000..6e93fd744 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 4.wav differ diff --git a/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 5.wav b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 5.wav new file mode 100644 index 000000000..7cfbcc8a0 Binary files /dev/null and b/sounds/weapons/zaal/BABY DRAGONS/BABY TAKING DAMAGE/BABY TAKING DAMAGE 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 1.wav new file mode 100644 index 000000000..de9c23d5c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 2.wav new file mode 100644 index 000000000..fa19af3f1 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 3.wav new file mode 100644 index 000000000..a402f2c0f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 4.wav new file mode 100644 index 000000000..f8e1da6d3 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 5.wav new file mode 100644 index 000000000..b7e96f940 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON AGGRO/AGGRO 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 1.wav new file mode 100644 index 000000000..c04e12191 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 10.wav new file mode 100644 index 000000000..5e46f6837 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 2.wav new file mode 100644 index 000000000..e2297ce39 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 3.wav new file mode 100644 index 000000000..27b4ffe6e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 4.wav new file mode 100644 index 000000000..44b24b4ea Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 5.wav new file mode 100644 index 000000000..a7f25b6d6 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 6.wav new file mode 100644 index 000000000..06b856eda Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 7.wav new file mode 100644 index 000000000..e42b97784 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 8.wav new file mode 100644 index 000000000..e05ec81a2 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 9.wav new file mode 100644 index 000000000..383845fc6 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ATTACKS/DRAGON ATTACKS 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 1.wav new file mode 100644 index 000000000..3d8fa8442 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 10.wav new file mode 100644 index 000000000..08cfbac1d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 2.wav new file mode 100644 index 000000000..83c4c0c14 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 3.wav new file mode 100644 index 000000000..8d8883018 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 4.wav new file mode 100644 index 000000000..c19a74ae9 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 5.wav new file mode 100644 index 000000000..cc8dae6d9 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 6.wav new file mode 100644 index 000000000..02f5cdd91 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 7.wav new file mode 100644 index 000000000..acf47fd05 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 8.wav new file mode 100644 index 000000000..db9b7b7fb Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 9.wav new file mode 100644 index 000000000..dc6fdf9bb Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BITES/DRAGON BITES 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 1.wav new file mode 100644 index 000000000..87b41415e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 10.wav new file mode 100644 index 000000000..a1adf52a1 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 11.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 11.wav new file mode 100644 index 000000000..90f4e84f7 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 11.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 12.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 12.wav new file mode 100644 index 000000000..47be900f0 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 12.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 13.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 13.wav new file mode 100644 index 000000000..b699a4f7b Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 13.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 14.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 14.wav new file mode 100644 index 000000000..364a84069 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 14.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 15.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 15.wav new file mode 100644 index 000000000..7468bf85c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 15.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 16.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 16.wav new file mode 100644 index 000000000..6aa492203 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 16.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 17.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 17.wav new file mode 100644 index 000000000..5e7f9a79f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 17.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 18.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 18.wav new file mode 100644 index 000000000..51482347d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 18.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 19.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 19.wav new file mode 100644 index 000000000..603939cb4 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 19.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 2.wav new file mode 100644 index 000000000..b58be3ddc Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 20.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 20.wav new file mode 100644 index 000000000..f211ebf0b Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 20.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 21.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 21.wav new file mode 100644 index 000000000..b8e953e54 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 21.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 22.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 22.wav new file mode 100644 index 000000000..839a796c2 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 22.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 23.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 23.wav new file mode 100644 index 000000000..5d54349ec Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 23.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 3.wav new file mode 100644 index 000000000..bb01e3001 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 4.wav new file mode 100644 index 000000000..2b2e5dac4 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 5.wav new file mode 100644 index 000000000..4d8e5746f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 6.wav new file mode 100644 index 000000000..bac77c1f5 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 7.wav new file mode 100644 index 000000000..303e5a1f4 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 8.wav new file mode 100644 index 000000000..619dacd85 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 9.wav new file mode 100644 index 000000000..2a8c3e217 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING FIRE/DRAGON BREATHING FIRE 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 1.wav new file mode 100644 index 000000000..8fa013f28 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 10.wav new file mode 100644 index 000000000..70e626b93 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 11.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 11.wav new file mode 100644 index 000000000..908d68deb Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 11.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 12.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 12.wav new file mode 100644 index 000000000..a87125e33 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 12.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 13.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 13.wav new file mode 100644 index 000000000..9d8998c1f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 13.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 14.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 14.wav new file mode 100644 index 000000000..2ff6cb658 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 14.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 15.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 15.wav new file mode 100644 index 000000000..c91c119b0 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 15.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 16.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 16.wav new file mode 100644 index 000000000..a2e44f3bd Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 16.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 17.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 17.wav new file mode 100644 index 000000000..fec021402 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 17.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 18.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 18.wav new file mode 100644 index 000000000..dc236b0c0 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 18.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 19.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 19.wav new file mode 100644 index 000000000..1d441c7fd Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 19.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 2.wav new file mode 100644 index 000000000..84450547a Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 20.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 20.wav new file mode 100644 index 000000000..cbf64fba7 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 20.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 3.wav new file mode 100644 index 000000000..6d5da92b3 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 4.wav new file mode 100644 index 000000000..fa34ccacb Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 5.wav new file mode 100644 index 000000000..a75912eda Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 6.wav new file mode 100644 index 000000000..deba0ec21 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 7.wav new file mode 100644 index 000000000..7556cb664 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 8.wav new file mode 100644 index 000000000..34bb06130 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 9.wav new file mode 100644 index 000000000..252ba0b72 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON BREATHING/BREATHING 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 1.wav new file mode 100644 index 000000000..909832d63 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 2.wav new file mode 100644 index 000000000..6410391cd Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 3.wav new file mode 100644 index 000000000..5f6ff8839 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 4.wav new file mode 100644 index 000000000..c674cb1dd Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 5.wav new file mode 100644 index 000000000..f13257aef Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON EATING/EATING 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 1.wav new file mode 100644 index 000000000..e117fa1c8 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 10.wav new file mode 100644 index 000000000..20a727207 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 11.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 11.wav new file mode 100644 index 000000000..7d312c284 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 11.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 12.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 12.wav new file mode 100644 index 000000000..ef8096c1c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 12.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 13.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 13.wav new file mode 100644 index 000000000..b613b921f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 13.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 14.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 14.wav new file mode 100644 index 000000000..4d222e386 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 14.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 15.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 15.wav new file mode 100644 index 000000000..1b8e6b314 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 15.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 16.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 16.wav new file mode 100644 index 000000000..e56d4b440 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 16.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 17.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 17.wav new file mode 100644 index 000000000..3af373d19 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 17.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 18.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 18.wav new file mode 100644 index 000000000..2f1a5019c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 18.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 19.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 19.wav new file mode 100644 index 000000000..c0a120542 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 19.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 2.wav new file mode 100644 index 000000000..3b18dc665 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 20.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 20.wav new file mode 100644 index 000000000..c7d689c36 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 20.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 3.wav new file mode 100644 index 000000000..494a64005 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 4.wav new file mode 100644 index 000000000..52cb18baf Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 5.wav new file mode 100644 index 000000000..651577240 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 6.wav new file mode 100644 index 000000000..17391f785 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 7.wav new file mode 100644 index 000000000..52e21c993 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 8.wav new file mode 100644 index 000000000..da40ddd68 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 9.wav new file mode 100644 index 000000000..4686f74a3 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON FOOTSTEPS/Footsteps 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 1.wav new file mode 100644 index 000000000..3d5c3bf9e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 2.wav new file mode 100644 index 000000000..1d09feb1e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 3.wav new file mode 100644 index 000000000..bc9459c4b Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 4.wav new file mode 100644 index 000000000..8c64761e0 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 5.wav new file mode 100644 index 000000000..872684104 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON HISSES/HISSES 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 1.wav new file mode 100644 index 000000000..8f61fd016 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 2.wav new file mode 100644 index 000000000..a8f1d82a2 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 3.wav new file mode 100644 index 000000000..e18f32d8f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 4.wav new file mode 100644 index 000000000..ce32389ae Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 5.wav new file mode 100644 index 000000000..115c818da Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON LANDING/LANDING 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 1.wav new file mode 100644 index 000000000..adf1c384d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 10.wav new file mode 100644 index 000000000..ac88531c4 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 11.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 11.wav new file mode 100644 index 000000000..6c45e92a1 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 11.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 12.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 12.wav new file mode 100644 index 000000000..6eeb6449e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 12.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 13.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 13.wav new file mode 100644 index 000000000..18f70202c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 13.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 14.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 14.wav new file mode 100644 index 000000000..022b54228 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 14.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 15.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 15.wav new file mode 100644 index 000000000..ae9307a40 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 15.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 16.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 16.wav new file mode 100644 index 000000000..3339d1098 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 16.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 17.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 17.wav new file mode 100644 index 000000000..86a81392d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 17.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 18.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 18.wav new file mode 100644 index 000000000..fffa31dea Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 18.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 19.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 19.wav new file mode 100644 index 000000000..7965ee64d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 19.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 2.wav new file mode 100644 index 000000000..061f85b82 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 20.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 20.wav new file mode 100644 index 000000000..3e63e16e5 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 20.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 3.wav new file mode 100644 index 000000000..6bedd9d6f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 4.wav new file mode 100644 index 000000000..9bc8adff5 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 5.wav new file mode 100644 index 000000000..bdcbe4744 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 6.wav new file mode 100644 index 000000000..c284870ea Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 7.wav new file mode 100644 index 000000000..3ef5ae0c2 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 8.wav new file mode 100644 index 000000000..65c90557e Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 9.wav new file mode 100644 index 000000000..107b47c13 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON ROAR/ROAR 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 1.wav new file mode 100644 index 000000000..c38bf3938 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 2.wav new file mode 100644 index 000000000..b976d9724 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 3.wav new file mode 100644 index 000000000..2d5241c2a Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 4.wav new file mode 100644 index 000000000..21b56cb2c Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 5.wav new file mode 100644 index 000000000..22af82c32 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON SCREECH/SCREECH 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 1.wav new file mode 100644 index 000000000..9f4fa095f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 10.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 10.wav new file mode 100644 index 000000000..241de9846 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 2.wav new file mode 100644 index 000000000..02992270f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 3.wav new file mode 100644 index 000000000..f5273df57 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 4.wav new file mode 100644 index 000000000..9e8bc8432 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 5.wav new file mode 100644 index 000000000..66712f94b Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 6.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 6.wav new file mode 100644 index 000000000..69b544aac Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 7.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 7.wav new file mode 100644 index 000000000..5f99f6bed Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 8.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 8.wav new file mode 100644 index 000000000..af3aad33f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 9.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 9.wav new file mode 100644 index 000000000..bc88eb3a6 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING DAMAGE/TAKING DAMAGE 9.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 1.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 1.wav new file mode 100644 index 000000000..5b195db82 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 2.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 2.wav new file mode 100644 index 000000000..9da5cb69a Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 3.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 3.wav new file mode 100644 index 000000000..4221dab95 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 4.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 4.wav new file mode 100644 index 000000000..1960a88df Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 5.wav b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 5.wav new file mode 100644 index 000000000..5fa708e65 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/DRAGON TAKING FLIGHT/TAKING FLIGHT 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 1.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 1.wav new file mode 100644 index 000000000..4a415f5cb Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 1.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 10.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 10.wav new file mode 100644 index 000000000..cc396ca82 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 10.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 2.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 2.wav new file mode 100644 index 000000000..53938d42d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 2.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 3.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 3.wav new file mode 100644 index 000000000..5c2c3136d Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 3.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 4.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 4.wav new file mode 100644 index 000000000..8ed4ea3d1 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 4.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 5.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 5.wav new file mode 100644 index 000000000..1203df050 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 5.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 6.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 6.wav new file mode 100644 index 000000000..78b10cba8 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 6.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 7.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 7.wav new file mode 100644 index 000000000..5572020d8 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 7.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 8.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 8.wav new file mode 100644 index 000000000..e87acca1f Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 8.wav differ diff --git a/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 9.wav b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 9.wav new file mode 100644 index 000000000..8866a1d99 Binary files /dev/null and b/sounds/weapons/zaal/DRAGONS/FLAPPING WINGS/FLAPPING WINGS 9.wav differ diff --git a/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 1.wav b/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 1.wav new file mode 100644 index 000000000..5c845053a Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 1.wav differ diff --git a/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 2.wav b/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 2.wav new file mode 100644 index 000000000..b7ea1f315 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Breathing/Huge monster Breathing 2.wav differ diff --git a/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 1.wav b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 1.wav new file mode 100644 index 000000000..efce8bec8 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 1.wav differ diff --git a/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 2.wav b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 2.wav new file mode 100644 index 000000000..cf84de34e Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 2.wav differ diff --git a/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 3.wav b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 3.wav new file mode 100644 index 000000000..65cd4baef Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 3.wav differ diff --git a/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 4.wav b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 4.wav new file mode 100644 index 000000000..cd88c2380 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 4.wav differ diff --git a/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 5.wav b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 5.wav new file mode 100644 index 000000000..2b2d58c84 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster Growls/Huge monster Growls 5.wav differ diff --git a/sounds/weapons/zaal/Huge monster attack/Huge monster attack 1.wav b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 1.wav new file mode 100644 index 000000000..eaf302231 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 1.wav differ diff --git a/sounds/weapons/zaal/Huge monster attack/Huge monster attack 2.wav b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 2.wav new file mode 100644 index 000000000..2aefdaa5c Binary files /dev/null and b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 2.wav differ diff --git a/sounds/weapons/zaal/Huge monster attack/Huge monster attack 3.wav b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 3.wav new file mode 100644 index 000000000..902ad5f8c Binary files /dev/null and b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 3.wav differ diff --git a/sounds/weapons/zaal/Huge monster attack/Huge monster attack 4.wav b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 4.wav new file mode 100644 index 000000000..9a48fc475 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 4.wav differ diff --git a/sounds/weapons/zaal/Huge monster attack/Huge monster attack 5.wav b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 5.wav new file mode 100644 index 000000000..9655ff28c Binary files /dev/null and b/sounds/weapons/zaal/Huge monster attack/Huge monster attack 5.wav differ diff --git a/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 1.wav b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 1.wav new file mode 100644 index 000000000..c75cb5b14 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 1.wav differ diff --git a/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 2.wav b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 2.wav new file mode 100644 index 000000000..68116229f Binary files /dev/null and b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 2.wav differ diff --git a/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 3.wav b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 3.wav new file mode 100644 index 000000000..602411e78 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 3.wav differ diff --git a/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 4.wav b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 4.wav new file mode 100644 index 000000000..82af7ec89 Binary files /dev/null and b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 4.wav differ diff --git a/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 5.wav b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 5.wav new file mode 100644 index 000000000..f3c1113fb Binary files /dev/null and b/sounds/weapons/zaal/Huge monster footsteps/Huge monster footsteps 5.wav differ diff --git a/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 1.wav b/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 1.wav new file mode 100644 index 000000000..4c1c34d9c Binary files /dev/null and b/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 1.wav differ diff --git a/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 2.wav b/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 2.wav new file mode 100644 index 000000000..9466812ca Binary files /dev/null and b/sounds/weapons/zaal/Huge monster laugh/Huge monster laugh 2.wav differ diff --git a/sounds/weapons/zaal/Large monster Growls/Large monster Growls 1.wav b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 1.wav new file mode 100644 index 000000000..8d256b77a Binary files /dev/null and b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 1.wav differ diff --git a/sounds/weapons/zaal/Large monster Growls/Large monster Growls 2.wav b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 2.wav new file mode 100644 index 000000000..b2daee2b8 Binary files /dev/null and b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 2.wav differ diff --git a/sounds/weapons/zaal/Large monster Growls/Large monster Growls 3.wav b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 3.wav new file mode 100644 index 000000000..87c24e600 Binary files /dev/null and b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 3.wav differ diff --git a/sounds/weapons/zaal/Large monster Growls/Large monster Growls 4.wav b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 4.wav new file mode 100644 index 000000000..f1aebccda Binary files /dev/null and b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 4.wav differ diff --git a/sounds/weapons/zaal/Large monster Growls/Large monster Growls 5.wav b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 5.wav new file mode 100644 index 000000000..af77a9eef Binary files /dev/null and b/sounds/weapons/zaal/Large monster Growls/Large monster Growls 5.wav differ diff --git a/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 1.wav b/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 1.wav new file mode 100644 index 000000000..cd80ba9ba Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 1.wav differ diff --git a/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 2.wav b/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 2.wav new file mode 100644 index 000000000..14fa641b1 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Breathing/Medium monster Breathing 2.wav differ diff --git a/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 1.wav b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 1.wav new file mode 100644 index 000000000..a91109d16 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 1.wav differ diff --git a/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 2.wav b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 2.wav new file mode 100644 index 000000000..6f4f02246 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 2.wav differ diff --git a/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 3.wav b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 3.wav new file mode 100644 index 000000000..c0185a9bf Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 3.wav differ diff --git a/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 4.wav b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 4.wav new file mode 100644 index 000000000..b0eab2991 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 4.wav differ diff --git a/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 5.wav b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 5.wav new file mode 100644 index 000000000..87f6a6d17 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster Growls/Medium monster Growls 5.wav differ diff --git a/sounds/weapons/zaal/Medium monster attack/Medium monster attack 1.wav b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 1.wav new file mode 100644 index 000000000..845a00863 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 1.wav differ diff --git a/sounds/weapons/zaal/Medium monster attack/Medium monster attack 2.wav b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 2.wav new file mode 100644 index 000000000..33b1d0c1d Binary files /dev/null and b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 2.wav differ diff --git a/sounds/weapons/zaal/Medium monster attack/Medium monster attack 3.wav b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 3.wav new file mode 100644 index 000000000..8578ea344 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 3.wav differ diff --git a/sounds/weapons/zaal/Medium monster attack/Medium monster attack 4.wav b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 4.wav new file mode 100644 index 000000000..6bb4c5d23 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 4.wav differ diff --git a/sounds/weapons/zaal/Medium monster attack/Medium monster attack 5.wav b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 5.wav new file mode 100644 index 000000000..210f37a6c Binary files /dev/null and b/sounds/weapons/zaal/Medium monster attack/Medium monster attack 5.wav differ diff --git a/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 1.wav b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 1.wav new file mode 100644 index 000000000..f044f93a4 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 1.wav differ diff --git a/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 2.wav b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 2.wav new file mode 100644 index 000000000..fe5d08f11 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 2.wav differ diff --git a/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 3.wav b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 3.wav new file mode 100644 index 000000000..d1f07087d Binary files /dev/null and b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 3.wav differ diff --git a/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 4.wav b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 4.wav new file mode 100644 index 000000000..afae2e678 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 4.wav differ diff --git a/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 5.wav b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 5.wav new file mode 100644 index 000000000..2f10c0e37 Binary files /dev/null and b/sounds/weapons/zaal/Medium monster footsteps/Medium monster footsteps 5.wav differ diff --git a/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 1.wav b/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 1.wav new file mode 100644 index 000000000..518f58f6f Binary files /dev/null and b/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 1.wav differ diff --git a/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 2.wav b/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 2.wav new file mode 100644 index 000000000..1d8af910c Binary files /dev/null and b/sounds/weapons/zaal/Medium monster laugh/Medium monster laugh 2.wav differ diff --git a/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 1.wav b/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 1.wav new file mode 100644 index 000000000..d905faf66 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 1.wav differ diff --git a/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 2.wav b/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 2.wav new file mode 100644 index 000000000..6bf9521f8 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Breathing/Small monster Breathing 2.wav differ diff --git a/sounds/weapons/zaal/Small monster Growls/Small monster Growls 1.wav b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 1.wav new file mode 100644 index 000000000..d3a8c9c36 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 1.wav differ diff --git a/sounds/weapons/zaal/Small monster Growls/Small monster Growls 2.wav b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 2.wav new file mode 100644 index 000000000..229a81fc6 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 2.wav differ diff --git a/sounds/weapons/zaal/Small monster Growls/Small monster Growls 3.wav b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 3.wav new file mode 100644 index 000000000..6c4373073 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 3.wav differ diff --git a/sounds/weapons/zaal/Small monster Growls/Small monster Growls 4.wav b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 4.wav new file mode 100644 index 000000000..3df5ca3fe Binary files /dev/null and b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 4.wav differ diff --git a/sounds/weapons/zaal/Small monster Growls/Small monster Growls 5.wav b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 5.wav new file mode 100644 index 000000000..6569c5997 Binary files /dev/null and b/sounds/weapons/zaal/Small monster Growls/Small monster Growls 5.wav differ diff --git a/sounds/weapons/zaal/Small monster attack/Small monster attack 1.wav b/sounds/weapons/zaal/Small monster attack/Small monster attack 1.wav new file mode 100644 index 000000000..ef9f55ab5 Binary files /dev/null and b/sounds/weapons/zaal/Small monster attack/Small monster attack 1.wav differ diff --git a/sounds/weapons/zaal/Small monster attack/Small monster attack 2.wav b/sounds/weapons/zaal/Small monster attack/Small monster attack 2.wav new file mode 100644 index 000000000..f5617f080 Binary files /dev/null and b/sounds/weapons/zaal/Small monster attack/Small monster attack 2.wav differ diff --git a/sounds/weapons/zaal/Small monster attack/Small monster attack 3.wav b/sounds/weapons/zaal/Small monster attack/Small monster attack 3.wav new file mode 100644 index 000000000..001f5d389 Binary files /dev/null and b/sounds/weapons/zaal/Small monster attack/Small monster attack 3.wav differ diff --git a/sounds/weapons/zaal/Small monster attack/Small monster attack 4.wav b/sounds/weapons/zaal/Small monster attack/Small monster attack 4.wav new file mode 100644 index 000000000..d945f6a00 Binary files /dev/null and b/sounds/weapons/zaal/Small monster attack/Small monster attack 4.wav differ diff --git a/sounds/weapons/zaal/Small monster attack/Small monster attack 5.wav b/sounds/weapons/zaal/Small monster attack/Small monster attack 5.wav new file mode 100644 index 000000000..0bf628494 Binary files /dev/null and b/sounds/weapons/zaal/Small monster attack/Small monster attack 5.wav differ diff --git a/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 1.wav b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 1.wav new file mode 100644 index 000000000..fa635ebbc Binary files /dev/null and b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 1.wav differ diff --git a/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 2.wav b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 2.wav new file mode 100644 index 000000000..054001a9e Binary files /dev/null and b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 2.wav differ diff --git a/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 3.wav b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 3.wav new file mode 100644 index 000000000..93d089bd3 Binary files /dev/null and b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 3.wav differ diff --git a/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 4.wav b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 4.wav new file mode 100644 index 000000000..2236af627 Binary files /dev/null and b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 4.wav differ diff --git a/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 5.wav b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 5.wav new file mode 100644 index 000000000..eb322f2c5 Binary files /dev/null and b/sounds/weapons/zaal/Small monster footsteps/Small monster footsteps 5.wav differ diff --git a/sounds/weapons/zaal/Small monster laugh/Small monster laugh 1.wav b/sounds/weapons/zaal/Small monster laugh/Small monster laugh 1.wav new file mode 100644 index 000000000..a61f7f5e6 Binary files /dev/null and b/sounds/weapons/zaal/Small monster laugh/Small monster laugh 1.wav differ diff --git a/sounds/weapons/zaal/Small monster laugh/Small monster laugh 2.wav b/sounds/weapons/zaal/Small monster laugh/Small monster laugh 2.wav new file mode 100644 index 000000000..afdb9f5d0 Binary files /dev/null and b/sounds/weapons/zaal/Small monster laugh/Small monster laugh 2.wav differ diff --git a/sounds/weapons/zaal/large monster Breathing/large monster Breathing 1.wav b/sounds/weapons/zaal/large monster Breathing/large monster Breathing 1.wav new file mode 100644 index 000000000..687a2a6c6 Binary files /dev/null and b/sounds/weapons/zaal/large monster Breathing/large monster Breathing 1.wav differ diff --git a/sounds/weapons/zaal/large monster Breathing/large monster Breathing 2.wav b/sounds/weapons/zaal/large monster Breathing/large monster Breathing 2.wav new file mode 100644 index 000000000..a6164c6c0 Binary files /dev/null and b/sounds/weapons/zaal/large monster Breathing/large monster Breathing 2.wav differ diff --git a/sounds/weapons/zaal/large monster attack/large monster attack 1.wav b/sounds/weapons/zaal/large monster attack/large monster attack 1.wav new file mode 100644 index 000000000..0f6e0a8fb Binary files /dev/null and b/sounds/weapons/zaal/large monster attack/large monster attack 1.wav differ diff --git a/sounds/weapons/zaal/large monster attack/large monster attack 2.wav b/sounds/weapons/zaal/large monster attack/large monster attack 2.wav new file mode 100644 index 000000000..04de72826 Binary files /dev/null and b/sounds/weapons/zaal/large monster attack/large monster attack 2.wav differ diff --git a/sounds/weapons/zaal/large monster attack/large monster attack 3.wav b/sounds/weapons/zaal/large monster attack/large monster attack 3.wav new file mode 100644 index 000000000..384b1d3f6 Binary files /dev/null and b/sounds/weapons/zaal/large monster attack/large monster attack 3.wav differ diff --git a/sounds/weapons/zaal/large monster attack/large monster attack 4.wav b/sounds/weapons/zaal/large monster attack/large monster attack 4.wav new file mode 100644 index 000000000..950e1ad47 Binary files /dev/null and b/sounds/weapons/zaal/large monster attack/large monster attack 4.wav differ diff --git a/sounds/weapons/zaal/large monster attack/large monster attack 5.wav b/sounds/weapons/zaal/large monster attack/large monster attack 5.wav new file mode 100644 index 000000000..104bd93f2 Binary files /dev/null and b/sounds/weapons/zaal/large monster attack/large monster attack 5.wav differ diff --git a/sounds/weapons/zaal/large monster footsteps/large monster footsteps 1.wav b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 1.wav new file mode 100644 index 000000000..7b69e8acf Binary files /dev/null and b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 1.wav differ diff --git a/sounds/weapons/zaal/large monster footsteps/large monster footsteps 2.wav b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 2.wav new file mode 100644 index 000000000..d78ba01e5 Binary files /dev/null and b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 2.wav differ diff --git a/sounds/weapons/zaal/large monster footsteps/large monster footsteps 3.wav b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 3.wav new file mode 100644 index 000000000..e51346e6c Binary files /dev/null and b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 3.wav differ diff --git a/sounds/weapons/zaal/large monster footsteps/large monster footsteps 4.wav b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 4.wav new file mode 100644 index 000000000..1d05eee91 Binary files /dev/null and b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 4.wav differ diff --git a/sounds/weapons/zaal/large monster footsteps/large monster footsteps 5.wav b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 5.wav new file mode 100644 index 000000000..6b2cbe342 Binary files /dev/null and b/sounds/weapons/zaal/large monster footsteps/large monster footsteps 5.wav differ diff --git a/sounds/weapons/zaal/large monster laugh/large monster laugh 1.wav b/sounds/weapons/zaal/large monster laugh/large monster laugh 1.wav new file mode 100644 index 000000000..97db78e63 Binary files /dev/null and b/sounds/weapons/zaal/large monster laugh/large monster laugh 1.wav differ diff --git a/sounds/weapons/zaal/large monster laugh/large monster laugh 2.wav b/sounds/weapons/zaal/large monster laugh/large monster laugh 2.wav new file mode 100644 index 000000000..cc080e4c1 Binary files /dev/null and b/sounds/weapons/zaal/large monster laugh/large monster laugh 2.wav differ diff --git a/sounds/weapons/zaal/lingspit.wav b/sounds/weapons/zaal/lingspit.wav new file mode 100644 index 000000000..5ea1efa95 Binary files /dev/null and b/sounds/weapons/zaal/lingspit.wav differ diff --git a/sounds/weapons/zaal/queenmeleeroar.wav b/sounds/weapons/zaal/queenmeleeroar.wav new file mode 100644 index 000000000..16aa36a57 Binary files /dev/null and b/sounds/weapons/zaal/queenmeleeroar.wav differ diff --git a/sounds/weapons/zaal/queenroar.wav b/sounds/weapons/zaal/queenroar.wav new file mode 100644 index 000000000..db3a7dc70 Binary files /dev/null and b/sounds/weapons/zaal/queenroar.wav differ diff --git a/sounds/weapons/zaal/roachspit.wav b/sounds/weapons/zaal/roachspit.wav new file mode 100644 index 000000000..6a7594e09 Binary files /dev/null and b/sounds/weapons/zaal/roachspit.wav differ diff --git a/sounds/weapons/zaal/ultraliskroar.wav b/sounds/weapons/zaal/ultraliskroar.wav new file mode 100644 index 000000000..ce34c5344 Binary files /dev/null and b/sounds/weapons/zaal/ultraliskroar.wav differ diff --git a/sounds/weapons/zaal/zartyroar.wav b/sounds/weapons/zaal/zartyroar.wav new file mode 100644 index 000000000..dd2a16769 Binary files /dev/null and b/sounds/weapons/zaal/zartyroar.wav differ diff --git a/springignore.txt b/springignore.txt index 54886d5ef..0318ea62a 100644 --- a/springignore.txt +++ b/springignore.txt @@ -2,6 +2,7 @@ # This should allow to play multiplayer directly using a clone of the repo. # +.git /.git /.svn /*/.svn diff --git a/story.txt b/story.txt index 27ed739bb..c8ee1b58b 100644 --- a/story.txt +++ b/story.txt @@ -1,62 +1,139 @@ -Act 1: Prehistory, the Cold War, and the Space War +Evolution RTS +Prologue +Act 1: Prehistory, the Cold War, the Space War +The planet Atera is a small, blue green planet orbiting a pale yellow star, itself orbited by two large moons: The Twin Eyes of Loz, the Goddess of War. These moons, pale white and gleaming in the skies of Atera, were the heralds of war and blood. -The planet Iammas is a small, blue green planet orbiting a pale yellow star, itself orbited by two large moons: The Twin Eyes of Loz, the Goddess of War. These moons, pale white and gleaming in the skies of Iammas, were the heralds of war and blood. +Their tidal patterns, complex and extreme, would flood areas, then open up new land routes. They would change the topography of whole regions in a short decade and bring the many tribes of Atera into contact with one another. The Ateran people were a lizardlike people, bipedal, tailed, with slitted eyes and aquatic bent. They could swim as well as walk, and their bodies were tough and flexible. -Their tidal patterns, complex and extreme, would flood areas, then open up new land routes. They would change the topography of whole regions in a short decade…and bring the many tribes of Iammas into contact with one another. The Iamman people were a lizardlike people, bipedal, tailed, with slitted eyes and aquatic bent. They could swim as well as walk, and their bodies were tough and flexible. +With spear and blowgun, the Aterans fought. They fought for land, for the Gods, for simple brutal pleasure. -With spear and blowgun, the Iammans fought. The fought for land, for the Gods, for simple brutal pleasure. +With bronze sword and shield, the Aterans fought. They fought for food, for mineral wealth, for slaves -With bronze sword and shield, the Iammans fought. They fought for food, for mineral wealth, for slaves +With gunpowder and lines of battle, the Aterans fought. For republics, for monarchies, for spices and for trade routes. -With gunpowder and lines of battle, the Iammans fought. For republics, for monarchies, for spices and for trade routes. +With the coming of their tenth millennium, the Aterans had formed into two coalitions, both poised to unleash the newest and most deadly weapons onto one another: Nuclear, biological, and chemical weapons. -With the coming of their tenth millennium, the Iammans had formed into two coalitions, both poised to unleash the newest and most deadly weapons onto one another: Nuclear, biological, and chemical weapons. - -The Northern Coalition and the Southern World Order stood in this uneasy peace, even as the first Iamman stepped on the Moon. +The Northern Coalition (NC) and the Southern World Order (SWO) stood in this uneasy peace, even as the first Ateran stepped on the Moon. It was only a short time before the war denied on the ground began in space. -In the vacume between the planets, Iamman blood crystallized and starships were pulped by cannon shells and laser blasts. The weapons had changed, and the field of battle had changed, but the simple truth of war had stayed the same: Young Immans were the ones who fought and the ones who died. - -It was then that two inventions came to the fore, inventions that would completely change the field of battle. One was the K.T Shield, a device that could ward off deadly energy attacks and make a ship invisible (for short periods of time) and the other was the Mass Drive, a device that could allow a starship to bridge massive distances in the blink of an eye. - -With these, the SWO triumphed and for the first time in ten thousand years, the Iamman people were at peace. +In the vacuum between the planets, Ateran blood crystallized and starships were pulped by cannon shells and laser blasts. The weapons had changed, and the field of battle had changed, but the simple truth of war had stayed the same: Young Aterans were the ones who fought and the ones who died. +It was then that two inventions came to the fore, inventions that would completely change the field of battle. One was the K.T. Shield, a device that could ward off deadly energy attacks and make a ship invisible (for short periods of time) and the other was the Mass Drive, a device that could allow a starship to bridge massive distances in the blink of an eye. +With these, the SWO triumphed and for the first time in ten thousand years, the Ateran people were at peace. -Act 2: Colonization, Martial Law, The Collapse. +Act 2: Colonization, Martial Law, the Collapse +The first Mass Drive capable starships were scout vessels, exploring nearby systems for life. They found rocks. Rocks and lifeless planets, incapable of supporting anything. But then they found them. A string of six livable planets, in six star systems, spread in a crescent constellation called The Arm of Kala, the Goddess of Peace. -The first Mass Drive capable star ships were scout vessels, exploring nearby systems for life. They found rocks. Rocks and lifeless planets, incapable of supporting anything. But then they found them. A string of six livable planets, in six star systems, spread in a crescent constellation called The Arm of Kala, the Goddess of Peace. - -The Outer Colonies were created…and war came once more. The Colonies seethed with rebellion, and the SWO reacted as anyone would expect: They cracked down. Rebellion was crushed and the Colonies were placed under martial law. +The Outer Colonies were created and war came once more. The Colonies seethed with rebellion, and the Southern World Order reacted as anyone would expect: They cracked down. Rebellion was crushed and the Colonies were placed under martial law. It was then that the Collapse came. -The Iamman planet, like many others, has a magnetosphere. And like many others, the magnetosphere periodically shifts its polarity, temporarily dropping and leaving the planet vulnerable. +The Ateran planet, like many others, has a magnetosphere. And like many others, the magnetosphere periodically shifts its polarity, temporarily dropping and leaving the planet vulnerable. Normally, this would be a non-issue. -However, the Iamman star happened to have the single largest recorded solar flare at exactly the same time. A wash of radiation bathed Iammas. Computers crashed, the network collapsed, countless terrabytes of information was lost completely. The economy collapsed. Communication collapsed. Civilization collapsed as well, as a massive rise in cancer deaths resulted. +However, the Ateran star happened to have the single largest recorded solar flare at exactly the same time. A wash of radiation bathed Atera. Computers crashed, the network collapsed, countless terabytes of information was lost completely. The economy collapsed. Communication collapsed. Civilization collapsed as well, and a massive rise in cancer deaths resulted. Chaos. Panic. War. Nuclear fire blossomed as panicked military officers believed they were under attack and fail-safes put in place centuries ago went into effect. -The Iammas homeworld was reduced to a dark age… +The Atera homeworld was reduced to a dark age. And the Outer Colonies? -They. +They did Nothing. + +Act 3: The Unification War +While Atera fell into chaos and darkness, the Outer Colonies reveled in their new found freedoms. They expanded, they built new cities, new colonies, new ships, new weapons. The first conflicts were minor, over viable planets that surrounded the Six Colonies. + +But the Ateran people could never balance on the knife’s edge of peace. + +Chapter 00 +Twenty years had passed since the Ateran Homeworld, Atera, was plunged into darkness and the freedom of the Outer Colonies finally realized. Initially, the shock of the devastation on Atera was both overwhelming and a relief. On one hand, trade with Atera and the Outer colonies was booming. Many raw materials were available in abundance upon the String of planets in the Arm of Kala that were not so easily obtained upon Atera. On the other hand, the Outer Colonies were finally free of the rule and oversight of Atera. + +Atera was practically uninhabitable compared to the planets of the Outer Colonies, Kali, Bi Xiu, Ashiesha, Pascia, Rohini, and Mot. Atera was an ever changing world of extreme tidal patterns and changing topography that made life in general a rather harsh reality. Even so, a sort of stubborn allegiance to Atera had developed in the years leading up to the collapse by it’s inhabitants. This illogical reasoning got to the point that the “Mudders” (as they were referred to by the people of the Outer Colonies) had developed an unhealthy dislike for the “Spacers”, and vice versa. This disdain was of course not enough to halt trade between the Outer Colonies and the Southern World Order (renamed simply to “The Order”, after control of Atera had been fully asserted by the SWO), but it did intensify relations. + +Some time after the initial rebellion of the Outer Colonies had been successfully quashed by The Order, relations and regulations finally relaxed to a level of uneasy peace. The Outer Colonies still governed themselves but with a modicum of “Order Oversight”�. This “oversight”� was more superficial than tangible, but it allowed The Order to exude an air of control over the known galaxy. + +Then the collapse came. Immediately, life on Atera, as they had known it, halted. Electronics of any kind were rendered useless and the people of Atera received a (in many cases) lethal dose of radiation. Trade ships from the Outer Colonies observed the chaos from afar, but regardless of any protests to the contrary, the collapse was seen as a net positive for the Outer Colonies. They almost universally agreed to not interfere with what was happening on Atera. + +Suddenly they were free to do as they wished, and each colony in turn flourished under independent rule. An interplanetary council, known as the Federation of Kala, was formed to unite the colonies under a common set of laws and trade agreements. This agreement lasted for decades without incident, but then the exploratory ships of Bi Xiu bumped into the Xenos. + +The Xeno planet (Designated “Nu-Gua”� by the astronomers of Bi Xiu) was situated in the habitable zone of a pale yellow star known as “5313 Lacertae”�. The system consisted of three planets, two of which were gas giants. Nu-Gua itself was accompanied by 3 tiny moons in stable orbits. Of all the potentially habitable worlds discovered thus far, Nu-Gua was widely considered the best hope for colonization. some 58% of it’s surface was covered with liquid water, and it’s atmosphere was estimated to be composed of oxygen and nitrogen, with trace amounts of carbon dioxide and argon. + +The exploratory ship commissioned by Bi Xiu was a large cruiser known as the Celestial Maiden. Leftover from the war with Atera and retrofitted for long voyages to distant worlds in hope of finding habitable planets. On approach to Nu-Gua, the observation deck of the Celestial Maiden reported sightings of potential cities and irregular formations upon the planet’s surface. + +As the Celestial Maiden drew closer to Nu-Gua, the observation deck reported satellites orbiting the planet. It was decided to attempt to make first contact, and a high orbit of about 117km from the surface of the Nu-Gua was established. Attempts using the standard forms of laser communication were met with no reaction initially, but the captain aboard the Celestial Maiden, being a patient man, decided to wait in orbit for a response. + +The Celestial Maiden never saw it coming. When the ship had attempted communication via laser, the people of Nu-Gua saw it as an act of aggression and responded in kind. Fired from the opposite side of the planet and slingshot around Nu-Gua’s largest moon, the 47 kiloton nuclear warhead practically incinerated the Celestial Maiden. + +Many weeks went by without any communication from the Celestial Maiden. A scout was organized and outfitted to visit Nu-Gua. The scout ship was able to get in and out, undetected, and reported finding scattered wreckage believed to be the ill fated Celestial Maiden. + +The Federation of Kala met in an emergency session and unilaterally declared war upon Nu-Gua. + +Opening hostilities were drawn out longer than originally expected, but the Xenos were defeated with relative ease and occupation was established upon Nu-Gua. Here the paths of each colony diverged. The colonies of Kali, Bi Xiu, Ashiesha, and Pascia, seething with malice and hatred, pushed for all out genocide. The colonies of Rohini and Mot pushed for a more measured approach; one of benevolence and instruction in the belief that the Xenos didn’t truly understand the gravity of what they had done. + +The Xenos were in a booming modern age and had achieved spaceflight only a little more than a century previously. Their weapons, crude projectiles by Ateran standards, were still deadly and effective. Their primary method of communication over long distances was the extremely slow and rather archaic practice of using radio waves. + +The Xenos themselves were a hideous race. Bare skinned and bi-pedal. Unsharpened teeth and no claws. In hand to hand combat, a Xeno stood practically no chance versus an Ateran’s scaled hide and clawed limbs. There was obvious intelligence and this is the quality that the colonies of Rohini and Mot seized upon in their arguments, saying: “If they can be taught and brought into modern times, by Ateran standards, then they should be.” + +The other colonies did not agree and began pre-emptively bombarding the planet’s surface. Troops landed and began systematically exterminating the Xenos. This prompted the colonies of Rohini and Mot to spring into action and land troops of their own while waging war in space above the planet and effectively blockading Nu-Gua. + +The Federation of Kala once again met in emergency session and summarily ejected the colonies of Rohini and Mot from the Federation while simultaneously declaring war and suspending all trade with the rogue colonies. With the might of the Federation bearing down upon them, Rohini and Mot were hard pressed to hold the blockade and eventually were forced to retreat to the far side of the planet. The armadas in space achieved a virtual standstill while their troops engaged each other on the planet’s surface. Throughout this time, the colonies of Rohini and Mot formed what they termed the “Loz Alliance”�. The Loz Alliance sought out the the beleaguered Xenos and entered peace talks. A treaty was formed and in exchange for help versus the Federation of Kala, they would have their independence from colonial rule. To renege on this treaty meant certain extermination. + +The Xenos turned out to be exceptionally gifted with the ability to learn new technologies. The armies of Nu-Gua’s citizens were turned in full force against the Federation of Kala. Even with this additional help, the Loz Alliance was hard pressed and steadily lost ground, until a group of courageous Xeno commandos gave their lives in a successful attempt to plant a fusion bomb in the powerplant fields erected by the Federation of Kala. As their power levels dropped, the forces of Kala found themselves losing ground to the Loz Alliance. + +Chapter 1: Incursion! +The armies of the Federation of Kala have been dealt a serious blow, but they are still a serious threat. The power fields allowed them to maintain a stranglehold on this sector, but their destruction has created an opening for us. + +One of our Nuclear Powerplants has been overrun by enemy forces. It is the only powerplant in this sector and an Overseer unit is not available to construct more. It is crucial that you reach the powerplant and protect it from destruction. + +Enemy forces are aware of the powerplant’s existence and location, but are choosing to use it as bait to lure our meager forces into an ambush. Our only advantage is that they have underestimated the size of our remaining forces in this sector. While they are not large in number, it is significantly more than they will be expecting. Even so, you will need to exercise caution. Remember, these are the only units that we have available to us until an Overseer unit arrives. Exercise caution. + +Chapter 2: Enemy Outpost +Our scouts have found the enemy’s main operations outpost in this sector. Their forces have been drawn off by our counter-attacks on other fronts, providing us with a limited window within which we may be able to destroy the outpost, and the factory responsible for fabricating all of their forces in this area. + +We still do not have an Overseer unit available for you to use, but we have gathered as much firepower as we can muster on such short notice. You will have an assault tank available to you. It is capable of dealing heavy damage to base defenses and structures, but cannot stand up to anti-armor skirmishers. You cannot hope to defeat the enemy without it. + +Chapter 3: Aerial Assault +Excellent news! Our efforts here on Nu-Gua have been progressing at a fast pace, much in part due to your achievements. The Federation of Kala has been pushed back so far that the surface troops are having to rely on cover from their ships in geosynchronous orbit for protection from our advancing ground forces. We have reports that the enemy is massing a huge aerial assault in which they hope to crush our advance. + +We cannot advance at this time as we are not strong enough to support both the battle in space as well as the battle on the ground, and we must achieve space superiority before we can advance further. + +Your mission is to prepare for the coming onslaught. If our reports are to be believed, you will be facing a nearly endless onslaught of bombers, gunships and fighters. You must hold the line and defend our skirmish line. If the enemy is able to break through then our ground forces will be nearly helpless to defend themselves. + +You will be given the use of an aerial engineer for this mission. You only have one, so do not lose it! It is possible that you may have to deal with some ground forces, but any advances by ground forces are likely to be very light. + +Chapter 4: Against the wall +We’ve almost done it! The Federation of Kala is reeling from our relentless assault both on the ground and in space! The Federation seems to be making a last stand and look as though they are poised for an evacuation if they are to fail. + +Your mission is the eliminate the enemy base in sector G-14. It is heavily defended and bristling to the teeth with offensive firepower. Exercise caution. Reports have come in stating that portions of the enemy base are inadequately covered with anti-air flak turrets. Unfortunately, we have no more details than that. It is recommended that you send some scout drones to test the aerial defenses. + +Chapter 5: Evacuation +The Federation is in full retreat! Their position in space is regrettably well fortified and we cannot press them any further. On the ground the federation is mass producing hover drone bombs and using them to cover their retreat. Press forward and take out the production facilities so that we can push the Federation of Kala out of this system for good! + +Hoverbombs are extremely fast and agile, proceed with caution as their explosion radius is quite large. The bombs are armored, so be sure to use units with bonus damage vs armored. + +Intermission +Meanwhile, closer to home… + +The forces of the Federation of Kala had been soundly routed. Nu-Gua was free again and the people of Nu-Gua flourished under their newfound bond with the Loz Alliance. -Did. +The confrontation in space far above Nu-Gua was later considered to be one of the strangest of the entire war. Very few lives were lost due to combat between ships. The Federation of Kala and the Loz alliance were hesitant to waste Ateran lives with reckless abandon. The Federation considered Xenos to be acceptable collateral damage and would kill them without reason and simply because they were not Ateran. The Federation still seethed with hatred over the loss of the Celestial Maiden. That the ship had been destroyed as a result of miscommunication (acknowledged and renounced retroactively by the Government of Nu-Gua) did not matter. In the eyes of the Federation it was blood for blood, and in this case that meant the complete and utter destruction of the Xenos. -Nothing. +Back in the colonies of the Federation of Kala, the council was in hot debate amongst themselves with regards to warring against their own kind in lieu of the Xenos. The colonies of Kali and Pascia pushed for a ceasefire and peacetalks to begin between the Loz Alliance and the Federation of Kala, reasoning that Nu-Gua could be dealt with in due time. +The colonies of Bi Xiu and Ashiesha argued that the Loz Alliance had turned their backs on the Federation and their own brethren, all for the “savages”� of Nu-Gua and deserved a traitor’s death. Bi Xiu’s foremost ambassador scorned Kali and Pascia for their marked restraint in the space battle above Nu-Gua, while the ambassadors of Kai and Pascia were quick to renounce Bi Xiu’s thirst for blood at any cost. +Eventually it was decided that the Loz Alliance must be subdued and subjected to rule under the Federation of Kala. A huge invasion fleet was dispatched to the world of Mot. -Act 3: The Unification War. +During this time the Loz Alliance had been busy instructing the Xenos in the ways of new technology and it’s usage. Nu-Gua was extremely rich in natural resources, more so than any two planets belonging to the Ateran colonies. Production facilities were erected on the planet and new ships were fabricated en-masse. The people of Nu-Gua were taught Ateran history, culture, and introduced to the Ateran way of life. In turn the Xenos taught the Aterans of the Loz Alliance the ways of Nu-Gua. They were taught of the various clever inventions of Nu-Gua that had resulted as an attempt to ease their way of life. The Ateran were introduced to the extensive military history of the Xenos. Many civil wars had occurred throughout the centuries. -While Immas fell into chaos and darkness, the Outer Colonies reveled in their new found freedoms. They expanded, they built new cities, new colonies, new ships…new weapons. The first conflicts were minor, over viable planets that surrounded the Six Colonies. +Initially there had been five main republics of Nu-Gua. These republics operated in the peace wrought by the threat of Mutually Assured Destruction. Eventually war broke out that engulfed the entire planet. After a very violent and bloody ten year struggle, the Xenos were united under a one world government and peace and balance were once again restored. Research into space travel was heavily invested in, and in 15 short years, the Xenos stepped foot on their largest moon. This achievement only served to fuel the desire of the Xenos to reach the stars. However, throughout all this, the Xenos retained their innate violent tendencies and innate fear of the unknown. -But the Iamman people could never balance on the knife’s edge of peace. +When the Celestial Maiden had hailed Nu-Gua, it had not even been previously spotted. The attempted laser communication was seen as an imminent attack or perhaps a test of the planetary defensive systems. The government panicked and in an emergency council session, voted with a scant majority to respond with a nuclear missile. -A new war was brewing. A violent conflict, between the Six Colonies, each one convinced that it was in the right, each one sure of its own ability to defeat its enemies. But they need Generals. They need soldiers. They need you. +Through the combined remorse on the part of the Xenos and their shared enemy, Nu-Gua and the Loz Alliance developed a strong bond of understanding and tentative trust. +Spies among the colonies of the Federation of Kala found out about the invasion fleet within hours of it’s departure. Emergency communications were sent to the colonies of Rohini and Mot, as well as to the Loz Alliance forces on Nu-Gua. The government of Nu-Gua immediately pledged their full backing and support. As it was, by the time the combined forces of the Xenos and the Loz Alliance arrived, the planet of Mot was under heavy assault. The war had begun in earnest. \ No newline at end of file diff --git a/unitpics/chicken_unitpics/chicken1.png b/unitpics/chicken_unitpics/chicken1.png deleted file mode 100644 index 664a49988..000000000 Binary files a/unitpics/chicken_unitpics/chicken1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1b.png b/unitpics/chicken_unitpics/chicken1b.png deleted file mode 100644 index 4624b97dc..000000000 Binary files a/unitpics/chicken_unitpics/chicken1b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1c.png b/unitpics/chicken_unitpics/chicken1c.png deleted file mode 100644 index b28dcb539..000000000 Binary files a/unitpics/chicken_unitpics/chicken1c.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1d.png b/unitpics/chicken_unitpics/chicken1d.png deleted file mode 100644 index f6904d7bf..000000000 Binary files a/unitpics/chicken_unitpics/chicken1d.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1x.png b/unitpics/chicken_unitpics/chicken1x.png deleted file mode 100644 index 3260178b3..000000000 Binary files a/unitpics/chicken_unitpics/chicken1x.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1y.png b/unitpics/chicken_unitpics/chicken1y.png deleted file mode 100644 index f9520380c..000000000 Binary files a/unitpics/chicken_unitpics/chicken1y.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken1z.png b/unitpics/chicken_unitpics/chicken1z.png deleted file mode 100644 index 24986433a..000000000 Binary files a/unitpics/chicken_unitpics/chicken1z.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken2.png b/unitpics/chicken_unitpics/chicken2.png deleted file mode 100644 index 6f6d6d359..000000000 Binary files a/unitpics/chicken_unitpics/chicken2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken2b.png b/unitpics/chicken_unitpics/chicken2b.png deleted file mode 100644 index 79d2973e5..000000000 Binary files a/unitpics/chicken_unitpics/chicken2b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chicken_dodo1.png b/unitpics/chicken_unitpics/chicken_dodo1.png deleted file mode 100644 index 896ec18f2..000000000 Binary files a/unitpics/chicken_unitpics/chicken_dodo1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickena1.png b/unitpics/chicken_unitpics/chickena1.png deleted file mode 100644 index c6c4921ba..000000000 Binary files a/unitpics/chicken_unitpics/chickena1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickena1c.png b/unitpics/chicken_unitpics/chickena1c.png deleted file mode 100644 index 1966021a1..000000000 Binary files a/unitpics/chicken_unitpics/chickena1c.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickena2.png b/unitpics/chicken_unitpics/chickena2.png deleted file mode 100644 index 9802b54b1..000000000 Binary files a/unitpics/chicken_unitpics/chickena2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickena2b.png b/unitpics/chicken_unitpics/chickena2b.png deleted file mode 100644 index 80585de10..000000000 Binary files a/unitpics/chicken_unitpics/chickena2b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenc1.png b/unitpics/chicken_unitpics/chickenc1.png deleted file mode 100644 index 22d438071..000000000 Binary files a/unitpics/chicken_unitpics/chickenc1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenc2.png b/unitpics/chicken_unitpics/chickenc2.png deleted file mode 100644 index 79fb85cfe..000000000 Binary files a/unitpics/chicken_unitpics/chickenc2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenc3.png b/unitpics/chicken_unitpics/chickenc3.png deleted file mode 100644 index 4a0ca7b61..000000000 Binary files a/unitpics/chicken_unitpics/chickenc3.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenc3b.png b/unitpics/chicken_unitpics/chickenc3b.png deleted file mode 100644 index c0176eb37..000000000 Binary files a/unitpics/chicken_unitpics/chickenc3b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenc3c.png b/unitpics/chicken_unitpics/chickenc3c.png deleted file mode 100644 index 1e9c82b5d..000000000 Binary files a/unitpics/chicken_unitpics/chickenc3c.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenf1.png b/unitpics/chicken_unitpics/chickenf1.png deleted file mode 100644 index 9c1d17c71..000000000 Binary files a/unitpics/chicken_unitpics/chickenf1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenf2.png b/unitpics/chicken_unitpics/chickenf2.png deleted file mode 100644 index 2449ddc1d..000000000 Binary files a/unitpics/chicken_unitpics/chickenf2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenh1.png b/unitpics/chicken_unitpics/chickenh1.png deleted file mode 100644 index 411061aeb..000000000 Binary files a/unitpics/chicken_unitpics/chickenh1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenh1b.png b/unitpics/chicken_unitpics/chickenh1b.png deleted file mode 100644 index 02a6db144..000000000 Binary files a/unitpics/chicken_unitpics/chickenh1b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenh2.png b/unitpics/chicken_unitpics/chickenh2.png deleted file mode 100644 index a4bfddfe7..000000000 Binary files a/unitpics/chicken_unitpics/chickenh2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenh3.png b/unitpics/chicken_unitpics/chickenh3.png deleted file mode 100644 index 977d04087..000000000 Binary files a/unitpics/chicken_unitpics/chickenh3.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenh5.png b/unitpics/chicken_unitpics/chickenh5.png deleted file mode 100644 index c11b2512f..000000000 Binary files a/unitpics/chicken_unitpics/chickenh5.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenp1.png b/unitpics/chicken_unitpics/chickenp1.png deleted file mode 100644 index abefb9667..000000000 Binary files a/unitpics/chicken_unitpics/chickenp1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenr1.png b/unitpics/chicken_unitpics/chickenr1.png deleted file mode 100644 index a8d5f48e7..000000000 Binary files a/unitpics/chicken_unitpics/chickenr1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenr2.png b/unitpics/chicken_unitpics/chickenr2.png deleted file mode 100644 index a8d5f48e7..000000000 Binary files a/unitpics/chicken_unitpics/chickenr2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenr3.png b/unitpics/chicken_unitpics/chickenr3.png deleted file mode 100644 index 4094469f3..000000000 Binary files a/unitpics/chicken_unitpics/chickenr3.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickens1.png b/unitpics/chicken_unitpics/chickens1.png deleted file mode 100644 index 5fc5d3b50..000000000 Binary files a/unitpics/chicken_unitpics/chickens1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickens2.png b/unitpics/chicken_unitpics/chickens2.png deleted file mode 100644 index 2ed9be56d..000000000 Binary files a/unitpics/chicken_unitpics/chickens2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenw1.png b/unitpics/chicken_unitpics/chickenw1.png deleted file mode 100644 index 48cd4ede8..000000000 Binary files a/unitpics/chicken_unitpics/chickenw1.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenw1b.png b/unitpics/chicken_unitpics/chickenw1b.png deleted file mode 100644 index aa0109151..000000000 Binary files a/unitpics/chicken_unitpics/chickenw1b.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenw1c.png b/unitpics/chicken_unitpics/chickenw1c.png deleted file mode 100644 index 4d99a816f..000000000 Binary files a/unitpics/chicken_unitpics/chickenw1c.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/chickenw2.png b/unitpics/chicken_unitpics/chickenw2.png deleted file mode 100644 index 7d1e8b299..000000000 Binary files a/unitpics/chicken_unitpics/chickenw2.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/epic_chickenq.png b/unitpics/chicken_unitpics/epic_chickenq.png deleted file mode 100644 index 3e99209f3..000000000 Binary files a/unitpics/chicken_unitpics/epic_chickenq.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/h_chickenq.png b/unitpics/chicken_unitpics/h_chickenq.png deleted file mode 100644 index b42674ab6..000000000 Binary files a/unitpics/chicken_unitpics/h_chickenq.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/n_chickenq.png b/unitpics/chicken_unitpics/n_chickenq.png deleted file mode 100644 index 3c51baea6..000000000 Binary files a/unitpics/chicken_unitpics/n_chickenq.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/roost.png b/unitpics/chicken_unitpics/roost.png deleted file mode 100644 index 152a3a9dd..000000000 Binary files a/unitpics/chicken_unitpics/roost.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/ve_chickenq.png b/unitpics/chicken_unitpics/ve_chickenq.png deleted file mode 100644 index e13f02492..000000000 Binary files a/unitpics/chicken_unitpics/ve_chickenq.png and /dev/null differ diff --git a/unitpics/chicken_unitpics/vh_chickenq.png b/unitpics/chicken_unitpics/vh_chickenq.png deleted file mode 100644 index dd78bb735..000000000 Binary files a/unitpics/chicken_unitpics/vh_chickenq.png and /dev/null differ diff --git a/unitpics/elaserbattery.png b/unitpics/elaserbattery.png new file mode 100644 index 000000000..4bf4676e5 Binary files /dev/null and b/unitpics/elaserbattery.png differ diff --git a/unitpics/eshieldgen.png b/unitpics/eshieldgen.png index 6e2d1f2bb..fb74c7522 100644 Binary files a/unitpics/eshieldgen.png and b/unitpics/eshieldgen.png differ diff --git a/unitpics/loadingpics/DreamstateLogic.png b/unitpics/loadingpics/DreamstateLogic.png new file mode 100644 index 000000000..97f5a0c55 Binary files /dev/null and b/unitpics/loadingpics/DreamstateLogic.png differ diff --git a/unitpics/loadingpics/TheEnigmaTNG.png b/unitpics/loadingpics/TheEnigmaTNG.png new file mode 100644 index 000000000..35d0d5037 Binary files /dev/null and b/unitpics/loadingpics/TheEnigmaTNG.png differ diff --git a/unitpics/lootboxbronze.png b/unitpics/lootboxbronze.png new file mode 100644 index 000000000..201b107d0 Binary files /dev/null and b/unitpics/lootboxbronze.png differ diff --git a/unitpics/lootboxgold.png b/unitpics/lootboxgold.png new file mode 100644 index 000000000..201b107d0 Binary files /dev/null and b/unitpics/lootboxgold.png differ diff --git a/unitpics/lootboxplatinum.png b/unitpics/lootboxplatinum.png new file mode 100644 index 000000000..201b107d0 Binary files /dev/null and b/unitpics/lootboxplatinum.png differ diff --git a/unitpics/lootboxsilver.png b/unitpics/lootboxsilver.png new file mode 100644 index 000000000..201b107d0 Binary files /dev/null and b/unitpics/lootboxsilver.png differ diff --git a/unitpics/lozcommander.png b/unitpics/lozcommander.png new file mode 100644 index 000000000..2df811a34 Binary files /dev/null and b/unitpics/lozcommander.png differ diff --git a/unitpics/lozengineer.png b/unitpics/lozengineer.png new file mode 100644 index 000000000..bcd02cc63 Binary files /dev/null and b/unitpics/lozengineer.png differ diff --git a/unitpics/pattern/xcommander.png b/unitpics/pattern/xcommander.png new file mode 100644 index 000000000..87a46ee49 Binary files /dev/null and b/unitpics/pattern/xcommander.png differ diff --git a/unitpics/pattern/xcrasher.png b/unitpics/pattern/xcrasher.png new file mode 100644 index 000000000..726978d9c Binary files /dev/null and b/unitpics/pattern/xcrasher.png differ diff --git a/unitpics/pattern/xflea.png b/unitpics/pattern/xflea.png new file mode 100644 index 000000000..1e24308a1 Binary files /dev/null and b/unitpics/pattern/xflea.png differ diff --git a/unitpics/pattern/xhammer.png b/unitpics/pattern/xhammer.png new file mode 100644 index 000000000..12fbb3c7d Binary files /dev/null and b/unitpics/pattern/xhammer.png differ diff --git a/unitpics/pattern/xkconstructor.png b/unitpics/pattern/xkconstructor.png new file mode 100644 index 000000000..d2fa562a8 Binary files /dev/null and b/unitpics/pattern/xkconstructor.png differ diff --git a/unitpics/pattern/xllt.png b/unitpics/pattern/xllt.png new file mode 100644 index 000000000..ba7ae65f8 Binary files /dev/null and b/unitpics/pattern/xllt.png differ diff --git a/unitpics/pattern/xmetalextractor.png b/unitpics/pattern/xmetalextractor.png new file mode 100644 index 000000000..9db1cfeb3 Binary files /dev/null and b/unitpics/pattern/xmetalextractor.png differ diff --git a/unitpics/pattern/xmetalextractormoho.png b/unitpics/pattern/xmetalextractormoho.png new file mode 100644 index 000000000..38e1a3af4 Binary files /dev/null and b/unitpics/pattern/xmetalextractormoho.png differ diff --git a/unitpics/pattern/xrocketturret.png b/unitpics/pattern/xrocketturret.png new file mode 100644 index 000000000..737982fc4 Binary files /dev/null and b/unitpics/pattern/xrocketturret.png differ diff --git a/unitpics/pattern/xrocko.png b/unitpics/pattern/xrocko.png new file mode 100644 index 000000000..be5a40b23 Binary files /dev/null and b/unitpics/pattern/xrocko.png differ diff --git a/unitpics/pattern/xskulk.png b/unitpics/pattern/xskulk.png new file mode 100644 index 000000000..547358e7d Binary files /dev/null and b/unitpics/pattern/xskulk.png differ diff --git a/unitpics/pattern/xsolar.png b/unitpics/pattern/xsolar.png new file mode 100644 index 000000000..16de6689c Binary files /dev/null and b/unitpics/pattern/xsolar.png differ diff --git a/unitpics/pattern/xstorage.png b/unitpics/pattern/xstorage.png new file mode 100644 index 000000000..1331594bf Binary files /dev/null and b/unitpics/pattern/xstorage.png differ diff --git a/unitpics/pattern/xwarrior.png b/unitpics/pattern/xwarrior.png new file mode 100644 index 000000000..f67195982 Binary files /dev/null and b/unitpics/pattern/xwarrior.png differ diff --git a/unitpics/unitpics with backgrounds/eairplant.png b/unitpics/unitpics with backgrounds/eairplant.png deleted file mode 100644 index 876f3c309..000000000 Binary files a/unitpics/unitpics with backgrounds/eairplant.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eamphibfac.png b/unitpics/unitpics with backgrounds/eamphibfac.png deleted file mode 100644 index a412e0ebf..000000000 Binary files a/unitpics/unitpics with backgrounds/eamphibfac.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eartyturret.png b/unitpics/unitpics with backgrounds/eartyturret.png deleted file mode 100644 index f37c5f4b2..000000000 Binary files a/unitpics/unitpics with backgrounds/eartyturret.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/ebasefactory.png b/unitpics/unitpics with backgrounds/ebasefactory.png deleted file mode 100644 index 0a28448df..000000000 Binary files a/unitpics/unitpics with backgrounds/ebasefactory.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/ecommander.png b/unitpics/unitpics with backgrounds/ecommander.png deleted file mode 100644 index e2d5228b7..000000000 Binary files a/unitpics/unitpics with backgrounds/ecommander.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/efusion2.png b/unitpics/unitpics with backgrounds/efusion2.png deleted file mode 100644 index 590ac23a6..000000000 Binary files a/unitpics/unitpics with backgrounds/efusion2.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/egeothermal.png b/unitpics/unitpics with backgrounds/egeothermal.png deleted file mode 100644 index a7972995d..000000000 Binary files a/unitpics/unitpics with backgrounds/egeothermal.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eheavyturret2.png b/unitpics/unitpics with backgrounds/eheavyturret2.png deleted file mode 100644 index 343a654f9..000000000 Binary files a/unitpics/unitpics with backgrounds/eheavyturret2.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/ejammer2.png b/unitpics/unitpics with backgrounds/ejammer2.png deleted file mode 100644 index 4971f2b7a..000000000 Binary files a/unitpics/unitpics with backgrounds/ejammer2.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/ekmar.png b/unitpics/unitpics with backgrounds/ekmar.png deleted file mode 100644 index 69779aa88..000000000 Binary files a/unitpics/unitpics with backgrounds/ekmar.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/elightturret2.png b/unitpics/unitpics with backgrounds/elightturret2.png deleted file mode 100644 index 77d6a1345..000000000 Binary files a/unitpics/unitpics with backgrounds/elightturret2.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/emine.png b/unitpics/unitpics with backgrounds/emine.png deleted file mode 100644 index 85ba3a153..000000000 Binary files a/unitpics/unitpics with backgrounds/emine.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eminifac.png b/unitpics/unitpics with backgrounds/eminifac.png deleted file mode 100644 index 68654146f..000000000 Binary files a/unitpics/unitpics with backgrounds/eminifac.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eorb.png b/unitpics/unitpics with backgrounds/eorb.png deleted file mode 100644 index 9abe8cb6e..000000000 Binary files a/unitpics/unitpics with backgrounds/eorb.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eradar2.png b/unitpics/unitpics with backgrounds/eradar2.png deleted file mode 100644 index 905a63dc8..000000000 Binary files a/unitpics/unitpics with backgrounds/eradar2.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/eshieldgen.png b/unitpics/unitpics with backgrounds/eshieldgen.png deleted file mode 100644 index 0d2463c93..000000000 Binary files a/unitpics/unitpics with backgrounds/eshieldgen.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/esilo.png b/unitpics/unitpics with backgrounds/esilo.png deleted file mode 100644 index 35a98efd9..000000000 Binary files a/unitpics/unitpics with backgrounds/esilo.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/estorage.png b/unitpics/unitpics with backgrounds/estorage.png deleted file mode 100644 index ae6e1c604..000000000 Binary files a/unitpics/unitpics with backgrounds/estorage.png and /dev/null differ diff --git a/unitpics/unitpics with backgrounds/euwturret.png b/unitpics/unitpics with backgrounds/euwturret.png deleted file mode 100644 index 7ba6899f1..000000000 Binary files a/unitpics/unitpics with backgrounds/euwturret.png and /dev/null differ diff --git a/unitpics/zaal_unitpics/zairbomber.png b/unitpics/zaal_unitpics/zairbomber.png new file mode 100644 index 000000000..abfe91eeb Binary files /dev/null and b/unitpics/zaal_unitpics/zairbomber.png differ diff --git a/unitpics/zaal_unitpics/zairscout.png b/unitpics/zaal_unitpics/zairscout.png new file mode 100644 index 000000000..c753cc76e Binary files /dev/null and b/unitpics/zaal_unitpics/zairscout.png differ diff --git a/unitpics/zaal_unitpics/zairtoairfighter.png b/unitpics/zaal_unitpics/zairtoairfighter.png new file mode 100644 index 000000000..a5aaf98e5 Binary files /dev/null and b/unitpics/zaal_unitpics/zairtoairfighter.png differ diff --git a/unitpics/zaal_unitpics/zairtogroundfighter.png b/unitpics/zaal_unitpics/zairtogroundfighter.png new file mode 100644 index 000000000..0938c97e2 Binary files /dev/null and b/unitpics/zaal_unitpics/zairtogroundfighter.png differ diff --git a/unitpics/zaal_unitpics/zarm.png b/unitpics/zaal_unitpics/zarm.png new file mode 100644 index 000000000..05f870f98 Binary files /dev/null and b/unitpics/zaal_unitpics/zarm.png differ diff --git a/unitpics/zaal_unitpics/zarty.png b/unitpics/zaal_unitpics/zarty.png new file mode 100644 index 000000000..37e22eddc Binary files /dev/null and b/unitpics/zaal_unitpics/zarty.png differ diff --git a/unitpics/zaal_unitpics/zassault.png b/unitpics/zaal_unitpics/zassault.png new file mode 100644 index 000000000..12f5cd83f Binary files /dev/null and b/unitpics/zaal_unitpics/zassault.png differ diff --git a/unitpics/zaal_unitpics/zespire1.png b/unitpics/zaal_unitpics/zespire1.png new file mode 100644 index 000000000..688d1e065 Binary files /dev/null and b/unitpics/zaal_unitpics/zespire1.png differ diff --git a/unitpics/zaal_unitpics/zespire4.png b/unitpics/zaal_unitpics/zespire4.png new file mode 100644 index 000000000..266af3b6a Binary files /dev/null and b/unitpics/zaal_unitpics/zespire4.png differ diff --git a/unitpics/zaal_unitpics/zespire5.png b/unitpics/zaal_unitpics/zespire5.png new file mode 100644 index 000000000..403e604ac Binary files /dev/null and b/unitpics/zaal_unitpics/zespire5.png differ diff --git a/unitpics/zaal_unitpics/zhatch.png b/unitpics/zaal_unitpics/zhatch.png new file mode 100644 index 000000000..380656558 Binary files /dev/null and b/unitpics/zaal_unitpics/zhatch.png differ diff --git a/unitpics/zaal_unitpics/zhive.png b/unitpics/zaal_unitpics/zhive.png new file mode 100644 index 000000000..0b9a7a4dc Binary files /dev/null and b/unitpics/zaal_unitpics/zhive.png differ diff --git a/unitpics/zaal_unitpics/zkamikaze.png b/unitpics/zaal_unitpics/zkamikaze.png new file mode 100644 index 000000000..411edc673 Binary files /dev/null and b/unitpics/zaal_unitpics/zkamikaze.png differ diff --git a/unitpics/zaal_unitpics/zlightswarm.png b/unitpics/zaal_unitpics/zlightswarm.png new file mode 100644 index 000000000..478c718c2 Binary files /dev/null and b/unitpics/zaal_unitpics/zlightswarm.png differ diff --git a/unitpics/zaal_unitpics/zmedswarm.png b/unitpics/zaal_unitpics/zmedswarm.png new file mode 100644 index 000000000..1ed19ab00 Binary files /dev/null and b/unitpics/zaal_unitpics/zmedswarm.png differ diff --git a/unitpics/zaal_unitpics/zmex.png b/unitpics/zaal_unitpics/zmex.png new file mode 100644 index 000000000..22ccc26ab Binary files /dev/null and b/unitpics/zaal_unitpics/zmex.png differ diff --git a/unitpics/zaal_unitpics/zpyro.png b/unitpics/zaal_unitpics/zpyro.png new file mode 100644 index 000000000..b118d82f5 Binary files /dev/null and b/unitpics/zaal_unitpics/zpyro.png differ diff --git a/unitpics/zaal_unitpics/zqueen.png b/unitpics/zaal_unitpics/zqueen.png new file mode 100644 index 000000000..8ee86597d Binary files /dev/null and b/unitpics/zaal_unitpics/zqueen.png differ diff --git a/unitpics/zaal_unitpics/zskirmisher.png b/unitpics/zaal_unitpics/zskirmisher.png new file mode 100644 index 000000000..8b86166c7 Binary files /dev/null and b/unitpics/zaal_unitpics/zskirmisher.png differ diff --git a/unitpics/zaal_unitpics/ztenticle.png b/unitpics/zaal_unitpics/ztenticle.png new file mode 100644 index 000000000..446a525a9 Binary files /dev/null and b/unitpics/zaal_unitpics/ztenticle.png differ diff --git a/unitpics/zaal_unitpics/ztumor.png b/unitpics/zaal_unitpics/ztumor.png new file mode 100644 index 000000000..27fe512fe Binary files /dev/null and b/unitpics/zaal_unitpics/ztumor.png differ diff --git a/unitpics/ztiberium.png b/unitpics/ztiberium.png new file mode 100644 index 000000000..784afed9b Binary files /dev/null and b/unitpics/ztiberium.png differ