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 80e0849b5..bdbe4075c 100644 --- a/DummyCommit.txt +++ b/DummyCommit.txt @@ -1,2 +1 @@ -VERSION{v9.06} -VERSION{Campaign Branch v1.5} \ No newline at end of file +VERSION{v15.01} \ No newline at end of file diff --git a/Evolution RTS Crash Course.txt b/Evolution RTS Crash Course.txt deleted file mode 100644 index 2c65191f3..000000000 --- a/Evolution RTS Crash Course.txt +++ /dev/null @@ -1,40 +0,0 @@ -Metal is used to make unit and structures. - -Energy is only used for units to fire, shields, nukes etc. - -Energy is not used for building, but you will need tons of it because it is often depleted by units firing their weapons in battles, or shields powering up or simply used by metal makers when converting energy to metal -Without energy, your units can't fire. Along those lines, build storage. Build LOTS of storage. Storage buildings increase the total amount of metal and energy that youc an store, and so in that way act like capacitors for your army. Storage buildings are quite possibly the most important buildings in your base. - -In order to tech up put generators next to your factories. - -Basic generators give you 5 supply, 1 power (in a radius) and 1 energy -Geothermal generators give you 20 supply 7 power and 7 energy -Advanced generators give you 30 supply, 10 power and 10 energy - -Generators give you supply. The supply cap is 200/200. Generators say how much supply, power, and energy they give you in the unit descriptions that pop up when you mouseover them on the build menu. You need supply in order to build units. - -Power is used to tech up. The generators have graphics around them when you place them for building. That graphic is a visualization of the radius in which power is supplied. Place generators so that they are near your factory, and the power they provide will unlock higher tech units within the factory. - -In this way, teching up is easy, but if you lose your generators, then you will lose the tech that the generator was allowing you to build. - -Engineers, ORBs, and Overseers do not use supply. Make as many as you would like. It's a good idea to have many on hand sot hat you always have workers available and they will assist with other construction projects. - -ORBs are field repair units. They repair everything in a huge radius for 10hp every second, as long as what they are repairing is out of combat (for free). - -Metal Makers are good. They are not as efficient as metal extractors, but they can help use your excess energy while supplying you you additional income. Each Metal Maker uses 5 energy to produce 0.5 metal (The same income as a metal extractor). - -However, if you are using metal makers, remember that you need energy in order for your units to fire, so build storage so that you have a buffer zone. - -There are 5 tech paths: - -Hover, Amphibious, All Terrain, Air and Destroyers - -Hover can of course go over water and are moderately good in all situations. - -Amphibious units are extremely fast, very high damage output, but have very weak armor. Amphibious units are stealthed to radar. - -All Terrains units can of course go everywhere except water. They are the slowest of the 3 main technologies (Hover/Amphibious/All-Terrain), but have good firepower and solid damage output and good armor. All Terrain units can cloak. All Terrain units can't be automatically targeted when cloaked, but you can see them via seismic indicators, so you can fore fire at them if you want. Cloaking All Terrain units is uses a lot of energy (2 per unit). The best way to use them is to cloak them right before a fight so that you get the first shot in the battle. It can make the difference between winning and losing a battle. - -Destroyer units are end-game units. They are extremely powerful and deal critical amounts of damage, but they can be brought down by surrounding them and focusing your fire. Make sure that if you are using them, that you keep them protected. - -This might seem like a lot to take in, but the game and the gameplay itself is quite simple really. I hope that this crash course has been helpful! \ No newline at end of file diff --git a/Features/All Worlds/ammobox.lua b/Features/All Worlds/ammobox.lua index 69ddc6643..da3c3fd34 100644 --- a/Features/All Worlds/ammobox.lua +++ b/Features/All Worlds/ammobox.lua @@ -1,10 +1,10 @@ local objectname= "ammobox" local featureDef = { name = "ammobox", - description =[[Energy Core - • Can be reclaimed for 5 Metal and 5 Energy by moving an Overseer or an ORB in range - - • Can be converted to MidKnight Gunship Drone by moving an Engineer in range + description =[[Energy Core (Dropped from destroyed units): + +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 ]], object ="ammobox2.s3o", footprintx =1, @@ -18,6 +18,8 @@ local featureDef = { reclaimable =false, autoreclaimable =false, indestructible = true, + smokeTime = 0, + upright = false, -- nodrawundergray ="1.0", customParams = { 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/Features/ChickenFeatures/chicken_egg.tdf b/Features/ChickenFeatures/chicken_egg.tdf new file mode 100644 index 000000000..db7aa399f --- /dev/null +++ b/Features/ChickenFeatures/chicken_egg.tdf @@ -0,0 +1,72 @@ +[chicken_egg] +{ + description=Egg; + blocking=0; + category=corpses; + damage=2000; + energy=250; + featurereclamate=SMUDGE01; + footprintx=1; + footprintz=1; + height=30; + hitdensity=999999; + metal=25; + object=ChickenDefenseModels/chickenegg.s3o; + reclaimable=1; + seqnamereclamate=TREE1RECLAMATE; + world=All Worlds; +} +[chicken_eggb] +{ + description=Egg; + blocking=0; + category=corpses; + damage=2000; + energy=250; + featurereclamate=SMUDGE01; + footprintx=1; + footprintz=1; + height=30; + hitdensity=999999; + metal=25; + object=ChickenDefenseModels/chickeneggb.s3o; + reclaimable=1; + seqnamereclamate=TREE1RECLAMATE; + world=All Worlds; +} +[chicken_eggc] +{ + description=Egg; + blocking=0; + category=corpses; + damage=2000; + energy=250; + featurereclamate=SMUDGE01; + footprintx=1; + footprintz=1; + height=30; + hitdensity=999999; + metal=25; + object=ChickenDefenseModels/chickeneggc.s3o; + reclaimable=1; + seqnamereclamate=TREE1RECLAMATE; + world=All Worlds; +} +[chicken_eggd] +{ + description=Egg; + blocking=0; + category=corpses; + damage=2000; + energy=250; + featurereclamate=SMUDGE01; + footprintx=1; + footprintz=1; + height=30; + hitdensity=999999; + metal=25; + object=ChickenDefenseModels/chickeneggd.s3o; + reclaimable=1; + seqnamereclamate=TREE1RECLAMATE; + world=All Worlds; +} \ No newline at end of file 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 new file mode 100644 index 000000000..d698a7574 --- /dev/null +++ b/Gamedata/alldefs_post.lua @@ -0,0 +1,638 @@ +-------------------------- +-- DOCUMENTATION +------------------------- + +-- Evolution RTS contains weapondefs in its unitdef files +-- Standalone weapondefs are only loaded by Spring after unitdefs are loaded +-- So, if we want to do post processing and include all the unit+weapon defs, and have the ability to bake these changes into files, we must do it after both have been loaded +-- That means, ALL UNIT AND WEAPON DEF POST PROCESSING IS DONE HERE + +-- What happens: +-- unitdefs_post.lua calls the _Post functions for unitDefs and any weaponDefs that are contained in the unitdef files +-- unitdefs_post.lua writes the corresponding unitDefs to customparams (if wanted) +-- weapondefs_post.lua fetches any weapondefs from the unitdefs, +-- weapondefs_post.lua fetches the standlaone weapondefs, calls the _post functions for them, writes them to customparams (if wanted) +-- strictly speaking, alldefs.lua is a misnomer since this file does not handle armordefs, featuredefs or movedefs + +-- Switch for when we want to save defs into customparams as strings (so as a widget can then write them to file) +-- 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 +------------------------- + +local 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 + +-- process unitdef +function UnitDef_Post(name, uDef) + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Utility + -- + + local 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 + + + local function disableunits(unitlist) + for name, ud in pairs(UnitDefs) do + if (ud.buildoptions) then + for _, toremovename in ipairs(unitlist) do + for index, unitname in pairs(ud.buildoptions) do + if (unitname == toremovename) then + table.remove(ud.buildoptions, index) + end + end + end + end + end + end + + -- 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 --No longer needed + if uDef.airsightdistance == uDef.sightdistance * 1.5 then + uDef.airsightdistance = uDef.sightdistance + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Set building Mask 0 for all mobile units + -- + if uDef.customparams and uDef.customparams.unittype == "mobile" then + uDef.buildingmask = 0 + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- 3dbuildrange for all none plane builders + -- + --[[ + for name, ud in pairs(UnitDefs) do + if (tobool(ud.isBuilder) and not tobool(ud.canfly)) then + ud.buildrange3d = true + end + end + --]] + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- turn off unit collision check for planes + -- + + if uDef.canfly and not uDef.istransport then + uDef.collide = false + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Set building start sound for all builders + -- + + if uDef.builder == true and uDef.sounds then + uDef.sounds.build = "miscfx/buildstart-nano.wav" + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Calculate mincloakdistance based on unit footprint size + -- + + local sqrt = math.sqrt + + local fx = uDef.footprintx and tonumber(uDef.footprintx) or 1 + local fz = uDef.footprintz and tonumber(uDef.footprintz) or 1 + 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 + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Spring Kludge Removal + -- + uDef.activateWhenBuilt = true + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + + --Set reverse velocity automatically + if uDef.maxvelocity then + uDef.maxreversevelocity = uDef.maxvelocity * 0.75 + end + + --Override groundplate used + 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 + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Turn off nanospray globally + if uDef.shownanospray then + 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 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- process weapondef +function WeaponDef_Post(name, wDef) + + -- 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. + if wDef.customparams and wDef.customparams.targetborderoverride == nil then + wDef.targetborder = 0.75 --Aim for just inside the hitsphere + elseif wDef.customparams and wDef.customparams.targetborderoverride ~= nil then + wDef.targetborder = tonumber(wDef.customparams.targetborderoverride) + end + + -- 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 + end + + if (tobool(wDef.ballistic) or tobool(wDef.dropped)) then + 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 + if wDef.customparams and wDef.customparams.ispointdefenselaser == true then + if wDef.customparams.primaryweaponrange ~= nil then + primaryWeaponRange = tonumber(wDef.customparams.primaryweaponrange) + else + primaryWeaponRange = 0 + end + wDef.areaofeffect = 0 + wDef.avoidfeature = false + wDef.avoidfriendly = false + wDef.collidefeature = false + wDef.collidefriendly = false + wDef.corethickness = 0.2 + wDef.duration = 0.2 + wDef.explosiongenerator = [[custom:genericshellexplosion-small-sparks-burn]] + wDef.falloffrate = 1 + wDef.impulsefactor = 0 + wDef.interceptedbyshieldtype = 4 + wDef.minintensity = 1 + wDef.name = [[Point Defense Laser]] + wDef.projectiles = 1 + wDef.range = primaryWeaponRange + wDef.reloadtime = 0.25 + wDef.weapontype = [[LaserCannon]] + wDef.rgbcolor = [[0 0.5 1]] + wDef.rgbcolor2 = [[1 1 1]] + wDef.soundtrigger = true + wDef.soundstart = [[weapons/pointdefensefire.wav]] + wDef.texture1 = [[shot]] + wDef.texture2 = [[empty]] + wDef.thickness = 2 + wDef.tolerance = 1000 + wDef.turret = true + wDef.weaponvelocity = 1500 + wDef.customparams.damagetype = [[pdlaser]] + 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 + + +-------------------------- +-- MODOPTIONS +------------------------- + +-- process modoptions (last, because they should not get baked) +function ModOptions_Post (UnitDefs, WeaponDefs) + if (Spring.GetModOptions) then + local modOptions = Spring.GetModOptions() + + for id,unitDef in pairs(UnitDefs) do + unitDef.buildcostmetal = unitDef.buildcostmetal * 2 + + --Disabled due to boxcollector cpu costs + -- if unitDef.customparams.corpse == "energycore" then + -- 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 + end + end + end + + -- 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 + 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 -- + -------------------------------------------------------------------------------- + + for id,uDef in pairs(UnitDefs) do + -- Handle upgraded units HP and Max Speed + if uDef.customparams and uDef.customparams.isupgraded == "1" then + uDef.maxdamage = uDef.maxdamage * 1.20 + if uDef.maxvelocity then + uDef.maxvelocity = uDef.maxvelocity * 0.95 + end + end + if uDef.customparams and uDef.customparams.isupgraded == "2" then + uDef.maxdamage = uDef.maxdamage * 1.35 + if uDef.maxvelocity then + uDef.maxvelocity = uDef.maxvelocity * 0.90 + end + end + if uDef.customparams and uDef.customparams.isupgraded == "3" then + uDef.maxdamage = uDef.maxdamage * 1.50 + if uDef.maxvelocity then + 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 + -- Handle upgraded units weapon reload times + if wDef.customparams and wDef.customparams.isupgraded == "1" then + wDef.reloadtime = wDef.reloadtime * 0.85 + wDef.damage.default = wDef.damage.default * 1.20 + if wDef.exteriorshield == true and wDef.shieldpower < 0 then + wDef.shieldpower = wDef.shieldpower * 1.20 + end + end + if wDef.customparams and wDef.customparams.isupgraded == "2" then + wDef.reloadtime = wDef.reloadtime * 0.70 + wDef.damage.default = wDef.damage.default * 1.35 + if wDef.exteriorshield == true and wDef.shieldpower < 0 then + wDef.shieldpower = wDef.shieldpower * 1.35 + end + end + if wDef.customparams and wDef.customparams.isupgraded == "3" then + wDef.reloadtime = wDef.reloadtime * 0.65 + wDef.damage.default = wDef.damage.default * 1.50 + if wDef.exteriorshield == true and wDef.shieldpower < 0 then + 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 + if wDef.exteriorshield == true then + wDef.shieldpower = wDef.shieldpower * 1.20 + end + end + if wDef.customparams and wDef.customparams.isshieldupgraded == "2" then + if wDef.exteriorshield == true then + wDef.shieldpower = wDef.shieldpower * 1.35 + end + end + if wDef.customparams and wDef.customparams.isshieldupgraded == "3" then + if wDef.exteriorshield == true then + 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 + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + + -------------------------------------------------------------------------------- + -- Process Armortypes -- + -------------------------------------------------------------------------------- + + local damageClasses = VFS.Include("gamedata/configs/damageTypes.lua") + local damageTypes = damageClasses.damageTypes + local defaultClass = damageClasses.default + + weapondamage = tonumber(wDef.damage.default) + if (weapondamage > 0) then + if (wDef.customparams) then + local damagetypelower + if wDef.customparams.damagetype ~=nil then + damagetypelower = string.lower(wDef.customparams.damagetype) + end + if damagetypelower == '' or damagetypelower == nil then + damagetypelower = defaultClass + end + --Spring.Echo(damagetypelower) + --Spring.Echo(" ") + if damageTypes[damagetypelower] then + for armorClass, armorMultiplier in pairs(damageTypes[damagetypelower]) do + --Spring.Echo(wd.name, armorClass, weapondamage*armorMultiplier ) + wDef.damage[armorClass] = weapondamage*armorMultiplier + end + else + Spring.Echo("!!WARNING!! Invalid damagetype: " .. damagetypelower) + end + end + end + + -------------------------------------------------------------------------------- + -------------------------------------------------------------------------------- + -- Set energy cost to fire automatically + -- There are 2 weapondef customparams used to control this + -- oldcosttofireformula = true, will result in the original formula that did not account for weapon range to be used + -- nocosttofire == true, will result in cost to fire being set at 0 + local weaponDefaultDamage = wDef.damage.default + 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 + 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 * 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 * weaponBurst + end +]]-- + --Set shield energy cost to recharge +--[[ 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 + --Spring.Echo("Energy usage is " .. wDef.shieldpowerregenenergy) + wDef.shieldpowerregenenergy = wDef.shieldpowerregen / 10 + end + end +]]-- + end + + -------------------------------------------------------------------------------- + -- Gameplay Costs -- + -------------------------------------------------------------------------------- + + for id,unitDef in pairs(UnitDefs) do + + 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 160037301..2028a90c3 100644 --- a/Gamedata/configs/damageTypes.lua +++ b/Gamedata/configs/damageTypes.lua @@ -4,330 +4,106 @@ local damageClasses = { -- classes with armor classes for weapons damageTypes = { - nonexistent = { - SIEGE = 0.1, - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 0.1, - }, - ---------------------------------------------------------------------------- - - -- Start Hovers - eaatank = { - SIEGE = 1, + -- + light = { -- These values should always mirror antilight and vice versa + LIGHT = 1.5, ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, - }, - eartytank = { - SIEGE = 0.50, - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - ebomb = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - efatso = { - SIEGE = 0.125, - ARMORED = 0.125, - LIGHT = 0.125, - BUILDING = 1, - }, - eflametank = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - elighttank3 = { - SIEGE = 0.75, - ARMORED = 0.75, - LIGHT = 0.75, - BUILDING = 1, - }, - eheavytank3 = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.33, + BUILDING = 1, + AIR = 1, }, - emediumtank3 = { - SIEGE = 1, + antilight = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.5, + BUILDING = 1, + AIR = 1, }, - emissiletank = { - SIEGE = 1, + -- + turretantilight = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.5, - }, - eriottank2 = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eriottank2shotgun = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.25, - }, - elacerator = { - SIEGE = 0.33, - ARMORED = 0.33, - LIGHT = 0.33, - BUILDING = 1, + BUILDING = 0.1, + AIR = 1, }, - -- End Hovers - - -- Start All Terrains - eallterrheavy = { - SIEGE = 1, - ARMORED = 1, + turretantiarmored = { LIGHT = 1, - BUILDING = 0.5, + ARMORED = 1.5, + BUILDING = 0.1, + AIR = 1, }, - eallterrlight = { - SIEGE = 0.5, - ARMORED = 0.5, + antiarmored = { LIGHT = 1, - BUILDING = 0.5, - }, - eallterrmed = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 0.40, - BUILDING = 0.40, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1, }, - eallterraa = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, - }, - eallterrriot = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eallterrriotshotgun = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.25, - }, - eallterrassault = { - SIEGE = 0.50, - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, - }, - eallterranarchid = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - eallterranarchidflame = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - -- End All Terrains - - -- Start Amphibs - eamphibbuggy = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 1, - }, - eamphibriot = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibneedle = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibriotshotgun = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.25, - }, - eamphibaa = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 1, - BUILDING = 0.5, - }, - eamphibmedtank = { - SIEGE = 1, - ARMORED = 1, + antibuilding = { LIGHT = 1, - BUILDING = 0.5, - }, - eamphibrock = { - SIEGE = 1, ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.5, + BUILDING = 1.5, + AIR = 1, }, - eamphibarty = { - SIEGE = 0.50, - ARMORED = 0.50, - LIGHT = 0.50, - BUILDING = 1, + antibuildingarty = { + LIGHT = 0.25, + ARMORED = 0.25, + BUILDING = 1.5, + AIR = 0.25, }, - eamphibleveler = { - SIEGE = 1, - ARMORED = 1, + antiair = { LIGHT = 1, - BUILDING = 0.5, - }, - -- End Amphibs - - -- Start Aircraft - edrone = { - SIEGE = 1, ARMORED = 1, - LIGHT = 1, - BUILDING = 1, + BUILDING = 1, + AIR = 1.5, }, - efighter = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.25, + antilightarmored = { + LIGHT = 1.5, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1, }, - egunship2 = { - SIEGE = 1, + antilightbuilding = { + LIGHT = 1.5, ARMORED = 1, - LIGHT = 1, - BUILDING = 0.25, - }, - egunship2torpedo = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.25, - }, - ebomber = { - SIEGE = 0.75, - ARMORED = 0.75, - LIGHT = 0.75, - BUILDING = 1, + BUILDING = 1.5, + AIR = 1, }, - -- End Aircraft - - -- Start Experimentals - eexkrabgroth = { - SIEGE = 0.1, - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 1, - }, - eextankdestroyer = { - SIEGE = 1, - ARMORED = 1, + antiarmoredbuilding = { LIGHT = 1, - BUILDING = 0.1, + ARMORED = 1.5, + BUILDING = 1.5, + AIR = 1, }, - eexnukearty = { - SIEGE = 0.5, - ARMORED = 0.5, - LIGHT = 0.5, - BUILDING = 1, - }, - -- End Experimentals - - -- Start Buildings - elightturret2 = { - SIEGE = 0.25, - ARMORED = 0.25, + antibuildingair = { LIGHT = 1, - BUILDING = 0.1, - }, - eheavyturret2 = { - SIEGE = 0.5, - ARMORED = 1, - LIGHT = 0.5, - BUILDING = 0.1, - }, - eaaturret = { - SIEGE = 1, ARMORED = 1, - LIGHT = 0.66, - BUILDING = 0.66, + BUILDING = 1.5, + AIR = 1.5, }, - elrpc = { - SIEGE = 0.25, - ARMORED = 0.25, - LIGHT = 0.25, - BUILDING = 1, - }, - euwturret = { - SIEGE = 1, - ARMORED = 1, + antiarmoredair = { LIGHT = 1, - BUILDING = 0.1, + ARMORED = 1.5, + BUILDING = 1, + AIR = 1.5, }, - emine = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0, + turretantilightarmored = { + LIGHT = 1.5, + ARMORED = 1.5, + BUILDING = 0.1, + AIR = 1, }, - -- End Buildings - - -- Start Miscellaneous - queenbeam = { - SIEGE = 0.1, - ARMORED = 0.1, - LIGHT = 0.1, - BUILDING = 1, - }, - queenflames = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.1, - }, - queencannon = { - SIEGE = 1, - ARMORED = 1, - LIGHT = 1, - BUILDING = 0.1, - }, - -- End Miscellaneous default = { - SIEGE = 1, - ARMORED = 1, LIGHT = 1, - BUILDING = 1, + ARMORED = 1, + BUILDING = 1, + AIR = 1, }, }, armorDefs = { - "LIGHT", + "LIGHT", "ARMORED", - "SIEGE", - "BUILDING", + "BUILDING", + "AIR", }, } return damageClasses; \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/blob_fire.tdf b/Gamedata/explosions/ChickenCEGs/blob_fire.tdf new file mode 100644 index 000000000..7f71a7bbd --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/blob_fire.tdf @@ -0,0 +1,56 @@ +[blob_fire] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddropwhite; + colorMap=0 0.6 0.6 1 0.3 0.6 0.6 0.4 0.85 0.6 0.6 0; + airdrag=.96; + particleLife=18; + particleLifeSpread=8; + numParticles=2; + particleSpeed=1; + particleSpeedSpread=2; + particleSize=9; + particleSizeSpread=4; + emitRot=0; + emitRotSpread=30; + directional=1; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=0.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblastwhite; + colorMap=0.85 0.6 0.6 1 0 0.6 0.6 0.4 0 0 0 0; + airdrag=.9; + particleLife=14; + particleLifeSpread=2; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=6; + particleSizeSpread=5; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +} diff --git a/Gamedata/explosions/ChickenCEGs/blob_trail.tdf b/Gamedata/explosions/ChickenCEGs/blob_trail.tdf new file mode 100644 index 000000000..1336bb199 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/blob_trail.tdf @@ -0,0 +1,115 @@ +[blob_trail] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.2; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddropwhite; + colorMap=0.2 0.5 0.9 1 0.3 0.6 0.8 0.3 0.4 0.7 0.7 0; + airdrag=.96; + particleLife=2; + particleLifeSpread=4; + numParticles=2; + particleSpeed=1; + particleSpeedSpread=2; + particleSize=6; + particleSizeSpread=3; + emitRot=0; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.35; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblastwhite; + colorMap=0.4 0.7 1 1 0.3 0.6 0.8 0.3 0.4 0.7 0.7 0; + airdrag=.9; + particleLife=2; + particleLifeSpread=3; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=3; + particleSizeSpread=6; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +} + + +[blood_trail] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.2; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddrop; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.96; + particleLife=2; + particleLifeSpread=4; + numParticles=2; + particleSpeed=1; + particleSpeedSpread=2; + particleSize=6; + particleSizeSpread=9; + emitRot=0; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.35; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblast; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.9; + particleLife=2; + particleLifeSpread=3; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=3; + particleSizeSpread=6; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +} + diff --git a/Gamedata/explosions/ChickenCEGs/blood_explode.tdf b/Gamedata/explosions/ChickenCEGs/blood_explode.tdf new file mode 100644 index 000000000..7d544c7a1 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/blood_explode.tdf @@ -0,0 +1,234 @@ +[blood_explode] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddrop; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.96; + particleLife=12; + particleLifeSpread=8; + numParticles=5; + particleSpeed=3; + particleSpeedSpread=6; + particleSize=24; + particleSizeSpread=16; + emitRot=0; + emitRotSpread=80; + directional=1; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=3; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblast; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.9; + particleLife=16; + particleLifeSpread=0; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=24; + particleSizeSpread=16; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +/* [groundflash] + { + flashSize = 96; // flash size + flashAlpha = .6; // initial alpha of the flash + circleGrowth = 9; // size increase/frame + circleAlpha = .4; // initial alpha of the ring + ttl = 16; // number of frames + color = .2,.4,.9; // color RGB + }*/ +} + +[control_explode] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddrop; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.96; + particleLife=12; + particleLifeSpread=8; + numParticles=5; + particleSpeed=3; + particleSpeedSpread=6; + particleSize=24; + particleSizeSpread=16; + emitRot=0; + emitRotSpread=80; + directional=1; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=3; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblast; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.9; + particleLife=16; + particleLifeSpread=0; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=24; + particleSizeSpread=16; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } + + [MOREDOTS] + { + class=CSimpleParticleSystem; + + [properties] + { + Texture=randdots; + + colorMap = 0.5 0.05 0.05 0.05 0.3 0.05 0.05 0.01 0.1 0.00 0.00 0.01; + + pos = 0, 2, 0; + gravity = 0, -0.1, 0; + emitVector = 0, 1, 0; + emitRot = 45; + emitRotSpread = 32; + + sizeGrowth = 0.5; + sizeMod = 1; + + airdrag = 0.8; + particleLife = 5; + particleLifeSpread = 12; + numParticles = 16; + particleSpeed = 10; + particleSpeedSpread = 6; + particleSize = 15; + particleSizeSpread = 10; + + directional = 1; + useAirLos = 0; + } + air=1; + ground=1; + count=1; + } + + [ongoingblood] + { + class=CExpGenSpawner; + [properties] + { + pos=15 r-30, 0, 15 r-30; + delay=20 r300; + explosionGenerator=custom:LITTLE_BLOOD_SPLASH; + } + air=1; + water=1; + ground=1; + count=25; + } + +} + + +[LITTLE_BLOOD_SPLASH] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddrop; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.96; + particleLife=6; + particleLifeSpread=12; + numParticles=2; + particleSpeed=3; + particleSpeedSpread=6; + particleSize=6; + particleSizeSpread=12; + emitRot=0; + emitRotSpread=80; + directional=1; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=3; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblast; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=.9; + particleLife=8; + particleLifeSpread=0; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=8; + particleSizeSpread=16; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +} + + diff --git a/Gamedata/explosions/ChickenCEGs/blood_explode_blue.tdf b/Gamedata/explosions/ChickenCEGs/blood_explode_blue.tdf new file mode 100644 index 000000000..8af45508f --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/blood_explode_blue.tdf @@ -0,0 +1,65 @@ +[blood_explode_blue] +{ + [splashes] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=-.1; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=blooddropwhite; + colorMap=0 0.6 0.6 1 0 0.6 0.6 1 0 0 0 0; + airdrag=.96; + particleLife=12; + particleLifeSpread=8; + numParticles=5; + particleSpeed=1.5; + particleSpeedSpread=3; + particleSize=12; + particleSizeSpread=8; + emitRot=0; + emitRotSpread=80; + directional=1; + } + air=1; + ground=1; + } + + [pop] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=3; + sizemod=1; + pos=0, 1.0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + Texture=bloodblastwhite; + colorMap=0 0.6 0.6 1 0 0.6 0.6 1 0 0 0 0; + airdrag=.9; + particleLife=20; + particleLifeSpread=2; + numParticles=1; + particleSpeed=0; + particleSpeedSpread=0; + particleSize=22; + particleSizeSpread=8; + emitRot=45; + emitRotSpread=30; + directional=0; + } + air=1; + ground=1; + } +/* [groundflash] + { + flashSize = 96; // flash size + flashAlpha = .6; // initial alpha of the flash + circleGrowth = 9; // size increase/frame + circleAlpha = .4; // initial alpha of the ring + ttl = 16; // number of frames + color = .2,.4,.9; // color RGB + }*/ +} diff --git a/Gamedata/explosions/ChickenCEGs/blood_spray.tdf b/Gamedata/explosions/ChickenCEGs/blood_spray.tdf new file mode 100644 index 000000000..296890427 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/blood_spray.tdf @@ -0,0 +1,51 @@ +[blood_spray] +{ + +/* [splash] + { + class=CSimpleParticleSystem; + [properties] { + sizegrowth=4; + sizemod=1; + pos=0, 1.0, 0; + emitVector=dir; + gravity=0, 0, 0; + Texture=bloodsplat; + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + airdrag=1; + particleLife=12; + particleLifeSpread=2; + numParticles=2; + particleSpeed=10; + particleSpeedSpread=2; + particleSize=2; + particleSizeSpread=1; + emitRot=0; + emitRotSpread=40; + directional=1; + } + air=1; + water=1; + ground=0; + }*/ + [flare] + { + class = CBitmapMuzzleFlame; + + [properties] + { + colorMap=1 1 1 1 1 1 1 1 0 0 0 0; + size=1; + length=2; + sizeGrowth=16; + ttl=18; + frontOffset=0; + sideTexture=bloodsplat; + frontTexture=bloodsplat; + dir=-1 r2, -1 r2, -1 r2; + } + water=1; + air=1; + ground=0; + } +} diff --git a/Gamedata/explosions/ChickenCEGs/chickenh5.tdf b/Gamedata/explosions/ChickenCEGs/chickenh5.tdf new file mode 100644 index 000000000..db65ada66 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/chickenh5.tdf @@ -0,0 +1,40 @@ +[BRAIN_SPHERE_EMIT] +{ + [nanodecay] + { + class=CSimpleParticleSystem; + + [properties] + { + alwaysVisible=0; + Texture=nanoball; + + colorMap = 0.5 0 0 0.0001 0.5 0.0 0.0 0.0001 0.5 0.0 0.0 0.7 0.3 0.0 0.0 0.5 0.2 0.0 0.0 0.001; + + pos = 10 r-20, 0, 10 r-20; + gravity = 0, 0.1, 0; + emitVector = 0, 1, 0; + emitRot = 16; + emitRotSpread = 16; + + sizeGrowth = -0.01; + sizeMod = 1; + + airdrag = 0.8; + particleLife = 5; + particleLifeSpread = 18; + numParticles = 1; + particleSpeed = 1; + particleSpeedSpread = 3; + particleSize = 4; + particleSizeSpread = 8; + + directional = 1; + useAirLos = 0; + } + air=1; + unit=1; + ground=1; + count=3; + } +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/chickenspike-sparks-burn.lua b/Gamedata/explosions/ChickenCEGs/chickenspike-sparks-burn.lua new file mode 100644 index 000000000..28d47ab49 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/chickenspike-sparks-burn.lua @@ -0,0 +1,409 @@ +-- chickenspike-small-sparks-burn +-- chickenspike-medium-sparks-burn +-- chickenspike-large-sparks-burn + +return { + ["chickenspike-small-sparks-burn"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + underwater = 1, + 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, 0, 0]], + texture = [[flare-chickens]], + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.8 0.2 0.0 0.35 0.5 0.5 0.0 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 1, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 0.7, + texture = [[randomdots-chickens]], + }, + }, + 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 = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 1, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 0.7, + texture = [[wake-chickens]], + }, + }, + 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 = 0.5, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 0.5, + texture = [[gunshot-chickens]], + useairlos = false, + }, + }, + underwaterexplosionspikes = { + class = [[CSimpleParticleSystem]], + count = 1, + underwater = 1, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.2 0.5 0.9 0.01 0 0 0 0.0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 4, + particlelife = 4, + particlelifespread = 15, + particlesize = 1, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 2, + sizemod = 0.25, + texture = [[wake-chickens]], + useairlos = false, + }, + }, + }, + + ["chickenspike-medium-sparks-burn"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + underwater = 1, + 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, 0, 0]], + texture = [[flare-chickens]], + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.8 0.2 0.0 0.35 0.5 0.5 0.0 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 0.7, + texture = [[randomdots-chickens]], + }, + }, + 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 = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.5, + sizemod = 0.7, + texture = [[wake-chickens]], + }, + }, + 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 = 0.5, + particlesizespread = 0, + particlespeed = 5, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 0.5, + texture = [[gunshot-chickens]], + useairlos = false, + }, + }, + underwaterexplosionspikes = { + class = [[CSimpleParticleSystem]], + count = 2, + underwater = 1, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.2 0.5 0.9 0.01 0 0 0 0.0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 4, + particlelife = 4, + particlelifespread = 15, + particlesize = 1, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 2, + sizemod = 0.25, + texture = [[wake-chickens]], + useairlos = false, + }, + }, + }, + + ["chickenspike-large-sparks-burn"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + underwater = 1, + 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 = 10, + speed = [[0, 0, 0]], + texture = [[flare-chickens]], + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.8 0.2 0.0 0.35 0.5 0.5 0.0 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 4, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.7, + sizemod = 0.7, + texture = [[randomdots-chickens]], + }, + }, + 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 = 15, + particlelife = 2, + particlelifespread = 15, + particlesize = 2, + particlesizespread = 1, + particlespeed = 4, + particlespeedspread = 6, + pos = [[0, 1, 0]], + sizegrowth = 0.7, + sizemod = 0.7, + texture = [[wake-chickens]], + }, + }, + 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 = 0.5, + particlesizespread = 0, + particlespeed = 7, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 0.5, + texture = [[gunshot-chickens]], + useairlos = false, + }, + }, + underwaterexplosionspikes = { + class = [[CSimpleParticleSystem]], + count = 2, + underwater = 1, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.2 0.5 0.9 0.01 0 0 0 0.0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 4, + particlelife = 4, + particlelifespread = 15, + particlesize = 1, + particlesizespread = 0, + particlespeed = 3, + particlespeedspread = 2, + pos = [[0, 2, 0]], + sizegrowth = 2, + sizemod = 0.25, + texture = [[wake-chickens]], + useairlos = false, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/ChickenCEGs/chickentrails.tdf b/Gamedata/explosions/ChickenCEGs/chickentrails.tdf new file mode 100644 index 000000000..0cbdb0f69 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/chickentrails.tdf @@ -0,0 +1,140 @@ +[DODOTRAIL] +{ + usedefaultexplosions=1; + [rocks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0,0,0; + colorMap= 0 0 0 0.01 0.9 0.9 0 0.05 0.9 0.9 0 0.1 0.9 0.9 0 0.15 0.9 0.9 0 0.2 0.9 0.9 0 0.25 0.8 0.8 0.1 0.3 0.7 0.7 0.2 0.4 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0 0 0 0.01; + texture=fireball; + airdrag=0.95; + particleLife=5; + particleLifeSpread=15; + numParticles=1; + particleSpeed=5; + particleSpeedSpread=2; + particleSize=15; + particleSizeSpread=5; + directional=1; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } + [smokey] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + colorMap=0 0 0 0 0 0 0 0 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.6 0 0 0 0.01; + texture=graysmoke; + airdrag=0.95; + particleLife=35; + particleLifeSpread=45; + numParticles=1; + particleSpeed=6; + particleSpeedSpread=1; + particleSize=20; + particleSizeSpread=15; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } +} + + +[ANGRYLOBBERTRAIL] +{ + [unit_sparkles] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=1.25; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, -1, 0; + gravity=0,0,0; + colorMap=0 0 0 0 0.5 0.5 0.5 0.2 0.8 0.8 0.8 0.4 0.3 0.3 0.3 0.2 0.1 0.1 0.1 0.1 0 0 0 0.01; + texture=lightb2; + airdrag=0.95; + particleLife=6; + particleLifeSpread=3; + numParticles=1; + particleSpeed=2; + particleSpeedSpread=2; + particleSize=5; + particleSizeSpread=30; + directional=1; + emitRot=0; + emitRotSpread=270; + } + air=1; + water=1; + ground=1; + unit=1; + count=2; + } + +} + + +[CHICKENHERO] +{ + [fireworks] + { + class=CSimpleParticleSystem; + + [properties] + { + alwaysVisible=0; + Texture=nanoball; + + colorMap = 0.9 0 0 0.2 0.8 0.0 0.0 0.4 0.7 0.0 0.0 0.7 0.6 0.0 0.0 0.4 0.5 0.0 0.0 0.001; + + pos = 0, 0, 0; + gravity = 0, -0.3, 0; + emitVector = 0, 1, 0; + emitRot = 45; + emitRotSpread = 32; + + sizeGrowth = -0.02; + sizeMod = 1; + + airdrag = 0.95; + particleLife = 8; + particleLifeSpread = 14; + numParticles = 1; + particleSpeed = 1; + particleSpeedSpread = 5; + particleSize = 2; + particleSizeSpread = 5; + + directional = 1; + useAirLos = 0; + } + air=1; + unit=1; + ground=1; + count=1; + } + +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/chickenunitexplosion-red.lua b/Gamedata/explosions/ChickenCEGs/chickenunitexplosion-red.lua new file mode 100644 index 000000000..6faa284ec --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/chickenunitexplosion-red.lua @@ -0,0 +1,527 @@ +-- chickenunitexplosion-small-red +-- chickenunitexplosion-medium-red +-- chickenunitexplosion-large-red + +return { + ["chickenunitexplosion-small-red"] = { + 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-chickens]], + }, + }, + + -- 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 = [[1 0 0 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 = [[bloodblast]], + }, + }, + + groundflash = { + air = true, + alwaysvisible = true, + flashalpha = 0.5, + flashsize = 50, + ground = true, + ttl = 20, + water = true, + underwater = true, + color = { + [1] = 1, + [2] = 0, + [3] = 0, + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + 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 = [[bloodblast]], + }, + }, + }, + + ["chickenunitexplosion-medium-red"] = { + 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-chickens]], + }, + }, + + -- 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 = [[1 0 0 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 = [[bloodblast]], + }, + }, + + 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] = 1, + [2] = 0, + [3] = 0, + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + 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 = [[bloodblast]], + }, + }, + }, + + ["chickenunitexplosion-large-red"] = { + 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-chickens]], + }, + }, + + -- 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 = [[1 0 0 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 = [[bloodblast]], + }, + }, + + 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] = 1, + [2] = 0, + [3] = 0, + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + }, + }, + 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-chickens]], + 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 = [[bloodblast]], + }, + }, + }, + +} + diff --git a/Gamedata/explosions/ChickenCEGs/emg.tdf b/Gamedata/explosions/ChickenCEGs/emg.tdf new file mode 100644 index 000000000..f7f6434bb --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/emg.tdf @@ -0,0 +1,344 @@ +[brawlermuzzle] +{ + [BitmapMuzzleFlame] + { + class = CBitmapMuzzleFlame; + + [properties] + { + dir = dir; + colorMap=1 1 0 0.01 1 0.5 0 0.01 0 0 0 0.01; + size=12; + length=18; + sizeGrowth=1; + ttl=3; + frontOffset=0.1; + sideTexture=plasma2; + frontTexture=flowerflash; + } + water=1; + air=1; + underwater=1; + ground=1; + count=1; + } + [GROUNDFLASH] + { + flashsize=35; + flashalpha=0.9; + circlegrowth=0; + circlealpha=1; + ttl=3; + color=1,0.7,0; + } +} + +[BRAWLIMPACTS] +{ + usedefaultexplosions=0; + [GROUNDFLASH] + { + flashsize=12; + flashalpha=0.9; + circlegrowth=0; + circlealpha=1; + ttl=3; + color=1,0.7,0; + } + [sparks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0; + sizeMod=1.0; + pos=0, 1, 0; + emitVector=dir; + gravity=0, -0.4, 0; + colorMap=1 1 0 0.01 1 1 0 0.01 1 0.5 0 0.01 0 0 0 0.01; + Texture=plasma; + airdrag=0.97; + particleLife=14; + particleLifeSpread=0; + numParticles=4; + particleSpeed=5; + particleSpeedSpread=10; + particleSize=6; + particleSizeSpread=0; + emitRot=0; + emitRotSpread=90; + directional=1; + } + air=1; + water=1; + ground=1; + count=1; + + } +} + +[flashplosion] +{ + usedefaultexplosions=0; + [GROUNDFLASH] + { + flashsize=12; + flashalpha=0.9; + circlegrowth=0; + circlealpha=1; + ttl=3; + color=1,0.7,0; + } + [sparks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0; + sizeMod=1.0; + pos=0, 1, 0; + emitVector=dir; + gravity=0, -0.2, 0; + colorMap=1 1 0 0.01 1 1 0 0.01 1 0.5 0 0.01 0 0 0 0.01; + Texture=plasma; + airdrag=0.97; + particleLife=7; + particleLifeSpread=0; + numParticles=4; + particleSpeed=3; + particleSpeedSpread=4; + particleSize=6; + particleSizeSpread=0; + emitRot=0; + emitRotSpread=40; + directional=1; + } + air=1; + water=1; + ground=1; + count=1; + + } +} + + +[emg_shells_l] +{ + usedefaultexplosions=0; + [shells] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=dir; + gravity=0, -0.5, 0; + colorMap=1 1 1 1 1 1 1 1; + Texture=shell; + airdrag=0.97; + particleLife=15; + particleLifeSpread=0; + numParticles=1; + particleSpeed=3; + particleSpeedSpread=0; + particleSize=2.5; + particleSizeSpread=0; + emitRot=0; + emitRotSpread=10; + directional=1; + } + air=1; + water=1; + ground=1; + count=1; + + } +} + +[emg_shells_m] +{ + usedefaultexplosions=0; + [shells] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=dir; + gravity=0, -0.5, 0; + colorMap=1 1 1 1 1 1 1 1; + Texture=shell; + airdrag=0.97; + particleLife=45; + particleLifeSpread=0; + numParticles=1; + particleSpeed=3; + particleSpeedSpread=0; + particleSize=2.5; + particleSizeSpread=0; + emitRot=0; + emitRotSpread=10; + directional=1; + } + air=1; + water=1; + ground=1; + count=1; + + } +} + +[flashmuzzle1] +{ + [BitmapMuzzleFlame] + { + class = CBitmapMuzzleFlame; + + [properties] + { + dir = dir; + colorMap=1 1 1 0.07 1 0.7 0 0.01 0.9 0.3 0 0.01 0 0 0 0.01; + size=12; + length=18; + sizeGrowth=1; + ttl=3; + frontOffset=0; + sideTexture=plasma2; + frontTexture=flowerflash; + } + water=1; + air=1; + underwater=1; + ground=1; + count=1; + } + [GROUNDFLASH] + { + flashsize=35; + flashalpha=0.4; + circlegrowth=0; + circlealpha=1; + ttl=3; + color=1,0.7,0; + } +} + +[EMG_HIT_HE] +{ + usedefaultexplosions=0; + [main]{ + class=heatcloud; + [properties]{ + texture=explo; + heat = 6; + maxheat = 6; + heatFalloff = 1; + + size = 1; + sizeGrowth = 8; + + pos = 0, 1, 0; + speed=0, 1, 0; + } + air=1; + water=1; + ground=1; + count=1; + } + [sparks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0; + sizeMod=1.0; + pos=0, 1, 0; + emitVector=0, 1, 0; + gravity=0, -0.2, 0; + colorMap=1 0.95 0.5 0.01 1 0.95 0.5 0.01 1 0.95 0.5 0.01 0 0 0 0.01; + Texture=plasma; + airdrag=0.97; + particleLife=10; + particleLifeSpread=0; + numParticles=16; + particleSpeed=1; + particleSpeedSpread=6; + particleSize=2; + particleSizeSpread=1; + emitRot=0; + emitRotSpread=90; + directional=1; + } + air=1; + water=1; + ground=1; + count=1; + } + [groundsmoke] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=1; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0.2, 0; + colorMap=1 1 0 1 1 0.25 0 0.8 0 0 0 0.6 0 0 0 0.4 0 0 0 0.2 0 0 0 0; + Texture=smokesmall; + airdrag=0.8; + particleLife=10; + particleLifeSpread=5; + numParticles=1; + particleSpeed=2; + particleSpeedSpread=2; + particleSize=4; + particleSizeSpread=4; + emitRot=0; + emitRotSpread=90; + directional=1; + } + unit=1; + ground=1; + count=3; + } + [watermist]{ + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=1; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0.2, 0; + colorMap=0.75 0.75 1 1 0 0 0 0; + Texture=smokesmall; + airdrag=0.8; + particleLife=10; + particleLifeSpread=5; + numParticles=1; + particleSpeed=2; + particleSpeedSpread=2; + particleSize=4; + particleSizeSpread=4; + emitRot=0; + emitRotSpread=90; + directional=1; + } + water=1; + count=3; + } + [GROUNDFLASH] + { + flashsize=48; + flashalpha=0.25; + circlegrowth=0; + circlealpha=1; + ttl=3; + color=1,0.95,0.5; + } +} diff --git a/Gamedata/explosions/ChickenCEGs/gundam_comm_explosion.tdf b/Gamedata/explosions/ChickenCEGs/gundam_comm_explosion.tdf new file mode 100644 index 000000000..e1dc036f2 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/gundam_comm_explosion.tdf @@ -0,0 +1,122 @@ +[COMM_EXPLOSION] +{ + [pop1] + { + class=heatcloud; + + [properties] + { + alwaysVisible=1; + texture=fireball; + heat = 10; + maxheat = 10; + heatFalloff = 0.4; + + size = 1; + sizeGrowth = 37; + + pos = r-10 r10, 0, r-10 r10; + speed=0, 0, 0; + } + air=1; + water=1; + ground=1; + count=2; + } + + [pop2] + { + class=heatcloud; + + [properties] + { + alwaysVisible=1; + texture=purpleexplo; + heat = 10; + maxheat = 15; + heatFalloff = 0.6; + + size = 1; + sizeGrowth = 30; + + pos = r-150 r150, 0, r-300 r150; + speed=0, 0, 0; + } + air=1; + water=1; + ground=1; + count=5; + } + + [dirt2] + { + class=CSimpleParticleSystem; + [properties] + { + alwaysVisible=1; + sizeGrowth=3; + sizeMod=1.0; + + pos = r-1 r1, r-1 r1, r-1 r1; + emitVector=0, 1, 0; + gravity= 0, 0.2, 0; + + colorMap=1 1 1 0.01 0.5 0.3 0.0 0.05 0.5 0.5 0.5 1.0 0 0 0 0.01; + Texture=dirt; + + airdrag=0.9; + + particleLife=30; + particleLifeSpread=0; + + numParticles=50; + + particleSpeed=5; + particleSpeedSpread=57; + particleSize=60; + particleSizeSpread=10; + + emitRot=90; + emitRotSpread=10; + + directional=1; + useAirLos=1; + } + water=1; + air=1; + ground=1; + count=1; + } + + [dirt] + { + [properties] + { + alwaysVisible=1; + size=20; + color=0.2, 0.1, 0.05; + alphaFalloff=2; + speed= r1.5 r-1.5, 2, r1.5 r-1.5; + pos=r-10 r10, 0, r-10 r10; + } + ground=1; + count=4; + } + + [groundflash] + { + alwaysVisible=1; + ttl = 17; + flashSize = 120; + flashAlpha = 0.9; + + circleGrowth = 8; + circleAlpha = 0.5; + + color = 0.7, 0.0, 0.5; + + air=1; + ground=1; + water=1; + } +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/gundam_electric_explosion.tdf b/Gamedata/explosions/ChickenCEGs/gundam_electric_explosion.tdf new file mode 100644 index 000000000..878735cea --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/gundam_electric_explosion.tdf @@ -0,0 +1,174 @@ +[ELECTRIC_EXPLOSION] +{ + [ELECTRIC1] + { + class=heatcloud; + + [properties] + { + texture=electnovaexplo; + heat = 10; + maxheat = 15; + heatFalloff = 1.1; + + size = 1; + sizeGrowth = 15; + + pos = r-2 r2, 5, r-2 r2; + speed=0, 1 0, 0; + } + air=1; + water=1; + ground=1; + count=3; + } + + [ELECTRIC2] + { + class=heatcloud; + + [properties] + { + texture=flare; + heat = 10; + maxheat = 15; + heatFalloff = 1.3; + + size = 3; + sizeGrowth = 25; + + pos = r-2 r2, 5, r-2 r2; + speed=0, 0, 0; + } + air=1; + water=1; + ground=1; + count=1; + } + + [whiteglow] + { + class=heatcloud; + + [properties] + { + texture=laserend; + heat = 10; + maxheat = 15; + heatFalloff = 1.1; + + size = 10; + sizeGrowth = 20; + + pos = 0, 5, 0; + speed=0, 1 0, 0; + } + air=1; + water=1; + ground=1; + count=2; + } + + [ELECTRICARCS1] + { + class=CSimpleParticleSystem; + + [properties] + { + Texture=lightening; + + 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; + + pos = 0, 2, 0; + gravity = 0, -0.05, 0; + emitVector = 0, 1, 0; + emitRot = 45; + emitRotSpread = 32; + + sizeGrowth = 1; + sizeMod = 1.0; + + airdrag = 0.8; + particleLife = 10; + particleLifeSpread = 5; + numParticles = 14; + particleSpeed = 5; + particleSpeedSpread = 5; + particleSize = 10; + particleSizeSpread = 0; + + directional = 1; + useAirLos = 0; + } + air=1; + ground=1; + count=1; + } + + [MOREDOTS] + { + class=CSimpleParticleSystem; + + [properties] + { + Texture=randdots; + + colorMap = 1.0 1.0 1.0 0.05 0.2 0.5 0.9 0.01 0.1 0.1 0.8 0.00; + + pos = 0, 2, 0; + gravity = 0, -0.1, 0; + emitVector = 0, 1, 0; + emitRot = 45; + emitRotSpread = 32; + + sizeGrowth = 0.5; + sizeMod = 1; + + airdrag = 0.8; + particleLife = 5; + particleLifeSpread = 16; + numParticles = 16; + particleSpeed = 10; + particleSpeedSpread = 3; + particleSize = 25; + particleSizeSpread = 0; + + directional = 1; + useAirLos = 0; + } + air=1; + ground=1; + count=1; + } + + [dirt] + { + [properties] + { + size=20; + color=0.2, 0.1, 0.05; + alphaFalloff=2; + speed= r1.5 r-1.5, 2, r1.5 r-1.5; + pos=r-10 r10, 0, r-10 r10; + } + ground=1; + count=4; + } + + [groundflash] + { + alwaysVisible=1; + ttl = 13; + flashSize = 220; + flashAlpha = 0.9; + + circleGrowth = 6; + circleAlpha = 0.6; + + color = 0.0, 0.5, 1.0; + + air=1; + ground=1; + water=1; + } +} diff --git a/Gamedata/explosions/ChickenCEGs/gundam_missile_explosion.tdf b/Gamedata/explosions/ChickenCEGs/gundam_missile_explosion.tdf new file mode 100644 index 000000000..c75969044 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/gundam_missile_explosion.tdf @@ -0,0 +1,172 @@ +[gundam_MISSILE_EXPLOSION] +{ + [pop1] + { + class=heatcloud; + + [properties] + { + texture=uglynovaexplo; + heat = 10; + maxheat = 15; + heatFalloff = 1.1; + + size = 1; + sizeGrowth = 15; + + pos = r-2 r2, 5, r-2 r2; + speed=0, 1 0, 0; + } + air=1; + water=1; + ground=1; + count=2; + } + + [pop2] + { + class=heatcloud; + + [properties] + { + texture=flare; + heat = 10; + maxheat = 15; + heatFalloff = 1.3; + + size = 3; + sizeGrowth = 25; + + pos = r-2 r2, 5, r-2 r2; + speed=0, 1 0, 0; + } + air=1; + water=1; + ground=1; + count=1; + } + + [POOF01] + { + class=CSimpleParticleSystem; + + [properties] + { + Texture=flashside1; + + colorMap = 1.0 1.0 1.0 0.04 0.9 0.5 0.2 0.01 0.8 0.1 0.1 0.01; + + pos = 0, 2, 0; + gravity = 0, -0.05, 0; + emitVector = 0, 1, 0; + emitRot = 45; + emitRotSpread = 32; + + sizeGrowth = 1; + sizeMod = 1.0; + + airdrag = 0.8; + particleLife = 10; + particleLifeSpread = 5; + numParticles = 8; + particleSpeed = 10; + particleSpeedSpread = 15; + particleSize = 30; + particleSizeSpread = 10; + + directional = 1; + useAirLos = 0; + } + air=1; + ground=1; + count=1; + } + + [dirt] + { + [properties] + { + size=20; + color=0.2, 0.1, 0.05; + alphaFalloff=2; + speed= r1.5 r-1.5, 2, r1.5 r-1.5; + pos=r-10 r10, 0, r-10 r10; + } + ground=1; + count=4; + } + + [groundflash] + { + ttl = 13; + flashSize = 180; + flashAlpha = 0.9; + + circleGrowth = 6; + circleAlpha = 0.6; + + color = 1, 0.5, 0; + + air=1; + ground=1; + water=1; + } +} + +[gundam_MISSILE_EXPLOSION_mod] +{ + [pop2] + { + class=heatcloud; + + [properties] + { + texture=flare; + heat = 10; + maxheat = 15; + heatFalloff = 1.3; + + size = 3; + sizeGrowth = 25; + + pos = r-2 r2, 5, r-2 r2; + speed=0, 1 0, 0; + } + air=1; + water=1; + ground=1; + count=1; + } + + + [dirt] + { + [properties] + { + size=20; + color=0.2, 0.1, 0.05; + alphaFalloff=2; + speed= r1.5 r-1.5, 2, r1.5 r-1.5; + pos=r-10 r10, 0, r-10 r10; + } + ground=1; + count=4; + } + + [groundflash] + { + ttl = 13; + flashSize = 120; + flashAlpha = 0.9; + + circleGrowth = 6; + circleAlpha = 0.6; + + color = 1, 0.5, 0; + + air=1; + ground=1; + water=1; + } +} + diff --git a/Gamedata/explosions/ChickenCEGs/none.tdf b/Gamedata/explosions/ChickenCEGs/none.tdf new file mode 100644 index 000000000..f6a546175 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/none.tdf @@ -0,0 +1,3 @@ +[NONE] +{ +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/nukedatbewm-roost.lua b/Gamedata/explosions/ChickenCEGs/nukedatbewm-roost.lua new file mode 100644 index 000000000..04d2cfba9 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/nukedatbewm-roost.lua @@ -0,0 +1,128 @@ +-- nukedatbewm-roost + +return { + ["nukedatbewm-roost"] = { + alwaysvisible = true, + groundflash = { + air = true, + ground = true, + water = true, + underwater = true, + alwaysvisible = true, + circlealpha = 0.5, + circlegrowth = 2, + flashalpha = 0.5, + flashsize = 2000, + ground = true, + ttl = 300, + water = true, + color = { + [1] = 1, + [2] = 0.69999998807907, + [3] = 0.30000001192093, + }, + }, + poof02 = { + air = true, + ground = true, + water = true, + underwater = true, + class = [[CSimpleParticleSystem]], + count = 1, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.8 0.6 0 0.01 0.4 0.4 0.4 0.01 0.0 0.0 0.0 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 128, + particlelife = 150, + particlelifespread = 150, + particlesize = 50, + particlesizespread = 1, + particlespeed = 104, + particlespeedspread = 32, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1.0, + texture = [[bigexplosmoke-chickens]], + useairlos = false, + }, + }, + poof04 = { + air = true, + ground = true, + water = true, + underwater = true, + class = [[CSimpleParticleSystem]], + count = 1, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[0.8 0.6 0 0.01 0.4 0.4 0.4 0.01 0.0 0.0 0.0 0.01]], + directional = false, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.2, 0]], + numparticles = 20, + particlelife = 150, + particlelifespread = 150, + particlesize = 50, + particlesizespread = 1, + particlespeed = 20, + particlespeedspread = 32, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 1.0, + texture = [[bigexplosmoke-chickens]], + useairlos = false, + }, + }, + pop1 = { + air = true, + ground = true, + water = true, + underwater = true, + alwaysvisible = true, + class = [[heatcloud]], + count = 2, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 0.4, + maxheat = 10, + pos = [[r-10 r10, 0, r-10 r10]], + size = 1, + sizegrowth = 50, + speed = [[0, 0, 0]], + texture = [[bigexplosmoke-chickens]], + }, + }, + pop2 = { + air = true, + ground = true, + water = true, + underwater = true, + alwaysvisible = true, + class = [[heatcloud]], + count = 10, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 0.6, + maxheat = 15, + pos = [[r-150 r150, 0, r-300 r150]], + size = 1, + sizegrowth = 40, + speed = [[0, 0, 0]], + texture = [[bigexplosmoke-chickens]], + }, + }, + }, + +} + diff --git a/Gamedata/explosions/ChickenCEGs/nuketrail-roost.lua b/Gamedata/explosions/ChickenCEGs/nuketrail-roost.lua new file mode 100644 index 000000000..63cf07f9f --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/nuketrail-roost.lua @@ -0,0 +1,78 @@ +-- nuketrail-roost + +return { + ["nuketrail-roost"] = { + usedefaultexplosions = false, + exhale = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.87, + colormap = [[0.7 0.5 0.2 0.1 0.15 0.15 0.15 0.2 0.0 0.0 0.0 0.01]], + directional = false, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0, 0]], + numparticles = 4, + particlelife = 120, + particlelifespread = 15, + particlesize = 13, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 5, + pos = [[0, 1, 0]], + sizegrowth = 0.50, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + exhale2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.87, + colormap = [[0.6 0.35 0.2 0.1 0.1 0.1 0.1 0.2 0.0 0.0 0.0 0.01]], + directional = false, + emitrot = 80, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0, 0]], + numparticles = 4, + particlelife = 80, + particlelifespread = 15, + particlesize = 13, + particlesizespread = 1, + particlespeed = 2, + particlespeedspread = 10, + pos = [[0, 1, 0]], + sizegrowth = 0.50, + sizemod = 1.0, + texture = [[smoke-chickens]], + }, + }, + spikes = { + air = true, + class = [[explspike]], + count = 4, + ground = true, + water = true, + properties = { + alpha = 1, + alphadecay = 0.08, + color = [[1.0, 0.5, 0.2]], + dir = [[-10 r20,-10 r20,-10 r20]], + length = 1, + width = 22, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/ChickenCEGs/queenspike.tdf b/Gamedata/explosions/ChickenCEGs/queenspike.tdf new file mode 100644 index 000000000..c505f20b3 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/queenspike.tdf @@ -0,0 +1,61 @@ +[QUEENSPIKES] +{ + usedefaultexplosions=1; + [rocks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0,0,0; + colorMap=0 0 0 0.01 0.9 0.9 0 0.05 0.9 0.9 0 0.1 0.9 0.9 0 0.15 0.9 0.9 0 0.2 0.9 0.9 0 0.25 0.8 0.8 0.1 0.3 0.7 0.7 0.2 0.4 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0 0 0 0.01; + texture=fireball; + airdrag=0.95; + particleLife=1; + particleLifeSpread=5; + numParticles=1; + particleSpeed=5; + particleSpeedSpread=2; + particleSize=10; + particleSizeSpread=5; + directional=1; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } + [smokey] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + colorMap=0 0 0 0 0 0 0 0 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.6 0 0 0 0.01; + texture=graysmoke; + airdrag=0.95; + particleLife=5; + particleLifeSpread=15; + numParticles=1; + particleSpeed=6; + particleSpeedSpread=1; + particleSize=15; + particleSizeSpread=15; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/rocktrail.tdf b/Gamedata/explosions/ChickenCEGs/rocktrail.tdf new file mode 100644 index 000000000..f51c1fe1d --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/rocktrail.tdf @@ -0,0 +1,124 @@ +[ROCKTRAIL] +{ + usedefaultexplosions=1; + [rocks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0,0,0; + colorMap=0 0 0 0.01 0.9 0.9 0 0.05 0.9 0.9 0 0.1 0.9 0.9 0 0.15 0.9 0.9 0 0.2 0.9 0.9 0 0.25 0.8 0.8 0.1 0.3 0.7 0.7 0.2 0.4 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0 0 0 0.01; + texture=fireball; + airdrag=0.95; + particleLife=1; + particleLifeSpread=5; + numParticles=1; + particleSpeed=5; + particleSpeedSpread=2; + particleSize=10; + particleSizeSpread=5; + directional=1; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } + [smokey] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + colorMap=0 0 0 0 0 0 0 0 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.6 0 0 0 0.01; + texture=graysmoke; + airdrag=0.95; + particleLife=5; + particleLifeSpread=15; + numParticles=1; + particleSpeed=6; + particleSpeedSpread=1; + particleSize=15; + particleSizeSpread=15; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=3; + } +} + + +[ROCKTRAILsm] +{ + usedefaultexplosions=1; + [rocks] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0,0,0; + colorMap=0 0 0 0.01 0.9 0.9 0 0.05 0.9 0.9 0 0.1 0.9 0.9 0 0.15 0.9 0.9 0 0.2 0.9 0.9 0 0.25 0.8 0.8 0.1 0.3 0.7 0.7 0.2 0.4 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0.5 0.35 0. 0.5 0 0 0 0.01; + texture=fireball; + airdrag=0.95; + particleLife=1; + particleLifeSpread=3; + numParticles=1; + particleSpeed=5; + particleSpeedSpread=2; + particleSize=5; + particleSizeSpread=5; + directional=1; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=5; + } + [smokey] + { + class=CSimpleParticleSystem; + [properties] + { + sizeGrowth=0.05; + sizeMod=1.0; + pos=0, 0, 0; + emitVector=0, 1, 0; + gravity=0, 0, 0; + colorMap=0 0 0 0 0 0 0 0 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.7 0.3 0.3 0.3 0.6 0 0 0 0.01; + texture=graysmoke; + airdrag=0.95; + particleLife=3; + particleLifeSpread=10; + numParticles=1; + particleSpeed=6; + particleSpeedSpread=1; + particleSize=8; + particleSizeSpread=8; + emitRot=10; + emitRotSpread=10; + } + air=1; + water=1; + ground=1; + count=2; + } +} \ No newline at end of file diff --git a/Gamedata/explosions/ChickenCEGs/xta_nano.tdf b/Gamedata/explosions/ChickenCEGs/xta_nano.tdf new file mode 100644 index 000000000..e39a7ea57 --- /dev/null +++ b/Gamedata/explosions/ChickenCEGs/xta_nano.tdf @@ -0,0 +1,24 @@ +[NANO]//Gives better effect +{ + [heatcloud]// Fire burst + { + [properties] + { + heat = 25; + Texture=Light; + maxheat = 25; + heatFalloff = 1.5; + size = 8.0 r1; + sizeGrowth = 0.08 r.16; + sizemod = 0; + sizemodmod = 0; + speed = 0.05 r-0.1, 0.05 r-0.1, 0.05 r-0.1; + pos = 0, 0.0, 0; + } + air=1; + water=0; + ground=1; + count=1; + useAirLos=0; + } +} \ No newline at end of file diff --git a/Gamedata/explosions/Steam.lua b/Gamedata/explosions/Steam.lua index b269275fa..720b86f49 100644 --- a/Gamedata/explosions/Steam.lua +++ b/Gamedata/explosions/Steam.lua @@ -10,7 +10,7 @@ return { water = true, properties = { airdrag = 0.7, - alwaysvisible = true, + alwaysvisible = false, colormap = [[0.5 0.5 0.5 1.0 0.7 0.7 0.7 1.0 0.9 0.9 0.9 1.0 0.9 0.9 0.9 0.5 0.9 0.9 0.9 0.1 0 0 0 0]], directional = true, emitrot = 45, @@ -28,7 +28,6 @@ return { sizemod = 0.9, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, }, diff --git a/Gamedata/explosions/airraidershot.lua b/Gamedata/explosions/airraidershot.lua new file mode 100644 index 000000000..b78add711 --- /dev/null +++ b/Gamedata/explosions/airraidershot.lua @@ -0,0 +1,51 @@ +return { + ["airraidershot"] = { + poof01 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.9 0.3 0.9 0.01 0.9 0 0.9 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 2, + particlelife = 10, + particlelifespread = 0, + particlesize = 2, + particlesizespread = 0, + particlespeed = 1, + particlespeedspread = 0, + pos = [[0, 2, 0]], + sizegrowth = 3, + sizemod = 0.5, + texture = [[lightb4-bw]], + useairlos = false, + }, + }, + pop1 = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + properties = { + alwaysvisible = true, + heat = 8, + heatfalloff = 3, + maxheat = 10, + pos = [[r-2 r2, 5, r-2 r2]], + size = 0.5, + sizegrowth = 7, + speed = [[0, 0, 0]], + texture = [[LightningStrike]], + }, + }, + }, +} \ No newline at end of file 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 aa13a3c5b..b00fdb24f 100644 --- a/Gamedata/explosions/blacksmoke.lua +++ b/Gamedata/explosions/blacksmoke.lua @@ -8,6 +8,7 @@ return { count = 2, ground = true, water = true, + underwater = false, properties = { airdrag = 0.7, --alwaysvisible = true, @@ -28,7 +29,36 @@ return { sizemod = 0.9, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", + }, + }, + + bubblesuw = { + air = false, + class = [[CSimpleParticleSystem]], + count = 2, + ground = false, + water = false, + underwater = true, + properties = { + airdrag = 0.7, + --alwaysvisible = true, + colormap = [[1 1 1 0.5 0.5 0.5 1 0.8 0 0 0 0.0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.3, 0]], + numparticles = 4, + particlelife = 60, + particlelifespread = 20, + particlesize = 1, + particlesizespread = 2, + particlespeed = 1, + particlespeedspread = 4, + sizegrowth = 1, + sizemod = 0.9, + texture = [[randdots]], + useairlos = false, }, }, }, diff --git a/Gamedata/explosions/dirt.lua b/Gamedata/explosions/dirt.lua index b90962e98..64f96b44e 100644 --- a/Gamedata/explosions/dirt.lua +++ b/Gamedata/explosions/dirt.lua @@ -16,7 +16,39 @@ return { emitrotspread = 0, emitvector = [[0, 1, 0]], gravity = [[0, 0.3 r0.3, 0]], - numparticles = 4, + 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]], + 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 = 1, particlelife = 15, particlelifespread = 20, particlesize = [[12 r4]], @@ -28,7 +60,6 @@ return { sizemod = 1.0, texture = [[new_dirta]], useairlos = false, - colorchange = "stuffs", }, }, dirtw = { @@ -45,17 +76,17 @@ return { emitrotspread = 0, emitvector = [[0, 1, 0]], gravity = [[0, 0.3 r0.3, 0]], - numparticles = 10, + numparticles = 1, particlelife = 15, particlelifespread = 20, particlesize = [[7 r4]], - particlesizespread = 2, + particlesizespread = 10, particlespeed = 1, particlespeedspread = 6, pos = [[r-0.5 r0.5, 1 r2, r-0.5 r0.5]], - sizegrowth = -0.2, + sizegrowth = 0.5, sizemod = 1.0, - texture = [[new_dirta]], + texture = [[randdots]], useairlos = false, }, }, @@ -89,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/fightershot.lua b/Gamedata/explosions/fightershot.lua new file mode 100644 index 000000000..ff96d5daa --- /dev/null +++ b/Gamedata/explosions/fightershot.lua @@ -0,0 +1,51 @@ +return { + ["fightershot"] = { + poof01 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0.3 0.0 0.01 0.5 0 0.0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 2, + particlelife = 10, + particlelifespread = 0, + particlesize = 2, + particlesizespread = 0, + particlespeed = 1, + particlespeedspread = 0, + pos = [[0, 2, 0]], + sizegrowth = 3, + sizemod = 1, + texture = [[muzzleside]], + useairlos = false, + }, + }, + pop1 = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + properties = { + alwaysvisible = true, + heat = 8, + heatfalloff = 3, + maxheat = 10, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 7, + speed = [[0, 0, 0]], + texture = [[LightningStrike]], + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/flamethrowerrange1000.lua b/Gamedata/explosions/flamethrowerrange1000.lua new file mode 100644 index 000000000..65eec0558 --- /dev/null +++ b/Gamedata/explosions/flamethrowerrange1000.lua @@ -0,0 +1,36 @@ +-- flamethrowerrange1000 + +return { + ["flamethrowerrange1000"] = { + searingflame2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 1, + colormap = [[0.01 0.01 0.01 0.005 0.04 0.04 0.1 0.005 0.08 0.03 0.01 0.005 0 0 0 0.05 0 0 0 0.01]], + directional = true, + emitrot = 3, + emitrotspread = 5, + emitvector = [[dir]], + gravity = [[0, 0.05, 0]], + numparticles = 30, + particlelife = 120, + particlelifespread = 5, + particlesize = [[2 r3]], + particlesizespread = 0, + particlespeed = 8, + particlespeedspread = 3, + pos = [[0, 0, 0]], + sizegrowth = 0.5, + sizemod = 1, + texture = [[flame]], + useairlos = true, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/flamethrowerrange750.lua b/Gamedata/explosions/flamethrowerrange750.lua new file mode 100644 index 000000000..afd9dd63f --- /dev/null +++ b/Gamedata/explosions/flamethrowerrange750.lua @@ -0,0 +1,36 @@ +-- flamethrowerrange750 + +return { + ["flamethrowerrange750"] = { + searingflame2 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 1, + colormap = [[0.01 0.01 0.01 0.005 0.04 0.04 0.1 0.005 0.08 0.03 0.01 0.005 0 0 0 0.05 0 0 0 0.01]], + directional = true, + emitrot = 3, + emitrotspread = 5, + emitvector = [[dir]], + gravity = [[0, 0.05, 0]], + numparticles = 15, + particlelife = 90, + particlelifespread = 5, + particlesize = [[2 r3]], + particlesizespread = 0, + particlespeed = 8, + particlespeedspread = 3, + pos = [[0, 0, 0]], + sizegrowth = 0.5, + sizemod = 1, + texture = [[flame]], + useairlos = true, + }, + }, + }, + +} + diff --git a/Gamedata/explosions/fusionreaction.lua b/Gamedata/explosions/fusionreaction.lua index ac15399d9..eb26133d0 100644 --- a/Gamedata/explosions/fusionreaction.lua +++ b/Gamedata/explosions/fusionreaction.lua @@ -173,15 +173,15 @@ return { emitrotspread = 15, emitvector = [[0, 1, 0]], gravity = [[0, -0.05, 0]], - numparticles = 8, + numparticles = 2, particlelife = 45, particlelifespread = 1, particlesize = 1, particlesizespread = 0, - particlespeed = 2, + particlespeed = 1, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.3, + sizegrowth = 0.7, sizemod = 1.0, texture = [[plasmaball]], useairlos = false, @@ -222,6 +222,8 @@ return { class = [[CSimpleParticleSystem]], count = 1, ground = true, + water = true, + underwater = true, properties = { airdrag = 0.8, --alwaysvisible = true, @@ -230,49 +232,22 @@ return { emitrot = 45, emitrotspread = 15, emitvector = [[0, 1, 0]], - gravity = [[0, -0.05, 0]], - numparticles = 8, - particlelife = 45, - particlelifespread = 1, - particlesize = 1, - particlesizespread = 0, - particlespeed = 4, - particlespeedspread = 1, - pos = [[0, 2, 0]], - sizegrowth = 0.7, - 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.05, 0]], - numparticles = 8, + gravity = [[0, -0.02, 0]], + numparticles = 2, particlelife = 45, particlelifespread = 1, particlesize = 1, particlesizespread = 0, - particlespeed = 4, + particlespeed = 2, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.7, + sizegrowth = 1.2, sizemod = 1.0, texture = [[plasmaball]], useairlos = false, }, }, - }, + }, ["fusionreactiongeo"] = { electricarcs1 = { @@ -280,6 +255,8 @@ return { class = [[CSimpleParticleSystem]], count = 1, ground = true, + water = true, + underwater = true, properties = { airdrag = 0.8, --alwaysvisible = true, @@ -289,42 +266,15 @@ return { 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, - }, - }, - 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, + numparticles = 2, particlelife = 45, particlelifespread = 1, particlesize = 1, particlesizespread = 0, - particlespeed = 2, + particlespeed = 1, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.3, + sizegrowth = 0.7, sizemod = 1.0, texture = [[plasmaball]], useairlos = false, @@ -348,15 +298,15 @@ return { emitrotspread = 15, emitvector = [[0, 1, 0]], gravity = [[0, -0.05, 0]], - numparticles = 8, + numparticles = 2, particlelife = 45, particlelifespread = 1, particlesize = 1, particlesizespread = 0, - particlespeed = 3, + particlespeed = 2, particlespeedspread = 1, pos = [[0, 2, 0]], - sizegrowth = 0.5, + sizegrowth = 1.2, sizemod = 1.0, texture = [[plasmaball]], useairlos = false, @@ -421,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, @@ -445,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, @@ -464,7 +422,7 @@ return { emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], - numparticles = 4, + numparticles = 1, particlelife = 70, particlelifespread = 1, particlesize = 1, @@ -472,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, @@ -495,24 +455,30 @@ return { emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], - numparticles = 4, + 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.2, + 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, @@ -522,15 +488,15 @@ return { emitrotspread = 15, emitvector = [[dir]], gravity = [[0, 0, 0]], - numparticles = 4, + 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.2, + sizegrowth = 0.3, sizemod = 1, texture = [[plasmaball]], useairlos = false, @@ -595,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 fc806d176..837b40390 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue-emp.lua @@ -75,7 +75,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -272,7 +271,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -288,7 +287,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -486,7 +484,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -502,7 +500,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -700,7 +697,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -716,7 +713,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 36a399822..0b64209be 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-blue.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,7 +285,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,7 +509,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,7 +733,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 ff3285a73..b0021bae4 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-green.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,7 +285,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,7 +509,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,7 +733,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 611f1d41f..d9380448e 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-purple.lua @@ -61,16 +61,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,16 +285,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,16 +509,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,16 +733,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, @@ -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 d771a0119..ccd79ad5f 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-red.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,7 +285,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,7 +509,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,7 +733,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 5a6ad7f9e..5730f2c42 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion-white.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,7 +285,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,7 +509,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,7 +733,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 4fd1acd23..083be0290 100644 --- a/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua +++ b/Gamedata/explosions/generic-building-explosions/genericbuildingexplosion.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 0.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 200, @@ -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, }, @@ -270,7 +269,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -286,7 +285,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 200, @@ -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, }, @@ -495,7 +493,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -511,7 +509,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 200, @@ -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, }, @@ -720,7 +717,7 @@ return { numparticles = 1, particlelife = [[200]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -736,7 +733,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 200, @@ -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 new file mode 100644 index 000000000..e4c5ae0d2 --- /dev/null +++ b/Gamedata/explosions/generic-projectile-cegs/generic-projectile-cegs.lua @@ -0,0 +1,69 @@ +return { + ["thudshot"] = { + poof01 = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.8, + alwaysvisible = true, + colormap = [[1.0 1.0 1.0 0.04 0.5 0.3 0.0 0.01 0.5 0 0.0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, -0.01, 0]], + numparticles = 8, + particlelife = 10, + particlelifespread = 0, + particlesize = 2, + particlesizespread = 0, + particlespeed = 10, + particlespeedspread = 0, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 0.6, + texture = [[muzzleside]], + useairlos = false, + }, + }, + pop1 = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + properties = { + alwaysvisible = true, + heat = 8, + heatfalloff = 3, + maxheat = 5, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 10, + speed = [[0, 0, 0]], + texture = [[starexplo]], + }, + }, + pop2 = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + water = true, + properties = { + alwaysvisible = true, + heat = 10, + heatfalloff = 1.3, + maxheat = 15, + pos = [[r-2 r2, 5, r-2 r2]], + size = 1, + sizegrowth = 3, + speed = [[0, 1 0, 0]], + texture = [[flare]], + }, + }, + }, +} \ No newline at end of file diff --git a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-blue-emp.lua b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-blue-emp.lua index 7d2aa5920..0cd9902f3 100644 --- a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-blue-emp.lua +++ b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-blue-emp.lua @@ -96,7 +96,6 @@ return { airdrag = 0.87, alwaysvisible = true, colormap = [[0 0.5 1 0.05 0 0 0 0.0]], -- same as groundflash colors - delay = [[10 r200]], directional = false, emitrot = 90, emitrotspread = 5, @@ -144,7 +143,6 @@ return { airdrag = 0.87, alwaysvisible = true, colormap = [[0.75 0.75 1 0.05 0 0 0 0.0]], - delay = [[10 r200]], directional = false, emitrot = 90, emitrotspread = 5, diff --git a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-purple.lua b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-purple.lua index c0fc13c0f..2fabd91c1 100644 --- a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-purple.lua +++ b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-purple.lua @@ -67,9 +67,9 @@ return { water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { @@ -241,9 +241,9 @@ return { water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { @@ -415,9 +415,9 @@ return { water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { diff --git a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-sparks-burn.lua b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-sparks-burn.lua index 1afd4adbc..29362710e 100644 --- a/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-sparks-burn.lua +++ b/Gamedata/explosions/generic-shell-explosions/genericshellexplosion-sparks-burn.lua @@ -1,6 +1,7 @@ -- genericshellexplosion-small-sparks-burn -- genericshellexplosion-medium-sparks-burn -- genericshellexplosion-large-sparks-burn +-- genericshellexplosion-huge-sparks-burn return { ["genericshellexplosion-small-sparks-burn"] = { @@ -404,6 +405,141 @@ return { }, }, }, + + + ["genericshellexplosion-huge-sparks-burn"] = { + centerflare = { + air = true, + class = [[heatcloud]], + count = 1, + ground = true, + underwater = 1, + 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 = 20, + speed = [[0, 0, 0]], + texture = [[flare]], + }, + }, + kickedupdirt = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + properties = { + airdrag = 0.87, + alwaysvisible = true, + colormap = [[0.8 0.2 0.0 0.35 0.5 0.5 0.0 0.35 0 0 0 0.0]], + directional = false, + emitrot = 90, + emitrotspread = 5, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.1, 0]], + numparticles = 15, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 4, + particlespeedspread = 12, + pos = [[0, 1, 0]], + sizegrowth = 0.7, + sizemod = 0.7, + texture = [[randomdots]], + }, + }, + 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 = 15, + particlelife = 2, + particlelifespread = 30, + particlesize = 2, + particlesizespread = 1, + particlespeed = 4, + particlespeedspread = 12, + pos = [[0, 1, 0]], + sizegrowth = 0.7, + sizemod = 0.7, + 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 = 16, + particlelifespread = 0, + particlesize = 0.5, + particlesizespread = 0, + particlespeed = 14, + particlespeedspread = 4, + pos = [[0, 2, 0]], + sizegrowth = 1, + sizemod = 0.5, + texture = [[gunshot]], + useairlos = false, + }, + }, + underwaterexplosionspikes = { + class = [[CSimpleParticleSystem]], + count = 2, + underwater = 1, + properties = { + airdrag = 0.9, + alwaysvisible = true, + colormap = [[0.7 0.8 0.9 0.03 0.2 0.5 0.9 0.01 0 0 0 0.0]], + directional = true, + emitrot = 45, + emitrotspread = 32, + emitvector = [[0, 1, 0]], + gravity = [[0, 0.5, 0]], + numparticles = 4, + particlelife = 8, + particlelifespread = 30, + particlesize = 1, + particlesizespread = 0, + particlespeed = 6, + particlespeedspread = 4, + pos = [[0, 2, 0]], + sizegrowth = 2, + sizemod = 0.25, + texture = [[wake]], + useairlos = false, + }, + }, + }, } diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-blue.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-blue.lua index c5b7ca6b6..339a537a9 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-blue.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-blue.lua @@ -45,7 +45,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,7 +265,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, @@ -453,7 +453,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -469,7 +469,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 100, @@ -673,7 +673,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-green.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-green.lua index 196a42813..f3dd59d99 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-green.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-green.lua @@ -45,7 +45,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,7 +265,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, @@ -453,7 +453,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -469,7 +469,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 100, @@ -673,7 +673,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-purple.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-purple.lua index 0c90ffdb3..c759ba6be 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-purple.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-purple.lua @@ -61,16 +61,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,16 +265,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { @@ -453,7 +453,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -469,16 +469,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 1, flashsize = 600, ground = true, ttl = 100, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { @@ -657,7 +657,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -673,16 +673,16 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, water = true, underwater = true, color = { - [1] = 0.10999999940395, + [1] = 0.50999999940395, [2] = 0, - [3] = 0.28999999165535, + [3] = 0.68999999165535, }, }, kickedupdirt = { diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-red.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-red.lua index cd1db842d..022e842b0 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-red.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-red.lua @@ -45,7 +45,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,7 +265,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 100, @@ -469,7 +469,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, @@ -657,7 +657,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -673,7 +673,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-white.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-white.lua index 77e91cd35..7a453114a 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-white.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion-white.lua @@ -45,7 +45,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,7 +265,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, @@ -469,7 +469,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, @@ -657,7 +657,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -673,7 +673,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 100, diff --git a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion.lua b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion.lua index dd9cd00ac..37a2f5310 100644 --- a/Gamedata/explosions/generic-unit-explosions/genericunitexplosion.lua +++ b/Gamedata/explosions/generic-unit-explosions/genericunitexplosion.lua @@ -61,7 +61,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 1.5, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 200, ground = true, ttl = 100, @@ -249,7 +249,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 24, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -265,7 +265,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 3, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 600, ground = true, ttl = 100, @@ -453,7 +453,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 16, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -469,7 +469,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 2, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 400, ground = true, ttl = 100, @@ -657,7 +657,7 @@ return { numparticles = 1, particlelife = [[100]], -- same as groundflash ttl particlelifespread = 0, - particlesize = 32, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 + particlesize = 8, -- groundflash flashsize 25 = 1, so if flashsize is 200, particlesize here would be 8 particlesizespread = 1, particlespeed = [[8]], particlespeedspread = 6, @@ -673,7 +673,7 @@ return { alwaysvisible = true, circlealpha = 0.6, circlegrowth = 4, - flashalpha = 0.9, + flashalpha = 0.6, flashsize = 800, ground = true, ttl = 100, diff --git a/Gamedata/explosions/heal.lua b/Gamedata/explosions/heal.lua index 5ee138069..6dd34027c 100644 --- a/Gamedata/explosions/heal.lua +++ b/Gamedata/explosions/heal.lua @@ -34,6 +34,7 @@ return { class = [[CSimpleParticleSystem]], count = 1, water = true, + underwater = true, properties = { airdrag = 0.7, alwaysvisible = false, 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/missiletrail.lua b/Gamedata/explosions/missiletrail.lua index e9691e2da..e24ea4350 100644 --- a/Gamedata/explosions/missiletrail.lua +++ b/Gamedata/explosions/missiletrail.lua @@ -216,6 +216,68 @@ return { }, }, }, + + ["missiletrailsabot"] = { + + smokeandfire = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.70, + alwaysvisible = true, + colormap = [[0.1 0.1 0.1 0.01 0.5 0.1 0.0 0.05 0.5 0.3 0.0 0.05 0.1 0.1 0.1 0.005 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 90, + emitvector = [[0, 1, 0]], + gravity = [[0.0, 0.0, 0.0]], + numparticles = 5, + particlelife = 3, + particlelifespread = 2, + particlesize = 3, + particlesizespread = 5, + particlespeed = 4, + particlespeedspread = 0, + pos = [[0.0, 1, 0.0]], + sizegrowth = -0.1, + sizemod = 0.9, + texture = [[dirt]], + useairlos = true, + }, + }, + smoke = { + air = true, + class = [[CSimpleParticleSystem]], + count = 1, + ground = true, + water = true, + properties = { + airdrag = 0.70, + alwaysvisible = true, + colormap = [[0.1 0.1 0.1 0.01 0.25 0.25 0.25 0.05 0.2 0.2 0.2 0.05 0.1 0.1 0.1 0.005 0 0 0 0.01]], + directional = true, + emitrot = 45, + emitrotspread = 90, + emitvector = [[0, 1, 0]], + gravity = [[0.0, 0.5, 0.0]], + numparticles = 2, + particlelife = 8, + particlelifespread = 2, + particlesize = 2, + particlesizespread = 5, + particlespeed = 2, + particlespeedspread = 0, + pos = [[0.0, 1, 0.0]], + sizegrowth = 1, + sizemod = 1, + texture = [[dirt]], + useairlos = true, + }, + }, + }, ["missiletrailgunshiplesssmokey"] = { coreflame = { @@ -233,8 +295,8 @@ return { emitvector = [[dir]], gravity = [[0, 0, 0]], numparticles = 4, - particlelife = 20, - particlelifespread = 15, + particlelife = 5, + particlelifespread = 7, particlesize = 13, particlesizespread = 1, particlespeed = 5, @@ -253,19 +315,19 @@ return { water = true, properties = { airdrag = 0.87, - colormap = [[0.25 0.25 0.25 0.5 0.5 0.5 0.5 0.5 0.25 0.25 0.25 0.5 0.0 0.0 0.0 0.01]], + colormap = [[0.25 0.25 0.25 0.1 0.5 0.5 0.5 0.1 0.25 0.25 0.25 0.1 0.0 0.0 0.0 0.01]], directional = false, emitrot = 80, - emitrotspread = 2, + emitrotspread = 1, emitvector = [[0, 1, 0]], gravity = [[0, 0, 0]], numparticles = 4, - particlelife = 40, - particlelifespread = 15, + particlelife = 5, + particlelifespread = 7, particlesize = 13, particlesizespread = 1, - particlespeed = 2, - particlespeedspread = 1, + particlespeed = 1.25, + particlespeedspread = 0, pos = [[0, 1, 0]], sizegrowth = 3, sizemod = 0.8, @@ -273,10 +335,10 @@ return { }, }, coreflame2 = { - air = true, + air = false, class = [[CSimpleParticleSystem]], count = 1, - ground = true, + ground = false, underwater = true, water = true, properties = { @@ -301,10 +363,10 @@ return { }, }, exhale2 = { - air = true, + air = false, class = [[CSimpleParticleSystem]], count = 1, - ground = true, + ground = false, underwater = true, water = true, properties = { @@ -397,17 +459,17 @@ return { properties = { airdrag = 0.70, alwaysvisible = true, - colormap = [[0.1 0.1 0.1 0.01 0.5 0.3 0.0 0.05 0.5 0.1 0.1 1.0 0.1 0.1 0.1 1.0 0.5 0.5 0.5 1.0 0 0 0 0.01]], + colormap = [[0.1 0.1 0.1 0.01 0.5 0.3 0.0 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 = 10, - particlelife = 50, + particlelife = 5, particlelifespread = 4, - particlesize = 2, - particlesizespread = 40, + particlesize = 1, + particlesizespread = 20, particlespeed = 10, particlespeedspread = 2, pos = [[0.0, 1, 0.0]], diff --git a/Gamedata/explosions/railgun.lua b/Gamedata/explosions/railgun.lua index 4947993ab..87e26e98d 100644 --- a/Gamedata/explosions/railgun.lua +++ b/Gamedata/explosions/railgun.lua @@ -15,10 +15,10 @@ return { emitvector = [[0, 0, 0]], gravity = [[0, 0, 0]], numparticles = 1, - particlelife = 60, - particlelifespread = 20, - particlesize = [[2]], - particlesizespread = 10, + particlelife = 10, + particlelifespread = 5, + particlesize = [[1]], + particlesizespread = 5, particlespeed = 1, particlespeedspread = 6, pos = [[0, 0, 0]], @@ -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 0d0af654f..d2617896d 100644 --- a/Gamedata/featuredefs_post.lua +++ b/Gamedata/featuredefs_post.lua @@ -19,37 +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 - if fd.name ~= "ammobox" then - 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 0665aad5b..c84db57cc 100644 --- a/Gamedata/icontypes.lua +++ b/Gamedata/icontypes.lua @@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- --- file: icontypes.lua +-- file: icontypes.lua -- brief: icontypes definitions -- -------------------------------------------------------------------------------- @@ -11,217 +11,557 @@ local icontypes = { default = { bitmap='icons/default.png', - size=1, - radiusadjust=3, - }, - - raider = { - bitmap='icons/raider.png', - size=1, - radiusadjust=3, - }, - - tankdestroyer = { - bitmap='icons/tankdestroyer.png', - size=1, - radiusadjust=3, - }, + size=1, + radiusadjust=3, + }, + + -- modifications by dmdr start here - assault = { - bitmap='icons/assault.png', - size=1, - radiusadjust=3, - }, + + engineer = { + bitmap='icons/dmdr_engi.png', + size=3, + radiusadjust=0, + }, - aa = { - bitmap='icons/aa.png', - size=1, - radiusadjust=3, - }, + orb = { + 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, + }, - support = { - bitmap='icons/support.png', - size=1, - radiusadjust=3, - }, + 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, + }, + + 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, + }, - etransport = { - bitmap='icons/support.png', - size=2, - radiusadjust=3, - }, + nukeshield = { + bitmap='icons/dmdr_shield_nuke.png', + size=3.5, + radiusadjust=0, + }, + + -- and end here + + eco = { + bitmap='icons/eco.png', + size=1, + radiusadjust=3, + }, + + air = { + bitmap='icons/air.png', + size=1, + radiusadjust=3, + }, + factory = { + bitmap='icons/factory.png', + size=1, + radiusadjust=3, + }, + + barricade = { + bitmap='icons/barricade.png', + size=1, + radiusadjust=3, + }, + + support = { + 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, + }, - engineer = { - bitmap='icons/engineer.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, + }, + chickencommander = { + bitmap='icons/commander.png', + size=3, + }, + + --[[ 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, + }, + + assault = { + bitmap='icons/assault.png', + size=1, + radiusadjust=3, + }, + + aa = { + bitmap='icons/aa.png', + size=1, + 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, - }, - eco = { - bitmap='icons/eco.png', - size=1, - radiusadjust=3, - }, - storage = { - bitmap='icons/storage.png', - size=1, - radiusadjust=3, - }, - energy = { - bitmap='icons/ecoenergy.png', - size=2, - radiusadjust=3, - }, - air = { - bitmap='icons/air.png', - size=1, - radiusadjust=3, - }, - factory = { - bitmap='icons/factory.png', - size=1, - radiusadjust=3, - }, - radar = { - bitmap='icons/radar.png', - size=1, - radiusadjust=3, - }, - radarjam = { - bitmap='icons/radarjam.png', - size=1, - radiusadjust=3, - }, - barricade = { - bitmap='icons/barricade.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/lOCKlUAui.TXT b/Gamedata/lOCKlUAui.TXT index 5ddc588c1..e69de29bb 100644 --- a/Gamedata/lOCKlUAui.TXT +++ b/Gamedata/lOCKlUAui.TXT @@ -1,3 +0,0 @@ -You can override CA's widget handler by creating camain.lua in your LuaUI -directory and changing "cawidgets.lua" to "widgets.lua", or by copying your -widget handler to cawidgets.lua. \ No newline at end of file diff --git a/Gamedata/modrules.lua b/Gamedata/modrules.lua index df04e01af..9f1da3641 100644 --- a/Gamedata/modrules.lua +++ b/Gamedata/modrules.lua @@ -15,29 +15,29 @@ 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 = { constructionDecay = true, -- defaults to true - constructionDecayTime = 3, -- defaults to 6.66 - constructionDecaySpeed = 0.01, -- defaults to 0.03 + constructionDecayTime = 10, -- defaults to 6.66 + constructionDecaySpeed = 1, -- defaults to 0.03 }, 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.lua b/Gamedata/movedefs.lua index e99b72b82..9adc855cd 100644 --- a/Gamedata/movedefs.lua +++ b/Gamedata/movedefs.lua @@ -27,7 +27,7 @@ for _,mdef in pairs (moveDefine) do for tagName,tagVal in pairs (tagList) do tagName = string.lower(tagName) if( mdef[tagName] == nil and tagVal ~= 0 ) then - Spring.Echo("Warning! moveDef: " .. mdef["name"] .. ", assigning default value for missing tag " .. tagName .. "(" .. tagVal .. ")") + --Spring.Echo("Warning! moveDef: " .. mdef["name"] .. ", assigning default value for missing tag " .. tagName .. "(" .. tagVal .. ")") mdef[tagName] = tagVal end end diff --git a/Gamedata/movedefs_classes.lua b/Gamedata/movedefs_classes.lua index de14dd0d7..6d483ccab 100644 --- a/Gamedata/movedefs_classes.lua +++ b/Gamedata/movedefs_classes.lua @@ -1,444 +1,671 @@ +if Spring.GetModOptions and Spring.GetModOptions().unitheat ~= nil then + 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, - maxslope=28, - maxwaterdepth=5000, - 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, - }, - minwaterdepth=10, - heatmod=0.5, - slopemod=4, - heatmapping=false, - }, +--Hover-- HOVERTANK2 = { footprintx=2, footprintz=2, - maxslope=26, - maxwaterdepth=10, + maxslope=30, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - NORMALTANK2 = { - footprintx=2, - footprintz=2, - maxslope=26, - maxwaterdepth=10, - maxwaterslope=26, - badwaterslope=26, + HOVERTANK3 = { + footprintx=3, + footprintz=3, + maxslope=30, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK2 = { - footprintx=2, - footprintz=2, - maxslope=28, - maxwaterdepth=5000, + HOVERTANK4 = { + footprintx=4, + footprintz=4, + maxslope=30, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - HOVERTANK3 = { - footprintx=3, - footprintz=3, - maxslope=26, - maxwaterdepth=10, + + HOVERTANK5 = { + footprintx=5, + footprintz=5, + maxslope=30, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERHBOT3 = { - footprintx=3, - footprintz=3, - maxslope=90, - maxwaterdepth=10, + HOVERTANK6 = { + footprintx=6, + footprintz=6, + maxslope=30, + 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=0.5, - slopemod=2, - heatmapping=false, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - TANK3 = { - footprintx=3, - footprintz=3, - maxslope=28, + + ORBHOVERTANK6 = { + footprintx=6, + footprintz=6, + maxslope=47, 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 = genericDepthmodParams, minwaterdepth=10, - heatmod=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - ALLTERRTANK3 = { + +--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, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.5, - quadraticCoeff = 0.1, - linearCoeff = 0.1, -- deprecates "depthMod" - constantCoeff = 1, - }, + maxslope=47, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, minwaterdepth=10, - heatmod=0.5, - slopemod=4, - heatmapping=false, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - HOVERTANK4 = { + + HOVERHBOT4 = { footprintx=4, footprintz=4, - maxslope=26, - maxwaterdepth=10, + maxslope=47, + 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=0.5, - slopemod=4, - heatmapping=false, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - - TANK4 = { - footprintx=4, - footprintz=4, - maxslope=28, - maxwaterdepth=5000, + + HOVERHBOT5 = { + footprintx=5, + footprintz=5, + maxslope=47, + 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=0.5, - slopemod=4, - heatmapping=false, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ALLTERRTANK4 = { - footprintx=4, - footprintz=4, - maxslope=90, - maxwaterdepth=10, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + + HOVERHBOT6 = { + footprintx=6, + footprintz=6, + maxslope=47, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + + HOVERHBOT8 = { + footprintx=8, + footprintz=8, + maxslope=47, + maxwaterdepth=25, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, minwaterdepth=10, - heatmod=0.5, + heatmod=unitHeat, + slopemod=3, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + +--End hBot-- + + +--All Terrain-- + + ALLTERRTANK2 = { + footprintx=2, + footprintz=2, + maxslope=47, + maxwaterdepth=30, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - 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, - }, + + ALLTERRTANK3 = { + footprintx=3, + footprintz=3, + maxslope=47, + maxwaterdepth=30, + crushstrength=20, + depthModParams = genericDepthmodParams, minwaterdepth=10, - heatmod=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK5 = { - footprintx=5, - footprintz=5, - maxslope=26, - maxwaterdepth=10, - maxwaterslope=255, - badwaterslope=255, + ALLTERRTANK4 = { + footprintx=4, + footprintz=4, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - + ALLTERRTANK5 = { footprintx=5, footprintz=5, - maxslope=90, - maxwaterdepth=10, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + maxslope=47, + maxwaterdepth=30, + crushstrength=20, + depthModParams = genericDepthmodParams, minwaterdepth=10, - heatmod=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - TANK6 = { + + ALLTERRTANK6 = { footprintx=6, footprintz=6, - maxslope=28, + maxslope=47, + maxwaterdepth=30, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + +--End All Terrain-- + + +--Amphibious-- + TANK1 = { + footprintx=1, + footprintz=1, + maxslope=30, maxwaterdepth=5000, maxwaterslope=255, badwaterslope=255, + crushstrength=0, + depthModParams = amphibDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=2, + depthMod=0, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - HOVERTANK6 = { - footprintx=6, - footprintz=6, - maxslope=26, - maxwaterdepth=10, + + 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=0.5, - slopemod=4, - heatmapping=false, + heatmod=unitHeat, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - ALLTERRTANK6 = { - footprintx=6, - footprintz=6, - maxslope=90, - maxwaterdepth=10, - crushstrength=20, - depthModParams = { - minHeight = 0, - maxHeight = 5000, - maxScale = 1.1, - quadraticCoeff = 0.3, - linearCoeff = 0.3, -- deprecates "depthMod" - constantCoeff = 0.3, - }, + + TANK3 = { + footprintx=3, + footprintz=3, + maxslope=30, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = amphibDepthmodParams, minwaterdepth=10, - heatmod=0.5, - slopemod=4, - heatmapping=false, + heatmod=unitHeat, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, - COMMANDERTANK4 = { + + TANK4 = { footprintx=4, footprintz=4, - maxslope=90, + maxslope=30, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, crushstrength=20, + depthModParams = amphibDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + + TANK6 = { + footprintx=6, + footprintz=6, + 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=0.5, + heatmod=unitHeat, + slopemod=2, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + + +--End Amphibious-- + + +--UBoat-- + + UBOAT4 = { + footprintx = 4, + footprintz = 4, + maxslope=60, + minwaterdepth = 30, + crushstrength = 20, + subMarine = 1, + depthModParams = amphibDepthmodParams, + minwaterdepth=10, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, + +--End UBoat-- + + +--Endbringers-- + EXPERIMENTALTANK10 = { footprintx=12, footprintz=12, - maxslope=28, + maxslope=30, maxwaterdepth=5000, 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, HOVERTANKEXPERIMENTAL9 = { footprintx=9, footprintz=9, - maxslope=26, - maxwaterdepth=20, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + 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=0.5, + heatmod=unitHeat, slopemod=4, - heatmapping=false, + allowRawMovement=true, + flowMapping=flowMappingToggle, }, + +--End Commanders-- + + +--ZAAL-- + + ZAALQUEEN3 = { + 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, + }, + ZAALKBOT1 = { + footprintx=1, + footprintz=1, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + ZAALKBOT2 = { + 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, + }, + 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, + }, + ZAALKBOT4 = { + footprintx=4, + footprintz=4, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + ZAALKBOT5 = { + footprintx=5, + maxslope=40, + maxwaterdepth=5000, + maxwaterslope=255, + badwaterslope=255, + crushstrength=20, + depthModParams = genericDepthmodParams, + minwaterdepth=0, + heatmod=unitHeat, + slopemod=4, + allowRawMovement=true, + flowMapping=flowMappingToggle, + }, + ZAALKBOT6 = { + footprintx=6, + footprintz=6, + 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, + }, + + 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, + }, + } -------------------------------------------------------------------------------- @@ -446,14 +673,21 @@ local moveDefs = { -- convert from map format to the expected array format -local moveDefsArray = {} +local array = {} local i = 1 for k,v in pairs(moveDefs) do - moveDefsArray[i] = v + v.heatmapping = false -- disable heatmapping + v.allowRawMovement = true + array[i] = v v.name = k i = i + 1 end -return moveDefsArray +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +return array + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Gamedata/movedefs_post.lua b/Gamedata/movedefs_post.lua index 2f603dd7d..82eb2c0c1 100644 --- a/Gamedata/movedefs_post.lua +++ b/Gamedata/movedefs_post.lua @@ -27,13 +27,13 @@ myMovDef = nil if ( MoveDefs[myMovDef][tagName] ~= nil ) then if ( ud[tagName] ~= nil and ud[tagName] ~= MoveDefs[myMovDef][tagName] ) then --Spring.Echo(tagName,ud[tagName],MoveDefs[myMovDef][tagName]) - Spring.Echo("Warning! Unit: " .. ud.name .." Unit tag: " .. tagName .. " (".. ud[tagName] .. ") conflicts movedata (" .. MoveDefs[myMovDef][tagName] .. ")") + --Spring.Echo("Warning! Unit: " .. ud.name .." Unit tag: " .. tagName .. " (".. ud[tagName] .. ") conflicts movedata (" .. MoveDefs[myMovDef][tagName] .. ")") ud[tagName] = MoveDefs[myMovDef][tagName] end end end else - Spring.Echo("Unit: " .. ud.name .. ", Missing move class def: \"" .. ud.movementclass .. "\"") + --Spring.Echo("Unit: " .. ud.name .. ", Missing move class def: \"" .. ud.movementclass .. "\"") end end diff --git a/Gamedata/particles.tdf b/Gamedata/particles.tdf deleted file mode 100644 index 993d22402..000000000 --- a/Gamedata/particles.tdf +++ /dev/null @@ -1,7 +0,0 @@ -[nanospray] -{ -allow_team_colours=1; -shownanoframe=1; -shownanospray=0; -nanocolor=0; -} diff --git a/Gamedata/post_save_to_customparams.lua b/Gamedata/post_save_to_customparams.lua new file mode 100644 index 000000000..2f1445303 --- /dev/null +++ b/Gamedata/post_save_to_customparams.lua @@ -0,0 +1,43 @@ +function table.val_to_str ( v ) + if "string" == type( v ) then + v = string.gsub( v, "\n", "\\n" ) + if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then + return "'" .. v .. "'" + end + return '"' .. string.gsub(v,'"', '\\"' ) .. '"' + else + return "table" == type( v ) and table.tostring( v ) or + tostring( v ) + end +end + +function table.key_to_str ( k ) + if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then + if k == "else" then k = "default" end -- handles deprecated ["else"] damage class + return string.lower(k) -- make all key values lower case + else + return "[" .. table.val_to_str( k ) .. "]" + end +end + +function table.tostring( tbl ) + local result, done = {}, {} + for k, v in ipairs( tbl ) do + table.insert( result, table.val_to_str( v ) ) + done[ k ] = true + end + for k, v in pairs( tbl ) do + if not done[ k ] then + table.insert( result, + table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) + end + end + return "{" .. table.concat( result, "," ) .. "}" +end + +function SaveDefToCustomParams(defType, name, def) + local def_string = table.tostring(def) + def.customparams = def.customparams or {} + def.customparams.__def = table.tostring(def) + Spring.Echo("saved " .. defType .. "." .. name .. " to customparams.__def as string") +end \ No newline at end of file diff --git a/Gamedata/resources.lua b/Gamedata/resources.lua index 4b9267a58..17a5fc46f 100644 --- a/Gamedata/resources.lua +++ b/Gamedata/resources.lua @@ -33,6 +33,17 @@ local resources = { muzzleside = 'default/muzzleside.tga', muzzlefront = 'default/muzzlefront.tga', largebeam = 'default/largelaserfalloff.tga', + -- Put these in "ProjectileTextures" + --Chicken Defense effects + uglynovaexplo='CC/uglynovaexplo.tga', + orangesmoke3='GPL/smoke_orange.png', + sporetrail='GPL/sporetrail.tga', + blooddrop='PD/blooddrop.tga', + bloodblast='PD/bloodblast.tga', + bloodsplat='PD/bloodsplat.tga', + blooddropwhite='PD/blooddropwhite.tga', + bloodblastwhite='PD/bloodblastwhite.tga', + null='PD/null.tga', }, } } 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 052791f5b..9a3f5ba0f 100644 --- a/Gamedata/sounds.lua +++ b/Gamedata/sounds.lua @@ -3,24 +3,167 @@ local Sounds = { SoundItems = { + build = { + --- 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.wav", + --gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + 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 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/weapons/tmediumtankfire.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 4, + }, + + riottankshotgun = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/weapons/bruisercannon.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 8, + }, + + ehbotpeeweeshotgun = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/weapons/shotgun-reload.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 16, + }, + + pdfire = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/weapons/pointdefensefire.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 8, + }, + + artyweaponhit = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/explosions/artyhit.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 1, + }, + + nukeartyweaponhit = { + --- new since 89.0 + --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + file = "sounds/explosions/nukeartyhit.wav", + gainmod = 0.35, + pitchmod = 0.05, + --pitch = 0.7, + in3d = true, + maxconcurrent = 1, + }, + + ack = { + --- always play on the front speaker(s) + file = "sounds/ui/ack.wav", + in3d = true, + maxconcurrent = 1, + 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) - file = "sounds/beep4.wav", + file = "sounds/ui/beep4.wav", in3d = "false", maxconcurrent = 1, }, +--------------------------------------------------- +--Unit Selections---------------------------------- +--------------------------------------------------- + + UnitSelect = { + --- always play on the front speaker(s) + file = "sounds/miscfx/unitselect.wav", + in3d = true, + 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/button9.wav", - in3d = "false", + file = "sounds/ui/button9.wav", + in3d = true, maxconcurrent = 1, + gain = 0.25, }, MapPoint = { --- respect where the point was set, but don't attuenuate in distace --- also, when moving the camera, don't pitch it - file = "sounds/beep6.wav", + file = "sounds/ui/beep6.wav", rolloff = 0, dopplerscale = 0, maxconcurrent = 1, @@ -28,111 +171,178 @@ local Sounds = { factory = { --- always play on the front speaker(s) - file = "sounds/gdfactoryselect.wav", + file = "sounds/miscfx/gdfactoryselect.wav", in3d = "false", maxconcurrent = 1, }, energy = { --- always play on the front speaker(s) - file = "sounds/gdenergy.wav", + file = "sounds/miscfx/gdenergy.wav", in3d = "false", maxconcurrent = 1, }, mex = { --- always play on the front speaker(s) - file = "sounds/gdmex.wav", + file = "sounds/miscfx/gdmex.wav", in3d = "false", maxconcurrent = 1, }, radar = { --- always play on the front speaker(s) - file = "sounds/unitselect.wav", + file = "sounds/miscfx/unitselect.wav", in3d = "false", maxconcurrent = 1, }, mobileunit = { --- always play on the front speaker(s) - file = "sounds/unitselect.wav", + file = "sounds/miscfx/unitselect.wav", in3d = "false", maxconcurrent = 1, }, turret = { --- always play on the front speaker(s) - file = "sounds/turretselect.wav", + file = "sounds/miscfx/turretselect.wav", in3d = "false", maxconcurrent = 1, }, - ExampleSound = { + healing = { + --- always play on the front speaker(s) + file = "sounds/miscfx/heal.wav", + in3d = "true", + maxconcurrent = 1, + }, + + --ExampleSound = { --- some things you can do with this file --- can be either ogg or wav - file = "somedir/subdir/soundfile.ogg", + -- file = "somedir/subdir/soundfile.ogg", --- loudness, > 1 is louder, < 1 is more quiet, you will most likely not set it to 0 - gain = 1, + -- gain = 1, --- > 1 -> high pitched, < 1 lowered - pitch = 1, + -- pitch = 1, --- If > 0.0 then this adds a random amount to gain each time the sound is played. --- Clamped between 0.0 and 1.0. The result is in the range [(gain * (1 + gainMod)), (gain * (1 - gainMod))]. - gainmod = 0.0, + -- gainmod = 0.0, --- If > 0.0 then this adds a random amount to pitch each time the sound is played. --- Clamped between 0.0 and 1.0. The result is in the range [(pitch * (1 + pitchMod)), (pitch * (1 - pitchMod))]. - pitchmod = 0.0, + -- pitchmod = 0.0, --- how unit / camera speed affects the sound, to exagerate it, use values > 1 --- dopplerscale = 0 completely disables the effect - dopplerscale = 1, + -- dopplerscale = 1, --- when lots of sounds are played, sounds with lwoer priority are more likely to get cut off --- priority > 0 will never be cut of (priorities can be negative) - priority = 0, + -- priority = 0, --- this sound will not be played more than 16 times at a time - maxconcurrent = 16, + -- maxconcurrent = 16, --- cutoff distance - maxdist = 20000, + -- maxdist = 20000, --- how fast it becomes more quiet in the distance (0 means aleays the same loudness regardless of dist) - rolloff = 1, + -- rolloff = 1, --- non-3d sounds do always came out of the front-speakers (or the center one) --- 3d sounds are, well, in 3d - in3d = true, + -- in3d = true, --- you can loop it for X miliseconds - looptime = 0, - }, + -- looptime = 0, + --}, - default = { - --- new since 89.0 - --- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) - --gainmod = 0.35, - --pitchmod = 0.3, - --pitch = 0.7, - --in3d = true, - }, + --default = { + -- new since 89.0 + -- you can overwrite the fallback profile here (used when no corresponding SoundItem is defined for a sound) + -- gainmod = 0.35, + -- pitchmod = 0.05, + -- pitch = 0.7, + -- in3d = true, + --}, }, } -local files = VFS.DirList("sounds/unitdeath/") +-- 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/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/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 for i=1,#files do local fileName = files[i] t[fileName] = { file = fileName; - pitchmod = 0.3; - gainmod = 0.2; - maxconcurrent = 8; + pitchmod = 0; + gainmod = 0; + maxconcurrent = 1; } end 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 f120266de..ffca6f5f4 100644 --- a/Gamedata/unitdefs_post.lua +++ b/Gamedata/unitdefs_post.lua @@ -1,202 +1,82 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local modOptions -if (Spring.GetModOptions) then - modOptions = Spring.GetModOptions() -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Utility --- - -local 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 +-- Evolution RTS does not use unitdefs_post, see alldefs_post.lua +-- basically, DONT TOUCH this! + + +-- see alldefs.lua for documentation +-- load the games _Post functions for defs, and find out if saving to custom params is wanted +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 - -local function disableunits(unitlist) - for name, ud in pairs(UnitDefs) do - if (ud.buildoptions) then - for _, toremovename in ipairs(unitlist) do - for index, unitname in pairs(ud.buildoptions) do - if (unitname == toremovename) then - table.remove(ud.buildoptions, index) - 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 end - end + return t1 end --------------------------------------------------------------------------------- --- Gameplay Speed (Classic RTS Mode) -- --------------------------------------------------------------------------------- -if modOptions and tobool(modOptions.gameplayspeed == "normal") then - for id,unitDef in pairs(UnitDefs) do --- Spring.Echo(unitDef.buildcostmetal) - unitDef.buildtime = unitDef.buildcostmetal - end - for name, unitDef in pairs(UnitDefs) do - if unitDef.unitname == "ecommander" then --- Spring.Echo(unitDef.unitname) - unitDef.workertime = unitDef.workertime * 2 - end - end -end +-- create scavenger units +VFS.Include("gamedata/scavengers/unitdef_changes.lua") +local scavengerUnitDefs = {} -if modOptions and tobool(modOptions.gameplayspeed == "fast") then - for id,unitDef in pairs(UnitDefs) do --- Spring.Echo(unitDef.buildcostmetal) - unitDef.buildtime = unitDef.buildcostmetal / 2 - end - for name, unitDef in pairs(UnitDefs) do - if unitDef.unitname == "ecommander" then --- Spring.Echo(unitDef.unitname) - unitDef.workertime = unitDef.workertime * 2 +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 - -if modOptions and tobool(modOptions.gameplayspeed == "faster") then - for id,unitDef in pairs(UnitDefs) do --- Spring.Echo(unitDef.buildcostmetal) - unitDef.buildtime = unitDef.buildcostmetal / 4 - end +for name,ud in pairs(scavengerUnitDefs) do + UnitDefs[name] = ud end -if modOptions then - if modOptions.gameplayspeed == nil then - Spring.Echo("Gameplay Speed is set to fastest") - else - Spring.Echo("Gameplay Speed is set to " .. modOptions.gameplayspeed) +-- handle unitdefs and the weapons they contain +for name,ud in pairs(UnitDefs) do + UnitDef_Post(name,ud) + if ud.weapondefs then + for wname,wd in pairs(ud.weapondefs) do + WeaponDef_Post(wname,wd) end -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- 3dbuildrange for all none plane builders --- ---[[ -for name, ud in pairs(UnitDefs) do - if (tobool(ud.isBuilder) and not tobool(ud.canfly)) then - ud.buildrange3d = true - end -end ---]] - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- turn off unit collision check for planes --- - -for name, ud in pairs(UnitDefs) do - if (tobool(ud.canfly) and not tobool(ud.istransport)) then - ud.collide = false + end + + --ud.acceleration = 0.75 + --ud.turnrate = 800 + + if SaveDefsToCustomParams then + SaveDefToCustomParams("UnitDefs", name, ud) end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Calculate mincloakdistance based on unit footprint size --- - -local sqrt = math.sqrt - -for name, ud in pairs(UnitDefs) do - if (not ud.mincloakdistance) then - local fx = ud.footprintx and tonumber(ud.footprintx) or 1 - local fz = ud.footprintz and tonumber(ud.footprintz) or 1 - local radius = 8 * sqrt((fx * fx) + (fz * fz)) - ud.mincloakdistance = (radius + 48) - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Spring Kludge Removal --- -for name, ud in pairs(UnitDefs) do - ud.activateWhenBuilt = true -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- Festive units mod option (CarRepairer's WIP) --- ---[[ -if modOptions and tobool(modOptions.xmasunits) then - for name, ud in pairs(UnitDefs) do - local unitname = ud.unitname - if unitname == "armcom" or unitname == "armcomlite" then - --ud.object = - elseif unitname == "armdrag" or unitname == "cordrag" then - ud.objectname = "christmastree_dt.S3O" - ud.featuredefs.dead.object = "christmastree_dt.S3O" - - elseif unitname == "armthund" or unitname == "corshad" then - ud.weapondefs.armbomb.model = "present_bomb1.s3o" - elseif unitname == "armpnix" then - ud.weapondefs.armadvbomb.model = "present_bomb2.s3o" - elseif unitname == "armcybr" then - ud.weapondefs.arm_pidr.model = "present_bomb3.s3o" - elseif unitname == "corhurc" then - ud.weapondefs.coradvbomb.model = "present_bomb2.s3o" - elseif unitname == "corclog" then - ud.objectname = "core_christmas_clogger.s3o" - ud.featuredefs.dead.object = "christmastree_dt.S3O" - end - - end --for -end ---]] - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- fix customParams table --- ---[[ -for name, ud in pairs(UnitDefs) do - if (ud.customparams and not ud.customParams) then - ud.customParams = ud.customparams - ud.customparams = nil - end -end ---]] - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---Recursive Table Reader - - -- local function recursiveTableReader(currTable, dashes) - -- dashes = dashes .. " " - -- if type(currTable) == 'table' then - -- for k,v in pairs(currTable) do - -- if (v ~= nil) then - -- Spring.Echo(dashes .. "[" .. k .. "]") - -- recursiveTableReader(v, dashes) - -- end - -- end - -- else - -- if (currTable ~= nil) then - -- Spring.Echo(dashes .. tostring(currTable) ) - -- end - -- end - -- end - -- recursiveTableReader(UnitDefs, "DEF ") \ No newline at end of file +end \ No newline at end of file diff --git a/Gamedata/unitdefs_pre.lua b/Gamedata/unitdefs_pre.lua new file mode 100644 index 000000000..523989096 --- /dev/null +++ b/Gamedata/unitdefs_pre.lua @@ -0,0 +1,483 @@ +Shared.buildList = { + [[ehbotfac]], + [[eminifac]], + [[ebasefactory]], + [[eamphibfac]], + [[eairplant]], + [[etech1]], + [[emetalextractor]], + [[esolar2]], + [[egeothermal]], + [[efusion2]], + [[estorage]], + [[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]], + [[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]], + [[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 = { + [[ehbotpeewee_turret]], + [[ehbotthud_turret]], + [[ehbotsniper_turret]], + [[ehbotrocko_turret]], +} + +Shared.buildListTurret = {} +for i = 1, #Shared.buildList do + Shared.buildListTurret[i] = Shared.buildList[i] +end +for i = 1, #turrets do + Shared.buildListTurret[#Shared.buildListTurret + 1] = turrets[i] +end + +local factory = { + [[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.buildListFactory = {} +for i = 1, #Shared.buildList do + Shared.buildListFactory[i] = Shared.buildList[i] +end +for i = 1, #factory do + Shared.buildListFactory[#Shared.buildListFactory + 1] = factory[i] +end + +-- 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]], + [[ehbotpeewee]], + [[eallterrriot_shotgun]], + [[ehbotthud]], + [[eallterrassault]], + [[eallterrshield]], + [[eallterrmed]], + [[ehbotsniper]], + [[eallterrheavy]], + [[ehbotrocko]], + [[fedengineer]], + [[eorb]], + +} + +Shared.buildListf2landfac = { + [[eamphibbuggy]], + [[elighttank3]], + [[eriottank2_shotgun]], + [[eamphibneedle]], + [[eartytank]], + [[ebox]], + [[eamphibmedtank]], + [[eheavytank3]], + [[eamphibrock]], + [[emissiletank]], + [[lozengineer]], + [[eorb]], +} + +Shared.buildListHoverFactory = { + [[elighttank3]], + [[eriottank2_shotgun]], + [[eheavytank3]], + [[emissiletank]], + [[eartytank]], + [[elacerator]], +} + +Shared.buildListHoverFactory_up1 = { + [[elighttank3_up1]], + [[eriottank2_up1]], + [[eheavytank3_up1]], + [[emissiletank_up1]], + [[eartytank_up1]], + [[elacerator_up1]], +} + +Shared.buildListHoverFactory_up2 = { + [[elighttank3_up2]], + [[eriottank2_up2]], + [[eheavytank3_up2]], + [[emissiletank_up2]], + [[eartytank_up2]], + [[elacerator_up2]], +} + +Shared.buildListHoverFactory_up3 = { + [[elighttank3_up3]], + [[eriottank2_up3]], + [[eheavytank3_up3]], + [[emissiletank_up3]], + [[eartytank_up3]], + [[elacerator_up3]], +} + +-- +-- + +Shared.buildListAmphibFactory = { + [[eamphibbuggy]], + [[eamphibriot_shotgun]], + [[eamphibneedle]], + [[eamphibmedtank]], + [[eamphibrock]], + [[eamphibarty]], + [[eamphibleveler]], +} + +Shared.buildListAmphibFactory_up1 = { + [[eamphibbuggy_up1]], + [[eamphibriot_up1]], + [[eamphibneedle_up1]], + [[eamphibmedtank_up1]], + [[eamphibrock_up1]], + [[eamphibarty_up1]], + [[eamphibleveler_up1]], +} + +Shared.buildListAmphibFactory_up2 = { + [[eamphibbuggy_up2]], + [[eamphibriot_up2]], + [[eamphibneedle_up2]], + [[eamphibmedtank_up2]], + [[eamphibrock_up2]], + [[eamphibarty_up2]], + [[eamphibleveler_up2]], +} + +Shared.buildListAmphibFactory_up3 = { + [[eamphibbuggy_up3]], + [[eamphibriot_up3]], + [[eamphibneedle_up3]], + [[eamphibmedtank_up3]], + [[eamphibrock_up3]], + [[eamphibarty_up3]], + [[eamphibleveler_up3]], +} + +-- +-- + +Shared.buildListAllTerrainFactory = { + [[eallterrlight]], + [[eallterrriot_shotgun]], + [[eallterrmed]], + [[eallterrheavy]], + [[eallterrassault]], + [[eallterrshield]], + [[eallterranarchid]], +} + +Shared.buildListAllTerrainFactory_up1 = { + [[eallterrlight_up1]], + [[eallterrriot_up1]], + [[eallterrmed_up1]], + [[eallterrheavy_up1]], + [[eallterrassault_up1]], + [[eallterrshield_up1]], + [[eallterranarchid_up1]], +} + +Shared.buildListAllTerrainFactory_up2 = { + [[eallterrlight_up2]], + [[eallterrriot_up2]], + [[eallterrmed_up2]], + [[eallterrheavy_up2]], + [[eallterrassault_up2]], + [[eallterrshield_up2]], + [[eallterranarchid_up2]], +} + +Shared.buildListAllTerrainFactory_up3 = { + [[eallterrlight_up3]], + [[eallterrriot_up3]], + [[eallterrmed_up3]], + [[eallterrheavy_up3]], + [[eallterrassault_up3]], + [[eallterrshield_up3]], + [[eallterranarchid_up3]], +} +-- +-- +Shared.buildListAirPlant = { + -- [[edrone]], + [[efighter]], + [[egunship2]], + [[ebomber]], + [[eairemp]], + [[etransport]], + [[ekrow]], +} +Shared.buildListAirPlant_up1 = { + -- [[edrone_up1]], + [[efighter_up1]], + [[egunship2_up1]], + [[ebomber_up1]], + [[eairemp_up1]], + [[etransport_up1]], + [[ekrow_up1]], +} +Shared.buildListAirPlant_up2 = { + -- [[edrone_up2]], + [[efighter_up2]], + [[egunship2_up2]], + [[ebomber_up2]], + [[eairemp_up2]], + [[etransport_up2]], + [[ekrow_up2]], +} +Shared.buildListAirPlant_up3 = { + -- [[edrone_up3]], + [[efighter_up3]], + [[egunship2_up3]], + [[ebomber_up3]], + [[eairemp_up3]], + [[etransport_up3]], + [[ekrow_up3]], +} +-- +-- +Shared.buildListHbotFactory = { + [[ehbotpeewee]], + [[ehbotthud]], + [[ehbotsniper]], + [[ehbotrocko]], + [[ehbotkarganneth]], +} +Shared.buildListHbotFactory_up1 = { + [[ehbotpeewee_up1]], + [[ehbotthud_up1]], + [[ehbotsniper_up1]], + [[ehbotrocko_up1]], + [[ehbotkarganneth_up1]], +} +Shared.buildListHbotFactory_up2 = { + [[ehbotpeewee_up2]], + [[ehbotthud_up2]], + [[ehbotsniper_up2]], + [[ehbotrocko_up2]], + [[ehbotkarganneth_up2]], +} +Shared.buildListHbotFactory_up3 = { + [[ehbotpeewee_up3]], + [[ehbotthud_up3]], + [[ehbotsniper_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/Gamedata/weapondefs_post.lua b/Gamedata/weapondefs_post.lua index 64288c8c8..aff60f3fd 100644 --- a/Gamedata/weapondefs_post.lua +++ b/Gamedata/weapondefs_post.lua @@ -1,129 +1,41 @@ - --------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- --- file: weapondefs_post.lua --- brief: weaponDef post processing --- author: Dave Rodgers --- --- Copyright (C) 2008. --- Licensed under the terms of the GNU GPL, v2 or later. --- +-- Default Engine Weapon Definitions Post-processing -------------------------------------------------------------------------------- +-- BA stores weapondefs in the unitdef files +-- Here we load those defs into the WeaponDefs table +-- Then we call alldefs_post.lua, in which post processing of defs should take place +-- basically, DONT TOUCH this! -------------------------------------------------------------------------------- --- --- Per-unitDef weaponDefs --- + +-- see alldefs.lua for documentation +-- load the games _Post functions for defs, and find out if saving to custom params is wanted +VFS.Include("gamedata/alldefs_post.lua") +-- load functionality for saving to custom params +VFS.Include("gamedata/post_save_to_customparams.lua") + local function isbool(x) return (type(x) == 'boolean') end 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 damageClasses = VFS.Include("gamedata/configs/damageTypes.lua") -local damageTypes = damageClasses.damageTypes -local defaultClass = damageClasses.default - local 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 - --------------------------------------------------------------------------------- - -local function BackwardCompability(wdName,wd) - -- weapon reloadTime and stockpileTime were seperated in 77b1 - if (tobool(wd.stockpile) and (wd.stockpiletime==nil)) then - wd.stockpiletime = wd.reloadtime - wd.reloadtime = 2 -- 2 seconds - end - - -- auto detect ota weapontypes - if (wd.weapontype==nil) then - local rendertype = tonumber(wd.rendertype) or 0 - if (tobool(wd.dropped)) then - wd.weapontype = "AircraftBomb"; - elseif (tobool(wd.vlaunch)) then - wd.weapontype = "StarburstLauncher"; - elseif (tobool(wd.beamlaser)) then - wd.weapontype = "BeamLaser"; - elseif (tobool(wd.isshield)) then - wd.weapontype = "Shield"; - elseif (tobool(wd.waterweapon)) then - wd.weapontype = "TorpedoLauncher"; - elseif (wdName:lower():find("disintegrator",1,true)) then - wd.weaponType = "DGun" - elseif (tobool(wd.lineofsight)) then - if (rendertype==7) then - wd.weapontype = "LightningCannon"; - - -- swta fix (outdated?) - elseif (wd.model and wd.model:lower():find("laser",1,true)) then - wd.weapontype = "LaserCannon"; - - elseif (tobool(wd.beamweapon)) then - wd.weapontype = "LaserCannon"; - elseif (tobool(wd.smoketrail)) then - wd.weapontype = "MissileLauncher"; - elseif (rendertype==4 and tonumber(wd.color)==2) then - wd.weapontype = "EmgCannon"; - elseif (rendertype==5) then - wd.weapontype = "Flame"; - --elseif(rendertype==1) then - -- wd.weapontype = "MissileLauncher"; - else - wd.weapontype = "Cannon"; - end - else - wd.weapontype = "Cannon"; - end - end - - weapondamage = tonumber(wd.damage.default) - if (weapondamage > 0) then - if (wd.customparams) then - local damagetypelower - if wd.customparams.damagetype ~=nil then - damagetypelower = string.lower(wd.customparams.damagetype) - end - if damagetypelower == '' or damagetypelower == nil then - damagetypelower = defaultClass - end - --Spring.Echo(damagetypelower) - --Spring.Echo(" ") - if damageTypes[damagetypelower] then - for armorClass, armorMultiplier in pairs(damageTypes[damagetypelower]) do - --Spring.Echo(wd.name, armorClass, weapondamage*armorMultiplier ) - wd.damage[armorClass] = weapondamage*armorMultiplier - end - else - Spring.Echo("!!WARNING!! Invalid damagetype: " .. damagetypelower) - end - end + 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 - --Spring.Echo("_________") - --Spring.Echo(wdName, wd.name) - --for damageClass, damageValue in pairs(wd.damage)do - -- Spring.Echo(damageClass, damageValue) - --end - -- - if (tobool(wd.ballistic) or tobool(wd.dropped)) then - wd.gravityaffected = true - end + return false end -------------------------------------------------------------------------------- -local function ProcessUnitDef(udName, ud) +local function ExtractWeaponDefs(udName, ud) local wds = ud.weapondefs if (not istable(wds)) then @@ -135,7 +47,12 @@ local function ProcessUnitDef(udName, ud) if (isstring(wdName) and istable(wd)) then local fullName = udName .. '_' .. wdName WeaponDefs[fullName] = wd - wd.filename = ud.filename + + WeaponDef_Post(fullName, wd) + + if SaveDefsToCustomParams then + MarkDefOmittedInCustomParams("WeaponDefs", fullName, wd) + end end end @@ -163,46 +80,35 @@ local function ProcessUnitDef(udName, ud) local fullName = udName .. '_' .. ud.explodeas if (WeaponDefs[fullName]) then ud.explodeas = fullName - else - --You're full of shit, fuck off! This echo should be boiled alive, shot, stabbed, the boiled alive again just to make sure! Spring.Echo("Explosion def (weapon) does not exist for", udName) end end if (isstring(ud.selfdestructas)) then local fullName = udName .. '_' .. ud.selfdestructas if (WeaponDefs[fullName]) then ud.selfdestructas = fullName - else - --You're full of shit, fuck off! This echo should be boiled alive, shot, stabbed, the boiled alive again just to make sure! Spring.Echo("Self-Destruct def (weapon) does not exist for", udName) end - end + end end -------------------------------------------------------------------------------- -local function ProcessWeaponDef(wdName, wd) - -- backward compability - BackwardCompability(wdName,wd) -end --------------------------------------------------------------------------------- - --- Process the unitDefs +-- handle standalone weapondefs +for name,wd in pairs(WeaponDefs) do + WeaponDef_Post(name,wd) + + if SaveDefsToCustomParams then + SaveDefToCustomParams("WeaponDefs", name, wd) + end +end + +-- extract weapondefs from the unitdefs local UnitDefs = DEFS.unitDefs - -for udName, ud in pairs(UnitDefs) do +for udName,ud in pairs(UnitDefs) do if (isstring(udName) and istable(ud)) then - ProcessUnitDef(udName, ud) - end -end - - -for wdName, wd in pairs(WeaponDefs) do - if (isstring(wdName) and istable(wd)) then - ProcessWeaponDef(wdName, wd) + ExtractWeaponDefs(udName, ud) end end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - +-- apply mod options that need _post +ModOptions_Post(UnitDefs, WeaponDefs) \ 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 980ed191f..1fedaf087 100644 --- a/LuaAI.lua +++ b/LuaAI.lua @@ -8,30 +8,34 @@ -- return { - { - name = 'ShardLua', - desc = 'Shard by AF for Spring Lua', - }, ---[[ { - 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 bbb1af9bd..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,10 +39,234 @@ end ------------------------------------------ -local font = gl.LoadFont("FreeSansBold.otf", 50, 20, 1.95) +-- 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"}, + +} + + +-- 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 + 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 + +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) + 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(":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 + +function gradienth(px,py,sx,sy, c1,c2) + gl.Color(c1) + gl.Vertex(sx, sy, 0) + gl.Vertex(sx, py, 0) + gl.Color(c2) + gl.Vertex(px, py, 0) + 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() @@ -34,78 +275,114 @@ function addon.DrawLoadScreen() local vbw = 3.5/vsy local hsw = 0.2 local vsw = 0.2 - gl.BeginEnd(GL.QUADS, function() - - --bar bg - gl.Color(0,0,0,0.85) - gl.Vertex(0.2, 0.1) - gl.Vertex(0.8, 0.1) - gl.Vertex(0.8, 0.15) - gl.Vertex(0.2, 0.15) - - --progress - gl.Color(1,0,0,0.3) - gl.Vertex(0.2, 0.1) - gl.Vertex(0.2 + math.max(0, loadProgress-0.01) * 0.6, 0.1) - gl.Vertex(0.2 + math.max(0, loadProgress-0.01) * 0.6, 0.15) - gl.Vertex(0.2, 0.15) - gl.Color(1,0.5,0.5,0.1) - gl.Vertex(0.2 + math.max(0, loadProgress-0.01) * 0.6, 0.1) - gl.Vertex(0.2 + math.max(0, loadProgress-0.01) * 0.6, 0.15) - gl.Color(1,0.25,0.25,0) - gl.Vertex(0.2 + math.min(1, math.max(0, loadProgress+0.01)) * 0.6, 0.15) - gl.Vertex(0.2 + math.min(1, math.max(0, loadProgress+0.01)) * 0.6, 0.1) - - --bar borders - gl.Color(1,0,0,0.2) --Top Bar - gl.Vertex(0.2, 0.15) - gl.Vertex(0.8, 0.15) - gl.Vertex(0.8, 0.15-vbw) - gl.Vertex(0.2, 0.15-vbw) - gl.Color(1,0,0,0.2) --Bottom Bar - gl.Vertex(0.2, 0.10) - gl.Vertex(0.8, 0.10) - gl.Vertex(0.8, 0.10+vbw) - gl.Vertex(0.2, 0.10+vbw) - gl.Color(1,0,0,0.2) --Left Side Bar - gl.Vertex(0.2, 0.1) - gl.Vertex(0.2, 0.15) - gl.Vertex(0.2+hbw, 0.15) - gl.Vertex(0.2+hbw, 0.1) - gl.Color(1,0,0,0.2) --Right Side Bar - gl.Vertex(0.8, 0.1) - gl.Vertex(0.8, 0.15) - gl.Vertex(0.8-hbw, 0.15) - gl.Vertex(0.8-hbw, 0.1) - end) - ---[[ - gl.Color(0,0,0,1) - gl.Rect(0.2,0.15,0.8,0.2) - gl.Color(1,1,1,1) - gl.Rect(0.2,0.15,0.2 + math.max(0, loadProgress) * 0.6,0.2) - gl.LineWidth(5) - gl.PolygonMode(GL.FRONT_AND_BACK, GL.LINE) - gl.Rect(0.2,0.15,0.8,0.2) - gl.PolygonMode(GL.FRONT_AND_BACK, GL.FILL) - gl.LineWidth(1) - gl.Color(1,1,1,1) ---]] + 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.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) - local barTextSize = vsy * (0.05 - 0.015) + 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.205, vsy * 0.14, barTextSize * 0.5, "sa") + 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.115, 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 @@ -116,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 4d52b690a..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) -local musicfiles = VFS.DirList(LUA_DIRNAME .. "Assets/music", "*.ogg") if (#musicfiles > 0) then - Spring.PlaySoundStream(musicfiles[ math.random(#musicfiles) ], 1) - Spring.SetSoundStreamVolume(0) + 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(1) + --Spring.StopSoundStream() + --Spring.SetSoundStreamVolume(0.5) end diff --git a/LuaIntro/Assets/music/loading.ogg b/LuaIntro/Assets/music/loading.ogg deleted file mode 100644 index a9652ab5b..000000000 Binary files a/LuaIntro/Assets/music/loading.ogg and /dev/null differ 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/ControlPoints/cv_Eye_Of_Horus_v2.lua b/LuaRules/Configs/ControlPoints/cv_Eye_Of_Horus_v2.lua deleted file mode 100644 index 9ee2563f0..000000000 --- a/LuaRules/Configs/ControlPoints/cv_Eye_Of_Horus_v2.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - points = { - [1] = {x = 3084, y = 0, z = 3578}, - [2] = {x = 632, y = 0, z = 4070}, - [3] = {x = 647, y = 0, z = 2884}, - [4] = {x = 5475, y = 0, z = 3150}, - [5] = {x = 5471, y = 0, z = 4260}, - [6] = {x = 2229, y = 0, z = 3467}, - [7] = {x = 3909, y = 0, z = 3692}, - }, -} \ No newline at end of file diff --git a/LuaRules/Configs/ControlPoints/cv_HighGround - v01.lua b/LuaRules/Configs/ControlPoints/cv_HighGround - v01.lua new file mode 100644 index 000000000..7c5e26e2c --- /dev/null +++ b/LuaRules/Configs/ControlPoints/cv_HighGround - v01.lua @@ -0,0 +1,11 @@ +return { + points = { + [1] = {x = 4096, y = 0, z = 829}, + [2] = {x = 763, y = 0, z = 4089}, + [3] = {x = 4082, y = 0, z = 7166}, + [4] = {x = 7205, y = 0, z = 4090}, + [5] = {x = 5123, y = 0, z = 4354}, + [6] = {x = 4096, y = 0, z = 3840}, + [7] = {x = 3074, y = 0, z = 4354}, + }, +} \ No newline at end of file diff --git a/LuaRules/Configs/ControlPoints/cv_HighGround - v03.lua b/LuaRules/Configs/ControlPoints/cv_HighGround - v03.lua new file mode 100644 index 000000000..7c5e26e2c --- /dev/null +++ b/LuaRules/Configs/ControlPoints/cv_HighGround - v03.lua @@ -0,0 +1,11 @@ +return { + points = { + [1] = {x = 4096, y = 0, z = 829}, + [2] = {x = 763, y = 0, z = 4089}, + [3] = {x = 4082, y = 0, z = 7166}, + [4] = {x = 7205, y = 0, z = 4090}, + [5] = {x = 5123, y = 0, z = 4354}, + [6] = {x = 4096, y = 0, z = 3840}, + [7] = {x = 3074, y = 0, z = 4354}, + }, +} \ No newline at end of file diff --git a/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v02.lua b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v02.lua new file mode 100644 index 000000000..24e0fa065 --- /dev/null +++ b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v02.lua @@ -0,0 +1,11 @@ +return { + points = { + [1] = {x = 1466, y = 0, z = 4071}, + [2] = {x = 4104, y = 0, z = 1450}, + [3] = {x = 6742, y = 0, z = 4087}, + [4] = {x = 4116, y = 0, z = 6733}, + [5] = {x = 4717, y = 0, z = 3516}, + [6] = {x = 3236, y = 0, z = 3669}, + [7] = {x = 4234, y = 0, z = 4954}, + }, +} \ No newline at end of file diff --git a/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v03.lua b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v03.lua new file mode 100644 index 000000000..24e0fa065 --- /dev/null +++ b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v03.lua @@ -0,0 +1,11 @@ +return { + points = { + [1] = {x = 1466, y = 0, z = 4071}, + [2] = {x = 4104, y = 0, z = 1450}, + [3] = {x = 6742, y = 0, z = 4087}, + [4] = {x = 4116, y = 0, z = 6733}, + [5] = {x = 4717, y = 0, z = 3516}, + [6] = {x = 3236, y = 0, z = 3669}, + [7] = {x = 4234, y = 0, z = 4954}, + }, +} \ No newline at end of file diff --git a/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v04.lua b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v04.lua new file mode 100644 index 000000000..24e0fa065 --- /dev/null +++ b/LuaRules/Configs/ControlPoints/cv_Volcanic Basin - v04.lua @@ -0,0 +1,11 @@ +return { + points = { + [1] = {x = 1466, y = 0, z = 4071}, + [2] = {x = 4104, y = 0, z = 1450}, + [3] = {x = 6742, y = 0, z = 4087}, + [4] = {x = 4116, y = 0, z = 6733}, + [5] = {x = 4717, y = 0, z = 3516}, + [6] = {x = 3236, y = 0, z = 3669}, + [7] = {x = 4234, y = 0, z = 4954}, + }, +} \ 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/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/MetalSpots/example.lua b/LuaRules/Configs/MetalSpots/example.lua new file mode 100644 index 000000000..73bc3218d --- /dev/null +++ b/LuaRules/Configs/MetalSpots/example.lua @@ -0,0 +1,44 @@ +-- Basic mexes. + +local spots = { + {x = 12, z = 55, metal = 2}, + {x = 34, z = 55, metal = 2}, + {x = 67, z = 55, metal = 2}, + {x = 89, z = 55, metal = 2}, +} + +-- Extra mexes added for 5v5+ games +local extraSpots = { + {x = 23, z = 55, metal = 2}, + {x = 78, z = 55, metal = 2}, +} + +if #Spring.GetTeamList() > 10 then + for i = 1, #extraSpots do + table.insert (spots, extraSpots[i]) + end +end + +-- Mirror the mexes symmetrically on the other half of the map +for i = 1, #spots do + local spot = spots[i] + local mirroredSpot = { + x = Game.mapSizeX - spot.x, + z = spot.z, + metal = spot.metal, + } + spots[#spots + 1] = mirroredSpot +end + +-- If a mapoption is set, add a supermex in the middle with dynamic income based on player count +if Spring.GetMapOptions().supermex then + spots[#spots + 1] = { + x = Game.mapSizeX / 2, + z = Game.mapSizeZ / 2, + metal = 3 + #Spring.GetTeamList(), + } +end + +return { + spots = spots, +} 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/cloak_shield_defs.lua b/LuaRules/Configs/cloak_shield_defs.lua index 7a0341ee8..4e9899543 100644 --- a/LuaRules/Configs/cloak_shield_defs.lua +++ b/LuaRules/Configs/cloak_shield_defs.lua @@ -1,10 +1,3 @@ --- $Id: cloak_shield_defs.lua 4643 2009-05-22 05:52:27Z carrepairer $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---Modified by Evil4Zerggin - --- -- Cloak Levels -- -- 0: disabled @@ -12,100 +5,45 @@ -- 2: conditionally enabled, does no use energy -- 3: enabled, unless stunned -- 4: always enabled --- - --- decloakDistance: Units cloaked by the cloaker have this decloakdistance. Use false to use the unit's own decloak distance (typically 0) - - -local function JammerAlign(defName) - local ud = UnitDefNames[defName] - if (ud == nil) then return 0 end - local jamRad = ud.jammerRadius - return 64 * math.floor(jamRad / 64) -end - -local function GetUnitDecloakDistance(defName) - local ud = UnitDefNames[defName] - if (ud == nil) then return 0 end - local decloakDist = ud.decloakDistance - return 64 * math.floor(decloakDist / 64) -end - -local cloakShieldDefs = { - ejammer2 = { - init = false, - draw = true, - energy = 5, - maxrad = JammerAlign('ejammer2'), - growRate = 512, - shrinkRate = 2048, - selfCloak = false, - decloakDistance = 500, - }, - - eallterrshield = { - init = true, - draw = true, - energy = 5, - maxrad = 150, - growRate = 512, - shrinkRate = 2048, - selfCloak = false, - decloakDistance = 150, - }, -} --- reads from customParams and copies to cloakShieldDefs as appropriate - needed for procedurally generated comms --- as always, need better way to handle if upgrades are desired! -local presets = { - module_cloakfield = { - init = true, - draw = true, - energy = 12, - maxrad = 350, - growRate = 512, - shrinkRate = 2048, - selfCloak = true, - decloakDistance = 300, - }, -} +local uncloakables = {} -for name, ud in pairs(UnitDefNames) do - if ud.customParams.cloakshield_preset then - cloakShieldDefs[name] = Spring.Utilities.CopyTable(presets[ud.customParams.cloakshield_preset]) +for k, v in pairs(UnitDefNames) do + if (v.customParams.cannotcloak) then + uncloakables[k] = true end end -if (Spring.IsDevLuaEnabled()) then - for name, ud in pairs(UnitDefNames) do - if (cloakShieldDefs[name] == nil) then - cloakShieldDefs[name] = { - init = false, - energy = 1024, --v.metalCost / 10, - draw = true, - minrad = 50, - maxrad = 256, - growRate = 256, - shrinkRate = 1024, - selfCloak = false, - decloakDistance = false, - level = 4, - } - end - end -end - -local uncloakables = {} - -for k,v in pairs(UnitDefNames) do - if (v.customParams.cannotcloak) then - uncloakables[k] = true - end +local cloakShieldDefs = {} + +for name, ud in pairs (UnitDefNames) do + local cp = ud.customParams + if cp.area_cloak and (cp.area_cloak ~= "0") then + cloakShieldDefs[name] = {} + + cloakShieldDefs[name].energy = tonumber (cp.area_cloak_upkeep) + cloakShieldDefs[name].maxrad = tonumber (cp.area_cloak_radius) + + cloakShieldDefs[name].growRate = tonumber (cp.area_cloak_grow_rate) + cloakShieldDefs[name].shrinkRate = tonumber (cp.area_cloak_shrink_rate) + cloakShieldDefs[name].decloakDistance = tonumber (cp.area_cloak_decloak_distance) + + cloakShieldDefs[name].init = (cp.area_cloak_init ~= "0") + cloakShieldDefs[name].draw = (cp.area_cloak_draw ~= "0") + cloakShieldDefs[name].selfCloak = (cp.area_cloak_self ~= "0") + + local exception = {} + if cloakShieldDefs[name].decloakDistance then + for _, eud in pairs (UnitDefs) do + if eud.decloakDistance < cloakShieldDefs[name].decloakDistance then + exception[eud.id] = true + end + end + end + cloakShieldDefs[name].radiusException = exception + end end -return cloakShieldDefs, uncloakables - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +return cloakShieldDefs, uncloakables \ No newline at end of file diff --git a/LuaRules/Configs/cob_buttons.lua b/LuaRules/Configs/cob_buttons.lua deleted file mode 100644 index cdee0a764..000000000 --- a/LuaRules/Configs/cob_buttons.lua +++ /dev/null @@ -1,52 +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', 'EMP', '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', 'EMP', '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', 'EMP', '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', 'Single', 'Salvo'}, - }, - }, - - eartytank = { - { - name = "Weapon type", - tooltip = "Switch between Normal and Saturation Artillery", - cob = "WeaponType", -- only this is required - type = CMDTYPE.ICON_MODE, - params = {'1', 'Normal', 'Saturation'}, - }, - }, -} \ No newline at end of file diff --git a/LuaRules/Configs/constants.lua b/LuaRules/Configs/constants.lua index 7b0ea0735..eea5e9c79 100644 --- a/LuaRules/Configs/constants.lua +++ b/LuaRules/Configs/constants.lua @@ -1 +1,2 @@ -HIDDEN_STORAGE = 10000 -- hidden storage: it will spend all energy above (storage - hidden_storage) \ No newline at end of file +HIDDEN_STORAGE = 10000 -- hidden storage: it will spend all energy above (storage - hidden_storage) +TEAM_SLOWUPDATE_RATE = 30 \ No newline at end of file diff --git a/LuaRules/Configs/cv_modOptions.lua b/LuaRules/Configs/cv_modOptions.lua new file mode 100644 index 000000000..9bc66c413 --- /dev/null +++ b/LuaRules/Configs/cv_modOptions.lua @@ -0,0 +1,85 @@ +cvMode = Spring.GetModOptions().scoremode + +--Is CV Enabled when you launch spring.exe directly? +if cvMode == nil then + cvMode = "disabled" +end + +-- CV Enabled/Disabled Controls +if cvMode == "disabled" then + return false +end + +------------------------------------------------------- +-- Use a building mask for Control Points? +--If this is set to false, then any unit will be buildable in the control point +useBuildingMask = true +------------------------------------------------------- + +captureRadius = tonumber(Spring.GetModOptions().captureradius) -- Radius around a point in which to capture it +if captureRadius == nil then + captureRadius = 500 +end + +captureTime = tonumber(Spring.GetModOptions().capturetime) -- Time to capture a point +if captureTime == nil then + captureTime = 30 +end + +captureBonus = tonumber(Spring.GetModOptions().capturebonus) -- speedup from adding more units +if captureBonus == nil then + captureBonus = 0.05 +else + captureBonus = captureBonus * 0.01 +end + +decapSpeed = tonumber(Spring.GetModOptions().decapspeed) -- speed multiplier for neutralizing an enemy point +if decapSpeed == nil then + decapSpeed = 3 +end + +dominationScore = tonumber(Spring.GetModOptions().dominationscore) +if dominationScore == nil then + dominationScore = 1000 +end + +dominationScoreTime = tonumber(Spring.GetModOptions().dominationscoretime) -- Time needed holding all points to score in multi domination +if dominationScoreTime == nil then + dominationScoreTime = 30 +end + +usemapconfig = Spring.GetModOptions().usemapconfig +if usemapconfig == nil then + usemapconfig = "disabled" +end + +limitScore = tonumber(Spring.GetModOptions().limitscore) +if limitScore == nil then + limitScore = 3500 +end + +-- These are together because they cover the same area (resourcing) +metalPerPoint = tonumber(Spring.GetModOptions().metalperpoint) +if metalPerPoint == nil then + metalPerPoint = 0 +end + +energyPerPoint = tonumber(Spring.GetModOptions().energyperpoint) +if energyPerPoint == nil then + energyPerPoint = 0 +end + +numberOfControlPoints = tonumber(Spring.GetModOptions().numberofcontrolpoints) +if numberOfControlPoints == nil then + numberOfControlPoints = 7 +end + +startTime = tonumber(Spring.GetModOptions().starttime) -- The time when capturing can start +if startTime == nil then + startTime = 180 +end + +tugofWarModifier = tonumber(Spring.GetModOptions().tugofwarmodifier) -- Radius around a point in which to capture it +if tugofWarModifier == nil then + tugofWarModifier = 2 +end \ No newline at end of file diff --git a/LuaRules/Configs/cv_nonCapturingUnits.lua b/LuaRules/Configs/cv_nonCapturingUnits.lua new file mode 100644 index 000000000..d9d54ea88 --- /dev/null +++ b/LuaRules/Configs/cv_nonCapturingUnits.lua @@ -0,0 +1,24 @@ +local nonCapturingUnits = { + "eairengineer", + "efighter", + "efighter_up1", + "efighter_up2", + "efighter_up3", + --"escout", + "egunship2", + "egunship2_up1", + "egunship2_up2", + "egunship2_up3", + "etransport", + "etransport_up1", + "etransport_up2", + "etransport_up3", + "edrone", + "ebomber", + "ebomber_up1", + "ebomber_up2", + "ebomber_up3", + --"escout", +} + +return nonCapturingUnits diff --git a/LuaRules/Configs/death_messages.lua b/LuaRules/Configs/death_messages.lua new file mode 100644 index 000000000..9ed6751f1 --- /dev/null +++ b/LuaRules/Configs/death_messages.lua @@ -0,0 +1,836 @@ +allyTeamDeathMessages = { + --ated + "XX has been obliterated", + "XX has been liquidated", + "XX has been eradicated", + "XX has been terminated", + "XX has been fumigated", + "XX has been castrated", + "XX has been expatriated", + "XX has been annihilated", + "XX has been exterminated", + "XX has been incapacitated", + "XX has been co-immunoprecipitated", + "XX has been deliminated", + "XX has been devastated", + "XX has been dishabilitated", + "XX has been eliminated", + "XX has been annihilated", + "XX has been dominated", + "XX has been deactivated", + "XX has been deprecated", + "XX has been incinerated", + "XX has been decapitated", + "XX has been floccinaucinihilipilificated", + + --ized + "XX has been hospitalized", + "XX has been crystalized", + "XX has been brutalized", + "XX has been caramelized", + "XX has been metabolized", + "XX has been destabilized", + "XX has been immobilized", + "XX has been oxidized", + "XX has been minimized", + "XX has been neutralized", + "XX has been fossilized", + "XX has been vulcanized", + "XX has been exorcized", + "XX has been pulverized", + "XX has been amortized", + "XX has been vaporized", + + --lled + "XX has been steamrolled", + "XX has been levelled", + "XX has been uninstalled", + "XX has been chargrilled", + "XX has been cudgelled", + "XX has been cancelled", + "XX has been anulled", + "XX has been jackrolled", + "XX has been mothballed", + "XX has been bedevilled", + "XX has been expelled", + "XX has been disembowelled", + "XX has been killed", + "XX has been unravelled", + + --oned + "XX has been bludgeoned", + "XX has been unbuttoned", + "XX has been imprisoned", + "XX has been outreasoned", + "XX has been chaperoned", + "XX has been dethroned", + "XX has been harpooned", + "XX has been stoned", + "XX has been poisoned", + "XX has been unreckoned", + "XX has been doggoned", + "XX has been gudgeoned", + "XX has been picarooned", + "XX has been dragooned", + "XX has been pensioned", + "XX has been sectioned", + +} + +teamDeathMessages = { + + "XX was exported to pdf", + "XX suffered an unmitigated disaster", + "XX should have stayed in bed", + "XX has bowed out", + "XX is singing with the choir invisible", + "XX has entered purgatory", + "XX has gone to a better place", + "XX has been shown the door", + "XX exits stage left", + "XX has left the scene", + "XX has gone to robot heaven", + "XX has left the building", + "XX is no longer with us", + "XX lost their mojo", + "XX was unworthy of continued existence", + "XX made like cheap pants, and split", + "XX made like a mankini, and split", + "XX couldn't even handle a few Kites", + "XX has been played out", + "XX has been conquered", + "XX is toast", + "XX is done for", + "XX has succumbed", + "XX was helpless before the onslaught", + "XX has been damaged beyond repair", + "XX has been slain", + "XX was outclassed", + "XX got taken down", + "XX got taken out", + "XX is defeated", + "XX fell short", + "XX fell flat", + "XX fizzled out", + "XX was brought to ruin", + "XX was cut short", + "XX had a major malfunction", + "XX claims they accidentally self-destructed", + "XX failed", + "XX suffered a quantum-phase-inducer-photon-interchange-conduit-warp-resonance-integrity-breach-failure-cascade-pulse", + "XX didn't build enough Generators", + "XX was careless", + "XX has been ousted", + "XX was forfeit", + "XX flatlined", + "XX lost their marbles", + "XX blew a fuse", + "XX has been officially owned", + "XX shall plague the land no more", + "XX spoke softly, but forgot their big stick", + "XX couldn't resist pushing the red button", + "XX was cast down", + "XX lived up to its reputation", + "XX played too much Zero-K", + "XX got whipped", + "XX didn't have the guts", + "XX is at one with the Force", + "XX kicked the bucket", + "XX was snuffed out", + "XX crumbled", + "XX has expired", + "XX bit the dust", + "XX bought the farm", + "XX is pushing up the daisies", + "XX was sent back to their manufacturer", + "XX didn't wear their protective goggles", + "XX fought to the bitter end", + "XX had better things to do", + "XX didn't see that one coming", + "XX will not buy this record, it is scratched", + "XX forgot to check their horoscope", + "XX was resolute to the end", + "XX was rendered inert", + "XX was stomped to a fine paste", + "XX passed its expiration date", + "XX has been discontinued", + "XX crashed out", + "XX forgot to pay their protection money", + "XX got taken to the mattresses", + "XX got whacked", + "XX didn't fully close the microwave", + "XX choked on a gerbil", + "XX got a terminal case of rust", + "XX was converted to nuclear waste", + "XX has been burned for witchery", + "XX was gunned down by angry circus people", + "XX drowned in a toilet", + "XX has been decommissioned", + "XX won't be bothering you anymore, m'ame", + "XX forgot to turn off the gas", + "XX found out baths and toasters don't mix", + "XX was eaten by zombies", + "XX thought the Backstreet Boys are cool", + "XX inspired a new 'Warning' label", + "XX will fight another day", + "XX was defeated, but the soul still burns", + "XX was beamed up", + "XX reached the end of their rope", + "XX checked out", + "XX croaked", + "XX has crossed the great divide", + "XX has been disassembled", + "XX paid the debt we all must pay", + "XX was gibbed", + "XX will go home feet first", + "XX is goin' to a dance pawty wit' Gawd!", + "XX got their just reward", + "XX went on to the bonus round", + "XX is mortally challenged", + "XX lost alignment", + "XX kicked the oxygen habit", + "XX got knocked off", + "XX is living-impaired", + "XX mailed in its warranty card", + "XX has passed on", + "XX got pasted", + "XX is permanently out of print", + "XX needs toner", + "XX pulled the plug", + "XX got smeared", + "XX will sleep with the fishes", + "XX is slowly cooling to room temperature", + "XX took a dirt nap", + "XX was taken out of production", + "XX got toasted", + "XX walked the plank", + "XX is worm food", + "XX met their end", + "XX followed the white rabbit", + "XX is, uh, just resting", + "XX is pining for the fjords", + "XX moved into upper management", + "XX remaindered", + "XX is dead, Jim", + "XX disappeared up its own chutney channel", + "XX left nothing behind", + "XX is deader than a Doodoos dodos", + "XX collapsed like a flan in a cupboard", + "XX is waiting for the worms", + "XX needs medical attention", + "XX needed a sick note", + "XX segfaulted", + "XX exploded", + "XX will be back", + "XX is gone but not forgotten", + "XX needed more beans", + "XX fell into the fiery pits of Mount Doom", + "XX won't be respawning", + "XX is with us in spirit", + "XX rode on into the sunset", + "XX was covered in honey and buried deep underground", + "XX will sleep it off", + "XX passed into folklore", + "XX flit its aged frame", + "XX slipped on a banana skin", + "XX was crushed by a falling piano", + "XX died in a fire", + "XX was uninsured", + "XX believes in resurrection", + "XX was blown up by the vogons", + "XX, I am your father!", + "XX breathed it's last", + "XX should eat more spinach", + "XX went back into the closet", + "XX was too young to die", + "XX is just a small town girl, living in a looonely wooorld", + "XX took a midnight train, going anywhere", + "XX has gone to Amarillo", + "XX is hugging its pillow", + "XX was buried at sea", + "XX lives in a blue house with a blue window", + "XX is looking for answers from the great beyond", + "XX ran out of batteries", + "XX was hung, drawn and quartered", + "XX serves as an example to the rest", + "XX is gone for good", + "XX needs more practice", + "XX is gone with the wind", + "XX did not get U.N. approval", + "XX is buying a stairway to heaven", + "XX is just another brick in the wall", + "XX was drinking whisky and rye, singing ...", + "XX is never going to dance again", + "XX is easy come, easy go", + "XX was loyal to the true emperor, Marcus Aurelius", + "And like that, XX was gone", + "XX passed into the realm of monsters and legends", + "The light still burns for XX, but there is nobody home", + "XX tottered over the brink", + "XX is as real in memory as was in flesh", + "XX should have used the shark repellent bat spray", + "XX lost its life in the line of duty", + "XX. That is all.", + "XX will be sent a receipt", + "XX was just a story", + "XX is in a cold grave, under the deep deep sea", + "XX left behind small sticky traces", + "XX will be restored from a backup", + "Blamelist: XX", + "XX just needed more love", + "XX will be composted", + "XX reached the final frontier", + "XX was a little short for a stormtrooper", + "XX should watch the replay", + "XX phoned home", + "XX was dependent on the kindness of strangers", + "XX dreamed a dream in times gone by", + "XX had a dream", + "XX just didn't want to live any more", + "Houston, XX has a problem", + "XX wasn't in Kansas anymore", + "XX loved the smell of Napalm in the morning", + "Frankly, my dear, XX doesn't give a damn", + "XX sees dead people", + "XX lost its life but not its freedom", + "XX must remember that through all history, truth and love have always won", + "XX passed through nature to eternity", + "XX is dust on the wind", + "XX was ravaged by viking invaders", + "XX was printed on recycled paper", + "XX will be recycled", + "XX is now open to constructive criticism", + "XX has only itself to blame", + "XX will be sent on a training course", + "XX will now describe what went wrong:", + "XX would like to discuss this", + "XX knows what went wrong", + "XX will be reimplemented in lua", + "XX got a special death message", + "XX was swiftly and painlessly destroyed", + "XX had it coming", + "XX needed repair", + "XX needed a resource bonus", + "XX died slowly and painfully", + "XX will be back for Christmas", + "XX went into hibernation", + "XX has been cremated", + "XX was a war hero", + "XX should try playing with both hands", + "XX soiled itself", + "XX went to infinity and beyond", + "XX had everything under control", + "XX went and got itself killed, again", + "XX seems to be dead", + "XX died a hero's death", + "XX is dead as a doornail", + "XX did the Texas cakewalk", + "XX went west, where the sky is blue", + "XX will sleep in the sky", + "XX has gone to meet its maker", + "XX popped its clogs", + "XX fell on its sword", + "XX couldn't stand the heat", + "XX upped it", + "XX is wearing a pine overcoat", + "XX is six foot under", + "XX shuffled off it's mortal coil", + "XX wears pants for no man", + "XX runs from no man", + "XX made the ultimate sacrifice", + "XX went to the big DSD in the sky", + "XX died with its boots on", + "XX answered the final summons", + "XX went beyond the veil", + "XX came to a sticky end", + "XX fell off its perch", + "XX is just resting after a long squawk", + "XX is stone dead", + "XX was cut out in little stars", + "XX got slippered", + "XX got bitten by zombies", + "XX was abducted by martians and internally probed", + "XX was stomped on by angry kangaroos", + "XX ran out of antibiotics", + "XX needed tighter financial regulation", + "XX curled up and died", + "XX has been dismantled", + "XX was sent back for repairs", + "XX was reduced to rubble", + "XX is writing its memoirs", + "XX is out cold", + "XX was hit for six", + "XX reached pensionable age", + "XX should try performance enhancing supplements", + "XX fell off its horse", + "XX was tarred and feathered", + "XX was an evolutionary dead end", + "XX went down faster than the Titanic", + "XX was hunted to extinction", + "XX was ground up and fed to cattle", + "XX was not fit for further existence", + "XX has been scraped off the bottom of the barrel", + "XX is dancing in the rain", + "XX won't cause any more trouble", + "XX entered into a permanent economic downturn", + "XX was stretchered off the battlefield", + "XX lived fast and died young", + "XX will see you in Hell", + "XX ran out of steam", + "XX was put out to pasture", + "XX was sent on gardening leave", + "XX took early retirement", + "XX got a red card", + "XX tested positive for banned substances", + "XX got taken up the Khyber pass", + "XX left its heart in San Francisco", + "XX willll alwayyyys love yooouuuu", + "XX won't look back in anger", + "XX was way past its bedtime", + "XX was torn down to make way for overflow parking", + "XX has been sent to the recycle bin", + "XX has no need of further assistance", + "XX died of plague", + "XX went the way of the dinosaurs", + "XX was torn to shreds", + "Come in XX, your time is up", + "XX was walking in the air", + "XX was destroyed in a fire", + "XX needed better nourishment", + "XX rode away in a chariot of fire", + "XX faced the final curtain", + "XX reached the bottom of the bottle", + "The greatest trick XX ever played was convincing the world it didn't exist", + "XX got torn apart by rabid pumas", + "XX was retired from active service", + "XX longs for peace and harmony", + "Warning: Do not try XX at home", + "XX was covered with tuna and thrown into a pit of hungry kittens", + "XX got trampled by cows", + "XX died from a combination of indigestion and uncontrollable laughter", + "XX has an advanced case of Boogie Fever", + "XX was crushed under a falling sequoia", + "XX was optimized out by the compiler", + "XX was pecked to death by cassowarys", + "XX was struck by a falling coconut", + "XX was felled by a beaver", + "XX was sawn in half by an inexperienced magician", + "XX fell off a ladder", + "XX discovered the perils of mortality", + "XX will always have Paris", + "Hasta la vista, XX", + "XX knows ever'thing there is to know 'bout the shrimpin' bidness", + "XX did that on purpose", + "XX lived by the sword and got shot", + "XX is electroencephalographically challenged", + "XX is diagonally parked in a parallel universe", + "XX left its body to science", + "XX ate a hostess cake and got the cream filling", + "XX got man gravy all over its panty biscuits", + "XX has a magic wand up its Harry Potter", + "XX was poisoned, shot in the head, bludgeoned, castrated and then thrown into a river", + "XX drowned in molasses", + "XX was struck by a flying lawnmower", + "XX got buttered", + "XX surrendered its mysteries to Zoidberg", + "XX should have read the manual", + "XX got killed by creepers", + "Sweet dreams are made of XX", + "XX can see St Peter waving", + "XX came from the stairhead, bearing a bowl of lather", + "XX was loose stool water", + "XX was handcuffed, blindfolded and fired into the sun", + "XX has been broken down and sold for scrap", + "XX picked the wrong faction", + "XX laboured against its own cure", + "XX was wrapped in bandages, soaked in brandy and burned alive", + "XX did not expect the Spanish Inquisition", + "XX fell overboard", + "XX was killed by a falling tortoise", + "XX jumped into a volcano", + "XX fell into a bath of flouroantimonic acid", + "XX didn't pass quality control", + "XX couldn't counter the five-point-palm-exploding-heart technique", + "XX flew a kite in a thunderstorm", + "XX built its house on sand", + "The big bad wolf huffed and he puffed and he blew XX away", + "XX was reserved for the majority leader and his designee", + "XX was swept over the great waterfall at the end of the world", + "XX can now be crossed off the list of endangered species", + "XX had a banking collapse", + "XX was taken away in a van", + "XX set its Thetan free", + "XX felt the wrath of Kanayamahiko", + "XX was destroyed with fire and brimstone", + "XX went to a placid island of ignorance in the midst of the black seas of infinity", + "XX felt the call of Cthulhu", + "XX was eaten by the very hungry caterpillar", + "XX lacked the will of the warrior", + "XX has lost its sheep and doesn't know where to find them", + "XX followed a trail of candy into the deep dark forest", + "XX fell down a disused mineshaft", + "XX was struck by an iceberg", + "XX went up the brown coloured creek and merrily discarded its one and only paddle", + "XX was collapsed to a point by the Ricci flow", + "XX converged to minus infinity", + "XX was not uniformly integrable", + "XX failed the Weierstrass M-test", + "XX was one egg short of a dozen", + "XX needed more hamsters", + "XX needed to build more parks and raise taxes", + "XX got tasered", + "XX tried to cross the Ford river and its oxen died", + "XX put the 'grrr' into swinger baby! Yeah!", + "XX was travelling through Dallas in an open-topped limousine", + "XX had a beef train shunted into its tuna station", + "XX is a lumberjack and he's ok", + "XX got rogered by a Hippo", + "XX should have taken the blue pill", + "XX will be placed in solitary confinement", + "XX would like some sodium thiopental, please", + "XX impaled itself on a curling iron", + "XX fell into a vat of steaming porridge", + "XX was wearing the wrong trousers", + "XX took a long walk on a short pier", + "All the King's horses and all the King's men couldn't put XX together again", + "XX got ketchup on its fur burger", + "XX couldn't keep its pecker up", + "XX wants to be a man, mancub", + "XX fell into a vat of toxic waste", + "XX wore a spacesuit filled with angry bees", + "XX was smashed up by a sonically created power yeti", + "XX fell into a wood-chipper", + "XX accidentally turned a children's book into three three-hour-long movies", + "It is pitch black. XX was eaten by a grue.", + "XX ate all the pies", + "XX trod on a mine", + "XX was relieved of its duty", + "XX went permanently afk", + "XX did it in the library with Colonel Mustard", + "XX will be donated to charity", + "XX was struck by a projectile cowpat", + "XX fell into a crevasse", + "XX was cut into small pieces and encased in concrete", + "XX flew low over power lines", + "XX fell down a rabbit hole", + "XX got its meat skewer stuck in a toaster", + "XX got slapped around with a large peewee", + "XX was reclassified as an apology", + "XX turned into a pumpkin and two mice", + "XX sat around eating risotto and drinking Chateau du Chasselas", + "XX solemnly promises never to do that again", + "XX will be put in a cat-basket and sent to the edge of the universe", + "XX wagged its tail and rang the bell", + "The part of XX was played by Sean Bean", + "XX needs new underwear", + "XX did a whoopsie", + "Once again, the devil vomits in XX's kettle", + "XX was wetter than a haddock's bathing costume", + "XX wants to be Switzerland next time", + "XX was clobbered around the ears with some old slippers", + "XX needs more air in its tyres", + "XX needs to be turned off and on again", + "XX took its toy back to the carpet", + "XX tossed its cookies", + "XX got its badoodle stuck in a cord-wangler", + "XX was shaken, not stirred", + "XX danced with the devil in the pale moonlight", + "XX sucked all the marrow out and choked on the bone", + "XX needed a vacation", + "XX was a smelly pirate hooker", + "XX loved lamp", + "XX was not so think as you drunk I am", + "XX flew the blue lady of the skies into the sunset", + "XX opened the pod bay doors", + "Here's looking at you, XX", + "XX found a cause worth dying for", + "XX can check out any time it likes but it can never leave", + "XX didn't last forever, like cold November rain", + "XX's heart will go onnnn annnd onnnnn", + "XX was a cold and broken Hallelujah", + "XX kissed the sky", + "XX thought it could tell blue skies from pain", + "XX would rather be a hammer than a nail", + "XX was on a whiskey diet", + "XX was full of misery, loneliness and suffering - and it's all over much too soon", + "XX is not the messiah, XX is a very naughty boy!", + "Do, or do not. There is no XX!", + "XX did not waste its last days trying to prolong them", + "Once XX has been eliminated, the remainder, however improbable, must be the truth", + "XX should stop posting naked pictures of itself on the internet", + "XX dug a hole and jumped into it", + "XX flew a commercial aeroplane into a tall building", + "XX went over the Niagara Falls in a steamboat", + "XX was eaten by a hungry streptococcus", + "XX was first against the wall when the revolution came", + "XX lost its flower at the tender age of fifteen", + "XX contained traces of horse DNA", + "XX expected, got nil", + "XX put its pants on its head and stuck two pencils up its nose", + "XX will be returned to sender", + "XX donated itself to charity", + "XX came. XX saw. XX died really horribly.", + "XX bought the farm, a country house, stables, an outdoor toilet, tree-lined driveway and half of Wiltshire.", + "XX played chess with the grim reaper and came second", + "The fat lady finished singing for XX and went home", + "XX found that death was only a lesson in ones own limitations", + "XX entered into the afterlife of recrimination", + "XX is a nullptr", + "XX suffered a fate worse than a fate worse than death", + "XX will spend the rest of the war teaching home economics", + "XX needs to re-install Windows", + "XX ran out of juice", + "Why does it always rain on XX?", + "XX was pushing an elephant up the stairs", + "XX wouldn't believe its wireless radio", + "XX looked back in anger", + "XX lives in a house, a very big house in the country", + "XX was the story of a charmless man", + "XX ran to the hills", + "XX is just a teenage dirtbag, baby", + "XX claims it had the sun in its eyes", + "XX took off its gloves and walked slowly back to the pavilion", + "XX took a headbutt to the groin", + "XX was shut down by the authorities", + "XX killed Kenny", + "XX was a failed experiment in gene therapy", + "XX was a waste of time, space, oxygen and fuel", + "XX ate its last waterbiscuit", + "XX was torn apart by angry weasels", + "XX didn't want to play this silly game anyway", + "There's a XX, waiting in the sky", + "Ground control to XX: your circuits gone, there's something wrong", + "XX put Basil in the ratatouille", + "XX was duck without orange or cherries", + "XX rubbed itself out", + "XX was a highway to the danger zone", + "XX put out on the first date", + "XX plunged into a canyon", + "XX would like to know how to rotate buildings", + "XX needs more cowbell", + "XX has a mouse but it doesn't have a house", + "XX went down in a blaze of glory", + "XX needs some tissues", + "XX could make a fortune just laying on its back", + "XX was sent to landfill", + "XX is biodegradable", + "XX fell off its ninja rope into the water", + "XX is a bell end", + "XX will be court-martialled for this", + "XX was jellied", + "XX believes in angels", + "XX was evicted from the Big Brother household", + "XX was the weakest link, goodbye", + "XX remembered it was a womble", + "XX was struck by the dreaded batter pudding hurler of Bexhill-on-sea", + "XX was punched up the conk", + "XX has the Spon Plague", + "XX did a barrel roll", + "XX was ridden by the valkyries", + "XX was dropped into a pit of boiling tar", + "XX spent too long standing under a loose stalactite", + "XX was guillotined", + "XX ate too many Easter eggs", + "XX got whopped", + "XX was covered in barbecue sauce and served up at a Hillybilly Ho-down", + "XX violated GPL", + "XX had a God delusion", + "XX had a mid-life crisis", + "XX will be put up for auction", + "XX has pneumonoultramicroscopicsilicovolcanoconiosis", + "XX is having lobster thermidor aux crevettes, with a mornay sauce garnished with truffle pate, brandy and a fried egg on top and spam", + "XX died while balls deep in a squealing hog, firing a shotgun into the air", + "XX will clean up the chunks of dead prostitute", + "XX acted out one too many lumberjack fantasies", + "XX drowned in a pool of childrens tears", + "XX was too busy perming its ears", + "XX jumped under a fleet of oncoming buses", + "XX painted matchstalk men and matchstalk cats and dogs", + "XX went the same way as FPS mode", + "XX didn't control the spice, or the dune", + "Thank you XX! But our Princess is in another castle!", + "The right XX in the wrong place can make all the difference in the world", + "Boomshakalaka!", + "XX is the second biggest monkey head I have ever seen!", + "XX must construct additional pylons", + "XX reticulated its spline", + "All your XX are belong to us", + "XX was almost a Jill sandwich", + "XX prepared for unforeseen consequences", + "XX was all outta gum", + "Give it to XX baby, uhuh, uhuh", + "XX cannot DGun inside an enemy startbox", + "A problem has been detected and XX has been shut down to prevent damage to your computer", + "Shoot all the blue jays you want, if you can hit em, but remember that it's a sin to kill a XX", + "XX is no hot-house flower, but a wild plant, born of a wet night, born of an hour of sunshine", + "XX ran with scissors", + "XX screamed in agony as the potato slid deeper", + "XX left behind a small damp patch", + "XX had its clock cleaned", + "XX tossed its caber", + "XX gave its dog a bone", + "XX 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", + "How to rotate XX?", + "The name's XX, James XX", + "XX claims it was shooting blanks", + "XX stole Christmas", + "XX sniffed too many Naegleria Fowleri", + "XX was mauled by rabid badgers", + "XX had its face melted", + "XX talked about Fight Club", + "XX stopped worrying and loved the bomb", + "XX said hello to my little friend", + "XX coulda had class, coulda been a contender, coulda been somebody", + "XX will never let go, Jack", + "Let's talk about XX", + "XX flew home in a wooden box", + "XX don't need no stinking badges!", + "XX is like a box of chocolates", + "XX hopped on the last rattler", + "XX joined the great majority", + "XX pegged out", + "XX rode the pale horse", + "XX went Tango Uniform", + "XX took the last train to glory", + "XX went bung", + "XX wrote its own lobby protocol", + "XX went pear shaped", + "XX went arse over elbow", + "XX had a knuckle sandwich", + "XX was made redundant", + "XX was snookered", + "XX went to see a man about a dog", + "XX only lived once", + "XX sank without trace", + "XX smoked its kipper", + "XX got its coat", + "XX mailed itself home", + "XX assumed responsibility", + "XX answered the final call", + "XX basted the formaldehyde turkey", + "XX lay down under the cement tree", + "XX climbed the golden stairs", + "XX crossed the Styx", + "XX curled up its toes", + "XX sowed the Elysian fields", + "XX hopped its twig", + "XX went to the necrophiliac singles bar", + "XX picked up its harp", + "XX had a retroactive abortion", + "XX was struck out by the big blue pencil", + "XX was declared insolvent", + "XX don't kill people, wabbits do", + "XX destroyed its own evidence", + "XX was rejected with resubmission", + "XX obtained a compensated pass", + "XX has just been erased", + "XX has had it with these motherf***king snakes on this motherf***king plane", + "XX bet on black", + "XX ain't got time to bleed", + "XX filled its hands", + "XX took Senator Trent to the bloody bank", + "XX called this a knife", + "XX thanked Bluestone", + "XX ate its vegetables", + "Let's face it, this is not the worst thing you've caught XX doing", + "XX made its contribution to birth control", + "XX was discharged", + "XX was terminated", + "XX was fresh out of Chlorine", + "XX is just gonna stand there and bleed", + "XX democratically voted against paying its own debts", + "XX took its final shower", + "XX turned over to the dark side", + "XX can into relevance", + "XX was fifty shades of fucked-up, Anastasia", + "XX was a bright cold day in April", + "XX was a queer, sultry summer", + "XX, light of my life, fear of my loins", + "XX was eloquently, lovingly and pugnaciously drunk", + "XX was one of the reasons the Chinese never invented custard", + "XX used to be Snow White", + "XX should have built more advanced fusion reactors", + "XX fell asleep in the bath", + "XX accidentally shot down a civilian airliner", + "XX ran itself over", + "XX got bottled", + "XX dug its own grave", + "XX can has pototoes for its obey", + "XX dribbled its way to oblivion", + "XX was the last Mohican", + "XX lived in the gaps between the stories", + "XX watches the slow dance of the infinite stars", + "XX wants to hear Toot Toot Tootsie", + "XX was Spartacus", + "Mrs Robinson you're trying to seduce XX, aren't you?", + "XX is not bad, just drawn that way", + "XX took to the skies", + "XX retired hurt", + "XX paid $1.35m for work carried out nine years ago under an oral contract, and was banned from all related activity for eight years", + "XX is the president of everybody", + "XX was a fixed function pipeline", + "XX has a ticket to the moon", + "XX slipped through the hourglass", + "XX violated Turkish airspace", + "XX was nine sheets to the wind", + "XX saw its last sunrise", + "XX got battered", + "XX stole Christmas", + "XX was just faking", + "XX really tied the room together", + "XX put Baby in a corner", + "XX used Subionic's script", + "XX played it cool", + "XX never meant any of this", + "XX devaluated", + "XX made mistakes", + "XX looked the other way", + "XX doesn't agree with the balance", + "XX was fatefull", + "XX doesn't accept reality", + "XX doesn't accept virtual reality", + "XX storms out", + "XX hit by a turtle when it was small", + "XX didn't build enough A.Fus.", + "XX had parachute failure", + "XX thought it was superman and jumped from a high place", + "XX killed John Wick's dog", + "XX teched in 1v1", + "XX tried so hard and got so far but in the end it doesn't even matter", + "XX should have used its brain", + "XX committed suicide", + "XX wasted its last hour to play Balanced Annihilation", + "XX will rest in peace", + "XX cut wrong cable of bomb", + "XX killed by Bugs Bunny in XX season", + "XX spent its ninth live", + "XX tried to swim in lava", + "XX has converted by an enemy monk", + "XX rushed enemy with villagers", + "XX ate mint candy over diet cola", + "XX was at wrong place in wrong time", + "XX slept on rails", + "XX was at World Trade Center", + "XX tried to get into Area 51", + "XX kidnapped by aliens", + "XX doesn't drink coffee it takes tea my dear", + "We will see XX in another life. In heaven where we never say goodbye.", + "XX didn't check the road before crossing", + "XX couldn't wake up from its last sleep", + "XX slept with the fishes", + "More tea XX?", + "XX didn't forgive itself", + "XX killed by grievers", + "And The Loser of the Year Award goes to XX!", + "All the pain XX had is ended", + "XX wanted to do like Bear Grylls but failed tragically", + "XX got its bungee cord broken", + "Fossils of XX has found in a 1 million year old rock", +} + + + + + + + diff --git a/LuaRules/Configs/lups_shield_fxs.lua b/LuaRules/Configs/lups_shield_fxs.lua new file mode 100644 index 000000000..7629edfea --- /dev/null +++ b/LuaRules/Configs/lups_shield_fxs.lua @@ -0,0 +1,100 @@ +local ShieldSphereBase = { + layer = -34, + life = 10000, + size = 350, + radius = 350, + 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, +} + +local SEARCH_SMALL = { + {0, 0}, + {1, 0}, + {-1, 0}, + {0, 1}, + {0, -1}, +} + +local SEARCH_MULT = 1 +local SEARCH_BASE = 16 +local DIAG = 1/math.sqrt(2) + +local SEARCH_LARGE = { + {0, 0}, + {1, 0}, + {-1, 0}, + {0, 1}, + {0, -1}, + {DIAG, DIAG}, + {-DIAG, DIAG}, + {DIAG, -DIAG}, + {-DIAG, -DIAG}, +} +local searchSizes = {} + +local shieldUnitDefs = {} +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + + if ud.customParams.shield_radius then + local radius = tonumber(ud.customParams.shield_radius) + Spring.Echo(ud.name, radius) + if not searchSizes[radius] then + local searchType = (radius > 250 and SEARCH_LARGE) or SEARCH_SMALL + local search = {} + for i = 1, #searchType do + search[i] = {SEARCH_MULT*(radius + SEARCH_BASE)*searchType[i][1], SEARCH_MULT*(radius + SEARCH_BASE)*searchType[i][2]} + end + searchSizes[radius] = search + end + + local myShield = Spring.Utilities.CopyTable(ShieldSphereBase, true) + if radius > 250 then + myShield.shieldSize = "large" + myShield.drawBack = 0.6 + myShield.drawBackMargin = 3 + myShield.margin = 1.35 + myShield.hitResposeMult = 0.6 + myShield.colormap1[1][4] = 0.1 + myShield.colormap1[2][4] = 0.1 + else + myShield.shieldSize = "small" + myShield.drawBack = 0.9 + myShield.drawBackMargin = 1.9 + myShield.margin = 1.2 + myShield.colormap1[1][4] = 0.22 + myShield.colormap1[2][4] = 0.22 + myShield.hitResposeMult = 1 + end + myShield.size = radius + myShield.radius = radius + myShield.pos = {0, tonumber(ud.customParams.shield_emit_height) or 0, tonumber(ud.customParams.shield_emit_offset) or 0} + + local strengthMult = tonumber(ud.customParams.shield_color_mult) + if strengthMult then + myShield.colormap1[1][4] = strengthMult*myShield.colormap1[1][4] + myShield.colormap1[2][4] = strengthMult*myShield.colormap1[2][4] + end + + local fxTable = { + {class = 'ShieldSphereColor', options = myShield}, + } + + if string.find(ud.name, "chicken_") then + myShield.colormap1 = {{0.3, 0.9, 0.2, 1.2}, {0.6, 0.4, 0.1, 1.2}} -- Note that alpha is multiplied by 0.26 + myShield.hitResposeMult = 0 + myShield.texture = "bitmaps/GPL/bubbleShield.png" + fxTable[1].class = "ShieldSphereColorFallback" + end + + shieldUnitDefs[unitDefID] = { + fx = fxTable, + search = searchSizes[radius], + shieldCapacity = tonumber(ud.customParams.shield_power), + } + end +end + +return shieldUnitDefs diff --git a/LuaRules/Configs/morph_defs.lua b/LuaRules/Configs/morph_defs.lua deleted file mode 100644 index 18c5209db..000000000 --- a/LuaRules/Configs/morph_defs.lua +++ /dev/null @@ -1,46 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -local devolution = (-1 > 0) - - -local morphDefs = { - - -- Constructors - - esubplane = { - into = 'esubmarine', - tech = 0, - time = 0, - }, - esubmarine = { - into = 'esubplane', - tech = 0, - time = 0, - }, -} - --- --- 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, metal = 1, energy = 1 } - end - for src,data in pairs(devoDefs) do - morphDefs[src] = data - end -end - - -return morphDefs - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaRules/Configs/spawn_defs.lua b/LuaRules/Configs/spawn_defs.lua new file mode 100644 index 000000000..e4b70bd55 --- /dev/null +++ b/LuaRules/Configs/spawn_defs.lua @@ -0,0 +1,422 @@ +queenChoice = Spring.GetModOptions().mo_queendifficulty or "automatic" +Spring.Echo(queenChoice) +if queenChoice == "automatic" or queenChoice == nil then + local teams = Spring.GetTeamList() + for i =1, #teams do + local luaAI = Spring.GetTeamLuaAI(teams[i]) + if luaAI == "Chicken: Very Easy" then + queenName = "ve_chickenq" + elseif luaAI == "Chicken: Easy" then + queenName = "e_chickenq" + elseif luaAI == "Chicken: Normal" then + queenName = "n_chickenq" + elseif luaAI == "Chicken: Hard" then + queenName = "h_chickenq" + elseif luaAI == "Chicken: Very Hard" then + queenName = "vh_chickenq" + elseif luaAI == "Chicken: Epic!" then + queenName = "epic_chickenq" + elseif luaAI == "Chicken: Custom" then + queenName = "n_chickenq" + elseif luaAI == "Chicken: Survival" then + queenName = "n_chickenq" + end + end +else + queenName = Spring.GetModOptions().mo_queendifficulty or "n_chickenq" +end + +Spring.Echo(queenName) + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +maxChicken = tonumber(Spring.GetModOptions().mo_maxchicken) or 400 +maxBurrows = 20 +gracePeriod = tonumber(Spring.GetModOptions().mo_graceperiod) or 160 -- no chicken spawn in this period, seconds +queenTime = (Spring.GetModOptions().mo_queentime or 40) * 60 -- time at which the queen appears, seconds +addQueenAnger = tonumber(Spring.GetModOptions().mo_queenanger) or 1 +burrowSpawnType = Spring.GetModOptions().mo_chickenstart or "avoid" +spawnSquare = 90 -- size of the chicken spawn square centered on the burrow +spawnSquareIncrement = 2 -- square size increase for each unit spawned +burrowName = "roost" -- burrow unit name +maxAge = 300 -- default chicken die at this age, seconds +burrowDef = UnitDefNames[burrowName].id +defenderChance = 0.375 -- probability of spawning a single turret +maxTurrets = 3 -- Max Turrets per burrow +queenSpawnMult = 1 -- how many times bigger is a queen hatch than a normal burrow hatch +burrowSpawnRate = 60 +chickenSpawnRate = 59 +minBaseDistance = 600 +maxBaseDistance = 7200 +chickensPerPlayer = 8 +spawnChance = 0.5 +bonusTurret = "chickend1" -- Turret that gets spawned when a burrow dies +angerBonus = 0.25 +expStep = 0.0625 +lobberEMPTime = 4 +damageMod = 1 +waves = {} +newWaveSquad = {} + +maxAges = {} +maxAges["chicken1"] = 240 +maxAges["chicken1b"] = 240 +maxAges["chicken1c"] = 240 +maxAges["chicken_dodo1"] = 120 +maxAges["chicken_dodo2"] = 120 +maxAges["chickena2"] = 500 +maxAges["chickena2b"] = 500 +maxAges["chickenh4"] = 120 +maxAges["chickenh1"] = 240 +maxAges["chickenh1b"] = 200 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function Copy(original) + local copy = {} + for k, v in pairs(original) do + if (type(v) == "table") then + copy[k] = Copy(v) + else + copy[k] = v + end + end + return copy +end + +local function addWave(wave, unitList) + if not waves[wave] then waves[wave] = {} end + table.insert(waves[wave], unitList) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local chickenTypes = { + ve_chickenq = true, + e_chickenq = true, + n_chickenq = true, + h_chickenq = true, + vh_chickenq = true, + epic_chickenq = true, + chicken1 = true, + chicken1b = true, + chicken1c = true, + chicken1d = true, + chicken1x = true, + chicken1y = true, + chicken1z = true, + chicken2 = true, + chicken2b = true, + chickena1 = true, + chickena1b = true, + chickena1c = true, + chickena2 = true, + chickena2b = true, + chickens1 = true, + chickens2 = true, + chicken_dodo1 = true, + chicken_dodo2 = true, + chickenf1 = true, + chickenf1b = true, + chickenf2 = true, + chickenc1 = true, + chickenc2 = true, + chickenc3 = true, + chickenc3b = true, + chickenc3c = true, + chickenr1 = true, + chickenr2 = true, + chickenr3 = true, + chickenh1 = true, + chickenh1b = true, + chickenh2 = true, + chickenh3 = true, + chickenh4 = true, + chickenh5 = true, + chickenw1 = true, + chickenw1b = true, + chickenw1c = true, + chickenw1d = true, + chickenw2 = true, + chickens3 = true, + chickenp1 = true, +} + +local defenders = { + chickend1 = true, +} + +addWave(1,{"3 chicken1"}) +addWave(1,{"3 chicken1c"}) +addWave(1,{"1 chicken1", "1 chicken1b", "1 chicken1c", "1 chickenh1"}) +addWave(1,{"1 chicken1", "1 chicken1b", "1 chicken1c", "1 chicken1d"}) +addWave(1,{"3 chicken1d", "1 chickenh1"}) +addWave(1,{"1 chicken1", "1 chicken1b", "1 chicken1c", "1 chicken1d"}) +addWave(1,{"2 chicken1b", "1 chickenh1b"}) +addWave(1,{"2 chicken1c", "1 chickena1"}) + +newWaveSquad[2] = {"7 chicken1", "6 chicken1b", "5 chicken1c", "4 chicken1d"} +addWave(2,{"5 chicken1", "4 chicken1b", "3 chicken1c", "2 chicken1d"}) +addWave(2,{"2 chicken1", "3 chicken1b", "4 chicken1c", "5 chicken1d"}) +addWave(2,{"3 chicken1", "3 chicken1b", "3 chicken1c", "3 chicken1d"}) +addWave(2,{"1 chicken1x", "1 chicken1y", "1 chicken1z"}) +addWave(2,{"5 chicken1b", "1 chickenf2"}) +addWave(2,{"6 chicken1c"}) +addWave(2,{"3 chicken1", "1 chickena1b", "1 chickenh1"}) +addWave(2,{"1 chickena1", "1 chickena1c", "1 chickenw1b"}) +addWave(2,{"1 chickena1b", "1 chickena1c", "1 chickenw1", "1 chickens1"}) +addWave(2,{"4 chicken1d", "1 chickens1"}) +addWave(2,{"4 chicken1", "1 chickena1"}) +addWave(2,{"3 chicken1", "1 chickenh1", "1 chickenh1b"}) + +newWaveSquad[3] = {"7 chicken1", "8 chicken1b", "9 chicken1c", "10 chicken1d"} +addWave(3,{"1 chickena1", "2 chickena1b", "1 chickena1c", "2 chickenh1"}) +addWave(3,{"1 chickena1", "1 chickena1b", "2 chickena1c"}) +addWave(3,{"1 chickena1", "1 chickena1b", "1 chickena1c", "1 chickenc3"}) +addWave(3,{"1 chickenc3", "1 chickenc3b", "1 chickenc3c", "2 chicken1"}) +addWave(3,{"1 chickena1", "1 chickena1b", "1 chickens1", "1 chicken1x", "1 chicken1y", "1 chicken1z"}) +addWave(3,{"1 chickena1b", "1 chickena1c", "1 chickenh1", "1 chickenh1b", "3 chicken1b"}) +addWave(3,{"1 chickena1", "1 chickena1b", "1 chickenf2", "3 chicken1c"}) +addWave(3,{"1 chickena1", "1 chickena1c", "1 chickens1", "3 chicken1d"}) +addWave(3,{"3 chicken1y", "2 chickena1", "1 chickenh1", "1 chickenw1", "1 chickens1"}) +addWave(3,{"2 chickena1b", "1 chickenw1d", "1 chickens1"}) + +newWaveSquad[4] = {"1 chickenh5", "9 chickenh1", "9 chickenh1b"} +addWave(4,{"1 chickena1", "1 chickena1b", "1 chickena1c", "1 chickenh1", "1 chickenh1b"}) +addWave(4,{"4 chicken1x", "3 chicken1y", "2 chicken1z", "1 chickenh1"}) +addWave(4,{"2 chicken1x", "3 chicken1y", "4 chicken1z", "1 chickenh1"}) +addWave(4,{"3 chickenc3", "1 chickena1"}) +addWave(4,{"3 chickenc3b", "1 chickens3"}) +addWave(4,{"3 chickenc3c", "1 chickens1"}) +addWave(4,{"3 chickenw1", "1 chicken_dodo1"}) +addWave(4,{"3 chickens1", "1 chickenf2"}) + +newWaveSquad[5] = {"11 chickens1", "2 chickenw2"} +addWave(5,{"6 chicken1x", "2 chickens1", "1 chicken_dodo1"}) +addWave(5,{"6 chickens1", "1 chickenw1"}) +addWave(5,{"5 chickens1", "1 chickena1b"}) +addWave(5,{"4 chickens1", "1 chickena1", "1 chickenf2"}) +addWave(5,{"3 chickens1", "1 chickena1c", "2 chickenc3"}) +addWave(5,{"3 chickens1", "1 chickenh1", "1 chickenh1b"}) +addWave(5,{"1 chickena1", "1 chickena1b", "1 chickena1c", "1 chickenw1b"}) +addWave(5,{"5 chicken1y", "1 chicken_dodo1", "3 chickenh1"}) +addWave(5,{"6 chicken1z", "1 chickenw1c", "1 chickenw1d"}) +addWave(5,{"3 chickens1", "1 chickenp1"}) +addWave(5,{"1 chickenp1", "1 chicken_dodo1", "3 chickenh1b"}) +addWave(5,{"1 chickenc3", "2 chickenc3b", "2 chickenc3b"}) +addWave(5,{"3 chickens3"}) + +newWaveSquad[6] = {"1 chickenh5", "1 chicken_dodo2", "7 chickenp1"} +addWave(6,{"1 chicken_dodo1", "3 chickenp1", "1 chickenf2"}) +addWave(6,{"1 chicken_dodo1", "3 chickenc3", "3 chickenc3b", "3 chickenc3c"}) +addWave(6,{"1 chicken_dodo1", "4 chickenp1", "1 chickens3"}) +addWave(6,{"1 chicken_dodo1", "4 chickenp1"}) +addWave(6,{"1 chicken_dodo1", "2 chickenp1", "1 chickenh1", "1 chickenh1b"}) +addWave(6,{"1 chicken_dodo1", "2 chickenp1", "1 chickenw1b", "1 chickenf2", "1 chickenw1"}) +addWave(6,{"2 chicken_dodo1", "1 chickenp1", "2 chickenc1"}) +addWave(6,{"2 chicken_dodo1", "1 chickena1", "1 chickena1b", "3 chickena1c", "1 chickenw1b"}) +addWave(6,{"2 chicken_dodo1", "5 chickens1", "1 chickenw2", "1 chickens3"}) +addWave(6,{"2 chicken_dodo1", "3 chicken1x", "1 chickenf1", "3 chicken2"}) +addWave(6,{"2 chicken_dodo1", "1 chickenp1", "1 chickenc1", "1 chickens1", "1 chickena1b", "1 chickenh1"}) +addWave(6,{"3 chicken_dodo1", "5 chickenh1", "1 chickens3"}) +addWave(6,{"4 chicken_dodo1", "1 chickenf1", "1 chickenw2"}) + +newWaveSquad[7] = {"1 chickenr1", "1 chickenh5", "12 chickenw2", "1 chickenf1", "1 chickenf1b"} +addWave(7,{"2 chickenw2", "1 chickenw1b", "1 chickenw1c", "1 chickens3"}) +addWave(7,{"1 chickenw1", "2 chickenw2", "1 chickenw1d", "1 chicken_dodo1"}) +addWave(7,{"1 chickenw1", "2 chickenw2", "1 chickenw1d", "1 chickens3"}) +addWave(7,{"1 chickenw1b", "1 chickenw1c", "2 chickenw2"}) +addWave(7,{"2 chickenw1", "3 chickenw1b", "1 chicken_dodo1"}) +addWave(7,{"2 chickenw1c", "2 chickenw1d"}) +addWave(7,{"1 chickenf1b", "2 chickens3"}) +addWave(7,{"2 chickenf1", "1 chickens3", "1 chicken_dodo1"}) +addWave(7,{"2 chickenf1", "1 chicken_dodo1", "1 chickens3"}) +addWave(7,{"2 chickenf1", "1 chicken_dodo1", "1 chickenf1b"}) +addWave(7,{"5 chickens3"}) +addWave(7,{"5 chickenw2"}) + +newWaveSquad[8] = {"1 chickenh5", "6 chickenc1", "2 chickenh2"} +addWave(8,{"2 chickenc1", "1 chickenw2", "1 chickenw1b", "1 chickenw1c", "1 chickenw1d"}) +addWave(8,{"2 chickenc1", "1 chickenr1", "3 chicken_dodo1"}) +addWave(8,{"2 chickenc1", "2 chickenf1", "1 chickenw2", "1 chickenw1d"}) +addWave(8,{"2 chickenc1", "1 chickenf1b", "2 chickenw2", "2 chickenw1b"}) +addWave(8,{"3 chickenc1", "4 chickenh1", "3 chickenf2"}) +addWave(8,{"3 chickenc1", "1 chickena1", "2 chickena1b", "1 chickena1c", "1 chicken_dodo1"}) +addWave(8,{"3 chickenc1", "4 chicken_dodo1"}) +addWave(8,{"3 chickenc1", "1 chickens1", "1 chickens2","2 chickenp1", "2 chickenh1b"}) +addWave(8,{"4 chickenc1", "1 chickenf1b", "1 chicken_dodo1"}) +addWave(8,{"4 chickenc1", "3 chicken_dodo1", "1 chickenh2"}) +addWave(8,{"2 chickena1", "1 chickena1b", "1 chickena1c", "1 chickena2", "1 chickenr1", "3 chickenf2"}) +addWave(8,{"6 chickens1", "1 chickens2"}) +addWave(8,{"5 chickenp1", "2 chickenh1", "2 chickenh1b"}) +addWave(8,{"4 chickenc3", "4 chickenc3b", "4 chickenc3c"}) +addWave(8,{"9 chicken2", "1 chicken_dodo2"}) + +newWaveSquad[9] = {"1 chickenh5", "5 chickens2", "10 chicken2"} +addWave(9,{"3 chickenf1", "1 chicken_dodo1", "1 chickena2", "1 chickenh1", "1 chickenw1b", "1 chicken2"}) +addWave(9,{"1 chickenr1", "2 chickenf1b", "2 chicken_dodo1", "1 chickenh1b", "1 chicken2"}) +addWave(9,{"1 chickenf1", "1 chickenf1b", "3 chicken_dodo1", "1 chickena2b", "1 chickenh1", "1 chickenh2"}) +addWave(9,{"1 chickenr1", "3 chickenc1", "1 chickenh1b", "1 chicken2"}) +addWave(9,{"3 chickenc1", "1 chicken_dodo2", "1 chickens2", "1 chickenh1", "1 chickenw1d", "1 chicken2"}) +addWave(9,{"2 chickenr1", "3 chickenc1", "1 chickenh1b", "1 chicken2"}) +addWave(9,{"1 chickenw1", "2 chickenw1b", "2 chickenw2", "1 chickenw1d", "2 chicken_dodo1", "1 chickens2", "1 chickenh1", "1 chicken2"}) +addWave(9,{"1 chickenr1", "6 chickenp1", "4 chickenh1b", "1 chicken2"}) +addWave(9,{"2 chickena1", "2 chickena1b", "2 chickena1c", "4 chickenh1", "1 chickenh1", "1 chickenw1", "1 chicken2"}) +addWave(9,{"1 chickenr1", "1 chickens2", "4 chickenh1b", "1 chicken2"}) +addWave(9,{"6 chicken2", "3 chickenh1", "1 chickenw2", "1 chickenf2"}) + +newWaveSquad[10] = {"2 chickenh5", "13 chicken2b", "1 chickenh2", "1 chickena2", "1 chickena2b"} +addWave(10,{"7 chicken2b", "1 chickens2", "2 chickenh1"}) +addWave(10,{"5 chicken2b", "1 chickena2", "1 chickenh1"}) +addWave(10,{"4 chicken2", "1 chickens2", "2 chickenh1b"}) +addWave(10,{"3 chicken2", "1 chickena2b", "1 chickenh1b"}) +addWave(10,{"3 chicken2b", "1 chickenh2", "2 chickenh1"}) +addWave(10,{"4 chicken2b", "1 chickenh5", "1 chickenh1"}) +addWave(10,{"7 chicken2", "1 chickenh2", "2 chickenh1b"}) +addWave(10,{"6 chicken2", "1 chicken_dodo2", "1 chickenr1"}) +addWave(10,{"1 chickenc2", "4 chickenc1", "1 chickenf1"}) +addWave(10,{"4 chickens3", "4 chickenw2", "1 chickenf1b"}) +addWave(10,{"6 chickenp1", "2 chickenh1b", "2 chickenh1"}) + +newWaveSquad[11] = {"4 chickenh2", "4 chickenh1", "4 chickenh1b"} +addWave(11,{"3 chickenh1","2 chickenh1b","1 chickenh2","2 chickenh3", "1 chickenc2", "1 chickenw2"}) +addWave(11,{"2 chickenh1","3 chickenh1b","1 chickenh2","2 chickenh3", "1 chickenc2", "1 chickenw2"}) +addWave(11,{"2 chickenh1","2 chickenh1b","1 chickenh2","2 chickenh3", "1 chickenc2", "1 chickenw2"}) +addWave(11,{"2 chickenh1","2 chickenh1b","1 chickenh2","2 chickenh3", "1 chickens2"}) +addWave(11,{"2 chickenh1","2 chickenh1b","1 chickenh2","2 chickenh3", "1 chickens2"}) +addWave(11,{"2 chickenh1","2 chickenh1b","1 chickenh2","2 chickenh3", "1 chickens2"}) +addWave(11,{"3 chickenc2"}) +addWave(11,{"3 chickenw1","3 chickenw1b", "3 chickenw1c", "3 chickenw1d"}) +addWave(11,{"3 chickens2"}) +addWave(11,{"1 chickena2", "2 chickenw2"}) +addWave(11,{"7 chickenw2"}) + +VERYEASY = "Chicken: Very Easy" +EASY = "Chicken: Easy" +NORMAL = "Chicken: Normal" +HARD = "Chicken: Hard" +VERYHARD = "Chicken: Very Hard" +EPIC = "Chicken: Epic!" +CUSTOM = "Chicken: Custom" +SURVIVAL = "Chicken: Survival" + +difficulties = { + [VERYEASY] = { + chickenSpawnRate = 100, + burrowSpawnRate = 120, + queenSpawnMult = 0, + angerBonus = 0.05, + expStep = 0, + lobberEMPTime = 0, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 7, + spawnChance = 0.25, + damageMod = 0.25, + }, + [EASY] = { + chickenSpawnRate = 100, + burrowSpawnRate = 120, + queenSpawnMult = 0, + angerBonus = 0.075, + expStep = 0.09375, + lobberEMPTime = 2.5, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 7, + spawnChance = 0.33, + damageMod = 0.5, + }, + + [NORMAL] = { + chickenSpawnRate = 80, + burrowSpawnRate = 105, + queenSpawnMult = 1, + angerBonus = 0.10, + expStep = 0.125, + lobberEMPTime = 4, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 9, + spawnChance = 0.4, + damageMod = 1, + }, + + [HARD] = { + chickenSpawnRate = 70, + burrowSpawnRate = 60, + queenSpawnMult = 1, + angerBonus = 0.125, + expStep = 0.25, + lobberEMPTime = 5, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 14, + spawnChance = 0.5, + damageMod = 1.1, + }, + + [VERYHARD] = { + chickenSpawnRate = 45, + burrowSpawnRate = 40, + queenSpawnMult = 3, + angerBonus = 0.15, + expStep = 0.4, + lobberEMPTime = 7.5, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 18, + spawnChance = 0.6, + damageMod = 1.25, + }, + [EPIC] = { + chickenSpawnRate = 120, + burrowSpawnRate = 30, + queenSpawnMult = 3, + angerBonus = 0.5, + expStep = 0.5, + lobberEMPTime = 10, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 50, + spawnChance = 0.75, + damageMod = 2, + }, + + [CUSTOM] = { + chickenSpawnRate = tonumber(Spring.GetModOptions().mo_custom_chickenspawn), + burrowSpawnRate = tonumber(Spring.GetModOptions().mo_custom_burrowspawn), + queenSpawnMult = tonumber(Spring.GetModOptions().mo_custom_queenspawnmult), + angerBonus = tonumber(Spring.GetModOptions().mo_custom_angerbonus), + expStep = (tonumber(Spring.GetModOptions().mo_custom_expstep) or 0.6) * -1, + lobberEMPTime = tonumber(Spring.GetModOptions().mo_custom_lobberemp), + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = tonumber(Spring.GetModOptions().mo_custom_minchicken), + spawnChance = (tonumber(Spring.GetModOptions().mo_custom_spawnchance) or 50) / 100, + damageMod = (tonumber(Spring.GetModOptions().mo_custom_damagemod) or 100) / 100, + }, + + [SURVIVAL] = { + chickenSpawnRate = 80, + burrowSpawnRate = 105, + queenSpawnMult = 1, + angerBonus = 0.1, + expStep = 0.125, + lobberEMPTime = 4, + chickenTypes = Copy(chickenTypes), + defenders = Copy(defenders), + chickensPerPlayer = 9, + spawnChance = 0.4, + damageMod = 1, + }, +} + + + +defaultDifficulty = 'Chicken: Custom' + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/AILoader.lua b/LuaRules/Gadgets/AILoader.lua index 12dde035f..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,14 +49,9 @@ Shard.AIsByTeamID = {} local AIs = Shard.AIs -- fake api object -api = shard_include("spring_lua/fakeapi") - --- AI class -shard_include("ai") +--api = shard_include("spring_lua/fakeapi") -- localization -local mAbs = math.abs -local tRemove = table.remove local spEcho = Spring.Echo local spGetTeamList = Spring.GetTeamList local spGetTeamInfo = Spring.GetTeamInfo @@ -52,14 +61,6 @@ local spGetTeamStartPosition = Spring.GetTeamStartPosition local spGetTeamUnits = Spring.GetTeamUnits local spGetAllUnits = Spring.GetAllUnits local spGetUnitTeam = Spring.GetUnitTeam -local spGetGameFrame = Spring.GetGameFrame -local spGetUnitPosition = Spring.GetUnitPosition -local spGetUnitHealth = Spring.GetUnitHealth - ---SYNCED CODE -if (gadgetHandler:IsSyncedCode()) then - -local activeCommands = {} local function prepareTheAI(thisAI) if not thisAI.modules then thisAI:Init() end @@ -68,61 +69,31 @@ local function prepareTheAI(thisAI) map = thisAI.map end -local function AddActiveCommand(unitID, cmdID, cmdParams) - local frame = spGetGameFrame() - local x, y, z = spGetUnitPosition(unitID) - activeCommands[#activeCommands+1] = { - unitID = unitID, - cmdID = cmdID, - cmdParams = cmdParams, - frame = frame, - nextCheck = frame + 150, - lastX = x, - lastY = y, - lastZ = z, - } -end - -local function RemoveActiveCommands(unitID, cmdID, cmdParams) - for i = #activeCommands, 1, -1 do - local ac = activeCommands[i] - if (not unitID or ac.unitID == unitID) and (not cmdID or ac.cmdID == cmdID) then - local match = true - if cmdParams then - for ip = 1, #cmdParams do - if cmdParams[ip] ~= ac.cmdParams[ip] then - match = false - break - end - end - end - if match then - -- Spring.Echo("removed active command", ac.unitID, ac.cmdID, ac.cmdParams[1], ac.cmdParams[2], ac.cmdParams[3]) - tRemove(activeCommands, i) - end - end - end -end +--SYNCED CODE +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 = AI() + thisAI = ShardAI() thisAI.id = id thisAI.allyId = allyId -- thisAI:Init() @@ -131,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 @@ -148,21 +121,24 @@ 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 - local frame = spGetGameFrame() - if frame > 0 then + if Spring.GetGameFrame() > 1 then self:GameStart() -- catch up to current units - for _,uID in ipairs(spGetAllUnits()) do - self:UnitCreated(uID, Spring.GetUnitDefID(uID), Spring.GetUnitTeam(uID)) - self:UnitFinished(uID, Spring.GetUnitDefID(uID), Spring.GetUnitTeam(uID)) + for _,uId in ipairs(spGetAllUnits()) do + self:UnitCreated(uId, Spring.GetUnitDefID(uId), Spring.GetUnitTeam(uId)) + self:UnitFinished(uId, Spring.GetUnitDefID(uId), Spring.GetUnitTeam(uId)) end end end -function gadget:GameStart() +function gadget:GameStart() -- Initialise AIs for _,thisAI in ipairs(AIs) do local _,_,_,isAI,side = spGetTeamInfo(thisAI.id) @@ -175,193 +151,115 @@ end function gadget:GameFrame(n) - for i = #activeCommands, 1, -1 do - local ac = activeCommands[i] - if n == ac.nextCheck then - local x, y, z = spGetUnitPosition(ac.unitID) - if (ac.lastX == x and ac.lastZ == z) or (mAbs(x-ac.lastX) + mAbs(z-ac.lastZ) < 10) then - -- unit move failed - tRemove(activeCommands, i) - local unit = Shard:shardify_unit(ac.unitID) - if unit then - for _,thisAI in ipairs(AIs) do - prepareTheAI(thisAI) - thisAI:UnitMoveFailed(unit) - end - end - else - ac.lastX, ac.lastY, ac.lastZ = x, y, z - ac.nextCheck = n + 150 - end - end - end -- 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() end end -function gadget:UnitCreated(unitID, unitDefID, teamID, builderID) - local x, y, z = spGetUnitPosition(unitID) - -- Spring.Echo("unit created", builderID, -unitDefID, x, y, z) - RemoveActiveCommands(builderID, -unitDefID, {x, y, z}) - local udef = UnitDefs[unitDefID] + +function gadget:UnitCreated(unitId, unitDefId, teamId, builderId) -- for each AI... - local unit = Shard:shardify_unit(unitID) + local unit = Shard:shardify_unit(unitId) for _,thisAI in ipairs(AIs) do - prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitCreated(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitCreated(unit) - else - -- thisAI:EnemyUnitCreated(unit) - end + 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) + end + -- thisAI:UnitCreated(unitId, unitDefId, teamId, builderId) end end -function gadget:UnitDestroyed(unitID, unitDefID, teamID, attackerId, attackerDefId, attackerTeamId) - RemoveActiveCommands(unitID) +function gadget:UnitDestroyed(unitId, unitDefId, teamId, attackerId, attackerDefId, attackerTeamId) -- for each AI... - local unit = Shard:shardify_unit(unitID) + local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitDead(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitDead(unit) - else - -- thisAI:EnemyUnitDead(unit) - end + 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) end end -function gadget:UnitDamaged(unitID, unitDefID, unitTeamId, damage, paralyzer, weaponDefId, projectileId, attackerId, attackerDefId, attackerTeamId) +function gadget:UnitDamaged(unitId, unitDefId, unitTeamId, damage, paralyzer, weaponDefId, projectileId, attackerId, attackerDefId, attackerTeamId) -- for each AI... - local unit = Shard:shardify_unit(unitID) + local unit = Shard:shardify_unit(unitId) if unit then local attackerUnit = Shard:shardify_unit(attackerId) local damageObj = Shard:shardify_damage(damage, weaponDefId, paralyzer) for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitDamaged(unit, attackerUnit, damageObj) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitDamaged(unit, attackerUnit, damageObj) - else - -- thisAI:EnemyUnitDamaged(unit, attackerUnit, damageObj) - end - end + thisAI:UnitDamaged(unit, attackerUnit, damageObj) + -- thisAI:UnitDamaged(unitId, unitDefId, unitTeamId, attackerId, attackerDefId, attackerTeamId) + end end end -function gadget:UnitIdle(unitID, unitDefID, teamID) - RemoveActiveCommands(unitID) +function gadget:UnitIdle(unitId, unitDefId, teamId) -- for each AI... - local unit = Shard:shardify_unit(unitID) + local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitIdle(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitIdle(unit) - else - -- thisAI:EnemyUnitIdle(unit) - end - end - end -end - -function gadget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) - if #cmdParams == 3 and (cmdID < 0 or cmdID == CMD.MOVE) and not UnitDefs[unitDefID].isBuilding then - -- Spring.Echo("got position command", UnitDefs[unitDefID].name, unitID, cmdID, cmdParams[1], cmdParams[2], cmdParams[3]) - local _, _, _, _, buildProgress = spGetUnitHealth(unitID) - if buildProgress == 1 then - AddActiveCommand(unitID, cmdID, cmdParams) + thisAI:UnitIdle(unit) + -- thisAI:UnitIdle(unitId, unitDefId, teamId) end end end -function gadget:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) - if #cmdParams == 3 and (cmdID < 0 or cmdID == CMD.MOVE) and not UnitDefs[unitDefID].isBuilding then - -- Spring.Echo("position command done", UnitDefs[unitDefID].name, unitID, cmdID, cmdParams[1], cmdParams[2], cmdParams[3]) - RemoveActiveCommands(unitID, cmdID, cmdParams) - end -end -function gadget:UnitFinished(unitID, unitDefID, teamID) +function gadget:UnitFinished(unitId, unitDefId, teamId) -- for each AI... - local unit = Shard:shardify_unit(unitID) + local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do - -- thisAI:UnitFinished(unitID, unitDefID, teamID) + -- thisAI:UnitFinished(unitId, unitDefId, teamId) prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitBuilt(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitBuilt(unit) - else - -- thisAI:EnemyUnitBuilt(unit) - end + thisAI:UnitBuilt(unit) end end end -function gadget:UnitTaken(unitID, unitDefID, teamID, newTeamID) - local unit = Shard:shardify_unit(unitID) +function gadget:UnitTaken(unitId, unitDefId, teamId, newTeamId) + local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitDead(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitDead(unit) - else - -- thisAI:EnemyUnitDead(unit) - end + -- thisAI:UnitTaken(unitId, unitDefId, teamId, newTeamId) + thisAI:UnitDead(unit) end end end -function gadget:UnitGiven(unitID, unitDefID, teamID, oldTeamId) - local unit = Shard:shardify_unit(unitID) +function gadget:UnitGiven(unitId, unitDefId, teamId, oldTeamId) + local unit = Shard:shardify_unit(unitId) if unit then for _,thisAI in ipairs(AIs) do prepareTheAI(thisAI) - if teamID == thisAI.id then - thisAI:UnitGiven(unit) - elseif thisAI.alliedTeamIds[teamID] then - -- thisAI:AllyUnitGiven(unit) - else - -- thisAI:EnemyUnitGiven(unit) - end + -- thisAI:UnitCreated(unitId, unitDefId, teamId, oldTeamId) + thisAI:UnitCreated(unit) end end end @@ -388,91 +286,23 @@ end --UNSYNCED CODE else -local function sdAddRectangle(_, x1, z1, x2, z2, r, g, b, a, label, filled, teamID, channel) - if (Script.LuaUI('ShardDrawAddRectangle')) then - Script.LuaUI.ShardDrawAddRectangle(x1, z1, x2, z2, {r, g, b, a}, label, filled, teamID, channel) - end -end - -local function sdEraseRectangle(_, x1, z1, x2, z2, r, g, b, a, label, filled, teamID, channel) - if (Script.LuaUI('ShardDrawEraseRectangle')) then - Script.LuaUI.ShardDrawEraseRectangle(x1, z1, x2, z2, {r, g, b, a}, label, filled, teamID, channel) - end -end - -local function sdAddCircle(_, x, z, radius, r, g, b, a, label, filled, teamID, channel) - if (Script.LuaUI('ShardDrawAddCircle')) then - Script.LuaUI.ShardDrawAddCircle(x, z, radius, {r, g, b, a}, label, filled, teamID, channel) - end -end - -local function sdEraseCircle(_, x, z, radius, r, g, b, a, label, filled, teamID, channel) - if (Script.LuaUI('ShardDrawEraseCircle')) then - Script.LuaUI.ShardDrawEraseCircle(x, z, radius, {r, g, b, a}, label, filled, teamID, channel) - end -end - -local function sdAddLine(_, x1, z1, x2, z2, r, g, b, a, label, arrow, teamID, channel) - if (Script.LuaUI('ShardDrawAddLine')) then - Script.LuaUI.ShardDrawAddLine(x1, z1, x2, z2, {r, g, b, a}, label, arrow, teamID, channel) - end -end - -local function sdEraseLine(_, x1, z1, x2, z2, r, g, b, a, label, arrow, teamID, channel) - if (Script.LuaUI('ShardDrawEraseLine')) then - Script.LuaUI.ShardDrawEraseLine(x1, z1, x2, z2, {r, g, b, a}, label, arrow, teamID, channel) + function gadget:Initialize() + Spring.Echo("Shard AI unsync gadget init") + gadgetHandler:AddSyncAction("shard_debug_position", handleShardDebugPosEvent) end -end - -local function sdAddPoint(_, x, z, r, g, b, a, label, teamID, channel) - if (Script.LuaUI('ShardDrawAddPoint')) then - Script.LuaUI.ShardDrawAddPoint(x, z, {r, g, b, a}, label, teamID, channel) - end -end - -local function sdErasePoint(_, x, z, r, g, b, a, label, teamID, channel) - if (Script.LuaUI('ShardDrawErasePoint')) then - Script.LuaUI.ShardDrawErasePoint(x, z, {r, g, b, a}, label, teamID, channel) - end -end - -local function sdAddUnit(_, unitID, r, g, b, a, label, teamID, channel) - if (Script.LuaUI('ShardDrawAddUnit')) then - Script.LuaUI.ShardDrawAddUnit(unitID, {r, g, b, a}, label, teamID, channel) - end -end -local function sdEraseUnit(_, unitID, r, g, b, a, label, teamID, channel) - if (Script.LuaUI('ShardDrawEraseUnit')) then - Script.LuaUI.ShardDrawEraseUnit(unitID, {r, g, b, a}, label, teamID, channel) + function gadget:Shutdown() + Spring.Echo("Shard AI unsync gadget shutdown") + gadgetHandler:RemoveSyncAction("shard_debug_position") end -end - -local function sdClearShapes(_, teamID, channel) - if (Script.LuaUI('ShardDrawClearShapes')) then - Script.LuaUI.ShardDrawClearShapes(teamID, channel) - end -end -local function sdDisplay(_, onOff) - if (Script.LuaUI('ShardDrawDisplay')) then - Script.LuaUI.ShardDrawDisplay(onOff) + 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 -function gadget:Initialize() - gadgetHandler:AddSyncAction('ShardDrawAddRectangle', sdAddRectangle) - gadgetHandler:AddSyncAction('ShardDrawEraseRectangle', sdEraseRectangle) - gadgetHandler:AddSyncAction('ShardDrawAddCircle', sdAddCircle) - gadgetHandler:AddSyncAction('ShardDrawEraseCircle', sdEraseCircle) - gadgetHandler:AddSyncAction('ShardDrawAddLine', sdAddLine) - gadgetHandler:AddSyncAction('ShardDrawEraseLine', sdEraseLine) - gadgetHandler:AddSyncAction('ShardDrawAddPoint', sdAddPoint) - gadgetHandler:AddSyncAction('ShardDrawErasePoint', sdErasePoint) - gadgetHandler:AddSyncAction('ShardDrawAddUnit', sdAddUnit) - gadgetHandler:AddSyncAction('ShardDrawEraseUnit', sdEraseUnit) - gadgetHandler:AddSyncAction('ShardDrawClearShapes', sdClearShapes) - gadgetHandler:AddSyncAction('ShardDrawDisplay', sdDisplay) end - -end \ No newline at end of file diff --git a/LuaRules/Gadgets/Better_Ranged_Counted_Multi_Tech.lua b/LuaRules/Gadgets/Better_Ranged_Counted_Multi_Tech.lua index e1bd89a15..6b22e9ec2 100644 --- a/LuaRules/Gadgets/Better_Ranged_Counted_Multi_Tech.lua +++ b/LuaRules/Gadgets/Better_Ranged_Counted_Multi_Tech.lua @@ -905,7 +905,7 @@ if (gadgetHandler:IsSyncedCode()) then end local ICanHaz = CheckCmd(cmd,team,x,y,z) if not ICanHaz then - -- Spring.PlaySoundFile("sounds/moarpower.wav", 1, x, y, z) + -- Spring.PlaySoundFile("sounds/ui/moarpower.wav", 1, x, y, z) Spring.SpawnCEG("moarpower", x, y, z) end return ICanHaz @@ -920,7 +920,7 @@ if (gadgetHandler:IsSyncedCode()) then CanIHaz = CheckCmd(-ud,team,isBuilder) end if not CanIHaz then - -- Spring.PlaySoundFile("sounds/moarpower.wav", 5, x, y, z) + -- Spring.PlaySoundFile("sounds/ui/moarpower.wav", 5, x, y, z) end return CanIHaz end diff --git a/LuaRules/Gadgets/GRTS_repair.locals.lua b/LuaRules/Gadgets/GRTS_repair.locals.lua index dc54eed02..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,7 +33,19 @@ function gadget:GetInfo() end local repairUnits= { - [UnitDefNames.eorb.id] = {radius=1000,strength=2.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.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 @@ -56,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 @@ -110,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 @@ -129,7 +141,7 @@ function gadget:GameFrame(f) if x then local h = spGetUnitHeight(t) Spring.SpawnCEG("heal", x, y+h, z) - Spring.PlaySoundFile("sounds/heal.wav", 1, 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 ce7d16416..377acdce6 100644 --- a/LuaRules/Gadgets/GreenBean_sell.locals.lua +++ b/LuaRules/Gadgets/GreenBean_sell.locals.lua @@ -27,12 +27,12 @@ function gadget:GetInfo() date = "2008-06-12", license = "Public Domain", layer = 300, - enabled = true + enabled = false } end -local refundFactor = .5 --How much of the original price is returned -local sellFactor = 1 --Factor for the buildtime +local refundFactor = 0.5 --How much of the original price is returned +local sellFactor = 30 --Factor for the buildtime with original equation -- With set amount of time equation, this is the number of seconds it takes to sell something local CMD_SELL = 39867 if (gadgetHandler:IsSyncedCode()) then @@ -44,10 +44,11 @@ local min = math.min local sellDesc = { name="Sell", - tooltip="Sell the building for a partial refund", + tooltip=[[Sell a unit or building for a partial refund (Refund amount: ]] .. refundFactor .. [[). +Click stop (or press S) to cancel the sale.]], action="sell", type=CMDTYPE_ICON, - texture="bitmaps/ui/command_buttons/cmd_sell.png", + --texture="bitmaps/ui/command_buttons/cmd_sell.png", id=CMD_SELL, } @@ -62,7 +63,8 @@ function gadget:AllowCommand(u, ud, team, cmd, param, opt) if cmd == CMD_SELL then if not UnitDefs[ud].customParams.nosale then if not saleTime[u] then - saleTime[u]=GetGameFrame() + UnitDefs[ud].buildTime * 32 * sellFactor + --saleTime[u]=GetGameFrame() + UnitDefs[ud].buildTime * 32 * sellFactor -- Original equation + saleTime[u]=GetGameFrame() + (sellFactor * 30) -- New set amount of time equation elseif opt.right then saleTime[u]=nil end @@ -108,7 +110,7 @@ function gadget:GameFrame(frame) for i = 1,resCount do resources[teamId][i] = min(resources[teamId][i] + (unitCost[unitDefId][i] or 0) * refundFactor, capacity[teamId][i]) end - else + elseif teamId ~= nil then local currentMetal = Spring.GetTeamResources(teamId,"metal") -- If sell command happens as team is destroyed, gets nil instead of number for argument 1 local currentEnergy = Spring.GetTeamResources(teamId,"energy") local unitMetal = (UnitDefs[unitDefId].metalCost or 0) * refundFactor @@ -118,7 +120,7 @@ function gadget:GameFrame(frame) Spring.SetTeamResource(teamId, "m", currentMetal + unitMetal) Spring.SetTeamResource(teamId, "e", currentEnergy + unitEnergy) Spring.SpawnCEG('salvage', ux, uy, uz) - Spring.PlaySoundFile('sounds/chaching.wav', 5, ux, uy, uz) + Spring.PlaySoundFile('sounds/miscfx/chaching.wav', 5, ux, uy, uz) end end end diff --git a/LuaRules/Gadgets/RegenAI.lua b/LuaRules/Gadgets/RegenAI.lua deleted file mode 100644 index de11ab8e5..000000000 --- a/LuaRules/Gadgets/RegenAI.lua +++ /dev/null @@ -1,510 +0,0 @@ - --- status: --- 0 dead --- 1 construction queued --- 2 under construction --- 3 exiting factory --- 4 moving to position --- 5 assigning orders --- 6 all set! --- 7 morphing, such as a bug that self-destroy to create an exploit - --- When status is 1, the ID is the id of the builder - -function gadget:GetInfo() - return { - name = "Regenerative AI", - desc = "An AI that rebuild what it loses", - author = "zwzsg", - version = "1.3", - date = "4th of August 2009", - license = "Public Domain", - layer = 84, - enabled = true - } -end - -VFS.Include("LuaRules/Gadgets/libs/new_cmd_id.lua",nil) - -if (gadgetHandler:IsSyncedCode()) then ---SYNCED - - - -- Idle Packet / Counter Dispatch Data - local minBuffer = 18 -- don't auto-dispatch if less that this many packets in buffer - local dispatchCoolDown = 2 -- in seconds, wait at least this amount between two autodispatch from the same port/connection - local dispatchRange = 400 -- don't autodispatch if attacker is further than that - local maxIdleTime = 8 -- in seconds, auto bufferize packets if they have been idle for that amount of time - local notIdleIfEnemyInThatRange = 250 - local idleTimer={} - local dispatchTimer={} - local orders={} - - -- Regenerative AI Data and Functions - local RegenData={} - local AlreadyDispatching=false - local AlreadyFoundImpossible={} - - local function StoreIt(u,ud,x,z) - if Spring.GetUnitRulesParam(u,"NoRegenAI") then - return false - end - if UnitDefs[ud].needGeo then - -- Poorly written check: Check for any feature, not just datavent, and the area most likely doesn't exactly fit - local f=Spring.GetFeaturesInRectangle(x-16,z-16,x+16,z+16) - if f and #f>=1 then - return true - else - return false - end - end - return true - end - - - local function IsItOccupied(u1) - local ux1,_,uz1=Spring.GetUnitPosition(u1) - local ud1=UnitDefs[Spring.GetUnitDefID(u1)] - local usx1,usz1=ud1.xsize*8-4,ud1.zsize*8-4 - for _,u2 in ipairs(Spring.GetAllUnits()) do - local ud2=UnitDefs[Spring.GetUnitDefID(u2)] - if ud2.canMove==false or (ud2.speed or 0)<1 then - local ux2,_,uz2=Spring.GetUnitPosition(u2) - local usx2,usz2=ud2.xsize*8,ud2.zsize*8 - if math.abs(ux2 - ux1)=1 then - return true - else - return false - end - end - - - local function SaveRegenData(team) - local function AddOrder(q,id,params,options) - table.insert(q,{id=id,params=params,options=options}) - end - local function AddStateOrder(q,id,param) - table.insert(q,{id=id,params={param},options={}}) - end - local function AddQueue(q,queue) - local OrdersOnUnits={ - [CMD.ATTACK]=true, - [CMD.GUARD]=true, - [CMD.RECLAIM]=true, - [CMD.REPAIR]=true, - [CMD.CAPTURE]=true, - [CMD.LOAD_UNITS]=true, - [CMD.LOAD_ONTO]=true, - [CMD.UNLOAD_UNITS]=true, - [CMD.DEATHWAIT]=true, - } - for _,o in ipairs(queue) do - local id=o.id - local params={} - local options={} - local shifted=false - for _,param in ipairs(o.params) do - table.insert(params,param) - end - for _,option in ipairs(o.options) do - table.insert(options,option) - if option=="shift" then - shifted=true - end - end - if not shifted then - table.insert(options,"shift") - end - if #o.params==1 and OrdersOnUnits[o.id] and Spring.ValidUnitID(o.params[1]) then - id=CMD_IF_UNIT_IN_AREA - local TargetType=Spring.GetUnitDefID(o.params[1]) - local x,y,z=Spring.GetUnitPosition(o.params[1]) - params={o.id,TargetType,x,y,z,128,1} - -- order to redo, unitdef to look for, center, radius, blocking order - -- blocking = wait until there's a unit to guard/attack/etc.. - end - table.insert(q,{id=id,params=params,options=options}) - end - end - local _,_,_,_,_,_,CustomTeamOptions=Spring.GetTeamInfo(team) - if (string.lower(Spring.GetTeamLuaAI(team))==string.lower(gadget:GetInfo().name)) or - (CustomTeamOptions and CustomTeamOptions["aioverride"] and string.lower(CustomTeamOptions["aioverride"])==string.lower(gadget:GetInfo().name)) then - local UnitsWithOrders={} - for _,u in ipairs(Spring.GetTeamUnits(team)) do - local udid=Spring.GetUnitDefID(u) - local ud=UnitDefs[Spring.GetUnitDefID(u)] - local heading=Spring.GetUnitHeading(u) - local buildfacing=Spring.GetUnitBuildFacing(u) - local x,_,z=Spring.GetUnitPosition(u) - local states=Spring.GetUnitStates(u) - local q={} - -- Add extra orders to restore unit states - AddStateOrder(q,CMD.FIRE_STATE,states["firestate"]) - AddStateOrder(q,CMD.MOVE_STATE,states["movestate"]) - if states["cloak"]~=ud.startCloaked then - AddStateOrder(q,CMD.CLOAK,states["cloak"] and 1 or 0) - end - if states["active"]~=ud.activateWhenBuilt then - AddStateOrder(q,CMD.ONOFF,states["active"] and 1 or 0) - end - if (states["trajectory"] and 1 or 0)~=ud.highTrajectoryType then - AddStateOrder(q,CMD.TRAJECTORY,states["trajectory"] and 1 or 0) - end - -- Could add here restoration of autoland, autorepairlevel, loopbackattack states - -- New Worm state - if Spring.GetUnitRulesParam(u,"autohold") then - AddStateOrder(q,CMD_AUTOHOLD,Spring.GetUnitRulesParam(u,"autohold")>=1 and 1 or 0) - end - -- Old Worm and Old Bug state - if Spring.GetUnitRulesParam(u,"burrow") then - AddStateOrder(q,CMD_BURROW,Spring.GetUnitRulesParam(u,"burrow")>=1 and 1 or 0) - end - if states["repeat"] then - AddStateOrder(q,CMD_REPEAT,nil) - end - AddQueue(q,Spring.GetFactoryCommands(u) or {}) - AddQueue(q,Spring.GetUnitCommands(u) or {}) - for _,b in ipairs(Spring.GetFullBuildQueue(u) or {}) do - local unitDefID,count = next(b,nil) - for c=1,count,1 do - AddOrder(q,-unitDefID,{},{}) - end - end - -- Some units shan't be regenerated - if StoreIt(u,ud.id,x,z) then - table.insert(UnitsWithOrders,{status=6,name=ud.name,id=u,x=x,z=z,heading=heading,buildfacing=buildfacing,orders=q}) - end - end - table.sort( - UnitsWithOrders, - function(a,b) - return UnitDefNames[a.name].health>UnitDefNames[b.name].health - end - ) - RegenData[team]=UnitsWithOrders - end - end - - - - --function gadget:Initialize() - --end - - - function gadget:GameStart() - for _,team in ipairs(Spring.GetTeamList()) do - local _,_,_,_,_,_,CustomTeamOptions=Spring.GetTeamInfo(team) - if (string.lower(Spring.GetTeamLuaAI(team))==string.lower(gadget:GetInfo().name)) or - (CustomTeamOptions and CustomTeamOptions["aioverride"] and string.lower(CustomTeamOptions["aioverride"])==string.lower(gadget:GetInfo().name)) then - RegenData[team]={RegenAI=true} - end - end - end - - - - local function Regen(frame,uwoi,uwo,team) - if uwo.status==1 or uwo.status==7 then -- If unit was merely queued or destroyed for morphing - if RegenData[team][uwoi].timer+30*300 then - -- CanBuildIt=true - --end - local bdbo=UnitDefs[Spring.GetUnitDefID(b)].buildOptions - if bdbo and #bdbo>=1 then - local CanBuildIt=false - for _,buildable in ipairs(bdbo) do - if udid==buildable then - --Spring.SendMessageToTeam(team,UnitDefs[Spring.GetUnitDefID(b)].name.." has "..uwo.name.." in buildmenu") - CanBuildIt=true - break - end - end - if CanBuildIt and isUnitComplete(b) and - #(Spring.GetUnitCommands(b) or {})==0 and - #(Spring.GetCommandQueue(b) or {})==0 and - #(Spring.GetFactoryCommands(b) or {})==0 and - ((not dispatchTimer[b]) or (Spring.GetGameSeconds()>dispatchCoolDown+dispatchTimer[b])) then - local bx,_,bz=Spring.GetUnitPosition(b) - local d=(bx-uwo.x)^2+(bz-uwo.z)^2 - if not BuilderID or didleTimer[u]+maxIdleTime then - --BufferizePacket(u) - local closestID,closestDist = nil,nil - for _,tp in ipairs(Spring.GetTeamUnitsByDefs(Spring.GetUnitTeam(u),{teleporter})) do - if not closestID or Spring.GetUnitSeparation(u,tp)0.5 and RegenData[team] then - - end - end - - - function gadget:UnitDestroyed(u,ud,team,atk,atkd,atkteam) - if dispatchTimer[u] then - dispatchTimer[u]=nil - end - if idleTimer[u] then - idleTimer[u]=nil - end - for _,rgteam in ipairs(Spring.GetTeamList()) do - if RegenData[rgteam] then - for uwoi,uwo in ipairs(RegenData[rgteam]) do - if uwo.id==u then - if atk==ud and (UnitDefs[ud].name=="exploit" or UnitDefs[ud].name=="bug") then - RegenData[rgteam][uwoi].status=7 -- should be morphing and come back as a UnitCreated with a new ID - RegenData[rgteam][uwoi].timer=Spring.GetGameFrame() - else - RegenData[rgteam][uwoi].status=0 - --Spring.SendMessageToTeam(rgteam,"Lost a "..uwo.name) - end - end - end - end - end - end - - - function gadget:UnitTaken(u,ud,team,newteam) - if RegenData[team] then - if not Spring.AreTeamsAllied(team,newteam) then -- If the new owner is not allied with the AI - for uwoi,uwo in ipairs(RegenData[team]) do - if uwo.id==u then - RegenData[team][uwoi].status=0 - end - end - end - end - end - - - function gadget:UnitCreated(u,ud,team) - if RegenData[team] then - local WannabeIdx=nil - local WannabeDist=nil - for uwoi,uwo in ipairs(RegenData[team]) do - if (uwo.status==1 and uwo.name==UnitDefs[ud].name) - --or (uwo.status==0 and uwo.name==UnitDefs[ud].name and uwo.name=="packet") - --or (uwo.status==7 and (uwo.name=="bug" or uwo.name=="exploit") and (UnitDefs[ud].name=="bug" or UnitDefs[ud].name=="exploit")) - then - local x,_,z=Spring.GetUnitPosition(u) - local d=(x-uwo.x)^2+(z-uwo.z)^2 - if (not WannabeIdx) or d=1 or WannabeDist<28^2) then - --Spring.SendMessageToTeam(team,"New "..uwo.name.." found!") - RegenData[team][uwoi].id=u - RegenData[team][uwoi].status=2 -- under construction - if isUnitComplete(u) then - RegenData[team][uwoi].status=3 - end - end - end - end - - --function gadget:UnitFinished(u,ud,team) - --end - - -else ---UNSYNCED - -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 -- backup/autoreclaimbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/autoreclaimbehaviour.lua new file mode 100644 index 000000000..566f37476 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/autoreclaimbehaviour.lua @@ -0,0 +1,44 @@ +AutoReclaimBehaviour = class(Behaviour) + +function AutoReclaimBehaviour:Init() + -- + self.active = false +end + +function AutoReclaimBehaviour:UnitCreated(unit) +end + +function AutoReclaimBehaviour:UnitIdle(unit) + if unit:Internal():ID() == self.unit:Internal():ID() then + if self:IsActive() then + self.unit:ElectBehaviour() + end + end + +end + +function AutoReclaimBehaviour:Update() + --self.game:GetMapFeatures() +end + +function AutoReclaimBehaviour:Activate() + self.active = true + local fcount = self.game.map:GetMapFeatures(self.unit:Internal():GetPosition(),200) + self.unit:Internal():AreaReclaim(self.unit:Internal():GetPosition(),500) +end + +function AutoReclaimBehaviour:Deactivate() + self.active = false +end + +function AutoReclaimBehaviour:Priority() + --if self.build == true then + -- return 100 + --end + --return 0 + return 49 + self.game.map:GetMapFeatures(self.unit:Internal():GetPosition(),500) +end + +function AutoReclaimBehaviour:UnitDead(unit) + -- +end 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 -- backup/engineerturretbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/engineerturretbehaviour.lua new file mode 100644 index 000000000..35fbc4bbc --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/engineerturretbehaviour.lua @@ -0,0 +1,66 @@ +EngineerTurretBehaviour = class(Behaviour) + +function EngineerTurretBehaviour:Init() + -- + self.active = true + self.underfire = false +end + +function EngineerTurretBehaviour:UnitCreated(unit) +end + +function EngineerTurretBehaviour:UnitIdle(unit) + if unit:Internal():ID() == self.unit:Internal():ID() then + if self:IsActive() then + self.unit:ElectBehaviour() + end + end + +end + +function EngineerTurretBehaviour:Update() + -- +end + +function EngineerTurretBehaviour:Activate() + self.underfire = false + + local s = self.unit:Internal():Build("emine") + if s then + self.active = true + else + self.unit:ElectBehaviour() + end +end + +function EngineerTurretBehaviour:Deactivate() + self.underfire = false + + local s = self.unit:Internal():Build("emine") + if s then + self.active = true + else + self.unit:ElectBehaviour() + end +end + +function EngineerTurretBehaviour:Priority() + if self.underfire == true then + return 150 + end + return 0 +end + +function EngineerTurretBehaviour:UnitDead(unit) + -- +end + +function EngineerTurretBehaviour:UnitDamaged(unit,attacker) + if unit:Internal():ID() == self.unit:Internal():ID() then + if not self:IsActive() then + self.underfire = true + self.unit:ElectBehaviour() + end + end +end + diff --git a/LuaRules/Gadgets/ai/EvoRTS/factoryregisterbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/factoryregisterbehaviour.lua similarity index 78% rename from LuaRules/Gadgets/ai/EvoRTS/factoryregisterbehaviour.lua rename to LuaRules/Gadgets/ai/EvoRTS -- backup/factoryregisterbehaviour.lua index d071d8f51..b9dfe15fe 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/factoryregisterbehaviour.lua +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/factoryregisterbehaviour.lua @@ -4,7 +4,7 @@ function FactoryRegisterBehaviour:Init() -- end -function FactoryRegisterBehaviour:OwnerBuilt() +function FactoryRegisterBehaviour:UnitFinished(unit) if ai.factories ~= nil then ai.factories = ai.factories + 1 else @@ -12,8 +12,8 @@ function FactoryRegisterBehaviour:OwnerBuilt() end end -function FactoryRegisterBehaviour:OwnerIdle() - -- +function FactoryRegisterBehaviour:UnitIdle(unit) + end function FactoryRegisterBehaviour:Update() @@ -31,7 +31,7 @@ function FactoryRegisterBehaviour:Priority() return 0 end -function FactoryRegisterBehaviour:OwnerDead() +function FactoryRegisterBehaviour:UnitDead(unit) if ai.factories ~= nil then ai.factories = ai.factories - 1 else diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/lowenergybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/lowenergybehaviour.lua new file mode 100644 index 000000000..f6a69710e --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/lowenergybehaviour.lua @@ -0,0 +1,73 @@ +LowEnergyBehaviour = class(Behaviour) + +function LowEnergyBehaviour:Init() + -- + self.active = false + self.underfire = false +end + +function LowEnergyBehaviour:UnitCreated(unit) +end + +function LowEnergyBehaviour:UnitIdle(unit) + if unit:Internal():ID() == self.unit:Internal():ID() then + + if not self:IsActive() then + res = game:GetResourceByName("energy") + if res == nil then + game:SendToConsole("res == nil in LowEnergyBehaviour") + else + if res.reserves == 0 then + self.underfire = true + self.unit:ElectBehaviour() + end + end + else + self.underfire = false + self.unit:ElectBehaviour() + end + + end + if unit:Internal():ID() == self.unit:Internal():ID() then + if self:IsActive() then + self.unit:ElectBehaviour() + end + end + +end + +function LowEnergyBehaviour:Update() + -- +end + +function LowEnergyBehaviour:Activate() + self.underfire = false + + local s = self.unit:Internal():Build("emediumgen") + if s then + self.active = true + else + self.unit:ElectBehaviour() + end +end + +function LowEnergyBehaviour:Deactivate() + self.active = false + self.underfire = false +end + +function LowEnergyBehaviour:Priority() + if self.underfire == true then + return 110 + end + return 0 +end + +function LowEnergyBehaviour:UnitDead(unit) + -- +end + +function LowEnergyBehaviour:UnitDamaged(unit,attacker) + +end + diff --git a/LuaRules/Gadgets/ai/EvoRTS -- backup/missingfactorybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS -- backup/missingfactorybehaviour.lua new file mode 100644 index 000000000..a31dfb2c2 --- /dev/null +++ b/LuaRules/Gadgets/ai/EvoRTS -- backup/missingfactorybehaviour.lua @@ -0,0 +1,59 @@ +MissingFactoryBehaviour = class(Behaviour) + +function MissingFactoryBehaviour:Init() + -- + self.active = false + self.building = false + self.build = false +end + +function MissingFactoryBehaviour:UnitCreated(unit) +end + +function MissingFactoryBehaviour:UnitIdle(unit) + if unit:Internal():ID() == self.unit:Internal():ID() then + self.building = false + if self:IsActive() then + self.unit:ElectBehaviour() + end + end +end + +function MissingFactoryBehaviour:Update() + -- +end + +function MissingFactoryBehaviour:Activate() + self.build = false + + local s = self.unit:Internal():Build("ebasefactory") + if s then + self.active = true + self.building = true + else + self.unit:ElectBehaviour() + end +end + +function MissingFactoryBehaviour:Deactivate() + self.active = false + self.building = false + self.build = false +end + +function MissingFactoryBehaviour:Priority() + if self.build == true then + return 100 + end + return 0 +end + +function MissingFactoryBehaviour:UnitDead(unit) + if unit:Internal():Name() == "ebasefactory" then + self.build = true + --game:SendToConsole("missingfactory activated") + elseif unit:Internal():Name() == "ebasefactory" then + self.build = true + --game:SendToConsole("missingfactory activated") + end +end 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 486c17476..03e7ac25a 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/attackers.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/attackers.lua @@ -3,6 +3,81 @@ 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", @@ -13,15 +88,189 @@ attackerlist = { "eartytank", "eamphibrock", "eamphibarty", - "emediumtank3", + "eamphibneedle", + "emediumtank3", "eheavytank3", "eamphibmedtank", "eallterrmed", "eallterrheavy", - "eallterrassault", - "eriottank2", + "eallterrassault", + "eriottank2", "eamphibriot", "eallterrriot", - "eorb", - "edrone", + "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", + --------------------- 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/autoreclaimbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/autoreclaimbehaviour.lua deleted file mode 100644 index 989bbaf79..000000000 --- a/LuaRules/Gadgets/ai/EvoRTS/autoreclaimbehaviour.lua +++ /dev/null @@ -1,41 +0,0 @@ -AutoReclaimBehaviour = class(Behaviour) - -function AutoReclaimBehaviour:Init() - -- - self.active = false -end - -function AutoReclaimBehaviour:UnitCreated(unit) -end - -function AutoReclaimBehaviour:OwnerIdle() - if self:IsActive() then - self.unit:ElectBehaviour() - end -end - -function AutoReclaimBehaviour:Update() - --game:GetMapFeatures() -end - -function AutoReclaimBehaviour:Activate() - self.active = true - local fcount = game.map:GetMapFeatures(self.unit:Internal():GetPosition(),200) - self.unit:Internal():AreaReclaim(self.unit:Internal():GetPosition(),500) -end - -function AutoReclaimBehaviour:Deactivate() - self.active = false -end - -function AutoReclaimBehaviour:Priority() - --if self.build == true then - -- return 100 - --end - --return 0 - return 49 + game.map:GetMapFeatures(self.unit:Internal():GetPosition(),500) -end - -function AutoReclaimBehaviour:OwnerDead() - -- -end diff --git a/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua b/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua index 0795b4777..983f5fdf4 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/behaviours.lua @@ -1,69 +1,171 @@ -shard_include "taskqueues" -shard_include "taskqueuebehaviour" -shard_include "attackerbehaviour" -shard_include "pointcapturerbehaviour" ---require "missingfactorybehaviour" ---require "engineerturretbehaviour" ---require "autoreclaimbehaviour" ---require "lowenergybehaviour" ---require "factoryregisterbehaviour" +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( "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 behaviours = { - --eorb = { - -- AutoReclaimBehaviour, - --}, + xklab = { + TaskQueueBehaviour, + }, + zarm = { + TaskQueueBehaviour, + }, + zespire1 = { + TaskQueueBehaviour, + }, + zespire4 = { + TaskQueueBehaviour, + }, + zhive = { + TaskQueueBehaviour, + }, + esilo = { + NukeBehaviour, + }, + eorb = { + AttackerBehaviour, + }, + eorb_up1 = { + AttackerBehaviour, + }, + eorb_up2 = { + AttackerBehaviour, + }, + eorb_up3 = { + AttackerBehaviour, + }, + ebasefactory = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eairplant = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eamphibfac = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, eminifac = { TaskQueueBehaviour, - --FactoryRegisterBehaviour, }, - ecommanderai = { + 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, - --LowEnergyBehaviour, - --EngineerTurretBehaviour, }, + 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, + }, + 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 @@ -77,13 +179,19 @@ function defaultBehaviours(unit) end end else - if IsAttacker(unit) then - table.insert(b,AttackerBehaviour) - end - if IsPointCapturer(unit) then - table.insert(b,PointCapturerBehaviour) + 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 +end \ No newline at end of file diff --git a/LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua deleted file mode 100644 index b200853ba..000000000 --- a/LuaRules/Gadgets/ai/EvoRTS/engineerturretbehaviour.lua +++ /dev/null @@ -1,52 +0,0 @@ -EngineerTurretBehaviour = class(Behaviour) - -function EngineerTurretBehaviour:Init() - -- - self.active = false - self.underfire = false -end - -function EngineerTurretBehaviour:OwnerIdle() - if self:IsActive() then - self.unit:ElectBehaviour() - end -end - -function EngineerTurretBehaviour:Update() - -- -end - -function EngineerTurretBehaviour:Activate() - self.underfire = false - - local s = self.unit:Internal():Build("elightturret2") - if s then - self.active = true - else - self.unit:ElectBehaviour() - end -end - -function EngineerTurretBehaviour:Deactivate() - self.active = false - self.underfire = false -end - -function EngineerTurretBehaviour:Priority() - if self.underfire == true then - return 110 - end - return 0 -end - -function EngineerTurretBehaviour:OwnerDead() - -- -end - -function EngineerTurretBehaviour:OwnerDamaged(attacker) - if not self:IsActive() then - self.underfire = true - self.unit:ElectBehaviour() - end -end - 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/lowenergybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/lowenergybehaviour.lua deleted file mode 100644 index f80c7746d..000000000 --- a/LuaRules/Gadgets/ai/EvoRTS/lowenergybehaviour.lua +++ /dev/null @@ -1,57 +0,0 @@ -LowEnergyBehaviour = class(Behaviour) - -function LowEnergyBehaviour:Init() - -- - self.active = false - self.underfire = false -end - -function LowEnergyBehaviour:OwnerIdle() - if not self:IsActive() then - res = game:GetResourceByName("energy") - if res == nil then - game:SendToConsole("res == nil in LowEnergyBehaviour") - end - else - if res and res.reserves == 0 then - self.underfire = true - end - self.unit:ElectBehaviour() - end -end - -function LowEnergyBehaviour:Update() - -- -end - -function LowEnergyBehaviour:Activate() - self.underfire = false - - local s = self.unit:Internal():Build("esolar2") - if s then - self.active = true - else - self.unit:ElectBehaviour() - end -end - -function LowEnergyBehaviour:Deactivate() - self.active = false - self.underfire = false -end - -function LowEnergyBehaviour:Priority() - if self.underfire == true then - return 110 - end - return 0 -end - -function LowEnergyBehaviour:OwnerDead() - -- -end - -function LowEnergyBehaviour:OwnerDamaged(attacker) - -end - diff --git a/LuaRules/Gadgets/ai/EvoRTS/missingfactorybehaviour.lua b/LuaRules/Gadgets/ai/EvoRTS/missingfactorybehaviour.lua deleted file mode 100644 index 91649585f..000000000 --- a/LuaRules/Gadgets/ai/EvoRTS/missingfactorybehaviour.lua +++ /dev/null @@ -1,51 +0,0 @@ -MissingFactoryBehaviour = class(Behaviour) - -function MissingFactoryBehaviour:Init() - -- - self.active = false - self.building = false - self.build = false -end - -function MissingFactoryBehaviour:OwnerIdle() - self.building = false - if self:IsActive() then - self.unit:ElectBehaviour() - end -end - -function MissingFactoryBehaviour:Update() - -- -end - -function MissingFactoryBehaviour:Activate() - self.build = false - - local s = self.unit:Internal():Build("ebasefactory") - if s then - self.active = true - self.building = true - else - self.unit:ElectBehaviour() - end -end - -function MissingFactoryBehaviour:Deactivate() - self.active = false - self.building = false - self.build = false -end - -function MissingFactoryBehaviour:Priority() - if self.build == true then - return 100 - end - return 0 -end - -function MissingFactoryBehaviour:UnitDead(unit) - if unit:Internal():Name() == "ebasefactory" then - self.build = true - --game:SendToConsole("missingfactory activated") - end -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 2eb94bcbf..427ba18c5 100644 --- a/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua +++ b/LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua @@ -5,196 +5,1372 @@ Task Queues! math.randomseed( os.time() ) math.random(); math.random(); math.random() -local function AirOrLand() - local r = math.random(0,3) - if r == 0 then - return "eairplant" - elseif r == 1 then - return "ebasefactory" - elseif r == 2 then - return "eamphibfac" - else - return "eminifac" +--------------------------------------------- Functions for AI +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 +local skip = {action = "nexttask"} +local MaximumSupply = tonumber(Spring.GetModOptions().supplycap) +if MaximumSupply == nil then + MaximumSupply = 400 +end +--Spring.GetGameSeconds() -- checking gametime + +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 + +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 + +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 + +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 -local function StartFactory() - local r = math.random(0,3) - if r == 0 then +function AllFacs(tqb, ai, unit) + return GetFacs(tqb,ai,unit) + GetPlannedFacs(tqb, ai, unit) +end + + +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 + + +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") + 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 r == 1 then - return "ebasefactory" - elseif r == 2 then - return "eamphibfac" + 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 + 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 BuildSupply(tqb, ai, unit) + --Spring.Echo([[Build Supply]]) + 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") + local sm = Spring.GetTeamRulesParam(ai.id, "supplyMax") + 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 ms < Spring.GetGameSeconds() and ms < 1000 then + return "estorage" + else + 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 + return "elightturret2" + end + 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 "eminifac" - end -end - -local factory = { - "elighttank3", - "elighttank3", - "elighttank3", - "elighttank3", - "elighttank3", - "eriottank2", - "eriottank2", - "eheavytank3", - "eheavytank3", - "eheavytank3", - "eheavytank3", - "eheavytank3", - "emissiletank", - "emissiletank", - "emissiletank", - "emissiletank", - "emissiletank", - "emissiletank", - "emissiletank", - "eartytank", - "eartytank", - "eengineer5", -} - -local firstEngineer = { - --{action = "wait", frames = 30} - AirOrLand, - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "emediumgen", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "emediumgen", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, --- "ecruisesilo", -} - -local engineers = { - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "emediumgen", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - AirOrLand, - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "estorage", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "emediumgen", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, - "efusion2", - { action = "moverelative", position = {x = math.random(-750, 750), y = math.random(-750, 750), z = math.random(-750, 750)} }, --- "ecruisesilo", -} - -local airplant = { - "egunship2", - "egunship2", - "egunship2", - "egunship2", - "efighter", - "efighter", - "ebomber", - "ebomber", - "egunship2", - "egunship2", - "egunship2", - "egunship2", - "efighter", - "efighter", - "ebomber", - "ebomber", - "eairengineer", -} - -local amphibfactory = { - "eamphibbuggy", - "eamphibbuggy", - "eamphibbuggy", - "eamphibbuggy", - "eamphibbuggy", - "eamphibriot", - "eamphibriot", - "eamphibneedle", - "eamphibneedle", - "eamphibneedle", - "eamphibneedle", - "eamphibmedtank", - "eamphibmedtank", - "eamphibmedtank", - "eamphibrock", - "eamphibrock", - "eamphibrock", - "eamphibrock", - "eamphibrock", - "eamphibrock", - "eamphibarty", - "eamphibarty", - "eamphibengineer", -} - -local allterrfactory = { - "eallterrlight", - "eallterrlight", - "eallterrlight", - "eallterrlight", - "eallterrlight", - "eallterrriot", - "eallterrriot", - "eallterrmed", - "eallterrmed", - "eallterrmed", - "eallterrmed", - "eallterrheavy", - "eallterrheavy", - "eallterrheavy", - "eallterrheavy", - "eallterrheavy", - "eallterrheavy", - "eallterrassault", - "eallterrengineer", -} - -local function engineerlist(beh) - if ai.engineerfirst == true then - return engineers - else - ai.engineerfirst = true - return firstEngineer - end + 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 unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2",} + return unitoptions[math.random(1,#unitoptions)] + end + 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 unitoptions = {"emine", "escoutdrone", "eradar2", "ebox", "ejammer2",} + return unitoptions[math.random(1,#unitoptions)] + end + 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 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 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 +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 + else + 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 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 + end + 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 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 + 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 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 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 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 + 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 + 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, +-- } + +---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 = { + BuildEngineers, + BuildTurret, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildEngineers, + BuildTurret, +} + +local overseerorders = { + BuildFactory, + BuildTechFacility, + BuildEnergy, + BuildTurret, + MoveToRandomStartBoxLocation, +} + +local lifterlist = { + BuildFactory, + BuildMex, + BuildTurret, + MoveToRandomStartBoxLocation, + BuildFactory, + BuildEnergy, + BuildSupply, + BuildTurret, + BuildEngineers, + BuildSupport, + BuildMex, + BuildTurret, + BuildEnergy, + BuildSupply, + BuildEngineers, + BuildSupport, +} + +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 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 + +------------------------------------------------- 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 function ZaalMorph(tqb, ai, unit) + return ezMorph +end + + +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) + + 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 PatternCommander + else + ai.engineerfirst = true + 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 = { - ecommanderai = engineerlist, - ebasefactory = factory, - eengineer5 = engineerlist, - eallterrengineer = engineerlist, - eamphibengineer = engineerlist, - eairengineer = engineerlist, - eairplant = airplant, - eamphibfac = amphibfactory, - eminifac = allterrfactory, + --builders + ecommanderbattleai = overseerqueue, + 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, } +---------------------------------------------------------- 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 77dc0ae62..fae4edccd 100644 --- a/LuaRules/Gadgets/ai/ai.lua +++ b/LuaRules/Gadgets/ai/ai.lua @@ -1,25 +1,17 @@ -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()) + self.game:SendToConsole("Shard by AF - playing: "..self.game:GameName().." on: "..self.map:MapName()) - ai = self - game = self.game - map = self.map - - 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 @@ -35,7 +27,7 @@ function AI:Init() end end -function AI:Update() +function ShardAI:Update() if self.gameend == true then return end @@ -48,7 +40,7 @@ function AI:Update() end end -function AI:GameMessage(text) +function ShardAI:GameMessage(text) if self.gameend == true then return end @@ -61,7 +53,7 @@ function AI:GameMessage(text) end end -function AI:UnitCreated(engineunit) +function ShardAI:UnitCreated(engineunit) if self.gameend == true then return end @@ -74,7 +66,7 @@ function AI:UnitCreated(engineunit) end end -function AI:UnitBuilt(engineunit) +function ShardAI:UnitBuilt(engineunit) if self.gameend == true then return end @@ -87,7 +79,7 @@ function AI:UnitBuilt(engineunit) end end -function AI:UnitDead(engineunit) +function ShardAI:UnitDead(engineunit) if self.gameend == true then return end @@ -99,20 +91,21 @@ function AI:UnitDead(engineunit) end end -function AI:UnitIdle(engineunit) +function ShardAI:UnitIdle(engineunit) if self.gameend == true then return end if engineunit == nil then self.game:SendToConsole("shard-warning: idle engineunit nil") return - end + end + for i,m in ipairs(self.modules) do m:UnitIdle(engineunit) end end -function AI:UnitDamaged(engineunit,engineattacker,enginedamage) +function ShardAI:UnitDamaged(engineunit,engineattacker,enginedamage) if self.gameend == true then return end @@ -125,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 @@ -137,14 +130,14 @@ 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) diff --git a/LuaRules/Gadgets/ai/attackerbehaviour.lua b/LuaRules/Gadgets/ai/attackerbehaviour.lua index 370b521dd..f86d00d2d 100644 --- a/LuaRules/Gadgets/ai/attackerbehaviour.lua +++ b/LuaRules/Gadgets/ai/attackerbehaviour.lua @@ -12,22 +12,22 @@ end AttackerBehaviour = class(Behaviour) function AttackerBehaviour:Init() - --game:SendToConsole("attacker!") + --self.ai.game:SendToConsole("attacker!") end function AttackerBehaviour:OwnerBuilt() self.attacking = false - ai.attackhandler:AddRecruit(self) + self.ai.attackhandler:AddRecruit(self) end function AttackerBehaviour:OwnerDead() - ai.attackhandler:RemoveRecruit(self) + self.ai.attackhandler:RemoveRecruit(self) end function AttackerBehaviour:OwnerIdle() self.attacking = false - ai.attackhandler:AddRecruit(self) + self.ai.attackhandler:AddRecruit(self) end function AttackerBehaviour:AttackCell(cell) @@ -58,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:OwnerDead() - ai.attackhandler:RemoveRecruit(self) +function AttackerBehaviour:OwnerDied() + 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 c78f3f94c..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 @@ -22,7 +27,6 @@ function Behaviour:UnitDead(unit) end function Behaviour:OwnerDead() - return end function Behaviour:UnitDamaged(unit,attacker,damage) @@ -61,24 +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:IsActive() + return self.active +end + +function Behaviour:Name() + return 'Behaviour' end function Behaviour:EchoDebug(...) if self.DebugEnabled then - self.game:SendToConsole(self.unit:Internal():Name(), self.unit:Internal():ID(), ...) + self.game:SendToConsole(self.game:GetTeamID(), self:Name(), self.unit:Internal():Name(), self.unit:Internal():ID(), ...) end -end \ No newline at end of file +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 380f9fb21..898237c35 100644 --- a/LuaRules/Gadgets/ai/behaviours.lua +++ b/LuaRules/Gadgets/ai/behaviours.lua @@ -7,14 +7,17 @@ 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 IsPointCapturer(unit) then + if IsPointCapturer(unit, ai) then table.insert(b,PointCapturerBehaviour) end if IsAttacker(unit) then diff --git a/LuaRules/Gadgets/ai/boot.lua b/LuaRules/Gadgets/ai/boot.lua index b7dd08999..8440516dd 100644 --- a/LuaRules/Gadgets/ai/boot.lua +++ b/LuaRules/Gadgets/ai/boot.lua @@ -1,15 +1,21 @@ -- @TODO: Move top level logic out of ai.lua into here, and then make it load environment specific boot.lua files -if not ShardSpringLua then - -- globals - require("preload/globals") +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 -require( "ai.lua" ) +shard_include( "ai" ) -- create and use an AI if ShardSpringLua then - return AI() + return ShardAI() +elseif game_engine then + ai = ShardAI() else - ai = AI() + ai = ShardAI() + ai:Init() end diff --git a/LuaRules/Gadgets/ai/bootbehaviour.lua b/LuaRules/Gadgets/ai/bootbehaviour.lua index d3a63a566..ac6c2568f 100644 --- a/LuaRules/Gadgets/ai/bootbehaviour.lua +++ b/LuaRules/Gadgets/ai/bootbehaviour.lua @@ -13,11 +13,16 @@ 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:OwnerBuilt() @@ -47,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 new file mode 100644 index 000000000..196d8840f --- /dev/null +++ b/LuaRules/Gadgets/ai/capturerbehaviour.lua @@ -0,0 +1,68 @@ +function IsCapturer(unit, ai) + local noncapturelist = ai.game:NonCapturingUnits() + 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.map:AreControlPoints() + self.maxDist = math.ceil( self.game: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/modules.lua b/LuaRules/Gadgets/ai/modules.lua index ea20deedf..247804c70 100644 --- a/LuaRules/Gadgets/ai/modules.lua +++ b/LuaRules/Gadgets/ai/modules.lua @@ -2,6 +2,7 @@ shard_include( "spothandler" ) shard_include( "controlpointhandler" ) shard_include( "unithandler" ) shard_include( "attackhandler" ) +shard_include( "placementhandler" ) shard_include( "sleep" ) -modules = { UnitHandler, AttackHandler, ControlPointHandler, MetalSpotHandler, 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 index 93663c335..6b2c6883e 100644 --- a/LuaRules/Gadgets/ai/pointcapturerbehaviour.lua +++ b/LuaRules/Gadgets/ai/pointcapturerbehaviour.lua @@ -1,5 +1,5 @@ -function IsPointCapturer(unit) - local noncapturelist = game:ControlPointNonCapturingUnits() +function IsPointCapturer(unit, ai) + local noncapturelist = ai.game:ControlPointNonCapturingUnits() for i = 1, #noncapturelist do local name = noncapturelist[i] if name == unit:Internal():Name() then @@ -26,9 +26,11 @@ function PointCapturerBehaviour:Init() self.minDist = math.ceil( self.maxDist / 3 ) end -function PointCapturerBehaviour:OwnerIdle() +function PointCapturerBehaviour:UnitIdle(unit) if not self.active then return end - self:GoForth() + if unit.engineID == self.unit.engineID then + self:GoForth() + end end function PointCapturerBehaviour:Update() 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 745fcb1d5..000000000 --- a/LuaRules/Gadgets/ai/preload/globals.lua +++ /dev/null @@ -1,52 +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 - return VFS.Include(gameFile) - elseif VFS.FileExists(baseFile) then - return VFS.Include(baseFile) - elseif VFS.FileExists(preloadFile) then - 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" - shard_include "spring_lua/controlpoint" -else - shard_include "spring_native/unit" - shard_include "spring_native/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 5355c9461..ffd0b9651 100644 --- a/LuaRules/Gadgets/ai/preload/module.lua +++ b/LuaRules/Gadgets/ai/preload/module.lua @@ -10,12 +10,6 @@ end function Module:EchoDebug(...) if self.DebugEnabled then - self.game:SendToConsole(self:Name(), ...) + self.game:SendToConsole(self.game:GetTeamID(), self:Name(), ...) end end - -function Module: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/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 index 6df2d9aed..1b14cc033 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/boot.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/boot.lua @@ -1 +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/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 db3c14243..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 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 a0bce7adb..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,26 @@ 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 = {} 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 f161512e8..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 ShardSpringUnit:IsAlive() - return not Spring.GetUnitIsDead(self.id) +function ShardUnit:Stunned() + local stunned_or_inbuild, stunned, inbuild = Spring.GetUnitIsStunned(self.id) + return stunned end +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 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 ShardSpringUnit:Move(p) +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 ShardUnit:MoveAndPatrol(p) + Spring.GiveOrderToUnit( self.id, CMD.PATROL, { p.x, p.y, p.z }, {} ) + return true +end -function ShardSpringUnit:Build(t, p) -- IUnitType* +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 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 ShardSpringUnit:AreaReclaim( p, radius )--Position p, double radius) +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 ShardSpringUnit:GetPosition() +function ShardUnit:Roam() + Spring.GiveOrderToUnit( self.id, CMD.MOVE_STATE, { 2 }, {} ) + return true +end + +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 @@ -226,13 +414,13 @@ function ShardSpringUnit:ExecuteCustomCommand( cmdId, params_list, options, tim return 0 end -function ShardSpringUnit:DrawHighlight( color, label, channel ) +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 ShardSpringUnit:EraseHighlight( color, label, channel ) +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) @@ -293,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 08e8eb9dd..5421ccdbe 100644 --- a/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua +++ b/LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua @@ -1,32 +1,57 @@ -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) +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 @@ -41,10 +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 -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 2d19aff52..8ece7162e 100644 --- a/LuaRules/Gadgets/ai/spothandler.lua +++ b/LuaRules/Gadgets/ai/spothandler.lua @@ -10,7 +10,7 @@ function MetalSpotHandler:internalName() end function MetalSpotHandler:Init() - self.spots = game.map:GetMetalSpots() + self.spots = self.game.map:GetMetalSpots() end function distance(pos1,pos2) @@ -24,12 +24,12 @@ function MetalSpotHandler:ClosestFreeSpot(unittype,position) local pos = nil 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 diff --git a/LuaRules/Gadgets/ai/taskqueuebehaviour.lua b/LuaRules/Gadgets/ai/taskqueuebehaviour.lua index 90f1ea0fa..44944cc3c 100644 --- a/LuaRules/Gadgets/ai/taskqueuebehaviour.lua +++ b/LuaRules/Gadgets/ai/taskqueuebehaviour.lua @@ -9,41 +9,57 @@ 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:OwnerBuilt() +function TaskQueueBehaviour:OwnerBuilt(unit) if not self:IsActive() then return end - self.progress = true + self:OnToNextTask() end -function TaskQueueBehaviour:OwnerIdle() +function TaskQueueBehaviour:OwnerIdle(unit) if not self:IsActive() then return end - self.progress = true self.countdown = 0 + self:OnToNextTask() end -function TaskQueueBehaviour:OwnerMoveFailed() +function TaskQueueBehaviour:OwnerMoveFailed(unit) if not self:IsActive() then return end - self:OwnerIdle() + self:OwnerIdle(unit) end function TaskQueueBehaviour:OwnerDead() if self.waiting ~= nil then for k,v in pairs(self.waiting) do - ai.modules.sleep.Kill(self.waiting[k]) + self.ai.modules.sleep.Kill(self.waiting[k]) end end self.waiting = nil @@ -53,7 +69,6 @@ end function TaskQueueBehaviour:GetQueue() q = taskqueues[self.name] if type(q) == "function" then - --game:SendToConsole("function table found!") q = q(self) end return q @@ -61,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 @@ -80,81 +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 - 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() @@ -169,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 6a74fda15..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() @@ -51,10 +50,11 @@ function Unit:UnitBuilt(unit) for k,v in pairs(self.behaviours) do v:UnitBuilt(unit) end - end + end end function Unit:UnitDead(unit) + if unit.engineID == self.engineID then if self.behaviours then -- game:SendToConsole("unit died, removing behaviours", self.engineID, self:Internal():Name()) @@ -139,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 c048b04fc..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 987d7066c..7d8bfd450 100644 --- a/LuaRules/Gadgets/api_custom_unit_shaders.lua +++ b/LuaRules/Gadgets/api_custom_unit_shaders.lua @@ -18,13 +18,10 @@ function gadget:GetInfo() date = "2008,2009,2010,2016", license = "GNU GPL, v2 or later", layer = 1, - enabled = false -- loaded by default? + enabled = true -- loaded by default? } end -local engineIsMin97 = (Script.IsEngineMinVersion and Script.IsEngineMinVersion(96,0,1)) -local engineIsMin101 = (Script.IsEngineMinVersion and Script.IsEngineMinVersion(101,0,0)) - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Synced @@ -33,61 +30,6 @@ local engineIsMin101 = (Script.IsEngineMinVersion and Script.IsEngineMinVersion( if (gadgetHandler:IsSyncedCode()) then - -if (not engineIsMin97) then - function gadget:UnitFinished(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_finished", unitID, unitDefID,teamID) - end - - function gadget:UnitDestroyed(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_destroyed", unitID, unitDefID,teamID) - end - - function gadget:UnitGiven(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_given", unitID, unitDefID,teamID) - end - - function gadget:UnitCloaked(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_cloak", unitID, unitDefID,teamID) - end - - function gadget:UnitDecloaked(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_decloak", unitID, unitDefID,teamID) - end - - function gadget:GameFrame() - for i,uid in ipairs(Spring.GetAllUnits()) do - if not select(3,Spring.GetUnitIsStunned(uid)) then --// inbuild? - gadget:UnitFinished(uid,Spring.GetUnitDefID(uid),Spring.GetUnitTeam(uid)) - end - end - gadgetHandler:RemoveCallIn('GameFrame') - end -end - - function gadget:UnitReverseBuild(unitID,unitDefID,teamID) - SendToUnsynced("unitshaders_reverse", unitID, unitDefID,teamID) - end - - --// block first try, so we have enough time to disable the lua UnitRendering - --// else the model would be invisible for 1 gameframe - local blockFirst = {} - function gadget:AllowUnitBuildStep(builderID, builderTeam, unitID, unitDefID, part) - if (part < 0) then - local inbuild = not select(3,Spring.GetUnitIsStunned(unitID)) - if (not inbuild) then - gadget:UnitReverseBuild(unitID,unitDefID,Spring.GetUnitTeam(unitID)) - if (not blockFirst[unitID]) then - blockFirst[unitID] = true - return false - end - end - else - blockFirst[unitID] = nil - end - return true - end - return end @@ -104,14 +46,25 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -VFS.Include("luarules/utilities/unitrendering.lua", nil, 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 = {}, @@ -172,8 +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 @@ -199,10 +151,17 @@ local function CompileShader(shader, definitions, plugins) --// (this way we can modularize a shader and enable/disable features in it) if (definitions or shadows) then definitions = definitions or {} - definitions = table.concat(definitions, "\n") + hasVersion = false + for _, def in pairs(definitions) do + hasVersion = hasVersion or string.sub(def,1,string.len("#version")) == "#version" + end + if not hasVersion then + table.insert(definitions, 1, "#version 150 compatibility") + end if (shadows) then - definitions = definitions .. "\n" .. "#define use_shadows" .. "\n" + table.insert(definitions, "#define use_shadows") end + definitions = table.concat(definitions, "\n") .. "\n" if (shader.vertex) then shader.vertex = definitions .. shader.vertex; end if (shader.fragment) @@ -211,48 +170,83 @@ 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.shader) then - gl.DeleteShader(mat_src.shader) - end - mat_src.shader = GLSLshader - mat_src.cameraLoc = gl.GetUniformLocation(GLSLshader,"camera") - mat_src.cameraInvLoc = gl.GetUniformLocation(GLSLshader,"cameraInv") - mat_src.cameraPosLoc = gl.GetUniformLocation(GLSLshader,"cameraPos") - mat_src.shadowMatrixLoc = gl.GetUniformLocation(GLSLshader,"shadowMatrix") - mat_src.shadowParamsLoc = gl.GetUniformLocation(GLSLshader,"shadowParams") - mat_src.sunLoc = gl.GetUniformLocation(GLSLshader,"sunPos") - mat_src.frameLoc = gl.GetUniformLocation(GLSLshader,"frame2") - mat_src.speedLoc = gl.GetUniformLocation(GLSLshader,"speed") - 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 - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -262,11 +256,16 @@ local function GetObjectMaterial(rendering, objectDefID) return mat end + local matInfo = rendering.materialInfos[objectDefID] local mat = rendering.materialDefs[matInfo[1]] - matInfo.UNITDEFID = objectDefID - matInfo.FEATUREDEFID = -objectDefID + if type(objectDefID) == "number" then + -- Non-number objectDefIDs are default material overrides. They will have + -- their textures defined in the unit materials files. + matInfo.UNITDEFID = objectDefID + matInfo.FEATUREDEFID = -objectDefID + end --// find unitdef tex keyword and replace it --// (a shader can be just for multiple unitdefs, so we support this keywords) @@ -284,7 +283,7 @@ local function GetObjectMaterial(rendering, objectDefID) local texdl = gl.CreateList(function() for _,tex in pairs(texUnits) do local prefix = tex.tex:sub(1,1) - if (prefix~="%") + if (prefix~="%") and(prefix~="#") and(prefix~="!") and(prefix~="$") @@ -298,17 +297,17 @@ local function GetObjectMaterial(rendering, objectDefID) end local luaMat = rendering.spGetMaterial("opaque", { - shader = mat.shader, - cameraposloc = mat.cameraPosLoc, - cameraloc = mat.cameraLoc, - camerainvloc = mat.cameraInvLoc, - shadowloc = mat.shadowMatrixLoc, - shadowparamsloc = mat.shadowParamsLoc, - usecamera = mat.usecamera, - culling = mat.culling, - texunits = texUnits, - prelist = mat.predl, - postlist = mat.postdl, + standardshader = mat.standardShader, + deferredshader = mat.deferredShader, + + standarduniforms = mat.standardUniforms, + deferreduniforms = mat.deferredUniforms, + + usecamera = mat.usecamera, + culling = mat.culling, + texunits = texUnits, + prelist = mat.predl, + postlist = mat.postdl, }) rendering.bufMaterials[objectDefID] = luaMat @@ -319,7 +318,22 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -function ToggleShadows() +local function ResetUnit(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:RenderUnitDestroyed(unitID, unitDefID) + Spring.UnitRendering.DeactivateMaterial(unitID, 3) + if not select(3,Spring.GetUnitIsStunned(unitID)) then --// inbuild? + gadget:UnitFinished(unitID,unitDefID) + end +end + +local function ResetFeature(featureID) + gadget:FeatureDestroyed(featureID) + Spring.FeatureRendering.DeactivateMaterial(featureID, 3) + gadget:FeatureCreated(featureID) +end + +local function ToggleShadows() shadows = Spring.HaveShadows() CompileMaterialShaders() @@ -327,28 +341,18 @@ function ToggleShadows() unitRendering.bufMaterials = {} local units = Spring.GetAllUnits() for _, unitID in pairs(units) do - local unitDefID = Spring.GetUnitDefID(unitID) - local teamID = Spring.GetUnitTeam(unitID) - UnitDestroyed(nil, unitID) - Spring.UnitRendering.DeactivateMaterial(unitID, 3) - if not select(3,Spring.GetUnitIsStunned(unitID)) then --// inbuild? - UnitFinished(nil,unitID,unitDefID,teamID) - end + ResetUnit(unitID) end featureRendering.bufMaterials = {} local features = Spring.GetAllFeatures() for _, featureID in pairs(features) do - local featureDefID = Spring.GetFeatureDefID(featureID) - local teamID = Spring.GetFeatureTeam(featureID) - FeatureDestroyed(nil, featureID) - Spring.FeatureRendering.DeactivateMaterial(featureID, 3) - FeatureCreated(nil,featureID,featureDefID,teamID) + ResetFeature(featureID) end end -function ToggleAdvShading() +local function ToggleAdvShading() advShading = Spring.HaveAdvShading() if (not advShading) then @@ -356,13 +360,13 @@ function ToggleAdvShading() unitRendering.drawList = {} local units = Spring.GetAllUnits() for _,unitID in pairs(units) do - Spring.UnitRendering.DeactivateMaterial(unitID, 3) + ResetUnit(unitID) end featureRendering.drawList = {} local features = Spring.GetAllFeatures() for _, featureID in pairs(features) do - Spring.FeatureRendering.DeactivateMaterial(featureID, 3) + ResetFeature(featureID) end elseif (normalmapping) then --// reinitializes all shaders @@ -371,64 +375,40 @@ function ToggleAdvShading() end -function ToggleNormalmapping(_,_,_, playerID) - if (playerID ~= Spring.GetMyPlayerID()) then - return - end - - normalmapping = not normalmapping - Spring.SetConfigInt("NormalMapping", (normalmapping and 1) or 0) - Spring.Echo("Set NormalMapping to " .. tostring((normalmapping and 1) or 0)) - - 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:UnitDestroyed(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/" 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) --// insert synced actions - if (not engineIsMin97) then - gadgetHandler:AddSyncAction("unitshaders_finished", UnitFinished) - gadgetHandler:AddSyncAction("unitshaders_destroyed", RenderUnitDestroyed) - gadgetHandler:AddSyncAction("unitshaders_given", UnitGiven) - gadgetHandler:AddSyncAction("unitshaders_cloak", UnitCloaked) - gadgetHandler:AddSyncAction("unitshaders_decloak", UnitDecloaked) - end - gadgetHandler:AddSyncAction("unitshaders_reverse", UnitReverseBuild) + 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/boxcollector.lua b/LuaRules/Gadgets/boxcollector.lua deleted file mode 100644 index b64ca9710..000000000 --- a/LuaRules/Gadgets/boxcollector.lua +++ /dev/null @@ -1,86 +0,0 @@ -function gadget:GetInfo() - return { - name = "Box collector", - desc = "removes box features and gives resources to collecting player", - author = "MrSpontaneous (ak Pasha Wrangell) with help from JK; fixed by lurker (Dylan Petonke)", - date = "Nov 11 2007", - license = "GPL", - layer = 1, - enabled = true - } -end - -if (gadgetHandler:IsSyncedCode()) then ----synced---- - - local Box="ammobox" - local BoxId - local BoxesOnMap={} - local unitInRange={} - local Resources={} - local SpawnCEG = Spring.SpawnCEG - - function gadget:Initialize() - BoxId = FeatureDefNames[Box].id - Spring.Echo(Box, BoxId) - ud = Spring.GetAllFeatures () - for n,u in pairs(ud) do - if Spring.GetFeatureDefID(u) == BoxId then - BoxesOnMap[u] = 1 - end - end - end - - function gadget:GameFrame(f) - if f%10 == 1 then - for box,b in pairs(BoxesOnMap) do - local x,y,z = Spring.GetFeaturePosition(box) - local unitsInRange = Spring.GetUnitsInSphere(x,y,z, 500)--at x , y , z with radius 200 - for _,unit in ipairs(unitsInRange) do - if UnitDefs[Spring.GetUnitDefID(unit)].customParams.cancollect and select(5, Spring.GetUnitHealth(unit)) == 1 then - local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(box) --- [1] is metal, [3] is energy - Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", remM) - Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", remE) - Spring.DestroyFeature(box) - local fx, fy, fz = Spring.GetFeaturePosition(box) - Spring.PlaySoundFile("sounds/boxcollection.wav", 1, fx, fy, fz) - SpawnCEG("sparklegreenplus5", fx, fy, fz) - BoxesOnMap[box] = nil - break - end - if UnitDefs[Spring.GetUnitDefID(unit)].customParams.dronespawner and select(5, Spring.GetUnitHealth(unit)) == 1 then - Spring.CreateUnit("edrone", x, y, z, 0, Spring.GetUnitTeam(unit)) - Spring.DestroyFeature(box) - local fx, fy, fz = Spring.GetFeaturePosition(box) - Spring.PlaySoundFile("sounds/dronespawner.wav", 1, fx, fy, fz) - SpawnCEG("sparkleorangeplus1drone", fx, fy, fz) - BoxesOnMap[box] = nil - break - end - -- if (UnitDefs[Spring.GetUnitDefID(unit)].customParams.amphibdronespawner) then - -- Spring.CreateUnit("eamphibdrone", x, y, z, 0, Spring.GetUnitTeam(unit)) - -- Spring.DestroyFeature(box) - -- local fx, fy, fz = Spring.GetFeaturePosition(box) - -- Spring.PlaySoundFile("sounds/boxcollection.wav", 1, fx, fy, fz) - -- SpawnCEG("sparklegreen", fx, fy, fz) - -- BoxesOnMap[box] = nil - -- break - -- end - end - end - end - end - - function gadget:FeatureDestroyed(featureID, _) - if (BoxesOnMap[featureID]) then - BoxesOnMap[featureID] = nil - end - end - - function gadget:FeatureCreated(featureID, allyTeam) - if (Spring.GetFeatureDefID(featureID) == BoxId) then - BoxesOnMap[featureID] = 1 - end - end - -end diff --git a/LuaRules/Gadgets/camera_lockcamera.lua b/LuaRules/Gadgets/camera_lockcamera.lua new file mode 100644 index 000000000..1f7573d65 --- /dev/null +++ b/LuaRules/Gadgets/camera_lockcamera.lua @@ -0,0 +1,340 @@ +local versionNumber = "v2.91" + +function gadget:GetInfo() + return { + name = "CameraBroadcast", + desc = "sends your camera to others", + author = "Evil4Zerggin", + date = "16 January 2009", + license = "GNU LGPL, v2.1 or later", + layer = -5, + enabled = true + } +end + + +------------------------------------------------ +--config +------------------------------------------------ + +--broadcast + +local broadcastPeriod = 0.0833 --will send packet in this interval (s) + +------------------------------------------------ +--speedups +------------------------------------------------ +local GetCameraState = Spring.GetCameraState +local SetCameraState = Spring.SetCameraState +local GetCameraNames = Spring.GetCameraNames +local GetMouseState = Spring.GetMouseState +local GetLastUpdateSeconds = Spring.GetLastUpdateSeconds +local GetMyPlayerID = Spring.GetMyPlayerID +local GetMyAllyTeamID = Spring.GetMyAllyTeamID +local GetSpectatingState = Spring.GetSpectatingState +local GetPlayerInfo = Spring.GetPlayerInfo + +local SendLuaRulesMsg = Spring.SendLuaRulesMsg + +local SendCommands = Spring.SendCommands + +local Echo = Spring.Echo +local strGMatch = string.gmatch +local strSub = string.sub +local strLen = string.len +local strByte = string.byte +local strChar = string.char + +local floor = math.floor +local ceil = math.ceil +local max = math.max +local min = math.min + + +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 + + local validation = randomString(2) + _G.validationCam = validation + + function gadget:RecvLuaMsg(msg, playerID) + 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 +else + local totalTime = 0 + local timeSinceBroadcast = 0 + + local lastPacketSent + + local CAMERA_IDS = GetCameraNames() + local CAMERA_NAMES = {} + local CAMERA_STATE_FORMATS = {} + + local validation = SYNCED.validationCam + + ------------------------------------------------ + --H4X + ------------------------------------------------ + --[0, 254] -> char + local function CustomPackU8(num) + return strChar(num + 1) + end + + local function CustomUnpackU8(s, offset) + local byte = strByte(s, offset) + if byte then + return strByte(s, offset) - 1 + else + return nil + end + end + + --1 sign bit, 7 exponent bits, 8 mantissa bits, -64 bias, denorm, no infinities or NaNs, avoid zero bytes, big-Endian + local function CustomPackF16(num) + --vfsPack is little-Endian + local floatChars = vfsPackF32(num) + if not floatChars then return nil end + + local sign = 0 + local exponent = strByte(floatChars, 4) * 2 + local mantissa = strByte(floatChars, 3) * 2 + + local negative = exponent >= 256 + local exponentLSB = mantissa >= 256 + local mantissaLSB = strByte(floatChars, 2) >= 128 + + if negative then + sign = 128 + exponent = exponent - 256 + end + + if exponentLSB then + exponent = exponent - 126 + mantissa = mantissa - 256 + else + exponent = exponent - 127 + end + + if mantissaLSB then + mantissa = mantissa + 1 + end + + if exponent > 63 then + exponent = 63 + --largest representable number + mantissa = 255 + elseif exponent < -62 then + --denorm + mantissa = floor((256 + mantissa) * 2^(exponent + 62)) + --preserve zero-ness + if mantissa == 0 and num ~= 0 then + mantissa = 1 + end + exponent = -63 + end + + if mantissa ~= 255 then + mantissa = mantissa + 1 + end + + local byte1 = sign + exponent + 64 + local byte2 = mantissa + + return strChar(byte1, byte2) + end + + local function CustomUnpackF16(s, offset) + offset = offset or 1 + local byte1, byte2 = strByte(s, offset, offset + 1) + + if not (byte1 and byte2) then return nil end + + local sign = 1 + local exponent = byte1 + local mantissa = byte2 - 1 + local norm = 1 + + local negative = (byte1 >= 128) + + if negative then + exponent = exponent - 128 + sign = -1 + end + + if exponent == 1 then + exponent = 2 + norm = 0 + end + + local order = 2^(exponent - 64) + + return sign * order * (norm + mantissa / 256) + end + + ------------------------------------------------ + --packets + ------------------------------------------------ + + --does not allow spaces in keys; values are numbers + local function CameraStateToPacket(s) + + local name = s.name + local stateFormat = CAMERA_STATE_FORMATS[name] + local cameraID = CAMERA_IDS[name] + + if not stateFormat or not cameraID then return nil end + local result = PACKET_HEADER .. validation .. CustomPackU8(cameraID) .. CustomPackU8(s.mode) + + for i=1, #stateFormat do + local num = s[stateFormat[i]] + if not num then return end + result = result .. CustomPackF16(num) + end + + return result + end + + local function PacketToCameraState(p) + local offset = PACKET_HEADER_LENGTH + 1 + 2 + local cameraID = CustomUnpackU8(p, offset) + local mode = CustomUnpackU8(p, offset + 1) + local name = CAMERA_NAMES[cameraID] + local stateFormat = CAMERA_STATE_FORMATS[name] + if not (cameraID and mode and name and stateFormat) then + return nil + end + local result = { + name = name, + mode = mode, + } + + offset = offset + 2 + + for i=1, #stateFormat do + local num = CustomUnpackF16(p, offset) + + if not num then return nil end + + result[stateFormat[i]] = num + offset = offset + 2 + end + + return result + end + + + + ------------------------------------------------ + --callins + ------------------------------------------------ + + Echo(": Sorry for the camera switch spam, but this is the only reliable way to list camera states other than hardcoding them") + local prevCameraState = GetCameraState() + for name, num in pairs(CAMERA_IDS) do + CAMERA_NAMES[num] = name + SetCameraState({name=name,mode=num},0) + local packetFormat = {} + local packetFormatIndex = 1 + for stateindex in pairs(GetCameraState()) do + if stateindex ~= "mode" and stateindex ~= "name" then + packetFormat[packetFormatIndex] = stateindex + packetFormatIndex = packetFormatIndex +1 + end + end + CAMERA_STATE_FORMATS[name] = packetFormat + end + SetCameraState(prevCameraState,0) + --workaround a bug where minimap remains minimized because we switched to overview cam + SendCommands("minimap minimize") + + function gadget:Initialize() + gadgetHandler:AddSyncAction("cameraBroadcast", handleCameraBroadcastEvent) + end + + function gadget:Shutdown() + SendLuaRulesMsg(PACKET_HEADER) + gadgetHandler:RemoveSyncAction("cameraBroadcast") + end + + function handleCameraBroadcastEvent(_,playerID,msg) + local cameraState + --a packet consisting only of the header indicated that transmission has stopped + if msg ~= PACKET_HEADER then + cameraState = PacketToCameraState(msg) + if not cameraState then + Echo(": Bad packet recieved.") + return + end + 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) + if targetSpec or allyTeamID ~= GetMyAllyTeamID() then + return + end + end + if Script.LuaUI("CameraBroadcastEvent") then + Script.LuaUI.CameraBroadcastEvent(playerID,cameraState) + end + end + + function gadget:Update() + if Spring.GetGameFrame() == 0 then + return + end + + local dt = GetLastUpdateSeconds() + totalTime = totalTime + dt + timeSinceBroadcast = timeSinceBroadcast + dt + if timeSinceBroadcast < broadcastPeriod then + return + end + + local state = GetCameraState() + local msg = CameraStateToPacket(state) + + if not msg then + Echo(": Error creating packet!") + return + end + + --don't send duplicates + if msg ~= lastPacketSent then + SendLuaRulesMsg(msg) + lastPacketSent = msg + end + + timeSinceBroadcast = timeSinceBroadcast - broadcastPeriod + end +end + diff --git a/LuaRules/Gadgets/chickens_unit_progenitor.lua b/LuaRules/Gadgets/chickens_unit_progenitor.lua deleted file mode 100644 index 9e9f82a28..000000000 --- a/LuaRules/Gadgets/chickens_unit_progenitor.lua +++ /dev/null @@ -1,94 +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 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -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 spawnerConfig = include("gamedata/configs/survival_settings.lua") - - - local SMALLUNIT = UnitDefNames[spawnerConfig.smallUnit].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 > 25) - 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, spawnerConfig.testUnit, 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 - -- spawnChicken(2, unitID, "chickenh3", unitTeam) - -- elseif (unitDefID == BOSS_WHITE2) then - -- spawnChicken(2, unitID, "chickenh4", unitTeam) - -- end - end - -end \ No newline at end of file diff --git a/LuaRules/Gadgets/chickens_unit_set_neutral.lua b/LuaRules/Gadgets/chickens_unit_set_neutral.lua deleted file mode 100644 index a4f68cd3e..000000000 --- a/LuaRules/Gadgets/chickens_unit_set_neutral.lua +++ /dev/null @@ -1,67 +0,0 @@ -function gadget:GetInfo() - return { - name = "SetNeutral", - desc = "Sets Armoured Units to Neutral when closed", - author = "TheFatController", - date = "25 Nov 2008", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (not gadgetHandler:IsSyncedCode()) then - return -end - -local spawnerConfig = include("gamedata/configs/survival_settings.lua") - -local GetUnitCOBValue = Spring.GetUnitCOBValue -local SetUnitNeutral = Spring.SetUnitNeutral -local GetUnitStates = Spring.GetUnitStates -local neutralUnits = {} -local armourTurrets = {} - -for k,_ in pairs (spawnerConfig.defenders) do - armourTurrets[UnitDefNames[k].id] = true -end - -local UPDATE = 30 -local timeCounter = 15 - -function gadget:GameFrame(n) - if (n >= timeCounter) then - timeCounter = (n + UPDATE) - for unitID,neutral in pairs(neutralUnits) do - local armoured = (GetUnitCOBValue(unitID, 20) > 0) - if neutral and (not armoured) then - SetUnitNeutral(unitID, false) - neutralUnits[unitID] = false - elseif (not neutral) and armoured then - SetUnitNeutral(unitID, true) - neutralUnits[unitID] = true - end - end - end -end - -function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) - neutralUnits[unitID] = nil -end - -function gadget:UnitFinished(unitID, unitDefID, unitTeam) - if armourTurrets[unitDefID] then - if (GetUnitCOBValue(unitID, 20) == 1) then - SetUnitNeutral(unitID, true) - neutralUnits[unitID] = true - else - neutralUnits[unitID] = false - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/chickens_unit_spawner_defense.lua b/LuaRules/Gadgets/chickens_unit_spawner_defense.lua deleted file mode 100644 index a0164176b..000000000 --- a/LuaRules/Gadgets/chickens_unit_spawner_defense.lua +++ /dev/null @@ -1,1206 +0,0 @@ -function gadget:GetInfo() - return { - name = "BA Chicken Spawner", - desc = "Spawns burrows and chickens", - author = "TheFatController, quantum", - date = "16 November, 2008", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true - } -d - -if (gadgetHandler:IsSyncedCode()) then --- BEGIN SYNCED --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Speed-ups --- - - 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 GetGameSpeed = Spring.GetGameSpeed - 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 spGetLocalTeamID = Spring.GetLocalTeamID - - 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 queenLifePercent = 100 - local maxTries = 100 - local currentWave = 1 - local targetCache = 1 - local minBurrows = 1 - local timeOfLastSpawn = 0 - local timeOfLastFakeSpawn = 0 - local highTeam = 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 - local timeCounter = 0 - local queenAnger = 0 - local bonusPoints = 0 - local burrowSpawnProgress = 0 - local queenMaxHP = 0 - local chickenDebtCount = 0 - local firstSpawn = true - local showScoresOnce = true - local gameOver = false - local qMove = false - local computerTeams = {} - local humanTeams = {} - local disabledUnits = {} - local spawnQueue = {} - local idleOrderQueue = {} - local stunList = {} - local endScores = {} - local queenResistance = {} - local queenID - local chickenTeamID - local luaAI - local lsx1,lsz1,lsx2,lsz2 - local turrets = {} - local chickenBirths = {} - local failChickens = {} - local chickenTargets = {} - local burrows = {} - local AIfaction - - local spawnerConfig = include("gamedata/configs/survival_settings.lua") - - local SMALL_UNIT = UnitDefNames[spawnerConfig.smallUnit].id - local MEDIUM_UNIT = UnitDefNames[spawnerConfig.mediumUnit].id - local LARGE_UNIT = UnitDefNames[spawnerConfig.largeUnit].id - local REFERENCE_UNIT = UnitDefNames[spawnerConfig.referenceUnit].id - - local modes = spawnerConfig.modes - - 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 faction - - if(GetTeamLuaAI(teamID) ~= "") then -- we found a lua ai, lets get his team! - _, _, _, _, hooffaction = Spring.GetTeamInfo(teamID) - AIfaction = hooffaction - end - - local teamLuaAI = GetTeamLuaAI(teamID) - if (teamLuaAI and teamLuaAI ~= "") then - local _,_,_,_,_,_,CustomTeamOptions=Spring.GetTeamInfo(teamID) - if (not CustomTeamOptions) or (not CustomTeamOptions["aioverride"]) then - luaAI = teamLuaAI - if (modes[teamLuaAI] > highestLevel) then - highestLevel = modes[teamLuaAI] - end - chickenTeamID = teamID - computerTeams[teamID] = true - else - humanTeams[teamID] = true -- chickens lua bots overriden also count as "humanTeams" - end - elseif teamID~=GetGaiaTeamID() then - humanTeams[teamID] = true -- bots not chickens also count as "humanTeams" - end - end - - luaAI = modes[highestLevel] - - local gaiaTeamID = GetGaiaTeamID() - if not chickenTeamID then - -- no chickens, lets go! - return - else - computerTeams[gaiaTeamID] = nil - end - - humanTeams[gaiaTeamID] = nil - - local gameMode = Spring.GetModOptions().comm - local placerMode = false - - if spawnerConfig.badModes[gameMode] then - return false - end - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - -- - -- 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 - - 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 getSqrDistance(x1,z1,x2,z2) - local dx,dz = x1-x2,z1-z2 - return (dx*dx)+(dz*dz) - end - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - -- - -- Difficulty - -- - if AIfaction == '' or AIfaction == nil then - local sidedata = VFS.Include("gamedata/sidedata.lua") - --default to first faction in list - AIfaction = string.lower(sidedata[1].name) - end - - Spring.Echo(AIfaction, " AIfaction") - VFS.Include("gamedata/configs/" .. AIfaction .. "_spawn_defs.lua") - - local function SetGlobals(difficulty) - for key, value in pairs(gadget.difficulties[difficulty]) do - gadget[key] = value - end - gadget.difficulties = nil - end - - SetGlobals(luaAI or defaultDifficulty) -- set difficulty - - local expIncrement = ((SetCount(humanTeams) * expStep) / queenTime) - if expStep < 0 then expIncrement = ((expStep * -1) / queenTime) end - local nextWave = ((queenTime / 8) / 60) - local gracePenalty = math.max(math.floor(((gracePeriod - 220) / 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 - 220),0) / 3)) - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - -- - -- Game Rules - -- - local UPDATE = 30 - - 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.sub(UnitDefs[unitDefID].name,1,-2) - 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 - - - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - -- - -- Clean up - -- - - local function KillOldChicken() - for unitID, birthDate in pairs(chickenBirths) do - local age = (t - birthDate) - if (age > maxAge) then - if (unitID ~= queenID) then - DestroyUnit(unitID) - chickenCount = chickenCount - 1 - chickenDebtCount = chickenDebtCount + 1 - 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 - - local function CalculateScores() - local totalDamage = 0 - local teamScores = {} - local totalScore = bonusPoints - for teamID in pairs(humanTeams) do - local foo = Spring.GetTeamStatsHistory(teamID,0,t) - teamScores[teamID] = foo[#foo].damageDealt - totalDamage = totalDamage + teamScores[teamID] - local teamUnits = GetTeamUnits(teamID) - for _, unitID in pairs(teamUnits) do - local defID = GetUnitDefID(unitID) - if defID then - totalScore = totalScore + UnitDefs[defID].metalCost - totalScore = totalScore + (UnitDefs[defID].energyCost / 50) - end - end - end - for teamID in pairs(humanTeams) do - teamScores[teamID] = (teamScores[teamID] / totalDamage) - teamScores[teamID] = math.ceil((totalScore * teamScores[teamID])) - if (teamID > highTeam) then - highTeam = teamID - end - end - highTeam = (highTeam + 1) - return teamScores - end - - local function DisplayScores(scoreList) - Spring.Echo(" ") - Spring.Echo("Team Scores") - Spring.Echo("-----------") - for i = 0,highTeam,1 do - if scoreList[i] then - local teamID = i - local teamScore = scoreList[i] - local playerList = Spring.GetPlayerList(teamID, false) - if playerList[1] then - Spring.SendMessage("Team" .. teamID .. " () - " .. comma_value(teamScore) .. " Points") - else - Spring.Echo("Team" .. teamID .. " (AI) - " .. comma_value(teamScore) .. " Points") - 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 - 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) - if UnitDefs[defID] and (UnitDefs[defID].speed > 75) 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 - - local function ChooseTarget() - local humanTeamList = SetToList(humanTeams) - if (#humanTeamList == 0) then - return {mRandom(1,MAPSIZEX-1),0,mRandom(1,MAPSIZEZ-1)} - end - local isDead - - if targetCache then - isDead = GetUnitIsDead(targetCache) - else -- targetcache is nil, so dead! - isDead = true - end - - if (targetCacheCount >= nextSquadSize) or isDead 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 tries < 5 then - if targetCache then - local defID = GetUnitDefID(targetCache) - if UnitDefs[defID] and (UnitDefs[defID].speed > 75) then - slowunit = false - end - 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 targetCache then - return {GetUnitPosition(targetCache)} - else - return {100,100,100} - 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) - 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) - idleOrderQueue[unitID] = {cmd = CMD.GUARD, params ={burrowID}, opts = {}} - SetUnitBlocking(unitID, false) - turrets[unitID] = {burrowID, t} - burrows[burrowID] = burrows[burrowID] + 1 - - end - - - local function SpawnBurrow(number) - - if (queenID) then - return - end - - local unitDefID = UnitDefNames[burrowName].id - - for i=1, (number or 1) do - local x, z - local tries = 0 - repeat - if (burrowSpawnType == "initialbox") then - x = mRandom(lsx1, lsx2) - z = mRandom(lsz1, lsz2) - elseif ((burrowSpawnType == "alwaysbox") and (tries < (maxTries / 2))) then - x = mRandom(lsx1, lsx2) - z = mRandom(lsz1, lsz2) - else - x = mRandom(spawnSquare, MAPSIZEX - spawnSquare) - z = mRandom(spawnSquare, MAPSIZEZ - spawnSquare) - end - - local y = GetGroundHeight(x, z) - tries = tries + 1 - local blocking = TestBuildOrder(REFERENCE_UNIT, x, y, z, 1) - if (blocking == 2) and (burrowSpawnType == "avoid") 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) - - local unitID = CreateUnit(burrowName, x, 0, z, "n", chickenTeamID) - burrows[unitID] = 0 - SetUnitBlocking(unitID, false) - 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 - queenLifePercent = lifeCheck - SetGameRulesParam("queenLife", queenLifePercent) - end - end - - local function stunUnit(unitID, seconds) - seconds = (seconds * 30) - if stunList[unitID] then - seconds = math.max(stunList[unitID], seconds) - end - stunList[unitID] = seconds - SetUnitHealth(unitID, {paralyze=99999999}) - end - - local function SpawnQueen() - - 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) - - return CreateUnit(queenName, x, y, z, "n", chickenTeamID) - - end - - - local function Wave() - if gameOver then - return - end - - currentWave = math.min(math.ceil((((t-gracePeriod+queenAnger) / 60) / nextWave)), 8) - if currentWave > #waves then - currentWave = #waves - end - if queenID then - 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 - end - end - end - currentWave = 10 - end - - local cCount = 0 - for burrowID in pairs(burrows) do - if (t > (queenTime * 0.33)) then SpawnTurret(burrowID, bonusTurret) end - local squad = waves[currentWave][mRandom(1,#waves[currentWave])] - 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() > 0.5) 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 - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - -- - -- Get rid of the AI - -- - - local function DisableUnit(unitID) - Spring.MoveCtrl.Enable(unitID) - Spring.MoveCtrl.SetPosition(unitID, MAPSIZEX/2, 99999, MAPSIZEZ/2) - Spring.SetUnitStealth(unitID, true) - Spring.SetUnitNoDraw(unitID, true) - Spring.SetUnitNoSelect(unitID, true) - Spring.SetUnitNoMinimap(unitID, true) - Spring.SetUnitCloak(unitID, true) - SetUnitBlocking(unitID, false) - SetUnitHealth(unitID, {paralyze=99999999}) - 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:UnitMoveFailed(unitID, unitDefID, unitTeam) - if gameOver then - return - end - if (unitTeam ~= chickenTeamID) or (unitID == queenID) or idleOrderQueue[unitID] then - return - end - local px,py,pz = GetUnitPosition(unitID) - if failChickens[unitID] then - if (getSqrDistance(failChickens[unitID].x,failChickens[unitID].z,px,pz) < 5000) then - failChickens[unitID].count = failChickens[unitID].count + 1 - if (failChickens[unitID].count > 3) then - DestroyUnit(unitID, false, true) - chickenDebtCount = chickenDebtCount + 1 - chickenCount = chickenCount - 1 - return - end - else - failChickens[unitID].x = px - failChickens[unitID].z = pz - end - else - failChickens[unitID] = { x = px, z = pz, count = 1 } - end - if (mRandom(1,2) == 1) then - px = px + mRandom(50,100) - else - px = px - mRandom(50,100) - end - if (mRandom(1,2) == 1) then - pz = pz + mRandom(50,100) - else - pz = pz - mRandom(50,100) - end - idleOrderQueue[unitID] = {cmd = CMD.MOVE, params = {px,py,pz}, opts = {}} - end - - function gadget:UnitIdle(unitID, unitDefID, unitTeam) - if gameOver then - return - end - if (unitTeam == chickenTeamID) and (chickenDefTypes[unitDefID] or (unitID == queenID)) then - if not AttackNearestEnemy(unitID, unitDefID, unitTeam) then - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = ChooseTarget(), opts = {}} - if targetCache then - if GetUnitNeutral(targetCache) then - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {targetCache}, opts = {}} - end - addChickenTarget(unitID, targetCache) - end - end - end - end - - function gadget:UnitCreated(unitID, unitDefID, unitTeam) - if chickenTargets[unitID] then - chickenTargets[unitID] = nil - end - end - - function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, - weaponID, attackerID, attackerDefID, attackerTeam) - - if chickenBirths[attackerID] then - chickenBirths[attackerID] = t - end - if failChickens[attackerID] then - failChickens[attackerID] = nil - end - if failChickens[unitID] then - failChickens[unitID] = nil - end - - -- if (unitDefID == LOBBER) then - -- local nSpawn = false - -- if ((GetUnitHealth(unitID) < 2475) and (damage < (2000 + mRandom(1,500)))) then nSpawn = true end - if ((weaponID == JUNO) and (mRandom(1,2) == 1)) then - nSpawn = true - end - - if (unitID == queenID) then - if paralyzer then - SetUnitHealth(unitID, {paralyze=0}) - return - end - if (weaponID == -1) and (damage > 25000) then - local qHealth = GetUnitHealth(unitID) - SetUnitHealth(unitID, (qHealth + damage - 25000)) - damage = 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 - local weaponName - weaponName = WeaponDefs[weaponID].description - Spring.Echo("Queen is becoming resistant to " .. UnitDefs[attackerDefID].humanName .. "'s attacks (" .. weaponName .. ")") - queenResistance[weaponID].notify = 1 - end - local qHealth = GetUnitHealth(unitID) - SetUnitHealth(unitID, (qHealth + (damage * resistPercent))) - damage = damage - (damage * resistPercent) - end - queenResistance[weaponID].damage = queenResistance[weaponID].damage + damage - end - qDamage = (qDamage + damage) - if (qDamage > (queenMaxHP/10)) then - if qMove then - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qMove = false - qDamage = 0 - mRandom(1,25000) - 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 > 800) and (dist < 3000) 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(1,25000)) - Wave() - qMove = true - else - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qDamage = 0 - Wave() - end - else - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - qDamage = 0 - end - end - end - end - end - - function gadget:GameStart() - Spring.Echo("GameStart() chickenTeamID",chickenTeamID) - DisableComputerUnits() - 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 Survival mode 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 Survival mode start box available, Burrow Placement set to 'Avoid Players'") - end - end - end - end - - function gadget:GameFrame(n) - - if gameOver then return end - - if (chickenCount < maxChicken) then - local i,defs = next(spawnQueue) - if i and defs then - local x, y, z = getChickenSpawnLoc(defs.burrow, SMALL_UNIT) - if x and y and z then - local myUnit = defs.unitName - if (chickenSwitches[difficulty] and chickenSwitches[difficulty][defs.unitName])then - myUnit = chickenSwitches[difficulty][defs.unitName] - end - local unitID = CreateUnit(myUnit, x,y,z, "n", defs.team) - if unitID then - SetUnitExperience(unitID, expMod) - idleOrderQueue[unitID] = {cmd = CMD.FIGHT, params = ChooseTarget(), opts = {}} - if targetCache then - if GetUnitNeutral(targetCache) then - idleOrderQueue[unitID] = {cmd = CMD.ATTACK, params = {targetCache}, opts = {}} - end - addChickenTarget(unitID, targetCache) - end - chickenBirths[unitID] = t - chickenCount = chickenCount + 1 - end - end - spawnQueue[i] = nil - end - end - - for unitID in pairs(stunList) do - stunList[unitID] = (stunList[unitID] - 1) - if (stunList[unitID] <= 0) then - SetUnitHealth(unitID, {paralyze=0}) - stunList[unitID] = nil - end - end - - if (n >= timeCounter) then - timeCounter = (n + UPDATE) - - t = GetGameSeconds() - KillOldChicken() - - if (t < gracePeriod) then return end - - expMod = (expMod + expIncrement) - - 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) }, {}) - end - end - - if (t >= (queenTime - queenAnger)) then - if (not queenID) and (not gameOver) then - queenID = SpawnQueen() - idleOrderQueue[queenID] = {cmd = CMD.STOP, params = {}, opts = {}} - _G.chickenEventArgs = {type="queen"} - SendToUnsynced("ChickenEvent") - _G.chickenEventArgs = nil - _,queenMaxHP = GetUnitHealth(queenID) - queenMaxHP = queenMaxHP * queenHealthMult - Spring.SetUnitMaxHealth(queenID, queenMaxHP) - SetUnitExperience(queenID, (expMod*1.5)) - chickenSpawnRate = (chickenSpawnRate * 0.75) - end - updateQueenLife() - end - - local quicken = 0 - local burrowCount = SetCount(burrows) - - if (burrowTarget > 0) and (burrowTarget ~= burrowCount) then - quicken = (burrowSpawnRate * (1 - (burrowCount / burrowTarget))) - end - - local burrowSpawnTime = (burrowSpawnRate - quicken) - - if (burrowSpawnRate < (t - timeOfLastFakeSpawn) and burrowCount < maxBurrows) then - if firstSpawn then - minBurrows = SetCount(humanTeams) - local hteamID = next(humanTeams) - local ranCount = GetTeamUnitCount(hteamID) - for i = 1,ranCount,1 do - mRandom() - end - burrowTarget = math.min(math.ceil(minBurrows * 1.5) + gracePenalty, 40) - else - burrowTarget = burrowTarget + 1 - end - timeOfLastFakeSpawn = t - end - - 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 = "avoid" - end - else - SpawnBurrow() - end - if (burrowCount >= minBurrows) then - timeOfLastSpawn = t - end - _G.chickenEventArgs = {type="burrowSpawn"} - SendToUnsynced("ChickenEvent") - _G.chickenEventArgs = nil - 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 - _G.chickenEventArgs = {type="wave", number=cCount, tech=currentWave} - SendToUnsynced("ChickenEvent") - _G.chickenEventArgs = nil - end - timeOfLastWave = t - end - chickenCount = UpdateUnitCount() - end - end - - function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) - if gameOver then - return - 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 chickenTargets[unitID] then - if (unitTeam ~= chickenTeamID) then - for chickenID in pairs(chickenTargets[unitID]) do - 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 = nil - 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 - end - - if (unitID == queenID) then - queenID = nil - gameOver = true - endScores = CalculateScores() - endScores.type = "scores" - _G.chickenEventArgs = endScores - SendToUnsynced("ChickenEvent") - _G.chickenEventArgs = nil - KillAllComputerUnits() - KillAllChicken() - 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 - queenAnger = (queenAnger + angerBonus) - expMod = (expMod + (expIncrement * angerBonus)) - SetGameRulesParam("queenAnger", queenAnger) - bonusPoints = (bonusPoints + 2500) - 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 - if gameOver and showScoresOnce then - DisplayScores(endScores) - showScoresOnce = false - end - 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 - - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -else - -- END SYNCED - -- BEGIN UNSYNCED - -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- - - local Script = Script - local SYNCED = SYNCED - - function WrapToLuaUI() - if (Script.LuaUI('ChickenEvent')) then - local chickenEventArgs = {} - for k, v in spairs(SYNCED.chickenEventArgs) do - chickenEventArgs[k] = v - end - Script.LuaUI.ChickenEvent(chickenEventArgs) - end - end - - function gadget:Initialize() - gadgetHandler:AddSyncAction('ChickenEvent', WrapToLuaUI) - end - -end diff --git a/LuaRules/Gadgets/cmd_alliance_break.lua b/LuaRules/Gadgets/cmd_alliance_break.lua new file mode 100644 index 000000000..f74e43209 --- /dev/null +++ b/LuaRules/Gadgets/cmd_alliance_break.lua @@ -0,0 +1,157 @@ +function gadget:GetInfo() + return { + name = "Unally on demand", + desc = "Removes an alliance when a dynamic ally attemps to backstab", + author = "BD", + date = "-", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +if (not gadgetHandler:IsSyncedCode()) then + return +end + +if Spring.GetModOptions() and tonumber(Spring.GetModOptions().fixedallies) and (tonumber(Spring.GetModOptions().fixedallies) ~= 0) then + return --no use if alliances are disabled +end + +local GetUnitDefID = Spring.GetUnitDefID +local AreTeamsAllied = Spring.AreTeamsAllied +local GetUnitsInSphere = Spring.GetUnitsInSphere +local GetUnitTeam = Spring.GetUnitTeam +local GetUnitAllyTeam = Spring.GetUnitAllyTeam +local GetTeamList = Spring.GetTeamList +local GetAllyTeamList = Spring.GetAllyTeamList +local GetUnitHealth = Spring.GetUnitHealth +local GetUnitsInCylinder = Spring.GetUnitsInCylinder +local SendMessageToTeam = Spring.SendMessageToTeam +local GetTeamInfo = Spring.GetTeamInfo +local GetPlayerInfo = Spring.GetPlayerInfo +local SetAlly = Spring.SetAlly +local ValidUnitID = Spring.ValidUnitID +local min = math.min + +local CMD_UNIT_SET_TARGET = 34923 +local CMD_UNIT_SET_TARGET_RECTANGLE = 34925 +local CMD_ATTACK = CMD.ATTACK +local CMD_LOOPBACKATTACK = CMD.LOOPBACKATTACK +local CMD_MANUALFIRE = CMD.MANUALFIRE + +local UPDATE_RATE = 3 --in times per second ( max one time per sim frame ) +local UPDATE_FRAMES = math.floor(Game.gameSpeed/UPDATE_RATE) + +local attackAOEs = {} +local attackDamages = {} +local allianceStatus = {} + + +for unitDefID, unitDef in pairs(UnitDefs) do + for weaponIndex, weaponProperties in pairs(unitDef.weapons) do + local weaponDef = WeaponDefs[weaponProperties.weaponDef] + if weaponDef.damageAreaOfEffect > (attackAOEs[unitDefID] or 0) then + attackAOEs[unitDefID] = weaponDef.damageAreaOfEffect + attackDamages[unitDefID] = weaponDef.damages + end + end +end + +function getTeamLeaderName(teamID) + return GetPlayerInfo(select(2,GetTeamInfo(teamID))) +end + +function gadget:GameFrame(n) + if n%UPDATE_FRAMES ~= 0 then + return + end + for _,allyTeamAID in pairs(GetAllyTeamList()) do + for _,allyTeamBID in pairs(GetAllyTeamList()) do + if allyTeamAID ~= allyTeamBID then + for _,teamAID in pairs(GetTeamList(allyTeamAID)) do + for _,teamBID in pairs(GetTeamList(allyTeamBID)) do + allianceStatus[teamAID] = allianceStatus[teamAID] or {} + allianceStatus[teamBID] = allianceStatus[teamBID] or {} + local AalliedToB = AreTeamsAllied(teamBID,teamAID) + local BalliedToA = AreTeamsAllied(teamAID,teamBID) + --if teamB's cached value is allied back with A, and new teamB's allied status is not allied, means the enemy broke alliance with us + if allianceStatus[teamBID][teamAID] and not BalliedToA then + if AalliedToB then + --if we're allied, break our alliance back + SetAlly(teamBID,teamAID,false) + SendMessageToTeam(teamAID,"Team " .. teamBID .. " (" .. getTeamLeaderName(teamBID) .. ") has unallied with you, breaking dynamic alliance.") + else + SendMessageToTeam(teamAID,"Team " .. teamBID .. " (" .. getTeamLeaderName(teamBID) .. ") broke his alliance with you.") + end + end + --if teamB wasn't allied with teamA, and now it is, inform teamA about the change + if not allianceStatus[teamBID][teamAID] and BalliedToA then + SendMessageToTeam(teamAID,"Team " .. teamBID .. " (" .. getTeamLeaderName(teamBID) .. ") has allied with you.") + end + allianceStatus[teamAID][teamBID] = AalliedToB + end + end + end + end + end +end + +function checkAndBreakAlliance(attackerTeam,targetTeam,attackerAllyTeam,targetAllyTeam) + if AreTeamsAllied(attackerTeam,targetTeam) and targetAllyTeam ~= attackerAllyTeam then + SetAlly(attackerTeam,targetTeam,false) + SendMessageToTeam(targetTeam,"Team " .. attackerTeam .. " (" .. getTeamLeaderName(attackerTeam) .. ") attempted to attack you, breaking dynamic alliance.") + return true + end +end + + +function gadget:UnitCommand(unitID, unitDefID, attackerTeam, cmdID, cmdParams, cmdOpts, cmdTag) + if #cmdParams == 1 and (cmdID == CMD_ATTACK or cmdID == CMD_LOOPBACKATTACK or cmdID == CMD_MANUALFIRE) then + local targetID = cmdParams[1] + if ValidUnitID(targetID) then + checkAndBreakAlliance(attackerTeam,GetUnitTeam(targetID),GetUnitAllyTeam(unitID),GetUnitAllyTeam(targetID)) + end + elseif #cmdParams >= 3 and (cmdID == CMD_ATTACK or cmdID == CMD_LOOPBACKATTACK or cmdID == CMD_SET_TARGET or cmdID == CMD_UNIT_SET_TARGET_RECTANGLE or cmdID == CMD_MANUALFIRE ) then + local attackAOE = attackAOEs[unitDefID] + if not attackAOE then + return + end + local targetAllyTeamIDs = {} + local attackerAllyTeam = GetUnitAllyTeam(unitID) + local totalDamageSum = 0 + local targetAllyTeamToTeam = {} + for _,targetID in pairs(GetUnitsInSphere(cmdParams[1],cmdParams[2],cmdParams[3],attackAOE)) do + local targetAllyTeam = GetUnitAllyTeam(targetID) + local targetDefID = GetUnitDefID(targetID) + local targetDef = UnitDefs[targetDefID] + local targetHp = GetUnitHealth(targetID) + local targetDamage = min(targetHp,attackDamages[unitDefID][targetDef.armorType]) + totalDamageSum = totalDamageSum + targetDamage + targetAllyTeamIDs[targetAllyTeam] = (targetAllyTeamIDs[targetAllyTeam] or 0) + targetDamage + end + --if an allyteam receives more damage than the others, and it's allied to the attacker, de-ally + for targetAllyTeam,damage in pairs(targetAllyTeamIDs) do + damage = damage / totalDamageSum + if damage > 0.5 then + for _,targetTeam in pairs(GetTeamList(targetAllyTeam)) do + checkAndBreakAlliance(attackerTeam,targetTeam,attackerAllyTeam,targetAllyTeam) + end + break + end + end + elseif #cmdParams == 4 and (cmdID == CMD_ATTACK or cmdID == CMD_LOOPBACKATTACK) then + local attackerAllyTeam = GetUnitAllyTeam(unitID) + for _,targetID in pairs(GetUnitsInCylinder(cmdParams[1],cmdParams[3],cmdParams[4])) do + checkAndBreakAlliance(attackerTeam,GetUnitTeam(targetID),attackerAllyTeam,GetUnitAllyTeam(targetID)) + end + end +end + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/cmd_areaguard.lua b/LuaRules/Gadgets/cmd_areaguard.lua index 05605f9ec..2fe5d628b 100644 --- a/LuaRules/Gadgets/cmd_areaguard.lua +++ b/LuaRules/Gadgets/cmd_areaguard.lua @@ -1 +1,183 @@ --------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "Area Guard", desc = "Replace Guard with Area Guard", author = "CarRepairer", date = "2013-06-12", license = "GNU GPL, v2 or later", layer = 0, enabled = true, } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- includes include "LuaRules/Configs/customcmds.h.lua" local echo = Spring.Echo -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- if gadgetHandler:IsSyncedCode() then -- SYNCED -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- vars local areaGuardCmd = { id = CMD_AREA_GUARD, name = "Guard2", action = "areaguard", cursor = 'Guard', type = CMDTYPE.ICON_UNIT_OR_AREA, tooltip = "Guard the unit or units", --hidden = true, } -------------------------------------------------------------------------------- -- functions local function DoAreaGuard( unitID, unitTeam, unitTeam, cmdParams, cmdOptions ) local cmdOptions2 = {} if (cmdOptions.shift) then table.insert(cmdOptions2, "shift") end if (cmdOptions.alt) then table.insert(cmdOptions2, "alt") end if (cmdOptions.ctrl) then table.insert(cmdOptions2, "ctrl") end if (cmdOptions.right) then table.insert(cmdOptions2, "right") end if #cmdParams == 1 then Spring.GiveOrderToUnit(unitID, CMD.GUARD, {cmdParams[1]}, cmdOptions2) return end if (not cmdOptions.shift) then Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, cmdOptions2) table.insert(cmdOptions2, "shift") end local alreadyGuarding = {} local cmdQueue = Spring.GetCommandQueue(unitID, -1); for _,cmd in ipairs(cmdQueue) do if cmd.id == CMD.GUARD and #cmd.params == 1 then alreadyGuarding[ cmd.params[1] ] = true end end local units = Spring.GetUnitsInSphere( unpack(cmdParams) ) for _,otherUnitID in ipairs( units ) do if otherUnitID ~= unitID and not alreadyGuarding[otherUnitID] then local teamID = Spring.GetUnitTeam(otherUnitID) if Spring.AreTeamsAllied( unitTeam, teamID ) then Spring.GiveOrderToUnit(unitID, CMD.GUARD, {otherUnitID}, cmdOptions2) end end end end -------------------------------------------------------------------------------- -- callins function gadget:UnitCreated(unitID, unitDefID, team) local cmdDescID = Spring.FindUnitCmdDesc(unitID, CMD.GUARD) if cmdDescID then local cmdArray = {hidden = true} Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) Spring.InsertUnitCmdDesc(unitID, 500, areaGuardCmd) end end function gadget:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions) if cmdID == CMD_AREA_GUARD then DoAreaGuard( unitID, unitTeam, unitTeam, cmdParams, cmdOptions ) return false end return true end function gadget:Initialize() for _, unitID in ipairs(Spring.GetAllUnits()) do local unitDefID = Spring.GetUnitDefID(unitID) --local team = spGetUnitTeam(unitID) gadget:UnitCreated(unitID, unitDefID, team) end end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- else -- UNSYNCED ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- local function SelectedUnitCanRepair() -- cache this? local selUnits = Spring.GetSelectedUnits() if not selUnits[1] then return nil -- no selected units end local unitID, unitDefID local canRepair for i = 1, #selUnits do unitID = selUnits[i] unitDefID = Spring.GetUnitDefID(unitID) if not unitDefID then return end local ud = UnitDefs[unitDefID] if ud.canRepair then return true end end return false end -------------------------------------------------------------------------------- -- callins function gadget:DefaultCommand(type,id) --echo 'DefaultCommand' if type == 'unit' then local target_team = Spring.GetUnitTeam(id) if Spring.AreTeamsAllied( target_team, Spring.GetLocalTeamID() ) then if SelectedUnitCanRepair() then local hp, maxHp,_,_,buildProgress = Spring.GetUnitHealth(id) if not buildProgress or buildProgress < 1 or hp < maxHp then return -- let the default command be repair end end return CMD_AREA_GUARD end end end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Area Guard", + desc = "Replace Guard with Area Guard", + author = "CarRepairer", + date = "2013-06-12", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- includes + +include "LuaRules/Configs/customcmds.h.lua" + +local echo = Spring.Echo + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if gadgetHandler:IsSyncedCode() then -- SYNCED +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +-------------------------------------------------------------------------------- +-- vars + + +local areaGuardCmd = { + id = CMD_AREA_GUARD, + name = [[Area +Guard]], + action = "areaguard", + cursor = 'Guard', + type = CMDTYPE.ICON_UNIT_OR_AREA, + tooltip = "Guard a single unit or multiple units in an area. Click once for guarding a single unit, click and drag to issue guard orders for all the units within the area.", + --hidden = true, +} + + +-------------------------------------------------------------------------------- +-- functions + +local function DoAreaGuard( unitID, unitTeam, unitTeam, cmdParams, cmdOptions ) + local cmdOptions2 = {} + if (cmdOptions.shift) then table.insert(cmdOptions2, "shift") end + if (cmdOptions.alt) then table.insert(cmdOptions2, "alt") end + if (cmdOptions.ctrl) then table.insert(cmdOptions2, "ctrl") end + if (cmdOptions.right) then table.insert(cmdOptions2, "right") end + + if #cmdParams == 1 then + Spring.GiveOrderToUnit(unitID, CMD.GUARD, {cmdParams[1]}, cmdOptions2) + return + end + + if (not cmdOptions.shift) then + Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, cmdOptions2) + table.insert(cmdOptions2, "shift") + end + + local alreadyGuarding = {} + local cmdQueue = Spring.GetCommandQueue(unitID, -1); + for _,cmd in ipairs(cmdQueue) do + if cmd.id == CMD.GUARD and #cmd.params == 1 then + alreadyGuarding[ cmd.params[1] ] = true + end + end + + local units = Spring.GetUnitsInSphere( unpack(cmdParams) ) + for _,otherUnitID in ipairs( units ) do + if otherUnitID ~= unitID and not alreadyGuarding[otherUnitID] then + local teamID = Spring.GetUnitTeam(otherUnitID) + if Spring.AreTeamsAllied( unitTeam, teamID ) then + Spring.GiveOrderToUnit(unitID, CMD.GUARD, {otherUnitID}, cmdOptions2) + end + end + end + +end + + + +-------------------------------------------------------------------------------- +-- callins + + + +function gadget:UnitCreated(unitID, unitDefID, team) + local cmdDescID = Spring.FindUnitCmdDesc(unitID, CMD.GUARD) + if cmdDescID then + local cmdArray = {hidden = true} + Spring.EditUnitCmdDesc(unitID, cmdDescID, cmdArray) + Spring.InsertUnitCmdDesc(unitID, 500, areaGuardCmd) + end +end + +function gadget:AllowCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions) + if cmdID == CMD_AREA_GUARD then + DoAreaGuard( unitID, unitTeam, unitTeam, cmdParams, cmdOptions ) + return false + end + + return true +end + +function gadget:Initialize() + for _, unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + --local team = spGetUnitTeam(unitID) + gadget:UnitCreated(unitID, unitDefID, team) + end +end + + + + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- +else -- UNSYNCED +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + + +local function SelectedUnitCanRepair() -- cache this? + local selUnits = Spring.GetSelectedUnits() + if not selUnits[1] then + return nil -- no selected units + end + local unitID, unitDefID + local canRepair + for i = 1, #selUnits do + unitID = selUnits[i] + unitDefID = Spring.GetUnitDefID(unitID) + if not unitDefID then + return + end + local ud = UnitDefs[unitDefID] + if ud.canRepair then + return true + end + end + return false +end + + + +-------------------------------------------------------------------------------- +-- callins + +--[[ +function gadget:DefaultCommand(type,id) + --echo 'DefaultCommand' + if type == 'unit' then + + local target_team = Spring.GetUnitTeam(id) + if Spring.AreTeamsAllied( target_team, Spring.GetLocalTeamID() ) then + if SelectedUnitCanRepair() then + local hp, maxHp,_,_,buildProgress = Spring.GetUnitHealth(id) + if not buildProgress or buildProgress < 1 or hp < maxHp then + return -- let the default command be repair + end + end + + return CMD_AREA_GUARD + end + end +end +]]-- + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- +end +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- 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_luaui_reload.lua b/LuaRules/Gadgets/cmd_luaui_reload.lua new file mode 100644 index 000000000..fb9125283 --- /dev/null +++ b/LuaRules/Gadgets/cmd_luaui_reload.lua @@ -0,0 +1,36 @@ +function gadget:GetInfo() + return { + name = "LuaUI Reload", + desc = "Implements /luarules reloadluaui (because luaui cannot reload itself)", + author = "Bluestone", + date = "Feb 2015", + license = "Round Objects", + layer = 0, + enabled = true -- loaded by default? + } +end + +if (gadgetHandler:IsSyncedCode()) then + return +end + +function LuaUIReload(cmd, line, words, playerID) + if playerID and playerID==Spring.GetMyPlayerID() then + Spring.SendCommands("luaui reload") + end +end + + +function gadget:Initialize() + gadgetHandler:AddChatAction('reloadluaui', LuaUIReload, "") +end + +function gadget:Shutdown() + gadgetHandler:RemoveChatAction('reloadluaui') +end + + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- 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_remove_stop.lua b/LuaRules/Gadgets/cmd_remove_stop.lua new file mode 100644 index 000000000..1b13d5e91 --- /dev/null +++ b/LuaRules/Gadgets/cmd_remove_stop.lua @@ -0,0 +1,68 @@ +if not gadgetHandler:IsSyncedCode() then + return +end + +function gadget:GetInfo() + return { + name = "Remove Stop", + desc = "Removes stop from structures which have no need for the command.", + author = "GoogleFrog", + date = "3 April 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } +end + +local spRemoveUnitCmdDesc = Spring.RemoveUnitCmdDesc +local spFindUnitCmdDesc = Spring.FindUnitCmdDesc +local CMD_STOP = CMD.STOP + +local removeCommands = { + --CMD.WAIT, + CMD.STOP, + --CMD.REPEAT, +} + +local stopRemoveDefs = {} + +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + if ud.customParams and ud.customParams.removestop then + stopRemoveDefs[unitDefID] = true + end +end + +function gadget:AllowCommand_GetWantedCommand() + return {[CMD_STOP] = true} +end + +function gadget:AllowCommand_GetWantedUnitDefID() + return stopRemoveDefs +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + if (cmdID == CMD_STOP and stopRemoveDefs[unitDefID]) then + return false + end + return true +end + +function gadget:UnitCreated(unitID, unitDefID) + if stopRemoveDefs[unitDefID] then + for i = 1, #removeCommands do + local cmdDesc = spFindUnitCmdDesc(unitID, removeCommands[i]) + if cmdDesc then + spRemoveUnitCmdDesc(unitID, cmdDesc) + end + end + end +end + +function gadget:Initialize() + -- load active units + for _, unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/cmd_remove_wait.lua b/LuaRules/Gadgets/cmd_remove_wait.lua new file mode 100644 index 000000000..11b7d62de --- /dev/null +++ b/LuaRules/Gadgets/cmd_remove_wait.lua @@ -0,0 +1,68 @@ +if not gadgetHandler:IsSyncedCode() then + return +end + +function gadget:GetInfo() + return { + name = "Remove Wait", + desc = "Removes wait from structures which have no need for the command.", + author = "GoogleFrog", + date = "3 April 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, + } +end + +local spRemoveUnitCmdDesc = Spring.RemoveUnitCmdDesc +local spFindUnitCmdDesc = Spring.FindUnitCmdDesc +local CMD_WAIT = CMD.WAIT + +local removeCommands = { + CMD.WAIT, + --CMD.STOP, + --CMD.REPEAT, +} + +local waitRemoveDefs = {} + +for unitDefID = 1, #UnitDefs do + local ud = UnitDefs[unitDefID] + if ud.customParams and ud.customParams.removewait then + waitRemoveDefs[unitDefID] = true + end +end + +function gadget:AllowCommand_GetWantedCommand() + return {[CMD_WAIT] = true} +end + +function gadget:AllowCommand_GetWantedUnitDefID() + return waitRemoveDefs +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + if (cmdID == CMD_WAIT and waitRemoveDefs[unitDefID]) then + return false + end + return true +end + +function gadget:UnitCreated(unitID, unitDefID) + if waitRemoveDefs[unitDefID] then + for i = 1, #removeCommands do + local cmdDesc = spFindUnitCmdDesc(unitID, removeCommands[i]) + if cmdDesc then + spRemoveUnitCmdDesc(unitID, cmdDesc) + end + end + end +end + +function gadget:Initialize() + -- load active units + for _, unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/cmd_selected_units.lua b/LuaRules/Gadgets/cmd_selected_units.lua new file mode 100644 index 000000000..de1fbd017 --- /dev/null +++ b/LuaRules/Gadgets/cmd_selected_units.lua @@ -0,0 +1,214 @@ + +function gadget:GetInfo() + return { + name = "Ally Selected Units", + desc = "sends your selected units to others", + author = "very_bad_soldier", + date = "August 1, 2008", + license = "GNU GPL v2", + layer = 0, + enabled = true + } +end + +local unitLimitPerFrame = 300 -- controls how many units will be send per frame +local fullSelectionUpdateInt = 0 -- refresh full selection info once in n seconds, 0 = disabled +local minZlibSize = 130 --minimum size threshold of msg to use zlib (msg smaller than this will not be compressed before sending) + +local HEADER_SEL_UNCOMPRESSED = "cosu" +local HEADER_SEL_COMPRESSED = "cosc" +local HEADER_LENGHT = string.len(HEADER_SEL_UNCOMPRESSED) + + + +if gadgetHandler:IsSyncedCode() then + function gadget:RecvLuaMsg(inMsg, playerID) + if inMsg:sub(1,HEADER_LENGHT)==HEADER_SEL_UNCOMPRESSED or inMsg:sub(1,HEADER_LENGHT)==HEADER_SEL_COMPRESSED then + SendToUnsynced("selectionUpdate",playerID,inMsg:sub(5),inMsg:sub(4,4) == "c") + return true + end + end +else + local floor = math.floor + local ZlibCompress = Spring.ZlibCompress + local ZlibDeCompress = Spring.ZlibDeCompress + local SendLuaRulesMsg = Spring.SendLuaRulesMsg + local GetSelectedUnits = Spring.GetSelectedUnits + local IsUnitSelected = Spring.IsUnitSelected + local GetSpectatingState = Spring.GetSpectatingState + local GetLastUpdateSeconds = Spring.GetLastUpdateSeconds + local GetPlayerInfo = Spring.GetPlayerInfo + local PackU16 = VFS.PackU16 + local UnpackU16 = VFS.UnpackU16 + + local myPlayerID = Spring.GetMyPlayerID() + + local time = 0 + local timeSeconds = 0 + local myLastSelectedUnits = {} + + + function gadget:Initialize() + gadgetHandler:AddSyncAction("selectionUpdate", handleSelectionUpdateEvent) + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("selectionUpdate") + end + + function handleSelectionUpdateEvent(_,playerID,msg,compressed) + 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 compressed then --we have a compressed msg here + msg = ZlibDecompress( msg ) + end + + local counts = UnpackU16( msg, 1, 2 ) + if counts[1] == counts[2] and counts[1] == 0xffff then + --clear all + if Script.LuaUI("selectedUnitsClear") then + Script.LuaUI.selectedUnitsClear(playerID) + end + else + local addCount = counts[1] + local removeCount = counts[2] + + if removeCount > 0 and Script.LuaUI("selectedUnitsRemove") then + local remUnits = UnpackU16( msg, 5 + addCount * 2, removeCount ) + for i=1,removeCount do + Script.LuaUI.selectedUnitsRemove(playerID,remUnits[i]) + end + end + + if addCount > 0 and Script.LuaUI("selectedUnitsAdd") then + local addUnits = UnpackU16( msg, 5, addCount ) + for i=1,addCount do + Script.LuaUI.selectedUnitsAdd(playerID,addUnits[i]) + end + end + end + end + + function gadget:CommandsChanged( id, params, options ) + sendSelectedUnits() + end + + function gadget:UnitDestroyed(unitID, attacker ) + myLastSelectedUnits[ unitID ] = nil + end + + function gadget:Update() + local deltaTime = GetLastUpdateSeconds() + if time+deltaTime == time then + time = 0 --prevent floating point errors + end + time = time + deltaTime + + if timeSeconds == floor(time) then + return --only run on whole seconds + end + + timeSeconds = floor(time) + + if fullSelectionUpdateInt ~= 0 and timeSeconds%fullSelectionUpdateInt == 0 then + --its time for a full update + sendUnitsMsg(PackU16(0xffff) .. PackU16(0xffff)) + myLastSelectedUnits = {} + end + + sendSelectedUnits() + end + + --all values are 16bit + --FORMAT: uncompressed msg "cosu[addCount][removeCount]([unitIdToAdd]*)([unitIdToRemove]*)" + --FORMAT: compressed msg "cosc{[addCount][removeCount]([unitIdToAdd]*)([unitIdToRemove]*)}" the part in curly braces has to be zlib compressed + --FORMAT clear all: "cosu[0xffffff][0xffffff]" --magic value. impossible to have as normal message + + function sendFullRefresh() + + end + + function sendUnitsMsg( msg ) + local finalMsg = msg + local header = HEADER_SEL_UNCOMPRESSED + if ZlibCompress and msg:len() >= minZlibSize then + finalMsg = ZlibCompress( finalMsg ) + header = HEADER_SEL_COMPRESSED + end + + SendLuaRulesMsg( header .. finalMsg) + end + + function sendSelectedUnits() + local units = GetSelectedUnits() + + local partAdd = "" + local addCount = 0 + for i, unitId in pairs(units) do + --check if unit is new this time + if not myLastSelectedUnits[unitId] then + partAdd = partAdd .. PackU16(unitId) + myLastSelectedUnits[unitId] = true + addCount = addCount + 1 + + if addCount > unitLimitPerFrame then + break + end + end + end + + local remTab = {} --these units will be removed in the next step + local partRemove = "" + local remCount = 0 + for unitId, unit in pairs(myLastSelectedUnits) do + --check if unit is still selected + if not IsUnitSelected(unitId) then + partRemove = partRemove .. PackU16(unitId) + remTab[unitId] = true + remCount = remCount + 1 + + if (addCount + remCount) > unitLimitPerFrame then + break + end + end + end + + --remove not anymore selected units + for unitId, b in pairs(remTab) do + myLastSelectedUnits[unitId] = nil + end + + local msg = partAdd .. partRemove + if msg:len() > 1 then + local msgToSend = "" + if #units > 0 and ( addCount + remCount) > #units then + --its more efficient to clear all and then start from zero + --so: 1. Clear All + msgToSend = PackU16(0xffff) .. PackU16(0xffff) + sendUnitsMsg( msgToSend) + myLastSelectedUnits = {} + --2. do normal send + sendSelectedUnits() + else + if #units == 0 then + --send clear all message + msgToSend = PackU16(0xffff) .. PackU16(0xffff) + myLastSelectedUnits = {} + else + --send standard message + msgToSend = PackU16(addCount) .. PackU16(remCount) .. msg + + end + + sendUnitsMsg( msgToSend) + end + end + end +end \ No newline at end of file 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_ceg_spawner.lua b/LuaRules/Gadgets/dbg_ceg_spawner.lua deleted file mode 100644 index 29670696f..000000000 --- a/LuaRules/Gadgets/dbg_ceg_spawner.lua +++ /dev/null @@ -1,59 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:GetInfo() - return { - name = "CEG Spawner", - desc = 'Spawn CEGs', - author = "CarRepairer", - date = "2010-11-07", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true, - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local echo = Spring.Echo - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -local function explode(div,str) - if (div=='') then return false end - local pos,arr = 0,{} - -- for each divider found - for st,sp in function() return string.find(str,div,pos,true) end do - table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider - pos = sp + 1 -- Jump past current divider - end - table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider - return arr -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function gadget:RecvLuaMsg(msg, playerID) - if not Spring.IsCheatingEnabled() then return end - - local ceg_msg_prefix = "*" - local ceg_msg = (msg:find(ceg_msg_prefix,1,true)) - - if ceg_msg then - msg = msg:sub(2) - msg = explode('|', msg) - echo ('Spawning CEG', msg[1] ) - Spring.SpawnCEG( msg[1], --cegname - msg[2], msg[3], msg[4], --pos - msg[5], msg[6], msg[7], --dir - msg[8] --radius - ) - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- 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/engine_hotfixes.lua b/LuaRules/Gadgets/engine_hotfixes.lua index cad7cc062..0c0a41024 100644 --- a/LuaRules/Gadgets/engine_hotfixes.lua +++ b/LuaRules/Gadgets/engine_hotfixes.lua @@ -56,7 +56,7 @@ if gadgetHandler:IsSyncedCode() then local fx, fy, fz = Spring.GetFeaturePosition(fID) Spring.DestroyFeature(fID) Spring.SpawnCEG('sparklegreen', fx, fy, fz) - Spring.PlaySoundFile('sounds/reclaimed.wav', 1, fx, fy, fz) + Spring.PlaySoundFile('sounds/miscfx/reclaimed.wav', 1, fx, fy, fz) end end end diff --git a/LuaRules/Gadgets/engine_taskbar_stuff.lua b/LuaRules/Gadgets/engine_taskbar_stuff.lua index 3b18aa012..9f9a2efee 100644 --- a/LuaRules/Gadgets/engine_taskbar_stuff.lua +++ b/LuaRules/Gadgets/engine_taskbar_stuff.lua @@ -27,6 +27,7 @@ local SetWMCaption = Spring.SetWMCaption or noFunc function gadget:Initialize() local name = Game.modName SetWMIcon("bitmaps/evologo.bmp") - SetWMCaption(name .. " (Spring " .. Game.version .. ")", name) + local engineVersion = (Game and Game.version) or (Engine and Engine.version) or "Engine version error" + SetWMCaption(name .. " (Spring " .. engineVersion .. ")", name) gadgetHandler:RemoveGadget() -end \ No newline at end of file +end diff --git a/LuaRules/Gadgets/factory_anti_slacker.lua b/LuaRules/Gadgets/factory_anti_slacker.lua index ac09db4b7..4ac03af4f 100644 --- a/LuaRules/Gadgets/factory_anti_slacker.lua +++ b/LuaRules/Gadgets/factory_anti_slacker.lua @@ -1,4 +1,11 @@ --- $Id$ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if not gadgetHandler:IsSyncedCode() then + return +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + function gadget:GetInfo() return { @@ -18,15 +25,15 @@ local spSetUnitBlocking = Spring.SetUnitBlocking local spGetUnitIsDead = Spring.GetUnitIsDead local noEject = { --- [UnitDefNames["missilesilo"].id] = true, + -- [UnitDefNames["missilesilo"].id] = true, + -- [UnitDefNames["factoryship"].id] = true, + -- [UnitDefNames["factoryplane"].id] = true, + -- [UnitDefNames["factorygunship"].id] = true, } -local ghostFrames = 30 --how long the unit will be ethereal +local ghostFrames = 360 --how long the unit will be ethereal local setBlocking = {} --indexed by gameframe, contains a subtable of unitIDs -if (gadgetHandler:IsSyncedCode()) then - - function gadget:GameFrame(n) if setBlocking[n] then --restore blocking for unitID, _ in pairs(setBlocking[n]) do @@ -44,16 +51,4 @@ function gadget:UnitFromFactory(unitID, unitDefID, teamID, builderID, builderDef setBlocking[frame][unitID] = true spSetUnitBlocking(unitID, false) end -end - ---[[ -function gadget:UnitCreated(unitID, unitDefID, teamID, builderID) - if not builderID then return end - local builderDefID = spGetUnitDefID(builderID) - if UnitDefs[builderDefID].isFactory and not noEject[builderDefID] then - gadget:UnitFromFactory(unitID, unitDefID, teamID, builderID, builderDefID) - end -end -]]-- - end \ No newline at end of file diff --git a/LuaRules/Gadgets/feature_energycore.lua b/LuaRules/Gadgets/feature_energycore.lua new file mode 100644 index 000000000..fc95293b4 --- /dev/null +++ b/LuaRules/Gadgets/feature_energycore.lua @@ -0,0 +1,25 @@ +function gadget:GetInfo() + return { + name = "Energy core handler", + desc = "", + author = "Floris", + date = "November 2017", + license = "", + layer = 0, + enabled = false -- loaded by default? + } +end + + +if (gadgetHandler:IsSyncedCode()) then + + local energycoreDefID = FeatureDefNames['ammobox'].id + + function gadget:FeatureCreated(featureID, allyTeamID) + if Spring.GetFeatureDefID(featureID) == energycoreDefID then + Spring.SetFeatureRotation(featureID,0,math.random()*360,0) + Spring.SetFeatureRotation(featureID,1,(math.random()-0.5)*320,0) + Spring.SetFeatureRotation(featureID,0,math.random()*360,1) + end + end +end diff --git a/LuaRules/Gadgets/fps_broadcast.lua b/LuaRules/Gadgets/fps_broadcast.lua new file mode 100644 index 000000000..f7128e6db --- /dev/null +++ b/LuaRules/Gadgets/fps_broadcast.lua @@ -0,0 +1,87 @@ + +function gadget:GetInfo() + return { + name = "FPS Broadcast", + desc = "Broadcasts FramesPerSecond", + 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.validationFps = validation + + function gadget:RecvLuaMsg(msg, playerID) + if msg:sub(1,1)=="@" and msg:sub(2,3)==validation then + SendToUnsynced("fpsBroadcast",playerID,tonumber(msg:sub(4))) + return true + end + end + +else + -------------------------------------------------------------------------------- + -- unsynced + -------------------------------------------------------------------------------- + + local GetLastUpdateSeconds= Spring.GetLastUpdateSeconds + local SendLuaRulesMsg = Spring.SendLuaRulesMsg + local GetFPS = Spring.GetFPS + + local updateTimer = 0 + local avgFps = GetFPS() + local numframes = 0 + local validation = SYNCED.validationFps + + function gadget:Initialize() + gadgetHandler:AddSyncAction("fpsBroadcast", handleFpsEvent) + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("fpsBroadcast") + end + + function handleFpsEvent(_,playerID,fps) + if Script.LuaUI("FpsEvent") then + Script.LuaUI.FpsEvent(playerID,fps) + end + end + + function gadget:Update() + updateTimer = updateTimer + GetLastUpdateSeconds() + if numFrames == nil then numFrames = 0 end + numFrames = numFrames + 1 + avgFps = ((avgFps*(numFrames-1))+GetFPS()) / numFrames + if updateTimer > sendPacketEvery then + SendLuaRulesMsg("@"..validation..math.floor(avgFps+0.5)) + updateTimer = 0 + avgFps = 0 + numFrames = 0 + end + end + +end + 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_boxcollector.lua b/LuaRules/Gadgets/game_boxcollector.lua new file mode 100644 index 000000000..07d448266 --- /dev/null +++ b/LuaRules/Gadgets/game_boxcollector.lua @@ -0,0 +1,217 @@ +function gadget:GetInfo() + return { + name = "Box collector", + desc = "removes box features and gives resources to collecting player", + author = "MrSpontaneous (ak Pasha Wrangell) with help from JK; fixed by lurker (Dylan Petonke)", + date = "Nov 11 2007", + license = "GPL", + layer = 1, + enabled = false + } +end + +if (gadgetHandler:IsSyncedCode()) then +---synced---- + + local Box="ammobox" + local chickenEgg="chicken_egg" + local chickenEggB="chicken_eggb" + local chickenEggC="chicken_eggc" + local chickenEggD="chicken_eggd" + local BoxId + local eggId + local eggIdB + local eggIdC + local eggIdD + local BoxesOnMap={} + local eggsOnMap={} + local eggsOnMapB={} + local eggsOnMapC={} + local eggsOnMapD={} + local unitInRange={} + local Resources={} + local SpawnCEG = Spring.SpawnCEG + + function gadget:Initialize() + BoxId = FeatureDefNames[Box].id + eggId = FeatureDefNames["chicken_egg"].id + eggIdB = FeatureDefNames["chicken_eggb"].id + eggIdC = FeatureDefNames["chicken_eggc"].id + eggIdD = FeatureDefNames["chicken_eggd"].id + --Spring.Echo(Box, BoxId) + + ud = Spring.GetAllFeatures () + for n,u in pairs(ud) do + if Spring.GetFeatureDefID(u) == BoxId then + BoxesOnMap[u] = 1 + end + if Spring.GetFeatureDefID(u) == eggId then + eggsOnMap[u] = 1 + end + if Spring.GetFeatureDefID(u) == eggIdB then + eggsOnMapB[u] = 1 + end + if Spring.GetFeatureDefID(u) == eggIdC then + eggsOnMapC[u] = 1 + end + if Spring.GetFeatureDefID(u) == eggIdD then + eggsOnMapD[u] = 1 + end + end + end + + function gadget:GameFrame(f) + --Spring.Echo(eggsOnMap) + if f%30 == 4 then + for box,b in pairs(BoxesOnMap) do + --Spring.Echo("Box") + --Spring.Echo(BoxesOnMap) + local x,y,z = Spring.GetFeaturePosition(box) + local unitsInRange = Spring.GetUnitsInSphere(x,y,z, 500)--at x , y , z with radius 200 + for _,unit in ipairs(unitsInRange) do + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycorecollect and select(5, Spring.GetUnitHealth(unit)) == 1 then + --local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(box) --- [1] is metal, [3] is energy + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", 5) + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", 5) + Spring.DestroyFeature(box) + local fx, fy, fz = Spring.GetFeaturePosition(box) + Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + SpawnCEG("sparklegreenplus5", fx, fy, fz) + BoxesOnMap[box] = nil + break + end + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycoredronespawner and select(5, Spring.GetUnitHealth(unit)) == 1 then + Spring.CreateUnit("edrone", x, y, z, 0, Spring.GetUnitTeam(unit)) + Spring.DestroyFeature(box) + local fx, fy, fz = Spring.GetFeaturePosition(box) + Spring.PlaySoundFile("sounds/miscfx/energycoredronespawner.wav", 1, fx, fy, fz) + SpawnCEG("sparkleorangeplus1drone", fx, fy, fz) + BoxesOnMap[box] = nil + break + end + -- if (UnitDefs[Spring.GetUnitDefID(unit)].customParams.amphibenergycoredronespawner) then + -- Spring.CreateUnit("eamphibdrone", x, y, z, 0, Spring.GetUnitTeam(unit)) + -- Spring.DestroyFeature(box) + -- local fx, fy, fz = Spring.GetFeaturePosition(box) + -- Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + -- SpawnCEG("sparklegreen", fx, fy, fz) + -- BoxesOnMap[box] = nil + -- break + -- end + end + end + for chickenEgg,b in pairs(eggsOnMap) do + --Spring.Echo("Egg") + --Spring.Echo(eggsOnMap) + local eggx,eggy,eggz = Spring.GetFeaturePosition(chickenEgg) + local unitsInRange = Spring.GetUnitsInSphere(eggx,eggy,eggz, 500)--at x , y , z with radius 200 + for _,unit in ipairs(unitsInRange) do + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycorecollect and select(5, Spring.GetUnitHealth(unit)) == 1 then + --local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(chickenEgg) --- [1] is metal, [3] is energy + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", 5) + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", 5) + Spring.DestroyFeature(chickenEgg) + local fx, fy, fz = Spring.GetFeaturePosition(chickenEgg) + Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + SpawnCEG("sparklegreenplus5", fx, fy, fz) + eggsOnMap[chickenEgg] = nil + break + end + end + end + for chickenEggB,b in pairs(eggsOnMapB) do + --Spring.Echo("Egg") + --Spring.Echo(eggsOnMap) + local eggx,eggy,eggz = Spring.GetFeaturePosition(chickenEggB) + local unitsInRange = Spring.GetUnitsInSphere(eggx,eggy,eggz, 500)--at x , y , z with radius 200 + for _,unit in ipairs(unitsInRange) do + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycorecollect and select(5, Spring.GetUnitHealth(unit)) == 1 then + --local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(chickenEggB) --- [1] is metal, [3] is energy + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", 5) + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", 5) + Spring.DestroyFeature(chickenEggB) + local fx, fy, fz = Spring.GetFeaturePosition(chickenEggB) + Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + SpawnCEG("sparklegreenplus5", fx, fy, fz) + eggsOnMapB[chickenEggB] = nil + break + end + end + end + for chickenEggC,b in pairs(eggsOnMapC) do + --Spring.Echo("Egg") + --Spring.Echo(eggsOnMap) + local eggx,eggy,eggz = Spring.GetFeaturePosition(chickenEggC) + local unitsInRange = Spring.GetUnitsInSphere(eggx,eggy,eggz, 500)--at x , y , z with radius 200 + for _,unit in ipairs(unitsInRange) do + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycorecollect and select(5, Spring.GetUnitHealth(unit)) == 1 then + --local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(chickenEggC) --- [1] is metal, [3] is energy + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", 5) + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", 5) + Spring.DestroyFeature(chickenEggC) + local fx, fy, fz = Spring.GetFeaturePosition(chickenEggC) + Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + SpawnCEG("sparklegreenplus5", fx, fy, fz) + eggsOnMapC[chickenEggC] = nil + break + end + end + end + for chickenEggD,b in pairs(eggsOnMapD) do + --Spring.Echo("Egg") + --Spring.Echo(eggsOnMap) + local eggx,eggy,eggz = Spring.GetFeaturePosition(chickenEggD) + local unitsInRange = Spring.GetUnitsInSphere(eggx,eggy,eggz, 500)--at x , y , z with radius 200 + for _,unit in ipairs(unitsInRange) do + if UnitDefs[Spring.GetUnitDefID(unit)].customParams.energycorecollect and select(5, Spring.GetUnitHealth(unit)) == 1 then + --local remM, maxM, remE, maxE, left = Spring.GetFeatureResources(chickenEggD) --- [1] is metal, [3] is energy + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "m", 5) + Spring.AddTeamResource(Spring.GetUnitTeam(unit) , "e", 5) + Spring.DestroyFeature(chickenEggD) + local fx, fy, fz = Spring.GetFeaturePosition(chickenEggD) + Spring.PlaySoundFile("sounds/miscfx/boxcollection.wav", 1, fx, fy, fz) + SpawnCEG("sparklegreenplus5", fx, fy, fz) + eggsOnMapD[chickenEggD] = nil + break + end + end + end + end + end + + function gadget:FeatureDestroyed(featureID, _) + if (BoxesOnMap[featureID]) then + BoxesOnMap[featureID] = nil + end + if (eggsOnMap[featureID]) then + eggsOnMap[featureID] = nil + end + if (eggsOnMapB[featureID]) then + eggsOnMapB[featureID] = nil + end + if (eggsOnMapC[featureID]) then + eggsOnMapC[featureID] = nil + end + if (eggsOnMapD[featureID]) then + eggsOnMapD[featureID] = nil + end + end + + function gadget:FeatureCreated(featureID, allyTeam) + if (Spring.GetFeatureDefID(featureID) == BoxId) then + BoxesOnMap[featureID] = 1 + end + if (Spring.GetFeatureDefID(featureID) == eggId) then + eggsOnMap[featureID] = 1 + end + if (Spring.GetFeatureDefID(featureID) == eggIdB) then + eggsOnMapB[featureID] = 1 + end + if (Spring.GetFeatureDefID(featureID) == eggIdC) then + eggsOnMapC[featureID] = 1 + end + if (Spring.GetFeatureDefID(featureID) == eggIdD) then + eggsOnMapD[featureID] = 1 + end + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/game_controlVictory.lua b/LuaRules/Gadgets/game_controlVictory.lua index 9ea686cb2..ac25a436f 100644 --- a/LuaRules/Gadgets/game_controlVictory.lua +++ b/LuaRules/Gadgets/game_controlVictory.lua @@ -2,53 +2,369 @@ function gadget:GetInfo() return { name = "Control Victory", desc = "Enables a victory through capture and hold", - author = "KDR_11k (David Becker)", - date = "2008-03-22", + author = "KDR_11k (David Becker), Smoth, Lurker, Forboding Angel, Floris", + date = "2008-03-22 -- Major update July 11th, 2016", license = "Public Domain", layer = 1, enabled = true } end +if Spring.GetModOptions() == nil or Spring.GetModOptions().scoremode == nil or Spring.GetModOptions().scoremode == "disabled" then + return +end + +--[[ +------------------- +Before implementing this gadget, read this!!! +This gadget relies on a few parts: +• control point config file which is located in luarules/configs/controlpoints/ , and it must have a filename of cv_.lua. So, in the case of a map named "Iammas Prime -" with a version of "v01", then the name of my file would be "cv_Iammas Prime - v01.lua". + PLEASE NOTE: If the map config file is not found and a capture mode is selected, the gadget will generate 7 points in a circle on the map automagically. + +• config placed in luarules/configs/ called cv_nonCapturingUnits.lua -- What units are barred form being able to capture control points? +• config placed in luarules/configs/ called cv_buildableUnits.lua -- What units can be built inside control points? + *-----------------* + EXTREMELY IMPORTANT! + In the "Buildable units"'s unitdefs, you need to add a building mask of 0. By default the building mask is 1. The control points use a building mask of 2. + Use the unitdef tag: + buildingMask = 0, + + BEWARE! Spring 103.0 allows for a bit field that works like this... 0 over 1, never 1 over 0. Normal ground is 1. Units are defaulted to 1. + + THE MASK CAN BE DISABLED OR ENABLED BY CHANGING THE VALUE IN cv_modOptions.lua!!! + *-----------------* +• config placed in luarules/configs/ called cv_modOptions.lua -- This controls options for when spring is launched and modoptions cannot be read +• modoptions + +The control point config is structured like this (cv_Iammas Prime - v01.lua): + +//// + +return { + points = { + [1] = {x = 4608, y = 0, z = 3048}, + [2] = {x = 4265, y = 0, z = 1350}, + [3] = {x = 4950, y = 0, z = 4786}, + [4] = {x = 6641, y = 0, z = 858}, + [5] = {x = 2574, y = 0, z = 5271}, + [6] = {x = 2219, y = 0, z = 498}, + [7] = {x = 6993, y = 0, z = 5616}, + }, +} + +//// + +The nonCapturingUnits.lua config file is structured like this: +These are units that are not allowed to capture points. + +//// + local nonCapturingUnits = { "eairengineer", "efighter", - --"escout", "egunship2", "etransport", "edrone", "ebomber", } ---local pointMarker = FeatureDefNames.xelnotgawatchtower.id -- Feature marking a point- This doesn't do anything atm +return nonCapturingUnits + +//// +!!!!THIS IS NOW DEPRECATED IN LEIU OF BUILDINGMASK!!!! +The code has, however, been kept (commented out) in case other game developers end up having a use for it. + +The buildableUnits.lua config file is structured like this: +These are units that are allowed to be built within control points. + +//// + +local buildableUnits = { + "armamex", + "armmex", + "armmoho", + "armuwmex", + "armuwmme", + "corexp", + "cormex", + "cormexp", + "cormoho", + "coruwmex", + "coruwmme", +} + +return buildableUnits + +//// + +Here are all of the modoptions in a neat copy pastable form... Place these modoptions in modoptions.lua in your base game folder: + +//// +-- Control Victory Options + { + key = 'controlvictoryoptions', + name = 'Control Victory Options', + desc = 'Allows you to control at a granular level the individual options for Control Point Victory', + type = 'section', + }, + { + key="scoremode", + name="Scoring Mode (Control Victory Points)", + desc="Defines how the game is played", + type="list", + def="countdown", + section="controlvictoryoptions", + items={ + {key="disabled", name="Disabled", desc="Disable Control Points as a victory condition."}, + {key="countdown", name="Countdown", desc="A Control Point decreases all opponents' scores, zero means defeat."}, + {key="tugofwar", name="Tug of War", desc="A Control Point steals enemy score, zero means defeat."}, + {key="domination", name="Domination", desc="Holding all Control Points will grant 1000 score, first to reach the score limit wins."}, + } + }, + { + key = 'limitscore', + name = 'Total Score', + desc = 'Total score amount available.', + type = 'number', + section= 'controlvictoryoptions', + def = 2750, + min = 500, + max = 5000, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = "numberofcontrolpoints", + name = "Set number of Control Points on the map", + desc = "Sets the number of control points on the map and scales the total score amount to match. Has no effect if Preset map configs are enabled.", + section= "controlvictoryoptions", + type="list", + def="7", + section= "controlvictoryoptions", + items={ + {key="7", name="7", desc=""}, + {key="13", name="13", desc=""}, + {key="19", name="19", desc=""}, + {key="25", name="25", desc=""}, + } + }, + { + key = "usemapconfig", + name = "Use preset map-specific Control Point locations?", + desc = "Should the control point config for this map be used instead of autogenerated control points?", + type="list", + def="disabled", + section= "controlvictoryoptions", + items={ + {key="disabled", name="Disabled", desc="This will tell the game to use autogenerated control points."}, + {key="enabled", name="Enabled", desc="This will tell the game to use preset map control points (Set via map config)."}, + } + }, + { + key = 'captureradius', + name = 'Capture Radius', + desc = 'Radius around a point in which to capture it.', + type = 'number', + section= 'controlvictoryoptions', + def = 500, + min = 250, + max = 1000, + step = 25, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'capturetime', + name = 'Capture Time', + desc = 'Time to capture a point.', + type = 'number', + section= 'controlvictoryoptions', + def = 30, + min = 1, + max = 60, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'capturebonus', + name = 'Capture Bonus', + desc = 'Percentage of how much faster capture takes place by adding more units.', + type = 'number', + section= 'controlvictoryoptions', + def = 5, + min = 1, + max = 100, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'decapspeed', + name = 'De-Cap Speed', + desc = 'Speed multiplier for neutralizing an enemy point.', + type = 'number', + section= 'controlvictoryoptions', + def = 2, + min = 1, + max = 3, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'starttime', + name = 'Start Time', + desc = 'The time when capturing can start.', + type = 'number', + section= 'controlvictoryoptions', + def = 0, + min = 0, + max = 300, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'metalperpoint', + name = 'Metal given to each player per captured point', + desc = 'Each player on an allyteam that has captured a point will receive this amount of resources per point captured per second', + type = 'number', + section= 'controlvictoryoptions', + def = 0, + min = 0, + max = 20, + step = 0.1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'energyperpoint', + name = 'Energy given to each player per captured point', + desc = 'Each player on an allyteam that has captured a point will receive this amount of resources per point captured per second', + type = 'number', + section= 'controlvictoryoptions', + def = 0, + min = 0, + max = 20, + step = 0.1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'dominationscoretime', + name = 'Domination Score Time', + desc = 'Time needed holding all points to score in multi domination.', + type = 'number', + section= 'controlvictoryoptions', + def = 30, + min = 1, + max = 60, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'tugofwarmodifier', + name = 'Tug of War Modifier', + desc = 'The amount of score transfered between opponents when points are captured is multiplied by this amount.', + type = 'number', + section= 'controlvictoryoptions', + def = 2, + min = 0, + max = 6, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'dominationscore', + name = 'Score awarded for Domination', + desc = 'The amount of score awarded when you have scored a domination.', + type = 'number', + section= 'controlvictoryoptions', + def = 1000, + min = 500, + max = 1000, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, +-- End Control Victory Options +//// + + +That's all folks!!! +------------------- +]]-- + +nonCapturingUnits = VFS.Include"LuaRules/Configs/cv_nonCapturingUnits.lua" +--buildableUnits = VFS.Include"LuaRules/Configs/cv_buildableUnits.lua" + +--Make controlvictory exit if chickens are present + +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("[ControlVictory] Deactivated because Chickens are present!") + return false +end + +VFS.Include("LuaRules/Configs/cv_modOptions.lua") - -local captureRadius = tonumber(Spring.GetModOptions().captureradius) or 500 -- Radius around a point in which to capture it -local captureTime = tonumber(Spring.GetModOptions().capturetime) or 30 -- Time to capture a point -local captureBonus = tonumber(Spring.GetModOptions().capturebonus) or.5 -- speedup from adding more units -local decapSpeed = tonumber(Spring.GetModOptions().decapspeed) or 3 -- speed multiplier for neutralizing an enemy point local moveSpeed =.5 +local buildingMask = 2 + +--Here we mitigate potential issues caused by wonky options settings + +if numberOfControlPoints == 13 then + limitScore = limitScore * 2 + captureRadius = captureRadius * 0.83 +end + +if numberOfControlPoints == 19 then + limitScore = limitScore * 3 + captureRadius = captureRadius * 0.66 +end -local startTime = tonumber(Spring.GetModOptions().starttime) or 0 -- The time when capturing can start +if numberOfControlPoints == 25 then + limitScore = limitScore * 4 + captureRadius = captureRadius * 0.5 +end -local dominationScoreTime = tonumber(Spring.GetModOptions().dominationscoretime) or 30 -- Time needed holding all points to score in multi domination +--Smaller than 250 gets really hard to see on the minimap +if captureRadius < 250 then + captureRadius = 250 +end -Spring.Echo("Control Victory Scoring Mode: " .. (Spring.GetModOptions().scoremode or "Control Victory Scoring Mode Is Not Set!")) -if Spring.GetModOptions().scoremode == "disabled" then return false end +--End Mitigation of wonky options settings -local limitScore = tonumber(Spring.GetModOptions().limitscore) or 3500 local allyTeamColorSets={} local scoreModes = { disabled = 0, -- none (duh) countdown = 1, -- A point decreases all opponents' scores, zero means defeat - tugowar = 2, -- A point steals enemy score, zero means defeat - multidomination = 3, -- Holding all points will grant 100 score, first to reach the score limit wins + tugofwar = 2, -- A point steals enemy score, zero means defeat + domination = 3, -- Holding all points will grant 100 score, first to reach the score limit wins } local scoreMode = scoreModes[Spring.GetModOptions().scoremode or "countdown"] -local _, _, _, _, _, gaia = Spring.GetTeamInfo(Spring.GetGaiaTeamID()) +--Lets add a pretty way to access scoremodes +if scoreMode == 0 then scoreModeAsString = "Disabled" end +if scoreMode == 1 then scoreModeAsString = "Countdown" end +if scoreMode == 2 then scoreModeAsString = "Tug of War" end +if scoreMode == 3 then scoreModeAsString = "Domination" end + + +Spring.Echo("[ControlVictory] Control Victory Scoring Mode: " .. cvMode) + +local gaia = Spring.GetGaiaTeamID() local mapx, mapz = Game.mapSizeX, Game.mapSizeZ if (gadgetHandler:IsSyncedCode()) then @@ -91,6 +407,10 @@ if (gadgetHandler:IsSyncedCode()) then local function gNonCapturingUnits() return nonCapturingUnits or {} end + + local function gBuildableUnits() + return buildableUnits or {} + end local function gCaptureRadius() return captureRadius or 0 @@ -101,6 +421,7 @@ if (gadgetHandler:IsSyncedCode()) then function gadget:Initialize() gadgetHandler:RegisterGlobal('ControlPoints', gControlPoints) gadgetHandler:RegisterGlobal('NonCapturingUnits', gNonCapturingUnits) + gadgetHandler:RegisterGlobal('BuildableUnits', gBuildableUnits) gadgetHandler:RegisterGlobal('CaptureRadius', gCaptureRadius) for _, a in ipairs(Spring.GetAllyTeamList()) do if scoreMode ~= 3 then @@ -110,39 +431,250 @@ if (gadgetHandler:IsSyncedCode()) then end end score[gaia] = 0 - local configfile, _ = string.gsub(Game.mapName, ".smf$", ".lua") - configfile = "LuaRules/Configs/ControlPoints/cv_" .. configfile .. ".lua" - Spring.Echo(configfile .. " -This is the name of the control victory configfile-") - if VFS.FileExists(configfile) then - local config = VFS.Include(configfile) - points = config.points - for _, p in pairs(points) do - p.capture = 0 - end - moveSpeed = 0 +---------------------------------- + + + + if scoreModeAsString == "Domination" then + local angle = math.random() * math.pi * 2 + points = {} + for i=1,3 do + local angle = angle + i * math.pi * 1/1.5 + points[i] = { + x=mapx/2 + mapx * .12 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .12 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end else - Spring.Echo("No Control Victory Config File Found") ---[[ local angle = math.random() * math.pi * 2 - points = {} - for i=1,3 do - local angle = angle + i * math.pi * 2/3 - points[i] = { - x=mapx/2 + mapx * .4 * math.sin(angle), - y=0, - z=mapz/2 + mapz * .4 * math.cos(angle), - velx=moveSpeed * 10 * -1 * math.cos(angle), - velz=moveSpeed * 10 * math.sin(angle), - owner=nil, - aggressor=nil, - capture=0, - } - end ]]-- + if usemapconfig == "enabled" then + local configfile, _ = string.gsub(Game.mapName, ".smf$", ".lua") + configfile = "LuaRules/Configs/ControlPoints/cv_" .. configfile .. ".lua" + Spring.Echo("[ControlVictory] " .. configfile .. " -This is the name of the control victory configfile-") + if VFS.FileExists(configfile) and usemapconfig == "enabled" then + local config = VFS.Include(configfile) + points = config.points + for _, p in pairs(points) do + p.capture = 0 + end + moveSpeed = 0 + end + else + if numberOfControlPoints == 7 then + --Since no config file is found, we create 7 points spaced out in a circle on the map + local angle = math.random() * math.pi * 2 + points = {} + for i=2,7 do + local angle = angle + i * math.pi * 2/6 + points[i] = { + x=mapx/2 + mapx * .4 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .4 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + end + + if numberOfControlPoints == 13 then + local angle = math.random() * math.pi * 2 + points = {} + for i=2,7 do + local angle = angle + i * math.pi * 2/6 + points[i] = { + x=mapx/2 + mapx * .2 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .2 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=8,13 do + local angle = angle + i * math.pi * 2/6 + 9 + points[i] = { + x=mapx/2 + mapx * .4 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .4 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + end + + if numberOfControlPoints == 19 then + local angle = math.random() * math.pi * 2 + points = {} + for i=2,7 do + local angle = angle + i * math.pi * 2/6 + points[i] = { + x=mapx/2 + mapx * .18 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .18 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=8,13 do + local angle = angle + i * math.pi * 2/6 + 9 + points[i] = { + x=mapx/2 + mapx * .3 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .3 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=14,19 do + local angle = angle + i * math.pi * 2/6 + 18 + points[i] = { + x=mapx/2 + mapx * .4 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .4 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + end + + if numberOfControlPoints == 25 then + local angle = math.random() * math.pi * 2 + points = {} + for i=2,7 do + local angle = angle + i * math.pi * 2/6 + points[i] = { + x=mapx/2 + mapx * .16 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .16 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=8,13 do + local angle = angle + i * math.pi * 2/6 + 9 + points[i] = { + x=mapx/2 + mapx * .26 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .26 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=14,19 do + local angle = angle + i * math.pi * 2/6 + 20 + points[i] = { + x=mapx/2 + mapx * .29 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .29 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + + for i=20,25 do + local angle = angle + i * math.pi * 2/6 + 36 + points[i] = { + x=mapx/2 + mapx * .4 * math.sin(angle), + y=0, + z=mapz/2 + mapz * .4 * math.cos(angle), + --We can make them move around if we want to by uncommenting these lines and the ones below + --velx=moveSpeed * 10 * -1 * math.cos(angle), + --velz=moveSpeed * 10 * math.sin(angle), + owner=nil, + aggressor=nil, + capture=0, + } + end + end + end + + points[1] = { + x=mapx/2, + y=0, + z=mapz/2, + owner=nil, + aggressor=nil, + capture=0, + } end _G.points = points _G.score = score _G.dom = dom + + + -- Set building masks for control points + if useBuildingMask == true then + for _, capturePoint in pairs(points) do + local r = captureRadius + local mask = buildingMask + local r2 = r * r + local step = Game.squareSize * 2 + for z = 0, 2 * r, step do -- top to bottom diameter + local lineLength = math.sqrt(r2 - (r - z) ^ 2) + for x = -lineLength, lineLength, step do + local squareX, squareZ = (capturePoint.x + x)/step, (capturePoint.z + z - r)/step + if squareX > 0 and squareZ > 0 and squareX < Game.mapSizeX/step and squareZ < Game.mapSizeZ/step then + Spring.SetSquareBuildingMask(squareX, squareZ, mask) + --Spring.MarkerAddPoint((cx + x), 0, (cz + z - r)) + end + end + end + end + end + end - + + + + +------------- function gadget:GameFrame(f) -- This causes the points to move around, windows screensaver style :-) --[[ for _,p in pairs(points) do @@ -162,7 +694,7 @@ if (gadgetHandler:IsSyncedCode()) then end end ]]-- - if f % 30 <.1 and f / 1800 > startTime then + if f % 30 <.1 and f / 30 > startTime then local owned = {} for _, allyTeamID in ipairs(Spring.GetAllyTeamList()) do owned[allyTeamID] = 0 @@ -180,32 +712,41 @@ if (gadgetHandler:IsSyncedCode()) then end if validUnit then local unitOwner = Spring.GetUnitAllyTeam(u) - --Spring.Echo(unitOwner) - if owner then - if owner == unitOwner then - count = 0 - break - else - count = count + 1 - end - else - if aggressor then - if aggressor == unitOwner then - count = count + 1 - else - aggressor = nil + if unitOwner ~= gaia then + --Spring.Echo(unitOwner) + if owner then + if owner == unitOwner then + count = 0 break + else + count = count + 1 end else - aggressor = unitOwner - count = count + 1 + if aggressor then + if aggressor == unitOwner then + count = count + 1 + else + aggressor = nil + break + end + else + aggressor = unitOwner + count = count + 1 + end end end end end - if owner and count > 0 then - capturePoint.aggressor = nil - capturePoint.capture = capturePoint.capture + (1 + captureBonus * (count - 1)) * decapSpeed + if owner then + if count > 0 then + capturePoint.aggressor = nil + capturePoint.capture = capturePoint.capture + (1 + captureBonus * (count - 1)) * decapSpeed + else + capturePoint.capture = capturePoint.capture - decapSpeed + if capturePoint.capture < 0 then + capturePoint.capture = 0 + end + end elseif aggressor then --Spring.Echo("capturePoint.aggressor", capturePoint.aggressor) if capturePoint.aggressor == aggressor then @@ -224,6 +765,24 @@ if (gadgetHandler:IsSyncedCode()) then owned[capturePoint.owner] = owned[capturePoint.owner] + 1 end end + + -- resources granted to each play on an allyteam that captures a point + for _, allyTeamID in ipairs(Spring.GetAllyTeamList()) do + local ateams = Spring.GetTeamList(allyTeamID) + for i = 1, #ateams do + local metalPerPoint = Spring.GetModOptions().metalperpoint + local energyPerPoint = Spring.GetModOptions().energyperpoint + if Spring.GetModOptions().metalperpoint == nil then + metalPerPoint = 0 + end + if Spring.GetModOptions().energyPerPoint == nil then + energyPerPoint = 0 + end + Spring.AddTeamResource(ateams[i], "metal", owned[allyTeamID] * metalPerPoint) -- adjust the 5 + Spring.AddTeamResource(ateams[i], "energy", owned[allyTeamID] * energyPerPoint) -- adjust the 5 + end + end + if scoreMode == 1 then -- Countdown for owner, count in pairs(owned) do for _, allyTeamID in ipairs(Spring.GetAllyTeamList()) do @@ -238,12 +797,12 @@ if (gadgetHandler:IsSyncedCode()) then Loser(allyTeamID) end end - elseif scoreMode == 2 then -- Tug o'War + elseif scoreMode == 2 then -- Tug of War for owner, count in pairs(owned) do for _, a in ipairs(Spring.GetAllyTeamList()) do if a ~= owner and score[a] > 0 then - score[a] = score[a] - count * 2 - score[owner] = score[owner] + count * 2 + score[a] = score[a] - count * tugofWarModifier + score[owner] = score[owner] + count * tugofWarModifier end end end @@ -253,7 +812,7 @@ if (gadgetHandler:IsSyncedCode()) then Loser(allyTeamID) end end - elseif scoreMode == 3 then -- Multi Domination + elseif scoreMode == 3 then -- Domination local prevDominator = dom.dominator dom.dominator = nil for owner, count in pairs(owned) do @@ -261,6 +820,9 @@ if (gadgetHandler:IsSyncedCode()) then dom.dominator = owner if prevDominator ~= owner or not dom.dominationTime then dom.dominationTime = f + 30 * dominationScoreTime + Spring.Echo([[--------------------------------------------]]) + Spring.Echo([[A domination will be scored in 30 seconds!!!]]) + Spring.Echo([[--------------------------------------------]]) end break end @@ -271,9 +833,12 @@ if (gadgetHandler:IsSyncedCode()) then capturePoint.owner = nil capturePoint.capture = 0 end - score[dom.dominator] = score[dom.dominator] + 1000 + score[dom.dominator] = score[dom.dominator] + Spring.GetModOptions().dominationscore if score[dom.dominator] >= limitScore then Winner(dom.dominator) + Spring.Echo([[-------------------------------]]) + Spring.Echo([[A domination has been scored!!!]]) + Spring.Echo([[-------------------------------]]) end end end @@ -281,31 +846,90 @@ if (gadgetHandler:IsSyncedCode()) then end end - function gadget:AllowUnitCreation(unit, builder, team, x, y, z) -- TODO: fix for comshare - if moveSpeed == 0 then - for _, p in pairs(points) do - if x and math.sqrt((x - p.x) * (x - p.x) + (z - p.z) * (z - p.z)) < captureRadius then - Spring.SendMessageToPlayer(team, "Cannot build units in a control point") - return false - end - end - end - return true - end +-- Allow units listed in the buildableUnits config to be built in control points +-- This is deprecated in leiu of buildingMask + -- local allowedBuildableUnits = {} + -- for i = 1, #buildableUnits do + -- if UnitDefNames[buildableUnits[i]] then + -- allowedBuildableUnits[UnitDefNames[buildableUnits[i]].id] = true + -- end + -- end + + -- function gadget:AllowUnitCreation(unit, builder, team, x, y, z) + -- if allowedBuildableUnits[unit] then + -- return true + -- end + -- for _, p in pairs(points) do + -- if x and math.sqrt((x - p.x) * (x - p.x) + (z - p.z) * (z - p.z)) < captureRadius then + -- Spring.SendMessageToPlayer(team, "This unit is not allowed to be built in Control Points") + -- return false + -- end + -- end + -- return true + -- end else -- UNSYNCED + + local pieces = math.floor(captureRadius / 20) + local OPTIONS = { + circlePieces = pieces, + circlePieceDetail = math.floor(pieces/4), + circleSpaceUsage = 0.85, + circleInnerOffset = 0, + rotationSpeed = 0.3, + } + pieces = nil + + local exampleImage = ":n:LuaRules/Images/controlpoints.png" + local showGameModeInfo = true + + local scoreboardRelX = 0.75 + local scoreboardRelY = 0.7 + local scoreboardWidth = 100 + local scoreboardHeight = 100 + + local bgMargin = 6 + local closeButtonSize = 30 + local vsx, vsy = Spring.GetViewGeometry() + local uiScale = 1 + + local closeButtonSize = 30 + local screenHeight = 212-bgMargin-bgMargin + local screenWidth = 1050-bgMargin-bgMargin + local screenX = (vsx*0.5) - (screenWidth/2) + local screenY = (vsy*0.5) + (screenHeight/2) + local loadedFontSize = 32 + local font = gl.LoadFont("luaui/Fonts/JosefinSans-SemiBold.ttf", loadedFontSize, 16,2) local Text = gl.Text local Color = gl.Color local DrawGroundCircle = gl.DrawGroundCircle + local glLineWidth = gl.LineWidth local PushMatrix = gl.PushMatrix local PopMatrix = gl.PopMatrix local Translate = gl.Translate + local BeginEnd = gl.BeginEnd + local CreateList = gl.CreateList + local CallList = gl.CallList local Scale = gl.Scale local Rotate = gl.Rotate local Rect = gl.Rect + local Vertex = gl.Vertex local Billboard = gl.Billboard + local QUADS = GL.QUADS + local TRIANGLE_FAN = GL.TRIANGLE_FAN + local PolygonOffset = gl.PolygonOffset local playerListEntry = {} + local capturePoints = {} + local controlPointSolidList = {} + + local prevTimer = Spring.GetTimer() + local currentRotationAngle = 0 + + local ringThickness = 3.5 + local capturePieParts = 4 + math.floor(captureRadius / 8) + + local scoreMode = Spring.GetModOptions().scoremode or "countdown" ----------------------------------------------------------------------------------------- -- creates initial player listing @@ -314,142 +938,629 @@ else -- UNSYNCED local playerEntries = {} for allyTeamID, teamScore in spairs(SYNCED.score) do -- note to self, allyTeamID +1 = ally team number - --if allyTeamID ~= gaia then - --does this allyteam have a table? if not, make one - if playerEntries[allyTeamID] == nil then - playerEntries[allyTeamID] = {} - -- Spring.Echo("creating allyTeamID table") - end - - for _,teamId in pairs(Spring.GetTeamList(allyTeamID))do - local playerList = Spring.GetPlayerList(teamId, true) - -- does this team have an entry? if not, make one! - if playerEntries[allyTeamID][teamId] == nil then - playerEntries[allyTeamID][teamId] = {} - -- Spring.Echo("creating team table") + if allyTeamID ~= gaia then + --does this allyteam have a table? if not, make one + if playerEntries[allyTeamID] == nil then + playerEntries[allyTeamID] = {} + -- Spring.Echo("creating allyTeamID table") end - local r, g, b = Spring.GetTeamColor(teamId) - local playerTeamColor = string.char("255",r*255,g*255,b*255) - for k,v in pairs(playerList)do - -- does this player have an entry? if not, make one! - if playerEntries[allyTeamID][teamId][v] == nil then - playerEntries[allyTeamID][teamId][v] = {} - -- Spring.Echo("creating player table") + + for _,teamId in pairs(Spring.GetTeamList(allyTeamID))do + local playerList = Spring.GetPlayerList(teamId, true) + -- does this team have an entry? if not, make one! + if playerEntries[allyTeamID][teamId] == nil then + playerEntries[allyTeamID][teamId] = {} + -- Spring.Echo("creating team table") end - - -- if Spring.Echo(playerEntries[allyTeamID][teamId][v]) then - -- Spring.Echo("waffles") - --end - playerEntries[allyTeamID][teamId][v]["name"] = Spring.GetPlayerInfo(v) - playerEntries[allyTeamID][teamId][v]["color"] = playerTeamColor - end -- end playerId - end -- end teamId - end -- allyTeamID + local r, g, b = Spring.GetTeamColor(teamId) + local playerTeamColor = string.char("255",r*255,g*255,b*255) + for k,v in pairs(playerList)do + -- does this player have an entry? if not, make one! + if playerEntries[allyTeamID][teamId][v] == nil then + playerEntries[allyTeamID][teamId][v] = {} + -- Spring.Echo("creating player table") + end + + -- if Spring.Echo(playerEntries[allyTeamID][teamId][v]) then + -- Spring.Echo("waffles") + --end + playerEntries[allyTeamID][teamId][v]["name"] = Spring.GetPlayerInfo(v) + playerEntries[allyTeamID][teamId][v]["color"] = playerTeamColor + end -- end playerId + end -- end teamId + end -- allyTeamID + end -- gaia exclusion return playerEntries end - - function gadget:Initialize() - playerListEntry = CreatePlayerList(playerEntries) - end - -- draws ground circles - local function DrawPoints() - --local teamAllyTeamID = Spring.GetLocalAllyTeamID() -- << FFS this isn't even used. - for _, capturePoint in spairs(SYNCED.points) do - --Spring.Echo(capturePoint) - --Spring.Echo(SYNCED.points) - - local r, g, b = 1, 1, 1 - if capturePoint.owner and capturePoint.owner ~= Spring.GetGaiaTeamID() then - r, g, b = Spring.GetTeamColor(Spring.GetTeamList(capturePoint.owner)[1]) - --Spring.Echo("Owner ID: " .. capturePoint.owner .. " -- Color: " .. r, g, b) + local function DrawCircleLine(innersize, outersize) + BeginEnd(QUADS, function() + local detailPartWidth, a1,a2,a3,a4 + local width = OPTIONS.circleSpaceUsage + local detail = OPTIONS.circlePieceDetail + + 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.circleInnerOffset+detailPartWidth - (width / detail)) * radstep) + a4 = ((i+OPTIONS.circleInnerOffset+detailPartWidth) * radstep) + + --outer (fadein) + Vertex(math.sin(a4)*innersize, 0, math.cos(a4)*innersize) + Vertex(math.sin(a3)*innersize, 0, math.cos(a3)*innersize) + --outer (fadeout) + Vertex(math.sin(a1)*outersize, 0, math.cos(a1)*outersize) + Vertex(math.sin(a2)*outersize, 0, math.cos(a2)*outersize) end - Color(r, g, b, 1) - --Spring.Echo("draw points", capturePoint.owner, r, g, b) - local y = Spring.GetGroundHeight(capturePoint.x, capturePoint.z) - - DrawGroundCircle(capturePoint.x, capturePoint.y, capturePoint.z, captureRadius, 30) - if capturePoint.capture > 0 then - PushMatrix() - Translate(capturePoint.x, y + 100, capturePoint.z) - Billboard() - Color(0, 0, 0, 1) - Rect(-26, 6, 26, -6) - Color(1, 1, 0, 1) - Rect(-25, 5, -25 + 50 * (capturePoint.capture / captureTime), -5) - PopMatrix() + end + end) + end + + function DrawCircleSolid(size, pieces, drawPieces, innercolor, outercolor, revert) + BeginEnd(TRIANGLE_FAN, function() + local radstep = (2.0 * math.pi) / pieces + local a1 + if (innercolor) then + Color(innercolor) + end + Vertex(0, 0, 0) + if (outercolor) then + Color(outercolor) + end + for i = 0, drawPieces do + if revert then + a1 = -(i * radstep) + else + a1 = (i * radstep) end - end - Color(1, 1, 1, 1) + Vertex(math.sin(a1)*size, 0, math.cos(a1)*size) + end + end) + 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 + 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) -- (coordinates work differently than the RectRound func in other widgets) + gl.Texture(":n:LuaRules/Images/bgcorner.png") + gl.BeginEnd(GL.QUADS, DrawRectRound, px,py,sx,sy,cs, tl,tr,br,bl) + gl.Texture(false) + end + + function viewResize(force) + vsx2,vsy2 = Spring.GetViewGeometry() + if force or vsx2 ~= vsy or vsx2 ~= vsy then + vsx,vsy = vsx2,vsy2 + uiScale = (0.75 + (vsx*vsy / 7500000)) + + screenX = (vsx*0.5) - (screenWidth/2) + screenY = (vsy*0.5) + (screenHeight/2) + + scoreboardX = (vsx * scoreboardRelX) - (((vsx/2) * (scoreboardRelX-0.5)) * (uiScale-1)) -- not acurate :( + scoreboardY = (vsy * scoreboardRelY) - (((vsy/2) * (scoreboardRelY-0.5)) * (uiScale-1)) -- not acurate :( + + if infoList then gl.DeleteList(infoList) end + infoList = CreateList(drawGameModeInfo) + end end + function gadget:Initialize() + playerListEntry = CreatePlayerList(playerEntries) + + viewResize(true) + + controlPointList = CreateList(DrawCircleLine, captureRadius-ringThickness, captureRadius) + if Spring.GetGameFrame() > 0 then + showGameModeInfo = false + end + + for i, capturePoint in spairs(SYNCED.points) do + if capturePoints[i] == nil then + capturePoints[i] = {} + capturePoints[i].color = {1,1,1} + capturePoints[i].aggressorColor = {1,1,1} + capturePoints[i].x = capturePoint.x + capturePoints[i].y = Spring.GetGroundHeight(capturePoint.x, capturePoint.z) + 2 + capturePoints[i].z = capturePoint.z + end + if capturePoint.owner and capturePoint.owner ~= gaia then + capturePoints[i].color[1],capturePoints[i].color[2],capturePoints[i].color[3] = Spring.GetTeamColor(Spring.GetTeamList(capturePoint.owner)[1]) + else + capturePoints[i].color = {1,1,1} + end + if capturePoint.aggressor and capturePoint.aggressor ~= gaia then + capturePoints[i].aggressorColor[1],capturePoints[i].aggressorColor[2],capturePoints[i].aggressorColor[3] = Spring.GetTeamColor(Spring.GetTeamList(capturePoint.aggressor)[1]) + else + capturePoints[i].aggressorColor = {1,1,1} + end + capturePoints[i].capture = capturePoint.capture + end + + end + function gadget:DrawInMiniMap() PushMatrix() - gl.LoadIdentity() - Translate(0, 1, 0) - Scale(1 / Game.mapSizeX, 1 / Game.mapSizeZ, 0) - Rotate(90, 1, 0, 0) - DrawPoints() + gl.LoadIdentity() + Translate(0, 1, 0) + Scale(1 / Game.mapSizeX, 1 / Game.mapSizeZ, 0) + Rotate(90, 1, 0, 0) + DrawPoints(true) PopMatrix() end - function gadget:DrawWorld() - gl.DepthTest(GL.LEQUAL) - gl.PolygonOffset(-10, -10) - DrawPoints() - gl.DepthTest(false) - gl.PolygonOffset(false) + function gadget:Update() + clockDifference = Spring.DiffTimers(Spring.GetTimer(), prevTimer) + prevTimer = Spring.GetTimer() + + -- animate rotation + if OPTIONS.rotationSpeed > 0 then + local angleDifference = (OPTIONS.rotationSpeed) * (clockDifference * 5) + currentRotationAngle = currentRotationAngle + (angleDifference*0.6) + if currentRotationAngle > 360 then + currentRotationAngle = currentRotationAngle - 360 + end + end + end + + function gadget:GameFrame() + + for i, capturePoint in spairs(SYNCED.points) do + if capturePoints[i] == nil then + capturePoints[i] = {} + capturePoints[i].color = {1,1,1} + capturePoints[i].aggressorColor = {1,1,1} + capturePoints[i].x = capturePoint.x + capturePoints[i].y = Spring.GetGroundHeight(capturePoint.x, capturePoint.z) + 2 + capturePoints[i].z = capturePoint.z + end + if capturePoint.owner and capturePoint.owner ~= gaia then + capturePoints[i].color[1],capturePoints[i].color[2],capturePoints[i].color[3] = Spring.GetTeamColor(Spring.GetTeamList(capturePoint.owner)[1]) + else + capturePoints[i].color = {1,1,1} + end + if capturePoint.aggressor and capturePoint.aggressor ~= gaia then + capturePoints[i].aggressorColor[1],capturePoints[i].aggressorColor[2],capturePoints[i].aggressorColor[3] = Spring.GetTeamColor(Spring.GetTeamList(capturePoint.aggressor)[1]) + else + capturePoints[i].aggressorColor = {1,1,1} + end + capturePoints[i].capture = capturePoint.capture + end + end + + function DrawPoints(simplified) + local capturedAlpha, capturingAlpha, prefix, parts + if simplified then -- for minimap + capturedAlpha = 0.7 + capturingAlpha = 0.85 + prefix = 'm_' -- so it uses different displaylists + parts = math.ceil((OPTIONS.circlePieces * OPTIONS.circlePieceDetail) / 5) + else + capturedAlpha = 0.7 + capturingAlpha = 0.85 + prefix = '' + parts = (OPTIONS.circlePieces * OPTIONS.circlePieceDetail) + end + for i,point in pairs(capturePoints) do + PushMatrix() + Translate(point.x, point.y, point.z) + -- owner circle backgroundcolor + if controlPointSolidList[prefix..point.color[1]..'_'..point.color[2]..'_'..point.color[3]] == nil then + controlPointSolidList[prefix..point.color[1]..'_'..point.color[2]..'_'..point.color[3]] = CreateList(DrawCircleSolid, captureRadius+ringThickness, parts, parts, {0,0,0,0}, {point.color[1], point.color[2], point.color[3], capturedAlpha}) + end + CallList(controlPointSolidList[prefix..point.color[1]..'_'..point.color[2]..'_'..point.color[3]]) + + -- captured percentage + if point.capture > 0 then + local revert = false + if point.aggressorColor[1]..'_'..point.aggressorColor[2]..'_'..point.aggressorColor[3] == '1_1_1' then + revert = true + end + local piesize = math.floor(((point.capture/captureTime) / (1/capturePieParts))+0.5) + if controlPointSolidList[prefix..point.aggressorColor[1]..'_'..point.aggressorColor[2]..'_'..point.aggressorColor[3]..'_'..piesize] == nil then + controlPointSolidList[prefix..point.aggressorColor[1]..'_'..point.aggressorColor[2]..'_'..point.aggressorColor[3]..'_'..piesize] = CreateList(DrawCircleSolid, (captureRadius-ringThickness*2), capturePieParts, piesize, {0,0,0,0}, {point.aggressorColor[1], point.aggressorColor[2], point.aggressorColor[3], capturingAlpha}, revert) + end + CallList(controlPointSolidList[prefix..point.aggressorColor[1]..'_'..point.aggressorColor[2]..'_'..point.aggressorColor[3]..'_'..piesize]) + end + if not simplified then -- not for minimap + --ring + Rotate(currentRotationAngle,0,1,0) + Color(1,1,1, 0.6) + CallList(controlPointList) + end + PopMatrix() + end + end + + function gadget:DrawWorldPreUnit() + PolygonOffset(-10000, -1) -- draw on top of water/map - sideeffect: will shine through terrain/mountains + DrawPoints(false) -- Todo: use DrawWorldPreUnit make it so that it colorizes the map/ground + PolygonOffset(false) + end + + + function gadget:GameStart() + --showGameModeInfo = false end - function gadget:DrawScreen(vsx, vsy) - local frame = Spring.GetGameFrame() - if frame / 1800 > startTime then - local n = 1 - local dominator = SYNCED.dom.dominatorwa - local dominationTime = SYNCED.dom.dominationTime + + function drawGameModeInfo() + + local white = "\255\255\255\255" + local offwhite = "\255\210\210\210" + 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" + + PushMatrix() + Translate(-(vsx * (uiScale-1))/2, -(vsy * (uiScale-1))/2, 0) + Scale(uiScale,uiScale,1) + local x = screenX --rightwards + local y = screenY --upwards + + -- background + Color(0,0,0,0.8) + RectRound(x-bgMargin,y-screenHeight-bgMargin,x+screenWidth+bgMargin,y+bgMargin,8, 0,1,1,1) + -- content area + 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 + Color(1,1,1,1) + PushMatrix() + 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) + PopMatrix() + + -- title + local title = offwhite .. [[Area Capture Mode ]] .. yellow .. scoreModeAsString + local titleFontSize = 18 + Color(0,0,0,0.8) + titleRect = {x-bgMargin, y+bgMargin, x+(gl.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() + + -- image of minimap showing controlpoints + local imageSize = 200 + Color(1,1,1,1) + gl.Texture(exampleImage) + gl.TexRect(x,y,x+imageSize,y-imageSize) + gl.Texture(false) + + -- textarea + + local infotext = offwhite .. [[Controlpoints are spread across the map. They can be captured by moving units into the circles. +Note that you can only build certain units inside them (e.g. Metal Extractors/Resource Node Generators). + +There are 3 modes (Current mode is ]] .. yellow .. scoreModeAsString .. offwhite .. [[): +- Countdown: Your score counts down until zero based upon how many points your enemy owns. +- Tug of War: Score is transferred between teams. Score transferred is multiplied by ]] .. yellow .. tugofWarModifier .. offwhite .. [[. +- Domination: Capture all controlpoints on the map for ]] .. yellow .. dominationScoreTime .. offwhite .. [[ seconds in order to gain ]] .. yellow .. dominationScore .. offwhite .. [[ score. Goal ]] .. yellow .. limitScore .. offwhite .. [[. + +You will also gain ]] .. white .. [[+]] .. skyblue .. metalPerPoint .. offwhite .. [[ metal and ]] .. white .. [[+]] .. yellow .. energyPerPoint .. offwhite ..[[ energy for each controlpoint you own. + +There are various options available in the lobby bsettings (use ]] .. yellow .. [[!list bsettings]] .. offwhite .. [[ in the lobby chat)]] + + Text(infotext, x+imageSize+15, y-25, 16, "no") + + PopMatrix() + end + + function drawMouseoverScoreboard() + PushMatrix() + Translate(-(vsx * (uiScale-1))/2, -(vsy * (uiScale-1))/2, 0) + Scale(uiScale,uiScale,1) + local x = scoreboardX --rightwards + local y = scoreboardY --upwards + local width = scoreboardWidth + local height = scoreboardHeight + local maxWidth = width + local maxHeight = height + + -- background + Color(0,0,0,0.8) + RectRound(x-bgMargin,y-height-bgMargin,x+width+bgMargin,y+bgMargin,8, 0,1,1,1) + + -- text + Text("\255\200\200\200Use middlemouse\nto drag this window", x+scoreboardWidth/2, y-(scoreboardHeight/2)+7, 14, "co") + + PopMatrix() + end + + + function drawScoreboard() + PushMatrix() + Translate(-(vsx * (uiScale-1))/2, -(vsy * (uiScale-1))/2, 0) + Scale(uiScale,uiScale,1) + local x = scoreboardX --rightwards + local y = scoreboardY --upwards + local width = scoreboardWidth + local height = scoreboardHeight + local maxWidth = width + local maxHeight = height + + -- background + Color(0,0,0,0.8) + RectRound(x-bgMargin,y-height-bgMargin,x+width+bgMargin,y+bgMargin,8, 0,1,1,1) + -- content area + Color(0.33,0.33,0.33,0.15) + RectRound(x,y-height,x+width,y,6) + + -- title + local title = "\255\255\255\255"..scoreModeAsString + local titleFontSize = 18 + Color(0,0,0,0.8) + titleRect = {x-bgMargin, y+bgMargin, x+(gl.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() + + local n = 1 + local dominator = SYNCED.dom.dominatorwa + local dominationTime = SYNCED.dom.dominationTime local white = string.char("255","255","255","255") - + local allyCounter = 0 + -- for all the scores with a team. - for allyTeamID, teamScore in spairs(SYNCED.score) do + for allyTeamID, allyScore in spairs(SYNCED.score) do --Spring.Echo("at allied team ID", allyTeamID) -- note to self, allyTeamID +1 = ally team number - - for _,teamId in pairs(Spring.GetTeamList(allyTeamID))do + local allyTeamMembers = Spring.GetTeamList(allyTeamID) + if allyTeamID ~= gaia and allyTeamMembers and (#allyTeamMembers > 0) then + local allyFound = false + local name = "Some Bot" + local team = allyTeamMembers[1] + + for _,teamId in pairs(Spring.GetTeamList(allyTeamID))do --Spring.Echo("\tat team ID", teamId) - -- gaia player doesn't count - if teamId ~= gaia then - - local playerList = Spring.GetPlayerList(teamId) - local r, g, b = Spring.GetTeamColor(teamId) - local playerTeamColor = string.char("255",r*255,g*255,b*255) - --Spring.Echo("\t\t\tplayerList", #playerList) - for _,playerId in pairs(playerList)do - local _, _, spectator = Spring.GetPlayerInfo(playerId) - --Spring.Echo("\t\t\t\tnot player") - --Spring.Echo("allied team ID", allyTeamID, "\t", "team ID", teamId, Spring.GetPlayerInfo(playerId)) - --Spring.Echo(Spring.GetPlayerInfo(_, _, spectator)) - if not spectator then - Text(playerTeamColor .. Spring.GetPlayerInfo(playerId) .. "'s Team (" .. Spring.GetTeamInfo(teamId) .. ")" .. white, vsx - 280, vsy * .58 - 38 * playerId+10, 16, "lo") - Text(white .. "Score: " .. teamScore, vsx - 250, vsy * .5625 - 38 * playerId+8, 16, "lo") - end - end -- end playerId - - end -- not gaia + + local playerList = Spring.GetPlayerList(teamId) + --Spring.Echo("\t\t\tplayerList", #playerList) + for _,playerId in pairs(playerList)do + local _, _, spectator = Spring.GetPlayerInfo(playerId) + --Spring.Echo("\t\t\t\tplayer") + --Spring.Echo("allied team ID", allyTeamID, "\t", "team ID", teamId, Spring.GetPlayerInfo(playerId)) + --Spring.Echo(Spring.GetPlayerInfo(_, _, spectator)) + if not spectator and not allyFound then + name = Spring.GetPlayerInfo(playerId) + team = teamId + allyFound = true + end + end -- end playerId end -- end teamId - - end + + if allyFound == false then + if Spring.GetTeamLuaAI(team) == "" then + name = "Evil Machine" + else + name = Spring.GetTeamLuaAI(team) + end + --get AI info? + end + local r, g, b = Spring.GetTeamColor(team) + color = string.char("255",r*255,g*255,b*255) + Text(color .. name .. "'s team", x+10, y - 22 - (55 * allyCounter-1), 16, "lo") + Text(white .. "\255\200\200\200Score: \255\255\255\255" .. allyScore, x+10, y - 42 -(55 * allyCounter-1), 16, "lo") + + local textwidth = 20 + gl.GetTextWidth(name .. "'s team")*16 + if textwidth > maxWidth then + maxWidth = textwidth + end + maxHeight = 42 +(55 * allyCounter-1) + 13 + allyCounter = allyCounter + 1 + end -- not gaia + end -- end allyTeamID if dominator and dominationTime > Spring.GetGameFrame() then -- Text( playerListEntry[dominator]["color"] .. "<" .. playerListEntry[dominator] .. "> will score a --Domination in " .. -- math.floor((dominationTime - Spring.GetGameFrame()) / 30) .. -- " seconds!", vsx *.5, vsy *.7, 24, "oc") end + scoreboardWidth = maxWidth + scoreboardHeight = maxHeight + PopMatrix() + end + + function gadget:DrawScreen(vsx, vsy) + + viewResize() + + if showGameModeInfo then + if infoList == nil then infoList = CreateList(drawGameModeInfo) end + CallList(infoList) + end + + local frame = Spring.GetGameFrame() + if frame / 30 > startTime then + if controlPointPromptPlayed ~= true then + Spring.PlaySoundFile("sounds/ui/controlpointscanbecaptured.wav", 1) + Spring.Echo([[Control Points may now be captured!]]) + controlPointPromptPlayed = true + end + if scoreboardList == nil or frame%15==0 then + if scoreboardList ~= nil then + gl.DeleteList(scoreboardList) + end + scoreboardList = CreateList(drawScoreboard) + end + CallList(scoreboardList) + + local mx,my = Spring.GetMouseState() + local rectX1 = ((scoreboardX-bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY1 = ((scoreboardY+bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + local rectX2 = ((scoreboardX+scoreboardWidth+bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY2 = ((scoreboardY-scoreboardHeight-bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + if IsOnRect(mx, my, rectX1, rectY2, rectX2, rectY1) then + if mouseoverScoreboard == nil then + mouseoverScoreboard = true + if mouseoverScoreboardList ~= nil then + gl.DeleteList(mouseoverScoreboardList) + end + mouseoverScoreboardList = CreateList(drawMouseoverScoreboard) + end + else + mouseoverScoreboard = nil + end + if mouseoverScoreboard then + CallList(mouseoverScoreboardList) + end else Text("Capturing points begins in:", vsx - 280, vsy *.58, 18, "lo") - local timeleft = startTime * 60 - frame / 30 + local timeleft = startTime - frame / 30 timeleft = timeleft - timeleft % 1 Text(timeleft .. " seconds", vsx - 280, vsy *.58 - 25, 18, "lo") end end + -end \ No newline at end of file + 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 gadget:MouseMove(x, y, dx, dy) + if draggingScoreboard then + scoreboardRelX = scoreboardRelX + (dx/vsx) + scoreboardRelY = scoreboardRelY + (dy/vsy) + if scoreboardList ~= nil then + gl.DeleteList(scoreboardList) + end + scoreboardList = CreateList(drawScoreboard) + + if mouseoverScoreboardList ~= nil then + gl.DeleteList(mouseoverScoreboardList) + end + mouseoverScoreboardList = CreateList(drawMouseoverScoreboard) + end + end + + function gadget:MousePress(x, y, button) + return mouseEvent(x, y, button, false) + end + + function gadget:MouseRelease(x, y, button) + return mouseEvent(x, y, button, true) + end + + function mouseEvent(x, y, button, release) + + if Spring.IsGUIHidden() then return false end + if release and draggingScoreboard ~= nil then + draggingScoreboard = nil + end + if not release and Spring.GetGameFrame() > 0 then + local rectX1 = ((scoreboardX-bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY1 = ((scoreboardY+bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + local rectX2 = ((scoreboardX+scoreboardWidth+bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY2 = ((scoreboardY-scoreboardHeight-bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + if button == 2 and IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + draggingScoreboard = true + return true + end + end + + if showGameModeInfo then + -- on window + local rectX1 = ((screenX-bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY1 = ((screenY+bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + local rectX2 = ((screenX+screenWidth+bgMargin) * uiScale) - ((vsx * (uiScale-1))/2) + local rectY2 = ((screenY-screenHeight-bgMargin) * uiScale) - ((vsy * (uiScale-1))/2) + if IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + + -- on close button + local brectX1 = rectX2 - ((closeButtonSize+bgMargin+bgMargin) * uiScale) + local brectY2 = rectY1 - ((closeButtonSize+bgMargin+bgMargin) * uiScale) + if IsOnRect(x, y, brectX1, brectY2, rectX2, rectY1) then + if release then + showGameModeInfo = false + end + return true + end + end + end + end + +end diff --git a/LuaRules/Gadgets/game_death_messages.lua b/LuaRules/Gadgets/game_death_messages.lua new file mode 100644 index 000000000..149a40e0e --- /dev/null +++ b/LuaRules/Gadgets/game_death_messages.lua @@ -0,0 +1,143 @@ +function gadget:GetInfo() + return { + name = "Death Messages", + desc = "Makes callins for death messages", + author = "Bluestone", + date = "Sept 2013", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +--This gadget makes callins for death messages accessible via Script.LuaRules +--The callins are called from within game_end + +--Each team can be part of precisely one death messages +--This death message can be either just for itself (if it resigns/etc) or as part of its allyteam message (if it is alive when its allyteam dies) +--Whichever call comes first will be the death message for that team + +-- synced only +if (not gadgetHandler:IsSyncedCode()) then + return false +end + +local slen = string.len +local ssub = string.sub +local sgsub = string.gsub + +local playerListByTeam = {} --loaded up at game start, doesn't include specs, doesn't change over time +local toMsg = {} +local msg + +--include the teamDeathMessages and allyTeamDeathMessages tables +--format is table[i]="deathmsg" +include("luarules/configs/death_messages.lua") +local numTeamDeathMsgs = #teamDeathMessages +local numAllyTeamDeathMsgs = #allyTeamDeathMessages +local msgColour = "\255\255\255\255" + +--construct death message for team +function TeamDeathMessage(teamID) + --choose msg + local n = math.random(numTeamDeathMsgs) + local msg = teamDeathMessages[n] + if msg == nil then + return "Team " .. teamID .. " got an error (no msg) instead of a death message!" + end + + local plList = playerListByTeam[teamID] + if plList == nil then + return --this team has already received a death message + end + + --fill in XX + local plNames = "" + for _,name in pairs(plList) do + plNames = plNames .. name .. ", " + end + if slen(plNames)-2 < 1 then + return "Team " .. teamID .. " got an error (no names) instead of a death message!" + end + plNames = ssub(plNames, 1, slen(plNames)-2) --remove final ", " + if plNames ~= "" then + plNames = " (" .. plNames .. ")" + end + local toCut = "XX" + local toPaste = "Team " .. teamID .. plNames + local msg,_ = sgsub(msg, toCut, toPaste) + + --send msg + msg = msgColour .. msg + Spring.SendMessage(msg) + + --remove names from playerListByTeam + playerListByTeam[teamID] = nil +end + +function AllyTeamDeathMessage(allyTeamID) + --choose msg + local n = math.random(numAllyTeamDeathMsgs) + local msg = allyTeamDeathMessages[n] + if msg == nil then + return "Allyteam " .. allyTeamID .. " got an error (no msg) instead of a death message!" + end + + --fill in XX + local teamList = Spring.GetTeamList(allyTeamID) + local plNames = "" + for _,teamID in pairs(teamList) do + local plList = playerListByTeam[teamID] + if plList ~= nil then --this team already received a death msg (and is dead), don't include it in the allyteam msg + for _,name in pairs(plList) do + plNames = plNames .. name .. ", " + end + playerListByTeam[teamID] = nil --don't let this team get any more death messages + end + end + if slen(plNames)-2 < 1 then + return "Allyteam " .. allyTeamID .. " got an error (no names) instead of a death message!" + end + plNames = ssub(plNames, 1, slen(plNames)-2) --remove final ", " + if plNames ~= "" then + plNames = " (" .. plNames .. ")" + end + local toCut = "XX" + local toPaste = "Allyteam " .. allyTeamID .. plNames + local msg,_ = sgsub(msg, toCut, toPaste) + + --send msg + msg = msgColour .. msg + Spring.SendMessage(msg) +end + +function gadget:Initialize() + --load a list of players for each team into playerListByTeam + local teamList = Spring.GetTeamList() + for _,teamID in pairs(teamList) do + local playerList = Spring.GetPlayerList(teamID) + local list = {} --without specs + for _,playerID in pairs(playerList) do + local name, _, isSpec = Spring.GetPlayerInfo(playerID) + if not isSpec then + table.insert(list, name) + end + end + playerListByTeam[teamID] = list + end + + --register functions so as they can be called from game_end (call as e.g. Script.LuaRules.TeamDeathMessage(teamID)) + gadgetHandler:RegisterGlobal('TeamDeathMessage', TeamDeathMessage) + gadgetHandler:RegisterGlobal('AllyTeamDeathMessage', AllyTeamDeathMessage) +end + +function gadget:Shutdown() + gadgetHandler:DeregisterGlobal('TeamDeathMessage') + gadgetHandler:DeregisterGlobal('AllyTeamDeathMessage') +end + + + + + + diff --git a/LuaRules/Gadgets/game_end.lua b/LuaRules/Gadgets/game_end.lua index 0dce49d32..0f65d23ea 100644 --- a/LuaRules/Gadgets/game_end.lua +++ b/LuaRules/Gadgets/game_end.lua @@ -2,10 +2,10 @@ -------------------------------------------------------------------------------- -- -- file: game_end.lua --- brief: spawns start unit and sets storage levels +-- brief: handles trigger conditions for game over -- author: Andrea Piras -- --- Copyright (C) 2010,2011. +-- Copyright (C) 2010-2013. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- @@ -16,10 +16,10 @@ function gadget:GetInfo() name = "Game End", desc = "Handles team/allyteam deaths and declares gameover", author = "Andrea Piras", - date = "August, 2010", + date = "June, 2013", license = "GNU GPL, v2 or later", layer = 0, - enabled = false -- loaded by default? + enabled = true -- loaded by default? } end @@ -31,106 +31,208 @@ if (not gadgetHandler:IsSyncedCode()) then return false end -local modOptions = Spring.GetModOptions() - --- teamDeathMode possible values: "none", "teamzerounits" , "allyzerounits" -local teamDeathMode = modOptions.teamdeathmode or "teamzerounits" +-- In this gadget, an allyteam is declared dead when it no longer has any units +-- Allyteam explosion when no coms are left (killing all remaining units of that allyteam) is implemented in teamcomends.lua -- sharedDynamicAllianceVictory is a C-like bool -local sharedDynamicAllianceVictory = tonumber(modOptions.shareddynamicalliancevictory) or 0 +local sharedDynamicAllianceVictory = tonumber(Spring.GetModOptions().shareddynamicalliancevictory) or 1 -- ignoreGaia is a C-like bool -local ignoreGaia = tonumber(modOptions.ignoregaiawinner) or 1 +local ignoreGaia = 1 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local gaiaTeamID = Spring.GetGaiaTeamID() -local spKillTeam = Spring.KillTeam -local spGetAllyTeamList = Spring.GetAllyTeamList -local spGetTeamList = Spring.GetTeamList -local spGetTeamInfo = Spring.GetTeamInfo -local spGameOver = Spring.GameOver -local spAreTeamsAllied = Spring.AreTeamsAllied +local KillTeam = Spring.KillTeam +local GetAllyTeamList = Spring.GetAllyTeamList +local GetTeamList = Spring.GetTeamList +local GetPlayerInfo = Spring.GetPlayerInfo +local GetPlayerList = Spring.GetPlayerList +local GetTeamInfo = Spring.GetTeamInfo +local GetTeamUnitCount = Spring.GetTeamUnitCount +local GetAIInfo = Spring.GetAIInfo +local GetTeamLuaAI = Spring.GetTeamLuaAI +local GameOver = Spring.GameOver +local AreTeamsAllied = Spring.AreTeamsAllied -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - -local gaiaAllyTeamID -local allyTeams = spGetAllyTeamList() -local teamsUnitCount = {} -local allyTeamUnitCount = {} -local allyTeamAliveTeamsCount = {} +--allyTeamInfos structure: +-- allyTeamInfos = { +-- [allyTeamID] = { +-- teams = { +-- [teamID]= { +-- unitCount, +-- isGaia, +-- dead, +-- isAI, +-- isControlled, +-- players = { +-- [playerID] = isControlling +-- }, +-- }, +-- }, +-- unitCount, +-- isGaia, +-- dead, +-- }, +--} +local allyTeamInfos = {} local teamToAllyTeam = {} -local aliveAllyTeamCount = 0 -local killedAllyTeams = {} - +local playerIDtoAIs = {} +local playerQuitIsDead = true -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GameOver() -- remove ourself after successful game over - gadgetHandler:RemoveGadget() + gadgetHandler:RemoveGadget(self) +end + +function gadget:Initialize() + if tostring(Spring.GetModOptions().deathmode) == "neverend" then + gadgetHandler:RemoveGadget(self) + return + end + + local gaiaTeamID = Spring.GetGaiaTeamID() + local teamCount = 0 + for _,teamID in ipairs(GetTeamList()) do + if ignoreGaia ~= 1 or teamID ~= gaiaTeamID then + teamCount = teamCount + 1 + end + end + + if teamCount < 2 then -- sandbox mode ( possibly gaia + possibly one player) + gadgetHandler:RemoveGadget(self) + return + elseif teamCount == 2 then + playerQuitIsDead = false -- let player quit & rejoin in 1v1 + end + + -- at start, fill in the table of all alive allyteams + for _,allyTeamID in ipairs(GetAllyTeamList()) do + local allyTeamInfo = {} + allyTeamInfo.unitCount = 0 + allyTeamInfo.teams = {} + for _,teamID in ipairs(GetTeamList(allyTeamID)) do + teamToAllyTeam[teamID] = allyTeamID + local teamInfo = {} + teamInfo.players = {} + --is it engine ai? + teamInfo.isAI = select(4,GetTeamInfo(teamID)) + teamInfo.hasLeader = select(2,GetTeamInfo(teamID)) >= 0 + if teamInfo.isAI then + --store who hosts that engine ai + local AIHostPlayerID = select(3,GetAIInfo(teamID)) + playerIDtoAIs[AIHostPlayerID] = playerIDtoAIs[AIHostPlayerID] or {} + playerIDtoAIs[AIHostPlayerID][teamID] = allyTeamID + end + --is luaai + if GetTeamLuaAI(teamID) ~= "" then + teamInfo.isAI = true + teamInfo.isControlled = true + end + --is gaia + if teamID == gaiaTeamID then + allyTeamInfo.isGaia = true + teamInfo.isGaia = true + teamInfo.isControlled = true + end + teamInfo.unitCount = GetTeamUnitCount(teamID) + allyTeamInfo.unitCount = allyTeamInfo.unitCount + teamInfo.unitCount + allyTeamInfo.teams[teamID] = teamInfo + end + allyTeamInfos[allyTeamID] = allyTeamInfo + end + for _,playerID in ipairs(GetPlayerList()) do + CheckPlayer(playerID) + end end local function IsCandidateWinner(allyTeamID) - local isAlive = (killedAllyTeams[allyTeamID] ~= true) - local gaiaCheck = (ignoreGaia == 0) or (allyTeamID ~= gaiaAllyTeamID) - return isAlive and gaiaCheck + return not allyTeamInfos[allyTeamID].dead and (ignoreGaia == 0 or not allyTeamInfos[allyTeamID].isGaia) end local function CheckSingleAllyVictoryEnd() - if aliveAllyTeamCount ~= 1 then - return false - end - + local winnerCount = 0 + local candidateWinners = {} -- find the last remaining allyteam - for _,candidateWinner in ipairs(allyTeams) do - if IsCandidateWinner(candidateWinner) then - return {candidateWinner} + for allyTeamID in pairs(allyTeamInfos) do + if IsCandidateWinner(allyTeamID) then + winnerCount = winnerCount + 1 + candidateWinners[#candidateWinners+1] = allyTeamID end end - - return {} + if #candidateWinners > 1 then + return false + end + return candidateWinners end -local function AreAllyTeamsDoubleAllied( firstAllyTeamID, secondAllyTeamID ) +local function AreAllyTeamsDoubleAllied(firstAllyTeamID, secondAllyTeamID) -- we need to check for both directions of alliance - return spAreTeamsAllied( firstAllyTeamID, secondAllyTeamID ) and spAreTeamsAllied( secondAllyTeamID, firstAllyTeamID ) + for teamA in pairs(allyTeamInfos[firstAllyTeamID].teams) do + for teamB in pairs(allyTeamInfos[secondAllyTeamID].teams) do + if not AreTeamsAllied(teamA, teamB) or not AreTeamsAllied(teamB, teamA) then + return false + end + end + end + return true end local function CheckSharedAllyVictoryEnd() -- we have to cross check all the alliances local candidateWinners = {} local winnerCountSquared = 0 - for _,firstAllyTeamID in ipairs(allyTeams) do - if IsCandidateWinner(firstAllyTeamID) then - for _,secondAllyTeamID in ipairs(allyTeams) do - if IsCandidateWinner(secondAllyTeamID) and AreAllyTeamsDoubleAllied( firstAllyTeamID, secondAllyTeamID ) then + local aliveCount = 0 + for allyTeamA in pairs(allyTeamInfos) do + if IsCandidateWinner(allyTeamA) then + aliveCount = aliveCount + 1 + for allyTeamB in pairs(allyTeamInfos) do + if IsCandidateWinner(allyTeamB) and AreAllyTeamsDoubleAllied(allyTeamA, allyTeamB) then -- store both check directions -- since we're gonna check if we're allied against ourself, only secondAllyTeamID needs to be stored - candidateWinners[secondAllyTeamID] = true + candidateWinners[allyTeamB] = true winnerCountSquared = winnerCountSquared + 1 end end end end - if winnerCountSquared == (aliveAllyTeamCount*aliveAllyTeamCount) then - -- all the allyteams alive are bidirectionally allied against eachother, they are all winners - local winnersCorrectFormat = {} - for winner in pairs(candidateWinners) do - winnersCorrectFormat[#winnersCorrectFormat+1] = winner - end - return winnersCorrectFormat + if aliveCount*aliveCount ~= winnerCountSquared then + return false end + + -- all the allyteams alive are bidirectionally allied against eachother, they are all winners + local winnersCorrectFormat = {} + for winner in pairs(candidateWinners) do + winnersCorrectFormat[#winnersCorrectFormat+1] = winner + end + return winnersCorrectFormat - -- couldn't find any winner - return false end -local function CheckGameOver() + +local function UpdateAllyTeamIsDead(allyTeamID) + local allyTeamInfo = allyTeamInfos[allyTeamID] + local dead = true + for teamID,teamInfo in pairs(allyTeamInfo.teams) do + if not playerQuitIsDead then + dead = dead and (teamInfo.dead or not teamInfo.hasLeader ) + else + dead = dead and (teamInfo.dead or not teamInfo.isControlled ) + end + end + allyTeamInfos[allyTeamID].dead = dead +end + +function gadget:GameFrame() + for _,playerID in ipairs(GetPlayerList()) do + CheckPlayer(playerID) -- because not all events that we want to test call gadget:PlayerChanged (e.g. allying) + end local winners if sharedDynamicAllianceVictory == 0 then winners = CheckSingleAllyVictoryEnd() @@ -139,129 +241,80 @@ local function CheckGameOver() end if winners then - spGameOver(winners) + GameOver(winners) end end -local function KillTeamsZeroUnits() - -- kill all the teams that have zero units - for teamID, unitCount in pairs(teamsUnitCount) do - if unitCount == 0 then - spKillTeam( teamID ) - end - end -end -local function KillAllyTeamsZeroUnits() - -- kill all the allyteams that have zero units - for allyTeamID, unitCount in pairs(allyTeamUnitCount) do - if unitCount == 0 then - -- kill all the teams in the allyteam - local teamList = spGetTeamList(allyTeamID) - for _,teamID in ipairs(teamList) do - spKillTeam( teamID ) +function CheckPlayer(playerID) + local _,active,spectator,teamID = GetPlayerInfo(playerID) + local allyTeamID = teamToAllyTeam[teamID] + local teamInfo = allyTeamInfos[allyTeamID].teams[teamID] + teamInfo.players[playerID] = active and not spectator + teamInfo.hasLeader = select(2,GetTeamInfo(teamID)) >= 0 + if not teamInfo.hasLeader and not teamInfo.dead then + KillTeam(teamID) + Script.LuaRules.TeamDeathMessage(teamID) + end + if not teamInfo.isAI then + --if team isn't AI controlled, then we need to check if we have attached players + teamInfo.isControlled = false + for _,isControlling in pairs(teamInfo.players) do + if isControlling then + teamInfo.isControlled = true + break end end end -end - -local function KillResignedTeams() - -- Check for teams w/o leaders -> all players resigned & no AIs left in the team - -- Note: In the case a player drops he will still be the leader of the team! - -- So he can reconnect and take his units. - local teamList = Spring.GetTeamList() - for i=1, #teamList do - local teamID = teamList[i] - local leaderID = select(2, spGetTeamInfo(teamID)) - if (leaderID < 0) then - spKillTeam(teamID) - end + --if player is an AI controller, then mark all hosted AIs as uncontrolled + local AIHostList = playerIDtoAIs[playerID] or {} + for AITeam, AIAllyTeam in pairs(AIHostList) do + allyTeamInfos[AIAllyTeam].teams[AITeam].isControlled = active end + allyTeamInfos[allyTeamID].teams[teamID] = teamInfo + UpdateAllyTeamIsDead(allyTeamID) end -function gadget:GameFrame(frame) - -- only do a check in slowupdate - if (frame%16) == 0 then - CheckGameOver() - -- kill teams after checking for gameover to avoid to trigger instantly gameover - if teamDeathMode == "teamzerounits" then - KillTeamsZeroUnits() - elseif teamDeathMode == "allyzerounits" then - KillAllyTeamsZeroUnits() - end - KillResignedTeams() - end -end + function gadget:TeamDied(teamID) - teamsUnitCount[teamID] = nil local allyTeamID = teamToAllyTeam[teamID] - local aliveTeamCount = allyTeamAliveTeamsCount[allyTeamID] - if aliveTeamCount then - aliveTeamCount = aliveTeamCount - 1 - allyTeamAliveTeamsCount[allyTeamID] = aliveTeamCount - if aliveTeamCount <= 0 then - -- one allyteam just died - aliveAllyTeamCount = aliveAllyTeamCount - 1 - allyTeamUnitCount[allyTeamID] = nil - killedAllyTeams[allyTeamID] = true - end - end + local allyTeamInfo = allyTeamInfos[allyTeamID] + allyTeamInfo.teams[teamID].dead = true + allyTeamInfos[allyTeamID] = allyTeamInfo + UpdateAllyTeamIsDead(allyTeamID) + Script.LuaRules.TeamDeathMessage(teamID) end -function gadget:Initialize() - if teamDeathMode == "none" then - gadgetHandler:RemoveGadget() - end - - gaiaAllyTeamID = select(6, spGetTeamInfo(gaiaTeamID)) - - -- at start, fill in the table of all alive allyteams - for _,allyTeamID in ipairs(allyTeams) do - local teamList = spGetTeamList(allyTeamID) - local teamCount = 0 - for _,teamID in ipairs(teamList) do - teamToAllyTeam[teamID] = allyTeamID - if (ignoreGaia == 0) or (teamID ~= gaiaTeamID) then - teamCount = teamCount + 1 - end - end - allyTeamAliveTeamsCount[allyTeamID] = teamCount - if teamCount > 0 then - aliveAllyTeamCount = aliveAllyTeamCount + 1 - end - end -end - function gadget:UnitCreated(unitID, unitDefID, unitTeamID) - local teamUnitCount = teamsUnitCount[unitTeamID] or 0 - teamUnitCount = teamUnitCount + 1 - teamsUnitCount[unitTeamID] = teamUnitCount local allyTeamID = teamToAllyTeam[unitTeamID] - local allyUnitCount = allyTeamUnitCount[allyTeamID] or 0 - allyUnitCount = allyUnitCount + 1 - allyTeamUnitCount[allyTeamID] = allyUnitCount + local allyTeamInfo = allyTeamInfos[allyTeamID] + allyTeamInfo.teams[unitTeamID].unitCount = allyTeamInfo.teams[unitTeamID].unitCount + 1 + allyTeamInfo.unitCount = allyTeamInfo.unitCount + 1 + allyTeamInfos[allyTeamID] = allyTeamInfo end gadget.UnitGiven = gadget.UnitCreated gadget.UnitCaptured = gadget.UnitCreated function gadget:UnitDestroyed(unitID, unitDefID, unitTeamID) - if unitTeamID == gaiaTeamID and ignoreGaia ~= 0 then - -- skip gaia + local allyTeamID = teamToAllyTeam[unitTeamID] + local allyTeamInfo = allyTeamInfos[allyTeamID] + local teamUnitCount = allyTeamInfo.teams[unitTeamID].unitCount -1 + local allyTeamUnitCount = allyTeamInfo.unitCount - 1 + allyTeamInfo.teams[unitTeamID].unitCount = teamUnitCount + allyTeamInfo.unitCount = allyTeamUnitCount + allyTeamInfos[allyTeamID] = allyTeamInfo + if allyTeamInfo.isGaia and ignoreGaia == 1 then return end - local teamUnitCount = teamsUnitCount[unitTeamID] - if teamUnitCount then - teamUnitCount = teamUnitCount - 1 - teamsUnitCount[unitTeamID] = teamUnitCount - end - local allyTeamID = teamToAllyTeam[unitTeamID] - local allyUnitCount = allyTeamUnitCount[allyTeamID] - if allyUnitCount then - allyUnitCount = allyUnitCount - 1 - allyTeamUnitCount[allyTeamID] = allyUnitCount + + if allyTeamUnitCount == 0 then + Script.LuaRules.AllyTeamDeathMessage(allyTeamID) + for teamID in pairs(allyTeamInfo.teams) do + KillTeam(teamID) + end end end 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 30f1b703e..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/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 cea7f8e0e..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 150 -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 4c3e94103..215cb4ac1 100644 --- a/LuaRules/Gadgets/game_resourceGifts.lua +++ b/LuaRules/Gadgets/game_resourceGifts.lua @@ -10,29 +10,20 @@ 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 = 3 -- add this each 1cycle -local baseIncomeIncreasePeriod = 2.5*60*30 -- x min * 60 s/min * 30 frame/s - -local aiCheatHandicapMetal = { - ["veryeasy"] = 5, - ["easy"] = 10, - ["medium"] = 25, - ["hard"] = 50, - ["insane"] = 100, -} - -local aiCheatHandicapEnergy = { - ["veryeasy"] = 5, - ["easy"] = 10, - ["medium"] = 25, - ["hard"] = 50, - ["insane"] = 100, -} +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 +else + baseIncomeIncreasePeriod = 2.5*60*30 -- x min * 60 s/min * 30 frame/s +end + +local maximumBaseIncome = Spring.GetModOptions().maxbasicincome or 10 if (not gadgetHandler:IsSyncedCode()) then return -- No Unsynced @@ -137,53 +128,27 @@ function gadget:GameFrame(n) -- Spring.Echo("New baseIncome") -- Spring.Echo(baseIncome) end - if (n % 30) == 4 then - local mexIncome = getMexIncomes() - - 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) - if not (baseIncome >= 15) then + if Spring.GetModOptions().mincome ~= "disabled" then + if (n % 30) == 4 then + local mexIncome = getMexIncomes() + + 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",10) + end + if not (baseIncome >= tonumber(maximumBaseIncome)) then Spring.AddTeamResource(i,"m",baseIncome + mexIncome[allyTeamID]) else - Spring.AddTeamResource(i,"m",15) + Spring.AddTeamResource(i,"m",tonumber(maximumBaseIncome)) end --- Spring.Echo("Final baseIncome amount that is being run through AddTeamResource") --- Spring.Echo(baseIncome) --- Spring.Echo("DUN DUN DUN") + -- Spring.Echo("Final baseIncome amount that is being run through AddTeamResource") + -- Spring.Echo(baseIncome) + -- Spring.Echo("DUN DUN DUN") + --end end - end - end - - --Give free resources to AI - Necessary for AI's to properly function - if n%32 == 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 "veryeasy"]) - end + 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("Power",TeamID) - end - end - end - - if n%160 == 1 then - for _,TeamID in ipairs(Spring.GetTeamList()) do - local isAiTeam = select(4, Spring.GetTeamInfo(TeamID)) - if isAiTeam then - Spring.AddTeamResource(TeamID,"m", aiCheatHandicapMetal[modOptions.aidifficulty or "veryeasy"]) - 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 ac9a4f45f..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 = "ecommanderai" - 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,17 +167,23 @@ 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 250 + local e = teamOptions.startenergy or modOptions.startenergy or 100 -- using SetTeamResource to get rid of any existing resource without affecting stats -- using AddTeamResource to add starting resource and counting it as income @@ -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 @@ -129,4 +237,4 @@ function gadget:GameStart() SpawnStartUnit(teamID) end end -end +end \ No newline at end of file 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 new file mode 100644 index 000000000..88dad6971 --- /dev/null +++ b/LuaRules/Gadgets/gfx_explosion_lights.lua @@ -0,0 +1,103 @@ + +function gadget:GetInfo() + return { + name = "Explosion_lights", + desc = "", + author = "Floris", + date = "April 2017", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true + } +end + +-- exclude air (to prevent aa missiles that reach ground from having lights) +--local groundTypes = { +-- default = true, +-- commanders = true, +-- crawlingbombs = true, +-- platform = true, +-- heavyunits = true, +-- nanos = true, +-- shields = true, +-- scouts = true, +-- corvettes = true, +-- destroyers = true, +-- cruisers = true, +-- carriers = true, +-- battleships = true, +-- flagships = true +--} +--local skipAirWeapons = {} +--local groundDamage = false +--for weaponID, weaponDef in pairs(WeaponDefs) do +-- groundDamage = false +-- for type, damage in pairs(weaponDef.damages) do -- weaponDef.damages doesnt contain what i expected +-- Spring.Echo(type..' '..damage) +-- if groundTypes[type] ~= nil and damage > 0 then +-- groundDamage = true +-- break +-- end +-- end +-- if groundDamage == false then +-- skipAirWeapons[weaponID] = true +-- end +--end + +------------------------------------------------------------------------------- +-- Synced +------------------------------------------------------------------------------- + +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 + +------------------------------------------------------------------------------- +-- Unsynced +------------------------------------------------------------------------------- + + local myAllyID = Spring.GetMyAllyTeamID() + + function gadget:PlayerChanged(playerID) + if (playerID == Spring.GetMyPlayerID()) then + myAllyID = Spring.GetMyAllyTeamID() + end + end + + local function SpawnExplosion(_,px,py,pz, weaponID, ownerID) + if Script.LuaUI("GadgetWeaponExplosion") then + if ownerID ~= nil then + local _, _, _, teamID, allyID = Spring.GetPlayerInfo(ownerID) + + if (Spring.GetUnitAllyTeam(ownerID) == myAllyID or Spring.IsPosInLos(px, py, pz, myAllyID)) then + --if skipAirWeapons[weaponID] == nil or py ~= Spring.GetGroundHeight(px, py) then + Script.LuaUI.GadgetWeaponExplosion(px, py, pz, weaponID, ownerID) + --end + end + else + -- dont know when this happens and if we should show the explosion... + Script.LuaUI.GadgetWeaponExplosion(px, py, pz, weaponID) + end + end + end + + function gadget:Initialize() + gadgetHandler:AddSyncAction("explosion_light", SpawnExplosion) + end + + function gadget:Shutdown() + gadgetHandler.RemoveSyncAction("explosion_light") + end +end \ No newline at end of file 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/hotfixes.lua b/LuaRules/Gadgets/hotfixes.lua deleted file mode 100644 index 05900c940..000000000 --- a/LuaRules/Gadgets/hotfixes.lua +++ /dev/null @@ -1,123 +0,0 @@ - -function gadget:GetInfo() - return { - name = "Lua hotfixes", - desc = "Patch up bugs in Spring's Lua and the Gadget Handler", - author = "zwzsg & lurker", - date = "23rd of January 2010", - license = "Public Domain", - layer = 2000, - enabled = true - } -end - - --- Patching the Gadget Handler, --- Making calling RemoveGadget in GameFrame or Update safe --- Previously, that could make other gadget skip that frame - -do - local gadgetHandler = getfenv(0).gadgetHandler - - if not gadgetHandler.gracefulRemove then - - gadgetHandler.gracefulRemove = true - - local RemoveGadget = gadgetHandler.RemoveGadget - local Update = gadgetHandler.Update - - function gadgetHandler:GameFrame(frameNum) - self.catchRemove = true - for _,g in ipairs(self.GameFrameList) do - g:GameFrame(frameNum) - end - self.catchRemove = false - if self.removeList then - for _,g in ipairs(self.removeList) do - self:RemoveGadget(g) - end - end - end - - function gadgetHandler:Update() - self.catchRemove = true - for _,g in ipairs(self.UpdateList) do - g:Update() - end - self.catchRemove = false - if self.removeList then - for _,g in ipairs(self.removeList) do - self:RemoveGadget(g) - end - end - end - - function gadgetHandler:RemoveGadget(gadget) - if self.catchRemove then - self.removeList = self.removeList or {} - self.removeList[#self.removeList + 1] = gadget - else - RemoveGadget(self, gadget) - end - end - - end - -end - - - - -if (gadgetHandler:IsSyncedCode()) then - --SYNCED - - if not getfenv(0).AllowUnsafeChanges then - getfenv(0).AllowUnsafeChanges = function(...) end - end - - if not Spring.CreateUnitRulesParam then - Spring.CreateUnitRulesParams = function(u,t) - if type(u)=="number" and type(t)=="table" and type(t[1])=="table" then - for k,v in pairs(t[1]) do - Spring.SetUnitRulesParam(u,k,v) - end - end - end - end - - function gadget:Initialize() - if (Spring.GetGameFrame() or 0)>0 then - local gadgetHandler = getfenv(0).gadgetHandler - Spring.Echo("gadgetHandler:GameStart()") - gadgetHandler:GameStart() - for _,unitID in ipairs(Spring.GetAllUnits()) do - local unitDefID, unitTeam, builderID = Spring.GetUnitDefID(unitID), Spring.GetUnitTeam(unitID), nil - gadgetHandler:UnitCreated(unitID, unitDefID, unitTeam, builderID) - Spring.Echo("gadgetHandler:UnitCreated(",unitID, unitDefID, unitTeam, builderID, ")") - if (select(5,Spring.GetUnitHealth(unitID)) or 0)>=1 then - Spring.Echo("gadgetHandler:UnitFinished(",unitID, unitDefID, unitTeam, ")") - gadgetHandler:UnitFinished(unitID, unitDefID, unitTeam) - end - end - end - end - -else - -- UNSYNCED - - -- Fix gl.Text y offset that changed between 0.80.0 and 0.80.1 - --if (tonumber(string.sub(Game.version,1,3) or 0) or 0)>=0.80 and (tonumber(string.sub(Game.version,6,6) or 0) or 0)>=1 then - -- local glText = gl.Text - -- gl.Text = function(text,x,y,size,options) - -- if (not size) or string.match(options,"[atvdb]") then - -- glText(text,x,y,size,options) - -- else - -- glText(text,x,y,size,"d"..(options or "")) - -- end - -- end - --end - -end - - - diff --git a/LuaRules/Gadgets/include/IterableMap.lua b/LuaRules/Gadgets/include/IterableMap.lua new file mode 100644 index 000000000..4b428faf2 --- /dev/null +++ b/LuaRules/Gadgets/include/IterableMap.lua @@ -0,0 +1,137 @@ +local IterableMap = {} + +function IterableMap.New() + + local indexByKey = {} + local dataByKey = {} + local indexMax = 0 + local unusedKey = 1 + local keyByIndex = {} + + local api = {} + + function api.GetUnusedKey() + while api.InMap(unusedKey) do + unusedKey = unusedKey + 1 + end + return unusedKey + end + + function api.Add(key, data) + if not key then + return + end + if indexByKey[key] then + -- Overwrites + dataByKey[key] = data + return + end + indexMax = indexMax + 1 + keyByIndex[indexMax] = key + dataByKey[key] = data + indexByKey[key] = indexMax + end + + function api.Remove(key) + if (not key) or (not indexByKey[key]) then + return + end + local myIndex = indexByKey[key] + local endKey = keyByIndex[indexMax] + + keyByIndex[myIndex] = endKey + indexByKey[endKey] = myIndex + keyByIndex[indexMax] = nil + indexByKey[key] = nil + dataByKey[key] = nil + indexMax = indexMax - 1 + end + + function api.ReplaceKey(oldKey, newKey) + if (not oldKey) or (not indexByKey[oldKey]) or indexByKey[newKey] then + return false + end + + keyByIndex[indexByKey[oldKey]] = newKey + indexByKey[newKey] = indexByKey[oldKey] + dataByKey[newKey] = dataByKey[oldKey] + + indexByKey[oldKey] = nil + dataByKey[oldKey] = nil + return true + end + + -- Get is also set in the case of tables because tables pass by reference + function api.Get(key) + return dataByKey[key] + end + + function api.Set(key, data) + if not indexByKey[key] then + Add(key, data) + else + dataByKey[key] = data + end + end + + function api.InMap(key) + return (indexByKey[key] and true) or false + end + + -- To use Iterator, write "for unitID, data in interableMap.Iterator() do" + -- This approach makes the garbage collector cry so try to use other methods + -- of iteration. + function api.Iterator() + local i = 0 + return function () + i = i + 1 + if i <= indexMax then + return keyByIndex[i], dataByKey[keyByIndex[i]] + end + end + end + + -- Does the function to every element of the map. A less barbaric method + -- of iteration. Recommended for cleanliness and speed. + -- Using the third argument, index, is a little evil because index should + -- be private. + function api.Apply(funcToApply, ...) + local i = 1 + while i <= indexMax do + local key = keyByIndex[i] + if funcToApply(key, dataByKey[key], i, ...) then + -- Return true to remove element + api.Remove(key) + else + i = i + 1 + end + end + end + + function api.ApplyNoArg(funcToApply) + local i = 1 + while i <= indexMax do + local key = keyByIndex[i] + if funcToApply(key, dataByKey[key], i) then + -- Return true to remove element + api.Remove(key) + else + i = i + 1 + end + end + end + + + -- This 'method' of iteration is for barbarians. Seems to have performance + -- similar to Apply. + function api.GetIndexMax() + return indexMax + end + function api.GetKeyByIndex(index) + return keyByIndex[index] + end + + return api +end + +return IterableMap \ No newline at end of file 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 c668a2626..f557a5209 100644 --- a/LuaRules/Gadgets/lups_cloak_fx.lua +++ b/LuaRules/Gadgets/lups_cloak_fx.lua @@ -1 +1,301 @@ --- $Id: lups_manager.lua 3171 2008-11-06 09:06:29Z det $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- author: jK -- -- Copyright (C) 2007,2008. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "Lups Cloak FX", desc = "", author = "jK", date = "008-2014", license = "GNU GPL, v2 or later", layer = 10, enabled = true, } end if (gadgetHandler:IsSyncedCode()) then return end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- speed ups + some table functions -- local tinsert = function(tab, insert) tab[#tab+1] = insert end local type = type local pairs = pairs -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- local Lups --// Lua Particle System local particleIDs = {} local initialized = false --// if LUPS isn't started yet, we try it once a gameframe later local tryloading = 1 --// try to activate lups if it isn't found -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- «« some basic functions »» -- local supportedFxs = {} local function fxSupported(fxclass) if (supportedFxs[fxclass]~=nil) then return supportedFxs[fxclass] else supportedFxs[fxclass] = Lups.HasParticleClass(fxclass) return supportedFxs[fxclass] end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- «« cloaked unit handling »» -- local CloakedHitEffect = { class='UnitJitter', options={ life=50, pos={0,0,0}, enemyHit=true, repeatEffect=false}, } local CloakEffect = { { class='UnitCloaker',options={ life=50 } }, { class='UnitJitter',options={ delay=24, life=math.huge } }, { class='Sound',options={ file="sounds/cloak.wav",volume=0.9 } }, } local EnemyCloakEffect = { { class='UnitCloaker',options={ life=20 } }, { class='Sound',options={ file="sounds/cloak.wav",volume=0.9 } }, } local DecloakEffect = { { class='UnitCloaker',options={ inverse=true, life=50 } }, { class='UnitJitter',options={ life=24 } }, { class='Sound',options={ file="sounds/cloak.wav",volume=0.9 } }, } local EnemyDecloakEffect = { { class='UnitCloaker',options={ inverse=true, life=60 } }, { class='Sound',options={ file="sounds/cloak.wav",volume=0.9 } }, } function gadget:UnitDamaged(unitID,unitDefID,teamID) if (not Spring.GetUnitIsCloaked(unitID)) then return end local allyTeamID = Spring.GetUnitAllyTeam(unitID) local LocalAllyTeamID local _, specFullView = Spring.GetSpectatingState() if (specFullView) then LocalAllyTeamID = allyTeamID else LocalAllyTeamID = Spring.GetLocalAllyTeamID() end if (allyTeamID==LocalAllyTeamID) then return end if (particleIDs[unitID]) then for _,fxID in ipairs(particleIDs[unitID]) do Lups.RemoveParticles(fxID) end end particleIDs[unitID] = {} CloakedHitEffect.options.unit = unitID CloakedHitEffect.options.team = teamID CloakedHitEffect.options.unitDefID = unitDefID tinsert( particleIDs[unitID], Lups.AddParticles(CloakedHitEffect.class,CloakedHitEffect.options) ) end function gadget:UnitCloaked(unitID,unitDefID,teamID) local allyTeamID = Spring.GetUnitAllyTeam(unitID) local LocalAllyTeamID local _, specFullView = Spring.GetSpectatingState() if (specFullView) then LocalAllyTeamID = allyTeamID else LocalAllyTeamID = Spring.GetLocalAllyTeamID() end if (particleIDs[unitID]) then for i=1,#particleIDs[unitID] do Lups.RemoveParticles(particleIDs[unitID][i]) end end particleIDs[unitID] = {} if (LocalAllyTeamID==allyTeamID) then for i=1,#CloakEffect do local fx = CloakEffect[i] fx.options.unit = unitID fx.options.unitDefID = unitDefID fx.options.team = teamID fx.options.allyTeam = allyTeamID tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) end else for i=1,#EnemyCloakEffect do local fx = EnemyCloakEffect[i] fx.options.unit = unitID fx.options.unitDefID = unitDefID fx.options.team = teamID fx.options.allyTeam = allyTeamID tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) end end end function gadget:UnitDecloaked(unitID,unitDefID,teamID) local allyTeamID = Spring.GetUnitAllyTeam(unitID) local LocalAllyTeamID local _, specFullView = Spring.GetSpectatingState() if (specFullView) then LocalAllyTeamID = allyTeamID else LocalAllyTeamID = Spring.GetLocalAllyTeamID() end if (particleIDs[unitID]) then for i=1,#particleIDs[unitID] do Lups.RemoveParticles(particleIDs[unitID][i]) end end particleIDs[unitID] = {} if (LocalAllyTeamID==allyTeamID) then for i=1,#DecloakEffect do local fx = DecloakEffect[i] fx.options.unit = unitID fx.options.unitDefID = unitDefID fx.options.team = teamID fx.options.allyTeam = allyTeamID tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) end else for i=1,#EnemyDecloakEffect do local fx = EnemyDecloakEffect[i] fx.options.unit = unitID fx.options.unitDefID = unitDefID fx.options.team = teamID fx.options.allyTeam = allyTeamID tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) end end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- «« Unit Destroyed handling »» -- function gadget:UnitDestroyed(unitID,unitDefID) if (particleIDs[unitID]) then local effects = particleIDs[unitID] for i=1,#effects do Lups.RemoveParticles(effects[i]) end particleIDs[unitID] = nil end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:PlayerChanged(playerID) if (playerID == Spring.GetMyPlayerID()) then --// this should reset the cloak fx when becoming a spec --gadget.Update = ReinitializeUnitFX gadgetHandler:UpdateCallIn("Update") end end local function ReinitializeUnitFX() --// clear old FXs for _,unitFxIDs in pairs(particleIDs) do for i=1,#unitFxIDs do Lups.RemoveParticles(unitFxIDs[i]) end end particleIDs = {} --// initialize effects for existing units local allUnits = Spring.GetAllUnits(); for i=1,#allUnits do local unitID = allUnits[i] if (Spring.GetUnitIsCloaked(unitID)) then local unitDefID = Spring.GetUnitDefID(unitID) local teamID = Spring.GetUnitTeam(unitID) UnitCloaked(nil,unitID,unitDefID,teamID) end end gadgetHandler:RemoveCallIn("Update") end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:Update() if (Spring.GetGameFrame()<1) then return end Lups = GG['Lups'] if (Lups) then initialized=true else return end gadget.Update = ReinitializeUnitFX gadgetHandler:UpdateCallIn("Update") end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function gadget:Shutdown() if (initialized) then for _,unitFxIDs in pairs(particleIDs) do for i=1,#unitFxIDs do Lups.RemoveParticles(unitFxIDs[i]) end end particleIDs = {} end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- \ No newline at end of file +-- $Id: lups_manager.lua 3171 2008-11-06 09:06:29Z det $ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- author: jK +-- +-- Copyright (C) 2007,2008. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- UNSYNCED ONLY +if gadgetHandler:IsSyncedCode() then + return +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + + +function gadget:GetInfo() + return { + name = "Lups Cloak FX", + desc = "", + author = "jK", + date = "Apr, 2008", + license = "GNU GPL, v2 or later", + layer = 10, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- speed ups + some table functions +-- + +--local tinsert = table.insert +local tinsert = function(tab, insert) + tab[#tab+1] = insert +end + +local type = type +local pairs = pairs + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local Lups --// Lua Particle System +local particleIDs = {} +local initialized = false --// if LUPS isn't started yet, we try it once a gameframe later +local tryloading = 1 --// try to activate lups if it isn't found + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- «« some basic functions »» +-- + +local supportedFxs = {} +local function fxSupported(fxclass) + if (supportedFxs[fxclass]~=nil) then + return supportedFxs[fxclass] + else + supportedFxs[fxclass] = Lups.HasParticleClass(fxclass) + return supportedFxs[fxclass] + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- «« cloaked unit handling »» +-- + +local CloakedHitEffect = { class='UnitJitter',options={ life=50, pos={0,0,0}, enemyHit=true, repeatEffect=false} } +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.25 } }, +} +local EnemyCloakEffect = { + { class='UnitCloaker',options={ life=20 } }, + { 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.25 } }, +} +local EnemyDecloakEffect = { + { class='UnitCloaker',options={ inverse=true, life=60 } }, + { class='Sound',options={ file="sounds/miscfx/cloak.wav",volume=0.25 } }, +} + +--[[ Units are actually decloaked when damaged so this part is not required +local function UnitDamaged(_,unitID,unitDefID,teamID) + local allyTeamID = Spring.GetUnitAllyTeam(unitID) + + local LocalAllyTeamID + local _, specFullView = Spring.GetSpectatingState() + if (specFullView) then + LocalAllyTeamID = allyTeamID + else + LocalAllyTeamID = Spring.GetLocalAllyTeamID() + end + + if (Spring.GetUnitIsCloaked(unitID))and(allyTeamID~=LocalAllyTeamID) then + + if (particleIDs[unitID]) then + for _,fxID in ipairs(particleIDs[unitID]) do + Lups.RemoveParticles(fxID) + end + end + + particleIDs[unitID] = {} + CloakedHitEffect.options.unit = unitID + CloakedHitEffect.options.team = teamID + CloakedHitEffect.options.unitDefID = unitDefID + tinsert( particleIDs[unitID],Lups.AddParticles(CloakedHitEffect.class,CloakedHitEffect.options) ) + end +end +--]] + +function gadget:UnitCloaked(unitID,unitDefID,teamID) + local allyTeamID = Spring.GetUnitAllyTeam(unitID) + + local LocalAllyTeamID + local _, specFullView = Spring.GetSpectatingState() + if (specFullView) then + LocalAllyTeamID = allyTeamID + else + LocalAllyTeamID = Spring.GetLocalAllyTeamID() + end + + if (particleIDs[unitID]) then + for i=1,#particleIDs[unitID] do + Lups.RemoveParticles(particleIDs[unitID][i]) + end + end + particleIDs[unitID] = {} + if (LocalAllyTeamID==allyTeamID) then + if Lups then + for i=1,#CloakEffect do + local fx = CloakEffect[i] + fx.options.unit = unitID + fx.options.unitDefID = unitDefID + fx.options.team = teamID + fx.options.allyTeam = allyTeamID + tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) + end + end + else + if Lups then + for i=1,#EnemyCloakEffect do + local fx = EnemyCloakEffect[i] + fx.options.unit = unitID + fx.options.unitDefID = unitDefID + fx.options.team = teamID + fx.options.allyTeam = allyTeamID + tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) + end + end + end + +end + +function gadget:UnitDecloaked(unitID,unitDefID,teamID) + local allyTeamID = Spring.GetUnitAllyTeam(unitID) + + local LocalAllyTeamID + local _, specFullView = Spring.GetSpectatingState() + if (specFullView) then + LocalAllyTeamID = allyTeamID + else + LocalAllyTeamID = Spring.GetLocalAllyTeamID() + end + + if (particleIDs[unitID]) then + for i=1,#particleIDs[unitID] do + Lups.RemoveParticles(particleIDs[unitID][i]) + end + end + particleIDs[unitID] = {} + if (LocalAllyTeamID==allyTeamID) then + for i=1,#DecloakEffect do + local fx = DecloakEffect[i] + fx.options.unit = unitID + fx.options.unitDefID = unitDefID + fx.options.team = teamID + fx.options.allyTeam = allyTeamID + tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) + end + else + for i=1,#EnemyDecloakEffect do + local fx = EnemyDecloakEffect[i] + fx.options.unit = unitID + fx.options.unitDefID = unitDefID + fx.options.team = teamID + fx.options.allyTeam = allyTeamID + tinsert( particleIDs[unitID],Lups.AddParticles(fx.class,fx.options) ) + end + end +end + +function gadget:UnitGiven(unitID, unitDefID, teamID, oldTeamID) + if (Spring.GetUnitIsCloaked(unitID)) then + gadget:UnitCloaked(unitID,unitDefID,teamID) + end +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- «« Unit Destroyed handling »» +-- + +function gadget:UnitDestroyed(unitID,unitDefID) + if (particleIDs[unitID]) then + local effects = particleIDs[unitID] + for i=1,#effects do + Lups.RemoveParticles(effects[i]) + end + particleIDs[unitID] = nil + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:PlayerChanged(playerID) + if (playerID == Spring.GetMyPlayerID()) then + --// this should reset the cloak fx when becoming a spec + --gadget.Update = ReinitializeUnitFX + gadgetHandler:UpdateCallIn("Update") + end +end + +local function ReinitializeUnitFX() + --// clear old FXs + for _,unitFxIDs in pairs(particleIDs) do + for i=1,#unitFxIDs do + Lups.RemoveParticles(unitFxIDs[i]) + end + end + particleIDs = {} + + --// initialize effects for existing units + local allUnits = Spring.GetAllUnits(); + for i=1,#allUnits do + local unitID = allUnits[i] + if (Spring.GetUnitIsCloaked(unitID)) then + local unitDefID = Spring.GetUnitDefID(unitID) + local teamID = Spring.GetUnitTeam(unitID) + gadget:UnitCloaked(unitID,unitDefID,teamID) + end + end + + gadgetHandler:RemoveCallIn("Update") +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:Update() + if (Spring.GetGameFrame()<1) then + return + end + + Lups = GG['Lups'] + + if (Lups) then + initialized = true + else + return + end + + gadget.Update = ReinitializeUnitFX + gadgetHandler:UpdateCallIn("Update") +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:Shutdown() + + if (initialized) then + for _,unitFxIDs in pairs(particleIDs) do + for i=1,#unitFxIDs do + Lups.RemoveParticles(unitFxIDs[i]) + end + end + particleIDs = {} + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + diff --git a/LuaRules/Gadgets/lups_flame_jitter.lua b/LuaRules/Gadgets/lups_flame_jitter.lua index 2fabd75cd..01a0fab49 100644 --- a/LuaRules/Gadgets/lups_flame_jitter.lua +++ b/LuaRules/Gadgets/lups_flame_jitter.lua @@ -1 +1,218 @@ --- $Id: lups_flame_jitter.lua 3643 2009-01-03 03:00:52Z jk $ ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "Lups Flamethrower Jitter", desc = "Flamethrower jitter FX with LUPS", author = "jK", date = "Apr, 2008", license = "GNU GPL, v2 or later", layer = 0, enabled = true, -- loaded by default? } end local MIN_EFFECT_INTERVAL = 20 if (gadgetHandler:IsSyncedCode()) then ------------------------------------------------------------------------------------- -- -> SYNCED ------------------------------------------------------------------------------------- --// Speed-ups local SendToUnsynced = SendToUnsynced ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- local thisGameFrame = 0 local lastLupsSpawn = {} function FlameShot(unitID,unitDefID,_, weapon) lastLupsSpawn[unitID] = lastLupsSpawn[unitID] or {} if ( ((lastLupsSpawn[unitID][weapon] or 0) - thisGameFrame) <= -MIN_EFFECT_INTERVAL ) then lastLupsSpawn[unitID][weapon] = thisGameFrame SendToUnsynced("flame_FlameShot", unitID, unitDefID, weapon) end end GG.LUPS = GG.LUPS or {} GG.LUPS.FlameShot = FlameShot function gadget:GameFrame(n) thisGameFrame = n end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:Initialize() gadgetHandler:RegisterGlobal("FlameShot",FlameShot) gadgetHandler:RegisterGlobal("FlameSetDir",FlameSetDir) gadgetHandler:RegisterGlobal("FlameSetFirePoint",FlameSetFirePoint) end function gadget:Shutdown() gadgetHandler:DeregisterGlobal("FlameShot") gadgetHandler:DeregisterGlobal("FlameSetDir") gadgetHandler:DeregisterGlobal("FlameSetFirePoint") end else ------------------------------------------------------------------------------------- -- -> UNSYNCED ------------------------------------------------------------------------------------- local particleCnt = 1 local particleList = {} local lastShoot = {} function FlameShot(_,unitID, unitDefID, weapon) -- why is this even needed? we limited frequency of fire FX back in synced --[[ local n = Spring.GetGameFrame() lastShoot[unitID] = lastShoot[unitID] or {} if ((lastShoot[unitID][weapon] or 0) > (n-MIN_EFFECT_INTERVAL) ) then return end lastShoot[unitID][weapon] = n ]]-- local posx,posy,posz, dirx,diry,dirz = Spring.GetUnitWeaponVectors(unitID,weapon) local wd = WeaponDefs[UnitDefs[unitDefID].weapons[weapon].weaponDef] local weaponRange = wd.range*wd.duration*15 local speedx,speedy,speedz = Spring.GetUnitVelocity(unitID) local partpos = "x*delay,y*delay,z*delay|x="..speedx..",y="..speedy..",z="..speedz local altFlameTexture = wd.customParams.altflametex -- FIXME: more elegant solution when this is actually implemented (as in, one that doesn't rely on different unitdef) particleList[particleCnt] = { class = 'JitterParticles2', colormap = { {1,1,1,1},{1,1,1,1} }, count = 6, life = weaponRange / 12, delaySpread = 25, force = {0,1.5,0}, --forceExp = 0.2, partpos = partpos, pos = {posx,posy,posz}, emitVector = {dirx,diry,dirz}, emitRotSpread= 10, speed = 10, speedSpread = 0, speedExp = 1.5, size = 15, sizeGrowth = 5.0, scale = 1.5, strength = 1.0, heat = 2, } particleCnt = particleCnt + 1 particleList[particleCnt] = { class = 'SimpleParticles2', colormap = { {1, 1, 1, 0.01}, {1, 1, 1, 0.01}, {0.75, 0.5, 0.5, 0.01}, {0.35, 0.15, 0.15, 0.25}, {0.1, 0.035, 0.01, 0.2}, {0, 0, 0, 0.01} }, count = 4, life = weaponRange / 12, delaySpread = 25, force = {0,1,0}, --forceExp = 0.2, partpos = partpos, pos = {posx,posy,posz}, emitVector = {dirx,diry,dirz}, emitRotSpread= 8, rotSpeed = 1, rotSpread = 360, rotExp = 9, speed = 10, speedSpread = 0, speedExp = 1.5, size = 2, sizeGrowth = 4.0, sizeExp = 0.7, --texture = "bitmaps/smoke/smoke06.tga", texture = altFlameTexture and "bitmaps/GPL/flame_alt.png" or "bitmaps/GPL/flame.png", } particleCnt = particleCnt + 1 particleList[particleCnt] = { class = 'SimpleParticles2', colormap = { {1, 1, 1, 0.01}, {0, 0, 0, 0.01} }, count = 20, --delay = 20, life = weaponRange / 48, lifeSpread = 20, delaySpread = 15, force = {0,1,0}, --forceExp = 0.2, partpos = partpos, pos = {posx,posy,posz}, emitVector = {dirx,diry,dirz}, emitRotSpread= 3, rotSpeed = 1, rotSpread = 360, rotExp = 9, speed = 10, speedSpread = 0, size = 2, sizeGrowth = 4.0, sizeExp = 0.65, --texture = "bitmaps/smoke/smoke06.tga", texture = altFlameTexture and "bitmaps/GPL/flame_alt.png" or "bitmaps/GPL/flame.png", } particleCnt = particleCnt + 1 end function gadget:GameFrame() if (particleCnt>1) then particleList.n = particleCnt GG.Lups.AddParticlesArray(particleList) particleList = {} particleCnt = 1 end end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:Initialize() gl.DeleteTexture("bitmaps/GPL/flame.png") gadgetHandler:AddSyncAction("flame_FlameShot", FlameShot) end function gadget:Shutdown() gadgetHandler:RemoveSyncAction("flame_FlameShot") end end \ No newline at end of file +-- $Id: lups_flame_jitter.lua 3643 2009-01-03 03:00:52Z jk $ +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Lups Flamethrower Jitter", + desc = "Flamethrower jitter FX with LUPS", + author = "jK", + date = "Apr, 2008", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = false, -- loaded by default? + } +end + +local MIN_EFFECT_INTERVAL = 20 + +if (gadgetHandler:IsSyncedCode()) then +------------------------------------------------------------------------------------- +-- -> SYNCED +------------------------------------------------------------------------------------- + + --// Speed-ups + local SendToUnsynced = SendToUnsynced + + ------------------------------------------------------------------------------------- + ------------------------------------------------------------------------------------- + + local thisGameFrame = 0 + local lastLupsSpawn = {} + + function FlameShot(unitID,unitDefID,_, weapon) + lastLupsSpawn[unitID] = lastLupsSpawn[unitID] or {} + if ( ((lastLupsSpawn[unitID][weapon] or 0) - thisGameFrame) <= -MIN_EFFECT_INTERVAL ) then + lastLupsSpawn[unitID][weapon] = thisGameFrame + SendToUnsynced("flame_FlameShot", unitID, unitDefID, weapon) + end + end + + GG.LUPS = GG.LUPS or {} + GG.LUPS.FlameShot = FlameShot + + function gadget:GameFrame(n) + thisGameFrame = n + SendToUnsynced("flame_GameFrame") + end + + ------------------------------------------------------------------------------------- + ------------------------------------------------------------------------------------- + + function gadget:Initialize() + gadgetHandler:RegisterGlobal("FlameShot",FlameShot) + gadgetHandler:RegisterGlobal("FlameSetDir",FlameSetDir) + gadgetHandler:RegisterGlobal("FlameSetFirePoint",FlameSetFirePoint) + end + + function gadget:Shutdown() + gadgetHandler:DeregisterGlobal("FlameShot") + gadgetHandler:DeregisterGlobal("FlameSetDir") + gadgetHandler:DeregisterGlobal("FlameSetFirePoint") + end + +else +------------------------------------------------------------------------------------- +-- -> UNSYNCED +------------------------------------------------------------------------------------- + + local particleCnt = 1 + local particleList = {} + + local lastShoot = {} + + function FlameShot(_,unitID, unitDefID, weapon) + -- why is this even needed? we limited frequency of fire FX back in synced + --[[ + local n = Spring.GetGameFrame() + lastShoot[unitID] = lastShoot[unitID] or {} + if ((lastShoot[unitID][weapon] or 0) > (n-MIN_EFFECT_INTERVAL) ) then + return + end + lastShoot[unitID][weapon] = n + ]]-- + + local posx,posy,posz, dirx,diry,dirz = Spring.GetUnitWeaponVectors(unitID,weapon) + local wd = WeaponDefs[UnitDefs[unitDefID].weapons[weapon].weaponDef] + local weaponRange = wd.range*wd.duration*15 + + local speedx,speedy,speedz = Spring.GetUnitVelocity(unitID) + local partpos = "x*delay,y*delay,z*delay|x="..speedx..",y="..speedy..",z="..speedz + + local altFlameTexture = wd.customParams.altflametex -- FIXME: more elegant solution when this is actually implemented (as in, one that doesn't rely on different unitdef) + + particleList[particleCnt] = { + class = 'JitterParticles2', + colormap = { {1,1,1,1},{1,1,1,1} }, + count = 6, + life = weaponRange / 12, + delaySpread = 25, + force = {0,1.5,0}, + --forceExp = 0.2, + + partpos = partpos, + pos = {posx,posy,posz}, + + emitVector = {dirx,diry,dirz}, + emitRotSpread= 10, + + speed = 10, + speedSpread = 0, + speedExp = 1.5, + + size = 15, + sizeGrowth = 5.0, + + scale = 1.5, + strength = 1.0, + heat = 2, + } + particleCnt = particleCnt + 1 + + particleList[particleCnt] = { + class = 'SimpleParticles2', + colormap = { {1, 1, 1, 0.01}, + {1, 1, 1, 0.01}, + {0.75, 0.5, 0.5, 0.01}, + {0.35, 0.15, 0.15, 0.25}, + {0.1, 0.035, 0.01, 0.2}, + {0, 0, 0, 0.01} }, + count = 4, + life = weaponRange / 12, + delaySpread = 25, + + force = {0,1,0}, + --forceExp = 0.2, + + partpos = partpos, + pos = {posx,posy,posz}, + + emitVector = {dirx,diry,dirz}, + emitRotSpread= 8, + + rotSpeed = 1, + rotSpread = 360, + rotExp = 9, + + speed = 10, + speedSpread = 0, + speedExp = 1.5, + + size = 2, + sizeGrowth = 4.0, + sizeExp = 0.7, + + --texture = "bitmaps/smoke/smoke06.tga", + texture = altFlameTexture and "bitmaps/GPL/flame_alt.png" or "bitmaps/GPL/flame.png", + } + particleCnt = particleCnt + 1 + + particleList[particleCnt] = { + class = 'SimpleParticles2', + colormap = { {1, 1, 1, 0.01}, {0, 0, 0, 0.01} }, + count = 20, + --delay = 20, + life = weaponRange / 48, + lifeSpread = 20, + delaySpread = 15, + + force = {0,1,0}, + --forceExp = 0.2, + + partpos = partpos, + pos = {posx,posy,posz}, + + emitVector = {dirx,diry,dirz}, + emitRotSpread= 3, + + rotSpeed = 1, + rotSpread = 360, + rotExp = 9, + + speed = 10, + speedSpread = 0, + + size = 2, + sizeGrowth = 4.0, + sizeExp = 0.65, + + --texture = "bitmaps/smoke/smoke06.tga", + texture = altFlameTexture and "bitmaps/GPL/flame_alt.png" or "bitmaps/GPL/flame.png", + } + particleCnt = particleCnt + 1 + + end + + function GameFrame() + if (particleCnt>1) then + particleList.n = particleCnt + GG.Lups.AddParticlesArray(particleList) + particleList = {} + particleCnt = 1 + end + end + + ------------------------------------------------------------------------------------- + ------------------------------------------------------------------------------------- + + function gadget:Initialize() + gl.DeleteTexture("bitmaps/GPL/flame.png") + gadgetHandler:AddSyncAction("flame_GameFrame", GameFrame) + gadgetHandler:AddSyncAction("flame_FlameShot", FlameShot) + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("flame_FlameShot") + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_nano_spray.lua b/LuaRules/Gadgets/lups_nano_spray.lua index 587b67365..479fdbd02 100644 --- a/LuaRules/Gadgets/lups_nano_spray.lua +++ b/LuaRules/Gadgets/lups_nano_spray.lua @@ -10,42 +10,41 @@ function gadget:GetInfo() date = "2008-2012", license = "GNU GPL, v2 or later", layer = 0, - enabled = not (Game.version:find('91.0') and (Game.version:find('91.0.1') == nil)) + enabled = true } end local spGetFactoryCommands = Spring.GetFactoryCommands -local spGetUnitCommands = Spring.GetUnitCommands +local spGetCommandQueue = Spring.GetCommandQueue -local function GetCmdTag(unitID) - local cmdTag = 0 - local cmds = spGetFactoryCommands(unitID,1) +local function GetCmdTag(unitID) + local cmdTag = 0 + local cmds = spGetFactoryCommands(unitID,1) if (cmds) then local cmd = cmds[1] if cmd then cmdTag = cmd.tag end end - if cmdTag == 0 then - local cmds = spGetUnitCommands(unitID,1) + if cmdTag == 0 then + local cmds = spGetCommandQueue(unitID,1) if (cmds) then local cmd = cmds[1] if cmd then cmdTag = cmd.tag end - end - end + end + end return cmdTag -end - +end + ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- if (gadgetHandler:IsSyncedCode()) then ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- - --// bw-compability local alreadyWarned = 0 local function WarnDeprecated() @@ -193,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 {} @@ -211,17 +210,27 @@ local factionsNanoFx = { streamSpeed = "limcount*0.05", }, ["default_high_quality"] = { - fxtype = "NanoParticles", - alpha = 0.27, - size = 6, - sizeSpread = 6, - sizeGrowth = 0.65, - rotSpeed = 0.1, - rotSpread = 360, - texture = "bitmaps/Other/Poof.png", - particles = 1.2, + 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, @@ -255,7 +264,7 @@ local factionsNanoFx = { corethickness = "limcount", streamThickness = "0.5+5*limcount", streamSpeed = "limcount*0.05", - },]]-- + }, } ------------------------------------------------------------------------------------- @@ -263,92 +272,106 @@ local factionsNanoFx = { local builders = {} - function gadget:GameFrame(frame) - for i=1,#builders do - local unitID = builders[i] - - if ((unitID + frame) % 30 < 1) then --// only update once per second - local strength = Spring.GetUnitCurrentBuildPower(unitID) or 0 -- * 16 - if (strength > 0) then - local type, target, isFeature = Spring.Utilities.GetUnitNanoTarget(unitID) - - if (target) then - local endpos - local radius = 30 - if (type=="restore") then - endpos = target - radius = target[4] - target = -1 - elseif (not isFeature) then - radius = (GetUnitRadius(target) or 1) * 0.80 - else - radius = (GetFeatureRadius(target) or 1) * 0.80 - end +local function BuilderFinished(unitID) + builders[#builders+1] = unitID +end - local terraform = false - local inversed = false - if (type=="restore") then - terraform = true - elseif (type=="reclaim") then - inversed = true - end +local function BuilderDestroyed(unitID) + for i=1,#builders do + if (builders[i] == unitID) then + builders[i] = builders[#builders] + end + end + builders[#builders] = nil +end - --[[ - if (type=="reclaim") and (strength > 0) then - --// reclaim is done always at full speed - strength = 1 - end - ]]-- - - local cmdTag = GetCmdTag(unitID) - local teamID = Spring.GetUnitTeam(unitID) - local allyID = Spring.GetUnitAllyTeam(unitID) - local unitDefID = Spring.GetUnitDefID(unitID) - local faction = GetFaction(unitDefID) - local teamColor = {Spring.GetTeamColor(teamID)} - local nanoPieces = Spring.GetUnitNanoPieces(unitID) or {} - - for j=1,#nanoPieces do - local nanoPieceID = nanoPieces[j] - --local nanoPieceIDAlt = Spring.GetUnitScriptPiece(unitID, nanoPieceID) - --if (unitID+frame)%60 == 0 then - -- Spring.Echo("Nanopiece nums (output)", j, UnitDefs[unitDefID].name, nanoPieceID, nanoPieceIDAlt) - --end - - local nanoParams = { - targetID = target, - isFeature = isFeature, - unitpiece = nanoPieceID, - unitID = unitID, - unitDefID = unitDefID, - teamID = teamID, - allyID = allyID, - nanopiece = nanoPieceID, - targetpos = endpos, - count = strength * 30, - color = teamColor, - type = type, - targetradius = radius, - terraform = terraform, - inversed = inversed, - cmdTag = cmdTag, --//used to end the fx when the command is finished - life = 60, - } - - local nanoSettings = CopyMergeTables(factionsNanoFx[faction] or factionsNanoFx.default, nanoParams) - ExecuteLuaCode(nanoSettings) - - local fxType = nanoSettings.fxtype - if (not nanoParticles[unitID]) then nanoParticles[unitID] = {} end - local unitFxs = nanoParticles[unitID] +function gadget:GameFrame(frame) + for i=1,#builders do + local unitID = builders[i] + if ((unitID + frame) % 30 < 1) then --// only update once per second + local strength = (Spring.GetUnitCurrentBuildPower(unitID) or 0)*(Spring.GetUnitRulesParam(unitID, "totalEconomyChange") or 1) -- * 16 + if (strength > 0) then + local type, target, isFeature = Spring.Utilities.GetUnitNanoTarget(unitID) + + if (target) then + local endpos + local radius = 30 + if (type=="restore") then + endpos = target + radius = target[4] + target = -1 + elseif (not isFeature) then + radius = (GetUnitRadius(target) or 1) * 0.80 + else + radius = (GetFeatureRadius(target) or 1) * 0.80 + end + + local terraform = false + local inversed = false + if (type=="restore") then + terraform = true + elseif (type=="reclaim") then + inversed = true + end + + --[[ + if (type=="reclaim") and (strength > 0) then + --// reclaim is done always at full speed + strength = 1 + end + ]]-- + + local cmdTag = GetCmdTag(unitID) + local teamID = Spring.GetUnitTeam(unitID) + local allyID = Spring.GetUnitAllyTeam(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + local faction = GetFaction(unitDefID) + local teamColor = {Spring.GetTeamColor(teamID)} + local nanoPieces = Spring.GetUnitNanoPieces(unitID) or {} + + for j=1,#nanoPieces do + local nanoPieceID = nanoPieces[j] + --local nanoPieceIDAlt = Spring.GetUnitScriptPiece(unitID, nanoPieceID) + --if (unitID+frame)%60 == 0 then + -- Spring.Echo("Nanopiece nums (output)", j, UnitDefs[unitDefID].name, nanoPieceID, nanoPieceIDAlt) + --end + + local nanoParams = { + targetID = target, + isFeature = isFeature, + unitpiece = nanoPieceID, + unitID = unitID, + unitDefID = unitDefID, + teamID = teamID, + allyID = allyID, + nanopiece = nanoPieceID, + targetpos = endpos, + count = strength * 30, + color = teamColor, + type = type, + targetradius = radius, + terraform = terraform, + inversed = inversed, + cmdTag = cmdTag, --//used to end the fx when the command is finished + life = 60, + } + + local nanoSettings = CopyMergeTables(factionsNanoFx[faction] or factionsNanoFx.default, nanoParams) + ExecuteLuaCode(nanoSettings) + + local fxType = nanoSettings.fxtype + if (not nanoParticles[unitID]) then nanoParticles[unitID] = {} end + local unitFxs = nanoParticles[unitID] + if Lups then unitFxs[#unitFxs+1] = Lups.AddParticles(nanoSettings.fxtype,nanoSettings) end end end end + end - end --//for - end + end --//for +end ------------------------------------------------------------------------------------- @@ -408,37 +431,32 @@ function gadget:Update() end end - - +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +local registeredBuilders = {} function gadget:UnitFinished(uid, udid) - if (UnitDefs[udid].isBuilder) then - builders[#builders+1] = unitID + if (UnitDefs[udid].isBuilder) and not registeredBuilders[uid] then + BuilderFinished(uid) + registeredBuilders[uid] = nil end end - function gadget:UnitDestroyed(uid, udid) - if (UnitDefs[udid].isBuilder) then - for i=1,#builders do - if (builders[i] == unitID) then - builders[i] = builders[#builders] - builders[#builders] = nil - end - end + if (UnitDefs[udid].isBuilder) and registeredBuilders[uid] then + BuilderDestroyed(uid) + registeredBuilders[uid] = nil end end - - function gadget:Initialize() - --maxEngineParticles = Spring.GetConfigInt("MaxNanoParticles", 10000) - --Spring.SetConfigInt("MaxNanoParticles", 0) - end - - function gadget:Shutdown() - --Spring.SetConfigInt("MaxNanoParticles", maxEngineParticles) - end +function gadget:Initialize() + for _,unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:UnitFinished(unitID, unitDefID) + end +end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- -end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_nano_spray_91.lua b/LuaRules/Gadgets/lups_nano_spray_91.lua deleted file mode 100644 index bb6bcf1f4..000000000 --- a/LuaRules/Gadgets/lups_nano_spray_91.lua +++ /dev/null @@ -1 +0,0 @@ --- $Id: lups_nano_spray.lua 3171 2008-11-06 09:06:29Z det $ ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:GetInfo() return { name = "LupsNanoSpray91", desc = "Wraps the nano spray to LUPS", author = "jK", date = "2008-2010", license = "GNU GPL, v2 or later", layer = 0, enabled = Game.version:find('91.0') and (Game.version:find('91.0.1') == nil) } end if (not gadget:GetInfo().enabled) then return end local spGetFactoryCommands = Spring.GetFactoryCommands local spGetUnitCommands = Spring.GetUnitCommands local function GetCmdTag(unitID) local cmdTag = 0 local cmds = spGetFactoryCommands(unitID,1) if (cmds) then local cmd = cmds[1] if cmd then cmdTag = cmd.tag end end if cmdTag == 0 then local cmds = spGetUnitCommands(unitID,1) if (cmds) then local cmd = cmds[1] if cmd then cmdTag = cmd.tag end end end return cmdTag end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- if (gadgetHandler:IsSyncedCode()) then ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- local GetUnitScriptPiece = Spring.GetUnitScriptPiece if (not GetUnitScriptPiece) then --//75b2 compa GetUnitScriptPiece = function(_,i) return i+1 end end local GetUnitAllyTeam = Spring.GetUnitAllyTeam local bit_and = math.bit_and local bit_or = math.bit_or local bit_bits = math.bit_bits local nanoEmitters = {} for i=0,29 do nanoEmitters[i] = {} end _G.nanoEmitters = nanoEmitters ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function QueryNanoPieceLua(unitID,unitDefID,teamID,piecenum) local cmdTag = GetCmdTag(unitID) local offset = unitID%30 local emitter = nanoEmitters[offset][unitID] if (emitter) then emitter.strength = emitter.strength+1 emitter.cmdTag = cmdTag if bit_and( emitter.nanoPieces,bit_bits(piecenum) )==0 then emitter.nanoPieces = bit_or( emitter.nanoPieces, bit_bits(piecenum) ) emitter.pieceCount = emitter.pieceCount+1 emitter[emitter.pieceCount] = piecenum end else nanoEmitters[offset][unitID] = { teamID = teamID, unitDefID = unitDefID, allyID = GetUnitAllyTeam(unitID), strength = 1, pieceCount = 1, nanoPieces = bit_bits(piecenum), cmdTag = cmdTag, [1] = piecenum, } end end function QueryNanoPieceCOB(unitID,unitDefID,teamID,piecenum) piecenum = GetUnitScriptPiece(unitID,piecenum) QueryNanoPieceLua(unitID,unitDefID,teamID,piecenum) end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:GameFrame(n) local offset = ((n+16) % 30) if (next(nanoEmitters[offset])) then SendToUnsynced("nano_GameFrame", offset) nanoEmitters[offset] = {} end end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:Initialize() GG.LUPS = GG.LUPS or {} GG.LUPS.QueryNanoPiece = QueryNanoPieceLua gadgetHandler:RegisterGlobal("QueryNanoPiece",QueryNanoPieceCOB) end function gadget:Shutdown() GG.LUPS = nil gadgetHandler:DeregisterGlobal("QueryNanoPiece") end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- else ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------- local Lups --// Lua Particle System local initialized = false --// if LUPS isn't started yet, we try it once a gameframe later local tryloading = 1 --// try to activate lups if it isn't found ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- --// Speed-ups local GetUnitRadius = Spring.GetUnitRadius local GetFeatureRadius = Spring.GetFeatureRadius local spGetFeatureDefID = Spring.GetFeatureDefID local spGetTeamColor = Spring.GetTeamColor local spGetGameFrame = Spring.GetGameFrame local Utils_GetUnitNanoTarget = Spring.Utilities.GetUnitNanoTarget local tinsert = table.insert local type = type local pairs = pairs local SYNCED = SYNCED local spairs = spairs ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- if (not GetFeatureRadius) then GetFeatureRadius = function(featureID) local fDefID = spGetFeatureDefID(featureID) return (FeatureDefs[fDefID].radius or 0) end end local function SetTable(table,arg1,arg2,arg3,arg4) table[1] = arg1 table[2] = arg2 table[3] = arg3 table[4] = arg4 end local function CopyTable(outtable,intable) for i,v in pairs(intable) do if (type(v)=='table') then if (type(outtable[i])~='table') then outtable[i] = {} end CopyTable(outtable[i],v) else outtable[i] = v end end end local function CopyMergeTables(table1,table2) local ret = {} CopyTable(ret,table2) CopyTable(ret,table1) return ret end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- «« some basic functions »» -- local supportedFxs = {} local function fxSupported(fxclass) if (supportedFxs[fxclass]~=nil) then return supportedFxs[fxclass] else supportedFxs[fxclass] = Lups.HasParticleClass(fxclass) return supportedFxs[fxclass] end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- Lua StrFunc parsing and execution -- local loadstring = loadstring local pcall = pcall local function ParseLuaStrFunc(strfunc) local luaCode = [[ return function(count,inversed) local limcount = (count/6) limcount = limcount/(limcount+1) return ]] .. strfunc .. [[ end ]] local luaFunc = loadstring(luaCode) local success,ret = pcall(luaFunc) if (success) then return ret else Spring.Echo("LUPS(NanoSpray): parsing error in user function: \n" .. ret) return function() return 0 end end end local function ParseLuaCode(t) for i,v in pairs(t) do if (type(v)=="string")and(i~="texture")and(i~="fxtype") then t[i] = ParseLuaStrFunc(v) end end end local function ExecuteLuaCode(t) for i,v in pairs(t) do if (type(v)=="function") then t[i]=v(t.count,t.inversed) end end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- «« NanoSpray handling »» -- local maxEngineParticles = Spring.GetConfigInt("MaxNanoParticles", 10000) local nanoParticles = {} local function GetFaction(udid) --local udef_factions = UnitDefs[udid].factions or {} --return ((#udef_factions~=1) and 'unknown') or udef_factions[1] return "default" -- default end local factionsNanoFx = { default = { fxtype = "NanoLasers", alpha = "0.2+count/30", corealpha = "0.2+count/120", corethickness = "limcount", streamThickness = "0.5+5*limcount", streamSpeed = "limcount*0.05", }, ["default_high_quality"] = { fxtype = "NanoParticles", alpha = 0.27, size = 6, sizeSpread = 6, sizeGrowth = 0.65, rotSpeed = 0.1, rotSpread = 360, texture = "bitmaps/Other/Poof.png", particles = 1.2, }, --[[arm = { fxtype = "NanoParticles", delaySpread = 30, size = 3, sizeSpread = 5, sizeGrowth = 0.25, texture = "bitmaps/PD/nano.png" }, ["arm_high_quality"] = { fxtype = "NanoParticles", alpha = 0.27, size = 6, sizeSpread = 6, sizeGrowth = 0.65, rotSpeed = 0.1, rotSpread = 360, texture = "bitmaps/Other/Poof.png", particles = 1.2, }, core = { fxtype = "NanoLasers", alpha = "0.2+count/30", corealpha = "0.2+count/120", corethickness = "limcount", streamThickness = "0.5+5*limcount", streamSpeed = "limcount*0.05", }, unknown = { fxtype = "NanoLasers", alpha = "0.2+count/30", corealpha = "0.2+count/120", corethickness = "limcount", streamThickness = "0.5+5*limcount", streamSpeed = "limcount*0.05", },]]-- } ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function GameFrame(_,offset) for unitID,nanoInfo in spairs(SYNCED.nanoEmitters[offset]) do local type, target, isFeature = Utils_GetUnitNanoTarget(unitID) if (target and Lups) then local cmdTag = GetCmdTag(unitID) if (nanoInfo.cmdTag == cmdTag) then local endpos local radius = 30 if (type=="restore") then endpos = target radius = target[4] target = -1 elseif (not isFeature) then radius = (GetUnitRadius(target) or 1)*0.80 else radius = (GetFeatureRadius(target) or 1) * 0.80 end local terraform = false local inversed = false if (type=="restore") then terraform = true elseif (type=="reclaim") then inversed = true end local strength = nanoInfo.strength if (type=="reclaim") then --// reclaim is done always at full speed strength = 30 end local faction = GetFaction(nanoInfo.unitDefID) local teamColor = {spGetTeamColor(nanoInfo.teamID)} for i=1,nanoInfo.pieceCount do local nanoParams = { targetID = target, isFeature = isFeature, unitpiece = nanoInfo[i], unitID = unitID, unitDefID = nanoInfo.unitDefID, teamID = nanoInfo.teamID, allyID = nanoInfo.allyID, nanopiece = nanoInfo[i], targetpos = endpos, count = strength, color = teamColor, type = type, targetradius = radius, terraform = terraform, inversed = inversed, cmdTag = cmdTag, --//used to end the fx when the command is finished } local nanoSettings = CopyMergeTables(factionsNanoFx[faction] or factionsNanoFx.default,nanoParams) ExecuteLuaCode(nanoSettings) local fxType = nanoSettings.fxtype if (not nanoParticles[unitID]) then nanoParticles[unitID] = {} end local unitFxs = nanoParticles[unitID] unitFxs[#unitFxs+1] = Lups.AddParticles(nanoSettings.fxtype,nanoSettings) end end end end --//for end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- function gadget:Update() if (spGetGameFrame()<1) then return end gadgetHandler:RemoveCallIn("Update") Lups = GG['Lups'] if (Lups) then initialized=true else return end --// enable freaky arm nano fx when quality>3 if ((Lups.Config["quality"] or 3) >= 3) then factionsNanoFx.default = factionsNanoFx["default_high_quality"] end --// init user custom nano fxs for faction,fx in pairs(Lups.Config or {}) do if (fx and (type(fx)=='table') and fx.fxtype) then local fxType = fx.fxtype local fxSettings = fx if (fxType)and ((fxType:lower()=="nanolasers")or (fxType:lower()=="nanoparticles"))and (fxSupported(fxType))and (fxSettings) then factionsNanoFx[faction] = fxSettings end end end for faction,fx in pairs(factionsNanoFx) do if (not fxSupported(fx.fxtype or "noneNANO")) then factionsNanoFx[faction] = factionsNanoFx.default end local factionNanoFx = factionsNanoFx[faction] factionNanoFx.delaySpread = 30 factionNanoFx.fxtype = factionNanoFx.fxtype:lower() if ((Lups.Config["quality"] or 2)>=2)and((factionNanoFx.fxtype=="nanolasers")or(factionNanoFx.fxtype=="nanolasersshader")) then factionNanoFx.flare = true end --// parse lua code in the table, so we can execute it later ParseLuaCode(factionNanoFx) end end function gadget:Initialize() gadgetHandler:AddSyncAction("nano_GameFrame", GameFrame) --maxEngineParticles = Spring.GetConfigInt("MaxNanoParticles", 10000) --Spring.SetConfigInt("MaxNanoParticles", 0) end function gadget:Shutdown() gadgetHandler:RemoveSyncAction("nano_GameFrame") --Spring.SetConfigInt("MaxNanoParticles", maxEngineParticles) end ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_napalm.lua b/LuaRules/Gadgets/lups_napalm.lua index 3e46cf86b..758343dcc 100644 --- a/LuaRules/Gadgets/lups_napalm.lua +++ b/LuaRules/Gadgets/lups_napalm.lua @@ -1 +1,97 @@ --- $Id: lups_napalm.lua 3171 2008-11-06 09:06:29Z det $ function gadget:GetInfo() return { name = "Napalm", desc = "", author = "jK", date = "Sep. 2008", license = "GNU GPL, v2 or later", layer = 0, enabled = true, } end if (gadgetHandler:IsSyncedCode()) then local napalmWeapons = {} --// find napalms for i=1,#WeaponDefs do local wd = WeaponDefs[i] if (wd.description:find("Napalm") or (wd.customParams and (wd.customParams.lups_napalm_fx or wd.customParams.lups_heat_fx))) then Script.SetWatchWeapon(wd.id,true) napalmWeapons[wd.id] = true end end local napalmExplosions = {} --// Speed-ups local SendToUnsynced = SendToUnsynced function gadget:Explosion(weaponID, px, py, pz) if (napalmWeapons[weaponID]) then napalmExplosions[#napalmExplosions+1] = {weaponID, px, py, pz} end return false end function gadget:GameFrame(n) if (#napalmExplosions>0) then _G.napalmExplosions = napalmExplosions _G.napalmCount = #napalmExplosions SendToUnsynced("napalm_GameFrame") napalmExplosions = {} end end else local napalmFX, heatFX = include("LuaRules/Configs/lups_napalm_fxs.lua") local Lups local LupsAddParticles local SYNCED = SYNCED local function SpawnNapalmFX(data) local nFXkey = WeaponDefs[data[1]].customParams and WeaponDefs[data[1]].customParams.lups_napalm_fx or "default" local hFXkey = WeaponDefs[data[1]].customParams and WeaponDefs[data[1]].customParams.lups_heat_fx or "default" local nFX = napalmFX[nFXkey] local hFX = heatFX[hFXkey] nFX.pos = {data[2],data[3],data[4]} Lups.AddParticles('SimpleParticles2',nFX) hFX.pos = nFX.pos Lups.AddParticles('JitterParticles2',hFX) end local function GameFrame() if (not Lups) then Lups = GG['Lups']; LupsAddParticles = Lups.AddParticles end local explosions = SYNCED.napalmExplosions for i=1,SYNCED.napalmCount do SpawnNapalmFX(explosions[i]) end end function gadget:Initialize() gl.DeleteTexture(napalmFX.texture) gadgetHandler:AddSyncAction("napalm_GameFrame", GameFrame) end function gadget:Shutdown() gadgetHandler.RemoveSyncAction("napalm_GameFrame") end end \ No newline at end of file +-- $Id: lups_napalm.lua 3171 2008-11-06 09:06:29Z det $ + +function gadget:GetInfo() + return { + name = "Napalm", + desc = "", + author = "jK", + date = "Sep. 2008", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = false, + } +end + + +if (gadgetHandler:IsSyncedCode()) then + + local napalmWeapons = {} + local wantedList = {} + + --// find napalms + for i=1,#WeaponDefs do + local wd = WeaponDefs[i] + if (wd.description:find("Napalm") or (wd.customParams and (wd.customParams.lups_napalm_fx or wd.customParams.lups_heat_fx))) then + Script.SetWatchWeapon(wd.id,true) + napalmWeapons[wd.id] = true + wantedList[#wantedList + 1] = wd.id + end + end + + local napalmExplosions = {} + + --// Speed-ups + local SendToUnsynced = SendToUnsynced + + function gadget:Explosion_GetWantedWeaponDef() + return wantedList + end + + function gadget:Explosion(weaponID, px, py, pz) + if (napalmWeapons[weaponID]) then + napalmExplosions[#napalmExplosions+1] = {weaponID, px, py, pz} + end + return false + end + + function gadget:GameFrame(n) + if (#napalmExplosions>0) then + _G.napalmExplosions = napalmExplosions + _G.napalmCount = #napalmExplosions + SendToUnsynced("napalm_GameFrame") + napalmExplosions = {} + end + end + +else + + local napalmFX, heatFX = include("LuaRules/Configs/lups_napalm_fxs.lua") + + local Lups + local LupsAddParticles + local SYNCED = SYNCED + + local function SpawnNapalmFX(data) + local nFXkey = WeaponDefs[data[1]].customParams and WeaponDefs[data[1]].customParams.lups_napalm_fx or "default" + local hFXkey = WeaponDefs[data[1]].customParams and WeaponDefs[data[1]].customParams.lups_heat_fx or "default" + + local nFX = napalmFX[nFXkey] + local hFX = heatFX[hFXkey] + + nFX.pos = {data[2],data[3],data[4]} + Lups.AddParticles('SimpleParticles2',nFX) + hFX.pos = nFX.pos + Lups.AddParticles('JitterParticles2',hFX) + end + + local function GameFrame() + if (not Lups) then Lups = GG['Lups']; LupsAddParticles = Lups.AddParticles end + local explosions = SYNCED.napalmExplosions + local napalmCount = SYNCED.napalmCount + for i=1,napalmCount do + SpawnNapalmFX(explosions[i]) + end + end + + + function gadget:Initialize() + gl.DeleteTexture(napalmFX.texture) + gadgetHandler:AddSyncAction("napalm_GameFrame", GameFrame) + end + + + function gadget:Shutdown() + gadgetHandler.RemoveSyncAction("napalm_GameFrame") + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_projectiles.lua b/LuaRules/Gadgets/lups_projectiles.lua index ce0be4bb1..462d2c2d4 100644 --- a/LuaRules/Gadgets/lups_projectiles.lua +++ b/LuaRules/Gadgets/lups_projectiles.lua @@ -13,7 +13,8 @@ function gadget:GetInfo() end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local weapons = include("LuaRules/Configs/lups_projectile_fxs.lua") or {} +local weapons = include("LuaRules/Configs/lups_projectile_fxs.lua") --{} + --[[ for i=1,#WeaponDefs do local wd = WeaponDefs[i] @@ -57,13 +58,12 @@ end function gadget:Initialize() for weaponID in pairs(weapons) do - Spring.Echo("bla", weaponID) Script.SetWatchWeapon(weaponID, true) end end function gadget:Shutdown() - for weaponID in pairs(weapons) do +for weaponID in pairs(weapons) do Script.SetWatchWeapon(weaponID, false) end end @@ -76,7 +76,7 @@ else -------------------------------------------------------------------------------- local Lups -local LupsAddParticles +local LupsAddParticles local SYNCED = SYNCED local projectiles = {} @@ -131,4 +131,4 @@ end -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- diff --git a/LuaRules/Gadgets/lups_shield.lua b/LuaRules/Gadgets/lups_shield.lua new file mode 100644 index 000000000..066e7241f --- /dev/null +++ b/LuaRules/Gadgets/lups_shield.lua @@ -0,0 +1,184 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Lups Shield", + desc = "Draws variable shields for shielded units", + author = "GoogleFrog", + date = "14 November 2017", + license = "GNU GPL, v2 or later", + layer = 500, -- Call ShieldPreDamaged after gadgets which change whether interception occurs + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +if gadgetHandler:IsSyncedCode() then + local spSetUnitRulesParam = Spring.SetUnitRulesParam + local INLOS_ACCESS = {inlos = true} + local gameFrame = 0 + + function gadget:GameFrame(n) + gameFrame = n + end + + function gadget:ShieldPreDamaged(proID, proOwnerID, shieldEmitterWeaponNum, shieldCarrierUnitID, bounceProjectile, beamEmitter, beamCarrierID) + spSetUnitRulesParam(shieldCarrierUnitID, "shieldHitFrame", gameFrame, INLOS_ACCESS) + return false + end + + return +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local spGetMyAllyTeamID = Spring.GetMyAllyTeamID +local spGetSpectatingState = Spring.GetSpectatingState + +local IterableMap = VFS.Include("LuaRules/Gadgets/Include/IterableMap.lua") +local shieldUnitDefs = include("LuaRules/Configs/lups_shield_fxs.lua") + +local Lups +local LupsAddParticles +local UPDATE_PERIOD = 10 + +local myAllyTeamID = spGetMyAllyTeamID() + +local shieldUnits = IterableMap.New() +local startup = true + +local stunnedUnits = {} + +local function GetVisibleSearch(x, z, search) + if not x then + return false + end + for i = 1, #search do + if Spring.IsPosInAirLos(x + search[i][1], 0, z + search[i][2], myAllyTeamID) then + return true + end + end + return false +end + +local function UpdateVisibility(unitID, unitData, unitVisible, forceUpdate) + unitVisible = unitVisible or (myAllyTeamID == unitData.allyTeamID) + if not unitVisible then + local ux,_,uz = Spring.GetUnitPosition(unitID) + unitVisible = GetVisibleSearch(ux, uz, unitData.search) + end + + if unitVisible == unitData.unitVisible and not forceUpdate then + return + end + unitData.unitVisible = unitVisible + + for i = 1, #unitData.fxTable do + local fxID = unitData.fxTable[i] + local fx = Lups.GetParticles(fxID) + fx.visibleToMyAllyTeam = unitVisible + end +end + +local function AddUnit(unitID, unitDefID) + if (not Lups) then + Lups = GG['Lups'] + LupsAddParticles = Lups.AddParticles + end + + local def = shieldUnitDefs[unitDefID] + local defFx = def.fx + local fxTable = {} + for i = 1, #defFx do + local fx = defFx[i] + local options = Spring.Utilities.CopyTable(fx.options) + options.unit = unitID + options.shieldCapacity = def.shieldCapacity + local fxID = LupsAddParticles(fx.class, options) + if fxID ~= -1 then + fxTable[#fxTable + 1] = fxID + end + end + + local unitData = { + unitDefID = unitDefID, + search = def.search, + fxTable = fxTable, + allyTeamID = Spring.GetUnitAllyTeam(unitID) + } + shieldUnits.Add(unitID, unitData) + + local _, fullview = spGetSpectatingState() + UpdateVisibility(unitID, unitData, fullview, true) +end + +local function RemoveUnit(unitID) + local unitData = shieldUnits.Get(unitID) + if unitData then + for i = 1, #unitData.fxTable do + local fxID = unitData.fxTable[i] + Lups.RemoveParticles(fxID) + end + shieldUnits.Remove(unitID) + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + RemoveUnit(unitID) + stunnedUnits[unitID] = nil +end + +function gadget:UnitFinished(unitID, unitDefID, unitTeam) + if shieldUnitDefs[unitDefID] then + AddUnit(unitID, unitDefID) + end +end + +function gadget:UnitTaken(unitID, unitDefID, newTeam, oldTeam) + local unitData = shieldUnits.Get(unitID) + if unitData then + unitData.allyTeamID = Spring.GetUnitAllyTeam(unitID) + end +end + +function gadget:PlayerChanged() + myAllyTeamID = spGetMyAllyTeamID() +end + +function gadget:GameFrame(n) + if startup then + local allUnits = Spring.GetAllUnits() + for i = 1, #allUnits do + local unitID = allUnits[i] + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:UnitFinished(unitID, unitDefID) + end + startup = false + end + + if n%UPDATE_PERIOD == 0 then + local _, fullview = spGetSpectatingState() + for unitID, unitData in shieldUnits.Iterator() do + if Spring.GetUnitIsStunned(unitID) then + RemoveUnit(unitID) + stunnedUnits[unitID] = Spring.GetUnitDefID(unitID) + end + UpdateVisibility(unitID, unitData, fullview) + end + + for unitID, unitDefID in pairs(stunnedUnits) do + if not Spring.GetUnitIsStunned(unitID) then + AddUnit(unitID, unitDefID) + stunnedUnits[unitID] = nil + end + end + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_shockwaves.lua b/LuaRules/Gadgets/lups_shockwaves.lua index 3a2eb9612..34b87ba72 100644 --- a/LuaRules/Gadgets/lups_shockwaves.lua +++ b/LuaRules/Gadgets/lups_shockwaves.lua @@ -1 +1,104 @@ --- $Id: lups_shockwaves.lua 3171 2008-11-06 09:06:29Z det $ function gadget:GetInfo() return { name = "Shockwaves", desc = "", author = "jK", date = "Jan. 2008", license = "GNU GPL, v2 or later", layer = 0, enabled = true } end if (gadgetHandler:IsSyncedCode()) then local hasShockwave = {} -- other gadgets can do Script.SetWatchWeapon and it is a global setting --// find weapons which cause a shockwave for i=1,#WeaponDefs do local wd = WeaponDefs[i] local customParams = wd.customParams or {} if (not customParams.lups_noshockwave) then local speed = 1 local life = 1 if customParams.lups_explodespeed then speed = wd.customParams.lups_explodespeed end if wd.customParams.lups_explodelife then life = wd.customParams.lups_explodelife end if (wd.damageAreaOfEffect>70 and not wd.paralyzer) then Script.SetWatchWeapon(wd.id,true) hasShockwave[wd.id] = {life = life, speed = speed} elseif (wd.type == "DGun") then Script.SetWatchWeapon(wd.id,true) hasShockwave[wd.id] = {life = life, speed = speed} --elseif (wd.description:find("Clogger")) then -- Script.SetWatchWeapon(wd.id,true) end end end function gadget:Explosion(weaponID, px, py, pz, ownerID) local wd = WeaponDefs[weaponID] --if (wd.description=="PlasmaImplosionDumpRocket") then --// Liche -- SendToUnsynced("lups_shockwave", px, py, pz, 6.4, 30, 0.13, true) -- return true --else local shockwave = hasShockwave[weaponID] if shockwave then if (wd.type == "DGun") then SendToUnsynced("lups_shockwave", px, py, pz, 4.0, 18, 0.13, true) else --local growth = wd.explosionSpeed --local life = wd.damageAreaOfEffect / wd.explosionSpeed local growth = (wd.damageAreaOfEffect*1.1)/20*shockwave.speed local life = 23*shockwave.life SendToUnsynced("lups_shockwave", px, py, pz, growth, life) end end return false end else local function SpawnShockwave(_,px,py,pz, growth, life, strength, desintergrator) local Lups = GG['Lups'] if (desintergrator) then Lups.AddParticles('SphereDistortion',{pos={px,py,pz}, life=life, strength=strength, growth=growth}) else Lups.AddParticles('ShockWave',{pos={px,py,pz}, growth=growth, life=life}) end end function gadget:Initialize() gadgetHandler:AddSyncAction("lups_shockwave", SpawnShockwave) end function gadget:Shutdown() gadgetHandler.RemoveSyncAction("lups_shockwave") end end \ No newline at end of file +-- $Id: lups_shockwaves.lua 3171 2008-11-06 09:06:29Z det $ + +function gadget:GetInfo() + return { + name = "Shockwaves", + desc = "", + author = "jK", + date = "Jan. 2008", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true + } +end + +------------------------------------------------------------------------------- +-- Synced +------------------------------------------------------------------------------- +if (gadgetHandler:IsSyncedCode()) then +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + + local hasShockwave = {} -- other gadgets can do Script.SetWatchWeapon and it is a global setting + local wantedList = {} + + --// find weapons which cause a shockwave + for i=1,#WeaponDefs do + local wd = WeaponDefs[i] + local customParams = wd.customParams or {} + if (not customParams.lups_noshockwave) then + local speed = 1 + local life = 1 + local normalShockwave = (wd.damageAreaOfEffect>70 and not wd.paralyzer and not customParams.disarmdamageonly) + if customParams.lups_explodespeed then + speed = wd.customParams.lups_explodespeed + normalShockwave = true + end + if customParams.lups_explodelife then + life = wd.customParams.lups_explodelife + normalShockwave = true + end + if wd.description == "Implosion Bomb" then + hasShockwave[wd.id] = {special = 1} + Script.SetWatchWeapon(wd.id,true) + wantedList[#wantedList + 1] = wd.id + elseif normalShockwave then + hasShockwave[wd.id] = { + life = 17*life, + speed = speed, + growth = (wd.damageAreaOfEffect*1.1)/20*speed + } + Script.SetWatchWeapon(wd.id,true) + wantedList[#wantedList + 1] = wd.id + elseif (wd.type == "DGun") then + hasShockwave[wd.id] = {DGun = true} + Script.SetWatchWeapon(wd.id,true) + wantedList[#wantedList + 1] = wd.id + end + end + end + + function gadget:Explosion_GetWantedWeaponDef() + return wantedList + end + + function gadget:Explosion(weaponID, px, py, pz, ownerID) + local wd = WeaponDefs[weaponID] + local shockwave = hasShockwave[weaponID] + if shockwave then + if shockwave.DGun then + SendToUnsynced("lups_shockwave", px, py, pz, 4.0, 18, 0.13, true) + elseif shockwave.special == 1 then + SendToUnsynced("lups_shockwave", px, py, pz, 6, 30, 0.13, true) + else + SendToUnsynced("lups_shockwave", px, py, pz, shockwave.growth, shockwave.life) + end + end + return false + end + +------------------------------------------------------------------------------- +-- Unsynced +------------------------------------------------------------------------------- +else +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + + local function SpawnShockwave(_,px,py,pz, growth, life, strength, desintergrator) + local Lups = GG['Lups'] + if (desintergrator) then + Lups.AddParticles('SphereDistortion',{pos={px,py,pz}, life=life, strength=strength, growth=growth}) + else + Lups.AddParticles('ShockWave',{pos={px,py,pz}, growth=growth, life=life}) + end + end + + function gadget:Initialize() + gadgetHandler:AddSyncAction("lups_shockwave", SpawnShockwave) + end + + function gadget:Shutdown() + gadgetHandler.RemoveSyncAction("lups_shockwave") + end + +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_thrusters.lua b/LuaRules/Gadgets/lups_thrusters.lua new file mode 100644 index 000000000..1ffc82574 --- /dev/null +++ b/LuaRules/Gadgets/lups_thrusters.lua @@ -0,0 +1,153 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- UNSYNCED ONLY +if gadgetHandler:IsSyncedCode() then + return +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "Thrusters", + desc = "Da red ones go fasta", + author = "KingRaptor (L.J. Lim)", + date = "2013.06.25", + license = "Public Domain", + layer = 0, + enabled = true, + } +end + +local unitDefs = include("LuaRules/Configs/lups_thruster_fxs.lua") +local UPDATE_PERIOD = 3 +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local Lups +local LupsAddParticles +local SYNCED = SYNCED + +local units = {} +local unitSpeeds = {} +local startup = true + +local function AddUnit(unitID, unitDefID) + if (not Lups) then Lups = GG['Lups']; LupsAddParticles = Lups.AddParticles end + + units[unitID] = { + unitDefID = unitDefID, + speed = unitSpeeds[unitID], + fx = {}, + } + local def = unitDefs[unitDefID] + for i=1,#def do + local fxTable = units[unitID].fx + local fx = def[i] + local options = Spring.Utilities.CopyTable(fx.options) + options.unit = unitID + local fxID = LupsAddParticles(fx.class, options) + if fxID ~= -1 then + fxTable[#fxTable+1] = fxID + end + end +end + +local function RemoveUnit(unitID) + if units[unitID] then + for i=1,#units[unitID].fx do + local fx = units[unitID].fx[i] + Lups.RemoveParticles(fx) + end + units[unitID] = nil + end +end + +local function GameFrameUnitsCheck() + for unitID, data in pairs(units) do + local def = unitDefs[data.unitDefID] + local maxDelta = def.maxDeltaSpeed*(UPDATE_PERIOD/30) + local oldSpeed = data.speed or 0 + local trueSpeed = unitSpeeds[unitID] + local delta = trueSpeed - oldSpeed + if delta > maxDelta then + delta = maxDelta + elseif delta < -maxDelta then + delta = -maxDelta + end + + local speed = oldSpeed + delta + if speed < def.minSpeed then + speed = def.minSpeed + end + + if delta > 0.01 or delta < -0.01 then + data.speed = speed + local modDelta = delta + delta*def.accelMod -- give bigger thrust when accelerating then when at constant speed + local modSpeed = speed + modDelta + + local mult = modSpeed/(def.baseSpeed or 8) + + for i=1,#data.fx do + local fxID = data.fx[i] + local fx = Lups.GetParticles(fxID) + if fx.size then + fx.size = fx.baseSize*mult + end + if fx.length then + fx.length = fx.baseLength + fx.linearLength*mult + end + fx:Destroy() -- clean up any display lists + fx:CreateParticle() + end + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +--// Speed-ups +local spGetUnitVelocity = Spring.GetUnitVelocity + +local function GetUnitSpeed(unitID) + if GG.GetUnitSpeed then + local speed = GG.GetUnitSpeed(unitID) + if speed then + return speed + end + end + + local _, _, _, speed = spGetUnitVelocity(unitID) + return speed +end + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + RemoveUnit(unitID) + unitSpeeds[unitID] = nil +end + +function gadget:UnitCreated(unitID, unitDefID, unitTeam) + if unitDefs[unitDefID] then + AddUnit(unitID, unitDefID) + unitSpeeds[unitID] = GetUnitSpeed(unitID) + end +end + +function gadget:GameFrame(n) + if startup then + local allUnits = Spring.GetAllUnits() + for i=1,#allUnits do + local unitID = allUnits[i] + local unitDefID = Spring.GetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end + startup = false + end + if n%UPDATE_PERIOD == 0 then + for unitID in pairs(unitSpeeds) do + unitSpeeds[unitID] = GetUnitSpeed(unitID) + end + GameFrameUnitsCheck() + end +end \ No newline at end of file diff --git a/LuaRules/Gadgets/lups_wrapper.lua b/LuaRules/Gadgets/lups_wrapper.lua index d629c8308..200f19a32 100644 --- a/LuaRules/Gadgets/lups_wrapper.lua +++ b/LuaRules/Gadgets/lups_wrapper.lua @@ -1 +1,18 @@ --- $Id: lups_wrapper.lua 3171 2008-11-06 09:06:29Z det $ --------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- -- -- file: lups.lua -- brief: Lups (Lua Particle System) Gadget Wrapper -- authors: jK -- last updated: 07 Nov. 2007 -- -- Copyright (C) 2007. -- Licensed under the terms of the GNU GPL, v2 or later. -- --------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- if (not gadgetHandler:IsSyncedCode()) then VFS.Include("lups/lups.lua",nil,VFS.ZIP_ONLY) end \ No newline at end of file +-- $Id: lups_wrapper.lua 3171 2008-11-06 09:06:29Z det $ +--------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------- +-- +-- file: lups.lua +-- brief: Lups (Lua Particle System) Gadget Wrapper +-- authors: jK +-- last updated: 07 Nov. 2007 +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +--------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------- + +if (not gadgetHandler:IsSyncedCode()) then + VFS.Include("lups/lups.lua",nil,VFS.ZIP_ONLY) +end \ No newline at end of file diff --git a/LuaRules/Gadgets/mex_placement.lua b/LuaRules/Gadgets/mex_placement.lua new file mode 100644 index 000000000..c0498f5c5 --- /dev/null +++ b/LuaRules/Gadgets/mex_placement.lua @@ -0,0 +1,233 @@ +-------------------------------------------------------------------------------- +-- SYNCED +-------------------------------------------------------------------------------- +if (not gadgetHandler:IsSyncedCode()) then + return +end + + +function gadget:GetInfo() + return { + name = "Mex Placement", + desc = "Controls mex placement and income", + author = "Google Frog", -- + date = "21 April 2012", + license = "GNU GPL, v2 or later", + layer = -10, + enabled = true -- loaded by default? + } +end + +include("LuaRules/Configs/customcmds.h.lua") + +-------------------------------------------------------------------------------- +-- Command Definition +-------------------------------------------------------------------------------- + +local mexDefID = {} +for udid, ud in pairs(UnitDefs) do + if ud.customParams.metal_extractor then + mexDefID[udid] = tonumber (ud.customParams.metal_extractor) + end +end + +local cmdMex = { + id = CMD_AREA_MEX, + type = CMDTYPE.ICON_AREA, + tooltip = 'Area Metal Extractor Queue: Click and drag to queue Metal Extractors in an area.', + name = [[Area +Mex]], + cursor = 'Repair', + action = 'areamex', + params = {}, +} + +local canMex = {} +for udid, ud in ipairs(UnitDefs) do + if ud.customParams.area_mex_def then + canMex[udid] = true + end +end + +-------------------------------------------------------------------------------- +-- Variables +-------------------------------------------------------------------------------- + +local spotByID = {} +local spotData = {} + +local metalSpots = {} +local metalSpotsByPos = {} + +local MEX_DISTANCE = 500 +local communism = false + +metalCommunism = Spring.GetModOptions().metalextractorcommunism or "disabled" +if metalCommunism == "enabled" then + communism = true -- pass a modoption here or whatever +else + communism = false +end + + +-------------------------------------------------------------------------------- +-- Command Handling +-------------------------------------------------------------------------------- + +local sameOrder = {} + + +function gadget:AllowCommand_GetWantedCommand() + local ret = { [CMD.INSERT] = true } + for id in pairs(mexDefID) do + ret[-id] = true + end + return ret +end + +function gadget:AllowCommand_GetWantedUnitDefID() + return true +end + +function gadget:AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOptions) + if (mexDefID[-cmdID] or (cmdID == CMD.INSERT and cmdParams and mexDefID[-cmdParams[2]])) and metalSpots then + local x = math.ceil(cmdParams[cmdID == CMD.INSERT and 4 or 1]) + local z = math.ceil(cmdParams[cmdID == CMD.INSERT and 6 or 3]) + if x and z then + if metalSpotsByPos[x] and metalSpotsByPos[x][z] then + return true + else + local _,_,_,isAI = Spring.GetTeamInfo(teamID) + if not isAI then + return false; + else + local nearestspot, dist, spotindex = GetClosestMetalSpot(x, z) + if spotData[spotindex] == nil and dist < MEX_DISTANCE then + return true + else + return false + end + end + end + end + end + return true +end + +function gadget:Initialize() + metalSpots = GG.metalSpots + metalSpotsByPos = GG.metalSpotsByPos + -- register command + gadgetHandler:RegisterCMDID(CMD_AREA_MEX) + -- load active units + for _, unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = Spring.GetUnitDefID(unitID) + local teamID = Spring.GetUnitTeam(unitID) + gadget:UnitCreated(unitID, unitDefID, teamID) + end + + -- This sets a building mask so that only mexDefID can be built on the mex spot + -- if metalSpots then + -- local scalingFactor = 2 * Game.squareSize + -- for i = 1, #metalSpots do + -- local spot = metalSpots[i] + -- for x = -3, 3 do + -- for z = -3, 3 do + -- Spring.SetSquareBuildingMask(spot.x / scalingFactor + x, spot.z / scalingFactor + z, 2) + -- end + -- end + -- end + -- end +end + +-------------------------------------------------------------------------------- +-- Unit Tracker +-------------------------------------------------------------------------------- + +local inlosTrueTable = {inlos = true} + +function gadget:UnitCreated(unitID, unitDefID, unitTeam) + if canMex[unitDefID] then + Spring.InsertUnitCmdDesc(unitID, cmdMex) + end + + if mexDefID[unitDefID] then + local x,_,z = Spring.GetUnitPosition(unitID) + local income + if metalSpots then + local spotID = metalSpotsByPos[x] and metalSpotsByPos[x][z] + if spotID then + spotByID[unitID] = spotID + spotData[spotID] = {unitID = unitID} + income = metalSpots[spotID].metal + --GG.UnitEcho(unitID,spotID) + else + local nearestspot, dist, spotindex = GetClosestMetalSpot(x, z) + if spotData[spotindex] == nil and dist < MEX_DISTANCE then + local _,_,_,isAI = Spring.GetTeamInfo(unitTeam) + if not isAI then + Spring.SetUnitPosition(unitID, nearestspot.x, nearestspot.z) + end + spotByID[unitID] = spotindex + spotData[spotindex] = {unitID = unitID} + income = metalSpots[spotindex].metal + end + end + else + income = GG.IntegrateMetal(x, z) + spotByID[unitID] = true + end + + if income then + income = income * mexDefID[unitDefID] + Spring.SetUnitRulesParam(unitID, "mexIncome", income, inlosTrueTable) + if not communism then + Spring.SetUnitResourcing(unitID, "cmm", income) + end + end + end +end + +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, #metalSpots do + local spot = 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, math.sqrt(bestDist), bestIndex +end + +function gadget:UnitDestroyed(unitID, unitDefID, unitTeam) + if mexDefID[unitDefID] and spotByID[unitID] then + spotData[spotByID[unitID]] = nil + spotByID[unitID] = nil + end +end + +if communism then function gadget:GameFrame (n) + if n % 30 ~= 0 then return end + + local allyteamIncomes = {} + for unitID in pairs (spotByID) do + if Spring.GetUnitIsActive (unitID) then + local allyteamID = select (6, Spring.GetTeamInfo (Spring.GetUnitTeam (unitID))) + allyteamIncomes[allyteamID] = (allyteamIncomes[allyteamID] or 0) + Spring.GetUnitRulesParam (unitID, "mexIncome") + end + end + + for allyTeamID, income in pairs (allyteamIncomes) do + -- fixme: handle comshare + local teams = Spring.GetTeamList (allyTeamID) + for i = 1, #teams do + Spring.AddTeamResource (teams[i], "m", income / #teams) + end + end +end end diff --git a/LuaRules/Gadgets/mex_spot_finder.lua b/LuaRules/Gadgets/mex_spot_finder.lua new file mode 100644 index 000000000..488496047 --- /dev/null +++ b/LuaRules/Gadgets/mex_spot_finder.lua @@ -0,0 +1,439 @@ + +if not gadgetHandler:IsSyncedCode() then return end + +function gadget:GetInfo() + return { + name = "Metalspot Finder Gadget", + desc = "Finds metal spots", + author = "Niobium, modified by Google Frog", + version = "v1.1", + date = "November 2010", + license = "GNU GPL, v2 or later", + layer = -math.huge + 5, + enabled = true + } +end + +------------------------------------------------------------ +-- Config +------------------------------------------------------------ +local MAPSIDE_METALMAP = "mapconfig/map_metal_layout.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 + +local gridSize = 16 -- Resolution of metal map +local buildGridSize = 8 -- Resolution of build positions + +local METAL_MAP_SQUARE_SIZE = 16 +local MEX_RADIUS = Game.extractorRadius +local MAP_SIZE_X = Game.mapSizeX +local MAP_SIZE_X_SCALED = MAP_SIZE_X / METAL_MAP_SQUARE_SIZE +local MAP_SIZE_Z = Game.mapSizeZ +local MAP_SIZE_Z_SCALED = MAP_SIZE_Z / METAL_MAP_SQUARE_SIZE + +local gameConfig = VFS.FileExists(GAMESIDE_METALMAP) and VFS.Include(GAMESIDE_METALMAP) or false +local mapConfig = VFS.FileExists(MAPSIDE_METALMAP) and VFS.Include(MAPSIDE_METALMAP) or false + +------------------------------------------------------------ +-- 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 spSetGameRulesParam = Spring.SetGameRulesParam + +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 + +------------------------------------------------------------ +-- Variables +------------------------------------------------------------ + +local modOptions +if (Spring.GetModOptions) then + modOptions = Spring.GetModOptions() +end + + +------------------------------------------------------------ +-- Speedup +------------------------------------------------------------ +local function GetSpotsByPos(spots) + local spotPos = {} + for i = 1, #spots do + local spot = spots[i] + local x = spot.x + local z = spot.z + --Spring.MarkerAddPoint(x,0,z,x .. ", " .. z) + spotPos[x] = spotPos[x] or {} + spotPos[x][z] = i + end + return spotPos +end + +------------------------------------------------------------ +-- Set Game Rules so widgets can read metal spots +------------------------------------------------------------ +local function SetMexGameRulesParams(metalSpots) + if not metalSpots then -- Mexes can be built anywhere + spSetGameRulesParam("mex_count", -1) + return + end + + local mexCount = #metalSpots + spSetGameRulesParam("mex_count", mexCount) + + for i = 1, mexCount do + local mex = metalSpots[i] + spSetGameRulesParam("mex_x" .. i, mex.x) + spSetGameRulesParam("mex_y" .. i, mex.y) + spSetGameRulesParam("mex_z" .. i, mex.z) + spSetGameRulesParam("mex_metal" .. i, mex.metal) + end +end + +------------------------------------------------------------ +-- Callins +------------------------------------------------------------ +function gadget:Initialize() + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Mex Spot Finder Initialising") + Spring.SetGameRulesParam("base_extraction", 0.001) + local metalSpots, fromEngineMetalmap = GetSpots() + local metalSpotsByPos = false + + if fromEngineMetalmap and #metalSpots < 6 then + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Indiscrete metal map detected") + metalSpots = false + end + + local metalValueOverride = gameConfig and gameConfig.metalValueOverride + + if metalSpots then + local mult = (modOptions and modOptions.metalmult) or 1 + local i = 1 + while i <= #metalSpots do + local spot = metalSpots[i] + if spot.metal > MINIMUN_MEX_INCOME then + if metalValueOverride then + spot.metal = metalValueOverride + end + spot.metal = spot.metal*mult + i = i + 1 + else + metalSpots[i] = metalSpots[#metalSpots] + metalSpots[#metalSpots] = nil + end + end + + metalSpotsByPos = GetSpotsByPos(metalSpots) + end + + SetMexGameRulesParams(metalSpots) + + GG.metalSpots = metalSpots + GG.metalSpotsByPos = metalSpotsByPos + + GG.IntegrateMetal = IntegrateMetal + + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Metal Spots found and GGed") +end + +------------------------------------------------------------ +-- Extractor Income Processing +------------------------------------------------------------ + +function IntegrateMetal(x, z, radius) + local centerX, centerZ + + radius = radius or MEX_RADIUS + + centerX = (floor( x / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE + centerZ = (floor( z / METAL_MAP_SQUARE_SIZE) + 0.5) * METAL_MAP_SQUARE_SIZE + + local startX = floor((centerX - radius) / METAL_MAP_SQUARE_SIZE) + local startZ = floor((centerZ - radius) / METAL_MAP_SQUARE_SIZE) + local endX = floor((centerX + radius) / METAL_MAP_SQUARE_SIZE) + local endZ = floor((centerZ + 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 < radius) then + local _, metal,metal2 = spGetGroundInfo(cx, cz) + if type(metal) == 'string' then -- Spring > v104 + metal = metal2 + end + result = result + metal + end + end + end + + return result * mult, centerX, centerZ +end + +------------------------------------------------------------ +-- Mex finding +------------------------------------------------------------ +local function SanitiseSpots(spots, metalValueOverride) + local i = 1 + while i <= #spots do + local spot = spots[i] + if spot and spot.x and spot.z then + local metal + metal, spot.x, spot.z = IntegrateMetal(spot.x, spot.z) + spot.y = spGetGroundHeight(spot.x, spot.z) + spot.metal = spot.metal or metalValueOverride or (metal > 0 and metal) or DEFAULT_MEX_INCOME + i = i + 1 + else + spot[i] = spot[#spots] + spot[#spots] = nil + end + end + + return spots +end + +local function makeString(group) + if group then + local ret = "" + for i, v in pairs(group.left) do + ret = ret .. i .. v + end + ret = ret .. " " + for i, v in pairs(group.right) do + ret = ret .. i .. v + end + ret = ret .. " " .. group.minZ .. " " .. group.maxZ .. " " .. group.worth + return ret + else + return "" + end +end + +function GetSpots() + + local spots = {} + + -- Check configs + if gameConfig then + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Loading gameside mex config") + if gameConfig.spots then + spots = SanitiseSpots(gameConfig.spots, gameConfig.metalValueOverride) + return spots, false + end + end + + if mapConfig then + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Loading mapside mex config") + loadConfig = true + spots = SanitiseSpots(mapConfig.spots, mapConfig.metalValueOverride) + return spots, false + end + + Spring.Log(gadget:GetInfo().name, LOG.INFO, "Detecting mex config from metalmap") + + -- Main group collection + local uniqueGroups = {} + + -- Strip info + local nStrips = 0 + local stripLeft = {} + local stripRight = {} + local stripGroup = {} + + -- Indexes + local aboveIdx + local workingIdx + + -- Strip processing function (To avoid some code duplication) + local function DoStrip(x1, x2, z, worth) + + local assignedTo + + for i = aboveIdx, workingIdx - 1 do + if stripLeft[i] > x2 + gridSize then + break + elseif stripRight[i] + gridSize >= x1 then + local matchGroup = stripGroup[i] + if assignedTo then + if matchGroup ~= assignedTo then + for iz = matchGroup.minZ, assignedTo.minZ - gridSize, gridSize do + assignedTo.left[iz] = matchGroup.left[iz] + end + for iz = matchGroup.minZ, matchGroup.maxZ, gridSize do + assignedTo.right[iz] = matchGroup.right[iz] + end + if matchGroup.minZ < assignedTo.minZ then + assignedTo.minZ = matchGroup.minZ + end + assignedTo.maxZ = z + assignedTo.worth = assignedTo.worth + matchGroup.worth + uniqueGroups[makeString(matchGroup)] = nil + end + else + assignedTo = matchGroup + assignedTo.left[z] = assignedTo.left[z] or x1 -- Only accept the first + assignedTo.right[z] = x2 -- Repeated overwrite gives us result we want + assignedTo.maxZ = z -- Repeated overwrite gives us result we want + assignedTo.worth = assignedTo.worth + worth + end + else + aboveIdx = aboveIdx + 1 + end + end + + nStrips = nStrips + 1 + stripLeft[nStrips] = x1 + stripRight[nStrips] = x2 + + if assignedTo then + stripGroup[nStrips] = assignedTo + else + local newGroup = { + left = {[z] = x1}, + right = {[z] = x2}, + minZ = z, + maxZ = z, + worth = worth + } + stripGroup[nStrips] = newGroup + uniqueGroups[makeString(newGroup)] = newGroup + end + end + + -- Strip finding + workingIdx = huge + for mz = metalmapStartX, metalmapSizeZ, gridSize do + + aboveIdx = workingIdx + workingIdx = nStrips + 1 + + local stripStart = nil + local stripWorth = 0 + + for mx = metalmapStartZ, metalmapSizeX, gridSize do + local groundMetal + if Engine ~= nil and Engine.version ~= nil and Engine.version ~= "104" then + _,_, groundMetal = spGetGroundInfo(mx, mz) + else + _, groundMetal = spGetGroundInfo(mx, mz) + end + if groundMetal > 0 then + stripStart = stripStart or mx + stripWorth = stripWorth + groundMetal + elseif stripStart then + DoStrip(stripStart, mx - gridSize, mz, stripWorth) + stripStart = nil + stripWorth = 0 + end + end + + if stripStart then + DoStrip(stripStart, metalmapSizeX, mz, stripWorth) + end + end + + -- Final processing + for _, g in pairs(uniqueGroups) do + local d = {} + + local gMinX, gMaxX = huge, -1 + local gLeft, gRight = g.left, g.right + for iz = g.minZ, g.maxZ, gridSize do + if gLeft[iz] < gMinX then gMinX = gLeft[iz] end + if gRight[iz] > gMaxX then gMaxX = gRight[iz] end + end + local x = (gMinX + gMaxX) * 0.5 + local z = (g.minZ + g.maxZ) * 0.5 + + d.metal, d.x, d.z = IntegrateMetal(x,z) + + d.y = spGetGroundHeight(d.x, d.z) + + local merged = false + + for i = 1, #spots do + local spot = spots[i] + local dis = (d.x - spot.x)^2 + (d.z - spot.z)^2 + if dis < extractorRadiusSqr*4 then + local metal, mx, mz = IntegrateMetal((d.x + spot.x) * 0.5, (d.z + spot.z) * 0.5) + + if dis < extractorRadiusSqr*1.7 or metal > (d.metal + spot.metal)*0.95 then + spot.x = mx + spot.y = spGetGroundHeight(mx, mx) + spot.z = mz + spot.metal = metal + merged = true + break + end + end + end + + if not merged then + spots[#spots + 1] = d + end + end + + --for i = 1, #spots do + -- Spring.MarkerAddPoint(spots[i].x,spots[i].y,spots[i].z,"") + --end + + return spots, true +end + +function GetValidStrips(spot) + + 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 + diff --git a/LuaRules/Gadgets/pseudo_orders.lua b/LuaRules/Gadgets/pseudo_orders.lua deleted file mode 100644 index c3f18826f..000000000 --- a/LuaRules/Gadgets/pseudo_orders.lua +++ /dev/null @@ -1,218 +0,0 @@ - - -function gadget:GetInfo() - return { - name = "Pseudo Orders", - desc = "Transfer, synced TimeWait, queuable Repeat, ...", - author = "zwzsg", - date = "August, 4th, 2009", - license = "Public domain", - layer = 17, - enabled = true - } -end - -VFS.Include("LuaRules/Gadgets/libs/new_cmd_id.lua",nil) - ---[[ --- Looks like I didn't need those after all -local TmWtDscrptn = { - name="Time Wait", - type=CMDTYPE.NUMBER, - tooltip="Wait a given amoutn of seconds", - id=CMD_TIMEWAIT, - action="timewait", - cursor="wait", -- not sure -} - -local TrnsfrDscrptn = { - name="Transfer", - type=CMDTYPE.NUMBER, - tooltip="Give unit to a team", - id=CMD_TRANSFER, - action="transfer", - cursor="Unload units", -} -]]-- - -if (gadgetHandler:IsSyncedCode()) then ---SYNCED - - local WaitTimers={} - local Transfers={} - local Orders={} - - local function CustomCommand(u,ud,team,cmd,params,options,tag,synced) - if cmd == CMD_TIMEWAIT then - if #params==1 and type(params[1])=="number" then - local gs=Spring.GetGameSeconds() - for wti,wt in ipairs(WaitTimers) do - if wt.unit==u and wt.tag==tag then - if gs>wt.ending then - table.remove(WaitTimers,wti) - return true,true - else - return true,false - end - end - end - table.insert(WaitTimers,{unit=u,duration=params[1],ending=gs+params[1],tag=tag}) - return true,false - else - Spring.Echo("Bad parameters to CMD_TIMEWAIT") - end - end - if cmd == CMD_TRANSFER then - if #params==1 and type(params[1])=="number" then - if Spring.GetTeamInfo(params[1]) then - table.insert(Transfers,{SourceUnit=u,DestinationTeam=params[1]}) - return true,(Spring.GetUnitTeam(u)==params[1]) - else - Spring.Echo("Bad TeamID to CMD_TRANSFER") - end - else - Spring.Echo("Bad parameters to CMD_TRANSFER") - end - end - if cmd == CMD_REPEAT then - if #params==0 then - if Spring.GetUnitStates(u)["repeat"] then - return true, true - else - table.insert(Orders,{unit=u,cmd=CMD.REPEAT,params={1},options={}}) - return true,true - end - else - Spring.Echo("Bad parameters to CMD_REPEAT") - end - end - if cmd == CMD_IF_UNIT_IN_AREA then - local tcid,tudid,x,y,z,radius,blocking=unpack(params) - local closest_d,closest_u - if not UnitDefs[tudid] then - Spring.Echo("CMD_IF_UNIT_IN_AREA: not a valid unitDefID",tudid) - return false - end - --Spring.Echo("CMD_IF_UNIT_IN_AREA: looking for a "..UnitDefs[tudid].name.." at ",x,y,z," in radius ",radius," blocking=",blocking) - for _,u in ipairs(Spring.GetUnitsInCylinder(x,z,radius)) do - if Spring.GetUnitDefID(u)==tudid then - local ux,_,uz=Spring.GetUnitPosition(u) - local d=(ux-x)^2+(uz-z)^2 - if (closest_u==nil) or (d1 then - Spring.Echo("CMD_SELECTABLE takes one or zero parameter!") - return false - else - local switch=((not params[1]) or tonumber(params[1])~="0") and true or false - Spring.SetUnitNoSelect(u,switch) - return true,true - end - end - end - - function gadget:AllowCommand(u,ud,team,cmd,params,options,tag,synced) - -- Factories never receive CommandFallback because they handle queue differently - -- So I have to catch custom orders at the AllowCommmand stage - if UnitDefs[ud].isFactory then - CustomCommand(u,ud,team,cmd,params,options,tag,synced) - end - return true - end - - function gadget:CommandFallback(u,ud,team,cmd,params,options,tag) - -- returns: Used, Finished - if UnitDefs[ud].isFactory then - return false,false - else - return CustomCommand(u,ud,team,cmd,params,options,tag) - end - end - - function gadget:GameFrame(f) - for _,o in ipairs(Orders) do - if Spring.ValidUnitID(o.unit) then - Spring.GiveOrderToUnit(o.unit,o.cmd,o.params,o.options) - end - end - Orders={} - for _,trnsfr in ipairs(Transfers) do - if Spring.ValidUnitID(trnsfr.SourceUnit) then - Spring.TransferUnit(trnsfr.SourceUnit,trnsfr.DestinationTeam) - end - end - Transfers={} - end - - function gadget:UnitDestroyed(u,ud,team) - for ti=#WaitTimers,1,-1 do - if u==WaitTimers[ti].unit then - table.remove(WaitTimers,ti) - end - end - for ti=#Transfers,1,-1 do - if u==Transfers[ti].SourceUnit then - table.remove(Transfers,ti) - end - end - for oi=#Orders,1,-1 do - if u==Orders[oi].unit then - table.remove(Orders,oi) - end - end - end - - -else ---UNSYNCED - - --[[ - -- Doesn't appear to be working - function gadget:Initialize() - Spring.SetCustomCommandDrawData(CMD_TIMEWAIT,"Wait", {.5,.5,1,1}) - Spring.SetCustomCommandDrawData(CMD_TRANSFER,"Resurrect", {.5,.5,1,1}) - 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 c62aaaaa0..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 = 0 - -local energyForce = true -local energyLevel = 0 - --- 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 new file mode 100644 index 000000000..ccf44ad83 --- /dev/null +++ b/LuaRules/Gadgets/system_info.lua @@ -0,0 +1,198 @@ + +function gadget:GetInfo() + return { + name = "System info", + desc = "", + author = "Floris", + date = "July,2016", + layer = 0, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-- 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.validationSys = validation + + function gadget:RecvLuaMsg(msg, playerID) + if msg:sub(1,3)=="$y$" and msg:sub(4,5)==validation then + SendToUnsynced("systemBroadcast",playerID,msg:sub(6)) + return true + end + end + +else + -------------------------------------------------------------------------------- + -- unsynced + -------------------------------------------------------------------------------- + + local SendLuaRulesMsg = Spring.SendLuaRulesMsg + local systems = {} + local validation = SYNCED.validationSys + + 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:Initialize() + gadgetHandler:AddSyncAction("systemBroadcast", handleSystemEvent) + + if (Spring.GetConfigInt("SystemPrivacy",0) or 0) == 1 then + return + end + + 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 = 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 + + local infolog = VFS.LoadFile("infolog.txt") + if infolog then + + -- store changelog into array + fileLines = lines(infolog) + + for i, line in ipairs(fileLines) do + + if string.sub(line, 1, 3) == '[F=' then + break + 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, '(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 (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 (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 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 + + local system = '' + if s_cpu ~= nil then + system = system..'\nCPU: '..string.gsub(s_cpu, " ", " ") + end + if s_cpuCoresPhysical ~= nil then + system = system..'\nCPU cores: '..s_cpuCoresPhysical..' / '..s_cpuCoresLogical + end + if s_ram ~= nil then + system = system..'\nRAM: '..string.gsub(s_ram, " ", " ") + end + if s_gpu ~= nil then + system = system..'\nGPU: '..string.gsub(s_gpu, " ", " ") + end + if s_gpuVram ~= nil then + system = system..'\nGPU VRAM: '..string.gsub(s_gpuVram, " ", " ") + end + if s_resolution ~= nil then + system = system..'\n'..string.gsub(s_resolution, " ", " ") + end + if s_os ~= nil then + system = system..'\nOS: '..s_os + end + + system = string.sub(system, 2) + if system ~= '' then + SendLuaRulesMsg("$y$"..validation..system) + end + end + + function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("systemBroadcast") + end + + function handleSystemEvent(_,playerID,system) + if Script.LuaUI("SystemEvent") then + if systems[playerID] == nil and system ~= nil then systems[playerID] = system end + Script.LuaUI.SystemEvent(playerID,systems[playerID]) + end + end + +end + diff --git a/LuaRules/Gadgets/tp_cover.lua b/LuaRules/Gadgets/tp_cover.lua deleted file mode 100644 index 2339bc42b..000000000 --- a/LuaRules/Gadgets/tp_cover.lua +++ /dev/null @@ -1,219 +0,0 @@ -----used custom tags -------in the featureDef: provide_cover (int) -------in the unitDef: need_cover (int) - -function gadget:GetInfo() - return { - name = "take cover assheads", - desc = "fuck yeah", - author = "knorke", - date = "now", - license = "weeeeeee iam on horse", - layer = -3, - enabled = true-- loaded by default? - } -end - -if (gadgetHandler:IsSyncedCode()) then ---SYNCHED - -local resolution = 100 -local updateRate = 30 -_G.resolution = resolution -cover = {} -_G.cover = cover -local mapX = Game.mapSizeX+1 -local mapZ = Game.mapSizeZ+1 - -local needed_cover = {} --[unitID] - ---Spring.GetFeatureRadius ( number featureID ) -> nil | number ---Spring.GetFeaturePosition( number featureID ) -> nil | number x, number y, number z - -function gadget:Initialize() - local all_units = Spring.GetAllUnits () - for i in pairs(all_units) do - --Spring.Echo ("unit " .. all_units[i]) - local ud = UnitDefs[Spring.GetUnitDefID(all_units[i])] - if (ud) then - needed_cover[all_units[i]] = tonumber (ud.customParams.needed_cover) or 999 - --Spring.Echo ("needs a cover of " .. needed_cover[all_units[i]]) - end - end - buildCover () -end - -function setcover (x,z, c) - --Spring.Echo ("x= ".. x .. " z=" .. z) - local tx, tz = tcoord (x,z) - --Spring.Echo ("tx= ".. tx .. " tz=" .. tz) - cover[tx][tz] = c - _G.cover = cover -end - -function getcover (x,z) - if (x > mapX) then return 0 end - if (x < 0) then return 0 end - if (z > mapZ) then return 0 end - if (z < 0) then return 0 end - local tx, tz = tcoord (x,z) - return cover[tx][tz] or 0 -end - -function addcover (x,z, a) - --Spring.Echo ("adding " .. a .. " cover at " .. x .. ":" .. z) - local old = getcover (x,z) - if (old+a < 0) then - setcover (x,z, 0) - else - setcover (x,z, old+a) - end -end - -function providedCoverFromFeature (featureID) - local fd = FeatureDefs[Spring.GetFeatureDefID(featureID)] - --Spring.Echo (fd.name) - if (not fd) then return 555 end - if (not fd.customParams) then return 666 end - return fd.customParams["provide_cover"] or 0 -end - - -function tcoord (x,z) - tx=math.floor ((x/resolution)+0.5) - tz=math.floor ((z/resolution)+0.5) - return tx,tz -end - -function buildCover () - local cnt=0 - for x=0, mapX+resolution, resolution do - local tx, tz = tcoord (x,666) - cover[tx]={} - for z=0 , mapZ+resolution, resolution do - cnt=cnt+1 - --Spring.Echo ("BAUE tx= ".. tx .. " tz=" .. tz) - local tx, tz = tcoord (x,z) - cover[tx][tz] = 0 --***wasting memory. who cares? - end - end - --Spring.Echo ("count=" .. cnt) - - local allF = Spring.GetAllFeatures () - for i in pairs(allF) do - local fi = allF[i] - local x,y,z = Spring.GetFeaturePosition (fi) - if(x and z) then - --local tx, tz = tcoord (x,z) - --Spring.MarkerAddPoint (x,y,z, "feature @ " .. tx .. ":" .. tz) - --addcover (x,z, 1) - --addcover (x,z, 1) - addcover (x,z, providedCoverFromFeature (fi)) - --local old = getcover (tx,tz) - --setcover (x,z, old+a) - end - end -end - -function updateUnits () - local all_units = Spring.GetAllUnits () - for i in pairs(all_units) do - local x,y,z=Spring.GetUnitPosition (all_units[i]) - if (x and y and z) then --***why is this needed? sometimes x is nil for some reason?! - local c = getcover (x,z) - if (c >= (needed_cover[all_units[i]] or 999)) then - --Spring.Echo (c) - hideUnit (all_units[i]) - else - unhideUnit (all_units[i]) - end - end - - end -end - ---***vielleicht lieber setunitlosstate? -function hideUnit (uID) - Spring.SetUnitCloak (uID, 2 ,false) - Spring.SetUnitStealth (uID, true) -end - -function unhideUnit (uID) - Spring.SetUnitCloak (uID, false ,false) - if not UnitDefs[Spring.GetUnitDefID(uID)].stealth then - Spring.SetUnitStealth (uID, false) - end -end - - -function gadget:GameFrame (f) - if (f%updateRate ==0) then - --Spring.Echo ("running") - updateUnits () - end -end - -function gadget:FeatureDestroyed(featureID, allyTeam) - local x,y,z = Spring.GetFeaturePosition (featureID) - if(x and z) then - addcover (x,z, -providedCoverFromFeature (featureID)) - end -end - -function gadget:FeatureCreated(featureID, allyTeam) - local x,y,z = Spring.GetFeaturePosition (featureID) - if(x and z) then - addcover (x,z, providedCoverFromFeature (featureID)) - end -end - -function gadget:UnitFinished(unitID, unitDefID, teamID) - local cp = UnitDefs[unitDefID].customParams - if (not cp) then return end - needed_cover[unitID] = tonumber (cp.needed_cover) or math.huge -end - -function gadget:UnitDestroyed(unitID) - needed_cover[unitID] = nil -end - - -------------------- -else ----UNSYNCED-- -------------------- - -local debugDraw = false ---***how can i avoid having this function twice? -function utcoord (x,z) - tx=math.floor ((x/SYNCED.resolution)+0.5) - tz=math.floor ((z/SYNCED.resolution)+0.5) - return tx,tz -end - -function ugetcover (x,z) - local tx, tz = utcoord (x,z) - return SYNCED.cover[tx][tz] -end - -function gadget:DrawWorldPreUnit() - if (debugDraw) then - --gl.LineWidth(2.0) - gl.Color(0, 1, 1, 1) - local mapX = Game.mapSizeX-1 - local mapZ = Game.mapSizeZ-1 - for x=1, mapX, SYNCED.resolution do - for z=1 ,mapZ, SYNCED.resolution do - local c = ugetcover (x,z) - if (c > -1) then - gl.DrawGroundCircle (x,100,z, SYNCED.resolution/2, 8) - gl.DrawGroundCircle (x,100,z, (SYNCED.resolution/10)+(c*10), 8) - end - end - end - end -end - ---[[ function gadget:KeyPress(key, mods, isRepeat) - if (key == 108 and Spring.IsCheatingEnabled() ) then debugDraw = not debugDraw end --108=L -end ]]-- - -end \ No newline at end of file diff --git a/LuaRules/Gadgets/unit_cloak_shield.lua b/LuaRules/Gadgets/unit_cloak_shield.lua index 990eba567..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") local SYNCSTR = "unit_cloak_shield" -------------------------------------------------------------------------------- -- COMMON -------------------------------------------------------------------------------- if (gadgetHandler:IsSyncedCode()) then -------------------------------------------------------------------------------- -- SYNCED -------------------------------------------------------------------------------- -- -- speed-ups -- local GetUnitDefID = Spring.GetUnitDefID local UseUnitResource = Spring.UseUnitResource 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.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 / 32, 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) if level then local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") if cannotCloak ~= 1 then SetUnitCloak(unitID, level) end else local wantCloak = GetUnitRulesParam(unitID, "wantcloak") if wantCloak == 1 then local cannotCloak = GetUnitRulesParam(unitID, "cannotcloak") if cannotCloak ~= 1 then SetUnitCloak(unitID, 1) end else SetUnitCloak(unitID, 0) 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 SendToUnsynced(SYNCSTR, unitID, 0) 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) SendToUnsynced(SYNCSTR, unitID, 0) 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 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 (GetUnitAllyTeam(cloakee) == allyTeam)) then if (cloakee ~= unitID) then --other units SetUnitCloakAndParam(cloakee, level) cloakees[cloakee] = true elseif (selfCloak) then --self cloak SetUnitCloakAndParam(cloakee, level) 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) -- 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) 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)) then ShrinkRadius(data) elseif (not data.want) then ShrinkRadius(data) else local activeState = Spring.GetUnitStates(unitID) local newState = activeState and activeState["active"] and UseUnitResource(unitID, 'e', data.energy) 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: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_death_sounds.lua b/LuaRules/Gadgets/unit_death_sounds.lua index 1178bd6b7..838fb9f99 100644 --- a/LuaRules/Gadgets/unit_death_sounds.lua +++ b/LuaRules/Gadgets/unit_death_sounds.lua @@ -22,7 +22,7 @@ local GetUnitPosition = Spring.GetUnitPosition local PlaySoundFile = Spring.PlaySoundFile -- constants -local DEFAULT_VOLUME = 15 +local DEFAULT_VOLUME = 7.5 local SOUNDS_PATH = "sounds/deathsounds/" local GAIA_TEAM_ID = Spring.GetGaiaTeamID() 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_icongenerator.lua b/LuaRules/Gadgets/unit_icongenerator.lua index 6f188984e..9a6c125fc 100644 --- a/LuaRules/Gadgets/unit_icongenerator.lua +++ b/LuaRules/Gadgets/unit_icongenerator.lua @@ -30,10 +30,10 @@ function gadget:GetInfo() } end +if (gadgetHandler:IsSyncedCode()) then + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - -if (gadgetHandler:IsSyncedCode()) then -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -1015,10 +1015,6 @@ local schemes,resolutions,ratios = {},{},{} Spring.Echo("Cheating must be enabled"); return false; end; - if (not Spring.GetModUICtrl()) then - Spring.Echo("ModUICtrl is needed (type /luamoduictrl 1)"); - return false; - end; if (final_tex or #jobs>0) then Spring.Echo("Wait until current process is finished"); return false; diff --git a/LuaRules/Gadgets/unit_morph.lua b/LuaRules/Gadgets/unit_morph.lua new file mode 100644 index 000000000..a4d04ea26 --- /dev/null +++ b/LuaRules/Gadgets/unit_morph.lua @@ -0,0 +1,1455 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: unit_morph.lua +-- brief: Adds unit morphing command +-- author: Dave Rodgers (improved by jK, Licho, aegis, CarRepairer & MaDDoX) +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GetInfo() + return { + name = "UnitMorph", + desc = "Adds unit morphing", + author = "trepan (improved by jK, Licho, aegis, CarRepairer, MaDDoX)", + date = "Jan, 2008", + license = "GNU GPL, v2 or later", + layer = 500, + enabled = true + } +end +local echo = Spring.Echo +--local unitDefsData = VFS.Include("gamedata/unitdefs_data.lua") -- TA Prime all-inclusive unitDefs file format + +-- Changes for "The Cursed" +-- CarRepairer: may add a customized texture in the morphdefs, otherwise uses original behavior (unit buildicon). +-- aZaremoth: may add a customized text in the morphdefs +-- Changes for "Advanced BA" +-- Deadnight Warrior: may add a customized command name in the morphdefs, otherwise defaults to "Upgrade" +-- you may use "$$unitname" and "$$into" in 'text', both will be replaced with human readable unit names +-- Changes by raaar (04/2012): +-- commented out the preservation of cmd queue and unit lineage at lines 536 and 559 +-- Changes by raaar (12/2013): +-- commented out turning unit off at lines 396 and 425, was giving errors in spring 95.0 +-- Changes for "TA Prime" by _MaDDoX (12/2017): +-- Default buildtime, buildcostenergy and buildcostmetal is now the difference between original and target unit values +-- Accepts and prioritizes definitions in customData.morphdef +-- Properly talks to multi_tech.lua (tech tree gadget by zwzsg) +-- 'require' entry now require techs instead of units +-- 'require' supports multiple tech requirements (comma-separated) +-- Morph button text now shown in red when requirements not fulfilled + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- 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 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 + +-------------------------------------------------------------------------------- +-- COMMON +-------------------------------------------------------------------------------- + +--[[ // for use with any mod -_- +function GetTechLevel(udid) + local ud = UnitDefs[udid]; + return (ud and ud.techLevel) or 0 +end +]]-- + +function string:split( inSplitPattern, outResults ) + if not outResults then + outResults = { } + end + local theStart = 1 + local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) + while theSplitStart do + table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) + theStart = theSplitEnd + 1 + theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) + end + table.insert( outResults, string.sub( self, theStart ) ) + return outResults +end + +-- // for use with mods like CA <_< +local function GetTechLevel(UnitDefID) + --return UnitDefs[UnitDefID].techLevel or 0 + local cats = UnitDefs[UnitDefID].modCategories + if (cats) then + --// bugfix, cuz lua don't remove uppercase :( + if (cats["LEVEL1"]) then return 1 + elseif (cats["LEVEL2"]) then return 2 + elseif (cats["LEVEL3"]) then return 3 + elseif (cats["level1"]) then return 1 + elseif (cats["level2"]) then return 2 + elseif (cats["level3"]) then return 3 + end + end + return 0 +end + +local function isFactory(UnitDefID) + return UnitDefs[UnitDefID].isFactory or false +end + + +local function isFinished(UnitID) + local _,_,_,_,buildProgress = Spring.GetUnitHealth(UnitID) + return (buildProgress==nil)or(buildProgress>=1) +end + +local function HeadingToFacing(heading) + --return math.floor((-heading - 24576) / 16384) % 4 + return math.floor((heading + 8192) / 16384) % 4 +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +if (gadgetHandler:IsSyncedCode()) then +-------------------------------------------------------------------------------- +-- SYNCED +-------------------------------------------------------------------------------- + +include("LuaRules/colors.h.lua") + +local stopPenalty = 0.667 +local morphPenalty = 1.6 +local upgradingBuildSpeed = 250 -- Commander workertime = 300 +local XpScale = 1.0 + +local XpMorphUnits = {} + +local devolution = true --// remove upgrade capabilities after factory destruction? +local stopMorphOnDevolution = true --// should morphing stop during devolution + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local morphDefs = {} --// make it global in Initialize() +local extraUnitMorphDefs = {} -- stores mainly planetwars morphs +local hostName = nil -- planetwars hostname +local PWUnits = {} -- planetwars units +local morphUnits = {} --// make it global in Initialize() + +local reqTechs = {} --// all possible techs which are used as a requirement for a morph + +--// per team techlevel and owned MorphReq. units table +local teamTechLevel = {} +--// Prime: Removing support for Required Units +local morphableUnits = {} -- UnitTypeIDs which may be morphed [teamId] [# of required UnitTypeIDs currenty] +local teamList = Spring.GetTeamList() +for i=1,#teamList do + local teamID = teamList[i] + morphableUnits[teamID] = {} + teamTechLevel[teamID] = 0 +end + +local morphCmdDesc = { +-- id = CMD_MORPH, -- added by the calling function because there is now more than one option + type = CMDTYPE.ICON, + name = 'Upgrade', + cursor = 'Morph', -- add with LuaUI? + action = 'morph', +} + +--// will be replaced in Initialize() +local RankToXp = function() return 0 end +local GetUnitRank = function() return 0 end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +--// translate lowercase UnitNames to real unitname (with upper-/lowercases) +local defNamesL = {} +for defName in pairs(UnitDefNames) do + defNamesL[string.lower(defName)] = defName +end + +--// Calculates Default values | edited for TA Prime by MaDDoX +local function DefCost(paramName, udSrc, udDst) + local pSrc = udSrc[paramName] + local pTgt = udDst[paramName] + if ((not pSrc) or (not pTgt) or + (type(pSrc) ~= 'number') or + (type(pTgt) ~= 'number')) then + Spring.Echo('Morph '..paramName..' error: NaN found') + return 0 + end + local cost = (pTgt - pSrc) * morphPenalty + if (cost < 0) then + cost = 0 + end + return math.floor(cost) +end + +-- That's only called on initialize, to validate morph_defs.lua & custom data +local function BuildMorphDef(udSrc, morphData) + local udDst = UnitDefNames[defNamesL[string.lower(morphData.into)] or -1] + if (not udDst) then + if (not morphData.into) then + Spring.Echo('Morph gadget: Invalid "into" field within morphData') + else + Spring.Echo('Morph gadget: Bad morph dst type: ' .. morphData.into) + end + return + else + local unitDef = udDst + local newData = {} + newData.into = udDst.id + --newData.time = morphData.time or math.floor(unitDef.buildTime*7/upgradingBuildSpeed) + newData.time = morphData.time or (DefCost('buildTime', udSrc, udDst) / upgradingBuildSpeed) + newData.increment = (1 / (30 * newData.time)) + newData.metal = morphData.metal or DefCost('metalCost', udSrc, udDst) + newData.energy = morphData.energy or DefCost('energyCost', udSrc, udDst) + newData.resTable = { + m = (newData.increment * newData.metal), + e = (newData.increment * newData.energy) + } + newData.tech = morphData.tech or 0 + newData.xp = morphData.xp or 0 + newData.rank = morphData.rank or 0 + newData.facing = morphData.facing + + local requireDefined = -1 + local foundAllRequires = true + if (morphData.require) then + --require = (UnitDefNames[defNamesL[string.lower(morphData.require)] or -1] or {}).id + local requires = morphData.require:split(',') + -- // All required technologies must be defined, or else invalidate + for i = 1, #requires do + -- Team 0 is used just as a filler here, the important is that the return ~= nil + requireDefined = GG.TechCheck(requires[i], 0) ~= nil + if (requireDefined) then + --echo('Morph gadget: Requirement defined: ' .. requires[i]) + reqTechs[requires[i]]=true + else + -- echo('Morph gadget: Bad morph requirement: ' .. requires[i].." tech not found") + --require = -1 + foundAllRequires = false + end + end + end + --newData.require = require + newData.require = foundAllRequires and morphData.require or -1 + + newData.cmd = CMD_MORPH + MAX_MORPH + newData.stopCmd = CMD_MORPH_STOP + MAX_MORPH + MAX_MORPH = MAX_MORPH + 1 + + newData.texture = morphData.texture + if morphData.text then + newData.text = string.gsub(morphData.text, "$$unitname", udSrc.humanName) + newData.text = string.gsub(newData.text, "$$into", udDst.humanName) + else + newData.text = morphData.text + end + if morphData.cmdname then + newData.cmdname = morphData.cmdname + else + newData.cmdname = "Upgrade" + end + return newData + end +end + +local function ValidateMorphDefs(mds) + local newDefs = {} + for src,morphData in pairs(mds) do + --//#debug +-- Spring.Echo("Source: "..src) +-- for k,v in pairs(morphData) do +-- Spring.Echo("K, V:"..tostring(k),v) +-- for q,w in pairs(v) do +-- Spring.Echo("-- morphData v: "..q,w) +-- end +-- end + local udSrc = UnitDefNames[defNamesL[string.lower(src)] or -1] + if (not udSrc) then + Spring.Echo('Morph gadget: Bad morph src type: ' .. src) + else + newDefs[udSrc.id] = {} + if (morphData.into) then + local morphDef = BuildMorphDef(udSrc, morphData) + if (morphDef) then newDefs[udSrc.id][morphDef.cmd] = morphDef end + else + for _,morphData in pairs(morphData) do + local morphDef = BuildMorphDef(udSrc, morphData) + if (morphDef) then newDefs[udSrc.id][morphDef.cmd] = morphDef end + end + end + end + end + return newDefs +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- //This is where multiple tech requirements check kick in. + +-- Previously it returned how many of the required unit type there are in the game + --return ((teamReqUnits[teamID][reqTechs] or 0) > 0) +-- Now it returns a list of all unreached techs +local function TechReqList(teamID, reqTechs) + if (reqTechs == -1) then + return {} end + + local unreachedTechs = {} + if (reqTechs) then + local requires = reqTechs:split(',') + + for i = 1, #requires do + local hasRequire = GG.TechCheck(requires[i], teamID) == true + if (hasRequire) then + --echo('Morph gadget: Requirement found: ' .. requires[i]) + else + --echo('Morph gadget: Unreached requirement: ' .. requires[i]) + --require = -1 + unreachedTechs[#unreachedTechs+1] = requires[i] + end + end + end + + return unreachedTechs +end + +local function TechReqCheck(teamID, reqTechs) + if (not reqTechs or reqTechs == -1) then + return true end + + local hasAllTechs = true + local requires = reqTechs:split(',') + + for i = 1, #requires do + local hasRequire = GG.TechCheck(requires[i], teamID) == true + if not hasRequire then + hasAllTechs = false + end + end + + return hasAllTechs +end + +local function GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, unitXP, unitRank, unreachedTechs) + local ud = UnitDefs[morphDef.into] + local tt = '' + if (morphDef.text ~= nil) then + tt = tt .. WhiteStr .. morphDef.text .. '\n' + else + --tt = tt .. WhiteStr .. 'Upgrade into a ' .. ud.humanName .. '\n' + tt = tt .. 'Upgrade into a ' .. ud.humanName .. '\n' + end + if (morphDef.time > 0) then + tt = tt .. GreenStr .. 'time: ' .. morphDef.time .. '\n' + end + if (morphDef.metal > 0) then + tt = tt .. CyanStr .. 'metal: ' .. morphDef.metal .. '\n' + end + if (morphDef.energy > 0) then + tt = tt .. YellowStr .. 'energy: ' .. morphDef.energy .. '\n' + end + if (morphDef.tech > teamTech) or + (morphDef.xp > unitXP) or + (morphDef.rank > unitRank) or + (unreachedTechs and #unreachedTechs >= 1) + then + tt = tt .. RedStr .. 'needs' + if (morphDef.tech>teamTech) then tt = tt .. ' level: ' .. morphDef.tech end + if (morphDef.xp>unitXP) then tt = tt .. ' xp: ' .. string.format('%.2f',morphDef.xp) end + if (morphDef.rank>unitRank) then tt = tt .. ' rank: ' .. morphDef.rank .. ' (' .. string.format('%.2f',RankToXp(unitDefID,morphDef.rank)) .. 'xp)' end + -- if (not teamOwnsReqUnit) then tt = tt .. ' unit: ' .. UnitDefs[morphDef.require].humanName end + -- Refactored to show unreached+required tech + --tt = tt .. ' unit: ' .. reqTech[x] + -- // Loop all unreachedTechs and add to the tooltip + if (unreachedTechs and #unreachedTechs >= 1) then + local str = ' tech(s): ' .. unreachedTechs[1] + if #unreachedTechs > 1 then + for i = 2, #unreachedTechs do + str = str .. ', '..unreachedTechs[i] + end + end + tt = tt..str + end + end + 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 = {} + + local teamTech = teamTechLevel[teamID] or 0 + local teamUnits = Spring.GetTeamUnits(teamID) + for n=1,#teamUnits do + local unitID = teamUnits[n] + local unitXP = Spring.GetUnitExperience(unitID) + local unitRank = GetUnitRank(unitID) + local unitDefID = Spring.GetUnitDefID(unitID) + local morphDefs = morphDefs[unitDefID] or {} + + for _,morphDef in pairs(morphDefs) do + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (cmdDescID) then + local unreachedTechs = TechReqList(teamID, morphDef.require) + morphCmdDesc.disabled = not MorphRequirementsFulfilled(unitID, morphDef, teamTech, unreachedTechs) + if (morphCmdDesc.disabled) then + morphCmdDesc.name = "\255\255\64\64"..morphDef.cmdname + else + morphCmdDesc.name = "\255\255\255\255"..morphDef.cmdname + end + morphCmdDesc.tooltip = GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, unitXP, + unitRank, unreachedTechs) + Spring.EditUnitCmdDesc(unitID, cmdDescID, morphCmdDesc) + end + end + end +end + +local function AddMorphCmdDesc(unitID, unitDefID, teamID, morphDef, teamTech) + local unitXP = Spring.GetUnitExperience(unitID) + local unitRank = GetUnitRank(unitID) + local teamReqTechs = TechReqList(teamID, morphDef.require) + local teamHasTechs = teamReqTechs and #teamReqTechs == 0 + morphCmdDesc.tooltip = GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, unitXP, unitRank, teamReqTechs) + + if morphDef.texture then + morphCmdDesc.texture = "LuaRules/Images/Morph/".. morphDef.texture + else + morphCmdDesc.texture = "#" .. morphDef.into --//only works with a patched layout.lua or the TweakedLayout widget! + end + morphCmdDesc.name = morphDef.cmdname + + morphCmdDesc.disabled= (morphDef.tech > teamTech) or (morphDef.rank > unitRank) + or(morphDef.xp > unitXP) or (not teamHasTechs) + + morphCmdDesc.id = morphDef.cmd + + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (cmdDescID) then + Spring.EditUnitCmdDesc(unitID, cmdDescID, morphCmdDesc) + else + Spring.InsertUnitCmdDesc(unitID, morphCmdDesc) + end + + morphCmdDesc.tooltip = nil + morphCmdDesc.texture = nil + morphCmdDesc.text = nil +end + + +local function AddExtraUnitMorph(unitID, unitDef, teamID, morphDef) -- adds extra unit morph (planetwars morphing) + morphDef = BuildMorphDef(unitDef, morphDef) + extraUnitMorphDefs[unitID] = morphDef + AddMorphCmdDesc(unitID, unitDef.id, teamID, morphDef, 0) +end + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +local function ReAssignAssists(newUnit,oldUnit) + local ally = Spring.GetUnitAllyTeam(newUnit) + local alliedTeams = Spring.GetTeamList(ally) + for n=1,#alliedTeams do + local teamID = alliedTeams[n] + local alliedUnits = Spring.GetTeamUnits(teamID) + for i=1,#alliedUnits do + local unitID = alliedUnits[i] + local cmds = Spring.GetCommandQueue(unitID, 1) + for j=1,#cmds do + local cmd = cmds[j] + if (cmd.id == CMD.GUARD)and(cmd.params[1] == oldUnit) then + Spring.GiveOrderToUnit(unitID,CMD.INSERT,{cmd.tag,CMD.GUARD,0,newUnit},{}) + Spring.GiveOrderToUnit(unitID,CMD.REMOVE,{cmd.tag},{}) + end + end + end + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function StartMorph(unitID, unitDefID, teamID, morphDef) + + -- do not allow morph for unfinsihed units + 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 + -- Spring.GiveOrderToUnit(unitID, CMD.ONOFF, { 0 }, { "alt" }) --// turns radars/jammers off + + morphUnits[unitID] = { + def = morphDef, + progress = 0.0, + increment = morphDef.increment, + morphID = morphID, + teamID = teamID, + } + + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (cmdDescID) then + Spring.EditUnitCmdDesc(unitID, cmdDescID, {id=morphDef.stopCmd, name=RedStr.."Stop"}) + end + + SendToUnsynced("unit_morph_start", unitID, unitDefID, morphDef.cmd) +end + + +local function StopMorph(unitID, morphData) + morphUnits[unitID] = nil + + --Spring.SetUnitHealth(unitID, { paralyze = -1}) + local scale = morphData.progress * stopPenalty + local unitDefID = Spring.GetUnitDefID(unitID) + + Spring.SetUnitResourcing(unitID,"e", UnitDefs[unitDefID].energyMake) + -- Spring.GiveOrderToUnit(unitID, CMD.ONOFF, { 1 }, { "alt" }) + local usedMetal = morphData.def.metal * scale + Spring.AddUnitResource(unitID, 'metal', usedMetal) + --local usedEnergy = morphData.def.energy * scale + --Spring.AddUnitResource(unitID, 'energy', usedEnergy) + + SendToUnsynced("unit_morph_stop", unitID) + + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphData.def.stopCmd) + if (cmdDescID) then + Spring.EditUnitCmdDesc(unitID, cmdDescID, {id=morphData.def.cmd, name=morphData.def.cmdname}) + end +end + + + +local function FinishMorph(unitID, morphData) + local udDst = UnitDefs[morphData.def.into] + local ud = UnitDefs[unitID] + local defName = udDst.name + local unitTeam = morphData.teamID + local px, py, pz = Spring.GetUnitBasePosition(unitID) + local h = Spring.GetUnitHeading(unitID) + Spring.SetUnitBlocking(unitID, false) + morphUnits[unitID] = nil + + local oldHealth,oldMaxHealth,paralyzeDamage,captureProgress,buildProgress = Spring.GetUnitHealth(unitID) + local isBeingBuilt = false + if buildProgress < 1 then + isBeingBuilt = true + end + + local newUnit + local face = HeadingToFacing(h) + + if udDst.isBuilding or udDst.isFactory then + --if udDst.isBuilding then + + local x = math.floor(px/16)*16 + local y = py + local z = math.floor(pz/16)*16 + + local xsize = udDst.xsize + local zsize =(udDst.zsize or udDst.ysize) + if ((face == 1) or(face == 3)) then + xsize, zsize = zsize, xsize + end + if xsize/4 ~= math.floor(xsize/4) then + x = x+8 + end + if zsize/4 ~= math.floor(zsize/4) then + z = z+8 + end + newUnit = Spring.CreateUnit(defName, x, y, z, face, unitTeam) + Spring.SetUnitPosition(newUnit, x, y, z) + else + newUnit = Spring.CreateUnit(defName, px, py, pz, face, unitTeam) + --Spring.SetUnitRotation(newUnit, 0, -h * math.pi / 32768, 0) + Spring.SetUnitPosition(newUnit, px, py, pz) + end + + if (extraUnitMorphDefs[unitID] ~= nil) then + -- nothing here for now + end + if (hostName ~= nil) and PWUnits[unitID] then + -- send planetwars deployment message + PWUnit = PWUnits[unitID] + PWUnit.currentDef=udDst + -- TODO: determine and apply smart orientation of the structure + local data = PWUnit.owner..","..defName..","..math.floor(px)..","..math.floor(pz)..",".."S" + Spring.SendCommands("w "..hostName.." pwmorph:"..data) + extraUnitMorphDefs[unitID] = nil + GG.PlanetWars.units[unitID] = nil + GG.PlanetWars.units[newUnit] = PWUnit + SendToUnsynced('PWCreate', unitTeam, newUnit) + elseif (not morphData.def.facing) then -- set rotation only if unit is not planetwars and facing is not true + --Spring.Echo(morphData.def.facing) + --Spring.SetUnitRotation(newUnit, 0, -h * math.pi / 32768, 0) + end + + + --//copy experience + local newXp = Spring.GetUnitExperience(unitID)*XpScale + local nextMorph = morphDefs[morphData.def.into] + if nextMorph~= nil and nextMorph.into ~= nil then nextMorph = {morphDefs[morphData.def.into]} end + if (nextMorph) then --//determine the lowest xp req. of all next possible morphs + local maxXp = math.huge + for _, nm in pairs(nextMorph) do + local rankXpInto = RankToXp(nm.into,nm.rank) + if (rankXpInto>0)and(rankXpInto0)and(xpInto= 1.0) then + FinishMorph(unitID, morphData) + return false -- remove from the list, all done + end + return true +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + --// Add MorphDefs from customData entries (TODO: allow data merge, currently only overrides) + local function AddCustomMorphDefs() + -- Standard .fbi method: (needs testing, TA Prime uses UnitDefsData) + for id,unitDef in pairs(UnitDefs) do + if unitDef.customParams.morphdef and type(unitDef.customParams.morphdef) == "table" then + local customMorphDef = unitDef.customParams.morphdef + --#debug echo(unitname.." morphdef into: "..tostring(unitDef.customParams.into)) + morphDefs[unitDef.name] = {customMorphDef} + end + end + return + + -- UnitDefsData method: + -- if unitDefsData == nil then + -- return end + + -- for id,unitDef in pairs(UnitDefs) do + -- local nam = unitDef.name + -- for _, uData in pairs(unitDefsData.data) do + -- if type(uData) == "table" and uData[1] == nam then + -- local dataEntry = uData[2] + -- if (dataEntry.customparams ~= nil and dataEntry.customparams.morphdef ~= nil) then + -- local customMorphDef = dataEntry.customparams.morphdef + --#debug Spring.Echo(nam .." morphdef into = ".. dataEntry.customparams.morphdef.into) + -- morphDefs[nam] = {customMorphDef} + -- end + -- end + -- end + + -- end + end + + +function gadget:Initialize() + --// RankApi linking + if (GG.rankHandler) then + GetUnitRank = GG.rankHandler.GetUnitRank + RankToXp = GG.rankHandler.RankToXp + end + + -- self linking for planetwars + GG['morphHandler'] = {} + GG['morphHandler'].AddExtraUnitMorph = AddExtraUnitMorph + + hostName = GG.PlanetWars and GG.PlanetWars.options.hostname or nil + PWUnits = GG.PlanetWars and GG.PlanetWars.units or {} + + if (type(GG.UnitRanked)~="table") then GG.UnitRanked = {} end + table.insert(GG.UnitRanked, UnitRanked) + + --// get the morphDefs + morphDefs = include("gamedata/morph_defs.lua") + + --// MorphDefs can now be all defined in customParams (by MaDDoX) + AddCustomMorphDefs() + morphDefs = ValidateMorphDefs(morphDefs) +-- if (not morphDefs) +-- then gadgetHandler:RemoveGadget() +-- return end + + --// make it global for unsynced access via SYNCED + _G.morphUnits = morphUnits + _G.morphDefs = morphDefs + _G.extraUnitMorphDefs = extraUnitMorphDefs + + --// Register CmdIDs + for number = 0, MAX_MORPH-1 do + gadgetHandler:RegisterCMDID(CMD_MORPH + number) + gadgetHandler:RegisterCMDID(CMD_MORPH_STOP + number) + end + + local allUnits = Spring.GetAllUnits() + for i = 1, #allUnits do + local unitID = allUnits[i] + local unitDefID = Spring.GetUnitDefID(unitID) + local teamID = Spring.GetUnitTeam(unitID) + --// Deprecated, now just checks existing technologies on start +-- if (reqTechs[unitDefID])and(isFinished(unitID)) then +-- local morphUnits = morphableUnits[teamID] +-- morphUnits[unitDefID] = (morphUnits[unitDefID] or 0) + 1 +-- end + UpdateMorphReqs(teamID) + AddFactory(unitID, unitDefID, teamID) + local morphDefSet = morphDefs[unitDefID] + if (morphDefSet) then + local useXPMorph = false + for _,morphDef in pairs(morphDefSet) do + if (morphDef) then + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (not cmdDescID) then + AddMorphCmdDesc(unitID, unitDefID, teamID, morphDef, teamTechLevel[teamID]) + end + useXPMorph = (morphDef.xp > 0) or useXPMorph + end + end + if (useXPMorph) then + XpMorphUnits[#XpMorphUnits+1] = {id=unitID, defID=unitDefID, team=teamID} end + end + end + +end + + +function gadget:Shutdown() + for i,f in pairs(GG.UnitRanked or {}) do + if (f==UnitRanked) then + table.remove(GG.UnitRanked, i) + break + end + end + + local allUnits = Spring.GetAllUnits() + for i=1,#allUnits do + local unitID = allUnits[i] + local morphData = morphUnits[unitID] + if (morphData) then + StopMorph(unitID, morphData) + end + for number=0,MAX_MORPH-1 do + local cmdDescID = Spring.FindUnitCmdDesc(unitID, CMD_MORPH+number) + if (cmdDescID) then + Spring.RemoveUnitCmdDesc(unitID, cmdDescID) + end + end + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- When a unit starts being built, still in green-placeholder mode +function gadget:UnitCreated(unitID, unitDefID, teamID) + local morphDefSet = morphDefs[unitDefID] + if (morphDefSet) then + local useXPMorph = false + for _,morphDef in pairs(morphDefSet) do + if (morphDef) then + AddMorphCmdDesc(unitID, unitDefID, teamID, morphDef, teamTechLevel[teamID]) + useXPMorph = (morphDef.xp > 0) or useXPMorph + end + end + if (useXPMorph) then XpMorphUnits[#XpMorphUnits+1] = {id=unitID,defID=unitDefID,team=teamID} end + end +end + +-- When a unit is completed, it must re-check morphing prereqs, since some tech could've been unlocked +function gadget:UnitFinished(unitID, unitDefID, teamID) + local bfrTechLevel = teamTechLevel[teamID] or 0 + AddFactory(unitID, unitDefID, teamID) + + UpdateMorphReqs(teamID) +-- if (reqTechs[unitDefID]) then +-- local teamReq = morphableUnits[teamID] +-- -- add 1 to amount of existing required units +-- teamReq[unitDefID] = (teamReq[unitDefID] or 0) + 1 +-- if (teamReq[unitDefID]==1) then +-- UpdateMorphReqs(teamID) +-- end +-- end + + if (bfrTechLevel ~= teamTechLevel[teamID]) then + UpdateMorphReqs(teamID) + end +end + + +function gadget:UnitDestroyed(unitID, unitDefID, teamID) + if (morphUnits[unitID]) then + StopMorph(unitID,morphUnits[unitID]) + morphUnits[unitID] = nil + end + local bfrTechLevel = teamTechLevel[teamID] or 0 + + RemoveFactory(unitID, unitDefID, teamID) + + local updateButtons = false + if (reqTechs[unitDefID])and(isFinished(unitID)) then + local teamReq = morphableUnits[teamID] + -- Reduces 1 from amount of required units found + teamReq[unitDefID] = (teamReq[unitDefID] or 0) - 1 + if (teamReq[unitDefID]==0) then + StopMorphsOnDevolution(teamID) + updateButtons = true + end + end + + if (bfrTechLevel~=teamTechLevel[teamID]) then + StopMorphsOnDevolution(teamID) + updateButtons = true + end + + if (updateButtons) then UpdateMorphReqs(teamID) end +end + + +function gadget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) + self:UnitCreated(unitID, unitDefID, teamID) + if (isFinished(unitID)) then + self:UnitFinished(unitID, unitDefID, teamID) + end +end + + +function gadget:UnitGiven(unitID, unitDefID, newTeamID, oldTeamID) + self:UnitDestroyed(unitID, unitDefID, oldTeamID) +end + + +function UnitRanked(unitID,unitDefID,teamID,newRank,oldRank) + local morphDefSet = morphDefs[unitDefID] + + if (morphDefSet) then + local teamTech = teamTechLevel[teamID] or 0 + local unitXP = Spring.GetUnitExperience(unitID) + for _, morphDef in pairs(morphDefSet) do + if (morphDef) then + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (cmdDescID) then + local morphCmdDesc = {} + local teamReqTechs = TechReqList(teamID,morphDef.require) + local teamHasTechs = teamReqTechs and #teamReqTechs == 0 + + morphCmdDesc.disabled = (morphDef.tech > teamTech) or (morphDef.rank > newRank) + or (morphDef.xp > unitXP) or (not teamHasTechs) + morphCmdDesc.tooltip = GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, unitXP, newRank, teamReqTechs) + Spring.EditUnitCmdDesc(unitID, cmdDescID, morphCmdDesc) + end + end + end + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +function AddFactory(unitID, unitDefID, teamID) + if (isFactory(unitDefID)) then + local unitTechLevel = GetTechLevel(unitDefID) + if (unitTechLevel > teamTechLevel[teamID]) then + teamTechLevel[teamID]=unitTechLevel + end + end +end + + +function RemoveFactory(unitID, unitDefID, teamID) + if (devolution)and(isFactory(unitDefID))and(isFinished(unitID)) then + + --// check all factories and determine team level + local level = 0 + local teamUnits = Spring.GetTeamUnits(teamID) + for i=1,#teamUnits do + local unitID2 = teamUnits[i] + if (unitID2 ~= unitID) then + local unitDefID2 = Spring.GetUnitDefID(unitID2) + if (isFactory(unitDefID2) and isFinished(unitID2)) then + local unitTechLevel = GetTechLevel(unitDefID2) + if (unitTechLevel>level) then level = unitTechLevel end + end + end + end + + if (level ~= teamTechLevel[teamID]) then + teamTechLevel[teamID] = level + end + + end +end + +function StopMorphsOnDevolution(teamID) + if (stopMorphOnDevolution) then + for unitID, morphData in pairs(morphUnits) do + local morphDef = morphData.def + if (morphData.teamID == teamID)and + ( + (morphDef.tech>teamTechLevel[teamID])or + (not TechReqCheck(teamID, morphDef.require)) + ) + then + StopMorph(unitID, morphData) + end + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:GameFrame(n) + + --if n == startFrame then + + --end + + if ((n+24)%150<1) then + --AddCustomMorphDefs() + + local unitCount = #XpMorphUnits + local i = 1 + + while (i<=unitCount) do + local unitdata = XpMorphUnits[i] + local unitID = unitdata.id + local unitDefID = unitdata.defID + + local morphDefSet = morphDefs[unitDefID] + if (morphDefSet) then + local teamID = unitdata.team + local teamTech = teamTechLevel[teamID] or 0 + local unitXP = Spring.GetUnitExperience(unitID) + local unitRank = GetUnitRank(unitID) + + local xpMorphLeft = false + for _,morphDef in pairs(morphDefSet) do + if (morphDef) then + local cmdDescID = Spring.FindUnitCmdDesc(unitID, morphDef.cmd) + if (cmdDescID) then + local morphCmdDesc = {} + local teamOwnsReqUnit = TechReqList(teamID, morphDef.require) + morphCmdDesc.disabled = (morphDef.tech > teamTech)or(morphDef.rank > unitRank)or(morphDef.xp > unitXP)or(not teamOwnsReqUnit) + morphCmdDesc.tooltip = GetMorphToolTip(unitID, unitDefID, teamID, morphDef, teamTech, unitXP, unitRank, teamOwnsReqUnit) + Spring.EditUnitCmdDesc(unitID, cmdDescID, morphCmdDesc) + + xpMorphLeft = morphCmdDesc.disabled or xpMorphLeft + end + end + end + if (not xpMorphLeft) then + --// remove unit in list (it fullfills all xp requirements) + XpMorphUnits[i] = XpMorphUnits[unitCount] + XpMorphUnits[unitCount] = nil + unitCount = unitCount - 1 + i = i - 1 + end + end + i = i + 1 + + end + end + + for unitID, morphData in pairs(morphUnits) do + if (not UpdateMorph(unitID, morphData)) then + morphUnits[unitID] = nil + end + 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 + StopMorph(unitID, morphData) + morphUnits[unitID] = nil + return false + end + elseif (cmdID == CMD.ONOFF) then + return false + elseif cmdID == CMD.SELFD then + StopMorph(unitID, morphData) + morphUnits[unitID] = nil + --else --// disallow ANY command to units in morph + -- return false + end + elseif (cmdID >= CMD_MORPH and cmdID < CMD_MORPH+MAX_MORPH) then + local morphDef = (morphDefs[unitDefID] or {})[cmdID] or extraUnitMorphDefs[unitID] + if ( (morphDef)and + (morphDef.tech<=teamTechLevel[teamID])and + (morphDef.rank<=GetUnitRank(unitID))and + (morphDef.xp<=Spring.GetUnitExperience(unitID))and + (TechReqCheck(teamID, morphDef.require)) ) + then + if (isFactory(unitDefID)) then + --// the factory cai is broken and doesn't call CommandFallback(), + --// so we have to start the morph here + StartMorph(unitID, unitDefID, teamID, morphDef) + return false + else + return true + end + end + return false + end + + 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 + local morphDef = (morphDefs[unitDefID] or {})[cmdID] or extraUnitMorphDefs[unitID] + if (not morphDef) then + return true, true --// command was used, remove it + end + local morphData = morphUnits[unitID] + if (not morphData) then + StartMorph(unitID, unitDefID, teamID, morphDef) + return true, true + end + return true, false --// command was used, do not remove it +end + + + +-------------------------------------------------------------------------------- +-- END SYNCED +-------------------------------------------------------------------------------- +else +-------------------------------------------------------------------------------- +-- UNSYNCED +-------------------------------------------------------------------------------- + +--// 75b2 compability (removed it in the next release) +if (Spring.GetTeamColor==nil) then + Spring.GetTeamColor = function(teamID) local _,_,_,_,_,_,r,g,b = Spring.GetTeamInfo(teamID); return r,g,b end +end + +-- +-- speed-ups +-- + +local gameFrame; +local SYNCED = SYNCED +local CallAsTeam = CallAsTeam +local spairs = spairs +local snext = snext + +local GetUnitTeam = Spring.GetUnitTeam +local GetUnitHeading = Spring.GetUnitHeading +local GetUnitBasePosition = Spring.GetUnitBasePosition +local GetGameFrame = Spring.GetGameFrame +local GetSpectatingState = Spring.GetSpectatingState +local AddWorldIcon = Spring.AddWorldIcon +local AddWorldText = Spring.AddWorldText +local IsUnitVisible = Spring.IsUnitVisible +local GetLocalTeamID = Spring.GetLocalTeamID +local spAreTeamsAllied = Spring.AreTeamsAllied +local spGetGameFrame = Spring.GetGameFrame + +local glBillboard = gl.Billboard +local glColor = gl.Color +local glPushMatrix = gl.PushMatrix +local glTranslate = gl.Translate +local glRotate = gl.Rotate +local glUnitShape = gl.UnitShape +local glPopMatrix = gl.PopMatrix +local glText = gl.Text +local glPushAttrib = gl.PushAttrib +local glPopAttrib = gl.PopAttrib +local glBlending = gl.Blending +local glDepthTest = gl.DepthTest + +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 GL_COLOR_BUFFER_BIT = GL.COLOR_BUFFER_BIT + +local headingToDegree = (360 / 65535) + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local useLuaUI = false +local oldFrame = 0 --//used to save bandwidth between unsynced->LuaUI +local drawProgress = true --//a widget can do this job too (see healthbars) + +local morphUnits + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +--//synced -> unsynced actions + +local function SelectSwap(cmd, oldID, newID) + local selUnits = Spring.GetSelectedUnits() + for i=1,#selUnits do + local unitID = selUnits[i] + if (unitID == oldID) then + selUnits[i] = newID + Spring.SelectUnitArray(selUnits) + break + end + end + + + if (Script.LuaUI('MorphFinished')) then + if (useLuaUI) then + local readTeam, spec, specFullView = nil,GetSpectatingState() + if (specFullView) + then readTeam = Script.ALL_ACCESS_TEAM + else readTeam = GetLocalTeamID() end + CallAsTeam({ ['read'] = readTeam }, function() + if (IsUnitVisible(oldID)) then + Script.LuaUI.MorphFinished(oldID,newID) + end + end) + end + end + + return true +end + +local function StartMorph(cmd, unitID, unitDefID, morphID) + if (Script.LuaUI('MorphStart')) then + if (useLuaUI) then + local readTeam, spec, specFullView = nil,GetSpectatingState() + if (specFullView) + then readTeam = Script.ALL_ACCESS_TEAM + else readTeam = GetLocalTeamID() end + CallAsTeam({ ['read'] = readTeam }, function() + if (unitID)and(IsUnitVisible(unitID)) then + Script.LuaUI.MorphStart(unitID, (SYNCED.morphDefs[unitDefID] or {})[morphID] or SYNCED.extraUnitMorphDefs[unitID]) + end + end) + end + end + return true +end + +local function StopMorph(cmd, unitID) + if (Script.LuaUI('MorphStop')) then + if (useLuaUI) then + local readTeam, spec, specFullView = nil,GetSpectatingState() + if (specFullView) + then readTeam = Script.ALL_ACCESS_TEAM + else readTeam = GetLocalTeamID() end + CallAsTeam({ ['read'] = readTeam }, function() + if (unitID)and(IsUnitVisible(unitID)) then + Script.LuaUI.MorphStop(unitID) + end + end) + end + end + return true +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function gadget:Initialize() + gadgetHandler:AddSyncAction("unit_morph_finished", SelectSwap) + gadgetHandler:AddSyncAction("unit_morph_start", StartMorph) + gadgetHandler:AddSyncAction("unit_morph_stop", StopMorph) + + --startFrame = spGetGameFrame() +end + + +function gadget:Shutdown() + gadgetHandler:RemoveSyncAction("unit_morph_finished") + gadgetHandler:RemoveSyncAction("unit_morph_start") + gadgetHandler:RemoveSyncAction("unit_morph_stop") +end + +function gadget:Update() + local frame = spGetGameFrame() + if (frame>oldFrame) then + oldFrame = frame + if snext(SYNCED.morphUnits) then + local useLuaUI_ = Script.LuaUI('MorphUpdate') + if (useLuaUI_~=useLuaUI) then --//Update Callins on change + drawProgress = not Script.LuaUI('MorphDrawProgress') + useLuaUI = useLuaUI_ + end + + if (useLuaUI) then + local morphTable = {} + local readTeam, spec, specFullView = nil,GetSpectatingState() + if (specFullView) + then readTeam = Script.ALL_ACCESS_TEAM + else readTeam = GetLocalTeamID() end + CallAsTeam({ ['read'] = readTeam }, function() + for unitID, morphData in spairs(SYNCED.morphUnits) do + if (unitID and morphData)and(IsUnitVisible(unitID)) then + morphTable[unitID] = {progress=morphData.progress, into=morphData.def.into} + end + end + end) + Script.LuaUI.MorphUpdate(morphTable) + end + + end + 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 +end + + +--//patchs an annoying popup the first time you morph a unittype(+team) +local alreadyInit = {} +local function InitializeUnitShape(unitDefID,unitTeam) + local iTeam = alreadyInit[unitTeam] + if (iTeam)and(iTeam[unitDefID]) then return end + + glPushMatrix() + gl.ColorMask(false) + gl.Scale(1.002,1.002,1.002) + glUnitShape(unitDefID, unitTeam) + gl.ColorMask(true) + glPopMatrix() + if (alreadyInit[unitTeam]==nil) then alreadyInit[unitTeam] = {} end + alreadyInit[unitTeam][unitDefID] = true +end + + +local function DrawMorphUnit(unitID, morphData, localTeamID) + local h = GetUnitHeading(unitID) + if (h==nil) then + return --// bonus, heading is only available when the unit is in LOS + end + local px,py,pz = GetUnitBasePosition(unitID) + if (px==nil) then + return + end + local unitTeam = morphData.teamID + + InitializeUnitShape(morphData.def.into,unitTeam) --BUGFIX + + local frac = ((gameFrame + unitID) % 30) / 30 + local alpha = 2.0 * math.abs(0.5 - frac) + local angle + if morphData.def.facing then + angle = -HeadingToFacing(h) * 90 + 180 + else + angle = h * headingToDegree + end + + SetTeamColor(unitTeam,alpha) + glPushMatrix() + glTranslate(px, py, pz) + glRotate(angle, 0, 1, 0) + gl.Scale(1.002,1.002,1.002) + glUnitShape(morphData.def.into, unitTeam) + glPopMatrix() + + --// cheesy progress indicator + if (drawProgress)and(localTeamID)and + ( (spAreTeamsAllied(unitTeam,localTeamID)) or (localTeamID==Script.ALL_ACCESS_TEAM) ) + then + glPushMatrix() + glPushAttrib(GL_COLOR_BUFFER_BIT) + glTranslate(px, py+14, pz) + glBillboard() + local progStr = string.format("%.1f%%", 100 * morphData.progress) + gl.Text(progStr, 0, -65, 24, "oc") + glPopAttrib() + glPopMatrix() + end +end + + +function gadget:DrawWorld() + if (not snext(SYNCED.morphUnits)) then + return --//no morphs to draw + end + + gameFrame = GetGameFrame() + + glBlending(GL_SRC_ALPHA, GL_ONE) + glDepthTest(GL_LEQUAL) + + local spec, specFullView = GetSpectatingState() + local readTeam + if (specFullView) then + readTeam = Script.ALL_ACCESS_TEAM + else + readTeam = GetLocalTeamID() + end + + CallAsTeam({ ['read'] = readTeam }, function() + for unitID, morphData in spairs(SYNCED.morphUnits) do + if (unitID and morphData)and(IsUnitVisible(unitID)) then + DrawMorphUnit(unitID, morphData,readTeam) + end + end + end) + glDepthTest(false) + glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) +end + + + +-------------------------------------------------------------------------------- +-- UNSYNCED +-------------------------------------------------------------------------------- +end +-------------------------------------------------------------------------------- +-- COMMON +-------------------------------------------------------------------------------- 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_priority.lua b/LuaRules/Gadgets/unit_priority.lua index cdf1a7f24..46984066a 100644 --- a/LuaRules/Gadgets/unit_priority.lua +++ b/LuaRules/Gadgets/unit_priority.lua @@ -27,9 +27,15 @@ end local CMD_PRIORITY=34220 local Tooltips = { - 'Construction spending None. (Hotkey: i)', - 'Construction spending Normal. Default - inherits low/high temporarily from unit it builds. (Hotkey: i)', - 'Construction spending Low. Served only after high and normal priority units. (Hotkey: i)', + [[Construction spending: Low Priority + +Low priority constructions are only built using resources that are left over from other construction projects.]], + [[Construction spending: Normal Priority + +Normal priority constructions share resources evenly between one another.]], + [[Construction spending: High Priority + +High priority constructions will receive resources and buildpower before any other lower priority constructions.]], } local DefaultState = 1 local CommandOrder = 123456 @@ -38,9 +44,16 @@ local CommandDesc = { type = CMDTYPE.ICON_MODE, name = 'Priority', action = 'priority', - texture = 'bitmaps/ui/buttons/cmd_priority.png', - tooltip = Tooltips[DefaultState + 1], - params = {DefaultState, 'Low','Normal','High'} + --texture = 'bitmaps/ui/buttons/cmd_priority.png', + tooltip = Tooltips[DefaultState+1], + params = {DefaultState, +[[Low +Priority]], +[[Normal +Priority]], +[[High +Priority]] + } } local StateCount = #CommandDesc.params-1 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_shield_link.lua b/LuaRules/Gadgets/unit_shield_link.lua index 3a8db05a6..262d48293 100644 --- a/LuaRules/Gadgets/unit_shield_link.lua +++ b/LuaRules/Gadgets/unit_shield_link.lua @@ -9,6 +9,7 @@ function gadget:GetInfo() enabled = true -- loaded by default? } end +local version = 1.232 -- CHANGELOG -- 2009-5-24: CarRepairer: Added graphic lines to show links of shields (also shows links of enemies' visible shields, can remove if desired). @@ -18,21 +19,74 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- + +if gadgetHandler:IsSyncedCode() then + local spGetUnitPosition = Spring.GetUnitPosition local spGetUnitDefID = Spring.GetUnitDefID local spGetUnitTeam = Spring.GetUnitTeam +local spGetTeamInfo = Spring.GetTeamInfo local spGetUnitAllyTeam = Spring.GetUnitAllyTeam local spGetUnitIsStunned = Spring.GetUnitIsStunned local spGetUnitIsActive = Spring.GetUnitIsActive local spGetUnitShieldState = Spring.GetUnitShieldState local spSetUnitShieldState = Spring.SetUnitShieldState -local spGetTeamInfo = Spring.GetTeamInfo +local spSetUnitRulesParam = Spring.SetUnitRulesParam +local spGetUnitRulesParam = Spring.GetUnitRulesParam + +------------ +local RECHARGE_KOEF = 0.01 +local CHARGE_DRAW_THRESHOLD = 0.1 +------------ +local allyTeamShields = {} +local allyTeamShieldList = {} -if gadgetHandler:IsSyncedCode() then +local unitRulesParamsSetting = {inlos = true} -- Let enemies see links. It is information availible to them anyway + +local updateLink = {} +local updateAllyTeamLinks = {} + +-- Double table with index in things +local function AddDataThingToIterable(id, data, things, thingByID) + if id and data then + thingByID.count = thingByID.count + 1 + thingByID[thingByID.count] = id + things[id] = data + things[id].index = thingByID.count + end +end + +local function RemoveDataThingFromIterable(id, things, thingByID) + if things[id] then + things[thingByID[thingByID.count]].index = things[id].index + thingByID[things[id].index] = thingByID[thingByID.count] + thingByID[thingByID.count] = nil + things[id] = nil + thingByID.count = thingByID.count - 1 + return true + end + return false +end + +-- Double table is required to choose a random element from the list +local function AddThingToIterable(id, things, thingByID) + thingByID.count = thingByID.count + 1 + thingByID[thingByID.count] = id + things[id] = thingByID.count +end -local shieldTeams = {} -shieldConnections = {} +local function RemoveThingFromIterable(id, things, thingByID) + if things[id] then + things[thingByID[thingByID.count]] = things[id] + thingByID[things[id]] = thingByID[thingByID.count] + thingByID[thingByID.count] = nil + things[id] = nil + thingByID.count = thingByID.count - 1 + return true + end + return false +end function gadget:Initialize() for _,unitID in ipairs(Spring.GetAllUnits()) do @@ -43,26 +97,54 @@ function gadget:Initialize() end function gadget:UnitCreated(unitID, unitDefID) - -- only count finished buildings local stunned_or_inbuild, stunned, inbuild = spGetUnitIsStunned(unitID) if stunned_or_inbuild ~= nil and inbuild then return end - + local ud = UnitDefs[unitDefID] - if ud.shieldWeaponDef then - local shieldWep = WeaponDefs[ud.shieldWeaponDef] - local x,y,z = spGetUnitPosition(unitID) - local allyTeam = spGetUnitAllyTeam(unitID) - shieldTeams[allyTeam] = shieldTeams[allyTeam] or {} - shieldUnit = { - shieldPower = shieldWep.shieldPower, - shieldRadius = shieldWep.shieldRadius, - shieldOn = true, - link = {}, - } - shieldTeams[allyTeam][unitID] = shieldUnit + + local shieldWeaponDefID + local shieldNum = -1 + if ud.customParams.dynamic_comm then + if GG.Upgrades_UnitShieldDef then + shieldWeaponDefID, shieldNum = GG.Upgrades_UnitShieldDef(unitID) + end + else + shieldWeaponDefID = ud.shieldWeaponDef + end + + if shieldWeaponDefID then + local shieldWep = WeaponDefs[shieldWeaponDefID] + --local x,y,z = spGetUnitPosition(unitID) + local allyTeamID = spGetUnitAllyTeam(unitID) + if not (allyTeamShields[allyTeamID] and allyTeamShields[allyTeamID][unitID]) then -- not need to redo table if already have table (UnitFinished() will call this function 2nd time) + allyTeamShields[allyTeamID] = allyTeamShields[allyTeamID] or {} + allyTeamShieldList[allyTeamID] = allyTeamShieldList[allyTeamID] or {count = 0} + + local shieldRegen = shieldWep.shieldPowerRegen + if shieldRegen == 0 and shieldWep.customParams and shieldWep.customParams.shield_rate then + shieldRegen = tonumber(shieldWep.customParams.shield_rate) + end + + local shieldUnit = { + shieldMaxCharge = shieldWep.shieldPower, + shieldNum = shieldNum, + shieldRadius = shieldWep.shieldRadius, + shieldRegen = shieldRegen, + shieldRank = ((shieldWep.shieldRadius > 200) and 2) or 1, + unitDefID = unitDefID, + neighbors = {}, + neighborList = {count = 0}, + allyTeamID = allyTeamID, + enabled = false, + oldEnabled = false, + oldFastEnabled = false, + } + AddDataThingToIterable(unitID, shieldUnit, allyTeamShields[allyTeamID], allyTeamShieldList[allyTeamID]) + end + QueueLinkUpdate(allyTeamID,unitID) end end @@ -72,164 +154,261 @@ end function gadget:UnitDestroyed(unitID, unitDefID) local ud = UnitDefs[unitDefID] - local allyTeam = spGetUnitAllyTeam(unitID) - if ud.shieldWeaponDef and shieldTeams[allyTeam] then - local shieldUnit = shieldTeams[allyTeam][unitID] - shieldTeams[allyTeam][unitID] = nil - if shieldUnit then - shieldUnit.link[unitID] = nil + local allyTeamID = spGetUnitAllyTeam(unitID) + if allyTeamShields[allyTeamID] and allyTeamShields[allyTeamID][unitID] then + local unitData = allyTeamShields[allyTeamID][unitID] + if unitData then + RemoveUnitFromNeighbors(allyTeamID, unitID, unitData.neighborList) end + RemoveDataThingFromIterable(unitID, allyTeamShields[allyTeamID], allyTeamShieldList[allyTeamID]) end end function gadget:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) local ud = UnitDefs[unitDefID] local _,_,_,_,_,oldAllyTeam = spGetTeamInfo(oldTeam) - if ud.shieldWeaponDef then - if shieldTeams[oldAllyTeam] and shieldTeams[oldAllyTeam][unitID] then - local shieldUnit = shieldTeams[oldAllyTeam][unitID] - shieldTeams[oldAllyTeam][unitID] = nil - shieldUnit.link[unitID] = nil - shieldUnit.link = {} + local allyTeamID = spGetUnitAllyTeam(unitID) + if allyTeamID and allyTeamShields[oldAllyTeam] and allyTeamShields[oldAllyTeam][unitID] then + local unitData + if allyTeamShields[oldAllyTeam] and allyTeamShields[oldAllyTeam][unitID] then + unitData = allyTeamShields[oldAllyTeam][unitID] + + RemoveDataThingFromIterable(unitID, allyTeamShields[oldAllyTeam], allyTeamShieldList[oldAllyTeam]) + RemoveUnitFromNeighbors(oldAllyTeam, unitID, unitData.neighborList) + unitData.neighbors = {} + unitData.neighborList = {count = 0} + unitData.allyTeamID = allyTeamID end + allyTeamShields[allyTeamID] = allyTeamShields[allyTeamID] or {} + allyTeamShieldList[allyTeamID] = allyTeamShieldList[allyTeamID] or {count = 0} - local allyTeam = spGetUnitAllyTeam(unitID) - shieldTeams[allyTeam] = shieldTeams[allyTeam] or {} - shieldTeams[allyTeam][unitID] = shieldUnit + --Note: wont be problem when NIL when nanoframe is captured because is always filled with new value when unit finish + AddDataThingToIterable(unitID, unitData, allyTeamShields[allyTeamID], allyTeamShieldList[allyTeamID]) + QueueLinkUpdate(allyTeamID,unitID) end end --- check if working unit so it can be used for shield link -local function linkable(unitID) - local stunned_or_inbuild, stunned, inbuild = spGetUnitIsStunned(unitID) - if stunned_or_inbuild then +function RemoveUnitFromNeighbors(allyTeamID, unitID, neighborList) + local otherID + local thisShieldTeam = allyTeamShields[allyTeamID] + for i = 1, neighborList.count do + otherID = neighborList[i] + if thisShieldTeam[otherID] then + RemoveThingFromIterable(unitID, thisShieldTeam[otherID].neighbors, thisShieldTeam[otherID].neighborList) + end + end +end + +function QueueLinkUpdate(allyTeamID,unitID) + updateLink[allyTeamID] = updateLink[allyTeamID] or {} + updateLink[allyTeamID][unitID] = true +end + +-- Check if working unit so it can be used for shield link +local function IsEnabled(unitID) + local enabled = spGetUnitShieldState(unitID) + if not enabled then return false end - local active = spGetUnitIsActive(unitID) - if active ~= nil then - return active - else - return true + local stunned_or_inbuild, stunned, inbuild = spGetUnitIsStunned(unitID) + if stunned_or_inbuild then + return false end + local att_enabled = (spGetUnitRulesParam(unitID, "att_abilityDisabled") ~= 1) + return att_enabled end -local function AdjustLinks() - shieldConnections = {} - _G.shieldConnections = shieldConnections +local function ShieldsAreTouching(shield1, shield2) + local xDiff = shield1.x - shield2.x + local zDiff = shield1.z - shield2.z + local yDiff = shield1.y - shield2.y + local sumRadius = shield1.shieldRadius + shield2.shieldRadius + return xDiff <= sumRadius and zDiff <= sumRadius and (xDiff*xDiff + yDiff*yDiff + zDiff*zDiff) < sumRadius*sumRadius +end - for allyTeam,shieldUnits in pairs(shieldTeams) do - for unitID,su in pairs(shieldUnits) do - local x,y,z = spGetUnitPosition(unitID) - su.link = {[unitID] = su} - su.x = x - su.y = y - su.z = z - su.valid = x and y and z +local function AdjustLinks(allyTeamID, shieldUnits, shieldList, unitUpdateList) + local unitData + for unitID,_ in pairs(unitUpdateList) do + unitData = shieldUnits[unitID] + if unitData and unitData.enabled then + local otherID, otherData + for i = 1, shieldList.count do --iterate over all shield unit, find anyone that's in range. + otherID = shieldList[i] + if unitID ~= otherID then + otherData = shieldUnits[otherID] + if not (otherData.neighbors[unitID] or unitData.neighbors[otherID]) and + otherData.enabled and ShieldsAreTouching(unitData, otherData) then + if unitData.shieldRank == otherData.shieldRank then + AddThingToIterable(otherID, unitData.neighbors, unitData.neighborList) + AddThingToIterable(unitID, otherData.neighbors, otherData.neighborList) + elseif unitData.shieldRank < otherData.shieldRank then + -- The higher ranked shield does not initiate transfer with lower shields. + AddThingToIterable(otherID, unitData.neighbors, unitData.neighborList) + else + AddThingToIterable(unitID, otherData.neighbors, otherData.neighborList) + end + end + end + end -- for otherID end - - local sc = {} - local cnt = 1 - shieldConnections[allyTeam] = sc - - -- cache - local unitStat = {} + end -- for unitID +end - for ud1,su in pairs(shieldUnits) do +local function UpdateAllLinks(allyTeamID, shieldUnits, shieldList, unitUpdateList) + local unitData + for unitID,_ in pairs(unitUpdateList) do + unitData = allyTeamShields[allyTeamID][unitID] + if unitData then + local x,y,z = spGetUnitPosition(unitID) + local valid = x and y and z + unitData.enabled = valid and IsEnabled(unitID) + + if (unitData.enabled) then + unitData.x = x + unitData.y = y + unitData.z = z + end + end + end + + AdjustLinks(allyTeamID, shieldUnits, shieldList, unitUpdateList) +end - repeat - if unitStat[ud1] == nil then - unitStat[ud1] = linkable(ud1) +local function UpdateEnabledState() + for allyTeamID,unitList in pairs(allyTeamShields) do + for unitID,shieldUnit in pairs(unitList) do + shieldUnit.enabled = IsEnabled(unitID) + if shieldUnit.enabled ~= shieldUnit.oldFastEnabled then + if shieldUnit.oldFastEnabled then + spSetUnitRulesParam(unitID,"shield_link_unit",-1,unitRulesParamsSetting) end - if not unitStat[ud1] then break end -- continue - - for ud2,su2 in pairs(shieldUnits) do - - if unitStat[ud2] == nil then - unitStat[ud2] = linkable(ud2) - end - - if su.link ~= su2.link and unitStat[ud2] then - if su.valid and ((su.x - su2.x)^2 + (su.y - su2.y)^2 + (su.z - su2.z)^2) ^ 0.5 < (su.shieldRadius + su2.shieldRadius) then - - sc[cnt] = {ud1,ud2} - cnt = cnt + 1 - - for unitID,linksu in pairs(su2.link) do - su.link[unitID] = linksu - linksu.link = su.link - end - end - end - end -- for ud2 - until true - end -- for ud1 + shieldUnit.oldFastEnabled = shieldUnit.enabled + end + end end end -local RECHARGE_KOEF = 0.01 +local function DoChargeTransfer(lowID, lowData, lowCharge, highID, highData, highCharge) + --charge flow is: based on the absolute difference in charge content, + --charge flow must: + --1)not be more than receiver's capacity, + --2)not be more than donator's available charge, + --3)leave spaces for receiver to regen, + --charge flow is capable: to reverse flow (IS DISABLED!) when receiver have regen and is full, + local chargeFlow = math.min(RECHARGE_KOEF*(highCharge - lowCharge),highCharge, lowData.shieldMaxCharge - lowData.shieldRegen - lowCharge) --minimize positive flow + if chargeFlow > 0 then -- Disallow negative flow + chargeFlow = chargeFlow * (spGetUnitRulesParam(highID, "totalReloadSpeedChange") or 1) + spSetUnitShieldState(highID, highData.shieldNum, highCharge - chargeFlow) + spSetUnitShieldState(lowID, lowData.shieldNum, lowCharge + chargeFlow) + return chargeFlow + end + return 0 +end function gadget:GameFrame(n) - if n%30 == 18 then AdjustLinks() end - - -- cache - local unitStat = {} - - for allyTeam,shieldUnits in pairs(shieldTeams) do - local processedLinks = {} --DO NOT USE PAIRS ON THIS - for unitID,su in pairs(shieldUnits) do - repeat - if not processedLinks[su.link] then - processedLinks[su.link] = true - - -- only update working shields - if unitStat[unitID] == nil then - unitStat[unitID] = linkable(unitID) + if n%30 == 18 then --update every 30 frames at the 18th frame + --note: only update link when unit moves reduce total consumption by 53% when unit idle. + for allyTeamID,unitList in pairs(allyTeamShieldList) do + local unitID, unitData + for i = 1, unitList.count do + unitID = unitList[i] + unitData = allyTeamShields[allyTeamID][unitID] + if unitData.enabled ~= unitData.oldEnabled then --if unit was linked/unlinked but now stunned/unstunned (state changes) + if not unitData.oldEnabled then + QueueLinkUpdate(allyTeamID,unitID) end - if not unitStat[unitID] then - break -- continue - end - - local totalCharge = 0 - local linkUnits = 0 - local udata = {} -- unit data, charge and chargeMax - for unitID2,su2 in pairs(su.link) do - local shieldOn,shieldCharge = spGetUnitShieldState(unitID2, -1) - su.shieldOn = shieldOn - if (shieldOn) then - udata[unitID2] = { - charge = shieldCharge, - chargeMax = su2.shieldPower - } - totalCharge = totalCharge + shieldCharge - linkUnits = linkUnits + 1 - end - end - local avg = totalCharge / linkUnits -- calculate average charge of netwrok - local overflow = 0 - local slack = 0 - - for uid,d in pairs(udata) do -- equalize all sheilds to average by 1% of their difference from average - local newCharge = d.charge + (avg - d.charge) * RECHARGE_KOEF - if (newCharge > d.chargeMax) then - overflow = overflow + newCharge - d.chargeMax - newCharge = d.chargeMax - else - slack = slack + d.chargeMax - newCharge - end - d.charge = newCharge - spSetUnitShieldState(uid, -1, newCharge) + unitData.oldEnabled = unitData.enabled + elseif unitData.enabled then + local x,y,z = unitData.x, unitData.y, unitData.z + if x and y and z then + local ux,uy,uz = spGetUnitPosition(unitID) + if ux-x > 10 or x-ux > 10 or uy-y > 10 or y-uy > 10 or uz-z > 10 or z-uz > 10 then --if unit change position + QueueLinkUpdate(allyTeamID, unitID) + end + else + Spring.Echo("Warning: shieldUnitPosition for " .. unitID .. " is NIL") --should not happen, all ShieldUnit should've been subjected to linking check at least once + updateAllyTeamLinks[allyTeamID] = true --re-create all link + break; --nothing else to do, escape loop end + end + end + end + for allyTeamID,_ in pairs(updateAllyTeamLinks) do + UpdateAllLinks(allyTeamID,allyTeamShields[allyTeamID],allyTeamShieldList[allyTeamID],allyTeamShields[allyTeamID]) + updateAllyTeamLinks[allyTeamID] = nil + end + for allyTeamID,unitToLink in pairs(updateLink) do + UpdateAllLinks(allyTeamID,allyTeamShields[allyTeamID],allyTeamShieldList[allyTeamID],unitToLink) --adjust/create link + updateLink[allyTeamID] = nil + end - if overflow > 0 and slack > 0 then -- if there was overflow (above max charge) and there is still some unused space for charge, transfer it there - for uid,d in pairs(udata) do - if (d.charge < d.chargeMax) then - local newCharge = d.charge + overflow * (d.chargeMax - d.charge) / slack - spSetUnitShieldState(uid, -1, newCharge) - end + elseif n%5 == 3 then + UpdateEnabledState() --do stun checks at a bit faster rate for charge distribution algorithm (below) + end + + -- Charge Distribution + --Distribute charge to random nearby neighbor + local drawChange = (n%10 == 0) + if n%2 == 0 then + for allyTeamID,unitList in pairs(allyTeamShieldList) do + local shieldUnits = allyTeamShields[allyTeamID] + local unitID, unitData, unitCharge + local otherID, otherData, otherCharge + local on, chargeFlow, attempt + local randomUnitIndex, randomNumberRange + for i = 1, unitList.count do + unitID = unitList[i] + unitData = shieldUnits[unitID] + on, unitCharge = spGetUnitShieldState(unitID, unitData.shieldNum) + chargeFlow = 0 + attempt = 1 + while attempt and attempt < 3 do + if on and unitCharge and unitData.enabled and unitData.neighborList.count >= 1 then + allyTeamID = unitData.allyTeamID + unitFlow = 0 + -- The +1 is here intentionally to give units a chance to not link (because + -- otherID will be nil). This penalises the flow rate of units with few + -- neighbors. + randomNumberRange = unitData.neighborList.count + 1 + randomUnitIndex = math.random(1, randomNumberRange) + otherID = unitData.neighborList[randomUnitIndex] + if otherID then + otherData = allyTeamShields[allyTeamID][otherID] + if otherData then + on, otherCharge = spGetUnitShieldState(otherID, otherData.shieldNum) + if on and otherCharge and otherData.enabled and ShieldsAreTouching(unitData, otherData) then + if (unitCharge > otherCharge) then + chargeFlow = DoChargeTransfer(otherID, otherData, otherCharge, unitID, unitData, unitCharge) + else + chargeFlow = DoChargeTransfer(unitID, unitData, unitCharge, otherID, otherData, otherCharge) + end + if chargeFlow >= CHARGE_DRAW_THRESHOLD and drawChange then + spSetUnitRulesParam(unitID,"shield_link_unit",otherID,unitRulesParamsSetting) + end + attempt = false + else + RemoveThingFromIterable(unitID, otherData.neighbors, otherData.neighborList) + RemoveThingFromIterable(otherID, unitData.neighbors, unitData.neighborList) + attempt = attempt + 1 + end + else + RemoveThingFromIterable(otherID, unitData.neighbors, unitData.neighborList) + attempt = attempt + 1 + end + elseif randomUnitIndex == randomNumberRange then + -- If I hit the end of the range I picked myself as a partner. + attempt = false + else + attempt = attempt + 1 end - end + else + attempt = false + end + end + if chargeFlow < CHARGE_DRAW_THRESHOLD and drawChange then + spSetUnitRulesParam(unitID,"shield_link_unit",-1,unitRulesParamsSetting) end - until true + end end end end @@ -252,68 +431,101 @@ local glPopAttrib = gl.PopAttrib local GL_LINE_BITS = GL.LINE_BITS local GL_LINES = GL.LINES +local abs = math.abs + local spGetMyAllyTeamID = Spring.GetMyAllyTeamID local spGetSpectatingState = Spring.GetSpectatingState local spIsUnitInView = Spring.IsUnitInView local spValidUnitID = Spring.ValidUnitID +local spGetUnitRulesParam = Spring.GetUnitRulesParam +local spGetUnitViewPosition = Spring.GetUnitViewPosition +local spGetUnitLosState = Spring.GetUnitLosState +local spGetGameFrame = Spring.GetGameFrame -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +local shieldUnits = {} +local shieldCount = 0 +function gadget:UnitCreated(unitID, unitDefID) + if UnitDefs[unitDefID].shieldWeaponDef then + shieldCount = shieldCount + 1 + shieldUnits[shieldCount] = unitID + end +end -function gadget:Initialize() +function gadget:UnitDestroyed(unitID, unitDefID) + if UnitDefs[unitDefID].shieldWeaponDef then + for i=1, #shieldUnits do + if shieldUnits[i] == unitID then + table.remove(shieldUnits,i) + shieldCount = shieldCount - 1 + break; + end + end + end end +function gadget:Initialize() + local spGetUnitDefID = Spring.GetUnitDefID + for _,unitID in ipairs(Spring.GetAllUnits()) do + local unitDefID = spGetUnitDefID(unitID) + gadget:UnitCreated(unitID, unitDefID) + end +end local function DrawFunc() - myAllyID = spGetMyAllyTeamID() + local unitID + local connectedToUnitID + local x1, y1, z1, x2, y2, z2 local spec, fullview = spGetSpectatingState() - spec = spec or fullview - - for allyID, connections in spairs(SYNCED.shieldConnections) do - for _,con in sipairs(connections) do - local u1 = con[1] - local u2 = con[2] - - local l1 - local l2 - - if (spec or allyID == myAllyID) then - l1 = spIsUnitInView(u1) - l2 = spIsUnitInView(u2) - end - - if ((l1 or l2) and (spValidUnitID(u1) and spValidUnitID(u2))) then - local _,_,_,x1, y1, z1 = spGetUnitPosition(u1, true) - local _,_,_,x2, y2, z2 = spGetUnitPosition(u2, true) + local myTeam = spGetMyAllyTeamID() + for i=1, #shieldUnits do + unitID = shieldUnits[i] + connectedToUnitID = tonumber(spGetUnitRulesParam(unitID, "shield_link_unit") or -1) + if connectedToUnitID and connectedToUnitID >= 0 and (spValidUnitID(unitID) and spValidUnitID(connectedToUnitID)) then + local los1 = spGetUnitLosState(unitID, myTeam, false) + local los2 = spGetUnitLosState(connectedToUnitID, myTeam, false) + if (fullview or (los1 and los1.los) or (los2 and los2.los)) and + (spIsUnitInView(unitID) or spIsUnitInView(connectedToUnitID)) then + + x1, y1, z1 = spGetUnitViewPosition(unitID, true) + x2, y2, z2 = spGetUnitViewPosition(connectedToUnitID, true) glVertex(x1, y1, z1) glVertex(x2, y2, z2) end end end -end +end - -function gadget:DrawWorld() - if SYNCED.shieldConnections and snext(SYNCED.shieldConnections) then +local function DrawWorldFunc() + if shieldCount > 1 then + local frame = spGetGameFrame() + local alpha = 0.5-0.1*abs((frame%10) - 5) + glPushAttrib(GL_LINE_BITS) - + glDepthTest(true) - glColor(0,0,1,math.random()*0.3+0.2) - glLineWidth(3) + glColor(1,0,1,alpha) + glLineWidth(alpha+0.6) glBeginEnd(GL_LINES, DrawFunc) - + glDepthTest(false) glColor(1,1,1,1) - + glPopAttrib() end end +function gadget:DrawWorld() + DrawWorldFunc() +end +function gadget:DrawWorldRefraction() + DrawWorldFunc() +end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- - diff --git a/LuaRules/Gadgets/unit_supply_requirement.lua b/LuaRules/Gadgets/unit_supply_requirement.lua index f84bff4ec..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 = 200 -local INTRINSIC_SUPPLY = 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 new file mode 100644 index 000000000..79d62c16a --- /dev/null +++ b/LuaRules/Gadgets/unit_takeCover.lua @@ -0,0 +1,215 @@ +----used custom tags +------in the featureDef: provide_cover (int) +------in the unitDef: need_cover (int) + +function gadget:GetInfo() + return { + name = "Unit Take Cover", + desc = "Units gain cloak when in the presence of features on the map", + author = "knorke, Forboding Angel", + date = "2016", + license = "CC0", + layer = -3, + enabled = false -- loaded by default? + } +end + +if (gadgetHandler:IsSyncedCode()) then ---SYNCHED + +local resolution = 100 +local updateRate = 30 +_G.resolution = resolution +cover = {} +_G.cover = cover +local mapX = Game.mapSizeX+1 +local mapZ = Game.mapSizeZ+1 + +local needed_cover = {} --[unitID] + +--Spring.GetFeatureRadius ( number featureID ) -> nil | number +--Spring.GetFeaturePosition( number featureID ) -> nil | number x, number y, number z + +function gadget:Initialize() + local all_units = Spring.GetAllUnits () + for i in pairs(all_units) do + --Spring.Echo ("unit " .. all_units[i]) + local ud = UnitDefs[Spring.GetUnitDefID(all_units[i])] + if (ud) then + needed_cover[all_units[i]] = tonumber (ud.customParams.needed_cover) or 999 + --Spring.Echo ("needs a cover of " .. needed_cover[all_units[i]]) + end + end + buildCover () +end + +function setcover (x,z, c) + --Spring.Echo ("x= ".. x .. " z=" .. z) + local tx, tz = tcoord (x,z) + --Spring.Echo ("tx= ".. tx .. " tz=" .. tz) + cover[tx][tz] = c + _G.cover = cover +end + +function getcover (x,z) + if (x > mapX) then return 0 end + if (x < 0) then return 0 end + if (z > mapZ) then return 0 end + if (z < 0) then return 0 end + local tx, tz = tcoord (x,z) + return cover[tx][tz] or 0 +end + +function addcover (x,z, a) + --Spring.Echo ("adding " .. a .. " cover at " .. x .. ":" .. z) + local old = getcover (x,z) + if (old+a < 0) then + setcover (x,z, 0) + else + setcover (x,z, old+a) + end +end + +function providedCoverFromFeature (featureID) + local fd = FeatureDefs[Spring.GetFeatureDefID(featureID)] + --Spring.Echo (fd.name) + if (not fd) then return 555 end + if (not fd.customParams) then return 666 end + return fd.customParams["provide_cover"] or 0 +end + + +function tcoord (x,z) + tx=math.floor ((x/resolution)+0.5) + tz=math.floor ((z/resolution)+0.5) + return tx,tz +end + +function buildCover () + local cnt=0 + for x=0, mapX+resolution, resolution do + local tx, tz = tcoord (x,666) + cover[tx]={} + for z=0 , mapZ+resolution, resolution do + cnt=cnt+1 + --Spring.Echo ("BAUE tx= ".. tx .. " tz=" .. tz) + local tx, tz = tcoord (x,z) + cover[tx][tz] = 0 --***wasting memory. who cares? + end + end + --Spring.Echo ("count=" .. cnt) + + local allF = Spring.GetAllFeatures () + for i in pairs(allF) do + local fi = allF[i] + local x,y,z = Spring.GetFeaturePosition (fi) + if(x and z) then + --local tx, tz = tcoord (x,z) + --Spring.MarkerAddPoint (x,y,z, "feature @ " .. tx .. ":" .. tz) + --addcover (x,z, 1) + --addcover (x,z, 1) + addcover (x,z, providedCoverFromFeature (fi)) + --local old = getcover (tx,tz) + --setcover (x,z, old+a) + end + end +end + +function updateUnits () + local all_units = Spring.GetAllUnits () + for i in pairs(all_units) do + local x,y,z=Spring.GetUnitPosition (all_units[i]) + if (x and y and z) then --***why is this needed? sometimes x is nil for some reason?! + local c = getcover (x,z) + if (c >= (needed_cover[all_units[i]] or 999)) then + --Spring.Echo (c) + hideUnit (all_units[i]) + else + unhideUnit (all_units[i]) + end + end + + end +end + +--***vielleicht lieber setunitlosstate? +function hideUnit (uID) + Spring.SetUnitCloak (uID, 2 ,false) +end + +function unhideUnit (uID) + Spring.SetUnitCloak (uID, false ,false) +end + + +function gadget:GameFrame (f) + if (f%updateRate ==0) then + --Spring.Echo ("running") + updateUnits () + end +end + +function gadget:FeatureDestroyed(featureID, allyTeam) + local x,y,z = Spring.GetFeaturePosition (featureID) + if(x and z) then + addcover (x,z, -providedCoverFromFeature (featureID)) + end +end + +function gadget:FeatureCreated(featureID, allyTeam) + local x,y,z = Spring.GetFeaturePosition (featureID) + if(x and z) then + addcover (x,z, providedCoverFromFeature (featureID)) + end +end + +function gadget:UnitFinished(unitID, unitDefID, teamID) + local cp = UnitDefs[unitDefID].customParams + if (not cp) then return end + needed_cover[unitID] = tonumber (cp.needed_cover) or math.huge +end + +function gadget:UnitDestroyed(unitID) + needed_cover[unitID] = nil +end + + +------------------- +else ----UNSYNCED-- +------------------- + +local debugDraw = false +--***how can i avoid having this function twice? +function utcoord (x,z) + tx=math.floor ((x/SYNCED.resolution)+0.5) + tz=math.floor ((z/SYNCED.resolution)+0.5) + return tx,tz +end + +function ugetcover (x,z) + local tx, tz = utcoord (x,z) + return SYNCED.cover[tx][tz] +end + +function gadget:DrawWorldPreUnit() + if (debugDraw) then + --gl.LineWidth(2.0) + gl.Color(0, 1, 1, 1) + local mapX = Game.mapSizeX-1 + local mapZ = Game.mapSizeZ-1 + for x=1, mapX, SYNCED.resolution do + for z=1 ,mapZ, SYNCED.resolution do + local c = ugetcover (x,z) + if (c > -1) then + gl.DrawGroundCircle (x,100,z, SYNCED.resolution/2, 8) + gl.DrawGroundCircle (x,100,z, (SYNCED.resolution/10)+(c*10), 8) + end + end + end + end +end + +--[[ function gadget:KeyPress(key, mods, isRepeat) + if (key == 108 and Spring.IsCheatingEnabled() ) then debugDraw = not debugDraw end --108=L +end ]]-- + +end \ No newline at end of file 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 bb55967ed..bcc6152c6 100644 --- a/LuaRules/Gadgets/weapon_single_hit.lua +++ b/LuaRules/Gadgets/weapon_single_hit.lua @@ -1,7 +1,14 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +if not gadgetHandler:IsSyncedCode() then + return +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", @@ -12,10 +19,7 @@ end local spGetGameFrame = Spring.GetGameFrame ------- SYNCED ------------------------------------------------------- -if (gadgetHandler:IsSyncedCode()) then - -local isNewEngine = not (Game.version:find('91.0') and (Game.version:find('91.0.1') == nil)) +local wantedWeaponList = {} local singleHitWeapon = {} local singleHitUnitId = {} @@ -24,15 +28,17 @@ local singleHitMultiWeapon = {} local singleHitProjectile = {} function gadget:Initialize() - for i=1,#WeaponDefs do - local wd = WeaponDefs[i] + for wdid = 1, #WeaponDefs do + local wd = WeaponDefs[wdid] if wd.customParams then if wd.customParams.single_hit then singleHitWeapon[wd.id] = true; + wantedWeaponList[#wantedWeaponList + 1] = wdid end - if isNewEngine and wd.customParams.single_hit_multi then + if wd.customParams.single_hit_multi then Script.SetWatchWeapon(wd.id, true) singleHitMultiWeapon[wd.id] = true; + wantedWeaponList[#wantedWeaponList + 1] = wdid end end end @@ -51,6 +57,9 @@ function gadget:ProjectileDestroyed(proID) end end +function gadget:UnitPreDamaged_GetWantedWeaponDef() + return wantedWeaponList +end function gadget:UnitPreDamaged(unitID,unitDefID,_, damage,_, weaponDefID,attackerID,_,_, projectileID) if singleHitWeapon[weaponDefID] then @@ -68,7 +77,6 @@ function gadget:UnitPreDamaged(unitID,unitDefID,_, damage,_, weaponDefID,attacke end end return damage - end end @@ -83,10 +91,5 @@ function gadget:UnitPreDamaged(unitID,unitDefID,_, damage,_, weaponDefID,attacke end return damage end - return damage; -end - - -end ------ END SYNCED --------------------------------------------------- +end \ No newline at end of file diff --git a/LuaRules/Images/bgcorner.png b/LuaRules/Images/bgcorner.png new file mode 100644 index 000000000..317f49a57 Binary files /dev/null and b/LuaRules/Images/bgcorner.png differ diff --git a/LuaRules/Images/controlpoints.png b/LuaRules/Images/controlpoints.png new file mode 100644 index 000000000..c374cd35e Binary files /dev/null and b/LuaRules/Images/controlpoints.png differ diff --git a/LuaRules/Utilities/getunitisbuilding.lua b/LuaRules/Utilities/getunitisbuilding.lua index f603ecfee..640974c31 100644 --- a/LuaRules/Utilities/getunitisbuilding.lua +++ b/LuaRules/Utilities/getunitisbuilding.lua @@ -8,8 +8,15 @@ ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- +local engineVersion = (Game and Game.version) or (Engine and Engine.version) or "Engine version error" + +local reverseCompat = (engineVersion:find('91.0') == 1) + local function IsFeatureInRange(unitID, featureID, range) - range = range + 20 -- fudge factor + if reverseCompat then + return true + end + range = range + 100 -- fudge factor local x,y,z = Spring.GetFeaturePosition(featureID) local ux,uy,uz = Spring.GetUnitPosition(unitID) return ((ux - x)^2 + (uz - z)^2) <= range^2 @@ -30,17 +37,17 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) if (buildID) then target = buildID type = "building" - --inRange = true + inRange = true else - --local unitDef = UnitDefs[Spring.GetUnitDefID(unitID)] or {} - --local buildRange = unitDef.buildDistance or 0 - local cmds = Spring.GetUnitCommands(unitID,1) + local unitDef = UnitDefs[Spring.GetUnitDefID(unitID)] or {} + local buildRange = unitDef.buildDistance or 0 + local cmds = Spring.GetCommandQueue(unitID,1) if (cmds)and(cmds[1]) then local cmd = cmds[1] local cmdID = cmd.id local cmdParams = cmd.params - if cmdID == CMD.RECLAIM then + if cmdID == CMD.RECLAIM then --// anything except "#cmdParams = 1 or 5" is either invalid or discribes an area reclaim if (not cmdParams[2])or(cmdParams[5]) then local id = cmdParams[1] @@ -52,13 +59,13 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) target = featureID isFeature = true type = "reclaim" - --inRange = IsFeatureInRange(unitID, featureID, buildRange) + inRange = IsFeatureInRange(unitID, featureID, buildRange) end else if Spring.ValidUnitID(unitID_) then target = unitID_ type = "reclaim" - --inRange = Spring.GetUnitSeparation(unitID, unitID_, true) <= buildRange + inRange = Spring.GetUnitSeparation(unitID, unitID_, true) <= buildRange end end end @@ -68,7 +75,7 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) if Spring.ValidUnitID(repairID) then target = repairID type = "repair" - --inRange = Spring.GetUnitSeparation(unitID, repairID, true) <= buildRange + inRange = Spring.GetUnitSeparation(unitID, repairID, true) <= buildRange end elseif cmdID == CMD.RESTORE then @@ -76,7 +83,7 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) local z = cmd.params[3] type = "restore" target = {x, GetGroundHeight(x,z)+5, z, cmd.params[4]} - --inRange = IsGroundPosInRange(unitID, x, z, buildRange) + inRange = IsGroundPosInRange(unitID, x, z, buildRange) elseif cmdID == CMD.CAPTURE then if (not cmdParams[2])or(cmdParams[5]) then @@ -84,7 +91,7 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) if Spring.ValidUnitID(captureID) then target = captureID type = "capture" - --inRange = Spring.GetUnitSeparation(unitID, captureID, true) <= buildRange + inRange = Spring.GetUnitSeparation(unitID, captureID, true) <= buildRange end end @@ -94,12 +101,16 @@ function Spring.Utilities.GetUnitNanoTarget(unitID) target = rezzID isFeature = true type = "resurrect" - --inRange = IsFeatureInRange(unitID, featureID, buildRange) + inRange = IsFeatureInRange(unitID, rezzID, buildRange) end end end end - return type, target, isFeature, inRange + if inRange then + return type, target, isFeature + else + return + end end 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/Utilities/unitTypeChecker.lua b/LuaRules/Utilities/unitTypeChecker.lua new file mode 100644 index 000000000..14de62844 --- /dev/null +++ b/LuaRules/Utilities/unitTypeChecker.lua @@ -0,0 +1,25 @@ + +function Spring.Utilities.getMovetype(ud) + if ud.canFly or ud.isAirUnit then + if ud.isHoveringAirUnit then + return 1 -- gunship + else + return 0 -- fixedwing + end + elseif not (ud.isBuilding or ud.isFactory or ud.speed == 0) then + return 2 -- ground/sea + end + return false -- For structures or any other invalid movetype +end + +function Spring.Utilities.getMovetypeByID(unitDefID) + local ud = unitDefID and UnitDefs[unitDefID] + if ud then + Spring.Utilities.getMovetype(ud) + end + return false +end + +function Spring.Utilities.BlueprintFloat(ud) + return Spring.Utilities.IsCurrentVersionNewerThan(103, 289) and ud.floatOnWater +end diff --git a/LuaRules/Utilities/unitrendering.lua b/LuaRules/Utilities/unitrendering.lua index 030a74539..a963e183c 100644 --- a/LuaRules/Utilities/unitrendering.lua +++ b/LuaRules/Utilities/unitrendering.lua @@ -1,3 +1,92 @@ +VFS.Include("LuaRules/Utilities/versionCompare.lua") +local reverseCompat = not Spring.Utilities.IsCurrentVersionNewerThan(100, 0) + +if reverseCompat then + +-- $Id:$ +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- +-- exported functions: +-- Spring.UnitRendering.GetLODCount(unitID) -> int +-- Spring.UnitRendering.ActivateMaterial(unitID,lod) -> nil +-- Spring.UnitRendering.DeactivateMaterial(unitID,lod) -> nil +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +if (SendToUnsynced) then + return +end + +local unit_lods = {} + +local origSetLODCount = Spring.UnitRendering.SetLODCount + +function Spring.UnitRendering.SetLODCount(unitID,lod_count) + unit_lods[unitID] = lod_count + origSetLODCount(unitID,lod_count) +end + +function Spring.UnitRendering.GetLODCount(unitID) + return unit_lods[unitID] or 0 +end + + + +local unitActiveMats = {} +local curHighestLOD = 0 + +function Spring.UnitRendering.ActivateMaterial(unitID,lod) + local actMats = unitActiveMats[unitID] + if (not actMats) then + actMats = {current = math.huge} + unitActiveMats[unitID] = actMats + end + + local lod_count = Spring.UnitRendering.GetLODCount(unitID) + if (lod_count < lod) then + Spring.UnitRendering.SetLODCount(unitID,lod) + end + + actMats[lod] = true + + if (lod > curHighestLOD) then + curHighestLOD = lod + end + + if (lod <= actMats.current) then + actMats.current = lod + Spring.UnitRendering.SetMaterialLastLOD(unitID, "opaque", lod) + end +end + + +function Spring.UnitRendering.DeactivateMaterial(unitID,lod) + local actMats = unitActiveMats[unitID] + if (not actMats) then + return + end + + actMats[lod] = nil + + if (actMats.current == lod) then + --// detect next available material + for i=1,curHighestLOD do + if (actMats[i]) then + actMats.current = i + Spring.UnitRendering.SetMaterialLastLOD(unitID, "opaque", i) + return + end + end + + --// none material active + unitActiveMats[unitID] = nil + Spring.UnitRendering.SetMaterialLastLOD(unitID, "opaque", 0) + Spring.UnitRendering.SetLODCount(unitID,0) + end +end + +else -- reverseCompat + -- $Id:$ ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- @@ -50,25 +139,18 @@ local function ActivateMaterial(rendering, objectID, lod) activeMats = {current = math.huge} rendering.activeMats[objectID] = activeMats end - + local lod_count = GetLODCount(rendering, objectID) if lod_count < lod then SetLODCount(rendering, objectID, lod) end - rendering.activeMats[lod] = true + activeMats[lod] = true if lod > rendering.curHighestLOD then rendering.curHighestLOD = lod end - ---I have no idea what the fuck this does, but commenting it out fixes errors AND fixes issues where units who cloak and then uncloak will lose their normalmaps. ---Doesn't make ANY sense at all, Hey! Welcome to spring! ---FFS this is fucking bullshit. ---Forboding Angel ---Update, this is screwed because custom unit shaders is broken as shit atm. 5-7-2016 ---Disabled CUS until it is unfucked, uncommented the block. if lod <= activeMats.current then activeMats.current = lod rendering.spSetMaterialLastLOD(objectID, "opaque", lod) @@ -131,4 +213,6 @@ end function Spring.FeatureRendering.DeactivateMaterial(featureID, lod) DeactivateMaterial(featureRendering, featureID, lod) +end + end \ No newline at end of file diff --git a/LuaRules/Utilities/versionCompare.lua b/LuaRules/Utilities/versionCompare.lua index bbf06925d..8fcfdd141 100644 --- a/LuaRules/Utilities/versionCompare.lua +++ b/LuaRules/Utilities/versionCompare.lua @@ -1,6 +1,6 @@ function Spring.Utilities.IsCurrentVersionNewerThan(rel, dev) -- Argument example, .0.1--g5072695 - local thisVersion = Game.version + local thisVersion = (Game and Game.version) or (Engine and Engine.version) or "Engine version error" local thisRel, thisDev local i = 1 for word in thisVersion:gmatch("[^%-]+") do diff --git a/LuaRules/callins.lua b/LuaRules/callins.lua index 248641759..256e07a61 100644 --- a/LuaRules/callins.lua +++ b/LuaRules/callins.lua @@ -1,4 +1,3 @@ --- $Id: callins.lua 3171 2008-11-06 09:06:29Z det $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- @@ -9,79 +8,181 @@ -- Copyright (C) 2007. -- Licensed under the terms of the GNU GPL, v2 or later. -- +-- functions listed here are reserved and not allowed to be RegisterGlobal()'ed +-- they are set to 'nil' if not used by any gadget, see gadgetHandler:UpdateCallIn -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -CallInsList = { - - "Shutdown", - "LayoutButtons", - "ConfigureLayout", - "CommandNotify", - - "KeyPress", - "KeyRelease", - "MouseMove", - "MousePress", - "MouseRelease", - "IsAbove", - "GetTooltip", - "AddConsoleLine", - "GroupChanged", - - "GameOver", - "TeamDied", - - "UnitCreated", - "UnitFinished", - "UnitFromFactory", - "UnitDestroyed", - "UnitTaken", - "UnitGiven", - "UnitIdle", - "UnitSeismicPing", - "UnitEnteredRadar", - "UnitEnteredLos", - "UnitLeftRadar", - "UnitLeftLos", - "UnitLoaded", - "UnitUnloaded", - - "FeatureCreated", - "FeatureDestroyed", - - "DrawWorld", - "DrawWorldPreUnit", - "DrawWorldShadow", - "DrawWorldReflection", - "DrawWorldRefraction", - "DrawScreenEffects", - "DrawScreen", - "DrawInMiniMap", - - "Explosion", - "ShockFront", - - "GameFrame", - "CobCallback", - "AllowCommand", - "CommandFallback", - "AllowUnitCreation", - "AllowUnitTransfer", - "AllowUnitBuildStep", - "AllowFeatureCreation", - "AllowFeatureBuildStep", - "AllowResourceLevel", - "AllowResourceTransfer", -} +CALLIN_MAP = {} +CALLIN_LIST = { + -- Save/Load + "Save", + "Load", + -- called when Lua is disabled or this client exits + "Shutdown", --- make the map -CallInsMap = {} -for _, callin in ipairs(CallInsList) do - CallInsMap[callin] = true -end + -- game callins + "GameSetup", + "GamePreload", + "GameStart", + "GameOver", + "GameFrame", + "GamePaused", + "GameProgress", + "GameID", + -- player callins + "PlayerChanged", + "PlayerAdded", + "PlayerRemoved", + + -- team callins + "TeamDied", + "TeamChanged", + + -- unit callins + "UnitCreated", + "UnitFinished", + "UnitFromFactory", + "UnitReverseBuilt", + "UnitDestroyed", + "RenderUnitDestroyed", + "UnitExperience", + "UnitIdle", + "UnitCmdDone", + "UnitPreDamaged", + "UnitDamaged", + "UnitStunned", + "UnitTaken", + "UnitGiven", + "UnitEnteredRadar", + "UnitEnteredLos", + "UnitLeftRadar", + "UnitLeftLos", + "UnitSeismicPing", + "UnitLoaded", + "UnitUnloaded", + "UnitCloaked", + "UnitDecloaked", + "UnitUnitCollision", + "UnitFeatureCollision", + "UnitMoveFailed", + "UnitMoved", -- FIXME: not exposed to Lua yet (as of 95.0) + "UnitEnteredAir", -- FIXME: not implemented by base GH + "UnitLeftAir", -- FIXME: not implemented by base GH + "UnitEnteredWater", -- FIXME: not implemented by base GH + "UnitLeftWater", -- FIXME: not implemented by base GH + "UnitCommand", + + -- weapon callins + "StockpileChanged", + + -- feature callins + "FeatureCreated", + "FeatureDestroyed", + "FeatureDamaged", + "FeatureMoved", -- FIXME: not exposed to Lua yet (as of 95.0) + "FeaturePreDamaged", + + -- projectile callins + "ProjectileCreated", + "ProjectileDestroyed", + + -- shield callins + "ShieldPreDamaged", + + -- misc synced LuaRules callins + "AllowCommand", + "AllowStartPosition", + "AllowUnitCreation", + "AllowUnitTransfer", + "AllowUnitBuildStep", + "AllowFeatureBuildStep", + "AllowFeatureCreation", + "AllowResourceLevel", + "AllowResourceTransfer", + "AllowDirectUnitControl", + "AllowBuilderHoldFire", + "AllowWeaponTargetCheck", + "AllowWeaponTarget", + "AllowWeaponInterceptTarget", + + "Explosion", + "CommandFallback", + "MoveCtrlNotify", + "TerraformComplete", + + -- synced message callins + "GotChatMsg", + "RecvLuaMsg", + + -- unsynced callins + "Update", + "UnsyncedHeightMapUpdate", -- FIXME: not implemented by base GH + + "DrawGenesis", + "DrawWorld", + "DrawWorldPreUnit", + "DrawWorldShadow", + "DrawWorldReflection", + "DrawWorldRefraction", + "DrawGroundPreForward", + "DrawGroundPreDeferred", + "DrawGroundPostDeferred", + "DrawUnitsPostDeferred", + "DrawFeaturesPostDeferred", + "DrawScreenEffects", + "DrawScreen", + "DrawInMiniMap", + + "SunChanged", + + "DrawUnit", + "DrawFeature", + "DrawShield", + "DrawProjectile", + + -- unsynced message callins + "RecvFromSynced", + "RecvSkirmishAIMessage", + + "DefaultCommand", + "CommandNotify", + + "ViewResize", -- FIXME ? + "LayoutButtons", + "ConfigureLayout", + + "AddConsoleLine", + "GroupChanged", + + -- moved from LuaUI + "KeyPress", + "KeyRelease", + "TextInput", + "MousePress", + "MouseRelease", + "MouseMove", + "MouseWheel", + + "IsAbove", + "GetTooltip", + + "WorldTooltip", -- FIXME: not implemented by base GH + "MapDrawCmd", + "ShockFront", -- FIXME: not implemented by base GH + + "DownloadQueued", + "DownloadStarted", + "DownloadFinished", + "DownloadFailed", + "DownloadProgress", +} + +for callinIdx, callinName in ipairs(CALLIN_LIST) do + CALLIN_MAP[callinName] = callinIdx +end -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file 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 352dd74f8..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,59 +863,59 @@ 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: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:Shutdown() - for _,g in r_ipairs(self.ShutdownList) do - g: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 return @@ -883,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 @@ -892,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 @@ -957,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 @@ -969,15 +1012,15 @@ end -- Game call-ins -- -function gadgetHandler:GameOver(winningAllyTeams) - for _,g in r_ipairs(self.GameOverList) do - g:GameOver(winningAllyTeams) +function gadgetHandler:GameOver(winners) + for _,g in ipairs(self.GameOverList) do + g:GameOver(winners) end return end function gadgetHandler:GameID(gameID) - for _,g in r_ipairs(self.GameIDList) do + for _,g in ipairs(self.GameIDList) do g:GameID(gameID) end return @@ -985,38 +1028,28 @@ end function gadgetHandler:TeamDied(teamID) - for _,g in r_ipairs(self.TeamDiedList) do + for _,g in ipairs(self.TeamDiedList) do g:TeamDied(teamID) end return end -function gadgetHandler:TeamChanged(teamID) - for _,g in r_ipairs(self.TeamChangedList) do - g:TeamChanged(teamID) +function gadgetHandler:PlayerAdded(playerID) + for _,g in ipairs(self.PlayerAddedList) do + g:PlayerAdded(playerID) end return end - function gadgetHandler:PlayerChanged(playerID) - for _,g in r_ipairs(self.PlayerChangedList) do + for _,g in ipairs(self.PlayerChangedList) do g:PlayerChanged(playerID) end return end - -function gadgetHandler:PlayerAdded(playerID) - for _,g in r_ipairs(self.PlayerAddedList) do - g:PlayerAdded(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 @@ -1029,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 @@ -1038,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 @@ -1047,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 @@ -1056,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 @@ -1065,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 @@ -1076,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 @@ -1089,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 @@ -1098,18 +1132,20 @@ function gadgetHandler:AllowCommand(unitID, unitDefID, unitTeam, return true end -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 +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 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 @@ -1119,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 @@ -1131,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 @@ -1140,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 @@ -1154,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 @@ -1164,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 @@ -1174,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 @@ -1185,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 @@ -1194,20 +1301,19 @@ function gadgetHandler:AllowDirectUnitControl(unitID, unitDefID, unitTeam, return true end - function gadgetHandler:AllowBuilderHoldFire(unitID, unitDefID, action) - for _,g in r_ipairs(self.AllowBuilderHoldFire) do - if (not 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 @@ -1218,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 @@ -1229,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 @@ -1276,33 +1394,57 @@ 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: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:UnitFromFactory( - unitID, unitDefID, unitTeam, - factID, factDefID, userOrders -) - for _,g in r_ipairs(self.UnitFromFactoryList) do +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 @@ -1310,22 +1452,19 @@ function gadgetHandler:UnitFromFactory( 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 @@ -1334,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 @@ -1342,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 + + 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 - for _,g in r_ipairs(self.UnitPreDamagedList) do - dmg, imp = g:UnitPreDamaged( - unitID, unitDefID, unitTeam, - retDamage, paralyzer, - weaponDefID, projectileID, - attackerID, attackerDefID, attackerTeam) + return rDam, rImp +end + +--[[ Old +function gadgetHandler:UnitPreDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer, weaponDefID, + projectileID, attackerID, attackerDefID, attackerTeam) - if (dmg ~= nil) then retDamage = dmg end - if (imp ~= nil) then retImpulse = imp end + 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 @@ -1432,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 @@ -1440,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 @@ -1448,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 @@ -1456,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 @@ -1464,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 @@ -1473,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 @@ -1483,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 @@ -1493,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 @@ -1502,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 @@ -1510,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 @@ -1518,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 @@ -1532,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 @@ -1546,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 @@ -1554,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 - -------------------------------------------------------------------------------- -- @@ -1613,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 @@ -1621,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 @@ -1633,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 @@ -1651,127 +1800,158 @@ end -- Misc call-ins -- +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) + 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 @@ -1779,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 @@ -1790,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 @@ -1800,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 @@ -1809,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 @@ -1861,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 @@ -1871,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 @@ -1881,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 @@ -1893,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: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 + +-- 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:DownloadStarted(id) - for _,g in r_ipairs(self.DownloadStartedList) do - g:DownloadStarted(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) + + 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 -function gadgetHandler:DownloadQueued(id) - for _,g in r_ipairs(self.DownloadQueuedList) do - g:DownloadQueued(id) + 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:DownloadFinished(id) - for _,g in r_ipairs(self.DownloadFinishedList) do - g:DownloadFinished(id) + +-- 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 -function gadgetHandler:DownloadFailed(id, errorid) - for _,g in r_ipairs(self.DownloadFailedList) do - g:DownloadFailed(id, errorid) +-- base +--[[ +function gadgetHandler:ViewResize(vsx, vsy) + for _,g in ipairs(self.ViewResizeList) do + g:ViewResize(vsx, vsy) end + return end -function gadgetHandler:DownloadProgress(id, downloaded, total) - for _,g in r_ipairs(self.DownloadProgressList) do - g:DownloadProgress(id, downloaded, total) +-- 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/EVO_HotkeyInfo.lua b/LuaUI/Configs/EVO_HotkeyInfo.lua new file mode 100644 index 000000000..a114cf065 --- /dev/null +++ b/LuaUI/Configs/EVO_HotkeyInfo.lua @@ -0,0 +1,109 @@ +General = { + {"Chat", title=true}, + {"enter", "Send chat message"}, + {"alt + enter", "Send chat message to allies"}, + {"shift + enter", "Send chat message to spectators"}, + {"ctrl + left click on name", "Ignore player"}, + {blankLine=true}, + {"Menus", title=true}, + {"shift + esc", "Quit menu"}, + {"f11", "Widget list"}, + {"ctrl + f11", "Widget teak mode"}, + {"h", "Share units / resources"}, + {blankLine=true}, + {"Camera movement", title=true}, + {"scrollwheel", "Zoom camera"}, + {"arrow keys / mouse at screen edge", "Move camera"}, + {"ctrl + scrollwheel", "Change camera angle"}, + {"middle click (+ drag)", "Drag camera"}, + {"ctrl + shift + o", "Flip camera"}, + {blankLine=true}, + {"Camera modes", title=true}, + {"ctrl + f1,2,3,4,5", "Change camera type"}, + {"alt + backspace", "Toggle fullscreen"}, + {"tab", "Toggle overview camera"}, + {"l", "Toggle LOS view"}, + {"f1", "Show height map"}, + {"f2", "Show passability (for selected unit)"}, + {"f3", "Cycle through map marks"}, + {"f4", "Show metal map"}, + {"f5", "Hide GUI"}, + {blankLine=true}, + {"Sound", title=true}, + {"-/+", "Change volume"}, + {"f6", "Toggle mute"}, +} + +Units_I_II = { + {"Selecting units", title=true}, + {"left mouse (+ drag)", "Select or deselect units"}, + {blankLine=true}, + {"Giving orders", title=true}, + {"right mouse (single click)", "Give order to unit(s)"}, + {"right mouse (drag)", "Give formation order to unit(s)"}, + {blankLine=true}, + {"Selecting orders", title=true}, + {"(none)", "default order (usually move)"}, + {"q", "Toggle Repeat"}, + {"m", "move"}, + {"a", "attack"}, + -- {"y", "set priority target"}, + {"r", "repair"}, + -- {"e", "reclaim"}, + -- {"o", "resurrect"}, + {"f", "fight"}, + {"p", "patrol"}, + {"k", "cloak"}, + {blankLine=true}, + {"s", "stop (clears order queue)"}, + {"w", "wait (pause current command)"}, + {"j", "cancel priority target"}, + {blankLine=true}, + {"d", "manual fire (dgun)"}, + {"ctrl + d", "self-destruct"}, + {blankLine=true}, + {"Giving selected orders", title=true}, + {"left mouse (single click)", "Give order to unit(s)"}, + {"right mouse (single click)", "Revert to default order"}, + {"right mouse + drag", "Give formation order to unit(s)"}, + {blankLine=true}, + {"Queueing orders", title=true}, + {"shift + (some order)", "Add order to end of order queue"}, + {"space + (some order)", "Add order to start of order queue"}, +} + + +Units_III = { + {"Selecting build orders", title=true}, + {"(mouse)", "Select from units build-menu"}, + -- {"z", "Cycle through mexes"}, + -- {"x", "Cycle through energy production"}, + -- {"c", "Cycle through radar/defence/etc"}, + -- {"v", "Cycle through factories"}, + {"[ and ]", "Change facing of buildings"}, + {blankLine=true}, + {"Giving build orders", title=true}, + {"left mouse", "Give build order"}, + {"right mouse", "De-select build order"}, + {"shift + (build order)", "Build in a line"}, + {"shift + alt + (build order)", "Build in a square"}, + {"b", "Increase build spacing"}, + {"n", "Decrease build spacing"}, + {blankLine=true}, + {"Group selection", title=true}, + {"ctrl + a", "Select all units"}, + {"ctrl + b", "Select all constructors"}, + {"ctrl + (num)", "Add units to group (num=1,2,..)"}, + {"(num)", "Select all units assigned to group (num)"}, + {"ctrl + z", "Select all units of same type as current"}, + {blankLine=true}, + {"Drawing", title=true}, + {"q + dbl click", "Place map mark"}, + {"q + drag left mouse", "Draw on map"}, + {"q + drag right mouse","Erase drawings and markers"}, + {blankLine=true}, + {"Console commands", title=true}, + {"/clearmapmarks", "Erase all drawings and markes"}, + {"/clock", "Toggle ingame clock"}, + {"/fps", "Toggle ingame fps indicator"}, +} diff --git a/LuaUI/Configs/LuaMex/options.lua b/LuaUI/Configs/LuaMex/options.lua new file mode 100644 index 000000000..948d0d75e --- /dev/null +++ b/LuaUI/Configs/LuaMex/options.lua @@ -0,0 +1,64 @@ +options = { + + drawincome = { + name = 'Should income be drawn below the mex spot?', + type = 'bool', + value = true, + tooltip = "When disabled, this will prevent income from being drawn below the mex spot.", + OnChange = function() updateMexDrawList() end + }, + drawcustomincomeamount = { + name = 'Draw a custom mex income amount under each spot instead of the automatically calculated one?', + type = 'bool', + value = false, + tooltip = "Enabled, this will allow you to draw a custom amount underneath each mex spot.", + OnChange = function() updateMexDrawList() end + }, + drawicons = { + name = 'Show Income as Icon', + type = 'bool', + value = false, + tooltip = "When enabled income is shown pictorially. When disabled income is shown as a number.", + OnChange = function() updateMexDrawList() end + }, + size = { + name = "Income Display Size", + type = "number", + value = 50, + min = 10, + max = 150, + step = 5, + OnChange = function() updateMexDrawList() end + }, + rounding = { + name = "Display digits", + type = "number", + value = 1, + min = 1, + max = 4, + advanced = true, + OnChange = function() updateMexDrawList() end + }, + multiplier = { + name = "Multiplier used for base mex value", + type = "number", + 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 + }, + customamount = { + name = "Custom amount to be drawn under each mex", + type = "number", + value = 0.5, + min = 0, + max = 100, + OnChange = function() updateMexDrawList() end + }, + specPlayerColours = { + name = "Use player colours when spectating", + type = "bool", + value = true, + OnChange = function() updateMexDrawList() end + } +} \ No newline at end of file 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 696280c03..eba7f9461 100644 --- a/LuaUI/Configs/lupsfxs.lua +++ b/LuaUI/Configs/lupsfxs.lua @@ -161,21 +161,129 @@ cafusBursts = { corjamtBursts = { layer = -35, life = math.huge, - piece = "sphere", - rotSpeed = 0.7, + piece = "base", + rotSpeed = 1, rotSpread = 0, arc = 50, arcSpread = 0, - size = 14, - sizeSpread = 10, + size = 200, + sizeSpread = 50, + texture = "bitmaps/GPL/Lups/shieldbursts5.png", + --colormap = { {1, 0.6, 1, 0.8} }, + colormap = { {0, 0, 1, 0.25} }, + directional= true, + repeatEffect = true, + count = 20, +} + +shieldBursts200 = { + layer = -35, + life = math.huge, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 200, + sizeSpread = 50, texture = "bitmaps/GPL/Lups/shieldbursts5.png", --colormap = { {1, 0.6, 1, 0.8} }, - colormap = { {1, 0.3, 1, 0.8} }, + colormap = { {1, 1, 1, 0.1} }, directional= true, repeatEffect = true, count = 20, } +shieldBursts300 = { + layer = -35, + life = math.huge, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 300, + 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 = 20, +} + +shieldBursts400 = { + layer = -35, + life = math.huge, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 400, + 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 = 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, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 1500, + 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, +} + +shieldBursts2000 = { + layer = -35, + life = math.huge, + piece = "base", + rotSpeed = 0.50, + rotSpread = 0, + arc = 50, + arcSpread = 0, + size = 2000, + 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, +} + ---------------------------------------------------------------------------- -- COLORSPHERES ------------------------------------------------------------ ---------------------------------------------------------------------------- @@ -192,10 +300,10 @@ cafusShieldSphere = { efusShieldSphere = { layer=-35, life=20, - pos={0,51,0}, - size=10, - colormap1 = { {0.9, 0.9, 1, 0.2},{0.9, 0.9, 1, 0.2},{0.9, 0.9, 1, 0.2},{0.9, 0.9, 1, 0.2} }, - colormap2 = { {0.2, 0.2, 1, 0.2},{0.2, 0.2, 1, 0.2},{0.2, 0.2, 1, 0.2},{0.2, 0.2, 1, 0.2} }, + pos={0,20,0}, + size=400, + colormap1 = { {0.9, 0.9, 1, 0.1},{0.9, 0.9, 1, 0.1},{0.9, 0.9, 1, 0.1},{0.9, 0.9, 1, 0.1} }, + colormap2 = { {0.2, 0.2, 1, 0.1},{0.2, 0.2, 1, 0.1},{0.2, 0.2, 1, 0.1},{0.2, 0.2, 1, 0.1} }, repeatEffect=true } @@ -209,6 +317,66 @@ corfusShieldSphere = { repeatEffect=true } +ShieldSphere200 = { + layer=-34, + life=20, + pos={0,20,0}, + size=200, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + repeatEffect=true +} + +ShieldSphere300 = { + layer=-34, + life=20, + pos={0,20,0}, + size=300, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + repeatEffect=true +} + +ShieldSphere400 = { + layer=-34, + life=20, + pos={0,20,0}, + size=400, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + 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, + pos={0,60,0}, + size=1500, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + repeatEffect=true +} + +ShieldSphere2000 = { + layer=-34, + life=20, + pos={0,60,0}, + size=2000, + colormap1 = { {0, 0, 1, 0.2} }, + colormap2 = { {0.2, 0.2, 1, 0.0} }, + repeatEffect=true +} + ---------------------------------------------------------------------------- -- LIGHT ------------------------------------------------------------------- ---------------------------------------------------------------------------- diff --git a/LuaUI/Configs/lupsunitfxs.lua b/LuaUI/Configs/lupsunitfxs.lua index 492f78cd3..4a0845921 100644 --- a/LuaUI/Configs/lupsunitfxs.lua +++ b/LuaUI/Configs/lupsunitfxs.lua @@ -1,6 +1,107 @@ effectUnitDefs = { +------------------ +------------------ + 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=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=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=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 = { + {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}}, + }, + + escout = { + {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 = { + {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}}, + }, + + 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=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 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine1", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine2", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine3", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine4", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine5", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine6", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine7", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine8", onActive=false, emitVector = {0, 0, 1}}}, + }, + + etransport = { + {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}}, + }, + +------------------ +------------------ + edrone_up1 = { + {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}}, + }, + + efighter_up1 = { {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}}, @@ -9,35 +110,125 @@ effectUnitDefs = { {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=25, piece="rengine2", onActive=true}}, }, - egunship2 = { + egunship2_up1 = { {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}}, }, - ebomber = { + ebomber_up1 = { {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}}, }, - eairengineer = { + escout_up1 = { + {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}}, + }, + + eraider_up1 = { + {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}}, + }, + + ekrow_up1 = { + {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}}}, + }, + + etransport_up1 = { + {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}}, + }, + + eairplant_up1 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine1", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine2", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine3", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine4", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine5", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine6", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine7", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine8", onActive=false, emitVector = {0, 0, 1}}}, + }, + +------------------ +------------------ + edrone_up2 = { + {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}}, + }, + + efighter_up2 = { {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}}, }, - escout = { + egunship2_up2 = { + {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}}, + }, + + ebomber_up2 = { + {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}}, + }, + + escout_up2 = { {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}}, }, - etransport = { + eraider_up2 = { + {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}}, + }, + + ekrow_up2 = { + {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}}}, + }, + + etransport_up2 = { {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}}, @@ -48,29 +239,233 @@ effectUnitDefs = { {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=40, piece="bengine4", onActive=true}}, }, - esubplane = { - {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="engines", onActive=true}}, + eairplant_up2 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine1", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine2", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine3", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine4", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine5", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine6", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine7", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine8", onActive=false, emitVector = {0, 0, 1}}}, }, - - edrone = { + +------------------ +------------------ + edrone_up3 = { {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}}, }, --- eairplant = { --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine1", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine2", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine3", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine4", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine5", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine6", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine7", onActive=false}}, --- {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 8, length=80, piece="engine8", onActive=false}}, --- }, - - esolar2 = { + efighter_up3 = { + {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}}, + }, + + egunship2_up3 = { + {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}}, + }, + + ebomber_up3 = { + {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}}, + }, + + escout_up3 = { + {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}}, + }, + + eraider_up3 = { + {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}}, + }, + + ekrow_up3 = { + {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}}}, + }, + + etransport_up3 = { + {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}}, + }, + + eairplant_up3 = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine1", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine2", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine3", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine4", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine5", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine6", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine7", onActive=false, emitVector = {0, 0, 1}}}, + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 16, length=60, piece="engine8", onActive=false, emitVector = {0, 0, 1}}}, + }, + +------------------ +------------------ + + esubplane = { + {class='AirJet', options={color={1,0.5,0.0,0.75}, width = 4, length=35, piece="engines", onActive=true}}, + }, + +------------------ +------------------ + + ehbotengineer = { + {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 = { + {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 = { + {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 = { + {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 = { + {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}}}, + }, + +------------------ +------------------ + +-- esolar2 = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -78,8 +473,8 @@ effectUnitDefs = { -- {class='Bursts', options=esolarBursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,32,0}, size=10, precision=22, strength = 0.02, repeatEffect=true}}, - }, - emetalextractor = { +-- }, +-- emetalextractor = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -87,8 +482,8 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,55,0}, size=10, precision=22, strength = 0.015, repeatEffect=true}}, - }, - euwmetalextractor = { +-- }, +-- euwmetalextractor = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -96,8 +491,8 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,25,0}, size=15, precision=22, strength = 0.015, repeatEffect=true}}, - }, - egeothermal = { +-- }, +-- egeothermal = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -105,8 +500,8 @@ effectUnitDefs = { -- {class='Bursts', options=egeoBursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,26,0.0}, size=10, precision=22, strength = 0.02, repeatEffect=true}}, - }, - efusion2 = { +-- }, +-- efusion2 = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -117,9 +512,9 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,51,0.0}, size=23, precision=22, strength = 0.02, repeatEffect=true}}, - }, +-- }, - burrow = { +-- burrow = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -130,9 +525,9 @@ effectUnitDefs = { -- {class='Bursts', options=burrowBursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,51,0.0}, size=23, precision=22, strength = 0.02, repeatEffect=true}}, - }, +-- }, - eminifac = { +-- eminifac = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -140,8 +535,8 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,25,110}, size=75, precision=22, strength = 0.015, repeatEffect=true}}, - }, - ebasefactory = { +-- }, +-- ebasefactory = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -149,8 +544,8 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={20,25,10}, size=55, precision=22, strength = 0.015, repeatEffect=true}}, - }, - eamphibfac = { +-- }, +-- eamphibfac = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -158,8 +553,8 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,25,85}, size=60, precision=22, strength = 0.015, repeatEffect=true}}, - }, - eairplant = { +-- }, +-- eairplant = { -- {class='StaticParticles', options=corfusNova}, -- {class='StaticParticles', options=corfusNova2}, -- {class='StaticParticles', options=corfusNova3}, @@ -167,36 +562,119 @@ effectUnitDefs = { -- {class='Bursts', options=efusion2Bursts}, -- {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,280,30}, size=55, precision=22, strength = 0.015, repeatEffect=true}}, +-- }, + +-- eexperimentalfac = { +-- {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,50,0}, size=140, precision=22, strength = 0.015, repeatEffect=true}}, +-- }, + +-- eshieldgen = { +-- {class='ShieldSphere',options=ShieldSphere2000}, +-- {class='Bursts',options=shieldBursts2000}, +-- {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,60,0.0}, size=2005, precision=0, strength = 0.001, repeatEffect=true}}, +-- }, + + eantinukeai = { + --{class='ShieldSphere',options=ShieldSphere2000}, + {class='Bursts',options=shieldBursts2000}, +-- {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,60,0.0}, size=2005, precision=0, strength = 0.001, repeatEffect=true}}, }, +------------------ +------------------ + + eallterrshield = { + --{class='ShieldSphere',options=ShieldSphere300}, +-- {class='Bursts',options=shieldBursts200}, +-- {class='StaticParticles', options=corfusNova}, +-- {class='StaticParticles', options=corfusNova2}, +-- {class='StaticParticles', options=corfusNova3}, +-- {class='StaticParticles', options=corfusNova4}, - eexperimentalfac = { +-- {class='Bursts', options=efusion2Bursts}, + {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=305, precision=0, strength = 0.001, repeatEffect=true}}, + }, + + eallterrshield_up1 = { + --{class='ShieldSphere',options=ShieldSphere300}, + --{class='Bursts',options=shieldBursts300}, -- {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,50,0}, size=140, precision=22, strength = 0.015, repeatEffect=true}}, + {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=305, precision=0, strength = 0.001, repeatEffect=true}}, }, - eshieldgen = { + + eallterrshield_up2 = { + --{class='ShieldSphere',options=ShieldSphere300}, +-- {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,60,0.0}, size=1500, precision=0, strength = 0.0025, repeatEffect=true}}, + {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=305, precision=0, strength = 0.001, repeatEffect=true}}, }, - eallterrshield = { + + eallterrshield_up3 = { + --{class='ShieldSphere',options=ShieldSphere300}, +-- {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=305, precision=0, strength = 0.001, repeatEffect=true}}, + }, + +------------------ +------------------ + + ekmar = { + --{class='ShieldSphere',options=ShieldSphere400}, +-- {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=1005, precision=0, strength = 0.001, repeatEffect=true}}, + }, + + ecommandershield = { + --{class='ShieldSphere',options=ShieldSphere400}, +-- {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,60,0.0}, size=300, precision=0, strength = 0.0025, repeatEffect=true}}, + {class='ShieldJitter', options={delay=0,life=math.huge, pos={0,20,0.0}, size=405, precision=0, strength = 0.001, repeatEffect=true}}, }, 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 ec60feb6f..000000000 --- a/LuaUI/Fonts/FreeSansBold_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/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/Skrawl_40.lua b/LuaUI/Fonts/Skrawl_40.lua index 6f8158554..66ea6b05d 100644 --- a/LuaUI/Fonts/Skrawl_40.lua +++ b/LuaUI/Fonts/Skrawl_40.lua @@ -1,4 +1,3 @@ --- $Id: Skrawl_40.lua 3171 2008-11-06 09:06:29Z det $ local fontSpecs = { srcFile = [[Skrawl.ttf]], diff --git a/LuaUI/Fonts/VISITOR.FON b/LuaUI/Fonts/VISITOR.FON new file mode 100644 index 000000000..31e4c5ba8 Binary files /dev/null and b/LuaUI/Fonts/VISITOR.FON 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/Fonts/visitor.txt b/LuaUI/Fonts/visitor.txt new file mode 100644 index 000000000..08f1239f0 --- /dev/null +++ b/LuaUI/Fonts/visitor.txt @@ -0,0 +1,86 @@ +______________________________ +Visitor Created by Brian Kent +¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ + +Thanks for Downloading Visitor. + +-Visitor TT1 [.ttf] +-Visitor TT2 [.ttf] +-Visitor [7pt] [.fon] + + 'Visitor.fon' is a Windows Bitmap Font (.fon). This font is best +used at 7pt. To use it at larger point sizes (for images), try using +a graphics program like Photo Shop, Paint Shop Pro, or the Paint +program that comes with Windows. Type out your text at the recommended +point size [7pt], then resize the image. Set the color mode to 256 +or 2 colors so the edges don't get blured when resizing, then after you +have the text to the size that you want, then change back to a higher +color mode and edit the image. + + For programs that don't show Bitmap Fonts in the Font Selector, you +may be able to get the font to work by typing in: +visitor -brk- + + The TTF versions were created different ways. TT1 was created from +within FontLab and TT2 was created in Illustrator then imported into +FontLab. I didn't know which one to include so I just included both. + + +If you have any questions or comments, you can e-mail me at +kentpw@norwich.net + +You can visit my Homepage <ÆNIGMA GAMES & FONTS> at +http://www.aenigmafonts.com/ + +____________ +!!! NOTE !!! +¯¯¯¯¯¯¯¯¯¯¯¯ +This font has been updated! I've edited the (BRK) in the font name +to just BRK. It seems that Adobe Illustrator and web pages with CSS +don't like fonts with ( and ) in their name. + +________________ +INSTALLING FONTS +¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ + There's a couple of ways to install Fonts. The 'easy' way to +install fonts is to just Unzip/place the font file(s) into your +Windows\Fonts directory (I always use this method). If you're unable +to do it the 'easy' way, then try to do it this way (for Windows +95/98/NT): + +1] Unzip the Font(s) to a folder (or somewhere, just remember where +you unzipped it) on your Computer. + +2] Next, click on the START button, then select SETTINGS then +CONTROL PANEL. + +3] When the Control Panel Window pops up, Double Click on FONTS. + +4] When the FONTS window pops up, select File then Install New Font... + +5] A Add Fonts window will pop up, just go to the folder that you +unzipped the Font(s) to, select the Font(s) and then click on OK. +Now the Font(s) are installed. + + Now you can use the Font(s) in programs the utilize Fonts. Make +sure that you install the font(s) first, then open up your apps +(so the app will recognize the font). Sometimes you'll have to +wait until you computer 'auto-refreshes' for programs to recognize +fonts (Windows is sometimes slow to do that). You can refresh your +computer quicker by going into Windows Explorer -or- My Computer and +press F5 (or in the menubar select VIEW then REFRESH). + + +__________ +DISCLAIMER +¯¯¯¯¯¯¯¯¯¯ +-The font(s) in this zip file were created by me (Brian Kent). All +of my Fonts are Freeware, you can use them any way you want to +(Personal use, Commercial use, or whatever). + +-If you have a Font related site and would like to offer my fonts on +your site, go right ahead. All I ask is that you keep this text file +intact with the Font. + +-You may not Sell or Distribute my Fonts for profit or alter them in +any way without asking me first. [e-mail - kentpw@norwich.net] \ No newline at end of file diff --git a/LuaUI/Fonts/visitor1.ttf b/LuaUI/Fonts/visitor1.ttf new file mode 100644 index 000000000..04ce123d4 Binary files /dev/null and b/LuaUI/Fonts/visitor1.ttf differ diff --git a/LuaUI/Fonts/visitor2.ttf b/LuaUI/Fonts/visitor2.ttf new file mode 100644 index 000000000..870130d76 Binary files /dev/null and b/LuaUI/Fonts/visitor2.ttf differ 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/Ranks/rank0.dds b/LuaUI/Images/advplayerslist/Ranks/rank0.dds new file mode 100644 index 000000000..8f28a2037 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank0.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank1.dds b/LuaUI/Images/advplayerslist/Ranks/rank1.dds new file mode 100644 index 000000000..881380b94 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank1.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank2.dds b/LuaUI/Images/advplayerslist/Ranks/rank2.dds new file mode 100644 index 000000000..267754675 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank2.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank3.dds b/LuaUI/Images/advplayerslist/Ranks/rank3.dds new file mode 100644 index 000000000..f284805f3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank3.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank4.dds b/LuaUI/Images/advplayerslist/Ranks/rank4.dds new file mode 100644 index 000000000..d2983ec8e Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank4.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank5.dds b/LuaUI/Images/advplayerslist/Ranks/rank5.dds new file mode 100644 index 000000000..7f3e34ab1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank5.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank6.dds b/LuaUI/Images/advplayerslist/Ranks/rank6.dds new file mode 100644 index 000000000..6460fa30f Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank6.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank7.dds b/LuaUI/Images/advplayerslist/Ranks/rank7.dds new file mode 100644 index 000000000..d9502a817 Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank7.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/rank_unknown.dds b/LuaUI/Images/advplayerslist/Ranks/rank_unknown.dds new file mode 100644 index 000000000..4478d266b Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/rank_unknown.dds differ diff --git a/LuaUI/Images/advplayerslist/Ranks/star.dds b/LuaUI/Images/advplayerslist/Ranks/star.dds new file mode 100644 index 000000000..ced6150db Binary files /dev/null and b/LuaUI/Images/advplayerslist/Ranks/star.dds differ diff --git a/LuaUI/Images/advplayerslist/ally.dds b/LuaUI/Images/advplayerslist/ally.dds new file mode 100644 index 000000000..ec815d53e Binary files /dev/null and b/LuaUI/Images/advplayerslist/ally.dds differ diff --git a/LuaUI/Images/advplayerslist/arm_default.png b/LuaUI/Images/advplayerslist/arm_default.png index 08130ae93..60b652f57 100644 Binary files a/LuaUI/Images/advplayerslist/arm_default.png and b/LuaUI/Images/advplayerslist/arm_default.png differ diff --git a/LuaUI/Images/advplayerslist/arrow.dds b/LuaUI/Images/advplayerslist/arrow.dds new file mode 100644 index 000000000..593846c53 Binary files /dev/null and b/LuaUI/Images/advplayerslist/arrow.dds differ diff --git a/LuaUI/Images/advplayerslist/arrowd.png b/LuaUI/Images/advplayerslist/arrowd.png index 4eb050338..7e1c5052c 100644 Binary files a/LuaUI/Images/advplayerslist/arrowd.png and b/LuaUI/Images/advplayerslist/arrowd.png differ diff --git a/LuaUI/Images/advplayerslist/barglow-center.dds b/LuaUI/Images/advplayerslist/barglow-center.dds new file mode 100644 index 000000000..11be8460e Binary files /dev/null and b/LuaUI/Images/advplayerslist/barglow-center.dds 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.dds b/LuaUI/Images/advplayerslist/barglow-edge.dds new file mode 100644 index 000000000..3e3e961f2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/barglow-edge.dds 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/advplayerslist/blob_small.png b/LuaUI/Images/advplayerslist/blob_small.png new file mode 100644 index 000000000..1fc691c57 Binary files /dev/null and b/LuaUI/Images/advplayerslist/blob_small.png differ diff --git a/LuaUI/Images/advplayerslist/camera.dds b/LuaUI/Images/advplayerslist/camera.dds new file mode 100644 index 000000000..6fad65adb Binary files /dev/null and b/LuaUI/Images/advplayerslist/camera.dds differ diff --git a/LuaUI/Images/advplayerslist/chat.dds b/LuaUI/Images/advplayerslist/chat.dds new file mode 100644 index 000000000..987ddd620 Binary files /dev/null and b/LuaUI/Images/advplayerslist/chat.dds differ diff --git a/LuaUI/Images/advplayerslist/chip.dds b/LuaUI/Images/advplayerslist/chip.dds new file mode 100644 index 000000000..91712901a Binary files /dev/null and b/LuaUI/Images/advplayerslist/chip.dds differ diff --git a/LuaUI/Images/advplayerslist/core_default.png b/LuaUI/Images/advplayerslist/core_default.png index 1207a4d8e..7b6ba56d6 100644 Binary files a/LuaUI/Images/advplayerslist/core_default.png and b/LuaUI/Images/advplayerslist/core_default.png differ diff --git a/LuaUI/Images/advplayerslist/country.dds b/LuaUI/Images/advplayerslist/country.dds new file mode 100644 index 000000000..1658fa2e3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/country.dds differ diff --git a/LuaUI/Images/advplayerslist/cpu.dds b/LuaUI/Images/advplayerslist/cpu.dds new file mode 100644 index 000000000..496938c6f Binary files /dev/null and b/LuaUI/Images/advplayerslist/cpu.dds differ diff --git a/LuaUI/Images/advplayerslist/cpuping.dds b/LuaUI/Images/advplayerslist/cpuping.dds new file mode 100644 index 000000000..496938c6f Binary files /dev/null and b/LuaUI/Images/advplayerslist/cpuping.dds differ diff --git a/LuaUI/Images/advplayerslist/cross.dds b/LuaUI/Images/advplayerslist/cross.dds new file mode 100644 index 000000000..3ce1be6db Binary files /dev/null and b/LuaUI/Images/advplayerslist/cross.dds differ diff --git a/LuaUI/Images/advplayerslist/draw.dds b/LuaUI/Images/advplayerslist/draw.dds new file mode 100644 index 000000000..b7155dc2c Binary files /dev/null and b/LuaUI/Images/advplayerslist/draw.dds differ diff --git a/LuaUI/Images/advplayerslist/energy.dds b/LuaUI/Images/advplayerslist/energy.dds new file mode 100644 index 000000000..1db1084f8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/energy.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ad.dds b/LuaUI/Images/advplayerslist/flags/ad.dds new file mode 100644 index 000000000..63ca92334 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ad.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ae.dds b/LuaUI/Images/advplayerslist/flags/ae.dds new file mode 100644 index 000000000..1b7ad4535 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ae.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/af.dds b/LuaUI/Images/advplayerslist/flags/af.dds new file mode 100644 index 000000000..9e2ef2387 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/af.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ag.dds b/LuaUI/Images/advplayerslist/flags/ag.dds new file mode 100644 index 000000000..4875d8bc0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ag.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ai.dds b/LuaUI/Images/advplayerslist/flags/ai.dds new file mode 100644 index 000000000..cbee4f083 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ai.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/al.dds b/LuaUI/Images/advplayerslist/flags/al.dds new file mode 100644 index 000000000..f0f1e300c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/al.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/am.dds b/LuaUI/Images/advplayerslist/flags/am.dds new file mode 100644 index 000000000..e0f5603fe Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/am.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/an.dds b/LuaUI/Images/advplayerslist/flags/an.dds new file mode 100644 index 000000000..189f429ab Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/an.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ao.dds b/LuaUI/Images/advplayerslist/flags/ao.dds new file mode 100644 index 000000000..2bc7a7eee Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ao.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ar.dds b/LuaUI/Images/advplayerslist/flags/ar.dds new file mode 100644 index 000000000..300eee6eb Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ar.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/as.dds b/LuaUI/Images/advplayerslist/flags/as.dds new file mode 100644 index 000000000..eb6468610 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/as.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/at.dds b/LuaUI/Images/advplayerslist/flags/at.dds new file mode 100644 index 000000000..909d1d031 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/at.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/au.dds b/LuaUI/Images/advplayerslist/flags/au.dds new file mode 100644 index 000000000..bd1ed03a0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/au.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/aw.dds b/LuaUI/Images/advplayerslist/flags/aw.dds new file mode 100644 index 000000000..825676dc8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/aw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ax.dds b/LuaUI/Images/advplayerslist/flags/ax.dds new file mode 100644 index 000000000..ed8f14b0b Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ax.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/az.dds b/LuaUI/Images/advplayerslist/flags/az.dds new file mode 100644 index 000000000..b1b6190ad Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/az.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ba.dds b/LuaUI/Images/advplayerslist/flags/ba.dds new file mode 100644 index 000000000..9a748cbf8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ba.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bb.dds b/LuaUI/Images/advplayerslist/flags/bb.dds new file mode 100644 index 000000000..aadbc56c2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bb.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bd.dds b/LuaUI/Images/advplayerslist/flags/bd.dds new file mode 100644 index 000000000..cf699324d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bd.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/be.dds b/LuaUI/Images/advplayerslist/flags/be.dds new file mode 100644 index 000000000..f61f6c085 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/be.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bf.dds b/LuaUI/Images/advplayerslist/flags/bf.dds new file mode 100644 index 000000000..fac5c031e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bg.dds b/LuaUI/Images/advplayerslist/flags/bg.dds new file mode 100644 index 000000000..9cb22202a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bh.dds b/LuaUI/Images/advplayerslist/flags/bh.dds new file mode 100644 index 000000000..e1fe7a536 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bi.dds b/LuaUI/Images/advplayerslist/flags/bi.dds new file mode 100644 index 000000000..86094b103 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bi.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bj.dds b/LuaUI/Images/advplayerslist/flags/bj.dds new file mode 100644 index 000000000..7d3a244e5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bj.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bm.dds b/LuaUI/Images/advplayerslist/flags/bm.dds new file mode 100644 index 000000000..80c105697 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bn.dds b/LuaUI/Images/advplayerslist/flags/bn.dds new file mode 100644 index 000000000..672843e9d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bo.dds b/LuaUI/Images/advplayerslist/flags/bo.dds new file mode 100644 index 000000000..db6fbe6fb Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bo.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/br.dds b/LuaUI/Images/advplayerslist/flags/br.dds new file mode 100644 index 000000000..c375709b2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/br.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bs.dds b/LuaUI/Images/advplayerslist/flags/bs.dds new file mode 100644 index 000000000..9b6e6e2d2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bs.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bt.dds b/LuaUI/Images/advplayerslist/flags/bt.dds new file mode 100644 index 000000000..9b895fd2e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bv.dds b/LuaUI/Images/advplayerslist/flags/bv.dds new file mode 100644 index 000000000..bf79db2a5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bw.dds b/LuaUI/Images/advplayerslist/flags/bw.dds new file mode 100644 index 000000000..0bc496d6a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/by.dds b/LuaUI/Images/advplayerslist/flags/by.dds new file mode 100644 index 000000000..27a4746f9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/by.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/bz.dds b/LuaUI/Images/advplayerslist/flags/bz.dds new file mode 100644 index 000000000..cf33b2ee0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/bz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ca.dds b/LuaUI/Images/advplayerslist/flags/ca.dds new file mode 100644 index 000000000..7a8685d33 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ca.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/catalonia.dds b/LuaUI/Images/advplayerslist/flags/catalonia.dds new file mode 100644 index 000000000..0c1f17ced Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/catalonia.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cc.dds b/LuaUI/Images/advplayerslist/flags/cc.dds new file mode 100644 index 000000000..cd211156c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cd.dds b/LuaUI/Images/advplayerslist/flags/cd.dds new file mode 100644 index 000000000..6ce5e2531 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cd.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cf.dds b/LuaUI/Images/advplayerslist/flags/cf.dds new file mode 100644 index 000000000..a3b419523 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cg.dds b/LuaUI/Images/advplayerslist/flags/cg.dds new file mode 100644 index 000000000..8a30fac96 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ch.dds b/LuaUI/Images/advplayerslist/flags/ch.dds new file mode 100644 index 000000000..9924f3de3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ch.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ci.dds b/LuaUI/Images/advplayerslist/flags/ci.dds new file mode 100644 index 000000000..6b13e2c08 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ci.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ck.dds b/LuaUI/Images/advplayerslist/flags/ck.dds new file mode 100644 index 000000000..6eb138189 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ck.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cl.dds b/LuaUI/Images/advplayerslist/flags/cl.dds new file mode 100644 index 000000000..3202e5f19 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cm.dds b/LuaUI/Images/advplayerslist/flags/cm.dds new file mode 100644 index 000000000..760b70594 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cn.dds b/LuaUI/Images/advplayerslist/flags/cn.dds new file mode 100644 index 000000000..70a1222c5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/co.dds b/LuaUI/Images/advplayerslist/flags/co.dds new file mode 100644 index 000000000..e7420e64d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/co.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cr.dds b/LuaUI/Images/advplayerslist/flags/cr.dds new file mode 100644 index 000000000..9cb4d5dd4 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cs.dds b/LuaUI/Images/advplayerslist/flags/cs.dds new file mode 100644 index 000000000..7fc81db03 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cs.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cu.dds b/LuaUI/Images/advplayerslist/flags/cu.dds new file mode 100644 index 000000000..63ce00563 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cv.dds b/LuaUI/Images/advplayerslist/flags/cv.dds new file mode 100644 index 000000000..097a72c07 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cx.dds b/LuaUI/Images/advplayerslist/flags/cx.dds new file mode 100644 index 000000000..e25446ad8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cx.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cy.dds b/LuaUI/Images/advplayerslist/flags/cy.dds new file mode 100644 index 000000000..6707c28b8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cy.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/cz.dds b/LuaUI/Images/advplayerslist/flags/cz.dds new file mode 100644 index 000000000..0c7ae81a9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/cz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/de.dds b/LuaUI/Images/advplayerslist/flags/de.dds new file mode 100644 index 000000000..238aa263e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/de.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/dj.dds b/LuaUI/Images/advplayerslist/flags/dj.dds new file mode 100644 index 000000000..d735ddaf8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/dj.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/dk.dds b/LuaUI/Images/advplayerslist/flags/dk.dds new file mode 100644 index 000000000..3bcfedfd5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/dk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/dm.dds b/LuaUI/Images/advplayerslist/flags/dm.dds new file mode 100644 index 000000000..bc5e5641c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/dm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/do.dds b/LuaUI/Images/advplayerslist/flags/do.dds new file mode 100644 index 000000000..e9a4522a1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/do.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/dz.dds b/LuaUI/Images/advplayerslist/flags/dz.dds new file mode 100644 index 000000000..e61564dfc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/dz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ec.dds b/LuaUI/Images/advplayerslist/flags/ec.dds new file mode 100644 index 000000000..76794903f Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ec.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ee.dds b/LuaUI/Images/advplayerslist/flags/ee.dds new file mode 100644 index 000000000..40a62a5eb Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ee.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/eg.dds b/LuaUI/Images/advplayerslist/flags/eg.dds new file mode 100644 index 000000000..cdf46fc48 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/eg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/eh.dds b/LuaUI/Images/advplayerslist/flags/eh.dds new file mode 100644 index 000000000..c675e66aa Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/eh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/england.dds b/LuaUI/Images/advplayerslist/flags/england.dds new file mode 100644 index 000000000..7b4a37fee Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/england.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/er.dds b/LuaUI/Images/advplayerslist/flags/er.dds new file mode 100644 index 000000000..462a67bc6 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/er.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/es.dds b/LuaUI/Images/advplayerslist/flags/es.dds new file mode 100644 index 000000000..1f3c704a2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/es.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/et.dds b/LuaUI/Images/advplayerslist/flags/et.dds new file mode 100644 index 000000000..1d3324071 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/et.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/europeanunion.dds b/LuaUI/Images/advplayerslist/flags/europeanunion.dds new file mode 100644 index 000000000..074c16b30 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/europeanunion.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fam.dds b/LuaUI/Images/advplayerslist/flags/fam.dds new file mode 100644 index 000000000..9d355e30b Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fam.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fi.dds b/LuaUI/Images/advplayerslist/flags/fi.dds new file mode 100644 index 000000000..79d2a4f16 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fi.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fj.dds b/LuaUI/Images/advplayerslist/flags/fj.dds new file mode 100644 index 000000000..cea0d1bcc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fj.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fk.dds b/LuaUI/Images/advplayerslist/flags/fk.dds new file mode 100644 index 000000000..cdacbadcf Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fm.dds b/LuaUI/Images/advplayerslist/flags/fm.dds new file mode 100644 index 000000000..24fe9ef23 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fo.dds b/LuaUI/Images/advplayerslist/flags/fo.dds new file mode 100644 index 000000000..92155f850 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fo.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/fr.dds b/LuaUI/Images/advplayerslist/flags/fr.dds new file mode 100644 index 000000000..bfd13b7a8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/fr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ga.dds b/LuaUI/Images/advplayerslist/flags/ga.dds new file mode 100644 index 000000000..1b4514e66 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ga.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gb.dds b/LuaUI/Images/advplayerslist/flags/gb.dds new file mode 100644 index 000000000..5a67ae9f4 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gb.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gd.dds b/LuaUI/Images/advplayerslist/flags/gd.dds new file mode 100644 index 000000000..2f4803c12 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gd.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ge.dds b/LuaUI/Images/advplayerslist/flags/ge.dds new file mode 100644 index 000000000..60e869cbd Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ge.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gf.dds b/LuaUI/Images/advplayerslist/flags/gf.dds new file mode 100644 index 000000000..bfd13b7a8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gh.dds b/LuaUI/Images/advplayerslist/flags/gh.dds new file mode 100644 index 000000000..ad8ed5839 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gi.dds b/LuaUI/Images/advplayerslist/flags/gi.dds new file mode 100644 index 000000000..40d7c222a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gi.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gl.dds b/LuaUI/Images/advplayerslist/flags/gl.dds new file mode 100644 index 000000000..e52b3d31b Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gm.dds b/LuaUI/Images/advplayerslist/flags/gm.dds new file mode 100644 index 000000000..39a59ee1e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gn.dds b/LuaUI/Images/advplayerslist/flags/gn.dds new file mode 100644 index 000000000..673c340ec Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gp.dds b/LuaUI/Images/advplayerslist/flags/gp.dds new file mode 100644 index 000000000..23a3cba10 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gp.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gq.dds b/LuaUI/Images/advplayerslist/flags/gq.dds new file mode 100644 index 000000000..c53f1d9e3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gq.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gr.dds b/LuaUI/Images/advplayerslist/flags/gr.dds new file mode 100644 index 000000000..0204c21f1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gs.dds b/LuaUI/Images/advplayerslist/flags/gs.dds new file mode 100644 index 000000000..fe5b6a268 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gs.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gt.dds b/LuaUI/Images/advplayerslist/flags/gt.dds new file mode 100644 index 000000000..ca4bfaac0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gu.dds b/LuaUI/Images/advplayerslist/flags/gu.dds new file mode 100644 index 000000000..781506968 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gw.dds b/LuaUI/Images/advplayerslist/flags/gw.dds new file mode 100644 index 000000000..295ee727e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/gy.dds b/LuaUI/Images/advplayerslist/flags/gy.dds new file mode 100644 index 000000000..702dc9a96 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/gy.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/hk.dds b/LuaUI/Images/advplayerslist/flags/hk.dds new file mode 100644 index 000000000..8f1d27013 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/hk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/hm.dds b/LuaUI/Images/advplayerslist/flags/hm.dds new file mode 100644 index 000000000..bd1ed03a0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/hm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/hn.dds b/LuaUI/Images/advplayerslist/flags/hn.dds new file mode 100644 index 000000000..28ed01269 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/hn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/hr.dds b/LuaUI/Images/advplayerslist/flags/hr.dds new file mode 100644 index 000000000..120ab4d46 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/hr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ht.dds b/LuaUI/Images/advplayerslist/flags/ht.dds new file mode 100644 index 000000000..43e33b044 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ht.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/hu.dds b/LuaUI/Images/advplayerslist/flags/hu.dds new file mode 100644 index 000000000..c52c43802 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/hu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/id.dds b/LuaUI/Images/advplayerslist/flags/id.dds new file mode 100644 index 000000000..f7725ab24 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/id.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ie.dds b/LuaUI/Images/advplayerslist/flags/ie.dds new file mode 100644 index 000000000..a01ec995d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ie.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/il.dds b/LuaUI/Images/advplayerslist/flags/il.dds new file mode 100644 index 000000000..d5f71ad97 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/il.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/in.dds b/LuaUI/Images/advplayerslist/flags/in.dds new file mode 100644 index 000000000..d1c3a4188 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/in.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/io.dds b/LuaUI/Images/advplayerslist/flags/io.dds new file mode 100644 index 000000000..32bd3c10b Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/io.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/iq.dds b/LuaUI/Images/advplayerslist/flags/iq.dds new file mode 100644 index 000000000..47202df0f Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/iq.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ir.dds b/LuaUI/Images/advplayerslist/flags/ir.dds new file mode 100644 index 000000000..6fefff1e1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ir.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/is.dds b/LuaUI/Images/advplayerslist/flags/is.dds new file mode 100644 index 000000000..e72686d68 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/is.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/it.dds b/LuaUI/Images/advplayerslist/flags/it.dds new file mode 100644 index 000000000..02fd1eabb Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/it.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/jm.dds b/LuaUI/Images/advplayerslist/flags/jm.dds new file mode 100644 index 000000000..da4790460 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/jm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/jo.dds b/LuaUI/Images/advplayerslist/flags/jo.dds new file mode 100644 index 000000000..a300495b9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/jo.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/jp.dds b/LuaUI/Images/advplayerslist/flags/jp.dds new file mode 100644 index 000000000..0cc2d4623 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/jp.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ke.dds b/LuaUI/Images/advplayerslist/flags/ke.dds new file mode 100644 index 000000000..022ab6700 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ke.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kg.dds b/LuaUI/Images/advplayerslist/flags/kg.dds new file mode 100644 index 000000000..2c3566679 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kh.dds b/LuaUI/Images/advplayerslist/flags/kh.dds new file mode 100644 index 000000000..10858f467 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ki.dds b/LuaUI/Images/advplayerslist/flags/ki.dds new file mode 100644 index 000000000..532e0afb5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ki.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/km.dds b/LuaUI/Images/advplayerslist/flags/km.dds new file mode 100644 index 000000000..dc5e37640 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/km.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kn.dds b/LuaUI/Images/advplayerslist/flags/kn.dds new file mode 100644 index 000000000..7a6236926 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kp.dds b/LuaUI/Images/advplayerslist/flags/kp.dds new file mode 100644 index 000000000..e9aeb47cc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kp.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kr.dds b/LuaUI/Images/advplayerslist/flags/kr.dds new file mode 100644 index 000000000..6390aaad1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kw.dds b/LuaUI/Images/advplayerslist/flags/kw.dds new file mode 100644 index 000000000..cc7929c64 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ky.dds b/LuaUI/Images/advplayerslist/flags/ky.dds new file mode 100644 index 000000000..6f87e1074 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ky.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/kz.dds b/LuaUI/Images/advplayerslist/flags/kz.dds new file mode 100644 index 000000000..99594c944 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/kz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/la.dds b/LuaUI/Images/advplayerslist/flags/la.dds new file mode 100644 index 000000000..dddb164c5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/la.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lb.dds b/LuaUI/Images/advplayerslist/flags/lb.dds new file mode 100644 index 000000000..5a258fc6d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lb.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lc.dds b/LuaUI/Images/advplayerslist/flags/lc.dds new file mode 100644 index 000000000..3e14c63c1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/li.dds b/LuaUI/Images/advplayerslist/flags/li.dds new file mode 100644 index 000000000..83db22b74 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/li.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lk.dds b/LuaUI/Images/advplayerslist/flags/lk.dds new file mode 100644 index 000000000..06f232fd6 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lr.dds b/LuaUI/Images/advplayerslist/flags/lr.dds new file mode 100644 index 000000000..ce3d0ced2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ls.dds b/LuaUI/Images/advplayerslist/flags/ls.dds new file mode 100644 index 000000000..36f70915c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ls.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lt.dds b/LuaUI/Images/advplayerslist/flags/lt.dds new file mode 100644 index 000000000..6cc36eb25 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lu.dds b/LuaUI/Images/advplayerslist/flags/lu.dds new file mode 100644 index 000000000..217c898f8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/lv.dds b/LuaUI/Images/advplayerslist/flags/lv.dds new file mode 100644 index 000000000..d90bfe17e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/lv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ly.dds b/LuaUI/Images/advplayerslist/flags/ly.dds new file mode 100644 index 000000000..52f7d4e0a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ly.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ma.dds b/LuaUI/Images/advplayerslist/flags/ma.dds new file mode 100644 index 000000000..626e6105a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ma.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mc.dds b/LuaUI/Images/advplayerslist/flags/mc.dds new file mode 100644 index 000000000..0e8e3d9c5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/md.dds b/LuaUI/Images/advplayerslist/flags/md.dds new file mode 100644 index 000000000..08543efdc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/md.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/me.dds b/LuaUI/Images/advplayerslist/flags/me.dds new file mode 100644 index 000000000..53fcf5029 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/me.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mg.dds b/LuaUI/Images/advplayerslist/flags/mg.dds new file mode 100644 index 000000000..9be91a269 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mh.dds b/LuaUI/Images/advplayerslist/flags/mh.dds new file mode 100644 index 000000000..5a8e6cc26 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mk.dds b/LuaUI/Images/advplayerslist/flags/mk.dds new file mode 100644 index 000000000..d2132d3cc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ml.dds b/LuaUI/Images/advplayerslist/flags/ml.dds new file mode 100644 index 000000000..71c64c831 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ml.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mm.dds b/LuaUI/Images/advplayerslist/flags/mm.dds new file mode 100644 index 000000000..3f9fdd6a1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mn.dds b/LuaUI/Images/advplayerslist/flags/mn.dds new file mode 100644 index 000000000..33a09586d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mo.dds b/LuaUI/Images/advplayerslist/flags/mo.dds new file mode 100644 index 000000000..839b9f1db Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mo.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mp.dds b/LuaUI/Images/advplayerslist/flags/mp.dds new file mode 100644 index 000000000..4ffd21103 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mp.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mq.dds b/LuaUI/Images/advplayerslist/flags/mq.dds new file mode 100644 index 000000000..4a946b460 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mq.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mr.dds b/LuaUI/Images/advplayerslist/flags/mr.dds new file mode 100644 index 000000000..d54664b0a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ms.dds b/LuaUI/Images/advplayerslist/flags/ms.dds new file mode 100644 index 000000000..4487cd915 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ms.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mt.dds b/LuaUI/Images/advplayerslist/flags/mt.dds new file mode 100644 index 000000000..56b7338ec Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mu.dds b/LuaUI/Images/advplayerslist/flags/mu.dds new file mode 100644 index 000000000..06f59f7ed Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mv.dds b/LuaUI/Images/advplayerslist/flags/mv.dds new file mode 100644 index 000000000..112c244a9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mw.dds b/LuaUI/Images/advplayerslist/flags/mw.dds new file mode 100644 index 000000000..dfdb327b9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mx.dds b/LuaUI/Images/advplayerslist/flags/mx.dds new file mode 100644 index 000000000..889daf2ca Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mx.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/my.dds b/LuaUI/Images/advplayerslist/flags/my.dds new file mode 100644 index 000000000..13bf2fdc2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/my.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/mz.dds b/LuaUI/Images/advplayerslist/flags/mz.dds new file mode 100644 index 000000000..336ffa03c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/mz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/na.dds b/LuaUI/Images/advplayerslist/flags/na.dds new file mode 100644 index 000000000..e4a628a49 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/na.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nc.dds b/LuaUI/Images/advplayerslist/flags/nc.dds new file mode 100644 index 000000000..b958c67c5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ne.dds b/LuaUI/Images/advplayerslist/flags/ne.dds new file mode 100644 index 000000000..b2eb8b174 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ne.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nf.dds b/LuaUI/Images/advplayerslist/flags/nf.dds new file mode 100644 index 000000000..418fc72cd Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ng.dds b/LuaUI/Images/advplayerslist/flags/ng.dds new file mode 100644 index 000000000..fdc8b6201 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ng.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ni.dds b/LuaUI/Images/advplayerslist/flags/ni.dds new file mode 100644 index 000000000..a06abfaa6 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ni.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nl.dds b/LuaUI/Images/advplayerslist/flags/nl.dds new file mode 100644 index 000000000..db9dd9ce7 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/no.dds b/LuaUI/Images/advplayerslist/flags/no.dds new file mode 100644 index 000000000..bf79db2a5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/no.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/np.dds b/LuaUI/Images/advplayerslist/flags/np.dds new file mode 100644 index 000000000..86e65d326 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/np.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nr.dds b/LuaUI/Images/advplayerslist/flags/nr.dds new file mode 100644 index 000000000..dc1d14dfd Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nu.dds b/LuaUI/Images/advplayerslist/flags/nu.dds new file mode 100644 index 000000000..9ca6cab51 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/nz.dds b/LuaUI/Images/advplayerslist/flags/nz.dds new file mode 100644 index 000000000..dd9e0569c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/nz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/om.dds b/LuaUI/Images/advplayerslist/flags/om.dds new file mode 100644 index 000000000..ecc2afd60 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/om.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pa.dds b/LuaUI/Images/advplayerslist/flags/pa.dds new file mode 100644 index 000000000..8c6af4091 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pa.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pe.dds b/LuaUI/Images/advplayerslist/flags/pe.dds new file mode 100644 index 000000000..c0a19c1e7 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pe.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pf.dds b/LuaUI/Images/advplayerslist/flags/pf.dds new file mode 100644 index 000000000..6860d6372 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pg.dds b/LuaUI/Images/advplayerslist/flags/pg.dds new file mode 100644 index 000000000..6753ea5c8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ph.dds b/LuaUI/Images/advplayerslist/flags/ph.dds new file mode 100644 index 000000000..547e56675 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ph.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pk.dds b/LuaUI/Images/advplayerslist/flags/pk.dds new file mode 100644 index 000000000..a727ad9e2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pl.dds b/LuaUI/Images/advplayerslist/flags/pl.dds new file mode 100644 index 000000000..37cf89b62 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pm.dds b/LuaUI/Images/advplayerslist/flags/pm.dds new file mode 100644 index 000000000..ce2e3a033 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pn.dds b/LuaUI/Images/advplayerslist/flags/pn.dds new file mode 100644 index 000000000..d5b85f059 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pr.dds b/LuaUI/Images/advplayerslist/flags/pr.dds new file mode 100644 index 000000000..59249a45c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ps.dds b/LuaUI/Images/advplayerslist/flags/ps.dds new file mode 100644 index 000000000..7d8296598 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ps.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pt.dds b/LuaUI/Images/advplayerslist/flags/pt.dds new file mode 100644 index 000000000..5a81491f8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/pw.dds b/LuaUI/Images/advplayerslist/flags/pw.dds new file mode 100644 index 000000000..fea788647 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/pw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/py.dds b/LuaUI/Images/advplayerslist/flags/py.dds new file mode 100644 index 000000000..c7225409e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/py.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/qa.dds b/LuaUI/Images/advplayerslist/flags/qa.dds new file mode 100644 index 000000000..f52612b74 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/qa.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/re.dds b/LuaUI/Images/advplayerslist/flags/re.dds new file mode 100644 index 000000000..bfd13b7a8 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/re.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ro.dds b/LuaUI/Images/advplayerslist/flags/ro.dds new file mode 100644 index 000000000..3e4be5f80 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ro.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/rs.dds b/LuaUI/Images/advplayerslist/flags/rs.dds new file mode 100644 index 000000000..acb896897 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/rs.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ru.dds b/LuaUI/Images/advplayerslist/flags/ru.dds new file mode 100644 index 000000000..afefe74ab Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ru.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/rw.dds b/LuaUI/Images/advplayerslist/flags/rw.dds new file mode 100644 index 000000000..e3cf230f3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/rw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sa.dds b/LuaUI/Images/advplayerslist/flags/sa.dds new file mode 100644 index 000000000..7dea89e2f Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sa.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sb.dds b/LuaUI/Images/advplayerslist/flags/sb.dds new file mode 100644 index 000000000..f998ba689 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sb.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sc.dds b/LuaUI/Images/advplayerslist/flags/sc.dds new file mode 100644 index 000000000..39afea81f Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/scotland.dds b/LuaUI/Images/advplayerslist/flags/scotland.dds new file mode 100644 index 000000000..e10e5dee2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/scotland.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sd.dds b/LuaUI/Images/advplayerslist/flags/sd.dds new file mode 100644 index 000000000..ab7678356 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sd.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/se.dds b/LuaUI/Images/advplayerslist/flags/se.dds new file mode 100644 index 000000000..8f05a17bb Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/se.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sg.dds b/LuaUI/Images/advplayerslist/flags/sg.dds new file mode 100644 index 000000000..e4746a71d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sh.dds b/LuaUI/Images/advplayerslist/flags/sh.dds new file mode 100644 index 000000000..9cb23100e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sh.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/si.dds b/LuaUI/Images/advplayerslist/flags/si.dds new file mode 100644 index 000000000..49c100c18 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/si.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sj.dds b/LuaUI/Images/advplayerslist/flags/sj.dds new file mode 100644 index 000000000..bf79db2a5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sj.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sk.dds b/LuaUI/Images/advplayerslist/flags/sk.dds new file mode 100644 index 000000000..7de59d89d Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sl.dds b/LuaUI/Images/advplayerslist/flags/sl.dds new file mode 100644 index 000000000..bf7dc8f54 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sm.dds b/LuaUI/Images/advplayerslist/flags/sm.dds new file mode 100644 index 000000000..0b23aef7e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sn.dds b/LuaUI/Images/advplayerslist/flags/sn.dds new file mode 100644 index 000000000..4ba8d4f56 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/so.dds b/LuaUI/Images/advplayerslist/flags/so.dds new file mode 100644 index 000000000..93ccdd001 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/so.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sr.dds b/LuaUI/Images/advplayerslist/flags/sr.dds new file mode 100644 index 000000000..80603f2e2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/st.dds b/LuaUI/Images/advplayerslist/flags/st.dds new file mode 100644 index 000000000..d2ea3fabd Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/st.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sv.dds b/LuaUI/Images/advplayerslist/flags/sv.dds new file mode 100644 index 000000000..be25119a0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sy.dds b/LuaUI/Images/advplayerslist/flags/sy.dds new file mode 100644 index 000000000..818c317f5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sy.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/sz.dds b/LuaUI/Images/advplayerslist/flags/sz.dds new file mode 100644 index 000000000..b69481186 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/sz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tc.dds b/LuaUI/Images/advplayerslist/flags/tc.dds new file mode 100644 index 000000000..be6532aca Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/td.dds b/LuaUI/Images/advplayerslist/flags/td.dds new file mode 100644 index 000000000..653727611 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/td.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tf.dds b/LuaUI/Images/advplayerslist/flags/tf.dds new file mode 100644 index 000000000..f2469ab36 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tg.dds b/LuaUI/Images/advplayerslist/flags/tg.dds new file mode 100644 index 000000000..a635fddd9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/th.dds b/LuaUI/Images/advplayerslist/flags/th.dds new file mode 100644 index 000000000..386a915c5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/th.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tj.dds b/LuaUI/Images/advplayerslist/flags/tj.dds new file mode 100644 index 000000000..282f395b9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tj.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tk.dds b/LuaUI/Images/advplayerslist/flags/tk.dds new file mode 100644 index 000000000..bba5e51dc Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tk.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tl.dds b/LuaUI/Images/advplayerslist/flags/tl.dds new file mode 100644 index 000000000..6361df18e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tl.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tm.dds b/LuaUI/Images/advplayerslist/flags/tm.dds new file mode 100644 index 000000000..0f35031ac Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tn.dds b/LuaUI/Images/advplayerslist/flags/tn.dds new file mode 100644 index 000000000..55af9b0e3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/to.dds b/LuaUI/Images/advplayerslist/flags/to.dds new file mode 100644 index 000000000..4aedd3fa3 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/to.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tr.dds b/LuaUI/Images/advplayerslist/flags/tr.dds new file mode 100644 index 000000000..6c49dab33 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tr.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tt.dds b/LuaUI/Images/advplayerslist/flags/tt.dds new file mode 100644 index 000000000..f2a019200 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tv.dds b/LuaUI/Images/advplayerslist/flags/tv.dds new file mode 100644 index 000000000..c6f608e87 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tv.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tw.dds b/LuaUI/Images/advplayerslist/flags/tw.dds new file mode 100644 index 000000000..e909dc531 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tw.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/tz.dds b/LuaUI/Images/advplayerslist/flags/tz.dds new file mode 100644 index 000000000..e2bdbe8e4 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/tz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ua.dds b/LuaUI/Images/advplayerslist/flags/ua.dds new file mode 100644 index 000000000..46747599a Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ua.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ug.dds b/LuaUI/Images/advplayerslist/flags/ug.dds new file mode 100644 index 000000000..6343e0239 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ug.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/um.dds b/LuaUI/Images/advplayerslist/flags/um.dds new file mode 100644 index 000000000..3ba166595 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/um.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/us.dds b/LuaUI/Images/advplayerslist/flags/us.dds new file mode 100644 index 000000000..46126f163 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/us.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/uy.dds b/LuaUI/Images/advplayerslist/flags/uy.dds new file mode 100644 index 000000000..463423543 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/uy.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/uz.dds b/LuaUI/Images/advplayerslist/flags/uz.dds new file mode 100644 index 000000000..ccb1453d5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/uz.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/va.dds b/LuaUI/Images/advplayerslist/flags/va.dds new file mode 100644 index 000000000..8b2f619ee Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/va.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/vc.dds b/LuaUI/Images/advplayerslist/flags/vc.dds new file mode 100644 index 000000000..bb3311346 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/vc.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ve.dds b/LuaUI/Images/advplayerslist/flags/ve.dds new file mode 100644 index 000000000..0cccb50e1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ve.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/vg.dds b/LuaUI/Images/advplayerslist/flags/vg.dds new file mode 100644 index 000000000..f901f0a8c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/vg.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/vi.dds b/LuaUI/Images/advplayerslist/flags/vi.dds new file mode 100644 index 000000000..ca33d9fbf Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/vi.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/vn.dds b/LuaUI/Images/advplayerslist/flags/vn.dds new file mode 100644 index 000000000..db1e06563 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/vn.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/vu.dds b/LuaUI/Images/advplayerslist/flags/vu.dds new file mode 100644 index 000000000..c70ee6cbf Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/vu.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/wales.dds b/LuaUI/Images/advplayerslist/flags/wales.dds new file mode 100644 index 000000000..0e4c38d5f Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/wales.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/wf.dds b/LuaUI/Images/advplayerslist/flags/wf.dds new file mode 100644 index 000000000..906e9299e Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/wf.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ws.dds b/LuaUI/Images/advplayerslist/flags/ws.dds new file mode 100644 index 000000000..97de5dd9c Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ws.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/wut.dds b/LuaUI/Images/advplayerslist/flags/wut.dds new file mode 100644 index 000000000..7a162c3e1 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/wut.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/ye.dds b/LuaUI/Images/advplayerslist/flags/ye.dds new file mode 100644 index 000000000..97fea1945 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/ye.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/yt.dds b/LuaUI/Images/advplayerslist/flags/yt.dds new file mode 100644 index 000000000..f25d40903 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/yt.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/za.dds b/LuaUI/Images/advplayerslist/flags/za.dds new file mode 100644 index 000000000..925dc9dd9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/za.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/zm.dds b/LuaUI/Images/advplayerslist/flags/zm.dds new file mode 100644 index 000000000..706590f72 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/zm.dds differ diff --git a/LuaUI/Images/advplayerslist/flags/zw.dds b/LuaUI/Images/advplayerslist/flags/zw.dds new file mode 100644 index 000000000..37b366553 Binary files /dev/null and b/LuaUI/Images/advplayerslist/flags/zw.dds differ diff --git a/LuaUI/Images/advplayerslist/id.dds b/LuaUI/Images/advplayerslist/id.dds new file mode 100644 index 000000000..d97c535e0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/id.dds differ diff --git a/LuaUI/Images/advplayerslist/indent.png b/LuaUI/Images/advplayerslist/indent.png new file mode 100644 index 000000000..796e8806b Binary files /dev/null and b/LuaUI/Images/advplayerslist/indent.png differ diff --git a/LuaUI/Images/advplayerslist/indicator.dds b/LuaUI/Images/advplayerslist/indicator.dds new file mode 100644 index 000000000..2cc4baae2 Binary files /dev/null and b/LuaUI/Images/advplayerslist/indicator.dds differ diff --git a/LuaUI/Images/advplayerslist/low.dds b/LuaUI/Images/advplayerslist/low.dds new file mode 100644 index 000000000..d36a6361c Binary files /dev/null and b/LuaUI/Images/advplayerslist/low.dds differ diff --git a/LuaUI/Images/advplayerslist/metal.dds b/LuaUI/Images/advplayerslist/metal.dds new file mode 100644 index 000000000..06563a2f0 Binary files /dev/null and b/LuaUI/Images/advplayerslist/metal.dds differ diff --git a/LuaUI/Images/advplayerslist/name.dds b/LuaUI/Images/advplayerslist/name.dds new file mode 100644 index 000000000..c874bd153 Binary files /dev/null and b/LuaUI/Images/advplayerslist/name.dds differ diff --git a/LuaUI/Images/advplayerslist/notfirst.dds b/LuaUI/Images/advplayerslist/notfirst.dds new file mode 100644 index 000000000..87ab1dc34 Binary files /dev/null and b/LuaUI/Images/advplayerslist/notfirst.dds differ diff --git a/LuaUI/Images/advplayerslist/notfirst.png b/LuaUI/Images/advplayerslist/notfirst.png index 4ffc141fe..5667900d2 100644 Binary files a/LuaUI/Images/advplayerslist/notfirst.png and b/LuaUI/Images/advplayerslist/notfirst.png differ diff --git a/LuaUI/Images/advplayerslist/ping.dds b/LuaUI/Images/advplayerslist/ping.dds new file mode 100644 index 000000000..a44c9cd19 Binary files /dev/null and b/LuaUI/Images/advplayerslist/ping.dds differ diff --git a/LuaUI/Images/advplayerslist/point.dds b/LuaUI/Images/advplayerslist/point.dds new file mode 100644 index 000000000..eda4e43e4 Binary files /dev/null and b/LuaUI/Images/advplayerslist/point.dds differ diff --git a/LuaUI/Images/advplayerslist/res.png b/LuaUI/Images/advplayerslist/res.png new file mode 100644 index 000000000..54649d9ad Binary files /dev/null and b/LuaUI/Images/advplayerslist/res.png differ diff --git a/LuaUI/Images/advplayerslist/resbar.png b/LuaUI/Images/advplayerslist/resbar.png new file mode 100644 index 000000000..fa0f57dd7 Binary files /dev/null and b/LuaUI/Images/advplayerslist/resbar.png differ diff --git a/LuaUI/Images/advplayerslist/resbarbg.png b/LuaUI/Images/advplayerslist/resbarbg.png new file mode 100644 index 000000000..8b99ed7f5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/resbarbg.png differ diff --git a/LuaUI/Images/advplayerslist/resources.dds b/LuaUI/Images/advplayerslist/resources.dds new file mode 100644 index 000000000..e07bf5c96 Binary files /dev/null and b/LuaUI/Images/advplayerslist/resources.dds differ diff --git a/LuaUI/Images/advplayerslist/separator.png b/LuaUI/Images/advplayerslist/separator.png new file mode 100644 index 000000000..f9c804334 Binary files /dev/null and b/LuaUI/Images/advplayerslist/separator.png differ diff --git a/LuaUI/Images/advplayerslist/share.dds b/LuaUI/Images/advplayerslist/share.dds new file mode 100644 index 000000000..854bd5f59 Binary files /dev/null and b/LuaUI/Images/advplayerslist/share.dds differ diff --git a/LuaUI/Images/advplayerslist/side.dds b/LuaUI/Images/advplayerslist/side.dds new file mode 100644 index 000000000..744ab97b5 Binary files /dev/null and b/LuaUI/Images/advplayerslist/side.dds differ diff --git a/LuaUI/Images/advplayerslist/sizedn.dds b/LuaUI/Images/advplayerslist/sizedn.dds new file mode 100644 index 000000000..77375bbfc Binary files /dev/null and b/LuaUI/Images/advplayerslist/sizedn.dds differ diff --git a/LuaUI/Images/advplayerslist/sizeup.dds b/LuaUI/Images/advplayerslist/sizeup.dds new file mode 100644 index 000000000..81e379810 Binary files /dev/null and b/LuaUI/Images/advplayerslist/sizeup.dds differ diff --git a/LuaUI/Images/advplayerslist/take.dds b/LuaUI/Images/advplayerslist/take.dds new file mode 100644 index 000000000..f604a1ef9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/take.dds differ diff --git a/LuaUI/Images/advplayerslist/ts.dds b/LuaUI/Images/advplayerslist/ts.dds new file mode 100644 index 000000000..00e969fd6 Binary files /dev/null and b/LuaUI/Images/advplayerslist/ts.dds differ diff --git a/LuaUI/Images/advplayerslist/ts.png b/LuaUI/Images/advplayerslist/ts.png new file mode 100644 index 000000000..cd335a1a9 Binary files /dev/null and b/LuaUI/Images/advplayerslist/ts.png differ diff --git a/LuaUI/Images/advplayerslist/units.dds b/LuaUI/Images/advplayerslist/units.dds new file mode 100644 index 000000000..8a2d4b341 Binary files /dev/null and b/LuaUI/Images/advplayerslist/units.dds differ diff --git a/LuaUI/Images/advplayerslist/units0.png b/LuaUI/Images/advplayerslist/units0.png new file mode 100644 index 000000000..98ab05057 Binary files /dev/null and b/LuaUI/Images/advplayerslist/units0.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/armortype/armored.dds b/LuaUI/Images/armortype/armored.dds new file mode 100644 index 000000000..aac1f5796 Binary files /dev/null and b/LuaUI/Images/armortype/armored.dds differ diff --git a/LuaUI/Images/backward.dds b/LuaUI/Images/backward.dds new file mode 100644 index 000000000..92dfcc392 Binary files /dev/null and b/LuaUI/Images/backward.dds differ diff --git a/LuaUI/Images/barglow-center.dds b/LuaUI/Images/barglow-center.dds new file mode 100644 index 000000000..f5e416d17 Binary files /dev/null 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 new file mode 100644 index 000000000..54ef132fb Binary files /dev/null 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/bgcorner.png b/LuaUI/Images/bgcorner.png new file mode 100644 index 000000000..317f49a57 Binary files /dev/null and b/LuaUI/Images/bgcorner.png differ diff --git a/LuaUI/Images/bgcorner1.png b/LuaUI/Images/bgcorner1.png new file mode 100644 index 000000000..7f14ecc75 Binary files /dev/null and b/LuaUI/Images/bgcorner1.png differ diff --git a/LuaUI/Images/button-highlight.dds b/LuaUI/Images/button-highlight.dds new file mode 100644 index 000000000..dad8ed220 Binary files /dev/null and b/LuaUI/Images/button-highlight.dds differ diff --git a/LuaUI/Images/button-pushed.dds b/LuaUI/Images/button-pushed.dds new file mode 100644 index 000000000..839b8af91 Binary files /dev/null and b/LuaUI/Images/button-pushed.dds differ diff --git a/LuaUI/Images/button.dds b/LuaUI/Images/button.dds new file mode 100644 index 000000000..acf8785b0 Binary files /dev/null and b/LuaUI/Images/button.dds differ diff --git a/LuaUI/Images/close.dds b/LuaUI/Images/close.dds new file mode 100644 index 000000000..c52563e60 Binary files /dev/null and b/LuaUI/Images/close.dds differ diff --git a/LuaUI/Images/commandsfx/glow.dds b/LuaUI/Images/commandsfx/glow.dds new file mode 100644 index 000000000..66f9dded5 Binary files /dev/null and b/LuaUI/Images/commandsfx/glow.dds differ diff --git a/LuaUI/Images/commandsfx/line.dds b/LuaUI/Images/commandsfx/line.dds new file mode 100644 index 000000000..90a843ea2 Binary files /dev/null and b/LuaUI/Images/commandsfx/line.dds differ diff --git a/LuaUI/Images/commandsfx/line2.dds b/LuaUI/Images/commandsfx/line2.dds new file mode 100644 index 000000000..635ac7b26 Binary files /dev/null and b/LuaUI/Images/commandsfx/line2.dds differ diff --git a/LuaUI/Images/damagetype/armor.dds b/LuaUI/Images/damagetype/armor.dds new file mode 100644 index 000000000..9e9f3717e Binary files /dev/null and b/LuaUI/Images/damagetype/armor.dds differ diff --git a/LuaUI/Images/damagetype/building.dds b/LuaUI/Images/damagetype/building.dds new file mode 100644 index 000000000..ba1f83b94 Binary files /dev/null and b/LuaUI/Images/damagetype/building.dds differ diff --git a/LuaUI/Images/damagetype/light.dds b/LuaUI/Images/damagetype/light.dds new file mode 100644 index 000000000..a14390586 Binary files /dev/null and b/LuaUI/Images/damagetype/light.dds differ diff --git a/LuaUI/Images/discord.png b/LuaUI/Images/discord.png new file mode 100644 index 000000000..5d9d47030 Binary files /dev/null and b/LuaUI/Images/discord.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/energy2.png b/LuaUI/Images/energy2.png new file mode 100644 index 000000000..08d838903 Binary files /dev/null and b/LuaUI/Images/energy2.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/forward.dds b/LuaUI/Images/forward.dds new file mode 100644 index 000000000..361b2096b Binary files /dev/null and b/LuaUI/Images/forward.dds differ diff --git a/LuaUI/Images/glow.dds b/LuaUI/Images/glow.dds new file mode 100644 index 000000000..66f9dded5 Binary files /dev/null and b/LuaUI/Images/glow.dds 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/guishader/noise.dds b/LuaUI/Images/guishader/noise.dds new file mode 100644 index 000000000..20768e352 Binary files /dev/null and b/LuaUI/Images/guishader/noise.dds differ diff --git a/LuaUI/Images/guishader/noise1.dds b/LuaUI/Images/guishader/noise1.dds new file mode 100644 index 000000000..baa56eede Binary files /dev/null and b/LuaUI/Images/guishader/noise1.dds differ diff --git a/LuaUI/Images/guishader/noise2.dds b/LuaUI/Images/guishader/noise2.dds new file mode 100644 index 000000000..da58aedd2 Binary files /dev/null and b/LuaUI/Images/guishader/noise2.dds differ diff --git a/LuaUI/Images/line.dds b/LuaUI/Images/line.dds new file mode 100644 index 000000000..90a843ea2 Binary files /dev/null and b/LuaUI/Images/line.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/mapmarksfx/eraser.dds b/LuaUI/Images/mapmarksfx/eraser.dds new file mode 100644 index 000000000..817214293 Binary files /dev/null and b/LuaUI/Images/mapmarksfx/eraser.dds differ diff --git a/LuaUI/Images/mapmarksfx/glow.dds b/LuaUI/Images/mapmarksfx/glow.dds new file mode 100644 index 000000000..9ef7e8e21 Binary files /dev/null and b/LuaUI/Images/mapmarksfx/glow.dds differ diff --git a/LuaUI/Images/mapmarksfx/pencil.dds b/LuaUI/Images/mapmarksfx/pencil.dds new file mode 100644 index 000000000..c95b514f1 Binary files /dev/null and b/LuaUI/Images/mapmarksfx/pencil.dds differ diff --git a/LuaUI/Images/mapmarksfx/ring-plain.dds b/LuaUI/Images/mapmarksfx/ring-plain.dds new file mode 100644 index 000000000..98b123926 Binary files /dev/null and b/LuaUI/Images/mapmarksfx/ring-plain.dds differ diff --git a/LuaUI/Images/mapmarksfx/ring.dds b/LuaUI/Images/mapmarksfx/ring.dds new file mode 100644 index 000000000..df77188c2 Binary files /dev/null and b/LuaUI/Images/mapmarksfx/ring.dds differ diff --git a/LuaUI/Images/metal.png b/LuaUI/Images/metal.png new file mode 100644 index 000000000..ea9a47112 Binary files /dev/null and b/LuaUI/Images/metal.png differ diff --git a/LuaUI/Images/music/forward.png b/LuaUI/Images/music/forward.png new file mode 100644 index 000000000..48d2d3843 Binary files /dev/null and b/LuaUI/Images/music/forward.png differ diff --git a/LuaUI/Images/music/music.png b/LuaUI/Images/music/music.png new file mode 100644 index 000000000..dcf038616 Binary files /dev/null and b/LuaUI/Images/music/music.png differ diff --git a/LuaUI/Images/music/next.png b/LuaUI/Images/music/next.png new file mode 100644 index 000000000..2f35baf1a Binary files /dev/null and b/LuaUI/Images/music/next.png differ diff --git a/LuaUI/Images/music/pause.png b/LuaUI/Images/music/pause.png new file mode 100644 index 000000000..4842ee362 Binary files /dev/null and b/LuaUI/Images/music/pause.png differ diff --git a/LuaUI/Images/music/play.png b/LuaUI/Images/music/play.png new file mode 100644 index 000000000..e9c47aa2a Binary files /dev/null and b/LuaUI/Images/music/play.png differ diff --git a/LuaUI/Images/music/volume.png b/LuaUI/Images/music/volume.png new file mode 100644 index 000000000..7f5290908 Binary files /dev/null and b/LuaUI/Images/music/volume.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/panel.tga b/LuaUI/Images/panel.tga new file mode 100644 index 000000000..f00b79982 Binary files /dev/null and b/LuaUI/Images/panel.tga differ diff --git a/LuaUI/Images/redminimap/move.png b/LuaUI/Images/redminimap/move.png new file mode 100644 index 000000000..94e022b3c Binary files /dev/null and b/LuaUI/Images/redminimap/move.png differ diff --git a/LuaUI/Images/redminimap/resize.png b/LuaUI/Images/redminimap/resize.png new file mode 100644 index 000000000..1d3f1c8c7 Binary files /dev/null and b/LuaUI/Images/redminimap/resize.png differ diff --git a/LuaUI/Images/resbar.dds b/LuaUI/Images/resbar.dds new file mode 100644 index 000000000..c095c777a Binary files /dev/null and b/LuaUI/Images/resbar.dds 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/snow/snow1.dds b/LuaUI/Images/snow/snow1.dds new file mode 100644 index 000000000..9bcde3258 Binary files /dev/null and b/LuaUI/Images/snow/snow1.dds differ diff --git a/LuaUI/Images/snow/snow2.dds b/LuaUI/Images/snow/snow2.dds new file mode 100644 index 000000000..e929f0b52 Binary files /dev/null and b/LuaUI/Images/snow/snow2.dds differ diff --git a/LuaUI/Images/snow/snow3.dds b/LuaUI/Images/snow/snow3.dds new file mode 100644 index 000000000..26093b1a3 Binary files /dev/null and b/LuaUI/Images/snow/snow3.dds differ diff --git a/LuaUI/Images/snow/snow4.dds b/LuaUI/Images/snow/snow4.dds new file mode 100644 index 000000000..2e6b8140b Binary files /dev/null and b/LuaUI/Images/snow/snow4.dds differ diff --git a/LuaUI/Images/snow/snow5.dds b/LuaUI/Images/snow/snow5.dds new file mode 100644 index 000000000..8a1b83089 Binary files /dev/null and b/LuaUI/Images/snow/snow5.dds differ diff --git a/LuaUI/Images/snow/snow6.dds b/LuaUI/Images/snow/snow6.dds new file mode 100644 index 000000000..96ea2ffc6 Binary files /dev/null and b/LuaUI/Images/snow/snow6.dds differ diff --git a/LuaUI/Images/supply.png b/LuaUI/Images/supply.png new file mode 100644 index 000000000..ea00eca3f Binary files /dev/null and b/LuaUI/Images/supply.png differ diff --git a/LuaUI/Images/tick.png b/LuaUI/Images/tick.png new file mode 100644 index 000000000..9e3cb433c Binary files /dev/null and b/LuaUI/Images/tick.png 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/Sounds/click.wav b/LuaUI/Sounds/click.wav new file mode 100644 index 000000000..fc8ff1e38 Binary files /dev/null and b/LuaUI/Sounds/click.wav differ diff --git a/LuaUI/Sounds/click2.wav b/LuaUI/Sounds/click2.wav new file mode 100644 index 000000000..c4be68573 Binary files /dev/null and b/LuaUI/Sounds/click2.wav differ diff --git a/LuaUI/Sounds/hover.wav b/LuaUI/Sounds/hover.wav new file mode 100644 index 000000000..e6fef65f1 Binary files /dev/null and b/LuaUI/Sounds/hover.wav differ diff --git a/LuaUI/Sounds/pushbutton.wav b/LuaUI/Sounds/pushbutton.wav new file mode 100644 index 000000000..8409b919b Binary files /dev/null and b/LuaUI/Sounds/pushbutton.wav differ diff --git a/LuaUI/Sounds/switchoff.wav b/LuaUI/Sounds/switchoff.wav new file mode 100644 index 000000000..67c2ef1ee Binary files /dev/null and b/LuaUI/Sounds/switchoff.wav differ diff --git a/LuaUI/Sounds/switchon.wav b/LuaUI/Sounds/switchon.wav new file mode 100644 index 000000000..b01506520 Binary files /dev/null and b/LuaUI/Sounds/switchon.wav differ diff --git a/LuaUI/Sounds/tock.wav b/LuaUI/Sounds/tock.wav new file mode 100644 index 000000000..f774f70e4 Binary files /dev/null and b/LuaUI/Sounds/tock.wav differ diff --git a/LuaUI/Sounds/zap.wav b/LuaUI/Sounds/zap.wav new file mode 100644 index 000000000..47b25ad9a Binary files /dev/null and b/LuaUI/Sounds/zap.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/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_mexspot_fetcher.lua b/LuaUI/Widgets_Evo/api_mexspot_fetcher.lua new file mode 100644 index 000000000..6585bbeb5 --- /dev/null +++ b/LuaUI/Widgets_Evo/api_mexspot_fetcher.lua @@ -0,0 +1,59 @@ + +function widget:GetInfo() + return { + name = "Mexspot Fetcher", + desc = "Fetches metal spot data from synced.", + author = "Google Frog", -- + date = "22 April 2012", + license = "GNU GPL, v2 or later", + layer = -30000, + enabled = true, -- loaded by default? + alwaysStart = true, + hidden = true, + } +end + +local spGetGameRulesParam = Spring.GetGameRulesParam + +local function GetSpotsByPos(spots) + local spotPos = {} + for i = 1, #spots do + local spot = spots[i] + local x = spot.x + local z = spot.z + --Spring.MarkerAddPoint(x,0,z,x .. ", " .. z) + spotPos[x] = spotPos[x] or {} + spotPos[x][z] = i + end + return spotPos +end + +local function GetMexSpotsFromGameRules() + local mexCount = spGetGameRulesParam("mex_count") + if (not mexCount) or mexCount == -1 then + WG.metalSpots = false + WG.metalSpotsByPos = false + return + end + + local metalSpots = {} + + for i = 1, mexCount do + metalSpots[i] = { + x = spGetGameRulesParam("mex_x" .. i), + y = spGetGameRulesParam("mex_y" .. i), + z = spGetGameRulesParam("mex_z" .. i), + metal = spGetGameRulesParam("mex_metal" .. i), + } + end + + local metalSpotsByPos = GetSpotsByPos(metalSpots) + + WG.metalSpots = metalSpots + WG.metalSpotsByPos = metalSpotsByPos +end + +function widget:Initialize() + Spring.Echo("Mexspot Fetcher fetching") + GetMexSpotsFromGameRules() +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_autocheat.lua b/LuaUI/Widgets_Evo/cmd_autocheat.lua new file mode 100644 index 000000000..07f48bc33 --- /dev/null +++ b/LuaUI/Widgets_Evo/cmd_autocheat.lua @@ -0,0 +1,20 @@ +function widget:GetInfo() + return { + name = "Auto Cheat and Globallos", + desc = "Sends cheat and globallos so I don't have to", + author = "Forboding Angel", + date = "01-21-2014", + license = "GPL v2 or later", + layer = 5, + enabled = false + } +end + +function widget:Initialize() + Spring.Echo([[I'm a filthy cheater]]) + + Spring.SendCommands("cheat") + Spring.SendCommands("globallos") + + widgetHandler:RemoveWidget() +end \ No newline at end of file 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 new file mode 100644 index 000000000..c598c68e8 --- /dev/null +++ b/LuaUI/Widgets_Evo/cmd_mex_placement.lua @@ -0,0 +1,995 @@ + +function widget:GetInfo() + return { + name = "Mex Placement Handler", + desc = "Places mexes in the correct position DO NOT DISABLE", + 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", + layer = 0, + enabled = true, + handler = true + } +end + +VFS.Include("LuaRules/Configs/customcmds.h.lua") +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 +------------------------------------------------------------ +local spGetActiveCommand = Spring.GetActiveCommand +local spGetMouseState = Spring.GetMouseState +local spTraceScreenRay = Spring.TraceScreenRay +local spGetUnitDefID = Spring.GetUnitDefID +local spGetMyAllyTeamID = Spring.GetMyAllyTeamID +local spGetUnitAllyTeam = Spring.GetUnitAllyTeam +local spGetUnitHealth = Spring.GetUnitHealth +local spGetSelectedUnits = Spring.GetSelectedUnits +local spInsertUnitCmdDesc = Spring.InsertUnitCmdDesc +local spGiveOrderToUnit = Spring.GiveOrderToUnit +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 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 + +local glLineWidth = gl.LineWidth +local glColor = gl.Color +local glRect = gl.Rect +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 +local glScale = gl.Scale +local glBillboard = gl.Billboard +local glAlphaTest = gl.AlphaTest +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glVertex = gl.Vertex +local glBeginEnd = gl.BeginEnd +local glLoadIdentity = gl.LoadIdentity +local glRotate = gl.Rotate +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glTranslate = gl.Translate +local glCallList = gl.CallList +local glCreateList = gl.CreateList + +local GL_FRONT_AND_BACK = GL.FRONT_AND_BACK +local GL_FILL = GL.FILL +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 CMD_OPT_SHIFT = CMD.OPT_SHIFT + +local sqrt = math.sqrt +local tasort = table.sort +local taremove = table.remove + +local myAllyTeam = spGetMyAllyTeamID() + +local mapX = Game.mapSizeX +local mapZ = Game.mapSizeZ +local mapXinv = 1/mapX +local mapZinv = 1/mapZ + +local METAL_MAP_SQUARE_SIZE = 16 +local MEX_RADIUS = Game.extractorRadius +local MAP_SIZE_X = Game.mapSizeX +local MAP_SIZE_X_SCALED = MAP_SIZE_X / METAL_MAP_SQUARE_SIZE +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] = {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, ...} + +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) * minimapIconSizeMult + +options_path = 'Settings/Interface/Map/Metal Spots' +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 = 3, + circlePieceDetail = 5, + circleSpaceUsage = 0.45, + circleInnerOffset = 0.42, + rotationSpeed = 5, +} + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- +-- Mexes and builders + +local mexDefID = {} +for udid, ud in pairs(UnitDefs) do + 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 +end + +-------------------------------------------------------------------------------- +-- Variables +-------------------------------------------------------------------------------- + +WG.mouseoverMexIncome = 0 + +local spotByID = {} +local spotData = {} + +local wasSpectating = spGetSpectatingState() +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 +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 +end + +local function Distance(x1,z1,x2,z2) + 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, 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) +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 _, 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] +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 +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 +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 +end + +function widget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) + widget:UnitDestroyed(unitID, unitDefID, oldTeamID) +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 +end + +------------------------------------------------------------ +-- Drawing +------------------------------------------------------------ + +local centerX +local centerZ +local extraction = 0 + +local mainMexDrawList = 0 +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 +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 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 + +function DrawMexList() + 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) +end + +function widget:Shutdown() + gl.DeleteList(mainMexDrawList) + gl.DeleteList(mainMexValueDrawList) + gl.DeleteList(circleList) + gl.DeleteShader(animShader) +end + +local function DoLine(x1, y1, z1, x2, y2, z2) + gl.Vertex(x1, y1, z1) + gl.Vertex(x2, y2, z2) +end + +function widget:DrawWorldPreUnit() + 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 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(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_old_style_chat_keys.lua b/LuaUI/Widgets_Evo/cmd_old_style_chat_keys.lua new file mode 100644 index 000000000..397824a75 --- /dev/null +++ b/LuaUI/Widgets_Evo/cmd_old_style_chat_keys.lua @@ -0,0 +1,44 @@ +function widget:GetInfo() + return { + name = "Alternate Chat Keys", + desc = "Binds alt/shift+enter for ally/spec chat, alt+backspace for fullscreen toggle" , + author = "", + date = "", + license = "Anyone who uses this widget has to email me a horse", + layer = 0, + enabled = true + } +end + +local binds={ + "bind Alt+backspace fullscreen", + + "bind Alt+enter chatally", + "bind Alt+enter chatswitchally", + "bind Ctrl+enter chatall", + "bind Ctrl+enter chatswitchall", + "bind Shift+enter chatspec", + "bind Shift+enter chatswitchspec", +} + +local unbinds={ + "bind Alt+enter fullscreen", +} + +function widget:Initialize() + for k,v in ipairs(unbinds) do + Spring.SendCommands("un"..v) + end + for k,v in ipairs(binds) do + Spring.SendCommands(v) + end +end + +function widget:Shutdown() + for k,v in ipairs(binds) do + Spring.SendCommands("un"..v) + end + for k,v in ipairs(unbinds) do + Spring.SendCommands(v) + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/cmd_persistent_build_spacing.lua b/LuaUI/Widgets_Evo/cmd_persistent_build_spacing.lua new file mode 100644 index 000000000..a00a7d7c3 --- /dev/null +++ b/LuaUI/Widgets_Evo/cmd_persistent_build_spacing.lua @@ -0,0 +1,46 @@ +function widget:GetInfo() + return { + name = "Persistent Build Spacing", + desc = "Recalls last build spacing set for each building and game [v2.0]", + author = "Niobium & DrHash", + date = "Sep 6, 2011", + license = "GNU GPL, v3 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-- Config +local defaultSpacing = 0 + +-- Globals +local lastCmdID = nil +local buildSpacing = {} + +-- Speedups +local spGetActiveCommand = Spring.GetActiveCommand +local spGetBuildSpacing = Spring.GetBuildSpacing +local spSetBuildSpacing = Spring.SetBuildSpacing + +-- Callins +function widget:Update() + + local _, cmdID = spGetActiveCommand() + if cmdID and cmdID < 0 then + + if cmdID ~= lastCmdID then + spSetBuildSpacing(buildSpacing[-cmdID] or defaultSpacing) + lastCmdID = cmdID + end + + buildSpacing[-cmdID] = spGetBuildSpacing() + end +end + +function widget:GetConfigData() + return { buildSpacing = buildSpacing } +end + +function widget:SetConfigData(data) + buildSpacing = data.buildSpacing or {} +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/cmd_state_reverse_toggle.lua b/LuaUI/Widgets_Evo/cmd_state_reverse_toggle.lua index da3560071..6606a9f56 100644 --- a/LuaUI/Widgets_Evo/cmd_state_reverse_toggle.lua +++ b/LuaUI/Widgets_Evo/cmd_state_reverse_toggle.lua @@ -1,8 +1,8 @@ function widget:GetInfo() return { name = "State Reverse Toggle", - desc = "Makes multinary states reverse toggleable", - author = "Google Frog", + desc = "Makes all buttons with 3 or more states reverse toggleable", + author = "Google Frog, Deadnight Warrior", date = "Oct 2, 2009", license = "GNU GPL, v2 or later", layer = 0, @@ -12,32 +12,26 @@ end local spGetSelectedUnits = Spring.GetSelectedUnits local spGiveOrderToUnit = Spring.GiveOrderToUnit - -local CMD_FIRE_STATE = CMD.FIRE_STATE -local CMD_MOVE_STATE = CMD.MOVE_STATE - -local multiStates = { - [CMD_FIRE_STATE] = 3, - [CMD_MOVE_STATE] = 3, - [CMD.AUTOREPAIRLEVEL] = 4, -} +local spGetActiveCmdDesc = Spring.GetActiveCmdDesc +local spGetCmdDescIndex = Spring.GetCmdDescIndex function widget:CommandNotify(id, params, options) - - if multiStates[id] then - if options.right then - local units = spGetSelectedUnits() - local state = params[1] - - state = state - 2 -- engine sent us one step forward instead of one step back, so we go two steps back - if state < 0 then - state = multiStates[id] + state -- wrap - end - for i=1, #units do - spGiveOrderToUnit(units[i], id, { state }, {}) + + local index = spGetCmdDescIndex(id) + if index then + local comButton = spGetActiveCmdDesc(index) + if comButton and comButton.params and #comButton.params>3 then + if options.right then + local units = spGetSelectedUnits() + local state = params[1] -2 + if state < 0 then + state = state + #comButton.params - 1 + end + for _,sid in ipairs(units) do + spGiveOrderToUnit(sid, id, { state }, {}) + end + return true end - return true end - end - -end \ No newline at end of file + 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_ceg_spawner.lua b/LuaUI/Widgets_Evo/dbg_ceg_spawner.lua deleted file mode 100644 index 9a8a09613..000000000 --- a/LuaUI/Widgets_Evo/dbg_ceg_spawner.lua +++ /dev/null @@ -1,129 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "CEG Spawner", - desc = "v0.03 Spawn CEGs", - author = "CarRepairer", - date = "2010-11-07", - license = "GPLv2", - layer = 5, - enabled = true, -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---Set to true to sort CEGs into alphabetic submenus. This cannot be added to epicmenu options because it's used to actually change those options. -local ALPHA = true - -local echo = Spring.Echo --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -options_order = { 'reload', 'xdir', 'ydir', 'zdir', 'radius', } -options_path = 'Settings/Toolbox/CEG Spawner' -options = { - reload = { - name = 'Reload CEGs', - type = 'button', - OnChange = function() Spring.SendCommands('reloadcegs') end, - }, - - xdir = { - name = 'X (-1,1)', - type = 'number', - min = -1, max = 1, step = 0.1, - value = 0, - }, - ydir = { - name = 'Y (-1,1)', - type = 'number', - min = -1, max = 1, step = 0.1, - value = 0, - }, - zdir = { - name = 'Z (-1,1)', - type = 'number', - min = -1, max = 1, step = 0.1, - value = 0, - }, - radius = { - name = 'Radius (0 - 100)', - type = 'number', - min = 0, max = 100, step = 1, - value = 20, - }, - - - -} - - -local vsx, vsy = widgetHandler:GetViewSizes() -local cx,cy = vsx * 0.5,vsy * 0.5 - - -local function AddCEGButton(cegname) - options_order[#options_order+1] = cegname - - options[cegname] = { - type = 'button', - name = cegname, - OnChange = function() - if not Spring.IsCheatingEnabled() then - echo "Cannot do this unless Cheating is enabled." - return - end - cx,cy = vsx * 0.5,vsy * 0.5 - local ttype,pos = Spring.TraceScreenRay(cx, cy, true) - if ttype == 'ground' then - Spring.SendLuaRulesMsg( '*' .. cegname - .. '|' .. pos[1] - .. '|' .. pos[2] - .. '|' .. pos[3] - - .. '|' .. options.xdir.value - .. '|' .. options.ydir.value - .. '|' .. options.zdir.value - .. '|' .. options.radius.value - - - ) - else - echo "Cannot do this with a unit in the center of the screen." - end - end, - } - - if ALPHA then - options[cegname].path = options_path..'/' .. cegname:sub(1,1):upper() - --echo ( options[cegname].path ) - end -end - -local function SetupOptions() - local explosionDefs = VFS.Include("gamedata/explosions.lua") - - local explosions2 = {} - for k,v in pairs(explosionDefs) do - --echo(k,v) - explosions2[#explosions2+1] = k - end - table.sort(explosions2) - for i,v in ipairs(explosions2) do - AddCEGButton(v) - end -end - - -SetupOptions() - - -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY - cx = vsx * 0.5 - cy = vsy * 0.5 -end 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_mouse_to_mex_portable.lua b/LuaUI/Widgets_Evo/dbg_mouse_to_mex_portable.lua index b9a2a95ca..599460af4 100644 --- a/LuaUI/Widgets_Evo/dbg_mouse_to_mex_portable.lua +++ b/LuaUI/Widgets_Evo/dbg_mouse_to_mex_portable.lua @@ -44,7 +44,7 @@ function widget:MousePress(mx, my, button) local _, pos = Spring.TraceScreenRay(mx, my, true) if legalPos(pos) then if true then - handle:write("[" .. mexIndex .. "] = {x = " .. floor(pos[1] + 0.5) .. ", z = " .. floor(pos[3] + 0.5) .. ", metal = " .. tostring(metal) .. "},\n") + handle:write("{x = " .. floor(pos[1] + 0.5) .. ", z = " .. floor(pos[3] + 0.5) .. ", metal = " .. tostring(metal) .. "},\n") handle:flush() markers[#markers + 1] = {pos[1], 0, pos[3]} Spring.MarkerAddPoint(pos[1], 0, pos[3], mexIndex) 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 new file mode 100644 index 000000000..6d802517a --- /dev/null +++ b/LuaUI/Widgets_Evo/dbg_widgetprofiler.lua @@ -0,0 +1,441 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "WidgetProfiler", + desc = "", + author = "jK", + version = "2.0", + date = "2007,2008,2009", + license = "GNU GPL, v2 or later", + layer = -math.huge, + handler = true, + enabled = false -- loaded by default? + } +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 + +-- special widgets (things with a right to high usage that the user should not touch!) +local specialWidgets = { + ["Lups"] = true, + ["API Chili"] = true, + ["Red_UI_Framework"] = true, + ["Red_Drawing"] = true, +} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local callinTimes = {} + +local oldUpdateWidgetCallIn +local oldInsertWidget + +local listOfHooks = {} +setmetatable(listOfHooks, { __mode = 'k' }) + +local inHook = false + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local SCRIPT_DIR = Script.GetName() .. '/' + +local function IsHook(func) + return listOfHooks[func] +end + +local function Hook(g,name) + local spGetTimer = Spring.GetTimer + local spDiffTimers = Spring.DiffTimers + local widgetName = g.whInfo.name + + local realFunc = g[name] + g["_old" .. name] = realFunc + + if (widgetName=="WidgetProfiler") then + return realFunc + end + local widgetCallinTime = callinTimes[widgetName] or {} + callinTimes[widgetName] = widgetCallinTime + widgetCallinTime[name] = widgetCallinTime[name] or {0,0} + local timeStats = widgetCallinTime[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 + +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 + + +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: OK") + + --// 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 + + 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 UpdateCallin: OK") +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 callinGadgets = wh[callin .. "List"] + for _,w in ipairs(callinGadgets or {}) do + if (w["_old" .. callin]) then + w[callin] = w["_old" .. callin] + end + end + end + + Spring.Echo("unhooked all callins: OK") + + --// unhook the UpdateCallin function + wh.UpdateWidgetCallIn = oldUpdateWidgetCallIn + wh.InsertWidget = oldInsertWidget + + Spring.Echo("unhooked UpdateCallin: OK") +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + local startTimer + + function widget:Update() + widgetHandler:RemoveWidgetCallIn("Update", self) + StartHook() + startTimer = Spring.GetTimer() + end + + function widget:Shutdown() + StopHook() + end + +local tick = 0.2 +local averageTime = 2 +local loadAverages = {} + +local function CalcLoad(old_load, new_load, t) + return old_load*math.exp(-tick/t) + new_load*(1 - math.exp(-tick/t)) +end + +local maximum = 0 +local avg = 0 +local totalLoads = {} +local allOverTime = 0 +local allOverTimeSec = 0 + +local sortedList = {} +local function SortFunc(a,b) + return a.plainname < b.plainname +end + +local maxLines = 50 +local deltaTime +local redStrength = {} + +function DrawWidgetList(list,name,x,y,j) + if j>=maxLines-5 then x = x - 350; j = 0; end + j = j + 1 + gl.Text("\255\160\255\160"..name.." WIDGETS", x+150, y-1-(12)*j, 10, "no") + j = j + 2 + + for i=1,#list do + if j>=maxLines then x = x - 350; j = 0; end + local v = list[i] + local name = v.plainname + local wname = v.fullname + local tLoad = v.tLoad + local colour = v.colourString + gl.Text(wname, x+150, y+1-(12)*j, 10, "no") + gl.Text(colour .. ('%.3f%%'):format(tLoad), x+105, y+1-(12)*j, 10, "no") + + j = j + 1 + end + + gl.Text("\255\255\064\064total load ("..string.lower(name)..")", x+150, y+1-(12)*j, 10, "no") + gl.Text("\255\255\064\064"..('%.3f%%'):format(list.allOverTime), x+105, y+1-(12)*j, 10, "no") + j = j + 1 + + return x,j +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 + +local minTime = 0.005 -- above this value, we fade in how heavy we mark a widget +local maxTime = 0.02 -- above this value, we mark a widget as heavy +local minFPS = 30 -- above this value, we fade out how red we mark heavy widgets +local maxFPS = 60 -- above this value, we don't mark any widgets red + +function CheckLoad(v) --tLoad is % + local tTime = v.tTime + local name = v.plainname + local FPS = Spring.GetFPS() + + if tTime>maxTime then tTime = maxTime end + if tTimemaxFPS then FPS = maxFPS end + if FPS=tick) then + startTimer = Spring.GetTimer() + sortedList = {} + + totalLoads = {} + maximum = 0 + avg = 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 + local load_avg = CalcLoad(loadAverages[wname] or load, load, averageTime) + loadAverages[wname] = load_avg + + allOverTimeSec = allOverTimeSec + total + + local tLoad = loadAverages[wname] + sortedList[n] = {plainname=wname, fullname=wname..'('..cmaxname..')', tLoad=tLoad, tTime=total/deltaTime} + allOverTime = allOverTime + tLoad + avg = avg + tLoad + if (maximum=maxLines-5 then x = x - 350; j = 0; end + j = j + 1 + gl.Text("\255\180\255\180TOTAL", x+150, y-1-(12)*j, 10, "no") + j = j + 1 + + if j>=maxLines-5 then x = x - 350; j = 0; end + j = j + 1 + gl.Text("\255\255\064\064total load", x+150, y-1-(12)*j, 10, "no") + gl.Text("\255\255\064\064"..('%.1f%%'):format(allOverTime), x+105, y-1-(12)*j, 10, "no") + j = j + 1 + gl.Text("\255\255\064\064total time", x+150, y-1-(12)*j, 10, "no") + gl.Text("\255\255\064\064"..('%.3fs'):format(allOverTimeSec), x+105, y-1-(12)*j, 10, "no") + gl.EndText() + + gl.PopMatrix() + end + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file 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 new file mode 100644 index 000000000..c64c6e112 --- /dev/null +++ b/LuaUI/Widgets_Evo/game_resetHotkeys.lua @@ -0,0 +1,69 @@ +function widget:GetInfo() + return { + name = "Reset Hotkeys", + desc = "Sets default hotkeys for common order elements", + author = "", + date = "", + license = "GNU LGPL, v2.1 or later", + layer = 0, + enabled = true -- loaded by default? + } +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", + }) + Spring.SendCommands("bind shift+s sell") + + -- replace guard with area guard + Spring.SendCommands({ + "unbindkeyset g", + }) + Spring.SendCommands("bind g areaguard") + + -- replace fps mode bind with capture + Spring.SendCommands({ + "unbindkeyset c", + }) + Spring.SendCommands("bind ctrl+c capture") + + + -- set repeat to be bound to q + Spring.SendCommands({ + "unbindkeyset q", + }) + Spring.SendCommands("bind q repeat") + + + -- set Priority to be bound to i + Spring.SendCommands({ + "unbindkeyset i", + }) + 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 + +end diff --git a/LuaUI/Widgets_Evo/gfx_bloom_shader.lua b/LuaUI/Widgets_Evo/gfx_bloom_shader.lua new file mode 100644 index 000000000..390224ea0 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_bloom_shader.lua @@ -0,0 +1,555 @@ +function widget:GetInfo() + return { + name = "Bloom Shader", + desc = "Sets Spring In Bloom", + author = "Floris", -- orginal bloom shader: Kloot + date = "24-9-2016", + license = "", + layer = -5, + enabled = false, + } +end + +-------------------------------------------------------------------------------- +-- config +-------------------------------------------------------------------------------- + +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 + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local drawWorldAlpha = 0 +local drawWorldPreUnitAlpha = 0 +local usedBasicAlpha = basicAlpha + +local camX, camY, camZ = Spring.GetCameraPosition() +local camDirX,camDirY,camDirZ = Spring.GetCameraDirection() + +-- shader and texture handles +local blurShaderH71 = nil +local blurShaderV71 = nil + +local brightShader = nil +local brightTexture1 = nil +local brightTexture2 = nil + +local combineShader = nil +local screenTexture = nil +local screenTextureQuarter = nil +local screenTextureSixteenth = nil + +-- speedups +local glCreateTexture = gl.CreateTexture +local glActiveTexture = gl.ActiveTexture +local glCopyToTexture = gl.CopyToTexture +local glRenderToTexture = gl.RenderToTexture +local glTexture = gl.Texture +local glTexRect = gl.TexRect + +local glUseShader = gl.UseShader + +local glUniformInt = gl.UniformInt +local glUniform = gl.Uniform +local glGetUniformLocation = gl.GetUniformLocation +local glGetActiveUniforms = gl.GetActiveUniforms + + +local GL_RGBA32F_ARB = 0x8814 +local GL_RGB32F_ARB = 0x8815 +local GL_ALPHA32F_ARB = 0x8816 +local GL_INTENSITY32F_ARB = 0x8817 +local GL_LUMINANCE32F_ARB = 0x8818 +local GL_LUMINANCE_ALPHA32F_ARB = 0x8819 +local GL_RGBA16F_ARB = 0x881A +local GL_RGB16F_ARB = 0x881B +local GL_ALPHA16F_ARB = 0x881C +local GL_INTENSITY16F_ARB = 0x881D +local GL_LUMINANCE16F_ARB = 0x881E +local GL_LUMINANCE_ALPHA16F_ARB = 0x881F +local GL_TEXTURE_RED_TYPE_ARB = 0x8C10 +local GL_TEXTURE_GREEN_TYPE_ARB = 0x8C11 +local GL_TEXTURE_BLUE_TYPE_ARB = 0x8C12 +local GL_TEXTURE_ALPHA_TYPE_ARB = 0x8C13 +local GL_TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14 +local GL_TEXTURE_INTENSITY_TYPE_ARB = 0x8C15 +local GL_TEXTURE_DEPTH_TYPE_ARB = 0x8C16 +local GL_UNSIGNED_NORMALIZED_ARB = 0x8C17 + + +-- shader uniform locations +local brightShaderText0Loc = nil +local brightShaderInvRXLoc = nil +local brightShaderInvRYLoc = nil +local brightShaderIllumLoc = nil + +local blurShaderH51Text0Loc = nil +local blurShaderH51InvRXLoc = nil +local blurShaderH51FragLoc = nil +local blurShaderV51Text0Loc = nil +local blurShaderV51InvRYLoc = nil +local blurShaderV51FragLoc = nil + +local blurShaderH71Text0Loc = nil +local blurShaderH71InvRXLoc = nil +local blurShaderH71FragLoc = nil +local blurShaderV71Text0Loc = nil +local blurShaderV71InvRYLoc = nil +local blurShaderV71FragLoc = nil + +local combineShaderDebgDrawLoc = nil +local combineShaderTexture0Loc = nil +local combineShaderTexture1Loc = nil +local combineShaderIllumLoc = nil +local combineShaderFragLoc = nil + +local illumThreshold = 0.33 +local function SetIllumThreshold() + local ra, ga, ba = gl.GetSun("ambient") + local rd, gd, bd = gl.GetSun("diffuse") + local rs, gs, bs = gl.GetSun("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 + --Spring.Echo(ambientIntensity..' '..diffuseIntensity..' '..specularIntensity) + illumThreshold = (0.33 * ambientIntensity) + (0.05 * diffuseIntensity) + (0.05 * specularIntensity) +end + +local function RemoveMe(msg) + Spring.Echo(msg) + --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 + usedBasicAlpha = basicAlpha + drawWorldAlpha = 0.035 + (usedBasicAlpha/11) + drawWorldPreUnitAlpha = 0.2 - (illumThreshold*0.4) + (usedBasicAlpha/6) + + gl.DeleteTexture(brightTexture1 or "") + gl.DeleteTexture(brightTexture2 or "") + gl.DeleteTexture(screenTexture or "") + + --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/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, + }) + screenTexture = glCreateTexture(vsx, vsy, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + }) + screenTextureQuarter = glCreateTexture(vsx/2, vsy/2, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + }) + screenTextureSixteenth = glCreateTexture(vsx/4, vsy/4, { + min_filter = GL.LINEAR, mag_filter = GL.LINEAR, + }) +end + + +function widget:ViewResize(viewSizeX, viewSizeY) + vsx,vsy = gl.GetViewSizes() + + ivsx = 1.0 / vsx + ivsy = 1.0 / vsy + kernelRadius = vsy / 80.0 + kernelRadius2 = vsy / 30.0 + + reset() +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Update(dt) + if initialized == false then return end + camX, camY, camZ = Spring.GetCameraPosition() + camDirX,camDirY,camDirZ = Spring.GetCameraDirection() +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/2) + drawWorldPreUnitAlpha*(basicAlpha*1.5)) + gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) + gl.Billboard() + 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/2) + drawWorldAlpha*(basicAlpha*1.5)) + gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) + gl.Billboard() + gl.Rect(-vsx, -vsy, vsx, vsy) + gl.PopMatrix() +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local initialized = false +function widget:Initialize() + + SetIllumThreshold() + + WG['bloom'] = {} + WG['bloom'].getBrightness = function() + return basicAlpha + end + 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'].getBlursize = function() + return globalBlursizeMult + end + 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") + return + end + + widget:ViewResize(widgetHandler:GetViewSizes()) + + + combineShader = gl.CreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D texture0; + uniform sampler2D texture1; + uniform float illuminationThreshold; + uniform float fragMaxBrightness; + uniform int debugDraw; + + void main(void) { + + vec2 C0 = vec2(gl_TexCoord[0]); + vec4 S0 = texture2D(texture0, C0); + vec4 S1 = texture2D(texture1, C0); + S1 = vec4(S1.rgb * fragMaxBrightness/max(1.0 - illuminationThreshold, 0.0001), 1.0); + + gl_FragColor = bool(debugDraw) ? S1 : S0 + S1; + } + ]], + + uniformInt = { texture0 = 0, texture1 = 1, debugDraw = 0}, + uniformFloat = {illuminationThreshold, fragMaxBrightness} + }) + + if (combineShader == nil) then + RemoveMe("[BloomShader::Initialize] combineShader compilation failed"); print(gl.GetShaderLog()); return + end + + + blurShaderH71 = gl.CreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D texture0; + uniform float inverseRX; + uniform float fragKernelRadius; + float bloomSigma = fragKernelRadius / 2.5; + + void main(void) { + vec2 C0 = vec2(gl_TexCoord[0]); + + vec4 S = texture2D(texture0, C0); + float weight = 1.0 / (2.50663 * bloomSigma); + float total_weight = weight; + S *= weight; + for (float r = 1.5; r < fragKernelRadius; r += 2) + { + weight = exp(-((r*r)/(2.0 * bloomSigma * bloomSigma)))/(2.50663 * bloomSigma); + S += texture2D(texture0, C0 - vec2(r * inverseRX, 0.0)) * weight; + S += texture2D(texture0, C0 + vec2(r * inverseRX, 0.0)) * weight; + + total_weight += 2*weight; + } + + gl_FragColor = vec4(S.rgb/total_weight, 1.0); + } + ]], + + uniformInt = {texture0 = 0}, + uniformFloat = {inverseRX, fragKernelRadius} + }) + + if (blurShaderH71 == nil) then + RemoveMe("[BloomShader::Initialize] blurShaderH71 compilation failed"); print(gl.GetShaderLog()); return + end + + blurShaderV71 = gl.CreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D texture0; + uniform float inverseRY; + uniform float fragKernelRadius; + float bloomSigma = fragKernelRadius / 2.5; + + void main(void) { + vec2 C0 = vec2(gl_TexCoord[0]); + + vec4 S = texture2D(texture0, C0); + float weight = 1.0 / (2.50663 * bloomSigma); + float total_weight = weight; + S *= weight; + for (float r = 1.5; r < fragKernelRadius; r += 2) + { + weight = exp(-((r*r)/(2.0 * bloomSigma * bloomSigma)))/(2.50663 * bloomSigma); + S += texture2D(texture0, C0 - vec2(0.0, r * inverseRY)) * weight; + S += texture2D(texture0, C0 + vec2(0.0, r * inverseRY)) * weight; + + total_weight += 2*weight; + } + + gl_FragColor = vec4(S.rgb/total_weight, 1.0); + } + ]], + + uniformInt = {texture0 = 0}, + uniformFloat = {inverseRY, fragKernelRadius} + }) + + if (blurShaderV71 == nil) then + RemoveMe("[BloomShader::Initialize] blurShaderV71 compilation failed"); print(gl.GetShaderLog()); return + end + + brightShader = gl.CreateShader({ + fragment = [[ + #version 150 compatibility + uniform sampler2D texture0; + uniform float illuminationThreshold; + uniform float inverseRX; + uniform float inverseRY; + + void main(void) { + vec2 C0 = vec2(gl_TexCoord[0]); + vec3 color = vec3(texture2D(texture0, C0)); + float illum = dot(color, vec3(0.2990, 0.5870, 0.1140)); + + if (illum > illuminationThreshold) { + gl_FragColor = vec4((color - color*(illuminationThreshold/max(illum, 0.00001))), 1.0); + } else { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + ]], + + uniformInt = {texture0 = 0}, + uniformFloat = {illuminationThreshold, inverseRX, inverseRY} + }) + + if (brightShader == nil) then + RemoveMe("[BloomShader::Initialize] brightShader compilation failed"); print(gl.GetShaderLog()); return + end + + brightShaderText0Loc = glGetUniformLocation(brightShader, "texture0") + brightShaderInvRXLoc = glGetUniformLocation(brightShader, "inverseRX") + brightShaderInvRYLoc = glGetUniformLocation(brightShader, "inverseRY") + brightShaderIllumLoc = glGetUniformLocation(brightShader, "illuminationThreshold") + + blurShaderH71Text0Loc = glGetUniformLocation(blurShaderH71, "texture0") + blurShaderH71InvRXLoc = glGetUniformLocation(blurShaderH71, "inverseRX") + blurShaderH71FragLoc = glGetUniformLocation(blurShaderH71, "fragKernelRadius") + blurShaderV71Text0Loc = glGetUniformLocation(blurShaderV71, "texture0") + blurShaderV71InvRYLoc = glGetUniformLocation(blurShaderV71, "inverseRY") + blurShaderV71FragLoc = glGetUniformLocation(blurShaderV71, "fragKernelRadius") + + combineShaderDebgDrawLoc = glGetUniformLocation(combineShader, "debugDraw") + combineShaderTexture0Loc = glGetUniformLocation(combineShader, "texture0") + combineShaderTexture1Loc = glGetUniformLocation(combineShader, "texture1") + combineShaderIllumLoc = glGetUniformLocation(combineShader, "illuminationThreshold") + combineShaderFragLoc = glGetUniformLocation(combineShader, "fragMaxBrightness") + + initialized = true +end + +function widget:Shutdown() + if initialized then + gl.DeleteTexture(brightTexture1 or "") + gl.DeleteTexture(brightTexture2 or "") + gl.DeleteTexture(screenTexture or "") + + if (gl.DeleteShader) then + gl.DeleteShader(brightShader or 0) + gl.DeleteShader(blurShaderH71 or 0) + gl.DeleteShader(blurShaderV71 or 0) + gl.DeleteShader(combineShader or 0) + end + end + WG['bloom'] = nil +end + + + +local function mglDrawTexture(texUnit, tex, w, h, flipS, flipT) + glTexture(texUnit, tex) + glTexRect(0, 0, w, h, flipS, flipT) + glTexture(texUnit, false) +end + +local function mglDrawFBOTexture(tex) + glTexture(tex) + glTexRect(-1, -1, 1, 1) + glTexture(false) +end + + +local function activeTextureFunc(texUnit, tex, w, h, flipS, flipT) + glTexture(texUnit, tex) + glTexRect(0, 0, w, h, flipS, flipT) + glTexture(texUnit, false) +end + +local function mglActiveTexture(texUnit, tex, w, h, flipS, flipT) + glActiveTexture(texUnit, activeTextureFunc, texUnit, tex, w, h, flipS, flipT) +end + + +local function renderToTextureFunc(tex, s, t) + glTexture(tex) + glTexRect(-1 * s, -1 * t, 1 * s, 1 * t) + glTexture(false) +end + +local function mglRenderToTexture(FBOTex, tex, s, t) + glRenderToTexture(FBOTex, renderToTextureFunc, tex, s, t) +end + + + + +local function Bloom() + gl.Color(1, 1, 1, 1) + + glCopyToTexture(screenTexture, 0, 0, 0, 0, vsx, vsy) + + -- global bloomin + glUseShader(brightShader) + glUniformInt(brightShaderText0Loc, 0) + glUniform( brightShaderInvRXLoc, ivsx) + glUniform( brightShaderInvRYLoc, ivsy) + glUniform( brightShaderIllumLoc, illumThreshold) + mglRenderToTexture(brightTexture1, screenTexture, 1, -1) + glUseShader(0) + + for i = 1, blurPasses do + glUseShader(blurShaderH71) + glUniformInt(blurShaderH71Text0Loc, 0) + glUniform( blurShaderH71InvRXLoc, ivsx) + glUniform( blurShaderH71FragLoc, kernelRadius*blursize*globalBlursizeMult) + mglRenderToTexture(brightTexture2, brightTexture1, 1, -1) + glUseShader(0) + glUseShader(blurShaderV71) + glUniformInt(blurShaderV71Text0Loc, 0) + glUniform( blurShaderV71InvRYLoc, ivsy) + glUniform( blurShaderV71FragLoc, kernelRadius*blursize*globalBlursizeMult) + mglRenderToTexture(brightTexture1, brightTexture2, 1, -1) + glUseShader(0) + end + + glUseShader(combineShader) + glUniformInt(combineShaderDebgDrawLoc, dbgDraw) + glUniformInt(combineShaderTexture0Loc, 0) + glUniformInt(combineShaderTexture1Loc, 1) + glUniform( combineShaderIllumLoc, illumThreshold) + glUniform( combineShaderFragLoc, usedBasicAlpha) + mglActiveTexture(0, screenTexture, vsx, vsy, false, true) + mglActiveTexture(1, brightTexture1, vsx, vsy, false, true) + glUseShader(0) +end + +function widget:DrawScreenEffects() + if initialized == false then return end + Bloom() +end + +function widget:GetConfigData(data) + savedTable = {} + savedTable.basicAlpha = basicAlpha + savedTable.qualityPreset = qualityPreset + savedTable.globalBlursizeMult = globalBlursizeMult + return savedTable +end + +function widget:SetConfigData(data) + if data.basicAlpha ~= nil then + basicAlpha = data.basicAlpha + 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_commands_fx.lua b/LuaUI/Widgets_Evo/gfx_commands_fx.lua deleted file mode 100644 index df5c84cc1..000000000 --- a/LuaUI/Widgets_Evo/gfx_commands_fx.lua +++ /dev/null @@ -1,488 +0,0 @@ -function widget:GetInfo() - return { - name = "Commands FX Original", - desc = "Adds glow-pulses wherever commands are queued. Including mapmarks.", - author = "Floris", - date = "14.04.2014", - license = "GNU GPL, v2 or later", - layer = 2, - enabled = true, - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- NOTE: STILL IN DEVELOPMENT! --- dont change without asking/permission please - -VFS.Include("LuaRules/Configs/customcmds.h.lua") - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local commandHistory = {} -local commandHistoryCoords = {} -- this table is used to count cmd´s with same coordinates -local commandCoordsRendered = {} -- this table is used to skip cmd´s that have the same coordinates -local mapDrawNicknameTime = {} -- this table is used to filter out previous map drawing nicknames if user has drawn something new -local mapEraseNicknameTime = {} -- -local ownPlayerID = Spring.GetMyPlayerID() - -local commandCount = 0 -local commandList = {} - -local spGetUnitPosition = Spring.GetUnitPosition -local spGetCameraPosition = Spring.GetCameraPosition -local spGetUnitCommands = Spring.GetUnitCommands -local spGetPlayerInfo = Spring.GetPlayerInfo -local spTraceScreenRay = Spring.TraceScreenRay -local spLoadCmdColorsConfig = Spring.LoadCmdColorsConfig -local spGetTeamColor = Spring.GetTeamColor - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -options_path = 'Settings/Interface/Command Visibility/Formations' -options_order = { 'indicate_cf', 'onClick'} -options = { - indicate_cf = { - name = "Indicate for custom formations", - desc = "Draw the command indication for commands given with custom formations.", - type = 'bool', - value = false - }, - onClick = { - name = "Indicate for clicks", - desc = "Draw the command indication for every click.", - type = 'bool', - value = false - } -} --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local OPTIONS = { - showMapmarkFx = true, - showMapmarkSpecNames = true, - showMapmarkSpecIcons = false, -- showMapmarkFx must be true for this to work - nicknameOpacityMultiplier = 6, -- multiplier applied to the given color opacity of the type: 'map_draw' - scaleWithCamera = true, - - size = 28, - opacity = 1, - duration = 0.7, -- each type has its own duration, but this settings applies to all - - baseParts = 14, -- (note that if camera is distant the number of parts will be reduced, up to 6 as minimum) - ringParts = 24, -- (note that if camera is distant the number of parts will be reduced, up to 6 as minimum) - ringWidth = 2, - ringStartSize = 4, - ringScale = 0.75, - reduceOverlapEffect = 0.08, -- when spotters have the same coordinates: reduce the opacity: 1 is no reducing while 0 is no adding - - types = { - leftclick = { - size = 0.58, - duration = 1, - baseColor = {1.00 ,0.50 ,0.00 ,0.28}, - ringColor = {1.00 ,0.50 ,0.00 ,0.12} - }, - rightclick = { - size = 0.58, - duration = 1, - baseColor = {1.00 ,0.75 ,0.00 ,0.25}, - ringColor = {1.00 ,0.75 ,0.00 ,0.11} - }, - map_mark = { - size = 2, - duration = 4.5, - baseColor = {1.00 ,1.00 ,1.00 ,0.40}, - ringColor = {1.00 ,1.00 ,1.00 ,0.75} - }, - map_draw = { - size = 0.63, - duration = 1.4, - baseColor = {1.00 ,1.00 ,1.00 ,0.15}, - ringColor = {1.00 ,1.00 ,1.00 ,0.00} - }, - map_erase = { - size = 2, - duration = 3, - baseColor = {1.00 ,1.00 ,1.00 ,0.13}, - ringColor = {1.00 ,1.00 ,1.00 ,0.00} - }, - [CMD.MOVE] = { - size = 1, - duration = 1, - baseColor = {0.00 ,1.00 ,0.00 ,0.25}, - ringColor = {0.00 ,1.00 ,0.00 ,0.25} - }, - [CMD.FIGHT] = { - size = 1.2, - duration = 1, - baseColor = {0.20 ,0.60 ,1.00 ,0.30}, - ringColor = {0.20 ,0.60 ,1.00 ,0.40} - }, - [CMD.DGUN] = { - size = 1.4, - duration = 1, - baseColor = {1.00 ,0.00 ,0.00 ,0.30}, - ringColor = {1.00 ,0.00 ,0.00 ,0.40} - }, - [CMD.ATTACK] = { - size = 1.4, - duration = 1, - baseColor = {1.00 ,0.00 ,0.00 ,0.30}, - ringColor = {1.00 ,0.00 ,0.00 ,0.40} - }, - [CMD.PATROL] = { - size = 1.4, - duration = 1, - baseColor = {0.40 ,0.40 ,1.00 ,0.30}, - ringColor = {0.40 ,0.40 ,1.00 ,0.40} - }, - [CMD_JUMP] = { - size = 1.2, - duration = 1, - baseColor = {0.00 ,1.00 ,1.00 ,0.25}, - ringColor = {0.00 ,1.00 ,1.00 ,0.25} - }, - [CMD_PLACE_BEACON] = { - size = 1.2, - duration = 1, - baseColor = {0.10 ,0.80 ,0.80 ,0.25}, - ringColor = {0.10 ,0.80 ,0.80 ,0.25} - }, - [CMD_WAIT_AT_BEACON] = { - size = 1.2, - duration = 1, - baseColor = {0.10 ,0.10 ,0.90 ,0.25}, - ringColor = {0.10 ,0.10 ,0.90 ,0.25} - }, - [CMD_UNIT_SET_TARGET] = { - size = 1.2, - duration = 1, - baseColor = {0.80 ,0.80 ,0.10 ,0.25}, - ringColor = {0.80 ,0.80 ,0.10 ,0.25} - }, - [CMD_UNIT_SET_TARGET_CIRCLE] = { - size = 1.2, - duration = 1, - baseColor = {0.80 ,0.80 ,0.10 ,0.25}, - ringColor = {0.80 ,0.80 ,0.10 ,0.25} - }, - } -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -function Round(num, idp) - local mult = 10^(idp or 0) - return math.floor(num * mult + 0.5) / mult -end - - -local function DrawBaseGlow(parts, size, r,g,b,a) - gl.Color(r,g,b,a) - gl.Vertex(0, 0, 0) - gl.Color(r,g,b,0) - local radstep = (2.0 * math.pi) / parts - for i = 0, parts do - local a1 = (i * radstep) - gl.Vertex(math.sin(a1)*size, 0, math.cos(a1)*size) - end -end - - -local function DrawRingCircle(parts, ringSize, ringInnerSize, ringOuterSize, rRing,gRing,bRing,aRing) - local radstep = (2.0 * math.pi) / parts - for i = 1, parts do - local a1 = (i * radstep) - local a2 = ((i+1) * radstep) - - local a1Sin = math.sin(a1) - local a2Sin = math.sin(a2) - - a1 = math.cos(a1) - a2 = math.cos(a2) - - --(fadefrom) - gl.Color(rRing,gRing,bRing,0) - gl.Vertex(a2Sin*ringInnerSize, 0, a2*ringInnerSize) - gl.Vertex(a1Sin*ringInnerSize, 0, a1*ringInnerSize) - --(fadeto) - gl.Color(rRing,gRing,bRing,aRing) - gl.Vertex(a1Sin*ringSize, 0, a1*ringSize) - gl.Vertex(a2Sin*ringSize, 0, a2*ringSize) - - --(fadefrom) - gl.Color(rRing,gRing,bRing,aRing) - gl.Vertex(a1Sin*ringSize, 0, a1*ringSize) - gl.Vertex(a2Sin*ringSize, 0, a2*ringSize) - --(fadeto) - gl.Color(rRing,gRing,bRing,0) - gl.Vertex(a2Sin*ringOuterSize, 0, a2*ringOuterSize) - gl.Vertex(a1Sin*ringOuterSize, 0, a1*ringOuterSize) - end -end - -local function CircleVerticies(circleDivs) - for i = 1, circleDivs do - local theta = 2 * math.pi * i / circleDivs - gl.Vertex(math.cos(theta), 0, math.sin(theta)) - end -end - -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 function AddCommandSpotter(cmdType, x, y, z, osClock, unitID, playerID) - if not unitID then - unitID = 0 - end - if not playerID then - playerID = false - end - --local uniqueNumber = unitID..'_'..osClock .. math.random() - --commandHistory[uniqueNumber] = { - -- cmdType = cmdType, - -- x = x, - -- y = y, - -- z = z, - -- osClock = osClock, - -- playerID = playerID - --} - - commandCount = commandCount + 1 - commandList[commandCount] = { - cmdType = cmdType, - x = x, - y = y, - z = z, - osClock = osClock, - playerID = playerID - } - - if commandHistoryCoords[cmdType..x..y..z] then - commandHistoryCoords[cmdType..x..y..z] = commandHistoryCoords[cmdType..x..y..z] + 1 - else - commandHistoryCoords[cmdType..x..y..z] = 1 - end -end - ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- - --- Engine Triggers - ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- - -local circleDrawList - -function widget:Initialize() - circleDrawList = gl.CreateList(gl.BeginEnd, GL.LINE_LOOP, CircleVerticies, 18) -end - -function widget:MapDrawCmd(playerID, cmdType, x, y, z, a, b, c) - local osClock = os.clock() - if OPTIONS.showMapmarkFx then - if cmdType == 'point' then - AddCommandSpotter('map_mark', x, y, z, osClock, false, playerID) - elseif cmdType == 'line' then - mapDrawNicknameTime[playerID] = osClock - AddCommandSpotter('map_draw', x, y, z, osClock, false, playerID) - elseif cmdType == 'erase' then - mapEraseNicknameTime[playerID] = osClock - AddCommandSpotter('map_erase', x, y, z, osClock, false, playerID) - end - end -end - -function widget:MousePress(x, y, button) - if options.onClick.value then - local traceType, tracedScreenRay = spTraceScreenRay(x, y, true) - if button == 1 and tracedScreenRay and tracedScreenRay[3] then - AddCommandSpotter('leftclick', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) - end - if button == 3 and tracedScreenRay and tracedScreenRay[3] then - AddCommandSpotter('rightclick', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) - end - end -end - -function widget:CommandNotify(cmdID, cmdParams, options) - if type(cmdParams) == 'table' and #cmdParams >= 3 and OPTIONS.types[cmdID] then - AddCommandSpotter(cmdID, cmdParams[1], cmdParams[2], cmdParams[3], os.clock()) - end -end - -function widget:UnitCommandNotify(unitID, cmdID, cmdParams, cmdOptions) - if options.indicate_cf.value then - if type(cmdParams) == 'table' and #cmdParams >= 3 and OPTIONS.types[cmdID] then - AddCommandSpotter(cmdID, cmdParams[1], cmdParams[2], cmdParams[3], os.clock(), unitID) - end - end -end - ---function widget:GameFrame(f) --- AddCommandSpotter(CMD.MOVE, (f%25)*40+40, 48, (math.floor(f/25)%25)*40+40, os.clock()) ---end - -function widget:DrawWorldPreUnit() - - local osClock = os.clock() - --local camX, camY, camZ = spGetCameraPosition() - gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) - gl.DepthTest(false) - - commandCoordsRendered = {} - - local index = 1 - while index <= commandCount do - local cmdValue = commandList[index] - --for cmdKey, cmdValue in pairs(commandHistory) do - - local clickOsClock = cmdValue.osClock - local cmdType = cmdValue.cmdType - local playerID = cmdValue.playerID - local duration = OPTIONS.types[cmdType].duration * OPTIONS.duration - - -- remove when duration has passed - if osClock - clickOsClock > duration then - if commandHistoryCoords[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] <= 1 then - commandHistoryCoords[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] = nil - else - commandHistoryCoords[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] = commandHistoryCoords[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] - 1 - end - --commandHistory[cmdKey] = nil - - commandList[index] = commandList[commandCount] - commandList[commandCount] = nil - commandCount = commandCount - 1 - - -- remove nicknames when user has drawn something new - elseif OPTIONS.showMapmarkSpecNames and cmdType == 'map_draw' and mapDrawNicknameTime[playerID] ~= nil and clickOsClock < mapDrawNicknameTime[playerID] then - - --commandHistory[cmdKey] = nil - commandList[index] = commandList[commandCount] - commandList[commandCount] = nil - commandCount = commandCount - 1 - - -- draw all - elseif OPTIONS.types[cmdType].baseColor[4] > 0 or OPTIONS.types[cmdType].ringColor[4] > 0 then - index = index + 1 - - if commandCoordsRendered[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] == nil then - commandCoordsRendered[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] = true - local alphaMultiplier = 1 + (OPTIONS.reduceOverlapEffect * (commandHistoryCoords[cmdType..cmdValue.x..cmdValue.y..cmdValue.z] - 1)) -- add a bit to the multiplier for each cmd issued on the same coords - - local size = OPTIONS.size * OPTIONS.types[cmdType].size - local a = (1 - ((osClock - clickOsClock) / duration)) * OPTIONS.opacity * alphaMultiplier - - local baseColor = OPTIONS.types[cmdType].baseColor - local ringColor = OPTIONS.types[cmdType].ringColor - - -- use player colors - if cmdType == 'map_mark' or cmdType == 'map_draw' or cmdType == 'map_erase' then - local _,_,spec,teamID = spGetPlayerInfo(playerID) - local r,g,b = 1,1,1 - if not spec then - r,g,b = spGetTeamColor(teamID) - end - baseColor = {1,1,1,baseColor[4]} - ringColor = {r,g,b,ringColor[4]} - end - - local rRing = ringColor[1] - local gRing = ringColor[2] - local bRing = ringColor[3] - local aRing = a * ringColor[4] - local r = baseColor[1] - local g = baseColor[2] - local b = baseColor[3] - a = a * baseColor[4] - - local ringSize = OPTIONS.ringStartSize + (size * OPTIONS.ringScale) * ((osClock - clickOsClock) / duration) - --local ringInnerSize = ringSize - OPTIONS.ringWidth - --local ringOuterSize = ringSize + OPTIONS.ringWidth - - gl.PushMatrix() - gl.Translate(cmdValue.x, cmdValue.y, cmdValue.z) - - --local xDifference = camX - cmdValue.x - --local yDifference = camY - cmdValue.y - --local zDifference = camZ - cmdValue.z - --local camDistance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) - local camDistance = 4000 - - -- set scale (based on camera distance) - local scale = 1 - if OPTIONS.scaleWithCamera and camZ then - scale = 0.82 + camDistance / 7500 - gl.Scale(scale,scale,scale) - end - local parts = 8 - - -- base glow - if baseColor[4] > 0 then - --local parts = Round(((OPTIONS.baseParts - (camDistance / 800)) + (size / 20)) * scale) - --if parts < 6 then parts = 6 end - gl.BeginEnd(GL.TRIANGLE_FAN, DrawBaseGlow, parts, size, r,g,b,a) - end - - -- ring circle: - if aRing > 0 then - --local parts = Round(((OPTIONS.ringParts - (camDistance / 800)) + (ringSize / 10)) * scale) - ----parts = parts * (ringSize / (size*OPTIONS.ringScale)) -- this reduces parts when ring is little, but introduces temporary gaps when a part is added - --if parts < 6 then parts = 6 end - gl.Color(rRing,gRing,bRing,aRing) - gl.Scale(ringSize,ringSize,ringSize) - gl.LineWidth(OPTIONS.ringWidth) - gl.CallList(circleDrawList) - --gl.BeginEnd(GL.QUADS, DrawRingCircle, parts, ringSize, ringInnerSize, ringOuterSize, rRing,gRing,bRing,aRing) - end - - -- draw + erase: nickname / draw icon - if playerID and playerID ~= ownPlayerID and OPTIONS.showMapmarkSpecNames and (cmdType == 'map_draw' or cmdType == 'map_erase' and clickOsClock >= mapEraseNicknameTime[playerID]) then - - local nickname,_,spec = spGetPlayerInfo(playerID) - if (spec) then - gl.Color(r,g,b, a * OPTIONS.nicknameOpacityMultiplier) - - if OPTIONS.showMapmarkSpecIcons then - if cmdType == 'map_draw' then - gl.Texture('LuaUI/Images/drawingcursors/pencil.png') - else - gl.Texture('LuaUI/Images/drawingcursors/eraser.png') - end - local iconSize = 11 - gl.BeginEnd(GL.QUADS,DrawGroundquad,iconSize,-iconSize,-iconSize,iconSize) - gl.Texture(false) - end - - gl.Billboard() - gl.Text(nickname, 0, -28, 20, "cn") - - end - end - gl.PopMatrix() - - end - end - end - - gl.LineWidth(1) - gl.Scale(1,1,1) - gl.Color(1,1,1,1) -end - diff --git a/LuaUI/Widgets_Evo/gfx_darken_map.lua b/LuaUI/Widgets_Evo/gfx_darken_map.lua new file mode 100644 index 000000000..3c527367e --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_darken_map.lua @@ -0,0 +1,147 @@ + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Darken map", + desc = "darkens the map, not units", + author = "Floris", + date = "2015", + license = "GNU GPL, v2 or later", + layer = 10000, + enabled = true -- loaded by default? + } +end + + +local darknessvalue = 0 +local maxDarkness = 0.6 +local darkenFeatures = false + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local currentMapname = Game.mapName:lower() +local maps = {} +local gaia = Spring.GetGaiaTeamID() + +local camX, camY, camZ = Spring.GetCameraPosition() +local camDirX,camDirY,camDirZ = Spring.GetCameraDirection() + +function widget:Shutdown() + WG['darkenmap'] = nil +end + +function widget:Initialize() + WG['darkenmap'] = {} + WG['darkenmap'].getMapDarkness = function() + return darknessvalue + end + WG['darkenmap'].setMapDarkness = function(value) + darknessvalue = tonumber(value) + maps[currentMapname] = darknessvalue + end + WG['darkenmap'].getDarkenFeatures = function() + return darkenFeatures + end + WG['darkenmap'].setDarkenFeatures = function(value) + darkenFeatures = value + end + + widgetHandler:AddAction("mapdarkness", mapDarkness, nil, "t") +end + + +function mapDarkness(_,_,params) + if #params == 1 then + if type(tonumber(params[1])) == "number" then + darknessvalue = tonumber(params[1]) + if darknessvalue > maxDarkness then + darknessvalue = maxDarkness + end + maps[currentMapname] = darknessvalue + end + end +end + + +local prevCam = {} +prevCam[1],prevCam[2],prevCam[3] = Spring.GetCameraPosition() +function widget:Update(dt) + 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 + + gl.PushMatrix() + gl.Color(0,0,0,darknessvalue) + gl.Translate(camX+(camDirX*360),camY+(camDirY*360),camZ+(camDirZ*360)) + gl.Billboard() + gl.Rect(-500, -500, 500, 500) + gl.PopMatrix() + end +end + +local spGetFeatureDefID = Spring.GetFeatureDefID +function widget:DrawWorld() + if darkenFeatures and darknessvalue >= 0.01 then + if features == nil then + 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 + local fdefID = spGetFeatureDefID(featureID) + if fdefID then + gl.Texture('%-'..fdefID..':1') + gl.Feature(featureID, true) + end + end + gl.PolygonOffset(false) + gl.DepthTest(false) + gl.Texture(false) + end + end +end + + +function widget:GetConfigData(data) + savedTable = {} + savedTable.maps = maps + savedTable.darkenFeatures = darkenFeatures + return savedTable +end + +function widget:SetConfigData(data) + if data.maps ~= nil then + maps = data.maps + if data.darkenFeatures ~= nil then + darkenFeatures = data.darkenFeatures + end + if data.maps[currentMapname] ~= nil then + darknessvalue = data.maps[currentMapname] + end + end +end + + +function widget:TextCommand(command) + if (string.find(command, "resetmapdarkness") == 1 and string.len(command) == 16) then + maps = {} + darknessvalue = 0 + end +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua b/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua new file mode 100644 index 000000000..2078e1157 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_deferred_rendering.lua @@ -0,0 +1,532 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Deferred rendering", + version = 3, + desc = "Collects and renders point and beam lights", + author = "beherith, aeonios", + date = "2015 Sept.", + license = "GPL V2", + layer = -1000000000, + enabled = true + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local glBeginEnd = gl.BeginEnd +local glBillboard = gl.Billboard +local glBlending = gl.Blending +local glCallList = gl.CallList +local glClear = gl.Clear +local glColor = gl.Color +local glCreateList = gl.CreateList +local glCreateShader = gl.CreateShader +local glCreateTexture = gl.CreateTexture +local glDeleteShader = gl.DeleteShader +local glDeleteTexture = gl.DeleteTexture +local glDepthMask = gl.DepthMask +local glDepthTest = gl.DepthTest +local glGetShaderLog = gl.GetShaderLog +local glGetUniformLocation = gl.GetUniformLocation +local glGetViewSizes = gl.GetViewSizes +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glTexCoord = gl.TexCoord +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glRect = gl.Rect +local glRenderToTexture = gl.RenderToTexture +local glUniform = gl.Uniform +local glUniformInt = gl.UniformInt +local glUniformMatrix = gl.UniformMatrix +local glUseShader = gl.UseShader +local glVertex = gl.Vertex +local glTranslate = gl.Translate +local spEcho = Spring.Echo +local spGetCameraPosition = Spring.GetCameraPosition +local spWorldToScreenCoords = Spring.WorldToScreenCoords + + +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 + +local vsx, vsy +local ivsx = 1.0 +local ivsy = 1.0 +local screenratio = 1.0 + +-- dynamic light shaders +local depthPointShader = nil +local depthBeamShader = nil + +-- shader uniforms +local lightposlocPoint = nil +local lightcolorlocPoint = nil +local lightparamslocPoint = nil +local uniformEyePosPoint +local uniformViewPrjInvPoint + +local lightposlocBeam = nil +local lightpos2locBeam = nil +local lightcolorlocBeam = nil +local lightparamslocBeam = nil +local uniformEyePosBeam +local uniformViewPrjInvBeam + +-------------------------------------------------------------------------------- +--Light falloff functions: http://gamedev.stackexchange.com/questions/56897/glsl-light-attenuation-color-and-intensity-formula +-------------------------------------------------------------------------------- + +local verbose = false +local function VerboseEcho(...) + if verbose then + Spring.Echo(...) + end +end + +local collectionFunctions = {} +local collectionFunctionCount = 0 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:ViewResize() + vsx, vsy = gl.GetViewSizes() + ivsx = 1.0 / vsx --we can do /n here! + ivsy = 1.0 / vsy + if (Spring.GetMiniMapDualScreen() == 'left') then + vsx = vsx / 2 + end + if (Spring.GetMiniMapDualScreen() == 'right') then + vsx = vsx / 2 + end + screenratio = vsy / vsx --so we dont overdraw and only always draw a square +end + +widget:ViewResize() + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local vertSrc = [[ + void main(void) + { + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_Vertex; + } +]] +local fragSrc = [[ +//This code authored by Peter Sarkozy aka Beherith (mysterme@gmail.com ) +//License is GPL V2 +// old version with calced normals is 67 fps for 10 beamers full screen at 1440p +// new version with buffered normals is 88 fps for 10 beamers full screen at 1440p + + +//#define DEBUG + +#define LIGHTRADIUS lightpos.w +uniform sampler2D modelnormals; +uniform sampler2D modeldepths; +uniform sampler2D mapnormals; +uniform sampler2D mapdepths; +uniform sampler2D modelExtra; + +uniform vec3 eyePos; +uniform vec4 lightpos; +#if (BEAM_LIGHT == 1) + uniform vec4 lightpos2; +#endif +uniform vec4 lightcolor; +uniform mat4 viewProjectionInv; + +float attenuate(float dist, float radius) { + // float raw = constant-linear * dist / radius - squared * dist * dist / (radius * radius); + // float att = clamp(raw, 0.0, 0.5); + float raw = 0.7 - 0.3 * dist / radius - 1.0 * dist * dist / (radius * radius); + float att = clamp(raw, 0.0, 1.0); + return (att * att); +} + +void main(void) +{ + float mapDepth = texture2D( mapdepths, gl_TexCoord[0].st).x; + float mdlDepth = texture2D(modeldepths, gl_TexCoord[0].st).x; + + #if (CLIP_CONTROL == 1) + vec4 mappos4 = vec4( vec3(gl_TexCoord[0].st * 2.0 - 1.0, mapDepth), 1.0); + vec4 modelpos4 = vec4( vec3(gl_TexCoord[0].st * 2.0 - 1.0, mdlDepth), 1.0); + #else + vec4 mappos4 = vec4( vec3(gl_TexCoord[0].st, mapDepth) * 2.0 - 1.0, 1.0); + vec4 modelpos4 = vec4( vec3(gl_TexCoord[0].st, mdlDepth) * 2.0 - 1.0, 1.0); + #endif + + vec4 map_normals4 = texture2D(mapnormals , gl_TexCoord[0].st) * 2.0 - 1.0; + vec4 model_normals4 = texture2D(modelnormals, gl_TexCoord[0].st) * 2.0 - 1.0; + vec4 model_extra4 = texture2D(modelExtra , gl_TexCoord[0].st) * 2.0 - 1.0; + + + float specularHighlight = 1.0; + float model_lighting_multiplier = 1.0; //models recieve additional lighting, looks better. + + + if ((mappos4.z - modelpos4.z) > 0.0) { + // this means we are processing a model fragment, not a map fragment + if (model_extra4.a > 0.5) { + map_normals4 = model_normals4; + mappos4 = modelpos4; + model_lighting_multiplier = 1.5; + specularHighlight = specularHighlight + 2.0 * model_extra4.g; + } + } + + + mappos4 = viewProjectionInv * mappos4; + mappos4.xyz = mappos4.xyz / mappos4.w; + + vec3 light_direction; + + #if (BEAM_LIGHT == 0) + light_direction = normalize(lightpos.xyz - mappos4.xyz); + + float dist_light_here = dot(lightpos.xyz - mappos4.xyz, light_direction); + float cosphi = max(0.0, dot(normalize(map_normals4.xyz), light_direction)); + float attenuation = attenuate(dist_light_here, LIGHTRADIUS); + + #else + + /*distance( Point P, Segment P0:P1 ) // http://geomalgorithms.com/a02-_lines.html + { + v = P1 - P0 + w = P - P0 + if ( (c1 = w dot v) <= 0 ) // before P0 + return d(P, P0) + if ( (c2 = v dot v) <= c1 ) // after P1 + return d(P, P1) + b = c1 / c2 + Pb = P0 + bv + return d(P, Pb) + } + */ + + vec3 v = lightpos2.xyz - lightpos.xyz; + vec3 w = mappos4.xyz - lightpos.xyz; + float c1 = dot(v, w); + float c2 = dot(v, v); + + if (c1 <= 0.0){ + v = mappos4.xyz; + w = lightpos.xyz; + } else if (c2 < c1) { + v = mappos4.xyz; + w = lightpos2.xyz; + } else { + w = lightpos.xyz + (c1 / c2) * v; + v = mappos4.xyz; + } + + light_direction = normalize(w.xyz - v.xyz); + + float dist_light_here = dot(w - v, light_direction); + float cosphi = max(0.0, dot(normalize(map_normals4.xyz), light_direction)); + // float attenuation = max(0.0, (1.0 * LIGHT_CONSTANT - LIGHT_SQUARED * (dist_light_here * dist_light_here) / (LIGHTRADIUS * LIGHTRADIUS) - LIGHT_LINEAR * (dist_light_here) / (LIGHTRADIUS))); + float attenuation = attenuate(dist_light_here, LIGHTRADIUS); + #endif + + vec3 viewDirection = normalize(vec3(eyePos - mappos4.xyz)); + + // light source on the wrong side? + if (dot(map_normals4.xyz, light_direction) > 0.02) { + vec3 reflection = reflect(-1.0 * light_direction, map_normals4.xyz); + + float glossiness = dot(reflection, viewDirection); + float highlight = pow(max(0.0, glossiness), 8.0); + + specularHighlight *= (0.5 * highlight); + } else { + specularHighlight = 0.0; + } + + + //OK, our blending func is the following: Rr=Lr*Dr+1*Dr + float lightalpha = cosphi * attenuation + attenuation * specularHighlight; + //dont light underwater: + lightalpha = clamp(lightalpha, 0.0, lightalpha * ((mappos4.y + 50.0) * (0.02))); + + gl_FragColor = vec4(lightcolor.rgb * lightalpha * model_lighting_multiplier, 1.0); + + #ifdef DEBUG + gl_FragColor = vec4(map_normals4.xyz, 1.0); //world normals debugging + gl_FragColor = vec4(fract(modelpos4.z * 0.01),sign(mappos4.z - modelpos4.z), 0.0, 1.0); //world pos debugging, very useful + if (length(lightcolor.rgb * lightalpha * model_lighting_multiplier) < (1.0 / 256.0)){ //shows light boudaries + gl_FragColor=vec4(vec3(0.5, 0.0, 0.5), 0.0); + } + #endif +} + +]] +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function DeferredLighting_RegisterFunction(func) + collectionFunctionCount = collectionFunctionCount + 1 + collectionFunctions[collectionFunctionCount] = func +end + +function widget:Initialize() + + if (glCreateShader == nil) then + Spring.Echo('Deferred Rendering requires shader support!') + widgetHandler:RemoveWidget(self) + return + end + + Spring.SetConfigInt("AllowDeferredMapRendering", 1) + Spring.SetConfigInt("AllowDeferredModelRendering", 1) + + 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(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(self) + else + depthPointShader = depthPointShader or glCreateShader({ + defines = { + "#version 120\n", + "#define BEAM_LIGHT 0\n", + "#define CLIP_CONTROL " .. (Platform ~= nil and Platform.glSupportClipSpaceControl and 1 or 0) .. "\n" + }, + vertex = vertSrc, + fragment = fragSrc, + uniformInt = { + modelnormals = 0, + modeldepths = 1, + mapnormals = 2, + mapdepths = 3, + modelExtra = 4, + }, + }) + + if (not depthPointShader) then + spEcho(glGetShaderLog()) + spEcho("gfx_deferred_rendering.lua: Bad depth point shader, removing self.") + GLSLRenderer = false + widgetHandler:RemoveWidget(self) + else + lightposlocPoint = glGetUniformLocation(depthPointShader, "lightpos") + lightcolorlocPoint = glGetUniformLocation(depthPointShader, "lightcolor") + uniformEyePosPoint = glGetUniformLocation(depthPointShader, 'eyePos') + uniformViewPrjInvPoint = glGetUniformLocation(depthPointShader, 'viewProjectionInv') + end + --fragSrc = "#define BEAM_LIGHT \n" .. fragSrc + depthBeamShader = depthBeamShader or glCreateShader({ + defines = { + "#version 120\n", + "#define BEAM_LIGHT 1\n", + "#define CLIP_CONTROL " .. (Platform ~= nil and Platform.glSupportClipSpaceControl and 1 or 0) .. "\n" + }, + vertex = vertSrc, + fragment = fragSrc, + uniformInt = { + modelnormals = 0, + modeldepths = 1, + mapnormals = 2, + mapdepths = 3, + modelExtra = 4, + }, + }) + + if (not depthBeamShader) then + spEcho(glGetShaderLog()) + spEcho("gfx_deferred_rendering.lua: Bad depth beam shader, removing self.") + GLSLRenderer = false + widgetHandler:RemoveWidget(self) + else + lightposlocBeam = glGetUniformLocation(depthBeamShader, 'lightpos') + lightpos2locBeam = glGetUniformLocation(depthBeamShader, 'lightpos2') + lightcolorlocBeam = glGetUniformLocation(depthBeamShader, 'lightcolor') + uniformEyePosBeam = glGetUniformLocation(depthBeamShader, 'eyePos') + uniformViewPrjInvBeam = glGetUniformLocation(depthBeamShader, 'viewProjectionInv') + end + + WG.DeferredLighting_RegisterFunction = DeferredLighting_RegisterFunction + end + screenratio = vsy / vsx --so we dont overdraw and only always draw a square + else + GLSLRenderer = false + end + + widget:ViewResize() +end + +function widget:Shutdown() + if (GLSLRenderer) then + if (glDeleteShader) then + glDeleteShader(depthPointShader) + glDeleteShader(depthBeamShader) + end + end +end + +local function DrawLightType(lights, lightsCount, lighttype) -- point = 0 beam = 1 + --Spring.Echo('Camera FOV = ', Spring.GetCameraFOV()) -- default TA cam fov = 45 + --set uniforms: + local cpx, cpy, cpz = spGetCameraPosition() + if lighttype == 0 then --point + glUseShader(depthPointShader) + glUniform(uniformEyePosPoint, cpx, cpy, cpz) + glUniformMatrix(uniformViewPrjInvPoint, "viewprojectioninverse") + else --beam + glUseShader(depthBeamShader) + glUniform(uniformEyePosBeam, cpx, cpy, cpz) + glUniformMatrix(uniformViewPrjInvBeam, "viewprojectioninverse") + end + + glTexture(0, "$model_gbuffer_normtex") + glTexture(1, "$model_gbuffer_zvaltex") + glTexture(2, "$map_gbuffer_normtex") + glTexture(3, "$map_gbuffer_zvaltex") + glTexture(4, "$model_gbuffer_spectex") + + local cx, cy, cz = spGetCameraPosition() + for i = 1, lightsCount do + local light = lights[i] + local param = light.param + if verbose then + VerboseEcho('gfx_deferred_rendering.lua: Light being drawn:', i) + Spring.Utilities.TableEcho(light) + end + if lighttype == 0 then -- point + local lightradius = param.radius + --Spring.Echo("Drawlighttype position = ", light.px, light.py, light.pz) + local sx, sy, sz = spWorldToScreenCoords(light.px, light.py, light.pz) -- returns x, y, z, where x and y are screen pixels, and z is z buffer depth. + sx = sx/vsx + sy = sy/vsy --since FOV is static in the Y direction, the Y ratio is the correct one + local dist_sq = (light.px-cx)^2 + (light.py-cy)^2 + (light.pz-cz)^2 + local ratio = lightradius / math.sqrt(dist_sq) * 1.5 + glUniform(lightposlocPoint, light.px, light.py, light.pz, param.radius) --in world space + glUniform(lightcolorlocPoint, param.r * light.colMult, param.g * light.colMult, param.b * light.colMult, 1) + glTexRect( + math.max(-1 , (sx-0.5)*2-ratio*screenratio), + math.max(-1 , (sy-0.5)*2-ratio), + math.min( 1 , (sx-0.5)*2+ratio*screenratio), + math.min( 1 , (sy-0.5)*2+ratio), + math.max( 0 , sx - 0.5*ratio*screenratio), + math.max( 0 , sy - 0.5*ratio), + math.min( 1 , sx + 0.5*ratio*screenratio), + math.min( 1 , sy + 0.5*ratio) + ) -- screen size goes from -1, -1 to 1, 1; uvs go from 0, 0 to 1, 1 + end + if lighttype == 1 then -- beam + local lightradius = 0 + local px = light.px+light.dx*0.5 + local py = light.py+light.dy*0.5 + local pz = light.pz+light.dz*0.5 + local lightradius = param.radius + math.sqrt(light.dx^2 + light.dy^2 + light.dz^2)*0.5 + VerboseEcho("Drawlighttype position = ", light.px, light.py, light.pz) + local sx, sy, sz = spWorldToScreenCoords(px, py, pz) -- returns x, y, z, where x and y are screen pixels, and z is z buffer depth. + sx = sx/vsx + sy = sy/vsy --since FOV is static in the Y direction, the Y ratio is the correct one + local dist_sq = (px-cx)^2 + (py-cy)^2 + (pz-cz)^2 + local ratio = lightradius / math.sqrt(dist_sq) + ratio = ratio*2 + + glUniform(lightposlocBeam, light.px, light.py, light.pz, param.radius) --in world space + glUniform(lightpos2locBeam, light.px+light.dx, light.py+light.dy+24, light.pz+light.dz, param.radius) --in world space, the magic constant of +24 in the Y pos is needed because of our beam distance calculator function in GLSL + glUniform(lightcolorlocBeam, param.r * light.colMult, param.g * light.colMult, param.b * light.colMult, 1) + --TODO: use gl.Shape instead, to avoid overdraw + glTexRect( + math.max(-1 , (sx-0.5)*2-ratio*screenratio), + math.max(-1 , (sy-0.5)*2-ratio), + math.min( 1 , (sx-0.5)*2+ratio*screenratio), + math.min( 1 , (sy-0.5)*2+ratio), + math.max( 0 , sx - 0.5*ratio*screenratio), + math.max( 0 , sy - 0.5*ratio), + math.min( 1 , sx + 0.5*ratio*screenratio), + math.min( 1 , sy + 0.5*ratio) + ) -- screen size goes from -1, -1 to 1, 1; uvs go from 0, 0 to 1, 1 + end + end + glUseShader(0) +end + +local function renderToTextureFunc(tex, s, t) + glTexture(tex) + glTexRect(-1 * s, -1 * t, 1 * s, 1 * t) + glTexture(false) +end + +local function mglRenderToTexture(FBOTex, tex, s, t) + glRenderToTexture(FBOTex, renderToTextureFunc, tex, s, t) +end + +local beamLights = {} +local beamLightCount = 0 +local pointLights = {} +local pointLightCount = 0 +function widget:Update() + beamLights = {} + beamLightCount = 0 + pointLights = {} + pointLightCount = 0 + for i = 1, collectionFunctionCount do + beamLights, beamLightCount, pointLights, pointLightCount = collectionFunctions[i](beamLights, beamLightCount, pointLights, pointLightCount) + end +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.44 + gl.PushMatrix() + local colorMultiplier = 1 / math.max(param.r, param.g, param.b) + 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)) + gl.PopMatrix() + end + end + gl.Billboard(false) + gl.Texture(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(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(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 new file mode 100644 index 000000000..cad82e918 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_dof.lua @@ -0,0 +1,475 @@ +function widget:GetInfo() + 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 + +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 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 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 + +function widget:ViewResize(x, y) + InitTextures() +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 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 reset() + if (glDeleteShader and dofShader) then + glDeleteShader(dofShader) + end + + if glDeleteTexture then + CleanupTextures() + end + dofShader = nil +end + +function widget:Shutdown() + reset() + WG['dof'] = nil +end + +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 + +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 + +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() + 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_fix_camera_zoom.lua b/LuaUI/Widgets_Evo/gfx_fix_camera_zoom.lua deleted file mode 100644 index 1e85a1ce2..000000000 --- a/LuaUI/Widgets_Evo/gfx_fix_camera_zoom.lua +++ /dev/null @@ -1,16 +0,0 @@ -function widget:GetInfo() - return { - name = "Fix Camera Zoom", - desc = "Inverts the default spring camera zooming", - author = "Some Loser", - date = "2012-08-11", - license = "GPL v2 or later", - layer = 5, - enabled = true - } -end - -function widget:Initialize() - Spring.SetConfigInt("ScrollWheelSpeed",-25) -end - diff --git a/LuaUI/Widgets_Evo/gfx_fog.lua b/LuaUI/Widgets_Evo/gfx_fog.lua new file mode 100644 index 000000000..477ba32b4 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_fog.lua @@ -0,0 +1,679 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- + +function widget:GetInfo() + return { + name = "GFX Fog", + version = 3, + desc = "Fog Drawing widget", + author = "trepan, user, aegis, jK, widget adaptation by Doo", + date = "2008-2011", + license = "GNU GPL, v2 or later", + layer = 1, + enabled = true + } +end + +local timeCyclesWeatherEffects = Spring.GetConfigInt("evo_timecyclesweathereffects", 0) +if timeCyclesWeatherEffects ~= 1 then + return false +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Config +mapcfg = {} +mapcfg.custom = { + fog = { + color = {gl.GetAtmosphere("fogColor")}, + height = tostring((1-gl.GetAtmosphere("fogStart"))*100).."%", --// allows either absolute sizes or in percent of map's MaxHeight + fogatten = 0.00125, + + } + } +GroundFogDefs = {} +local GroundFogDefs = mapcfg.custom.fog + +function GetConfig() +mapcfg = {} +mapcfg.custom = { + fog = { + color = {gl.GetAtmosphere("fogColor")}, + height = tostring((1-gl.GetAtmosphere("fogStart"))*100).."%", --// allows either absolute sizes or in percent of map's MaxHeight + fogatten = 0.00125, + } + } +GroundFogDefs = {} +GroundFogDefs = mapcfg.custom.fog +if GroundFogDefs then +if (GroundFogDefs.height == "auto") then + local min,max = Spring.GetGroundExtremes() + GroundFogDefs.height = max * (1-gl.GetAtmosphere("fogStart")) +elseif (GroundFogDefs.height:match("(%d+)%%")) then + local min,max = Spring.GetGroundExtremes() + local percent = GroundFogDefs.height:match("(%d+)%%") + GroundFogDefs.height = max * (1-gl.GetAtmosphere("fogStart")) +end +end + +fogHeight = GroundFogDefs.height +fogColor = GroundFogDefs.color +fogAtten = GroundFogDefs.fogatten +fr,fg,fb = unpack(fogColor) + +assert(type(fogHeight) == "number") +assert(type(fr) == "number") +assert(type(fg) == "number") +assert(type(fb) == "number") +assert(type(fogAtten) == "number") +end + +if GroundFogDefs then +if (GroundFogDefs.height == "auto") then + local min,max = Spring.GetGroundExtremes() + GroundFogDefs.height = max * (1-gl.GetAtmosphere("fogStart")) +elseif (GroundFogDefs.height:match("(%d+)%%")) then + local min,max = Spring.GetGroundExtremes() + local percent = GroundFogDefs.height:match("(%d+)%%") + GroundFogDefs.height = max * (1-gl.GetAtmosphere("fogStart")) +end +end + +fogHeight = GroundFogDefs.height +fogColor = GroundFogDefs.color +fogAtten = GroundFogDefs.fogatten +fr,fg,fb = unpack(fogColor) + +assert(type(fogHeight) == "number") +assert(type(fr) == "number") +assert(type(fg) == "number") +assert(type(fb) == "number") +assert(type(fogAtten) == "number") + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Automatically generated local definitions + +local GL_MODELVIEW = GL.MODELVIEW +local GL_NEAREST = GL.NEAREST +local GL_ONE = GL.ONE +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local GL_PROJECTION = GL.PROJECTION +local GL_QUADS = GL.QUADS +local GL_SRC_ALPHA = GL.SRC_ALPHA +local glBeginEnd = gl.BeginEnd +local glBlending = gl.Blending +local glCallList = gl.CallList +local glColor = gl.Color +local glColorMask = gl.ColorMask +local glCopyToTexture = gl.CopyToTexture +local glCreateList = gl.CreateList +local glCreateShader = gl.CreateShader +local glCreateTexture = gl.CreateTexture +local glDeleteShader = gl.DeleteShader +local glDeleteTexture = gl.DeleteTexture +local glDepthMask = gl.DepthMask +local glDepthTest = gl.DepthTest +local glGetMatrixData = gl.GetMatrixData +local glGetShaderLog = gl.GetShaderLog +local glGetUniformLocation = gl.GetUniformLocation +local glGetViewSizes = gl.GetViewSizes +local glLoadIdentity = gl.LoadIdentity +local glLoadMatrix = gl.LoadMatrix +local glMatrixMode = gl.MatrixMode +local glMultiTexCoord = gl.MultiTexCoord +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glResetMatrices = gl.ResetMatrices +local glTexCoord = gl.TexCoord +local glTexture = gl.Texture +local glRect = gl.Rect +local glUniform = gl.Uniform +local glUniformMatrix = gl.UniformMatrix +local glUseShader = gl.UseShader +local glVertex = gl.Vertex +local glTranslate = gl.Translate +local spEcho = Spring.Echo +local spGetCameraPosition = Spring.GetCameraPosition +local spGetCameraVectors = Spring.GetCameraVectors +local time = Spring.GetGameSeconds +local spGetDrawFrame = Spring.GetDrawFrame + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Extra GL constants +-- + +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 + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local debugGfx = false --or true + +local GLSLRenderer = true +local forceNonGLSL = false -- force using the non-GLSL renderer +local post83 = false +do + post83 = true +end +if (forceNonGLSL) then + GLSLRenderer = false +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local gnd_min, gnd_max = Spring.GetGroundExtremes() +if (gnd_min < 0) then gnd_min = 0 end +if (gnd_max < 0) then gnd_max = 0 end +local vsx, vsy +local mx = Game.mapSizeX +local mz = Game.mapSizeZ +local fog +local CurrentCameraY +local timeNow, timeThen = 0,0 + + +local depthShader +local depthTexture + +local uniformEyePos +local uniformNoise +local uniformViewPrjInv + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +----a simple plane, very complete, would look good with shadows, reflex and stuff. + +local function DrawPlaneModel() + local layers = (fogHeight - (gnd_min+50)) / 50 + + glColor(fr,fg,fb,50*fogAtten) + glDepthTest(true) + glBlending(true) + + glBeginEnd(GL_QUADS,function() + for h = gnd_min+50,fogHeight,50 do + local l = -mx*4 + local r = mx + mx*4 + local t = -mz*4 + local b = mz + mz*4 + glVertex(l, h, t) + glVertex(r, h, t) + glVertex(r, h, b) + glVertex(l, h, b) + end + end) + + glDepthTest(false) + glBlending(false) + glColor(1,1,1,1) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- fog rendering + +local function FogSlices() + local h = 8*(math.sin(time()/1.2)) + 30*(math.sin(time()/7.3)) - 30 + glPushMatrix() + glTranslate(0,h,0) + glCallList(fog) + glPopMatrix() +end + +local function FogFullscreen() + local camY = select(2, spGetCameraPosition()) + local inFogH = fogHeight - camY + + if (inFogH > fogHeight * 0.1) then + glColor(fr,fg,fb, math.min(0.8, inFogH * fogAtten)) + glRect(0,0,vsx,vsy) + glColor(1,1,1,1) + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:ViewResize() + vsx, vsy = gl.GetViewSizes() + if (Spring.GetMiniMapDualScreen()=='left') then + vsx=vsx/2; + end + if (Spring.GetMiniMapDualScreen()=='right') then + vsx=vsx/2 + end + + if (depthTexture) then + glDeleteTexture(depthTexture) + depthTexture = nil + end + + depthTexture = glCreateTexture(vsx, vsy, { + format = GL_DEPTH_COMPONENT24, + min_filter = GL_NEAREST, + mag_filter = GL_NEAREST, + }) + + if (depthTexture == nil) then + spEcho("Removing fog widget, bad depth texture") + end +end + +widget:ViewResize() + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local vertSrc = [[ + + void main(void) + { + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_Vertex; + } +]] + +local fragSrc = ([[ + const float fogAtten = %f; + const float fogHeight = %f; + const vec3 fogColor = vec3(%f, %f, %f); + + uniform sampler2D tex0; + uniform vec3 eyePos; + uniform vec2 noise; +#ifdef USE_INVERSEMATRIX + uniform mat4 viewProjectionInv; +#endif + + //! source: http://www.ozone3d.net/blogs/lab/20110427/glsl-random-generator/ + float rand(vec2 n) + { + return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); + } + + void main(void) + { + float z = texture2D(tex0, gl_TexCoord[0].st).x; + + vec4 ppos; + ppos.xyz = vec3(gl_TexCoord[0].st, z) * 2. - 1.; + ppos.a = 1.; +#ifdef USE_INVERSEMATRIX + vec4 worldPos4 = viewProjectionInv * ppos; +#else + vec4 worldPos4 = gl_ModelViewProjectionMatrixInverse * ppos; +#endif + vec3 worldPos = worldPos4.xyz / worldPos4.w; + vec3 toPoint = worldPos - eyePos; + +#ifdef DEBUG_GFX // world position debugging + const float k = 100.0; + vec3 debugColor = pow(2.0 * abs(0.5 - fract(worldPos / k)), 6.0); + gl_FragColor = vec4(debugColor, 1.0); + return; // BAIL +#endif + + float h0 = clamp(worldPos.y, 0.0, fogHeight); + float h1 = clamp(eyePos.y, 0.0, fogHeight); // FIXME: uniform ... + + float len = length(toPoint); + float dist = len * abs((h1 - h0) / toPoint.y); // div-by-zero prob? + float atten = clamp(1.0 - exp(-dist * fogAtten), 0.0, 1.0); + + gl_FragColor = vec4(fogColor, atten); + + //! noise + vec2 seed = gl_TexCoord[0].st + noise; + gl_FragColor.rgb += 0.030 * rand(seed); + } +]]):format(fogAtten, fogHeight, fogColor[1], fogColor[2], fogColor[3]) + + +if (post83) then + fragSrc = '#define USE_INVERSEMATRIX\n' .. fragSrc +end + +if (debugGfx) then + fragSrc = '#define DEBUG_GFX\n' .. fragSrc +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() +GetConfig() + if (enabled) then + if ((not forceNonGLSL) and Spring.GetMiniMapDualScreen()~='left') then --FIXME dualscreen + if (not glCreateShader) then + spEcho("Shaders not found, reverting to non-GLSL widget") + GLSLRenderer = false + else + + if depthShader then + gl.DeleteShader(depthShader) + depthShader = nil + end + + depthShader = glCreateShader({ + vertex = vertSrc, + fragment = fragSrc, + uniformInt = { + tex0 = 0, + }, + }) + Spring.Echo(depthShader) + + if (not depthShader) then + spEcho(glGetShaderLog()) + spEcho("Bad shader, reverting to non-GLSL widget.") + GLSLRenderer = false + else + uniformEyePos = glGetUniformLocation(depthShader, 'eyePos') + uniformNoise = glGetUniformLocation(depthShader, 'noise') + uniformViewPrjInv = glGetUniformLocation(depthShader, 'viewProjectionInv') + end + end + else + GLSLRenderer = false + end + if (not GLSLRenderer) then + if (fog) then + gl.DeleteList(fog) + fog = nil + end + + fog = glCreateList(DrawPlaneModel) + end + else + + end +end +frame = 0 +function widget:Update() +if frame%30 == 0 then +GetConfig() + vertSrc = nil + fragSrc = nil +vertSrc = [[ + + void main(void) + { + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = gl_Vertex; + } +]] + +fragSrc = ([[ + const float fogAtten = %f; + const float fogHeight = %f; + const vec3 fogColor = vec3(%f, %f, %f); + + uniform sampler2D tex0; + uniform vec3 eyePos; + uniform vec2 noise; +#ifdef USE_INVERSEMATRIX + uniform mat4 viewProjectionInv; +#endif + + //! source: http://www.ozone3d.net/blogs/lab/20110427/glsl-random-generator/ + float rand(vec2 n) + { + return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); + } + + void main(void) + { + float z = texture2D(tex0, gl_TexCoord[0].st).x; + + vec4 ppos; + ppos.xyz = vec3(gl_TexCoord[0].st, z) * 2. - 1.; + ppos.a = 1.; +#ifdef USE_INVERSEMATRIX + vec4 worldPos4 = viewProjectionInv * ppos; +#else + vec4 worldPos4 = gl_ModelViewProjectionMatrixInverse * ppos; +#endif + vec3 worldPos = worldPos4.xyz / worldPos4.w; + vec3 toPoint = worldPos - eyePos; + +#ifdef DEBUG_GFX // world position debugging + const float k = 100.0; + vec3 debugColor = pow(2.0 * abs(0.5 - fract(worldPos / k)), 6.0); + gl_FragColor = vec4(debugColor, 1.0); + return; // BAIL +#endif + + float h0 = clamp(worldPos.y, 0.0, fogHeight); + float h1 = clamp(eyePos.y, 0.0, fogHeight); // FIXME: uniform ... + + float len = length(toPoint); + float dist = len * abs((h1 - h0) / toPoint.y); // div-by-zero prob? + float atten = clamp(1.0 - exp(-dist * fogAtten), 0.0, 1.0); + + gl_FragColor = vec4(fogColor, atten); + + //! noise + vec2 seed = gl_TexCoord[0].st + noise; + gl_FragColor.rgb += 0.030 * rand(seed); + } +]]):format(fogAtten, fogHeight, fogColor[1], fogColor[2], fogColor[3]) +if (post83) then + fragSrc = '#define USE_INVERSEMATRIX\n' .. fragSrc +end +if (debugGfx) then + fragSrc = '#define DEBUG_GFX\n' .. fragSrc +end + if (enabled) then + if ((not forceNonGLSL) and Spring.GetMiniMapDualScreen()~='left') then --FIXME dualscreen + if (not glCreateShader) then + spEcho("Shaders not found, reverting to non-GLSL widget") + GLSLRenderer = false + else + depthShader = glCreateShader({ + vertex = vertSrc, + fragment = fragSrc, + uniformInt = { + tex0 = 0, + }, + }) + if (not depthShader) then + spEcho(glGetShaderLog()) + spEcho("Bad shader, reverting to non-GLSL widget.") + GLSLRenderer = false + else + uniformEyePos = glGetUniformLocation(depthShader, 'eyePos') + uniformNoise = glGetUniformLocation(depthShader, 'noise') + uniformViewPrjInv = glGetUniformLocation(depthShader, 'viewProjectionInv') + end + end + else + GLSLRenderer = false + end + if (not GLSLRenderer) then + if (fog) then + gl.DeleteList(fog) + fog = nil + end + + fog = glCreateList(DrawPlaneModel) + end + else + + end +end +frame = frame + 1 +end + + + + +function widget:Shutdown() + if (GLSLRenderer) then + glDeleteTexture(depthTexture) + if (glDeleteShader) then + glDeleteShader(depthShader) + end + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Vector Math +-- + +local function cross(a, b) + return { + (a[2] * b[3]) - (a[3] * b[2]), + (a[3] * b[1]) - (a[1] * b[3]), + (a[1] * b[2]) - (a[2] * b[1]) + } +end + +local function add(a, b) + return { + a[1] * b[1], + a[2] * b[2], + a[3] * b[3] + } +end + +local function dot(a, b) + return (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]) +end + + +local function normalize(a) + local len = math.sqrt((a[1] * a[1]) + (a[2] * a[2]) + (a[3] * a[3])) + if (len == 0.0) then + return a + end + a[1] = a[1] / len + a[2] = a[2] / len + a[3] = a[3] / len + return { a[1], a[2], a[3] } +end + + +local function scale(a, s) + a[1] = a[1] * s + a[2] = a[2] * s + a[3] = a[3] * s + return { a[1], a[2], a[3] } +end + + + +local function fract(x) + return select(2, math.modf(x,1)) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local dl + +local function DrawFogNew() + GetConfig() + --//FIXME handle dualscreen correctly! + + -- copy the depth buffer + if (depthTexture) then + glDeleteTexture(depthTexture) + depthTexture = nil + end + + depthTexture = glCreateTexture(vsx, vsy, { + format = GL_DEPTH_COMPONENT24, + min_filter = GL_NEAREST, + mag_filter = GL_NEAREST, + }) + + glCopyToTexture(depthTexture, 0, 0, 0, 0, vsx, vsy) --FIXME scale down? + + -- setup the shader and its uniform values + + glUseShader(depthShader) + + -- set uniforms + local cpx, cpy, cpz = spGetCameraPosition() + glUniform(uniformEyePos, cpx, cpy, cpz) + + local noise1 = (spGetDrawFrame() / 2521) % 1 -- why 2521? it's prime ;) + glUniform(uniformNoise, noise1 + fract(cpx), noise1 + fract(cpz)) + + if (post83) then + glUniformMatrix(uniformViewPrjInv, "viewprojectioninverse") + end + if dl then + gl.DeleteList(dl) + dl = nil + end + if (not dl) then + dl = gl.CreateList(function() + -- render a full screen quad + glTexture(0, depthTexture) + glTexture(0, false) + gl.TexRect(-1, -1, 1, 1, 0, 0, 1, 1) + + --// finished + glUseShader(0) + end) + end + + glCallList(dl) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:DrawWorld() + GetConfig() + if (GLSLRenderer) then + if (debugGfx) then glBlending(GL_SRC_ALPHA, GL_ONE) end + if depthShader then + gl.DeleteShader(depthShader) + depthShader = nil + end + + depthShader = glCreateShader({ + vertex = vertSrc, + fragment = fragSrc, + uniformInt = { + tex0 = 0, + }, + }) + uniformEyePos = glGetUniformLocation(depthShader, 'eyePos') + uniformNoise = glGetUniformLocation(depthShader, 'noise') + uniformViewPrjInv = glGetUniformLocation(depthShader, 'viewProjectionInv') + DrawFogNew() + if (debugGfx) then glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) end + else + FogSlices() + end +end + +if (not GLSLRenderer) then + function widget:DrawScreenEffects() + FogFullscreen() + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- 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 new file mode 100644 index 000000000..69700c772 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_light_effects.lua @@ -0,0 +1,805 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Light Effects", + version = 4, + desc = "Creates projectile, laser and explosion lights and sends them to the deferred renderer.", + author = "Floris (original by beherith)", + date = "May 2017", + license = "GPL V2", + layer = 0, + enabled = true, + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local spGetProjectilesInRectangle = Spring.GetProjectilesInRectangle +local spGetVisibleProjectiles = Spring.GetVisibleProjectiles +local spGetProjectilePosition = Spring.GetProjectilePosition +local spGetProjectileType = Spring.GetProjectileType +local spGetProjectileDefID = Spring.GetProjectileDefID +local spGetPieceProjectileParams = Spring.GetPieceProjectileParams +local spGetProjectileVelocity = Spring.GetProjectileVelocity + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Local Variables +local previousProjectileDrawParams +local fadeProjectiles, fadeProjectileTimes = {}, {} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Config + +local useLOD = false -- Reduces the number of lights drawn based on camera distance and current fps. +local projectileFade = true +local FADE_TIME = 5 + + +local overrideParam = {r = 1, g = 1, b = 1, radius = 200} +local doOverride = false + +local globalLightMult = 3 +local globalRadiusMult = 1.3 +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} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local projectileLightTypes = {} +--[1] red +--[2] green +--[3] blue +--[4] radius +--[5] BEAMTYPE, true if BEAM + +local explosionLightsCount = 0 +local explosionLights = {} + + +local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + 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 + + +local function GetLightsFromUnitDefs() + --Spring.Echo('GetLightsFromUnitDefs init') + local plighttable = {} + for weaponDefID = 1, #WeaponDefs do + --These projectiles should have lights: + --Cannon (projectile size: tempsize = 2.0f + std::min(wd.customParams.shield_damage * 0.0025f, wd.damageAreaOfEffect * 0.1f);) + --Dgun + --MissileLauncher + --StarburstLauncher + --LaserCannon + --LightningCannon + --BeamLaser + --Flame + --Shouldnt: + --AircraftBomb + --Shield + --TorpedoLauncher + local weaponDef = WeaponDefs[weaponDefID] + + local customParams = weaponDef.customParams or {} + + local skip = false + if customParams.light_skip ~= nil and customParams.light_skip then + skip = true + end + + local lightMultiplier = 0.08 + local bMult = 1.6 -- because blue appears to be very faint + local r,g,b = weaponDef.visuals.colorR, weaponDef.visuals.colorG, weaponDef.visuals.colorB*bMult + + local weaponData = {type=weaponDef.type, r = (r + 0.1) * lightMultiplier, g = (g + 0.1) * lightMultiplier, b = (b + 0.1) * lightMultiplier, radius = 100} + local recalcRGB = false + + if (weaponDef.type == 'Cannon') then + if customParams.single_hit then + weaponData.beamOffset = 1 + weaponData.beam = true + else + weaponData.radius = 120 * weaponDef.size + if weaponDef.damageAreaOfEffect ~= nil then + weaponData.radius = 120 * ((weaponDef.size*0.4) + (weaponDef.damageAreaOfEffect * 0.025)) + end + lightMultiplier = 0.02 * ((weaponDef.size*0.66) + (weaponDef.damageAreaOfEffect * 0.012)) + if lightMultiplier > 0.08 then + lightMultiplier = 0.08 + end + recalcRGB = true + end + elseif (weaponDef.type == 'LaserCannon') then + weaponData.radius = 70 * weaponDef.size + elseif (weaponDef.type == 'DGun') then + weaponData.radius = 500 + lightMultiplier = 0.28 + elseif (weaponDef.type == 'MissileLauncher') then + weaponData.radius = 125 * weaponDef.size + if weaponDef.damageAreaOfEffect ~= nil then + weaponData.radius = 125 * (weaponDef.size + (weaponDef.damageAreaOfEffect * 0.01)) + end + lightMultiplier = 0.01 + (weaponDef.size/55) + 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 + recalcRGB = true + skip = true + elseif (weaponDef.type == 'LightningCannon') then + weaponData.radius = 70 * weaponDef.size + weaponData.beam = true + elseif (weaponDef.type == 'BeamLaser') then + weaponData.radius = 16 * (weaponDef.size * weaponDef.size * weaponDef.size) + weaponData.beam = true + if weaponDef.beamTTL > 2 then + weaponData.fadeTime = weaponDef.beamTTL + weaponData.fadeOffset = 0 + end + end + + if customParams.light_opacity then + lightMultiplier = customParams.light_opacity + end + if customParams.light_mult ~= nil then + recalcRGB = true + lightMultiplier = lightMultiplier * tonumber(customParams.light_mult) + end + + -- For long lasers or projectiles + if customParams.light_beam_mult then + weaponData.beamOffset = 1 + weaponData.beam = true + weaponData.beamMult = tonumber(customParams.light_beam_mult) + weaponData.beamMultFrames = tonumber(customParams.light_beam_mult_frames) + end + + if customParams.light_fade_time and customParams.light_fade_offset then + weaponData.fadeTime = tonumber(customParams.light_fade_time) + weaponData.fadeOffset = tonumber(customParams.light_fade_offset) + end + + if customParams.light_radius then + weaponData.radius = tonumber(customParams.light_radius) + end + + 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 + weaponData.groundHeightLimit = tonumber(customParams.light_ground_height) + end + + if customParams.light_camera_height then + weaponData.cameraHeightLimit = tonumber(customParams.light_camera_height) + end + + if customParams.light_beam_start then + weaponData.beamStartOffset = tonumber(customParams.light_beam_start) + end + + if customParams.light_beam_offset then + weaponData.beamOffset = tonumber(customParams.light_beam_offset) + end + + if customParams.light_color then + local colorList = Split(customParams.light_color, " ") + r = colorList[1] + g = colorList[2] + b = colorList[3]*bMult + end + + if recalcRGB or globalLightMult ~= 1 or globalLightMultLaser ~= 1 then + local laserMult = 1 + if (weaponDef.type == 'BeamLaser' or weaponDef.type == 'LightningCannon' or weaponDef.type == 'LaserCannon') then + laserMult = globalLightMultLaser + end + weaponData.r = (r + 0.1) * lightMultiplier * globalLightMult * laserMult + weaponData.g = (g + 0.1) * lightMultiplier * globalLightMult * laserMult + weaponData.b = (b + 0.1) * lightMultiplier*bMult * globalLightMult * laserMult + end + + + if (weaponDef.type == 'Cannon') then + weaponData.glowradius = weaponData.radius + end + + weaponData.radius = weaponData.radius * globalRadiusMult + if (weaponDef.type == 'BeamLaser' or weaponDef.type == 'LightningCannon' or weaponDef.type == 'LaserCannon') then + weaponData.radius = weaponData.radius * globalRadiusMultLaser + end + + + if not skip and weaponData ~= nil and weaponData.radius > 0 and customParams.fake_weapon == nil then + + plighttable[weaponDefID] = weaponData + end + end + + return plighttable +end + + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Utilities + +local function InterpolateBeam(x, y, z, dx, dy, dz) + local finalDx, finalDy, finalDz = 0, 0, 0 + for i = 1, 10 do + local h = Spring.GetGroundHeight(x + dx + finalDx, z + dz + finalDz) + local mult + dx, dy, dz = dx*0.5, dy*0.5, dz*0.5 + if h < y + dy + finalDy then + finalDx, finalDy, finalDz = finalDx + dx, finalDy + dy, finalDz + dz + end + end + return finalDx, finalDy, finalDz +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Projectile Collection + +local function GetCameraHeight() + local camX, camY, camZ = Spring.GetCameraPosition() + return camY - math.max(Spring.GetGroundHeight(camX, camZ), 0) +end + +local function ProjectileLevelOfDetailCheck(param, proID, fps, height) + if param.cameraHeightLimit and param.cameraHeightLimit < height then + if param.cameraHeightLimit*3 > height then + local fraction = param.cameraHeightLimit/height + if fps < 60 then + fraction = fraction*fps/60 + end + local ratio = 1/fraction + return (proID%ratio < 1) + else + return false + end + end + + if param.beam then + return true + end + + if fps < 60 then + local fraction = fps/60 + local ratio = 1/fraction + return (proID%ratio < 1) + end + return true +end + +local function GetBeamLights(lightParams, pID, x, y, z) + local deltax, deltay, deltaz = spGetProjectileVelocity(pID) -- for beam types, this returns the endpoint of the beam] + local timeToLive + + if lightParams.beamMult then + local mult = lightParams.beamMult + if lightParams.beamMultFrames then + timeToLive = timeToLive or Spring.GetProjectileTimeToLive(pID) + if (not lightParams.maxTTL) or lightParams.maxTTL < timeToLive then + lightParams.maxTTL = timeToLive + end + mult = mult * (1 - math.min(1, (timeToLive - (lightParams.maxTTL - lightParams.beamMultFrames))/lightParams.beamMultFrames)) + end + deltax, deltay, deltaz = mult*deltax, mult*deltay, mult*deltaz + end + + if y + deltay < -800 then + -- The beam has fallen through the world + deltax, deltay, deltaz = InterpolateBeam(x, y, z, deltax, deltay, deltaz) + end + + if lightParams.beamOffset then + local m = lightParams.beamOffset + x, y, z = x - deltax*m, y - deltay*m, z - deltaz*m + end + if lightParams.beamStartOffset then + local m = lightParams.beamStartOffset + x, y, z = x + deltax*m, y + deltay*m, z + deltaz*m + deltax, deltay, deltaz = deltax*(1 - m), deltay*(1 - m), deltaz*(1 - m) + end + + local light = { + pID = pID, + px = x, py = y, pz = z, + dx = deltax, dy = deltay, dz = deltaz, + param = (doOverride and overrideParam) or lightParams, + beam = true + } + + if lightParams.fadeTime then + timeToLive = timeToLive or Spring.GetProjectileTimeToLive(pID) + light.colMult = math.max(0, (timeToLive + lightParams.fadeOffset)/lightParams.fadeTime) + else + light.colMult = 1 + end + + return light +end + +local function GetProjectileLight(lightParams, pID, x, y, z) + local light = { + pID = pID, + px = x, py = y, pz = z, + param = (doOverride and overrideParam) or lightParams + } + -- Use the following to check heatray fadeout parameters. + --local timeToLive = Spring.GetProjectileTimeToLive(pID) + --Spring.MarkerAddPoint(x,y,z,timeToLive) + + if lightParams.fadeTime and lightParams.fadeOffset then + local timeToLive = Spring.GetProjectileTimeToLive(pID) + light.colMult = math.max(0, (timeToLive + lightParams.fadeOffset)/lightParams.fadeTime) + else + light.colMult = 1 + end + + return light +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 + if (not projectileFade) and projectileCount == 0 then + return beamLights, beamLightCount, pointLights, pointLightCount + end + + local fps = Spring.GetFPS() + local cameraHeight = math.floor(GetCameraHeight()*0.01)*100 + --Spring.Echo("cameraHeight", cameraHeight, "fps", fps) + local projectilePresent = {} + local projectileDrawParams = projectileFade and {} + + for i = 1, projectileCount do + local pID = projectiles[i] + local x, y, z = spGetProjectilePosition(pID) + --Spring.Echo("projectilepos = ", x, y, z, 'id', pID) + projectilePresent[pID] = true + local weapon, piece = spGetProjectileType(pID) + if piece then + local explosionflags = spGetPieceProjectileParams(pID) + if explosionflags and (explosionflags%32) > 15 then --only stuff with the FIRE explode tag gets a light + --Spring.Echo('explosionflag = ', explosionflags) + local drawParams = {pID = pID, px = x, py = y, pz = z, param = (doOverride and overrideParam) or gibParams, colMult = 1} + if drawParams.param.gib == true or drawParams.param.gib == nil then + pointLightCount = pointLightCount + 1 + pointLights[pointLightCount] = drawParams + if projectileDrawParams then + projectileDrawParams[#projectileDrawParams + 1] = drawParams + end + end + end + else + lightParams = projectileLightTypes[spGetProjectileDefID(pID)] + if lightParams and (not useLOD or ProjectileLevelOfDetailCheck(lightParams, pID, fps, cameraHeight)) then + if lightParams.beam then --BEAM type + local drawParams = GetBeamLights(lightParams, pID, x, y, z) + beamLightCount = beamLightCount + 1 + beamLights[beamLightCount] = drawParams + if projectileDrawParams then + -- Don't add beams (for now?) + --projectileDrawParams[#projectileDrawParams + 1] = drawParams + end + 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 + end + end + + local frame = Spring.GetGameFrame() + if projectileFade then + if previousProjectileDrawParams then + for i = 1, #previousProjectileDrawParams do + local pID = previousProjectileDrawParams[i].pID + if not projectilePresent[pID] then + local params = previousProjectileDrawParams[i] + params.startColMul = params.colMul or 1 + params.py = params.py + 10 + fadeProjectiles[#fadeProjectiles + 1] = params + fadeProjectileTimes[#fadeProjectileTimes + 1] = frame + FADE_TIME + end + end + end + + local i = 1 + while i <= #fadeProjectiles do + local strength = (fadeProjectileTimes[i] - frame)/FADE_TIME + if strength <= 0 then + fadeProjectileTimes[i] = fadeProjectileTimes[#fadeProjectileTimes] + fadeProjectileTimes[#fadeProjectileTimes] = nil + fadeProjectiles[i] = fadeProjectiles[#fadeProjectiles] + fadeProjectiles[#fadeProjectiles] = nil + else + local params = fadeProjectiles[i] + params.colMult = strength*params.startColMul + if params.beam then + beamLightCount = beamLightCount + 1 + beamLights[beamLightCount] = params + else + pointLightCount = pointLightCount + 1 + pointLights[pointLightCount] = params + end + i = i + 1 + end + end + + previousProjectileDrawParams = projectileDrawParams + end + + -- 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 + else + pointLightCount = pointLightCount + 1 + pointLights[pointLightCount] = params + end + end + + return beamLights, beamLightCount, pointLights, pointLightCount +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 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 + + local strength,animSpeed,life,heat,sizeGrowth,size,force + + 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 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 + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Shutdown() + WG['lighteffects'] = nil +end + +function widget:Initialize() + loadWeaponDefs() + + widgetHandler:RegisterGlobal('GadgetWeaponExplosion', GadgetWeaponExplosion) + if WG.DeferredLighting_RegisterFunction then + WG.DeferredLighting_RegisterFunction(GetProjectileLights) + projectileLightTypes = GetLightsFromUnitDefs() + end + + WG['lighteffects'] = {} + WG['lighteffects'].getGlobalBrightness = function() + return globalLightMult + end + WG['lighteffects'].getGlobalRadius = function() + return globalRadiusMult + end + WG['lighteffects'].getGlobalBrightness = function() + return globalLightMultLaser + end + WG['lighteffects'].getLaserRadius = function() + return globalRadiusMultLaser + end + 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() + loadWeaponDefs() + end + WG['lighteffects'].setGlobalRadius = function(value) + globalRadiusMult = value + projectileLightTypes = GetLightsFromUnitDefs() + loadWeaponDefs() + end + WG['lighteffects'].setLaserBrightness = function(value) + globalLightMultLaser = value + projectileLightTypes = GetLightsFromUnitDefs() + end + WG['lighteffects'].setLaserRadius = function(value) + globalRadiusMultLaser = value + projectileLightTypes = GetLightsFromUnitDefs() + end + WG['lighteffects'].setLife = function(value) + 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) + 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.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_lups_smokesignal.lua b/LuaUI/Widgets_Evo/gfx_lups_smokesignal.lua deleted file mode 100644 index 412e66469..000000000 --- a/LuaUI/Widgets_Evo/gfx_lups_smokesignal.lua +++ /dev/null @@ -1,119 +0,0 @@ -function widget:GetInfo() - return { - name = "Smoke Signal", - desc = "Adds a Lups smoke signal to marker points", - author = "jK/quantum", - date = "Sep, 2008", - license = "GNU GPL, v2 or later", - layer = 10, - enabled = false -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function MergeTable(outtable,intable) - for i,v in pairs(intable) do - if (outtable[i]==nil) then - if (type(v)=='table') then - if (type(outtable[i])~='table') then outtable[i] = {} end - MergeTable(outtable[i],v) - else - outtable[i] = v - end - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local smokeFX = { - layer = 1, - alwaysVisible = true, - speed = 0.65, - count = 300, - - colormap = { {0, 0, 0, 0.01}, - {0.4, 0.4, 0.4, 0.01}, - {0.35, 0.15, 0.15, 0.20}, - {0, 0, 0, 0.01} }, - - life = 50, - lifeSpread = 20, - delaySpread = 900, - rotSpeed = 1, - rotSpeedSpread = -2, - rotSpread = 360, - size = 30, - sizeSpread = 5, - sizeGrowth = 0.9, - emitVector = {0,1,0}, - emitRotSpread = 60, - - texture = 'bitmaps/smoke/smoke01.tga', -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Lups -- Lua Particle System -local AddParticles -local particleIDs = {} - -local random,pi = math.random,math.pi -local sin,cos = math.sin,math.cos - -local GetWind = Spring.GetWind -local spGetUnitPosition = Spring.GetUnitPosition -local spGetUnitRadius = Spring.GetUnitRadius - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() -end - -function widget:Shutdown() - if (initialized) then - Lups = WG['Lups'] - for _,particleID in pairs(particleIDs) do - Lups.RemoveParticles(particleID) - end - end -end - -local t = 1 -function widget:Update() - if (t>2) then - Lups = WG['Lups'] - if (Lups) then - totalFxCount = Lups.GetStats() - AddParticles = Lups.AddParticles - end - t=1 - end - t=t+1 -end - -function widget:MapDrawCmd(playerID, cmdType, px, py, pz, caption) - if (cmdType ~= 'point') or not(Spring.GetGameSeconds()>0) or (Lups==nil) then return end - --// get wind and random values - local wx, wy, wz = GetWind() - wx, wy, wz = wx*0.09, wy*0.09, wz*0.09 - smokeFX.force = {wx,wy+3,wz} - - local _,_,spec,team = Spring.GetPlayerInfo(playerID) - if not team then return end - local r, g, b = Spring.GetTeamColor(team) - if spec then r, g, b = 1, 1, 1 end - - --// send particles to LUPS - smokeFX.pos = {px,py,pz} - smokeFX.partpos = "r*sin(alpha),0,r*cos(alpha) | alpha=rand()*2*pi, r=rand()*20" - smokeFX.colormap[2] = { r, g, b, smokeFX.colormap[2][4]} - smokeFX.colormap[3] = { r, g, b, smokeFX.colormap[3][4]} - smokeFX.texture = "bitmaps/smoke/smoke0" .. math.random(1,9) .. ".tga" - particleIDs[#particleIDs+1] = AddParticles('SimpleParticles2',smokeFX) -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 d5cac0c35..000000000 --- a/LuaUI/Widgets_Evo/gfx_outline.lua +++ /dev/null @@ -1,337 +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 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() - 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) -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_rain.lua b/LuaUI/Widgets_Evo/gfx_rain.lua new file mode 100644 index 000000000..fd34ba2b7 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_rain.lua @@ -0,0 +1,562 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: precipitation.lua +-- brief: precipitation shader gadget +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "GFX Rain", + desc = "Precipitation shader widget", + author = "trepan, Argh, The_Yak", + date = "August 27, 2009, Aug 2, 2013", + license = "GNU GPL, v2 or later", + layer = -24, + enabled = true -- loaded by default? + } +end + +local timeCyclesWeatherEffects = Spring.GetConfigInt("evo_timecyclesweathereffects", 0) +if timeCyclesWeatherEffects ~= 1 then + return false +end + +------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +b = 1 +local particleType = 1 -- 1 for rain, 2 for snow, 3 for clouds (when they finally work) +local particleDensity = 0 -- how many particles? Limit for performance! +f = 0 +nbPlayers = 0 +X = Game.mapSizeX +Z = Game.mapSizeZ +r = 1 +aparticleDensity = 1 +function GameStart() +r = 1 +roster = Spring.GetPlayerRoster(2) +nbPlayers = 0 +for i,isSpec in pairs(roster) do +if isSpec[5] == false then +nbPlayers = nbPlayers + 1 +end +end +end + +function widget:UnitDamaged(_,_,_,da) + +if da >= 1500 then +da = 1500 +end +b = b + da +--Spring.Echo(particleDensity) +end + +--Rain Color Control +local function ColorFunc() + local rainColorR = 0.2*((15000-particleDensity)/15000) + local rainColorG = math.random(2,5)/10*((15000-particleDensity)/15000) + local rainColorB = 0.5*((15000-particleDensity)/15000) + local rainAlpha = (1*(particleDensity/15000))^(1/4) + -- Spring.Echo(rainColorR) + -- Spring.Echo(rainColorG) + -- Spring.Echo(rainColorB) + -- Spring.Echo(rainAlpha) + return rainColorR,rainColorG,rainColorB,rainAlpha +end + +--particleOne +local particleOneGravity = 50 -- how fast does it fall? +local particleOneDriftX = -20 -- how fast does it move on the X axis? Can be positive or negative. +local particleOneDriftZ = -20 -- how fast does it move on the Z axis? Can be positive or negative. +local particleOneTexture = 'LuaUI/Widgets/snowflake1.tga' -- what bitmap are we using? +local particleOneScale = 4000 -- scale, see GLSL for details + +local particleTwoGravity = 40 -- how fast does it fall? +local particleTwoDriftX = -40 -- how fast does it move on the X axis? Can be positive or negative. +local particleTwoDriftZ = 20 -- how fast does it move on the Z axis? Can be positive or negative. +local particleTwoTexture = 'LuaUI/Widgets/snowflake2.tga' -- what bitmap are we using? +local particleTwoScale = 3000 -- scale, see GLSL for details + +local particleThreeGravity = 60 -- how fast does it fall? +local particleThreeDriftX = -60 -- how fast does it move on the X axis? Can be positive or negative. +local particleThreeDriftZ = 20 -- how fast does it move on the Z axis? Can be positive or negative. +local particleThreeTexture = 'LuaUI/Widgets/snowflake3.tga' -- what bitmap are we using? +local particleThreeScale = 2500 -- scale, see GLSL for details + +local math_random = math.random +local math_randomseed = math.randomseed + +local shader +local rainshader +local shaderTimeLoc +local shaderCamPosLoc +local shaderScaleLoc +local shaderSpeedLoc + +local startTimer = Spring.GetTimer() +local diffTime = 0 + +local rainparticleOneList +local rainparticleTwoList +local rainparticleThreeList + +local firstPos = 0 +local secondPos = 0 +local thirdPos = 0 +local camX,camY,camZ + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +--OpenGL stuff. + local glBeginEnd = gl.BeginEnd + local glVertex = gl.Vertex + local glColor = gl.Color + local glBlending = gl.Blending + local glTranslate = gl.Translate + local glCallList = gl.CallList + local glDepthTest = gl.DepthTest + local glCreateList = gl.CreateList + local glDeleteList = gl.DeleteList + local glTexture = gl.Texture + local glGetShaderLog = gl.GetShaderLog + local glCreateShader = gl.CreateShader + local glDeleteShader = gl.DeleteShader + local glUseShader = gl.UseShader + local glUniformMatrix = gl.UniformMatrix + local glUniformInt = gl.UniformInt + local glUniform = gl.Uniform + local glGetUniformLocation = gl.GetUniformLocation + local glGetActiveUniforms = gl.GetActiveUniforms + local glBeginEnd = gl.BeginEnd + local glPointSprite = gl.PointSprite + local glPointSize = gl.PointSize + local glPointParameter = gl.PointParameter + local glResetState = gl.ResetState + local GL_POINTS = GL.POINTS + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +function widget:Shutdown() + --glDeleteList(particleOneSubList) + glDeleteList(particleOneList) +end + +local function CreateParticleOneList() + particleOneList = gl.CreateList(function() + local tmpRand = math.random() + math.randomseed(1) + gl.BeginEnd(GL.POINTS, function() + for i = 1, aparticleDensity do + local x = math.random() + local y = math.random() + local z = math.random() + local w = math.random() + gl.Vertex(x, y, z, w) + end + end) + math.random(1e9 * tmpRand) + end) +end + +local function CreateParticleTwoList() + particleTwoList = gl.CreateList(function() + local tmpRand = math.random() + math.randomseed(2) + gl.BeginEnd(GL.POINTS, function() + for i = 1, aparticleDensity do + local x = math.random() + local y = math.random() + local z = math.random() + local w = math.random() + gl.Vertex(x, y, z, w) + end + end) + math.random(1e9 * tmpRand) + end) +end + +local function CreateParticleThreeList() + particleThreeList = gl.CreateList(function() + local tmpRand = math.random() + math.randomseed(3) + gl.BeginEnd(GL.POINTS, function() + for i = 1, aparticleDensity do + local x = math.random() + local y = math.random() + local z = math.random() + local w = math.random() + gl.Vertex(x, y, z, w) + end + end) + math.random(1e9 * tmpRand) + end) +end + +local function CreateCloudList() + cloudOneList = gl.CreateList(function() + + gl.BeginEnd(GL.POINTS, function() +glVertex(-30,0,40) +glVertex(-40,30,-20) +glVertex(-40,-20,0) +glVertex(-30,-40,30) +glVertex(-30,10,-20) +glVertex(-20,0,-20) +glVertex(-10,-20,-30) +glVertex(-20,50,50) +glVertex(-20,40,0) +glVertex(-20,-30,40) +glVertex(-30,-50,10) +glVertex(30,10,30) +glVertex(30,-30,10) +glVertex(20,-10,40) +glVertex(20,-50,30) +glVertex(30,50,-10) +glVertex(20,20,-20) +glVertex(20,-20,10) +glVertex(0,70,-50) +glVertex(0,-40,30) +glVertex(0,-10,10) +glVertex(0,-20,-20) +glVertex(0,-60,50) +glVertex(0,-40,0) +glVertex(0,-30,80) +glVertex(0,20,0) +glVertex(0,40,60) +glVertex(0,-20,30) + end) + end) +end + + +local function CreateRainDrops() + rainparticleOneList = glCreateList(function() + local tmpRand = math_random() + math_randomseed(6) + glBeginEnd(GL.LINES, function() + for i = 1, particleDensity do + local x = math_random(-3000,3000) + local y = math_random(-5000,10000) + local z = math_random(-3000,3000) + glColor(ColorFunc()) + glVertex(x,y,z) + glVertex(x,y- math_random(20,40),z) + end + end) + math_random(1e9 * tmpRand) + end) + + rainparticleTwoList = glCreateList(function() + local tmpRand = math_random() + math_randomseed(6) + glBeginEnd(GL.LINES, function() + for i = 1, particleDensity do + local x = math_random(-3000,3000) + local y = math_random(-5000,20000) + local z = math_random(-3000,3000) + glColor(ColorFunc()) + glVertex(x,y,z) + glVertex(x,y- math_random(20,40),z) + end + end) + math_random(1e9 * tmpRand) + end) + + rainparticleThreeList = glCreateList(function() + local tmpRand = math_random() + math_randomseed(6) + glBeginEnd(GL.LINES, function() + for i = 1, particleDensity do + local x = math_random(-3000,3000) + local y = math_random(-5000,30000) + local z = math_random(-3000,3000) + glColor(ColorFunc()) + glVertex(x,y,z) + glVertex(x,y- math_random(20,40),z) + end + end) + math_random(1e9 * tmpRand) + end) + + if (rainparticleOneList == nil) then + return false + end + return true +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Update(dt) +t = t + dt + +r = r + 2000*dt + f = f +1 + -- Spring.Echo(f) +if r >= b then +r = b +end +K = (X*Z/3500)*nbPlayers +-- Spring.Echo(rfx) +p = 1-(math.exp(-r/K)) +particleDensity = 15000*(1-gl.GetAtmosphere("fogStart")) +-- Spring.Echo(aparticleDensity) +aparticleDensity = 15000*(p) +if particleDensity >= 15000 then +particleDensity = 15000 +end + +if aparticleDensity >= 15000 then +aparticleDensity = 15000 +end + b = b * 0.9995^(dt*30) + -- Spring.Echo(dt*30) + +if f%150 == 0 then + if (Spring.GetMapOptions().alt == "0") then + widgetHandler:RemoveWidget() + return + end + if (glCreateShader == nil) then + Spring.Echo("[Weather Particles:Initialize] no shader support") + widgetHandler:RemoveWidget() + return + end +CreateRainDrops() + -- CreateParticleOneList() + -- CreateParticleTwoList() + -- CreateParticleThreeList() + + -- Spring.Echo("Finished Snow / Rain Shader") + end +end + +function widget:Initialize() +t = 0 +f = 0 +rfx = 0 +roster = Spring.GetPlayerRoster(2) +nbPlayers = 0 +for i,isSpec in pairs(roster) do +if isSpec[5] == false then +nbPlayers = nbPlayers + 1 +end +end + + if (Spring.GetMapOptions().alt == "0") then + widgetHandler:RemoveWidget() + return + end + if (glCreateShader == nil) then + Spring.Echo("[Weather Particles:Initialize] no shader support") + widgetHandler:RemoveWidget() + return + end + + shader = glCreateShader({ + + vertex = [[ + uniform float time; + uniform float scale; + uniform vec3 speed; + uniform vec3 camPos; + void main(void) + { + vec3 scalePos = vec3(gl_Vertex) * scale; + + gl_FrontColor = vec4(0.8,0.8,0.9,0.0 + 0.8 * cos(scalePos.y)); + + vec3 pos = scalePos - mod(camPos, scale); + pos.y -= time * 0.5 * (speed.x * (2.0 + gl_Vertex.w)); + pos.x += (sin(time)*10.0) + (time * speed.y); + pos.z += (cos(time)*10.0) + (time * speed.z); + pos = mod(pos, scale) - (scale * 0.5) + camPos; + if (pos.y < 0.0) { + gl_FrontColor *= 1.0 + 2.0 * (pos.y / scale); + pos.y = 0.0; + } + vec4 eyePos = gl_ModelViewMatrix * vec4(pos, 1.0); + + gl_PointSize = (1.0 + gl_Vertex.w) * 5000.0 / length(eyePos); + + gl_Position = gl_ProjectionMatrix * eyePos; + } + ]], + uniform = { + time = diffTime, + scale = 0, + speed = {0,0,0}, + camPos = {0,0,0}, + }, + }) + +rainshader = glCreateShader({ + vertex = [[ + void main(void) + { + gl_FrontColor = gl_Color; + gl_Position = ftransform(); + } + ]], + }) + +cloudshader = glCreateShader({ + vertex = [[ + uniform vec3 camPos; + void main(void) + { + + //float myLength = distance(gl_Vertex.xyz, camPos.xyz); + //gl_PointSize = 100.0 / myLength / 1000; + gl_Position = ftransform(); + + } + ]], + uniform = { + camPos = {0,0,0}, + }, + }) + + if (shader == nil) then + Spring.Echo("[Weather Particles:Initialize] particle shader compilation failed") + Spring.Echo(glGetShaderLog()) + widgetHandler:RemoveWidget() + return + end + + if (rainshader == nil) then + Spring.Echo("[Weather Particles:Initialize] rain shader compilation failed") + Spring.Echo(glGetShaderLog()) + widgetHandler:RemoveWidget() + return + end + + if (cloudshader == nil) then + Spring.Echo("[Weather Particles:Initialize] cloud shader compilation failed") + Spring.Echo(glGetShaderLog()) + widgetHandler:RemoveWidget() + return + end + + shaderTimeLoc = glGetUniformLocation(shader, 'time') + shaderCamPosLoc = glGetUniformLocation(shader, 'camPos') + + shaderScaleLoc = glGetUniformLocation(shader, 'scale') + shaderSpeedLoc = glGetUniformLocation(shader, 'speed') + + cloudShaderCamPosLoc = glGetUniformLocation(cloudshader, 'camPos') + + CreateParticleOneList() + CreateParticleTwoList() + CreateParticleThreeList() + CreateCloudList() + CreateRainDrops() + + Spring.Echo("Finished Snow / Rain Shader") + +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +function widget:DrawWorld() + + + if particleType == 1 then + camX,camY,camZ = Spring.GetCameraPosition() + glDepthTest(GL.LEQUAL) + glBlending(GL.SRC_ALPHA, GL.ONE) + gl.DepthMask(false) + glUseShader(rainshader) + + firstPos = firstPos - particleOneGravity + if firstPos <= camY-10000 then + firstPos = camY + 100 + end + + gl.Translate(camX,firstPos,camZ) + glCallList(rainparticleOneList) + + secondPos = secondPos - particleTwoGravity + if secondPos <= camY-20000 then + secondPos = camY + 300 + end + gl.Translate(camX,secondPos,camZ) + glCallList(rainparticleTwoList) + + + thirdPos = thirdPos - particleThreeGravity + if thirdPos <= camY-30000 then + thirdPos = camY + 500 + end + gl.Translate(camX,thirdPos,camZ) + glCallList(rainparticleThreeList) + + glUseShader(shader) + camX,camY,camZ = Spring.GetCameraPosition() + diffTime = Spring.DiffTimers(Spring.GetTimer(), startTimer) + --Spring.Echo(diffTime,camX,camY,camZ) + glUniform(shaderTimeLoc,diffTime * 1) + glUniform(shaderCamPosLoc, camX, camY, camZ) + + glDepthTest(true) + glBlending(GL.SRC_ALPHA, GL.ONE) + + gl.PointSprite(true, true) + gl.PointSize(10.0) + gl.PointParameter(0, 0, 0.001, 0, 1e9, 1) + + glTexture(particleOneTexture) + glUniform(shaderScaleLoc, particleOneScale) + glUniform(shaderSpeedLoc, particleOneGravity,particleOneDriftX, particleOneDriftZ) + glCallList(particleOneList) + + + glTexture(particleTwoTexture) + glUniform(shaderScaleLoc, particleTwoScale) + glUniform(shaderSpeedLoc, particleTwoGravity, particleTwoDriftX, particleTwoDriftZ) + glCallList(particleTwoList) + + glTexture(particleThreeTexture) + glUniform(shaderScaleLoc, particleThreeScale) + glUniform(shaderSpeedLoc, particleThreeGravity, particleThreeDriftX, particleThreeDriftZ) + glCallList(particleThreeList) + end + + + + if particleType == 3 then + glColor(1.0,1.0,1.0,1.0) + glUseShader(cloudshader) + camX,camY,camZ = Spring.GetCameraPosition() + glUniform(cloudShaderCamPosLoc, camX, camY, camZ) + diffTime = Spring.DiffTimers(Spring.GetTimer(), startTimer) + + --glUniform(shaderTimeLoc,diffTime * 1) + glDepthTest(true) + --glTexture(cloudTextureThree) + glBlending(GL.SRC_ALPHA, GL.ONE) + + gl.PointSprite(true, true) + gl.PointSize(1) + gl.PointParameter(0, 0, 0, 0, 1, 1) + gl.Translate(500,1500,500) + glCallList(cloudOneList) + end + + gl.PointParameter(1, 0, 0, 0, 1e9, 1) + gl.PointSize(1.0) + gl.PointSprite(false, false) + glResetState() + glUseShader(0) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/gfx_settings_high.lua b/LuaUI/Widgets_Evo/gfx_settings_high.lua deleted file mode 100644 index f1c2433fb..000000000 --- a/LuaUI/Widgets_Evo/gfx_settings_high.lua +++ /dev/null @@ -1,36 +0,0 @@ -function widget:GetInfo() - return { - name = "Graphics Settings (4 - High)", - desc = "Sets graphics settings for you to predefined settings", - author = "Forboding Angel", - date = "01-21-2014", - license = "GPL v2 or later", - layer = 5, - enabled = false - } -end - -function widget:Initialize() - Spring.SendCommands("advmapshading 1") - Spring.SendCommands("advmodelshading 1") - Spring.SendCommands("dynamicsky 0") - Spring.SendCommands("dynamicsun 1") - Spring.SendCommands("maxparticles 5000") - Spring.SendCommands("maxnanoparticles 2000") - Spring.SendCommands("water 3") - Spring.SendCommands("shadows 2 8192") - - Spring.SetConfigInt("3DTrees",1) - Spring.SetConfigInt("AdvSky",0) - Spring.SetConfigString("DynamicSunMinElevation", "0.3") - Spring.SetConfigInt("FSAALevel",8) - Spring.SetConfigInt("FeatureDrawDistance",999999) - Spring.SetConfigInt("FeatureFadeDistance",999999) - Spring.SetConfigInt("GrassDetail",0) - Spring.SetConfigInt("GroundDetail",64) - Spring.SetConfigInt("MaxSounds",128) - Spring.SetConfigInt("ScrollWheelSpeed",-25) - - widgetHandler:RemoveWidget() -end - diff --git a/LuaUI/Widgets_Evo/gfx_settings_low.lua b/LuaUI/Widgets_Evo/gfx_settings_low.lua deleted file mode 100644 index 551914714..000000000 --- a/LuaUI/Widgets_Evo/gfx_settings_low.lua +++ /dev/null @@ -1,35 +0,0 @@ -function widget:GetInfo() - return { - name = "Graphics Settings (2 - Low)", - desc = "Sets graphics settings for you to predefined settings", - author = "Forboding Angel", - date = "01-21-2014", - license = "GPL v2 or later", - layer = 5, - enabled = false - } -end - -function widget:Initialize() - Spring.SendCommands("advmapshading 0") - Spring.SendCommands("advmodelshading 1") - Spring.SendCommands("dynamicsky 0") - Spring.SendCommands("dynamicsun 0") - Spring.SendCommands("maxparticles 2500") - Spring.SendCommands("maxnanoparticles 1000") - Spring.SendCommands("water 3") - Spring.SendCommands("shadows 0") - - Spring.SetConfigInt("3DTrees",0) - Spring.SetConfigInt("AdvSky",0) - Spring.SetConfigString("DynamicSunMinElevation", "0.3") - Spring.SetConfigInt("FSAALevel",2) - Spring.SetConfigInt("FeatureDrawDistance",999999) - Spring.SetConfigInt("FeatureFadeDistance",999999) - Spring.SetConfigInt("GrassDetail",0) - Spring.SetConfigInt("GroundDetail",32) - Spring.SetConfigInt("MaxSounds",128) - Spring.SetConfigInt("ScrollWheelSpeed",-25) - - widgetHandler:RemoveWidget() -end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gfx_settings_medium.lua b/LuaUI/Widgets_Evo/gfx_settings_medium.lua deleted file mode 100644 index 7ba95bbd9..000000000 --- a/LuaUI/Widgets_Evo/gfx_settings_medium.lua +++ /dev/null @@ -1,36 +0,0 @@ -function widget:GetInfo() - return { - name = "Graphics Settings (3 - Medium)", - desc = "Sets graphics settings for you to predefined settings", - author = "Forboding Angel", - date = "01-21-2014", - license = "GPL v2 or later", - layer = 5, - enabled = false - } -end - -function widget:Initialize() - Spring.SendCommands("advmapshading 1") - Spring.SendCommands("advmodelshading 1") - Spring.SendCommands("dynamicsky 0") - Spring.SendCommands("dynamicsun 1") - Spring.SendCommands("maxparticles 5000") - Spring.SendCommands("maxnanoparticles 2000") - Spring.SendCommands("water 3") - Spring.SendCommands("shadows 2 2048") - - Spring.SetConfigInt("3DTrees",1) - Spring.SetConfigInt("AdvSky",0) - Spring.SetConfigString("DynamicSunMinElevation", "0.3") - Spring.SetConfigInt("FSAALevel",4) - Spring.SetConfigInt("FeatureDrawDistance",999999) - Spring.SetConfigInt("FeatureFadeDistance",999999) - Spring.SetConfigInt("GrassDetail",0) - Spring.SetConfigInt("GroundDetail",64) - Spring.SetConfigInt("MaxSounds",128) - Spring.SetConfigInt("ScrollWheelSpeed",-25) - - widgetHandler:RemoveWidget() -end - diff --git a/LuaUI/Widgets_Evo/gfx_settings_ultra_high.lua b/LuaUI/Widgets_Evo/gfx_settings_ultra_high.lua deleted file mode 100644 index a5d12d740..000000000 --- a/LuaUI/Widgets_Evo/gfx_settings_ultra_high.lua +++ /dev/null @@ -1,36 +0,0 @@ -function widget:GetInfo() - return { - name = "Graphics Settings (5 - Ultra High)", - desc = "Sets graphics settings for you to predefined settings", - author = "Forboding Angel", - date = "01-21-2014", - license = "GPL v2 or later", - layer = 5, - enabled = false - } -end - -function widget:Initialize() - Spring.SendCommands("advmapshading 1") - Spring.SendCommands("advmodelshading 1") - Spring.SendCommands("dynamicsky 0") - Spring.SendCommands("dynamicsun 1") - Spring.SendCommands("maxparticles 5000") - Spring.SendCommands("maxnanoparticles 2000") - Spring.SendCommands("water 3") - Spring.SendCommands("shadows 1 8192") - - Spring.SetConfigInt("3DTrees",1) - Spring.SetConfigInt("AdvSky",0) - Spring.SetConfigString("DynamicSunMinElevation", "0.3") - Spring.SetConfigInt("FSAALevel",16) - Spring.SetConfigInt("FeatureDrawDistance",999999) - Spring.SetConfigInt("FeatureFadeDistance",999999) - Spring.SetConfigInt("GrassDetail",0) - Spring.SetConfigInt("GroundDetail",120) - Spring.SetConfigInt("MaxSounds",128) - Spring.SetConfigInt("ScrollWheelSpeed",-25) - - widgetHandler:RemoveWidget() -end - diff --git a/LuaUI/Widgets_Evo/gfx_settings_ultra_low.lua b/LuaUI/Widgets_Evo/gfx_settings_ultra_low.lua deleted file mode 100644 index e3ecf9aaa..000000000 --- a/LuaUI/Widgets_Evo/gfx_settings_ultra_low.lua +++ /dev/null @@ -1,36 +0,0 @@ -function widget:GetInfo() - return { - name = "Graphics Settings (1 - Ultra Low)", - desc = "Sets graphics settings for you to predefined settings", - author = "Forboding Angel", - date = "01-21-2014", - license = "GPL v2 or later", - layer = 5, - enabled = false - } -end - -function widget:Initialize() - Spring.SendCommands("advmapshading 0") - Spring.SendCommands("advmodelshading 0") - Spring.SendCommands("dynamicsky 0") - Spring.SendCommands("dynamicsun 0") - Spring.SendCommands("maxparticles 2000") - Spring.SendCommands("maxnanoparticles 500") - Spring.SendCommands("water 0") - Spring.SendCommands("shadows 0") - - Spring.SetConfigInt("3DTrees",0) - Spring.SetConfigInt("AdvSky",0) - Spring.SetConfigString("DynamicSunMinElevation", "0.3") - Spring.SetConfigInt("FSAALevel",0) - Spring.SetConfigInt("FeatureDrawDistance",999999) - Spring.SetConfigInt("FeatureFadeDistance",999999) - Spring.SetConfigInt("GrassDetail",0) - Spring.SetConfigInt("GroundDetail",32) - Spring.SetConfigInt("MaxSounds",128) - Spring.SetConfigInt("ScrollWheelSpeed",-25) - - widgetHandler:RemoveWidget() -end - diff --git a/LuaUI/Widgets_Evo/gfx_snow.lua b/LuaUI/Widgets_Evo/gfx_snow.lua new file mode 100644 index 000000000..3da632f17 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_snow.lua @@ -0,0 +1,606 @@ + +function widget:GetInfo() + return { + name = "Snow", + desc = "Lets it automaticly snow on snow maps! - also togglable with /snow (remembers per map)", + author = "Floris (original: trepan, Argh)", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + layer = -24, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- /snow -- toggles snow on current map (also remembers this) + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +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) +local particleMultiplier = 0.005 -- amount of particles +local customParticleMultiplier = 1 +local windMultiplier = 4.5 +local maxWindSpeed = 25 -- to keep it real +local gameFrameCountdown = 120 -- on launch: wait this many frames before adjusting the average fps calc +local particleScaleMultiplier = 1 + +-- pregame info message +local autoReduce = true +local fadetime = 13 +local fadetimeThreshold = 30 +local textStartOpacity = 0.6 + +local fpsDifference = (maxFps-minFps)/particleSteps -- fps difference need before changing the dlist to one with fewer particles + +local snowTexFolder = "LuaUI/Images/snow/" + +local snowKeywords = {'snow','frozen','cold','winter','ice','icy','arctic','frost','melt','glacier','mosh_pit','blindside','northernmountains','amarante','cervino'} + +local snowMaps = {} + +-- disable for maps that have a keyword but are not snowmaps +snowMaps['sacrifice_v1'] = false + +-- disable for maps already containing a snow widget +snowMaps['xenolithic_v4'] = false +snowMaps['thecoldplace'] = false + + +local particleTypes = {} +table.insert(particleTypes, { + texture = 'snow1.dds', + gravity = 50, + scale = 5500 +}) +table.insert(particleTypes, { + texture = 'snow2.dds', + gravity = 44, + scale = 5500 +}) +table.insert(particleTypes, { + texture = 'snow3.dds', + gravity = 58, + scale = 5500 +}) +table.insert(particleTypes, { + texture = 'snow4.dds', + gravity = 62, + scale = 6600 +}) +table.insert(particleTypes, { + texture = 'snow5.dds', + gravity = 47, + scale = 6600 +}) +table.insert(particleTypes, { + texture = 'snow6.dds', + gravity = 54, + scale = 6600 +}) + +local avgFpsInit = false + +local math_random = math.random +local math_randomseed = math.randomseed + +local shader +local shaderTimeLoc +local shaderCamPosLoc +local shaderScaleLoc +local shaderSpeedLoc + +local startTimer = Spring.GetTimer() +local diffTime = 0 + +local spGetFPS = Spring.GetFPS +local averageFps = 60 +local spGetVisibleUnits = Spring.GetVisibleUnits +local spGetVisibleFeatures = Spring.GetVisibleFeatures + +local firstPos = 0 +local secondPos = 0 +local thirdPos = 0 +local camX,camY,camZ +local vsx, vsy = gl.GetViewSizes() +local particleScale = 1 +local startTime = os.clock() + +local offsetX = 0 +local offsetZ = 0 +local prevOsClock = os.clock() +local gameStarted = false + +local enabled = false +local previousFps = (maxFps + minFps) / 1.75 +local particleStep = math.floor(particleSteps / 1.33) +if particleStep < 1 then particleStep = 1 end +local currentMapname = Game.mapName:lower() +local particleLists = {} +local particleDensityMax = 0 +local particleDensity = 0 +local previousParticleAmount = particleDensity + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local spGetWind = Spring.GetWind +local spGetGameFrame = Spring.GetGameFrame + +local glBeginEnd = gl.BeginEnd +local glVertex = gl.Vertex +local glColor = gl.Color +local glBlending = gl.Blending +local glTranslate = gl.Translate +local glCallList = gl.CallList +local glDepthTest = gl.DepthTest +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glTexture = gl.Texture +local glGetShaderLog = gl.GetShaderLog +local glCreateShader = gl.CreateShader +local glDeleteShader = gl.DeleteShader +local glUseShader = gl.UseShader +local glUniformMatrix = gl.UniformMatrix +local glUniformInt = gl.UniformInt +local glUniform = gl.Uniform +local glGetUniformLocation = gl.GetUniformLocation +local glGetActiveUniforms = gl.GetActiveUniforms +local glBeginEnd = gl.BeginEnd +local glPointSprite = gl.PointSprite +local glPointSize = gl.PointSize +local glPointParameter = gl.PointParameter +local glResetState = gl.ResetState +local GL_POINTS = GL.POINTS + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +local windDirX, _, windDirZ, _ = spGetWind() +local startOsClock = os.clock() + + +function widget:Shutdown() + removeSnow() + WG['snow'] = nil +end + +function removeSnow() + removeParticleLists() + if shader ~= nil then + glDeleteShader(shader) + end +end + +function removeParticleLists() + if particleLists[1] ~= nil then + for layer=1, 3 do + for step=1, particleSteps do + glDeleteList(particleLists[layer][step]) + end + end + particleLists = {} + end +end + +-- creating multiple lists per particleType so we can switch to less particles without causing lag +local function CreateParticleLists() + removeParticleLists() + particleDensityMax = math.floor(((vsx * vsy) * (particleMultiplier*customParticleMultiplier)) / #particleTypes) + particleDensity = particleDensityMax * ((averageFps-minFps) / maxFps) + for particleType, pt in pairs(particleTypes) do + particleLists[particleType] = {} + for step=1, particleSteps do + --local density = (particleDensityMax/particleSteps) * step + local particles = math.floor(((particleDensityMax/particleSteps) * step) / (((particleSteps+(particleSteps/2)) - step) / (particleSteps/2))) + particleLists[particleType][step] = gl.CreateList(function() + local tmpRand = math.random() + math.randomseed(particleType) + gl.BeginEnd(GL.POINTS, function() + for i = 1, particles do + local x = math.random() + local y = math.random() + local z = math.random() + local w = math.random() + local w = 1 + gl.Vertex(x, y, z, w) + end + end) + math.random(1e9 * tmpRand) + end) + end + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +function init() + + -- abort if not enabled + if enabled == false then return end + + if (glCreateShader == nil) then + Spring.Echo("[Snow widget:Initialize] no shader support") + widgetHandler:RemoveWidget(self) + return + end + + shader = glCreateShader({ + vertex = [[ + #version 150 compatibility + uniform float time; + uniform float scale; + uniform vec3 speed; + uniform vec3 camPos; + void main(void) + { + vec3 scalePos = vec3(gl_Vertex) * scale; + + gl_FrontColor = vec4(0.8,0.8,0.9,0.66 * cos(scalePos.y)); + + vec3 pos = scalePos - mod(camPos, scale); + pos.y -= time * 0.5 * (speed.x * (2.0 + gl_Vertex.w)); + + pos.x += (sin(time*1.5)*3) + speed.y; + pos.z += (cos(time*1.5)*3) + speed.z; + + if (pos.x >= 1) { + pos.x -= 1; + } + if (pos.x < 0) { + pos.x += 1; + } + if (pos.z >= 1) { + pos.z -= 1; + } + if (pos.z < 0) { + pos.z += 1; + } + pos = mod(pos, scale) - (scale * 0.5) + camPos; + + vec4 eyePos = gl_ModelViewMatrix * vec4(pos, 1.0); + + gl_PointSize = (1.0 + gl_Vertex.w) * 5000.0 / length(eyePos); + + gl_Position = gl_ProjectionMatrix * eyePos; + } + ]], + uniform = { + time = diffTime, + scale = 0, + speed = {0,0,0}, + camPos = {0,0,0}, + }, + }) + + if (shader == nil) then + Spring.Echo("[Snow widget:Initialize] particle shader compilation failed") + Spring.Echo(glGetShaderLog()) + widgetHandler:RemoveWidget(self) + return + end + + shaderTimeLoc = glGetUniformLocation(shader, 'time') + shaderCamPosLoc = glGetUniformLocation(shader, 'camPos') + + shaderScaleLoc = glGetUniformLocation(shader, 'scale') + shaderSpeedLoc = glGetUniformLocation(shader, 'speed') + + if particleLists[1] == nil then + CreateParticleLists() + end +end + + +function getWindSpeed() + windDirX, _, windDirZ, _ = spGetWind() + + -- cap windspeed while preserving direction + if windDirX > maxWindSpeed and windDirX > windDirZ then + windDirZ = (windDirZ / windDirX) * maxWindSpeed + windDirX = maxWindSpeed + elseif windDirZ > maxWindSpeed and windDirZ > windDirX then + windDirX = (windDirX / windDirZ) * maxWindSpeed + windDirZ = maxWindSpeed + end +end + +function widget:Initialize() + + WG['snow'] = {} + WG['snow'].getSnowMap = function() + if enabled or widgetDisabledSnow then + return true + else + return false + end + end + WG['snow'].setMultiplier = function(value) + customParticleMultiplier = value + if enabled or widgetDisabledSnow then + CreateParticleLists() + end + end + WG['snow'].setAutoReduce = function(value) + autoReduce = value + if autoReduce == false then + enabled = true + particleStep = particleSteps + widgetDisabledSnow = false + else + avgFpsInit = true + averageFps = spGetFPS() + end + end + WG['snow'].setSnowMap = function(value) + snowMaps[currentMapname] = value + enabled = value + if value then + init() + else + removeSnow() + end + end + + if spGetGameFrame() > 0 then + gameStarted = true + end + + drawinfolist = gl.CreateList( function() + 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 = font:GetTextWidth(text)*fontSize + local textHeight = font:GetTextHeight(text)*fontSize + --gl.Text(text, -textWidth/2, -textHeight/2, fontSize, "") + 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() + -- check for keywords + local keywordFound = false + for _,keyword in pairs(snowKeywords) do + if string.find(currentMapname, keyword) then + enabled = true + keywordFound = true + break + end + end + -- check for remembered snow state + if snowMaps[currentMapname] ~= nil then + if snowMaps[currentMapname] == true then + enabled = true + elseif snowMaps[currentMapname] == false then + enabled = false + end + end + -- save enabled snow state + if enabled and keywordFound then + snowMaps[currentMapname] = true + end + + getWindSpeed() + init() +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local widgetDisabledSnow = false +function widget:GameFrame(gameFrame) + if gameFrame == 1 then + gameStarted = true + if drawinfolist ~= nil then + gl.DeleteList(drawinfolist) + end + end + + if not enabled and not widgetDisabledSnow then return end + + if gameFrameCountdown <= 0 then + if gameFrame%31==0 then + getWindSpeed() + end + if gameFrame%44==0 then + averageFps = ((averageFps * 19) + spGetFPS()) / 20 + if averageFps < 1 then averageFps = 1 end + --Spring.Echo(particleStep.." avg fps: "..averageFps) + end + if gameFrame%88==0 and autoReduce then + if averageFps >= previousFps+fpsDifference or averageFps <= previousFps-fpsDifference then + local particleAmount = (averageFps-minFps) / (maxFps-minFps) + if particleAmount > 1 then + particleAmount = 1 + end + if previousParticleAmount ~= particleAmount then + previousParticleAmount = particleAmount + previousFps = averageFps + if particleAmount <= 1/particleSteps then + enabled = false + widgetDisabledSnow = true + else + particleDensity = math.floor(particleDensityMax * particleAmount) + if particleDensity > particleDensityMax then particleDensity = particleDensityMax end + particleStep = math.floor(particleDensity / (particleDensityMax / particleSteps)) + if particleStep < 1 then particeStep = 1 end + enabled = true + widgetDisabledSnow = false + end + end + end + end + else + gameFrameCountdown = gameFrameCountdown - 1 + end +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 + if not avgFpsInit then + avgFpsInit = true + averageFps = spGetFPS() + end + local now = os.clock() + local opacityMultiplier = (((startTime+fadetimeThreshold) - now) / fadetime) + if opacityMultiplier > 1 then opacityMultiplier = 1 end + + if opacityMultiplier > 0 then + gl.PushMatrix() + gl.Translate(vsx/2, vsy/1.5, 0) + gl.Scale(widgetScale,widgetScale,0) + gl.Color(1,1,1,textStartOpacity*opacityMultiplier) + gl.CallList(drawinfolist) + gl.PopMatrix() + end + end +end + +local pausedTime = 0 +local lastFrametime = Spring.GetTimer() +function widget:DrawWorld() + if not enabled then return end + + local _, _, isPaused = Spring.GetGameSpeed() + if isPaused then + pausedTime = pausedTime + Spring.DiffTimers(Spring.GetTimer(), lastFrametime) + end + lastFrametime = Spring.GetTimer() + if os.clock() - startOsClock > 0.5 then -- delay to prevent no textures being shown + if shader ~= nil and particleLists[#particleTypes] ~= nil and particleLists[#particleTypes][particleStep] ~= nil then + glUseShader(shader) + camX,camY,camZ = Spring.GetCameraPosition() + diffTime = Spring.DiffTimers(lastFrametime, startTimer) - pausedTime + + glUniform(shaderTimeLoc,diffTime * 1) + glUniform(shaderCamPosLoc, camX, camY, camZ) + + glDepthTest(true) + glBlending(GL.SRC_ALPHA, GL.ONE) + + gl.PointSprite(true, true) + gl.PointSize(10.0) + gl.PointParameter(0, 0, 0.001, 0, 1e9, 1) + + local osClock = os.clock() + local timePassed = osClock - prevOsClock + prevOsClock = osClock + + if not isPaused then + offsetX = offsetX + ((windDirX * windMultiplier) * timePassed) + offsetZ = offsetZ + ((windDirZ * windMultiplier) * timePassed) + end + + for particleType, pt in pairs(particleTypes) do + glTexture(snowTexFolder..pt.texture) + glUniform(shaderScaleLoc, pt.scale*particleScale) + glUniform(shaderSpeedLoc, pt.gravity, offsetX, offsetZ) + glCallList(particleLists[particleType][particleStep]) + glTexture(false) + end + + gl.PointParameter(1, 0, 0, 0, 1e9, 1) + gl.PointSize(1.0) + gl.PointSprite(false, false) + glResetState() + glUseShader(0) + end + end +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 + --particleScale = (0.60 + (vsx*vsy / 8000000)) * particleScaleMultiplier + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetConfigData(data) + savedTable = {} + savedTable.snowMaps = snowMaps + savedTable.averageFps = math.floor(averageFps) + savedTable.particleStep = particleStep + savedTable.gameframe = Spring.GetGameFrame() + savedTable.customParticleMultiplier = customParticleMultiplier + savedTable.autoReduce = autoReduce + return savedTable +end + +function widget:SetConfigData(data) + if data.snowMaps ~= nil then snowMaps = data.snowMaps end + if data.customParticleMultiplier ~= nil then customParticleMultiplier = data.customParticleMultiplier end + if data.autoReduce ~= nil then autoReduce = data.autoReduce end + if data.gameframe ~= nil and data.gameframe > 0 then + if data.averageFps ~= nil then + averageFps = data.averageFps + avgFpsInit = true + end + if data.particleStep ~= nil and data.gameframe ~= nil and Spring.GetGameFrame() > 0 then + particleStep = data.particleStep + if particleStep < 1 then particleStep = 1 end + if particleStep > particleSteps then particleStep = particleSteps end + end + end +end + +function widget:TextCommand(command) + if (string.find(command, "snow") == 1 and string.len(command) == 4) then + if snowMaps[currentMapname] == nil or snowMaps[currentMapname] == false then + snowMaps[currentMapname] = true + enabled = true + Spring.Echo("Snow widget: snow enabled for this map. (Snow wont show when average fps is below "..minFps..".)") + init() + else + snowMaps[currentMapname] = false + enabled = false + Spring.Echo("Snow widget: snow disabled for this map.") + removeSnow() + end + end +end 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 new file mode 100644 index 000000000..729ec4b62 --- /dev/null +++ b/LuaUI/Widgets_Evo/gfx_weather.lua @@ -0,0 +1,228 @@ +function widget:GetInfo() + return { + name = "Weather", + desc = "Darkens map, with more red colors while the total damages dealt in game increase to give a warfare feeling", + author = "Doo", + date = "25 april 2015", + version = "133.7", + license = "GNU GPL, v2 or later", + layer = -4, + enabled = true, -- loaded by default? + } +end + +local timeCyclesWeatherEffects = Spring.GetConfigInt("evo_timecyclesweathereffects", 0) +if timeCyclesWeatherEffects ~= 1 then + return false +end + +lightningcolor = 0 + +function widget:Initialize() + spx,spy,spz = gl.GetSun() + r = 1 + b = 1 + f = 0 + t = 0 + diffuse = {} + ambient = {} + specular = {} + fogColor = {} + sunColor = {} + skyColor = {} + cloudColor = {} + + newdiffuse = {} + newambient = {} + newspecular = {} + newfogColor = {} + newsunColor = {} + newskyColor = {} + newcloudColor = {} + + X = Game.mapSizeX + Z = Game.mapSizeZ + shadowDensity = gl.GetSun("shadowDensity") + diffuse.r, diffuse.g, diffuse.b = gl.GetSun("diffuse") + ambient.r, ambient.g, ambient.b = gl.GetSun("ambient") + specular.r, specular.g, specular.b = gl.GetSun("specular") + + fogStart = gl.GetAtmosphere("fogStart") + fogEnd = gl.GetAtmosphere("fogEnd") + fogColor.r, fogColor.g, fogColor.b = gl.GetAtmosphere("fogColor") + + sunColor.r, sunColor.g, sunColor.b = gl.GetAtmosphere("sunColor") + skyColor.r, skyColor.g, skyColor.b = gl.GetAtmosphere("skyColor") + cloudColor.r, cloudColor.g, cloudColor.b = gl.GetAtmosphere("cloudColor") + + --water + -- waterBase = {} + -- waterAbsorb = {} + -- waterMin = {} + -- waterSurface = {} + -- waterSpecular = {} + -- waterPlane = {} + -- newwaterBase = {} + -- newwaterAbsorb = {} + -- newwaterMin = {} + -- newwaterSurface = {} + -- newwaterSpecular = {} + -- newwaterPlane = {} + + -- waterBase.r, waterBase.g, waterBase.b = Game.waterBaseColor[1], Game.waterBaseColor[2], Game.waterBaseColor[3] + -- waterAbsorb.r, waterAbsorb.g, waterAbsorb.b = Game.waterAbsorb[1], Game.waterAbsorb[2], Game.waterAbsorb[3] + -- waterMin.r, waterMin.g, waterMin.b = Game.waterMinColor[1], Game.waterMinColor[2], Game.waterMinColor[3] + -- waterSurface.r, waterSurface.g, waterSurface.b = Game.waterSurfaceColor[1], Game.waterSurfaceColor[2], Game.waterSurfaceColor[3] + -- waterSpecular.r, waterSpecular.g, waterSpecular.b = Game.waterSpecularColor[1], Game.waterSpecularColor[2], Game.waterSpecularColor[3] + -- waterPlane.r, waterPlane.g, waterPlane.b = Game.waterPlaneColor[1], Game.waterSpecularColor[2], Game.waterSpecularColor[3] + rain = 0 + roster = Spring.GetPlayerRoster(2) + nbPlayers = 0 + for i,isSpec in pairs(roster) do + if isSpec[5] == false then + nbPlayers = nbPlayers + 1 + end + end +end + +function widget:UnitDestroyed(unitID) + explosion = UnitDefs[Spring.GetUnitDefID(unitID)].deathExplosion + maxlightningcolor = (WeaponDefs[WeaponDefNames[explosion].id].damages[1]^0.001 * WeaponDefs[WeaponDefNames[explosion].id].damageAreaOfEffect)/160 + --Spring.Echo(maxlightningcolor) + lightning = false +end + +function GameStart() + spx,spy,spz = gl.GetSun() + r = 1 + roster = Spring.GetPlayerRoster(2) + nbPlayers = 0 + for i,isSpec in pairs(roster) do + if isSpec[5] == false then + nbPlayers = nbPlayers + 1 + end + end +end + +function widget:UnitDamaged(_,_,_,da) +-- if da >= 1500 then +-- da = 1500 +-- end +-- b = b + da +end +sunframe = 0 +function widget:Update(dt) + sunframe = sunframe + dt * 0.15 + lightningcolor = 0 + if n == nil or n == 150 then + n = 1 + lightning = false + end + + if lightning == true then + -- Spring.Echo(lightningcolor) + lightningcolor = (maxlightningcolor/n)/2 + if lightningcolor >= 1 then lightningcolor = 1 end + if lightningcolor <= 0.025 then lightningcolor = 0 end + n = n + 1 + end + -- Spring.Echo(b) + -- Spring.Echo(r) + -- Spring.Echo(p) + -- Spring.Echo(b) + -- Spring.Echo(r) + -- Spring.Echo(p) + r = r + 2000*dt + -- Spring.Echo(X) + -- Spring.Echo(Z) + -- Spring.Echo(X*Z/1000) + -- Spring.Echo(K) + K = (X*Z/3500)*nbPlayers + t = t + dt + if r>=b then + r = b + end + -- Spring.Echo(w) + b = b * 0.9995^(dt*30) + + f = f+1 + px,py,pz = gl.GetSun() + -- Spring.SetSunManualControl(true) + Spring.SetSunDirection(math.cos(sunframe/15), 1+math.sin(sunframe/16), math.sin(sunframe/15)) + normpx, normpy, normpz = px/math.sqrt(px^2+py^2+pz^2),py/math.sqrt(px^2+py^2+pz^2),pz/math.sqrt(px^2+py^2+pz^2) + -- Spring.Echo(px) + if normpy <= 0 then + normpy = 0 + end + -- Spring.Echo(normpy) + -- Spring.Echo(pz) + p = (1-(normpy)) + w = 1-(math.exp(-r/K)) + rain = (((1 + math.sin(t/50))/2.3)-0.7)*5.7 + if rain < 0 then rain = 0 end + + -- Spring.Echo(p) + -- Spring.Echo(b) + -- Spring.Echo(p) + if p >= 1 then + p = 1 + end + if w >= 1 then + w = 1 + end + + -- Spring.Echo((1-p)*shadowDensity) + newshadowDensity = (1-p)*shadowDensity + newdiffuse.r, newdiffuse.g, newdiffuse.b = diffuse.r*(1-p)*(1-w)*(1-rain) + 0.035*1*p*(1-w)*(1-rain) + 0.23*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), diffuse.g*(1-p)*(1-w)*(1-rain)+0.035*1*p*(1-w)*(1-rain)+ 0.07*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), diffuse.b*(1-p)*(1-w)*(1-rain)+0.07*1*p*(1-w)*(1-rain)+ 0.035*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w) + + newambient.r, newambient.g, newambient.b = ambient.r, ambient.g, ambient.b -- Use this if it gets too dark + + --newambient.r, newambient.g, newambient.b = ambient.r*(1-p)*(1-w)*(1-rain)+ 0.15*1*p*(1-w)*(1-rain)+ 0.69*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), ambient.g*(1-p)*(1-rain)*(1-w)+0.30*1*p*(1-rain)*(1-w)+ 0.30*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), ambient.b*(1-p)*(1-w)*(1-rain)+0.65*1*p*(1-w)*(1-rain)+ 0.15*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w) -- This is better, but sometimes it gets pitch black + + newspecular.r, newspecular.g, newspecular.b = specular.r*(1-p)*(1-w)+0.2*0.60*1*p*(1-w)*(1-rain) + 0.5*rain*(1-p)*(1-w), specular.g*(1-p)*(1-w)+0.2*0.60*1*p*(1-w)*(1-rain) + 0.5*rain*(1-p)*(1-w), specular.b*(1-p)*(1-w)+0.2*1*1*p*(1-w)*(1-rain) + 0.5*rain*(1-p)*(1-w) + + newfogStart = 1-(math.max(rain, w)) + newfogEnd = 15 + newfogColor.r, newfogColor.g, newfogColor.b, newfogColor["alpha"] = fogColor.r*(1-p)*(1-w)*(1-rain)+0.03*1*p*(1-w)*(1-rain)+ 0.07*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), fogColor.g*(1-p)*(1-w)*(1-rain)+0.06*1*p*(1-w)*(1-rain)+ 0.05*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), fogColor.b*(1-p)*(1-w)*(1-rain)+0.20*1*p*(1-w)*(1-rain)+ 0.05*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), 0 + + newsunColor.r, newsunColor.g, newsunColor.b = sunColor.r*(1-p)*(1-w)*(1-rain)+0.6*1*p*(1-w)*(1-rain)+ 1*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), sunColor.g*(1-p)*(1-w)*(1-rain)+0.95*1*p*(1-w)*(1-rain)+ 0.95*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), sunColor.b*(1-p)*(1-w)*(1-rain)+0.1*1*p*(1-w)*(1-rain)+ 0.60*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w) + newskyColor.r, newskyColor.g, newskyColor.b = skyColor.r*(1-p)*(1-w)*(1-rain)+0.03*1*p*(1-w)*(1-rain)+ 0.2*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), skyColor.g*(1-p)*(1-w)*(1-rain)+0.06*1*p*(1-w)*(1-rain)+ 0.06*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w), skyColor.b*(1-p)*(1-w)*(1-rain)+0.2*1*p*(1-w)*(1-rain)+ 0.03*w*(1-p)*(1-rain) + 0.5*rain*(1-p)*(1-w) + newcloudColor.r, newcloudColor.g, newcloudColor.b = cloudColor.r*(1-p)*(1-w) + 0.5*rain*(1-p)*(1-w), cloudColor.g*(1-p)*(1-w) + 0.5*rain*(1-p)*(1-w), cloudColor.b*(1-p)*(1-w) + 0.5*rain*(1-p)*(1-w) + + if (newdiffuse.r + newdiffuse.g + newdiffuse.b) <= 1.5 then + factor = 1.5/(newdiffuse.r + newdiffuse.g + newdiffuse.b) + newdiffuse.r = newdiffuse.r * factor + newdiffuse.g = newdiffuse.g * factor + newdiffuse.b = newdiffuse.b * factor + end + + if (newambient.r + newambient.g + newambient.b) <= 1.5 then + factor = 1.5/(newdiffuse.r + newdiffuse.g + newdiffuse.b) + newambient.r = newambient.r * factor + newambient.g = newambient.g * factor + newambient.b = newambient.b * factor + end + -- Spring.Echo(rain) + -- Spring.Echo(newfogStart) + + Spring.SetSunLighting({groundAmbientColor = {newambient.r + lightningcolor, newambient.g + lightningcolor, newambient.b + lightningcolor} , groundDiffuseColor = {newdiffuse.r + lightningcolor, newdiffuse.g + lightningcolor, newdiffuse.b + lightningcolor}, groundSpecularColor = {newspecular.r, newspecular.g, newspecular.b}, unitAmbientColor = {newambient.r + lightningcolor, newambient.g + lightningcolor, newambient.b + lightningcolor} , unitDiffuseColor = {newdiffuse.r + lightningcolor, newdiffuse.g + lightningcolor, newdiffuse.b + lightningcolor}, unitSpecularColor = {newspecular.r, newspecular.g, newspecular.b}}) + Spring.SetAtmosphere({fogStart = newfogStart, fogEnd = newfogEnd, fogColor = {newfogColor.r+ lightningcolor, newfogColor.g+ lightningcolor, newfogColor.b+ lightningcolor, 0}, sunColor = {newsunColor.r+ lightningcolor, newsunColor.g+ lightningcolor, newsunColor.b+ lightningcolor}, skyColor = {newskyColor.r , newskyColor.g, newskyColor.b}, cloudColor = {newcloudColor.r+ lightningcolor, newcloudColor.g+ lightningcolor, newcloudColor.b+ lightningcolor}}) + --WATER + + -- Spring.Echo(waterBase.r) + -- newwaterBase.r, newwaterBase.g, newwaterBase.b = waterBase.r*(1-p)+0.23*p, waterBase.g*(1-p)+0.07*p, waterBase.b*(1-p)+0.035*p + -- newwaterAbsorb.r, newwaterAbsorb.g, newwaterAbsorb.b = waterAbsorb.r*(1+p), waterAbsorb.g*(1+p), waterAbsorb.b*(1+p) + -- newwaterMin.r, newwaterMin.g, newwaterMin.b = waterMin.r*(1-p), waterMin.g*(1-p), waterMin.b*(1-p) + -- newwaterSurface.r, newwaterSurface.g, newwaterSurface.b = waterSurface.r*(1-p)+0.23*p, waterSurface.g*(1-p)+0.07*p, waterSurface.b*(1-p)+0.035*p + -- newwaterSpecular.r, newwaterSpecular.g, newwaterSpecular.b = waterSpecular.r*(1-p)+0.05*p, waterSpecular.g*(1-p)+0.05*p, waterSpecular.b*(1-p)+0.05*p + -- newwaterPlane.r, newwaterPlane.g, newwaterPlane.b = waterPlane.r*(1-p)+0.2*p, waterPlane.g*(1-p)+0.06*p, waterPlane.b*(1-p)+0.03*p + + -- Spring.SetWaterParams( + -- {absorb = {newwaterAbsorb.r, newwaterAbsorb.g, newwaterAbsorb.b}, baseColor = {newwaterBase.r, newwaterBase.g, newwaterBase.b}, minColor = {newwaterMin.r, newwaterMin.g, newwaterMin.b}, surfaceColor = {newwaterSurface.r, newwaterSurface.g, newwaterSurface.b}, diffuseColor = {newdiffuse.r, newdiffuse.g, newdiffuse.b}, specularColor = {newwaterSpecular.r, newwaterSpecular.g, newwaterSpecular.b}, planeColor = {newwaterPlane.r, newwaterPlane.g, newwaterPlane.b}}) + + +end +function widget:Shutdown() + Spring.SetSunLighting({groundAmbientColor = {ambient.r, ambient.g, ambient.b} , groundDiffuseColor = {diffuse.r, diffuse.g, diffuse.b}, groundSpecularColor = {specular.r, specular.g, specular.b}, unitAmbientColor = {ambient.r, ambient.g, ambient.b} , unitDiffuseColor = {diffuse.r, diffuse.g, diffuse.b}, unitSpecularColor = {specular.r, specular.g, specular.b}}) + Spring.SetAtmosphere({fogStart = fogStart, fogEnd = fogEnd, fogColor = {fogColor.r, fogColor.g, fogColor.b, fogColor.alpha}, sunColor = {sunColor.r, sunColor.g, sunColor.b}, skyColor = {skyColor.r, skyColor.g, skyColor.b}, cloudColor = {cloudColor.r, cloudColor.g, cloudColor.b}}) +end \ No newline at end of file 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 new file mode 100644 index 000000000..03eb8426d --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_advplayerslist.lua @@ -0,0 +1,4142 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Copyright (C) 2008. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + + +function widget:GetInfo() + return { + name = "AdvPlayersList", + desc = "Playerlist. Use tweakmode (ctrl+F11) to customize.", + author = "Marmoth. (spiced up by Floris)", + date = "25 april 2015", + version = "22.0", + license = "GNU GPL, v2 or later", + layer = -4, + enabled = true, -- loaded by default? + } +end + +--Changelog +-- before v8.0 developed outside of BA by Marmoth +-- v9.0 (Bluestone): modifications to deal with twice as many players/specs; specs are rendered in a small font and cpu/ping does not show for them. +-- v9.1 ([teh]decay): added notification about shared resources +-- v10 (Bluestone): Better use of opengl for a big speed increase & less spaghetti +-- v11 (Bluestone): Get take info from cmd_idle_players +-- v11.1 (Bluestone): Added TrueSkill column +-- v11.2 (Bluestone): Remove lots of hardcoded crap about module names/pictures +-- v11.3 (Bluestone): More cleaning up +-- v11.4 (Bluestone): Mute people with ctrl+click on their name +-- v12 (Floris): Restyled looks + added imageDirectory var + HD-ified rank and some other icons +-- v13 (Floris): Added scale buttons. Added grey cpu/ping icons for spectators. Resized elements. Textured bg. Spec label click to unfold/fold. Added guishader. Lockcamera on doubleclick. Ping in ms/sec/min. Shows dot icon in front of tracked player. HD-ified lots of other icons. Speccing/dead player keep their color. Improved e/m share gui responsiveness. + removed the m_spec option +-- v14 (Floris): Added country flags + Added camera icons for locked camera + specs show bright when they are broadcasting new lockcamera positions + bugfixed lockcamera for specs. Added small gaps between in tweakui icons. Auto scales with resolution changes. +-- v15 (Floris): Integrated LockCamers widget code +-- v16 (Floris): Added chips next to gambling-spectators for betting system +-- 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 + +-------------------------------------------------------------------------------- +-- Config +-------------------------------------------------------------------------------- + +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_GetAllyTeamList = Spring.GetAllyTeamList +local Spring_GetTeamInfo = Spring.GetTeamInfo +local Spring_GetTeamList = Spring.GetTeamList +local Spring_GetPlayerInfo = Spring.GetPlayerInfo +local Spring_GetPlayerList = Spring.GetPlayerList +local Spring_GetTeamColor = Spring.GetTeamColor +local Spring_GetLocalAllyTeamID = Spring.GetLocalAllyTeamID +local Spring_GetLocalTeamID = Spring.GetLocalTeamID +local Spring_GetLocalPlayerID = Spring.GetLocalPlayerID +local Spring_ShareResources = Spring.ShareResources +local Spring_GetTeamUnitCount = Spring.GetTeamUnitCount +local Echo = Spring.Echo +local Spring_GetTeamResources = Spring.GetTeamResources +local Spring_SendCommands = Spring.SendCommands +local Spring_GetConfigInt = Spring.GetConfigInt +local Spring_GetMouseState = Spring.GetMouseState +local Spring_GetAIInfo = Spring.GetAIInfo +local Spring_GetTeamRulesParam = Spring.GetTeamRulesParam +local Spring_IsGUIHidden = Spring.IsGUIHidden +local Spring_GetDrawFrame = Spring.GetDrawFrame +local Spring_GetMyTeamID = Spring.GetMyTeamID +local Spring_AreTeamsAllied = Spring.AreTeamsAllied + +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 + +-------------------------------------------------------------------------------- +-- IMAGES +-------------------------------------------------------------------------------- + +local imageDirectory = ":n:"..LUAUI_DIRNAME.."Images/advplayerslist/" + +local flagsDirectory = imageDirectory.."flags/" + +local bgcorner = LUAUI_DIRNAME.."Images/bgcorner.png" + +local pics = { + chipPic = imageDirectory.."chip.dds", + currentPic = imageDirectory.."indicator.dds", + unitsPic = imageDirectory.."units.dds", + energyPic = imageDirectory.."energy.dds", + metalPic = imageDirectory.."metal.dds", + notFirstPic = imageDirectory.."notfirst.dds", + notFirstPicWO = imageDirectory.."notfirstwo.png", + pingPic = imageDirectory.."ping.dds", + cpuPic = imageDirectory.."cpu.dds", + selectPic = imageDirectory.."select.png", + barPic = imageDirectory.."bar.png", + amountPic = imageDirectory.."amount.png", + pointPic = imageDirectory.."point.dds", + lowPic = imageDirectory.."low.dds", + arrowPic = imageDirectory.."arrow.dds", + arrowdPic = imageDirectory.."arrowd.png", + takePic = imageDirectory.."take.dds", + crossPic = imageDirectory.."cross.dds", + pointbPic = imageDirectory.."pointb.png", + takebPic = imageDirectory.."takeb.png", + seespecPic = imageDirectory.."seespec.png", + indentPic = imageDirectory.."indent.png", + cameraPic = imageDirectory.."camera.dds", + countryPic = imageDirectory.."country.dds", + readyTexture = imageDirectory.."indicator.dds", + drawPic = imageDirectory.."draw.dds", + allyPic = imageDirectory.."ally.dds", + resourcesPic = imageDirectory.."res.png", + resbarPic = imageDirectory.."resbar.png", + resbarBgPic = imageDirectory.."resbarBg.png", + barGlowCenterPic= imageDirectory.."barglow-center.png", + barGlowEdgePic = imageDirectory.."barglow-edge.png", + + cpuPingPic = imageDirectory.."cpuping.dds", + specPic = imageDirectory.."spec.png", + chatPic = imageDirectory.."chat.dds", + sidePic = imageDirectory.."side.dds", + sharePic = imageDirectory.."share.dds", + namePic = imageDirectory.."name.dds", + idPic = imageDirectory.."id.dds", + tsPic = imageDirectory.."ts.dds", + sizednPic = imageDirectory.."sizedn.dds", + sizeupPic = imageDirectory.."sizeup.dds", + + rank0 = imageDirectory.."ranks/rank0.dds", + rank1 = imageDirectory.."ranks/rank1.dds", + rank2 = imageDirectory.."ranks/rank2.dds", + rank3 = imageDirectory.."ranks/rank3.dds", + rank4 = imageDirectory.."ranks/rank4.dds", + rank5 = imageDirectory.."ranks/rank5.dds", + rank6 = imageDirectory.."ranks/rank6.dds", + rank7 = imageDirectory.."ranks/rank7.dds", + rank8 = imageDirectory.."ranks/rank_unknown.dds", +} + +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 +-------------------------------------------------------------------------------- + +local pingCpuColors = { + [1] = {r = 0.11, g = 0.82, b = 0.11}, + [2] = {r = 0.4, g = 0.75, b = 0.2}, + [3] = {r = 0.72, g = 0.72, b = 0.2}, + [4] = {r = 0.82, g = 0.27, b = 0.18}, + [5] = {r = 1, g = 0.15, b = 0.3} +} + +-------------------------------------------------------------------------------- +-- Time Variables +-------------------------------------------------------------------------------- + +local blink = true +local lastTime = 0 +local blinkTime = 0 +local now = 0 + +local lastRequestTime = -1 +local interRequestTime = 1 -- seconds + +-------------------------------------------------------------------------------- +-- LockCamera variables +-------------------------------------------------------------------------------- + +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 + +local lastBroadcasts = {} +local recentBroadcasters = {} +local newBroadcaster = false +local totalTime = 0 +local playerScores = {} + +local aliveAllyTeams = {} + +local myLastCameraState + + +-------------------------------------------------------------------------------- +-- +-------------------------------------------------------------------------------- +local ui_opacity = tonumber(Spring.GetConfigFloat("ui_opacity",0.66) or 0.66) +local playSounds = true +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 +-------------------------------------------------------------------------------- + +local tipText + +-------------------------------------------------------------------------------- +-- Players counts and info +-------------------------------------------------------------------------------- + +-- local player info +local myAllyTeamID +local myTeamID +local mySpecStatus,fullView,_ = Spring.GetSpectatingState() + +--General players/spectator count and tables +local player = {} +local playerSpecs = {} +local playerReadyState = {} +local numberOfSpecs = 0 + +--To determine faction at start +local sideOneDefID = UnitDefNames.ecommander.id +local sideTwoDefID = UnitDefNames.ecommander.id + +local teamSideOne = "evorts" +local teamSideTwo = "evorts" + +--Name for absent/resigned players +local absentName = " --- " + +--Did the game start yet? +local gameStarted = false +-------------------------------------------------------------------------------- +-- Button check variable +-------------------------------------------------------------------------------- + +local clickToMove = nil -- click detection for moving the widget +local moveStart = nil -- position of the cursor before dragging the widget + +local energyPlayer = nil -- player to share energy with (nil when no energy sharing) +local metalPlayer = nil -- player to share metal with(nil when no metal sharing) +local amountEM = 0 -- amount of metal/energy to share/ask +local amountEMMax = nil -- max amount of metal/energy to share/ask +local sliderPosition = 0 -- slider position in metal and energy sharing +local sliderOrigin = nil -- position of the cursor before dragging the widget + +local firstclick = 0 -- + +local dblclickPeriod = 0.4 +local backgroundMargin = 7 +local widgetRelRight = 0 + +local desiredLosmodeChanged = 0 + +-------------------------------------------------------------------------------- +-- GEOMETRY VARIABLES +-------------------------------------------------------------------------------- + +local widgetTop = 0 +local widgetRight = 1 +local widgetHeight = 0 +local widgetWidth = 0 +local widgetPosX = vsx-200 +local widgetPosY = 0 +local widgetScale = 0 + +local expandDown = false +local expandLeft = true +local right + +local activePlayers = {} +local labelOffset = 18 +local separatorOffset = 4 +local playerOffset = 17 +local specOffset = 12 +local drawList = {} +local teamN +local prevClickTime = os.clock() +local specListShow = true + +local collapsed = false +local collapsedHeight = 42 + +-------------------------------------------------- +-- Modules +-------------------------------------------------- + + +local modules = {} +local modulesCount = 0 +local m_indent; modulesCount = modulesCount + 1 +local m_rank; modulesCount = modulesCount + 1 +local m_side; modulesCount = modulesCount + 1 +local m_ID; modulesCount = modulesCount + 1 +local m_name; modulesCount = modulesCount + 1 +local m_share; modulesCount = modulesCount + 1 +local m_chat; modulesCount = modulesCount + 1 +local m_cpuping; modulesCount = modulesCount + 1 +local m_diplo; modulesCount = modulesCount + 1 +local m_sizedn; modulesCount = modulesCount + 1 +local m_sizeup; modulesCount = modulesCount + 1 + +-- these are not considered as normal module since they dont take any place and wont affect other's position +-- (they have no module.width and are not part of modules) +local m_point; modulesCount = modulesCount + 1 +local m_take; modulesCount = modulesCount + 1 +local m_seespec; modulesCount = modulesCount + 1 + +local position = 1 +m_indent = { + name = "indent", + spec = true, --display for specs? + play = true, --display for players? + active = true, --display? (overrides above) + default = true, --display by default? + width = 9, + position = position, + posX = 0, + pic = pics["indentPic"], + noPic = true, +} +position = position + 1 + +m_ID = { + name = "id", + spec = true, + play = true, + active = false, + width = 17, + position = position, + posX = 0, + pic = pics["idPic"], +} +position = position + 1 + +m_rank = { + name = "rank", + spec = true, --display for specs? + play = true, --display for players? + active = true, --display? (overrides above) + default = false, --display by default? + width = 18, + position = position, + posX = 0, + pic = pics["rank6"], +} +position = position + 1 + +m_country = { + name = "country", + spec = true, + play = true, + active = true, + default = true, + width = 20, + position = position, + posX = 0, + pic = pics["countryPic"], +} +position = position + 1 + +m_side = { + name = "side", + spec = true, + play = true, + active = false, + width = 18, + position = position, + posX = 0, + pic = pics["sidePic"], +} +position = position + 1 + +m_skill = { + name = "skill", + spec = true, + play = true, + active = true, + width = 18, + position = position, + posX = 0, + pic = pics["tsPic"], +} +position = position + 1 + +m_name = { + name = "name", + spec = true, + play = true, + active = true, + alwaysActive = true, + width = 10, + position = position, + posX = 0, + pic = pics["namePic"], + noPic = true, + picGap = 7, +} +position = position + 1 + +m_cpuping = { + name = "cpuping", + spec = true, + play = true, + active = true, + width = 24, + position = position, + posX = 0, + pic = pics["cpuPingPic"], +} +position = position + 1 + +m_resources = { + name = "resources", + spec = true, + play = true, + active = true, + width = 28, + position = position, + posX = 0, + pic = pics["resourcesPic"], + picGap = 7, +} +position = position + 1 + +m_share = { + name = "share", + spec = false, + play = true, + active = true, + width = 50, + position = position, + posX = 0, + pic = pics["sharePic"], +} +position = position + 1 + +m_chat = { + name = "chat", + spec = false, + play = true, + active = false, + width = 18, + position = position, + posX = 0, + pic = pics["chatPic"], +} +position = position + 1 + +local fixedallies = tonumber(Spring.GetModOptions().fixedallies) +local drawAllyButton = (not fixedallies or fixedallies == 0) +m_alliance = { + name = "ally", + spec = false, + play = true, + active = true, + width = 16, + position = position, + posX = 0, + pic = pics["allyPic"], + noPic = false, +} +if not drawAllyButton then + m_alliance.width = 0 +end + +position = position + 1 + +m_sizedn = { + name = "sizedn", + spec = true, + play = true, + active = true, + alwaysActive = true, + width = 0, + position = position, + posX = 0, + pic = pics["sizednPic"], +} +position = position + 1 + +m_sizeup = { + name = "sizeup", + spec = true, + play = true, + active = true, + alwaysActive = true, + width = 0, + position = position, + posX = 0, + pic = pics["sizeupPic"], +} +position = position + 1 + +modules = { + m_indent, + m_rank, + m_country, + m_ID, + m_side, + m_name, + m_skill, + m_resources, + m_cpuping, + m_alliance, + m_share, + m_chat, + m_sizedn, + m_sizeup, +} + +m_point = { + active = true, + defaut = true, -- defaults dont seem to be accesible on widget data load + pic = pics["pointbPic"], +} + +m_take = { + active = true, + default = true, + pic = pics["takePic"], +} + +m_seespec = { + active = true, + default = true, + pic = pics["seespecPic"], +} + + +local specsLabelOffset = 0 +local teamsizeVersusText = "" + + +--------------------------------------------------------------------------------------------------- +-- Geometry +--------------------------------------------------------------------------------------------------- + +function SetModulesPositionX() + m_name.width = SetMaxPlayerNameWidth() + table.sort(modules, function(v1,v2) + return v1.position < v2.position + end) + pos = 1 + for _,module in ipairs(modules) do + module.posX = pos + if module.active == true then + if mySpecStatus == true then + if module.spec == true then + pos = pos + module.width + end + else + if module.play == true then + pos = pos + module.width + end + end + end + + widgetWidth = pos + 1 + if widgetWidth < 20 then + widgetWidth = 20 + end + + if widgetWidth + widgetPosX > vsx then + widgetPosX = vsx - (widgetWidth * widgetScale) - widgetRelRight + end + if widgetRight - widgetWidth < 0 then + widgetRight = widgetWidth + end + if expandLeft == true then + widgetPosX = vsx - (widgetWidth * widgetScale) - widgetRelRight + else + widgetRight = widgetPosX + widgetWidth + end + end +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*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,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*font2:GetTextWidth(name)+8 + if nextWidth > maxWidth then + maxWidth = nextWidth + end + end + return maxWidth +end + +function GetNumberOfSpecs() + local pList = Spring_GetPlayerList() + local count = 0 + local name = "" + for _,playerID in ipairs(pList) do + _,active,spec = Spring_GetPlayerInfo(playerID) + if spec and active then count = count + 1 end + end + return count +end + +function GeometryChange() + --check if disappeared off the edge of screen + widgetRight = widgetWidth + widgetPosX + if widgetRight > vsx-(backgroundMargin * widgetScale) then + widgetRight = vsx - (backgroundMargin * widgetScale) + widgetPosX = vsx - ((widgetWidth + backgroundMargin) * widgetScale) - widgetRelRight + end + if widgetPosX + widgetWidth/2 > vsx/2 then + right = true + else + right = false + end +end + + +local function UpdateAlliances() + playerList = Spring_GetPlayerList() + teamList = Spring_GetTeamList() + for _,playerID in pairs (playerList) do + if not player[playerID].spec then + 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 + alliances[#alliances+1] = player2ID + end + end + player[playerID].alliances = alliances + end + 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 + for playerID, info in pairs(lastBroadcasts) do + lastTime = info[1] + if (totalTime - lastTime <= listTime or playerID == lockPlayerID) then + if (totalTime - lastTime <= listTime) then + recentBroadcasters[playerID] = totalTime - lastTime + end + i = i + 1 + end + end +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] + if info then + SetCameraState(info[2], transitionTime) + end + else + if myLastCameraState then + 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 + + WG.playerFPS = WG.playerFPS or {} + WG.playerFPS[playerID] = fps +end + +function SystemEvent(playerID, system) + 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))) + lastSystemData[playerID] = system + + WG.playerSystemData = WG.playerSystemData or {} + WG.playerSystemData[playerID] = system +end + +function ActivityEvent(playerID) + lastActivity[playerID] = os.clock() +end + +function CameraBroadcastEvent(playerID,cameraState) + + --if cameraState is empty then transmission has stopped + if not cameraState then + if lastBroadcasts[playerID] then + lastBroadcasts[playerID] = nil + newBroadcaster = true + end + if lockPlayerID == playerID then + LockCamera() + end + return + end + + if not lastBroadcasts[playerID] and not newBroadcaster then + newBroadcaster = true + end + + lastBroadcasts[playerID] = {totalTime, cameraState} + + if playerID == lockPlayerID then + SetCameraState(cameraState, transitionTime) + end +end + +--------------------------------------------------------------------------------------------------- +-- Init/GameStart (creating players) +--------------------------------------------------------------------------------------------------- + +--[[function RecvPlayerScores(newPlayerScores) + playerScores = newPlayerScores or {} +end]]-- + +function widget:Initialize() + 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,fullView,_ = Spring.GetSpectatingState() + if Spring.GetGameFrame() <= 0 then + if mySpecStatus and not alwaysHideSpecs then + specListShow = true + else + specListShow = false + end + end + if (Spring.GetConfigInt("ShowPlayerInfo")==1) then + Spring.SendCommands("info 0") + end + + if Spring.GetGameFrame()>0 then + gameStarted = true + end + + GeometryChange() + SetModulesPositionX() + SetSidePics() + InitializePlayers() + SortList() + + WG['advplayerlist_api'] = {} + WG['advplayerlist_api'].GetPosition = function() + return apiAbsPosition + end + WG['advplayerlist_api'].GetCollapsable = function() + return collapsable + 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 and not collapsed then + if mySpecStatus and not alwaysHideSpecs then + specListShow = true + else + specListShow = false + end + + gameStarted = true + SetSidePics() + InitializePlayers() + SetOriginalColourNames() + SortList() + end +end + + +function widget:Shutdown() + 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('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 + + +function SetSidePics() + --record readyStates + playerList = Spring.GetPlayerList() + for _,playerID in pairs (playerList) do + playerReadyState[playerID] = Spring.GetGameRulesParam("player_" .. tostring(playerID) .. "_readyState") + end + + --set factions, from TeamRulesParam when possible and from initial info if not + teamList = Spring_GetTeamList() + for _, team in ipairs(teamList) do + local teamSide + if Spring_GetTeamRulesParam(team, 'startUnit') then + local startunit = Spring_GetTeamRulesParam(team, 'startUnit') + if startunit == sideOneDefID then + teamSide = teamSideOne + end + if startunit == sideOneDefID then + teamSide = teamSideTwo + end + else + _,_,_,_,teamSide = Spring_GetTeamInfo(team,false) + end + + if teamSide then + sidePics[team] = imageDirectory..teamSide.."_default.png" + sidePicsWO[team] = imageDirectory..teamSide.."wo_default.png" + else + sidePics[team] = imageDirectory.."default.png" + sidePicsWO[team] = imageDirectory.."defaultwo.png" + end + end +end + + +function InitializePlayers() + myPlayerID = Spring_GetLocalPlayerID() + myTeamID = Spring_GetLocalTeamID() + myAllyTeamID = Spring_GetLocalAllyTeamID() + for i = 0, 128 do + player[i] = {} + end + GetAllPlayers() +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 + local teamPlayers = Spring_GetPlayerList(i, true) + 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 + end + specPlayers = Spring_GetTeamList() + for _,playerID in ipairs(specPlayers) do + local active,_,spec = Spring_GetPlayerInfo(playerID,false) + if spec == true then + if active == true then + player[playerID] = CreatePlayer(playerID) + end + end + end +end + + +function GetAliveAllyTeams() + aliveAllyTeams = {} + local allteams = Spring_GetTeamList() + teamN = table.maxn(allteams) - 1 --remove gaia + for i = 0,teamN-1 do + local _,_, isDead, _, _, tallyteam = Spring_GetTeamInfo(i,false) + if not isDead then + aliveAllyTeams[tallyteam] = true + end + end +end + + +function round(num, idp) + local mult = 10^(idp or 0) + return math.floor(num * mult + 0.5) / mult +end + +function GetSkill(playerID) + + local customtable = select(11,Spring.GetPlayerInfo(playerID)) + local tsMu = customtable.skill + local tsSigma = customtable.skilluncertainty + local tskill = "" + if tsMu then + tskill = tsMu and tonumber(tsMu:match("%d+%.?%d*")) or 0 + tskill = round(tskill,0) + if string.find(tsMu, ")") then + tskill = "\255"..string.char(190)..string.char(140)..string.char(140) .. tskill -- ')' means inferred from lobby rank + else + + -- show privacy mode + local priv = "" + if string.find(tsMu, "~") then -- '~' means privacy mode is on + priv = "\255"..string.char(200)..string.char(200)..string.char(200) .. "*" + end + + --show sigma + if tsSigma then -- 0 is low sigma, 3 is high sigma + tsSigma=tonumber(tsSigma) + local tsRed, tsGreen, tsBlue + if tsSigma > 2 then + tsRed, tsGreen, tsBlue = 190, 130, 130 + elseif tsSigma == 2 then + tsRed, tsGreen, tsBlue = 140, 140, 140 + elseif tsSigma == 1 then + tsRed, tsGreen, tsBlue = 195, 195, 195 + elseif tsSigma < 1 then + tsRed, tsGreen, tsBlue = 250, 250, 250 + end + tskill = priv .. "\255"..string.char(tsRed)..string.char(tsGreen)..string.char(tsBlue) .. tskill + else + tskill = priv .. "\255"..string.char(195)..string.char(195)..string.char(195) .. tskill --should never happen + end + end + else + tskill = "\255"..string.char(160)..string.char(160)..string.char(160) .. "?" + end + return tskill +end + + +function CreatePlayer(playerID) + + --generic player data + 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 + local tskill + tskill = GetSkill(playerID) + + --cpu/ping + tpingLvl = GetPingLvl(tping) + tcpuLvl = GetCpuLvl(tcpu) + tping = tping * 1000 - ((tping * 1000) % 1) + tcpu = tcpu * 100 - ((tcpu * 100) % 1) + + -- resources + local energy, energyStorage, energyIncome, metal, metalStorage, metalIncome = 0,1,0,1,0,0 + if aliveAllyTeams[tallyteam] ~= nil and (mySpecStatus or myAllyTeamID == tallyteam) then + energy, energyStorage,_, energyIncome = Spring_GetTeamResources(tteam, "energy") + metal, metalStorage,_, metalIncome = Spring_GetTeamResources(tteam, "metal") + 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 { + rank = trank, + skill = tskill, + name = tname, + team = tteam, + allyteam = tallyteam, + red = tred, + green = tgreen, + blue = tblue, + dark = GetDark(tred,tgreen,tblue), + side = tside, + pingLvl = tpingLvl, + cpuLvl = tcpuLvl, + ping = tping, + cpu = tcpu, + country = tcountry, + dead = false, + spec = tspec, + ai = false, + energy = energy, + energyStorage = energyStorage, + metal = metal, + metalStorage = metalStorage, + } + +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,false) + local tred, tgreen, tblue = Spring_GetTeamColor(teamID) + local tname, ttotake, tskill + local tdead = true + + if isAI then + + local version + + _,_,_,_, tname, version = Spring_GetAIInfo(teamID) + + if type(version) == "string" then + tname = "AI:" .. tname .. "-" .. version + else + tname = "AI:" .. tname + end + if Spring.GetGameRulesParam('ainame_'..teamID) then + tname = Spring.GetGameRulesParam('ainame_'..teamID)..' (AI)' + end + + ttotake = false + tdead = false + tai = true + + else + + if Spring_GetGameSeconds() < 0.1 then + tname = absentName + ttotake = false + tdead = false + else + ttotake = IsTakeable(teamID) + end + + tai = false + end + + if tname == nil then + tname = absentName + end + + tskill = "" + + -- resources + local energy, energyStorage, energyIncome, metal, metalStorage, metalIncome = 0,1,0,1,0,0 + 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 or 0) + metal = math.floor(metal or 0) + if energy < 0 then energy = 0 end + if metal < 0 then metal = 0 end + end + + return{ + rank = 8, -- "don't know which" value + skill = tskill, + name = tname, + team = teamID, + allyteam = tallyteam, + red = tred, + green = tgreen, + blue = tblue, + dark = GetDark(tred, tgreen, tblue), + side = tside, + totake = ttotake, + dead = tdead, + spec = false, + ai = tai, + energy = energy, + energyStorage = energyStorage, + metal = metal, + metalStorage = metalStorage, + } + +end + +function UpdatePlayerResources() + local energy, energyStorage, metal, metalStorage = 0, 1, 0 ,1 + for playerID,_ in pairs(player) do + if player[playerID].name and not player[playerID].spec and player[playerID].team then + if aliveAllyTeams[player[playerID].allyteam] ~= nil and (mySpecStatus or myAllyTeamID == player[playerID].allyteam) then + energy, energyStorage,_, energyIncome = Spring_GetTeamResources(player[playerID].team, "energy") + metal, metalStorage,_, metalIncome = Spring_GetTeamResources(player[playerID].team, "metal") + if energy == nil then -- need to be there for when you do /specfullview + energy, energyStorage, energyIncome, metal, metalStorage, metalIncome = 0, 0, 0, 0, 0, 0 + else + energy = math.floor(energy) + metal = math.floor(metal) + if energy < 0 then energy = 0 end + if metal < 0 then metal = 0 end + end + player[playerID].energy = energy + player[playerID].energyIncome = energyIncome + player[playerID].energyStorage = energyStorage + player[playerID].metal = metal + player[playerID].metalIncome = metalIncome + player[playerID].metalStorage = metalStorage + end + end + end +end + +function GetDark(red,green,blue) + -- Determines if the player color is dark (i.e. if a white outline for the sidePic is needed) + if red + green*1.2 + blue*0.4 < 0.8 then return true end + return false +end + + +function SetOriginalColourNames() + -- Saves the original team colours associated to team teamID + for playerID,_ in pairs(player) do + if player[playerID].name then + if player[playerID].spec then + originalColourNames[playerID] = "\255\255\255\255" + else + originalColourNames[playerID] = colourNames(player[playerID].team) + end + end + end +end + + + + +--------------------------------------------------------------------------------------------------- +-- Sorting player data +-- note: SPADS ensures that order of playerIDs/teams/allyteams as appropriate reflects TS (mu) order +--------------------------------------------------------------------------------------------------- + + +function SortList() + local teamList + local myOldSpecStatus = mySpecStatus + + mySpecStatus = select(3,Spring_GetPlayerInfo(myPlayerID,false)) + + -- checks if a team has died + if mySpecStatus ~= myOldSpecStatus then + if mySpecStatus then + teamList = Spring_GetTeamList() + for _, team in ipairs(teamList) do + if not select(3,Spring_GetTeamInfo(team,false)) then -- not dead + Spec(team) + break + end + end + end + end + + myAllyTeamID = Spring_GetLocalAllyTeamID() + myTeamID = Spring_GetLocalTeamID() + + drawList = {} + drawListOffset = {} + vOffset = 0 + + -- calls the (cascade) sorting for players + vOffset = SortAllyTeams(vOffset) + + -- calls the sortings for specs if see spec is on + --if m_chat.active == true then + vOffset = SortSpecs(vOffset) + --end + + -- set the widget height according to space needed to show team + widgetHeight = vOffset + 3 + + + -- move the widget if list is too long + if widgetHeight + widgetPosY > vsy then + widgetPosY = vsy - widgetHeight + end + + if widgetTop - widgetHeight < 0 then + --widgetTop = widgetHeight + end + + -- set the widget Y position or the top of the widget according to expand direction + if expandDown == true then + widgetPosY = widgetTop - widgetHeight + else + widgetTop = widgetPosY + widgetHeight + end + +end + + +function SortAllyTeams(vOffset) + -- adds ally teams to the draw list (own ally team first) + -- (labels and separators are drawn) + local allyTeamID + local allyTeamList = Spring_GetAllyTeamList() + local firstenemy = true + local isFirstDrawnTeam = true + allyTeamsCount = table.maxn(allyTeamList)-1 + + --find own ally team + vOffset = 12/2.66 + for allyTeamID = 0, allyTeamsCount - 1 do + if allyTeamID == myAllyTeamID then + vOffset = vOffset + labelOffset - 3 + if drawAlliesLabel then + 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) + end + break + end + end + + + -- add the others + for allyTeamID = 0, allyTeamsCount-1 do + if allyTeamID ~= myAllyTeamID then + if firstenemy == true then + vOffset = vOffset + 13 + + vOffset = vOffset + labelOffset - 3 + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -3 -- "Enemies" label + firstenemy = false + else + vOffset = vOffset + separatorOffset + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -4 -- Enemy teams separator + end + vOffset = SortTeams(allyTeamID, vOffset)+2 -- Add the teams from the allyTeam + end + end + + + return vOffset +end + +local deadPlayerHeightReduction = 10 +function SortTeams(allyTeamID, vOffset) + -- Adds teams to the draw list (own team first) + --(teams are not visible as such unless they are empty or AI) + local teamID + local teamsList = Spring_GetTeamList(allyTeamID) + + --add teams + for _,teamID in ipairs(teamsList) do + 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 +end + +function SortPlayers(teamID,allyTeamID,vOffset) + -- Adds players to the draw list (self first) + + local playersList = Spring_GetPlayerList(teamID,true) + local noPlayer = true + + -- add own player (if not spec) + if myTeamID == teamID then + if player[myPlayerID].name ~= nil then + if mySpecStatus == false then + vOffset = vOffset + playerOffset + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = myPlayerID -- new player (with ID) + player[myPlayerID].posY = vOffset + noPlayer = false + end + end + end + + -- add other players (if not spec) + for _,playerID in ipairs(playersList) do + if playerID ~= myPlayerID then + if player[playerID].name ~= nil then + if player[playerID].spec ~= true then + vOffset = vOffset + playerOffset + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = playerID -- new player (with ID) + player[playerID].posY = vOffset + noPlayer = false + end + end + end + end + + -- add AI teams + if select(4,Spring_GetTeamInfo(teamID,false)) then -- is AI + vOffset = vOffset + playerOffset + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = 64 + teamID -- new AI team (instead of players) + player[64 + teamID].posY = vOffset + noPlayer = false + end + + -- add no player token if no player found in this team at this point + if noPlayer == true then + vOffset = vOffset + playerOffset - (deadPlayerHeightReduction/2) + 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) + end + end + + return vOffset +end + +function SortSpecs(vOffset) + -- Adds specs to the draw list + local playersList = Spring_GetPlayerList(-1,true) + local noSpec = true + for _,playerID in ipairs(playersList) do + _,active,spec = Spring_GetPlayerInfo(playerID,false) + if spec and active then + if player[playerID].name ~= nil then + + -- add "Specs" label if first spec + if noSpec == true then + vOffset = vOffset + 13 + vOffset = vOffset + labelOffset - 2 + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -5 + noSpec = false + specJoinedOnce = true + vOffset = vOffset + 4 + end + + -- add spectator + if specListShow == true then + vOffset = vOffset + specOffset + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = playerID + player[playerID].posY = vOffset + noPlayer = false + end + end + end + end + + -- add "Specs" label + if specJoinedOnce and noSpec then + vOffset = vOffset + 13 + vOffset = vOffset + labelOffset - 2 + drawListOffset[#drawListOffset+1] = vOffset + drawList[#drawList+1] = -5 + vOffset = vOffset + 4 + end + + return vOffset +end + + + +--------------------------------------------------------------------------------------------------- +-- Draw control +--------------------------------------------------------------------------------------------------- + +local PrevGameFrame +local MainList +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 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 + -- draws the background + if Background then + gl_CallList(Background) + else + CreateBackground() + end + + 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 + + UpdateRecentBroadcasters() + UpdateAlliances() + GetAliveAllyTeams() + + if m_resources.active then + UpdateResources() + end + UpdatePlayerResources() + + --Create lists + CreateBackground() + CreateMainList() + CreateShareSlider() +end + +--------------------------------------------------------------------------------------------------- +-- Background gllist +--------------------------------------------------------------------------------------------------- + +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 + +function CreateBackground() + + if Background then + gl_DeleteList(Background) + end + local margin = backgroundMargin + + + local BLcornerX = widgetPosX - margin + local BLcornerY = widgetPosY - margin + local TRcornerX = widgetPosX + widgetWidth + margin + local TRcornerY = widgetPosY + widgetHeight - 1 + margin + + 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,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 + +--------------------------------------------------------------------------------------------------- +-- Main (player) gllist +--------------------------------------------------------------------------------------------------- + + +function UpdateResources() + if energyPlayer ~= nil then + if energyPlayer.team == myTeamID then + local current,storage = Spring_GetTeamResources(myTeamID,"energy") + amountEMMax = storage - current + amountEM = amountEMMax*sliderPosition/39 + amountEM = amountEM-(amountEM%1) + else + amountEMMax = Spring_GetTeamResources(myTeamID,"energy") + amountEM = amountEMMax*sliderPosition/39 + amountEM = amountEM-(amountEM%1) + end + end + if metalPlayer ~= nil then + if metalPlayer.team == myTeamID then + local current, storage = Spring_GetTeamResources(myTeamID,"metal") + amountEMMax = storage - current + amountEM = amountEMMax*sliderPosition/39 + amountEM = amountEM-(amountEM%1) + else + amountEMMax = Spring_GetTeamResources(myTeamID,"metal") + amountEM = amountEMMax*sliderPosition/39 + amountEM = amountEM-(amountEM%1) + end + end +end + +function CheckTime() + local period = 0.5 + now = os.clock() + if now > (lastTime + period) then + lastTime = now + CheckPlayersChange() + if blink == true then + blink = false + else + blink = true + end + for playerID =0, 63 do + if player[playerID] ~= nil then + if player[playerID].pointTime ~= nil then + if player[playerID].pointTime <= now then + player[playerID].pointX = nil + player[playerID].pointY = nil + player[playerID].pointZ = nil + player[playerID].pointTime = nil + end + end + end + end + end +end + + +function CreateMainList(tip) + + --Spring.Echo("List Updated") + + numberOfSpecs = GetNumberOfSpecs() + + local mouseX,mouseY = Spring_GetMouseState() + local leader + + if MainList then + gl_DeleteList(MainList) + end + tipText = nil + MainList = gl_CreateList(function() + drawTipText = nil + for i, drawObject in ipairs(drawList) do + if drawObject == -5 then + specsLabelOffset = drawListOffset[i] + local specAmount = numberOfSpecs + if numberOfSpecs == 0 or (specListShow and numberOfSpecs < 10) then + specAmount = "" + end + DrawLabel(" Spectators "..specAmount, drawListOffset[i], specListShow) + if Spring.GetGameFrame() <= 0 then + if specListShow then + DrawLabelTip("(click to hide specs)", drawListOffset[i], 95) + else + DrawLabelTip("(click to show specs)", drawListOffset[i], 95) + end + end + elseif drawObject == -4 then + DrawSeparator(drawListOffset[i]) + elseif drawObject == -3 then + DrawLabel(" Enemies", drawListOffset[i], true) + elseif drawObject == -2 then + DrawLabel(" Allies", drawListOffset[i], true) + if Spring.GetGameFrame() <= 0 then + DrawLabelTip("(dbl-click playername to track)", drawListOffset[i], 46) + end + elseif drawObject == -1 then + leader = true + else + DrawPlayer(drawObject, leader, drawListOffset[i], mouseX, mouseY) + end + + -- draw player tooltip later so they will be on top of players drawn below + if tipText ~= nil then + drawTipText = tipText + drawTipMouseX = mouseX + drawTipMouseY = mouseY + end + + end + if drawTipText ~= nil then + tipText = drawTipText + if not WG['tooltip'] then -- else use tooltip widget (in widget:update) + DrawTip(drawTipMouseX, drawTipMouseY) + end + end + end) + +end + +function DrawLabel(text, vOffset, drawSeparator) + if widgetWidth < 67 then + text = string.sub(text, 0, 1) + end + 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 +end + +function DrawLabelTip(text, vOffset, xOffset) + if widgetWidth < 67 then + text = string.sub(text, 0, 1) + end + 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) + vOffset = vOffset - 2 + gl_Color(0.55,0.55,0.55,0.45) + gl_Rect(widgetPosX+2, widgetPosY + widgetHeight -vOffset+(1/widgetScale), widgetPosX + widgetWidth-2, widgetPosY + widgetHeight -vOffset) + gl_Color(0,0,0,0.3) + gl_Rect(widgetPosX+2, widgetPosY + widgetHeight -vOffset, widgetPosX + widgetWidth-2, widgetPosY + widgetHeight -vOffset-(1/widgetScale)) + gl_Color(1,1,1) +end + +function DrawLabelRightside(text, vOffset) + 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 + + + +function DrawPlayer(playerID, leader, vOffset, mouseX, mouseY) + tipY = nil + local rank = player[playerID].rank + local skill = player[playerID].skill + local name = player[playerID].name + local team = player[playerID].team + local allyteam = player[playerID].allyteam + local side = player[playerID].side + local red = player[playerID].red + local green = player[playerID].green + local blue = player[playerID].blue + local dark = player[playerID].dark + local pingLvl = player[playerID].pingLvl + local cpuLvl = player[playerID].cpuLvl + local ping = player[playerID].ping + local cpu = player[playerID].cpu + local country = player[playerID].country + local spec = player[playerID].spec + local totake = player[playerID].totake + local needm = player[playerID].needm + local neede = player[playerID].neede + local dead = player[playerID].dead + local ai = player[playerID].ai + local alliances = player[playerID].alliances + local posY = widgetPosY + widgetHeight - vOffset + local tipPosY = widgetPosY + ((widgetHeight - vOffset)*widgetScale) + + local alpha = 0.44-- alpha used to show inactivity for specs + + if WG['betfrontend'] ~= nil then + playerScores = WG['betfrontend'].GetPlayerScores() + 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 + + + if (lockPlayerID ~= nil and lockPlayerID == playerID) then -- active + DrawCamera(posY, true) + end + + if spec == false then --player + if not dead and alliances ~= nil and #alliances > 0 then + DrawAlliances(alliances, posY) + end + if leader == true then -- take / share buttons + if mySpecStatus == false then + if allyteam == myAllyTeamID then + if m_take.active == true then + if totake == true then + DrawTakeSignal(posY) + if tipY == true then TakeTip(mouseX) end + end + end + if m_share.active == true and dead ~= true then + DrawShareButtons(posY, needm, neede) + if tipY == true then ShareTip(mouseX, playerID) end + end + end + if drawAllyButton and dead ~= true then + if tipY == true then AllyTip(mouseX, playerID) end + end + else + if m_indent.active == true and Spring_GetMyTeamID() == team then + DrawDot(posY) + end + end + gl_Color(red,green,blue,1) + if m_ID.active == true then + DrawID(team, posY, dark, dead) + end + if m_skill.active == true then + DrawSkill(skill, posY, dark, name) + end + end + gl_Color(red,green,blue,1) + if m_rank.active == true then + DrawRank(rank, posY) + end + if m_country.active == true and country ~= "" then + DrawCountry(country, posY) + end + --gl_Color(red,green,blue,1) + gl_Color(1,1,1,0.45) + if name ~= absentName and m_side.active == true then + DrawSidePic(team, playerID, posY, leader, dark, ai) + end + gl_Color(red,green,blue,1) + if m_name.active == true then + DrawName(name, team, posY, dark, playerID) + end + if m_alliance.active == true and drawAllyButton and not mySpecStatus and not dead and team ~= myTeamID then + DrawAlly(posY, player[playerID].team) + end + + if m_resources.active and aliveAllyTeams[allyteam] ~= nil and player[playerID].energy ~= nil then + if mySpecStatus or myAllyTeamID == allyteam then + local e = player[playerID].energy + local es = player[playerID].energyStorage + local ei = player[playerID].energyIncome + local m = player[playerID].metal + local ms = player[playerID].metalStorage + local mi = player[playerID].metalIncome + if es > 0 then + DrawResources(e, es, m, ms, posY, dead) + if tipY == true then ResourcesTip(mouseX, e, es, ei, m, ms, mi) end + end + end + end + else -- spectator + gl_Color(1,1,1,1) + if specListShow == true and m_name.active == true then + + if playerSpecs[playerID] ~= nil and (lockPlayerID ~= nil and lockPlayerID ~= playerID or lockPlayerID == nil) then + if recentBroadcasters[playerID] ~= nil and type(recentBroadcasters[playerID]) == "number" then + DrawCamera(posY, false) + end + end + if playerScores[playerID] ~= nil then + DrawChips(playerID, posY) + end + DrawSmallName(name, team, posY, false, playerID, alpha) + end + + end + + 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], lastGpuMemData[playerID], lastSystemData[playerID], name) end + end + end + + gl_Color(1,1,1,1) + if playerID < 64 then + + if m_chat.active == true and mySpecStatus == false and spec == false then + if playerID ~= myPlayerID then + DrawChatButton(posY) + end + end + + if m_point.active then + if player[playerID].pointTime ~= nil then + if player[playerID].allyteam == myAllyTeamID or mySpecStatus == true then + --if blink == true then + DrawPoint(posY, player[playerID].pointTime-now) + --end + if tipY == true then PointTip(mouseX) end + end + end + end + + end + leader = false + gl_Texture(false) +end + +function DrawTakeSignal(posY) + + if blink == true then -- Draws a blinking rectangle if the player of the same team left (/take option) + if right then + gl_Color(0.7,0.7,0.7) + gl_Texture(pics["arrowPic"]) + DrawRect(widgetPosX - 14, posY, widgetPosX, posY + 16) + gl_Color(1,1,1) + gl_Texture(pics["takePic"]) + DrawRect(widgetPosX - 57, posY - 15, widgetPosX - 12, posY + 32) + else + local leftPosX = widgetPosX + widgetWidth + gl_Color(0.7,0.7,0.7) + gl_Texture(pics["arrowPic"]) + DrawRect(leftPosX + 14, posY, leftPosX, posY + 16) + gl_Color(1,1,1) + gl_Texture(pics["takePic"]) + DrawRect(leftPosX + 12, posY - 15, leftPosX + 57, posY + 32) + end + end +end + +function DrawShareButtons(posY, needm, neede) + gl_Color(1,1,1,1) + gl_Texture(pics["unitsPic"]) -- Share UNIT BUTTON + DrawRect(m_share.posX + widgetPosX + 1, posY, m_share.posX + widgetPosX + 17, posY + 16) + gl_Texture(pics["energyPic"]) -- share ENERGY BUTTON + DrawRect(m_share.posX + widgetPosX + 17, posY, m_share.posX + widgetPosX + 33, posY + 16) + gl_Texture(pics["metalPic"]) -- share METAL BUTTON + DrawRect(m_share.posX + widgetPosX + 33, posY, m_share.posX + widgetPosX + 49, posY + 16) + gl_Texture(pics["lowPic"]) + if needm == true then + DrawRect(m_share.posX + widgetPosX + 33, posY, m_share.posX + widgetPosX + 49, posY + 16) + end + if neede == true then + DrawRect(m_share.posX + widgetPosX + 17, posY, m_share.posX + widgetPosX + 33, posY + 16) + end + gl_Texture(false) +end + + +function DrawChatButton(posY) + gl_Texture(pics["chatPic"]) + DrawRect(m_chat.posX + widgetPosX + 1, posY, m_chat.posX + widgetPosX + 17, posY + 16) +end + +function DrawResources(energy, energyStorage, metal, metalStorage, posY, dead) + local paddingLeft = 2 + local paddingRight = 2 + local barWidth = m_resources.width - paddingLeft - paddingRight + local y1Offset = 7 + local y2Offset = 5 + if dead then + y1Offset = 7.4 + y2Offset = 6 + end + gl_Color(1,1,1,0.14) + gl_Texture(pics["resbarBgPic"]) + DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset, m_resources.posX + widgetPosX + paddingLeft + barWidth, posY + y2Offset) + gl_Color(1,1,1,1) + gl_Texture(pics["resbarPic"]) + 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 = 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) + + gl_Texture(pics["barGlowEdgePic"]) + DrawRect(m_resources.posX + widgetPosX + paddingLeft-(glowsize*1.8), posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft, posY + y2Offset-glowsize) + DrawRect(m_resources.posX + widgetPosX + paddingLeft + ((barWidth/metalStorage)*metal)+(glowsize*1.8), posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/metalStorage)*metal), posY + y2Offset-glowsize) + end + + if not dead then + y1Offset = 11 + y2Offset = 9 + else + y1Offset = 10 + y2Offset = 8.6 + end + gl_Color(1,1,0,0.14) + gl_Texture(pics["resbarBgPic"]) + DrawRect(m_resources.posX + widgetPosX + paddingLeft, posY + y1Offset, m_resources.posX + widgetPosX + paddingLeft + barWidth, posY + y2Offset) + gl_Color(1,1,0,1) + gl_Texture(pics["resbarPic"]) + 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 = 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) + + gl_Texture(pics["barGlowEdgePic"]) + DrawRect(m_resources.posX + widgetPosX + paddingLeft-(glowsize*1.8), posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft, posY + y2Offset-glowsize) + DrawRect(m_resources.posX + widgetPosX + paddingLeft + ((barWidth/energyStorage)*energy)+(glowsize*1.8), posY + y1Offset+glowsize, m_resources.posX + widgetPosX + paddingLeft + ((barWidth/energyStorage)*energy), posY + y2Offset-glowsize) + end +end + +function DrawChips(playerID, posY) + local xPos = m_name.posX + widgetPosX - 6 + 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) +end + +function DrawSidePic(team, playerID, posY, leader, dark, ai) + if gameStarted then + if leader == true then + gl_Texture(sidePics[team]) -- sets side image (for leaders) + else + gl_Texture(pics["notFirstPic"]) -- sets image for not leader of team players + end + DrawRect(m_side.posX + widgetPosX + 2, posY+1, m_side.posX + widgetPosX + 16, posY + 15) -- draws side image + --[[if dark == true then -- draws outline if player color is dark + gl_Color(1,1,1) + if leader == true then + gl_Texture(sidePicsWO[team]) + else + gl_Texture(notFirstPicWO) + end + DrawRect(m_side.posX + widgetPosX + 2, posY+1,m_side.posX + widgetPosX + 16, posY + 15) + gl_Texture(false) + end + ]]-- + gl_Texture(false) + else + DrawState(playerID, m_side.posX + widgetPosX, posY) + end +end + +function DrawRank(rank, posY) + if rank == 0 then + DrawRankImage(pics["rank0"], posY) + elseif rank == 1 then + DrawRankImage(pics["rank1"], posY) + elseif rank == 2 then + DrawRankImage(pics["rank2"], posY) + elseif rank == 3 then + DrawRankImage(pics["rank3"], posY) + elseif rank == 4 then + DrawRankImage(pics["rank4"], posY) + elseif rank == 5 then + DrawRankImage(pics["rank5"], posY) + elseif rank == 6 then + DrawRankImage(pics["rank6"], posY) + elseif rank == 7 then + DrawRankImage(pics["rank7"], posY) + else + --DrawRankImage(rank8, posY) + end + gl_Color(1,1,1,1) +end + +function DrawRankImage(rankImage, posY) + gl_Color(1,1,1) + gl_Texture(rankImage) + DrawRect(m_rank.posX + widgetPosX + 3, posY+1, m_rank.posX + widgetPosX + 17, posY + 15) +end + + +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) + --local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.ceil(sx),math.ceil(sy),math.floor(cs) + gl.BeginEnd(GL.QUADS, RectQuad, px,py,sx,sy) +end + +function DrawAlly(posY, team) + if Spring_AreTeamsAllied(team, myTeamID) then + gl_Color(0,1,0, 0.44) + else + gl_Color(1,0,0, 0.44) + end + gl_Texture(pics["allyPic"]) + DrawRect(m_alliance.posX + widgetPosX + 3, posY+1, m_alliance.posX + widgetPosX + 17, posY + 15) +end + +function DrawCountry(country, posY) + if country ~= nil and country ~= "??" then + gl_Texture(flagsDirectory..string.upper(country)..".dds") + gl_Color(1,1,1) + DrawRect(m_country.posX + widgetPosX + 3, posY+1, m_country.posX + widgetPosX + 17, posY + 15) + end +end + +function DrawDot(posY) + gl_Color(1,1,1,0.70) + gl_Texture(pics["currentPic"]) + DrawRect(m_indent.posX + widgetPosX-1 , posY+3, m_indent.posX + widgetPosX + 7, posY + 11) +end + +function DrawCamera(posY,active) + if active ~= nil and active then + gl_Color(1,1,1,0.7) + else + gl_Color(1,1,1,0.13) + end + gl_Texture(pics["cameraPic"]) + DrawRect(m_indent.posX + widgetPosX-1.5 , posY+2, m_indent.posX + widgetPosX + 9, posY + 12.4) +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 + +function DrawState(playerID, posX, posY) +-- note that adv pl list uses a phantom pID for absent players, so this will always show unready for players not ingame + local ready = (playerReadyState[playerID]==1) or (playerReadyState[playerID]==2) or (playerReadyState[playerID]==-1) + local hasStartPoint = (playerReadyState[playerID]==4) + if ai then + gl_Color(0.1,0.1,0.97,1) + else + if ready then + gl_Color(0.1,0.95,0.2,1) + else + if hasStartPoint then + gl_Color(1,0.65,0.1,1) + else + gl_Color(0.8,0.1,0.1,1) + end + end + end + gl_Texture(pics["readyTexture"]) + DrawRect(posX, posY - 1 , posX + 16, posY + 16) + gl_Color(1,1,1,1) +end + +function DrawAlliances(alliances, posY) -- still a problem is that teams with the same/similar color can be misleading + local posX = widgetPosX + m_name.posX + local width = m_name.width / #alliances + local padding = 2 + for i,playerID in pairs(alliances) do + if player[playerID] ~= nil and player[playerID].red ~= nil then + gl_Color(0,0,0,0.25) + RectRound(posX+(width*(i-1)), posY - 3 , posX + (width*i), posY + 19, 2) + gl_Color(player[playerID].red, player[playerID].green, player[playerID].blue, 0.5) + RectRound(posX+(width*(i-1)) + padding, posY - 3 + padding , posX + (width*i)- padding, posY + 19 - padding, 2) + end + end + gl_Color(1,1,1,1) +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 + else + willSub = (Spring.GetGameRulesParam("Player" .. (playerID) .. "willSub")==1) and " (sub)" or "" + end + end + local nameText = name .. willSub + + + local nameColourR,nameColourG,nameColourB,nameColourA = Spring_GetTeamColor(team) + local xPadding = 0 + + -- includes readystate icon if factions arent shown + if not gameStarted and not m_side.active then + xPadding = 16 + DrawState(playerID, m_name.posX + widgetPosX, posY) + end + if (nameColourR + nameColourG*1.2 + nameColourB*0.4) < 0.8 then + font2:Begin() + font2:Print(colourNames(team) .. nameText, m_name.posX + widgetPosX + 3 + xPadding, posY + 4, 14, "o") + font2:End() + else + 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) +end + + +function DrawSmallName(name, team, posY, dark, playerID, alpha) + if team == nil then + return + end + + local ignored = WG.ignoredPlayers and WG.ignoredPlayers[name] + 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 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 + 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 + 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) + local spacer = "" + if playerID < 10 then + spacer = " " + end + local fontSize = 11 + local deadspace = 0 + 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") + --font:Print(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 4.1, fontSize, "n") + if dead then + font:SetTextColor(1,1,1,0.4) + else + font:SetTextColor(1,1,1,0.66) + end + font:Print(spacer .. playerID .. "", m_ID.posX + deadspace + widgetPosX+4.5, posY + 5, fontSize, "on") + font:End() +end + +function DrawSkill(skill, posY, dark) + 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) + gl_Texture(pics["pingPic"]) + if spec then + local grayvalue = 0.3 + (pingLvl / 15) + gl_Color(grayvalue,grayvalue,grayvalue,(0.2*pingLvl)) + DrawRect(m_cpuping.posX + widgetPosX + 12, posY+1, m_cpuping.posX + widgetPosX + 21, posY + 14) + else + gl_Color(pingCpuColors[pingLvl].r,pingCpuColors[pingLvl].g,pingCpuColors[pingLvl].b) + DrawRect(m_cpuping.posX + widgetPosX + 12, posY+1, m_cpuping.posX + widgetPosX + 24, posY + 15) + end + + 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 + --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 + --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 + end + else + + if fps ~= nil then + if fps > 99 then + fps = 99 + end + grayvalue = 0.95 - (fps/195) + if fps < 0 then + fps = 0 + greyvalue = 1 + end + if spec then + --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 + --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 + else + gl_Texture(pics["cpuPic"]) + if spec then + gl_Color(grayvalue,grayvalue,grayvalue,0.1+(0.14*cpuLvl)) + DrawRect(m_cpuping.posX + widgetPosX + 2 , posY+1, m_cpuping.posX + widgetPosX + 13, posY + 14) + else + 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) + if right == true then + gl_Color(1,0,0,pointtime/pointDuration) + gl_Texture(pics["arrowPic"]) + DrawRect(widgetPosX - 18, posY, widgetPosX - 2, posY+ 14) + gl_Color(1,1,1,pointtime/pointDuration) + gl_Texture(pics["pointPic"]) + DrawRect(widgetPosX - 33, posY-1, widgetPosX - 17, posY + 15) + else + leftPosX = widgetPosX + widgetWidth + gl_Color(1,0,0,pointtime/pointDuration) + gl_Texture(pics["arrowPic"]) + 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) + end + gl_Color(1,1,1,1) +end + +function TakeTip(mouseX) + if right == true then + if mouseX >= widgetPosX - 57 * widgetScale and mouseX <= widgetPosX - 1 * widgetScale then + tipText = "Click to take abandoned units" + end + else + local leftPosX = widgetPosX + widgetWidth + if mouseX >= leftPosX + 1 * widgetScale and mouseX <= leftPosX + 57 * widgetScale then + tipText = "Click to take abandoned units" + end + end +end + +function ShareTip(mouseX, playerID) + if playerID == myPlayerID then + if mouseX >= widgetPosX + (m_share.posX + 1) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 17) * widgetScale then + tipText = "Double click to ask for Unit support" + elseif mouseX >= widgetPosX + (m_share.posX + 19) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 35) * widgetScale then + tipText = "Click and drag to ask for Energy" + elseif mouseX >= widgetPosX + (m_share.posX + 37) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 53) * widgetScale then + tipText = "Click and drag to ask for Metal" + end + else + if mouseX >= widgetPosX + (m_share.posX + 1) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 17) * widgetScale then + tipText = "Double click to share Units" + elseif mouseX >= widgetPosX + (m_share.posX + 19) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 35) * widgetScale then + tipText = "Click and drag to share Energy" + elseif mouseX >= widgetPosX + (m_share.posX + 37) * widgetScale and mouseX <= widgetPosX + (m_share.posX + 53) * widgetScale then + tipText = "Click and drag to share Metal" + end + end +end + + +function AllyTip(mouseX, playerID) + if mouseX >= widgetPosX + (m_alliance.posX + 1) * widgetScale and mouseX <= widgetPosX + (m_alliance.posX + 11) * widgetScale then + if Spring_AreTeamsAllied(player[playerID].team, myTeamID) then + tipText = "Click to become enemy" + else + tipText = "Click to become ally" + end + end +end + + +function ResourcesTip(mouseX, e, es, ei, m, ms, mi) + if mouseX >= widgetPosX + (m_resources.posX + 1) * widgetScale and mouseX <= widgetPosX + (m_resources.posX + m_resources.width) * widgetScale then + if e > 1000 then + e = math.floor(e / 100) * 100 + else + e = math.floor(e / 10) * 10 + end + if m > 1000 then + m = math.floor(m / 100) * 100 + else + m = math.floor(m / 10) * 10 + end + if ei == nil then + ei = 0 + mi = 0 + end + ei = math.floor(ei) + mi = math.floor(mi) + if ei > 1000 then + ei = math.floor(ei / 100) * 100 + elseif ei > 100 then + ei = math.floor(ei / 10) * 10 + end + if mi > 200 then + mi = math.floor(mi / 10) * 10 + end + if e >= 10000 then e = math.floor(e/1000).."k" end + 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\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, 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" + elseif pingLvl >= 2000 and pingLvl < 60000 then + pingLvl = round(pingLvl/1000,0).." sec" + elseif pingLvl >= 60000 then + pingLvl = round(pingLvl/60000,0).." min" + end + tipText = "sPing (Buffered, NOT actual latency!): "..pingLvl + elseif mouseX >= widgetPosX + (m_cpuping.posX + 1) * widgetScale and mouseX <= widgetPosX + (m_cpuping.posX + 11) * widgetScale then + tipText = "Cpu: "..cpuLvl.."%" + 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 + end +end + +function PointTip(mouseX) + if right == true then + if mouseX >= widgetPosX - 28 * widgetScale and mouseX <= widgetPosX - 1 * widgetScale then + tipText = "Click to reach the last point set by the player" + end + else + local leftPosX = widgetPosX + widgetWidth + if mouseX >= leftPosX + 1 * widgetScale and mouseX <= leftPosX + 28 * widgetScale then + tipText = "Click to reach the last point set by the player" + end + end +end + + +function stringToLines(str) + local t = {} + local function helper(line) t[#t+1] = line return "" end + helper((str:gsub("(.-)\r?\n", helper))) + return t +end + + +function DrawTip(mouseX, mouseY) + + local scaleDiffX = -((widgetPosX*widgetScale)-widgetPosX)/widgetScale + local scaleDiffY = -((widgetPosY*widgetScale)-widgetPosY)/widgetScale + local scaleReset = widgetScale / widgetScale / widgetScale + gl.Translate(-scaleDiffX,-scaleDiffY,0) + gl.Scale(scaleReset,scaleReset,0) + + text = tipText --this is needed because we're inside a gllist + if text ~= nil then + local fontSize = 14*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) + + local oldWidgetScale = widgetScale + widgetScale = 1 + + local bottomY = mouseY-(th-(26*oldWidgetScale)) + local ycorrection = 0 + if bottomY < 0 then ycorrection = (15*widgetScale)-bottomY end + + local padding = -1.8*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 + font:Begin() + for i, line in ipairs(textLines) do + 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 + font:End() + end + tipText = nil + + gl.Color(1,1,1,1) + gl.Scale(widgetScale,widgetScale,0) + gl.Translate(scaleDiffX,scaleDiffY,0) +end + +--------------------------------------------------------------------------------------------------- +-- Share slider gllist +--------------------------------------------------------------------------------------------------- + +function CreateShareSlider() + + if ShareSlider then + gl_DeleteList(ShareSlider) + end + + ShareSlider = gl_CreateList(function() + + font:Begin() + local posY + if energyPlayer ~= nil then + posY = widgetPosY + widgetHeight - energyPlayer.posY + gl_Texture(pics["barPic"]) + DrawRect(m_share.posX + widgetPosX + 16,posY-3,m_share.posX + widgetPosX + 34,posY+58) + gl_Texture(pics["energyPic"]) + DrawRect(m_share.posX + widgetPosX + 17,posY+sliderPosition,m_share.posX + widgetPosX + 33,posY+16+sliderPosition) + gl_Texture(pics["amountPic"]) + if right == true then + DrawRect(m_share.posX + widgetPosX - 28,posY-1+sliderPosition, m_share.posX + widgetPosX + 19,posY+17+sliderPosition) + gl_Texture(false) + 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"]) + DrawRect(m_share.posX + widgetPosX + 32,posY-3,m_share.posX + widgetPosX + 50,posY+58) + gl_Texture(pics["metalPic"]) + DrawRect(m_share.posX + widgetPosX + 33, posY+sliderPosition,m_share.posX + widgetPosX + 49,posY+16+sliderPosition) + gl_Texture(pics["amountPic"]) + if right == true then + DrawRect(m_share.posX + widgetPosX - 12,posY-1+sliderPosition, m_share.posX + widgetPosX + 35,posY+17+sliderPosition) + gl_Texture(false) + 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 + font:End() + + end) +end + +function GetCpuLvl(cpuUsage) + + -- set the 5 cpu usage levels (green to red) + + if cpuUsage < 0.15 then return 1 + elseif cpuUsage < 0.3 then return 2 + elseif cpuUsage < 0.45 then return 3 + elseif cpuUsage < 0.65 then return 4 + else return 5 + end + +end + +function GetPingLvl(ping) + + -- set the 5 ping levels (green to red) + + if ping < 0.15 then return 1 + elseif ping < 0.3 then return 2 + elseif ping < 0.7 then return 3 + elseif ping < 1.5 then return 4 + else return 5 + end +end + + +--------------------------------------------------------------------------------------------------- +-- Mouse +--------------------------------------------------------------------------------------------------- + +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 + local clickTime = os.clock() + if button == 1 then + local alt,ctrl,meta,shift = Spring.GetModKeyState() + sliderPosition = 0 + amountEM = 0 + -- spectators label onclick + posY = widgetPosY + widgetHeight - specsLabelOffset + if numberOfSpecs > 0 and IsOnRect(x, y, widgetPosX + 2, posY+2, widgetPosX + widgetWidth - 2, posY+20) then + specListShow = not specListShow + SetModulesPositionX() --why? + SortList() + CreateLists() + return true + end + + for _,i in ipairs(drawList) do -- i = object # + if i > -1 then + clickedPlayer = player[i] + clickedPlayer.id = i + clickedName = clickedPlayer.name + posY = widgetPosY + widgetHeight - clickedPlayer.posY + end + + if mySpecStatus == true then + + if i == -1 then + t = true + else + t = false + if m_point.active then + if i > -1 and i < 64 then + if clickedPlayer.pointTime ~= nil then + if right == true then + if IsOnRect(x,y, widgetPosX - 33, posY - 2,widgetPosX - 17, posY + 16) then --point button + Spring.SetCameraTarget(clickedPlayer.pointX,clickedPlayer.pointY,clickedPlayer.pointZ,1) -- -- + return true -- + end -- + else -- + if IsOnRect(x,y, widgetPosX + widgetWidth + 17, posY-2,widgetPosX + widgetWidth + 33, posY + 16) then -- + Spring.SetCameraTarget(clickedPlayer.pointX,clickedPlayer.pointY,clickedPlayer.pointZ,1) -- + return true + end + end + end + end + end + end + if i>-1 and i<64 then + 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+16) then + if ctrl then + Spring_SendCommands{"toggleignore "..clickedPlayer.name} + return true + end + + if (mySpecStatus or player[i].allyteam == myAllyTeamID) and clickTime - prevClickTime < dblclickPeriod and clickedName == prevClickedName then + LockCamera(i) + prevClickedName = '' + SortList() + CreateLists() + return true + end + prevClickedName = clickedName + end + end + + else + if t == true then + if clickedPlayer.allyteam == myAllyTeamID then + if m_take.active == true then + if clickedPlayer.totake == true then + if right == true then + if IsOnRect(x,y, widgetPosX - 57, posY ,widgetPosX - 12, posY + 17) then --take button + Take(clickedPlayer.team, clickedPlayer.name, i) -- + return true -- + end -- + else -- + if IsOnRect(x,y, widgetPosX + widgetWidth + 12, posY ,widgetPosX + widgetWidth + 57, posY + 17) then -- + Take(clickedPlayer.team, clickedPlayer.name, i) -- + return true + end + end + end + end + if m_share.active == true and clickedPlayer.dead ~= true then + if IsOnRect(x, y, m_share.posX + widgetPosX +1, posY, m_share.posX + widgetPosX +17,posY+16) then -- share units button + if release ~= nil then -- + if release >= now then -- + if clickedPlayer.team == myTeamID then -- + Spring_SendCommands("say a: I need unit support!") -- (ask) + else -- + local suc = Spring.GetSelectedUnitsCount() + Spring_SendCommands("say a: I gave "..suc.." units to "..clickedPlayer.name..".") + local su = Spring.GetSelectedUnits() + for _,uid in ipairs(su) do + local ux,uy,uz = Spring.GetUnitPosition(uid) + Spring.MarkerAddPoint(ux,uy,uz) + end + Spring_ShareResources(clickedPlayer.team, "units") -- + end + end + release = nil + else + firstclick = now+1 + end + return true + end + if IsOnRect(x, y, m_share.posX + widgetPosX +17, posY, m_share.posX + widgetPosX +33,posY+16) then -- share energy button (initiates the slider) + energyPlayer = clickedPlayer + return true + end + if IsOnRect(x, y, m_share.posX + widgetPosX +33, posY, m_share.posX + widgetPosX +49,posY+16) then -- share metal button (initiates the slider) + metalPlayer = clickedPlayer + return true + end + end + end + end + if i == -1 then + t = true + else + t = false + if i > -1 and i < 64 then + --chat button + if m_chat.active == true then + if IsOnRect(x, y, m_chat.posX + widgetPosX +1, posY, m_chat.posX + widgetPosX +17,posY+16) then + Spring_SendCommands("chatall","pastetext /w "..clickedPlayer.name..' \1') + return true + end + end + --ally button + if m_alliance.active == true and drawAllyButton and not mySpecStatus and player[i] ~= nil and player[i].dead ~= true and i ~= myPlayerID then + if IsOnRect(x, y, m_alliance.posX + widgetPosX +1, posY, m_alliance.posX + widgetPosX + m_alliance.width,posY+16) then + if Spring_AreTeamsAllied(player[i].team, myTeamID) then + Spring_SendCommands("ally "..player[i].allyteam.." 0") + else + Spring_SendCommands("ally "..player[i].allyteam.." 1") + end + return true + end + end + --point + if m_point.active then + if clickedPlayer.pointTime ~= nil then + if clickedPlayer.allyteam == myAllyTeamID then + if right == true then + if IsOnRect(x,y, widgetPosX - 28, posY - 1,widgetPosX - 12, posY + 17) then + Spring.SetCameraTarget(clickedPlayer.pointX,clickedPlayer.pointY,clickedPlayer.pointZ,1) + return true + end + else + if IsOnRect(x,y, widgetPosX + widgetWidth + 12, posY-1,widgetPosX + widgetWidth + 28, posY + 17) then + Spring.SetCameraTarget(clickedPlayer.pointX,clickedPlayer.pointY,clickedPlayer.pointZ,1) + return true + end + end + end + end + end + --name + 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 = '' + SortList() + CreateLists() + return true + end + prevClickedName = clickedName + end + end + end + end + end + end + prevClickTime = clickTime +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 + if sliderOrigin == nil then + sliderOrigin = y + end + sliderPosition = (y-sliderOrigin) * (1/widgetScale) + if sliderPosition < 0 then sliderPosition = 0 end + if sliderPosition > 39 then sliderPosition = 39 end + local prevAmountEM = amountEM + UpdateResources() + if playSounds and (lastSliderSound == nil or os.clock() - lastSliderSound > 0.05) and amountEM ~= prevAmountEM then + lastSliderSound = os.clock() + Spring.PlaySoundFile(sliderdrag, 0.3, 'ui') + end + end +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 + firstclick = nil + else + release = nil + end + if energyPlayer ~= nil then -- share energy/metal mouse release + if energyPlayer.team == myTeamID then + if amountEM == 0 then + Spring_SendCommands("say a: I need Energy!") + else + Spring_SendCommands("say a: I need "..amountEM.." Energy!") + end + elseif amountEM > 0 then + Spring_ShareResources(energyPlayer.team, "energy", amountEM) + Spring_SendCommands("say a: I sent "..amountEM.." energy to "..energyPlayer.name) + end + sliderOrigin = nil + amountEMMax = nil + sliderPosition = nil + amountEM = nil + energyPlayer = nil + end + + if metalPlayer ~= nil then + if metalPlayer.team == myTeamID then + if amountEM == 0 then + Spring_SendCommands("say a: I need Metal!") + else + Spring_SendCommands("say a: I need "..amountEM.." Metal!") + end + elseif amountEM > 0 then + Spring_ShareResources(metalPlayer.team, "metal", amountEM) + Spring_SendCommands("say a: I sent "..amountEM.." metal to "..metalPlayer.name) + end + sliderOrigin = nil + amountEMMax = nil + sliderPosition = nil + amountEM = nil + metalPlayer = nil + end + end +end + +function Spec(teamID) + Spring_SendCommands{"specteam "..teamID} + specTarget = teamID + SortList() +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) + + -- calc scale offset + BLcornerX = BLcornerX - ((widgetPosX - BLcornerX) * (widgetScale-1)) + BLcornerY = BLcornerY - ((widgetPosY - BLcornerY) * (widgetScale-1)) + TRcornerX = TRcornerX - ((widgetPosX - TRcornerX) * (widgetScale-1)) + TRcornerY = TRcornerY - ((widgetPosY - TRcornerY) * (widgetScale-1)) + + -- check if the mouse is in a rectangle + return x >= BLcornerX and x <= TRcornerX + and y >= BLcornerY + and y <= TRcornerY +end + +local function DrawGreyRect() + gl_Color(0.2,0.2,0.2,0.25) + gl_Rect(widgetPosX, widgetPosY, widgetPosX + widgetWidth, widgetPosY + widgetHeight) + gl_Color(1,1,1,1) +end + +local function DrawTweakButton(module, localLeft, localOffset, localBottom) + gl_Texture(module.pic) + DrawRect(localLeft + localOffset, localBottom + 11, localLeft + localOffset + 16, localBottom + 27) + if module.active ~= true and module.alwaysActive == nil then + gl_Texture(pics["crossPic"]) + DrawRect(localLeft + localOffset, localBottom + 11, localLeft + localOffset + 16, localBottom + 27) + end +end + +local function DrawTweakButtons() + + local minSize = (modulesCount-1) * 16 + 2 + local localLeft = widgetPosX + local localBottom = widgetPosY + widgetHeight - 28 + local localOffset = 1 --see func above, these track how far right we've got TODO: pass values + + gl_Color(0,0,0,0.5) + RectRound(localLeft-3, localBottom + 8, localLeft + widgetWidth+3, localBottom + 30, 5, true) + + gl_Color(1,1,1,1) + --if localLeft + minSize > vsx then localLeft = vsx - minSize end + if localBottom < 0 then localBottom = 0 end + + for n,module in pairs(modules) do + if module.noPic == nil or module.noPic == false then + if mySpecStatus == false or mySpecStatus == true and module.spec then + DrawTweakButton(module, localLeft, localOffset, localBottom) + localOffset = localOffset + 16 + end + end + if module.picGap ~= nil then + if mySpecStatus == false or mySpecStatus == true and module.spec then + localOffset = localOffset + module.picGap + end + end + end + +end + +local function DrawArrows() + gl_Color(1,1,1,0.4) + gl_Texture(pics["arrowdPic"]) + if expandDown == true then + DrawRect(widgetPosX, widgetPosY - 15, widgetRight, widgetPosY - 1) + else + DrawRect(widgetPosX, widgetTop + 15, widgetRight, widgetTop + 1) + end + gl_Texture(pics["arrowPic"]) + if expandLeft == true then + DrawRect(widgetPosX - 1, widgetPosY, widgetPosX - 15, widgetTop) + else + DrawRect(widgetRight + 1, widgetPosY, widgetRight + 15, widgetTop) + end + gl_Color(1,1,1,1) + gl_Texture(false) +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) + gl.Translate(scaleDiffX,scaleDiffY,0) + + --DrawGreyRect() + DrawTweakButtons() + --DrawArrows() + + CreateMainList() + CreateBackground() + + local scaleReset = widgetScale / widgetScale / widgetScale + gl.Translate(-scaleDiffX,-scaleDiffY,0) + gl.Scale(scaleReset,scaleReset,0) +end + +function checkButton(module, x, y, localLeft, localOffset, localBottom) + if IsOnRect(x, y, localLeft + localOffset, localBottom + 11, localLeft + localOffset + 16, localBottom + 27) then + if module.alwaysActive == nil then + module.active = not module.active + SetModulesPositionX() --why? + SortList() + -- adjust because of widget scaling + local widthDiff = (module.width * widgetScale) - module.width + if module.active then + widgetRight = widgetRight - widthDiff + else + widgetRight = widgetRight + widthDiff + end + else + if module.name == "sizedn" then + customScaleDown() + elseif module.name == "sizeup" then + customScaleUp() + end + end + CreateLists() + return true + else + return false + end +end + +function widget:TweakMousePress(x,y,button) + + if collapsed then return end + + if button == 1 then + local localLeft = widgetPosX + local localBottom = widgetPosY + widgetHeight - 28 + local localOffset = 1 + if localBottom < 0 then localBottom = 0 end + --if localLeft + 181 > vsx then localLeft = vsx - 181 end + + for _,module in pairs(modules) do + if module.noPic == nil or module.noPic == false then + if mySpecStatus == false or mySpecStatus == true and module.spec then + if checkButton(module,x,y,localLeft,localOffset,localBottom) then return true end + localOffset = localOffset + 16 + end + end + if module.picGap ~= nil then + if mySpecStatus == false or mySpecStatus == true and module.spec then + localOffset = localOffset + module.picGap + end + end + end + elseif button == 2 or button == 3 then + if IsOnRect(x, y, widgetPosX, widgetPosY, widgetPosX + widgetWidth, widgetPosY + widgetHeight) then + clickToMove = true + return true + end + + end +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 + end + if moveStartY == nil then -- move widget on y axis + moveStartY = y - widgetPosY + end + widgetPosX = widgetPosX + dx + widgetPosY = widgetPosY + dy + + if widgetPosY <= (backgroundMargin*widgetScale) then + widgetPosY = (backgroundMargin*widgetScale) + expandDown = false --expandDown=false only if we are right on the bottom of the screen + end + if widgetPosY + (widgetHeight * widgetScale) >= vsy -(backgroundMargin*widgetScale) then + widgetPosY = vsy - (widgetHeight * widgetScale) -(backgroundMargin*widgetScale) + expandDown = true + end + if widgetPosX <= (backgroundMargin*widgetScale) then --expandLeft=false only when we are precisely on the left edge of the screen + widgetPosX = (backgroundMargin*widgetScale) + expandLeft = false + end + if widgetPosX + (widgetWidth * widgetScale) >= vsx-(backgroundMargin*widgetScale) then + widgetPosX = vsx - (widgetWidth * widgetScale) - (backgroundMargin*widgetScale) + expandLeft = true + end + widgetTop = widgetPosY + widgetHeight + widgetRight = widgetPosX + widgetWidth + widgetRelRight = vsx - (widgetPosX + (widgetWidth*widgetScale)) + if widgetPosX + widgetWidth/2 > vsx/2 then + right = true + else + right = false + end + end +end + +function widget:TweakMouseRelease(x,y,button) + + if collapsed then return end + + clickToMove = nil -- ends the share slider process +end + +--------------------------------------------------------------------------------------------------- +-- Save/load +--------------------------------------------------------------------------------------------------- + +function widget:GetConfigData(data) -- save + if m_side ~= nil then + + --put module.active into a table + local m_active_Table = {} + for n,module in pairs(modules) do + m_active_Table[module.name] = module.active + end + + local settings = { + --view + customScale = customScale, + vsx = vsx, + vsy = vsy, + widgetRelRight = widgetRelRight, + widgetPosX = widgetPosX, + widgetPosY = widgetPosY, + widgetRight = widgetRight, + widgetTop = widgetTop, + expandDown = expandDown, + expandLeft = expandLeft, + specListShow = specListShow, + m_pointActive = m_point.active, + m_takeActive = m_take.active, + m_seespecActive = m_seespec.active, + m_active_Table = m_active_Table, + cpuText = cpuText, + lockPlayerID = lockPlayerID, + specListShow = specListShow, + gameFrame = Spring.GetGameFrame(), + lastSystemData = lastSystemData, + alwaysHideSpecs = alwaysHideSpecs, + collapsable = collapsable, + transitionTime = transitionTime, + lockcameraHideEnemies = lockcameraHideEnemies, + lockcameraLos = lockcameraLos, + } + + return settings + end +end + +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 + expandLeft = data.expandLeft + specListShow = data.specListShow + local oldvsx = data.vsx + local oldvsy = data.vsy + if oldvsx == nil then + oldvsx = vsx + oldvsy = vsy + end + local dx = vsx - oldvsx + local dy = vsy - oldvsy + if expandDown == true then + widgetTop = data.widgetTop + dy + if widgetTop > vsy then + widgetTop = vsy + end + else + widgetPosY = data.widgetPosY + end + if expandLeft == true then + widgetRelRight = data.widgetRelRight or 0 + widgetRight = vsx - (widgetWidth * (widgetScale-1)) - widgetRelRight --align right of widget to right of screen + widgetPosX = widgetRight - (widgetWidth*widgetScale) + if widgetRight > vsx then + widgetRight = vsx + end + else + widgetPosX = data.widgetPosX --align left of widget to left of screen + end + 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 + end + + --not technically modules + m_point.active = true -- m_point.default doesnt work + if data.m_pointActive ~= nil then + m_point.active = data.m_pointActive + end + m_take.active = true -- m_take.default doesnt work + if data.m_takeActive ~= nil then + m_take.active = data.m_takeActive + end + m_seespec.active = true -- m_seespec.default doesnt work + if data.m_seespecActive ~= nil then + m_seespec.active = data.m_seespecActive + end + --load module.active from table + local m_active_Table = data.m_active_Table or {} + for name,active in pairs(m_active_Table) do + --find module with matching name + for _,module in pairs(modules) do + if module.name == name then + if name == "ally" then -- needs to be always active (some aready stored it as false before, this makes sure its corrected) + module.active = true + else + module.active = module.default + if active ~= nil then + module.active = active + end + end + end + end + end + + SetModulesPositionX() + + if data.lastSystemData ~= nil and data.gameFrame ~= nil and data.gameFrame <= Spring.GetGameFrame() and data.gameFrame > Spring.GetGameFrame()-300 then + lastSystemData = data.lastSystemData + end +end + +function widget:TextCommand(command) + 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 + +--------------------------------------------------------------------------------------------------- +-- Player related changes +--------------------------------------------------------------------------------------------------- + +function CheckPlayersChange() + local sorting = false + for i = 0,63 do + 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 + if table.maxn(Spring_GetPlayerList(player[i].team,true)) == 0 then + player[player[i].team + 64] = CreatePlayerFromTeam(player[i].team) + sorting = true + end + end + player[i].name = nil + player[i] = {} + sorting = true + end + elseif active == true and name ~= nil then + if spec ~= player[i].spec then -- PLAYER SWITCHING TO SPEC STATUS + if spec == true then + if table.maxn(Spring_GetPlayerList(player[i].team,true)) == 0 then -- (update the no players team) + player[player[i].team + 64] = CreatePlayerFromTeam(player[i].team) + end + player[i].team = nil -- remove team + end + player[i].spec = spec -- consider player as spec + sorting = true + end + if teamID ~= player[i].team then -- PLAYER CHANGING TEAM + if table.maxn(Spring_GetPlayerList(player[i].team,true)) == 0 then -- check if there is no more player in the team + update + player[player[i].team + 64] = CreatePlayerFromTeam(player[i].team) + end + player[i].team = teamID + player[i].red, player[i].green, player[i].blue = Spring_GetTeamColor(teamID) + player[i].dark = GetDark(player[i].red, player[i].green, player[i].blue) + player[i].skill = GetSkill(i) + sorting = true + end + if player[i].name == nil then + player[i] = CreatePlayer(i) + end + if allyTeamID ~= player[i].allyteam then + player[i].allyteam = allyTeamID + updateTake(allyTeamID) + sorting = true + end + + -- Update stall / cpu / ping info for each player + if player[i].spec == false then + player[i].needm = GetNeed("metal",player[i].team) + player[i].neede = GetNeed("energy",player[i].team) + player[i].rank = rank + else + player[i].needm = false + player[i].neede = false + end + player[i].pingLvl = GetPingLvl(pingTime) + player[i].cpuLvl = GetCpuLvl(cpuUsage) + player[i].ping = pingTime*1000-((pingTime*1000)%1) + player[i].cpu = cpuUsage*100-((cpuUsage*100)%1) + end + + if teamID and Spring_GetGameFrame() > 0 then + local totake = IsTakeable(teamID) + player[i].totake = totake + if totake then + sorting = true + else + player[i].name = name + end + end + end + + 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 + +end + + + +function GetNeed(resType,teamID) + local current, _, pull, income = Spring_GetTeamResources(teamID, resType) + if current == nil then return false end + local loss = pull - income + if loss > 0 then + if loss*5 > current then + return true + end + end + return false +end + +local reportTake = false +local tookTeamID +local tookTeamName +local tookFrame = -120 + +function updateTake(allyTeamID) + for i = 0,teamN-1 do + if player[i + 64].allyTeam == allyTeamID then + player[i + 64] = CreatePlayerFromTeam(i) + end + end +end + +function Take(teamID,name, i) + + -- sends the /take command to spring + reportTake = true + tookTeamID = teamID + tookTeamName = name + tookFrame = Spring.GetGameFrame() + + Spring_SendCommands("luarules take2 " .. teamID) + return +end + +function widget:TeamDied(teamID) + player[teamID+64] = CreatePlayerFromTeam(teamID) + SortList() +end + +--------------------------------------------------------------------------------------------------- +-- Take related stuff +--------------------------------------------------------------------------------------------------- + +function IsTakeable(teamID) + if Spring_GetTeamRulesParam(teamID, "numActivePlayers") == 0 then + local units = Spring_GetTeamUnitCount(teamID) + local energy = Spring_GetTeamResources(teamID,"energy") + local metal = Spring_GetTeamResources(teamID,"metal") + if units and energy and metal then + if (units > 0) or (energy > 1000) or (metal > 100) then + return true + end + end + else + return false + end +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() + end + + if curFrame >= 30 + tookFrame then + if lastTakeMsg + 120 < tookFrame and reportTake then + local teamID = tookTeamID + local afterE = Spring_GetTeamResources(teamID,"energy") + local afterM = Spring_GetTeamResources(teamID, "metal") + local afterU = Spring_GetTeamUnitCount(teamID) + + local toSay = "say a: I took " .. tookTeamName .. ". " + + if afterE and afterM and afterU then + if afterE > 1.0 or afterM > 1.0 or afterU > 0 then + toSay = toSay .. "Left " .. math.floor(afterU) .. " units, " .. math.floor(afterE) .. " energy and " .. math.floor(afterM) .. " metal." + end + end + + Spring_SendCommands(toSay) + + for j = 0,127 do + if player[j].allyteam == myAllyTeamID then + if player[j].totake == true then + player[j] = CreatePlayerFromTeam(player[j].team) + SortList() + end + end + end + + lastTakeMsg = tookFrame + reportTake = false + else + reportTake = false + end + end + + -- update lists to take account of allyteam faction changes before gamestart + if not curFrame or curFrame <=0 then + if timeCounter < updateRatePreStart then + return + else + timeCounter = 0 + SetSidePics() --if the game hasn't started, update factions + CreateLists() + end + end + + -- update lists every now and then, just to make sure + if timeCounter < updateRate then + return + else + timeCounter = 0 + CreateLists() + end +end + + +--------------------------------------------------------------------------------------------------- +-- Other callins +--------------------------------------------------------------------------------------------------- + +function updateWidgetScale() + if customScale < 0.6 then + customScale = 0.6 + end + widgetScale = (0.75 + (vsx*vsy / 5000000)) * customScale +end + +function customScaleUp() + widgetPosX = widgetPosX - (widgetWidth*customScaleStep) + widgetRight = widgetPosX + widgetWidth + customScale = customScale + customScaleStep + updateWidgetScale() +end + +function customScaleDown() + widgetPosX = widgetPosX + (widgetWidth*customScaleStep) + widgetRight = widgetPosX + widgetWidth + customScale = customScale - customScaleStep + 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 + end + if expandLeft == true then + 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) + if m_point.active then + if cmdType == "point" then + player[playerID].pointX = px + player[playerID].pointY = py + player[playerID].pointZ = pz + player[playerID].pointTime = now + pointDuration + end + end + + local osClock = os.clock() + if cmdType == 'line' then + --mapDrawNicknameTime[playerID] = osClock + --AddCommandSpotter('map_draw', x, y, z, osClock, false, playerID) + end +end diff --git a/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua b/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua new file mode 100644 index 000000000..da2901c41 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_advplayerslist_displayinfo.lua @@ -0,0 +1,292 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- 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 info", + desc = "Displays current gametime, fps and gamespeed", + author = "Floris", + date = "april 2017", + license = "GNU GPL, v2 or later", + layer = -3, + enabled = true, -- 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 = 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 glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glColor = gl.Color +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 volume + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + updatePosition() + WG['displayinfo'] = {} + WG['displayinfo'].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, 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 updateValues() + + local textsize = 11*widgetScale + local textYPadding = 8*widgetScale + local textXPadding = 7*widgetScale + + if drawlist[2] ~= nil then + glDeleteList(drawlist[2]) + end + drawlist[2] = glCreateList( function() + local _,gamespeed,_ = Spring.GetGameSpeed() + gamespeed = string.format("%.2f", gamespeed) + local fps = Spring.GetFPS() + 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 + seconds = '00' + elseif seconds < 10 then + seconds = '0'..seconds + end + local time = minutes..':'..seconds + + 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 + drawlist[1] = glCreateList( function() + glColor(0, 0, 0, ui_opacity) + RectRound(left, bottom, right, top, 5.5*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() +end + + +function widget:Shutdown() + 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 + passedTime2 = passedTime2 + dt + if passedTime > 0.1 then + passedTime = passedTime - 0.1 + updatePosition() + end + if passedTime2 > 1 then + updateValues() + passedTime2 = passedTime2 - 1 + 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} + + 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 = 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 + 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 + if drawlist[1] ~= nil then + glPushMatrix() + glCallList(drawlist[1]) + glCallList(drawlist[2]) + glPopMatrix() + end +end diff --git a/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua b/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua new file mode 100644 index 000000000..b0cc82834 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_allySelectedUnits.lua @@ -0,0 +1,725 @@ +include("keysym.h.lua") +local versionNumber = "2.03" + +function widget:GetInfo() + return { + name = "Ally Selected Units", + desc = "Shows units selected by teammates [v" .. string.format("%s", versionNumber ) .. "]", + author = "very_bad_soldier", + date = "August 1, 2008", + license = "GNU GPL v2", + layer = -10, + 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) + +--callin driven +--"hot" units + +local floor = math.floor +local abs = math.abs + +local udefTab = UnitDefs +local spGetUnitDefID = Spring.GetUnitDefID +local spEcho = Spring.Echo +local spGetUnitPosition = Spring.GetUnitPosition +local spGetUnitBasePosition = Spring.GetUnitBasePosition +local spGetMyPlayerID = Spring.GetMyPlayerID +local spGetPlayerInfo = Spring.GetPlayerInfo +local spGetLocalTeamID = Spring.GetLocalTeamID +local spGetUnitDefDimensions = Spring.GetUnitDefDimensions +local spSelectUnitMap = Spring.SelectUnitMap +local spGetTeamColor = Spring.GetTeamColor +local spGetGroundHeight = Spring.GetGroundHeight +local spIsSphereInView = Spring.IsSphereInView +local spGetSpectatingState = Spring.GetSpectatingState +local spGetGameSeconds = Spring.GetGameSeconds +local spIsGUIHidden = Spring.IsGUIHidden +local glColor = gl.Color +local glDepthTest = gl.DepthTest +local glUnitShape = gl.UnitShape +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glTranslate = gl.Translate +local glText = gl.Text +local glTexture = gl.Texture +local glTexRect = gl.TexRect +local glBillboard = gl.Billboard +local glLineWidth = gl.LineWidth +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.45 +local hotFadeTime = 0.25 +local lockTeamUnits = false --disallow selection of units selected by teammates +local showAlly = true --also show allies (besides coop) +local useHotColor = false --use RED for all hot units, if false use playerColor starting with transparency +local showAsSpectator = true +local circleDivsCoop = 32 --nice circle +local circleDivsAlly = 5 --aka pentagon +local selectPlayerUnits = true + +local hotColor = { 1.0, 0.0, 0.0, 1.0 } + +local playerColorPool = {} +playerColorPool[1] = { 0.0, 1.0, 0.0 } +playerColorPool[2] = { 1.0, 1.0, 0.0 } +playerColorPool[3] = { 0.0, 0.0, 1.0 } +playerColorPool[4] = { 0.6, 0.0, 0.0 } --reserve full-red for hot units +playerColorPool[5] = { 0.0, 1.0, 1.0 } +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.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 = "LuaUI/Images/bgcorner.png" +local sizeMultiplier = 1 + +--Internals------------------------------------------------------ +local playerColors = {} +local nextPlayerPoolId = 1 +local myTeamID = Spring.GetMyTeamID() +local myPlayerID = Spring.GetMyPlayerID() +local playerSelectedUnits = {} +local hotUnits = {} +local circleLinesCoop +local circleLinesAlly +local lockPlayerID + +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 = scaleFactor*( 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*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 + +function widget:Initialize() + SetUnitConf() + circleLinesCoop = calcCircleLines(circleDivsCoop) + circleLinesAlly = calcCircleLines(circleDivsAlly) + + setPlayerColours() + + widget:PlayerChanged(myPlayerID) + + widgetHandler:RegisterGlobal('selectedUnitsRemove', selectedUnitsRemove) + 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') + 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,false)) + if not playerSelectedUnits[ playerID ] then + playerSelectedUnits[ playerID ] = { + ["units"]={}, + ["coop"]=(playerTeam == myTeamID), + ["todraw"] = DoDrawPlayer(playerID), + } + end + --grab color from color pool for new teammate + --no color yet + getPlayerColour(playerID,playerTeam) +end + +function getPlayerColour(playerID,teamID) + if playerSelectedUnits[ playerID ]["coop"] and not spec then + if not playerColorPool[ nextPlayerPoolId ] then + playerColors[ playerID ] = playerColorPool[ 1 ] --we have only 8 colors, take color 1 as default + else + playerColors[ playerID ] = playerColorPool[ nextPlayerPoolId ] + end + nextPlayerPoolId = nextPlayerPoolId + 1 + else + playerColors[ playerID ] = { spGetTeamColor( teamID ) }--he is only ally, use his color + end +end + +function setPlayerColours() + playerColors = {} + for _, playerID in pairs(Spring.GetPlayerList()) do + widget:PlayerAdded(playerID) + end +end + +function widget:PlayerChanged(playerID) + if not spec and spGetSpectatingState() then + spec = true + setPlayerColours() + if not showAsSpectator then + widgetHandler:RemoveWidget(self) + return + end + end + myTeamID = spGetLocalTeamID() + local playerTeam = select(4,spGetPlayerInfo(playerID,false)) + local oldCoopStatus = playerSelectedUnits[ playerID ]["coop"] + playerSelectedUnits[ playerID ]["coop"] = (teamID == myTeamID) + playerSelectedUnits[ playerID ]["todraw"] = DoDrawPlayer(playerID) + + --grab color from color pool for new teammate + if oldCoopStatus ~= playerSelectedUnits[ playerID ]["coop"] then + getPlayerColour(playerID,playerTeam) + end +end + +function calcCircleLines(divs) + local circleOffset = 0 + local lines = gl.CreateList(function() + gl.BeginEnd(GL.LINE_LOOP, function() + local radstep = (2.0 * math.pi) / divs + for i = 1, divs do + local a = (i * radstep) + gl.Vertex(math.sin(a), circleOffset, math.cos(a)) + end + end) + end) + + return lines +end + + +function widget:CommandsChanged( id, params, options ) + if ( lockTeamUnits ) then + deselectAllTeamSelected() + end +end + +function widget:UnitDestroyed(unitID) + hotUnits[ unitID ] = nil + + for playerID, selUnits in pairs( playerSelectedUnits ) do + selUnits["units"][ unitID ] = nil + end +end + +function newHotUnit( unitId, coop, playerID ) + if not playerSelectedUnits[playerID]["todraw"] then + return + end + local udef = spGetUnitDefID( unitId ) + if ( udef ~= nil ) then + local realDefRadius = unitConf[udef].xscale*1.5 + if ( realDefRadius ~= nil ) then + local defRadius = realDefRadius * scaleMultiplier + hotUnits[ unitId ] = { ts = os.clock(), coop = coop, defRadius = defRadius, playerID = playerID } + end + end +end + + +function selectedUnitsClear(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) + end + --make all hot + for unitId, defRadius in pairs(playerSelectedUnits[ playerID ]["units"]) do + newHotUnit( unitId, playerSelectedUnits[ playerID ]["coop"], playerID ) + end + --clear all + playerSelectedUnits[ playerID ]["units"] = {} + end + if lockPlayerID ~= nil and playerID == lockPlayerID and selectPlayerUnits then + selectPlayerSelectedUnits(lockPlayerID) + end +end + +function selectedUnitsAdd(playerID,unitID) + isSpec = select(3,spGetPlayerInfo(playerID),false) + if not isSpec or (lockPlayerID ~= nil and playerID == lockPlayerID) then + if not playerSelectedUnits[ playerID ] then + widget:PlayerAdded(playerID) + end + --add unit + local udefID = spGetUnitDefID(unitID) + if spGetUnitDefID(unitID) ~= nil then + local realDefRadius = unitConf[udefID].xscale*1.5 + if realDefRadius then + playerSelectedUnits[ playerID ]["units"][ unitID] = realDefRadius * scaleMultiplier + --un-hot it + hotUnits[ unitID ] = nil + end + end + end + if lockPlayerID ~= nil and playerID == lockPlayerID and selectPlayerUnits then + selectPlayerSelectedUnits(lockPlayerID) + end +end + +function selectedUnitsRemove(playerID,unitID) + isSpec = select(3,spGetPlayerInfo(playerID),false) + if not isSpec or (lockPlayerID ~= nil and playerID == lockPlayerID) then + if not playerSelectedUnits[ playerID ] then + widget:PlayerAdded(playerID) + end + --remove unit + playerSelectedUnits[ playerID ]["units"][unitID] = nil + --make it hot + newHotUnit( unitID, playerSelectedUnits[ playerID ]["coop"], playerID ) + end + if lockPlayerID ~= nil and playerID == lockPlayerID and selectPlayerUnits then + selectPlayerSelectedUnits(lockPlayerID) + end +end + +function DoDrawPlayer(playerID,teamID) + if playerID == myPlayerID then + return false + end + if teamID ~= myTeamID and not showAlly then + return false + end + return true + +end + +function deselectAllTeamSelected() + local selectedUnits = array2Table( spGetSelectedUnits() ) + for playerID, selUnits in pairs( playerSelectedUnits ) do + for unitId, defRadius in pairs( selUnits["units"] ) do + selectedUnits[unitId] = nil + end + end + spSelectUnitMap( selectedUnits ) +end + +function array2Table( arr ) + tab = {} + for i,v in ipairs(arr) do + tab[v] = true + end + return tab +end + +local updateTime = 0 +local checkLockPlayerInterval = 1 +function widget:Update(dt) + if (WG['advplayerlist_api'] ~= nil) then + updateTime = updateTime + dt + if updateTime > checkLockPlayerInterval then + lockPlayerID = WG['advplayerlist_api'].GetLockPlayerID() + if lockPlayerID ~= nil and selectPlayerUnits then + selectPlayerSelectedUnits(lockPlayerID) + end + updateTime = 0 + end + end +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 + + 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 + count = count + 1 + units[count] = unitId + end + end + end + Spring.SelectUnitArray(units) +end + +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) + 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'] then + WG['guishader'].InsertRect(xPos, yPos, xPos + (panelWidth*sizeMultiplier), yPos + (panelHeight*sizeMultiplier), 'allyselectedunits') + end + 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) + gl.PointSize(1) + local now = spGetGameSeconds() + for playerID, selUnits in pairs( playerSelectedUnits ) do + + 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) + 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 + --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 + glDrawListAtUnit(unitID, circleLinesCoop, false, defRadius,defRadius,defRadius) + else + glDrawListAtUnit(unitID, circleLinesAlly, false, defRadius,defRadius,defRadius) + end + end + end + end + end + end + + glColor(1, 1, 1, 1) + glLineWidth(1) +end + + +function DrawHotUnits() + glDepthTest(false) + glLineWidth( 2 ) + + local toDelete = {} + + for unitID, val in pairs( hotUnits ) do + if lockPlayerID == nil or val.playerID ~= lockPlayerID or (val.playerID == lockPlayerID and not selectPlayerUnits) then + local x, y, z = spGetUnitBasePosition(unitID) + local defRadius = val["defRadius"] + 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 timeDiff = (os.clock() - val["ts"]) + + if ( timeDiff <= hotFadeTime ) then + if ( useHotColor ) then + hotColor[4] = 1.0 - ( timeDiff / hotFadeTime ) + glColor( hotColor ) + else + local cl = playerColors[ val["playerID"] ] + cl[4] = maxAlpha - maxAlpha * ( timeDiff / hotFadeTime ) + glColor( cl ) + end + else + toDelete[unitID] = true + end + + if ( toDelete[unitID] == nil ) then + local lines = circleLinesAlly + if ( val["coop"] == true and not spec) then + lines = circleLinesCoop + end + + glPushMatrix() + glTranslate(x,y,z) + glScale( defRadius, 1, defRadius) + glCallList(lines) + glPopMatrix() + end + end + end + end + + for unitID, val in pairs( toDelete ) do + hotUnits[unitID] = nil + end + + glDepthTest(false) + glColor(1, 1, 1, 1) + glLineWidth( 1 ) +end + + + +function widget:GetConfigData() + return { + maxAlpha = maxAlpha, + selectPlayerUnits = selectPlayerUnits, + xRelPos = xRelPos, yRelPos = yRelPos, + version = 1.1 + } +end + +function widget:SetConfigData(data) + 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 55f167013..8178dddee 100644 --- a/LuaUI/Widgets_Evo/gui_attack_aoe.lua +++ b/LuaUI/Widgets_Evo/gui_attack_aoe.lua @@ -1,7 +1,7 @@ -- $Id: gui_attack_aoe.lua 3823 2009-01-19 23:40:49Z evil4zerggin $ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local versionNumber = "v3.1" +local versionNumber = "v3.1c" function widget:GetInfo() return { @@ -33,16 +33,14 @@ local pointSizeMult = 2048 -------------------------------------------------------------------------------- local aoeDefInfo = {} local dgunInfo = {} -local hasSelectionCallin = false +local hasSelection = false local aoeUnitDefID local dgunUnitDefID local aoeUnitID local dgunUnitID -local selUnitID local circleList local secondPart = 0 local mouseDistance = 1000 -local extraDrawRange -------------------------------------------------------------------------------- --speedups @@ -58,7 +56,7 @@ local GetUnitRadius = Spring.GetUnitRadius local GetUnitStates = Spring.GetUnitStates local TraceScreenRay = Spring.TraceScreenRay local CMD_ATTACK = CMD.ATTACK -local CMD_MANUALFIRE = CMD.MANUALFIRE +local CMD_DGUN = CMD.MANUALFIRE local g = Game.gravity local GAME_SPEED = 30 local g_f = g / GAME_SPEED / GAME_SPEED @@ -166,100 +164,84 @@ end --initialization -------------------------------------------------------------------------------- -local function getWeaponInfo(weaponDef, unitDef) - - local retData - - local weaponType = weaponDef.type - local scatter = weaponDef.accuracy + weaponDef.sprayAngle - local aoe = weaponDef.damageAreaOfEffect - local cost = unitDef.cost - local mobile = unitDef.speed > 0 - local waterWeapon = weaponDef.waterWeapon - local ee = weaponDef.edgeEffectiveness - if (weaponDef.cylinderTargetting >= 100) then - retData = {type = "orbital", scatter = scatter} - elseif (weaponType == "Cannon") then - retData = {type = "ballistic", scatter = scatter, v = (weaponDef.customParams.weaponvelocity or 0),range = weaponDef.range, - mygravity = weaponDef.customParams and weaponDef.customParams.mygravity and weaponDef.customParams.mygravity*800 - } - elseif (weaponType == "MissileLauncher") then - local turnRate = 0 - if (weaponDef.tracks) then - turnRate = weaponDef.turnRate - end - if (weaponDef.wobble > turnRate * 1.4) then - scatter = (weaponDef.wobble - weaponDef.turnRate) * (weaponDef.customParams.weaponvelocity or 0) * 16 - local rangeScatter = (8 * weaponDef.wobble - weaponDef.turnRate) - retData = {type = "wobble", scatter = scatter, rangeScatter = rangeScatter, range = weaponDef.range} - elseif (weaponDef.wobble > turnRate) then - scatter = (weaponDef.wobble - weaponDef.turnRate) * (weaponDef.customParams.weaponvelocity or 0) * 16 - retData = {type = "wobble", scatter = scatter} - elseif (weaponDef.tracks) then - retData = {type = "tracking"} - else - retData = {type = "direct", scatter = scatter, range = weaponDef.range} - end - elseif (weaponType == "AircraftBomb") then - retData = {type = "dropped", scatter = scatter, v = unitDef.speed, h = unitDef.wantedHeight, salvoSize = weaponDef.salvoSize, salvoDelay = weaponDef.salvoDelay} - elseif (weaponType == "StarburstLauncher") then - if (weaponDef.tracks) then - retData = {type = "tracking"} - else - retData = {type = "cruise"} - end - elseif (weaponType == "TorpedoLauncher") then - if (weaponDef.tracks) then - retData = {type = "tracking"} - else - retData = {type = "direct", scatter = scatter, range = weaponDef.range} - end - elseif (weaponType == "Flame" or weaponDef.noExplode) then - retData = {type = "noexplode", range = weaponDef.range} - else - retData = {type = "direct", scatter = scatter, range = weaponDef.range} - end - - if not weaponDef.impactOnly then - retData.aoe = aoe - else - retData.aoe = 0 - end - retData.cost = cost - retData.mobile = mobile - retData.waterWeapon = waterWeapon - retData.ee = ee - - return retData -end - local function SetupUnitDef(unitDefID, unitDef) if (not unitDef.weapons) then return end local maxSpread = minSpread local maxWeaponDef - for num, weapon in ipairs(unitDef.weapons) do + for _, weapon in ipairs(unitDef.weapons) do if (weapon.weaponDef) then local weaponDef = WeaponDefs[weapon.weaponDef] if (weaponDef) then - local aoe = weaponDef.damageAreaOfEffect - if (num == 3 and unitDef.canManualFire) then - dgunInfo[unitDefID] = getWeaponInfo(weaponDef, unitDef) - elseif (not weaponDef.isShield + if (weaponDef.canAttackGround + and not (weaponDef.type == "Shield") and not ToBool(weaponDef.interceptor) - and (aoe > maxSpread or weaponDef.range * (weaponDef.accuracy + weaponDef.sprayAngle) > maxSpread )) then - maxSpread = max(aoe, weaponDef.range * (weaponDef.accuracy + weaponDef.sprayAngle)) + and (weaponDef.damageAreaOfEffect > maxSpread or weaponDef.range * (weaponDef.accuracy + weaponDef.sprayAngle) > maxSpread ) + and not string.find(weaponDef.name, "flak")) then + maxSpread = max(weaponDef.damageAreaOfEffect, weaponDef.range * (weaponDef.accuracy + weaponDef.sprayAngle)) maxWeaponDef = weaponDef end end end end - if (maxWeaponDef) then - aoeDefInfo[unitDefID] = getWeaponInfo(maxWeaponDef, unitDef) + if (not maxWeaponDef) then return end + + local weaponType = maxWeaponDef.type + local scatter = maxWeaponDef.accuracy + maxWeaponDef.sprayAngle + local aoe = maxWeaponDef.damageAreaOfEffect + local cost = unitDef.cost + local mobile = unitDef.speed > 0 + local waterWeapon = maxWeaponDef.waterWeapon + local ee = maxWeaponDef.edgeEffectiveness + + if (maxWeaponDef.cylinderTargeting >= 100) then + aoeDefInfo[unitDefID] = {type = "orbital", scatter = scatter} + elseif (weaponType == "Cannon") then + aoeDefInfo[unitDefID] = {type = "ballistic", scatter = scatter, v = maxWeaponDef.projectilespeed * 30, range = maxWeaponDef.range} + elseif (weaponType == "MissileLauncher") then + local turnRate = 0 + if (maxWeaponDef.tracks) then + turnRate = maxWeaponDef.turnRate + end + if (maxWeaponDef.wobble > turnRate * 1.4) then + scatter = (maxWeaponDef.wobble - maxWeaponDef.turnRate) * maxWeaponDef.projectilespeed * 30 * 16 + local rangeScatter = (8 * maxWeaponDef.wobble - maxWeaponDef.turnRate) + aoeDefInfo[unitDefID] = {type = "wobble", scatter = scatter, rangeScatter = rangeScatter, range = maxWeaponDef.range} + elseif (maxWeaponDef.wobble > turnRate) then + scatter = (maxWeaponDef.wobble - maxWeaponDef.turnRate) * maxWeaponDef.projectilespeed * 30 * 16 + aoeDefInfo[unitDefID] = {type = "wobble", scatter = scatter} + elseif (maxWeaponDef.tracks) then + aoeDefInfo[unitDefID] = {type = "tracking"} + else + aoeDefInfo[unitDefID] = {type = "direct", scatter = scatter, range = maxWeaponDef.range} + end + elseif (weaponType == "AircraftBomb") then + aoeDefInfo[unitDefID] = {type = "dropped", scatter = scatter, v = unitDef.speed, h = unitDef.wantedHeight, salvoSize = maxWeaponDef.salvoSize, salvoDelay = maxWeaponDef.salvoDelay} + elseif (weaponType == "StarburstLauncher") then + if (maxWeaponDef.tracks) then + aoeDefInfo[unitDefID] = {type = "tracking"} + else + aoeDefInfo[unitDefID] = {type = "cruise"} + end + elseif (weaponType == "TorpedoLauncher") then + if (maxWeaponDef.tracks) then + aoeDefInfo[unitDefID] = {type = "tracking"} + else + aoeDefInfo[unitDefID] = {type = "direct", scatter = scatter, range = maxWeaponDef.range} + end + elseif (weaponType == "Flame" ) then + aoeDefInfo[unitDefID] = {type = "noexplode", range = maxWeaponDef.range} + else + aoeDefInfo[unitDefID] = {type = "direct", scatter = scatter, range = maxWeaponDef.range} end + aoeDefInfo[unitDefID].aoe = aoe + aoeDefInfo[unitDefID].cost = cost + aoeDefInfo[unitDefID].mobile = mobile + aoeDefInfo[unitDefID].waterWeapon = waterWeapon + aoeDefInfo[unitDefID].ee = ee end local function SetupDisplayLists() @@ -279,20 +261,19 @@ end local function UpdateSelection() local sel = GetSelectedUnitsSorted() - + local maxCost = 0 dgunUnitDefID = nil aoeUnitDefID = nil dgunUnitID = nil aoeUnitID = nil + hasSelection = false for unitDefID, unitIDs in pairs(sel) do - if unitDefID == "n" then - break - end if (dgunInfo[unitDefID]) then dgunUnitDefID = unitDefID dgunUnitID = unitIDs[1] + hasSelection = true end if (aoeDefInfo[unitDefID]) then @@ -301,13 +282,10 @@ local function UpdateSelection() maxCost = currCost aoeUnitDefID = unitDefID aoeUnitID = GetRepUnitID(unitIDs) + hasSelection = true end end - extraDrawRange = UnitDefs[unitDefID] and UnitDefs[unitDefID].customParams and UnitDefs[unitDefID].customParams.extradrawrange - if extraDrawRange then - selUnitID = GetRepUnitID(unitIDs) - end - end + end end -------------------------------------------------------------------------------- @@ -366,9 +344,10 @@ end --ballistics -------------------------------------------------------------------------------- -local function GetBallisticVector(v, mg, dx, dy, dz, trajectory, range) +local function GetBallisticVector(v, dx, dy, dz, trajectory, range) local dr_sq = dx*dx + dz*dz local dr = sqrt(dr_sq) + if (dr > range) then return nil end local d_sq = dr_sq + dy*dy @@ -377,10 +356,10 @@ local function GetBallisticVector(v, mg, dx, dy, dz, trajectory, range) return 0, v * trajectory, 0 end - local root1 = v*v*v*v - 2*v*v*mg*dy - mg*mg*dr_sq + local root1 = v*v*v*v - 2*v*v*g*dy - g*g*dr_sq if (root1 < 0) then return nil end - local root2 = 2*dr_sq*d_sq*(v*v - mg*dy - trajectory*sqrt(root1)) + local root2 = 2*dr_sq*d_sq*(v*v - g*dy - trajectory*sqrt(root1)) if (root2 < 0) then return nil end @@ -389,7 +368,7 @@ local function GetBallisticVector(v, mg, dx, dy, dz, trajectory, range) if (r == 0 or vr == 0) then vy = v - else vy = vr*dy/dr + dr*mg/(2*vr) + else vy = vr*dy/dr + dr*g/(2*vr) end local bx = dx*vr/dr @@ -430,16 +409,14 @@ end --v: weaponvelocity --trajectory: +1 for high, -1 for low -local function DrawBallisticScatter(scatter, v, mygravity ,fx, fy, fz, tx, ty, tz, trajectory, range) +local function DrawBallisticScatter(scatter, v, fx, fy, fz, tx, ty, tz, trajectory, range) if (scatter == 0) then return end local dx = tx - fx local dy = ty - fy local dz = tz - fz if (dx == 0 and dz == 0) then return end - - local mg = mygravity or g - - local bx, by, bz = GetBallisticVector(v, mg, dx, dy, dz, trajectory, range) + + local bx, by, bz = GetBallisticVector(v, dx, dy, dz, trajectory, range) --don't draw anything if out of range if (not bx) then return end @@ -483,14 +460,14 @@ local function DrawBallisticScatter(scatter, v, mygravity ,fx, fy, fz, tx, ty, t end glLineWidth(scatterLineWidthMult / mouseDistance) - -- FIXME ATIBUG glPointSize(pointSizeMult / mouseDistance) + glPointSize(pointSizeMult / mouseDistance) glColor(scatterColor) glDepthTest(false) glBeginEnd(GL_LINES, VertexList, bars) glBeginEnd(GL_POINTS, VertexList, vertices) glDepthTest(true) glColor(1,1,1,1) - -- FIXME ATIBUG glPointSize(1) + glPointSize(1) glLineWidth(1) end @@ -592,6 +569,14 @@ end --callins -------------------------------------------------------------------------------- +function widget:MousePress() + UpdateSelection() +end + +function widget:KeyPress() + UpdateSelection() +end + function widget:Initialize() for unitDefID, unitDef in pairs(UnitDefs) do SetupUnitDef(unitDefID, unitDef) @@ -603,51 +588,59 @@ 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 (not hasSelectionCallin) then + if chobbyInterface then return end + + if not hasSelection then return end + local _, cmd, _ = GetActiveCommand() + + if (cmd == CMD_DGUN and dgunUnitDefID) then + mouseDistance = GetMouseDistance() or 1000 + local tx, ty, tz = GetMouseTargetPosition() + if (not tx) then return end + local info = dgunInfo[dgunUnitDefID] + local fx, fy, fz = GetUnitPosition(dgunUnitID) + if (not fx) then return end + local angle = math.atan2(fx-tx,fz-tz) + (math.pi/2.1) + local offset_x = (sin(angle)*13) + local offset_z = (cos(angle)*13) + local dx = fx + offset_x + local dz = fz + offset_z + DrawNoExplode(info.aoe, dx, fy, dz, tx, ty, tz, info.range) + glColor(1, 0, 0, 0.75) + glLineWidth(1) + glDrawGroundCircle(fx, fy, fz, info.range, circleDivs) + glColor(1,1,1,1) + return + end + + if (cmd ~= CMD_ATTACK or not aoeUnitDefID) then UpdateSelection() + return end mouseDistance = GetMouseDistance() or 1000 - local tx, ty, tz = GetMouseTargetPosition() if (not tx) then return end - local _, cmd, _ = GetActiveCommand() - local info, unitID - - if extraDrawRange and selUnitID and cmd == CMD_ATTACK then - local fx, fy, fz = GetUnitPosition(selUnitID) - if fx then - glColor(1, 0.35, 0.35, 0.75) - glLineWidth(1) - glDrawGroundCircle(fx, fy, fz, extraDrawRange, 50) - glColor(1,1,1,1) - end - end - if (cmd == CMD_ATTACK and aoeUnitDefID) then - info = aoeDefInfo[aoeUnitDefID] - unitID = aoeUnitID - elseif (cmd == CMD_MANUALFIRE and dgunUnitDefID) then - info = dgunInfo[dgunUnitDefID] - unitID = dgunUnitID - else - return - end - - local fx, fy, fz = GetUnitPosition(unitID) + local info = aoeDefInfo[aoeUnitDefID] + local fx, fy, fz = GetUnitPosition(aoeUnitID) if (not fx) then return end - if (not info.mobile) then fy = fy + GetUnitRadius(unitID) end + if (not info.mobile) then fy = fy + GetUnitRadius(aoeUnitID) end if (not info.waterWeapon) then ty = max(0, ty) end local weaponType = info.type - if (weaponType == "noexplode") then - DrawNoExplode(info.aoe, fx, fy, fz, tx, ty, tz, info.range) - elseif (weaponType == "ballistic") then - local states = GetUnitStates(unitID) + if (weaponType == "ballistic") then + local states = GetUnitStates(aoeUnitID) local trajectory if (states.trajectory) then trajectory = 1 @@ -655,12 +648,14 @@ function widget:DrawWorld() trajectory = -1 end DrawAoE(tx, ty, tz, info.aoe, info.ee) - DrawBallisticScatter(info.scatter, info.v, info.mygravity, fx, fy, fz, tx, ty, tz, trajectory, info.range) + DrawBallisticScatter(info.scatter, info.v, fx, fy, fz, tx, ty, tz, trajectory, info.range) + elseif (weaponType == "noexplode") then + DrawNoExplode(info.aoe, fx, fy, fz, tx, ty, tz, info.range) elseif (weaponType == "tracking") then DrawAoE(tx, ty, tz, info.aoe, info.ee) elseif (weaponType == "direct") then DrawAoE(tx, ty, tz, info.aoe, info.ee) - DrawDirectScatter(info.scatter, fx, fy, fz, tx, ty, tz, info.range, GetUnitRadius(unitID)) + DrawDirectScatter(info.scatter, fx, fy, fz, tx, ty, tz, info.range, GetUnitRadius(aoeUnitID)) elseif (weaponType == "dropped") then DrawDroppedScatter(info.aoe, info.ee, info.scatter, info.v, fx, info.h, fz, tx, ty, tz, info.salvoSize, info.salvoDelay) elseif (weaponType == "wobble") then @@ -669,27 +664,24 @@ function widget:DrawWorld() elseif (weaponType == "orbital") then DrawAoE(tx, ty, tz, info.aoe, info.ee) DrawOrbitalScatter(info.scatter, tx, ty, tz) - elseif (weaponType == "dontdraw") then - -- don't draw anything foo else DrawAoE(tx, ty, tz, info.aoe, info.ee) end - - if (cmd == CMD_MANUALFIRE) then - glColor(1, 0, 0, 0.75) - glLineWidth(1) - glDrawGroundCircle(fx, fy, fz, info.range, circleDivs) - glColor(1,1,1,1) - end - end function widget:SelectionChanged(sel) - hasSelectionCallin = true - UpdateSelection() + selectionChanged = true end +local selChangedSec = 0 function widget:Update(dt) secondPart = secondPart + dt secondPart = secondPart - floor(secondPart) -end \ No newline at end of file + + 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 d1ee30b62..e6b58e5fa 100644 --- a/LuaUI/Widgets_Evo/gui_build_eta.lua +++ b/LuaUI/Widgets_Evo/gui_build_eta.lua @@ -5,7 +5,9 @@ -- brief: display estimated time of arrival for builds -- author: Dave Rodgers -- --- Copyright (C) 2007. +-- >> modified by: jK << +-- +-- Copyright (C) 2007,2008. -- Licensed under the terms of the GNU GPL, v2 or later. -- -------------------------------------------------------------------------------- @@ -15,10 +17,10 @@ function widget:GetInfo() return { name = "BuildETA", desc = "Displays estimated time of arrival for builds", - author = "trepan", - date = "Feb 04, 2007", + author = "trepan (modified by jK)", + date = "Feb, 2008", license = "GNU GPL, v2 or later", - layer = -1, + layer = -9, enabled = true -- loaded by default? } end @@ -26,18 +28,31 @@ end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -local gl = gl -- use a local copy for faster access +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 etaTable = {} +local gl = gl -- use a local copy for faster access +local Spring = Spring +local table = table +local etaTable = {} +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 @@ -57,7 +72,7 @@ local function MakeETA(unitID,unitDefID) lastProg = buildProgress, rate = nil, timeLeft = nil, - yoffset = ud.height + 14 --dims.height - (dims.midy - dims.miny) + 5 + yoffset = ud.height+14 } end @@ -65,12 +80,6 @@ end -------------------------------------------------------------------------------- function widget:Initialize() - if (UnitDefs[1].height == nil) then - for udid, ud in ipairs(UnitDefs) do - ud.height = Spring.GetUnitDefDimensions(udid).radius - end - end - local myUnits = Spring.GetTeamUnits(Spring.GetMyTeamID()) for _,unitID in ipairs(myUnits) do local _,_,_,_,buildProgress = Spring.GetUnitHealth(unitID) @@ -86,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 @@ -99,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 @@ -149,7 +161,7 @@ function widget:Update(dt) end end end - for _,unitID in ipairs(killTable) do + for _,unitID in pairs(killTable) do etaTable[unitID] = nil end end @@ -158,7 +170,8 @@ end -------------------------------------------------------------------------------- function widget:UnitCreated(unitID, unitDefID, unitTeam) - if (unitTeam == Spring.GetMyTeamID()) then + local spect,spectFull = Spring.GetSpectatingState() + if Spring.AreTeamsAllied(unitTeam,Spring.GetMyTeamID()) or (spect and spectFull) then etaTable[unitID] = MakeETA(unitID,unitDefID) end end @@ -178,40 +191,66 @@ function widget:UnitFinished(unitID, unitDefID, unitTeam) etaTable[unitID] = nil end - +function widget:Shutdown() + gl.DeleteFont(font) +end -------------------------------------------------------------------------------- -function widget:DrawWorld() -if not Spring.IsGUIHidden() then - gl.DepthTest(true) - - gl.Color(1, 1, 1) - --fontHandler.UseDefaultFont() - - for unitID, bi in pairs(etaTable) do - gl.DrawFuncAtUnit(unitID, true, function(timeLeft,yoffset) - local etaStr - if (timeLeft == nil) then - etaStr = '\255\1\1\255???' - else - if (timeLeft > 0) then - etaStr = string.format('\255\1\255\1%.1f', timeLeft) - else - etaStr = string.format('\255\255\1\1%.1f', -timeLeft) - end - end - etaStr = "\255\255\255\1ETA\255\255\255\255:" .. etaStr - - gl.Translate(0, yoffset,0) - gl.Billboard() - gl.Translate(0, 5 ,0) - --fontHandler.DrawCentered(etaStr) - gl.Text(etaStr, 0, 0, 8, "c") - end, bi.timeLeft,bi.yoffset) +local function DrawEtaText(timeLeft,yoffset) + local etaStr + if (timeLeft == nil) then + 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" + elseif (timeLeft > 0) then + etaStr = "\255\255\255\1ETA\255\255\255\255:" .. string.format('\255\1\255\1%.1f', timeLeft) .. "s" + else + etaStr = "\255\255\255\1ETA\255\255\255\255:" .. string.format('\255\255\1\1%.1f', -timeLeft) .. "s" + end end - gl.DepthTest(false) + gl.Translate(0, yoffset,10) + gl.Billboard() + gl.Translate(0, 5 ,0) + --fontHandler.DrawCentered(etaStr) + 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) + + gl.Color(1, 1, 1,0.1) + --fontHandler.UseDefaultFont() + local cx, cy, cz = Spring.GetCameraPosition() + for unitID, bi in pairs(etaTable) do + local ux,uy,uz = Spring.GetUnitViewPosition(unitID) + if ux~=nil then + 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 + end + + gl.Color(1, 1, 1,1) + gl.DepthTest(false) + end end 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_chili_selections_and_cursortip.lua b/LuaUI/Widgets_Evo/gui_chili_selections_and_cursortip.lua deleted file mode 100644 index fe85c37e3..000000000 --- a/LuaUI/Widgets_Evo/gui_chili_selections_and_cursortip.lua +++ /dev/null @@ -1,2171 +0,0 @@ --------------------------------------------------------------------------------- -function widget:GetInfo() - return { - name = "Chili Selections & CursorTip", - desc = "v0.061 Chili Selection Window and Cursor Tooltip.", - author = "CarRepairer, jK", - date = "2009-06-02", - license = "GNU GPL, v2 or later", - layer = 0, - experimental = false, - enabled = true, - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local spGetCurrentTooltip = Spring.GetCurrentTooltip -local spGetUnitDefID = Spring.GetUnitDefID -local spGetFeatureDefID = Spring.GetFeatureDefID -local spGetFeatureTeam = Spring.GetFeatureTeam -local spGetUnitAllyTeam = Spring.GetUnitAllyTeam -local spGetUnitTeam = Spring.GetUnitTeam -local spGetUnitHealth = Spring.GetUnitHealth -local spGetUnitResources = Spring.GetUnitResources -local spTraceScreenRay = Spring.TraceScreenRay -local spGetTeamInfo = Spring.GetTeamInfo -local spGetPlayerInfo = Spring.GetPlayerInfo -local spGetTeamColor = Spring.GetTeamColor -local spGetUnitTooltip = Spring.GetUnitTooltip -local spGetModKeyState = Spring.GetModKeyState -local spGetMouseState = Spring.GetMouseState -local spSendCommands = Spring.SendCommands -local spGetUnitIsStunned = Spring.GetUnitIsStunned -local spGetSelectedUnits = Spring.GetSelectedUnits -local spGetSelectedUnitsCounts = Spring.GetSelectedUnitsCounts -local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount -local spGetSelectedUnitsByDef = Spring.GetSelectedUnitsSorted - -local echo = Spring.Echo - -local glColor = gl.Color ---local glAlphaTest = gl.AlphaTest -local glTexture = gl.Texture -local glTexRect = gl.TexRect - - -local abs = math.abs -local strFormat = string.format - - -include("keysym.h.lua") - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Chili -local Button -local Label -local Window -local StackPanel -local Panel -local Grid -local TextBox -local Image -local Multiprogressbar -local Progressbar -local LayoutPanel -local Grid - -local screen0 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local icon_size = 20 -local stillCursorTime = 0 - -local scrH, scrW = 0,0 -local old_ttstr, old_data -local old_mx, old_my = -1,-1 -local mx, my = -1,-1 -local showExtendedTip = false -local changeNow = false - -local window_tooltip2 -local windows = {} -local tt_healthbar, tt_unitID, tt_fid, tt_ud, tt_fd -local stt_ud, stt_unitID -local controls = {} -local controls_icons = {} - -local stack_main, stack_leftbar -local globalitems = {} - -local ttFontSize = 12 - -local green = '\255\1\255\1' -local cyan = '\255\1\255\255' -local white = '\255\255\255\255' -local yellow = '\255\255\255\1' - -local windMin = 0 -local windMax = 2.5 - -local updateFrequency = 0.2 - -local timer = 0 -local tweakShow = false - -local window_height = 130 -local real_window_corner -local window_corner -local numSelectedUnits = 0 -local selectedUnitsByDefCounts = {} -local selectedUnitsByDef = {} -local selectedUnits = {} -local selectionSortOrder = {} - - -local color = {} - -local cursor_size = 24 -- pencil and eraser -local iconFormat = '' - -local iconTypesPath = LUAUI_DIRNAME.."Configs/icontypes.lua" -local icontypes = VFS.FileExists(iconTypesPath) and VFS.Include(iconTypesPath) - -local tildepressed, drawing, erasing - -local windTooltips = { - ["armwin"] = true, -} - -local terraCmds = { - Ramp=1, - Level=1, - Raise=1, - Smooth=1, - Restore=1, -} -local terraTips = {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- group info - -local selectedUnits = {} -local numSelectedUnits = 0 - -local gi_count = 0 -local gi_cost = 0 -local gi_finishedcost = 0 -local gi_hp = 0 -local gi_maxhp = 0 -local gi_metalincome = 0 -local gi_metaldrain = 0 -local gi_energyincome = 0 -local gi_energydrain = 0 -local gi_usedbp = 0 -local gi_totalbp = 0 - -local gi_str --group info string -local gi_label --group info Chili label - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -options_path = 'Settings/Interface/Tooltip' -options_order = { 'tooltip_delay', 'hpshort', 'featurehp', 'hide_for_unreclaimable', 'showdrawtooltip','showterratooltip', - 'groupalways', 'showgroupinfo', 'squarepics', -} - -local function option_Deselect() - -- unselect to prevent errors - Spring.SelectUnitMap({}, false) - window_height = options.squarepics.value and 140 or 115 -end - -options = { - tooltip_delay = { - name = 'Tooltip display delay (0 - 4s)', - desc = 'Determines how long you can leave the mouse idle until the tooltip is displayed.', - type = 'number', - min=0,max=4,step=0.1, - value = 0, - }, - --[[ This is causing it so playername is not always visible, too difficult to maintain. - fontsize = { - name = 'Font Size (10-20)', - desc = 'Resizes the font of the tip', - type = 'number', - min=10,max=20,step=1, - value = 10, - OnChange = FontChanged, - }, - --]] - hpshort = { - name = "HP Short Notation", - type = 'bool', - value = false, - desc = 'Shows short number for HP.', - }, - featurehp = { - name = "Show HP on Features", - type = 'bool', - advanced = true, - value = false, - desc = 'Shows healthbar for features.', - OnChange = function() - --fixme: dispose? - controls['feature']=nil; - controls['corpse']=nil; - end, - }, - hide_for_unreclaimable = { - name = "Hide Tooltip for Unreclaimables", - type = 'bool', - advanced = true, - value = false, - desc = 'Don\'t show the tooltip for unreclaimable features.', - }, - showdrawtooltip = { - name = "Show Map-drawing Tooltip", - type = 'bool', - value = true, - desc = 'Show map-drawing tooltip when holding down the tilde (~).', - }, - showterratooltip = { - name = "Show Terraform Tooltip", - type = 'bool', - value = true, - desc = 'Show terraform tooltip when performing terraform commands.', - }, - - groupalways = {name='Always Group Units', type='bool', value=false, OnChange = option_Deselect, - path = 'Settings/Interface/Selected Units Window', - }, - showgroupinfo = {name='Show Group Info', type='bool', value=true, OnChange = option_Deselect, - path = 'Settings/Interface/Selected Units Window', - }, - squarepics = {name='Square Buildpics', type='bool', value=false, OnChange = option_Deselect, - path = 'Settings/Interface/Selected Units Window', - }, -} - ---[[ -local function FontChanged() - controls = {} - controls_icons = {} - ttFontSize = options.fontsize.value -end ---]] - ---options.fontsize.OnChange = FontChanged - -local function GetHealthColor(fraction, returnType) - local midpt = (fraction > .5) - local r, g - if midpt then - r = ((1-fraction)/0.5) - g = 1 - else - r = 1 - g = (fraction)/0.5 - end - if returnType == "char" then - return string.char(255,math.floor(255*r),math.floor(255*g),0) - end - return {r, g, 0, 1} -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function round(num, idp) - if (not idp) then - return math.floor(num+.5) - else - local mult = 10^(idp or 0) - return math.floor(num * mult + 0.5) / mult - end -end - ---from rooms widget by quantum -local function ToSI(num) - if type(num) ~= 'number' then - return 'Tooltip wacky error #55' - end - if (num == 0) then - return "0" - else - local absNum = abs(num) - if (absNum < 0.001) then - return strFormat("%.1fu", 1000000 * num) - elseif (absNum < 1) then - return strFormat("%.1f", num) - elseif (absNum < 1000) then - return strFormat("%.0f", num) - elseif (absNum < 1000000) then - return strFormat("%.1fk", 0.001 * num) - else - return strFormat("%.1fM", 0.000001 * num) - end - end -end -local function ToSIPrec(num) -- more presise - if type(num) ~= 'number' then - return 'Tooltip wacky error #56' - end - if not options.hpshort.value then - return num - end - if (num == 0) then - return "0" - else - local absNum = abs(num) - if (absNum < 0.001) then - return strFormat("%.2fu", 1000000 * num) - elseif (absNum < 1) then - return strFormat("%.2f", num) - elseif (absNum < 1000) then - return strFormat("%.1f", num) - elseif (absNum < 1000000) then - return strFormat("%.2fk", 0.001 * num) - else - return strFormat("%.2fM", 0.000001 * num) - end - end -end - - -local function numformat(num, displayPlusMinus) - return comma_value(ToSIPrec(num), displayPlusMinus) -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- group selection - ---updates cost, HP, and resourcing info for group info -local function UpdateDynamicGroupInfo() - gi_cost = 0 - gi_hp = 0 - gi_metalincome = 0 - gi_metaldrain = 0 - gi_energyincome = 0 - gi_energydrain = 0 - gi_usedbp = 0 - - for i = 1, numSelectedUnits do - local id = selectedUnits[i] - - local ud = UnitDefs[spGetUnitDefID(id) or 0] - if ud then - local name = ud.name - local hp, _, paradam, cap, build = spGetUnitHealth(id) - local mm,mu,em,eu = spGetUnitResources(id) - - if name ~= "terraunit" then - gi_cost = gi_cost + ud.metalCost*build - gi_hp = gi_hp + hp - - local stunned_or_inbuld = spGetUnitIsStunned(id) - if not stunned_or_inbuld then - if name == 'armmex' or name =='cormex' or name =='emetalextractor' or name =='euwmetalextractor' then -- mex case - local tooltip = spGetUnitTooltip(id) - - local baseMetal = 0.5 - local s = tooltip:match("Makes: ([^ ]+)") - if s ~= nil then - baseMetal = tonumber(s) - end - - s = tooltip:match("Overdrive: %+([0-9]+)") - local od = 0 - if s ~= nil then - od = tonumber(s) - end - - gi_metalincome = gi_metalincome + baseMetal + baseMetal * od / 100 - - s = tooltip:match("Energy: ([^ ]+)") - if s ~= nil then - gi_energydrain = gi_energydrain - (tonumber(s) or 0) - end - else - gi_metalincome = gi_metalincome + mm - gi_metaldrain = gi_metaldrain + mu - gi_energyincome = gi_energyincome + em - gi_energydrain = gi_energydrain + eu - end - - if ud.buildSpeed ~= 0 then - gi_usedbp = gi_usedbp + mu - end - end - end - end - - end - - gi_cost = numformat(gi_cost) - gi_hp = numformat(gi_hp) - gi_metalincome = numformat(gi_metalincome) - gi_metaldrain = numformat(gi_metaldrain) - gi_energyincome = numformat(gi_energyincome) - gi_energydrain = numformat(gi_energydrain) - gi_usedbp = numformat(gi_usedbp) -end - ---updates values that don't change over time for group info -local function UpdateStaticGroupInfo() - gi_count = numSelectedUnits - gi_finishedcost = 0 - gi_totalbp = 0 - gi_maxhp = 0 - - for i = 1, numSelectedUnits do - local ud = UnitDefs[spGetUnitDefID(selectedUnits[i]) or 0] - if ud then - local name = ud.name - if name ~= "terraunit" then - gi_totalbp = gi_totalbp + ud.buildSpeed - gi_maxhp = gi_maxhp + ud.health - gi_finishedcost = gi_finishedcost + ud.metalCost - end - end - end - gi_finishedcost = numformat(gi_finishedcost) - gi_totalbp = numformat(gi_totalbp) - gi_maxhp = numformat(gi_maxhp) -end - - - ---this is a separate function to allow group info to be regenerated without reloading the whole tooltip -local function WriteGroupInfo() - if not options.showgroupinfo.value then return end - if gi_label then - window_corner:RemoveChild(gi_label) - end - gi_str = - "Selected Units " .. gi_count .. "\n" .. - "Health " .. gi_hp .. " / " .. gi_maxhp .. "\n" .. - "Cost " .. gi_cost .. " / " .. gi_finishedcost .. "\n" .. - "Metal \255\0\255\0+" .. gi_metalincome .. "\255\255\255\255 / \255\255\0\0-" .. gi_metaldrain .. "\255\255\255\255\n" .. - "Energy \255\0\255\0+" .. gi_energyincome .. "\255\255\255\255 / \255\255\0\0-" .. gi_energydrain .. "\255\255\255\255\n" .. - "Build Power " .. gi_usedbp .. " / " .. gi_totalbp - - gi_label = Label:New{ - parent = window_corner; - y=5, - right=5, - x=window_corner.width-150, - height = '100%'; - width = 120, - caption = gi_str; - valign = 'top'; - fontSize = 12; - fontshadow = true, - fontOutline = true, - } -end - - ----------------------------------------------------------------- ----------------------------------------------------------------- - -local function Show(obj) - if (not obj:IsDescendantOf(screen0)) then - screen0:AddChild(obj) - end -end - - -local function GetUnitDesc(unitID, ud) - if not (unitID or ud) then return '' end - - local lang = WG.lang or 'en' - if lang == 'en' then - if unitID then - local tooltip = ud.tooltip - if windTooltips[ud.name] and not Spring.GetUnitRulesParam(unitID,"NotWindmill") and Spring.GetUnitRulesParam(unitID,"minWind") then - tooltip = tooltip .. "\nWind Range " .. string.format("%.1f", Spring.GetUnitRulesParam(unitID,"minWind")) .. " - " .. string.format("%.1f", Spring.GetGameRulesParam("WindMax") ) - end - return tooltip - end - return ud.tooltip - end - local suffix = ('_' .. lang) - local desc = ud.customParams and ud.customParams['description' .. suffix] or ud.tooltip or 'Description error' - if unitID then - - local tooltip = ud.tooltip - if windTooltips[ud.name] and not Spring.GetUnitRulesParam(unitID,"NotWindmill") then - tooltip = tooltip .. "\nWind Range " .. string.format("%.1f", Spring.GetUnitRulesParam(unitID,"minWind")) .. " - " .. Spring.GetGameRulesParam("WindMax") - end - return tooltip - end - return desc -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function AddSelectionIcon(barGrid,unitid,defid,unitids,counts) - local ud = UnitDefs[defid] - local item = LayoutPanel:New{ - name = unitid or defid; - parent = barGrid; - width = 50; - height = 62; - columns = 1; - padding = {0,0,0,0}; - itemPadding = {0,0,0,0}; - itemMargin = {0,0,0,1}; - resizeItems = false; - centerItems = false; - autosize = true; - } - local img = Image:New{ - parent = item; - tooltip = ud.humanName .. " - " .. ud.tooltip.. "\n\255\0\255\0Click: Select \nRightclick: Deselect \nAlt+Click: Select One \nCtrl+click: Select Type \nMiddle-click: Goto"; - file2 = (WG.GetBuildIconFrame)and(WG.GetBuildIconFrame(UnitDefs[defid])); - file = "#" .. defid; - keepAspect = true; - height = 50; - --height = 50; - width = 50; - padding = {0,0,0,0}; --FIXME something overrides the default in image.lua!!!! - OnClick = {function(_,_,_,button) - - local alt, ctrl, meta, shift = spGetModKeyState() - - if (button==3) then - if (unitid and not ctrl) then - --// deselect a single unit - for i=1,numSelectedUnits do - if (selectedUnits[i]==unitid) then - table.remove(selectedUnits,i) - break - end - end - else - --// deselect a whole unitdef block - for i=numSelectedUnits,1,-1 do - if (Spring.GetUnitDefID(selectedUnits[i])==defid) then - table.remove(selectedUnits,i) - if (alt) then - break - end - end - end - end - Spring.SelectUnitArray(selectedUnits) - --update selected units right now - local sel = Spring.GetSelectedUnits() - widget:SelectionChanged(sel) - elseif button == 1 then - if not ctrl then - if (alt) then - Spring.SelectUnitArray({ selectedUnitsByDef[defid][1] }) -- only 1 - else - Spring.SelectUnitArray(unitids) -- no modifier - select all - end - else - -- select all units of the icon type - Spring.SelectUnitArray(selectedUnitsByDef[defid]) - - --local sorted = Spring.GetTeamUnitsSorted(Spring.GetMyTeamID()) - --local units = sorted[defid] - --if units then Spring.SelectUnitArray(units) end - end - else --button2 (middle) - local x,y,z = Spring.GetUnitPosition( unitids[1] ) - Spring.SetCameraTarget(x,y,z, 1) - end - end} - }; - if ((counts or 1)>1) then - Label:New{ - parent = img; - align = "right"; - valign = "top"; - x = 8; - --y = 30; - y = 20; - width = 40; - fontsize = 20; - fontshadow = true; - fontOutline = true; - caption = counts; - }; - end - Progressbar:New{ - parent = item; - name = 'health'; - width = 50; - height = 5; - max = 1; - color = {0.0,0.99,0.0,1}; - }; -end - -local function MakeUnitGroupSelectionToolTip() - window_corner:ClearChildren(); - - local barGrid = LayoutPanel:New{ - name = 'Bars'; - resizeItems = false; - centerItems = false; - parent = window_corner; - height = "100%"; - x=0, - --width = "100%"; - right=options.showgroupinfo.value and 120 or 0, - --columns = 5; - itemPadding = {0,0,0,0}; - itemMargin = {0,0,2,2}; - tooltip = "Left Click: Just select clicked unit(s)\nRight Click: Deselect unit(s)"; - } - --if check is done in target function - --if options.showgroupinfo.value then - WriteGroupInfo() - --end - - if ((numSelectedUnits<8) and (not options.groupalways.value)) then - for i=1,numSelectedUnits do - local unitid = selectedUnits[i] - local defid = spGetUnitDefID(unitid) - local unitids = {unitid} - - AddSelectionIcon(barGrid,unitid,defid,unitids) - end - else - for i=1,#selectionSortOrder do - local defid = selectionSortOrder[i] - local unitids = selectedUnitsByDef[defid] - local counts = selectedUnitsByDefCounts[defid] - - AddSelectionIcon(barGrid,nil,defid,unitids,counts) - end - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -local function UpdateSelectedUnitsTooltip() - local selectedUnits = selectedUnits - if (numSelectedUnits>1) then - local barsContainer = window_corner.childrenByName['Bars'] - - if ((numSelectedUnits<8) and (not options.groupalways.value)) then - for i=1,numSelectedUnits do - local unitid = selectedUnits[i] - - local unitIcon = barsContainer.childrenByName[unitid] - --Spring.Echo(unitid) - local healthbar = unitIcon.childrenByName['health'] - local health, maxhealth = spGetUnitHealth(unitid) - if (health) then - healthbar:SetValue(health/maxhealth) - healthbar.tooltip = numformat(health) .. ' / ' .. numformat(maxhealth) - healthbar.color = GetHealthColor(health/maxhealth) - end - end - else - for defid,unitids in pairs(selectedUnitsByDef) do - local health = 0 - local maxhealth = 0 - for i=1,#unitids do - local uhealth, umaxhealth = spGetUnitHealth(unitids[i]) - health = health + (uhealth or 0) - maxhealth = maxhealth + (umaxhealth or 0) - end - - local unitGroup = barsContainer.childrenByName[defid] - local healthbar = unitGroup.childrenByName['health'] - healthbar:SetValue(health/maxhealth) - healthbar.tooltip = numformat(health) .. ' / ' .. numformat(maxhealth) - healthbar.color = GetHealthColor(health/maxhealth) - end - end - - - end -end - - - -function comma_value(amount, displayPlusMinus) - local formatted - - -- amount is a string when ToSI is used before calling this function - if type(amount) == "number" then - if (amount ==0) then formatted = "0" else - if (amount < 20 and (amount * 10)%10 ~=0) then - if displayPlusMinus then formatted = strFormat("%+.1f", amount) - else formatted = strFormat("%.1f", amount) end - else - if displayPlusMinus then formatted = strFormat("%+d", amount) - else formatted = strFormat("%d", amount) end - end - end - else - formatted = amount .. "" - end - - if options.hpshort.value then - local k - while true do - formatted, k = formatted:gsub("^(-?%d+)(%d%d%d)", '%1,%2') - if (k==0) then - break - end - end - end - return formatted -end - -local function AdjustWindow(window) - local nx - if (0 > window.x) then - nx = 0 - elseif (window.x + window.width > screen0.width) then - nx = screen0.width - window.width - end - - local ny - if (0 > window.y) then - ny = 0 - elseif (window.y + window.height > screen0.height) then - ny = screen0.height - window.height - end - - if (nx or ny) then - window:SetPos(nx,ny) - end - - --//FIXME If we don't do this the stencil mask of stack_rightside doesn't get updated, when we move the mouse (affects only if type(stack_rightside) == StackPanel) - stack_main:Invalidate() - stack_leftbar:Invalidate() - - if window_tooltip2:GetChildByName('leftbar') then - window_tooltip2:GetChildByName('leftbar'):Invalidate() - end - window_tooltip2:GetChildByName('main'):Invalidate() - -end - - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local UnitDefByHumanName_cache = {} -local function GetUnitDefByHumanName(humanName) - local cached_udef = UnitDefByHumanName_cache[humanName] - if (cached_udef ~= nil) then - return cached_udef - end - - for _,ud in pairs(UnitDefs) do - if ud.humanName == humanName then - UnitDefByHumanName_cache[humanName] = ud - return ud - end - end - UnitDefByHumanName_cache[humanName] = false - return false -end - -local function tooltipBreakdown(tooltip) - local unitname = nil - tooltip = tooltip:gsub('\r', '\n') - tooltip = tooltip:gsub('\n+', '\n') - - local requires, provides, consumes, unitDef, buildType, morph_data - if tooltip:find('Requires', 5, true) == 5 then - requires, tooltip = tooltip:match('....Requires([^\n]*)\n....(.*)') - end - - if tooltip:find('Provides', 1, true) == 1 then - provides, tooltip = tooltip:match('Provides([^\n]*)\n(.*)') - end - - if tooltip:find('Consumes', 5, true) == 5 then - --consumes, tooltip = tooltip:match('....Consumes([^\n]*)\n....(.*)') - end - - if tooltip:find('Build', 1, true) == 1 then - local start,fin = tooltip:find([[ - ]], 1, true) - if start and fin then - - local unitHumanName - - if (tooltip:find('Build Unit:', 1, true) == 1) then - buildType = 'buildunit' - unitHumanName = tooltip:sub(13,start-1) - else - buildType = 'build' - unitHumanName = tooltip:sub(8,start-1) - end - unitDef = GetUnitDefByHumanName(unitHumanName) - - tooltip = tooltip:sub(fin+1) - end - - elseif tooltip:find('Morph', 1, true) == 1 then - - local unitHumanName = tooltip:gsub('Morph into a (.*)(time).*', '%1'):gsub('[^%a \-]', '') - unitDef = GetUnitDefByHumanName(unitHumanName) - - local needunit - if tooltip:find('needs unit', 1, true) then - needunit = tooltip:gsub('.*needs unit: (.*)', '%1'):gsub('[^%a \-]', '') - end - morph_data = { - morph_time = tooltip:gsub('.*time:(.*)metal.*', '%1'):gsub('[^%d]', ''), - morph_cost = tooltip:gsub('.*metal: (.*)energy.*', '%1'):gsub('[^%d]', ''), - morph_prereq = needunit, - } - end - - return { - tooltip = tooltip, - unitDef = unitDef, - buildType = buildType, - morph_data = morph_data, - requires = requires, - provides = provides, - consumes = consumes, - } -end - ----------------------------------------------------------------- - -local function SetHealthbar(tt_healthbar,health, maxhealth) - if health then - - tt_health_fraction = health/maxhealth - tt_healthbar:SetValue(tt_health_fraction) - if options.hpshort.value then - tt_healthbar:SetCaption(numformat(health) .. ' / ' .. numformat(maxhealth)) - else - tt_healthbar:SetCaption(math.ceil(health) .. ' / ' .. math.ceil(maxhealth)) - end - - tt_healthbar.color = GetHealthColor(tt_health_fraction) - - else - tt_healthbar.color = {0,0,0.5, 1} - local maxhealth = (tt_fd and tt_fd.health) or (tt_ud and tt_ud.health) or 0 - tt_healthbar:SetValue(1) - if options.hpshort.value then - tt_healthbar:SetCaption('??? / ' .. numformat(maxhealth)) - else - tt_healthbar:SetCaption('??? / ' .. math.ceil(maxhealth)) - end - end -end - -local function SetHealthbars() - if - not ( tt_unitID or tt_fid or stt_unitID ) - then - return - end - local tt_healthbar_stack, tt_healthbar - - local health, maxhealth - if tt_unitID then - health, maxhealth = spGetUnitHealth(tt_unitID) - tt_healthbar = globalitems.hp_unit:GetChildByName('bar') - SetHealthbar(tt_healthbar,health, maxhealth) - elseif tt_fid then - health, maxhealth = Spring.GetFeatureHealth(tt_fid) - tt_healthbar_stack = tt_ud and globalitems.hp_corpse or globalitems.hp_feature - tt_healthbar = tt_healthbar_stack:GetChildByName('bar') - SetHealthbar(tt_healthbar,health, maxhealth) - end - - if stt_unitID then - health, maxhealth = spGetUnitHealth(stt_unitID) - tt_healthbar = globalitems.hp_selunit:GetChildByName('bar') - SetHealthbar(tt_healthbar,health, maxhealth) - end -end - - -local function KillTooltip(force) - old_ttstr = '' - tt_unitID = nil - - if window_tooltip2 and window_tooltip2:IsDescendantOf(screen0) then - screen0:RemoveChild(window_tooltip2) - end -end - -local function UpdateResourceStack(tooltip_type, unitID, ud, tooltip) - - local stack_children = {} - - local metal, energy = 0,0 - local color_m = {1,1,1,1} - local color_e = {1,1,1,1} - - local resource_tt_name = 'resources_' .. tooltip_type - - if tooltip_type == 'feature' or tooltip_type == 'corpse' then - metal = ud.metal - energy = ud.energy - - if unitID then - local m, _, e, _, _ = Spring.GetFeatureResources(unitID) - metal = m or metal - energy = e or energy - end - else --tooltip_type == 'unit' or 'selunit' - local metalMake, metalUse, energyMake, energyUse = Spring.GetUnitResources(unitID) - - if metalMake then - metal = metalMake - metalUse - end - if energyMake then - energy = energyMake - energyUse - end - - -- special cases for mexes - if ud.name=='cormex' or ud.name =='emetalextractor' or ud.name =='euwmetalextractor' then - local baseMetal = 0.5 - local s = tooltip:match("Makes: ([^ ]+)") - if s ~= nil then baseMetal = tonumber(s) end - - s = tooltip:match("Overdrive: %+([0-9]+)") - local od = 0 - if s ~= nil then od = tonumber(s) end - - metal = metal + baseMetal + baseMetal * od / 100 - - s = tooltip:match("Energy: ([^ \n]+)") - s = tonumber(s) - if s ~= nil and type(s) == 'number' then - energy = energy + tonumber(s) - end - end - - end - - if tooltip_type == 'feature' or tooltip_type == 'corpse' then - color_m = {1,1,1,1} - color_e = {1,1,1,1} - else - if metal > 0 then - color_m = {0,1,0,1} - elseif metal < 0 then - color_m = {1,0,0,1} - end - if energy > 0 then - color_e = {0,1,0,1} - elseif energy < 0 then - color_e = {1,0,0,1} - end - end - local displayPlusMinus = tooltip_type ~= 'feature' and tooltip_type ~= 'corpse' - - if globalitems[resource_tt_name] then - local metalcontrol = globalitems[resource_tt_name]:GetChildByName('metal') - local energycontrol = globalitems[resource_tt_name]:GetChildByName('energy') - - metalcontrol.font:SetColor(color_m) - energycontrol.font:SetColor(color_e) - - metalcontrol:SetCaption( numformat(metal, displayPlusMinus) ) - energycontrol:SetCaption( numformat(energy, displayPlusMinus) ) - return - end - - local lbl_metal2 = Label:New{ name='metal', caption = numformat(metal, displayPlusMinus), autosize=true, fontSize=ttFontSize, valign='center' } - local lbl_energy2 = Label:New{ name='energy', caption = numformat(energy, displayPlusMinus), autosize=true, fontSize=ttFontSize, valign='center' } - - local lbl_empty = Label:New{ name='blank', caption = ' ', autosize=true, fontSize=ttFontSize, valign='center' } - - globalitems[resource_tt_name] = StackPanel:New{ - centerItems = false, - autoArrangeV = true, - orientation='horizontal', - resizeItems=false, - width = '100%', - height = icon_size+1, - padding = {0,0,0,0}, - itemPadding = {0,0,0,0}, - itemMargin = {5,0,0,0}, - children = { - Image:New{file='LuaUI/images/ibeam.png',height= icon_size,width= icon_size, fontSize=ttFontSize,}, - lbl_metal2, - lbl_empty, - Image:New{file='LuaUI/images/energy.png',height= icon_size,width= icon_size, fontSize=ttFontSize,}, - lbl_energy2, - }, - } -end - -local function PlaceToolTipWindow2(x,y) - if not window_tooltip2 then return end - - if not window_tooltip2:IsDescendantOf(screen0) then - screen0:AddChild(window_tooltip2) - end - - local x = x - local y = scrH-y - window_tooltip2:SetPos(x,y) - AdjustWindow(window_tooltip2) - - window_tooltip2:BringToFront() -end - -local function UpdateMorphControl(morph_data) - - local morph_controls = {} - - local height = 0 - - local morph_time = '' - local morph_cost = '' - local morph_prereq = '' - if morph_data then - morph_time = morph_data.morph_time - morph_cost = morph_data.morph_cost - morph_prereq = morph_data.morph_prereq - height = icon_size+1 - - end - if globalitems.morphs then - globalitems.morphs.height=height - - globalitems.morphs:GetChildByName('time'):SetCaption(morph_time) - globalitems.morphs:GetChildByName('cost'):SetCaption(morph_cost) - globalitems.morphs:GetChildByName('prereq'):SetCaption(morph_prereq and ('Need Unit: '..morph_prereq) or '') - - --[[ - globalitems.morphs:GetChildByName('time').height=height - globalitems.morphs:GetChildByName('time'):Invalidate() - globalitems.morphs:Invalidate() - globalitems.morphs:UpdateLayout() - --]] - return - end - height = icon_size+1 - - morph_controls[#morph_controls + 1] = Label:New{ caption = 'Morph: ', height= icon_size, valign='center', textColor=color.tooltip_info, autosize=false, width=45, fontSize=ttFontSize,} - morph_controls[#morph_controls + 1] = Image:New{file='LuaUI/images/clock.png',height= icon_size,width= icon_size, fontSize=ttFontSize,} - morph_controls[#morph_controls + 1] = Label:New{ name='time', caption = morph_time, valign='center', textColor=color.tooltip_info, autosize=false, width=25, fontSize=ttFontSize,} - morph_controls[#morph_controls + 1] = Image:New{file='LuaUI/images/ibeam.png',height= icon_size,width= icon_size, fontSize=ttFontSize,} - morph_controls[#morph_controls + 1] = Label:New{ name='cost', caption = morph_cost, valign='center', textColor=color.tooltip_info, autosize=false, width=25, fontSize=ttFontSize,} - - --if morph_prereq then - --morph_controls[#morph_controls + 1] = Label:New{ 'prereq' caption = 'Need Unit: '..morph_prereq, valign='center', textColor=color.tooltip_info, autosize=false, width=180, fontSize=ttFontSize,} - morph_controls[#morph_controls + 1] = Label:New{ name='prereq', caption = morph_prereq and ('Need Unit: '..morph_prereq) or '', valign='center', textColor=color.tooltip_info, autosize=false, width=80, fontSize=ttFontSize,} - --end - - - globalitems.morphs = StackPanel:New { - centerItems = false, - autoArrangeV = true, - orientation='horizontal', - resizeItems=false, - width = '100%', - height = height, - padding = {0,0,0,0}, - itemPadding = {0,0,0,0}, - itemMargin = {0,0,0,0}, - children = morph_controls, - } -end - - -local function GetHelpText(tooltip_type) - local _,_,_,buildUnitName = Spring.GetActiveCommand() - if buildUnitName then - return '' - end - - local sc_caption = '' - if tooltip_type == 'build' then - sc_caption = 'Space+click: Show unit stats' - elseif tooltip_type == 'buildunit' then - if showExtendedTip then - - sc_caption = - 'Shift+click: x5 multiplier.\n'.. - 'Ctrl+click: x20 multiplier.\n'.. - 'Alt+click: Add units to front of queue. \n'.. - 'Rightclick: remove units from queue.\n'.. - 'Space+click: Show unit stats' - else - sc_caption = '(Hold Spacebar for help)' - end - - elseif tooltip_type == 'morph' then - sc_caption = 'Space+click: Show unit stats' - else - sc_caption = 'Space+click: Show unit stats' - end - --return TextBox:New{ text = sc_caption, textColor=color.tooltip_help, width=250, fontSize=ttFontSize, } - return sc_caption - -end - -local function MakeStack(ttname, ttstackdata, leftbar) - local children = {} - local height = 0 - - for i, item in ipairs( ttstackdata ) do - local stack_children = {} - local empty = false - - if item.directcontrol then - local directitem = globalitems[item.directcontrol] - stack_children[#stack_children+1] = directitem - - elseif item.text or item.icon then - local curFontSize = ttFontSize + (item.fontSize or 0) - if ttname == 'tt_text2' then - curFontSize = curFontSize +2 - end - - local itemtext = item.text or '' - local stackchildren = {} - - if item.icon then - controls_icons[ttname][item.name] = Image:New{ file = item.icon, height= icon_size,width= icon_size, fontSize=curFontSize,} - stack_children[#stack_children+1] = controls_icons[ttname][item.name] - end - - if item.wrap then - controls[ttname][item.name] = TextBox:New{ - name=item.name, - autosize=false, - text = itemtext , - width='100%', - valign="ascender", - font={ size=curFontSize }, - fontshadow = true, - fontOutline = true, - } - stack_children[#stack_children+1] = controls[ttname][item.name] - else - local rightmargin = item.icon and icon_size or 0 - local width = (leftbar and 50 or 230) - rightmargin - - --controls[ttname][item.name] = Label:New{ autosize=false, name=item.name, caption = itemtext, fontSize=curFontSize, valign='center', height=icon_size+5, width = width } - controls[ttname][item.name] = Label:New{ - fontShadow=true, - defaultHeight=0, - autosize=true, - name=item.name, - caption = itemtext, - fontSize=curFontSize, - fontshadow = true, - fontOutline = true, - valign='center', - height=icon_size+5, - x=icon_size+5, - right=1, - } - stack_children[#stack_children+1] = controls[ttname][item.name] - end - - if (not item.icon) and itemtext == '' then - controls[ttname][item.name]:Resize('100%',0) - end - - - else - empty = true - end - - if not empty then - children[#children+1] = StackPanel:New{ - centerItems = false, - autoArrangeV = true, - orientation='horizontal', - resizeItems=false, - width = '100%', - autosize=true, - padding = {1,1,1,1}, - itemPadding = {1,1,0,0}, - itemMargin = {4,0,0,0}, - children = stack_children, - } - end - end - return children -end - -local function UpdateStack(ttname, stack) - for i, item in ipairs( stack ) do - local name = item.name - - if item.directcontrol then - --local directitem = (type( item.directcontrol ) == 'string') and globalitems[item.directcontrol] or item.directcontrol - local directitem = globalitems[item.directcontrol] - --[[ - if hideitems[item.directcontrol] then - directitem:Resize('100%',0) - else - directitem:Resize('100%',globalitemheights[item.directcontrol]) - end - --]] - end - if controls[ttname][name] then - if item.wrap then - controls[ttname][name]:SetText( item.text ) - controls[ttname][name]:Invalidate() - else - controls[ttname][name]:SetCaption( item.text ) - end - end - if controls_icons[ttname][name] then - if item.icon then - controls_icons[ttname][name].file = item.icon - controls_icons[ttname][name]:Invalidate() - end - end - - end - -end - -local function SetTooltip(tt_window) - if not window_tooltip2 or window_tooltip2 ~= tt_window then - KillTooltip(true) - window_tooltip2 = tt_window - end - PlaceToolTipWindow2(mx+20,my-20) -end - -local function BuildTooltip2(ttname, ttdata, sel) - if not ttdata.main then - echo ' Missing ttdata.main' - return - end - if controls[ttname] and not sel then - UpdateStack(ttname, ttdata.main) - if ttdata.leftbar then - UpdateStack(ttname, ttdata.leftbar) - end - else - controls[ttname] = {} - controls_icons[ttname] = {} - local stack_leftbar_temp, stack_main_temp - local children_main = MakeStack(ttname, ttdata.main) - local leftside = false - if ttdata.leftbar then - children_leftbar = MakeStack(ttname, ttdata.leftbar) - - stack_leftbar_temp = - StackPanel:New{ - name = 'leftbar', - orientation='vertical', - padding = {0,0,0,0}, - itemPadding = {1,0,0,0}, - itemMargin = {0,0,0,0}, - resizeItems=false, - autosize=true, - width = 70, - children = children_leftbar, - } - leftside = true - else - stack_leftbar_temp = StackPanel:New{ width=10, } - end - - stack_main_temp = StackPanel:New{ - name = 'main', - autosize=true, - x = leftside and 60 or 0, - y = 0, - orientation='vertical', - centerItems = false, - width = 300, - padding = {0,0,0,0}, - itemPadding = {1,0,0,0}, - itemMargin = {0,0,0,0}, - resizeItems=false, - children = children_main, - } - if not sel then - windows[ttname] = Window:New{ - name = ttname, - --skinName = 'default', - useDList = false, - resizable = false, - draggable = false, - autosize = true, - --tweakDraggable = true, - backgroundColor = color.tooltip_bg, - children = { stack_leftbar_temp, stack_main_temp, } - } - end - if sel then - return stack_main_temp, stack_leftbar_temp - end - end - SetTooltip(windows[ttname]) -end - -local function GetUnitIcon(ud) - if not ud then return false end - return icontypes - and icontypes[(ud and ud.iconType or "default")].bitmap - or 'icons/'.. ud.iconType ..iconFormat -end - - -local function MakeToolTip_Text(text) - BuildTooltip2('tt_text2',{ - main = { - { name='text', text = text, wrap=true }, - } - }) -end - -local function UpdateBuildpic( ud, globalitem_name, unitID ) - if not ud then return end - - if not globalitems[globalitem_name] then - globalitems[globalitem_name] = Image:New{ - file = "#" .. ud.id, - file2 = (WG.GetBuildIconFrame)and(WG.GetBuildIconFrame(ud)), - keepAspect = true, - height = 55, - width = 55, - unitID = unitID, - - } - if globalitem_name == 'buildpic_selunit' then - globalitems[globalitem_name].OnClick = {function(self,_,_,button) - if (button==2) then - --button2 (middle) - local x,y,z = Spring.GetUnitPosition( self.unitID ) - if x then - Spring.SetCameraTarget(x,y,z, 1) - end - end - end} - end - return - end - - globalitems[globalitem_name].unitID = unitID - globalitems[globalitem_name].file = "#" .. ud.id - globalitems[globalitem_name].file2 = (WG.GetBuildIconFrame)and(WG.GetBuildIconFrame(ud)) - globalitems[globalitem_name]:Invalidate() -end - -local function MakeToolTip_UD(tt_table) - - local helptext = GetHelpText(tt_table.buildType) - local iconPath = GetUnitIcon(tt_table.unitDef) - - local tt_structure = { - leftbar = { - tt_table.morph_data - and { name= 'bp', directcontrol = 'buildpic_morph' } - or { name= 'bp', directcontrol = 'buildpic_ud' }, - { name = 'cost', icon = 'LuaUI/images/ibeam.png', text = cyan .. numformat(tt_table.unitDef.metalCost), }, - }, - main = { - { name = 'udname', icon = iconPath, text = tt_table.unitDef.humanName, fontSize=2 }, - { name = 'tt', text = tt_table.unitDef.tooltip, wrap=true }, - { name='health', icon = 'LuaUI/images/commands/Bold/health.png', text = numformat(tt_table.unitDef.health), }, - --[[ - { name = 'requires', text = tt_table.requires and ('REQUIRES' .. tt_table.requires) or '', }, - { name = 'provides', text = tt_table.provides and ('PROVIDES' .. tt_table.provides) or '', }, - { name = 'consumes', text = tt_table.consumes and ('CONSUMES' .. tt_table.consumes) or '', }, - --]] - tt_table.morph_data and { name='morph', directcontrol = 'morphs' } or {}, - { name='helptext', text = green .. helptext, wrap=true}, - - }, - } - - if tt_table.morph_data then - UpdateBuildpic( tt_table.unitDef, 'buildpic_morph' ) - UpdateMorphControl( tt_table.morph_data ) - - BuildTooltip2('morph2', tt_structure) - else - UpdateBuildpic( tt_table.unitDef, 'buildpic_ud' ) - BuildTooltip2('ud2', tt_structure) - end - -end - - -local function MakeToolTip_Unit(data, tooltip) - local unitID = data - local team, fullname - tt_unitID = unitID - team = spGetUnitTeam(tt_unitID) - tt_ud = UnitDefs[ spGetUnitDefID(tt_unitID) or -1] - - fullname = ((tt_ud and tt_ud.humanName) or "") - - if not (tt_ud) then - --fixme - return false - end - --local alliance = spGetUnitAllyTeam(tt_unitID) - local _, player = spGetTeamInfo(team) - local playerName = player and spGetPlayerInfo(player) or 'noname' - local teamColor = Chili.color2incolor(spGetTeamColor(team)) - ---local unittooltip = tt_unitID and spGetUnitTooltip(tt_unitID) or (tt_ud and tt_ud.tooltip) or "" - local unittooltip = GetUnitDesc(tt_unitID, tt_ud) - local iconPath = GetUnitIcon(tt_ud) - - UpdateResourceStack( 'unit', unitID, tt_ud, tooltip ) - - local tt_structure = { - leftbar = { - { name= 'bp', directcontrol = 'buildpic_unit' }, - { name= 'cost', icon = 'LuaUI/images/ibeam.png', text = cyan .. numformat((tt_ud and tt_ud.metalCost) or '0') }, - }, - main = { - { name='uname', icon = iconPath, text = fullname .. '\n(' .. teamColor .. playerName .. white ..')', fontSize=2, fontshadow = true, fontOutline = true,}, - { name='utt', text = unittooltip, wrap=true }, - { name='hp', directcontrol = 'hp_unit', }, - { name='res', directcontrol = 'resources_unit' }, - { name='help', text = green .. 'Space+click: Show unit stats', }, - }, - } - - UpdateBuildpic( tt_ud, 'buildpic_unit' ) - BuildTooltip2('unit2', tt_structure) -end - - -local function MakeToolTip_SelUnit(data, tooltip) - local unitID = data - local fullname - stt_unitID = unitID - stt_ud = UnitDefs[ spGetUnitDefID(stt_unitID) or -1] - - fullname = ((stt_ud and stt_ud.humanName) or "") - - if not (stt_ud) then - --fixme - return false - end - - local unittooltip = GetUnitDesc(stt_unitID, stt_ud) - local iconPath = GetUnitIcon(stt_ud) - - UpdateResourceStack( 'selunit', unitID, stt_ud, tooltip ) - - - - local tt_structure = { - leftbar = { - { name= 'bp', directcontrol = 'buildpic_selunit' }, - { name= 'cost', icon = 'LuaUI/images/ibeam.png', text = cyan .. numformat((stt_ud and stt_ud.metalCost) or '0') }, - }, - main = { - { name='uname', icon = iconPath, text = fullname, fontSize=2, fontshadow = true, fontOutline = true, }, - { name='utt', text = unittooltip, wrap=true }, - { name='hp', directcontrol = 'hp_selunit', }, - stt_ud.isBuilder and { name='bp', directcontrol = 'bp_selunit', } or {}, - { name='res', directcontrol = 'resources_selunit' }, - }, - } - - UpdateBuildpic( stt_ud, 'buildpic_selunit', stt_unitID ) - return BuildTooltip2('selunit2', tt_structure, true) -end - -local function MakeToolTip_Feature(data, tooltip) - local featureID = data - local tt_fd - local team, fullname - - tt_fid = featureID - team = spGetFeatureTeam(featureID) - local fdid = spGetFeatureDefID(featureID) - tt_fd = fdid and FeatureDefs[fdid or -1] - local feature_name = tt_fd and tt_fd.name - - local live_name - - if tt_fd and tt_fd.customParams and tt_fd.customParams.unit then - live_name = tt_fd.customParams.unit - else - live_name = feature_name:gsub('([^_]*).*', '%1') - end - - local desc = '' - if feature_name:find('dead2') or feature_name:find('heap') then - desc = ' (debris)' - elseif feature_name:find('dead') then - desc = ' (wreckage)' - end - tt_ud = UnitDefNames[live_name] - fullname = ((tt_ud and tt_ud.humanName .. desc) or tt_fd.tooltip or "") - - if not (tt_fd) then - --fixme - return false - end - - if options.hide_for_unreclaimable.value and not tt_fd.reclaimable then - return false - end - - --local alliance = spGetUnitAllyTeam(tt_unitID) - local _, player = spGetTeamInfo(team) - local playerName = player and spGetPlayerInfo(player) or 'noname' - local teamColor = Chili.color2incolor(spGetTeamColor(team)) - ---local unittooltip = tt_unitID and spGetUnitTooltip(tt_unitID) or (tt_ud and tt_ud.tooltip) or "" - local unittooltip = GetUnitDesc(tt_unitID, tt_ud) - local iconPath = GetUnitIcon(tt_ud) - - UpdateResourceStack( tt_ud and 'corpse' or 'feature', featureID, tt_ud or tt_fd, tooltip ) - - local tt_structure = { - leftbar = - tt_ud and - { - { name= 'bp', directcontrol = 'buildpic_feature' }, - { name='cost', icon = 'LuaUI/images/ibeam.png', text = cyan .. numformat((tt_ud and tt_ud.metalCost) or '0'), }, - } - or nil, - main = { - { name='uname', icon = iconPath, text = fullname .. ' (' .. teamColor .. playerName .. white ..')', fontSize=2, fontshadow = true, fontOutline = true, wrap = true, }, - { name='utt', text = unittooltip, wrap=true }, - ( options.featurehp.value - and { name='hp', directcontrol = (tt_ud and 'hp_corpse' or 'hp_feature'), } - or {}), - { name='res', directcontrol = tt_ud and 'resources_corpse' or 'resources_feature' }, - { name='help', text = tt_ud and (green .. 'Space+click: Show unit stats') or '', }, - }, - } - - - if tt_ud then - UpdateBuildpic( tt_ud, 'buildpic_feature' ) - BuildTooltip2('corpse2', tt_structure) - else - BuildTooltip2('feature2', tt_structure) - end - return true -end - - - -local function CreateHpBar(name) - --[[ - globalitems[name] = Progressbar:New { - name = name, - width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - color = {0,1,0,1}, - max=1, - caption = 'a', - - children = { - Image:New{file='LuaUI/images/commands/bold/health.png',height= icon_size,width= icon_size, x=0,y=0}, - }, - } - --]] - globalitems[name] = Panel:New { - orientation='horizontal', - name = name, - width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - backgroundColor = {0,0,0,0}, - - children = { - Image:New{file='LuaUI/images/commands/bold/health.png',height= icon_size,width= icon_size, x=0,y=0}, - Progressbar:New { - name = 'bar', - x=icon_size, - right=0, - --width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - color = {0,1,0,1}, - max=1, - caption = 'a', - }, - - - }, - } - -end - -local function CreateBpBar(name) - --[[ - globalitems[name] = Progressbar:New { - name = name, - width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - color = {0.8,0.8,0.2,1}; - max=1, - caption = 'a', - - children = { - Image:New{file='LuaUI/Images/commands/Bold/buildsmall.png',height= icon_size,width= icon_size, x=0,y=0}, - }, - } - --]] - globalitems[name] = Panel:New { - orientation='horizontal', - name = name, - width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - backgroundColor = {0,0,0,0}, - - children = { - Image:New{file='LuaUI/Images/commands/Bold/buildsmall.png',height= icon_size,width= icon_size, x=0,y=0}, - Progressbar:New { - name = 'bar', - x=icon_size, - right=0, - --width = '100%', - height = icon_size+2, - itemMargin = {0,0,0,0}, - itemPadding = {0,0,0,0}, - padding = {0,0,0,0}, - color = {0.8,0.8,0.2,1}; - max=1, - caption = 'a', - }, - - - }, - } -end - - -local function MakeToolTip_Draw() - local tt_structure = { - main = { - { name='lmb', icon = LUAUI_DIRNAME .. 'Images/drawingcursors/pencil.png', text = 'Left Mouse Button', }, - { name='rmb', icon = LUAUI_DIRNAME .. 'Images/drawingcursors/eraser.png', text = 'Right Mouse Button', }, - { name='mmb', icon = LUAUI_DIRNAME .. 'Images/Crystal_Clear_action_flag.png', text = 'Middle Mouse Button', }, - { name='dblclick', icon = LUAUI_DIRNAME .. 'Images/drawingcursors/flagtext.png', text = 'Double Click', }, - - }, - } - BuildTooltip2('drawing2', tt_structure) -end - -local function MakeToolTip_Terra(cmdName) - - local tt_structure = { - main = { - { name='cmdName', text = cyan..cmdName, wrap=false}, - { name='tips', text = terraTips[cmdName], wrap=true }, - }, - } - - BuildTooltip2('terra', tt_structure) -end - -local function MakeTooltip() - if options.showdrawtooltip.value and tildepressed and not (drawing or erasing) then - MakeToolTip_Draw() - return - end - - local index, cmd_id, cmd_type, cmd_name = Spring.GetActiveCommand() - local cmdDesc = Spring.GetActiveCmdDesc( index ) - if options.showterratooltip.value and cmdDesc then - if terraCmds[ cmdDesc.name ] then - MakeToolTip_Terra(cmdDesc.name) - return - end - end - - - local cur_ttstr = screen0.currentTooltip or spGetCurrentTooltip() - local type, data = spTraceScreenRay(mx, my) - if (not changeNow) and cur_ttstr ~= '' and old_ttstr == cur_ttstr and old_data == data then - PlaceToolTipWindow2(mx+20,my-20) - return - end - old_data = data - old_ttstr = cur_ttstr - - tt_unitID = nil - tt_ud = nil - - --chili control tooltip - if screen0.currentTooltip ~= nil - and not screen0.currentTooltip:find('Build') --detect if chili control shows build option - and not screen0.currentTooltip:find('Morph') --detect if chili control shows morph option - then - if cur_ttstr ~= '' and cur_ttstr:gsub(' ',''):len() > 0 then - MakeToolTip_Text(cur_ttstr) - else - KillTooltip() - end - return - end - - local tt_table = tooltipBreakdown(cur_ttstr) - local tooltip, unitDef = tt_table.tooltip, tt_table.unitDef - - if not tooltip then - KillTooltip() - return - elseif unitDef then - tt_ud = unitDef - MakeToolTip_UD(tt_table) - return - end - - -- empty tooltip - if (tooltip == '') or tooltip:gsub(' ',''):len() <= 0 then - KillTooltip() - return - end - - --unit(s) selected/pointed at - local unit_tooltip = tooltip:find('Experience %d+.%d+ Cost ') --shows on your units, not enemy's - or tooltip:find('TechLevel %d') --shows on units - or tooltip:find('Metal.*Energy') --shows on features - - --unit(s) selected/pointed at - if unit_tooltip then - -- pointing at unit/feature - if type == 'unit' then - MakeToolTip_Unit(data, tooltip) - return - elseif type == 'feature' then - if MakeToolTip_Feature(data, tooltip) then - return - end - end - - --holding meta or static tip - if (showExtendedTip) then - MakeToolTip_Text(tooltip) - else - KillTooltip() - end - return - end - - --tooltip that shows position - local pos_tooltip = tooltip:sub(1,4) == 'Pos ' - - -- default tooltip - if not pos_tooltip or showExtendedTip then - MakeToolTip_Text(tooltip) - return - end - - KillTooltip() - return - -end --function MakeTooltip - -local function SetupTerraTips() - terraTips = { - - } - - for cmdName, _ in pairs( terraCmds ) do - terraTips[cmdName] = - green.. 'Click&Drag'..white..': Free draw terraform. \n'.. - green.. 'Alt+Click&Drag'..white..': Box terraform. \n'.. - green.. 'Alt+Ctrl+Click&Drag'..white..': Hollow box terraform. \n'.. - green.. 'Ctrl+Click on unit' ..white..': Terraform around unit. \n'.. - '\n'.. - '' - end - - terraTips.Smooth = terraTips.Smooth .. - yellow..'[During Terraform Draw]\n'.. - green.. 'Ctrl'..white..': Draw straight line segment. \n'.. - '' - - terraTips.Ramp = - green.. 'Step 1'..white..': Click to start ramp \n OR click&drag to start a ramp at desired height. \n'.. - green.. 'Step 2'..white..': Click to set end of ramp \n OR click&drag to set end of ramp at desired height. \n Hold '..green..'Alt'..white..' to snap to certain levels of pathability. \n'.. - green.. 'Step 3'..white..': Move mouse to set ramp width, click to complete. \n'.. - '\n'.. - yellow..'[Any Time]\n'.. - green.. 'Space'..white..': Cycle through only raise/lower \n'.. - '\n'.. - yellow..'[Wireframe indicator colors]\n'.. - green.. 'Green'..white..': All units can traverse. \n'.. - green.. 'Yellow'..white..': Vehicles cannot traverse. \n'.. - green.. 'Red'..white..': Only all-terrain / spiders can traverse. \n'.. - '' - - - terraTips.Level = terraTips.Level .. - yellow..'[During Terraform Draw]\n'.. - green.. 'Ctrl'..white..': Draw straight line segment. \n'.. - '\n'.. - yellow..'[After Terraform Draw]\n'.. - green.. 'Alt'..white..': Snap to starting height / below water level (prevent ships) / below water level (prevent land units). \n'.. - green.. 'Ctrl'..white..': Hold and point at terrain to level to height pointed at.\n'.. - '\n'.. - yellow..'[Any Time]\n'.. - green.. 'Space'..white..': Cycle through only raise/lower \n'.. - '' - - terraTips.Raise = terraTips.Raise .. - yellow..'[During Terraform Draw]\n'.. - green.. 'Ctrl'..white..': Draw straight line segment. \n'.. - '\n'.. - yellow..'[After Terraform Draw]\n'.. - green.. 'Alt'..white..': Snap to steps of 15 height. \n'.. - green.. 'Ctrl'..white..': Snap to 0 height. \n'.. - '' - - terraTips.Restore = terraTips.Restore .. - '\n'.. - yellow..'[Any Time]\n'.. - green.. 'Space'..white..': Limit to only raise/lower \n'.. - '' - -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -function widget:Update(dt) - if widgetHandler:InTweakMode() then - tweakShow = true - Show(real_window_corner) - elseif tweakShow then - tweakShow = false - widget:SelectionChanged(Spring.GetSelectedUnits()) - end - - timer = timer + dt - if timer >= updateFrequency then - UpdateSelectedUnitsTooltip() - UpdateDynamicGroupInfo() - WriteGroupInfo() - - SetHealthbars() - if stt_unitID then - local tt_table = tooltipBreakdown( spGetCurrentTooltip() ) - local tooltip, unitDef = tt_table.tooltip, tt_table.unitDef - UpdateResourceStack( 'selunit', stt_unitID, stt_ud, tooltip ) - - local nanobar_stack = globalitems['bp_selunit'] - local nanobar = nanobar_stack:GetChildByName('bar') - if nanobar then - local metalMake, metalUse, energyMake,energyUse = Spring.GetUnitResources(stt_unitID) - - if metalUse then - nanobar:SetValue(metalUse/stt_ud.buildSpeed,true) - nanobar:SetCaption(round(100*metalUse/stt_ud.buildSpeed)..'%') - else - nanobar:SetValue(1) - nanobar:SetCaption('??? / ' .. numformat(stt_ud.buildSpeed)) - end - end - - end - changeNow = true - timer = 0 - end - - old_mx, old_my = mx,my - alt,_,meta,_ = spGetModKeyState() - mx,my = spGetMouseState() - local mousemoved = (mx ~= old_mx or my ~= old_my) - - local show_cursortip = true - if meta then - if not showExtendedTip then changeNow = true end - showExtendedTip = true - - else - if (options.tooltip_delay.value > 0) and not tildepressed then - if not mousemoved then - stillCursorTime = stillCursorTime + dt - else - stillCursorTime = 0 - end - show_cursortip = stillCursorTime > options.tooltip_delay.value - end - - if showExtendedTip then changeNow = true end - showExtendedTip = false - - end - - if mousemoved or changeNow then - if not show_cursortip and not tildepressed then - KillTooltip() - return - end - MakeTooltip() - changeNow = false - end - - - -end - -function widget:ViewResize(vsx, vsy) - scrW = vsx - scrH = vsy -end - -function widget:Initialize() - if (not WG.Chili) then - widgetHandler:RemoveWidget(widget) - return - end - - SetupTerraTips() - - Spring.SetDrawSelectionInfo(false) - - local VFSMODE = VFS.RAW_FIRST - _, iconFormat = VFS.Include(LUAUI_DIRNAME .. "Configs/chilitip_conf.lua" , nil, VFSMODE) - local confdata = VFS.Include(LUAUI_DIRNAME .. "Configs/epicmenu_conf.lua", nil, VFSMODE) - color = confdata.color - - -- setup Chili - Chili = WG.Chili - Button = Chili.Button - Label = Chili.Label - Window = Chili.Window - Panel = Chili.Panel - StackPanel = Chili.StackPanel - Grid = Chili.Grid - TextBox = Chili.TextBox - Image = Chili.Image - Multiprogressbar = Chili.Multiprogressbar - Progressbar = Chili.Progressbar - LayoutPanel = Chili.LayoutPanel - screen0 = Chili.Screen0 - - widget:ViewResize(Spring.GetViewGeometry()) - - CreateHpBar('hp_unit') - CreateHpBar('hp_selunit') - CreateHpBar('hp_feature') - CreateHpBar('hp_corpse') - - CreateBpBar('bp_selunit') - - stack_main = StackPanel:New{ - width=300, -- needed for initial tooltip - } - stack_leftbar = StackPanel:New{ - width=10, -- needed for initial tooltip - } - - window_tooltip2 = Window:New{ - --skinName = 'default', - useDList = false, - resizable = false, - draggable = false, - autosize = true, - backgroundColor = color.tooltip_bg, - children = { stack_leftbar, stack_main, }, - minHeight = 32, - minWidth = 32, - } - --FontChanged() - spSendCommands({"tooltip 0"}) - - - local screenWidth,screenHeight = Spring.GetWindowGeometry() - local y = tostring(math.floor(screenWidth/screenHeight*0.35*0.35*100 - window_height)) .. "%" - - real_window_corner = Window:New{ - name = 'real_window_corner'; - color = {0, 0, 0, 0}, - right = "35%"; - bottom = 0; - width = 550; - height = 220; - dockable = true; - draggable = false, - resizable = false, - tweakDraggable = true, - tweakResizable = true, - padding = {0, 0, 0, 0}, - minWidth = 450, - minHeight = 160, - - } - - window_corner = Panel:New{ - parent = real_window_corner, - name = 'unitinfo2'; - x = 0, - y = 0, - width = "100%"; - height = "100%"; - dockable = false, - resizable = false; - draggable = false, - OnMouseDown={ function(self) - local _,_, meta,_ = Spring.GetModKeyState() - if not meta then return false end - WG.crude.OpenPath('Settings/Interface/Selected Units Window') - WG.crude.ShowMenu() - return true --skip button function, else clicking on build pic will also select the unit. - end }, - } - - windMin = Spring.GetGameRulesParam("WindMin") - windMax = Spring.GetGameRulesParam("WindMax") - - for i=1,#UnitDefs do - local ud = UnitDefs[i] - if (ud.customParams.level) --// engine overrides commanders tooltips with playernames - or (ud.extractsMetal > 0) --// the Overdrive gadgets adds additional information to the tooltip, but the visualize it a different way - then - ud.chili_selections_useStaticTooltip = true - end - end - - option_Deselect() - -end - -function widget:Shutdown() - spSendCommands({"tooltip 1"}) - if (window_tooltip2) then - window_tooltip2:Dispose() - end - Spring.SetDrawSelectionInfo(true) -end - - - -function widget:KeyPress(key, modifier, isRepeat) - if key == KEYSYMS.BACKQUOTE then - if not tildepressed then - changeNow = true - end - tildepressed = true - end -end -function widget:KeyRelease(key) - if key == KEYSYMS.BACKQUOTE then - if tildepressed then - changeNow = true - end - tildepressed = false - end -end - -function widget:DrawScreen() - if not tildepressed then return end - local x, y, lmb, mmb, rmb = Spring.GetMouseState() - drawing = lmb - erasing = rmb - - local filefound - if drawing then - filefound = glTexture(LUAUI_DIRNAME .. 'Images/drawingcursors/pencil.png') - elseif erasing then - filefound = glTexture(LUAUI_DIRNAME .. 'Images/drawingcursors/eraser.png') - end - - if filefound then - --do teamcolor? - --glColor(0,1,1,1) - if drawing or erasing then - Spring.SetMouseCursor('none') - end - glTexRect(x, y-cursor_size, x+cursor_size, y) - glTexture(false) - --glColor(1,1,1,1) - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---lags like a brick due to being spammed constantly for unknown reason, moved all its behavior to SelectionChanged ---function widget:CommandsChanged() ---end --- - - -function widget:SelectionChanged(newSelection) - numSelectedUnits = spGetSelectedUnitsCount() - selectedUnits = newSelection - - if (numSelectedUnits>0) then - UpdateStaticGroupInfo() - UpdateDynamicGroupInfo() - selectedUnitsByDef = spGetSelectedUnitsByDef() - selectedUnitsByDef.n = nil -- REMOVE IN 0.83 - selectedUnitsByDefCounts = {} - for i,v in pairs(selectedUnitsByDef) do - selectedUnitsByDefCounts[i] = #v - end - - --// spGetSelectedUnitsByDef() doesn't save the order for the different defids, so we reconstruct it from spGetSelectedUnits() - --// else the sort order would change each time we select a new unit or deselect one! - selectionSortOrder = {} - local alreadyInList = {} - for i=1,#selectedUnits do - local defid = spGetUnitDefID(selectedUnits[i]) - if (not alreadyInList[defid]) then - alreadyInList[defid] = true - selectionSortOrder[#selectionSortOrder+1] = defid - end - end - - if (numSelectedUnits == 1) then - local tt_table = tooltipBreakdown( spGetCurrentTooltip() ) - local tooltip, unitDef = tt_table.tooltip, tt_table.unitDef - - local cur1, cur2 = MakeToolTip_SelUnit(selectedUnits[1], tooltip) - if cur1 then - window_corner:ClearChildren() - window_corner:AddChild(cur1) - window_corner:AddChild(cur2) - end - else - stt_unitID = nil - MakeUnitGroupSelectionToolTip() - end - Show(real_window_corner) - else - stt_unitID = nil - window_corner:ClearChildren() - screen0:RemoveChild(real_window_corner) - end -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -function widget:Shutdown() - Spring.SetDrawSelectionInfo(true) -end 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 b9144ae1c..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 = -10, + layer = -2, enabled = true, -- loaded by default? } end @@ -14,57 +14,86 @@ 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 local fontSize = 15 -- not real fontsize, it will be scaled -local scaleFontAmount = 115 +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 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 + -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- @@ -74,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 'Robert Paulson' - for _,pID in ipairs(players) do - local pname,active = GetPlayerInfo(pID) - if active 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 @@ -93,74 +129,200 @@ 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.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 - if (attributes[2][1] + attributes[2][2]*1.35 + attributes[2][3]*0.5) < 0.75 then - if fontShadow then - glTranslate(0, -(fontSize/44), 0) - shadowFont:Begin() - shadowFont:SetTextColor({0,0,0,shadowOpacity}) - shadowFont:SetOutlineColor({0,0,0,shadowOpacity}) - shadowFont:Print(attributes[1], 0, 0, fontSize, "con") - shadowFont:End() - glTranslate(0, (fontSize/44), 0) - end - font:SetTextColor({1,1,1,0.9*attributes[2][4]*attributes[2][4]*attributes[2][4]*attributes[2][4]}) - font:SetOutlineColor(({1,1,1,0.9*attributes[2][4]*attributes[2][4]*attributes[2][4]*attributes[2][4]})) - else - font:SetTextColor({0,0,0,0.9*attributes[2][4]*attributes[2][4]*attributes[2][4]*attributes[2][4]}) - font:SetOutlineColor(({0,0,0,0.9*attributes[2][4]*attributes[2][4]*attributes[2][4]*attributes[2][4]})) + if outlineColor[1] == 1 and fontShadow then + glTranslate(0, -(fontSize/44), 0) + shadowFont:Begin() + shadowFont:SetTextColor({0,0,0,shadowOpacity}) + shadowFont:SetOutlineColor({0,0,0,shadowOpacity}) + shadowFont:Print(attributes[1], 0, 0, fontSize, "con") + shadowFont:End() + glTranslate(0, (fontSize/44), 0) end + font:SetTextColor(outlineColor) + font:SetOutlineColor(outlineColor) + font:Print(attributes[1], -(fontSize/38), -(fontSize/33), fontSize, "con") font:Print(attributes[1], (fontSize/38), -(fontSize/33), fontSize, "con") end font:Begin() font:SetTextColor(attributes[2]) - font:SetOutlineColor(attributes[4]) + font:SetOutlineColor(outlineColor) font:Print(attributes[1], 0, 0, fontSize, "con") font:End() 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 glTranslate(0, attributes[3], 0) glBillboard() - glScale(usedFontSize/fontSize,usedFontSize/fontSize,usedFontSize/fontSize) + if nameScaling then + glScale(usedFontSize/fontSize,usedFontSize/fontSize,usedFontSize/fontSize) + end glCallList(comnameList[attributes[1]]) - glScale(1,1,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 -function widget:DrawWorld() - --if Spring.IsGUIHidden() then return 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 spec then + CheckedForSpec = true + CheckAllComs() + end + end + glDepthTest(true) glAlphaTest(GL_GREATER, 0) 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) - local xDifference = camX - x - local yDifference = camY - y - local zDifference = camZ - z - camDistance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) - - usedFontSize = (fontSize*0.5) + (camDistance/scaleFontAmount) - - glDrawFuncAtUnit(unitID, false, DrawName, unitID, attributes, fontShadow) + camDistance = diag(camX-x, camY-y, camZ-z) + + 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 @@ -171,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 @@ -181,20 +345,33 @@ 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) - if Spring.GetGameFrame()<30*5 then - CheckAllComs() -- handle substitutions, etc - end + spec = Spring.GetSpectatingState() + local name,_ = GetPlayerInfo(playerID,false) + comnameList[name] = nil + CheckAllComs() -- handle substitutions, etc end function widget:UnitCreated(unitID, unitDefID, unitTeam) @@ -203,16 +380,51 @@ 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) CheckCom(unitID, unitDefID, unitTeam) end + + +function toggleNameScaling() + nameScaling = not nameScaling +end + +function widget:GetConfigData() + return { + 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.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 ae54fe666..1e01ed01f 100644 --- a/LuaUI/Widgets_Evo/gui_commands_fx.lua +++ b/LuaUI/Widgets_Evo/gui_commands_fx.lua @@ -2,8 +2,8 @@ function widget:GetInfo() return { name = "Commands FX", desc = "Shows commands given by allies", - author = "Floris, Bluestone", - date = "28 January 2015", + author = "Floris (bluestone helped optimizing)", + date = "20 may 2015", license = "GNU GPL, v2 or later", layer = 2, enabled = true, @@ -12,28 +12,12 @@ end -- future: hotkey to show all current cmds? (like current shift+space) -- handle set target +-- quickfade on cmd cancel -local spGetUnitPosition = Spring.GetUnitPosition -local spGetUnitCommands = Spring.GetUnitCommands -local spIsUnitInView = Spring.IsUnitInView -local spIsSphereInView = Spring.IsSphereInView -local spIsUnitIcon = Spring.IsUnitIcon -local spValidUnitID = Spring.ValidUnitID -local spValidFeatureID = Spring.ValidFeatureID -local spGetFeaturePosition = Spring.GetFeaturePosition -local spIsUnitSelected = Spring.IsUnitSelected -local spIsGUIHidden = Spring.IsGUIHidden -local spTraceScreenRay = Spring.TraceScreenRay -local spIsUnitSelected = Spring.IsUnitSelected -local spGetUnitDefID = Spring.GetUnitDefID -local spLoadCmdColorsConfig = Spring.LoadCmdColorsConfig - -local GL_SRC_ALPHA = GL.SRC_ALPHA -local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA -local GL_ONE = GL.ONE - -local MAX_UNITS = Game.maxUnits +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +local CMD_RAW_MOVE = 39812 local CMD_ATTACK = CMD.ATTACK --icon unit or map local CMD_CAPTURE = CMD.CAPTURE --icon unit or area local CMD_FIGHT = CMD.FIGHT -- icon map @@ -53,46 +37,69 @@ local CMD_UNLOAD_UNIT = CMD.UNLOAD_UNIT -- icon map local CMD_UNLOAD_UNITS = CMD.UNLOAD_UNITS -- icon unit or area local BUILD = -1 --------------------------------------------------------------------------------- - -local commands = {} -local minCommand = 1 -- track lowest/highest entries that need to be processed -local minQueueCommand = 1 -local maxCommand = 0 - -local unitCommand = {} -- most recent key in command table of order for unitID -local setTarget = {} -- set targets of units -local osClock - -local drawBuildQueue = true -local drawPulse = true -local drawPulseAllways = false -local drawLineTexture = true - -local opacity = 1 -local duration = 2 - -local lineWidth = 5 -local lineOpacity = 0.85 -local lineDuration = 1 -- set a value <= 1 -local lineWidthEnd = 0.5 -- multiplier (this wont affect textured lines) -local lineTextureLength = 4.5 -local lineTextureSpeed = 2 - -local glowRadius = 32 -local glowDuration = 0.3 -local glowOpacity = 0.13 - -local pulseRadius = 21 -local pulseDuration = 0.85 -- set a value <= 1 -local pulseOpacity = 1 -local pulseRotateSpeed = 1 -- not working yet +local diag = math.diag +local pi = math.pi +local sin = math.sin +local cos = math.cos +local atan = math.atan +local random = math.random +local glPushMatrix = gl.PushMatrix +local glUnitShape = gl.UnitShape +local glRotate = gl.Rotate +local glTranslate = gl.Translate +local glPopMatrix = gl.PopMatrix +local glTexture = gl.Texture +local glColor = gl.Color +local glBeginEnd = gl.BeginEnd +local glVertex = gl.Vertex +local glTexCoord = gl.TexCoord +local glUnit = gl.Unit +local GL_QUADS = GL.QUADS + +local GaiaTeamID = Spring.GetGaiaTeamID() -local pulseImg = LUAUI_DIRNAME.."Images/commandsfx/pulse.png" -local glowImg = LUAUI_DIRNAME.."Images/commandsfx/glow.png" -local lineImg = LUAUI_DIRNAME.."Images/commandsfx/line.png" +-------------------------------------------------------------------------------- +-- Config +-------------------------------------------------------------------------------- +local filterAIteams = true + +local drawBuildQueue = true +local drawLineTexture = true +local drawUnitHighlight = true +local drawUnitHighlightSkipFPS = 13 -- (0 to disable) skip drawing when framerate gets below this value + +local opacity = 1 +local duration = 2.6 + +local lineWidth = 7.8 +local lineOpacity = 0.75 +local lineDuration = 1 -- set a value <= 1 +local lineWidthEnd = 0.85 -- multiplier +local lineTextureLength = 4 +local lineTextureSpeed = 2.4 + +local groundGlow = true +local glowRadius = 26 +local glowDuration = 0.5 +local glowOpacity = 0.11 + +-- limit amount of effects to keep performance sane +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/line.dds" + +local ignoreUnits = {} +for udefID,def in ipairs(UnitDefs) do + if def.customParams['nohealthbars'] then + ignoreUnits[udefID] = true + end +end local mapX = Game.mapSizeX local mapZ = Game.mapSizeZ @@ -100,81 +107,145 @@ local mapZ = Game.mapSizeZ local CONFIG = { [CMD_ATTACK] = { sizeMult = 1.4, + endSize = 0.28, colour = {1.00, 0.20, 0.20, 0.30}, }, [CMD_CAPTURE] = { sizeMult = 1.4, + endSize = 0.28, colour = {1.00, 1.00, 0.30, 0.30}, }, [CMD_FIGHT] = { sizeMult = 1.2, + endSize = 0.24, colour = {0.30, 0.50, 1.00, 0.25}, }, [CMD_GUARD] = { sizeMult = 1, + endSize = 0.2, colour = {0.10, 0.10, 0.50, 0.25}, }, [CMD_LOAD_ONTO] = { sizeMult = 1, + endSize = 0.2, colour = {0.30, 1.00, 1.00 ,0.25}, }, [CMD_LOAD_UNITS] = { sizeMult = 1, + endSize = 0.2, colour = {0.30, 1.00, 1.00, 0.30}, }, [CMD_MANUALFIRE] = { sizeMult = 1.4, + endSize = 0.28, colour = {1.00, 0.00, 0.00, 0.30}, }, - [CMD_MOVE] = { - sizeMult = 1, - colour = {0.00, 1.00, 0.00, 0.25}, - }, + [CMD_MOVE] = { + sizeMult = 1, + endSize = 0.2, + colour = {0.00, 1.00, 0.00, 0.25}, + }, + [CMD_RAW_MOVE] = { + sizeMult = 1, + endSize = 0.2, + colour = {0.00, 1.00, 0.00, 0.25}, + }, [CMD_PATROL] = { sizeMult = 1, + endSize = 0.2, colour = {0.10, 0.10, 1.00, 0.25}, }, [CMD_RECLAIM] = { sizeMult = 1, + endSize = 0, colour = {1.00, 0.20, 1.00, 0.4}, }, [CMD_REPAIR] = { sizeMult = 1, + endSize = 0.2, colour = {0.30, 1.00, 1.00, 0.4}, }, [CMD_RESTORE] = { sizeMult = 1, + endSize = 0.2, colour = {0.00, 0.50, 0.00, 0.25}, }, [CMD_RESURRECT] = { sizeMult = 1, + endSize = 0.2, colour = {0.20, 0.60, 1.00, 0.25}, }, --[[ [CMD_SET_TARGET] = { sizeMult = 1, + endSize = 0.2, colour = {1.00 ,0.75 ,1.00 ,0.25}, }, ]] [CMD_UNLOAD_UNIT] = { sizeMult = 1, + endSize = 0.2, colour = {1.00, 1.00 ,0.00 ,0.25}, }, [CMD_UNLOAD_UNITS] = { sizeMult = 1, + endSize = 0.2, colour = {1.00, 1.00 ,0.00 ,0.25}, }, [BUILD] = { sizeMult = 1, - colour = {0.00, 1.00 ,0.00 ,0.25}, + endSize = 0.2, + colour = {0.00, 1.00 ,0.00 ,0.25}, } } -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- +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 + local UNITCONF = {} local shapes = {} + +local drawFrame = 0 +local gameframeDrawFrame = 0 + +local spGetUnitPosition = Spring.GetUnitPosition +local spGetCommandQueue = Spring.GetCommandQueue +local spIsUnitInView = Spring.IsUnitInView +local spIsSphereInView = Spring.IsSphereInView +local spIsUnitIcon = Spring.IsUnitIcon +local spValidUnitID = Spring.ValidUnitID +local spValidFeatureID = Spring.ValidFeatureID +local spGetFeaturePosition = Spring.GetFeaturePosition +local spIsUnitSelected = Spring.IsUnitSelected +local spIsGUIHidden = Spring.IsGUIHidden +local spTraceScreenRay = Spring.TraceScreenRay +local spIsUnitSelected = Spring.IsUnitSelected +local spGetUnitDefID = Spring.GetUnitDefID +local spLoadCmdColorsConfig = Spring.LoadCmdColorsConfig +local spGetFPS = Spring.GetFPS +local spGetMyTeamID = Spring.GetMyTeamID + +local GL_SRC_ALPHA = GL.SRC_ALPHA +local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA +local GL_ONE = GL.ONE + +local MAX_UNITS = Game.maxUnits +local find = string.find + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + function SetUnitConf() local name, shape, xscale, zscale, scale, xsize, zsize, weaponcount for udid, unitDef in pairs(UnitDefs) do @@ -202,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) @@ -221,42 +291,57 @@ 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() --spLoadCmdColorsConfig('useQueueIcons 0 ') - spLoadCmdColorsConfig('queueIconScale 0.75 ') - spLoadCmdColorsConfig('queueIconAlpha 0.4 ') - --spLoadCmdColorsConfig('unitBox 0.0 1.0 0.0 0.85') + spLoadCmdColorsConfig('queueIconScale 0.66 ') + spLoadCmdColorsConfig('queueIconAlpha 0.5 ') - setCmdLineColors(0.4) + 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 ') - --spLoadCmdColorsConfig('unitBox 0.0 1.0 0.0 1.0') setCmdLineColors(0.7) end -local pi = math.pi -local sin = math.sin -local cos = math.cos -local atan = math.atan -local random = math.random local function DrawLineEnd(x1,y1,z1, x2,y2,z2, width) y1 = y2 - local xDifference = x2 - x1 - local yDifference = y2 - y1 - local zDifference = z2 - z1 - local distance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) + local distance = diag(x2-x1, y2-y1, z2-z1) -- for 2nd rounding local distanceDivider = distance / (width/2.25) @@ -276,31 +361,28 @@ local function DrawLineEnd(x1,y1,z1, x2,y2,z2, width) local zOffset2 = zOffset / 1.35 -- first rounding - gl.Vertex(x1+xOffset2, y1, z1+zOffset2) - gl.Vertex(x1-xOffset2, y1, z1-zOffset2) + glVertex(x1+xOffset2, y1, z1+zOffset2) + glVertex(x1-xOffset2, y1, z1-zOffset2) - gl.Vertex(x2-xOffset, y2, z2-zOffset) - gl.Vertex(x2+xOffset, y2, z2+zOffset) + glVertex(x2-xOffset, y2, z2-zOffset) + glVertex(x2+xOffset, y2, z2+zOffset) -- second rounding - gl.Vertex(x1+xOffset2, y1, z1+zOffset2) - gl.Vertex(x1-xOffset2, y1, z1-zOffset2) + glVertex(x1+xOffset2, y1, z1+zOffset2) + glVertex(x1-xOffset2, y1, z1-zOffset2) xOffset2 = xOffset / 3.22 zOffset2 = zOffset / 3.22 - gl.Vertex(x1_2-xOffset2, y1, z1_2-zOffset2) - gl.Vertex(x1_2+xOffset2, y1, z1_2+zOffset2) + glVertex(x1_2-xOffset2, y1, z1_2-zOffset2) + glVertex(x1_2+xOffset2, y1, z1_2+zOffset2) end local function DrawLineEndTex(x1,y1,z1, x2,y2,z2, width, texLength, texOffset) y1 = y2 - local xDifference = x2 - x1 - local yDifference = y2 - y1 - local zDifference = z2 - z1 - local distance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) + local distance = diag(x2-x1, y2-y1, z2-z1) -- for 2nd rounding local distanceDivider = distance / (width/2.25) @@ -320,29 +402,29 @@ local function DrawLineEndTex(x1,y1,z1, x2,y2,z2, width, texLength, texOffset) local zOffset2 = zOffset / 1.35 -- first rounding - gl.TexCoord(0.2-texOffset,0) - gl.Vertex(x1+xOffset2, y1, z1+zOffset2) - gl.TexCoord(0.2-texOffset,1) - gl.Vertex(x1-xOffset2, y1, z1-zOffset2) + glTexCoord(0.2-texOffset,0) + glVertex(x1+xOffset2, y1, z1+zOffset2) + glTexCoord(0.2-texOffset,1) + glVertex(x1-xOffset2, y1, z1-zOffset2) - gl.TexCoord(0.55-texOffset,0.85) - gl.Vertex(x2-xOffset, y2, z2-zOffset) - gl.TexCoord(0.55-texOffset,0.15) - gl.Vertex(x2+xOffset, y2, z2+zOffset) + glTexCoord(0.55-texOffset,0.85) + glVertex(x2-xOffset, y2, z2-zOffset) + glTexCoord(0.55-texOffset,0.15) + glVertex(x2+xOffset, y2, z2+zOffset) -- second rounding - gl.TexCoord(0.8-texOffset,0.7) - gl.Vertex(x1+xOffset2, y1, z1+zOffset2) - gl.TexCoord(0.8-texOffset,0.3) - gl.Vertex(x1-xOffset2, y1, z1-zOffset2) + glTexCoord(0.8-texOffset,0.7) + glVertex(x1+xOffset2, y1, z1+zOffset2) + glTexCoord(0.8-texOffset,0.3) + glVertex(x1-xOffset2, y1, z1-zOffset2) xOffset2 = xOffset / 3.22 zOffset2 = zOffset / 3.22 - gl.TexCoord(0.55-texOffset,0.15) - gl.Vertex(x1_2-xOffset2, y1, z1_2-zOffset2) - gl.TexCoord(0.55-texOffset,0.85) - gl.Vertex(x1_2+xOffset2, y1, z1_2+zOffset2) + glTexCoord(0.55-texOffset,0.15) + glVertex(x1_2-xOffset2, y1, z1_2-zOffset2) + glTexCoord(0.55-texOffset,0.85) + glVertex(x1_2+xOffset2, y1, z1_2+zOffset2) end local function DrawLine(x1,y1,z1, x2,y2,z2, width) -- long thin rectangle @@ -351,45 +433,41 @@ local function DrawLine(x1,y1,z1, x2,y2,z2, width) -- long thin rectangle local zOffset = cos(pi-theta) * width / 2 local xOffset = sin(pi-theta) * width / 2 - gl.Vertex(x1+xOffset, y1, z1+zOffset) - gl.Vertex(x1-xOffset, y1, z1-zOffset) + glVertex(x1+xOffset, y1, z1+zOffset) + glVertex(x1-xOffset, y1, z1-zOffset) - gl.Vertex(x2-xOffset, y2, z2-zOffset) - gl.Vertex(x2+xOffset, y2, z2+zOffset) + glVertex(x2-xOffset, y2, z2-zOffset) + glVertex(x2+xOffset, y2, z2+zOffset) end local function DrawLineTex(x1,y1,z1, x2,y2,z2, width, texLength, texOffset) -- long thin rectangle - local xDifference = x2 - x1 - local yDifference = y2 - y1 - local zDifference = z2 - z1 - local distance = math.sqrt(xDifference*xDifference + yDifference*yDifference + zDifference*zDifference) + local distance = diag(x2-x1, y2-y1, z2-z1) local theta = (x1~=x2) and atan((z2-z1)/(x2-x1)) or pi/2 local zOffset = cos(pi-theta) * width / 2 local xOffset = sin(pi-theta) * width / 2 - gl.TexCoord(((distance/width)/texLength)+1-texOffset, 1) - gl.Vertex(x1+xOffset, y1, z1+zOffset) - gl.TexCoord(((distance/width)/texLength)+1-texOffset, 0) - gl.Vertex(x1-xOffset, y1, z1-zOffset) + glTexCoord(((distance/width)/texLength)+1-texOffset, 1) + glVertex(x1+xOffset, y1, z1+zOffset) + glTexCoord(((distance/width)/texLength)+1-texOffset, 0) + glVertex(x1-xOffset, y1, z1-zOffset) - gl.TexCoord(0-texOffset,0) - gl.Vertex(x2-xOffset, y2, z2-zOffset) - gl.TexCoord(0-texOffset,1) - gl.Vertex(x2+xOffset, y2, z2+zOffset) + glTexCoord(0-texOffset,0) + glVertex(x2-xOffset, y2, z2-zOffset) + glTexCoord(0-texOffset,1) + glVertex(x2+xOffset, y2, z2+zOffset) end local function DrawGroundquad(x,y,z,size) - - gl.TexCoord(0,0) - gl.Vertex(x-size,y,z-size) - gl.TexCoord(0,1) - gl.Vertex(x-size,y,z+size) - gl.TexCoord(1,1) - gl.Vertex(x+size,y,z+size) - gl.TexCoord(1,0) - gl.Vertex(x+size,y,z-size) + glTexCoord(0,0) + glVertex(x-size,y,z-size) + glTexCoord(0,1) + glVertex(x-size,y,z+size) + glTexCoord(1,1) + glVertex(x+size,y,z+size) + glTexCoord(1,0) + glVertex(x+size,y,z-size) end ------------------------------------------------------------------------------------ @@ -400,14 +478,30 @@ 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 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, _, _) - -- 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 - local el = {ID=cmdID,time=os.clock(),unitID=unitID,draw=false,selected=spIsUnitSelected(unitID),udid=spGetUnitDefID(unitID)} -- command queue is not updated until next gameframe - maxCommand = maxCommand + 1 - --Spring.Echo("Adding " .. maxCommand) - commands[maxCommand] = el - end + 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 function ExtractTargetLocation(a,b,c,d,cmdID) @@ -433,58 +527,116 @@ function ExtractTargetLocation(a,b,c,d,cmdID) return x,y,z end -function widget:GameFrame() - --Spring.Echo("GameFrame: minCommand " .. minCommand .. " minQueueCommand " .. minQueueCommand .. " maxCommand " .. maxCommand) - local i = minQueueCommand - while (i <= maxCommand) do - --Spring.Echo("Processing " .. i) --debug - - local unitID = commands[i].unitID - RemovePreviousCommand(unitID) - unitCommand[unitID] = i - - -- get pruned command queue - local q = spGetUnitCommands(commands[i].unitID,50) or {} --limit to prevent mem leak, hax etc - local our_q = {} - local gotHighlight = false - 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) - end - end - our_q[#our_q+1] = cmd - end - end - - commands[i].queue = our_q - commands[i].queueSize = #our_q - if #our_q>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].processed = true - - minQueueCommand = minQueueCommand + 1 - i = i + 1 - end +function getCommandsQueue(unitID) + local q = spGetCommandQueue(unitID, 35) or {} --limit to prevent mem leak, hax etc + local our_q = {} + 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] = 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.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 unitID,v in pairs(newUnitCommands) do + if v ~= true and ignoreUnits[v[1]] == nil then + addUnitCommand(unitID, v[1], v[2]) + end + end + newUnitCommands = {} + + -- 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 + local function IsPointInView(x,y,z) if x and y and z then return spIsSphereInView(x,y,z,1) --better way of doing this? @@ -492,172 +644,206 @@ local function IsPointInView(x,y,z) return false end -local prevRotationOffset = 0 -local rotationOffset = 0 + local prevTexOffset = 0 local texOffset = 0 local prevOsClock = os.clock() function widget:DrawWorldPreUnit() - --Spring.Echo(maxCommand-minCommand) --EXPENSIVE! often handling hundreds of command queues at once - --if spIsGUIHidden() then return end - - osClock = os.clock() - gl.Blending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) - gl.DepthTest(false) + if chobbyInterface then return end + drawFrame = drawFrame + 1 + + if spIsGUIHidden() then return end + + osClock = os.clock() if drawLineTexture then texOffset = prevTexOffset - ((osClock - prevOsClock)*lineTextureSpeed) texOffset = texOffset - math.floor(texOffset) prevTexOffset = texOffset - rotationOffset = prevRotationOffset - ((osClock - prevOsClock)*pulseRotateSpeed) - rotationOffset = rotationOffset - math.floor(texOffset) - prevRotationOffset = rotationOffset - end + end prevOsClock = os.clock() - local i = minCommand - while (i <= maxCommand) do --only draw commands that have already been processed in GameFrame - - 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 - minCommand = minCommand + 1 - - 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) - gl.Color(lineColour[1],lineColour[2],lineColour[3],lineAlpha) - if commands[i].set_target.params[3] then - gl.BeginEnd(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 = Spring.GetUnitPosition(commands[i].set_target.params[1]) - if x then - gl.BeginEnd(GL.QUADS, DrawLine, prevX,prevY,prevZ, x,y,z, lineWidth) - end - end - end - ]] - -- draw command queue - if commands[i].queueSize > 0 and prevX then + + gl.DepthTest(false) + gl.Blending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + + local groundGlowCount = 0 + local commandCount = 0 + 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 - --Spring.Echo(CMD[commands[i].queue[j].id]) --debug - 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) - local validCoord = X and Z and X>=0 and X<=mapX and Z>=0 and Z<=mapZ - -- draw - if X and validCoord then - -- lines - local usedLineWidth = lineWidth - (progress * (lineWidth - (lineWidth * lineWidthEnd))) - local lineColour = CONFIG[commands[i].queue[j].id].colour - local lineAlpha = opacity * lineOpacity * (lineColour[4] * 1.5) * lineAlphaMultiplier - if lineAlpha > 0 then - gl.Color(lineColour[1],lineColour[2],lineColour[3],lineAlpha) + 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) + local validCoord = X and Z and X>=0 and X<=mapX and Z>=0 and Z<=mapZ + -- draw + if X and validCoord then + commandCount = commandCount + 1 + -- lines + local usedLineWidth = lineWidth - (progress * (lineWidth - (lineWidth * lineWidthEnd))) + local lineColour = CONFIG[commands[i].queue[j].id].colour + local lineAlpha = opacity * lineOpacity * (lineColour[4] * 2) * lineAlphaMultiplier + if lineAlpha > 0 then + glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) if drawLineTexture then - usedLineWidth = lineWidth - gl.Texture(lineImg) - gl.BeginEnd(GL.QUADS, DrawLineTex, prevX,prevY,prevZ, X, Y, Z, usedLineWidth, lineTextureLength, texOffset) - gl.Texture(false) + + usedLineWidth = lineWidth - (progress * (lineWidth - (lineWidth * lineWidthEnd))) + glTexture(lineImg) + glBeginEnd(GL_QUADS, DrawLineTex, prevX,prevY,prevZ, X, Y, Z, usedLineWidth, lineTextureLength * (lineWidth / usedLineWidth), texOffset) + glTexture(false) else - gl.BeginEnd(GL.QUADS, DrawLine, prevX,prevY,prevZ, X, Y, Z, usedLineWidth) + glBeginEnd(GL_QUADS, DrawLine, prevX,prevY,prevZ, X, Y, Z, usedLineWidth) end -- ghost of build queue if drawBuildQueue and commands[i].queue[j].buildingID then - gl.PushMatrix() - gl.Translate(X,Y+1,Z) - gl.Rotate(90 * commands[i].queue[j].params[4], 0, 1, 0) - gl.UnitShape(commands[i].queue[j].buildingID, Spring.GetMyTeamID()) - gl.Rotate(-90 * commands[i].queue[j].params[4], 0, 1, 0) - gl.Translate(-X,-Y-1,-Z) - gl.PopMatrix() + glPushMatrix() + glTranslate(X,Y+1,Z) + glRotate(90 * commands[i].queue[j].params[4], 0, 1, 0) + glUnitShape(commands[i].queue[j].buildingID, spGetMyTeamID(), true, false, false) + glRotate(-90 * commands[i].queue[j].params[4], 0, 1, 0) + glTranslate(-X,-Y-1,-Z) + glPopMatrix() end if j == 1 and not drawLineTexture then -- draw startpoint rounding - gl.Color(lineColour[1],lineColour[2],lineColour[3],lineAlpha) - gl.BeginEnd(GL.QUADS, DrawLineEnd, X, Y, Z, prevX,prevY,prevZ, usedLineWidth) + glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) + glBeginEnd(GL_QUADS, DrawLineEnd, X, Y, Z, prevX,prevY,prevZ, usedLineWidth) end end - if j==commands[i].queueSize then - - -- draw pulse if unit was selected when the cmd was given - if drawPulse and commands[i].selected or drawPulseAllways then - local pulseProgress = 0.7 - ((progress/1.5) / pulseDuration) - if progress < 0.05 then - pulseProgress = 0.57 + ((progress/1.5) / pulseDuration) - end - local pulseAlphaMultiplier = 1 - (progress / pulseDuration) - local pulseAlpha = (opacity * (lineColour[4]*1.7) * pulseAlphaMultiplier) * pulseOpacity - if pulseAlpha > 0.03 then - local pulseSize = pulseRadius/7 + ((pulseRadius / 2) * pulseProgress) - gl.Color(lineColour[1],lineColour[2],lineColour[3],pulseAlpha) - gl.Texture(pulseImg) - gl.BeginEnd(GL.QUADS,DrawGroundquad,X,Y,Z,pulseSize*1.5) - gl.Texture(false) - end - end - + if j==commands[i].queueSize then + -- draw endpoint rounding - if lineAlpha > 0 then + if drawLineTexture == false and lineAlpha > 0 then if drawLineTexture then - gl.Texture(lineImg) - gl.Color(lineColour[1],lineColour[2],lineColour[3],lineAlpha) - gl.BeginEnd(GL.QUADS, DrawLineEndTex, prevX,prevY,prevZ, X, Y, Z, usedLineWidth, lineTextureLength, texOffset) - gl.Texture(false) + glTexture(lineImg) + glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) + glBeginEnd(GL_QUADS, DrawLineEndTex, prevX,prevY,prevZ, X, Y, Z, usedLineWidth, lineTextureLength, texOffset) + glTexture(false) else - gl.Color(lineColour[1],lineColour[2],lineColour[3],lineAlpha) - gl.BeginEnd(GL.QUADS, DrawLineEnd, prevX,prevY,prevZ, X, Y, Z, usedLineWidth) + glColor(lineColour[1],lineColour[2],lineColour[3],lineAlpha) + glBeginEnd(GL_QUADS, DrawLineEnd, prevX,prevY,prevZ, X, Y, Z, usedLineWidth) end - end - + end + -- ground glow - local size = glowRadius * CONFIG[commands[i].queue[j].id].sizeMult - local glowAlpha = (1 - progress) * glowOpacity * opacity - - gl.Color(lineColour[1],lineColour[2],lineColour[3],glowAlpha) - gl.Texture(glowImg) - gl.BeginEnd(GL.QUADS,DrawGroundquad,X,Y,Z,size) - gl.Texture(false) - - end - prevX, prevY, prevZ = X, Y, Z - end - end - end - - end - - i = i + 1 - end - - gl.Scale(1,1,1) - gl.Color(1,1,1,1) + if groundGlow and groundGlowCount < maxGroundGlowCount then + groundGlowCount = groundGlowCount + 1 + local size = (glowRadius * CONFIG[commands[i].queue[j].id].sizeMult) + ((glowRadius * CONFIG[commands[i].queue[j].id].endSize - glowRadius * CONFIG[commands[i].queue[j].id].sizeMult) * progress) + local glowAlpha = (1 - progress) * glowOpacity * opacity + + if commands[i].selected then + glowAlpha = glowAlpha * 1.5 + end + glColor(lineColour[1],lineColour[2],lineColour[3],glowAlpha) + glTexture(glowImg) + glBeginEnd(GL_QUADS,DrawGroundquad,X,Y+3,Z,size) + glTexture(false) + 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 spIsGUIHidden() then return end - - -- highlight unit - gl.DepthTest(true) - gl.PolygonOffset(-2, -2) - gl.Blending(GL_SRC_ALPHA, GL_ONE) - local i = minCommand - while (i <= maxCommand) do - if commands[i].draw and commands[i].highlight and not spIsUnitIcon(commands[i].unitID) then - local progress = (osClock - commands[i].time) / duration - gl.Color(commands[i].highlight[1],commands[i].highlight[2],commands[i].highlight[3],0.1*(1-progress)) - gl.Unit(commands[i].unitID, true) - end - i = i + 1 - end - gl.Blending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) - gl.PolygonOffset(false) - gl.DepthTest(false) + if chobbyInterface then return end + if spIsGUIHidden() then return end + + if drawUnitHighlightSkipFPS > 0 and spGetFPS() < drawUnitHighlightSkipFPS then return end + + -- highlight unit + if drawUnitHighlight then + gl.DepthTest(true) + gl.PolygonOffset(-2, -2) + gl.Blending(GL_SRC_ALPHA, GL_ONE) + local highlightUnitCounter = 0 + 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)) + glUnit(commands[i].unitID, true) + highlightUnitCounter = highlightUnitCounter + 1 + end + if highlightUnitCounter >= drawUnitHightlightMaxUnits then + break + end + end + gl.Blending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + 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_common_colors.lua b/LuaUI/Widgets_Evo/gui_common_colors.lua deleted file mode 100644 index 2d10c12aa..000000000 --- a/LuaUI/Widgets_Evo/gui_common_colors.lua +++ /dev/null @@ -1,267 +0,0 @@ -function widget:GetInfo() - return { - name = "Common Team Colors", - desc = "v0.004 Makes neat team color scheme and everyone using this widget will see the same colors", - author = "CarRepairer", - date = "2013-09-24", - license = "GPL v2", - layer = -10001, - enabled = true, - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -options_path = 'Settings/Interface/Common Team Colors' -options = { - simpleColors = { - name = "Simple Colors", - type = 'bool', - value = false, - desc = 'All allies are green, all enemies are red.', - OnChange = function() widget:Initialize() end - }, -} - -local echo = Spring.Echo --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- HTML color names, colors should be a "wheel" -colors = { - --- Car's per player randomizer kinda sucks, so we randomize the shit out of the lines. Sad, but effective. - ---[[ - {'Coffee', '#6F4E37'}; - {'Teal', '#008080'}; - {'Salmon', '#FA8072'}; - {'Plum', '#DDA0DD'}; - {'Aquamarine', '#7FFFD4'}; - {'Yellow', '#FFFF00'}; - {'SkyBlue', '#87CEEB'}; - {'Navy', '#000080'}; - {'NeonPink', '#F535AA'}; - {'Blue', '#1144AA'}; - {'Cyan', '#00FFFF'}; - {'Parchment', '#FFFFC2'}; - {'Indigo', '#4B0082'}; - {'Red', '#FF0000'}; - {'Orange', '#FFA500'}; - {'Lime', '#00FF00'}; - {'Maroon', '#800000'}; - {'DarkGreen', '#006400'}; - {'Green', '#00CC00'}; - {'Mustard', '#FFDB58'}; - {'Sienna', '#A0522D'}; -]]-- - - {'Orange', '#ff6600'}; - {'Parchment', '#FFFFC2'}; - {'Teal', '#009B95'}; - {'Red', '#FF0000'}; - {'Purple', '#3914AF'}; - {'Yellow', '#FFFF00'}; - {'Blue', '#1144AA'}; - {'Pink', '#C9007A'}; - {'Green', '#00CC00'}; - - -} - -local colorNames = {} -for _,v in ipairs(colors) do - colorNames[v[1]] = v[2] -end - -local myColor = colorNames.Green -local allyColor = colorNames.Yellow -local gaiaColor = '#CCCCCC' -local enemyColor = colorNames.Red - -WG.LocalColor = (type(WG.LocalColor) == "table" and WG.LocalColor) or {} -WG.LocalColor.listeners = WG.LocalColor.listeners or {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -local function color2incolor(r,g,b,a) - if type(r) == 'table' then - r,g,b,a = unpack4(r) - end - r = math.max(r, 0.01) - g = math.max(g, 0.01) - b = math.max(b, 0.01) - - local inColor = '\255\255\255\255' - if r then - inColor = string.char(255, r*255, g*255, b*255) - end - return inColor -end -local function HexToColor(hex) - - hex = hex:gsub('#', '') - local r = hex:sub(1,2) - local g = hex:sub(3,4) - local b = hex:sub(5,6) - - r = tonumber(r, 16) - g = tonumber(g, 16) - b = tonumber(b, 16) - - r = r / 255 - g = g / 255 - b = b / 255 - - return r,g,b - -end - -local function NumFromStr(str) - local num = 0 - for i = 1, #str do - local byteNum = string.byte(str,i,i); - num = math.bit_xor(num*2, byteNum) - end - return num -end - -local function RandomGameNumber() - --[[ - local strTable = {} - local players = Spring.GetPlayerList() - for i, playerID in ipairs(players) do - local name, _, spec = Spring.GetPlayerInfo(playerID) - if not spec then - strTable[#strTable+1] = name - strTable[#strTable+1] = playerID - end - end - local str = table.concat( strTable ) - --]] - local teams = Spring.GetTeamList() - local str = #teams .. Game.mapName - --echo (str) - return NumFromStr(str) -end - - - -local function SetNewTeamColors(offset) - local gaia = Spring.GetGaiaTeamID() - --Spring.SetTeamColor(gaia, unpack(gaiaColor)) - - local allyTeamList = Spring.GetAllyTeamList() - - local teams = Spring.GetTeamList() - local numTeams = #teams - local numColors = #colors - local skippable = numColors - numTeams - - - local i = offset - echo( '*** Common Colors ***' ) - for _, allianceID in ipairs(allyTeamList) do - - for _, teamID in ipairs(Spring.GetTeamList(allianceID)) do - if (teamID ~= gaia) then - i = (i % #colors) + 1 - - local r,g,b = HexToColor(colors[i][2]) - - local _, playerID = Spring.GetTeamInfo(teamID) - local name = playerID and Spring.GetPlayerInfo(playerID) or 'noname' - echo( ' - ' .. color2incolor(r,g,b,1) .. name .. ' (' .. colors[i][1] ..')' ) - Spring.SetTeamColor(teamID, r,g,b) - end - end --team - - if skippable > 0 then - i = (i % #colors) + 1 - skippable = skippable - 1 - end - - end --alliance - -end - -local function SetNewSimpleTeamColors() - local gaia = Spring.GetGaiaTeamID() - Spring.SetTeamColor(gaia, HexToColor(gaiaColor)) - - local myAlly = Spring.GetMyAllyTeamID() - local myTeam = Spring.GetMyTeamID() - - for _, teamID in ipairs(Spring.GetTeamList()) do - local _,_,_,_,_,allyID = Spring.GetTeamInfo(teamID) - if (allyID == myAlly) then - Spring.SetTeamColor(teamID, HexToColor(allyColor)) - elseif (teamID ~= gaia) then - Spring.SetTeamColor(teamID, HexToColor(enemyColor)) - end - end - Spring.SetTeamColor(myTeam, HexToColor(myColor)) -- overrides previously defined color -end - -local function ResetOldTeamColors() - for _,team in ipairs(Spring.GetTeamList()) do - Spring.SetTeamColor(team,Spring.GetTeamOrigColor(team)) - end -end - -local function NotifyColorChange() - for name,func in pairs(WG.LocalColor.listeners) do - if type(func) == "function" then -- because we don't trust other widget writers to not give us random junk - func() -- yeah we wouldn't even need to do this with static typing :( - else - Spring.Echo(" ERROR: Listener '" .. name .. "' is not a function!" ) - end - end -end - -function WG.LocalColor.localTeamColorToggle() - options.simpleColors.value = not options.simpleColors.value - widget:Initialize() -end - -function WG.LocalColor.RegisterListener(name, func) - WG.LocalColor.listeners[name] = func -end - -function WG.LocalColor.UnregisterListener(name) - WG.LocalColor.listeners[name] = nil -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - if options.simpleColors.value then - SetNewSimpleTeamColors() - else - SetNewTeamColors( RandomGameNumber() ) - end - - NotifyColorChange() -end - -function widget:Shutdown() - ResetOldTeamColors() - NotifyColorChange() - WG.LocalColor.localTeamColorToggle = nil -end - - -function widget:TextCommand(command) - --[[ - if (string.find(command, 'tc') == 1) then - SetNewTeamColors( command:sub(4,5) + 0 ) - NotifyColorChange() - end - --]] - if (string.find(command, 'commoncolors') == 1) then - SetNewTeamColors( RandomGameNumber() ) - end - -end \ No newline at end of file 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_contextmenu.lua b/LuaUI/Widgets_Evo/gui_contextmenu.lua deleted file mode 100644 index a8ed09ae0..000000000 --- a/LuaUI/Widgets_Evo/gui_contextmenu.lua +++ /dev/null @@ -1,974 +0,0 @@ -function widget:GetInfo() - return { - name = "Context Menu", - desc = "v0.084 Chili Context Menu\nPress [Space] while clicking for a context menu.", - author = "CarRepairer", - date = "2009-06-02", - license = "GNU GPL, v2 or later", - layer = 0, - experimental = false, - enabled = true, - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -include("keysym.h.lua") - -local spSendLuaRulesMsg = Spring.SendLuaRulesMsg -local spGetCurrentTooltip = Spring.GetCurrentTooltip -local spGetUnitDefID = Spring.GetUnitDefID -local spGetUnitAllyTeam = Spring.GetUnitAllyTeam -local spGetUnitTeam = Spring.GetUnitTeam -local spTraceScreenRay = Spring.TraceScreenRay -local spGetTeamInfo = Spring.GetTeamInfo -local spGetPlayerInfo = Spring.GetPlayerInfo -local spGetTeamColor = Spring.GetTeamColor -local spGetModKeyState = Spring.GetModKeyState - -local abs = math.abs -local strFormat = string.format - -local echo = Spring.Echo - -local VFSMODE = VFS.RAW_FIRST -local ignoreweapon, iconFormat = VFS.Include(LUAUI_DIRNAME .. "Configs/chilitip_conf.lua" , nil, VFSMODE) -local confdata = VFS.Include(LUAUI_DIRNAME .. "Configs/epicmenu_conf.lua", nil, VFSMODE) -local color = confdata.color - -local iconTypesPath = LUAUI_DIRNAME.."Configs/icontypes.lua" -local icontypes = VFS.FileExists(iconTypesPath) and VFS.Include(iconTypesPath) - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Chili -local Button -local Label -local Window -local ScrollPanel -local StackPanel -local Grid -local TextBox -local Image -local screen0 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local B_HEIGHT = 30 -local icon_size = 18 - -local scrH, scrW = 0,0 -local myAlliance = Spring.GetLocalAllyTeamID() -local myTeamID = Spring.GetLocalTeamID() - -local ceasefires = true -local marketandbounty = false - -local window_unitcontext, window_unitstats -local statswindows = {} - - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- ---[[ -options = { -} -options_path = 'Settings/Interface' ---]] --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local 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 - -if tobool(Spring.GetModOptions().noceasefire) or Spring.FixedAllies() then - ceasefires = false -end - -if tobool(Spring.GetModOptions().marketandbounty) then - marketandbounty = true -end - - -function comma_value(amount, displayPlusMinus) - local formatted - - -- amount is a string when ToSI is used before calling this function - if type(amount) == "number" then - if (amount ==0) then formatted = "0" else - if (amount < 20 and (amount * 10)%10 ~=0) then - if displayPlusMinus then formatted = strFormat("%+.1f", amount) - else formatted = strFormat("%.1f", amount) end - else - if displayPlusMinus then formatted = strFormat("%+d", amount) - else formatted = strFormat("%d", amount) end - end - end - else - formatted = amount .. "" - end - - return formatted -end - ---from rooms widget by quantum -local function ToSI(num) - if type(num) ~= 'number' then - return 'Tooltip wacky error #55' - end - if (num == 0) then - return "0" - else - local absNum = abs(num) - if (absNum < 0.001) then - return strFormat("%.1fu", 1000000 * num) - elseif (absNum < 1) then - return strFormat("%.1f", num) - elseif (absNum < 1000) then - return strFormat("%.0f", num) - elseif (absNum < 1000000) then - return strFormat("%.1fk", 0.001 * num) - else - return strFormat("%.1fM", 0.000001 * num) - end - end -end - -local function numformat(num) - return comma_value(num) -end - -local function AdjustWindow(window) - local nx - if (0 > window.x) then - nx = 0 - elseif (window.x + window.width > screen0.width) then - nx = screen0.width - window.width - end - - local ny - if (0 > window.y) then - ny = 0 - elseif (window.y + window.height > screen0.height) then - ny = screen0.height - window.height - end - - if (nx or ny) then - window:SetPos(nx,ny) - end -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function CloseButtonFunc(self) - self.parent.parent:Dispose() -end -local function CloseButtonFunc2(self) - self.parent.parent.parent:Dispose() -end - -local function CloseButton(width) - return Button:New{ - caption = 'Close', - OnMouseUp = { CloseButtonFunc }, - width=width, - height = B_HEIGHT, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } -end - -local UnitDefByHumanName_cache = {} -local function GetUnitDefByHumanName(humanName) - local cached_udef = UnitDefByHumanName_cache[humanName] - if (cached_udef ~= nil) then - return cached_udef - end - -- uncomment the altResult stuff to allow a non-exact match - --local altResult - - for _,ud in pairs(UnitDefs) do - if (ud.humanName == humanName) then - UnitDefByHumanName_cache[humanName] = ud - return ud - --elseif (ud.humanName:find(humanName)) then - -- altResult = altResult or ud - end - end - --if altResult then - -- UnitDefByHumanName_cache[humanName] = altResult - -- return altResult - --end - - UnitDefByHumanName_cache[humanName] = false - return false -end - - -local function getHelpText(unitDef, lang) - local suffix = (lang == 'en') and '' or ('_' .. lang) - return unitDef.customParams and unitDef.customParams['helptext' .. suffix] - or unitDef.customParams.helptext - or "No help text available for this unit." -end - - -local function getDescription(unitDef, lang) - if not lang or lang == 'en' then - return unitDef.tooltip - end - local suffix = ('_' .. lang) - return unitDef.customParams and unitDef.customParams['description' .. suffix] or unitDef.tooltip or 'Description error' -end - -local function weapons2Table(cells, weaponStats, ws, merw, index) - local cells = cells - local mainweapon = merw and merw[index] - if ws.isShield then - cells[#cells+1] = ws.wname - cells[#cells+1] = '' - cells[#cells+1] = ' - Strength:' - cells[#cells+1] = ws.power - cells[#cells+1] = ' - Regen:' - cells[#cells+1] = ws.regen - cells[#cells+1] = ' - Energy/second:' - cells[#cells+1] = ws.regenE - cells[#cells+1] = ' - Radius:' - cells[#cells+1] = ws.radius - - cells[#cells+1] = '' - cells[#cells+1] = '' - elseif not ws.slaveTo then - if mainweapon then - for i=1, #mainweapon do - wsm = weaponStats[mainweapon[i]] - ws.damw = ws.damw + wsm.bestTypeDamagew - ws.dpsw = ws.dpsw + wsm.dpsw - ws.dam = ws.dam + wsm.bestTypeDamage - ws.dps = ws.dps + wsm.dps - end - end - -- multiply paralyze damage by 3 due to armor.txt - ws.damw = ws.damw * 3 - ws.dpsw = ws.dpsw * 3 - - local dps_str, dam_str = '', '' - if ws.dps > 0 then - dam_str = dam_str .. numformat(ws.dam,2) - dps_str = dps_str .. numformat(ws.dps,2) - end - if ws.dpsw > 0 then - if dps_str ~= '' then - dps_str = dps_str .. ' || ' - dam_str = dam_str .. ' || ' - end - dam_str = dam_str .. numformat(ws.damw,2) .. ' (P)' - dps_str = dps_str .. numformat(ws.dpsw,2) .. ' (P)' - end - - cells[#cells+1] = ws.wname - cells[#cells+1] = '' - cells[#cells+1] = ' - Damage:' - cells[#cells+1] = dam_str - cells[#cells+1] = ' - Reloadtime:' - cells[#cells+1] = string.format("%.1f", ws.reloadtime) ..'s' - cells[#cells+1] = ' - Damage/second:' - cells[#cells+1] = dps_str - cells[#cells+1] = ' - Range:' - cells[#cells+1] = numformat(ws.range,2) - - cells[#cells+1] = '' - cells[#cells+1] = '' - - end - return cells -end - -local function printWeapons(unitDef) - local weaponStats = {} - local bestDamage, bestDamageIndex, bestTypeDamage = 0,0,0 - - local merw = {} - - local wd = WeaponDefs - if not wd then return false end - - for i=1, #unitDef.weapons do - local weapon = unitDef.weapons[i] - local weaponID = weapon.weaponDef - local weaponDef = WeaponDefs[weaponID] - - local weaponName = weaponDef.description - - if (weaponName) then - local wsTemp = {} - if weaponDef.isShield then - wsTemp.wname = weaponDef.description or 'NoName Weapon' - wsTemp.isShield = true - wsTemp.radius = weaponDef.shieldRadius - wsTemp.power = weaponDef.shieldPower - wsTemp.regen = weaponDef.shieldPowerRegen - wsTemp.regenE = weaponDef.shieldPowerRegenEnergy - else - wsTemp.slaveTo = (weapon.slavedTo ~= 0) and weapon.slavedTo or nil - - if wsTemp.slaveTo then - merw[wsTemp.slaveTo] = merw[wsTemp.slaveTo] or {} - merw[wsTemp.slaveTo][#(merw[wsTemp.slaveTo])+1] = i - end - wsTemp.bestTypeDamage = 0 - wsTemp.bestTypeDamagew = 0 - wsTemp.paralyzer = weaponDef.paralyzer - for key, val in pairs(weaponDef.damages) do - --[[ - if (wsTemp.bestTypeDamage <= (damage+0) and not wsTemp.paralyzer) - or (wsTemp.bestTypeDamagew <= (damage+0) and wsTemp.paralyzer) - then - - if wsTemp.paralyzer then - wsTemp.bestTypeDamagew = (damage+0) - else - wsTemp.bestTypeDamage = (damage+0) - end - --]] - if key == 0 then - if wsTemp.paralyzer then - wsTemp.bestTypeDamagew = val - else - wsTemp.bestTypeDamage = val - end - - wsTemp.burst = weaponDef.salvoSize or 1 - wsTemp.projectiles = weaponDef.projectiles or 1 - wsTemp.dam = 0 - wsTemp.damw = 0 - if wsTemp.paralyzer then - wsTemp.damw = wsTemp.bestTypeDamagew * wsTemp.burst * wsTemp.projectiles - else - wsTemp.dam = wsTemp.bestTypeDamage * wsTemp.burst * wsTemp.projectiles - end - wsTemp.reloadtime = weaponDef.reload or '' - wsTemp.airWeapon = weaponDef.toAirWeapon or false - wsTemp.range = weaponDef.range or '' - wsTemp.wname = weaponDef.description or 'NoName Weapon' - wsTemp.dps = 0 - wsTemp.dpsw = 0 - if wsTemp.reloadtime ~= '' and wsTemp.reloadtime > 0 then - if wsTemp.paralyzer then - wsTemp.dpsw = math.floor(wsTemp.damw/wsTemp.reloadtime + 0.5) - else - wsTemp.dps = math.floor(wsTemp.dam/wsTemp.reloadtime + 0.5) - end - end - --echo('test', unitDef.unitname, wsTemp.wname, wsTemp.bestTypeDamage, i) - if wsTemp.dam > bestDamage then - bestDamage = wsTemp.dam - bestDamageIndex = i - end - if wsTemp.damw > bestDamage then - bestDamage = wsTemp.damw - bestDamageIndex = i - end - - end - end - end - if not wsTemp.wname - or wsTemp.wname:find('fake') - or wsTemp.wname:find('Fake') - or wsTemp.wname:find('NoWeapon') - then - weaponStats[i] = false - else - weaponStats[i] = wsTemp - end - end - end - - local cells = {} - - for index,ws in pairs(weaponStats) do - --if not ignoreweapon[unitDef.name] or not ignoreweapon[unitDef.name][index] then - if ws then - cells = weapons2Table(cells, weaponStats, ws, merw, index) - end - --end - end - - return cells -end - -local function printunitinfo(ud, lang, buttonWidth) - local icons = { - Image:New{ - file2 = (WG.GetBuildIconFrame)and(WG.GetBuildIconFrame(ud)), - file = "#" .. ud.id, - keepAspect = true; - height = 40; - width = 40; - }, - } - if ud.iconType ~= 'default' then - icons[#icons + 1] = - Image:New{ - file=icontypes and icontypes[(ud and ud.iconType or "default")].bitmap - or 'icons/'.. ud.iconType ..iconFormat, - height=40, - width=40, - } - end - - local helptextbox = TextBox:New{ - text = getHelpText(ud, lang), - textColor = color.stats_fg, - width = '100%', - height = '100%', - padding = { 1, 1, 1, 1 }, - } - - local statschildren = {} - - -- stuff for modular commanders - local commModules, commCost - if ud.customParams.commtype then - commModules = WG.GetCommModules and WG.GetCommModules(ud.id) - commCost = ud.customParams.cost or (WG.GetCommUnitInfo and WG.GetCommUnitInfo(ud.id) and WG.GetCommUnitInfo(ud.id).cost) - end - local cost = numformat(ud.metalCost) - if commCost then - cost = cost .. ' (' .. numformat(commCost) .. ')' - end - - statschildren[#statschildren+1] = Label:New{ caption = 'STATS', textColor = color.stats_header, } - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header, } - - statschildren[#statschildren+1] = Label:New{ caption = 'Cost: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = cost, textColor = color.stats_fg, } - - statschildren[#statschildren+1] = Label:New{ caption = 'Max HP: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = numformat(ud.health), textColor = color.stats_fg, } - - if ud.speed > 0 then - statschildren[#statschildren+1] = Label:New{ caption = 'Speed: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = numformat(ud.speed/Game.gameSpeed,2), textColor = color.stats_fg, } - end - - if ud.energyMake > 0 then - statschildren[#statschildren+1] = Label:New{ caption = 'Energy: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = '+' .. numformat(ud.energyMake,2), textColor = color.stats_fg, } - end - if ud.energyUpkeep < 0 then - statschildren[#statschildren+1] = Label:New{ caption = 'Energy: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = '+' .. numformat(ud.energyUpkeep,2):sub(2), textColor = color.stats_fg, } - end - - if ud.buildSpeed > 0 then - statschildren[#statschildren+1] = Label:New{ caption = 'Buildpower: ', textColor = color.stats_fg, } - statschildren[#statschildren+1] = Label:New{ caption = numformat(ud.buildSpeed,2), textColor = color.stats_fg, } - end - - - if commModules then - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - statschildren[#statschildren+1] = Label:New{ caption = 'MODULES', textColor = color.stats_header, } - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - for i=1, #commModules do - statschildren[#statschildren+1] = Label:New{ caption = commModules[i], textColor = color.stats_fg,} - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_fg,} - end - end - - - local cells = printWeapons(ud) - - if cells and #cells > 0 then - - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - - statschildren[#statschildren+1] = Label:New{ caption = 'WEAPONS', textColor = color.stats_header,} - statschildren[#statschildren+1] = Label:New{ caption = '', textColor = color.stats_header,} - for i=1, #cells do - statschildren[#statschildren+1] = Label:New{ caption = cells[i], textColor = color.stats_fg, } - end - end - - local stack_icons = StackPanel:New{ - autoArrangeV = false, - padding = {1,1,1,1}, - itemPadding = {1,1,1,1}, - itemMargin = {1,1,1,1}, - height = 100, - width = 50, - resizeItems = false, - children = icons, - } - - local stack_stats = Grid:New{ - columns=2, - autoArrangeV = false, - --height = (#statschildren/2)*statschildren[1].height, - height = (#statschildren/2)*15, - - width = '100%', - children = statschildren, - y = 1, - padding = {1,1,1,1}, - itemPadding = {1,1,1,1}, - itemMargin = {1,1,1,1}, - } - - local helptext_stack = StackPanel:New{ - resizeItems = false, - orientation = 'vertical', - autoArrangeV = false, - autoArrangeH = false, - centerItems = false, - right = 60, - x = 1, - --width = 200, - --height = '100%', - autosize=true, - resizeItems = false, - children = { helptextbox, stack_stats, }, - } - return - { - StackPanel:New{ - resizeItems = false, - orientation = 'horizontal', - autoArrangeV = false, - autoArrangeH = false, - centerItems = false, - padding = {1,1,1,1}, - itemPadding = {1,1,1,1}, - itemMargin = {1,1,1,1}, - --height = 400 , - autosize=true, - y = 1, - width = '100%', - children = { helptext_stack, stack_icons, }, - }, - } - -end - -local function tooltipBreakdown(tooltip) - local unitname = nil - - if tooltip:find('Build', 1, true) == 1 then - local start,fin = tooltip:find([[ - ]], 1, true) - if start and fin then - local unitHumanName - local buildType - if (tooltip:find('Build Unit:', 1, true) == 1) then - buildType = 'buildunit' - unitHumanName = tooltip:sub(13,start-1) - else - buildType = 'build' - unitHumanName = tooltip:sub(8,start-1) - end - local udef = GetUnitDefByHumanName(unitHumanName) - - return udef or false - - end - - elseif tooltip:find('Morph', 1, true) == 1 then - local unitHumanName = tooltip:gsub('Morph into a (.*)(time).*', '%1'):gsub('[^%a \-]', '') - local udef = GetUnitDefByHumanName(unitHumanName) - return udef or false - - elseif tooltip:find('Selected', 1, true) == 1 then - local start,fin = tooltip:find([[ - ]], 1, true) - if start and fin then - local unitHumanName = tooltip:sub(11,start-1) - local udef = GetUnitDefByHumanName(unitHumanName) - return udef or false - end - end - - return false -end - ----------------------------------------------------------------- - -local function hideWindow(window) - if not window then return end - window:SetPos(-1000, -1000) - window.visible = false -end ---[[ -local function showWindow(window, x, y) - window.visible = true - if x then - window:SetPos(x,y) - end -end ---]] -local function KillStatsWindow(num) - statswindows[num]:Dispose() - statswindows[num] = nil -end - -local function MakeStatsWindow(ud, x,y) - hideWindow(window_unitcontext) - - local y = scrH-y - local x = x - - local window_width = 450 - local window_height = 450 - - local num = #statswindows+1 - - local children = { - ScrollPanel:New{ - --horizontalScrollbar = false, - x=0,y=15, - width='100%', - bottom = B_HEIGHT*2, - padding = {2,2,2,2}, - children = printunitinfo(ud, WG.lang or 'en', window_width) , - }, - Button:New{ - caption = 'Close', - OnMouseUp = { function(self) KillStatsWindow(num) end }, - - x=0, - height=B_HEIGHT, - right=10, - bottom=1, - - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } - } - - if window_unitstats then - window_unitstats:Dispose() - end - - statswindows[num] = Window:New{ - x = x, - y = y, - width = window_width, - height = window_height, - resizable = true, - parent = screen0, - backgroundColor = color.stats_bg, - - minWidth = 250, - minHeight = 300, - - caption = ud.humanName ..' - '.. getDescription(ud, WG.lang or 'en'), - - children = children, - } - AdjustWindow(statswindows[num]) - -end - -local function PriceWindow(unitID, action) - local window_width = 250 - - local header = 'Offer For Sale' - local command = '$sell:' - local cancelText = 'Cancel Sale' - if action == 'buy' then - header = 'Offer To Buy' - command = '$buy :' - cancelText = 'Cancel Offer' - elseif action == 'bounty' then - header = 'Place Bounty (Cannot cancel!)' - command = '$bounty:' - end - - local children = {} - children[#children+1] = Label:New{ caption = header, width=window_width, height=B_HEIGHT, textColor = color.context_header,} - - local grid_children = {} - - local dollar_amounts = {50,100,200,500,1000,2000,5000,10000, 0} - for i=1, #dollar_amounts do - local dollar_amount = dollar_amounts[i] - local caption, func - if action == 'bounty' then - if dollar_amount ~= 0 then - caption = '$' .. dollar_amount - func = function() spSendLuaRulesMsg( command .. unitID .. '|' .. dollar_amount ) end - end - else - caption = dollar_amount == 0 and cancelText or '$' .. dollar_amount - func = function() spSendLuaRulesMsg( command .. unitID .. '|' .. dollar_amount) end - end - if caption then - grid_children[#grid_children+1] = Button:New{ - caption = caption, - OnMouseUp = { func, CloseButtonFunc2 }, - width=window_width, - height=B_HEIGHT, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } - end - end - --local grid_height = (B_HEIGHT)* #grid_children /3 - local grid_height = (B_HEIGHT)* 3 - local price_grid = Grid:New{ - --rows = 3, - columns = 3, - resizeItems=true, - width = window_width, - height = grid_height, - padding = {0,0,0,0}, - itemPadding = {2,2,2,2}, - itemMargin = {0,0,0,0}, - - children = grid_children, - } - - children[#children+1] = price_grid - - children[#children+1] = Label:New{ caption = '', width=window_width, height=B_HEIGHT, autosize=false,} - - children[#children+1] = CloseButton(window_width) - - local window_height = (B_HEIGHT) * (#children-1) + grid_height - - local stack1 = StackPanel:New{ - centerItems = false, - resizeItems=false, - width = window_width, - height = window_height, - padding = {0,0,0,0}, - itemPadding = {2,2,2,2}, - itemMargin = {0,0,0,0}, - children = children, - } - - local window = Window:New{ - x = scrW/2, - y = scrH/2, - clientWidth = window_width, - clientHeight = window_height, - resizable = false, - parent = screen0, - backgroundColor = color.context_bg, - children = {stack1}, - } -end - -local function MakeUnitContextMenu(unitID,x,y) - --hideWindow(window_unitstats) - - local udid = spGetUnitDefID(unitID) - local ud = UnitDefs[udid] - if not ud then return end - local alliance = spGetUnitAllyTeam(unitID) - local team = spGetUnitTeam(unitID) - local _, player = spGetTeamInfo(team) - local playerName = spGetPlayerInfo(player) or 'noname' - local teamColor = {spGetTeamColor(team)} - - local window_width = 200 - --local buttonWidth = window_width - 0 - - - local children = { - Label:New{ caption = ud.humanName ..' - '.. getDescription(ud, WG.lang or 'en'), width=window_width, textColor = color.context_header,}, - Label:New{ caption = 'Player: ' .. playerName, width=window_width, textColor=teamColor }, - Label:New{ caption = 'Alliance - ' .. alliance .. ' Team - ' .. team, width=window_width ,textColor = color.context_fg,}, - - Button:New{ - caption = 'Unit Info', - OnMouseUp = { function() MakeStatsWindow(ud,x,y) end }, - width=window_width, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - }, - } - local y = scrH-y - local x = x - - if marketandbounty then - if team == myTeamID then - children[#children+1] = Button:New{ - caption = 'Offer For Sale', - OnMouseUp = { function(self) PriceWindow(unitID, 'sell') end }, - width=window_width, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } - else - children[#children+1] = Button:New{ - caption = 'Offer To Buy', - OnMouseUp = { function(self) PriceWindow(unitID, 'buy') end }, - width=window_width, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } - end - if myAlliance ~= alliance then - children[#children+1] = Button:New{ - caption = 'Place Bounty', - OnMouseUp = { function(self) PriceWindow(unitID, 'bounty') end }, - width=window_width, - backgroundColor=color.sub_back_bg, - textColor=color.sub_back_fg, - } - end - end - - - if ceasefires and myAlliance ~= alliance then - window_height = window_height + B_HEIGHT*2 - children[#children+1] = Button:New{ caption = 'Vote for ceasefire', OnMouseUp = { function() spSendLuaRulesMsg('cf:y'..alliance) end }, width=window_width} - children[#children+1] = Button:New{ caption = 'Break ceasefire/unvote', OnMouseUp = { function() spSendLuaRulesMsg('cf:n'..alliance) spSendLuaRulesMsg('cf:b'..alliance) end }, width=window_width} - end - children[#children+1] = CloseButton() - - local window_height = (B_HEIGHT)* #children - - if window_unitcontext then - window_unitcontext:Dispose() - end - local stack1 = StackPanel:New{ - centerItems = false, - --autoArrangeV = true, - --autoArrangeH = true, - resizeItems=true, - width = window_width, - height = window_height, - padding = {0,0,0,0}, - itemPadding = {2,2,2,2}, - itemMargin = {0,0,0,0}, - children = children, - } - - window_unitcontext = Window:New{ - x = x, - y = y, - clientWidth = window_width, - clientHeight = window_height, - resizable = false, - parent = screen0, - backgroundColor = color.context_bg, - children = {stack1}, - } - AdjustWindow(window_unitcontext) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - - -function widget:MousePress(x,y,button) - - if button ~= 1 then return end - - local alt, ctrl, meta, shift = spGetModKeyState() - - if meta then - local cur_ttstr = screen0.currentTooltip or spGetCurrentTooltip() - local ud = tooltipBreakdown(cur_ttstr) - - local _,cmd_id = Spring.GetActiveCommand() - - if cmd_id then - return false - end - - if ud then - MakeStatsWindow(ud,x,y) - return true - end - - local type, data = spTraceScreenRay(x, y) - if (type == 'unit') then - local unitID = data - local ud = UnitDefs[Spring.GetUnitDefID(unitID)] - if ud then - MakeStatsWindow(ud,x,y) - end - -- FIXME enable later when does not show useless info MakeUnitContextMenu(unitID,x,y) - return true - elseif (type == 'feature') then - local fdid = Spring.GetFeatureDefID(data) - local fd = fdid and FeatureDefs[fdid] - local feature_name = fd and fd.name - if feature_name then - - local live_name - if fd and fd.customParams and fd.customParams.unit then - live_name = fd.customParams.unit - else - live_name = feature_name:gsub('([^_]*).*', '%1') - end - - local ud = UnitDefNames[live_name] - if ud then - MakeStatsWindow(ud,x,y) - return true - end - end - end - - end - - --[[ - if window_unitcontext and window_unitcontext.visible and (not screen0.hoveredControl or not screen0.hoveredControl:IsDescendantOf(window_unitcontext)) then - hideWindow(window_unitcontext) - return true - end - - if window_unitstats and window_unitstats.visible and (not screen0.hoveredControl or not screen0.hoveredControl:IsDescendantOf(window_unitstats)) then - hideWindow(window_unitstats) - return true - end - --]] -end - -function widget:ViewResize(vsx, vsy) - scrW = vsx - scrH = vsy -end - - -function widget:Initialize() - - if (not WG.Chili) then - widgetHandler:RemoveWidget(widget) - return - end - - -- setup Chili - Chili = WG.Chili - Button = Chili.Button - Label = Chili.Label - Window = Chili.Window - ScrollPanel = Chili.ScrollPanel - StackPanel = Chili.StackPanel - Grid = Chili.Grid - TextBox = Chili.TextBox - Image = Chili.Image - screen0 = Chili.Screen0 - - widget:ViewResize(Spring.GetViewGeometry()) - -end - -function widget:Shutdown() -end \ No newline at end of file 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_darkening.lua b/LuaUI/Widgets_Evo/gui_darkening.lua deleted file mode 100644 index c19b3d1ea..000000000 --- a/LuaUI/Widgets_Evo/gui_darkening.lua +++ /dev/null @@ -1,121 +0,0 @@ --- $Id: gui_darkening.lua 3171 2008-11-06 09:06:29Z det $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Darkening", - desc = "Adds a new '/luaui darkening %float%' (and '/luaui inc_dark' & '/luaui dec_dark') command.", - author = "jK", - date = "Nov 22, 2007", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - }; -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local mapChanged = false; -local darkeningMap; -local darkening = 0; - -local LUA_BRIGHT_MAP_FILE = "LuaUI/Config/darkeningMap.lua"; - -local vsx, vsy; -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX; - vsy = viewSizeY; -end -widget:ViewResize(widgetHandler:GetViewSizes()); - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function UpdateCallins() - if (darkening>0) then - widgetHandler:UpdateCallIn('DrawWorldPreUnit'); - else - widgetHandler:RemoveCallIn('DrawWorldPreUnit'); - end -end - - -function SetDarkening(_,_,words) - mapChanged = true; - darkening = tonumber(words[1]); - darkeningMap[Game.mapName] = darkening; - UpdateCallins(); -end - -function IncDarkening() - mapChanged = true; - darkening = darkening + 0.1; - darkeningMap[Game.mapName] = darkening; - UpdateCallins(); -end - -function DecDarkening() - mapChanged = true; - darkening = darkening - 0.1; - darkeningMap[Game.mapName] = darkening; - UpdateCallins(); -end - - -function fileexists( file ) - local f = io.open( file, "r" ); - if f then - io.close( f ); - return true; - else - return false; - end -end - -function widget:Initialize() - if fileexists(LUA_BRIGHT_MAP_FILE) then - darkeningMap = include("Config/darkeningMap.lua"); - end - if (brightnessMap) then - darkening = darkeningMap[Game.mapName]; - else - darkeningMap = {}; - end - UpdateCallins(); - - local help = " [0..1]: sets map darkening"; - widgetHandler:AddAction("darkening", SetDarkening, nil, "t"); - widgetHandler:AddAction("inc_dark", IncDarkening, nil, "t"); - widgetHandler:AddAction("dec_dark", DecDarkening, nil, "t"); -end - - -function widget:Shutdown() - if mapChanged then - include("savetable.lua"); - table.save(darkeningMap, LUA_BRIGHT_MAP_FILE); - end - - widgetHandler:RemoveAction("darkening"); - widgetHandler:RemoveAction("inc_dark"); - widgetHandler:RemoveAction("dec_dark"); -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:DrawWorldPreUnit() - local drawMode = Spring.GetMapDrawMode() - if (drawMode=="height") or (drawMode=="path") then return end - - gl.MatrixMode(GL.PROJECTION); gl.PushMatrix(); gl.LoadIdentity() - gl.MatrixMode(GL.MODELVIEW); gl.PushMatrix(); gl.LoadIdentity() - - gl.Color(0,0,0,darkening); - gl.Rect(-1,1,1,-1); - - gl.MatrixMode(GL.PROJECTION); gl.PopMatrix() - gl.MatrixMode(GL.MODELVIEW); gl.PopMatrix() -end diff --git a/LuaUI/Widgets_Evo/gui_discord.lua b/LuaUI/Widgets_Evo/gui_discord.lua new file mode 100644 index 000000000..5f042fe7f --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_discord.lua @@ -0,0 +1,185 @@ +function widget:GetInfo() + return { + name = "Discord icon", + desc = "located next to advplayerlist", + author = "Floris", + date = "24 july 2016", + license = "GNU GPL, v2 or later", + layer = -4, -- set to -5 to draw mascotte on top of advplayerlist + enabled = false, + } +end + +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 +local glGetTextWidth = gl.GetTextWidth +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 + +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 + +--------------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------------- + +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) +end + +local parentPos = {} +function updatePosition(force) + if (WG['advplayerlist_api'] ~= nil) then + local prevPos = parentPos + 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 + usedImgSize = iconSize * parentPos[5] + xPos = parentPos[4] + yPos = parentPos[1] + local vsx,vsy = Spring.GetViewGeometry() + if xPos > vsx then xPos = vsx end + if (prevPos[1] == nil or prevPos[1] ~= parentPos[1] or prevPos[2] ~= parentPos[2] or prevPos[5] ~= parentPos[5]) or force then + createList(usedImgSize) + end + end +end + +function widget:Initialize() + if spGetGameFrame() > 0 then widgetHandler:RemoveWidget(self) return end + updatePosition() +end + +function widget:Shutdown() + if drawlist[1] ~= nil then + glDeleteList(drawlist[1]) + end + gl.DeleteFont(font) +end + +function widget:GameFrame(n) + if n > 0 then + widgetHandler:RemoveWidget(self) + 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() + glTranslate(xPos, yPos, 0) + if mouseover then + gl.Color(1,1,1,1) + else + gl.Color(1,1,1,0.55) + end + glCallList(drawlist[1]) + local mx,my = Spring.GetMouseState() + if widget:IsAbove(mx,my) then + 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 + 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 + Spring.SendCommands("our discord server: https://"..discordLink) + widgetHandler:RemoveWidget(self) + return true + end +end + +function widget:MouseRelease(mx, my, mb) + if mb == 1 and isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then + updatePosition(true) + end +end + +function widget:IsAbove(mx, my) + if isInBox(mx, my, {xPos-usedImgSize, yPos, xPos, yPos+usedImgSize}) then + mouseover = true + end + return mouseover +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\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_energy_display.lua b/LuaUI/Widgets_Evo/gui_energy_display.lua deleted file mode 100644 index 5e92c0f6c..000000000 --- a/LuaUI/Widgets_Evo/gui_energy_display.lua +++ /dev/null @@ -1,68 +0,0 @@ -function widget:GetInfo() - return { - name = "Energy Text Display", - desc = "Displays energy economy parameters as text", - author = "Code_Man", - date = "11/4/2016", - license = "MIT X11", - layer = 1, - enabled = true - } -end - ---Disable Default Resources Bar -Spring.SendCommands({"resbar 0"}) - -local white = "\255\255\255\255" -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 str = "" -local FontSize = 15 -local vsx, vsy = gl.GetViewSizes() -local posx, posy = vsx - 245, vsy -40 - ---Spring.GetTeamResources --- ( number teamID, string "metal" | "energy" ) -> --- nil | number currentLevel, (ec) --- number storage, (es) --- number pull, (ep) --- number income, (ei) --- number expense, (ee) --- number share, --- number sent, --- number received - -function widget:GameFrame(n) - local myTeamID = Spring.GetMyTeamID() - local ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") - ---Normal Energy Display --- str = yellow .. "Energy:" .. orange .. " ± " .. tostring(math.round(ei - ee)) .. green .. " +" .. tostring(math.round(ei)) .. white .. "/" .. red .. "-" .. tostring(math.round(ep)) .. white .. " (" .. tostring(math.round(ec)) .. "/" .. tostring(math.round(es)) .. ")" - ---Custom Evo Energy display ---This doesn't display the total possible amount because it is 100000 possible in storage - str = yellow .. "Energy:" .. orange .. " ± " .. tostring(math.round(ei - ee)) .. green .. " +" .. tostring(math.round(ei)) .. white .. "/" .. red .. "-" .. tostring(math.round(ep)) .. white .. " (" .. yellow .. tostring(math.round(ec)).. white .. "/" .. tostring(math.round(es)) .. ")" -end - -function widget:TweakMousePress(x, y, button) - if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then - return true - end -end - -function widget:TweakMouseMove(x, y, dx, dy, button) - if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then - posx = x - posy = y - end -end - -function DrawScreen() - local vsx, vsy = gl.GetViewSizes() - gl.Text(str, posx, posy, FontSize, "on") -end ---------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua b/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua new file mode 100644 index 000000000..fcca550ed --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_evo_defaultgui_layout.lua @@ -0,0 +1,370 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_EVO_Layout.lua +-- author: jK +-- based heavily on code by: Dave Rodgers (aka trepan) +-- orig. filename: layout.lua +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "EVO Default Engine Gui Layout", + desc = "Sets the control panel to EVO default", + author = "jK and trepan, mixed by lurker and DeadnightWarrior", + date = "Feb 3, 2008", + license = "GNU GPL, v2 or later", + layer = -10, + handler = true, + enabled = false -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +include("colors.h.lua") + +local floor = math.floor +local glColor = gl.Color +local glRect = gl.Rect +local glTexRect = gl.TexRect +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 glTexture = gl.Texture + +local langSuffix = Spring.GetConfigString('Language', 'fr') +local l10nName = 'L10N/commands_' .. langSuffix .. '.lua' +local success, translations = pcall(VFS.Include, l10nName) +if (not success) then + translations = nil +end + +-- for DefaultHandler +local FrameTex = "bitmaps/icons/frame_slate_128x96.png" +local FrameScale = "&0.099x0.132&" +local PageNumTex = "bitmaps/icons/frame_slate_128x96.png" +local btns = {} + +if (false) then -- disable textured buttons? + FrameTex = "" + PageNumTex = "" +end + +local PageNumCmd = { + name = "1", + iconname = PageNumTexture, + tooltip = "Active Page Number\n(click to toggle buildiconsfirst)", + actions = { "buildiconsfirst", "firstmenu" } +} + +local engineVersion = (Game and Game.version) or (Engine and Engine.version) or "Engine version error" +if (engineVersion:find("0.75")==nil)or(engineVersion:find("svn")) then + PageNumCmd.texture = PageNumCmd.iconname + PageNumCmd.iconname = nil +end + +local X, Y +local TweakPosX, TweakPosY +local btnOffset, txtOffset +local bntTxtSize, TweakTitleSize +local rowSize, btnSize +-------------------------------------------------------------------------------- + +local function CustomLayoutHandler(xIcons, yIcons, cmdCount, commands) + + widgetHandler.commands = commands + --widgetHandler.commands.n = cmdCount + widgetHandler:CommandsChanged() + + -- FIXME: custom commands + if (cmdCount <= 0) then + return "", xIcons, yIcons, {}, {}, {}, {}, {}, {}, {}, {} + end + + local menuName = '' + local removeCmds = {} + local customCmds = widgetHandler.customCommands + local onlyTexCmds = {} + local reTexCmds = {} + local reNamedCmds = {} + local reTooltipCmds = {} + local reParamsCmds = {} + local iconList = {} + + local ipp + if cmdCount-2 > xIcons * (yIcons+1) then + ipp = (xIcons * yIcons) -- iconsPerPage + else + ipp = (xIcons * (yIcons + 1)) + end + + local activePage = Spring.GetActivePage() + + local prevCmd = cmdCount - 1 + local nextCmd = cmdCount - 0 + local prevPos = ipp - xIcons + local nextPos = ipp - 1 + if (prevCmd >= 1) then reTexCmds[prevCmd] = FrameTex end + if (nextCmd >= 1) then reTexCmds[nextCmd] = FrameTex end + + local pageNumCmd = -1 + local pageNumPos = (prevPos + nextPos) / 2 + if (xIcons > 2) then + local color + if (commands[1].id < 0) then color = GreenStr else color = RedStr end + local activePage = activePage or 0 + local pageNum = '' .. (activePage + 1) .. '' + PageNumCmd.name = color .. ' ' .. pageNum .. ' ' + table.insert(customCmds, PageNumCmd) + pageNumCmd = cmdCount + 1 + end + + local pos = 0; + local firstSpecial = ipp - xIcons + + for cmdSlot = 1, (cmdCount - 2) do + + -- fill the last row with special buttons + while (math.fmod(pos, ipp) >= firstSpecial) do + pos = pos + 1 + end + + local onLastRow = (math.abs(math.fmod(pos, ipp)) < 0.1) + + if (onLastRow) then + local pageStart = math.floor(ipp * math.floor(pos / ipp)) + if (pageStart > 0) then + iconList[prevPos + pageStart] = prevCmd + iconList[nextPos + pageStart] = nextCmd + if (pageNumCmd > 0) then + iconList[pageNumPos + pageStart] = pageNumCmd + end + end + if (pageStart == ipp) then + iconList[prevPos] = prevCmd + iconList[nextPos] = nextCmd + if (pageNumCmd > 0) then + iconList[pageNumPos] = pageNumCmd + end + end + end + + -- add the command icons to iconList + local cmd = commands[cmdSlot] + + if ((cmd ~= nil) and (cmd.hidden == false)) then + + iconList[pos] = cmdSlot + pos = pos + 1 + + local cmdTex = cmd.texture or "" -- FIXME 0.75b2 compatibility + + if (translations) then + local trans = translations[cmd.id] + if (trans) then + reTooltipCmds[cmdSlot] = trans.desc + if (not trans.params) then + if (cmd.id ~= CMD.STOCKPILE) then + reNamedCmds[cmdSlot] = trans.name + end + else + local num = tonumber(cmd.params[1]) + if (num) then + num = (num + 1) + cmd.params[num] = trans.params[num] + reParamsCmds[cmdSlot] = cmd.params + end + end + end + end + end + end + + return menuName, xIcons, yIcons, + removeCmds, customCmds, + onlyTexCmds, reTexCmds, + reNamedCmds, reTooltipCmds, reParamsCmds, + iconList +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local Echo = Spring.Echo + +local commonConfig = { +"outlinefont 1", +"dropShadows 1", +"useOptionLEDs 1", +"textureAlpha 1.0", +"frameAlpha 0.5", +"selectGaps 1", +"selectThrough 1", + +"xPos 0", +"yPos 0.097", +"ySelectionPos 0.094", +"prevPageSlot auto", +"deadIconSlot none", +"nextPageSlot auto", +"textBorder 0.0025", +"iconBorder 0.0005", +"frameBorder 0.000", + +} + +local config = {} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + widgetHandler:DisableWidget("Red Build/Order Menu") + if not btns.x or not btns.y then + btns = {x = 5, y = 11} + end + X, Y = Spring.GetViewGeometry() + local maxButSize=(1-0.097-0.31-4/Y)/btns.y-.0005 + TweakPosX = floor((maxButSize+0.0005)*btns.x*Y*1.12) + TweakPosY = floor(maxButSize*btns.y*Y) + btnOffset, txtOffset = floor(12*Y/1200), floor(48*Y/1200) + bntTxtSize = 22*Y/1200 + TweakTitleSize = 10*Y/1200 + rowSize, btnSize = floor(25*Y/1200), floor(80*Y/1200) + + + config = { + "xIcons " .. btns.x, + "yIcons " .. btns.y, + "xSelectionPos " .. TweakPosX/3/X, + "xIconSize " .. maxButSize*1.12*Y/X, + "yIconSize " .. maxButSize + } + + --[[ + -- 4:3 Screen aspect ratio + if (X/Y == 4/3) then + config = {"xIconSize 0.054375", "yIconSize 0.0725"} + + -- 5:4 Screen aspect ratio + elseif (X/Y == 5/4) then + config = {"xIconSize 0.05704", "yIconSize 0.0713"} + + -- 16:9 Screen aspect ratio + elseif ((X/Y == 16/9) or (X==1366 and Y==768)) then + config = {"xIconSize 0.040", "yIconSize 0.0643"} + + -- 16:10 Screen aspect ratio + elseif (X/Y == 16/10) then + config = {"xIconSize 0.044", "yIconSize 0.0675"} + else + Echo("Control Panel Widget doens't support your " ..X.. "x" ..Y.. " resolution.") + Echo("Call back your default Layout.") + Shutdown() + return + end + --]] + + local file = io.open(LUAUI_DIRNAME .. 'ctrlpanelImp.txt', 'w') + + for k, v in pairs(commonConfig) do + file:write(v .. '\n') + end + for k, v in pairs(config) do + file:write(v .. '\n') + end + + file:close() + Spring.SendCommands('ctrlpanel ' .. LUAUI_DIRNAME .. 'ctrlpanelImp.txt') + + widgetHandler:ConfigLayoutHandler(CustomLayoutHandler) +end + +function widget:Shutdown() + Spring.SendCommands({"ctrlpanel " .. LUAUI_DIRNAME .. "ctrlpanel.txt"}) + widgetHandler:ConfigLayoutHandler(true) +end + + +-- LuaUI Tweak mode + +local TweakAbove + +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() + glTranslate(TweakPosX, TweakPosY, 0) + glColor(0, 0, 0, 0.5) + for i=0,2 do + glRect(btnOffset,rowSize*i+i,btnSize,rowSize*(i+1)) + end + glColor(1, 1, 1, 1) + glBeginText() + glText('Select button configuration', btnOffset, 3*rowSize+3, TweakTitleSize, 'd') + glText('3 x 8', txtOffset, 2*rowSize, bntTxtSize, 'cd') + glText('4 x 9', txtOffset, rowSize, bntTxtSize, 'cd') + glText('5 x 11', txtOffset, 0, bntTxtSize, 'cd') + glEndText() + glPopMatrix() +end + +function widget:TweakIsAbove(x,y) + if x>TweakPosX and y>TweakPosY and x xIcons * (yIcons+1) then - ipp = (xIcons * yIcons) -- iconsPerPage - else - ipp = (xIcons * (yIcons + 1)) - end - - local activePage = Spring.GetActivePage() - - local prevCmd = cmdCount - 1 - local nextCmd = cmdCount - 0 - local prevPos = ipp - xIcons - local nextPos = ipp - 1 - if (prevCmd >= 1) then reTexCmds[prevCmd] = FrameTex end - if (nextCmd >= 1) then reTexCmds[nextCmd] = FrameTex end - - local pageNumCmd = -1 - local pageNumPos = (prevPos + nextPos) / 2 - if (xIcons > 2) then - local color - if (commands[1].id < 0) then color = GreenStr else color = RedStr end - local activePage = activePage or 0 - local pageNum = '' .. (activePage + 1) .. '' - PageNumCmd.name = color .. ' ' .. pageNum .. ' ' - table.insert(customCmds, PageNumCmd) - pageNumCmd = cmdCount + 1 - end - - local pos = 0; - local firstSpecial = ipp - xIcons - - for cmdSlot = 1, (cmdCount - 2) do - - -- fill the last row with special buttons - while (math.fmod(pos, ipp) >= firstSpecial) do - pos = pos + 1 - end - - local onLastRow = (math.abs(math.fmod(pos, ipp)) < 0.1) - - if (onLastRow) then - local pageStart = math.floor(ipp * math.floor(pos / ipp)) - if (pageStart > 0) then - iconList[prevPos + pageStart] = prevCmd - iconList[nextPos + pageStart] = nextCmd - if (pageNumCmd > 0) then - iconList[pageNumPos + pageStart] = pageNumCmd - end - end - if (pageStart == ipp) then - iconList[prevPos] = prevCmd - iconList[nextPos] = nextCmd - if (pageNumCmd > 0) then - iconList[pageNumPos] = pageNumCmd - end - end - end - - -- add the command icons to iconList - local cmd = commands[cmdSlot] - - if ((cmd ~= nil) and (cmd.hidden == false)) then - - iconList[pos] = cmdSlot - pos = pos + 1 - - local cmdTex = cmd.texture or "" -- FIXME 0.75b2 compatibility - - if (translations) then - local trans = translations[cmd.id] - if (trans) then - reTooltipCmds[cmdSlot] = trans.desc - if (not trans.params) then - if (cmd.id ~= CMD.STOCKPILE) then - reNamedCmds[cmdSlot] = trans.name - end - else - local num = tonumber(cmd.params[1]) - if (num) then - num = (num + 1) - cmd.params[num] = trans.params[num] - reParamsCmds[cmdSlot] = cmd.params - end - end - end - end - end - end - - return menuName, xIcons, yIcons, - removeCmds, customCmds, - onlyTexCmds, reTexCmds, - reNamedCmds, reTooltipCmds, reParamsCmds, - iconList -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local Echo = Spring.Echo - -local commonConfig = { -"outlinefont 1", -"dropShadows 1", -"useOptionLEDs 1", -"textureAlpha 1.0", -"frameAlpha 0.5", -"selectGaps 1", -"selectThrough 1", - -"xPos 0", -"yPos 0.097", -"ySelectionPos 0.094", -"prevPageSlot auto", -"deadIconSlot none", -"nextPageSlot auto", -"textBorder 0.0025", -"iconBorder 0.0005", -"frameBorder 0.000", - -} - -local config = {} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - widgetHandler:DisableWidget("Red Build/Order Menu") - if not btns.x or not btns.y then - btns = {x = 5, y = 11} - end - X, Y = Spring.GetViewGeometry() - local maxButSize=(1-0.097-0.31-4/Y)/btns.y-.0005 - TweakPosX = floor((maxButSize+0.0005)*btns.x*Y*1.12) - TweakPosY = floor(maxButSize*btns.y*Y) - btnOffset, txtOffset = floor(12*Y/1200), floor(48*Y/1200) - bntTxtSize = 22*Y/1200 - TweakTitleSize = 10*Y/1200 - rowSize, btnSize = floor(25*Y/1200), floor(80*Y/1200) - - - config = { - "xIcons " .. btns.x, - "yIcons " .. btns.y, - "xSelectionPos " .. TweakPosX/3/X, - "xIconSize " .. maxButSize*1.12*Y/X, - "yIconSize " .. maxButSize - } - - --[[ - -- 4:3 Screen aspect ratio - if (X/Y == 4/3) then - config = {"xIconSize 0.054375", "yIconSize 0.0725"} - - -- 5:4 Screen aspect ratio - elseif (X/Y == 5/4) then - config = {"xIconSize 0.05704", "yIconSize 0.0713"} - - -- 16:9 Screen aspect ratio - elseif ((X/Y == 16/9) or (X==1366 and Y==768)) then - config = {"xIconSize 0.040", "yIconSize 0.0643"} - - -- 16:10 Screen aspect ratio - elseif (X/Y == 16/10) then - config = {"xIconSize 0.044", "yIconSize 0.0675"} - else - Echo("Control Panel Widget doens't support your " ..X.. "x" ..Y.. " resolution.") - Echo("Call back your default Layout.") - Shutdown() - return - end - --]] - - local file = io.open(LUAUI_DIRNAME .. 'ctrlpanelImp.txt', 'w') - - for k, v in pairs(commonConfig) do - file:write(v .. '\n') - end - for k, v in pairs(config) do - file:write(v .. '\n') - end - - file:close() - Spring.SendCommands('ctrlpanel ' .. LUAUI_DIRNAME .. 'ctrlpanelImp.txt') - - widgetHandler:ConfigLayoutHandler(CustomLayoutHandler) -end - -function widget:Shutdown() - Spring.SendCommands({"ctrlpanel " .. LUAUI_DIRNAME .. "ctrlpanel.txt"}) - widgetHandler:ConfigLayoutHandler(true) -end - - --- LuaUI Tweak mode - -local TweakAbove - -function widget:DrawScreen() --Tweak Mode doesn't work without it -end -function widget:TweakDrawScreen() - glPushMatrix() - glTranslate(TweakPosX, TweakPosY, 0) - glColor(0, 0, 0, 0.5) - for i=0,2 do - glRect(btnOffset,rowSize*i+i,btnSize,rowSize*(i+1)) - end - glColor(1, 1, 1, 1) - glBeginText() - glText('Select button configuration', btnOffset, 3*rowSize+3, TweakTitleSize, 'd') - glText('3 x 8', txtOffset, 2*rowSize, bntTxtSize, 'cd') - glText('4 x 9', txtOffset, rowSize, bntTxtSize, 'cd') - glText('5 x 11', txtOffset, 0, bntTxtSize, 'cd') - glEndText() - glPopMatrix() -end - -function widget:TweakIsAbove(x,y) - if x>TweakPosX and y>TweakPosY and x= 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 new file mode 100644 index 000000000..64670fcb9 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_fancy_selected_units.lua @@ -0,0 +1,852 @@ +function widget:GetInfo() + return { + name = "Fancy Selected Units", --(took 'UnitShapes' widget as a base for this one) + desc = "Shows which units are selected", + author = "Floris", + date = "04.04.2014", + license = "GNU GPL, v2 or later", + layer = -50, + enabled = true + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local currentRotationAngle = 0 +local currentRotationAngleOpposite = 0 +local previousOsClock = os.clock() + +local animationMultiplier = 1 +local animationMultiplierInner = 1 +local animationMultiplierAdd = true + +local clearquad +local shapes = {} +local degrot = {} + +local rad_con = 180 / math.pi +local math_acos = math.acos + +local UNITCONF = {} + +local selectedUnits = {} +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 checkSelectionChanges = true +local limitDetails = false + +local glCallList = gl.CallList +local glDrawListAtUnit = gl.DrawListAtUnit + +local spIsUnitSelected = Spring.IsUnitSelected +local spGetSelectedUnitsCount = Spring.GetSelectedUnitsCount +local spGetSelectedUnitsSorted = Spring.GetSelectedUnitsSorted +local spGetUnitTeam = Spring.GetUnitTeam +local spLoadCmdColorsConfig = Spring.LoadCmdColorsConfig +local spGetUnitDirection = Spring.GetUnitDirection +local spGetCameraPosition = Spring.GetCameraPosition +local spGetUnitViewPosition = Spring.GetUnitViewPosition +local spGetUnitDefID = Spring.GetUnitDefID +local spIsGUIHidden = Spring.IsGUIHidden +local spGetTeamColor = Spring.GetTeamColor +local spGetUnitHealth = Spring.GetUnitHealth +local spGetUnitIsCloaked = Spring.GetUnitIsCloaked +local spUnitInView = Spring.IsUnitInView +local spIsUnitVisible = Spring.IsUnitVisible + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +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.55, -- how much teamcolor used for the base platter + + -- opacity + spotterOpacity = 0.95, + baseOpacity = 0.15, -- setting to 0: wont be rendered + firstLineOpacity = 1, + + -- animation + selectionStartAnimation = true, + selectionStartAnimationTime = 0.05, + selectionStartAnimationScale = 0.82, + -- selectionStartAnimationScale = 1.17, + selectionEndAnimation = true, + selectionEndAnimationTime = 0.07, + selectionEndAnimationScale = 0.9, + --selectionEndAnimationScale = 1.17, + + -- animation + rotationSpeed = 2.5, + animationSpeed = 0.00045, -- speed of scaling up/down inner and outer lines + animateSpotterSize = true, + maxAnimationMultiplier = 1.012, + minAnimationMultiplier = 0.99, + + -- circle shape + solidCirclePieces = 32, + circlePieces = 64, + circlePieceDetail = 1, + circleSpaceUsage = 1, + circleInnerOffset = 0, + + -- size + innersize = 1.7, + selectinner = 1.66, + outersize = 1.8, +} + +------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------ + + +local function SetupCommandColors(state) + spLoadCmdColorsConfig('unitBox 0 1 0 ' .. (state and 1 or 0)) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Creating polygons: +local function CreateDisplayLists(callback) + local displayLists = {} + + 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 + + + +local function DrawCircleLine(innersize, outersize) + gl.BeginEnd(GL.QUADS, function() + local detailPartWidth, a1,a2,a3,a4 + local width = OPTIONS.circleSpaceUsage + local detail = OPTIONS.circlePieceDetail + + 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.circleInnerOffset+detailPartWidth - (width / detail)) * radstep) + a4 = ((i+OPTIONS.circleInnerOffset+detailPartWidth) * radstep) + + --outer (fadein) + gl.Vertex(math.sin(a4)*innersize, 1, math.cos(a4)*innersize) + gl.Vertex(math.sin(a3)*innersize, 1, math.cos(a3)*innersize) + --outer (fadeout) + gl.Vertex(math.sin(a1)*outersize, 1, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2)*outersize, 1, math.cos(a2)*outersize) + end + end + end) +end + +local function DrawCircleSolid(size) + gl.BeginEnd(GL.TRIANGLE_FAN, function() + local pieces = OPTIONS.solidCirclePieces + local radstep = (2.0 * math.pi) / pieces + local a1 + if (color) then + gl.Color(color) + end + gl.Vertex(0, 1, 0) + for i = 0, pieces do + a1 = (i * radstep) + gl.Vertex(math.sin(a1)*size, 1, math.cos(a1)*size) + end + end) +end + +local function CreateCircleLists() + local callback = {} + + function callback.fading(innersize, outersize) + return gl.CreateList(DrawCircleLine, innersize, outersize) + end + + function callback.solid(color, size) + return gl.CreateList(DrawCircleSolid, size) + end + + shapes.circle = CreateDisplayLists(callback) +end + + + +local function DrawSquareLine(innersize, outersize) + + gl.BeginEnd(GL.QUADS, function() + local radstep = (2.0 * math.pi) / 4 + local width, a1,a2,a2_2 + for i = 1, 4 do + -- straight piece + width = 0.7 + i = i + 0.65 + a1 = (i * radstep) + a2 = ((i+width) * radstep) + + gl.Vertex(math.sin(a2)*innersize, 1, math.cos(a2)*innersize) + gl.Vertex(math.sin(a1)*innersize, 1, math.cos(a1)*innersize) + + gl.Vertex(math.sin(a1)*outersize, 1, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2)*outersize, 1, math.cos(a2)*outersize) + + -- corner piece + width = 0.3 + i = i + 3 + a1 = (i * radstep) + a2 = ((i+width) * radstep) + i = i -0.6 + a2_2 = ((i+width) * radstep) + + gl.Vertex(math.sin(a2_2)*innersize, 1, math.cos(a2_2)*innersize) + gl.Vertex(math.sin(a1)*innersize, 1, math.cos(a1)*innersize) + + gl.Vertex(math.sin(a1)*outersize, 1, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2_2)*outersize, 1, math.cos(a2_2)*outersize) + end + end) +end + +local function DrawSquareSolid(size) + gl.BeginEnd(GL.TRIANGLE_FAN, function() + local width, a1,a2,a2_2 + local radstep = (2.0 * math.pi) / 4 + + for i = 1, 4 do + --straight piece + width = 0.7 + i = i + 0.65 + 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 + 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 + + end) +end + +local function CreateSquareLists() + + local callback = {} + + function callback.fading(innersize, outersize) + return gl.CreateList(DrawSquareLine, innersize, outersize) + end + + function callback.solid(color, size) + return gl.CreateList(DrawSquareSolid, size) + end + shapes.square = CreateDisplayLists(callback) +end + + + +local function DrawTriangleLine(innersize, outersize) + gl.BeginEnd(GL.QUADS, function() + local width, a1,a2,a2_2 + local radstep = (2.0 * math.pi) / 3 + + for i = 1, 3 do + --straight piece + width = 0.75 + i = i + 0.625 + a1 = (i * radstep) + a2 = ((i+width) * radstep) + + gl.Vertex(math.sin(a2)*innersize, 1, math.cos(a2)*innersize) + gl.Vertex(math.sin(a1)*innersize, 1, math.cos(a1)*innersize) + + gl.Vertex(math.sin(a1)*outersize, 1, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2)*outersize, 1, math.cos(a2)*outersize) + + -- corner piece + width = 0.35 + i = i + 3 + a1 = (i * radstep) + a2 = ((i+width) * radstep) + i = i -0.6 + a2_2 = ((i+width) * radstep) + + gl.Vertex(math.sin(a2_2)*innersize, 1, math.cos(a2_2)*innersize) + gl.Vertex(math.sin(a1)*innersize, 1, math.cos(a1)*innersize) + + gl.Vertex(math.sin(a1)*outersize, 1, math.cos(a1)*outersize) + gl.Vertex(math.sin(a2_2)*outersize, 1, math.cos(a2_2)*outersize) + end + + end) +end + +local function DrawTriangleSolid(size) + + gl.BeginEnd(GL.TRIANGLE_FAN, function() + + local width, a1,a2,a2_2 + local radstep = (2.0 * math.pi) / 3 + + for i = 1, 3 do + -- straight piece + 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.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 + + end) +end + +local function CreateTriangleLists() + + local callback = {} + + function callback.fading(innersize, outersize) + return gl.CreateList(DrawTriangleLine, innersize, outersize) + end + + function callback.solid(color, size) + return gl.CreateList(DrawTriangleSolid, size) + end + shapes.triangle = CreateDisplayLists(callback) +end + + +local function DestroyShape(shape) + gl.DeleteList(shape.select) + gl.DeleteList(shape.inner) + gl.DeleteList(shape.large) + gl.DeleteList(shape.shape) +end + + + +function widget:Initialize() + + loadConfig() + + clearquad = gl.CreateList(function() + local size = 1000 + gl.BeginEnd(GL.QUADS, function() + gl.Vertex( -size,0, -size) + gl.Vertex( Game.mapSizeX+size,0, -size) + gl.Vertex( Game.mapSizeX+size,0, Game.mapSizeZ+size) + gl.Vertex( -size,0, Game.mapSizeZ+size) + end) + end) + + currentClock = os.clock() + + WG['fancyselectedunits'] = {} + WG['fancyselectedunits'].getOpacity = function() + return OPTIONS.spotterOpacity + end + WG['fancyselectedunits'].setOpacity = function(value) + OPTIONS.spotterOpacity = value + OPTIONS.spotterOpacity = value + end + WG['fancyselectedunits'].getBaseOpacity = function() + return OPTIONS.baseOpacity + end + WG['fancyselectedunits'].setBaseOpacity = function(value) + OPTIONS.baseOpacity = value + OPTIONS.baseOpacity = value + end + WG['fancyselectedunits'].getTeamcolorOpacity = function() + return OPTIONS.teamcolorOpacity + end + WG['fancyselectedunits'].setTeamcolorOpacity = function(value) + OPTIONS.teamcolorOpacity = value + OPTIONS.teamcolorOpacity = value + end + + SetupCommandColors(false) +end + + +function loadConfig() + + CreateCircleLists() + CreateSquareLists() + CreateTriangleLists() + + SetUnitConf() +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.25 + + local name, shape, xscale, zscale, scale, xsize, zsize, weaponcount, shapeName + for udid, unitDef in pairs(UnitDefs) do + xsize, zsize = unitDef.xsize, unitDef.zsize + scale = scaleFactor*( xsize^2 + zsize^2 )^0.5 + name = unitDef.name + + + if (unitDef.isBuilding or unitDef.isFactory or unitDef.speed==0) then + shapeName = 'square' + shape = shapes.square + xscale, zscale = rectangleFactor * xsize, rectangleFactor * zsize + elseif (unitDef.isAirUnit) then + shapeName = 'triangle' + shape = shapes.triangle + 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 + xscale, zscale = scale, scale + end + + local radius = Spring.GetUnitDefDimensions(udid).radius + xscale = (xscale*0.7) + (radius/5) + zscale = (zscale*0.7) + (radius/5) + + weaponcount = table.getn(unitDef.weapons) + + UNITCONF[udid] = {name=name, shape=shape, shapeName=shapeName, xscale=xscale, zscale=zscale, weaponcount=weaponcount} + end +end + + +function widget:Shutdown() + if WG['teamplatter'] == nil and WG['highlightselunits'] == nil then + SetupCommandColors(true) + end + WG['fancyselectedunits'] = nil + + gl.DeleteList(clearquad) + + for _, shape in pairs(shapes) do + DestroyShape(shape) + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +function GetUsedRotationAngle(unitID, shapeName, opposite) + if (shapeName == 'circle') then + if opposite then + return currentRotationAngleOpposite + else + return currentRotationAngle + end + else + return degrot[unitID] + end +end + + +local selectedUnitsSorted = Spring.GetSelectedUnitsSorted() +local selectedUnitsCount = Spring.GetSelectedUnitsCount() +function widget:SelectionChanged(sel) + checkSelectionChanges = true +end + + +local function updateSelectedUnitsData() + + -- 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 + + -- 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 + + -- 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 + + -- 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 + 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, 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) + + for unitID,unitParams in pairs(selectedUnits[teamID]) do + + unit = UNITCONF[unitParams.udid] + changedScale = 1 + usedAlpha = a + + 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 (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 + degrot[unitID] = 180 + math_acos(dirz) * rad_con + end + end + end + end + end + + 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 + + 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) + end + 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 + 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 + end +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() + + -- animate rotation + if OPTIONS.rotationSpeed > 0 then + local angleDifference = (OPTIONS.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 + + -- animate scale + 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.maxAnimationMultiplier) then + animationMultiplier = OPTIONS.maxAnimationMultiplier + animationMultiplierInner = OPTIONS.minAnimationMultiplier + animationMultiplierAdd = false + end + else + animationMultiplier = animationMultiplier - addedMultiplierValue + animationMultiplierInner = animationMultiplierInner + addedMultiplierValue + 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 + for teamID,_ in pairs(selectedUnits) do + + gl.ColorMask(false, false, false, true) + gl.BlendFunc(GL.ONE, GL.ONE) + gl.Color(1,1,1,1) + glCallList(clearquad) + + -- draw base background layer + 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.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', 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.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) + gl.ColorMask(true,true,true,true) + gl.BlendFunc(GL.ONE_MINUS_DST_ALPHA, GL.DST_ALPHA) + glCallList(clearquad) + end + + -- draw line layer + a = 1 - (OPTIONS.firstLineOpacity * OPTIONS.spotterOpacity) + + 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(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) + + -- Does not need to be drawn per Unit anymore + glCallList(clearquad) + end + + gl.ColorMask(false,false,false,false) + gl.Color(1,1,1,1) + gl.PopAttrib() +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-- Config related + +function widget:GetConfigData(data) + savedTable = {} + savedTable.spotterOpacity = OPTIONS.spotterOpacity + savedTable.baseOpacity = OPTIONS.baseOpacity + savedTable.teamcolorOpacity = OPTIONS.teamcolorOpacity + + return savedTable +end + +function widget:SetConfigData(data) + 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 7194b5f34..000000000 --- a/LuaUI/Widgets_Evo/gui_fancy_teamplatter.lua +++ /dev/null @@ -1,187 +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) - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- 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 teamID = spGetUnitTeam(unitID) - if circlePolys[teamID] ~= nil then - local unitDefIDValue = spGetUnitDefID(unitID) - 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 new file mode 100644 index 000000000..3694d22e9 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_gameinfo.lua @@ -0,0 +1,667 @@ + +function widget:GetInfo() + return { + name = "Game info", + desc = "", + author = "Floris", + date = "May 2017", + license = "", + 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 = 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 titlecolor = "\255\255\205\100" +local keycolor = "" +local valuecolor = "\255\255\255\255" +local valuegreycolor = "\255\180\180\180" +local vcolor = valuegreycolor +local separator = "::" + +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 +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 +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 + content = content .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.."\n" +else + content = content .. keycolor.."Wind speed"..separator..valuegreycolor..Game.windMin..valuegreycolor.." - "..valuegreycolor..Game.windMax.."\n" +end +if Game.waterDamage == 0 then + vcolor = valuegreycolor +else + vcolor = valuecolor +end +content = content .. keycolor.."Water damage"..separator..vcolor..Game.waterDamage .. keycolor.."\n" +content = content .. "\n" + +-- modoptions +local defaultModoptions = VFS.Include("modoptions.lua") +local modoptionsDefault = {} + +for key, value in pairs(defaultModoptions) do + local v = value.def + if value.def == false then + v = 0 + elseif value.def == true then + v = 1 + end + modoptionsDefault[tostring(value.key)] = tostring(v) +end +-- modoptions.lua doesnt contain engine modoptions: maxunits, pathfinder, startmetal, startenergy, disablemapdamage, fixedallies +modoptionsDefault['maxspeed'] = '3' +modoptionsDefault['minspeed'] = '0.3' +--modoptionsDefault['pathfinder'] = 'normal' +modoptionsDefault['startmetal'] = '1000' +modoptionsDefault['startenergy'] = '1000' +modoptionsDefault['fixedallies'] = '1' +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 + unchangedModoptions[key] = value + else + changedModoptions[key] = value + end +end +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 + content = content .. keycolor..key..separator..valuecolor..value.."\n" +end +for key, value in pairs(unchangedModoptions) do + content = content .. keycolor..key..separator..valuegreycolor..value.."\n" +end + + +local bgMargin = 6 + +local closeButtonSize = 30 +local screenHeight = 520-bgMargin-bgMargin +local screenWidth = 400-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 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 + 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() +local amNewbie = (Spring.GetTeamRulesParam(myTeamID, 'isNewbie') == 1) + +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-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 + +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.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 + 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 content 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, '::') then + local cmd = string.match(line, '^[ \+a-zA-Z0-9_-]*') -- escaping the escape: \\ doesnt work in lua !#$@&*()&5$# + local descr = string.sub(line, string.len(string.match(line, '^[ \+a-zA-Z0-9_-]*::'))+1) + descr, numLines = font:WrapText(descr, (width-scrollbarMargin-scrollbarWidth - 250 - 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(descr, x+250, y-(lineSeparator+fontSizeTitle)*j, fontSizeLine, "n") + j = j + (numLines - 1) + else + -- line + font:SetTextColor(fontColorLine) + line = "" .. line + line, numLines = font:WrapText(line, (width-scrollbarMargin-scrollbarWidth)*(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 = "Game info" + local titleFontSize = 18 + 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) + 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 + 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) + 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, 'gameinfo') + end + showOnceMore = false + + else + if WG['guishader'] then + WG['guishader'].DeleteDlist('gameinfo') + 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: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 + + +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['teamstats'] ~= nil) then + WG['teamstats'].toggle(false) + end +end + +function toggle() + show = not show + if show then + hideWindows() + end +end + +function widget:Initialize() + if content then + + widgetHandler:AddAction("customgameinfo", toggle) + Spring.SendCommands("unbind any+i gameinfo") + Spring.SendCommands("unbind i gameinfo") + Spring.SendCommands("bind i customgameinfo") + + WG['gameinfo'] = {} + WG['gameinfo'].toggle = function(state) + if state ~= nil then + show = state + else + show = not show + end + if show then + hideWindows() + end + end + + -- somehow there are a few characters added at the start that we need to remove + --content = string.sub(content, 4) + + -- store changelog into array + 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(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 + 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 71bfc6a18..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,15 +18,16 @@ 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 = 2.4 -local barWidth = 12 --// (barWidth)x2 total width!!! +local barHeight = 5 +local barWidth = 24 --// (barWidth)x2 total width!!! local barAlpha = 0.85 local barOutlineAlpha = 0.8 local barInnerAlpha = 0.5 @@ -45,6 +46,7 @@ local drawFeatureBarPercentage = 0 -- true: commanders always will local choppedCornerSize = 0.45 local outlineSize = 0.75 local drawFullHealthBars = false +local unitHpThreshold = 0.99 local drawFeatureHealth = true local featureTitlesAlpha = featureBarAlpha * titlesAlpha/barAlpha @@ -53,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.17 - 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 @@ -65,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 @@ -73,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] = { @@ -117,6 +124,19 @@ local barColors = { reclaim = { 0.75,0.75,0.75,barValueAlpha }, } +local ignoreUnits = {} +for udefID,def in ipairs(UnitDefs) do + if def.customParams['nohealthbars'] then + ignoreUnits[udefID] = true + end +end +local ignoreFeatures = {} +for fdefID,def in pairs(FeatureDefs) do + if def.customParams['nohealthbars'] then + ignoreFeatures[fdefID] = true + end +end + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -129,6 +149,7 @@ local cx, cy, cz = 0,0,0; --// camera pos local smoothheight = 0 local paraUnits = {}; +local UnitMorphs = {}; local barShader; local barDList; @@ -140,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 @@ -184,62 +206,8 @@ function drawBarGl() if OPTIONS[currentOption].showOutline then heightAddition = outlineSize end - -- add glow - 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 + gl.PushMatrix() + gl.Scale(barScale,barScale,barScale) if (OPTIONS[currentOption].choppedCorners) then gl.BeginEnd(GL.QUADS,function() @@ -425,11 +393,12 @@ function drawBarGl() gl.Vertex(barWidth,barHeight,0, 1); end) end + gl.PopMatrix() 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 @@ -659,15 +628,17 @@ function init() --// create bar shader if (gl.CreateShader) then - + + if (barShader) then + gl.DeleteShader(barShader) + end barShader = gl.CreateShader({ vertex = [[ + #version 120 #define barColor gl_MultiTexCoord1 #define progress gl_MultiTexCoord2.x #define offset gl_MultiTexCoord2.y - - uniform float glowAlpha; void main() { @@ -676,79 +647,83 @@ function init() gl_TexCoord[0]= gl_TextureMatrix[0]*gl_MultiTexCoord0; gl_FrontColor = gl_Color; gl_Position = ftransform(); - return; + //return; -- commenting out this line fixes glitchy healthbars on intel gfx } - - if (gl_Vertex.w==1) { + vec4 vertex = gl_Vertex; + if (vertex.w==1) { gl_FrontColor = gl_Color; - if (gl_Vertex.z>0.0) { - gl_Vertex.x -= (1.0-progress)*gl_Vertex.z; - gl_Vertex.z = 0.0; + if (vertex.z>0.0) { + vertex.x -= (1.0-progress)*gl_Vertex.z; + vertex.z = 0.0; } - }else if (gl_Vertex.w==-2 ) { - gl_FrontColor = vec4(barColor.rgb,barColor.a*glowAlpha); + }else if (vertex.w==-2 ) { + gl_FrontColor = vec4(barColor.rgb,barColor.a); if (gl_Vertex.z>1.0) { - gl_Vertex.x += progress*gl_Vertex.z; - gl_Vertex.z = 0.0; + vertex.x += progress*gl_Vertex.z; + vertex.z = 0.0; } - gl_Vertex.w = 1; + vertex.w = 1; - }else if (gl_Vertex.w==-3 ) { - gl_FrontColor = vec4(barColor.rgb,barColor.a*(glowAlpha/1.5)); + }else if (vertex.w==-3 ) { + gl_FrontColor = vec4(barColor.rgb,barColor.a); - if (gl_Vertex.z>1.0) { - gl_Vertex.x += progress*gl_Vertex.z; - gl_Vertex.z = 0.0; + if (vertex.z>1.0) { + vertex.x += progress*gl_Vertex.z; + vertex.z = 0.0; } - gl_Vertex.w = 1; + vertex.w = 1; - }else if (gl_Vertex.w==-4 ) { + }else if (vertex.w==-4 ) { gl_FrontColor = vec4(barColor.rgb,0); if (gl_Vertex.z>1.0) { - gl_Vertex.x += progress*gl_Vertex.z; - gl_Vertex.z = 0.0; + vertex.x += progress*gl_Vertex.z; + vertex.z = 0.0; } - gl_Vertex.w = 1; + vertex.w = 1; - }else if (gl_Vertex.w>1 ) { + }else if (vertex.w>1 ) { if (progress >= 0.92) { // smooth out because else the bar wil overlap and look ugly at the end point - gl_FrontColor = float4(gl_Color[0]+(barColor.r/4),gl_Color[1]+(barColor.g/4),gl_Color[2]+(barColor.b/4),((0.08-(progress-0.92))*12.5)*gl_Color[3]); + gl_FrontColor = vec4(gl_Color[0]+(barColor.r/4),gl_Color[1]+(barColor.g/4),gl_Color[2]+(barColor.b/4),((0.08-(progress-0.92))*12.5)*gl_Color[3]); }else{ - gl_FrontColor = float4(gl_Color[0]+(barColor.r/4),gl_Color[1]+(barColor.g/4),gl_Color[2]+(barColor.b/4),gl_Color[3]); + gl_FrontColor = vec4(gl_Color[0]+(barColor.r/4),gl_Color[1]+(barColor.g/4),gl_Color[2]+(barColor.b/4),gl_Color[3]); } - if (gl_Vertex.z>0.0) { - gl_Vertex.x -= (1.0-progress)*gl_Vertex.z; - gl_Vertex.z = 0.0; + if (vertex.z>0.0) { + vertex.x -= (1.0-progress)*gl_Vertex.z; + vertex.z = 0.0; } - gl_Vertex.w = 1.0; + vertex.w = 1.0; }else{ - if (gl_Vertex.y>0.0) { + if (vertex.y>0.0) { gl_FrontColor = vec4(barColor.rgb*1.8,barColor.a); }else{ - gl_FrontColor = vec4(barColor.rgb*0.9,barColor.a); + gl_FrontColor = vec4(barColor.rgb*0.85,barColor.a); } - if (gl_Vertex.z>1.0) { - gl_Vertex.x += progress*gl_Vertex.z; - gl_Vertex.z = 0.0; + if (vertex.z>1.0) { + vertex.x += progress*gl_Vertex.z; + vertex.z = 0.0; } - gl_Vertex.w = 1.0; + vertex.w = 1.0; } - gl_Vertex.y += offset; - gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; + vertex.y += offset; + gl_Position = gl_ModelViewProjectionMatrix*vertex; } ]], uniform = { - glowAlpha = glowAlpha, + }, }); - - + + if (barShader) then + if (barDList) then + gl.DeleteList(barDList) + gl.DeleteList(barFeatureDList) + end barDList = gl.CreateList(drawBarGl) barFeatureDList = gl.CreateList(drawFeatureBarGl) end @@ -773,6 +748,25 @@ function widget:Initialize() Spring.SendCommands({"unbind f9 showhealthbars"}) Spring.SendCommands({"bind f9 luaui showhealthbars"}) + --// link morph callins + widgetHandler:RegisterGlobal('MorphUpdate', MorphUpdate) + widgetHandler:RegisterGlobal('MorphFinished', MorphFinished) + widgetHandler:RegisterGlobal('MorphStart', MorphStart) + widgetHandler:RegisterGlobal('MorphStop', MorphStop) + + --// deactivate cheesy progress text + widgetHandler:RegisterGlobal('MorphDrawProgress', function() return true end) + + + WG['healthbars'] = {} + WG['healthbars'].getScale = function() + return barScale + end + WG['healthbars'].setScale = function(value) + barScale = value + init() + end + init() end @@ -784,6 +778,13 @@ function widget:Shutdown() Spring.SendCommands({"bind f9 showhealthbars"}) --Spring.SendCommands({"showhealthbars 1"}) -- don't re-enable, nobody ever uses engines built in healthbars --Spring.SendCommands({"showrezbars 1"}) + + widgetHandler:DeregisterGlobal('MorphUpdate', MorphUpdate) + widgetHandler:DeregisterGlobal('MorphFinished', MorphFinished) + widgetHandler:DeregisterGlobal('MorphStart', MorphStart) + widgetHandler:DeregisterGlobal('MorphStop', MorphStop) + + widgetHandler:DeregisterGlobal('MorphDrawProgress') if (barShader) then gl.DeleteShader(barShader) @@ -927,16 +928,20 @@ do local barInfo = bars[i] DrawUnitBar(yoffset,barInfo.progress,barInfo.color) if (fullText) then + + gl.PushMatrix() + gl.Scale(barScale,barScale,barScale) if (barShader) then glMyText(1) end glColor(1,1,1,barAlpha) - glText(barInfo.text,barStart,yoffset-outlineSize,4,"r") + glText(barInfo.text,barStart,yoffset-outlineSize,4,"ro") if (drawBarTitles and barInfo.title ~= "health") then glColor(1,1,1,titlesAlpha) - glText(barInfo.title,0,yoffset-outlineSize,2.35,"cd") + glText(barInfo.title,0,yoffset-outlineSize,4.70,"cdo") end if (barShader) then glMyText(0) end + gl.PopMatrix() end yoffset = yoffset - barHeightL end @@ -957,7 +962,7 @@ do end if (drawBarTitles and barInfo.title ~= "health") then glColor(1,1,1,featureTitlesAlpha) - glText(barInfo.title,0,yoffset-outlineSize,2.35,"cd") + glText(barInfo.title,0,yoffset-outlineSize,4.70,"cdo") end if (barShader) then glMyText(0) end end @@ -1000,8 +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, @@ -1046,7 +1054,7 @@ do end --// HEALTH - if (health) and ((drawFullHealthBars)or(hp<1)) and ((build==1)or(build-hp>=0.01)) then + if (health) and ((drawFullHealthBars)or(hp=0.01)) then hp100 = hp*100; hp100 = hp100 - hp100%1; --//same as floor(hp*100), but 10% faster if (hp100<0) then hp100=0 elseif (hp100>100) then hp100=100 end if (drawFullHealthBars)or(hp100<100) and not (hp<0) then @@ -1086,9 +1094,19 @@ do else numStockpiled = false end + + --// MORPHING + local morph = UnitMorphs[unitID] + if morph then + local infotext = '' + if (fullText and (drawBarPercentage > 0 or dist < minPercentageDistance)) then + infotext = floor(morph.progress*100)..'%' + end + AddBar("Evolving",morph.progress,"build",infotext or '') + end --// PARALYZE - if (emp>0.01)and(hp>0.01)and(emp<1e8) then + if (emp>0.01)and(hp>0.01)and(emp<1e8)and(not morph) then local stunned = GetUnitIsStunned(unitID) local infotext = '' if (stunned) then @@ -1136,6 +1154,9 @@ do glTranslate(ux, uy+ci.height, uz ) glBillboard() + --// DRAW BARS + DrawBars(fullText) + --// STOCKPILE ICON if (numStockpiled) then if (barShader) then @@ -1147,9 +1168,6 @@ do end end - --// DRAW BARS - DrawBars(fullText) - glPopMatrix() end end @@ -1178,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] = { @@ -1314,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 @@ -1322,31 +1349,24 @@ do return end - --gl.Fog(false) - glDepthTest(true) - --glDepthMask(true) - cx, cy, cz = GetCameraPosition() - --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 - - --gl.Fog(false) - --glDepthTest(true) + + 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 @@ -1356,15 +1376,15 @@ do drawFeatureInfo = true end local wx, wy, wz, dx, dy, dz, dist, featureInfo, resurrect, reclaimLeft - + if drawFeatureInfo or (featureResurrectVisibility or featureReclaimVisibility) then 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] @@ -1405,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 @@ -1425,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 @@ -1454,18 +1469,18 @@ end --//end do function widget:GetConfigData(data) savedTable = {} + savedTable.barScale = barScale savedTable.drawBarPercentage = drawBarPercentage savedTable.alwaysDrawBarPercentageForComs = alwaysDrawBarPercentageForComs - savedTable.addGlow = addGlow savedTable.currentOption = currentOption return savedTable end function widget:SetConfigData(data) - if data.drawBarPercentage ~= nil then drawBarPercentage = data.drawBarPercentage end - if data.alwaysDrawBarPercentageForComs ~= nil then alwaysDrawBarPercentageForComs = data.alwaysDrawBarPercentageForComs end - if data.addGlow ~= nil then addGlow = data.addGlow end - if data.currentOption ~= nil and OPTIONS[data.currentOption] ~= nil then currentOption = data.currentOption end + barScale = data.barScale or barScale + drawBarPercentage = data.drawBarPercentage or drawBarPercentage + alwaysDrawBarPercentageForComs = data.alwaysDrawBarPercentageForComs or alwaysDrawBarPercentageForComs + currentOption = data.currentOption or currentOption end function widget:TextCommand(command) @@ -1478,13 +1493,51 @@ 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 + +function MorphStart(unitID,morphDef) + --return false +end + +function MorphStop(unitID) + UnitMorphs[unitID] = nil +end + +function MorphFinished(unitID) + 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 new file mode 100644 index 000000000..5d1d77b45 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_mapmarks_fx.lua @@ -0,0 +1,292 @@ +function widget:GetInfo() + return { + name = "Mapmarks FX", + desc = "Adds glow/rings at map marks", + author = "Floris", + date = "7 june 2015", + 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 = 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 = {} + +local ownPlayerID = Spring.GetMyPlayerID() + +-- spring vars +local spGetPlayerInfo = Spring.GetPlayerInfo +local spGetTeamColor = Spring.GetTeamColor + +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local nicknameOpacityMultiplier = 6 -- multiplier applied to the given color opacity of the type: 'map_draw' + +local generalSize = 28 -- overall size +local generalOpacity = 0.8 -- overall opacity +local generalDuration = 1.2 -- overall duration + +local ringStartSize = 9 +local ringScale = 0.75 + +local imageDir = ":n:LuaUI/Images/mapmarksfx/" + +local types = { + map_mark = { + 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} + }, + map_draw = { + size = 0.75, + endSize = 0.2, + duration = 2, + glowColor = {1.00 ,1.00 ,1.00 ,0.15}, + ringColor = {1.00 ,1.00 ,1.00 ,0.00} + }, + map_erase = { + size = 3.5, + endSize = 0.7, + duration = 4, + glowColor = {1.00 ,1.00 ,1.00 ,0.10}, + ringColor = {1.00 ,1.00 ,1.00 ,0.00} + } +} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local commandCount = 0 +local glowDlist + + +local function DrawGroundquad(x,y,z,size) + gl.TexCoord(0,0) + gl.Vertex(x-size,y,z-size) + gl.TexCoord(0,1) + gl.Vertex(x-size,y,z+size) + gl.TexCoord(1,1) + gl.Vertex(x+size,y,z+size) + gl.TexCoord(1,0) + gl.Vertex(x+size,y,z-size) +end + +local function AddEffect(cmdType, x, y, z, osClock, unitID, playerID) + if not playerID then + playerID = false + end + local nickname,_,spec,teamID = spGetPlayerInfo(playerID,false) + local teamcolor = {} + teamcolor[1],teamcolor[2],teamcolor[3] = spGetTeamColor(teamID) + + commandCount = commandCount + 1 + commands[commandCount] = { + cmdType = cmdType, + x = x, + y = y, + z = z, + osClock = osClock, + playerID = playerID, + color = teamcolor, + spec = spec, + nickname = nickname + } +end + + +------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------ + +-- Engine Triggers + +------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------ + +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() + + glowDlist = glCreateList(function() + gl.Texture(imageDir..'glow.dds') + gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,1) + gl.Texture(false) + end) + pencilDlist = glCreateList(function() + gl.Texture(imageDir..'pencil.dds') + gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,1) + gl.Texture(false) + end) + eraserDlist = glCreateList(function() + gl.Texture(imageDir..'eraser.dds') + gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,1) + gl.Texture(false) + end) + ringDlist = glCreateList(function() + gl.Texture(imageDir..'ring.dds') + gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,1) + gl.Texture(false) + end) +end + + +function widget:Shutdown() + glDeleteList(glowDlist) + glDeleteList(pencilDlist) + glDeleteList(eraserDlist) + glDeleteList(ringDlist) + gl.DeleteFont(font) +end + + +function widget:MapDrawCmd(playerID, cmdType, x, y, z, a, b, c) + local osClock = os.clock() + if cmdType == 'point' then + AddEffect('map_mark', x, y, z, osClock, false, playerID) + elseif cmdType == 'line' then + mapDrawNicknameTime[playerID] = osClock + AddEffect('map_draw', x, y, z, osClock, false, playerID) + elseif cmdType == 'erase' then + mapEraseNicknameTime[playerID] = osClock + AddEffect('map_erase', x, y, z, osClock, false, playerID) + end +end + + +function Round(num, idp) + local mult = 10^(idp or 0) + return math.floor(num * mult + 0.5) / mult +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() + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.DepthTest(false) + 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 + durationProcess = (osClock - cmdValue.osClock) / duration + + -- remove when duration has passed + if osClock - cmdValue.osClock > duration then + + commands[cmdKey] = nil + + -- remove nicknames when user has drawn something new + elseif cmdValue.cmdType == 'map_draw' and mapDrawNicknameTime[cmdValue.playerID] ~= nil and cmdValue.osClock < mapDrawNicknameTime[cmdValue.playerID] then + + commands[cmdKey] = nil + + -- draw all + elseif types[cmdValue.cmdType].glowColor[4] > 0 or types[cmdValue.cmdType].ringColor[4] > 0 then + size = generalSize * types[cmdValue.cmdType].size + ((generalSize * types[cmdValue.cmdType].endSize - generalSize * types[cmdValue.cmdType].size) * durationProcess) + a = (1 - durationProcess) * generalOpacity + + if cmdValue.spec then + glowColor = {1,1,1,types[cmdValue.cmdType].glowColor[4]} + ringColor = {1,1,1,types[cmdValue.cmdType].ringColor[4]} + else + glowColor = {cmdValue.color[1],cmdValue.color[2],cmdValue.color[3],types[cmdValue.cmdType].glowColor[4]} + ringColor = {cmdValue.color[1],cmdValue.color[2],cmdValue.color[3],types[cmdValue.cmdType].ringColor[4]} + end + + aRing = a * ringColor[4] + a = a * glowColor[4] + + + gl.Translate(cmdValue.x, cmdValue.y, cmdValue.z) + + -- glow + if glowColor[4] > 0 then + gl.Color(glowColor[1],glowColor[2],glowColor[3],a) + gl.Scale(size*0.8,1,size*0.8) + glCallList(glowDlist) + gl.Scale(1/(size*0.8),1,1/(size*0.8)) + end + -- ring + if aRing > 0 then + gl.Color(ringColor[1],ringColor[2],ringColor[3],aRing) + ringSize = ringStartSize + (size * ringScale) * durationProcess + gl.Scale(ringSize,1,ringSize) + glCallList(ringDlist) + gl.Scale(1/ringSize,1,1/ringSize) + end + + -- draw + erase: nickname / draw icon + if cmdValue.playerID and cmdValue.playerID ~= ownPlayerID and (cmdValue.cmdType == 'map_draw' or cmdValue.cmdType == 'map_erase' and cmdValue.osClock >= mapEraseNicknameTime[cmdValue.playerID]) then + + if (cmdValue.spec) then + iconSize = 11 + gl.Color(glowColor[1],glowColor[2],glowColor[3], a * nicknameOpacityMultiplier) + + if cmdValue.cmdType == 'map_draw' then + gl.Scale(iconSize,1,iconSize) + glCallList(pencilDlist) + gl.Scale(1/iconSize,1,1/iconSize) + else + gl.Scale(iconSize,1,iconSize) + glCallList(eraserDlist) + gl.Scale(1/iconSize,1,1/iconSize) + end + + gl.PushMatrix() + gl.Billboard() + font:Begin() + font:Print(cmdValue.nickname, 0, -28, 20, "cn") + font:End() + gl.PopMatrix() + end + end + + gl.Translate(-cmdValue.x, -cmdValue.y, -cmdValue.z) + end + end + + gl.PopMatrix() + gl.Color(1,1,1,1) +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_metal_display.lua b/LuaUI/Widgets_Evo/gui_metal_display.lua deleted file mode 100644 index cf376954f..000000000 --- a/LuaUI/Widgets_Evo/gui_metal_display.lua +++ /dev/null @@ -1,67 +0,0 @@ -function widget:GetInfo() - return { - name = "Metal Text Display", - desc = "Displays metal economy parameters as text", - author = "Code_Man", - date = "11/4/2016", - license = "MIT X11", - layer = 1, - enabled = true - } -end - ---Disable Default Resources Bar -Spring.SendCommands({"resbar 0"}) - -local white = "\255\255\255\255" -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 str = "" -local FontSize = 15 -local vsx, vsy = gl.GetViewSizes() -local posx, posy = vsx - 245, vsy - 20 - - ---Spring.GetTeamResources --- ( number teamID, string "metal" | "energy" ) -> --- nil | number currentLevel, (mc) --- number storage, (ms) --- number pull, (mp) --- number income, (mi) --- number expense, (me) --- number share, --- number sent, --- number received - -function widget:GameFrame(n) - local myTeamID = Spring.GetMyTeamID() - local mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") ---Normal metal display --- str = "\255\136\197\226Metal: \255\255\135\0± " .. tostring(math.round(mi - me)) .. "\255\0\255\0 +" .. tostring(math.round(mi)) .. "\255\255\255\255/\255\255\0\0-" .. tostring(math.round(mp)) .. "\255\255\255\255 (" .. tostring(math.round(mc)) .. "/" .. tostring(math.round(ms)) .. "\255\255\255\255)" - ---Custom Evo metal display - str = skyblue .. "Metal: " .. orange .. "± " .. tostring(math.round(mi - me)) .. green .. " +" .. tostring(math.round(mi)) .. white .. "/" .. red .. "-" .. tostring(math.round(mp)) .. white .. " (" .. skyblue .. tostring(math.round(mc)) .. white .. "/" .. tostring(math.round(ms)) .. ")" -end - -function widget:TweakMousePress(x, y, button) - if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then - return true - end -end - -function widget:TweakMouseMove(x, y, dx, dy, button) - if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then - posx = x - posy = y - end -end - -function DrawScreen() - local vsx, vsy = gl.GetViewSizes() - gl.Text(str, posx, posy, FontSize, "on") -end ---------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_mouse_fx.lua b/LuaUI/Widgets_Evo/gui_mouse_fx.lua new file mode 100644 index 000000000..aac1be7ad --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_mouse_fx.lua @@ -0,0 +1,242 @@ +function widget:GetInfo() + return { + name = "Mouse FX", + desc = "Adds glow effect at mouse clicks", + author = "Floris", + date = "13 may 2015", + license = "GNU GPL, v2 or later", + layer = 2, + enabled = true, + } +end + + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local commands = {} +local mapDrawNicknameTime = {} -- this table is used to filter out previous map drawing nicknames if user has drawn something new +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.GetMouseState + +local glCreateList = gl.CreateList +local glDeleteList = gl.DeleteList +local glCallList = gl.CallList + +local diag = math.diag + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local nicknameOpacityMultiplier = 6 -- multiplier applied to the given color opacity of the type: 'map_draw' +local scaleWithCamera = true +local showMouseclicks = true + +local generalSize = 30 -- overall size +local generalOpacity = 0.8 -- overall opacity +local generalDuration = 1.2 -- overall duration + +local imageDir = ":n:LuaUI/Images/" + +local types = { + leftclick = { + size = 0.82, + endSize = 0.25, + duration = 0.85, + baseColor = {0.66 ,1 ,0.15 ,0.5} + }, + rightclick = { + size = 0.82, + endSize = 0.25, + duration = 0.85, + baseColor = {1.00 ,0.85 ,0.15 ,0.55} + }, + leftclick2 = { + size = 1.33, + endSize = 0.82, + duration = 1.65, + baseColor = {0.7 ,1 ,0.15 ,0.18} + }, + rightclick2 = { + size = 1.33, + endSize = 0.82, + duration = 1.65, + baseColor = {1.00 ,0.85 ,0.15 ,0.20} + } +} + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local commandCount = 0 +local partCache = {} +local mouseButton = false +local baseDlist + + +local function DrawGroundquad(x,y,z,size) + gl.TexCoord(0,0) + gl.Vertex(x-size,y,z-size) + gl.TexCoord(0,1) + gl.Vertex(x-size,y,z+size) + gl.TexCoord(1,1) + gl.Vertex(x+size,y,z+size) + gl.TexCoord(1,0) + gl.Vertex(x+size,y,z-size) +end + + +local function AddCommandSpotter(cmdType, x, y, z, osClock) + commandCount = commandCount + 1 + commands[commandCount] = { + cmdType = cmdType, + x = x, + y = y, + z = z, + osClock = osClock + } +end + + +------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------ + +-- Engine Triggers + +------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------ + + +function widget:Initialize() + + baseDlist = glCreateList(function() + gl.Texture(imageDir..'glow.dds') + gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,1) + gl.Texture(false) + end) +end + + +function widget:Shutdown() + + glDeleteList(baseDlist) +end + + +function widget:MousePress(x, y, button) + if button == 1 then + mouseButton = button + end + local traceType, tracedScreenRay = spTraceScreenRay(x, y, true) + if button == 3 and tracedScreenRay and tracedScreenRay[3] then + AddCommandSpotter('rightclick', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) + AddCommandSpotter('rightclick2', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) + end +end + + +function mouseRelease(x, y, button) + if showMouseclicks then + local traceType, tracedScreenRay = spTraceScreenRay(x, y, true) + if button == 1 and tracedScreenRay and tracedScreenRay[3] then + AddCommandSpotter('leftclick', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) + AddCommandSpotter('leftclick2', tracedScreenRay[1], tracedScreenRay[2], tracedScreenRay[3], os.clock()) + end + end +end + +function widget:Update() + if mouseButton ~= false then + local x,y,m1,m2,m3 = spGetMouseState() + if m1 == false and m3 == false then + mouseRelease(x,y, mouseButton) + mouseButton = 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: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) + --gl.Blending(GL.SRC_ALPHA, GL.ONE) + gl.DepthTest(false) + gl.PushMatrix() + + for cmdKey, cmdValue in pairs(commands) do + + local duration = types[cmdValue.cmdType].duration * generalDuration + local durationProcess = (osClock - cmdValue.osClock) / duration + + -- remove when duration has passed + if osClock - cmdValue.osClock > duration then + commands[cmdKey] = nil + + -- remove nicknames when user has drawn something new + elseif cmdValue.cmdType == 'map_draw' and mapDrawNicknameTime[cmdValue.playerID] ~= nil and cmdValue.osClock < mapDrawNicknameTime[cmdValue.playerID] then + + commands[cmdKey] = nil + + -- draw all + elseif types[cmdValue.cmdType].baseColor[4] > 0 then + local size = generalSize * types[cmdValue.cmdType].size + ((generalSize * types[cmdValue.cmdType].endSize - generalSize * types[cmdValue.cmdType].size) * durationProcess) + --local size = generalSize * types[cmdValue.cmdType].size + local a = (1 - durationProcess) * generalOpacity + + local baseColor = types[cmdValue.cmdType].baseColor + + a = a * baseColor[4] + + gl.Translate(cmdValue.x, cmdValue.y, cmdValue.z) + + local camDistance = diag(camX-cmdValue.x, camY-cmdValue.y, camZ-cmdValue.z) + + -- set scale (based on camera distance) + local scale = 1 + if scaleWithCamera and camZ then + scale = 0.82 + camDistance / 20000 + gl.Scale(scale,scale,scale) + end + + -- base glow + if baseColor[4] > 0 then + gl.Color(baseColor[1],baseColor[2],baseColor[3],a) + gl.Scale(size,1,size) + glCallList(baseDlist) + gl.Scale(1/size,1,1/size) + --gl.Texture(imageDir..'glow.dds') + --gl.BeginEnd(GL.QUADS,DrawGroundquad,0,0,0,size) + --gl.Texture(false) + end + if scaleWithCamera and camZ then + gl.Scale(1/scale,1/scale,1/scale) + end + gl.Translate(-cmdValue.x, -cmdValue.y, -cmdValue.z) + + end + end + + gl.PopMatrix() + gl.Scale(1,1,1) + gl.Color(1,1,1,1) +end + 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 new file mode 100644 index 000000000..e5a0ee57c --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_options.lua @@ -0,0 +1,3064 @@ + +function widget:GetInfo() +return { + name = "Options", + desc = "", + author = "Floris", + date = "September 2016", + layer = 20000, + enabled = true, + handler = true, +} +end + +--[[ +-- 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' +local paginatorclick = 'LuaUI/Sounds/buildbar_waypoint.wav' +local sliderdrag = 'LuaUI/Sounds/buildbar_rem.wav' +local selectclick = 'LuaUI/Sounds/buildbar_click.wav' +local selectunfoldclick = 'LuaUI/Sounds/buildbar_hover.wav' +local selecthoverclick = 'LuaUI/Sounds/hover.wav' +local toggleonclick = 'LuaUI/Sounds/switchon.wav' +local toggleoffclick = 'LuaUI/Sounds/switchoff.wav' + +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 backwardTex = "LuaUI/Images/backward.dds" +local forwardTex = "LuaUI/Images/forward.dds" +local glowTex = "LuaUI/Images/glow2.dds" + +local bgMargin = 6 + +local closeButtonSize = 30 +local screenHeight = 520-bgMargin-bgMargin +local screenWidth = 1050-bgMargin-bgMargin + +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 customMapSunPos = {} + +local screenX = (vsx*0.5) - (screenWidth/2) +local screenY = (vsy*0.5) + (screenHeight/2) + +local wsx,wsy,wpx,wpy = Spring.GetWindowGeometry() +local ssx,ssy,spx,spy = Spring.GetScreenGeometry() + +local spIsGUIHidden = Spring.IsGUIHidden + +local glColor = gl.Color +local glLineWidth = gl.LineWidth +local glPolygonMode = gl.PolygonMode +local glRect = gl.Rect +local glTexRect = gl.TexRect +local glRotate = gl.Rotate +local glTexture = gl.Texture +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 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 = {} +local optionHover = {} +local optionSelect = {} + +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 = { + msaa = 0, + bloom = false, + bloomhighlights = false, + ssao = false, + water = 1, + mapedgeextension = false, + lighteffects = false, + lups = false, + snow = false, + xrayshader = false, + particles = 5000, + nanoparticles = 500, + grassdetail = 0, + treeradius = 0, + advsky = false, + timecyclesweathereffects = false, + outline = false, + guishader = false, + shadows = false, + advmapshading = false, + advmodelshading = false, + decals = 0, + grounddetail = 64, + darkenmap_darkenfeatures = false, + enemyspotter_highlight = false, + }, + low = { + msaa = 2, + bloom = false, + bloomhighlights = false, + ssao = false, + water = 2, + mapedgeextension = false, + lighteffects = false, + lups = true, + snow = false, + xrayshader = false, + particles = 10000, + nanoparticles = 800, + grassdetail = 0, + treeradius = 200, + advsky = false, + timecyclesweathereffects = false, + outline = false, + guishader = false, + shadows = false, + advmapshading = true, + advmodelshading = true, + decals = 0, + grounddetail = 64, + darkenmap_darkenfeatures = false, + enemyspotter_highlight = false, + }, + medium = { + msaa = 4, + bloom = true, + bloomhighlights = false, + ssao = false, + water = 3, + mapedgeextension = true, + lighteffects = true, + lups = true, + snow = true, + xrayshader = false, + particles = 15000, + nanoparticles = 1200, + grassdetail = 0, + treeradius = 400, + advsky = false, + timecyclesweathereffects = false, + outline = false, + guishader = false, + shadows = true, + advmapshading = true, + advmodelshading = true, + decals = 1, + grounddetail = 64, + darkenmap_darkenfeatures = false, + enemyspotter_highlight = false, + }, + high = { + msaa = 8, + bloom = true, + bloomhighlights = false, + ssao = true, + water = 3, + mapedgeextension = true, + lighteffects = true, + lups = true, + snow = true, + xrayshader = false, + particles = 20000, + nanoparticles = 2000, + grassdetail = 0, + treeradius = 800, + advsky = true, + timecyclesweathereffects = false, + outline = true, + guishader = true, + shadows = true, + advmapshading = true, + advmodelshading = true, + decals = 2, + grounddetail = 64, + darkenmap_darkenfeatures = false, + enemyspotter_highlight = false, + }, + ultra = { + msaa = 16, + bloom = true, + bloomhighlights = true, + ssao = true, + water = 3, + mapedgeextension = true, + lighteffects = true, + lups = true, + snow = true, + xrayshader = false, + particles = 25000, + nanoparticles = 5000, + grassdetail = 0, + treeradius = 800, + advsky = true, + timecyclesweathereffects = false, + outline = true, + guishader = true, + shadows = true, + advmapshading = true, + advmodelshading = true, + decals = 3, + grounddetail = 64, + darkenmap_darkenfeatures = true, + enemyspotter_highlight = true, + }, +} +local customPresets = {} + +--if VFS.FileExists("LuaUI/configs/options.lua",VFS.ZIP) then +----if io.open("LuaUI/configs/options.lua",'r') ~= nil then -- file exists? +-- Spring.Echo("Options: loading external options config") +-- include("configs/options.lua") +--end + +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 + 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 = false +local textSize = 1 +local textMargin = 0.25 +local lineWidth = 0.0625 + +local posX = 0.947 +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) + 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 + +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 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 getOptionByID(id) + for i, option in pairs(options) do + if option.id == id then + return i + end + end + return false +end + + +function orderOptions() + local groupOptions = {} + for id,group in pairs(optionGroups) do + groupOptions[group.id] = {} + end + for oid,option in pairs(options) do + if option.type ~= 'label' then + 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 + local name = group.name + if group.id == 'gfx' then + name = group.name..' \255\130\130\130'..vsx..' x '..vsy + end + newOptionsCount = newOptionsCount +1 + newOptions[newOptionsCount] = {id="group_"..group.id, name=name, type="label"} + end + for oid,option in pairs(grOptions) do + 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 +local totalColumns = 0 -- gets calculated +function DrawWindow() + + orderOptions() + + 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 + 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 + 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 = "Settings" + local titleFontSize = 18 + 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() + 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.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 + local oHeight = 15 + local oPadding = 6 + y = y - oPadding - 11 + local oWidth = (screenWidth/3)-oPadding-oPadding + local yHeight = screenHeight-102-oPadding + local xPos = x + oPadding + 5 + local xPosMax = xPos + oWidth - oPadding - oPadding + local yPosMax = y-yHeight + local boolPadding = 3.5 + local boolWidth = 40 + local sliderWidth = 110 + local selectWidth = 140 + local i = 0 + local rows = 0 + local column = 1 + local drawColumnPos = 1 + + 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 = {} + + + -- draw navigation... backward/forward + if totalColumns > maxShownColumns then + local buttonSize = 52 + local buttonMargin = 18 + local startX = x+screenWidth + local startY = screenY-screenHeight+buttonMargin + + glColor(1,1,1,1) + + if (startColumn-1) + maxShownColumns < totalColumns then + optionButtonForward = {startX-buttonSize-buttonMargin, startY, startX-buttonMargin, startY+buttonSize} + glColor(1,1,1,1) + glTexture(forwardTex) + glTexRect(optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4]) + else + optionButtonForward = nil + end + + 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 } + else + optionButtonBackward = {startX-(buttonSize*2)-buttonMargin-(buttonMargin/1.5), startY, startX-(buttonSize*1)-buttonMargin-(buttonMargin/1.5), startY+buttonSize} + end + glColor(1,1,1,1) + glTexture(backwardTex) + glTexRect(optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4]) + else + optionButtonBackward = nil + 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 + 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 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 + i = i + 1 + end + end + font:End() +end + + +function correctMouseForScaling(x,y) + local interfaceScreenCenterPosX = (screenX+(screenWidth/2))/vsx + local interfaceScreenCenterPosY = (screenY-(screenHeight/2))/vsy + x = x - (((x/vsx)-interfaceScreenCenterPosX) * vsx)*((widgetScale-1)/widgetScale) + y = y - (((y/vsy)-interfaceScreenCenterPosY) * vsy)*((widgetScale-1)/widgetScale) + return x,y +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 + lastUpdate = sec + local changes = true + for i, option in ipairs(options) do + if options[i].widget ~= nil and options[i].type == 'bool' and options[i].value ~= GetWidgetToggleValue(options[i].widget) then + options[i].value = GetWidgetToggleValue(options[i].widget) + changes = true + end + end + if changes then + if windowList then + gl.DeleteList(windowList) + 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 + + if showOptionsToggleButton then + glPushMatrix() + glTranslate(posX*vsx, posY*vsy, 0) + glScale(17*widgetScale, 17*widgetScale, 1) + glColor(0, 0, 0, (0.3*bgColorMultiplier)) + glCallList(buttonGL) + glPopMatrix() + end + + -- draw the window + if not windowList then + --windowList = gl.CreateList(DrawWindow) + end + + -- update new slider value + if sliderValueChanged then + gl.DeleteList(windowList) + windowList = gl.CreateList(DrawWindow) + 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'] 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) + -- 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 + + -- draw button hover + local usedScreenX = (vsx*0.5) - ((screenWidth/2)*widgetScale) + local usedScreenY = (vsy*0.5) + ((screenHeight/2)*widgetScale) + + -- mouseover (highlight and tooltip) + + local description = '' + local x,y,ml = Spring.GetMouseState() + local cx, cy = correctMouseForScaling(x,y) + + 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], 2) + font:Begin() + if options[i].description ~= nil then + description = options[i].description + 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 + 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 + 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 + end + end + end + + -- draw select options + if showSelectOptions ~= nil then + + -- highlight all that are affected by presets + if options[showSelectOptions].id == 'preset' then + 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, 1) + end + end + end + + local oHeight = optionButtons[showSelectOptions][4] - optionButtons[showSelectOptions][2] + local oPadding = 4 + y = optionButtons[showSelectOptions][4] -oPadding + local yPos = y + --Spring.Echo(oHeight) + optionSelect = {} + for i, option in pairs(options[showSelectOptions].options) do + yPos = y-(((oHeight+oPadding+oPadding)*i)-oPadding) + end + + 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 + end + 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() + else + if WG['guishader'] then + WG['guishader'].DeleteDlist('options') + + end + end + if checkedWidgetDataChanges == nil then + checkedWidgetDataChanges = true + 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 + if options[i].value then + value = 1 + end + 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 + Spring.SetConfigInt("evo_timecyclesweathereffects",value) + Spring.SendCommands("luarules reloadluaui") + elseif id == 'shadows' then + Spring.SendCommands("Shadows "..value) + elseif id == 'vsync' then + Spring.SendCommands("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("WindowState",0) + else + Spring.SetConfigInt("WindowPosX",0) + Spring.SetConfigInt("WindowPosY",0) + Spring.SetConfigInt("WindowState",1) + end + 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) + elseif id == 'fpstimespeed' then + Spring.SendCommands("fps "..value) + Spring.SendCommands("clock "..value) + Spring.SendCommands("speed "..value) + + 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 + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigShortcutsInfo', {'shortcutsInfo'}, options[i].value) + elseif id == 'buildmenuprices' then + 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 + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigPlaySounds', {'playSounds'}, options[i].value) + elseif id == 'buildmenutooltip' then + saveOptionValue('Red Build/Order Menu', 'red_buildmenu', 'setConfigUnitTooltip', {'drawTooltip'}, options[i].value) + elseif id == 'buildmenubigtooltip' then + 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 + 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 + saveOptionValue('Snow', 'snow', 'setSnowMap', {'snowMaps',Game.mapName:lower()}, options[i].value) + elseif id == 'snowautoreduce' then + 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 + saveOptionValue('Darken map', 'darkenmap', 'setDarkenFeatures', {'darkenFeatures'}, options[i].value) + elseif id == 'teamplatter_skipownteam' then + saveOptionValue('TeamPlatter', 'teamplatter', 'setSkipOwnTeam', {'skipOwnTeam'}, options[i].value) + elseif id == 'enemyspotter_highlight' then + 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"] = {} + end + widgetHandler.configData["Highlight Selected Units"].useShader = options[i].value + if WG['highlightselunits'] ~= nil then + WG['highlightselunits'].setShader(options[i].value) + end + elseif id == 'smartselect_includebuildings' then + 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 + widgetHandler:EnableWidget("Deferred rendering") + end + widgetHandler:EnableWidget("Light Effects") + else + if widgetHandler.orderList["Deferred rendering"] ~= nil then + widgetHandler:DisableWidget("Deferred rendering") + 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 + Spring.SetConfigInt("evo_buildpichelp",value) + elseif id == 'dynamicmusic' then + 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 + if luaShaders ~= 1 and not enabledLuaShaders then + Spring.SetConfigInt("ForceShaders", 1) + enabledLuaShaders = true + end + end + end + if value == 1 then + 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) + else + widgetHandler:DisableWidget(options[i].widget) + end + end + forceUpdate = true + if id == "teamcolors" then + Spring.SendCommands("luarules reloadluaui") -- cause several widgets are still using old colors + end + end + + elseif options[i].type == 'slider' then + local value = options[i].value + if id == 'msaa' then + if value > 0 then + Spring.SetConfigInt("MSAALevel",1) + else + Spring.SetConfigInt("MSAALevel",0) + end + 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 + enabled = 0 + end + Spring.SendCommands("shadows "..enabled.." "..value) + Spring.SetConfigInt("shadows", 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 + 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 + 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 + Spring.SetConfigInt("GroundDetail", value) + Spring.SendCommands("GroundDetail "..value) + elseif id == 'sndvolmaster' then + Spring.SetConfigInt("snd_volmaster", value) + elseif id == 'sndvolbattle' then + Spring.SetConfigInt("snd_volbattle", value) + elseif id == 'sndvolgeneral' then + Spring.SetConfigInt("snd_volgeneral", value) + elseif id == 'sndvolui' then + Spring.SetConfigInt("snd_volui", value) + elseif id == 'sndvolunitreply' then + Spring.SetConfigInt("snd_volunitreply", value) + elseif id == 'sndairabsorption' then + Spring.SetConfigFloat("snd_airAbsorption", value) + elseif id == 'sndvolmusic' then + 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 + saveOptionValue('Darken map', 'darkenmap', 'setMapDarkness', {'maps',Game.mapName:lower()}, value) + elseif id == 'iconadjuster' then + saveOptionValue('Icon adjuster', 'iconadjuster', 'setScale', {'iconScale'}, value) + elseif id == 'healthbarsscale' then + 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 + saveOptionValue('Bloom Shader', 'bloom', 'setBrightness', {'basicAlpha'}, value) + elseif id == 'bloomsize' then + saveOptionValue('Bloom Shader', 'bloom', 'setBlursize', {'globalBlursizeMult'}, value) + elseif id == 'consolemaxlines' then + 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 + 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 + saveOptionValue('GUI Shader', 'guishader', 'setBlurIntensity', {'blurIntensity'}, value) + elseif id == 'guiopacity' then + Spring.SetConfigFloat("ui_opacity", value) + elseif id == 'snowamount' then + 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 + saveOptionValue('Light Effects', 'lighteffects', 'setGlobalBrightness', {'globalLightMult'}, value) + elseif id == 'lighteffects_radius' then + saveOptionValue('Light Effects', 'lighteffects', 'setGlobalRadius', {'globalRadiusMult'}, value) + elseif id == 'lighteffects_laserbrightness' then + saveOptionValue('Light Effects', 'lighteffects', 'setLaserBrightness', {'globalLightMultLaser'}, value) + elseif id == 'lighteffects_laserradius' then + saveOptionValue('Light Effects', 'lighteffects', 'setLaserRadius', {'globalRadiusMultLaser'}, value) + elseif id == 'lighteffects_life' then + saveOptionValue('Light Effects', 'lighteffects', 'setLife', {'globalLifeMult'}, value) + elseif id == 'teamplatter_opacity' then + saveOptionValue('TeamPlatter', 'teamplatter', 'setOpacity', {'spotterOpacity'}, value) + elseif id == 'enemyspotter_opacity' then + 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 + 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 + + elseif options[i].type == 'select' then + local value = options[i].value + if id == 'preset' then + 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 + Spring.SendCommands('viewfps') + elseif value == 2 then + Spring.SendCommands('viewta') + elseif value == 3 then + Spring.SendCommands('viewspring') + elseif value == 4 then + Spring.SendCommands('viewrot') + elseif value == 5 then + Spring.SendCommands('viewfree') + end + elseif id == 'cursor' then + 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 + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + end +end + +function loadPreset(preset) + for optionID, value in pairs(presets[preset]) do + local i = getOptionByID(optionID) + if options[i] ~= nil then + options[i].value = value + applyOptionValue(i, true) + end + end + + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) +end + + +function widget:KeyPress(key) + if key == 27 then -- ESC + if showSelectOptions then + showSelectOptions = nil + else + show = false + end + 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 round(num, numDecimalPlaces) + local mult = 10^(numDecimalPlaces or 0) + if num >= 0 then return math.floor(num * mult + 0.5) / mult + 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 + 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 :( +end + +function widget:MouseWheel(up, value) + local x,y = Spring.GetMouseState() + local cx, cy = correctMouseForScaling(x,y) + if show then + return true + end +end + +function widget:MouseMove(x, y) + if draggingSlider ~= nil then + local cx, cy = correctMouseForScaling(x,y) + local newValue = getSliderValue(draggingSlider,cx) + if options[draggingSlider].value ~= newValue then + options[draggingSlider].value = newValue + sliderValueChanged = true + applyOptionValue(draggingSlider) + if playSounds and (lastSliderSound == nil or os.clock() - lastSliderSound > 0.04) then + lastSliderSound = os.clock() + Spring.PlaySoundFile(sliderdrag, 0.4, 'ui') + end + 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 + + 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 + if presetNames[o[5]] and customPresets[presetNames[o[5]]] ~= nil then + deletePreset(presetNames[o[5]]) + if playSounds then + Spring.PlaySoundFile(selectclick, 0.5, 'ui') + end + if selectClickAllowHide ~= nil or not IsOnRect(cx, cy, optionButtons[showSelectOptions][1], optionButtons[showSelectOptions][2], optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4]) then + showSelectOptions = nil + selectClickAllowHide = nil + else + selectClickAllowHide = true + end + return + end + end + end + end + elseif button == 1 then + if release then + + -- navigation buttons + if optionButtonForward ~=nil and IsOnRect(cx, cy, optionButtonForward[1], optionButtonForward[2], optionButtonForward[3], optionButtonForward[4]) then + startColumn = startColumn + maxShownColumns + if startColumn > totalColumns + (maxShownColumns-1) then + startColumn = (totalColumns-maxShownColumns) + 1 + end + if playSounds then + Spring.PlaySoundFile(paginatorclick, 0.6, 'ui') + end + showSelectOptions = nil + selectClickAllowHide = nil + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + return + end + if optionButtonBackward ~= nil and IsOnRect(cx, cy, optionButtonBackward[1], optionButtonBackward[2], optionButtonBackward[3], optionButtonBackward[4]) then + startColumn = startColumn - maxShownColumns + if startColumn < 1 then startColumn = 1 end + if playSounds then + Spring.PlaySoundFile(paginatorclick, 0.6, 'ui') + end + showSelectOptions = nil + selectClickAllowHide = nil + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + return + end + + -- apply new slider value + if draggingSlider ~= nil then + options[draggingSlider].value = getSliderValue(draggingSlider,cx) + applyOptionValue(draggingSlider) + draggingSlider = nil + return + end + + -- select option + if showSelectOptions ~= nil then + for i, o in pairs(optionSelect) do + if IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then + options[showSelectOptions].value = o[5] + applyOptionValue(showSelectOptions) + if playSounds then + Spring.PlaySoundFile(selectclick, 0.5, 'ui') + end + end + end + if selectClickAllowHide ~= nil or not IsOnRect(cx, cy, optionButtons[showSelectOptions][1], optionButtons[showSelectOptions][2], optionButtons[showSelectOptions][3], optionButtons[showSelectOptions][4]) then + showSelectOptions = nil + selectClickAllowHide = nil + else + selectClickAllowHide = true + end + return + 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 tabClicked then + + elseif IsOnRect(x, y, rectX1, rectY2, rectX2, rectY1) then + + + if release then + + -- select option + if showSelectOptions == nil then + if showPresetButtons then + for preset, pp in pairs(presets) do + if IsOnRect(cx, cy, pp.pos[1], pp.pos[2], pp.pos[3], pp.pos[4]) then + loadPreset(preset) + end + end + end + + for i, o in pairs(optionButtons) do + if options[i].type == 'bool' and IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then + options[i].value = not options[i].value + applyOptionValue(i) + if playSounds then + if options[i].value then + Spring.PlaySoundFile(toggleonclick, 0.75, 'ui') + else + Spring.PlaySoundFile(toggleoffclick, 0.75, 'ui') + end + end + elseif options[i].type == 'slider' and IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then + + elseif options[i].type == 'select' and IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then + end + 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 + draggingSlider = i + local newValue = getSliderValue(draggingSlider,cx) + if options[draggingSlider].value ~= newValue then + options[draggingSlider].value = getSliderValue(draggingSlider,cx) + applyOptionValue(draggingSlider) + if playSounds then + Spring.PlaySoundFile(sliderdrag, 0.3, 'ui') + end + end + elseif options[i].type == 'select' and IsOnRect(cx, cy, o[1], o[2], o[3], o[4]) then + + if playSounds then + Spring.PlaySoundFile(selectunfoldclick, 0.6, 'ui') + end + if showSelectOptions == nil then + showSelectOptions = i + elseif showSelectOptions == i then + --showSelectOptions = nil + end + end + end + end + end + + if button == 1 or button == 3 then + return true + end + -- 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 + end + return true + end + + if show then + 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) + ty = (y - posY*vsy)/(17*widgetScale) + if tx < 0 or tx > 5.25 or ty < -0.25 or ty > 1.4 then return false end + if release then + showOnceMore = show -- show once more because the guishader lags behind, though this will not fully fix it + show = not show + end + if show then + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + end + return true + end +end + +function GetWidgetToggleValue(widgetname) + if widgetHandler.orderList[widgetname] == nil or widgetHandler.orderList[widgetname] == 0 then + return false + elseif widgetHandler.orderList[widgetname] >= 1 + and widgetHandler.knownWidgets ~= nil + and widgetHandler.knownWidgets[widgetname] ~= nil then + if widgetHandler.knownWidgets[widgetname].active then + return true + else + return 0.5 + end + end +end + +-- 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 + + +-- 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'}) + + loadWidgetData("SSAO", "ssao_strength", {'strength'}) + loadWidgetData("SSAO", "ssao_radius", {'radius'}) + + loadWidgetData("Bloom Shader Deferred", "bloomdeferredbrightness", {'glowAmplifier'}) + loadWidgetData("Bloom Shader Deferred", "bloomdeferredsize", {'qualityBlursizeMult'}) + loadWidgetData("Bloom Shader Deferred", "bloomdeferredquality", {'qualityPreset'}) + + loadWidgetData("Bloom Shader", "bloombrightness", {'basicAlpha'}) + loadWidgetData("Bloom Shader", "bloomsize", {'globalBlursizeMult'}) + loadWidgetData("Bloom Shader", "bloomquality", {'qualityPreset'}) + + 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'}) + + 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='gfx', name='Graphics'}, + {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="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="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="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", 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", 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 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="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="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", 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", 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="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=0, max=5000, step=100, value=tonumber(Spring.GetConfigInt("MaxNanoParticles",1) or 500), description='NOTE: Nano particles are more expensive regarding the CPU'}, + + --{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)'}, + {id="snowmap", group="gfx", name=widgetOptionColor.." enabled on this map", type="bool", value=true, description='It will remember what you toggled for every map\n\n\(by default: maps with wintery names have this toggled)'}, + {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="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="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)}, + {id="sndvolbattle", group="snd", name="Battle volume", type="slider", min=0, max=100, step=2, value=tonumber(Spring.GetConfigInt("snd_volbattle",1) or 100)}, + {id="sndvolui", group="snd", name="Interface volume", type="slider", min=0, max=100, step=2, value=tonumber(Spring.GetConfigInt("snd_volui",1) or 100)}, + {id="sndvolunitreply", group="snd", name="Unit reply volume", type="slider", min=0, max=100, step=2, value=tonumber(Spring.GetConfigInt("snd_volunitreply",1) or 100)}, + {id="sndvolmusic", group="snd", name="Music volume", type="slider", min=0, max=100, step=2, value=tonumber(Spring.GetConfigInt("snd_volmusic",1) or 20)}, + {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="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="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", 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="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="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="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=''}, + + --{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="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 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="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="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", 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="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="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="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="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)'}, + } + + -- 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 + options[getOptionByID('cursor')] = nil + else + local cursorsets = {} + local cursor = 1 + local cursoroption + cursorsets = WG['cursors'].getcursorsets() + local cursorname = WG['cursors'].getcursor() + for i,c in pairs(cursorsets) do + if c == cursorname then + cursor = i + break + end + end + 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 + elseif WG['healthbars'].getScale ~= nil then + options[getOptionByID('healthbarsscale')].value = WG['healthbars'].getScale() + 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 + options[getOptionByID('darkenmap_darkenfeatures')] = nil + else + options[getOptionByID('darkenmap')].value = WG['darkenmap'].getMapDarkness() + options[getOptionByID('darkenmap_darkenfeatures')].value = WG['darkenmap'].getDarkenFeatures() + 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 + 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 + if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigUnitPrice == nil then + options[getOptionByID('buildmenuprices')] = nil + end + if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigPlaySounds == nil then + options[getOptionByID('buildmenusounds')] = nil + end + if WG['red_buildmenu'] == nil or WG['red_buildmenu'].getConfigUnitTooltip == nil then + options[getOptionByID('buildmenutooltip')] = nil + end + 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 + options[getOptionByID('teamplatter_opacity')] = nil + options[getOptionByID('teamplatter_skipownunits')] = nil + end + + if widgetHandler.knownWidgets["EnemySpotter"] == nil then + options[getOptionByID('enemyspotter_opacity')] = nil + options[getOptionByID('enemyspotter_highlight')] = nil + end + + local processedOptions = {} + local processedOptionsCount = 0 + local insert = true + for oid,option in pairs(options) do + insert = true + 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" 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 + insert = false + end + if option.widget ~= nil and widgetHandler.knownWidgets[option.widget] == nil then + insert = false + end + if insert then + processedOptionsCount = processedOptionsCount + 1 + processedOptions[processedOptionsCount] = option + end + end + options = processedOptions +end + + +function deletePreset(name) + Spring.Echo('deleted preset: '..name) + customPresets[name] = nil + presets[name] = nil + local newPresetNames = {} + for _, presetName in ipairs(presetNames) do + if presetName ~= name then + table.insert(newPresetNames, presetName) + end + end + presetNames = newPresetNames + options[getOptionByID('preset')].options = presetNames + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) +end + +function savePreset(name) + if name == nil then + name = 'custom' + local i = 1 + while customPresets[name] ~= nil do + i = i + 1 + name = 'custom'..i + end + end + if presets[name] ~= nil then + Spring.Echo("preset '"..name.."' already exists") + else + local preset = {} + for optionID, _ in pairs(presets['lowest']) do + if options[getOptionByID(optionID)] ~= nil then + preset[optionID] = options[getOptionByID(optionID)].value + end + end + customPresets[name] = preset + presets[name] = preset + table.insert(presetNames, name) + options[getOptionByID('preset')].options = presetNames + Spring.Echo('saved preset: '..name) + if windowList then gl.DeleteList(windowList) end + windowList = gl.CreateList(DrawWindow) + end +end + + +function widget:Initialize() + + 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) + if state ~= nil then + show = state + else + show = not show + end + end + WG['options'].isvisible = function() + return show + end + WG['options'].getCameraSmoothness = function() + return cameraTransitionTime + end + + presets = tableMerge(presets, customPresets) + for preset,_ in pairs(customPresets) do + table.insert(presetNames, preset) + end + + init() +end + +function widget:Shutdown() + if buttonGL then + glDeleteList(buttonGL) + end + 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 + + +local function Split(s, separator) + local results = {} + for part in s:gmatch("[^"..separator.."]+") do + results[#results + 1] = part + end + 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 + savePreset(words[2]) + else + savePreset() + end + end +end + +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 + +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 3f52d0735..1f0498317 100644 --- a/LuaUI/Widgets_Evo/gui_pauseScreen.lua +++ b/LuaUI/Widgets_Evo/gui_pauseScreen.lua @@ -1,250 +1,312 @@ include("keysym.h.lua") -local versionNumber = "1.0" +local versionNumber = "1.34" function widget:GetInfo() - return { - name = "Pause Screen", - desc = "[v" .. string.format("%s", versionNumber ) .. "] Displays pause screen when game is paused.", - author = "very_bad_soldier", - date = "2009.08.16", - license = "GNU GPL v2", - layer = 0, - enabled = true - } + return { + name = "Pause Screen", + desc = "Displays an overlay when the game is paused", + author = "Floris", + date = "sept 2016", + license = "GNU GPL v2", + layer = 99999999, + enabled = true + } 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 glPopMatrix = gl.PopMatrix local glPushMatrix = gl.PushMatrix local glTranslate = gl.Translate -local glText = gl.Text -local glBeginEnd = gl.BeginEnd -local glTexRect = gl.TexRect -local glLoadFont = gl.LoadFont -local glDeleteFont = gl.DeleteFont -local glRect = gl.Rect -local glLineWidth = gl.LineWidth -local glDepthTest = gl.DepthTest - -local osClock = os.clock +local glTexRect = gl.TexRect +local glDeleteFont = gl.DeleteFont +local glRect = gl.Rect +local glUseShader = gl.UseShader +local glCopyToTexture = gl.CopyToTexture +local glUniform = gl.Uniform +local glGetUniformLocation = gl.GetUniformLocation + +local osClock = os.clock + ---------------------------------------------------------------------------------- + -- CONFIGURATION -local debug = false -local boxWidth = 300 -local boxHeight = 60 -local slideTime = 0.4 -local fadeTime = 1 -local wndBorderSize = 4 -local imgWidth = 160 --acording to the used png -local fontSizeHeadline = 36 -local fontSizeAddon = 24 -local windowIconPath = "LuaUI/Images/evologo.png" -local fontPath = "LuaUI/Fonts/MicrogrammaDBold.ttf" ---Color config in drawPause function - ----------------- -local screenx, screeny -local myFont -local clickTimestamp = 0 -local pauseTimestamp = 0 --start or end of pause + +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 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 lineOffset = nil -local yCenter = nil -local xCut = nil +local usedSizeMultiplier = 1 +local vsx, vsy = Spring.GetWindowGeometry() +local widgetInitTime = osClock() +local previousDrawScreenClock = osClock() +local paused = false + +local shaderAlpha = 0 +local screencopy +local shaderProgram + +--intensity formula based on http://alienryderflex.com/hsp.html +local fragmentShaderSource = { + washed = [[ + uniform sampler2D screencopy; + uniform float alpha; + float getIntensity(vec4 color) { + vec3 intensityVector = color.rgb * vec3(0.66,0.66,0.66); + return length(intensityVector); + } + + void main() { + vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); + vec4 origColor = texture2D(screencopy, texCoord); + float intensity = getIntensity(origColor); + intensity = intensity * 1.15; + float multi = intensity * 0.9; + if (intensity > 1) intensity = 1; + if (intensity < 0.5) { + if (intensity < 0.2) { + gl_FragColor = vec4(multi*0.22, multi*0.22, multi*0.22, alpha); + } else if (intensity < 0.35) { + gl_FragColor = vec4(multi*0.32, multi*0.32, multi*0.32, alpha); + } else { + gl_FragColor = vec4(multi*0.55, multi*0.55, multi*0.55, alpha); + } + } else { + if (intensity < 0.75) { + gl_FragColor = vec4(multi*0.7, multi*0.7, multi*0.7, alpha); + } else { + gl_FragColor = vec4(multi*0.82, multi*0.82, multi*0.82, alpha); + } + } + } + ]], +} + +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() - myFont = glLoadFont( fontPath, fontSizeHeadline ) - updateWindowCoords() + vsx, vsy = widgetHandler:GetViewSizes() + widget:ViewResize(vsx, vsy) + + + local _, gameSpeed, isPaused = spGetGameSpeed() + if isPaused or gameSpeed == 0 then -- when host admin paused its just gamespeed 0 + paused = true + end + + if gl.CreateShader and (Platform == nil or Platform.gpuVendor ~= 'Intel') then + shaderProgram = gl.CreateShader( + { + fragment = fragmentShaderSource.washed, + uniformInt = { + screencopy = 0, + }, + }) + if shaderProgram then + alphaLoc = glGetUniformLocation(shaderProgram, "alpha") + end + else + Spring.Echo(": GLSL not supported.") + end end function widget:Shutdown() - glDeleteFont( myFont ) + glDeleteFont( myFont ) + if shaderProgram then + gl.DeleteShader(shaderProgram) + end end -function widget:DrawScreen() - local now = osClock() - local _, _, paused = spGetGameSpeed() - 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 - clickTimestamp = nil - end - - lastPause = paused - - if ( paused or ( ( now - pauseTimestamp) <= slideTime ) ) then - drawPause() - end - - ResetGl() +function widget:GamePaused(playerID, isGamePaused) + paused = isGamePaused end -function widget:MousePress(x, y, button) - if ( not clickTimestamp ) then - if ( ( x > screenCenterX - boxWidth) and ( y < screenCenterY + boxHeight ) and - ( x < screenCenterX + boxWidth ) and ( y > screenCenterY - boxHeight ) ) then - printDebug("CLICK") - clickTimestamp = osClock() - return true +function widget:RecvLuaMsg(msg, playerID) + if msg:sub(1,18) == 'LobbyOverlayActive' then + chobbyInterface = (msg:sub(1,19) == 'LobbyOverlayActive1') end - end +end - return false +function widget:DrawScreen() + if chobbyInterface then return end + if Spring.IsGUIHidden() then return end + local now = osClock() + + if ( paused or ( ( now - pauseTimestamp) <= slideTime ) ) then + showPauseScreen = true + drawPause() + if blurScreen and WG['guishader'] then + WG['guishader'].InsertRect(0,0,vsx,vsy, 'pausescreen') + end + else + showPauseScreen = false + if blurScreen and WG['guishader'] then + WG['guishader'].RemoveRect('pausescreen') + end + end end + function drawPause() - local _, _, paused = spGetGameSpeed() - local now = osClock() - local diffPauseTime = ( now - pauseTimestamp) - - local text = { 1.0, 1.0, 1.0, 1.0 } - local text2 = { 0.9, 0.9, 0.9, 1.0 } - local outline = { 0.4, 0.4, 0.4, 1.0 } - local colorWnd = { 0.0, 0.0, 0.0, 0.6 } - local colorWnd2 = { 0.5, 0.5, 0.5, 0.6 } - local iconColor = { 1.0, 1.0, 1.0, 1.0 } - - --adjust transparency when clicked - if ( clickTimestamp ~= nil ) then - local factor = ( 1.0 - ( now - clickTimestamp ) / fadeTime ) - factor = max( factor, 0.3 ) - colorWnd[4] = colorWnd[4] * factor - text[4] = text[4] * factor - text2[4] = text2[4] * factor - outline[4] = outline[4] * factor - iconColor[4] = iconColor[4] * factor - printDebug("fac: " .. factor) - end - local imgWidthHalf = imgWidth * 0.5 - - --draw window - glPushMatrix() - local group1XOffset = 0 - if ( diffPauseTime <= slideTime ) then - --we are sliding - if ( paused ) then - --sliding in - group1XOffset = ( screenx - wndX1 ) * ( 1.0 - ( diffPauseTime / slideTime ) ) - else - --sliding out - group1XOffset = ( screenx - wndX1 ) * ( ( diffPauseTime / slideTime ) ) - end - glTranslate( group1XOffset, 0, 0) - end - - glColor( colorWnd ) - glRect( wndX1, wndY1, wndX2, wndY2 ) - glColor( colorWnd ) - glRect( wndX1 - wndBorderSize, wndY1 + wndBorderSize, wndX2 + wndBorderSize, wndY2 - wndBorderSize) - glPopMatrix() - - --draw text - myFont:Begin() - myFont:SetOutlineColor( outline ) - - myFont:SetTextColor( text ) - myFont:Print( "GAME PAUSED", textX + group1XOffset, textY, fontSizeHeadline, "O" ) + local now = osClock() + local diffPauseTime = ( now - pauseTimestamp) + + local text = { 1.0, 1.0, 1.0, 0*maxAlpha } + local outline = { 0.0, 0.0, 0.0, 0*maxAlpha } + + if paused then + progress = ( now - pauseTimestamp ) / slideTime + else + progress = 1 - (( now - pauseTimestamp ) / slideTime ) + end + if progress > 1 then + progress = 1 + end + if progress < 0 then + progress = 0 + end + text[4] = (text[4] * (1-progress)) + fadeToTextAlpha + outline[4] = (outline[4] * (1-progress)) + (fadeToTextAlpha/2.25) - myFont:SetTextColor( text2 ) - myFont:Print( "Press 'Pause' to continue.", textX + group1XOffset, textY - lineOffset, fontSizeAddon, "O" ) - - myFont:End() - - --draw icon - glColor( iconColor ) - glTexture( ":n:" .. windowIconPath ) - glPushMatrix() - - if ( diffPauseTime <= slideTime ) then - --we are sliding - if ( paused ) then - --sliding in - glTranslate( 0, ( ( yCenter + imgWidthHalf ) * ( 1.0 - ( diffPauseTime / slideTime ) ) ), 0) - else - --sliding out - glTranslate( 0, ( yCenter + imgWidthHalf ) * ( diffPauseTime / slideTime ), 0) - end - end - - glTexRect( xCut - imgWidthHalf, yCenter + imgWidthHalf, xCut + imgWidthHalf, yCenter - imgWidthHalf, 0.0, 0.0, 1.0, 1.0 ) - glPopMatrix() - - glTexture(false) + shaderAlpha = progress * maxShaderAlpha + nonShaderAlpha = progress * maxNonShaderAlpha + + glPushMatrix() + + if not shaderProgram then + glColor(0,0,0,nonShaderAlpha) + glRect( 0, 0, vsx, vsy) + end + + glTranslate(-vsx*(usedSizeMultiplier-1)/2, -vsy*(usedSizeMultiplier-1)/2, 0) + glScale(usedSizeMultiplier,usedSizeMultiplier,1) + if ( diffPauseTime <= slideTime ) then + --we are sliding + if ( paused ) then + --sliding in + glTranslate( (( vsx - wndX1 ) / usedSizeMultiplier) * ( 1.0 - ( diffPauseTime / slideTime ) ), 0, 0) + else + --sliding out + glTranslate( (( vsx - wndX1 ) / usedSizeMultiplier) * ( ( diffPauseTime / slideTime ) ), 0, 0) + end + end + + --draw text + font:Begin() + font:SetOutlineColor( outline ) + font:SetTextColor( text ) + font:Print( "GAME PAUSED", textX, textY, fontSizeHeadline, "O" ) + font:End() + + glPopMatrix() end function updateWindowCoords() - screenx, screeny = widgetHandler:GetViewSizes() - - screenCenterX = screenx / 2 - screenCenterY = screeny / 2 - wndX1 = screenCenterX - boxWidth - wndY1 = screenCenterY + boxHeight - wndX2 = screenCenterX + boxWidth - wndY2 = screenCenterY - boxHeight - - textX = wndX1 + ( wndX2 - wndX1 ) * 0.35 - textY = wndY2 + ( wndY1 - wndY2 ) * 0.5 - lineOffset = ( wndY1 - wndY2 ) * 0.3 - - yCenter = wndY2 + ( wndY1 - wndY2 ) * 0.5 - xCut = wndX1 + ( wndX2 - wndX1 ) * 0.2 + 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 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() - end - ---Commons -function ResetGl() - glColor( { 1.0, 1.0, 1.0, 1.0 } ) - glLineWidth( 1.0 ) - glDepthTest(false) - glTexture(false) + + screencopy = gl.CreateTexture(vsx, vsy, { + border = false, + min_filter = GL.NEAREST, + mag_filter = GL.NEAREST, + }) end - -function printDebug( value ) - if ( debug ) then - if ( type( value ) == "boolean" ) then - if ( value == true ) then spEcho( "true" ) - else spEcho("false") end - elseif ( type(value ) == "table" ) then - spEcho("Dumping table:") - for key,val in pairs(value) do - spEcho(key,val) - end - else - spEcho( value ) - end +function widget:DrawScreenEffects() + if Spring.IsGUIHidden() then return end + if shaderProgram and showPauseScreen then + glCopyToTexture(screencopy, 0, 0, 0, 0, vsx, vsy) + glTexture(0, screencopy) + glUseShader(shaderProgram) + glUniform(alphaLoc, shaderAlpha) + glTexRect(0,vsy,vsx,0) + glTexture(0, false) + glUseShader(0) end end - \ No newline at end of file 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_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 new file mode 100644 index 000000000..70adc3089 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_red_battleroom.lua @@ -0,0 +1,960 @@ +-- disable as clipLine is very slow on headless +if (Spring.GetConfigInt('Headless', 0) ~= 0) then + return false +end + +function widget:GetInfo() + return { + name = "Red Console (Battle and autohosts)", --version 4.1 + desc = "Requires Red UI Framework", + author = "Regret + Doo edit", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, --enabled by default + handler = true, --can use widgetHandler:x() + } +end +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (1 + (vsx*vsy / 4000000)) + +local NeededFrameworkVersion = 8 +local SoundIncomingChat = 'sounds/ui/beep4.wav' +local SoundIncomingChatVolume = 1.0 + +local gameOver = false +local lastConnectionAttempt = '' +--todo: dont cut words apart when clipping text + + +local clock = os.clock +local slen = string.len +local ssub = string.sub +local sgsub = string.gsub +local sfind = string.find +local sformat = string.format +local schar = string.char +local sgsub = string.gsub +local mfloor = math.floor +local sbyte = string.byte +local sreverse = string.reverse +local mmax = math.max +local glGetTextWidth = gl.GetTextWidth +local sGetPlayerRoster = GetPlayerRoster +local sGetTeamColor = Spring.GetTeamColor +local sGetMyAllyTeamID = Spring.GetMyAllyTeamID +local sGetModKeyState = Spring.GetModKeyState +local spPlaySoundFile = Spring.PlaySoundFile +local sGetMyPlayerID = Spring.GetMyPlayerID + +local Config = { + console = { + px = vsx*0.3,py = vsy*0.05, --default start position + sx = vsx*0.4, --background size + + fontsize = 10*widgetScale, + + minlines = 3, --minimal number of lines to display + maxlines = 3, + maxlinesScrollmode = 3, + + maxage = 30, --max time for a message to be displayed, in seconds + + margin = 7*widgetScale, --distance from background border + + fadetime = 0.25, --fade effect time, in seconds + fadedistance = 1*widgetScale, --distance from cursor at which console shows up when empty + + filterduplicates = true, --group identical lines, f.e. ( 5x Nickname: blahblah) + + --note: transparency for text not supported yet + cothertext = {1,1,1,1}, --normal chat color + callytext = {0,1,0,1}, --ally chat + cspectext = {1,1,0,1}, --spectator chat + + cotherallytext = {1,0.5,0.5,1}, --enemy ally messages (seen only when spectating) + cmisctext = {0.78,0.78,0.78,1}, --everything else + cgametext = {0.4,1,1,1}, --server (autohost) chat + + cbackground = {0,0,0,0.0}, + cborder = {0,0,0,0}, + + 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 console.\n".. + "- Press \255\255\255\1CTRL\255\255\255\255 while mouse is above the \nconsole to activate chatlog viewing.\n".. + "- Use mousewheel (+hold \255\255\255\1SHIFT\255\255\255\255 for speedup)\n to scroll through the chatlog.", + }, + }, +} + + +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 GetPlayerRoster() +PlayerRoster = {} + if Engine and Engine.version then + PlayerList = Spring.GetPlayerList() + for ct,playerID in pairs(PlayerList) do + PlayerInfo = {Spring.GetPlayerInfo(playerID)} + PlayerRoster[ct] = {} + PlayerRoster[ct][1] = PlayerInfo[1] + PlayerRoster[ct][2] = playerID + PlayerRoster[ct][3] = PlayerInfo[4] + PlayerRoster[ct][4] = PlayerInfo[5] + PlayerRoster[ct][5] = PlayerInfo[3] + PlayerRoster[ct][6] = PlayerInfo[7] + PlayerRoster[ct][7] = PlayerInfo[6] + -- Spring.Echo(PlayerInfo) + end + return PlayerRoster + else + return Spring.GetPlayerRoster() + end +end + +local function AutoResizeObjects() --autoresize v2 + if (LastAutoResizeX==nil) then + LastAutoResizeX = vsx + LastAutoResizeY = vsy + 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 createconsole(r) + local vars = {} + + local lines = {"text", + px=r.px+r.margin,py=r.py+r.margin, + fontsize=r.fontsize, + caption="", + options="o", --black outline + } + + local activationarea = {"area", + px=r.px-r.fadedistance,py=r.py-r.fadedistance, + sx=r.sx+r.fadedistance*2,sy=0, + + mousewheel=function(up,mx,my,self) + if (vars.browsinghistory) then + local alt,ctrl,meta,shift = Spring.GetModKeyState() + local step = 1 + if (shift) then + step = 5 + end + if (vars.historyoffset == nil) then + vars.historyoffset = 0 + end + if (up) then + vars.historyoffset = vars.historyoffset + step + vars._forceupdate = true + else + vars.historyoffset = vars.historyoffset - step + vars._forceupdate = true + end + if (vars.historyoffset > (#vars.consolehistory - r.maxlines)) then + vars.historyoffset = #vars.consolehistory - r.maxlines + elseif (vars.historyoffset < 0) then + vars.historyoffset = 0 + end + end + end, + } + + local background = {"rectanglerounded", + px=r.px,py=r.py, + sx=r.sx,sy=r.maxlines*r.fontsize+r.margin*2, + color=r.cbackground, + border=r.cborder, + movable=r.dragbutton, + + obeyscreenedge = true, + --overrideclick = {2}, + + movableslaves={lines,activationarea}, + + effects = { + fadein_at_activation = r.fadetime, + fadeout_at_deactivation = r.fadetime, + }, + } + + activationarea.onupdate=function(self) + local fadedistance = (self.sx-background.sx)/2 + self.sy = background.sy+fadedistance*2 + self.px = background.px-fadedistance + self.py = background.py-fadedistance + + if (not self._mousenotover) then + background.active = nil --activate + if (vars._empty) then + background.sy = (r.minlines*lines.fontsize + (lines.px-background.px)*2) + end + local alt,ctrl,meta,shift = Spring.GetModKeyState() + if (ctrl and not vars.browsinghistory) then + if (vars._skipagecheck == nil) then + vars._forceupdate = true + vars.nextupdate = -1 + vars.browsinghistory = true + vars.historyoffset = 0 + + self.overridewheel = true + end + vars._skipagecheck = true + vars._usecounters = false + end + else + if (vars._skipagecheck ~= nil) then + vars._forceupdate = true + vars.browsinghistory = nil + vars.historyoffset = 0 + + self.overridewheel = nil + vars._skipagecheck = nil + vars._usecounters = nil + end + end + + self._mousenotover = nil + end + activationarea.mousenotover=function(mx,my,self) + self._mousenotover = true + if (vars._empty) then + background.active = false + end + end + + New(activationarea) + New(background) + New(lines) + + local counters = {} + for i=1,r.maxlines do + local b = New(lines) + b.onupdate = function(self) + self.px = background.px - self.getwidth() - (lines.px-background.px) + end + b._count = 0 + b.active = false + b.py = b.py+(i-1)*r.fontsize + counters[#counters+1] = b + background.movableslaves[#background.movableslaves+1] = b + end + + --tooltip + background.mouseover = function(mx,my,self) SetTooltip(r.tooltip.background) end + + background.active = nil + + return { + ["background"] = background, + ["lines"] = lines, + ["counters"] = counters, + ["vars"] = vars + } +end + +local function lineColour(prevline) -- search prevline and find the final instance of a colour code + + local prevlineReverse = sreverse(prevline) + local newlinecolour = "" + + local colourCodePosReverse = sfind(prevlineReverse, "\255") --search string from back to front + + if colourCodePosReverse then + for i = 0,2 do + if ssub(prevlineReverse, colourCodePosReverse + 3 - i, colourCodePosReverse + 3 - i) == "\255" then + colourCodePosReverse = colourCodePosReverse + 3 - i + break + end + end + + local colourCodePos = slen(prevline) - colourCodePosReverse + 1 + if slen(ssub(prevline, colourCodePos)) >= 4 then + newlinecolour = ssub(prevline, colourCodePos, colourCodePos+3) + end + end + + return newlinecolour +end + +local function clipLine(line,fontsize,maxwidth) + local clipped = {} + + local firstclip = line:len() + local firstpass = true + while (1) do --loops over lines + local linelen = slen(line) + local i=1 + while (1) do -- loop through potential positions where we might need to clip + if (glGetTextWidth(ssub(line,1,i+1))*fontsize > maxwidth) then + local test = line + local newlinecolour = "" + + -- set colour of new clipped line + if firstpass == nil then + newlinecolour = lineColour(clipped[#clipped]) + end + + local newline = newlinecolour .. ssub(test,1,i) + + clipped[#clipped+1] = newline + line = ssub(line,i+1) + + if (firstpass) then + firstclip = i + firstpass = nil + end + + break + end + i=i+1 + if (i > linelen) then + break + end + end + + -- check if we need to clip again + local width = glGetTextWidth(line)*fontsize + if (width <= maxwidth) then + break + end + end + + -- put remainder of line into final clipped line + local newlinecolour = "" + if #clipped > 0 then + newlinecolour = lineColour(clipped[#clipped]) + end + clipped[#clipped+1] = newlinecolour .. line + + return clipped,firstclip +end + +local function clipHistory(g,oneline) + local history = g.vars.consolehistory + local maxsize = g.background.sx - (g.lines.px-g.background.px) + + local fontsize = g.lines.fontsize + + if (oneline) then + local line = history[#history] + local lines,firstclip = clipLine(line[1],fontsize,maxsize) + line[1] = ssub(line[1],1,firstclip) + for i=1,#lines do + if (i>1) then + history[#history+1] = {line[4]..lines[i],line[2],line[3],line[4],line[5]} + end + end + else + local clippedhistory = {} + for i=1,#history do + local line = history[i] + local lines,firstclip = clipLine(line[1],fontsize,maxsize) + lines[1] = ssub(line[1],1,firstclip) + for i=1,#lines do + if (i>1) then + clippedhistory[#clippedhistory+1] = {line[4]..lines[i],line[2],line[3],line[4],line[5]} + else + clippedhistory[#clippedhistory+1] = {lines[i],line[2],line[3],line[4],line[5]} + end + end + end + g.vars.consolehistory = clippedhistory + end +end + +local function convertColor(r,g,b) + return schar(255, (r*255), (g*255), (b*255)) +end + +local function processLine(line,g,cfg,newlinecolor) + + g.vars.nextupdate = 0 + + local roster = GetPlayerRoster() + --[[DEBUG + for i,el in pairs(roster) do + if i==1 then + Spring.Echo(#el) + for j,val in pairs(el) do + Spring.Echo(j,val) + end + end + Spring.Echo(i,el) + end + --]] + + local names = {} + for i=1,#roster do + names[roster[i][1]] = {roster[i][4],roster[i][5],roster[i][3],roster[i][2]} + -- Spring.Echo(roster[i][3]) + -- if roster[i][3] == Spring.GetMyPlayerID() then + -- Spring.Echo(Spring.GetMyPlayerID()) + -- myname = roster[i][1] + -- end + end + local name = "" + local text = "" + local linetype = 0 --other + if Initialized == true then + ignoreThisMessage = false + else + ignoreThisMessage = false + end + local playSound = false + + 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 + 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 + linetype = 1 --playermessage + name = ssub(line,2,sfind(line,"> ")-1) + text = ssub(line,slen(name)+4) + if ssub(text,1,1) == "!" then + ignoreThisMessage = true + if myname and myname == name then + waitbotanswer = true + end + end + elseif (names[ssub(line,2,(sfind(line,"] ") or 1)-1)] ~= nil) then + ignoreThisMessage = true + linetype = 2 --spectatormessage + name = ssub(line,2,sfind(line,"] ")-1) + text = ssub(line,slen(name)+4) + if ssub(text,1,1) == "!" then + ignoreThisMessage = true + -- Spring.Echo(name) + -- Spring.Echo(myname) + if myname and myname == name then + waitbotanswer = true + end + end + elseif (names[ssub(line,2,(sfind(line,"(replay)") or 3)-3)] ~= nil) then + ignoreThisMessage = true + linetype = 2 --spectatormessage + name = ssub(line,2,sfind(line,"(replay)")-3) + text = ssub(line,slen(name)+13) + if ssub(text,1,1) == "!" then + ignoreThisMessage = true + if myname and myname == name then + waitbotanswer = true + end + end + elseif (names[ssub(line,1,(sfind(line," added point: ") or 1)-1)] ~= nil) then + ignoreThisMessage = true + linetype = 3 --playerpoint + name = ssub(line,1,sfind(line," added point: ")-1) + text = ssub(line,slen(name.." added point: ")+1) + elseif (ssub(line,1,1) == ">") then + linetype = 4 --gamemessage + playSound = true + text = ssub(line,3) + if sfind(text, "Invalid command" )or sfind(line, "not a valid") or sfind(text, "you cannot") or sfind(text, "You are not allowed") or (sfind(text, "Invalid") and sfind(text, "you are not allowed to vote for command")) or sfind(text, "Unable to") or sfind(text, "Could not find") or sfind(text, "Ringing") or sfind(text, " is no one to ring") then + ignoreThisMessage = true + playSound = false + if waitbotanswer then + playSound = true + ignoreThisMessage = false + waitbotanswer = nil + if sfind(text, myname) then + ignoreThisMessage = false + playSound = true + end + end + end + if sfind(text, "BAAlphatest1") then + playSound = true + text = ssub(text, sfind(text, "BAAlphatest1") + 15) + end + if sfind(text, "Ticot") then + playSound = true + text = ssub(text, sfind(text, "Ticot") + 8) + end + if sfind(text, "Pirateur") then + playSound = true + text = ssub(text, sfind(text, "Pirateur") + 11) + end + if sfind(text, "OverKillHost1") then + playSound = true + text = ssub(text, sfind(text, "OverKillHost1") + 15) + end + if sfind(text, "Pirine") then + playSound = true + text = ssub(text, sfind(text, "Pirine") + 9) + end + + --PROCESSS VOTES HERE-- + if sfind(text, "called a vote for command") then + -- vote start: "Didgeri[doo] called a vote for command "bKick Didgeri[doo]" [!vote y, !vote n, !vote b]" + local command = ssub(text, sfind(text,"called a vote for command") + 27, sfind(text, '" ')-1) + local user = ssub(text, 1, sfind(text,"called a vote for command")-1) + text = user.." started vote: "..command + elseif sfind(text, "Vote for command") then + -- vote end: "Vote for command "xxx" passed." + status = ssub(text, sfind(text, '" ')+2,sfind(text, '" ')+7) + text = "Vote "..status.."." + -- elseif sfind(text, [[Vote in progress: ]]) then + -- vote progress :"Vote in progress: "bKick Didgeri[doo]" [y:0/2, n:1/2] (39s remaining)" + -- local votes = ssub(text,sfind(text, [[y:]]), sfind(text, [[\(]])-1) + -- local timeremaining = ssub(text,sfind(text, [[ \(]]) + 2, sfind(text, [[ remaining]])-1) + -- text = "Vote: "..votes..", "..timeremaining.." seconds left." + end + + -- Will have to insert a basic autohosts list here, for now it's just available on tests hosts so let's not bother too much. + + if ssub(line,1,3) == "> <" then --player speaking in battleroom + ignoreThisMessage = true + if ssub(text,1,1) == "!" then + ignoreThisMessage = 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 + + if registermyname and not nameregistered then + myname = name + registermyname = false + nameregistered = true + ignoreThisMessage = true + -- Spring.SendCommands("wByNum "..regID.." Registered as "..myname) + end + + -- filter shadows config changes + if sfind(line,"^Set \"shadows\" config(-)parameter to ") then + ignoreThisMessage = true + end + + 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 + -- 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 + -- end + --end + + -- filter Sync error when its a spectator + --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 + -- end + --end + + -- filter Connection attempts + --if sfind(line,"^Connection attempt from ") then + -- name = ssub(line,25) + -- lastConnectionAttempt = name + -- ignoreThisMessage = true + --end + + -- filter Connection established + --if sfind(line," Connection established") then + -- name = lastConnectionAttempt + -- ignoreThisMessage = true + --end + + + if linetype==0 then + --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 + end + + if sfind(line,"Wrong network version") then + local n,_ = sfind(line,"Message") + if n ~= nil then + line = ssub(line,1,n-3) --shorten so as these messages don't get clipped and can be detected as duplicates + end + end + + + if gameOver then + if sfind(line,'left the game') then + ignoreThisMessage = true + end + end + end + + + --ignore messages from muted-- + if WG.ignoredPlayers and WG.ignoredPlayers[name] then + ignoreThisMessage = true + --Spring.Echo ("blocked message by " .. name) + end + + local MyAllyTeamID = sGetMyAllyTeamID() + local textcolor = nil + + + if (linetype==1) then --playermessage + local c = cfg.cothertext + local misccolor = convertColor(c[1],c[2],c[3]) + if (sfind(text,"Allies: ") == 1) then + text = ssub(text,9) + if (names[name][1] == MyAllyTeamID) then + c = cfg.callytext + else + c = cfg.cotherallytext + end + elseif (sfind(text,"Spectators: ") == 1) then + text = ssub(text,13) + c = cfg.cspectext + end + + textcolor = convertColor(c[1],c[2],c[3]) + local r,g,b,a = sGetTeamColor(names[name][3]) + local namecolor = convertColor(r,g,b) + + line = namecolor..name..misccolor..": "..textcolor..text + + playSound = true + + elseif (linetype==2) then --spectatormessage + local c = cfg.cothertext + local misccolor = convertColor(c[1],c[2],c[3]) + if (sfind(text,"Allies: ") == 1) then + text = ssub(text,9) + c = cfg.cspectext + elseif (sfind(text,"Spectators: ") == 1) then + text = ssub(text,13) + c = cfg.cspectext + end + textcolor = convertColor(c[1],c[2],c[3]) + c = cfg.cspectext + local namecolor = convertColor(c[1],c[2],c[3]) + + line = namecolor.."(s) "..name..misccolor..": "..textcolor..text + + playSound = true + + elseif (linetype==3) then --playerpoint + local c = cfg.cspectext + local namecolor = convertColor(c[1],c[2],c[3]) + + local spectator = true + if (names[name] ~= nil) then + spectator = names[name][2] + end + if (spectator) then + name = "(s) "..name + else + local r,g,b,a = sGetTeamColor(names[name][3]) + namecolor = convertColor(r,g,b) + end + + c = cfg.cotherallytext + if (spectator) then + c = cfg.cspectext + elseif (names[name][1] == MyAllyTeamID) then + c = cfg.callytext + end + textcolor = convertColor(c[1],c[2],c[3]) + c = cfg.cothertext + local misccolor = convertColor(c[1],c[2],c[3]) + + 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 + else --every other message + local c = cfg.cmisctext + textcolor = convertColor(c[1],c[2],c[3]) + + line = textcolor..line + end + + if (g.vars.consolehistory == nil) then + g.vars.consolehistory = {} + end + local history = g.vars.consolehistory + + if not Initialized then + ignoreThisMessage = false + 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 and not Spring.IsGUIHidden() ) then + spPlaySoundFile( SoundIncomingChat, SoundIncomingChatVolume, nil, "ui" ) + end + end + onelinedone = true + return history[#history] +end + +local function updateconsole(g,cfg) + local forceupdate = g.vars._forceupdate + local justforcedupdate = g.vars._justforcedupdate + + if (forceupdate and (not justforcedupdate)) then + g.vars._justforcedupdate = true + g.vars._forceupdate = nil + else + g.vars._justforcedupdate = nil + g.vars._forceupdate = nil + + if (g.vars.nextupdate == nil) then + g.vars.nextupdate = 0 + end + if ((g.vars.nextupdate < 0) or (clock() < g.vars.nextupdate)) then + return + end + end + + local skipagecheck = g.vars._skipagecheck + local usecounters = g.vars._usecounters + + local maxlines = cfg.maxlines + + local historyoffset = 0 + if (g.vars.browsinghistory) then + if (g.vars.historyoffset == nil) then + g.vars.historyoffset = 0 + end + historyoffset = g.vars.historyoffset + maxlines = cfg.maxlinesScrollmode + end + + if (usecounters == nil) then + usecounters = cfg.filterduplicates + end + + + local counters = {} + for i=1,maxlines do + counters[i] = 1 + if g.counters[i] == nil then + g.counters[i] = {} + end + g.counters[i].active = false + g.counters[i].caption = "" + end + + local maxage = cfg.maxage + local display = "" + local count = 0 + local i=0 + local lastID = 0 + local lastLine = "" + + local history = g.vars.consolehistory or {} + + while (count < maxlines) do + if (history[#history-i-historyoffset]) then + local line = history[#history-i-historyoffset] + if (skipagecheck or ((clock()-line[2]) <= maxage)) then + if (count == 0) then + count = count + 1 + display = line[1] + else + if (usecounters and (lastID > 0) and (lastID~=line[3]) and (line[1] == lastLine)) then + counters[count] = counters[count] + 1 + else + count = count + 1 + display = line[1].."\n"..display + end + end + + lastLine = line[1] + lastID = line[3] + + if (skipagecheck) then + g.vars.nextupdate = -1 + else + g.vars.nextupdate = line[2]+maxage + end + else + break + end + i=i+1 + else + break + end + end + + if (usecounters) then + for i=1,#counters do + if (counters[i] ~= 1) then + local counter = count-i+1 + g.counters[counter].active = nil + g.counters[counter].caption = counters[i].."x" + end + end + end + + if (count == 0) then + g.vars.nextupdate = -1 --no update until new console line + g.background.active = false + g.lines.active = false + g.vars._empty = true + g.background.sy = (cfg.minlines*g.lines.fontsize + (g.lines.px-g.background.px)*2 ) -(cfg.margin/3.5) + else + g.background.active = nil --activate + g.lines.active = nil --activate + g.vars._empty = nil + g.background.sy = (count*g.lines.fontsize + (g.lines.px-g.background.px)*2 ) -(cfg.margin/3.5) + end + + g.lines.caption = display + g.lines.sx = 100 +end + +function widget:Initialize() +regID = tostring(Spring.GetMyPlayerID()) + PassedStartupCheck = RedUIchecks() + if (not PassedStartupCheck) then return end + + console = createconsole(Config.console) + Spring.SendCommands("console 0") + Spring.SendCommands('inputtextgeo 0.26 0.73 0.02 0.028') + AutoResizeObjects() +end + +function widget:GameOver() + gameOver = true +end + +function widget:Shutdown() + Spring.SendCommands("console 1") +end + +function widget:AddConsoleLine(lines,priority) + lines = lines:match('^\[f=[0-9]+\] (.*)$') or lines + local textcolor + for line in lines:gmatch("[^\n]+") do + textcolor = processLine(line, console, Config.console, textcolor)[4] + end + clipHistory(console,true) +end + +function widget:Update() + updateconsole(console,Config.console) + AutoResizeObjects() +if not Initialized then + if onelinedone == true then +Initialized = true +regID = tostring(Spring.GetMyPlayerID()) +Spring.SendCommands("wByNum "..regID.." My player ID is "..regID) +end +end +end + +--save/load stuff +--currently only position +function widget:GetConfigData() --save config + if (PassedStartupCheck) then + local vsy = Screen.vsy + Config.console.px = console.background.px + Config.console.py = console.background.py + return {Config=Config} + 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 + 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_chatonlyconsole.lua b/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua new file mode 100644 index 000000000..07893fa17 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_red_chatonlyconsole.lua @@ -0,0 +1,964 @@ +-- disable as clipLine is very slow on headless +if (Spring.GetConfigInt('Headless', 0) ~= 0) then + return false +end + +function widget:GetInfo() + return { + name = "Red Console (In-game chat only)", --version 4.1 + desc = "Requires Red UI Framework", + author = "Regret + Doo edit", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true, --enabled by default + handler = true, --can use widgetHandler:x() + } +end +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (1 + (vsx*vsy / 4000000)) + +local NeededFrameworkVersion = 8 +local SoundIncomingChat = 'sounds/ui/beep4.wav' +local SoundIncomingChatVolume = 1.0 + +local gameOver = false +local lastConnectionAttempt = '' +--todo: dont cut words apart when clipping text + + +local clock = os.clock +local slen = string.len +local ssub = string.sub +local sgsub = string.gsub +local sfind = string.find +local sformat = string.format +local schar = string.char +local sgsub = string.gsub +local mfloor = math.floor +local sbyte = string.byte +local sreverse = string.reverse +local mmax = math.max +local glGetTextWidth = gl.GetTextWidth +local sGetPlayerRoster = GetPlayerRoster +local sGetTeamColor = Spring.GetTeamColor +local sGetMyAllyTeamID = Spring.GetMyAllyTeamID +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 = 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 + + fadetime = 0.25, --fade effect time, in seconds + fadedistance = 1*widgetScale, --distance from cursor at which console shows up when empty + + filterduplicates = true, --group identical lines, f.e. ( 5x Nickname: blahblah) + + --note: transparency for text not supported yet + cothertext = {1,1,1,1}, --normal chat color + callytext = {0,1,0,1}, --ally chat + cspectext = {1,1,0,1}, --spectator chat + + cotherallytext = {1,0.5,0.5,1}, --enemy ally messages (seen only when spectating) + cmisctext = {0.78,0.78,0.78,1}, --everything else + cgametext = {0.4,1,1,1}, --server (autohost) chat + + cbackground = {0,0,0,0.0}, + cborder = {0,0,0,0}, + + 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 console.\n".. + "- Press \255\255\255\1CTRL\255\255\255\255 while mouse is above the \nconsole to activate chatlog viewing.\n".. + "- Use mousewheel (+hold \255\255\255\1SHIFT\255\255\255\255 for speedup)\n to scroll through the chatlog.", + }, + }, +} + + +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 GetPlayerRoster() +PlayerRoster = {} + if Engine and Engine.version then + PlayerList = Spring.GetPlayerList() + for ct,playerID in pairs(PlayerList) do + PlayerInfo = {Spring.GetPlayerInfo(playerID)} + PlayerRoster[ct] = {} + PlayerRoster[ct][1] = PlayerInfo[1] + PlayerRoster[ct][2] = playerID + PlayerRoster[ct][3] = PlayerInfo[4] + PlayerRoster[ct][4] = PlayerInfo[5] + PlayerRoster[ct][5] = PlayerInfo[3] + PlayerRoster[ct][6] = PlayerInfo[7] + PlayerRoster[ct][7] = PlayerInfo[6] + -- Spring.Echo(PlayerInfo) + end + return PlayerRoster + else + return Spring.GetPlayerRoster() + end +end + +local function AutoResizeObjects() --autoresize v2 + if (LastAutoResizeX==nil) then + LastAutoResizeX = vsx + LastAutoResizeY = vsy + 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 createconsole(r) + local vars = {} + + local lines = {"text", + px=r.px+r.margin,py=r.py+r.margin, + fontsize=r.fontsize, + caption="", + options="o", --black outline + } + + local activationarea = {"area", + px=r.px-r.fadedistance,py=r.py-r.fadedistance, + sx=r.sx+r.fadedistance*2,sy=0, + + mousewheel=function(up,mx,my,self) + if (vars.browsinghistory) then + local alt,ctrl,meta,shift = Spring.GetModKeyState() + local step = 1 + if (shift) then + step = 5 + end + if (vars.historyoffset == nil) then + vars.historyoffset = 0 + end + if (up) then + vars.historyoffset = vars.historyoffset + step + vars._forceupdate = true + else + vars.historyoffset = vars.historyoffset - step + vars._forceupdate = true + end + if (vars.historyoffset > (#vars.consolehistory - r.maxlines)) then + vars.historyoffset = #vars.consolehistory - r.maxlines + elseif (vars.historyoffset < 0) then + vars.historyoffset = 0 + end + end + end, + } + + local background = {"rectanglerounded", + px=r.px,py=r.py, + sx=r.sx,sy=r.maxlines*r.fontsize+r.margin*2, + color=r.cbackground, + border=r.cborder, + movable=r.dragbutton, + + obeyscreenedge = true, + --overrideclick = {2}, + + movableslaves={lines,activationarea}, + + effects = { + fadein_at_activation = r.fadetime, + fadeout_at_deactivation = r.fadetime, + }, + } + + activationarea.onupdate=function(self) + local fadedistance = (self.sx-background.sx)/2 + self.sy = background.sy+fadedistance*2 + self.px = background.px-fadedistance + self.py = background.py-fadedistance + + if (not self._mousenotover) then + background.active = nil --activate + if (vars._empty) then + background.sy = (r.minlines*lines.fontsize + (lines.px-background.px)*2) + end + local alt,ctrl,meta,shift = Spring.GetModKeyState() + if (ctrl and not vars.browsinghistory) then + if (vars._skipagecheck == nil) then + vars._forceupdate = true + vars.nextupdate = -1 + vars.browsinghistory = true + vars.historyoffset = 0 + + self.overridewheel = true + end + vars._skipagecheck = true + vars._usecounters = false + end + else + if (vars._skipagecheck ~= nil) then + vars._forceupdate = true + vars.browsinghistory = nil + vars.historyoffset = 0 + + self.overridewheel = nil + vars._skipagecheck = nil + vars._usecounters = nil + end + end + + self._mousenotover = nil + end + activationarea.mousenotover=function(mx,my,self) + self._mousenotover = true + if (vars._empty) then + background.active = false + end + end + + New(activationarea) + New(background) + New(lines) + + local counters = {} + for i=1,r.maxlines do + local b = New(lines) + b.onupdate = function(self) + self.px = background.px - self.getwidth() - (lines.px-background.px) + end + b._count = 0 + b.active = false + b.py = b.py+(i-1)*r.fontsize + counters[#counters+1] = b + background.movableslaves[#background.movableslaves+1] = b + end + + --tooltip + background.mouseover = function(mx,my,self) SetTooltip(r.tooltip.background) end + + background.active = nil + + return { + ["background"] = background, + ["lines"] = lines, + ["counters"] = counters, + ["vars"] = vars + } +end + +local function lineColour(prevline) -- search prevline and find the final instance of a colour code + + local prevlineReverse = sreverse(prevline) + local newlinecolour = "" + + local colourCodePosReverse = sfind(prevlineReverse, "\255") --search string from back to front + + if colourCodePosReverse then + for i = 0,2 do + if ssub(prevlineReverse, colourCodePosReverse + 3 - i, colourCodePosReverse + 3 - i) == "\255" then + colourCodePosReverse = colourCodePosReverse + 3 - i + break + end + end + + local colourCodePos = slen(prevline) - colourCodePosReverse + 1 + if slen(ssub(prevline, colourCodePos)) >= 4 then + newlinecolour = ssub(prevline, colourCodePos, colourCodePos+3) + end + end + + return newlinecolour +end + +local function clipLine(line,fontsize,maxwidth) + local clipped = {} + + local firstclip = line:len() + local firstpass = true + while (1) do --loops over lines + local linelen = slen(line) + local i=1 + while (1) do -- loop through potential positions where we might need to clip + if (glGetTextWidth(ssub(line,1,i+1))*fontsize > maxwidth) then + local test = line + local newlinecolour = "" + + -- set colour of new clipped line + if firstpass == nil then + newlinecolour = lineColour(clipped[#clipped]) + end + + local newline = newlinecolour .. ssub(test,1,i) + + clipped[#clipped+1] = newline + line = ssub(line,i+1) + + if (firstpass) then + firstclip = i + firstpass = nil + end + + break + end + i=i+1 + if (i > linelen) then + break + end + end + + -- check if we need to clip again + local width = glGetTextWidth(line)*fontsize + if (width <= maxwidth) then + break + end + end + + -- put remainder of line into final clipped line + local newlinecolour = "" + if #clipped > 0 then + newlinecolour = lineColour(clipped[#clipped]) + end + clipped[#clipped+1] = newlinecolour .. line + + return clipped,firstclip +end + +local function clipHistory(g,oneline) + local history = g.vars.consolehistory + local maxsize = g.background.sx - (g.lines.px-g.background.px) + + local fontsize = g.lines.fontsize + + if (oneline) then + local line = history[#history] + local lines,firstclip = clipLine(line[1],fontsize,maxsize) + line[1] = ssub(line[1],1,firstclip) + for i=1,#lines do + if (i>1) then + history[#history+1] = {line[4]..lines[i],line[2],line[3],line[4],line[5]} + end + end + else + local clippedhistory = {} + for i=1,#history do + local line = history[i] + local lines,firstclip = clipLine(line[1],fontsize,maxsize) + lines[1] = ssub(line[1],1,firstclip) + for i=1,#lines do + if (i>1) then + clippedhistory[#clippedhistory+1] = {line[4]..lines[i],line[2],line[3],line[4],line[5]} + else + clippedhistory[#clippedhistory+1] = {lines[i],line[2],line[3],line[4],line[5]} + end + end + end + g.vars.consolehistory = clippedhistory + end +end + +local function convertColor(r,g,b) + return schar(255, (r*255), (g*255), (b*255)) +end + +local function processLine(line,g,cfg,newlinecolor) + + + g.vars.nextupdate = 0 + + local roster = GetPlayerRoster() + --[[DEBUG + for i,el in pairs(roster) do + if i==1 then + Spring.Echo(#el) + for j,val in pairs(el) do + Spring.Echo(j,val) + end + end + Spring.Echo(i,el) + end + --]] + + local names = {} + for i=1,#roster do + names[roster[i][1]] = {roster[i][4],roster[i][5],roster[i][3],roster[i][2]} + end + + local name = "" + local text = "" + local linetype = 0 --other + if Initialized == true then + bypassThisMessage = true + else + 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 + bypassThisMessage = true + end + + if (not newlinecolor) then + if (names[ssub(line,2,(sfind(line,"> ") or 1)-1)] ~= nil) then + 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 + bypassThisMessage = true + end + elseif (names[ssub(line,2,(sfind(line,"] ") or 1)-1)] ~= nil) then + 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 + bypassThisMessage = true + end + elseif (names[ssub(line,2,(sfind(line,"(replay)") or 3)-3)] ~= nil) then + 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 + bypassThisMessage = true + end + elseif (names[ssub(line,1,(sfind(line," added point: ") or 1)-1)] ~= nil) then + bypassThisMessage = false + linetype = 3 --playerpoint + name = ssub(line,1,sfind(line," added point: ")-1) + text = ssub(line,slen(name.." added point: ")+1) + if text == "" then + text = "Look here!" + end + elseif (ssub(line,1,1) == ">") then + linetype = 4 --gamemessage + text = ssub(line,3) + bypassThisMessage = true + if ssub(line,1,3) == "> <" then --player speaking in battleroom + 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 + + if registermyname and not nameregistered then + myname = name + registermyname = false + nameregistered = true + bypassThisMessage = true + elseif sfind(line, "My player ID is") and sfind(line, regID) then + bypassThisMessage = true + end + + -- filter shadows config changes + if sfind(line,"^Set \"shadows\" config(-)parameter to ") then + bypassThisMessage = true + end + + + -- filter Sync error when its a spectator + 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 + bypassThisMessage = true + end + end + + -- filter Sync error when its a spectator + 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 + bypassThisMessage = true + end + end + + -- filter Connection attempts + if sfind(line,"^Connection attempt from ") then + name = ssub(line,25) + lastConnectionAttempt = name + bypassThisMessage = true + end + + -- filter Connection established + if sfind(line," Connection established") then + name = lastConnectionAttempt + bypassThisMessage = true + end + + + if linetype==0 then + --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 + bypassThisMessage = true + end + + if sfind(line,"Wrong network version") then + local n,_ = sfind(line,"Message") + if n ~= nil then + line = ssub(line,1,n-3) --shorten so as these messages don't get clipped and can be detected as duplicates + end + end + + + if gameOver then + if sfind(line,'left the game') then + bypassThisMessage = true + end + end + end + + + --ignore messages from muted-- + if WG.ignoredPlayers and WG.ignoredPlayers[name] then + bypassThisMessage = true + --ignoreThisMessage = true + --Spring.Echo ("blocked message by " .. name) + end + + local MyAllyTeamID = sGetMyAllyTeamID() + local textcolor = nil + + local playSound = false + if (linetype==1) then --playermessage + local c = cfg.cothertext + local misccolor = convertColor(c[1],c[2],c[3]) + if (sfind(text,"Allies: ") == 1) then + text = ssub(text,9) + if (names[name][1] == MyAllyTeamID) then + c = cfg.callytext + else + c = cfg.cotherallytext + end + elseif (sfind(text,"Spectators: ") == 1) then + text = ssub(text,13) + c = cfg.cspectext + end + + 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 + + playSound = true + + elseif (linetype==2) then --spectatormessage + local c = cfg.cothertext + local misccolor = convertColor(c[1],c[2],c[3]) + if (sfind(text,"Allies: ") == 1) then + text = ssub(text,9) + c = cfg.cspectext + elseif (sfind(text,"Spectators: ") == 1) then + text = ssub(text,13) + c = cfg.cspectext + end + textcolor = convertColor(c[1],c[2],c[3]) + c = cfg.cspectext + local namecolor = convertColor(c[1],c[2],c[3]) + if ignoreThisMessage then text = ignoredText end + + line = namecolor.."(s) "..name..misccolor..": "..textcolor..text + + playSound = true + + elseif (linetype==3) then --playerpoint + local c = cfg.cspectext + local namecolor = convertColor(c[1],c[2],c[3]) + + local spectator = true + if (names[name] ~= nil) then + spectator = names[name][2] + end + if (spectator) then + name = "(s) "..name + else + local r,g,b,a = sGetTeamColor(names[name][3]) + namecolor = convertColor(r,g,b) + end + + c = cfg.cotherallytext + if (spectator) then + c = cfg.cspectext + elseif (names[name][1] == MyAllyTeamID) then + c = cfg.callytext + end + 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]) + 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]) + + line = textcolor..line + end + + if (g.vars.consolehistory == nil) then + g.vars.consolehistory = {} + end + local history = g.vars.consolehistory + + + 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 bypassThisMessage == true) and not Spring.IsGUIHidden() then + spPlaySoundFile( SoundIncomingChat, SoundIncomingChatVolume, nil, "ui" ) + end + end + onelinedone = true + return history[#history] +end + +local function updateconsole(g,cfg) + local forceupdate = g.vars._forceupdate + local justforcedupdate = g.vars._justforcedupdate + + if (forceupdate and (not justforcedupdate)) then + g.vars._justforcedupdate = true + g.vars._forceupdate = nil + else + g.vars._justforcedupdate = nil + g.vars._forceupdate = nil + + if (g.vars.nextupdate == nil) then + g.vars.nextupdate = 0 + end + if ((g.vars.nextupdate < 0) or (clock() < g.vars.nextupdate)) then + return + end + end + + local skipagecheck = g.vars._skipagecheck + local usecounters = g.vars._usecounters + + local maxlines = cfg.maxlines + + local historyoffset = 0 + if (g.vars.browsinghistory) then + if (g.vars.historyoffset == nil) then + g.vars.historyoffset = 0 + end + historyoffset = g.vars.historyoffset + maxlines = cfg.maxlinesScrollmode + end + + if (usecounters == nil) then + usecounters = cfg.filterduplicates + end + + + local counters = {} + for i=1,maxlines do + counters[i] = 1 + if g.counters[i] == nil then + g.counters[i] = {} + end + g.counters[i].active = false + g.counters[i].caption = "" + end + + local maxage = cfg.maxage + local display = "" + local count = 0 + local i=0 + local lastID = 0 + local lastLine = "" + + local history = g.vars.consolehistory or {} + + while (count < maxlines) do + if (history[#history-i-historyoffset]) then + local line = history[#history-i-historyoffset] + if (skipagecheck or ((clock()-line[2]) <= maxage)) then + if (count == 0) then + count = count + 1 + display = line[1] + else + if (usecounters and (lastID > 0) and (lastID~=line[3]) and (line[1] == lastLine)) then + counters[count] = counters[count] + 1 + else + count = count + 1 + display = line[1].."\n"..display + end + end + + lastLine = line[1] + lastID = line[3] + + if (skipagecheck) then + g.vars.nextupdate = -1 + else + g.vars.nextupdate = line[2]+maxage + end + else + break + end + i=i+1 + else + break + end + end + + if (usecounters) then + for i=1,#counters do + if (counters[i] ~= 1) then + local counter = count-i+1 + g.counters[counter].active = nil + g.counters[counter].caption = counters[i].."x" + end + end + end + + if (count == 0) then + g.vars.nextupdate = -1 --no update until new console line + g.background.active = false + g.lines.active = false + g.vars._empty = true + g.background.sy = (cfg.minlines*g.lines.fontsize + (g.lines.px-g.background.px)*2 ) -(cfg.margin/3.5) + else + g.background.active = nil --activate + g.lines.active = nil --activate + g.vars._empty = nil + g.background.sy = (count*g.lines.fontsize + (g.lines.px-g.background.px)*2 ) -(cfg.margin/3.5) + end + + g.lines.caption = display + g.lines.sx = 100 +end + +function widget:Initialize() + regID = tostring(Spring.GetMyPlayerID()) + PassedStartupCheck = RedUIchecks() + if (not PassedStartupCheck) then return end + + console = createconsole(Config.console) + 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() + gameOver = true +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) + lines = lines:match('^\[f=[0-9]+\] (.*)$') or lines + local textcolor + for line in lines:gmatch("[^\n]+") do + textcolor = processLine(line, console, Config.console, textcolor)[4] + end + clipHistory(console,true) +end + +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 + 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 (console ~= nil) then + local vsy = Screen.vsy + Config.console.px = console.background.px + Config.console.py = console.background.py + 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 new file mode 100644 index 000000000..93fe8a9e4 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_red_minimap.lua @@ -0,0 +1,408 @@ +function widget:GetInfo() + return { + version = "2", + name = "Red Minimap", + desc = "Requires Red UI Framework", + author = "Regret", + date = "December 7, 2009", --last change December 11,2009 + license = "GNU GPL, v2 or later", + layer = -11, + enabled = true, --enabled by default + handler = true, --can use widgetHandler:x() + } +end +local vsx, vsy = gl.GetViewSizes() + +local rescalevalue = 1.26 +local buttonScale = 2 +local NeededFrameworkVersion = 8 +--local CanvasX,CanvasY = 1272/rescalevalue,734/rescalevalue --resolution in which the widget was made (for 1:1 size) +local CanvasX,CanvasY = vsx,vsy --resolution in which the widget was made (for 1:1 size) +--1272,734 == 1280,768 windowed + +local widgetScale = (1 + (vsx*vsy / 7500000)) + +local maxSx = CanvasX*0.275 +local maxSy = CanvasY*0.23 + +local Config = { + minimap = { + px = 0,py = 0, --default start position + sx = math.min(maxSy*(Game.mapX/Game.mapY), maxSx), sy = maxSy, --background size + + bsx = 15,bsy = 15, --button size + + fadetime = 0.25, --fade effect time, in seconds + fadedistance = 100, --distance from cursor at which console shows up when empty + + cresizebackground = {0.9,0.9,0.9,0.5}, --color {r,g,b,alpha} + cresizecolor = {1,1,1,1}, + + cmovebackground = {0,1,0,0.5}, + cmovecolor = {0.9,0.9,0.9,0.8}, + + cborder = {0,0,0,0}, + cbackground = {0,0,0,0.55}, + cbordersize = 2.25*widgetScale, + + dragbutton = {1}, --left mouse button + tooltip = { + --todo? kinda useless + }, + }, +} + +local sformat = string.format +local sSendCommands = Spring.SendCommands +local sGetMiniMapGeometry = Spring.GetMiniMapGeometry +local sGetCameraState = Spring.GetCameraState +local sceduleMinimapGeometry = false + + +function widget:ViewResize(newX,newY) + vsx, vsy = gl.GetViewSizes() + widgetScale = (1 + (vsx*vsy / 7500000)) + Config.minimap.cbordersize = 2.25*widgetScale +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 createminimap(r) + local minimap = {"rectangle", + px=r.px,py=r.py, + sx=r.sx,sy=r.sy, + border=r.cborder, + obeyscreenedge = true, + } + local minimapbg = {"rectanglerounded", + px=r.px-r.cbordersize,py=r.py, + sx=r.sx,sy=r.sy, + color=r.cbackground, + obeyscreenedge = true, + bordersize=r.cbordersize + } + + local resizebutton = {"rectangle", + px=r.px+r.sx-r.bsx,py=r.py+r.sy-1, + sx=r.bsx*buttonScale,sy=r.bsy*buttonScale, + + color=r.cresizebackground, + texturecolor=r.cmovecolor, + texture="LuaUI/Images/RedMinimap/resize.png", + border=r.cborder, + movable=r.dragbutton, + overridecursor = true, + overrideclick = r.dragbutton, + roundedsize = math.floor(r.bsy*0.15), + onlyTweakUi = false, + + effects = { + fadein_at_activation = r.fadetime, + fadeout_at_deactivation = r.fadetime, + }, + } + local offsetcorrection = r.bsx - ((r.bsx * buttonScale)) + local movebutton = {"rectangle", + px=r.px+r.sx-r.bsx*2+1 + offsetcorrection,py=r.py+r.sy-1, + sx=r.bsx*buttonScale,sy=r.bsy*buttonScale, + + color=r.cmovebackground, + texturecolor=r.cmovecolor, + texture="LuaUI/Images/RedMinimap/move.png", + + border=r.cborder, + movable=r.dragbutton, + obeyscreenedge = true, + overridecursor = true, + overrideclick = r.dragbutton, + roundedsize = math.floor(r.bsy*0.15), + onlyTweakUi = false, + + effects = { + fadein_at_activation = r.fadetime, + fadeout_at_deactivation = r.fadetime, + }, + } + + New(movebutton) + New(resizebutton) + New(minimap) + New(minimapbg) + + resizebutton.mouseover = function(mx,my,self) + self.active = nil + movebutton.active = nil + + if (not self._mouseover) then + self._color4 = self.color[4] + self.color[4] = 4 + end + + self._mouseover = true + end + resizebutton.mousenotover = function(mx,my,self) + if ((not minimap._mouseover) and (not movebutton._mouseover)) then + self.active = false --deactivate + end + + if (self._mouseover) then + self.color[4] = self._color4 + end + + self._mouseover = nil + end + + movebutton.mouseover = function(mx,my,self) + self.active = nil + resizebutton.active = nil + + if (not self._mouseover) then + self._color4 = self.color[4] + self.color[4] = 1 + end + + self._mouseover = true + end + movebutton.mousenotover = function(mx,my,self) + if ((not minimap._mouseover) and (not resizebutton._mouseover)) then + self.active = false --deactivate + end + + if (self._mouseover) then + self.color[4] = self._color4 + end + + self._mouseover = nil + end + + minimap.onupdate=function(self) + self.sx = resizebutton.px-self.px+resizebutton.sx + self.sy = resizebutton.py-self.py+1 + minimapbg.px = self.px - minimapbg.bordersize + minimapbg.py = self.py - minimapbg.bordersize + minimapbg.sx = self.sx + minimapbg.bordersize + minimapbg.bordersize + minimapbg.sy = self.sy + minimapbg.bordersize + minimapbg.bordersize + end + resizebutton.onupdate=function(self) + if (self._mouseover) then + self.minpx = minimap.px+r.bsx-1 + self.minpy = minimap.py+r.bsx + else + self.minpx = 0 + self.minpy = 0 + end + self.maxpx = Screen.vsx + self.maxpy = Screen.vsy + end + + minimap.mousenotover = function(mx,my,self) + self._mouseover = nil + end + + minimap.mouseover = function(mx,my,self) + self._mouseover = true + + movebutton.active = nil + resizebutton.active = nil + end + + minimap.movableslaves = { + movebutton, + } + movebutton.movableslaves = { + minimap,resizebutton, + } + resizebutton.movableslaves = { + movebutton, + } + + return minimap +end + +function widget:Initialize() + --oldMinimapGeometry = Spring.GetConfigString("MiniMapGeometry","2 2 200 200") -- store original geometry + oldMinimapGeometry = sGetMiniMapGeometry() + + PassedStartupCheck = RedUIchecks() + if (not PassedStartupCheck) then return end + + rMinimap = createminimap(Config.minimap) + + gl.SlaveMiniMap(true) + + AutoResizeObjects() --fix for displacement on crash issue +end + +local lastPos = {} + + +function widget:ViewResize(viewSizeX, viewSizeY) + sceduleMinimapGeometry = true +end + + +function widget:Update() + local _,_,_,_,minimized,maximized = sGetMiniMapGeometry() + if (maximized) then + --hack to reset state minimap + gl.SlaveMiniMap(false) + gl.SlaveMiniMap(true) + ---- + end + + if (minimized) then + rMinimap.active = false + --hack to reset state minimap + gl.SlaveMiniMap(false) + gl.SlaveMiniMap(true) + ---- + else + rMinimap.active = nil + end + + local st = sGetCameraState() + if (st.name == "ov") then --overview camera + rMinimap.active = false + else + rMinimap.active = nil + end + + AutoResizeObjects() + if ((lastPos.px ~= rMinimap.px) or (lastPos.py ~= rMinimap.py) or (lastPos.sx ~= rMinimap.sx) or (lastPos.sy ~= rMinimap.sy) or sceduleMinimapGeometry) then + sSendCommands(sformat("minimap geometry %i %i %i %i", + rMinimap.px, + rMinimap.py, + rMinimap.sx, + rMinimap.sy)) + sceduleMinimapGeometry = false + end + lastPos.px = rMinimap.px + lastPos.py = rMinimap.py + lastPos.sx = rMinimap.sx + 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 + end + -- this makes jK rage + gl.ResetState() + gl.ResetMatrices() + ---- + + --gl.SlaveMiniMap(true) + gl.DrawMiniMap() + --gl.SlaveMiniMap(false) + + -- this makes jK rage + gl.ResetState() + gl.ResetMatrices() + ---- +end + +function widget:Shutdown() + gl.SlaveMiniMap(false) + Spring.SendCommands("minimap geometry "..oldMinimapGeometry) +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.minimap.px = rMinimap.px * unscale + Config.minimap.py = rMinimap.py * unscale + return {Config=Config} + end +end +function widget:SetConfigData(data) --load config + if (data.Config ~= nil) then + Config.minimap.px = data.Config.minimap.px + Config.minimap.py = data.Config.minimap.py + 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 new file mode 100644 index 000000000..9045fc66c --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_replaybuttons.lua @@ -0,0 +1,375 @@ +--http://springrts.com/phpbb/viewtopic.php?f=23&t=30560 +function widget:GetInfo() + return { + name = "replay buttons", + desc = "click buttons to change replay speed", + author = "knorke", + version = "1", + date = "June 2013", + license = "click button magic", + layer = 10, + enabled = true, + } +end + +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) +local wantedSpeed = nil +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 + Spring.Echo ("[Replay Control] Replay not detected, Shutting Down.") + widgetHandler:RemoveWidget(self) + return + end + + local dy = 0 + local h = 0.033 + for i = 1, #speeds do + dy=dy+h + add_button (speedbuttons, wPos.x, wPos.y+dy, 0.037, 0.033, " " .. speeds[i].."x", speeds[i], speedButtonColor (i)) + end + speedbuttons[2].color = {0.75,0,0,0.66} + dy=dy+h + local text = " skip" + if Spring.GetGameFrame() > 0 then + text = " ||" + end + add_button (buttons, wPos.x, wPos.y, 0.037, 0.033, text,"playpauseskip", {0,0,0,0.6}) + +end + +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 chobbyInterface then return end + if WG['guishader'] then + if isActive then + local h = 0.033 + local dy = (#speeds +1) * h + + 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'].DeleteDlist('replaybuttons') + end + end + + if not isActive then return end + 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) + if not isActive then return end + local cb,i = clicked_button (speedbuttons) + if cb ~= "NOBUTTONCLICKED" then + setReplaySpeed (speeds[i], i) + for i = 1, #speeds do --reset all buttons colors + speedbuttons[i].color = speedButtonColor (i) + end + speedbuttons[i].color = {0.75,0,0,0.66 } + sceduleUpdate = true + end + + local cb,i = clicked_button (buttons) + if cb == "playpauseskip" then + if Spring.GetGameFrame () > 1 then + if (isPaused) then + Spring.SendCommands ("pause 0") + buttons[i].text = " ||" + isPaused = false + else + Spring.SendCommands ("pause 1") + buttons[i].text = " >>" + isPaused = true + end + else + Spring.SendCommands ("skip 1") + buttons[i].text = " ||" + end + sceduleUpdate = true + end +end + +function setReplaySpeed (speed, i) + local s = Spring.GetGameSpeed() + --Spring.Echo ("setting speed to: " , speed , " current is " , s) + if (speed > s) then --speedup + Spring.SendCommands ("setminspeed " .. speed) + Spring.SendCommands ("setminspeed " ..0.1) + else --slowdown + wantedSpeed = speed + end +end + + +function widget:Update() + if (wantedSpeed) then + if (Spring.GetGameSpeed() > wantedSpeed) then + Spring.SendCommands ("slowdown") + else + wantedSpeed = nil + end + end + if #Spring.GetSelectedUnits () ~=0 then isActive = false else isActive = true end +end + +function widget:GameFrame (f) + if (f==1) then + buttons[1].text= " ||" + end +end + +------------------------------------------------------------------------------------------ +--a simple UI framework with buttons +--Feb 2011 by knorke +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix + +--UI coordinaten zu scalierten screen koordinaten +function sX (uix) + return uix*vsx +end +function sY (uiy) + return uiy*vsy +end +---...und andersrum! +function uiX (sX) + return sX/vsx +end +function uiY (sY) + return sY/vsy +end + +function widget:ViewResize(viewSizeX, 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) + --gl.Rect (sX(x), sY(y), sX(x2), sY(y2)) +end + +function uiText (text, x,y,s,options) + if (text==" " or text==" ") then return end --archivement: unlock +20 fps + font:Begin() + font:Print(text, sX(x), sY(y), sX(s), options) + font:End() +end +-------------------------------- +-----message boxxy----- +function drawmessagebox (msgbox, msg_n) + if (msgbox.messages==nil) then return end + local yoff = msgbox.textsize + if (msg_n==nil) then msg_n=100 end --*** + local start = #msgbox.messages-msg_n+1 + if (start < 1) then start = 1 end + local fade = 1 + for i = start, #msgbox.messages , 1 do + drawmessage (msgbox.messages[i], msgbox.x, msgbox.y-yoff, msgbox.textsize) + yoff=yoff+msgbox.textsize*1.2 + end +end + + +function drawmessage_simple (message, x, y, s) + offx=0 + 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 + font:Print(message.text, sX(x+offx), sY(y), sX(s), 'vo') + font:End() +end + +--X, Y and size in UI scale +function drawmessage (message, x, y, s) + if (message.bgcolor) then + gl.Color (unpack(message.bgcolor)) + uiRect (x,y+s/2, x+1, y-s/2) + end + offx=0 + 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 + --****!!! irgendwie malt er danach keine Rechtecke mehr + --gl.PushMatrix() + gl.Color (1,1,1,1) + gl.Texture(message.icon) + gl.TexRect(sX(x+s*1.9),sY(y-s*0.8), sX(x+s*2.9),sY(y+s*0.8) ) + gl.Texture(false) + --gl.PopMatrix() + offx=offx+(s) + end + font:Print(message.text, sX(x+offx), sY(y), sX(s), 'vo') + font:End() +end + + +function addmessage (msgbox, text, bgcolor) + local newmessage = {} + --newmessage.frame = gameframe + if (bgcolor) then newmessage.bgcolor = bgcolor end---{0,0,0.8,0.5} + newmessage.text = text + table.insert (msgbox.messages, newmessage) +end +-------message boxxy end------ +------BUTTONS------ + +function RectRound(px,py,sx,sy,cs) + + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.floor(sx),math.floor(sy),math.floor(cs) + + gl.Rect(px+cs, py, sx-cs, sy) + gl.Rect(sx-cs, py+cs, sx, sy-cs) + gl.Rect(px+cs, py+cs, px, sy-cs) + + if py <= 0 or px <= 0 then gl.Texture(false) else gl.Texture(bgcorner) end + gl.TexRect(px, py+cs, px+cs, py) -- top left + + if py <= 0 or sx >= vsx then gl.Texture(false) else gl.Texture(bgcorner) end + gl.TexRect(sx, py+cs, sx-cs, py) -- top right + + if sy >= vsy or px <= 0 then gl.Texture(false) else gl.Texture(bgcorner) end + gl.TexRect(px, sy-cs, px+cs, sy) -- bottom left + + if sy >= vsy or sx >= vsx then gl.Texture(false) else gl.Texture(bgcorner) end + gl.TexRect(sx, sy-cs, sx-cs, sy) -- bottom right + + gl.Texture(false) +end + +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 (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) + uiText (b[i].text, b[i].x, b[i].y+b[i].h/2, (0.0115), 'vo') + end +end + + + +function add_button (buttonlist, x,y, w, h, text, name, color) + local new_button = {} + new_button.x=x new_button.y=y new_button.w=w new_button.h=h new_button.text=text new_button.name=name + if(color) then new_button.color=color end + table.insert (buttonlist, new_button) +end + +function previous_button () + active_button = active_button -1 + if (active_button < 1) then active_button = #buttons end +end + +function next_button () + active_button = active_button +1 + if (active_button > #buttons) then active_button = 1 end +end + +function point_in_rect (x1, y1, x2, y2, px, py) + if (px > x1 and px < x2 and py > y1 and py < y2) then return true end + return false +end + +function clicked_button (b) + local mx, my,click = Spring.GetMouseState() + local mousex=uiX(mx) + local mousey=uiY(my) + for i = 1, #b, 1 do + if (click == true and point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, mousex, mousey)) then return b[i].name, i end + --if (mouse_was_down == false and click == true and point_in_rect (b[i].x, b[i].y, b[i].x+b[i].w, b[i].y+b[i].h, mousex, mousey)) then mouse_was_down = true end + end + --keyboard: + --if (enter_was_down and active_button > 0 and active_button < #buttons+1) then enter_was_down = false return b[active_button].name, active_button end + return "NOBUTTONCLICKED" +end diff --git a/LuaUI/Widgets_Evo/gui_resourceBar.lua b/LuaUI/Widgets_Evo/gui_resourceBar.lua new file mode 100644 index 000000000..a1eef5f0a --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_resourceBar.lua @@ -0,0 +1,702 @@ +function widget:GetInfo() + return { + name = "Resource Bar Display", + desc = "Displays economy parameters", + author = "Code_Man, CommonPlayer, Floris", + date = "11/4/2016", -- modified by CommonPlayer on Oct 2016 + license = "MIT X11", + layer = 1, + 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 = 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"}) + +-- configurable settings +local FontSize = 22 +local supplyOffset = 0 +local supplyBarWidth = 340 +local energyOffset = 350 +local energyBarWidth = 340 +local metalOffset = 700 +local metalBarWidth = 340 +local width, height = metalOffset+metalBarWidth+supplyBarWidth, 40 +local textOffsetX, textOffsetY = 5, 17 +local bgFlashPeriod = 45 +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 1000000 + +-- internal settings, do not touch +local white = "\255\255\255\255" +local yellow = "\255\255\255\1" +local orange = "\255\255\135\1" +local green = "\255\0\255\1" +local red = "\255\255\0\1" +local skyblue = "\255\136\197\226" + +local barTexture = LUAUI_DIRNAME.."Images/resbar.dds" +local barGlowCenterTexture = LUAUI_DIRNAME.."Images/barglow-center.dds" +local barGlowEdgeTexture = LUAUI_DIRNAME.."Images/barglow-edge.dds" +local energyTexture = LUAUI_DIRNAME.."Images/energy2.png" +local metalTexture = LUAUI_DIRNAME.."Images/metal.png" +local supplyTexture = LUAUI_DIRNAME.."Images/supply.png" + +local supplyWarning = false +local energyWarning = false +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 + +local increment = 0 +local vsx, vsy = gl.GetViewSizes() +local widgetScale = (0.66 + (vsx*vsy / 9500000)) -- gets auto changed anyway +local bgmargin = 12 +local bgmargin2 = 6 +--local posx, posy = vsx - width * 1.59, vsy - height +local posx, posy = vsx - width * 1.59, vsy - height +local tweakStartX, tweakStartY = vsx - width * 1.59, vsy - height + +local modoptMincome = Spring.GetModOptions().mincome + +-- how long before metal income changes, in seconds (default 150s, or 2.5min) +local metalIncomeTimer = 150 + +-- how long before metal income stops increasing, in seconds (default 60s, or 10min, 4 times the metalIncomeTimer) +local incomeProgressionEndTimer = metalIncomeTimer * 4 + 5 + +local myPlayerID = Spring.GetMyPlayerID() + +--Spring.GetTeamResources +-- ( number teamID, string "metal" | "energy" ) -> +-- nil | number currentLevel, (mc) +-- number storage, (ms) +-- number pull, (mp) +-- number income, (mi) +-- number expense, (me) +-- number share, +-- number sent, +-- number received + + +local bgcorner = ":n:"..LUAUI_DIRNAME.."Images/bgcorner.png" +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 + 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) -- (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 widget:GameFrame(n) + 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) + + --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 + + -- background flashes when the player messed up their eco + if supplyWarning == true or energyWarning == true or metalWarning == true then + if increment == 0 then + countUp = true + end + + if increment < bgFlashPeriod and countUp == true then + increment = increment + 1 + if energyWarning == true then + + end + elseif increment > 0 then + if n%30 == 1 then + if energyWarning == true then + --Spring.Echo("EnergyWarning") + if resourcePrompts == 1 then + 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 + if metalWarning == true then + --Spring.Echo("MetalWarning") + if resourcePrompts == 1 then + 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 + if supplyWarning == true then + --Spring.Echo("SupplyWarning") + if resourcePrompts == 1 then + 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 + countUp = false + increment = increment - 1 + end + end +end + +-- tweaking UI position with ctrl+f11 +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 + + +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() + + su, sm = math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed") or 0), math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax") or 0) + ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") + mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") + + local cockblocked = (Spring.GetTeamRulesParam(myTeamID, "supply_blocked") == 1) + + if sm < maxSupply and (cockblocked or su > sm) then + supplyWarning = true + bgSupplyR = 1 + bgSupplyG = increment/bgFlashPeriod + else + supplyWarning = false + bgSupplyR = 0 + bgSupplyG = 0 + end + + percentage = su / maxSupply + if percentage > 1 then percentage = 1 end + + energyPercentage = ec / es + if energyPercentage > 1 then energyPercentage = 1 end + if energyPercentage < 0.2 then + energyWarning = true + bgEnergyR = 1 + bgEnergyG = increment/bgFlashPeriod + else + energyWarning = false + bgEnergyR = 0 + bgEnergyG = 0 + end + + metalPercentage = mc / ms + if metalPercentage > 1 then metalPercentage = 1 end + if metalPercentage > 0.8 then + metalWarning = true + bgMetalR = 1 + bgMetalG = increment/bgFlashPeriod + else + metalWarning = false + bgMetalR = 0 + bgMetalG = 0 + end + + generateDisplayList2() + end + if displayList2 ~= nil then + gl.CallList(displayList) + gl.CallList(displayList2) + gl.CallList(displayList3) + end +end + +function widget:Initialize() + + if Spring.GetModOptions().basicincomeinterval ~= nil then + metalIncomeTimer = tonumber(Spring.GetModOptions().basicincomeinterval) * 60 + end + + local incomePerInterval = 3 + if Spring.GetModOptions().basicincome ~= nil then + incomePerInterval = Spring.GetModOptions().basicincome + end + local totalSteps = math.ceil(maxBasicIncome / incomePerInterval) - 1 + local incomeProgressionEndTimer = totalSteps * metalIncomeTimer + incomeProgressionEndTimer = incomeProgressionEndTimer + 5 -- five extra seconds to ensure it ends properly + + self:ViewResize(gl.GetViewSizes()) +end + + +function widget:Shutdown() + if (WG['guishader'] ~= nil) then + WG['guishader'].RemoveRect('resources') + end + + if displayList ~= nil then + gl.DeleteList(displayList) + gl.DeleteList(displayList2) + gl.DeleteList(displayList3) + end + gl.DeleteFont(font) + gl.DeleteFont(font2) +end +--------------------------------------------------------------------------------------------------------- + +function generateDisplayList() + if displayList ~= nil then + gl.DeleteList(displayList) + end + displayList = gl.CreateList( function() + + -- start drawing + gl.PushMatrix() + + -- set position + gl.Translate(posx, posy, 0) + + -- apply scaling + gl.Translate(-(width*widgetScale)/3, -((height+bgmargin-2) * (widgetScale-1)), 0) + gl.Scale(widgetScale, widgetScale, 1) + + -- background + 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) + + 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) +end + +function generateDisplayList2() + local energyIncomeColor = green + local metalIncomeColor = green + local energyPosNeg = "+" + local metalPosNeg = "+" + local supplyAvailableColor = white + if displayList2 ~= nil then + gl.DeleteList(displayList2) + end + displayList2 = gl.CreateList(function () + -- draw background (black / gray / black / ...) + -- background flashes when the player messed up their eco + local glowSize = (height/6) * 5 + local glowAlpha = 0.15 + + gl.Color(bgSupplyR,bgSupplyG,0,0.33) + gl.Texture(barTexture) + RectRound(supplyOffset,0,supplyOffset+supplyBarWidth,height, 5) + + gl.Color(bgEnergyR,bgEnergyG,0,0.33) + RectRound(energyOffset,0,energyOffset+energyBarWidth,height, 5) + + gl.Color(bgMetalR,bgMetalG,0,0.33) + RectRound(metalOffset,0,metalOffset+metalBarWidth,height, 5) + + -- supply bar + r, g, b = 0, 0, 0 + + if supplyWarning then + r = 1 + else + r, g, b = 1, 0.5, 0 + end + + gl.Texture(barTexture) + -- gray bar for locked supply, black bar for unlocked supply, last bar for used supply + gl.Color(0.5,0.5,0.5,1) + gl.TexRect(supplyOffset,0,supplyOffset+supplyBarWidth,height/6) + maxPercentage = sm / maxSupply + + gl.Color(0,1,0,1) + gl.TexRect(supplyOffset,0,supplyOffset+(supplyBarWidth*maxPercentage),height/6) + + gl.Color(r,g,b,glowAlpha) + gl.Texture(barGlowCenterTexture) + gl.TexRect(supplyOffset,-glowSize,supplyOffset+(supplyBarWidth*maxPercentage),(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(supplyOffset-glowSize-glowSize,-glowSize,supplyOffset,(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(supplyOffset+(supplyBarWidth*maxPercentage)+glowSize+glowSize,-glowSize,supplyOffset+(supplyBarWidth*maxPercentage),(height/6)+glowSize) + + gl.Texture(barTexture) + gl.Color(r,g,b,1) + + if not progressBars then + percentage = 1 + end + 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 + supplyUsedColor = orange + if su >= (sm * 0.75) then + supplyUsedColor = red + end + end + if sm < maxSupply * 0.50 then + supplyAvailableColor = orange + elseif sm < maxSupply then + supplyAvailableColor = yellow + elseif sm == maxSupply then + supplyAvailableColor = green + end + + supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. "∞" .. " " + --supplyStr = supplyUsedColor .. su .. white .. "/" .. supplyAvailableColor .. sm .. " " + + else + supplyStr = white .. su .. "/" .. "∞" .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. "∞" .. white .. ") " + --supplyStr = white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ") " + end + font2:Begin() + font2:Print(supplyStr, supplyOffset+supplyBarWidth, textOffsetY, FontSize, "onr") + + + -- energy bar + r, g, b = 0, 0, 0 + + if energyPercentage > 0.8 then + g = 0.9 + elseif energyPercentage < 0.2 then + r = 1 + else + r, g, b = 1, 0.9, 0 + end + + gl.Color(r,g,b,1) + if not progressBars then + energyPercentage = 1 + end + + gl.Texture(barTexture) + gl.TexRect(energyOffset,0,energyOffset+(energyBarWidth*energyPercentage),height/6) + + gl.Color(r,g,b,glowAlpha) + gl.Texture(barGlowCenterTexture) + gl.TexRect(energyOffset,-glowSize,energyOffset+(energyBarWidth*energyPercentage),(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(energyOffset-glowSize-glowSize,-glowSize,energyOffset,(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(energyOffset+(energyBarWidth*energyPercentage)+glowSize+glowSize,-glowSize,energyOffset+(energyBarWidth*energyPercentage),(height/6)+glowSize) + + gl.Texture(barTexture) + + if simplifiedResourceBar == 1 then + if ei > ep then + energyIncomeColor = green + energyPosNeg = "+" + else + energyIncomeColor = red + energyPosNeg = "" + end + energyStr = energyIncomeColor .. energyPosNeg .. tostring(math.round(ei - ep,1)) .. white .. " (" .. yellow .. tostring(math.round(ec)).. white .. "/" .. tostring(math.round(es)) .. ") " + 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 + font2:Print(energyStr, energyOffset+energyBarWidth, textOffsetY, FontSize, "onr") + + -- metal bar + r, g, b = 0, 0, 0 + + if metalPercentage > 0.8 then + g = 0.9 + elseif metalPercentage < 0.2 then + r = 1 + else + r, g, b = .53, .77, .89 + end + + gl.Color(r,g,b,1) + if not progressBars then + metalPercentage = 1 + end + gl.Texture(barTexture) + gl.TexRect(metalOffset,0,metalOffset+(metalBarWidth*metalPercentage),height/6) + + gl.Color(r,g,b,glowAlpha) + gl.Texture(barGlowCenterTexture) + gl.TexRect(metalOffset,-glowSize,metalOffset+(metalBarWidth*metalPercentage),(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(metalOffset-glowSize-glowSize,-glowSize,metalOffset,(height/6)+glowSize) + gl.Texture(barGlowEdgeTexture) + gl.TexRect(metalOffset+(metalBarWidth*metalPercentage)+glowSize+glowSize,-glowSize,metalOffset+(metalBarWidth*metalPercentage),(height/6)+glowSize) + + gl.Texture(barTexture) + + -- draw metal income timer + if modoptMincome ~= "disabled" then + timeElapsed = Spring.GetGameSeconds() + if timeElapsed < incomeProgressionEndTimer then + percentage = timeElapsed%metalIncomeTimer/metalIncomeTimer + gl.Color(1,0.5,0,1) + gl.Texture(barTexture) + gl.TexRect(metalOffset,0,metalOffset+(metalBarWidth*percentage),height/12) + if percentage == 0 and timeElapsed > 0 and (not incomeIncreased) then + if resourcePrompts ~= 0 then + Spring.PlaySoundFile("sounds/ui/metalincomeincrease.wav", 1) + Spring.Echo("Metal income has increased!") + end + incomeIncreased = true + end + if percentage > 0.5 and incomeIncreased then + incomeIncreased = false + end + end + end + + if simplifiedResourceBar == 1 then + if mi > mp then + metalIncomeColor = green + metalPosNeg = "+" + else + metalIncomeColor = red + metalPosNeg = "" + end + metalStr = metalIncomeColor .. metalPosNeg .. tostring(math.round(mi - mp,1)) .. white .. " (" .. skyblue .. tostring(math.round(mc)) .. white .. "/" .. tostring(math.round(ms)) .. ") " + 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 + font2:Print(metalStr, metalOffset+metalBarWidth, textOffsetY, FontSize, "onr") + font2:End() + gl.Texture(false) + + end) +end + +function generateDisplayList3() + if displayList3 ~= nil then + gl.DeleteList(displayList3) + end + displayList3 = gl.CreateList(function () + + -- draw icons + local iconSize = 32 + gl.Color(1,1,1,1) + gl.Texture(supplyTexture) + gl.TexRect(supplyOffset+1, height-iconSize, supplyOffset+iconSize+1, height) + + gl.Texture(energyTexture) + gl.TexRect(energyOffset+1, height-iconSize, energyOffset+iconSize+1, height) + + gl.Texture(metalTexture) + gl.TexRect(metalOffset+1, height-iconSize, metalOffset+iconSize+1, height) + + + gl.PopMatrix() + end) +end + +function widget:ViewResize(newX,newY) + vsx, vsy = newX, newY + widgetScale = (0.66 + (vsx*vsy / 9500000)) + --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_resource_energy_display.lua b/LuaUI/Widgets_Evo/gui_resource_energy_display.lua new file mode 100644 index 000000000..f511a29de --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_resource_energy_display.lua @@ -0,0 +1,94 @@ +function widget:GetInfo() + return { + name = "Resource: Energy Text Display", + desc = "Displays energy economy parameters as text", + author = "Code_Man", + date = "11/4/2016", + license = "MIT X11", + layer = 1, + enabled = false + } +end + +--Disable Default Resources Bar +Spring.SendCommands({"resbar 0"}) + +local white = "\255\255\255\255" +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 str = "" +local FontSize = 15 +local vsx, vsy = gl.GetViewSizes() +local posx, posy = vsx - 245, vsy -40 + +local increment = 0 + +--Spring.GetTeamResources +-- ( number teamID, string "metal" | "energy" ) -> +-- nil | number currentLevel, (ec) +-- number storage, (es) +-- number pull, (ep) +-- number income, (ei) +-- number expense, (ee) +-- number share, +-- number sent, +-- number received + +function widget:GameFrame(n) + local myTeamID = Spring.GetMyTeamID() + local ec, es, ep, ei, ee = Spring.GetTeamResources(myTeamID, "energy") + +--Normal Energy Display +-- str = yellow .. "Energy:" .. orange .. " ± " .. tostring(math.round(ei - ee)) .. green .. " +" .. tostring(math.round(ei)) .. white .. "/" .. red .. "-" .. tostring(math.round(ep)) .. white .. " (" .. tostring(math.round(ec)) .. "/" .. tostring(math.round(es)) .. ")" + +--Custom Evo Energy display + local warningColor = white -- If the word "energy" displays as white, something below isn't working correctly + if ec <= es * 0.2 then + warning = true + else + warning = false + end + + if warning == true then + if increment == 0 then + countUp = true + end + + if increment < 255 and countUp == true then + increment = increment + 15 + elseif increment > 0 then + countUp = false + increment = increment - 15 + end + + warningColor = "\255\255" .. string.char (increment) .. "\0" + + else + warningColor = yellow + end + + str = warningColor .. "Energy:" .. orange .. " ± " .. tostring(math.round(ei - ee)) .. green .. " +" .. tostring(math.round(ei)) .. white .. "/" .. red .. "-" .. tostring(math.round(ep)) .. white .. " (" .. yellow .. tostring(math.round(ec)).. white .. "/" .. tostring(math.round(es)) .. ")" +end + +function widget:TweakMousePress(x, y, button) + if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then + return true + end +end + +function widget:TweakMouseMove(x, y, dx, dy, button) + if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then + posx = x + posy = y + end +end + +function DrawScreen() + local vsx, vsy = gl.GetViewSizes() + gl.Text(str, posx, posy, FontSize, "on") +end +--------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_resource_metal_display.lua b/LuaUI/Widgets_Evo/gui_resource_metal_display.lua new file mode 100644 index 000000000..53aabbed6 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_resource_metal_display.lua @@ -0,0 +1,93 @@ +function widget:GetInfo() + return { + name = "Resource: Metal Text Display", + desc = "Displays metal economy parameters as text", + author = "Code_Man", + date = "11/4/2016", + license = "MIT X11", + layer = 1, + enabled = false + } +end + +--Disable Default Resources Bar +Spring.SendCommands({"resbar 0"}) + +local white = "\255\255\255\255" +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 str = "" +local FontSize = 15 +local vsx, vsy = gl.GetViewSizes() +local posx, posy = vsx - 245, vsy - 20 + +local increment = 0 + +--Spring.GetTeamResources +-- ( number teamID, string "metal" | "energy" ) -> +-- nil | number currentLevel, (mc) +-- number storage, (ms) +-- number pull, (mp) +-- number income, (mi) +-- number expense, (me) +-- number share, +-- number sent, +-- number received + +function widget:GameFrame(n) + local myTeamID = Spring.GetMyTeamID() + local mc, ms, mp, mi, me = Spring.GetTeamResources(myTeamID, "metal") +--Normal metal display +-- str = "\255\136\197\226Metal: \255\255\135\0± " .. tostring(math.round(mi - me)) .. "\255\0\255\0 +" .. tostring(math.round(mi)) .. "\255\255\255\255/\255\255\0\0-" .. tostring(math.round(mp)) .. "\255\255\255\255 (" .. tostring(math.round(mc)) .. "/" .. tostring(math.round(ms)) .. "\255\255\255\255)" + +--Custom Evo metal display + local warningColor = white -- If the word "energy" displays as white, something below isn't working correctly + if mc >= ms * 0.8 then + warning = true + else + warning = false + end + + if warning == true then + if increment == 0 then + countUp = true + end + + if increment < 255 and countUp == true then + increment = increment + 15 + elseif increment > 0 then + countUp = false + increment = increment - 15 + end + + warningColor = "\255\255" .. string.char (increment) .. "\0" + + else + warningColor = skyblue + end + + str = warningColor .. "Metal: " .. orange .. "± " .. tostring(math.round(mi - me)) .. green .. " +" .. tostring(math.round(mi)) .. white .. "/" .. red .. "-" .. tostring(math.round(mp)) .. white .. " (" .. skyblue .. tostring(math.round(mc)) .. white .. "/" .. tostring(math.round(ms)) .. ")" +end + +function widget:TweakMousePress(x, y, button) + if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then + return true + end +end + +function widget:TweakMouseMove(x, y, dx, dy, button) + if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then + posx = x + posy = y + end +end + +function DrawScreen() + local vsx, vsy = gl.GetViewSizes() + gl.Text(str, posx, posy, FontSize, "on") +end +--------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_resource_supply_display.lua b/LuaUI/Widgets_Evo/gui_resource_supply_display.lua new file mode 100644 index 000000000..d24498506 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_resource_supply_display.lua @@ -0,0 +1,80 @@ +function widget:GetInfo() + return { + name = "Resource: Supply Text Display", + desc = "Displays supply economy parameters as text", + author = "Code_Man", + date = "11/4/2016", + license = "MIT X11", + layer = 1, + enabled = false + } +end + +local white = "\255\255\255\255" +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 str = "" +local FontSize = 15 +local vsx, vsy = gl.GetViewSizes() +local posx, posy = vsx - 245, vsy - 60 +local maxSupply = 200 + +local increment = 0 + +function widget:GameFrame(n) + local myTeamID = Spring.GetMyTeamID() + --math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed")) -- (su) + --math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax")) -- (sm) + local su, sm = math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed")), math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax")) + if su <= maxSupply * 0.95 then + if su >= sm * 0.9 and sm ~= maxSupply then + warning = true + else + warning = false + end + + if warning == true then + if increment == 0 then + countUp = true + end + + if increment < 255 and countUp == true then + increment = increment + 15 + elseif increment > 0 then + countUp = false + increment = increment - 15 + end + + warningColor = "\255\255" .. string.char (increment) .. "\0" + + else + warningColor = green + end + else + warningColor = green + end + + str = warningColor .. "Supply: " .. white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ")" +end + +function widget:TweakMousePress(x, y, button) + if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then + return true + end +end + +function widget:TweakMouseMove(x, y, dx, dy, button) + if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then + posx = x + posy = y + end +end + +function DrawScreen() + local vsx, vsy = gl.GetViewSizes() + gl.Text(str, posx, posy, FontSize, "on") +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 new file mode 100644 index 000000000..b48cc149d --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_selected_units_buttons.lua @@ -0,0 +1,651 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: gui_selbuttons.lua +-- brief: adds a selected units button control panel +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Selected Units Buttons", + desc = "Buttons for the current selection", + author = "trepan, Floris", + date = "28 may 2015", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +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 +local glBlending = gl.Blending +local glBeginEnd = gl.BeginEnd +local glClear = gl.Clear +local glColor = gl.Color +local glPopMatrix = gl.PopMatrix +local glPushMatrix = gl.PushMatrix +local glRect = gl.Rect +local glRotate = gl.Rotate +local glScale = gl.Scale +local glTexRect = gl.TexRect +local glText = gl.Text +local glTexture = gl.Texture +local glTranslate = gl.Translate +local glUnitDef = gl.UnitDef +local glVertex = gl.Vertex +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 +local spSelectUnitArray = Spring.SelectUnitArray +local spSelectUnitMap = Spring.SelectUnitMap +local spSendCommands = Spring.SendCommands +local spIsGUIHidden = Spring.IsGUIHidden + + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +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 + +local leftmouseColor = {1, 0.72, 0.25, 0.22} +local middlemouseColor = {1, 1, 1, 0.16} +local rightmouseColor = {1, 0.4, 0.4, 0.2} +--local hoverColor = { 1, 1, 1, 0.25 } + +local unitTypes = 0 +local countsTable = {} +local activePress = false +local mouseIcon = -1 +local currentDef = nil +local prevUnitCount = spGetSelectedUnitsCounts() +local oldUnitpics = false + +local iconSizeX = 76 +local iconSizeY = 76 +local iconImgMult = 0.85 + +local usedIconSizeX = iconSizeX +local usedIconSizeY = iconSizeY +local rectMinX = 0 +local rectMaxX = 0 +local rectMinY = 0 +local rectMaxY = 0 + +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/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'] then + if not picList then + WG['guishader'].RemoveDlist('selectionbuttons') + guishaderDisabled = true + else + if backgroundDimentions[1] ~= nil then + 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(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 + iconMargin = usedIconSizeX / 25 + + if picList then + gl.DeleteList(picList) + picList = gl.CreateList(DrawPicList) + end +end + +function cacheUnitIcons() + if cached == nil then + gl.Color(1,1,1,0.001) + for id, unit in pairs(UnitDefs) do + gl.Texture('#' .. id) + gl.TexRect(-1,-1,0,0) + gl.Texture(false) + end + gl.Color(1,1,1,1) + cached = true + end +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() + 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 + 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 + i = i + 1 + end + end + 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: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 +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 + +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() + 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 + currentDef = nil + return + end + + local xmid = vsx * 0.5 + 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 xmin = math.floor(rectMinX) + 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,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 + local row = 0 + local icon = 0 + 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 + + +function DrawUnitDefTexture(unitDefID, iconPos, count, row) + local usedIconImgMult = iconImgMult + local ypad2 = -usedIconSizeY/50 + 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)) / 3 + local xPad = (usedIconSizeX*(1-usedIconImgMult)) / 3 + + local xmin = math.floor(rectMinX + (usedIconSizeX * iconPos)) + xPad + local xmax = xmin + usedIconSizeX - xPad - xPad + if ((xmax < 0) or (xmin > vsx)) then return end -- bail + + local ymin = rectMinY + yPad + local ymax = rectMaxY - yPad + local xmid = (xmin + xmax) * 0.5 + local ymid = (ymin + ymax) * 0.5 + + local ud = UnitDefs[unitDefID] + glColor(color) + glTexture('#' .. unitDefID) + glTexRect(math.floor(xmin+iconMargin), math.floor(ymin+iconMargin+ypad2), math.ceil(xmax-iconMargin), math.ceil(ymax-iconMargin+ypad2)) + glTexture(false) + + if count > 1 then + -- draw the count text + local offset = math.ceil((ymax - (ymin+iconMargin+iconMargin)) / 20) + 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 + + +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) + + glTexture(false) + glRect(px+cs, py, sx-cs, sy) + glRect(sx-cs, py+cs, sx, sy-cs) + glRect(px+cs, py+cs, px, sy-cs) + + if py <= 0 or px <= 0 then glTexture(false) else glTexture(bgcorner) end + glTexRect(px, py+cs, px+cs, py) -- top left + + if py <= 0 or sx >= vsx then glTexture(false) else glTexture(bgcorner) end + glTexRect(sx, py+cs, sx-cs, py) -- top right + + if sy >= vsy or px <= 0 then glTexture(false) else glTexture(bgcorner) end + glTexRect(px, sy-cs, px+cs, sy) -- bottom left + + if sy >= vsy or sx >= vsx then glTexture(false) else glTexture(bgcorner) end + glTexRect(sx, sy-cs, sx-cs, sy) -- bottom right + + glTexture(false) +end + +function DrawIconQuad(iconPos, color) + + local usedIconImgMult = iconImgMult*1.08 + + local yPad = (usedIconSizeY*(1-usedIconImgMult)) / 2 + local xPad = (usedIconSizeX*(1-usedIconImgMult)) / 2 + + local xmin = math.floor(rectMinX + (usedIconSizeX * iconPos)) + xPad + local xmax = xmin + usedIconSizeX - xPad - xPad + if ((xmax < 0) or (xmin > vsx)) then return end -- bail + + local ymin = rectMinY + local ymax = rectMaxY - yPad + local xmid = (xmin + xmax) * 0.5 + local ymid = (ymin + ymax) * 0.5 + + gl.Texture(highlightImg) + gl.Color(color) + glTexRect(xmin+iconMargin, ymin+iconMargin+iconMargin, xmax-iconMargin, ymax-iconMargin) + gl.Texture(false) + + RectRound(xmin+iconMargin, ymin+iconMargin+iconMargin, xmax-iconMargin, ymax-iconMargin, (xmax-xmin)/15) + glBlending(GL_SRC_ALPHA, GL_ONE) + gl.Color(color[1],color[2],color[3],color[4]/2) + RectRound(xmin+iconMargin, ymin+iconMargin+iconMargin, xmax-iconMargin, ymax-iconMargin, (xmax-xmin)/15) + glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) +end + + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +function widget:MousePress(x, y, button) + mouseIcon = MouseOverIcon(x, y) + activePress = (mouseIcon >= 0) + return activePress +end + +------------------------------------------------------------------------------- + +local function LeftMouseButton(unitDefID, unitTable) + local alt, ctrl, meta, shift = spGetModKeyState() + local acted = false + if (not ctrl) then + -- select units of icon type + if (alt or meta) then + acted = true + spSelectUnitArray({ unitTable[1] }) -- only 1 + else + acted = true + spSelectUnitArray(unitTable) + end + else + -- select all units of the icon type + local sorted = spGetTeamUnitsSorted(spGetMyTeamID()) + local units = sorted[unitDefID] + if (units) then + acted = true + spSelectUnitArray(units, shift) + end + end + if acted and playSounds then + Spring.PlaySoundFile(leftclick, 0.75, 'ui') + end +end + + +local function MiddleMouseButton(unitDefID, unitTable) + local alt, ctrl, meta, shift = spGetModKeyState() + -- center the view + if (ctrl) then + -- center the view on the entire selection + spSendCommands({"viewselection"}) + else + -- center the view on this type on unit + local selUnits = spGetSelectedUnits() + spSelectUnitArray(unitTable) + spSendCommands({"viewselection"}) + spSelectUnitArray(selUnits) + end + if playSounds then + Spring.PlaySoundFile(middleclick, 0.75, 'ui') + end +end + + +local function RightMouseButton(unitDefID, unitTable) + local alt, ctrl, meta, shift = spGetModKeyState() + -- remove selected units of icon type + local selUnits = spGetSelectedUnits() + local map = {} + for _,uid in ipairs(selUnits) do map[uid] = true end + for _,uid in ipairs(unitTable) do + map[uid] = nil + if (ctrl) then break end -- only remove 1 unit + end + spSelectUnitMap(map) + if playSounds then + Spring.PlaySoundFile(rightclick, 0.75, 'ui') + end +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 + activePress = false + local icon = MouseOverIcon(x, y) + + local units = spGetSelectedUnitsSorted() + if (units.n ~= unitTypes) then + return -1 -- discard this click + end + units.n = nil + + local unitDefID = -1 + local unitTable = nil + local index = 0 + for udid,uTable in pairs(units) do + if (index == icon) then + unitDefID = udid + unitTable = uTable + break + end + index = index + 1 + end + if (unitTable == nil) then + return -1 + end + + local alt, ctrl, meta, shift = spGetModKeyState() + + if (button == 1) then + LeftMouseButton(unitDefID, unitTable) + elseif (button == 2) then + MiddleMouseButton(unitDefID, unitTable) + elseif (button == 3) then + RightMouseButton(unitDefID, unitTable) + end + + return -1 +end + + +function MouseOverIcon(x, y) + if (unitTypes <= 0) then return -1 end + if (x < rectMinX) then return -1 end + if (x > rectMaxX) then return -1 end + if (y < rectMinY) then return -1 end + if (y > rectMaxY) then return -1 end + + local icon = math.floor((x - rectMinX) / usedIconSizeX) + -- clamp the icon range + if (icon < 0) then + icon = 0 + end + if (icon >= unitTypes) then + icon = (unitTypes - 1) + end + return icon +end + + +------------------------------------------------------------------------------- + + +function widget:GetConfigData() + return {oldUnitpics=oldUnitpics} +end + +function widget:SetConfigData(data) --load config + if (data.oldUnitpics ~= nil) then + oldUnitpics = data.oldUnitpics + end +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_supply_display.lua b/LuaUI/Widgets_Evo/gui_supply_display.lua deleted file mode 100644 index 24f20791d..000000000 --- a/LuaUI/Widgets_Evo/gui_supply_display.lua +++ /dev/null @@ -1,53 +0,0 @@ -function widget:GetInfo() - return { - name = "Supply Text Display", - desc = "Displays supply economy parameters as text", - author = "Code_Man", - date = "11/4/2016", - license = "MIT X11", - layer = 1, - enabled = true - } -end - ---Disable Default Resources Bar -Spring.SendCommands({"resbar 0"}) - -local white = "\255\255\255\255" -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 str = "" -local FontSize = 15 -local vsx, vsy = gl.GetViewSizes() -local posx, posy = vsx - 245, vsy - 60 -local maxSupply = 200 - -function widget:GameFrame(n) - local myTeamID = Spring.GetMyTeamID() - --math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed")) -- (su) - --math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax")) -- (sm) - local su, sm = math.round(Spring.GetTeamRulesParam(myTeamID, "supplyUsed")), math.round(Spring.GetTeamRulesParam(myTeamID, "supplyMax")) - str = green .. "Supply: " .. white .. su .. "/" .. sm .. " (" .. orange .. "±" .. tostring(sm - su) .. white .. "/" .. green .. maxSupply .. white .. ")" -end - -function widget:TweakMousePress(x, y, button) - if x >= posx and x < posx + 100 and y >= posy and y < posy + FontSize * 2 then - return true - end -end - -function widget:TweakMouseMove(x, y, dx, dy, button) - if x >= 0 and x < vsx - 100 and y >= 0 and y < vsy then - posx = x - posy = y - end -end - -function DrawScreen() - local vsx, vsy = gl.GetViewSizes() - gl.Text(str, posx, posy, FontSize, "on") -end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/gui_tooltip.lua b/LuaUI/Widgets_Evo/gui_tooltip.lua new file mode 100644 index 000000000..ecca9325b --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_tooltip.lua @@ -0,0 +1,279 @@ + +function widget:GetInfo() + return { + name = "Tooltip", + desc = "Shows tooltips", + author = "Floris", + date = "April 2017", + license = "GNU GPL, v2 or later", + layer = -9999999999, + enabled = true, -- loaded by default? + } +end + +------------------------------------------------------------------------------------ +-- Info +------------------------------------------------------------------------------------ +--[[ + +-- Availible API functions: +WG['tooltip'].AddTooltip(name, area, value, delay, x, y) -- area: {x1,y1,x2,y2} value: 'text' delay(optional): #seconds x/y(optional): display coordinates +WG['tooltip'].RemoveTooltip(name) + +WG['tooltip'].ShowTooltip(name, value, x, y) -- x/y (optional): display coordinates + +You can use 'AddTooltip' to add a screen area that will display a tooltip when you hover over it + +Use 'ShowTooltip' to directly show a tooltip, the name you give should be unique, and not one you desined in 'AddTooltip' +(the name will be deleted after use) + +]]-- +------------------------------------------------------------------------------------ +-- Config +------------------------------------------------------------------------------------ + +local defaultDelay = 0.4 +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 +------------------------------------------------------------------------------------ + +local bgcorner = "LuaUI/Images/bgcorner.png" +local glColor = gl.Color +local glText = gl.Text +local glRect = gl.Rect +local glTranslate = gl.Translate + +local spGetModKeyState = Spring.GetModKeyState +local spGetMouseState = Spring.GetMouseState +local spTraceScreenRay = Spring.TraceScreenRay +local spGetTooltip = Spring.GetCurrentTooltip + +local vsx, vsy = Spring.GetViewGeometry() + +local tooltips = {} + +------------------------------------------------------------------------------------ +-- Functions +------------------------------------------------------------------------------------ + +function RectRound(px,py,sx,sy,cs) + + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.floor(sx),math.floor(sy),math.floor(cs) + + gl.Rect(px+cs, py, sx-cs, sy) + gl.Rect(sx-cs, py+cs, sx, sy-cs) + gl.Rect(px+cs, py+cs, px, sy-cs) + + gl.Texture(bgcorner) + gl.TexRect(px, py+cs, px+cs, py) -- top left + gl.TexRect(sx, py+cs, sx-cs, py) -- top right + gl.TexRect(px, sy-cs, px+cs, sy) -- bottom left + gl.TexRect(sx, sy-cs, sx-cs, sy) -- bottom right + gl.Texture(false) +end + +function widget:Initialize() + init() +end + +function widget:Shutdown() + gl.DeleteFont(font) + if WG['guishader'] then + for name, tooltip in pairs(tooltips) do + WG['guishader'].DeleteScreenDlist('tooltip_'..name) + end + end + WG['tooltip'] = nil +end + +function init() + vsx, vsy = gl.GetViewSizes() + widgetScale = (0.60 + (vsx*vsy / 5000000)) + + if WG['tooltip'] == nil then + WG['tooltip'] = {} + 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 + 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 + end + end + WG['tooltip'].RemoveTooltip = function(name) + if tooltips[name] ~= nil then + tooltips[name] = nil + end + end + WG['tooltip'].ShowTooltip = function(name, value, x, y) + if value ~= nil then + tooltips[name] = {value=tostring(value) } + if x ~= nil and y ~= nil then + tooltips[name].pos = {x,y} + end + end + end + end +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 + + +function IsOnRect(x, y, BLcornerX, BLcornerY,TRcornerX,TRcornerY) + return x >= BLcornerX and x <= TRcornerX and y >= BLcornerY and y <= TRcornerY +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 drawTooltip(name, x, y) + --Spring.Echo('Showing tooltip: '..name) + + local paddingH = 7 *widgetScale + local paddingW = paddingH * 1.33 + local posX = x + paddingW + local posY = y + paddingH + + local fontSize = usedFontSize*widgetScale + local maxWidth = 0 + local maxHeight = 0 + local lineHeight = fontSize + (fontSize/4.5) + local lines = lines(tooltips[name].value) + + -- get text dimentions + for i, line in ipairs(lines) do + 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*2) + end + if posX - paddingW < 0 then + posX = 0 + paddingW + end + if posY + paddingH > vsy then + posY = (posY - (posY - vsy)) - paddingH + end + if posY-maxHeight-paddingH-paddingH < 0 then + posY = 0 + maxHeight + paddingH + paddingH + end + + -- draw background + local cornersize = 0 + 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) + 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) + 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 + font:Print('\255\244\244\244'..line, 0, maxHeight, fontSize, "o") + maxHeight = maxHeight - lineHeight + end + 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'] then + for name, _ in pairs(cleanupGuishaderAreas) do + WG['guishader'].DeleteScreenDlist(name) + cleanupGuishaderAreas[name] = nil + end + end + for name, tooltip in pairs(tooltips) do + if tooltip.area == nil or (tooltip.area[4]~= nil and IsOnRect(x, y, tooltip.area[1], tooltip.area[2], tooltip.area[3], tooltip.area[4])) then + if tooltip.area == nil then + if tooltip.pos ~= nil then + drawTooltip(name, tooltip.pos[1], tooltip.pos[2]) + else + drawTooltip(name, x + (xOffset*widgetScale), y + (yOffset*widgetScale)) + end + tooltips[name] = nil + cleanupGuishaderAreas['tooltip_'..name] = true + else + if tooltip.displayTime == nil then + tooltip.displayTime = now + tooltip.delay + elseif tooltip.displayTime <= now then + if tooltip.pos ~= nil then + drawTooltip(name, tooltip.pos[1], tooltip.pos[2]) + else + drawTooltip(name, x + (xOffset*widgetScale), y + (yOffset*widgetScale)) + end + end + end + else + if tooltip.displayTime ~= nil then + tooltip.displayTime = nil + if WG['guishader'] then + WG['guishader'].DeleteScreenDlist('tooltip_'..name) + end + end + 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 new file mode 100644 index 000000000..1b19429d3 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_unit_stats.lua @@ -0,0 +1,863 @@ + +function widget:GetInfo() + return { + name = "Unit Stats", + desc = "Shows detailed unit stats", + author = "Niobium", + date = "Jan 11, 2009", + version = 1.3, + license = "GNU GPL, v2 or later", + layer = -9999999999, + enabled = true, -- loaded by default? + } +end + +include("keysym.h.lua") + +---- v1.3 changes +-- Fix for 87.0 +-- Added display of experience effect (when experience >25%) + +---- v1.2 changes +-- Fixed drains for burst weapons (Removed 0.125 minimum) +-- Show remaining costs for units under construction + +---- v1.1 changes +-- Added extra text to help explain numbers +-- Added grouping of duplicate weapons +-- Added sonar radius +-- Fixed radar/jammer detection +-- Fixed stockpiling unit drains +-- Fixed turnrate/acceleration scale +-- Fixed very low reload times + +------------------------------------------------------------------------------------ +-- Globals +------------------------------------------------------------------------------------ +local fontSize = 13 +local useSelection = 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 = 25 +local fontfileOutlineSize = 6 +local fontfileOutlineStrength = 1.4 +local font = gl.LoadFont(fontfile, fontfileSize*fontfileScale, fontfileOutlineSize*fontfileScale, fontfileOutlineStrength) + +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 = "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' +local blue = '\255\128\128\255' + +local metalColor = '\255\196\196\255' -- Light blue +local energyColor = '\255\255\255\128' -- Light yellow +local buildColor = '\255\128\255\128' -- Light green + +local simSpeed = Game.gameSpeed + +local max = math.max +local floor = math.floor +local ceil = math.ceil +local format = string.format +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 spGetUnitDefID = Spring.GetUnitDefID +local spGetUnitExp = Spring.GetUnitExperience +local spGetUnitHealth = Spring.GetUnitHealth +local spGetUnitTeam = Spring.GetUnitTeam +local spGetUnitExperience = Spring.GetUnitExperience +local spGetUnitSensorRadius = Spring.GetUnitSensorRadius +local spGetUnitWeaponState = Spring.GetUnitWeaponState + +local uDefs = UnitDefs +local wDefs = WeaponDefs + +local triggerKey = KEYSYMS.SPACE + +local myTeamID = Spring.GetMyTeamID +local spGetTeamRulesParam = Spring.GetTeamRulesParam +local spGetTooltip = Spring.GetCurrentTooltip + +local vsx, vsy = Spring.GetViewGeometry() + +local maxWidth = 0 +local textBuffer = {} +local textBufferCount = 0 + +local spec = Spring.GetSpectatingState() + +------------------------------------------------------------------------------------ +-- Functions +------------------------------------------------------------------------------------ + + +function RectRound(px,py,sx,sy,cs) + + local px,py,sx,sy,cs = math.floor(px),math.floor(py),math.floor(sx),math.floor(sy),math.floor(cs) + + gl.Rect(px+cs, py, sx-cs, sy) + gl.Rect(sx-cs, py+cs, sx, sy-cs) + gl.Rect(px+cs, py+cs, px, sy-cs) + + gl.Texture(bgcorner) + gl.TexRect(px, py+cs, px+cs, py) -- top left + gl.TexRect(sx, py+cs, sx-cs, py) -- top right + gl.TexRect(px, sy-cs, px+cs, sy) -- bottom left + gl.TexRect(sx, sy-cs, sx-cs, sy) -- bottom right + gl.Texture(false) +end + +local function DrawText(t1, t2) + textBufferCount = textBufferCount + 1 + textBuffer[textBufferCount] = {t1,t2,cX,cY} + cY = cY - fontSize + 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 + 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) + + if not teamID then return "\255\255\255\255" end + + local R, G, B = spGetTeamColor(teamID) + + if not R then return "\255\255\255\255" end + + R = floor(R * 255) + G = floor(G * 255) + B = floor(B * 255) + + if (R < 11) then R = 11 end -- Note: char(10) terminates string + if (G < 11) then G = 11 end + if (B < 11) then B = 11 end + + return "\255" .. char(R) .. char(G) .. char(B) +end + +local function GetTeamName(teamID) + + if not teamID then return 'Error:NoTeamID' end + + local _, teamLeader = spGetTeamInfo(teamID,false) + if not teamLeader then return 'Error:NoLeader' end + + 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'] then + WG['guishader'].DeleteScreenDlist('unit_stats_title') + WG['guishader'].DeleteScreenDlist('unit_stats_data') + guishaderEnabled = false + end +end + +------------------------------------------------------------------------------------ +-- Code +------------------------------------------------------------------------------------ + +function widget:Initialize() + init() +end + +function widget:Shutdown() + gl.DeleteFont(font) + RemoveGuishader() +end + +function widget:PlayerChanged() + spec = Spring.GetSpectatingState() +end + +function init() + vsx, vsy = gl.GetViewSizes() + widgetScale = (0.60 + (vsx*vsy / 5000000)) + fontSize = customFontSize * widgetScale + + bgcornerSize = fontSize*0.45 + bgpadding = fontSize*0.9 + + xOffset = (32 + bgpadding)*widgetScale + yOffset = -((32 + bgpadding)*widgetScale) +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 + 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 or spIsUserWriting() then + WG.hoverID = nil + RemoveGuishader() + return + end + local mx, my = spGetMouseState() + local uID + local rType, unitID = spTraceScreenRay(mx, my) + if rType == 'unit' then + uID = unitID + end + if useSelection then + if selectedUnitsCount >= 1 then + uID = selectedUnits[1] + end + end + 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 = (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 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 + + ------------------------------------------------------------------------------------ + -- 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 = 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 + + 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 + + local uExp = spGetUnitExperience(uID) + ------------------------------------------------------------------------------------ + -- Armor + ------------------------------------------------------------------------------------ + + DrawText("Armor:", "class " .. Game.armorTypes[uDef.armorType or 0] or '???') + + 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 + 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 + + 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 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 + 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 + 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 + + for i = 1, #wepsCompact do + + local wDefId = wepsCompact[i] + local uWep = wDefs[wDefId] + + 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] + + 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 + + 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 + end + end + + -- background + 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 + 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) + + + -- 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'].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 + + 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 new file mode 100644 index 000000000..5be0e4f46 --- /dev/null +++ b/LuaUI/Widgets_Evo/gui_widget_selector.lua @@ -0,0 +1,853 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: selector.lua +-- brief: the widget selector, loads and unloads widgets +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- changes: +-- jK (April@2009) - updated to new font system +-- Bluestone (Jan 2015) - added to BA as a widget, added various stuff +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Widget Selector", + desc = "Widget selection widget", + author = "trepan, jK, Bluestone", + date = "Jan 8, 2007", + license = "GNU GPL, v2 or later", + layer = -math.huge, + handler = true, + enabled = true + } +end + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + +-- relies on a gadget to implement "luarules reloadluaui" +-- relies on custom stuff in widgetHandler to implement blankOutConfig and allowUserWidgets + +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 + +local floor = math.floor + +local widgetsList = {} +local fullWidgetsList = {} + +local vsx, vsy = widgetHandler:GetViewSizes() + +local minMaxEntries = 15 +local curMaxEntries = 25 + +local startEntry = 1 +local pageStep = math.floor(curMaxEntries / 2) - 1 + +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 bgPadding = 5.5 +local bgcorner = "LuaUI/Images/bgcorner.png" + +local maxWidth = 0.01 +local borderx = yStep * 0.75 +local bordery = yStep * 0.75 + +local midx = vsx * 0.5 +local minx = vsx * 0.4 +local maxx = vsx * 0.6 +local midy = vsy * 0.5 +local miny = vsy * 0.4 +local maxy = vsy * 0.6 + +local sbposx = 0.0 +local sbposy = 0.0 +local sbsizex = 0.0 +local sbsizey = 0.0 +local sby1 = 0.0 +local sby2 = 0.0 +local sbsize = 0.0 +local sbheight = 0.0 +local activescrollbar = false +local scrollbargrabpos = 0.0 + +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", + [3] = "Allow/Disallow User Widgets", + [4] = "Reset LuaUI", + [5] = "Factory Reset LuaUI", +} + +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 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 + + +------------------------------------------------------------------------------- + + +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 + + +local function UpdateGeometry() + midx = vsx * 0.5 + midy = vsy * 0.5 + + local halfWidth = ((maxWidth+2) * fontSize) * sizeMultiplier * 0.5 + minx = floor(midx - halfWidth - (borderx*sizeMultiplier)) + maxx = floor(midx + halfWidth + (borderx*sizeMultiplier)) + + local ySize = (yStep * sizeMultiplier) * (#widgetsList) + miny = floor(midy - (0.5 * ySize)) - ((fontSize+bgPadding+bgPadding)*sizeMultiplier) + maxy = floor(midy + (0.5 * ySize)) +end + + +local function UpdateListScroll() + local wCount = #fullWidgetsList + local lastStart = lastStart or wCount - curMaxEntries + 1 + if (lastStart < 1) then lastStart = 1 end + if (lastStart > wCount - curMaxEntries + 1) then lastStart = 1 end + if (startEntry > lastStart) then startEntry = lastStart end + if (startEntry < 1) then startEntry = 1 end + + widgetsList = {} + local se = startEntry + local ee = se + curMaxEntries - 1 + local n = 1 + for i = se, ee do + widgetsList[n],n = fullWidgetsList[i],n+1 + end +end + + +local function ScrollUp(step) + startEntry = startEntry - step + UpdateListScroll() +end + + +local function ScrollDown(step) + startEntry = startEntry + step + UpdateListScroll() +end + + +function widget:MouseWheel(up, value) + if not show then return false end + + local a,c,m,s = Spring.GetModKeyState() + if (a or m) then + return false -- alt and meta allow normal control + end + local step = (s and 4) or (c and 1) or 2 + if (up) then + ScrollUp(step) + else + ScrollDown(step) + end + return true +end + + +local function SortWidgetListFunc(nd1, nd2) --does nd1 come before nd2? + -- widget profiler on top + if nd1[1]=="Widget Profiler" then + return true + elseif nd2[1]=="Widget Profiler" then + return false + end + + -- mod widgets first, then user widgets + if (nd1[2].fromZip ~= nd2[2].fromZip) then + return nd1[2].fromZip + end + + -- sort by name + return (nd1[1] < nd2[1]) +end + + +local function UpdateList() + if (not widgetHandler.knownChanged) then + return + end + widgetHandler.knownChanged = false + + local myName = widget:GetInfo().name + maxWidth = 0 + widgetsList = {} + for name,data in pairs(widgetHandler.knownWidgets) do + if (name ~= myName) then + fullWidgetsList[#fullWidgetsList+1] = { name, data } + -- look for the maxWidth + local width = fontSize * font:GetTextWidth(name) + if (width > maxWidth) then + maxWidth = width + end + end + end + + maxWidth = (maxWidth / fontSize) + + local myCount = #fullWidgetsList + if (widgetHandler.knownCount ~= (myCount + 1)) then + error('knownCount mismatch') + end + + table.sort(fullWidgetsList, SortWidgetListFunc) + + UpdateListScroll() + UpdateGeometry() +end + + +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 + end + sizeMultiplier = 0.6 + (vsx*vsy / 6000000) * customScale + + UpdateGeometry() +end + + +------------------------------------------------------------------------------- + +function widget:KeyPress(key, mods, isRepeat) + if (show and (key == KEYSYMS.ESCAPE) or + ((key == KEYSYMS.F11) and not isRepeat and + not (mods.alt or mods.ctrl or mods.meta or mods.shift))) then + show = not show + return true + end + if (show and key == KEYSYMS.PAGEUP) then + ScrollUp(pageStep) + return true + end + if (show and key == KEYSYMS.PAGEDOWN) then + ScrollDown(pageStep) + return true + end + return false +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']) then + activeGuishader = false + WG['guishader'].DeleteDlist('widgetselector') + end + return + end + UpdateList() + if (WG['guishader'] == nil) then + activeGuishader = false + end + if (WG['guishader']) and not activeGuishader then + activeGuishader = true + 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 + 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 + + -- draw the -/+ buttons + if maxx-10 < mx and mx < maxx and maxy < my and my < maxy + ((buttonFontSize + 7)*sizeMultiplier) then + tcol = '\255\031\031\031' + end + 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 + font:Print(tcol.."-", minx, maxy + ((7 + bgPadding)*sizeMultiplier), buttonFontSize*sizeMultiplier, "ol") + tcol = WhiteStr + + -- draw the box + 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) + RectRound(minx, miny, maxx, maxy, 8*sizeMultiplier) + + -- draw the text buttons (at the bottom) & their outlines + for i,name in ipairs(buttons) do + tcol = WhiteStr + 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 + font:Print(tcol .. buttons[i], (minx+maxx)/2, miny - (buttonTop*sizeMultiplier) - (i*(buttonHeight*sizeMultiplier)), buttonFontSize*sizeMultiplier, "oc") + end + + + -- draw the widgets + local nd = not widgetHandler.tweakMode and self:AboveLabel(mx, my) + local pointedY = nil + local pointedEnabled = false + local pointedName = (nd and nd[1]) or nil + local posy = maxy - ((yStep+bgPadding)*sizeMultiplier) + sby1 = posy + ((fontSize + fontSpace)*sizeMultiplier) * 0.5 + for _,namedata in ipairs(widgetsList) do + local name = namedata[1] + local data = namedata[2] + local color = '' + local pointed = (pointedName == name) + local order = widgetHandler.orderList[name] + local enabled = order and (order > 0) + local active = data.active + if (pointed and not activescrollbar) then + pointedY = posy + pointedEnabled = data.active + if not pagestepped and (lmb or mmb or rmb) then + color = WhiteStr + else + color = (active and '\255\128\255\128') or + (enabled and '\255\255\255\128') or '\255\255\128\128' + end + else + color = (active and '\255\064\224\064') or + (enabled and '\255\200\200\064') or '\255\224\064\064' + end + + local tmpName + if (data.fromZip) then + -- FIXME: extra chars not counted in text length + tmpName = WhiteStr .. '*' .. color .. name .. WhiteStr .. '*' + else + tmpName = color .. name + end + + font:Print(color..tmpName, midx, posy + (fontSize*sizeMultiplier) * 0.5, fontSize*sizeMultiplier, "vc") + posy = posy - (yStep*sizeMultiplier) + end + + + -- scrollbar + if #widgetsList < #fullWidgetsList then + sby2 = posy + (yStep * sizeMultiplier) - (fontSpace*sizeMultiplier) * 0.5 + sbheight = sby1 - sby2 + sbsize = sbheight * #widgetsList / #fullWidgetsList + if activescrollbar then + startEntry = math.max(0, math.min( + math.floor(#fullWidgetsList * + ((sby1 - sbsize) - + (my - math.min(scrollbargrabpos, sbsize))) + / sbheight + 0.5), + #fullWidgetsList - curMaxEntries)) + 1 + end + local sizex = maxx - minx + sbposx = minx + sizex + 1.0 + scrollbarOffset + sbposy = sby1 - sbsize - sbheight * (startEntry - 1) / #fullWidgetsList + sbsizex = (yStep * sizeMultiplier) + sbsizey = sbsize + + local trianglePadding = 4*sizeMultiplier + local scrollerPadding = 8*sizeMultiplier + + -- background + --gl.Color(0.0, 0.0, 0.0, 0.2) + --RectRound(sbposx, miny, sbposx + sbsizex, maxy, 6*sizeMultiplier) + if (sbposx < mx and mx < sbposx + sbsizex and miny < my and my < maxy) or activescrollbar then + gl.Color(1,1,1,0.04) + RectRound(sbposx, miny, sbposx + sbsizex, maxy, 6*sizeMultiplier) + end + + --[[gl.Color(1.0, 1.0, 1.0, 0.15) + gl.Shape(GL.TRIANGLES, { + { v = { sbposx + sbsizex / 2, miny + trianglePadding } }, + { v = { sbposx + trianglePadding, sby2 - 1 - trianglePadding} }, + { v = { sbposx + sbsizex - trianglePadding, sby2 - 1 - trianglePadding} } + }) + gl.Shape(GL.TRIANGLES, { + { v = { sbposx + sbsizex / 2, maxy - trianglePadding } }, + { v = { sbposx - trianglePadding + sbsizex, sby2 + sbheight + 1 + trianglePadding} }, + { v = { sbposx + trianglePadding, sby2 + sbheight + 1 + trianglePadding} } + })]]-- + + -- scroller + if (sbposx < mx and mx < sbposx + sbsizex and sby2 < my and my < sby2 + sbheight) then + gl.Color(1.0, 1.0, 1.0, 0.4) + gl.Blending(GL.SRC_ALPHA, GL.ONE) + RectRound(sbposx+scrollerPadding, sbposy, sbposx + sbsizex - scrollerPadding, sbposy + sbsizey, 1.75*sizeMultiplier) + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + end + gl.Color(0.33, 0.33, 0.33, 0.8) + RectRound(sbposx+scrollerPadding, sbposy, sbposx + sbsizex - scrollerPadding, sbposy + sbsizey, 1.75*sizeMultiplier) + else + sbposx = 0.0 + sbposy = 0.0 + sbsizex = 0.0 + sbsizey = 0.0 + end + + + -- highlight label + if (sbposx < mx and mx < sbposx + sbsizex and miny < my and my < maxy) or activescrollbar then + + else + if (pointedY) then + gl.Color(1.0, 1.0, 1.0, 0.09) + local xn = minx + 0.5 + local xp = maxx - 0.5 + local yn = pointedY - ((fontSpace * 0.5 + 1)*sizeMultiplier) + local yp = pointedY + ((fontSize + fontSpace * 0.5 + 1)*sizeMultiplier) + if scrollbarOffset < 0 then + xp = xp + scrollbarOffset + --xn = xn - scrollbarOffset + end + yn = yn + 0.5 + yp = yp - 0.5 + gl.Blending(GL.SRC_ALPHA, GL.ONE) + RectRound(xn, yn, xp, yp, 5*sizeMultiplier) + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) +end + end + + font:End() +end + + +function widget:MousePress(x, y, button) + if (Spring.IsGUIHidden()) or not show then + return false + end + + UpdateList() + + if button == 1 then + -- above a button + if minx < x and x < maxx and miny - (buttonTop*sizeMultiplier) - #buttons*(buttonHeight*sizeMultiplier) < y and y < miny - (buttonTop*sizeMultiplier) then + return true + end + + -- above the -/+ + if maxx-10 < x and x < maxx and maxy + bgPadding < y and y < maxy + ((buttonFontSize + 7 + bgPadding)*sizeMultiplier) then + return true + end + if minx < x and x < minx+10 and maxy + bgPadding < y and y < maxy + ((buttonFontSize + 7 + bgPadding)*sizeMultiplier) then + return true + end + + -- above the scrollbar + if ((x >= minx + scrollbarOffset) and (x <= maxx + scrollbarOffset + (yStep * sizeMultiplier))) then + if ((y >= (maxy - bordery)) and (y <= maxy)) then + if x > maxx+scrollbarOffset then + ScrollUp(1) + else + ScrollUp(pageStep) + end + return true + elseif ((y >= miny) and (y <= miny + bordery)) then + if x > maxx+scrollbarOffset then + ScrollDown(1) + else + ScrollDown(pageStep) + end + return true + end + end + + -- above the list + if sbposx < x and x < sbposx + sbsizex and sbposy < y and y < sbposy + sbsizey then + activescrollbar = true + scrollbargrabpos = y - sbposy + return true + elseif sbposx < x and x < sbposx + sbsizex and sby2 < y and y < sby2 + sbheight then + if y > sbposy + sbsizey then + startEntry = math.max(1, math.min(startEntry - curMaxEntries, #fullWidgetsList - curMaxEntries + 1)) + elseif y < sbposy then + startEntry = math.max(1, math.min(startEntry + curMaxEntries, #fullWidgetsList - curMaxEntries + 1)) + end + UpdateListScroll() + pagestepped = true + return true + end + end + + local namedata = self:AboveLabel(x, y) + if (not namedata) then + show = false + return false + end + + + return true + +end + + +function widget:MouseMove(x, y, dx, dy, button) + if show and activescrollbar then + startEntry = math.max(0, math.min(math.floor((#fullWidgetsList * ((sby1 - sbsize) - (y - math.min(scrollbargrabpos, sbsize))) / sbheight) + 0.5), + #fullWidgetsList - curMaxEntries)) + 1 + UpdateListScroll() + return true + end + return false +end + + +function widget:MouseRelease(x, y, mb) + if (Spring.IsGUIHidden()) or not show then + return -1 + end + + UpdateList() + if pagestepped then + pagestepped = false + return true + end + + if mb == 1 and activescrollbar then + activescrollbar = false + scrollbargrabpos = 0.0 + return -1 + end + + if mb == 1 then + if maxx-10 < x and x < maxx and maxy + bgPadding < y and y < maxy + buttonFontSize + 7 + bgPadding then + -- + button + curMaxEntries = curMaxEntries + 1 + UpdateListScroll() + UpdateGeometry() + Spring.WarpMouse(x, y+0.5*(fontSize+fontSpace)) + return -1 + end + if minx < x and x < minx+10 and maxy + bgPadding < y and y < maxy + buttonFontSize + 7 + bgPadding then + -- - button + if curMaxEntries > minMaxEntries then + curMaxEntries = curMaxEntries - 1 + UpdateListScroll() + UpdateGeometry() + Spring.WarpMouse(x, y-0.5*(fontSize+fontSpace)) + end + return -1 + end + end + + if mb == 1 then + local buttonID = nil + for i,_ in ipairs(buttons) do + if minx < x and x < maxx and miny - (buttonTop*sizeMultiplier) - i*(buttonHeight*sizeMultiplier) < y and y < miny - (buttonTop*sizeMultiplier) - (i-1)*(buttonHeight*sizeMultiplier) then + buttonID = i + break + end + end + if buttonID == 1 then + Spring.SendCommands("luarules reloadluaui") + return -1 + end + if buttonID == 2 then + -- disable all widgets, but don't reload + for _,namedata in ipairs(fullWidgetsList) do + widgetHandler:DisableWidget(namedata[1]) + end + widgetHandler:SaveConfigData() + return -1 + end + 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 + Spring.Echo("Disallowed user widgets, reloading...") + else + widgetHandler.__allowUserWidgets = true + Spring.Echo("Allowed user widgets, reloading...") + end + Spring.SendCommands("luarules reloadluaui") + return -1 + end + if buttonID == 4 then + Spring.SendCommands("luaui reset") + return -1 + end + if buttonID == 5 then + Spring.SendCommands("luaui factoryreset") + return -1 + end + end + + local namedata = self:AboveLabel(x, y) + if (not namedata) then + return false + end + + local name = namedata[1] + local data = namedata[2] + + if (mb == 1) then + widgetHandler:ToggleWidget(name) + elseif ((button == 2) or (button == 3)) then + local w = widgetHandler:FindWidget(name) + if (not w) then return -1 end + if (button == 2) then + widgetHandler:LowerWidget(w) + else + widgetHandler:RaiseWidget(w) + end + widgetHandler:SaveConfigData() + end + return -1 +end + + +function widget:AboveLabel(x, y) + if ((x < minx) or (y < (miny + bordery)) or + (x > maxx) or (y > (maxy - bordery))) then + return nil + end + local count = #widgetsList + if (count < 1) then return nil end + + local i = floor(1 + ((maxy - bordery) - y) / (yStep * sizeMultiplier)) + if (i < 1) then i = 1 + elseif (i > count) then i = count end + + return widgetsList[i] +end + + +function widget:IsAbove(x, y) + if not show then return false end + UpdateList() + if ((x < minx) or (x > maxx + (yStep * sizeMultiplier)) or + (y < miny - #buttons*buttonHeight) or (y > maxy+bgPadding)) then + return false + end + return true +end + + +function widget:GetTooltip(x, y) + if not show then return nil end + + UpdateList() + local namedata = self:AboveLabel(x, y) + if (not namedata) then + return '\255\200\255\200'..'Widget Selector\n' .. + '\255\255\255\200'..'LMB: toggle widget\n' .. + '\255\255\200\200'..'MMB: lower widget\n' .. + '\255\200\200\255'..'RMB: raise widget' + end + + local n = namedata[1] + local d = namedata[2] + + local order = widgetHandler.orderList[n] + local enabled = order and (order > 0) + + local tt = (d.active and GreenStr) or (enabled and YellowStr) or RedStr + tt = tt..n..'\n' + tt = d.desc and tt..WhiteStr..d.desc..'\n' or tt + tt = d.author and tt..BlueStr..'Author: '..CyanStr..d.author..'\n' or tt + tt = tt..MagentaStr..d.basename + if (d.fromZip) then + tt = tt..RedStr..' (mod widget)' + end + return tt +end + +function widget:GetConfigData() + local data = {startEntry=startEntry, curMaxEntries=curMaxEntries, show=show} + return data +end + +function widget:SetConfigData(data) + startEntry = data.startEntry or startEntry + curMaxEntries = data.curMaxEntries or curMaxEntries + show = data.show or show +end + +function widget:TextCommand(s) + -- process request to tell the widgetHandler to blank out the widget config when it shuts down + local token = {} + local n = 0 + for w in string.gmatch(s, "%S+") do + n = n + 1 + token[n] = w + end + if n==1 and token[1]=="reset" then + -- tell the widget handler to reload with a blank config + widgetHandler.blankOutConfig = true + Spring.SendCommands("luarules reloadluaui") + end + if n==1 and token[1]=="factoryreset" then + -- tell the widget handler to disallow user widgets and reload with a blank config + widgetHandler.__blankOutConfig = true + widgetHandler.__allowUserWidgets = false + Spring.SendCommands("luarules reloadluaui") + end +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'] 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 new file mode 100644 index 000000000..511b31b1e --- /dev/null +++ b/LuaUI/Widgets_Evo/map_startbox.lua @@ -0,0 +1,616 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: minimap_startbox.lua +-- brief: shows the startboxes in the minimap +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Start Boxes", + desc = "Displays Start Boxes and Start Points", + author = "trepan, jK", + date = "2007-2009", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +if (Game.startPosType ~= 2) then + return false +end + +if (Spring.GetGameFrame() > 1) then + widgetHandler:RemoveWidget(self) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- config options +-- + +-- 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) + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local useThickLeterring = true +local heightOffset = 50 +local fontSize = 18 +local fontShadow = true -- only shows if font has a white outline +local shadowOpacity = 0.35 + +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 widgetScale = (1 + (vsx*vsy / 5500000)) + +local gl = gl -- use a local copy for faster access + +local msx = Game.mapSizeX +local msz = Game.mapSizeZ + +local xformList = 0 +local coneList = 0 +local startboxDListStencil = 0 +local startboxDListColor = 0 + +local isSpec = Spring.GetSpectatingState() or Spring.IsReplay() + +local gaiaTeamID +local gaiaAllyTeamID + +local startTimer = Spring.GetTimer() + +local texName = LUAUI_DIRNAME .. 'Images/highlight_strip.png' +local texScale = 512 + + +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 glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +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 + +-------------------------------------------------------------------------------- + +GL.KEEP = 0x1E00 +GL.INCR_WRAP = 0x8507 +GL.DECR_WRAP = 0x8508 +GL.INCR = 0x1E02 +GL.DECR = 0x1E03 +GL.INVERT = 0x150A + +local stencilBit1 = 0x01 +local stencilBit2 = 0x10 + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function DrawMyBox(minX,minY,minZ, maxX,maxY,maxZ) + gl.BeginEnd(GL.QUADS, function() + --// top + gl.Vertex(minX, maxY, minZ); + gl.Vertex(maxX, maxY, minZ); + gl.Vertex(maxX, maxY, maxZ); + gl.Vertex(minX, maxY, maxZ); + --// bottom + gl.Vertex(minX, minY, minZ); + gl.Vertex(minX, minY, maxZ); + gl.Vertex(maxX, minY, maxZ); + gl.Vertex(maxX, minY, minZ); + end); + gl.BeginEnd(GL.QUAD_STRIP, function() + --// sides + gl.Vertex(minX, minY, minZ); + gl.Vertex(minX, maxY, minZ); + gl.Vertex(minX, minY, maxZ); + gl.Vertex(minX, maxY, maxZ); + gl.Vertex(maxX, minY, maxZ); + gl.Vertex(maxX, maxY, maxZ); + gl.Vertex(maxX, minY, minZ); + gl.Vertex(maxX, maxY, minZ); + gl.Vertex(minX, minY, minZ); + gl.Vertex(minX, maxY, minZ); + end); +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +local function createComnameList(x, y, name, teamID, color) + comnameList[teamID] = {} + comnameList[teamID]['x'] = math.floor(x) + comnameList[teamID]['y'] = math.floor(y) + comnameList[teamID]['list'] = gl.CreateList( function() + local outlineColor = {0,0,0,1} + if (color[1] + color[2]*1.2 + color[3]*0.4) < 0.8 then + outlineColor = {1,1,1,1} + end + if useThickLeterring then + if outlineColor[1] == 1 and fontShadow then + glTranslate(0, -(usedFontSize/44), 0) + shadowFont:Begin() + shadowFont:SetTextColor({0,0,0,shadowOpacity}) + shadowFont:SetOutlineColor({0,0,0,shadowOpacity}) + shadowFont:Print(name, x, y, usedFontSize, "con") + shadowFont:End() + glTranslate(0, (usedFontSize/44), 0) + end + font2:Begin() + font2:SetTextColor(outlineColor) + font2:SetOutlineColor(outlineColor) + + 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 + font2:Begin() + font2:SetTextColor(color) + font2:SetOutlineColor(outlineColor) + font2:Print(name, x, y, usedFontSize, "con") + font2:End() + end) +end + +local function DrawName(x, y, name, teamID, color) + -- not optimal, everytime you move camera the x and y are different so it has to recreate the drawlist + if comnameList[teamID] == nil or comnameList[teamID]['x'] ~= math.floor(x) or comnameList[teamID]['y'] ~= math.floor(y) then -- using floor because the x and y values had a a tiny change each frame + if comnameList[teamID] ~= nil then + gl.DeleteList(comnameList[teamID]['list']) + end + createComnameList(x, y, name, teamID, color) + end + 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(self) + return + end + + createInfotextList() + + -- get the gaia teamID and allyTeamID + gaiaTeamID = Spring.GetGaiaTeamID() + if (gaiaTeamID) then + gaiaAllyTeamID = select(6,Spring.GetTeamInfo(gaiaTeamID,false)) + end + + -- flip and scale (using x & y for gl.Rect()) + xformList = gl.CreateList(function() + gl.LoadIdentity() + gl.Translate(0, 1, 0) + gl.Scale(1 / msx, -1 / msz, 1) + end) + + -- cone list for world start positions + coneList = gl.CreateList(function() + local h = 100 + local r = 25 + local divs = 32 + gl.BeginEnd(GL.TRIANGLE_FAN, function() + gl.Vertex( 0, h, 0) + for i = 0, divs do + local a = i * ((math.pi * 2) / divs) + local cosval = math.cos(a) + local sinval = math.sin(a) + gl.Vertex(r * sinval, 0, r * cosval) + end + end) + end) + + if (drawGroundQuads) then + startboxDListStencil = gl.CreateList(function() + local minY,maxY = Spring.GetGroundExtremes() + minY = minY - 200; maxY = maxY + 500; + for _,at in ipairs(Spring.GetAllyTeamList()) do + if (true or at ~= gaiaAllyTeamID) then + local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) + if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then + + if (at == Spring.GetMyAllyTeamID()) then + gl.StencilMask(stencilBit2); + gl.StencilFunc(GL.ALWAYS, 0, stencilBit2); + else + gl.StencilMask(stencilBit1); + gl.StencilFunc(GL.ALWAYS, 0, stencilBit1); + end + DrawMyBox(xn-1,minY,zn-1, xp+1,maxY,zp+1) + + end + end + end + end) + + startboxDListColor = gl.CreateList(function() + local minY,maxY = Spring.GetGroundExtremes() + minY = minY - 200; maxY = maxY + 500; + for _,at in ipairs(Spring.GetAllyTeamList()) do + if (true or at ~= gaiaAllyTeamID) then + local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) + if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then + + if (at == Spring.GetMyAllyTeamID()) then + gl.Color( 0, 1, 0, 0.22 ) -- green + gl.StencilMask(stencilBit2); + gl.StencilFunc(GL.NOTEQUAL, 0, stencilBit2); + else + gl.Color( 1, 0, 0, 0.22 ) -- red + gl.StencilMask(stencilBit1); + gl.StencilFunc(GL.NOTEQUAL, 0, stencilBit1); + end + DrawMyBox(xn-1,minY,zn-1, xp+1,maxY,zp+1) + + end + end + end + end) + end +end + + +function removeLists() + gl.DeleteList(infotextList) + gl.DeleteList(xformList) + gl.DeleteList(coneList) + gl.DeleteList(startboxDListStencil) + gl.DeleteList(startboxDListColor) + 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) + end + end + comnameList = {} +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local teamColors = {} + +local function GetTeamColor(teamID) + local color = teamColors[teamID] + if (color) then + return color + end + local r,g,b = Spring.GetTeamColor(teamID) + + color = { r, g, b } + teamColors[teamID] = color + return color +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local teamColorStrs = {} + + +local function GetTeamColorStr(teamID) + local colorSet = teamColorStrs[teamID] + if (colorSet) then + return colorSet[1], colorSet[2] + end + + local outlineChar = '' + local r,g,b = Spring.GetTeamColor(teamID) + if (r and g and b) then + local function ColorChar(x) + local c = math.floor(x * 255) + c = ((c <= 1) and 1) or ((c >= 255) and 255) or c + return string.char(c) + end + local colorStr + colorStr = '\255' + colorStr = colorStr .. ColorChar(r) + colorStr = colorStr .. ColorChar(g) + colorStr = colorStr .. ColorChar(b) + local i = (r * 0.299) + (g * 0.587) + (b * 0.114) + outlineChar = ((i > 0.25) and 'o') or 'O' + teamColorStrs[teamID] = { colorStr, outlineChar } + return colorStr, "s",outlineChar + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function DrawStartboxes3dWithStencil() + gl.DepthMask(false); + if (gl.DepthClamp) then gl.DepthClamp(true); end + + gl.DepthTest(true); + gl.StencilTest(true); + gl.ColorMask(false, false, false, false); + gl.Culling(false); + + gl.StencilOp(GL.KEEP, GL.INVERT, GL.KEEP); + + gl.CallList(startboxDListStencil); --// draw + + gl.Culling(GL.BACK); + gl.DepthTest(false); + + gl.ColorMask(true, true, true, true); + + gl.CallList(startboxDListColor); --// draw + + if (gl.DepthClamp) then gl.DepthClamp(false); end + gl.StencilTest(false); + gl.DepthTest(true); + gl.Culling(false); +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:DrawWorld() + --gl.Fog(false) + + local time = Spring.DiffTimers(Spring.GetTimer(), startTimer) + + -- show the ally startboxes + DrawStartboxes3dWithStencil() + + -- show the team start positions + for _, teamID in ipairs(Spring.GetTeamList()) do + 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 + if (x ~= nil and x > 0 and z > 0 and y > -500) and not isNewbie then + local color = GetTeamColor(teamID) + local alpha = 0.5 + math.abs(((time * 3) % 1) - 0.5) + gl.PushMatrix() + gl.Translate(x, y, z) + gl.Color(color[1], color[2], color[3], alpha) + gl.CallList(coneList) + gl.PopMatrix() + end + end + end + + --gl.Fog(true) +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:DrawScreenEffects() + -- show the names over the team start positions + --gl.Fog(false) + for _, teamID in ipairs(Spring.GetTeamList()) do + 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) + local x, y, z = Spring.GetTeamStartPosition(teamID) + if (x ~= nil and x > 0 and z > 0 and y > -500) then + local sx, sy, sz = Spring.WorldToScreenCoords(x, y + 120, z) + if (sz < 1) then + + DrawName(sx, sy, name, teamID, GetTeamColor(teamID)) + + end + end + end + end + --gl.Fog(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 + if not isSpec then + gl.PushMatrix() + gl.Translate(vsx/2, vsy/6.2, 0) + gl.Scale(1*widgetScale, 1*widgetScale, 1) + gl.CallList(infotextList) + gl.PopMatrix() + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:DrawInMiniMap(sx, sz) + -- only show at the beginning + if (Spring.GetGameFrame() > 1) then + widgetHandler:RemoveWidget(self) + end + + gl.PushMatrix() + gl.CallList(xformList) + + gl.LineWidth(1.49) + + local gaiaAllyTeamID + local gaiaTeamID = Spring.GetGaiaTeamID() + if (gaiaTeamID) then + gaiaAllyTeamID = select(6,Spring.GetTeamInfo(gaiaTeamID,false)) + end + + -- show all start boxes + for _,at in ipairs(Spring.GetAllyTeamList()) do + if (at ~= gaiaAllyTeamID) then + local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) + if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then + local color + if (at == Spring.GetMyAllyTeamID()) then + color = { 0, 1, 0, 0.1 } -- green + else + color = { 1, 0, 0, 0.1 } -- red + end + gl.Color(color) + gl.Rect(xn, zn, xp, zp) + color[4] = 0.5 -- pump up the volume + gl.Color(color) + gl.PolygonMode(GL.FRONT_AND_BACK, GL.LINE) + gl.Rect(xn, zn, xp, zp) + gl.PolygonMode(GL.FRONT_AND_BACK, GL.FILL) + end + end + end + + gl.PushAttrib(GL_HINT_BIT) + --gl.Smoothing(true) --enable point smoothing + + -- show the team start positions + for _, teamID in ipairs(Spring.GetTeamList()) do + 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 + if (x ~= nil and x > 0 and z > 0 and y > -500) and not isNewbie then + local color = GetTeamColor(teamID) + local r, g, b = color[1], color[2], color[3] + local time = Spring.DiffTimers(Spring.GetTimer(), startTimer) + local i = 2 * math.abs(((time * 3) % 1) - 0.5) + gl.PointSize(11) + gl.Color(i, i, i) + gl.BeginEnd(GL.POINTS, gl.Vertex, x, z) + gl.PointSize(7.5) + gl.Color(r, g, b) + gl.BeginEnd(GL.POINTS, gl.Vertex, x, z) + end + end + end + + gl.LineWidth(1.0) + gl.PointSize(1.0) + gl.PopAttrib() --reset point smoothing + gl.PopMatrix() +end + + +function widget:ViewResize(x, y) + vsx,vsy = x,y + widgetScale = (0.75 + (vsx*vsy / 7500000)) + removeTeamLists() + 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/minimap_relative.lua b/LuaUI/Widgets_Evo/minimap_relative.lua new file mode 100644 index 000000000..cd1052173 --- /dev/null +++ b/LuaUI/Widgets_Evo/minimap_relative.lua @@ -0,0 +1,82 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: minimap_relative.lua +-- brief: keeps the minimap at a relative size (maxspect) +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "RelativeMinimap", + desc = "Keeps the minimap at a relative size (maxspect)", + author = "trepan", + date = "Feb 5, 2007", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Adjust these setting to your liking +-- + +-- offsets, in pixels +local xoff = 2 +local yoff = 2 + +-- maximum fraction of screen size, +-- set one value to 1 to calibrate the other +local xmax = 0.262 +local ymax = 0.310 + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Make sure these are floored +-- + +xoff = math.floor(xoff) +yoff = math.floor(yoff) + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widget:Initialize() + widget:ViewResize(widgetHandler:GetViewSizes()) +end + + +function widget:ViewResize(viewSizeX, viewSizeY) + -- the extra 2 pixels are for the minimap border + local xp = math.floor(viewSizeX * xmax) - xoff - 2 + local yp = math.floor(viewSizeY * ymax) - yoff - 2 + local limitAspect = (xp / yp) + local mapAspect = (Game.mapSizeX / Game.mapSizeZ) + + local sx, sy + if (mapAspect > limitAspect) then + sx = xp + sy = xp / mapAspect + else + sx = yp * mapAspect + sy = yp + end + sx = math.floor(sx) + sy = math.floor(sy) + gl.ConfigMiniMap(xoff, viewSizeY - sy - yoff, sx, sy) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/minimap_startbox.lua b/LuaUI/Widgets_Evo/minimap_startbox.lua deleted file mode 100644 index 9697c721e..000000000 --- a/LuaUI/Widgets_Evo/minimap_startbox.lua +++ /dev/null @@ -1,420 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: minimap_startbox.lua --- brief: shows the startboxes in the minimap --- author: Dave Rodgers --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "MiniMap Start Boxes", - desc = "MiniMap Start Boxes", - author = "trepan, jK", - date = "2007-2009", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (Game.startPosType ~= 2) then - return false -end - -if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- config options --- - --- enable simple version by default though -local drawGroundQuads = true - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local gl = gl -- use a local copy for faster access - -local msx = Game.mapSizeX -local msz = Game.mapSizeZ - -local xformList = 0 -local coneList = 0 -local startboxDListStencil = 0 -local startboxDListColor = 0 - -local gaiaTeamID -local gaiaAllyTeamID - -local startTimer = Spring.GetTimer() - -local texName = LUAUI_DIRNAME .. 'Images/highlight_strip.png' -local texScale = 512 - --------------------------------------------------------------------------------- - -GL.KEEP = 0x1E00 -GL.INCR_WRAP = 0x8507 -GL.DECR_WRAP = 0x8508 -GL.INCR = 0x1E02 -GL.DECR = 0x1E03 -GL.INVERT = 0x150A - -local stencilBit1 = 0x01 -local stencilBit2 = 0x10 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function DrawMyBox(minX,minY,minZ, maxX,maxY,maxZ) - gl.BeginEnd(GL.QUADS, function() - --// top - gl.Vertex(minX, maxY, minZ); - gl.Vertex(maxX, maxY, minZ); - gl.Vertex(maxX, maxY, maxZ); - gl.Vertex(minX, maxY, maxZ); - --// bottom - gl.Vertex(minX, minY, minZ); - gl.Vertex(minX, minY, maxZ); - gl.Vertex(maxX, minY, maxZ); - gl.Vertex(maxX, minY, minZ); - end); - gl.BeginEnd(GL.QUAD_STRIP, function() - --// sides - gl.Vertex(minX, minY, minZ); - gl.Vertex(minX, maxY, minZ); - gl.Vertex(minX, minY, maxZ); - gl.Vertex(minX, maxY, maxZ); - gl.Vertex(maxX, minY, maxZ); - gl.Vertex(maxX, maxY, maxZ); - gl.Vertex(maxX, minY, minZ); - gl.Vertex(maxX, maxY, minZ); - gl.Vertex(minX, minY, minZ); - gl.Vertex(minX, maxY, minZ); - end); -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - -- only show at the beginning - if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() - return - end - - -- get the gaia teamID and allyTeamID - gaiaTeamID = Spring.GetGaiaTeamID() - if (gaiaTeamID) then - local _,_,_,_,_,atid = Spring.GetTeamInfo(gaiaTeamID) - gaiaAllyTeamID = atid - end - - -- flip and scale (using x & y for gl.Rect()) - xformList = gl.CreateList(function() - gl.LoadIdentity() - gl.Translate(0, 1, 0) - gl.Scale(1 / msx, -1 / msz, 1) - end) - - -- cone list for world start positions - coneList = gl.CreateList(function() - local h = 100 - local r = 25 - local divs = 32 - gl.BeginEnd(GL.TRIANGLE_FAN, function() - gl.Vertex( 0, h, 0) - for i = 0, divs do - local a = i * ((math.pi * 2) / divs) - local cosval = math.cos(a) - local sinval = math.sin(a) - gl.Vertex(r * sinval, 0, r * cosval) - end - end) - end) - - if (drawGroundQuads) then - startboxDListStencil = gl.CreateList(function() - local minY,maxY = Spring.GetGroundExtremes() - minY = minY - 200; maxY = maxY + 100; - for _,at in ipairs(Spring.GetAllyTeamList()) do - if (true or at ~= gaiaAllyTeamID) then - local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) - if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then - - if (at == Spring.GetMyAllyTeamID()) then - gl.StencilMask(stencilBit2); - gl.StencilFunc(GL.ALWAYS, 0, stencilBit2); - else - gl.StencilMask(stencilBit1); - gl.StencilFunc(GL.ALWAYS, 0, stencilBit1); - end - DrawMyBox(xn,minY,zn, xp,maxY,zp) - - end - end - end - end) - - startboxDListColor = gl.CreateList(function() - local minY,maxY = Spring.GetGroundExtremes() - minY = minY - 200; maxY = maxY + 100; - for _,at in ipairs(Spring.GetAllyTeamList()) do - if (true or at ~= gaiaAllyTeamID) then - local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) - if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then - - if (at == Spring.GetMyAllyTeamID()) then - gl.Color( 0, 1, 0, 0.3 ) -- green - gl.StencilMask(stencilBit2); - gl.StencilFunc(GL.NOTEQUAL, 0, stencilBit2); - else - gl.Color( 1, 0, 0, 0.3 ) -- red - gl.StencilMask(stencilBit1); - gl.StencilFunc(GL.NOTEQUAL, 0, stencilBit1); - end - DrawMyBox(xn,minY,zn, xp,maxY,zp) - - end - end - end - end) - end -end - - -function widget:Shutdown() - gl.DeleteList(xformList) - gl.DeleteList(coneList) - gl.DeleteList(startboxDListStencil) - gl.DeleteList(startboxDListColor) -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local teamColors = {} - -local function GetTeamColor(teamID) - local color = teamColors[teamID] - if (color) then - return color - end - local r,g,b = Spring.GetTeamColor(teamID) - - color = { r, g, b } - teamColors[teamID] = color - return color -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local teamColorStrs = {} - - -local function GetTeamColorStr(teamID) - local colorSet = teamColorStrs[teamID] - if (colorSet) then - return colorSet[1], colorSet[2] - end - - local outlineChar = '' - local r,g,b = Spring.GetTeamColor(teamID) - if (r and g and b) then - local function ColorChar(x) - local c = math.floor(x * 255) - c = ((c <= 1) and 1) or ((c >= 255) and 255) or c - return string.char(c) - end - local colorStr - colorStr = '\255' - colorStr = colorStr .. ColorChar(r) - colorStr = colorStr .. ColorChar(g) - colorStr = colorStr .. ColorChar(b) - local i = (r * 0.299) + (g * 0.587) + (b * 0.114) - outlineChar = ((i > 0.25) and 'o') or 'O' - teamColorStrs[teamID] = { colorStr, outlineChar } - return colorStr, "s",outlineChar - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function DrawStartboxes3dWithStencil() - gl.DepthMask(false); - if (gl.DepthClamp) then gl.DepthClamp(true); end - - gl.DepthTest(true); - gl.StencilTest(true); - gl.ColorMask(false, false, false, false); - gl.Culling(false); - - gl.StencilOp(GL.KEEP, GL.INVERT, GL.KEEP); - - gl.CallList(startboxDListStencil); --// draw - - gl.Culling(GL.BACK); - gl.DepthTest(false); - - gl.ColorMask(true, true, true, true); - - gl.CallList(startboxDListColor); --// draw - - if (gl.DepthClamp) then gl.DepthClamp(false); end - gl.StencilTest(false); - gl.DepthTest(true); - gl.Culling(false); -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:DrawWorld() - gl.Fog(false) - - local time = Spring.DiffTimers(Spring.GetTimer(), startTimer) - - -- show the ally startboxes - DrawStartboxes3dWithStencil() - - -- show the team start positions - for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local _,_,spec = Spring.GetPlayerInfo(leader) - if ((not spec) and (teamID ~= gaiaTeamID)) then - local x, y, z = Spring.GetTeamStartPosition(teamID) - if (x ~= nil and x > 0 and z > 0 and y > -500) then - local color = GetTeamColor(teamID) - local alpha = 0.5 + math.abs(((time * 3) % 1) - 0.5) - gl.PushMatrix() - gl.Translate(x, y, z) - gl.Color(color[1], color[2], color[3], alpha) - gl.CallList(coneList) - gl.PopMatrix() - end - end - end - - gl.Fog(true) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:DrawScreenEffects() - -- show the names over the team start positions - gl.Fog(false) - gl.BeginText() - for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local name,_,spec = Spring.GetPlayerInfo(leader) - if ((not spec) and (teamID ~= gaiaTeamID)) then - local colorStr, outlineStr = GetTeamColorStr(teamID) - local x, y, z = Spring.GetTeamStartPosition(teamID) - if (x ~= nil and x > 0 and z > 0 and y > -500) then - local sx, sy, sz = Spring.WorldToScreenCoords(x, y + 120, z) - if (sz < 1) then - gl.Text(colorStr .. name, sx, sy, 18, 'cs') - end - end - end - end - gl.EndText() - gl.Fog(true) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:DrawInMiniMap(sx, sz) - -- only show at the beginning - if (Spring.GetGameFrame() > 1) then - widgetHandler:RemoveWidget() - end - - gl.PushMatrix() - gl.CallList(xformList) - - gl.LineWidth(1.49) - - local gaiaAllyTeamID - local gaiaTeamID = Spring.GetGaiaTeamID() - if (gaiaTeamID) then - local _,_,_,_,_,atid = Spring.GetTeamInfo(gaiaTeamID) - gaiaAllyTeamID = atid - end - - -- show all start boxes - for _,at in ipairs(Spring.GetAllyTeamList()) do - if (at ~= gaiaAllyTeamID) then - local xn, zn, xp, zp = Spring.GetAllyTeamStartBox(at) - if (xn and ((xn ~= 0) or (zn ~= 0) or (xp ~= msx) or (zp ~= msz))) then - local color - if (at == Spring.GetMyAllyTeamID()) then - color = { 0, 1, 0, 0.1 } -- green - else - color = { 1, 0, 0, 0.1 } -- red - end - gl.Color(color) - gl.Rect(xn, zn, xp, zp) - color[4] = 0.5 -- pump up the volume - gl.Color(color) - gl.PolygonMode(GL.FRONT_AND_BACK, GL.LINE) - gl.Rect(xn, zn, xp, zp) - gl.PolygonMode(GL.FRONT_AND_BACK, GL.FILL) - end - end - end - - gl.PushAttrib(GL_HINT_BIT) - gl.Smoothing(true) --enable point smoothing - - -- show the team start positions - for _, teamID in ipairs(Spring.GetTeamList()) do - local _,leader = Spring.GetTeamInfo(teamID) - local _,_,spec = Spring.GetPlayerInfo(leader) - if ((not spec) and (teamID ~= gaiaTeamID)) then - local x, y, z = Spring.GetTeamStartPosition(teamID) - if (x ~= nil and x > 0 and z > 0 and y > -500) then - local color = GetTeamColor(teamID) - local r, g, b = color[1], color[2], color[3] - local time = Spring.DiffTimers(Spring.GetTimer(), startTimer) - local i = 2 * math.abs(((time * 3) % 1) - 0.5) - gl.PointSize(11) - gl.Color(i, i, i) - gl.BeginEnd(GL.POINTS, gl.Vertex, x, z) - gl.PointSize(7.5) - gl.Color(r, g, b) - gl.BeginEnd(GL.POINTS, gl.Vertex, x, z) - end - end - end - - gl.LineWidth(1.0) - gl.PointSize(1.0) - gl.PopAttrib() --reset point smoothing - gl.PopMatrix() -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/red_ui_framework.lua b/LuaUI/Widgets_Evo/red_ui_framework.lua new file mode 100644 index 000000000..2ab79df29 --- /dev/null +++ b/LuaUI/Widgets_Evo/red_ui_framework.lua @@ -0,0 +1,838 @@ +function widget:GetInfo() + return { + version = "9", + name = "Red_UI_Framework", + desc = "Red UI Framework", + author = "Regret (enhanced by Floris)", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + 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 + +local TN = "Red" +local DrawingTN = "Red_Drawing" --WG name for drawing function list +local version = 9 + +local clock = os.clock +local sgsub = string.gsub +local function getLineCount(text) + _,linecount = sgsub(text,"\n","\n") + return linecount+1 +end + +local Main = {} --boss table with a manabar +local WidgetList = {} --list of widgets using the framework + +local LastProcessedWidget = "" --for debugging +local inTweak = false + +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 = 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 +end + + +--helper functions +local type = type + +local function getTextWidth(o) + 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) + return getLineCount(o.caption)*o.fontsize +end + +local function isInRect(x,y,px,py,sx,sy) + if (not py) then + py = px.py + sx = px.sx + sy = px.sy + px = px.px + end + if ((x >= px) and (x <= px+sx) + and (y >= py) and (y <= py+sy)) then + return true + end + return false +end + +local function copytable(t,copyeverything) + local r = {} + for i,v in pairs(t) do + if (copyeverything and (type(v)=="table")) then + r[i] = copytable(v) --can (probably) cause loops + else + r[i] = v + end + end + return r +end +------------------------- + + +--Objects +local F = { + [1] = function(o) --rectangle + if (o.draw == false) then + return + end + + local color = o.color + local border = o.border --color + local texturecolor = o.texturecolor + local captioncolor = o.captioncolor + local iconscale = 1 + if o.iconscale ~= nil then + iconscale = o.iconscale + end + + local texture = o.texture + local px,py,sx,sy = o.px,o.py,o.sx,o.sy + + local alphamult = o.alphamult + if (alphamult~=nil) then + if (color) then + color = copytable(color) + color[4] = o.color[4]*alphamult + end + if (border) then + border = copytable(border) + border[4] = o.border[4]*alphamult + end + if (captioncolor) then + captioncolor = copytable(captioncolor) + captioncolor[4] = o.captioncolor[4]*alphamult + end + if (texturecolor) then + texturecolor = copytable(texturecolor) + texturecolor[4] = o.texturecolor[4]*alphamult + else + texturecolor = {1,1,1,alphamult} + end + end + + if (color) then + Rect(px,py,sx,sy,color,iconscale) + end + + if (texture) then + TexRect(px,py,sx,sy,texture,texturecolor,iconscale) + end + + if (o.caption) then + local px2,py2 = px,py + local text = o.caption + 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 + if (height > sy) then + fontsize = sy/linecount + px2 = px2 + (sx - width*fontsize) /2 --center + 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,o.font2) + o.autofontsize = fontsize + end + + if (border) then --todo: border styles + Border(px,py,sx,sy,o.borderwidth,border) + end + end, + + [2] = function(o) --text + if (o.draw == false) then + return + end + + local color = o.color + local captioncolor = o.captioncolor + + local alphamult = o.alphamult + if (alphamult~=nil) then + if (color) then + color = copytable(color) + color[4] = o.color[4]*alphamult + elseif (captioncolor) then + captioncolor = copytable(captioncolor) + captioncolor[4] = o.captioncolor[4]*alphamult + end + end + + local px,py = o.px,o.py + local fontsize = o.fontsize + + Text(px,py,fontsize,o.caption,o.options,color or captioncolor,o.font2) + end, + + [3] = function(o) --area + --plain dummy + end, + + [4] = function(o) --rectangle rounded + if (o.draw == false) then + return + end + + local color = o.color + local border = o.border --color + local texturecolor = o.texturecolor + local captioncolor = o.captioncolor + local iconscale = 1 + if o.iconscale ~= nil then + iconscale = o.iconscale + end + + local texture = o.texture + local px,py,sx,sy = o.px,o.py,o.sx,o.sy + + local alphamult = o.alphamult + if (alphamult~=nil) then + if (color) then + color = copytable(color) + color[4] = o.color[4]*alphamult + end + if (border) then + border = copytable(border) + border[4] = o.border[4]*alphamult + end + if (captioncolor) then + captioncolor = copytable(captioncolor) + captioncolor[4] = o.captioncolor[4]*alphamult + end + if (texturecolor) then + texturecolor = copytable(texturecolor) + texturecolor[4] = o.texturecolor[4]*alphamult + else + texturecolor = {1,1,1,alphamult} + end + end + if (color) then + local roundedSize = usedRoundedSize + if o.roundedsize ~= nil then + roundedSize = o.roundedsize + end + 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,(o.guishader ~= nil and o.guishader)) + end + end + + if (texture) then + TexRect(px,py,sx,sy,texture,texturecolor,iconscale) + end + + if (o.caption) then + local px2,py2 = px,py + local text = o.caption + 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 + if (height > sy) then + fontsize = sy/linecount + px2 = px2 + (sx - width*fontsize) /2 --center + 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,o.font2) + o.autofontsize = fontsize + end + + if (border) then --todo: border styles + --Border(px,py,sx,sy,o.borderwidth,border) + end + end, +} +if useRoundedRectangles == false then + F[4] = F[1] +end + +local otypes = { + ["rectangle"] = 1, + ["text"] = 2, + ["area"] = 3, + ["rectanglerounded"] = 4, +} +------------------------- + +local function processEffects(o,CurClock) + local e = o.effects + + if (o.active ~= false) then + if (e.fadein_at_activation) then + if (o.justactivated) then + if (o.alphamult == nil) then + o.alphamult = 0 + end + o.fadein_at_activation_start = CurClock --effect start + end + if (o.alphamult~=nil) then + local start = o.fadein_at_activation_start + o.alphamult = (CurClock-start)/e.fadein_at_activation + if (o.alphamult > 1) then + o.alphamult = nil + o.fadein_at_activation_start = nil + else + --useless here [x] maby + o.tempactive = true --force object to be active + end + end + end + else + o.fadein_at_activation_start = nil + end + + if (o.active == false) then + if (e.fadeout_at_deactivation) then + if (o.justdeactivated) then + if (o.alphamult == nil) then + o.alphamult = 0 + end + o.fadeout_at_deactivation_start = CurClock --effect start + end + if (o.alphamult~=nil) then + local start = o.fadeout_at_deactivation_start + if (start~=nil) then + o.alphamult = 1-(CurClock-start)/e.fadeout_at_deactivation + if (o.alphamult <= 0) then + o.alphamult = nil + o.fadeout_at_deactivation_start = nil + else + o.tempactive = true --force object to be active + end + end + end + end + else + o.fadeout_at_deactivation_start = nil + end +end + +--Mouse handling +local Mouse = {{},{},{}} +local sGetMouseState = Spring.GetMouseState + +local dropClick = false +local dropWheel = false + +local useDefaultMouseCursor = false +function widget:IsAbove(x,y) + if (useDefaultMouseCursor) then + return true + end + return false +end + +local WheelState = nil +function widget:MouseWheel(up,value) --up = true/false , value = -1/1 + if Spring.IsGUIHidden() then return end + WheelState = up + return dropWheel +end + +function widget:MousePress(mx,my,mb) + if Spring.IsGUIHidden() then return end + if (type(dropClick)=="table") then + for i=1,#dropClick do + if (dropClick[i] == mb) then + dropClick = true + break + end + end + if (dropClick ~= true) then + dropClick = false + end + end + + return dropClick +end + +local LastMouseState = {sGetMouseState()} +local function handleMouse() + if Spring.IsGUIHidden() then return end + --reset status + dropClick = false + dropWheel = false + useDefaultMouseCursor = false + ---- + + local CurMouseState = {sGetMouseState()} --{mx,my,m1,m2,m3} + CurMouseState[2] = vsy-CurMouseState[2] --make 0,0 top left + + Mouse.hoverunused = true --used in mouseover + Mouse.x = CurMouseState[1] + Mouse.y = CurMouseState[2] + + if (WheelState ~= nil) then + Mouse.wheel = WheelState + else + Mouse.wheel = nil + end + WheelState = nil + + for i=3,5 do + local n=i-2 + Mouse[n][1] = nil + Mouse[n][2] = nil + Mouse[n][3] = nil + + if (CurMouseState[i] and LastMouseState[i]) then + Mouse[n][1] = true --isheld + elseif (CurMouseState[i] and (not LastMouseState[i])) then + Mouse[n][2] = true --waspressed + Mouse[n][4] = {Mouse.x,Mouse.y} --last press + elseif ((not CurMouseState[i]) and LastMouseState[i]) then + Mouse[n][3] = true --wasreleased + Mouse[n][5] = {Mouse.x,Mouse.y} --last release + end + end + LastMouseState = CurMouseState +end + +local function mouseEvent(t,e,o) + if (t) then + for i=1,#t do + local m = Mouse[t[i][1]] + if (m[e]) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then + o.checkedformouse = true + else + return true + end + end + + if ((e==1) and (not isInRect(m[4][1],m[4][2],o))) then --last click was not in same area + --nuthin' + else + m[e] = nil --so only topmost area will get the event + t[i][2](Mouse.x,Mouse.y,o) + end + end + end + end +end + +local function processMouseEvents(o) + o.checkedformouse = nil + + if (o[2] == 2) then --text + o.sx = o.getwidth() + o.sy = o.getheight() + end + + if (o.movable) then + for i=1,#o.movable do + if inTweak or (o.onlyTweakUi ~= nil and o.onlyTweakUi == false) then + if (not o.wasclicked) then + if (Mouse[o.movable[i]][2]) then + if (isInRect(Mouse.x,Mouse.y,o)) then + o.checkedformouse = true + + o.wasclicked = {o.px - Mouse.x,o.py - Mouse.y} + Mouse[o.movable[i]][2] = nil --so only topmost area will get the event + end + end + else + local newpx = Mouse.x + o.wasclicked[1] + local newpy = Mouse.y + o.wasclicked[2] + + if (o.obeyscreenedge) then + 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 + if (newpx((o.movablearea.px+o.movablearea.sx)-o.sx)) then newpx = (o.movablearea.px+o.movablearea.sx)-o.sx end + if (newpy>((o.movablearea.py+o.movablearea.sy)-o.sy)) then newpy = (o.movablearea.py+o.movablearea.sy)-o.sy end + elseif (o.minpx) then + if (newpx(o.maxpx-o.sx)) then newpx = o.maxpx-o.sx end + if (newpy>(o.maxpy-o.sy)) then newpy = o.maxpy-o.sy end + end + + local changex = newpx-o.px + local changey = newpy-o.py + if (o.movableslaves) then + for j=1,#o.movableslaves do + local s = o.movableslaves[j] + local snewpx = s.px - (o.px - newpx) + local snewpy = s.py - (o.py - newpy) + + if (s.obeyscreenedge) then + if (snewpx<0) then snewpx = 0 end + if (snewpy<0) then snewpy = 0 end + if (snewpx>(vsx-s.sx)) then snewpx = vsx-s.sx end + if (snewpy>(vsy-s.sy)) then snewpy = vsy-s.sy end + elseif (s.movablearea and (s.movablearea~=o)) then --disregard self to prevent a bug + if (snewpx((s.movablearea.px+s.movablearea.sx)-s.sx)) then snewpx = (s.movablearea.px+s.movablearea.sx)-s.sx end + if (snewpy>((s.movablearea.py+s.movablearea.sy)-s.sy)) then snewpy = (s.movablearea.py+s.movablearea.sy)-s.sy end + elseif (s.minpx) then + if (snewpx(s.maxpx-s.sx)) then snewpx = s.maxpx-s.sx end + if (snewpy>(s.maxpy-s.sy)) then snewpy = s.maxpy-s.sy end + end + + local schangex = snewpx-s.px + local schangey = snewpy-s.py + + if (math.abs(changex)>math.abs(schangex)) then changex = schangex end + if (math.abs(changey)>math.abs(schangey)) then changey = schangey end + end + for j=1,#o.movableslaves do --move slaves + local s = o.movableslaves[j] + s.px = s.px+changex + s.py = s.py+changey + end + end + o.px = o.px+changex --move self + o.py = o.py+changey + if (Mouse[o.movable[i]][3]) then + o.wasclicked = nil + Mouse[o.movable[i]][3] = nil --so only topmost area will get the event + end + end + end + end + end + + if (o.mousenotover) then + if (isInRect(Mouse.x,Mouse.y,o)) then + o.checkedformouse = true + else + o.mousenotover(Mouse.x,Mouse.y,o) + return + end + end + + if (o.overridecursor) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then o.checkedformouse = true else return end + end + useDefaultMouseCursor = true + end + if (o.overrideclick) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then o.checkedformouse = true else return end + end + dropClick = o.overrideclick + end + if (o.overridewheel) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then o.checkedformouse = true else return end + end + dropWheel = true + end + + if (o.mouseover and Mouse.hoverunused) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then + o.checkedformouse = true + else + return + end + end + Mouse.hoverunused = false + o.mouseover(Mouse.x,Mouse.y,o) + end + + if mouseEvent(o.mouseclick,2,o) + or mouseEvent(o.mouseheld,1,o) + or mouseEvent(o.mouserelease,3,o) then return end + + if (o.mousewheel) then + if (not o.checkedformouse) then + if (isInRect(Mouse.x,Mouse.y,o)) then + o.checkedformouse = true + else + return + end + end + if (Mouse.wheel ~= nil) then + o.mousewheel(Mouse.wheel,Mouse.x,Mouse.y,o) + end + end +end +------------------------- + +local ssub = string.sub +function widget:Initialize() + + 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 + Main.Mouse = Mouse + + Main.GetWidgetObjects = function(w) + for i=1,#WidgetList do + if (WidgetList[i]:GetInfo().name == w:GetInfo().name) then + return copytable(Main[1][i]) + end + end + end + + Main.SetTooltip = function(text) + WG[TN].tooltip = text + end + Main.GetSetTooltip = function() + return WG[TN].tooltip + end + + Main.New = function(w) --function to create a function dawg + for i=1,#WidgetList do --prevents duplicate widget tables + if (WidgetList[i]:GetInfo().name == w:GetInfo().name) then + --Spring.Echo(widget:GetInfo().name..">> don't reload the widget \""..w:GetInfo().name.."\" so fast :<") + table.remove(WidgetList,i) + table.remove(Main[1],i) + break + end + end + + local n = #Main[1]+1 + WidgetList[n] = w --remember widget + Main[1][n] = {} + local t = Main[1][n] + return function(o) + local duplicate = false + for i=1,#t do + if (t[i] == o) then + duplicate = true --object already exists, create a copy + break + end + end + + local r = {} + + local m = #t+1 + if (duplicate) then + --local new = copytable(o,true) + local new = copytable(o) + t[m] = new + r = new + else + o[2] = otypes[o[1]] --translate object type + t[m] = o + r = o + end + + r.delete = function() + r.scheduledfordeletion = true + end + + if (r.caption) then + r.getwidth = function() + return getTextWidth(r) + end + + r.getheight = function() + return getTextHeight(r) + end + end + + return r + end + end +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 + end +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 + +local hookedtodrawing = false +local fc = 0 --framecount +function widget:Update() + + Main.tooltip = nil + handleMouse() + --flush deactivated widgets + fc=fc+1 + if (fc > 200) then + fc = 0 + local temp = {} + for i=1,#WidgetList do + local name = WidgetList[i]:GetInfo().name + local order = widgetHandler.orderList[name] + local enabled = order and (order > 0) + + if (enabled) then + temp[#temp+1] = WidgetList[i] + else + table.remove(Main[1],i) + end + end + WidgetList = temp + end + + if (not hookedtodrawing) then --so drawing widget can be loaded after this widget + if (WG[DrawingTN]) then + local X = WG[DrawingTN] + if (X.version ~= version) then + Spring.Echo(widget:GetInfo().name..">> Invalid drawing widget version.") + widgetHandler:ToggleWidget(widget:GetInfo().name) + return + end + Color = X.Color + Rect = X.Rect + RectRound = X.RectRound + TexRect = X.TexRect + Border = X.Border + Text = X.Text + hookedtodrawing = true + end + else --process widgets + local wl = Main[1] + for j=#wl,1,-1 do --iterate backwards + if (j==0) then break end + local CurClock = clock() + + --for debugging + WG[DrawingTN].LastWidget = "" + local w = WidgetList[j] + if (w) then + local winfo = WidgetList[j]:GetInfo() + if (winfo) then + LastProcessedWidget = winfo.name + WG[DrawingTN].LastWidget = LastProcessedWidget + end + end + -- + + local dellst = {} + local objlst = wl[j] + + for i=1,#objlst do + local o = objlst[i] + o.tempactive = nil + if (o.scheduledfordeletion) then + dellst[#dellst+1] = i + else + if (o.active ~= false) then + o.notfirstprocessing = true + if (o.lastactivestate == false) then + o.justactivated = true + else + o.justactivated = nil + end + else + if ((o.lastactivestate ~= false) and o.notfirstprocessing) then + o.justdeactivated = true + else + o.justdeactivated = nil + end + end + o.lastactivestate = o.active + + if (o.effects) then + processEffects(o,CurClock) + end + if ((o.active ~= false) or o.tempactive) then + F[o[2]](o) --object draw function + end + end + + --process mouseevents backwards, so topmost drawn objects get to mouseevents first + 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 + end + end + end + + for i=1,#dellst do + table.remove(objlst,dellst[i]) + end + end + end +end + +function widget:WorldTooltip(ttType,data1,data2,data3) + return Main.tooltip +end diff --git a/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua b/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua new file mode 100644 index 000000000..9c9ad8245 --- /dev/null +++ b/LuaUI/Widgets_Evo/red_ui_framework_drawing.lua @@ -0,0 +1,463 @@ +function widget:GetInfo() + return { + version = "9", + name = "Red_Drawing", + desc = "Drawing widget for Red UI Framework", + author = "Regret", + date = "29 may 2015", + license = "GNU GPL, v2 or later", + layer = -1, + enabled = true, + } +end + +local bgcornerSize = 8 +local bgcorner = "LuaUI/Images/bgcorner.png" + +local TN = "Red_Drawing" --WG name for function list +local version = 9 + + +local vsx,vsy = widgetHandler:GetViewSizes() +if (vsx == 1) then --hax for windowed mode + vsx,vsy = Spring.GetWindowGeometry() +end + +local sIsGUIHidden = Spring.IsGUIHidden + +local F = {} --function table +local Todo = {} --function queue +local dList = {} +local StartList + +local glText = gl.Text +local glTexture = gl.Texture +local glColor = gl.Color +local glRect = gl.Rect +local glTexRect = gl.TexRect +local glMatrixMode = gl.MatrixMode +local glLoadIdentity = gl.LoadIdentity +local glOrtho = gl.Ortho +local glTranslate = gl.Translate +local glResetState = gl.ResetState +local glResetMatrices = gl.ResetMatrices +local glDepthTest = gl.DepthTest +local glVertex = gl.Vertex +local glBeginEnd = gl.BeginEnd +local glCallList = gl.CallList +local glDeleteList = gl.DeleteList +local glCreateList = gl.CreateList +local glPushMatrix = gl.PushMatrix +local glPopMatrix = gl.PopMatrix +local glScale = gl.Scale + +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 GL_LINE_LOOP = GL.LINE_LOOP +local GL_COLOR_BUFFER_BIT = GL.COLOR_BUFFER_BIT +local GL_PROJECTION = GL.PROJECTION +local GL_MODELVIEW = GL.MODELVIEW + +local blurRect = {} +local newBlurRect = {} + + +local function Color(c) + glColor(c[1],c[2],c[3],c[4]) +end + +local function Text(px,py,fontsize,text,options,c,usefont2) + glPushMatrix() + local f = usefont2 and font2 or font + f:Begin() + if (c) then + 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 + 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 + options = options.."d" --fuck you jK + else + options = "d" + end + glScale(1,-1,1) --flip + + --glText(text,0,0,fontsize,options) + f:Print(text,0,0,fontsize,options) + f:End() + glPopMatrix() +end + +local function Border(px,py,sx,sy,width,c) + if (width == nil) then + width = 1 + elseif (width == 0) then + return + end + px,py,sx,sy = px,py,sx,sy + + glPushMatrix() + if (c) then + glColor(c[1],c[2],c[3],c[4]) + else + glColor(1,1,1,1) + end + glTranslate(px,py,0) + glRect(0,0,sx,width) --top + glRect(0,width,width,sy) --left + glRect(width,sy-width,sx-width,sy) --bottom + glRect(sx-width,width,sx,sy) --right + glPopMatrix() +end + +local function Rect(px,py,sx,sy,c,scale) + if (c) then + glColor(c[1],c[2],c[3],c[4]) + else + glColor(1,1,1,1) + 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 + px,py,sx,sy = px,py,sx,sy + glRect(px,py,px+sx,py+sy) +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 + + -- 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 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 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 +end + +local function TexRect(px,py,sx,sy,texture,c,scale) + glPushMatrix() + if (c) then + glColor(c[1],c[2],c[3],c[4]) + else + glColor(1,1,1,1) + 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 + px,py,sx,sy = px,py,sx,sy + glTranslate(px,py+sy,0) + glScale(1,-1,1) --flip + glTexture(texture) + DrawRect(0,0,sx,sy) + glTexture(false) + glPopMatrix() +end + +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 CreateStartList() + if (StartList) then glDeleteList(StartList) end + StartList = glCreateList(function() + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + glOrtho(0,vsx,vsy,0,0,1) --top left is 0,0 + glDepthTest(false) + glMatrixMode(GL_MODELVIEW) + glLoadIdentity() + glTranslate(0.375,0.375,0) -- for exact pixelization + end) +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 + T.Rect = function(a,b,c,d,e,f) + Todo[#Todo+1] = {2,a,b,c,d,e,f} + end + T.TexRect = function(a,b,c,d,e,f,g) + Todo[#Todo+1] = {3,a,b,c,d,e,f,g} + end + 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,g) + Todo[#Todo+1] = {5,a,b,c,d,e,f,g} + end + 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 + F[2] = Rect + F[3] = TexRect + F[4] = Border + F[5] = Text + F[6] = RectRound +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 + + newBlurRect = {} + + glResetState() + glResetMatrices() + + glCallList(StartList) + + local id = '' + local t + for i=1,#Todo do + t = Todo[i] + id = '' + if t[1] == 5 then -- text + 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 + 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[id]) + else + 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() + + 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'].DeleteDlist('red_ui_'..rect.id) + blurRect[id] = nil + else + newBlurRect[id] = rect + end + end + -- add new blur areas + local count = 0 + for id, rect in pairs(newBlurRect) do + if blurRect[id] == nil then + local x = rect.px + 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'].InsertDlist(glCreateList( function() RectRoundOrg(x,y2,x2,y,rect.cs) end), 'red_ui_'..rectid) + newBlurRect[rectid].id = rectid + end + count = count + 1 + end + --Spring.Echo(count) + blurRect = newBlurRect + else + blurRect = {} + end +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 + removeDLists() + end +end + +function removeDLists() + for t, l in pairs(dList) do + glDeleteList(dList[l]) + end + dList = {} +end + +function widget:Shutdown() + glDeleteList(StartList) + removeDLists() + + if WG['guishader'] then + + -- remove blur areas + for id, rect in pairs(blurRect) do + if rect.id ~= nil then + WG['guishader'].DeleteDlist('red_ui_'..rect.id) + blurRect[id] = nil + end + end + end + + if (WG[TN].LastWidget) then + Spring.Echo(widget:GetInfo().name..">> last processed widget was \""..WG[TN].LastWidget.."\"") --for debugging + end + + WG[TN]=nil +end diff --git a/LuaUI/Widgets_Evo/reset_hotkeys.lua b/LuaUI/Widgets_Evo/reset_hotkeys.lua deleted file mode 100644 index 68cfcd7a2..000000000 --- a/LuaUI/Widgets_Evo/reset_hotkeys.lua +++ /dev/null @@ -1,39 +0,0 @@ -function widget:GetInfo() - return { - name = "Reset Hotkeys", - desc = "Sets default hotkeys for common order elements", - author = "", - date = "", - license = "GNU LGPL, v2.1 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - -function widget:Initialize() - - -- replace fps mode bind with capture - Spring.SendCommands({ - "unbindkeyset c", - }) - Spring.SendCommands("bind ctrl+c capture") - - - -- set repeat to be bound to q - Spring.SendCommands({ - "unbindkeyset q", - }) - Spring.SendCommands("bind q repeat") - - - -- set Priority to be bound to i - Spring.SendCommands({ - "unbindkeyset i", - }) - Spring.SendCommands("bind i priority") - - if Game.version == "85.0" then - Spring.SendCommands({"unbindaction specteam"}) - 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_game_sounds.lua b/LuaUI/Widgets_Evo/snd_game_sounds.lua index 96924d9e2..ff51ede89 100644 --- a/LuaUI/Widgets_Evo/snd_game_sounds.lua +++ b/LuaUI/Widgets_Evo/snd_game_sounds.lua @@ -49,19 +49,19 @@ alarmTimes["position"] = {} local spamBlock = false ---------------------------------------------------------------------------- -local cloak1 = "sounds/cloak.wav" -local decloak1 = "sounds/cloak.wav" -local cloak2 = "sounds/cloak.wav" -local decloak2 = "sounds/cloak.wav" +local cloak1 = "sounds/miscfx/cloak.wav" +local decloak1 = "sounds/miscfx/cloak.wav" +local cloak2 = "sounds/miscfx/cloak.wav" +local decloak2 = "sounds/miscfx/cloak.wav" -local CD1 = "sounds/count1.wav" -local CD2 = "sounds/count2.wav" -local CD3 = "sounds/count3.wav" -local CD4 = "sounds/count4.wav" -local CD5 = "sounds/count5.wav" -local CD6 = "sounds/count6.wav" -local cancel = "sounds/cancel2.wav" -local movefailed = "sounds/cantdo4.wav" +local CD1 = "sounds/selfdcountdown/count1.wav" +local CD2 = "sounds/selfdcountdown/count2.wav" +local CD3 = "sounds/selfdcountdown/count3.wav" +local CD4 = "sounds/selfdcountdown/count4.wav" +local CD5 = "sounds/selfdcountdown/count5.wav" +local CD6 = "sounds/selfdcountdown/count6.wav" +local cancel = "sounds/ui/cancel2.wav" +local movefailed = "sounds/ui/cantdo4.wav" local ADUnits = {} local CMD_SELFD = CMD.SELFD @@ -244,9 +244,9 @@ function widget:UnitDamaged (unitID, unitDefID, unitTeam, damage, paralyzer, wea local snd if isCommander then - snd = 'sounds/warning2.wav' + snd = 'sounds/miscfx/warning2.wav' else - snd = 'sounds/warning1.wav' + snd = 'sounds/miscfx/warning1.wav' end -- ALL units have volume = 1.0 in unitdef. Some units, such as critters and DT:s have no volume, making the widget fail on nil index. -- this was the previous lookup code for volume: udef.sounds.underattack[1].volume diff --git a/LuaUI/Widgets_Evo/snd_music.lua b/LuaUI/Widgets_Evo/snd_music.lua deleted file mode 100644 index 7c8a6ecc6..000000000 --- a/LuaUI/Widgets_Evo/snd_music.lua +++ /dev/null @@ -1,287 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: gui_music.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 based on situation", - author = "cake, trepan, Smoth, Licho, xponen", - date = "Mar 01, 2008, Aug 20 2009, Nov 23 2011", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local unitExceptions = include("Configs/snd_music_exception.lua") - -local windows = {} - -local WAR_THRESHOLD = 5000 -local PEACE_THRESHOLD = 1000 - -local musicType = 'peace' -local dethklok = {} -- keeps track of the number of doods killed in each time frame -local timeframetimer = 0 -local previousTrack = '' -local previousTrackType = '' -local newTrackWait = 1000 -local numVisibleEnemy = 0 -local fadeVol -local curTrack = "no name" -local songText = "no name" - -local warTracks = VFS.DirList('music/war/', '*.ogg') -local peaceTracks = VFS.DirList('music/peace/', '*.ogg') -local victoryTracks = VFS.DirList('music/victory/', '*.ogg') -local defeatTracks = VFS.DirList('music/defeat/', '*.ogg') - -local firstTime = false -local wasPaused = false -local firstFade = true -local initSeed = 0 -local seedInitialized = false -local gameOver = false - -local myTeam = Spring.GetMyTeamID() -local isSpec = Spring.GetSpectatingState() or Spring.IsReplay() -local defeat = false - -options_path = 'Settings/Interface/Pause Screen' - -options = { - pausemusic = {name='Pause Music', type='bool', value=false}, -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:Initialize() - -- Spring.Echo(math.random(), math.random()) - -- Spring.Echo(os.clock()) - - -- for TrackName,TrackDef in pairs(peaceTracks) do - -- Spring.Echo("Track: " .. TrackDef) - -- end - --math.randomseed(os.clock()* 101.01)--lurker wants you to burn in hell rgn - -- for i=1,20 do Spring.Echo(math.random()) end - - for i = 1, 30, 1 do - dethklok[i]=0 - end -end - - -function widget:Shutdown() - Spring.StopSoundStream() - - for i=1,#windows do - (windows[i]):Dispose() - end -end - -local function PlayNewTrack() - Spring.StopSoundStream() - local newTrack = previousTrack - repeat - if musicType == 'peace' then - newTrack = peaceTracks[math.random(1, #peaceTracks)] - elseif musicType == 'war' then - newTrack = warTracks[math.random(1, #warTracks)] - end - until newTrack ~= previousTrack - -- for key, val in pairs(oggInfo) do - -- Spring.Echo(key, val) - -- end - firstFade = false - previousTrack = newTrack - - -- if (oggInfo.comments.TITLE and oggInfo.comments.TITLE) then - -- Spring.Echo("Song changed to: " .. oggInfo.comments.TITLE .. " By: " .. oggInfo.comments.ARTIST) - -- else - -- Spring.Echo("Song changed but unable to get the artist and title info") - -- end - curTrack = newTrack - Spring.PlaySoundStream(newTrack,WG.music_volume or 0.5) - playing = true - - WG.music_start_volume = WG.music_volume -end - -function widget:Update(dt) - if gameOver then - return - end - if (Spring.GetGameSeconds()>=0) then - if not seedInitialized then - math.randomseed(os.clock()* 100) - seedInitialized=true - end - timeframetimer = timeframetimer + dt - if (timeframetimer > 1) then -- every second - timeframetimer = 0 - newTrackWait = newTrackWait + 1 - local PlayerTeam = Spring.GetMyTeamID() - numVisibleEnemy = 0 - local doods = Spring.GetVisibleUnits() - for _, u in ipairs(doods) do - if (Spring.IsUnitAllied(u) ~= true) then - numVisibleEnemy = numVisibleEnemy + 1 - end - end - - totalKilled = 0 - for i = 1, 10, 1 do --calculate the first half of the table (1-15) - totalKilled = totalKilled + (dethklok[i] * 2) - end - - for i = 11, 20, 1 do -- calculate the second half of the table (16-45) - totalKilled = totalKilled + dethklok[i] - end - - for i = 20, 1, -1 do -- shift value(s) to the end of table - dethklok[i+1] = dethklok[i] - end - dethklok[1] = 0 -- empty the first row - - --Spring.Echo (totalKilled) - - if (totalKilled > WAR_THRESHOLD) then - musicType = 'war' - end - - if (totalKilled <= PEACE_THRESHOLD) then - musicType = 'peace' - end - - if (not firstTime) then - PlayNewTrack() - firstTime = true -- pop this cherry - end - - local playedTime, totalTime = Spring.GetSoundStreamTime() - playedTime = math.floor(playedTime) - totalTime = math.floor(totalTime) - --Spring.Echo(playedTime, totalTime) - - --Spring.Echo(playedTime, totalTime, newTrackWait) - - --if((totalTime - playedTime) <= 6 and (totalTime >= 1) ) then - --Spring.Echo("time left:", (totalTime - playedTime)) - --Spring.Echo("volume:", (totalTime - playedTime)/6) - --if ((totalTime - playedTime)/6 >= 0) then - -- Spring.SetSoundStreamVolume((totalTime - playedTime)/6) - --else - -- Spring.SetSoundStreamVolume(0.1) - --end - --elseif(playedTime <= 5 )then--and not firstFade - --Spring.Echo("time playing:", playedTime) - --Spring.Echo("volume:", playedTime/5) - --Spring.SetSoundStreamVolume( playedTime/5) - --end - - if ( (musicType ~= previousTrackType and musicType == 'war') or (playedTime >= totalTime)) then -- both zero means track stopped in 8 - previousTrackType = musicType - PlayNewTrack() - - --Spring.Echo("Track: " .. newTrack) - newTrackWait = 0 - end - end - local _, _, paused = Spring.GetGameSpeed() - if (paused ~= wasPaused) and options.pausemusic.value then - Spring.PauseSoundStream() - wasPaused = paused - end - end -end - -function widget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer) - if unitExceptions[unitDefID] then - return - end - - if (damage < 1.5) then return end - local PlayerTeam = Spring.GetMyTeamID() - - if (UnitDefs[unitDefID] == nil) then return end - - if paralyzer then - return - else - if (teamID == PlayerTeam) then - damage = damage * 1.5 - end - local multifactor = 1 - if (numVisibleEnemy > 3) then - multifactor = math.log(numVisibleEnemy) - end - dethklok[1] = dethklok[1] + (damage * multifactor); - end -end - -function widget:UnitDestroyed(unitID, unitDefID, teamID) - if unitExceptions[unitDefID] then - return - end - local unitWorth = 50 - if (UnitDefs[unitDefID].metalCost > 500) then - unitWorth = 200 - end - if (UnitDefs[unitDefID].metalCost > 1000) then - unitWorth = 300 - end - if (UnitDefs[unitDefID].metalCost > 3000) then - unitWorth = 500 - end - if (UnitDefs[unitDefID].metalCost > 8000) then - unitWorth = 700 - end - if (teamID == PlayerTeam) then - unitWorth = unitWorth * 1.5 - end - local multifactor = 1 - if (numVisibleEnemy > 3) then - multifactor = math.log(numVisibleEnemy) - end - dethklok[1] = dethklok[1] + (unitWorth*multifactor); -end - -function widget:TeamDied(team) - if team == myTeam and not isSpec then - defeat = true - end -end - -function widget:GameOver() - --gameOver = true - local track - -- FIXME: get a better way to detect who won - if not defeat then - if #victoryTracks <= 0 then return end - track = victoryTracks[math.random(1, #victoryTracks)] - else - if #defeatTracks <= 0 then return end - track = defeatTracks[math.random(1, #defeatTracks)] - end - Spring.StopSoundStream() - Spring.PlaySoundStream(track,WG.music_volume or 0.5) - WG.music_start_volume = WG.music_volume -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 298708fee..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, 1.0) - 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({"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 5a984950a..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,9 +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["efighter"].id or unitDefID == UnitDefNames["egunship2"].id or unitDefID == UnitDefNames["escout"].id or unitDefID == UnitDefNames["etransport"].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_armor_icons.lua b/LuaUI/Widgets_Evo/unit_armor_icons.lua new file mode 100644 index 000000000..bcb3195fc --- /dev/null +++ b/LuaUI/Widgets_Evo/unit_armor_icons.lua @@ -0,0 +1,150 @@ + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +function widget:GetInfo() + return { + name = "Armor Icons", + desc = "Adds an armor icon for armored units (needs Unit Icons)", + author = "trepan (idea quantum,jK), CarRepairer tweak, CommonPlayer", + date = "Feb, 2008", + license = "GNU GPL, v2 or later", + layer = 5, + enabled = true -- loaded by default? + } +end + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +-- speed-ups +local GetUnitDefID = Spring.GetUnitDefID +local GetAllUnits = Spring.GetAllUnits + +---------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------- + +local PWUnits = {} + +local myAllyTeamID = 666 + + +local armoredTex = 'luaui/images/armortype/armored.dds' +local dmgTexBase = 'luaui/images/damagetype/' +local dmgTextures = { + ecommanderbattle = dmgTexBase .. 'light.dds', + -- Start h-bots + ehbotpeewee = dmgTexBase .. 'light.dds', + ehbotthud = dmgTexBase .. 'light.dds', + ehbotsniper = dmgTexBase .. 'armor.dds', + ehbotrocko = dmgTexBase .. 'armor.dds', + -- Start Hovers + eartytank = dmgTexBase .. 'building.dds', + elighttank3 = dmgTexBase .. 'light.dds', + eheavytank3 = dmgTexBase .. 'armor.dds', + emissiletank = dmgTexBase .. 'armor.dds', + eriottank2 = dmgTexBase .. 'light.dds', + eriottank2shotgun = dmgTexBase .. 'light.dds', + elacerator = dmgTexBase .. 'building.dds', + -- Start All Terrains + eallterrheavy = dmgTexBase .. 'armor.dds', + eallterrlight = dmgTexBase .. 'light.dds', + eallterrmed = dmgTexBase .. 'armor.dds', + eallterrriot = dmgTexBase .. 'light.dds', + eallterrriotshotgun = dmgTexBase .. 'light.dds', + eallterrassault = dmgTexBase .. 'building.dds', + eallterranarchid = dmgTexBase .. 'building.dds', + eallterranarchidflame = dmgTexBase .. 'building.dds', + -- Start Amphibs + eamphibbuggy = dmgTexBase .. 'light.dds', + eamphibriot = dmgTexBase .. 'light.dds', + eamphibneedle = dmgTexBase .. 'light.dds', + eamphibriotshotgun = dmgTexBase .. 'light.dds', + eamphibmedtank = dmgTexBase .. 'armor.dds', + eamphibrock = dmgTexBase .. 'armor.dds', + eamphibarty = dmgTexBase .. 'building.dds', + eamphibleveler = dmgTexBase .. 'armor.dds', + -- Start Aircraft + edrone = dmgTexBase .. 'light.dds', + efighter = dmgTexBase .. 'light.dds', + egunship2 = dmgTexBase .. 'armor.dds', + ebomber = dmgTexBase .. 'building.dds', + -- Start Buildings + elightturret2 = dmgTexBase .. 'light.dds', + eheavyturret2 = dmgTexBase .. 'armor.dds', +} + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +function PWCreate(unitID) + PWUnits[unitID] = true + SetArmorIcon(unitID) +end + +function widget:Initialize() + + widgetHandler:RegisterGlobal("PWCreate", PWCreate) + + WG.icons.SetOrder( 'dmgtype', 1 ) + WG.icons.SetOrder( 'armor', 2 ) + + for _,unitID in pairs( GetAllUnits() ) do + SetArmorIcon(unitID) + end +end + +function widget:Shutdown() +end + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +function SetArmorIcon(unitID) + local ud = UnitDefs[GetUnitDefID(unitID)] + if (ud == nil) then + return + end + + if ud.customParams.armortype then + armortype = ud.customParams.armortype + if armortype == "armored" then + if not PWUnits[unitID] then + WG.icons.SetUnitIcon( unitID, {name='armor', texture=armoredTex } ) + end + end + end + if ud.weapons and #ud.weapons ~= 0 then + local wd = WeaponDefs[ud.weapons[1].weaponDef] + if wd.customParams ~= nil and wd.customParams.damagetype ~= nil and + dmgTextures[wd.customParams.damagetype] ~= nil then + WG.icons.SetUnitIcon( unitID, {name='dmgtype', texture=dmgTextures[wd.customParams.damagetype] } ) + end + end +end + + + +------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- + +function widget:UnitCreated(unitID, unitDefID, unitTeam) + SetArmorIcon(unitID) +end + + +function widget:UnitDestroyed(unitID, unitDefID, unitTeam) + WG.icons.SetUnitIcon( unitID, {name='armor', texture=nil} ) + PWUnits[unitID] = nil +end + +--needed if icon widget gets disabled/enabled after this one. find a better way? +function widget:GameFrame(f) + if f%(32*5) == 0 then --5 seconds + for _,unitID in pairs( GetAllUnits() ) do + SetArmorIcon(unitID) + end + end +end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/unit_auto_group.lua b/LuaUI/Widgets_Evo/unit_auto_group.lua index 0dccf9ea1..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', @@ -111,11 +102,8 @@ options = { } local finiGroup = {} -local myTeam -local selUnitDefs = {} -local loadGroups = true +local myTeam = Spring.GetMyTeamID() 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 @@ -137,47 +124,94 @@ local GetGameFrame = Spring.GetGameFrame local IsGuiHidden = Spring.IsGUIHidden local Echo = Spring.Echo - function printDebug( value ) - if ( debug ) then Echo( value ) - end - end +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() and (Spring.GetGameFrame() > 0 or gameStarted) then + widgetHandler:RemoveWidget(self) + return + end + myTeam = Spring.GetMyTeamID() +end + +function widget:Initialize() + 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:Initialize() - local _, _, spec, team = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) - if spec then - widgetHandler:RemoveWidget() - return false +function widget:Shutdown() + WG['autogroup'] = nil + if dlists then + for i,_ in ipairs(dlists) do + gl.DeleteList(dlists[i]) + end + dlists = {} end - myTeam = team + gl.DeleteFont(font) end function widget:DrawWorld() -if not IsGuiHidden() then - local existingGroups = GetGroupList() - if options.groupnumbers.value then - for inGroup, _ in pairs(existingGroups) do - 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, 30.0, -10.0, textSize, "cns") - gl.PopMatrix() + if not IsGuiHidden() then + local existingGroups = GetGroupList() + if options.groupnumbers.value then + for inGroup, _ in pairs(existingGroups) do + 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.CallList(dlists[inGroup]) + gl.PopMatrix() + end end end end - else end -end + end end 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 @@ -197,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 @@ -205,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 @@ -221,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 @@ -231,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 @@ -255,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 @@ -308,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 @@ -323,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 --]] @@ -332,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 new file mode 100644 index 000000000..fd720d1f1 --- /dev/null +++ b/LuaUI/Widgets_Evo/unit_automaticFightCommand.lua @@ -0,0 +1,104 @@ +function widget:GetInfo() + return { + name = "Automatic Fight Command", + desc = "Gives select units a fight command after they have been built (because Spring doesn't call unitIdle properly)", + author = "Forby", + date = "Jan 8, 2007", + license = "GNU GPL, v2 or later", + layer = 0, + enabled = true -- loaded by default? + } +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local CMD_FIGHT = CMD.FIGHT +local spGetMyTeamID = Spring.GetMyTeamID +local spGetTeamUnits = Spring.GetTeamUnits +local spGetUnitDefID = Spring.GetUnitDefID +local spGetUnitPosition = Spring.GetUnitPosition +local spGiveOrderToUnit = Spring.GiveOrderToUnit +local spGetSpectatingState = Spring.GetSpectatingState + +local hmsx = Game.mapSizeX/2 +local hmsz = Game.mapSizeZ/2 + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +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] +end + + +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 - 1 + else + x = x + 1 + end + if (z > hmsz) then + z = z - 1 + else + z = z + 1 + end + -- meta enables reclaim enemy units, alt autoresurrect ( if available ) + spGiveOrderToUnit(unitID, CMD_FIGHT, { x, y, z }, {"meta"}) + end +end + +function widget:PlayerChanged() + if spGetSpectatingState() then + widgetHandler:RemoveWidget() + end +end + +function widget:Initialize() + if spGetSpectatingState() then + widgetHandler:RemoveWidget() + end +end + + +function widget:UnitCreated(unitID, unitDefID, unitTeam) + if unitTeam ~= spGetMyTeamID() then + return + end + if IsTargetUnit(UnitDefs[unitDefID]) then + SetupUnit(unitID) + end +end + + +function widget:UnitGiven(unitID, unitDefID, unitTeam) + widget:UnitCreated(unitID, unitDefID, unitTeam) +end \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/unit_customrings.lua b/LuaUI/Widgets_Evo/unit_customrings.lua index 6f5d9a44f..8b8c5f50d 100644 --- a/LuaUI/Widgets_Evo/unit_customrings.lua +++ b/LuaUI/Widgets_Evo/unit_customrings.lua @@ -26,28 +26,86 @@ end local ringsDefs = { [UnitDefNames.ecommander.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 1000 }, - { color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, + -- { 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 = {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 = {0, 0, 1, 0.5}, lineWidth = 5, radius = 500 }, + }, + [UnitDefNames.ecommanderbuild.id] = { + --{ 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 = 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 = 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 = 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.eorb_up1.id] = { + --{ 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.eorb_up2.id] = { + --{ 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 = 1050 }, + }, + [UnitDefNames.eorb_up3.id] = { + --{ 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.ehbotengineer.id] = { + --{ 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 = 1000 }, + --{ color = {0.5, 0, 1, 0.2}, lineWidth = 5, radius = 500 }, + { color = {0,1,0,0.6}, lineWidth = 10, radius = 995 }, + }, + [UnitDefNames.zarm.id] = { { color = {0,1,0,0.6}, lineWidth = 10, radius = 1000 }, }, - [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 }, + + -- Shield Units + [UnitDefNames.ekmar.id] = { + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 750 }, }, - [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.eallterrshield.id] = { + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 300 }, }, - [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.eallterrshield_up1.id] = { + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 300 }, }, - [UnitDefNames.eairengineer.id] = { - { color = {1, 0.5, 0, 0.8}, lineWidth = 2, radius = 600 }, + [UnitDefNames.eallterrshield_up2.id] = { + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 300 }, + }, + [UnitDefNames.eallterrshield_up3.id] = { + { color = {0, 0, 1, 0.5}, lineWidth = 5, radius = 300 }, }, } @@ -73,7 +131,15 @@ function widget:UnitCreated(uId, uDefId) end end -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: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_icons.lua b/LuaUI/Widgets_Evo/unit_icons.lua index db54657b5..3236eb74f 100644 --- a/LuaUI/Widgets_Evo/unit_icons.lua +++ b/LuaUI/Widgets_Evo/unit_icons.lua @@ -43,7 +43,7 @@ options = { iconsize = { name = 'Hovering Icon Size', type = 'number', - value = 30, min=10, max = 40, + value = 15, min=10, max = 40, } } @@ -54,8 +54,8 @@ local unitHeights = {} local iconOrders = {} local iconOrders_order = {} -local iconoffset = 14 - +local iconoffset = 14 -- vertical offset +local iconoffsethorizontal = 28 -- horizontal offset local iconUnitTexture = {} local textureUnitsXshift = {} @@ -206,7 +206,7 @@ end ------------------------------------------------------------------------------------- local function DrawUnitFunc(xshift, yshift) - glTranslate(xshift,yshift,0) + glTranslate(xshift + iconoffsethorizontal,yshift,0) glBillboard() glTexRect(-options.iconsize.value*0.5, -9, options.iconsize.value*0.5, options.iconsize.value-9) end @@ -294,4 +294,4 @@ function widget:Shutdown() end ------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------------------- diff --git a/LuaUI/Widgets_Evo/unit_rank_icons.lua b/LuaUI/Widgets_Evo/unit_rank_icons.lua deleted file mode 100644 index 6fcf4ce07..000000000 --- a/LuaUI/Widgets_Evo/unit_rank_icons.lua +++ /dev/null @@ -1,160 +0,0 @@ -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Rank Icons 2", - desc = "Adds a rank icon depending on experience next to units (needs Unit Icons)", - author = "trepan (idea quantum,jK), CarRepairer tweak", - date = "Feb, 2008", - license = "GNU GPL, v2 or later", - layer = 5, - enabled = true -- loaded by default? - } -end - -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- - --- speed-ups -local GetUnitDefID = Spring.GetUnitDefID -local GetUnitExperience = Spring.GetUnitExperience -local GetAllUnits = Spring.GetAllUnits -local IsUnitAllied = Spring.IsUnitAllied -local GetSpectatingState = Spring.GetSpectatingState - -local min = math.min -local floor = math.floor - ----------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------- - -local PWranks = { [0] = {}, [1] = {}, [2] = {}, [3] = {}, [4] = {} } - -local PWUnits = {} - -local myAllyTeamID = 666 - - -local rankTexBase = 'LuaUI/Images/Ranks/' -local rankTextures = { - [0] = nil, - [1] = rankTexBase .. 'rank1.png', - [2] = rankTexBase .. 'rank2.png', - [3] = rankTexBase .. 'rank3.png', - [4] = rankTexBase .. 'star.png', -} -local PWrankTextures = { - [0] = rankTexBase .. 'PWrank0.png', - [1] = rankTexBase .. 'PWrank1.png', - [2] = rankTexBase .. 'PWrank2.png', - [3] = rankTexBase .. 'PWrank3.png', - [4] = rankTexBase .. 'PWstar.png', -} - -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- - -function PWCreate(unitID) - PWUnits[unitID] = true - SetUnitRank(unitID) -end - -function widget:Initialize() - - widgetHandler:RegisterGlobal("PWCreate", PWCreate) - - WG.icons.SetOrder( 'rank', 1 ) - - for udid, ud in pairs(UnitDefs) do - -- 0.15+2/(1.2+math.exp(Unit.power/1000)) - ud.power_xp_coeffient = ((ud.power / 1000) ^ -0.2) / 6 -- dark magic - end - - for _,unitID in pairs( GetAllUnits() ) do - SetUnitRank(unitID) - end -end - -function widget:Shutdown() -end - -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- - -function SetUnitRank(unitID) - local ud = UnitDefs[GetUnitDefID(unitID)] - if (ud == nil) then - return - end - - local xp = GetUnitExperience(unitID) - if (not xp) then - return - end - xp = min(floor(xp / ud.power_xp_coeffient),4) - - if not PWUnits[unitID] then - if (xp>0) then - WG.icons.SetUnitIcon( unitID, {name='rank', texture=rankTextures[xp] } ) - end - else - PWranks[xp][unitID] = true - end -end - - - -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------- - -function widget:UnitExperience(unitID,unitDefID,unitTeam, xp, oldXP) - local ud = UnitDefs[unitDefID] - if (ud == nil) then - return - end - if xp < 0 then xp = 0 end - if oldXP < 0 then oldXP = 0 end - - local rank = min(floor(xp / ud.power_xp_coeffient),4) - local oldRank = min(floor(oldXP / ud.power_xp_coeffient),4) - - if (rank~=oldRank) then - if not PWUnits[unitID] then - WG.icons.SetUnitIcon( unitID, {name='rank', texture=rankTextures[rank]} ) - else - for i=0,rank-1 do PWranks[i][unitID] = nil end - PWranks[rank][unitID] = true - end - end -end - -function widget:UnitCreated(unitID, unitDefID, unitTeam) - if (IsUnitAllied(unitID)or(GetSpectatingState())) then - SetUnitRank(unitID) - end -end - - -function widget:UnitDestroyed(unitID, unitDefID, unitTeam) - WG.icons.SetUnitIcon( unitID, {name='rank', texture=nil} ) - PWUnits[unitID] = nil -end - - -function widget:UnitGiven(unitID, unitDefID, oldTeam, newTeam) - if (not IsUnitAllied(unitID))and(not GetSpectatingState()) then - WG.icons.SetUnitIcon( unitID, {name='rank', texture=nil} ) - end -end - ---needed if icon widget gets disabled/enabled after this one. find a better way? -function widget:GameFrame(f) - if f%(32*5) == 0 then --5 seconds - for _,unitID in pairs( GetAllUnits() ) do - SetUnitRank(unitID) - end - end -end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file diff --git a/LuaUI/Widgets_Evo/unit_selectionblurryhalo.lua b/LuaUI/Widgets_Evo/unit_selectionblurryhalo.lua deleted file mode 100644 index 8455fffe8..000000000 --- a/LuaUI/Widgets_Evo/unit_selectionblurryhalo.lua +++ /dev/null @@ -1,614 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widget:GetInfo() - return { - name = "Selection BlurryHalo", - desc = "Shows a halo for selected, hovered ally-selected units. (Doesn't work on ati cards!)", - author = "CarRepairer, from jK's gfx_halo", - date = "Jan, 2008", - version = "0.004", - license = "GNU GPL, v2 or later", - layer = -11, - enabled = true -- loaded by default? - } -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local showAlly = false -local visibleAllySelUnits = {} -local visibleSelected = {} -local thickness = 1.0 - -local function UpdateHaloColors(self) end - -options_path = 'Settings/Interface/Selection/Blurry Halo Selections' - -options_order = { - 'showally', - 'useteamcolors', - 'thickness', - - - 'lblPresetColors', - 'selectColor', - 'allySelectColor', - 'myHoverColor', - 'allyHoverColor', - 'enemyHoverColor', - 'featureHoverColor', - - -} - -options = { - showally = { - name = 'Show Ally Selections', - type = 'bool', - desc = 'Highlight the units your allies currently have selected.', - value = true, - OnChange = function(self) - visibleAllySelUnits = {} - showAlly = self.value - end, - }, - useteamcolors = { - name = 'Use Team Colors', - type = 'bool', - desc = 'Highlight your allies\' selections with their team colors instead of the preset colors.', - value = false, - }, - - thickness = { - name = 'Outline Thickness', - desc = 'How thick the outline appears around objects', - type = 'number', - min = 0.4, max = 2, step = 0.01, - value = 0.8, - OnChange = function(self) UpdateHaloColors(); end - }, - ----- - - lblPresetColors = {type='label', name = 'Preset Colors' }, - selectColor = { - name = 'Selected Units Color', - type = 'colors', - value = { 0, 1, 0, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - allySelectColor = { - name = 'Ally Selected Units Color', - type = 'colors', - value = { 1, 1, 0, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - myHoverColor = { - name = 'My Unit Hover Color', - type = 'colors', - value = { 1, 1, 1, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - allyHoverColor = { - name = 'Ally Unit Hover Color', - type = 'colors', - value = { 0.5, 0.5, 1, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - enemyHoverColor = { - name = 'Enemy Unit Hover Color', - type = 'colors', - value = { 1, 0, 0, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - - featureHoverColor = { - name = 'Feature Hover Color', - type = 'colors', - value = { 1, 0, 1, 1 }, - OnChange = function(self) UpdateHaloColors(); end - }, - - - -} - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---// user var - -local gAlpha = 0.8 - ---// app var - -local offscreentex -local outlinemasktex -local blurtex -local fbo - -local blurShader_h -local blurShader_v -local maskGenShader -local maskApplyShader -local uniformScreenX, uniformScreenY -local uniformThicknessX, uniformThicknessY - -local vsx, vsy = 0,0 -local resChanged = false - - ---more -local featureHoverColor = { 1, 0, 1, 1} -local myHoverColor = { 1, 1, 1, 1 } -local allyHoverColor = { 0.5, 0.5, 1, 1 } -local enemyHoverColor = { 1, 0, 0, 1 } -local selectColor = { 0, 1, 0, 1 } -local allySelectColor = { 1, 1, 0, 1 } - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---// gl const - -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 - -local GL_COLOR_ATTACHMENT0_EXT = 0x8CE0 -local GL_COLOR_ATTACHMENT1_EXT = 0x8CE1 -local GL_COLOR_ATTACHMENT2_EXT = 0x8CE2 -local GL_COLOR_ATTACHMENT3_EXT = 0x8CE3 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - ---// speed ups - -local ALL_UNITS = Spring.ALL_UNITS - -local spGetMyTeamID = Spring.GetMyTeamID -local spGetUnitTeam = Spring.GetUnitTeam -local spValidUnitID = Spring.ValidUnitID -local ValidFeatureID = Spring.ValidFeatureID -local spIsUnitAllied = Spring.IsUnitAllied -local spIsUnitSelected = Spring.IsUnitSelected -local spGetMouseState = Spring.GetMouseState -local spTraceScreenRay = Spring.TraceScreenRay -local spGetPlayerControlledUnit = Spring.GetPlayerControlledUnit -local spGetVisibleUnits = Spring.GetVisibleUnits -local spIsUnitIcon = Spring.IsUnitIcon - -local GL_FRONT = GL.FRONT -local GL_BACK = GL.BACK -local GL_MODELVIEW = GL.MODELVIEW -local GL_PROJECTION = GL.PROJECTION -local GL_COLOR_BUFFER_BIT = GL.COLOR_BUFFER_BIT -local GL_DEPTH_BUFFER_BIT = GL.DEPTH_BUFFER_BIT - -local glUnit = gl.Unit -local glFeature = gl.Feature -local glCopyToTexture = gl.CopyToTexture -local glRenderToTexture = gl.RenderToTexture -local glCallList = gl.CallList -local glActiveFBO = gl.ActiveFBO - -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 glCulling = gl.Culling -local glDepthTest = gl.DepthTest - -local glResetMatrices = gl.ResetMatrices -local glMatrixMode = gl.MatrixMode -local glPushMatrix = gl.PushMatrix -local glLoadIdentity = gl.LoadIdentity -local glPopMatrix = gl.PopMatrix -local glBlending = gl.Blending - -local echo = Spring.Echo - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- ---functions - -UpdateHaloColors = function(self) - selectColor = options.selectColor.value - allySelectColor = options.allySelectColor.value - myHoverColor = options.myHoverColor.value - - allyHoverColor = options.allyHoverColor.value - enemyHoverColor = options.enemyHoverColor.value - featureHoverColor = options.featureHoverColor.value - - thickness = options.thickness.value -end - -local function GetVisibleUnits() - local units = spGetVisibleUnits(-1, 30, false) - - local visibleAllySelUnits = {} - local visibleSelected = {} - - for i=1, #units do - local unitID = units[i] - if (spIsUnitSelected(unitID)) then - visibleSelected[#visibleSelected+1] = unitID - elseif showAlly and WG.allySelUnits and WG.allySelUnits[unitID] then - visibleAllySelUnits[#visibleAllySelUnits+1] = unitID - end - end - - return visibleAllySelUnits, visibleSelected - -end - - -local function DrawHaloFunc() - visibleAllySelUnits, visibleSelected = GetVisibleUnits() - - glColor(selectColor) - for i=1,#visibleSelected do - local unitID = visibleSelected[i] - glUnit(unitID,true,-1) - end - - if not options.useteamcolors.value then glColor(allySelectColor) end - for i=1,#visibleAllySelUnits do - local unitID = visibleAllySelUnits[i] - if options.useteamcolors.value then - local teamID = spGetUnitTeam(unitID) - if teamID then - local r, g, b = Spring.GetTeamColor(teamID); - glColor(r, g, b, allySelectColor[4]) - else - glColor(allySelectColor) - end - end - glUnit(unitID,true,-1) - end - - local mx, my = spGetMouseState() - local pointedType, data = spTraceScreenRay(mx, my) - if pointedType == 'unit' and spValidUnitID(data) then -- and not spIsUnitIcon(data) then - local teamID = spGetUnitTeam(data) - if teamID == spGetMyTeamID() then - glColor(myHoverColor) - elseif (teamID and Spring.AreTeamsAllied(teamID, Spring.GetMyTeamID()) ) then - glColor(allyHoverColor) - else - glColor(enemyHoverColor) - end - - glUnit(data, true,-1) - elseif (pointedType == 'feature') and ValidFeatureID(data) then - glColor(featureHoverColor) - glFeature(data, true) - end - -end - -local DrawVisibleUnits - -DrawVisibleUnits = DrawHaloFunc - -local MyDrawVisibleUnits = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - DrawVisibleUnits() - glColor(1,1,1,1) -end -local maskGen = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - glUseShader(maskGenShader) - glTexRect(-1-0.25/vsx,1+0.25/vsy,1+0.25/vsx,-1-0.25/vsy) -end -local blur_h = function() - glClear(GL_COLOR_BUFFER_BIT,0,0,0,0) - glUseShader(blurShader_h) - glUniform(uniformThicknessX, thickness) - glTexRect(-1-0.25/vsx,1+0.25/vsy,1+0.25/vsx,-1-0.25/vsy) -end -local blur_v = function() - glUseShader(blurShader_v) - glUniform(uniformThicknessY, thickness) - glTexRect(-1-0.25/vsx,1+0.25/vsy,1+0.25/vsx,-1-0.25/vsy) -end - -function widget:DrawWorldPreUnit() - if Spring.IsGUIHidden() then - return - end - - glBlending(true) - - if (resChanged) then - resChanged = false - if (vsx==1) or (vsy==1) then return end - glUseShader(blurShader_h) - glUniformInt(uniformScreenX, vsx ) - glUseShader(blurShader_v) - glUniformInt(uniformScreenY, vsy ) - end - - glDepthTest(false) - glActiveFBO(fbo,MyDrawVisibleUnits) - - glTexture(offscreentex) - glRenderToTexture(outlinemasktex, maskGen) - glRenderToTexture(blurtex, blur_h) - glTexture(blurtex) - glRenderToTexture(offscreentex, blur_v) - - glBlending(false) -end - -function widget:DrawScreenEffects() - if Spring.IsGUIHidden() then - return - end - glBlending(true) - - glColor(1,1,1,gAlpha) - - glCallList(enter2d) - glTexture(0, offscreentex) - glTexture(1, outlinemasktex) - glUseShader(maskApplyShader) - glTexRect(-1-0.25/vsx,1+0.25/vsy,1+0.25/vsx,-1-0.25/vsy) --this line breaks mearth labels - glCallList(leave2d) - glBlending(false) -end - - -local function ShowSelectionSquares(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 - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- ---call ins - -function widget:Initialize() - showAlly = options.showally.value - - if (not gl.CreateShader)or(not gl.CreateFBO) then - Spring.Echo("Halo widget: your card is unsupported!") - widgetHandler:RemoveWidget() - return - end - - vsx, vsy = widgetHandler:GetViewSizes() - - maskGenShader = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - - void main(void) { - vec4 color = texture2D(tex0, gl_TexCoord[0].st); - gl_FragColor = vec4(1.0 - ((color.r + color.g + color.b) * 255.0)); - } - ]], - uniformInt = { - tex0 = 0, - }, - }) - - if (maskGenShader == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "Halo selection widget: mask generation shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - blurShader_h = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - uniform int screenX; - uniform float thickness; - - void main(void) { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - gl_FragColor = vec4(0.0); - - float pixelsize = thickness/float(screenX); - gl_FragColor += 0.6 * texture2D(tex0, vec2(texCoord.s + 2.0*pixelsize,texCoord.t) ); - gl_FragColor += 0.7 * texture2D(tex0, vec2(texCoord.s + pixelsize,texCoord.t) ); - - gl_FragColor += texture2D(tex0, texCoord ); - - gl_FragColor += 0.7 * texture2D(tex0, vec2(texCoord.s - 1.0*pixelsize,texCoord.t) ); - gl_FragColor += 0.6 * texture2D(tex0, vec2(texCoord.s - 2.0*pixelsize,texCoord.t) ); - - gl_FragColor.rgb /= max(max(gl_FragColor.r, gl_FragColor.g), max(gl_FragColor.b, 1.0)); - } - ]], - uniformInt = { - tex0 = 0, - screenX = vsx, - }, - uniformFloat = { - thickness = 1.0, - }, - }) - - - if (blurShader_h == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "Halo selection widget: hblur shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - blurShader_v = gl.CreateShader({ - fragment = [[ uniform sampler2D tex0; - uniform int screenY; - uniform float thickness; - - void main(void) { - vec2 texCoord = vec2(gl_TextureMatrix[0] * gl_TexCoord[0]); - gl_FragColor = vec4(0.0); - - float pixelsize = thickness/float(screenY); - gl_FragColor += 0.6 * texture2D(tex0, vec2(texCoord.s,texCoord.t + 2.0*pixelsize) ); - gl_FragColor += 0.7 * texture2D(tex0, vec2(texCoord.s,texCoord.t + pixelsize) ); - - gl_FragColor += texture2D(tex0, texCoord ); - - gl_FragColor += 0.7 * texture2D(tex0, vec2(texCoord.s,texCoord.t - 1.0*pixelsize) ); - gl_FragColor += 0.6 * texture2D(tex0, vec2(texCoord.s,texCoord.t - 2.0*pixelsize) ); - - gl_FragColor.rgb /= max(max(gl_FragColor.r, gl_FragColor.g), max(gl_FragColor.b, 1.0)); - } - ]], - uniformInt = { - tex0 = 0, - screenY = vsy, - }, - uniformFloat = { - thickness = 1.0, - }, - }) - - if (blurShader_v == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "Halo selection widget: vblur shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - maskApplyShader = gl.CreateShader({ - fragment = [[ - uniform sampler2D tex0; - uniform sampler2D tex1; - - void main(void) { - gl_FragColor = texture2D(tex0, gl_TexCoord[0].st) * texture2D(tex1, gl_TexCoord[0].st); - } - ]], - uniformInt = { - tex0 = 0, - tex1 = 1, - }, - }) - - if (maskApplyShader == nil) then - Spring.Log(widget:GetInfo().name, LOG.ERROR, "Halo selection widget: mask application shader error: "..gl.GetShaderLog()) - widgetHandler:RemoveWidget() - return false - end - - uniformScreenX = gl.GetUniformLocation(blurShader_h, 'screenX') - uniformScreenY = gl.GetUniformLocation(blurShader_v, 'screenY') - uniformThicknessX = gl.GetUniformLocation(blurShader_h, 'thickness') - uniformThicknessY = gl.GetUniformLocation(blurShader_v, 'thickness') - - fbo = gl.CreateFBO() - - self:ViewResize(vsx,vsy) - - 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(0, false) - glTexture(1, false) - glUseShader(0) - end) - - - ShowSelectionSquares(false) -end --init - -function widget:ViewResize(viewSizeX, viewSizeY) - vsx = viewSizeX - vsy = viewSizeY - - fbo.color0 = nil - - gl.DeleteTextureFBO(offscreentex or 0) - gl.DeleteTextureFBO(blurtex or 0) - gl.DeleteTextureFBO(outlinemasktex or 0) - - 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, - }) - - outlinemasktex = gl.CreateTexture(vsx,vsy, { - border = false, - min_filter = GL.LINEAR, - mag_filter = GL.LINEAR, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - blurtex = gl.CreateTexture(math.floor(vsx*0.5),math.floor(vsy*0.5), { - border = false, - min_filter = GL.LINEAR, - mag_filter = GL.LINEAR, - wrap_s = GL.CLAMP, - wrap_t = GL.CLAMP, - fbo = true, - }) - - fbo.color0 = offscreentex - fbo.drawbuffers = GL_COLOR_ATTACHMENT0_EXT - - resChanged = true -end - - -function widget:Shutdown() - if (gl.DeleteTextureFBO) then - gl.DeleteTextureFBO(offscreentex) - gl.DeleteTextureFBO(blurtex) - gl.DeleteTextureFBO(outlinemasktex) - end - - if (gl.DeleteFBO) then - gl.DeleteFBO(fbo or 0) - end - - if (gl.DeleteShader) then - gl.DeleteShader(maskGenShader or 0) - gl.DeleteShader(blurShader_h or 0) - gl.DeleteShader(blurShader_v or 0) - gl.DeleteShader(maskApplyShader or 0) - end - - gl.DeleteList(enter2d) - gl.DeleteList(leave2d) - - ShowSelectionSquares(true) -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 9da4d6fab..420832f16 100644 --- a/LuaUI/Widgets_Evo/unit_smart_select.lua +++ b/LuaUI/Widgets_Evo/unit_smart_select.lua @@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- -- file: unit_smart_select.lua --- version: 1.3 +-- version: 1.36 -- brief: Selects units as you drag over them and provides selection modifier hotkeys -- original author: Ryan Hileman (aegis) -- @@ -15,11 +15,11 @@ function widget:GetInfo() return { name = "SmartSelect", - desc = "Selects units as you drag over them and provides selection modifier hotkeys", + desc = "Selects units as you drag over them. (SHIFT: select all, Z: same type, SPACE: new idle units, CTRL: invert selection) /selectionmode toggles filtering buildings in selection", author = "aegis", date = "Jan 2, 2011", license = "Public Domain", - layer = 0, + layer = -99999999999, enabled = true } end @@ -30,15 +30,20 @@ end -- whether to select buildings when mobile units are inside selection rectangle local selectBuildingsWithMobile = false +local includeNanosAsMobile = true + +local includeBuilders = true -- only select new units identical to those already selected local sameSelectKey = 'z' +-- only select new idle units +local idleSelectKey = 'space' + ----------------------------------------------------------------- -- manually generated locals because I don't have trepan's script ----------------------------------------------------------------- local GetTimer = Spring.GetTimer -local DiffTimers = Spring.DiffTimers local GetMouseState = Spring.GetMouseState local GetModKeyState = Spring.GetModKeyState local GetKeyState = Spring.GetKeyState @@ -55,14 +60,15 @@ local GetSelectedUnits = Spring.GetSelectedUnits local GetUnitsInRectangle = Spring.GetUnitsInRectangle local SelectUnitArray = Spring.SelectUnitArray local GetActiveCommand = Spring.GetActiveCommand +local GetUnitTeam = Spring.GetUnitTeam local GetGroundHeight = Spring.GetGroundHeight local GetMiniMapGeometry = Spring.GetMiniMapGeometry -local GetMiniMapDualScreen = Spring.GetMiniMapDualScreen local IsAboveMiniMap = Spring.IsAboveMiniMap local GetUnitDefID = Spring.GetUnitDefID local GetUnitPosition = Spring.GetUnitPosition +local GetCommandQueue = Spring.GetCommandQueue local UnitDefs = UnitDefs local min = math.min @@ -74,11 +80,15 @@ local glLineWidth = gl.LineWidth local glDepthTest = gl.DepthTest local glBeginEnd = gl.BeginEnd local GL_LINE_STRIP = GL.LINE_STRIP + +local GaiaTeamID = Spring.GetGaiaTeamID() + ----------------------------------------------------------------- -- end function locals ------------------------------------------ ----------------------------------------------------------------- sameSelectKey = Spring.GetKeyCode(sameSelectKey) +idleSelectKey = Spring.GetKeyCode(idleSelectKey) local minimapOnLeft = (Spring.GetMiniMapDualScreen() == "left") local combatFilter, builderFilter, buildingFilter, mobileFilter @@ -92,9 +102,8 @@ local minimapRect local lastCoords local lastMeta +local filtered -local lastUpdate = GetTimer() -local spectating = false local myPlayerID local function sort(v1, v2) @@ -105,14 +114,6 @@ local function sort(v1, v2) end end -local function GetUnitsInArbitraryRectangle(x1, z1, x2, z2, team) - x1, x2 = sort(x1, x2) - z1, z2 = sort(z1, z2) - - local units = GetUnitsInRectangle(x1, z1, x2, z2, team) - return units -end - local mapWidth, mapHeight = Game.mapSizeX, Game.mapSizeZ local function MinimapToWorldCoords(x, y) @@ -161,17 +162,38 @@ 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 lastSelection = nil + filtered = false if (IsAboveMiniMap(x, y)) then referenceCoords = {0, 0, 0} @@ -185,20 +207,50 @@ function widget:MousePress(x, y, button) end end -function widget:Update() - --[[ - local newUpdate = GetTimer() - if (DiffTimers(newUpdate, lastUpdate) < 0.1) then - return +function widget:TextCommand(command) + if (string.find(command, "selectionmode") == 1 and string.len(command) == 13) then + selectBuildingsWithMobile = not selectBuildingsWithMobile + if selectBuildingsWithMobile then + Spring.Echo("SmartSelect: Selects whatever comes under selection rectangle.") + else + Spring.Echo("SmartSelect: Ignores buildings if it can select mobile units.") + end end - lastUpdate = newUpdate - --]] + if (string.find(command, "selectionnanos") == 1 and string.len(command) == 14) then + includeNanosAsMobile = not includeNanosAsMobile + init() + if includeNanosAsMobile then + Spring.Echo("SmartSelect: Treats nanos like mobile units and wont exclude them") + else + Spring.Echo("SmartSelect: Stops treating nanos as if they are mobile units") + end + end +end + +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.includeBuilders ~= nil then includeBuilders = data.includeBuilders end +end + +function widget:Update() + 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 @@ -206,7 +258,8 @@ function widget:Update() end 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 @@ -221,20 +274,48 @@ 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)) - mouseSelection = GetUnitsInMinimapRectangle(r[1], r[2], x, y, team) + mouseSelection = GetUnitsInMinimapRectangle(r[1], r[2], x, y, nil) else local d = referenceCoords local x1, y1 = WorldToScreenCoords(d[1], d[2], d[3]) - mouseSelection = GetUnitsInScreenRectangle(x, y, x1, y1, team) + mouseSelection = GetUnitsInScreenRectangle(x, y, x1, y1, nil) + end + originalMouseSelection = mouseSelection + + + -- filter gaia units + local filteredselection = {} + 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 - + filteredselection = nil + local newSelection = {} local uid, udid, udef, tmp + if (idleSelect) then + tmp = {} + for i=1, #mouseSelection do + uid = mouseSelection[i] + udid = GetUnitDefID(uid) + if (mobileFilter[udid] or builderFilter[udid]) and (GetCommandQueue(uid, 0) == 0) then + tmp[#tmp+1] = uid + end + end + mouseSelection = tmp + end + if (sameSelect) and (#referenceSelection > 0) then -- only select new units identical to those already selected tmp = {} @@ -248,6 +329,7 @@ function widget:Update() mouseSelection = tmp end + if (alt) then -- only select mobile combat units @@ -286,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 @@ -301,6 +391,7 @@ function widget:Update() newSelection = referenceSelection end + if (ctrl) then -- deselect units inside the selection rectangle, if we already had units selected local negative = {} @@ -320,53 +411,56 @@ function widget:Update() newSelection = tmp SelectUnitArray(newSelection) elseif (shift) then - --Spring.Echo('shift') -- append units inside selection rectangle to current selection SelectUnitArray(newSelection) SelectUnitArray(mouseSelection, true) elseif (#mouseSelection > 0) then -- select units inside selection rectangle SelectUnitArray(mouseSelection) - elseif (alt == false) then + elseif (#originalMouseSelection > 0) and (#mouseSelection == 0) then + SelectUnitArray({}) + else -- keep current selection while dragging until more things are selected SelectUnitArray(referenceSelection) 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 -function widget:Initialize() +function init() myPlayerID = GetMyPlayerID() combatFilter = {} builderFilter = {} buildingFilter = {} mobileFilter = {} - + for udid, udef in pairs(UnitDefs) do - local mobile = (udef.canMove and udef.speed > 0.000001) + 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.isBuilder and udef.buildSpeed > 0) or + --(udef.builder and udef.buildSpeed > 0) or -- udef.builder = deprecated it seems (udef.canResurrect and udef.resurrectSpeed > 0) or (udef.canRepair and udef.repairSpeed > 0) local building = (mobile == false) local combat = (builder == false) and (mobile == true) and (#udef.weapons > 0) - + combatFilter[udid] = combat builderFilter[udid] = builder buildingFilter[udid] = building @@ -374,6 +468,29 @@ function widget:Initialize() end end +function widget:Shutdown() + WG['smartselect'] = nil +end + +function widget:Initialize() + + WG['smartselect'] = {} + 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 + local function DrawRectangle(r) local x1, y1, x2, y2 = r[1], r[2], r[3], r[4] glVertex(r[1], 0, r[2]) @@ -383,12 +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/Widgets_Evo/unit_transport_ai.lua b/LuaUI/Widgets_Evo/unit_transport_ai.lua deleted file mode 100644 index 75d388d78..000000000 --- a/LuaUI/Widgets_Evo/unit_transport_ai.lua +++ /dev/null @@ -1,641 +0,0 @@ --- $Id: unit_transport_ai.lua 4460 2009-04-20 20:36:16Z licho $ -include("keysym.h.lua") - -function widget:GetInfo() - return { - name = "Transport AI", - desc = "Automatically transports units going to factory waypoint.\n" .. - "Adds embark=call for transport and disembark=unload from transport command", - author = "Licho", - date = "1.11.2007", - license = "GNU GPL, v2 or later", - layer = 0, - enabled = true - } -end - - -local CONST_IGNORE_BUILDERS = false -- should automated factory transport ignore builders? -local CONST_HEIGHT_MULTIPLIER = 3 -- how many times to multiply height difference when evaluating distance -local CONST_TRANSPORT_PICKUPTIME = 9 -- how long (in seconds) does transport land and takeoff with unit -local CONST_PRIORITY_BENEFIT = 10000 -- how much more important are priority transfers -local CONST_BENEFIT_LIMIT = 5 -- what is the lowest benefit treshold to use transport (in sec difference with transport against without it) -local CONST_TRANSPORT_STOPDISTANCE = 150 -- how close by has transport be to stop the unit -local CONST_UNLOAD_RADIUS = 200 -- how big is the radious for unload command for factory transports - -local idleTransports = {} -- list of idle transports key = id, value = {defid} -local waitingUnits = {} -- list of units waiting for traqnsport - key = unitID, {unit state, unitDef, factory} -local priorityUnits = {} -- lists of priority units waiting for key= unitId, value = state -local toPick = {} -- list of units waiting to be picked - key = transportID, value = {id, stoppedState} -local toPickRev = {} -- list of units waiting to be picked - key = unitID, value=transportID -local storedQueue = {} -- unit keyed stored queues -local hackIdle ={} -- temp field to overcome unitIdle problem - - -local ST_ROUTE = 1 -- unit is enroute from factory -local ST_PRIORITY = 2 -- unit is in need of priority transport -local ST_STOPPED = 3 -- unit is enroute from factory but stopped - - -local timer = 0 -local myTeamID - - -local GetUnitPosition = Spring.GetUnitPosition -local GetUnitDefID = Spring.GetUnitDefID -local Echo = Spring.Echo -local GetPlayerInfo = Spring.GetPlayerInfo -local GetCommandQueue = Spring.GetCommandQueue -local GetUnitSeparation = Spring.GetUnitSeparation -local GiveOrderToUnit = Spring.GiveOrderToUnit -local GetUnitDefDimensions = Spring.GetUnitDefDimensions -local GetTeamUnits = Spring.GetTeamUnits -local GetSelectedUnits = Spring.GetSelectedUnits -local GetUnitIsTransporting = Spring.GetUnitIsTransporting -local GetGroundHeight = Spring.GetGroundHeight - -local function IgBuilderChanged() - CONST_IGNORE_BUILDERS = options.ignoreBuilders.value -end - -options_path = 'Game/Settings' -options = { - ignoreBuilders = { - name = "Transport AI: Ignore Builders", - type = "bool", - value = false, - desc = "Do not pick up builders.", - OnChange = IgBuilderChanged, - }, -} - -function IsTransport(unitDefID) - ud = UnitDefs[unitDefID] - return (ud ~= nil and (ud.transportCapacity >= 1) and ud.canFly) -end - -function IsTransportable(unitDefID) - ud = UnitDefs[unitDefID] - if (ud == nil) then return false end - udc = ud.springCategories - return (udc~= nil and ud.speed > 0 and not ud.canFly) -end - - -function IsEmbarkCommand(unitID) - local queue = GetCommandQueue(unitID); - if (queue ~= nil and #queue>=1 and IsEmbark(queue[1])) then - return true - end - return false -end - -function IsEmbark(cmd) - if (cmd.id == CMD.WAIT and cmd.options.alt and not cmd.options.ctrl) then - return true - end - return false -end - -function IsDisembark(cmd) - if (cmd.id == CMD.WAIT and cmd.options.alt and cmd.options.ctrl) then - return true - end - return false -end - -function IsWaitCommand(unitID) - local queue = GetCommandQueue(unitID); - if (queue ~= nil and queue[1].id == CMD.WAIT and not queue[1].options.alt) then - return true - end - return false -end - -function IsIdle(unitID) - local queue = GetCommandQueue(unitID) - if (queue == nil or #queue==0) then - return true - else - return false - end -end - -function GetToPickTransport(unitID) - local x = toPickRev[unitID] - if x~= nil then - return x - else - return 0 - end -end - -function GetToPickUnit(transportID) - local x = toPick[transportID] - if (x~=nil) then - if x[1] ~= nil then - return x[1] - else - return 0 - end - end - return 0 -end - -function DeleteToPickTran(transportID) - local tr = toPick[transportID] - if (tr ~= nil) then - local uid = tr[1] - if (uid ~= nil) then - toPickRev[uid]=nil - end - end - toPick[transportID] = nil -end - -function DeleteToPickUnit(unitID) - local tr = toPickRev[unitID] - if (tr~=nil) then - toPick[tr] = nil - end - toPickRev[unitID] = nil -end - -function AddToPick(transportID, unitID, stopped, fact) - toPick[transportID] = {unitID, stopped, fact} - toPickRev[unitID] = transportID -end - - - -function widget:Initialize() - local _, _, spec, teamID = GetPlayerInfo(Spring.GetMyPlayerID()) - if spec then - widgetHandler:RemoveWidget() - return false - end - myTeamID = teamID - widgetHandler:RegisterGlobal('taiEmbark', taiEmbark) - - - for _, unitID in ipairs(GetTeamUnits(teamID)) do -- init existing transports - if AddTransport(unitID, GetUnitDefID(unitID)) then - AssignTransports(unitID, 0) - end - end -end - -function widget:Shutdown() - widgetHandler:DeregisterGlobal('taiEmbark') -end - - -function widget:UnitTaken(unitID, unitDefID, oldTeamID, teamID) - if teamID == myTeamID then - if AddTransport(unitID, unitDefID) then - AssignTransports(unitID, 0) - end - end -end - ---[[function widget:UnitCreated(unitID, unitDefID, teamID) - if teamID == myTeamID then - if AddTransport(unitID, unitDefID) then - AssignTransports(unitID, 0) - end - end -end]]-- - -function widget:UnitDestroyed(unitID, unitDefID, teamID) - if teamID == myTeamID then --- Echo("unit destroyed " ..unitID) - idleTransports[unitID] = nil - priorityUnits[unitID] = nil - local tuid = GetToPickUnit(unitID) - if (tuid ~= 0) then -- transport which was about to pick something was destroyed - local state = toPick[unitID][2] - local fact = toPick[unitID][3] - if (state == ST_PRIORITY) then - waitingUnits[tuid] = {ST_PRIORITY, GetUnitDefID(tuid)} - else - waitingUnits[tuid] = {ST_ROUTE, GetUnitDefID(tuid), fact} - if (state == ST_STOPPED) then - GiveOrderToUnit(tuid, CMD.WAIT, {}, {}) - end - end - DeleteToPickTran(unitID) - AssignTransports(0, tuid) - else -- unit which was about to be picked was destroyed - pom = GetToPickTransport(unitID) - if (pom~=0) then - DeleteToPickUnit(unitID) - GiveOrderToUnit(pom, CMD.STOP, {}, {}) - end -- delete form toPick list - end - end -end - -function widget:UnitGiven(unitID, unitDefID, newTeamID, teamID) - widget:UnitDestroyed(unitID, unitDefID, teamID) -end - - -function AddTransport(unitID, unitDefID) - if (IsTransport(unitDefID)) then -- and IsIdle(unitID) - idleTransports[unitID] = unitDefID - --Echo ("transport added " .. unitID) - return true - end - return false -end - - -function widget:UnitIdle(unitID, unitDefID, teamID) - if teamID ~= myTeamID then return end - if WG.FerryUnits and WG.FerryUnits[unitID] then return end - if (hackIdle[unitID] ~= nil) then - hackIdle[unitID] = nil - return - end - if (AddTransport(unitID, unitDefID)) then - AssignTransports(unitID, 0) - else - if (IsTransportable(unitDefID)) then - priorityUnits[unitID] = nil - - local marked = GetToPickTransport(unitID) - if (waitingUnits[unitID] ~= nil) then -- unit was waiting for transport and now its suddenly idle (stopped) - delete it --- Echo("waiting unit idle "..unitID) - waitingUnits[unitID] = nil - end - - if (marked ~= 0) then --- Echo("to pick unit idle "..unitID) - DeleteToPickTran(marked) - GiveOrderToUnit(marked, CMD.STOP, {}, {}) -- and stop it (when it becomes idle it will be assigned) - end - end - end -end - - - - -function widget:UnitFromFactory(unitID, unitDefID, unitTeam, factID, factDefID, userOrders) - if unitTeam == myTeamID then - local ud = UnitDefs[unitDefID] - if (CONST_IGNORE_BUILDERS and ud.isBuilder and ud.canAssist) then return end - if (IsTransportable(unitDefID) and not userOrders) then --- Echo ("new unit from factory "..unitID) - - for _,v in ipairs(GetCommandQueue(unitID)) do - if (IsEmbark(v)) then - priorityUnits[unitID] = unitDefID - return - end - end - - waitingUnits[unitID] = {ST_ROUTE, unitDefID, factID} - AssignTransports(0, unitID) - end - end -end - - -function widget:CommandNotify(id, params, options) - local sel = nil - if (not options.shift) then - sel = GetSelectedUnits() - for _, uid in ipairs(sel) do - widget:UnitDestroyed(uid, GetUnitDefID(uid), myTeamID) - end - end - - if (id == CMD.WAIT and options.alt) then - if (sel == nil) then sel = GetSelectedUnits() end - for _, uid in ipairs(sel) do - priorityUnits[uid] = GetUnitDefID(uid) - end - end - - return false -end - - -function widget:Update(deltaTime) - timer = timer + deltaTime - if (timer < 1) then return end - StopCloseUnits() - - local todel = {} - for i, d in pairs(priorityUnits) do --- Echo ("checking prio " ..i) - if (IsEmbarkCommand(i)) then --- Echo ("prio called " ..i) - waitingUnits[i] = {ST_PRIORITY, d} - AssignTransports(0, i) - table.insert(todel, i) - end - end - for _, x in ipairs(todel) do - priorityUnits[x] = nil - end - - timer = 0 -end - - -function StopCloseUnits() -- stops dune units which are close to transport - for transportID, val in pairs(toPick) do - local unitID = val[1] - local state = val[2] - if (state == ST_ROUTE) then - local dist = GetUnitSeparation(transportID, unitID, true) - if (dist ~= nil and dist < CONST_TRANSPORT_STOPDISTANCE) then - local canStop = true - if (val[3] ~= nil) then - local fd = GetUnitDefID(val[3]) - local ud = GetUnitDefID(unitID) - if (fd ~= nil and ud ~= nil) then - local fd = GetUnitDefDimensions(fd) - local ud = GetUnitDefDimensions(ud) - if (fd ~= nil and ud ~= nil) then - if (GetUnitSeparation(unitID, val[3], true) < fd.radius + ud.radius) then --- Echo ("Cant stop - too close to factory") - canStop = false - end - end - end - end - if canStop then - if not IsWaitCommand(unitID) then GiveOrderToUnit(unitID, CMD.WAIT, {},{}) end - toPick[transportID][2] = ST_STOPPED - end - end - end - end -end - - -function widget:UnitLoaded(unitID, unitDefID, teamID, transportID) - if (teamID ~= myTeamID or toPick[transportID]==nil) then return end - - local queue = GetCommandQueue(unitID); - if (queue == nil) then return end - --- Echo("unit loaded " .. transportID .. " " ..unitID) - local torev = {} - local vl = nil - - local ender = false - - storedQueue[unitID] = {} - DeleteToPickTran(transportID) - hackIdle[transportID] = true - local cnt = 0 - for k, v in ipairs(queue) do - if (not v.options.internal) then - if ((v.id == CMD.MOVE or (v.id==CMD.WAIT) or v.id == CMD.SET_WANTED_MAX_SPEED) and not ender) then - cnt = cnt +1 - if (v.id == CMD.MOVE) then - GiveOrderToUnit(transportID, CMD.MOVE, v.params, {"shift"}) - table.insert(torev, {v.params[1], v.params[2], v.params[3]+20}) - vl = v.params - end - if (IsDisembark(v)) then - ender = true - end - else - if (not ender) then - ender = true - end - if (v.ID ~= CMD.WAIT) then - local opts = {} - table.insert(opts, "shift") -- appending - if (v.options.alt) then table.insert(opts, "alt") end - if (v.options.ctrl) then table.insert(opts, "ctrl") end - if (v.options.right) then table.insert(opts, "right") end - table.insert(storedQueue[unitID], {v.id, v.params, opts}) - end - end - end - end - - GiveOrderToUnit(unitID, CMD.STOP, {}, {}) - - if (vl ~= nil) then - GiveOrderToUnit(transportID, CMD.UNLOAD_UNITS, {vl[1], vl[2], vl[3], CONST_UNLOAD_RADIUS}, {"shift"}) - - local i = #torev - while (i > 0) do - GiveOrderToUnit(transportID, CMD.MOVE, torev[i], {"shift"}) - i = i -1 - end - - local x,y,z = GetUnitPosition(transportID) - GiveOrderToUnit(transportID, CMD.MOVE, {x,y,z}, {"shift"}) - end - -end - - -function widget:UnitUnloaded(unitID, unitDefID, teamID, transportID) - if (teamID ~= myTeamID or storedQueue[unitID] == nil) then return end - GiveOrderToUnit(unitID, CMD.STOP, {}, {}) - for _, x in ipairs(storedQueue[unitID]) do - GiveOrderToUnit(unitID, x[1], x[2], x[3]) - end - storedQueue[unitID] = nil - local queue = GetCommandQueue(unitID) - if (queue and queue[1] and queue[1].id == CMD.WAIT) then GiveOrderToUnit(unitID, CMD.WAIT, {}, {}) end -- workaround: clears wait order if STOP fails to do so -end - - -function CanTransport(transportID, unitID) - local udef = GetUnitDefID(unitID) - local tdef = GetUnitDefID(transportID) - - if (not udef or not tdef) then return false end - if (UnitDefs[udef].xsize > UnitDefs[tdef].transportSize * 2) then -- unit size check --- Echo ("size failed") - return false - end - - local trans = GetUnitIsTransporting(transportID) -- capacity check - if (UnitDefs[tdef].transportCapacity <= #trans) then --- Echo ("count failed") - return false - end - - - local mass = 0 -- mass check - for _,a in ipairs(trans) do - mass = mass + UnitDefs[GetUnitDefID(a)].mass - end - if (mass > UnitDefs[tdef].transportMass) then --- Echo ("mass failed") - return false - end - return true -end - - -function AssignTransports(transportID, unitID) - local best = {} --- Echo ("assigning " .. transportID .. " " ..unitID) - if (transportID~=0) then - local transpeed = UnitDefs[GetUnitDefID(transportID)].speed - for id, val in pairs(waitingUnits) do - if CanTransport(transportID, id) then - local unitspeed = UnitDefs[val[2]].speed - - local ud = GetPathLength(id) - local td = GetUnitSeparation(id, transportID, true) - - local ttime = (td + ud) / transpeed + CONST_TRANSPORT_PICKUPTIME - local utime = (ud) / unitspeed - local benefit = utime-ttime - if (val[1]==ST_PRIORITY) then - benefit = benefit + CONST_PRIORITY_BENEFIT - end - -- Echo (" "..transportID .. " " .. id .. " " .. benefit) - - if (benefit > CONST_BENEFIT_LIMIT) then table.insert(best, {benefit, transportID, id}) end - end - end - elseif (unitID ~=0) then - local unitspeed = UnitDefs[GetUnitDefID(unitID)].speed - local state = waitingUnits[unitID][1] - local ud = GetPathLength(unitID) - for id, def in pairs(idleTransports) do - if CanTransport(id, unitID) then - local transpeed = UnitDefs[def].speed - local td = GetUnitSeparation(unitID, id, true) - - local ttime = (td + ud) / transpeed + CONST_TRANSPORT_PICKUPTIME - local utime = (ud) / unitspeed - local benefit = utime-ttime - if (state==ST_PRIORITY) then - benefit = benefit + CONST_PRIORITY_BENEFIT - end - --- Echo (" "..id.. " " .. unitID .. " " .. benefit) - - if (benefit > CONST_BENEFIT_LIMIT) then table.insert(best, {benefit, id, unitID}) end - end - end - end - - table.sort(best, function(a,b) return a[1]>b[1] end) - local i = 1 - local it = #best - local used = {} - while i <= it do - local tid = best[i][2] - local uid = best[i][3] - i = i +1 - if (used[tid]==nil and used[uid]==nil) then - used[tid] = 1 - used[uid] = 1 --- Echo ("ordering " .. tid .. " " .. uid ) - - if (waitingUnits[uid][1] == ST_PRIORITY) then - AddToPick(tid, uid, ST_PRIORITY) - else - AddToPick(tid, uid, ST_ROUTE, waitingUnits[uid][3]) - end - waitingUnits[uid] = nil - idleTransports[tid] = nil - GiveOrderToUnit(tid, CMD.LOAD_UNITS, {uid}, {}) - end - end -end - - - -function Dist(x,y,z, x2, y2, z2) - local xd = x2-x - local yd = y2-y - local zd = z2-z - return math.sqrt(xd*xd + yd*yd + zd*zd) -end - - -function GetPathLength(unitID) - local mini = math.huge - local maxi = -math.huge - local px,py,pz= GetUnitPosition(unitID) - - local h = GetGroundHeight(px,pz) - if (h < mini) then mini = h end - if (h > maxi) then maxi = h end - - local d = 0 - local queue = GetCommandQueue(unitID); - if (queue == nil) then return 0 end - for k, v in ipairs(queue) do - if (v.id == CMD.MOVE or v.id==CMD.WAIT) then - if (v.id == CMD.MOVE) then - d = d + Dist(px,py, pz, v.params[1], v.params[2], v.params[3]) - px = v.params[1] - py = v.params[2] - pz = v.params[3] - local h = GetGroundHeight(px,pz) - if (h < mini) then mini = h end - if (h > maxi) then maxi = h end - end - else - break - end - end - - d = d + (maxi - mini) * CONST_HEIGHT_MULTIPLIER - return d -end - - ---[[ -function widget:KeyPress(key, modifier, isRepeat) - if (key == KEYSYMS.Q and not modifier.ctrl) then - if (not modifier.alt) then - local opts = {"alt"} - if (modifier.shift) then table.insert(opts, "shift") end - - for _, id in ipairs(GetSelectedUnits()) do -- embark - local def = GetUnitDefID(id) - if (IsTransportable(def) or UnitDefs[def].isFactory) then - GiveOrderToUnit(id, CMD.WAIT, {}, opts) - if (not UnitDefs[def].isFactory) then priorityUnits[id] = def end - end - end - else - local opts = {"alt", "ctrl"} - if (modifier.shift) then table.insert(opts, "shift") end - for _, id in ipairs(GetSelectedUnits()) do --disembark - local def = GetUnitDefID(id) - if (IsTransportable(def) or UnitDefs[def].isFactory) then GiveOrderToUnit(id, CMD.WAIT, {}, opts) end - end - - end - end -end ]]-- - - - -function taiEmbark(unitID, teamID, embark, shift) -- called by gadget - if (teamID ~= myTeamID) then return end - - if (not shift) then - widget:UnitDestroyed(unitID, GetUnitDefID(unitID), myTeamID) - end - - - if (embark) then - local def = GetUnitDefID(unitID) - local ud = UnitDefs[def] - if (ud ~= nil and not ud.isFactory) then - priorityUnits[unitID] = def - end - end -end - diff --git a/LuaUI/camain.lua b/LuaUI/camain.lua deleted file mode 100644 index 59134360a..000000000 --- a/LuaUI/camain.lua +++ /dev/null @@ -1,174 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: main.lua --- brief: the entry point from gui.lua, relays call-ins to the widget manager --- author: Dave Rodgers --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- --- 0.75b2 compatibilty --- -if (Spring.GetTeamColor == nil) then - local getTeamInfo = Spring.GetTeamInfo - Spring.GetTeamColor = function(teamID) - local _,_,_,_,_,_,r,g,b,a = getTeamInfo(teamID) - return r, g, b, a - end - Spring.GetTeamInfo = function(teamID) - local id, leader, active, isDead, isAi, side, - r, g, b, a, allyTeam = getTeamInfo(teamID) - return id, leader, active, isDead, isAi, side, allyTeam - end -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -Spring.SendCommands({"ctrlpanel " .. LUAUI_DIRNAME .. "ctrlpanel.txt"}) - -VFS.Include(LUAUI_DIRNAME .. 'utils.lua', utilFile) - -include("setupdefs.lua") -include("savetable.lua") - -include("debug.lua") -include("modfonts.lua") -include("layout.lua") -- contains a simple LayoutButtons() -include("cawidgets.lua") -- the widget handler - --------------------------------------------------------------------------------- --- --- print the header --- - -if (RestartCount == nil) then - RestartCount = 0 -else - RestartCount = RestartCount + 1 -end - -do - local restartStr = "" - if (RestartCount > 0) then - restartStr = " (" .. RestartCount .. " Restarts)" - end - Spring.SendCommands({"echo " .. LUAUI_VERSION .. restartStr}) -end - - --------------------------------------------------------------------------------- - -local gl = Spring.Draw -- easier to use - - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- --- A few helper functions --- - -function Say(msg) - Spring.SendCommands({'say ' .. msg}) -end - - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- --- Update() -- called every frame --- - -activePage = 0 - -forceLayout = true - - -function Update() - local currentPage = Spring.GetActivePage() - if (forceLayout or (currentPage ~= activePage)) then - Spring.ForceLayoutUpdate() -- for the page number indicator - forceLayout = false - end - activePage = currentPage - - fontHandler.Update() - - widgetHandler:Update() - - return -end - - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --- --- WidgetHandler fixed calls --- - -function Shutdown() - return widgetHandler:Shutdown() -end - -function ConfigureLayout(command) - return widgetHandler:ConfigureLayout(command) -end - -function CommandNotify(id, params, options) - return widgetHandler:CommandNotify(id, params, options) -end - -function DrawScreen(vsx, vsy) - return widgetHandler:DrawScreen() -end - -function KeyPress(key, mods, isRepeat) - return widgetHandler:KeyPress(key, mods, isRepeat) -end - -function KeyRelease(key, mods) - return widgetHandler:KeyRelease(key, mods) -end - -function MouseMove(x, y, dx, dy, button) - return widgetHandler:MouseMove(x, y, dx, dy, button) -end - -function MousePress(x, y, button) - return widgetHandler:MousePress(x, y, button) -end - -function MouseRelease(x, y, button) - return widgetHandler:MouseRelease(x, y, button) -end - -function IsAbove(x, y) - return widgetHandler:IsAbove(x, y) -end - -function GetTooltip(x, y) - return widgetHandler:GetTooltip(x, y) -end - -function AddConsoleLine(msg, priority) - return widgetHandler:AddConsoleLine(msg, priority) -end - -function GroupChanged(groupID) - return widgetHandler:GroupChanged(groupID) -end - - --- --- The unit (and some of the Draw) call-ins are handled --- differently (see LuaUI/widgets.lua / UpdateCallIns()) --- - - --------------------------------------------------------------------------------- - diff --git a/LuaUI/cawidgets.lua b/LuaUI/cawidgets.lua deleted file mode 100644 index ad8509f59..000000000 --- a/LuaUI/cawidgets.lua +++ /dev/null @@ -1,2112 +0,0 @@ --- $Id: cawidgets.lua 4261 2009-03-31 16:34:36Z licho $ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: widgets.lua --- brief: the widget manager, a call-in router --- author: Dave Rodgers --- --- modified by jK and quantum --- --- Copyright (C) 2007,2008,2009. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - --- stable release? -local isStable = false -local resetWidgetDetailLevel = false -- has widget detail level changed - -local ORDER_VERSION = 8 --- change this to reset enabled/disabled widgets -local DATA_VERSION = 9 -- change this to reset widget settings - -function includeZIPFirst(filename, envTable) - if (string.find(filename, '.h.lua', 1, true)) then - filename = 'Headers/' .. filename - end - return VFS.Include(LUAUI_DIRNAME .. filename, envTable, VFS.ZIP_FIRST) -end - - -include("keysym.h.lua") -include("utils.lua") -includeZIPFirst("system.lua") -includeZIPFirst("cache.lua") --contain cached override for Spring.GetVisibleUnit (performance optimization). All overrides that are placed here have global reach -include("callins.lua") -include("savetable.lua") -include("utility_two.lua") --contain file backup function -local myName, transmitMagic, voiceMagic, transmitLobbyMagic, MessageProcessor = include("chat_preprocess.lua") -- contain stuff that preprocess chat message for Chili Chat widgets - -local modShortUpper = Game.modShortName:upper() -local ORDER_FILENAME = LUAUI_DIRNAME .. 'Config/' .. modShortUpper .. '_order.lua' -local CONFIG_FILENAME = LUAUI_DIRNAME .. 'Config/' .. modShortUpper .. '_data.lua' -local WIDGET_DIRNAME = LUAUI_DIRNAME .. 'Widgets_Evo/' - -local HANDLER_BASENAME = "cawidgets.lua" -local SELECTOR_BASENAME = 'selector.lua' - -do - local isMission = Game.modDesc:find("Mission Mutator") - if isMission then -- all missions will be forced to use a specific name - if not VFS.FileExists(ORDER_FILENAME) or not VFS.FileExists(CONFIG_FILENAME) then - ORDER_FILENAME = LUAUI_DIRNAME .. 'Config/evo_order.lua' --use "evo" name when running any mission mod (provided that there's no existing config file) - CONFIG_FILENAME = LUAUI_DIRNAME .. 'Config/evo_data.lua' - end - end -end - -local SAFEWRAP = 1 --- 0: disabled --- 1: enabled, but can be overriden by widget.GetInfo().unsafe --- 2: always enabled - -local SAFEDRAW = false -- requires SAFEWRAP to work -local glPopAttrib = gl.PopAttrib -local glPushAttrib = gl.PushAttrib -local pairs = pairs -local ipairs = ipairs - -do -- create backup for evo_data.lua and evo_order.lua to workaround against case of file corruption when OS crash - local fileToCheck = {ORDER_FILENAME,CONFIG_FILENAME} - local extraText = {'-- Widget Order List (0 disables a widget)', '-- Widget Custom Data'} --this is a header text that is appended to start of file - for i=1, #fileToCheck do - CheckLUAFileAndBackup(fileToCheck[i], extraText[i]) - end -end - --- read local widgets config -local localWidgetsFirst = false -local localWidgets = false - -if VFS.FileExists(CONFIG_FILENAME) then --check config file whether user want to use localWidgetsFirst - local cadata = VFS.Include(CONFIG_FILENAME) - if cadata and cadata["Local Widgets Config"] then - localWidgetsFirst = cadata["Local Widgets Config"].localWidgetsFirst - localWidgets = cadata["Local Widgets Config"].localWidgets - end -end - -local VFSMODE -VFSMODE = localWidgetsFirst and VFS.RAW_FIRST -VFSMODE = VFSMODE or localWidgets and VFS.ZIP_FIRST -VFSMODE = VFSMODE or VFS.ZIP - -local detailLevel = Spring.GetConfigInt("widgetDetailLevel", 3) - --------------------------------------------------------------------------------- - --- install bindings for TweakMode and the Widget Selector - -Spring.SendCommands({ - "unbindkeyset Any+f11", - "unbindkeyset Ctrl+f11", - "bind f11 luaui selector", - "bind C+f11 luaui tweakgui", - "echo LuaUI: bound F11 to the widget selector", - "echo LuaUI: bound CTRL+F11 to tweak mode" -}) - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- the widgetHandler object --- - -widgetHandler = { - - widgets = {}, - - configData = {}, - orderList = {}, - - knownWidgets = {}, - knownCount = 0, - knownChanged = true, - - commands = {}, - customCommands = {}, - inCommandsChanged = false, - - autoModWidgets = false, - - actionHandler = include("actions.lua"), - - WG = {}, -- shared table for widgets - - globals = {}, -- global vars/funcs - - mouseOwner = nil, - ownedButton = 0, - - tweakMode = false, -} - - --- these call-ins are set to 'nil' if not used --- they are setup in UpdateCallIns() -local flexCallIns = { - 'GameOver', - 'GamePaused', - 'GameFrame', - 'GameSetup', - 'TeamDied', - 'TeamChanged', - 'PlayerAdded', - 'PlayerChanged', - "PlayerRemoved", - 'ShockFront', - 'WorldTooltip', - 'MapDrawCmd', - 'DefaultCommand', - 'UnitCreated', - 'UnitFinished', - 'UnitFromFactory', - 'UnitDestroyed', - 'UnitExperience', - 'UnitTaken', - 'UnitGiven', - 'UnitIdle', - 'UnitCommand', - 'UnitCmdDone', - 'UnitDamaged', - 'UnitEnteredRadar', - 'UnitEnteredLos', - 'UnitLeftRadar', - 'UnitLeftLos', - 'UnitEnteredWater', - 'UnitEnteredAir', - 'UnitLeftWater', - 'UnitLeftAir', - 'UnitSeismicPing', - 'UnitLoaded', - 'UnitUnloaded', - 'UnitCloaked', - 'UnitDecloaked', - 'UnitMoveFailed', - 'RecvLuaMsg', - 'StockpileChanged', - 'DrawGenesis', - 'DrawWorld', - 'DrawWorldPreUnit', - 'DrawWorldShadow', - 'DrawWorldReflection', - 'DrawWorldRefraction', - 'DrawScreenEffects', - 'DrawInMiniMap', - 'RecvSkirmishAIMessage', - 'SelectionChanged', - 'AddTransmitLine', - 'AddConsoleMessage', - 'VoiceCommand', -} -local flexCallInMap = {} -for _,ci in ipairs(flexCallIns) do - flexCallInMap[ci] = true -end - -local callInLists = { - 'GamePreload', - 'GameStart', - 'Shutdown', - 'Update', - 'TextCommand', - 'CommandNotify', - 'AddConsoleLine', - 'ViewResize', - 'DrawScreen', - 'KeyPress', - 'KeyRelease', - 'MousePress', - 'MouseWheel', - 'JoyAxis', - 'JoyHat', - 'JoyButtonDown', - 'JoyButtonUp', - 'IsAbove', - 'GetTooltip', - 'GroupChanged', - 'CommandsChanged', - 'TweakMousePress', - 'TweakMouseWheel', - 'TweakIsAbove', - 'TweakGetTooltip', - 'GameProgress', - 'UnsyncedHeightMapUpdate', --- these use mouseOwner instead of lists --- 'MouseMove', --- 'MouseRelease', --- 'TweakKeyPress', --- 'TweakKeyRelease', --- 'TweakMouseMove', --- 'TweakMouseRelease', - --- uses the DrawScreenList --- 'TweakDrawScreen', -} - --- append the flex call-ins -for _,uci in ipairs(flexCallIns) do - table.insert(callInLists, uci) -end - - --- initialize the call-in lists -do - for _,listname in ipairs(callInLists) do - widgetHandler[listname..'List'] = {} - end -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Reverse integer iterator for drawing --- - -local function rev_iter(t, key) - if (key <= 1) then - return nil - else - local nkey = key - 1 - return nkey, t[nkey] - end -end - -local function ripairs(t) - return rev_iter, t, (1 + #t) -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- helper functions ----include chat preprocess here - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -function widgetHandler:LoadOrderList() - local chunk, err = loadfile(ORDER_FILENAME) - if (chunk == nil) then - self.orderList = {} -- safety - return {} - else - local tmp = {} - setfenv(chunk, tmp) - self.orderList = chunk() - if (not self.orderList) then - self.orderList = {} -- safety - end - if (self.orderList.version or 0) < ORDER_VERSION then - self.orderList = {} - self.orderList.version = ORDER_VERSION - end - local detailLevel = Spring.GetConfigInt("widgetDetailLevel", 2) - if (self.orderList.lastWidgetDetailLevel ~= detailLevel) then - resetWidgetDetailLevel = true - self.orderList.lastWidgetDetailLevel = detailLevel - end - end -end - - -function widgetHandler:SaveOrderList() - -- update the current order - for i,w in ipairs(self.widgets) do - self.orderList[w.whInfo.name] = i - end - table.save(self.orderList, ORDER_FILENAME, - '-- Widget Order List (0 disables a widget)') -end - - --------------------------------------------------------------------------------- - -function widgetHandler:LoadConfigData() - local chunk, err = loadfile(CONFIG_FILENAME) - if (chunk == nil) then - return {} - else - local tmp = {} - setfenv(chunk, tmp) - self.configData = chunk() - if (not self.configData) then - self.configData = {} -- safety - end - if (self.configData.version or 0) < DATA_VERSION then - self.configData = {} - self.configData.version = DATA_VERSION - end - - end -end - - -function widgetHandler:SaveConfigData() - resetWidgetDetailLevel = false - self:LoadConfigData() - for _,w in ipairs(self.widgets) do - if (w.GetConfigData) then - local ok, err = pcall(function() - self.configData[w.whInfo.name] = w:GetConfigData() - end) - if not ok then Spring.Log(HANDLER_BASENAME, LOG.ERROR, "Failed to GetConfigData from: " .. w.whInfo.name.." ("..err..")") end - end - end - table.save(self.configData, CONFIG_FILENAME, '-- Widget Custom Data') -end - - -function widgetHandler:SendConfigData() - self:LoadConfigData() - for _,w in ipairs(self.widgets) do - local data = self.configData[w.whInfo.name] - if (w.SetConfigData and data) then - w:SetConfigData(data) - end - end -end - - --------------------------------------------------------------------------------- - -function widgetHandler:Initialize() - if Game.modVersion:find("stable",1,true) then - isStable = true - end - - self:LoadOrderList() - self:LoadConfigData() - - local autoModWidgets = Spring.GetConfigInt('LuaAutoModWidgets', 1) - self.autoModWidgets = (autoModWidgets ~= 0) - - -- create the "LuaUI/Config" directory - Spring.CreateDir(LUAUI_DIRNAME .. 'Config') - - local unsortedWidgets = {} - - -- stuff the widgets into unsortedWidgets - local widgetFiles = VFS.DirList(WIDGET_DIRNAME, "*.lua", VFSMODE) - for k,wf in ipairs(widgetFiles) do - local widget = self:LoadWidget(wf) - if (widget) then - table.insert(unsortedWidgets, widget) - end - end - - -- sort the widgets - table.sort(unsortedWidgets, function(w1, w2) - local l1 = w1.whInfo.layer - local l2 = w2.whInfo.layer - if (l1 ~= l2) then - return (l1 < l2) - end - local n1 = w1.whInfo.name - local n2 = w2.whInfo.name - local o1 = self.orderList[n1] - local o2 = self.orderList[n2] - if (o1 ~= o2) then - return (o1 < o2) - else - return (n1 < n2) - end - end) - - -- first add the api widgets - for _,w in ipairs(unsortedWidgets) do - if (w.whInfo.api) then - widgetHandler:InsertWidget(w) - - local name = w.whInfo.name - local basename = w.whInfo.basename - Spring.Echo(string.format("Loaded API widget: %-18s <%s>", name, basename)) - end - end - - -- add the widgets - for _,w in ipairs(unsortedWidgets) do - if (not w.whInfo.api) then - widgetHandler:InsertWidget(w) - - local name = w.whInfo.name - local basename = w.whInfo.basename - Spring.Echo(string.format("Loaded widget: %-18s <%s>", name, basename)) - end - end - - -- save the active widgets, and their ordering - self:SaveOrderList() - self:SaveConfigData() -end - - -function widgetHandler:LoadWidget(filename, _VFSMODE) - _VFSMODE = _VFSMODE or VFSMODE - local basename = Basename(filename) - local text = VFS.LoadFile(filename, _VFSMODE) - - if (text == nil) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (missing file: ' .. filename ..')') - return nil - end - local chunk, err = loadstring(text, filename) - if (chunk == nil) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') - return nil - end - - local widget = widgetHandler:NewWidget() - setfenv(chunk, widget) - local success, err = pcall(chunk) - if (not success) then - Spring.Echo('Failed to load: ' .. basename .. ' (' .. err .. ')') - return nil - end - if (err == false) then - return nil -- widget asked for a silent death - end - - -- raw access to widgetHandler - if (widget.GetInfo and widget:GetInfo().handler) then - widget.widgetHandler = self - end - - self:FinalizeWidget(widget, filename, basename) - local name = widget.whInfo.name - if (basename == SELECTOR_BASENAME) then - self.orderList[name] = 1 -- always enabled - end - - err = self:ValidateWidget(widget) - if (err) then - Spring.Echo('Failed to load: ' .. basename .. ' (' .. err .. ')') - return nil - end - - local knownInfo = self.knownWidgets[name] - if (knownInfo) then - if (knownInfo.active) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (duplicate name)') - return nil - end - else - -- create a knownInfo table - knownInfo = {} - knownInfo.desc = widget.whInfo.desc - knownInfo.author = widget.whInfo.author - knownInfo.basename = widget.whInfo.basename - knownInfo.filename = widget.whInfo.filename - knownInfo.alwaysStart = widget.whInfo.alwaysStart - knownInfo.fromZip = true - if (_VFSMODE ~= VFS.ZIP) then - if (_VFSMODE == VFS.RAW_FIRST) then - knownInfo.fromZip = not VFS.FileExists(filename,VFS.RAW_ONLY) - else - knownInfo.fromZip = VFS.FileExists(filename,VFS.ZIP_ONLY) - end - end - self.knownWidgets[name] = knownInfo - self.knownCount = self.knownCount + 1 - self.knownChanged = true - end - knownInfo.active = true - - if (widget.GetInfo == nil) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Failed to load: ' .. basename .. ' (no GetInfo() call)') - return nil - end - - local info = widget:GetInfo() - local order = self.orderList[name] - - local enabled = ((order ~= nil) and (order > 0)) or - ((order == nil) and -- unknown widget - (info.enabled and ((not knownInfo.fromZip) or self.autoModWidgets))) or info.alwaysStart - - -- experimental widget, disabled by default in stable - if info.experimental and isStable then - enabled = false - end - - if resetWidgetDetailLevel and info.detailsDefault ~= nil then - if type(info.detailsDefault) == "table" then - enabled = info.detailsDefault[detailLevel] and true - elseif type(info.detailsDefault) == "number" then - enabled = detailLevel >= info.detailsDefault - elseif tonumber(info.detailsDefault) then - enabled = detailLevel >= tonumber(info.detailsDefault) - end - end - - if (enabled) then - -- this will be an active widget - if (order == nil) then - self.orderList[name] = 12345 -- back of the pack - else - self.orderList[name] = order - end - else - self.orderList[name] = 0 - self.knownWidgets[name].active = false - return nil - end - - -- load the config data - local config = self.configData[name] - if (widget.SetConfigData and config) then - widget:SetConfigData(config) - end - - return widget -end - - -function widgetHandler:NewWidget() - local widget = {} - if (true) then - -- copy the system calls into the widget table - for k,v in pairs(System) do - widget[k] = v - end - else - -- use metatable redirection - setmetatable(widget, { - __index = System, - __metatable = true, - }) - end - widget.WG = self.WG -- the shared table - widget.widget = widget -- easy self referencing - - -- wrapped calls (closures) - widget.widgetHandler = {} - local wh = widget.widgetHandler - local self = self - widget.include = function (f) return include(f, widget) end - wh.ForceLayout = function (_) self:ForceLayout() end - wh.RaiseWidget = function (_) self:RaiseWidget(widget) end - wh.LowerWidget = function (_) self:LowerWidget(widget) end - wh.RemoveWidget = function (_) self:RemoveWidget(widget) end - wh.GetCommands = function (_) return self.commands end - wh.InTweakMode = function (_) return self.tweakMode end - wh.GetViewSizes = function (_) return self:GetViewSizes() end - wh.GetHourTimer = function (_) return self:GetHourTimer() end - wh.IsMouseOwner = function (_) return (self.mouseOwner == widget) end - wh.DisownMouse = function (_) - if (self.mouseOwner == widget) then - self.mouseOwner = nil - end - end - - wh.isStable = function (_) return self:isStable() end - - wh.UpdateCallIn = function (_, name) - self:UpdateWidgetCallIn(name, widget) - end - wh.RemoveCallIn = function (_, name) - self:RemoveWidgetCallIn(name, widget) - end - - wh.AddAction = function (_, cmd, func, data, types) - return self.actionHandler:AddAction(widget, cmd, func, data, types) - end - wh.RemoveAction = function (_, cmd, types) - return self.actionHandler:RemoveAction(widget, cmd, types) - end - - wh.AddLayoutCommand = function (_, cmd) - if (self.inCommandsChanged) then - table.insert(self.customCommands, cmd) - else - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "AddLayoutCommand() can only be used in CommandsChanged()") - end - end - - wh.RegisterGlobal = function(_, name, value) - return self:RegisterGlobal(widget, name, value) - end - wh.DeregisterGlobal = function(_, name) - return self:DeregisterGlobal(widget, name) - end - wh.SetGlobal = function(_, name, value) - return self:SetGlobal(widget, name, value) - end - - wh.ConfigLayoutHandler = function(_, d) self:ConfigLayoutHandler(d) end - - ---- - widget.ProcessConsoleBuffer = function(_,_, num) -- FIXME: probably not the least hacky way to make ProcessConsoleBuffer accessible to widgets - return MessageProcessor:ProcessConsoleBuffer(num) - end - ---- - - return widget -end - - -function widgetHandler:FinalizeWidget(widget, filename, basename) - local wi - - if (widget.GetInfo == nil) then - wi = {} - wi.filename = filename - wi.basename = basename - wi.name = basename - wi.layer = 0 - else - local info = widget:GetInfo() - wi = info - wi.filename = filename - wi.basename = basename - wi.name = wi.name or basename - wi.layer = wi.layer or 0 - wi.desc = wi.desc or "" - wi.author = wi.author or "" - wi.license = wi.license or "" - wi.enabled = wi.enabled or false - wi.api = wi.api or false - - -- exprimental widget - -- change name for separate settings and disable by default - if info.experimental and isStable then - wi.name = wi.name .. " (experimental)" - wi.enabled = false - end - - end - - widget.whInfo = {} -- a proxy table - local mt = { - __index = wi, - __newindex = function() error("whInfo tables are read-only") end, - __metatable = "protected" - } - setmetatable(widget.whInfo, mt) -end - - -function widgetHandler:ValidateWidget(widget) - if (widget.GetTooltip and not widget.IsAbove) then - return "Widget has GetTooltip() but not IsAbove()" - end - if (widget.TweakGetTooltip and not widget.TweakIsAbove) then - return "Widget has TweakGetTooltip() but not TweakIsAbove()" - end - return nil -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -local function HandleError(widget, funcName, status, ...) - if (status) then - return ... - end - - if (funcName ~= 'Shutdown') then - widgetHandler:RemoveWidget(widget) - else - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Error in Shutdown()') - end - local name = widget.whInfo.name - local error_message = select(1,...) - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Error in ' .. funcName ..'(): ' .. tostring(error_message)) - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Removed widget: ' .. name) - return nil -end - -local function SafeWrapFuncNoGL(func, funcName) - return function(w, ...) - return HandleError(w, funcName, pcall(func, w, ...)) - end -end - -local function SafeWrapFuncGL(func, funcName) - local wh = widgetHandler - - return function(w, ...) - - glPushAttrib(GL.ALL_ATTRIB_BITS) - local r = { pcall(func, w, ...) } - glPopAttrib() - - if (r[1]) then - table.remove(r, 1) - return unpack(r) - else - if (funcName ~= 'Shutdown') then - widgetHandler:RemoveWidget(w) - else - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Error in Shutdown()') - end - local name = w.whInfo.name - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Error in ' .. funcName ..'(): ' .. tostring(r[2])) - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'Removed widget: ' .. name) - return nil - end - end -end - - -local function SafeWrapFunc(func, funcName) - if (not SAFEDRAW) then - return SafeWrapFuncNoGL(func, funcName) - else - if (string.sub(funcName, 1, 4) ~= 'Draw') then - return SafeWrapFuncNoGL(func, funcName) - else - return SafeWrapFuncGL(func, funcName) - end - end -end - - -local function SafeWrapWidget(widget) - if (SAFEWRAP <= 0) then - return - elseif (SAFEWRAP == 1) then - if (widget.GetInfo and widget.GetInfo().unsafe) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'LuaUI: loaded unsafe widget: ' .. widget.whInfo.name) - return - end - end - - for _,ciName in ipairs(callInLists) do - if (widget[ciName]) then - widget[ciName] = SafeWrapFunc(widget[ciName], ciName) - end - if (widget.Initialize) then - widget.Initialize = SafeWrapFunc(widget.Initialize, 'Initialize') - end - end -end - - --------------------------------------------------------------------------------- - -local function ArrayInsert(t, f, w) - if (f) then - local layer = w.whInfo.layer - local index = 1 - for i,v in ipairs(t) do - if (v == w) then - return -- already in the table - end - if (layer >= v.whInfo.layer) then - index = i + 1 - end - end - table.insert(t, index, w) - end -end - - -local function ArrayRemove(t, w) - for k,v in ipairs(t) do - if (v == w) then - table.remove(t, k) - -- break - end - end -end - - -function widgetHandler:InsertWidget(widget) - if (widget == nil) then - return - end - - SafeWrapWidget(widget) - - ArrayInsert(self.widgets, true, widget) - for _,listname in ipairs(callInLists) do - local func = widget[listname] - if (type(func) == 'function') then - ArrayInsert(self[listname..'List'], func, widget) - end - end - self:UpdateCallIns() - - if (widget.Initialize) then - widget:Initialize() - end -end - - -function widgetHandler:RemoveWidget(widget) - if (widget == nil) then - return - end - - local name = widget.whInfo.name - if (widget.GetConfigData) then - local ok, err = pcall(function() - self.configData[name] = widget:GetConfigData() - end) - if not ok then Spring.Log(HANDLER_BASENAME, LOG.ERROR, "Failed to GetConfigData: " .. name.." ("..err..")") end - end - self.knownWidgets[name].active = false - if (widget.Shutdown) then - widget:Shutdown() - end - ArrayRemove(self.widgets, widget) - self:RemoveWidgetGlobals(widget) - self.actionHandler:RemoveWidgetActions(widget) - for _,listname in ipairs(callInLists) do - ArrayRemove(self[listname..'List'], widget) - end - self:UpdateCallIns() -end - - --------------------------------------------------------------------------------- - -function widgetHandler:UpdateCallIn(name) - local listName = name .. 'List' - if ((name == 'Update') or - (name == 'DrawScreen')) then - return - end - - if ((#self[listName] > 0) or - (not flexCallInMap[name]) or - ((name == 'GotChatMsg') and actionHandler.HaveChatAction()) or - ((name == 'RecvFromSynced') and actionHandler.HaveSyncAction())) then - -- always assign these call-ins - local selffunc = self[name] - _G[name] = function(...) - return selffunc(self, ...) - end - else - _G[name] = nil - end - Script.UpdateCallIn(name) -end - - -function widgetHandler:UpdateWidgetCallIn(name, w) - local listName = name .. 'List' - local ciList = self[listName] - if (ciList) then - local func = w[name] - if (type(func) == 'function') then - ArrayInsert(ciList, func, w) - else - ArrayRemove(ciList, w) - end - self:UpdateCallIn(name) - else - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'UpdateWidgetCallIn: bad name: ' .. name) - end -end - - -function widgetHandler:RemoveWidgetCallIn(name, w) - local listName = name .. 'List' - local ciList = self[listName] - if (ciList) then - ArrayRemove(ciList, w) - self:UpdateCallIn(name) - else - Spring.Log(HANDLER_BASENAME, LOG.ERROR, 'RemoveWidgetCallIn: bad name: ' .. name) - end -end - - -function widgetHandler:UpdateCallIns() - for _,name in ipairs(callInLists) do - self:UpdateCallIn(name) - end -end - - --------------------------------------------------------------------------------- - -function widgetHandler:EnableWidget(name) - local ki = self.knownWidgets[name] - if (not ki) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "EnableWidget(), could not find widget: " .. tostring(name)) - return false - end - if (not ki.active) then - Spring.Echo('Loading: '..ki.filename) - local order = widgetHandler.orderList[name] - if (not order or (order <= 0)) then - self.orderList[name] = 1 - end - local w = self:LoadWidget(ki.filename) - if (not w) then return false end - self:InsertWidget(w) - self:SaveOrderList() - end - return true -end - - -function widgetHandler:DisableWidget(name) - local ki = self.knownWidgets[name] - if (not ki) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "DisableWidget(), could not find widget: " .. tostring(name)) - return false - end - if (ki.active) then - local w = self:FindWidget(name) - if (not w) then return false end - Spring.Echo('Removed: '..ki.filename) - self:RemoveWidget(w) -- deactivate - self.orderList[name] = 0 -- disable - self:SaveOrderList() - end - return true -end - - -function widgetHandler:ToggleWidget(name) - local ki = self.knownWidgets[name] - if (not ki) then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "ToggleWidget(), could not find widget: " .. tostring(name)) - return - end - if (ki.active) then - return self:DisableWidget(name) - elseif (self.orderList[name] <= 0) then - return self:EnableWidget(name) - else - -- the widget is not active, but enabled; disable it - self.orderList[name] = 0 - self:SaveOrderList() - end - return true -end - - --------------------------------------------------------------------------------- - -local function FindWidgetIndex(t, w) - for k,v in ipairs(t) do - if (v == w) then - return k - end - end - return nil -end - - -local function FindLowestIndex(t, i, layer) - for x = (i - 1), 1, -1 do - if (t[x].whInfo.layer < layer) then - return x + 1 - end - end - return 1 -end - - -function widgetHandler:RaiseWidget(widget) - if (widget == nil) then - return - end - local function Raise(t, f, w) - if (f == nil) then return end - local i = FindWidgetIndex(t, w) - if (i == nil) then return end - local n = FindLowestIndex(t, i, w.whInfo.layer) - if (n and (n < i)) then - table.remove(t, i) - table.insert(t, n, w) - end - end - Raise(self.widgets, true, widget) - for _,listname in ipairs(callInLists) do - Raise(self[listname..'List'], widget[listname], widget) - end -end - - -local function FindHighestIndex(t, i, layer) - local ts = #t - for x = (i + 1),ts do - if (t[x].whInfo.layer > layer) then - return (x - 1) - end - end - return (ts + 1) -end - - -function widgetHandler:LowerWidget(widget) - if (widget == nil) then - return - end - local function Lower(t, f, w) - if (f == nil) then return end - local i = FindWidgetIndex(t, w) - if (i == nil) then return end - local n = FindHighestIndex(t, i, w.whInfo.layer) - if (n and (n > i)) then - table.insert(t, n, w) - table.remove(t, i) - end - end - Lower(self.widgets, true, widget) - for _,listname in ipairs(callInLists) do - Lower(self[listname..'List'], widget[listname], widget) - end -end - - -function widgetHandler:FindWidget(name) - if (type(name) ~= 'string') then - return nil - end - for k,v in ipairs(self.widgets) do - if (name == v.whInfo.name) then - return v,k - end - end - return nil -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Global var/func management --- - -function widgetHandler:RegisterGlobal(owner, name, value) - if ((name == nil) or - (_G[name]) or - (self.globals[name]) or - (CallInsMap[name])) then - return false - end - _G[name] = value - self.globals[name] = owner - return true -end - - -function widgetHandler:DeregisterGlobal(owner, name) - if ((name == nil) or (self.globals[name] and (self.globals[name] ~= owner))) then - return false - end - _G[name] = nil - self.globals[name] = nil - return true -end - - -function widgetHandler:SetGlobal(owner, name, value) - if ((name == nil) or (self.globals[name] ~= owner)) then - return false - end - _G[name] = value - return true -end - - -function widgetHandler:RemoveWidgetGlobals(owner) - local count = 0 - for name, o in pairs(self.globals) do - if (o == owner) then - _G[name] = nil - self.globals[name] = nil - count = count + 1 - end - end - return count -end - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- Helper facilities --- - -local hourTimer = 0 - - -function widgetHandler:GetHourTimer() - return hourTimer -end - -function widgetHandler:GetViewSizes() - --FIXME remove - return gl.GetViewSizes() -end - -function widgetHandler:ForceLayout() - forceLayout = true -- in main.lua -end - - -function widgetHandler:ConfigLayoutHandler(data) - ConfigLayoutHandler(data) -end - -function widgetHandler:isStable() - return isStable -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- The call-in distribution routines --- - -function widgetHandler:Shutdown() - self:SaveOrderList() - self:SaveConfigData() - for _,w in ipairs(self.ShutdownList) do - w:Shutdown() - end - return -end - -function widgetHandler:Update() - local deltaTime = Spring.GetLastUpdateSeconds() - -- update the hour timer - hourTimer = (hourTimer + deltaTime)%3600 - for _,w in ipairs(self.UpdateList) do - w:Update(deltaTime) - end - return -end - - -function widgetHandler:ConfigureLayout(command) - if (command == 'tweakgui') then - self.tweakMode = true - Spring.Echo("LuaUI TweakMode: ON") - return true - elseif (command == 'reconf') then - self:SendConfigData() - return true - elseif (command == 'selector') then - for _,w in ipairs(self.widgets) do - if (w.whInfo.basename == SELECTOR_BASENAME) then - return true -- there can only be one - end - end - local sw = self:LoadWidget(LUAUI_DIRNAME .. SELECTOR_BASENAME, VFS.RAW_FIRST) - self:InsertWidget(sw) - self:RaiseWidget(sw) - return true - elseif (string.find(command, 'togglewidget') == 1) then - self:ToggleWidget(string.sub(command, 14)) - return true - elseif (string.find(command, 'enablewidget') == 1) then - self:EnableWidget(string.sub(command, 14)) - return true - elseif (string.find(command, 'disablewidget') == 1) then - self:DisableWidget(string.sub(command, 15)) - return true - end - - if (self.actionHandler:TextAction(command)) then - return true - end - - for _,w in ipairs(self.TextCommandList) do - if (w:TextCommand(command)) then - return true - end - end - return false -end - - -function widgetHandler:CommandNotify(id, params, options) - for _,w in ipairs(self.CommandNotifyList) do - if (w:CommandNotify(id, params, options)) then - return true - end - end - return false -end - ---NOTE: StringStarts() and MessageProcessor is included in "chat_preprocess.lua" -function widgetHandler:AddConsoleLine(msg, priority) - if StringStarts(msg, transmitLobbyMagic) then -- sending to the lobby - return -- ignore - elseif StringStarts(msg, transmitMagic) then -- receiving from the lobby - if StringStarts(msg, voiceMagic) then - local tableString = string.sub(msg, string.len(voiceMagic) + 1) -- strip the magic string - local voiceCommandParams = Deserialize("return "..tableString) -- deserialize voice command parameters in table form - for _,w in ipairs(self.VoiceCommandList) do - w:VoiceCommand(voiceCommandParams.commandName, voiceCommandParams) - end - return - else - for _,w in ipairs(self.AddTransmitLineList) do - w:AddTransmitLine(msg, priority) - end - return - end - else - --censor message for muted player. This is mandatory, everyone is forced to close ears to muted players (ie: if it is optional, then everyone will opt to hear muted player for spec-cheat info. Thus it will defeat the purpose of mute) - local newMsg = { text = msg, priority = priority } - MessageProcessor:ProcessConsoleLine(newMsg) - if newMsg.msgtype ~= 'other' and newMsg.msgtype ~= 'autohost' then - local playerID_msg = newMsg.player and newMsg.player.id --retrieve playerID from message. - local customkeys = select(10, Spring.GetPlayerInfo(playerID_msg)) - if customkeys and customkeys.muted then - local myPlayerID = Spring.GetLocalPlayerID() - if myPlayerID == playerID_msg then --if I am the muted, then: - newMsg.argument="" --remind myself that I am muted. - msg = "" - else --if I am NOT the muted, then: delete this message - return - end - --TODO: improve chili_chat2 spam-filter/dedupe-detection too. - end - end - - --send message to widget:AddConsoleLine - for _,w in ipairs(self.AddConsoleLineList) do - w:AddConsoleLine(msg, priority) - end - - --send message to widget:AddConsoleMessage - if newMsg.msgtype == 'point' or newMsg.msgtype == 'label' then - return -- ignore all console messages about points... those come in through the MapDrawCmd callin - end - for _,w in ipairs(self.AddConsoleMessageList) do - w:AddConsoleMessage(newMsg) - end - end -end - - -function widgetHandler:GroupChanged(groupID) - for _,w in ipairs(self.GroupChangedList) do - w:GroupChanged(groupID) - end - return -end - - -function widgetHandler:CommandsChanged() - widgetHandler:UpdateSelection() -- for selectionchanged - self.inCommandsChanged = true - self.customCommands = {} - for _,w in ipairs(self.CommandsChangedList) do - w:CommandsChanged() - end - self.inCommandsChanged = false - return -end - - --------------------------------------------------------------------------------- --- --- Drawing call-ins --- - - -function widgetHandler:ViewResize(viewGeometry) - local vsx = viewGeometry.viewSizeX - local vsy = viewGeometry.viewSizeY - - for _,w in ipairs(self.ViewResizeList) do - w:ViewResize(vsx, vsy, viewGeometry) - end - return -end - -function widgetHandler:DrawScreen() - if (self.tweakMode) then - gl.Color(0, 0, 0, 0.5) - local sx, sy, px, py = Spring.GetViewGeometry() - gl.Shape(GL.QUADS, { - {v = { px, py }}, {v = { px+sx, py }}, {v = { px+sx, py+sy }}, {v = { px, py+sy }} - }) - gl.Color(1, 1, 1) - end - for _,w in ripairs(self.DrawScreenList) do - w:DrawScreen() - if (self.tweakMode and w.TweakDrawScreen) then - w:TweakDrawScreen() - end - end - return -end - - -function widgetHandler:DrawGenesis() - for _,w in ripairs(self.DrawGenesisList) do - w:DrawGenesis() - end - return -end - - -function widgetHandler:DrawWorld() - for _,w in ripairs(self.DrawWorldList) do - w:DrawWorld() - end - return -end - - -function widgetHandler:DrawWorldPreUnit() - for _,w in ripairs(self.DrawWorldPreUnitList) do - w:DrawWorldPreUnit() - end - return -end - - -function widgetHandler:DrawWorldShadow() - for _,w in ripairs(self.DrawWorldShadowList) do - w:DrawWorldShadow() - end - return -end - - -function widgetHandler:DrawWorldReflection() - for _,w in ripairs(self.DrawWorldReflectionList) do - w:DrawWorldReflection() - end - return -end - - -function widgetHandler:DrawWorldRefraction() - for _,w in ripairs(self.DrawWorldRefractionList) do - w:DrawWorldRefraction() - end - return -end - - -function widgetHandler:DrawScreenEffects(vsx, vsy) - for _,w in ripairs(self.DrawScreenEffectsList) do - w:DrawScreenEffects(vsx, vsy) - end - return -end - - -function widgetHandler:DrawInMiniMap(xSize, ySize) - for _,w in ripairs(self.DrawInMiniMapList) do - w:DrawInMiniMap(xSize, ySize) - end - return -end - - --------------------------------------------------------------------------------- --- --- Keyboard call-ins --- - -function widgetHandler:KeyPress(key, mods, isRepeat, label, unicode) - if (self.tweakMode) then - local mo = self.mouseOwner - if (mo and mo.TweakKeyPress) then - mo:TweakKeyPress(key, mods, isRepeat, label, unicode) - end - return true - end - - if (self.actionHandler:KeyAction(true, key, mods, isRepeat)) then - return true - end - - for _,w in ipairs(self.KeyPressList) do - if (w:KeyPress(key, mods, isRepeat, label, unicode)) then - return true - end - end - return false -end - - -function widgetHandler:KeyRelease(key, mods, label, unicode) - if (self.tweakMode) then - local mo = self.mouseOwner - if (mo and mo.TweakKeyRelease) then - mo:TweakKeyRelease(key, mods, label, unicode) - elseif (key == KEYSYMS.ESCAPE) then - Spring.Echo("LuaUI TweakMode: OFF") - self.tweakMode = false - end - return true - end - - if (self.actionHandler:KeyAction(false, key, mods, false)) then - return true - end - - for _,w in ipairs(self.KeyReleaseList) do - if (w:KeyRelease(key, mods, label, unicode)) then - return true - end - end - return false -end - - --------------------------------------------------------------------------------- --- --- Mouse call-ins --- - -do - local lastDrawFrame = 0 - local lastx,lasty = 0,0 - local lastWidget - - local spGetDrawFrame = Spring.GetDrawFrame - - -- local helper (not a real call-in) - function widgetHandler:WidgetAt(x, y) - local drawframe = spGetDrawFrame() - if (lastDrawFrame == drawframe)and(lastx == x)and(lasty == y) then - return lastWidget - end - - lastDrawFrame = drawframe - lastx = x - lasty = y - - if (not self.tweakMode) then - for _,w in ipairs(self.IsAboveList) do - if (w:IsAbove(x, y)) then - lastWidget = w - return w - end - end - else - for _,w in ipairs(self.TweakIsAboveList) do - if (w:TweakIsAbove(x, y)) then - lastWidget = w - return w - end - end - end - lastWidget = nil - return nil - end -end - - -function widgetHandler:MousePress(x, y, button) - local mo = self.mouseOwner - if (not self.tweakMode) then - if (mo) then - mo:MousePress(x, y, button) - return true -- already have an active press - end - for _,w in ipairs(self.MousePressList) do - if (w:MousePress(x, y, button)) then - self.mouseOwner = w - return true - end - end - return false - else - if (mo) then - mo:TweakMousePress(x, y, button) - return true -- already have an active press - end - for _,w in ipairs(self.TweakMousePressList) do - if (w:TweakMousePress(x, y, button)) then - self.mouseOwner = w - return true - end - end - return true -- always grab the mouse - end -end - - -function widgetHandler:MouseMove(x, y, dx, dy, button) - local mo = self.mouseOwner - if (not self.tweakMode) then - if (mo and mo.MouseMove) then - return mo:MouseMove(x, y, dx, dy, button) - end - else - if (mo and mo.TweakMouseMove) then - mo:TweakMouseMove(x, y, dx, dy, button) - end - return true - end -end - - -function widgetHandler:MouseRelease(x, y, button) - local mo = self.mouseOwner - local mx, my, lmb, mmb, rmb = Spring.GetMouseState() - if (not (lmb or mmb or rmb)) then - self.mouseOwner = nil - end - - if (not self.tweakMode) then - if (mo and mo.MouseRelease) then - return mo:MouseRelease(x, y, button) - end - return -1 - else - if (mo and mo.TweakMouseRelease) then - mo:TweakMouseRelease(x, y, button) - end - return -1 - end -end - - -function widgetHandler:MouseWheel(up, value) - if (not self.tweakMode) then - for _,w in ipairs(self.MouseWheelList) do - if (w:MouseWheel(up, value)) then - return true - end - end - return false - else - for _,w in ipairs(self.TweakMouseWheelList) do - if (w:TweakMouseWheel(up, value)) then - return true - end - end - return false -- FIXME: always grab in tweakmode? - end -end - -function widgetHandler:JoyAxis(axis, value) - for _,w in ipairs(self.JoyAxisList) do - if (w:JoyAxis(axis, value)) then - return true - end - end - return false -end - -function widgetHandler:JoyHat(hat, value) - for _,w in ipairs(self.JoyHatList) do - if (w:JoyHat(hat, value)) then - return true - end - end - return false -end - -function widgetHandler:JoyButtonDown(button, state) - for _,w in ipairs(self.JoyButtonDownList) do - if (w:JoyButtonDown(button, state)) then - return true - end - end - return false -end - -function widgetHandler:JoyButtonUp(button, state) - for _,w in ipairs(self.JoyButtonUpList) do - if (w:JoyButtonUp(button, state)) then - return true - end - end - return false -end - -function widgetHandler:IsAbove(x, y) - if (self.tweakMode) then - return true - end - return (widgetHandler:WidgetAt(x, y) ~= nil) -end - - -function widgetHandler:GetTooltip(x, y) - if (not self.tweakMode) then - for _,w in ipairs(self.GetTooltipList) do - if (w:IsAbove(x, y)) then - local tip = w:GetTooltip(x, y) - if ((type(tip) == 'string') and (#tip > 0)) then - return tip - end - end - end - return "" - else - for _,w in ipairs(self.TweakGetTooltipList) do - if (w:TweakIsAbove(x, y)) then - local tip = w:TweakGetTooltip(x, y) or '' - if ((type(tip) == 'string') and (#tip > 0)) then - return tip - end - end - end - return "Tweak Mode -- hit ESCAPE to cancel" - end -end - - --------------------------------------------------------------------------------- --- --- Game call-ins --- - -function widgetHandler:GamePreload() - for _,w in ipairs(self.GamePreloadList) do - w:GamePreload() - end - return -end - -function widgetHandler:GameStart() - for _,w in ipairs(self.GameStartList) do - w:GameStart() - end - - local plist = "" - gaiaTeam = Spring.GetGaiaTeamID() - for _, teamID in ipairs(Spring.GetTeamList()) do - local teamLuaAI = Spring.GetTeamLuaAI(teamID) - if ((teamLuaAI == nil or teamLuaAI == "") and teamID ~= gaiaTeam) then - local _,_,_,ai,side,ally = Spring.GetTeamInfo(teamID) - if (not ai) then - for _, pid in ipairs(Spring.GetPlayerList(teamID)) do - local name, active, spec = Spring.GetPlayerInfo(pid) - if active and not spec then plist = plist .. "," .. name end - end - end - end - end - Spring.SendCommands("wbynum 255 SPRINGIE:stats,plist".. plist) - return -end - -function widgetHandler:GameOver() - for _,w in ipairs(self.GameOverList) do - w:GameOver() - end - return -end - - -function widgetHandler:GamePaused(playerID, paused) - for _,w in ipairs(self.GamePausedList) do - w:GamePaused(playerID, paused) - end - return -end - - -function widgetHandler:TeamDied(teamID) - for _,w in ipairs(self.TeamDiedList) do - w:TeamDied(teamID) - end - return -end - - -function widgetHandler:TeamChanged(teamID) - for _,w in ipairs(self.TeamChangedList) do - w:TeamChanged(teamID) - end - return -end - - -function widgetHandler:PlayerAdded(playerID, reason) - --ListMutedPlayers() - for _,w in ipairs(self.PlayerAddedList) do - w:PlayerAdded(playerID, reason) - end - return -end - - -function widgetHandler:PlayerChanged(playerID) - for _,w in ipairs(self.PlayerChangedList) do - w:PlayerChanged(playerID) - end - return -end - - -function widgetHandler:PlayerRemoved(playerID, reason) - for _,w in ipairs(self.PlayerRemovedList) do - w:PlayerRemoved(playerID, reason) - end - return -end - - -function widgetHandler:GameFrame(frameNum) - for _,w in ipairs(self.GameFrameList) do - w:GameFrame(frameNum) - end - return -end - - -function widgetHandler:ShockFront(power, dx, dy, dz) - for _,w in ipairs(self.ShockFrontList) do - w:ShockFront(power, dx, dy, dz) - end - return -end - -function widgetHandler:RecvSkirmishAIMessage(aiTeam, dataStr) - for _,w in ipairs(self.RecvSkirmishAIMessageList) do - local dataRet = w:RecvSkirmishAIMessage(aiTeam, dataStr) - if (dataRet) then - return dataRet - end - end -end - -function widgetHandler:WorldTooltip(ttType, ...) - for _,w in ipairs(self.WorldTooltipList) do - local tt = w:WorldTooltip(ttType, ...) - if ((type(tt) == 'string') and (#tt > 0)) then - return tt - end - end - return -end - - -function widgetHandler:MapDrawCmd(playerID, cmdType, px, py, pz, ...) - local customkeys = select(10, Spring.GetPlayerInfo(playerID)) - if customkeys and customkeys.muted then - return true - end - - local retval = false - for _,w in ipairs(self.MapDrawCmdList) do - local takeEvent = w:MapDrawCmd(playerID, cmdType, px, py, pz, ...) - if (takeEvent) then - retval = true - end - end - return retval -end - - -function widgetHandler:GameSetup(state, ready, playerStates) - for _,w in ipairs(self.GameSetupList) do - local success, newReady = w:GameSetup(state, ready, playerStates) - if (success) then - return true, newReady - end - end - return false -end - - -function widgetHandler:DefaultCommand(...) - for _,w in ripairs(self.DefaultCommandList) do - local result = w:DefaultCommand(...) - if (type(result) == 'number') then - return result - end - end - return nil -- not a number, use the default engine command -end - - --------------------------------------------------------------------------------- --- --- Unit call-ins --- - -function widgetHandler:UnitCreated(unitID, unitDefID, unitTeam, builderID) - for _,w in ipairs(self.UnitCreatedList) do - w:UnitCreated(unitID, unitDefID, unitTeam, builderID) - end - return -end - - -function widgetHandler:UnitFinished(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitFinishedList) do - w:UnitFinished(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitFromFactory(unitID, unitDefID, unitTeam, - factID, factDefID, userOrders) - for _,w in ipairs(self.UnitFromFactoryList) do - w:UnitFromFactory(unitID, unitDefID, unitTeam, - factID, factDefID, userOrders) - end - return -end - - -function widgetHandler:UnitDestroyed(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitDestroyedList) do - w:UnitDestroyed(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitExperience(unitID, unitDefID, unitTeam, - experience, oldExperience) - for _,w in ipairs(self.UnitExperienceList) do - w:UnitExperience(unitID, unitDefID, unitTeam, - experience, oldExperience) - end - return -end - - -function widgetHandler:UnitTaken(unitID, unitDefID, unitTeam, newTeam) - for _,w in ipairs(self.UnitTakenList) do - w:UnitTaken(unitID, unitDefID, unitTeam, newTeam) - end - return -end - - -function widgetHandler:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) - for _,w in ipairs(self.UnitGivenList) do - w:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) - end - return -end - - -function widgetHandler:UnitIdle(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitIdleList) do - w:UnitIdle(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitCommand(unitID, unitDefID, unitTeam, - cmdId, cmdOpts, cmdParams) - for _,w in ipairs(self.UnitCommandList) do - w:UnitCommand(unitID, unitDefID, unitTeam, - cmdId, cmdOpts, cmdParams) - end - return -end - - -function widgetHandler:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdTag) - for _,w in ipairs(self.UnitCmdDoneList) do - w:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdTag) - end - return -end - - -function widgetHandler:UnitDamaged(unitID, unitDefID, unitTeam, - damage, paralyzer) - for _,w in ipairs(self.UnitDamagedList) do - w:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer) - end - return -end - - -function widgetHandler:UnitEnteredRadar(unitID, unitTeam) - for _,w in ipairs(self.UnitEnteredRadarList) do - w:UnitEnteredRadar(unitID, unitTeam) - end - return -end - - -function widgetHandler:UnitEnteredLos(unitID, unitTeam) - for _,w in ipairs(self.UnitEnteredLosList) do - w:UnitEnteredLos(unitID, unitTeam) - end - return -end - - -function widgetHandler:UnitLeftRadar(unitID, unitTeam) - for _,w in ipairs(self.UnitLeftRadarList) do - w:UnitLeftRadar(unitID, unitTeam) - end - return -end - - -function widgetHandler:UnitLeftLos(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitLeftLosList) do - w:UnitLeftLos(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitEnteredWater(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitEnteredWaterList) do - w:UnitEnteredWater(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitEnteredAir(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitEnteredAirList) do - w:UnitEnteredAir(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitLeftWater(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitLeftWaterList) do - w:UnitLeftWater(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitLeftAir(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitLeftAirList) do - w:UnitLeftAir(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitSeismicPing(x, y, z, strength) - for _,w in ipairs(self.UnitSeismicPingList) do - w:UnitSeismicPing(x, y, z, strength) - end - return -end - - -function widgetHandler:UnitLoaded(unitID, unitDefID, unitTeam, - transportID, transportTeam) - for _,w in ipairs(self.UnitLoadedList) do - w:UnitLoaded(unitID, unitDefID, unitTeam, - transportID, transportTeam) - end - return -end - - -function widgetHandler:UnitUnloaded(unitID, unitDefID, unitTeam, - transportID, transportTeam) - for _,w in ipairs(self.UnitUnloadedList) do - w:UnitUnloaded(unitID, unitDefID, unitTeam, - transportID, transportTeam) - end - return -end - - -function widgetHandler:UnitCloaked(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitCloakedList) do - w:UnitCloaked(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitDecloaked(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitDecloakedList) do - w:UnitDecloaked(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:UnitMoveFailed(unitID, unitDefID, unitTeam) - for _,w in ipairs(self.UnitMoveFailedList) do - w:UnitMoveFailed(unitID, unitDefID, unitTeam) - end - return -end - - -function widgetHandler:RecvLuaMsg(msg, playerID) - local retval = false - for _,w in ipairs(self.RecvLuaMsgList) do - if (w:RecvLuaMsg(msg, playerID)) then - retval = true - end - end - return retval -- FIXME -- another actionHandler type? -end - - -function widgetHandler:StockpileChanged(unitID, unitDefID, unitTeam, - weaponNum, oldCount, newCount) - for _,w in ipairs(self.StockpileChangedList) do - w:StockpileChanged(unitID, unitDefID, unitTeam, - weaponNum, oldCount, newCount) - end - 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, #newSelection do - if (newSelection[i] ~= oldSelection[i]) then -- it seems the order stays - changed = true - break - end - end - else - changed = true - end - if (changed) then - widgetHandler:SelectionChanged(newSelection) - end - oldSelection = newSelection -end - - -function widgetHandler:SelectionChanged(selectedUnits) - for _,w in ipairs(self.SelectionChangedList) do - local unitArray = w:SelectionChanged(selectedUnits) - if (unitArray) then - Spring.SelectUnitArray(unitArray) - break - end - end - return -end - - -function widgetHandler:GameProgress(frame) - for _,w in ipairs(self.GameProgressList) do - w:GameProgress(frame) - end - return -end - -function widgetHandler:UnsyncedHeightMapUpdate(x1,z1,x2,z2) - for _,w in ipairs(self.UnsyncedHeightMapUpdateList) do - w:UnsyncedHeightMapUpdate(x1,z1,x2,z2) - end - return -end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -widgetHandler:Initialize() - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- diff --git a/LuaUI/chat_preprocess.lua b/LuaUI/chat_preprocess.lua deleted file mode 100644 index fcbd92bd9..000000000 --- a/LuaUI/chat_preprocess.lua +++ /dev/null @@ -1,138 +0,0 @@ ---Chat preprocessor. Provide preprocessed chat message for Chili Chat widget - -local myName = Spring.GetPlayerInfo(Spring.GetMyPlayerID()) -local transmitMagic = "> ["..myName.."]!transmit" -- Lobby is sending to LuaUI -local voiceMagic = "> ["..myName.."]!transmit voice" -- Lobby is sending a voice command to LuaUI -local transmitLobbyMagic = "!transmitlobby" -- LuaUI is sending to lobby - -function StringStarts(s, start) - return string.sub(s, 1, string.len(start)) == start -end - -local function Deserialize(text) - local f, err = loadstring(text) - if not f then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "Error while deserializing table (compiling): "..tostring(err)) - return - end - setfenv(f, {}) -- sandbox - local success, arg = pcall(f) - if not success then - Spring.Log(HANDLER_BASENAME, LOG.ERROR, "Error while deserializing table (calling): "..tostring(arg)) - return - end - return arg -end - - -local MessageProcessor = {} - -local PLAYERNAME_PATTERN = '([%w%[%]_]+)' -- to make message patterns easier to read/update - --- message definitions ---[[ -pattern syntax: - see http://www.lua.org/manual/5.1/manual.html#5.4.1 - pattern must contain at least 1 capture group; its content will end up in msg.argument after parseMessage() - PLAYERNAME will match anything that looks like a playername (see code for definition of PLAYERNAME_PATTERN); it is a capture group - if message does not contain a PLAYERNAME, add 'noplayername = true' to definition - it should be possible to add definitions to help debug widgets or whatever... (no guarantee) ---]] -MessageProcessor.MESSAGE_DEFINITIONS = { - { msgtype = 'player_to_allies', pattern = '^ Allies: (.*)' }, - { msgtype = 'player_to_player_received', pattern = '^ Private: (.*)' }, -- TODO test! - { msgtype = 'player_to_player_sent', pattern = '^You whispered PLAYERNAME: (.*)' }, -- TODO test! - { msgtype = 'player_to_specs', pattern = '^ Spectators: (.*)' }, - { msgtype = 'player_to_everyone', pattern = '^ (.*)' }, - - { msgtype = 'spec_to_specs', pattern = '^%[PLAYERNAME%] Spectators: (.*)' }, - { msgtype = 'spec_to_allies', pattern = '^%[PLAYERNAME%] Allies: (.*)' }, -- TODO is there a reason to differentiate spec_to_specs and spec_to_allies?? - { msgtype = 'spec_to_everyone', pattern = '^%[PLAYERNAME%] (.*)' }, - - -- shameful copy-paste -- TODO rewrite pattern matcher to remove this duplication - { msgtype = 'replay_spec_to_specs', pattern = '^%[PLAYERNAME %(replay%)%] Spectators: (.*)' }, - { msgtype = 'replay_spec_to_allies', pattern = '^%[PLAYERNAME %(replay%)%] Allies: (.*)' }, -- TODO is there a reason to differentiate spec_to_specs and spec_to_allies?? - { msgtype = 'replay_spec_to_everyone', pattern = '^%[PLAYERNAME %(replay%)%] (.*)'}, - - { msgtype = 'label', pattern = '^PLAYERNAME added point: (.+)', discard = true }, -- NOTE : these messages are discarded -- points and labels are provided through MapDrawCmd() callin - { msgtype = 'point', pattern = '^PLAYERNAME added point: ', discard = true }, - { msgtype = 'autohost', pattern = '^> (.+)', noplayername = true }, - { msgtype = 'other' } -- no pattern... will match anything else -} - -local function escapePatternReplacementChars(s) - return string.gsub(s, "%%", "%%%%") -end - -function MessageProcessor:Initialize() - local escapedPlayernamePattern = escapePatternReplacementChars(PLAYERNAME_PATTERN) - for _,def in ipairs(self.MESSAGE_DEFINITIONS) do - if def.pattern then - def.pattern = def.pattern:gsub('PLAYERNAME', escapedPlayernamePattern) -- patch definition pattern so it is an actual lua pattern string - end - end -end - -local players = {} - -local function SetupPlayers() - local playerroster = Spring.GetPlayerList() - - for i, id in ipairs(playerroster) do - local name, _, spec, teamId, allyTeamId, _,_,_,_,customkeys = Spring.GetPlayerInfo(id) - players[name] = { id = id, spec = spec, allyTeamId = allyTeamId, muted = (customkeys and customkeys.muted == 1) } - end -end - -local function getSource(spec, allyTeamId) - return (spec and 'spec') - or ((Spring.GetMyTeamID() == allyTeamId) and 'ally') - or 'enemy' -end - --- update msg members msgtype, argument, source and playername (when relevant) -function MessageProcessor:ParseMessage(msg) - for _, candidate in ipairs(self.MESSAGE_DEFINITIONS) do - if candidate.pattern == nil then -- for fallback/other messages - msg.msgtype = candidate.msgtype - msg.argument = msg.text - msg.source = 'other' - return - end - local capture1, capture2 = msg.text:match(candidate.pattern) - if capture1 then - msg.msgtype = candidate.msgtype - if candidate.noplayername then - msg.argument = capture1 - msg.source = 'other' - return - else - local playername = capture1 - if players[playername] then - local player = players[playername] - msg.player = player - msg.source = getSource(player.spec, player.allyTeamId) - msg.playername = playername - msg.argument = capture2 - return - end - end - end - end -end - -function MessageProcessor:ProcessConsoleLine(msg) - self:ParseMessage(msg) -end - -function MessageProcessor:ProcessConsoleBuffer(count) - local bufferMessages = Spring.GetConsoleBuffer(count) - for i = 1,#bufferMessages do - self:ProcessConsoleLine(bufferMessages[i]) - end - return bufferMessages -end - -SetupPlayers() -MessageProcessor:Initialize() -return myName, transmitMagic, voiceMagic, transmitLobbyMagic, MessageProcessor \ No newline at end of file diff --git a/LuaUI/main_evo.lua b/LuaUI/main_evo.lua new file mode 100644 index 000000000..3612b56ab --- /dev/null +++ b/LuaUI/main_evo.lua @@ -0,0 +1,156 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: main.lua +-- brief: the entry point from gui.lua, relays call-ins to the widget manager +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +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") + +include("debug.lua") +include("fonts.lua") +include("layout.lua") -- contains a simple LayoutButtons() +include("widgets_evo.lua") -- the widget handler + + +-------------------------------------------------------------------------------- +-- +-- print the header +-- + +if (RestartCount == nil) then + RestartCount = 0 +else + RestartCount = RestartCount + 1 +end + +do + local restartStr = "" + if (RestartCount > 0) then + restartStr = " (" .. RestartCount .. " Restarts)" + end + Spring.SendCommands({"echo " .. LUAUI_VERSION .. restartStr}) +end + + +-------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- +-- A few helper functions +-- + +function Say(msg) + Spring.SendCommands({'say ' .. msg}) +end + + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- +-- Update() -- called every frame +-- + +activePage = 0 + +forceLayout = true + + +function Update() + local currentPage = Spring.GetActivePage() + if (forceLayout or (currentPage ~= activePage)) then + Spring.ForceLayoutUpdate() -- for the page number indicator + forceLayout = false + end + activePage = currentPage + + fontHandler.Update() + + widgetHandler:Update() + + return +end + + +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +-- +-- WidgetHandler fixed calls +-- + +function Shutdown() + return widgetHandler:Shutdown() +end + +function ConfigureLayout(command) + return widgetHandler:ConfigureLayout(command) +end + +function CommandNotify(id, params, options) + return widgetHandler:CommandNotify(id, params, options) +end + +function DrawScreen(vsx, vsy) + widgetHandler:SetViewSize(vsx, vsy) + return widgetHandler:DrawScreen() +end + +function KeyPress(key, mods, isRepeat, label, unicode) + return widgetHandler:KeyPress(key, mods, isRepeat, label, unicode) +end + +function KeyRelease(key, mods, label, unicode) + return widgetHandler:KeyRelease(key, mods, label, unicode) +end + +function MouseMove(x, y, dx, dy, button) + return widgetHandler:MouseMove(x, y, dx, dy, button) +end + +function MousePress(x, y, button) + return widgetHandler:MousePress(x, y, button) +end + +function MouseRelease(x, y, button) + return widgetHandler:MouseRelease(x, y, button) +end + +function IsAbove(x, y) + return widgetHandler:IsAbove(x, y) +end + +function GetTooltip(x, y) + return widgetHandler:GetTooltip(x, y) +end + +function AddConsoleLine(msg, priority) + return widgetHandler:AddConsoleLine(msg, priority) +end + +function GroupChanged(groupID) + return widgetHandler:GroupChanged(groupID) +end + + +-- +-- The unit (and some of the Draw) call-ins are handled +-- differently (see LuaUI/widgets.lua / UpdateCallIns()) +-- + + +-------------------------------------------------------------------------------- + diff --git a/LuaUI/modfonts.lua b/LuaUI/modfonts.lua index 708572c14..e345e7685 100644 --- a/LuaUI/modfonts.lua +++ b/LuaUI/modfonts.lua @@ -194,15 +194,13 @@ end -------------------------------------------------------------------------------- local function StripColorCodes(text) - if text ~= nil then - local stripped = "" - for txt, color in text:gmatch("([^\255]*)(\255?.?.?.?)") do - if (txt:len() > 0) then - stripped = stripped .. txt - end - end - return stripped - end + local stripped = "" + for txt, color in text:gmatch("([^\255]*)(\255?.?.?.?)") do + if (txt:len() > 0) then + stripped = stripped .. txt + end + end + return stripped end diff --git a/LuaUI/system.lua b/LuaUI/system.lua deleted file mode 100644 index 025dab81e..000000000 --- a/LuaUI/system.lua +++ /dev/null @@ -1,100 +0,0 @@ --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- --- --- file: system.lua --- brief: defines the global entries placed into a widget's table --- author: Dave Rodgers --- --- Copyright (C) 2007. --- Licensed under the terms of the GNU GPL, v2 or later. --- --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if (System == nil) then - - System = { - -- - -- Custom LuaUI variables - -- - Commands = Commands, - fontHandler = fontHandler, - LUAUI_DIRNAME = LUAUI_DIRNAME, - - -- - -- Custom Spring tables - -- - VFS = VFS, - Script = Script, - Spring = Spring, - Game = Game, - gl = gl, - GL = GL, - CMD = CMD, - CMDTYPE = CMDTYPE, - - UnitDefs = UnitDefs, - UnitDefNames = UnitDefNames, - FeatureDefs = FeatureDefs, - FeatureDefNames = FeatureDefNames, - WeaponDefs = WeaponDefs, - WeaponDefNames = WeaponDefNames, - - -- - -- Standard libraries - -- - io = io, - os = os, - math = math, - debug = debug, - table = table, - string = string, - package = package, - coroutine = coroutine, - - -- - -- Standard functions and variables - -- - assert = assert, - error = error, - - print = print, - - next = next, - pairs = pairs, - ipairs = ipairs, - - tonumber = tonumber, - tostring = tostring, - type = type, - - collectgarbage = collectgarbage, - gcinfo = gcinfo, - - unpack = unpack, - select = select, - newproxy = newproxy, - - dofile = dofile, - loadfile = loadfile, - loadlib = loadlib, - loadstring = loadstring, - require = require, - - getmetatable = getmetatable, - setmetatable = setmetatable, - - rawequal = rawequal, - rawget = rawget, - rawset = rawset, - - getfenv = getfenv, - setfenv = setfenv, - - pcall = pcall, - xpcall = xpcall, - - _VERSION = _VERSION - } - -end diff --git a/LuaUI/utility_two.lua b/LuaUI/utility_two.lua deleted file mode 100644 index 17b69b4d8..000000000 --- a/LuaUI/utility_two.lua +++ /dev/null @@ -1,30 +0,0 @@ --- Utility function for ZK - --- Will try to read LUA content from target file and create BACKUP if have a successful read (in user's Spring folder) OR DELETE them if have a failure read --- This prevent corrupted file from being used. -function CheckLUAFileAndBackup(filePath, headerString) - local chunk, err = loadfile(filePath) - if (chunk) then --if original content is LUA OK: - local tmp = {} - setfenv(chunk, tmp) - local tab = chunk() - if tab and type(tab) == "table" then - table.save(chunk(),filePath..".bak",headerString) --write to backup - end - else --if original content is not LUA OK: - Spring.Log("CheckLUAFileAndBackup","warning", tostring(err) .. " (Now will find backup file)") - chunk, err = loadfile(filePath..".bak") - if (chunk) then --if backup content is LUA OK: - local tmp = {} - setfenv(chunk, tmp) - local tab = chunk() - if tab and type(tab) == "table" then - table.save(chunk(),filePath,headerString) --overwrite original - end - else --if backup content is also not LUA OK: - Spring.Log("CheckLUAFileAndBackup","warning", tostring(err) .. " (Backup file not available)") - Spring.Echo(os.remove (filePath)) --delete original - Spring.Echo(os.remove (filePath..".bak")) --delete backup - end - end -end \ No newline at end of file diff --git a/LuaUI/widgets_evo.lua b/LuaUI/widgets_evo.lua new file mode 100644 index 000000000..80af22e60 --- /dev/null +++ b/LuaUI/widgets_evo.lua @@ -0,0 +1,2091 @@ +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- file: widgets.lua +-- brief: the widget manager, a call-in router +-- author: Dave Rodgers +-- +-- Copyright (C) 2007. +-- Licensed under the terms of the GNU GPL, v2 or later. +-- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function pwl() -- ??? (print widget list) + for k,v in ipairs(widgetHandler.widgets) do + print(k, v.whInfo.layer, v.whInfo.name) + end +end + + +include("keysym.h.lua") +include("utils.lua") +include("system.lua") +include("cache.lua") --contain cached override for Spring.GetVisibleUnit (performance optimization). All overrides that are placed here have global reach +include("callins.lua") +include("savetable.lua") + + +local gl = gl + +local modShortUpper = Game.modShortName:upper() +local ORDER_FILENAME = LUAUI_DIRNAME .. 'Config/' .. modShortUpper .. '_order.lua' +local CONFIG_FILENAME = LUAUI_DIRNAME .. 'Config/' .. modShortUpper .. '_data.lua' +local WIDGET_DIRNAME = LUAUI_DIRNAME .. 'Widgets_Evo/' + +local SELECTOR_BASENAME = 'selector.lua' + +local SAFEWRAP = 1 +-- 0: disabled +-- 1: enabled, but can be overriden by widget.GetInfo().unsafe +-- 2: always enabled + +local SAFEDRAW = false -- requires SAFEWRAP to work +local glPopAttrib = gl.PopAttrib +local glPushAttrib = gl.PushAttrib +local section = 'widgets_evo.lua' + + +-------------------------------------------------------------------------------- + +-- install bindings for TweakMode and the Widget Selector + +Spring.SendCommands({ + "unbindkeyset Any+f11", + "unbindkeyset Ctrl+f11", + "bind f11 luaui selector", + "bind C+f11 luaui tweakgui", + "echo LuaUI: bound F11 to the widget selector", + "echo LuaUI: bound CTRL+F11 to tweak mode" +}) + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- the widgetHandler object +-- + +widgetHandler = { + + widgets = {}, + + configData = {}, + orderList = {}, + + knownWidgets = {}, + knownCount = 0, + knownChanged = true, + + commands = {}, + customCommands = {}, + inCommandsChanged = false, + + autoUserWidgets = true, + + actionHandler = include("actions.lua"), + + WG = {}, -- shared table for widgets + + globals = {}, -- global vars/funcs + + mouseOwner = nil, + ownedButton = 0, + + tweakMode = false, + tweakKeys = {}, + + xViewSize = 1, + yViewSize = 1, + xViewSizeOld = 1, + yViewSizeOld = 1, +} + + +-- these call-ins are set to 'nil' if not used +-- they are setup in UpdateCallIns() +local flexCallIns = { + 'GamePreload', + 'GameStart', + 'GameOver', + 'GamePaused', + 'GameFrame', + 'GameSetup', + 'TeamDied', + 'TeamChanged', + 'PlayerChanged', + 'PlayerAdded', + 'PlayerRemoved', + 'ShockFront', + 'WorldTooltip', + 'MapDrawCmd', + 'DefaultCommand', + 'UnitCreated', + 'UnitFinished', + 'UnitFromFactory', + 'UnitReverseBuilt', + 'UnitDestroyed', + 'RenderUnitDestroyed', + 'UnitTaken', + 'UnitGiven', + 'UnitIdle', + 'UnitCommand', + 'UnitCmdDone', + 'UnitDamaged', + 'UnitStunned', + 'UnitEnteredRadar', + 'UnitEnteredLos', + 'UnitLeftRadar', + 'UnitLeftLos', + 'UnitEnteredWater', + 'UnitEnteredAir', + 'UnitLeftWater', + 'UnitLeftAir', + 'UnitSeismicPing', + 'UnitLoaded', + 'UnitUnloaded', + 'UnitCloaked', + 'UnitDecloaked', + 'UnitMoveFailed', + 'RecvLuaMsg', + 'SelectionChanged', + 'StockpileChanged', + 'DrawGenesis', + 'DrawWorld', + 'DrawWorldPreUnit', + 'DrawWorldShadow', + 'DrawWorldReflection', + 'DrawWorldRefraction', + 'DrawUnitsPostDeferred', + 'DrawFeaturesPostDeferred', + 'DrawScreenEffects', + 'DrawInMiniMap', + 'SunChanged', + 'RecvSkirmishAIMessage', +} +local flexCallInMap = {} +for _,ci in ipairs(flexCallIns) do + flexCallInMap[ci] = true +end + +local callInLists = { + 'GamePreload', + 'GameStart', + 'Shutdown', + 'Update', + 'TextCommand', + 'CommandNotify', + 'AddConsoleLine', + 'ViewResize', + 'DrawScreen', + 'KeyPress', + 'KeyRelease', + 'MousePress', + 'MouseWheel', + 'JoyAxis', + 'JoyHat', + 'JoyButtonDown', + 'JoyButtonUp', + 'IsAbove', + 'GetTooltip', + 'GroupChanged', + 'CommandsChanged', + 'TweakMousePress', + 'TweakMouseWheel', + 'TweakIsAbove', + 'TweakGetTooltip', + 'RecvFromSynced', + 'TextInput', + 'DownloadQueued', + 'DownloadStarted', + 'DownloadFinished', + 'DownloadFailed', + 'DownloadProgress', +-- these use mouseOwner instead of lists +-- 'MouseMove', +-- 'MouseRelease', +-- 'TweakKeyPress', +-- 'TweakKeyRelease', +-- 'TweakMouseMove', +-- 'TweakMouseRelease', + +-- uses the DrawScreenList +-- 'TweakDrawScreen', +} + +-- append the flex call-ins +for _,uci in ipairs(flexCallIns) do + table.insert(callInLists, uci) +end + + +-- initialize the call-in lists +do + for _,listname in ipairs(callInLists) do + widgetHandler[listname..'List'] = {} + end +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Reverse integer iterator for drawing +-- + +local function rev_iter(t, key) + if (key <= 1) then + return nil + else + local nkey = key - 1 + return nkey, t[nkey] + end +end + +local function ripairs(t) + return rev_iter, t, (1 + #t) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +function widgetHandler:LoadConfigData() + local chunk, err = loadfile(CONFIG_FILENAME) + if (chunk == nil) or (chunk() == nil) or (err) then + if err then + Spring.Log(section, LOG.ERROR, err) + end + return + end + local tmp = {math = {huge = math.huge}} + setfenv(chunk, tmp) + self.orderList = chunk().order + self.configData = chunk().data + if (not self.orderList) then + self.orderList = {} -- safety + end + if (not self.configData) then + self.configData = {} -- safety + end +end + + +function widgetHandler:SaveConfigData() +-- self:LoadConfigData() + local filetable = {} + for i,w in ipairs(self.widgets) do + if (w.GetConfigData) then + self.configData[w.whInfo.name] = select(2, pcall(w.GetConfigData)) + end + self.orderList[w.whInfo.name] = i + end + filetable.order = self.orderList + filetable.data = self.configData + table.save( filetable, CONFIG_FILENAME, '-- Widget Custom data and order, order = 0 disabled widget') +end + + +function widgetHandler:SendConfigData() + self:LoadConfigData() + for i,w in ipairs(self.widgets) do + local data = self.configData[w.whInfo.name] + if (w.SetConfigData and data) then + w:SetConfigData(data) + end + end +end + + +-------------------------------------------------------------------------------- + + +local function GetWidgetInfo(name, mode) + + do return end -- FIXME + + local lines = VFS.LoadFile(name, mode) + + local infoLines = {} + + for line in lines:gmatch('([^\n]*)\n') do + if (not line:find('^%s*%-%-')) then + if (line:find('[^\r]')) then + break -- not commented, not a blank line + end + end + local s, e, source = line:find('^%s*%-%-%>%>(.*)') + if (source) then + table.insert(infoLines, source) + end + end + + local info = {} + local chunk, err = loadstring(table.concat(infoLines, '\n')) + if (not chunk) then + Spring.Log(section, LOG.INFO, 'not loading ' .. name .. ': ' .. err) + else + setfenv(chunk, info) + local success, err = pcall(chunk) + if (not success) then + Spring.Log(section, LOG.INFO, 'not loading ' .. name .. ': ' .. err) + end + end + + for k,v in pairs(info) do + Spring.Log(section, LOG.INFO, name, k, 'type: ' .. type(v), '<'..tostring(v)..'>') + end +end + + +function widgetHandler:Initialize() + self:LoadConfigData() + + local autoUserWidgets = Spring.GetConfigInt('LuaAutoEnableUserWidgets', 1) + self.autoUserWidgets = (autoUserWidgets ~= 0) + + -- create the "LuaUI/Config" directory + Spring.CreateDir(LUAUI_DIRNAME .. 'Config') + + local unsortedWidgets = {} + + -- stuff the raw widgets into unsortedWidgets + local widgetFiles = VFS.DirList(WIDGET_DIRNAME, "*.lua", VFS.RAW_ONLY) + for k,wf in ipairs(widgetFiles) do + GetWidgetInfo(wf, VFS.RAW_ONLY) + local widget = self:LoadWidget(wf, false) + if (widget) then + table.insert(unsortedWidgets, widget) + end + end + + -- stuff the zip widgets into unsortedWidgets + local widgetFiles = VFS.DirList(WIDGET_DIRNAME, "*.lua", VFS.ZIP_ONLY) + for k,wf in ipairs(widgetFiles) do + GetWidgetInfo(wf, VFS.ZIP_ONLY) + local widget = self:LoadWidget(wf, true) + if (widget) then + table.insert(unsortedWidgets, widget) + end + end + + -- sort the widgets + table.sort(unsortedWidgets, function(w1, w2) + local l1 = w1.whInfo.layer + local l2 = w2.whInfo.layer + if (l1 ~= l2) then + return (l1 < l2) + end + local n1 = w1.whInfo.name + local n2 = w2.whInfo.name + local o1 = self.orderList[n1] + local o2 = self.orderList[n2] + if (o1 ~= o2) then + return (o1 < o2) + else + return (n1 < n2) + end + end) + + -- add the widgets + for _,w in ipairs(unsortedWidgets) do + local name = w.whInfo.name + local basename = w.whInfo.basename + local source = self.knownWidgets[name].fromZip and "mod: " or "user:" + Spring.Log(section, LOG.INFO, string.format("Loading widget from %s %-18s <%s> ...", source, name, basename)) + + widgetHandler:InsertWidget(w) + end + + -- save the active widgets, and their ordering + self:SaveConfigData() +end + + +function widgetHandler:LoadWidget(filename, fromZip) + local basename = Basename(filename) + local text = VFS.LoadFile(filename) + if (text == nil) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (missing file: ' .. filename ..')') + return nil + end + local chunk, err = loadstring(text, filename) + if (chunk == nil) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + return nil + end + + local widget = widgetHandler:NewWidget() + setfenv(chunk, widget) + local success, err = pcall(chunk) + if (not success) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + return nil + end + if (err == false) then + return nil -- widget asked for a silent death + end + + -- raw access to widgetHandler + if (widget.GetInfo and widget:GetInfo().handler) then + widget.widgetHandler = self + end + + self:FinalizeWidget(widget, filename, basename) + local name = widget.whInfo.name + if (basename == SELECTOR_BASENAME) then + self.orderList[name] = 1 -- always enabled + end + + err = self:ValidateWidget(widget) + if (err) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (' .. err .. ')') + return nil + end + + local knownInfo = self.knownWidgets[name] + if (knownInfo) then + if (knownInfo.active) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (duplicate name)') + return nil + end + else + -- create a knownInfo table + knownInfo = {} + knownInfo.desc = widget.whInfo.desc + knownInfo.author = widget.whInfo.author + knownInfo.basename = widget.whInfo.basename + knownInfo.filename = widget.whInfo.filename + knownInfo.enabled = widget.whInfo.enabled + knownInfo.fromZip = fromZip + self.knownWidgets[name] = knownInfo + self.knownCount = self.knownCount + 1 + self.knownChanged = true + end + knownInfo.active = true + + if (widget.GetInfo == nil) then + Spring.Log(section, LOG.ERROR, 'Failed to load: ' .. basename .. ' (no GetInfo() call)') + return nil + end + + local info = widget:GetInfo() + local order = self.orderList[name] + if (((order ~= nil) and (order > 0)) or + ((order == nil) and -- unknown widget + (info.enabled and (knownInfo.fromZip or self.autoUserWidgets)))) then + -- this will be an active widget + if (order == nil) then + self.orderList[name] = 12345 -- back of the pack + else + self.orderList[name] = order + end + else + self.orderList[name] = 0 + self.knownWidgets[name].active = false + return nil + end + + -- load the config data + local config = self.configData[name] + if (widget.SetConfigData and config) then + widget:SetConfigData(config) + end + + return widget +end + + +function widgetHandler:NewWidget() + local widget = {} + if (true) then + -- copy the system calls into the widget table + for k,v in pairs(System) do + widget[k] = v + end + widget["SendToUnsynced"] = Spring.SendToUnsynced + else + -- use metatable redirection + setmetatable(widget, { + __index = System, + __metatable = true, + }) + end + widget.WG = self.WG -- the shared table + widget.widget = widget -- easy self referencing + + -- wrapped calls (closures) + widget.widgetHandler = {} + local wh = widget.widgetHandler + local self = self + widget.include = function (f) return include(f, widget) end + wh.ForceLayout = function (_) self:ForceLayout() end + wh.RaiseWidget = function (_) self:RaiseWidget(widget) end + wh.LowerWidget = function (_) self:LowerWidget(widget) end + wh.RemoveWidget = function (_) self:RemoveWidget(widget) end + wh.GetCommands = function (_) return self.commands end + wh.InTweakMode = function (_) return self.tweakMode end + wh.GetViewSizes = function (_) return self:GetViewSizes() end + wh.GetHourTimer = function (_) return self:GetHourTimer() end + wh.IsMouseOwner = function (_) return (self.mouseOwner == widget) end + wh.DisownMouse = function (_) + if (self.mouseOwner == widget) then + self.mouseOwner = nil + end + end + + wh.UpdateCallIn = function (_, name) + self:UpdateWidgetCallIn(name, widget) + end + wh.RemoveCallIn = function (_, name) + self:RemoveWidgetCallIn(name, widget) + end + + wh.AddAction = function (_, cmd, func, data, types) + return self.actionHandler:AddAction(widget, cmd, func, data, types) + end + wh.RemoveAction = function (_, cmd, types) + return self.actionHandler:RemoveAction(widget, cmd, types) + end + + wh.AddSyncAction = function(_, cmd, func, help) + return self.actionHandler:AddSyncAction(widget, cmd, func, help) + end + wh.RemoveSyncAction = function(_, cmd) + return self.actionHandler:RemoveSyncAction(widget, cmd) + end + + wh.AddLayoutCommand = function (_, cmd) + if (self.inCommandsChanged) then + table.insert(self.customCommands, cmd) + else + Spring.Log(section, LOG.ERROR, "AddLayoutCommand() can only be used in CommandsChanged()") + end + end + + wh.RegisterGlobal = function(_, name, value) + return self:RegisterGlobal(widget, name, value) + end + wh.DeregisterGlobal = function(_, name) + return self:DeregisterGlobal(widget, name) + end + wh.SetGlobal = function(_, name, value) + return self:SetGlobal(widget, name, value) + end + + wh.ConfigLayoutHandler = function(_, d) self:ConfigLayoutHandler(d) end + + return widget +end + + +function widgetHandler:AddWidgetSyncAction(widget, cmd, func, help) + return self.actionHandler:AddSyncAction(widget, cmd, func, help) +end + +function widgetHandler:RemoveWidgetSyncAction(widget, cmd) + return self.actionHandler:RemoveSyncAction(widget, cmd) +end + + +function widgetHandler:FinalizeWidget(widget, filename, basename) + local wi = {} + + wi.filename = filename + wi.basename = basename + if (widget.GetInfo == nil) then + wi.name = basename + wi.layer = 0 + else + local info = widget:GetInfo() + wi.name = info.name or basename + wi.layer = info.layer or 0 + wi.desc = info.desc or "" + wi.author = info.author or "" + wi.license = info.license or "" + wi.enabled = info.enabled or false + end + + widget.whInfo = {} -- a proxy table + local mt = { + __index = wi, + __newindex = function() error("whInfo tables are read-only") end, + __metatable = "protected" + } + setmetatable(widget.whInfo, mt) +end + + +function widgetHandler:ValidateWidget(widget) + if (widget.GetTooltip and not widget.IsAbove) then + return "Widget has GetTooltip() but not IsAbove()" + end + if (widget.TweakGetTooltip and not widget.TweakIsAbove) then + return "Widget has TweakGetTooltip() but not TweakIsAbove()" + end + return nil +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +local function SafeWrapFuncNoGL(func, funcName) + local wh = widgetHandler + + return function(w, ...) + + local r = { pcall(func, w, ...) } + + if (r[1]) then + table.remove(r, 1) + return unpack(r) + else + if (funcName ~= 'Shutdown') then + widgetHandler:RemoveWidget(w) + else + Spring.Log(section, LOG.ERROR, 'Error in Shutdown()') + end + local name = w.whInfo.name + Spring.Log(section, LOG.ERROR, r[1]) + Spring.Log(section, LOG.ERROR, 'Error in ' .. funcName ..'(): ' .. tostring(r[2])) + Spring.Log(section, LOG.ERROR, 'Removed widget: ' .. name) + return nil + end + end +end + + +local function SafeWrapFuncGL(func, funcName) + local wh = widgetHandler + + return function(w, ...) + + glPushAttrib(GL.ALL_ATTRIB_BITS) + local r = { pcall(func, w, ...) } + glPopAttrib() + + if (r[1]) then + table.remove(r, 1) + return unpack(r) + else + if (funcName ~= 'Shutdown') then + widgetHandler:RemoveWidget(w) + else + Spring.Log(section, LOG.ERROR, 'Error in Shutdown()') + end + local name = w.whInfo.name + Spring.Log(section, LOG.ERROR, 'Error in ' .. funcName ..'(): ' .. tostring(r[2])) + Spring.Log(section, LOG.ERROR, 'Removed widget: ' .. name) + return nil + end + end +end + + +local function SafeWrapFunc(func, funcName) + if (not SAFEDRAW) then + return SafeWrapFuncNoGL(func, funcName) + else + if (string.sub(funcName, 1, 4) ~= 'Draw') then + return SafeWrapFuncNoGL(func, funcName) + else + return SafeWrapFuncGL(func, funcName) + end + end +end + + +local function SafeWrapWidget(widget) + if (SAFEWRAP <= 0) then + return + elseif (SAFEWRAP == 1) then + if (widget.GetInfo and widget.GetInfo().unsafe) then + Spring.LOG(section, LOG.INFO, 'LuaUI: loaded unsafe widget: ' .. widget.whInfo.name) + return + end + end + + for _,ciName in ipairs(callInLists) do + if (widget[ciName]) then + widget[ciName] = SafeWrapFunc(widget[ciName], ciName) + end + if (widget.Initialize) then + widget.Initialize = SafeWrapFunc(widget.Initialize, 'Initialize') + end + end +end + + +-------------------------------------------------------------------------------- + +local function ArrayInsert(t, f, w) + if (f) then + local layer = w.whInfo.layer + local index = 1 + for i,v in ipairs(t) do + if (v == w) then + return -- already in the table + end + if (layer >= v.whInfo.layer) then + index = i + 1 + end + end + table.insert(t, index, w) + end +end + + +local function ArrayRemove(t, w) + for k,v in ipairs(t) do + if (v == w) then + table.remove(t, k) + -- break + end + end +end + + +function widgetHandler:InsertWidget(widget) + if (widget == nil) then + return + end + + SafeWrapWidget(widget) + + ArrayInsert(self.widgets, true, widget) + for _,listname in ipairs(callInLists) do + local func = widget[listname] + if (type(func) == 'function') then + ArrayInsert(self[listname..'List'], func, widget) + end + end + self:UpdateCallIns() + + if (widget.Initialize) then + widget:Initialize() + end +end + + +function widgetHandler:RemoveWidget(widget) + if (widget == nil) then + return + end + + local name = widget.whInfo.name + if (widget.GetConfigData) then + self.configData[name] = widget:GetConfigData() + end + self.knownWidgets[name].active = false + if (widget.Shutdown) then + widget:Shutdown() + end + ArrayRemove(self.widgets, widget) + self:RemoveWidgetGlobals(widget) + self.actionHandler:RemoveWidgetActions(widget) + for _,listname in ipairs(callInLists) do + ArrayRemove(self[listname..'List'], widget) + end + self:UpdateCallIns() + + if (widget.whInfo.basename == SELECTOR_BASENAME) then + Spring.SendCommands({"luaui update"}) + end +end + + +-------------------------------------------------------------------------------- + +function widgetHandler:UpdateCallIn(name) + local listName = name .. 'List' + if ((name == 'Update') or + (name == 'DrawScreen')) then + return + end + + if ((#self[listName] > 0) or + (not flexCallInMap[name]) or + ((name == 'GotChatMsg') and actionHandler.HaveChatAction()) or + ((name == 'RecvFromSynced'))) then + -- always assign these call-ins + local selffunc = self[name] + _G[name] = function(...) + return selffunc(self, ...) + end + else + _G[name] = nil + end + Script.UpdateCallIn(name) +end + + +function widgetHandler:UpdateWidgetCallIn(name, w) + local listName = name .. 'List' + local ciList = self[listName] + if (ciList) then + local func = w[name] + if (type(func) == 'function') then + ArrayInsert(ciList, func, w) + else + ArrayRemove(ciList, w) + end + self:UpdateCallIn(name) + else + Spring.Log(section, LOG.ERROR, 'UpdateWidgetCallIn: bad name: ' .. name) + end +end + + +function widgetHandler:RemoveWidgetCallIn(name, w) + local listName = name .. 'List' + local ciList = self[listName] + if (ciList) then + ArrayRemove(ciList, w) + self:UpdateCallIn(name) + else + Spring.Log(section, LOG.ERROR, 'RemoveWidgetCallIn: bad name: ' .. name) + end +end + + +function widgetHandler:UpdateCallIns() + for _,name in ipairs(callInLists) do + self:UpdateCallIn(name) + end +end + + +function widgetHandler:SelectorActive() + for _,w in ipairs(self.widgets) do + if (w.whInfo.basename == SELECTOR_BASENAME) then + return true + end + end + return false +end +-------------------------------------------------------------------------------- + +function widgetHandler:EnableWidget(name) + local ki = self.knownWidgets[name] + if (not ki) then + Spring.Log(section, LOG.ERROR, "EnableWidget(), could not find widget: " .. tostring(name)) + return false + end + if (not ki.active) then + Spring.Log(section, LOG.INFO, 'Loading: '..ki.filename) + local order = widgetHandler.orderList[name] + if (not order or (order <= 0)) then + self.orderList[name] = 1 + end + local w = self:LoadWidget(ki.filename) + if (not w) then return false end + self:InsertWidget(w) + self:SaveConfigData() + end + + if (not self:SelectorActive()) then + Spring.SendCommands({"luaui update"}) + end + + return true +end + + +function widgetHandler:DisableWidget(name) + local ki = self.knownWidgets[name] + if (not ki) then + Spring.Log(section, LOG.ERROR, "DisableWidget(), could not find widget: " .. tostring(name)) + return false + end + if (ki.active) then + local w = self:FindWidget(name) + if (not w) then return false end + Spring.Log(section, LOG.INFO, 'Removed: '..ki.filename) + self:RemoveWidget(w) -- deactivate + self.orderList[name] = 0 -- disable + self:SaveConfigData() + end + + if (not self:SelectorActive()) then + Spring.SendCommands({"luaui update"}) + end + + return true +end + + +function widgetHandler:ToggleWidget(name) + local ki = self.knownWidgets[name] + if (not ki) then + Spring.Log(section, LOG.ERROR, "ToggleWidget(), could not find widget: " .. tostring(name)) + return + end + if (ki.active) then + return self:DisableWidget(name) + elseif (self.orderList[name] <= 0) then + return self:EnableWidget(name) + else + -- the widget is not active, but enabled; disable it + self.orderList[name] = 0 + self:SaveConfigData() + end + return true +end + + +-------------------------------------------------------------------------------- + +local function FindWidgetIndex(t, w) + for k,v in ipairs(t) do + if (v == w) then + return k + end + end + return nil +end + + +local function FindLowestIndex(t, i, layer) + for x = (i - 1), 1, -1 do + if (t[x].whInfo.layer < layer) then + return x + 1 + end + end + return 1 +end + + +function widgetHandler:RaiseWidget(widget) + if (widget == nil) then + return + end + local function Raise(t, f, w) + if (f == nil) then return end + local i = FindWidgetIndex(t, w) + if (i == nil) then return end + local n = FindLowestIndex(t, i, w.whInfo.layer) + if (n and (n < i)) then + table.remove(t, i) + table.insert(t, n, w) + end + end + Raise(self.widgets, true, widget) + for _,listname in ipairs(callInLists) do + Raise(self[listname..'List'], widget[listname], widget) + end +end + + +local function FindHighestIndex(t, i, layer) + local ts = #t + for x = (i + 1),ts do + if (t[x].whInfo.layer > layer) then + return (x - 1) + end + end + return (ts + 1) +end + + +function widgetHandler:LowerWidget(widget) + if (widget == nil) then + return + end + local function Lower(t, f, w) + if (f == nil) then return end + local i = FindWidgetIndex(t, w) + if (i == nil) then return end + local n = FindHighestIndex(t, i, w.whInfo.layer) + if (n and (n > i)) then + table.insert(t, n, w) + table.remove(t, i) + end + end + Lower(self.widgets, true, widget) + for _,listname in ipairs(callInLists) do + Lower(self[listname..'List'], widget[listname], widget) + end +end + + +function widgetHandler:FindWidget(name) + if (type(name) ~= 'string') then + return nil + end + for k,v in ipairs(self.widgets) do + if (name == v.whInfo.name) then + return v,k + end + end + return nil +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Global var/func management +-- + +function widgetHandler:RegisterGlobal(owner, name, value) + if ((name == nil) or + (_G[name]) or + (self.globals[name]) or + (CallInsMap[name])) then + return false + end + _G[name] = value + self.globals[name] = owner + return true +end + + +function widgetHandler:DeregisterGlobal(owner, name) + if (name == nil) then + return false + end + _G[name] = nil + self.globals[name] = nil + return true +end + + +function widgetHandler:SetGlobal(owner, name, value) + if ((name == nil) or (self.globals[name] ~= owner)) then + return false + end + _G[name] = value + return true +end + + +function widgetHandler:RemoveWidgetGlobals(owner) + local count = 0 + for name, o in pairs(self.globals) do + if (o == owner) then + _G[name] = nil + self.globals[name] = nil + count = count + 1 + end + end + return count +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- Helper facilities +-- + +local hourTimer = 0 + + +function widgetHandler:GetHourTimer() + return hourTimer +end + + +function widgetHandler:GetViewSizes() + return self.xViewSize, self.yViewSize +end + + +function widgetHandler:ForceLayout() + forceLayout = true -- in main.lua +end + + +function widgetHandler:ConfigLayoutHandler(data) + ConfigLayoutHandler(data) +end + + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- +-- The call-in distribution routines +-- + +function widgetHandler:Shutdown() + self:SaveConfigData() + for _,w in ipairs(self.ShutdownList) do + w:Shutdown() + end + return +end + +function widgetHandler:Update() + local deltaTime = Spring.GetLastUpdateSeconds() + -- update the hour timer + hourTimer = (hourTimer + deltaTime) % 3600.0 + for _,w in ipairs(self.UpdateList) do + w:Update(deltaTime) + end + return +end + + +function widgetHandler:ConfigureLayout(command) + if (command == 'tweakgui') then + self.tweakKeys = {} + self.tweakMode = true + Spring.Log(section, LOG.INFO, "LuaUI TweakMode: ON") + return true + elseif (command == 'reconf') then + self:SendConfigData() + return true + elseif (command == 'selector') then + if (self:SelectorActive()) then + return true -- there can only be one + end + local sw = self:LoadWidget(LUAUI_DIRNAME .. SELECTOR_BASENAME) + self:InsertWidget(sw) + self:RaiseWidget(sw) + return true + elseif (string.find(command, 'togglewidget') == 1) then + self:ToggleWidget(string.sub(command, 14)) + return true + elseif (string.find(command, 'enablewidget') == 1) then + self:EnableWidget(string.sub(command, 14)) + return true + elseif (string.find(command, 'disablewidget') == 1) then + self:DisableWidget(string.sub(command, 15)) + return true + end + + if (self.actionHandler:TextAction(command)) then + return true + end + + for _,w in ipairs(self.TextCommandList) do + if (w:TextCommand(command)) then + return true + end + end + return false +end + + +function widgetHandler:CommandNotify(id, params, options) + for _,w in ipairs(self.CommandNotifyList) do + if (w:CommandNotify(id, params, options)) then + return true + end + end + return false +end + + +function widgetHandler:AddConsoleLine(msg, priority) + for _,w in ipairs(self.AddConsoleLineList) do + w:AddConsoleLine(msg, priority) + end + return +end + + +function widgetHandler:GroupChanged(groupID) + for _,w in ipairs(self.GroupChangedList) do + w:GroupChanged(groupID) + end + return +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 + w:CommandsChanged() + end + self.inCommandsChanged = false + return +end + + +-------------------------------------------------------------------------------- +-- +-- Drawing call-ins +-- + + +-- generates ViewResize() calls for the widgets +function widgetHandler:SetViewSize(vsx, vsy) + self.xViewSize = vsx + self.yViewSize = vsy + if ((self.xViewSizeOld ~= vsx) or + (self.yViewSizeOld ~= vsy)) then + widgetHandler:ViewResize(vsx, vsy) + self.xViewSizeOld = vsx + self.yViewSizeOld = vsy + end +end + + +function widgetHandler:ViewResize(vsx, vsy) + if (type(vsx) == 'table') then + vsy = vsx.viewSizeY + vsx = vsx.viewSizeX + print('real ViewResize') -- FIXME + end + + for _,w in ipairs(self.ViewResizeList) do + w:ViewResize(vsx, vsy) + end + return +end + + +function widgetHandler:DrawScreen() + if (self.tweakMode) then + gl.Color(0, 0, 0, 0.5) + local sx, sy = self.xViewSize, self.yViewSize + gl.Shape(GL.QUADS, { + {v = { 0, 0 }}, {v = { sx, 0 }}, {v = { sx, sy }}, {v = { 0, sy }} + }) + gl.Color(1, 1, 1) + end + for _,w in ripairs(self.DrawScreenList) do + w:DrawScreen() + if (self.tweakMode and w.TweakDrawScreen) then + w:TweakDrawScreen() + end + end + return +end + + +function widgetHandler:DrawGenesis() + for _,w in ripairs(self.DrawGenesisList) do + w:DrawGenesis() + end + return +end + + +function widgetHandler:DrawWorld() + for _,w in ripairs(self.DrawWorldList) do + w:DrawWorld() + end + return +end + + +function widgetHandler:DrawWorldPreUnit() + for _,w in ripairs(self.DrawWorldPreUnitList) do + w:DrawWorldPreUnit() + end + return +end + + +function widgetHandler:DrawWorldShadow() + for _,w in ripairs(self.DrawWorldShadowList) do + w:DrawWorldShadow() + end + return +end + + +function widgetHandler:DrawWorldReflection() + for _,w in ripairs(self.DrawWorldReflectionList) do + w:DrawWorldReflection() + end + return +end + + +function widgetHandler:DrawWorldRefraction() + for _,w in ripairs(self.DrawWorldRefractionList) do + w:DrawWorldRefraction() + end + return +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) + end + return +end + + +function widgetHandler:DrawInMiniMap(xSize, ySize) + for _,w in ripairs(self.DrawInMiniMapList) do + w:DrawInMiniMap(xSize, ySize) + end + return +end + +function widgetHandler:SunChanged() + for _,w in ripairs(self.SunChangedList) do + w:SunChanged() + end + return +end + + +-------------------------------------------------------------------------------- +-- +-- Keyboard call-ins +-- + +function widgetHandler:KeyPress(key, mods, isRepeat, label, unicode) + if (self.tweakMode) then + self.tweakKeys[key] = true + local mo = self.mouseOwner + if (mo and mo.TweakKeyPress) then + mo:TweakKeyPress(key, mods, isRepeat, label, unicode) + end + return true + end + + if (self.actionHandler:KeyAction(true, key, mods, isRepeat)) then + return true + end + + for _,w in ipairs(self.KeyPressList) do + if (w:KeyPress(key, mods, isRepeat, label, unicode)) then + return true + end + end + return false +end + + +function widgetHandler:KeyRelease(key, mods, label, unicode) + if (self.tweakMode and self.tweakKeys[key] ~= nil) then + local mo = self.mouseOwner + if (mo and mo.TweakKeyRelease) then + mo:TweakKeyRelease(key, mods, label, unicode) + elseif (key == KEYSYMS.ESCAPE) then + Spring.Log(section, LOG.INFO, "LuaUI TweakMode: OFF") + self.tweakMode = false + end + return true + end + + if (self.actionHandler:KeyAction(false, key, mods, false)) then + return true + end + + for _,w in ipairs(self.KeyReleaseList) do + if (w:KeyRelease(key, mods, label, unicode)) then + return true + end + end + return false +end + +function widgetHandler:TextInput(utf8, ...) + if (self.tweakMode) then + return true + end + + for _,w in ipairs(self.TextInputList) do + if (w:TextInput(utf8, ...)) then + return true + end + end + return false +end + +-------------------------------------------------------------------------------- +-- +-- Mouse call-ins +-- + +-- local helper (not a real call-in) +function widgetHandler:WidgetAt(x, y) + if (not self.tweakMode) then + for _,w in ipairs(self.IsAboveList) do + if (w:IsAbove(x, y)) then + return w + end + end + else + for _,w in ipairs(self.TweakIsAboveList) do + if (w:TweakIsAbove(x, y)) then + return w + end + end + end + return nil +end + + +function widgetHandler:MousePress(x, y, button) + local mo = self.mouseOwner + if (not self.tweakMode) then + if (mo) then + mo:MousePress(x, y, button) + return true -- already have an active press + end + for _,w in ipairs(self.MousePressList) do + if (w:MousePress(x, y, button)) then + if (not mo) then + self.mouseOwner = w + end + return true + end + end + return false + else + if (mo) then + mo:TweakMousePress(x, y, button) + return true -- already have an active press + end + for _,w in ipairs(self.TweakMousePressList) do + if (w:TweakMousePress(x, y, button)) then + self.mouseOwner = w + return true + end + end + return true -- always grab the mouse + end +end + + +function widgetHandler:MouseMove(x, y, dx, dy, button) + local mo = self.mouseOwner + if (not self.tweakMode) then + if (mo and mo.MouseMove) then + return mo:MouseMove(x, y, dx, dy, button) + end + else + if (mo and mo.TweakMouseMove) then + mo:TweakMouseMove(x, y, dx, dy, button) + end + return true + end +end + + +function widgetHandler:MouseRelease(x, y, button) + local mo = self.mouseOwner + local mx, my, lmb, mmb, rmb = Spring.GetMouseState() + if (not (lmb or mmb or rmb)) then + self.mouseOwner = nil + end + + if (not self.tweakMode) then + if (mo and mo.MouseRelease) then + return mo:MouseRelease(x, y, button) + end + return -1 + else + if (mo and mo.TweakMouseRelease) then + mo:TweakMouseRelease(x, y, button) + end + return -1 + end +end + + +function widgetHandler:MouseWheel(up, value) + if (not self.tweakMode) then + for _,w in ipairs(self.MouseWheelList) do + if (w:MouseWheel(up, value)) then + return true + end + end + return false + else + for _,w in ipairs(self.TweakMouseWheelList) do + if (w:TweakMouseWheel(up, value)) then + return true + end + end + return false -- FIXME: always grab in tweakmode? + end +end + +function widgetHandler:JoyAxis(axis, value) + for _,w in ipairs(self.JoyAxisList) do + if (w:JoyAxis(axis, value)) then + return true + end + end + return false +end + +function widgetHandler:JoyHat(hat, value) + for _,w in ipairs(self.JoyHatList) do + if (w:JoyHat(hat, value)) then + return true + end + end + return false +end + +function widgetHandler:JoyButtonDown(button, state) + for _,w in ipairs(self.JoyButtonDownList) do + if (w:JoyButtonDown(button, state)) then + return true + end + end + return false +end + +function widgetHandler:JoyButtonUp(button, state) + for _,w in ipairs(self.JoyButtonUpList) do + if (w:JoyButtonUp(button, state)) then + return true + end + end + return false +end + +function widgetHandler:IsAbove(x, y) + if (self.tweakMode) then + return true + end + return (widgetHandler:WidgetAt(x, y) ~= nil) +end + + +function widgetHandler:GetTooltip(x, y) + if (not self.tweakMode) then + for _,w in ipairs(self.GetTooltipList) do + if (w:IsAbove(x, y)) then + local tip = w:GetTooltip(x, y) + if ((type(tip) == 'string') and (#tip > 0)) then + return tip + end + end + end + return "" + else + for _,w in ipairs(self.TweakGetTooltipList) do + if (w:TweakIsAbove(x, y)) then + local tip = w:TweakGetTooltip(x, y) or '' + if ((type(tip) == 'string') and (#tip > 0)) then + return tip + end + end + end + return "Tweak Mode -- hit ESCAPE to cancel" + end +end + + +-------------------------------------------------------------------------------- +-- +-- Game call-ins +-- + +function widgetHandler:GamePreload() + for _,w in ipairs(self.GamePreloadList) do + w:GamePreload() + end + return +end + +function widgetHandler:GameStart() + for _,w in ipairs(self.GameStartList) do + w:GameStart() + end + return +end + +function widgetHandler:GameOver() + for _,w in ipairs(self.GameOverList) do + w:GameOver() + end + return +end + + +function widgetHandler:GamePaused(playerID, paused) + for _,w in ipairs(self.GamePausedList) do + w:GamePaused(playerID, paused) + end + return +end + + +function widgetHandler:TeamDied(teamID) + for _,w in ipairs(self.TeamDiedList) do + w:TeamDied(teamID) + end + return +end + + +function widgetHandler:TeamChanged(teamID) + for _,w in ipairs(self.TeamChangedList) do + w:TeamChanged(teamID) + end + return +end + + +function widgetHandler:PlayerChanged(playerID) + for _,w in ipairs(self.PlayerChangedList) do + w:PlayerChanged(playerID) + end + return +end + + +function widgetHandler:PlayerAdded(playerID) + for _,w in ipairs(self.PlayerAddedList) do + w:PlayerAdded(playerID) + end + return +end + + +function widgetHandler:PlayerRemoved(playerID, reason) + for _,w in ipairs(self.PlayerRemovedList) do + w:PlayerRemoved(playerID, reason) + end + return +end + + +function widgetHandler:GameFrame(frameNum) + for _,w in ipairs(self.GameFrameList) do + w:GameFrame(frameNum) + end + 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 + w:ShockFront(power, dx, dy, dz) + end + return +end + +function widgetHandler:RecvSkirmishAIMessage(aiTeam, dataStr) + for _,w in ipairs(self.RecvSkirmishAIMessageList) do + local dataRet = w:RecvSkirmishAIMessage(aiTeam, dataStr) + if (dataRet) then + return dataRet + end + end +end + +function widgetHandler:WorldTooltip(ttType, ...) + for _,w in ipairs(self.WorldTooltipList) do + local tt = w:WorldTooltip(ttType, ...) + if ((type(tt) == 'string') and (#tt > 0)) then + return tt + end + end + return +end + + +function widgetHandler:MapDrawCmd(playerID, cmdType, px, py, pz, ...) + local retval = false + for _,w in ipairs(self.MapDrawCmdList) do + local takeEvent = w:MapDrawCmd(playerID, cmdType, px, py, pz, ...) + if (takeEvent) then + retval = true + end + end + return retval +end + + +function widgetHandler:GameSetup(state, ready, playerStates) + for _,w in ipairs(self.GameSetupList) do + local success, newReady = w:GameSetup(state, ready, playerStates) + if (success) then + return true, newReady + end + end + return false +end + + +function widgetHandler:DefaultCommand(...) + for _,w in ripairs(self.DefaultCommandList) do + local result = w:DefaultCommand(...) + if (type(result) == 'number') then + return result + end + end + return nil -- not a number, use the default engine command +end + + +-------------------------------------------------------------------------------- +-- +-- Unit call-ins +-- + +function widgetHandler:UnitCreated(unitID, unitDefID, unitTeam, builderID) + for _,w in ipairs(self.UnitCreatedList) do + w:UnitCreated(unitID, unitDefID, unitTeam, builderID) + end + return +end + + +function widgetHandler:UnitFinished(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitFinishedList) do + w:UnitFinished(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitFromFactory(unitID, unitDefID, unitTeam, + factID, factDefID, userOrders) + for _,w in ipairs(self.UnitFromFactoryList) do + w:UnitFromFactory(unitID, unitDefID, unitTeam, + factID, factDefID, userOrders) + end + return +end + + +function widgetHandler:UnitReverseBuilt(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitReverseBuiltList) do + w:UnitReverseBuilt(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitDestroyed(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitDestroyedList) do + w:UnitDestroyed(unitID, unitDefID, unitTeam) + end + return +end + +function widgetHandler:RenderUnitDestroyed(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.RenderUnitDestroyedList) do + w:RenderUnitDestroyed(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitTaken(unitID, unitDefID, unitTeam, newTeam) + for _,w in ipairs(self.UnitTakenList) do + w:UnitTaken(unitID, unitDefID, unitTeam, newTeam) + end + return +end + + +function widgetHandler:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) + for _,w in ipairs(self.UnitGivenList) do + w:UnitGiven(unitID, unitDefID, unitTeam, oldTeam) + end + return +end + + +function widgetHandler:UnitIdle(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitIdleList) do + w:UnitIdle(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitCommand(unitID, unitDefID, unitTeam, cmdId, cmdParams, cmdOpts, cmdTag) + for _,w in ipairs(self.UnitCommandList) do + w:UnitCommand(unitID, unitDefID, unitTeam, cmdId, cmdParams, cmdOpts, cmdTag) + end + return +end + + +function widgetHandler:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) + for _,w in ipairs(self.UnitCmdDoneList) do + w:UnitCmdDone(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOpts, cmdTag) + end + return +end + + +function widgetHandler:UnitDamaged(unitID, unitDefID, unitTeam, + damage, paralyzer) + for _,w in ipairs(self.UnitDamagedList) do + w:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer) + end + return +end + +function widgetHandler:UnitStunned(unitID, unitDefID, unitTeam, stunned) + for _,w in ipairs(self.UnitStunnedList) do + w:UnitStunned(unitID, unitDefID, unitTeam, stunned) + end + return +end + + +function widgetHandler:UnitEnteredRadar(unitID, unitTeam) + for _,w in ipairs(self.UnitEnteredRadarList) do + w:UnitEnteredRadar(unitID, unitTeam) + end + return +end + + +function widgetHandler:UnitEnteredLos(unitID, unitTeam) + for _,w in ipairs(self.UnitEnteredLosList) do + w:UnitEnteredLos(unitID, unitTeam) + end + return +end + + +function widgetHandler:UnitLeftRadar(unitID, unitTeam) + for _,w in ipairs(self.UnitLeftRadarList) do + w:UnitLeftRadar(unitID, unitTeam) + end + return +end + + +function widgetHandler:UnitLeftLos(unitID, unitTeam) + for _,w in ipairs(self.UnitLeftLosList) do + w:UnitLeftLos(unitID, unitTeam) + end + return +end + + +function widgetHandler:UnitEnteredWater(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitEnteredWaterList) do + w:UnitEnteredWater(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitEnteredAir(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitEnteredAirList) do + w:UnitEnteredAir(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitLeftWater(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitLeftWaterList) do + w:UnitLeftWater(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitLeftAir(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitLeftAirList) do + w:UnitLeftAir(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitSeismicPing(x, y, z, strength) + for _,w in ipairs(self.UnitSeismicPingList) do + w:UnitSeismicPing(x, y, z, strength) + end + return +end + + +function widgetHandler:UnitLoaded(unitID, unitDefID, unitTeam, + transportID, transportTeam) + for _,w in ipairs(self.UnitLoadedList) do + w:UnitLoaded(unitID, unitDefID, unitTeam, + transportID, transportTeam) + end + return +end + + +function widgetHandler:UnitUnloaded(unitID, unitDefID, unitTeam, + transportID, transportTeam) + for _,w in ipairs(self.UnitUnloadedList) do + w:UnitUnloaded(unitID, unitDefID, unitTeam, + transportID, transportTeam) + end + return +end + + +function widgetHandler:UnitCloaked(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitCloakedList) do + w:UnitCloaked(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitDecloaked(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitDecloakedList) do + w:UnitDecloaked(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:UnitMoveFailed(unitID, unitDefID, unitTeam) + for _,w in ipairs(self.UnitMoveFailedList) do + w:UnitMoveFailed(unitID, unitDefID, unitTeam) + end + return +end + + +function widgetHandler:RecvLuaMsg(msg, playerID) + local retval = false + for _,w in ipairs(self.RecvLuaMsgList) do + if (w:RecvLuaMsg(msg, playerID)) then + retval = true + end + end + return retval -- FIXME -- another actionHandler type? +end + + +function widgetHandler:RecvFromSynced(...) + local retval = false + if (self.actionHandler:RecvFromSynced(...)) then + retval = true + end + for _,w in ipairs(self.RecvFromSyncedList) do + if (w:RecvFromSynced(...)) then + retval = true + end + end + return retval +end + + +function widgetHandler:StockpileChanged(unitID, unitDefID, unitTeam, + weaponNum, oldCount, newCount) + for _,w in ipairs(self.StockpileChangedList) do + w:StockpileChanged(unitID, unitDefID, unitTeam, + weaponNum, oldCount, newCount) + end + return +end + +-------------------------------------------------------------------------------- +-- +-- Download call-ins +-- + +function widgetHandler:DownloadStarted(id) + for _,w in ipairs(self.DownloadStartedList) do + w:DownloadStarted(id) + end +end + +function widgetHandler:DownloadQueued(id) + for _,w in ipairs(self.DownloadQueuedList) do + w:DownloadQueued(id) + end +end + +function widgetHandler:DownloadFinished(id) + for _,w in ipairs(self.DownloadFinishedList) do + w:DownloadFinished(id) + end +end + +function widgetHandler:DownloadFailed(id, errorid) + for _,w in ipairs(self.DownloadFailedList) do + w:DownloadFailed(id, errorid) + end +end + +function widgetHandler:DownloadProgress(id, downloaded, total) + for _,w in ipairs(self.DownloadProgressList) do + w:DownloadProgress(id, downloaded, total) + end +end + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +widgetHandler:Initialize() + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/ModOptions.lua b/ModOptions.lua index 3ccd1da2d..10402d73d 100644 --- a/ModOptions.lua +++ b/ModOptions.lua @@ -2,13 +2,13 @@ local options= { { key = 'startingresources', name = 'Starting Resources', - desc = 'Sets storage and amount of resources that players will start with', + desc = 'Sets the storage and amount of resources with which each player will start', type = 'section', }, { key = 'startmetal', name = 'Starting Metal', - desc = 'Determines amount of metal and metal storage that each player will start with', + desc = 'Determines the amount of metal and metal storage with which each player will start', type = 'number', section= 'startingresources', def = 100, @@ -20,74 +20,388 @@ local options= { { key = 'startenergy', name = 'Starting Energy', - desc = 'Determines amount of energy and energy storage that each player will start with', + desc = 'Determines the amount of energy and energy storage with which each player will start', type = 'number', section= 'startingresources', - def = 250, + def = 100, min = 0, max = 1000, step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + +-- Shard AI Options + { + key = 'aioptions', + name = 'DAI (AI Opponent) Options', + desc = 'Allows you to adjust ShardLua settings', + type = 'section', + }, + { + key = 'aidebug', + name = 'AI is spamming chat with debug values', + desc = 'AI is spamming chat with debug values', + type="list", + def="disabled", + section= "aioptions", + items={ + {key="disabled", name="Disabled", desc="Clean Chat"}, + {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 { - key = 'gameplayoptions', - name = 'Gameplay Options', - desc = 'Sets storage and amount of resources that players will start with', + key = 'resourcing', + name = 'Resourcing Options', + desc = 'Allows you to adjust how metal income is handled and how it is distributed', type = 'section', }, { - key="gameplayspeed", - name="Gameplay Speed", - desc="Modifies buildtimes based upon cost", + 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="faster", - section="gameplayoptions", + def="enabled", + section= "resourcing", + items={ + {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 = '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, + 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="normal", name="Normal", desc="Unit buildtimes are equal to their metal cost"}, - {key="fast", name="Fast", desc="Unit buildtimes are equal to their metal cost divided by 2"}, - {key="faster", name="Faster", desc="Unit buildtimes are equal to their metal cost divided by 4"}, - {key="fastest", name="Fastest", desc="All units have a buildtime of 5 seconds"}, + {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', + 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.', + type="list", + def="enabled", + section= "resourcing", + items={ + {key="disabled", name="Disabled", desc="Turn off the automatic metal income"}, + {key="enabled", name="Enabled", desc="Metal income is automatic and graduates as the game goes along."}, + } + }, + { + key = 'basicincome', + name = 'Basic Metal Income Amount', + desc = 'Determines the amount of metal income you start with per second.', + 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 = 'basicincomeinterval', + name = 'Basic Metal Income Increase Interval', + desc = 'Determines how often your basic metal income is increased.', + type = 'number', + section= 'resourcing', + def = 2.5, + min = 0.5, + max = 5, + 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 = 10, + min = 0, + max = 30, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + + { + key = 'supplyoptions', + name = 'Supply Options', + desc = 'Allows you to set options that effect Supply', + type = 'section', + }, + { + key = 'supplycap', + name = 'Maximum Army Supply', + desc = 'Determines the maximum army supply that is allowed.', + type = 'number', + section= 'supplyoptions', + def = 1000000, + min = 50, + max = 1000000, + step = 50, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'intrinsicsupply', + name = 'Intrinsic Army Supply', + desc = 'How much supply is available from the beginning of the game without needing supply depots?', + type = 'number', + section= 'supplyoptions', + 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="aidifficulty", - name="AI Difficulty", - desc="Modifies how much Shard cheats", - type="list", - def="veryeasy", - section="gameplayoptions", + key = 'gameplayoptions', + name = 'Gameplay 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="veryeasy", name="Very Easy", desc="AI gets a gift of 5 metal every 5 seconds and a static 5 energy income."}, - {key="easy", name="Easy", desc="AI gets a gift of 10 metal every 5 seconds and a static 10 energy income."}, - {key="medium", name="Medium", desc="AI gets a gift of 25 metal every 5 seconds and a static 25 energy income."}, - {key="hard", name="Hard", desc="AI gets a gift of 50 metal every 5 seconds and a static 50 energy income."}, - {key="insane", name="Insane", desc="AI gets a gift of 100 metal every 5 seconds and a static 100 energy income."}, + {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="scoremode", - name="Scoring Mode (Control Victory Points)", - desc="Defines how the game is played", + 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", + desc="What it takes to eliminate a team", type="list", - def="countdown", + def="com", section="gameplayoptions", items={ - {key="disabled", name="Disabled", desc="Disable Control Points as a victory condition."}, - {key="countdown", name="Countdown", desc="A Control Point decreases all opponents' scores, zero means defeat."}, - {key="tugowar", name="Tug of War", desc="A Control Point steals enemy score, zero means defeat."}, - {key="multidomination", name="Domination", desc="Holding all Control Points will grant 1000 score, first to reach the score limit wins."}, + {key="neverend", name="None", desc="Teams are never eliminated"}, + {key="com", name="Kill all enemy Overseers", desc="When a team has no Overseers left, it loses"}, + {key="killall", name="Kill everything", desc="Every last unit must be eliminated, no exceptions!"}, } }, + { + key = "shareddynamicalliancevictory", + name = "Dynamic Alliance Victory?", + desc = "Should dynamic alliance teams share in a victory, or should they be forced to turn on one another?", + type = "bool", + def = true, + section= "gameplayoptions", + }, + { + key = 'unitheat', + name = 'Unit Heat Amount', + desc = 'How much heat does each unit generate when it moves through an area?', + type = 'number', + section= 'gameplayoptions', + def = 42, + min = 0, + max = 100, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + +-- Control Victory Options { key = 'controlvictoryoptions', name = 'Control Victory Options', desc = 'Allows you to control at a granular level the individual options for Control Point Victory', type = 'section', }, - + { + key="scoremode", + name="Scoring Mode (Control Victory Points)", + desc="Defines how the game is played", + type="list", + def="disabled", + section="controlvictoryoptions", + items={ + {key="disabled", name="Disabled", desc="Disable Control Points as a victory condition."}, + {key="countdown", name="Countdown", desc="A Control Point decreases all opponents' scores, zero means defeat."}, + {key="tugofwar", name="Tug of War", desc="A Control Point steals enemy score, zero means defeat."}, + {key="domination", name="Domination", desc="Holding all Control Points will grant 1000 score, first to reach the score limit wins."}, + } + }, { key = 'limitscore', name = 'Total Score', @@ -100,6 +414,33 @@ local options= { step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + { + key = "numberofcontrolpoints", + name = "Set number of Control Points on the map", + desc = "Sets the number of control points on the map and scales the total score amount to match. Has no effect if Preset map configs are enabled.", + section= "controlvictoryoptions", + type="list", + def="7", + section= "controlvictoryoptions", + items={ + {key="7", name="7", desc=""}, + {key="13", name="13", desc=""}, + {key="19", name="19", desc=""}, + {key="25", name="25", desc=""}, + } + }, + { + key = "usemapconfig", + name = "Use preset map-specific Control Point locations?", + desc = "Should the control point config for this map be used instead of autogenerated control points?", + type="list", + def="disabled", + section= "controlvictoryoptions", + items={ + {key="disabled", name="Disabled", desc="This will tell the game to use autogenerated control points."}, + {key="enabled", name="Enabled", desc="This will tell the game to use preset map control points (Set via map config)."}, + } + }, { key = 'captureradius', name = 'Capture Radius', @@ -127,13 +468,13 @@ local options= { { key = 'capturebonus', name = 'Capture Bonus', - desc = 'How much faster capture takes place by adding more units.', + desc = 'Percentage of how much faster capture takes place by adding more units.', type = 'number', section= 'controlvictoryoptions', - def = 0.5, - min = 0, - max = 10, - step = 0.1, -- quantization is aligned to the def value + def = 5, + min = 1, + max = 100, + step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, { @@ -142,23 +483,47 @@ local options= { desc = 'Speed multiplier for neutralizing an enemy point.', type = 'number', section= 'controlvictoryoptions', - def = 3, - min = 0.1, - max = 10, - step = 0.1, -- quantization is aligned to the def value + def = 2, + min = 1, + max = 3, + step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, { key = 'starttime', name = 'Start Time', - desc = 'The time when capturing can start.', + desc = 'Number of seconds until control points can be captured.', type = 'number', section= 'controlvictoryoptions', - def = 0, + def = 180, min = 0, max = 300, step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization + }, + { + key = 'metalperpoint', + name = 'Metal given to each player per captured point', + desc = 'Each player on an allyteam that has captured a point will receive this amount of resources per point captured per second', + type = 'number', + section= 'controlvictoryoptions', + def = 0, + min = 0, + max = 20, + step = 0.1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'energyperpoint', + name = 'Energy given to each player per captured point', + desc = 'Each player on an allyteam that has captured a point will receive this amount of resources per point captured per second', + type = 'number', + section= 'controlvictoryoptions', + def = 0, + min = 0, + max = 20, + step = 0.1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization }, { key = 'dominationscoretime', @@ -172,6 +537,31 @@ local options= { step = 1, -- quantization is aligned to the def value -- (step <= 0) means that there is no quantization }, + { + key = 'tugofwarmodifier', + name = 'Tug of War Modifier', + desc = 'The amount of score transfered between opponents when points are captured is multiplied by this amount.', + type = 'number', + section= 'controlvictoryoptions', + def = 2, + min = 0, + max = 6, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, + { + key = 'dominationscore', + name = 'Score awarded for Domination', + desc = 'The amount of score awarded when you have scored a domination.', + type = 'number', + section= 'controlvictoryoptions', + def = 1000, + min = 500, + max = 1000, + step = 1, -- quantization is aligned to the def value + -- (step <= 0) means that there is no quantization + }, +-- End Control Victory Options } 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 f488e9946..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,75 +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 - --- Doing it with a table fail: http://pastebin.com/SxPpP44E +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 -------------------------------------------------------------------------------- --------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- 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 3c2ea2ec7..8e11e5230 100644 --- a/ModelMaterials/Shaders/default.lua +++ b/ModelMaterials/Shaders/default.lua @@ -1,365 +1,390 @@ -local devCompat = Spring.Utilities.IsCurrentVersionNewerThan(100, 0) +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 sunDiffuse; + uniform vec3 sunAmbient; + uniform vec3 etcLoc; + uniform int simFrame; + + #ifdef flashlights + out float selfIllumMod; + #endif + //uniform float frameLoc; + + //The api_custom_unit_shaders supplies this definition: + #ifdef use_shadows + uniform mat4 shadowMatrix; + uniform vec4 shadowParams; + #endif + + #ifdef use_vertex_ao + out float aoTerm; + #endif + + out vec3 viewDir; + + #ifdef use_normalmapping + out mat3 tbnMatrix; + #else + 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 + vec3 tangent = gl_MultiTexCoord5.xyz; + vec3 bitangent = gl_MultiTexCoord6.xyz; + tbnMatrix = gl_NormalMatrix * mat3(tangent, bitangent, normal); + #else + normalv = gl_NormalMatrix * normal; + #endif + + worldPos = gl_ModelViewMatrix * vertex; + gl_Position = gl_ProjectionMatrix * (camera * worldPos); + viewDir = cameraPos - worldPos.xyz; + + #ifdef use_shadows + 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 + 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 + #endif + + #ifndef use_treadoffset + tex_coord0.st = gl_MultiTexCoord0.st; + #endif + + #ifdef flashlights + // 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); + + %%VERTEX_POST_TRANSFORM%% + } +]], + + +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; //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; + #endif + uniform float shadowDensity; + + #ifdef use_vertex_ao + in float aoTerm; + #endif + + uniform vec4 teamColor; + in vec3 viewDir; + //varying float fogFactor; + + #ifdef flashlights + in float selfIllumMod; + #endif + + #ifdef use_normalmapping + in mat3 tbnMatrix; + uniform sampler2D normalMap; + #define normalv tbnMatrix[2] + #else + in vec3 normalv; + #endif + + 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); + } -if devCompat then +#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); -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; - #ifdef use_shadows - uniform mat4 shadowMatrix; - varying vec4 shadowpos; - #ifndef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - #endif - - varying vec3 cameraDir; - //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; - - //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; - - #ifdef use_shadows - #ifdef use_perspective_correct_shadows - uniform vec4 shadowParams; - #endif - varying vec4 shadowpos; - uniform sampler2DShadow shadowTex; - uniform float shadowDensity; - #endif - - uniform vec4 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 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - - 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 = 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 = 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")}, - }, -} + #if defined(SHADOW_SAMPLES) && (SHADOW_SAMPLES > 1) -else - -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; - #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; - - #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 extraColor = texture2D(textureS3o2, gl_TexCoord[0].st); - - 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 = 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 = 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")}, - }, -} + float rndRotAngle = NORM2SNORM(hash12(gl_FragCoord.xy)) * PI / 2.0 * SHADOW_RANDOMNESS; -end \ No newline at end of file + 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 + 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 = tex_coord0.st; + #ifdef flip_normalmap + tc.t = 1.0 - tc.t; + #endif + vec4 normaltex = texture(normalMap, tc); + vec3 nvTS = normalize(NORM2SNORM(normaltex.xyz)); + vec3 N = tbnMatrix * nvTS; + #else + vec3 N = normalize(normalv); + #endif + + 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 + + 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 = min(nShadow, gShadow); + + light = mix(sunAmbient, light, shadow); + specularColor *= shadow; + + reflection = mix(light, reflection, extraColor.g); // reflection + + #ifdef flashlights + 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 + specularColor + envcube lighting + // (reflection contains the NdotL term!) + 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; + #endif + + // debug hook + #if 0 + //outColor.rgb = vec3(normalv); + outColor.rgb = vec3(N); + #endif + + #if (deferred_mode == 0) + fragData[0] = outColor; + #else + 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, + 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/Music/Entire Album.xspf b/Music/Entire Album.xspf deleted file mode 100644 index 244bd56cd..000000000 --- a/Music/Entire Album.xspf +++ /dev/null @@ -1,634 +0,0 @@ - - - Playlist - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/defeat/429789_06___Surface.ogg - Surface - Wahnsinn - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/429789 - 361000 - - 0 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/503713_Flow.ogg - Flow - Nick Dyson - Evolution RTS Soundtrack Volume 1 - http://nickdyson09.newgrounds.com/ - - 1 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/511381_Sweet-Cold-Revenge.ogg - Sweet Cold Revenge - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - file:///C:/Users/Forboding%20Angel/AppData/Roaming/vlc/art/artistalbum/CoredxBitch/Evolution%20RTS%20Soundtrack%20Volume%201/art.jpg - - 2 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/527066_Beyond.ogg - Beyond - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - file:///C:/Users/Forboding%20Angel/AppData/Roaming/vlc/art/artistalbum/CoredxBitch/Evolution%20RTS%20Soundtrack%20Volume%201/art.jpg - - 3 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/542137_Flour.ogg - Flour - Nick Dyson - Evolution RTS Soundtrack Volume 1 - http://nickdyson09.newgrounds.com/ - - 4 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/551420_Pox.ogg - Pox - Nick Dyson - Evolution RTS Soundtrack Volume 1 - http://nickdyson09.newgrounds.com/ - - 5 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/553714_A-Pixel-is-Born.ogg - A Pixes is Born - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 6 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/553754_Lighthouse.ogg - Lighthouse - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 7 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/553873_Restarting-The-Time.ogg - Restarting the Time Machine - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 8 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Angel%20Down.ogg - Angel Down - Michael J. Powell / Ben Woods - Evolution RTS Soundtrack Volume 1 - - 9 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Byte%20Run.ogg - Byte Run - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 10 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Droum.ogg - Droum - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 11 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/EE%20Environmental%20Runs.ogg - EE Enviromental Runs - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 12 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Eastern%20Vector.ogg - Eastern Vector - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 13 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Environment%20Alpha.ogg - Environment Alpha - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 14 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Evade.ogg - Evade - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 15 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Exbioract%20Menu.ogg - Exbioract - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 16 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/GD%20Initialization.ogg - GD Initialization - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 17 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Intrusive%20Thoughts.ogg - Instrusive Thoughts - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 18 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Mysteries%20at%20Severnaya%20Industrial%209.ogg - Mysteries At Severnaya Industrial - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 19 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/Strange%20Robot.ogg - Strange Robot - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 20 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/The%20URC%20Extraction.ogg - The URC Extraction - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 21 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/peace/This%20World%20is%20Imploding.ogg - This World Is Imploding - Michael J. Powell - Evolution RTS Soundtrack Volume 1 - - 22 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/victory/450042_01___Resting_Place.ogg - Resting Place - Wahnsinn - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/450042 - - 23 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/187452_Heavy.ogg - Heavy - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 24 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/192884_new.ogg - Heavy Pt. 2 - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 25 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/256720_Better_than_Nothing.ogg - Better than Nothing - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 26 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/291507_Left_to_Rot.ogg - Left to Rot - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 27 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/297894_Fists_of_Stone.ogg - Fists of Stone - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 28 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/334346_Distant_Lands.ogg - Distant Lands - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 29 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/381879_dknew2.ogg - DK Riffs 2 - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 30 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/383176_Sacrifice___deathkllr84.ogg - Sacrifice - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 31 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/392305_deathkllr84___metalriffs.ogg - Heavy Ass Riffs - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 32 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/393018_deathkllr84___Anasasis_int.ogg - Anasasis Intro - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 33 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/393567_deathkllr84___breakdown.ogg - Breakdown - deathkllr84 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/187452 - - 34 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/493567_Torture-Arena.ogg - Torture Arena - fire118 - Evolution RTS Soundtrack Volume 1 - This track can be found at: http://www.newgrounds.com/audio/listen/380892 - - 35 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/514888_Sweet-Cold-Revenge-.ogg - Sweet Cold Revenge (Metal) - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - - 36 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/518212_No-more-sun.ogg - No More Sun - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - - 37 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/551136_Knightfall.ogg - Knightfall - Freddy Fog - Evolution RTS Soundtrack Volume 1 - http://freddyfog.newgrounds.com/ - - 38 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/551169_Execution.ogg - Execution - Freddy Fog - Evolution RTS Soundtrack Volume 1 - http://freddyfog.newgrounds.com/ - - 39 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/551170_Active-Power.ogg - Active Power - Freddy Fog - Evolution RTS Soundtrack Volume 1 - http://freddyfog.newgrounds.com/ - - 40 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/552938_Recovery.ogg - Recovery - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - - 41 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/555389_Reboot.ogg - Reboot - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 42 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/556245_Defiance-1.ogg - Defiance 1 - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 43 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/556245_Defiance-2.ogg - Defiance 2 - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 44 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/556245_Defiance-3.ogg - Defiance 3 - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 45 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/556245_Defiance-4.ogg - Defiance 4 - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 46 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/556245_Defiance-5.ogg - Defiance 5 - LunyAlex - Evolution RTS Soundtrack Volume 1 - http://lunyalex.newgrounds.com/ - - 47 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/559522_Aftershock.ogg - Aftershock - Freddy Fog - Evolution RTS Soundtrack Volume 1 - http://freddyfog.newgrounds.com/ - - 48 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/566692_Scars-of-Hate.ogg - Scars of Hate - Deadly Dare - Evolution RTS Soundtrack Volume 1 - http://deadly-dare.newgrounds.com/ - - 49 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/578554_Traitor.ogg - Traitor - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - file:///C:/Users/Forboding%20Angel/AppData/Roaming/vlc/art/artistalbum/CoredxBitch/Evolution%20RTS%20Soundtrack%20Volume%201/art.jpg - - 50 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/582016_This-Means-Death.ogg - This Means Death - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - - 51 - file-caching=300 - - - - file:///C:/Users/Forboding%20Angel/Documents/GitHub/evolution-rts/Music/war/585171_Quasar.ogg - Quasar - CoredxBitch - Evolution RTS Soundtrack Volume 1 - http://coredxbitch.newgrounds.com/ - - 52 - file-caching=300 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Music/defeat/429789_06___Surface.ogg b/Music/defeat/429789_06___Surface.ogg deleted file mode 100644 index 9a6721100..000000000 Binary files a/Music/defeat/429789_06___Surface.ogg and /dev/null differ diff --git a/Music/peace/503713_Flow.ogg b/Music/peace/503713_Flow.ogg deleted file mode 100644 index 07c90b799..000000000 Binary files a/Music/peace/503713_Flow.ogg and /dev/null differ diff --git a/Music/peace/511381_Sweet-Cold-Revenge.ogg b/Music/peace/511381_Sweet-Cold-Revenge.ogg deleted file mode 100644 index 30798e4fc..000000000 Binary files a/Music/peace/511381_Sweet-Cold-Revenge.ogg and /dev/null differ diff --git a/Music/peace/527066_Beyond.ogg b/Music/peace/527066_Beyond.ogg deleted file mode 100644 index ed8263d56..000000000 Binary files a/Music/peace/527066_Beyond.ogg and /dev/null differ diff --git a/Music/peace/542137_Flour.ogg b/Music/peace/542137_Flour.ogg deleted file mode 100644 index 34556c404..000000000 Binary files a/Music/peace/542137_Flour.ogg and /dev/null differ diff --git a/Music/peace/551420_Pox.ogg b/Music/peace/551420_Pox.ogg deleted file mode 100644 index 6846d9cd4..000000000 Binary files a/Music/peace/551420_Pox.ogg and /dev/null differ diff --git a/Music/peace/553714_A-Pixel-is-Born.ogg b/Music/peace/553714_A-Pixel-is-Born.ogg deleted file mode 100644 index 903b460d9..000000000 Binary files a/Music/peace/553714_A-Pixel-is-Born.ogg and /dev/null differ diff --git a/Music/peace/553754_Lighthouse.ogg b/Music/peace/553754_Lighthouse.ogg deleted file mode 100644 index 3a0827430..000000000 Binary files a/Music/peace/553754_Lighthouse.ogg and /dev/null differ diff --git a/Music/peace/553873_Restarting-The-Time.ogg b/Music/peace/553873_Restarting-The-Time.ogg deleted file mode 100644 index 0b7fc2eaa..000000000 Binary files a/Music/peace/553873_Restarting-The-Time.ogg and /dev/null differ diff --git a/Music/peace/Angel Down.ogg b/Music/peace/Angel Down.ogg deleted file mode 100644 index 6e700d62e..000000000 Binary files a/Music/peace/Angel Down.ogg and /dev/null differ diff --git a/Music/peace/Byte Run.ogg b/Music/peace/Byte Run.ogg deleted file mode 100644 index 64cfe018e..000000000 Binary files a/Music/peace/Byte Run.ogg and /dev/null differ diff --git a/Music/peace/Droum.ogg b/Music/peace/Droum.ogg deleted file mode 100644 index df28c5879..000000000 Binary files a/Music/peace/Droum.ogg and /dev/null differ diff --git a/Music/peace/EE Environmental Runs.ogg b/Music/peace/EE Environmental Runs.ogg deleted file mode 100644 index 0be30e035..000000000 Binary files a/Music/peace/EE Environmental Runs.ogg and /dev/null differ diff --git a/Music/peace/Eastern Vector.ogg b/Music/peace/Eastern Vector.ogg deleted file mode 100644 index 27540f1c3..000000000 Binary files a/Music/peace/Eastern Vector.ogg and /dev/null differ diff --git a/Music/peace/Environment Alpha.ogg b/Music/peace/Environment Alpha.ogg deleted file mode 100644 index 2c213cc4d..000000000 Binary files a/Music/peace/Environment Alpha.ogg and /dev/null differ diff --git a/Music/peace/Evade.ogg b/Music/peace/Evade.ogg deleted file mode 100644 index b6303b009..000000000 Binary files a/Music/peace/Evade.ogg and /dev/null differ diff --git a/Music/peace/Exbioract Menu.ogg b/Music/peace/Exbioract Menu.ogg deleted file mode 100644 index 36ff6356b..000000000 Binary files a/Music/peace/Exbioract Menu.ogg and /dev/null differ diff --git a/Music/peace/GD Initialization.ogg b/Music/peace/GD Initialization.ogg deleted file mode 100644 index 3b74ed51b..000000000 Binary files a/Music/peace/GD Initialization.ogg and /dev/null differ diff --git a/Music/peace/Intrusive Thoughts.ogg b/Music/peace/Intrusive Thoughts.ogg deleted file mode 100644 index bf87ba440..000000000 Binary files a/Music/peace/Intrusive Thoughts.ogg and /dev/null differ diff --git a/Music/peace/Mysteries at Severnaya Industrial 9.ogg b/Music/peace/Mysteries at Severnaya Industrial 9.ogg deleted file mode 100644 index 29998f307..000000000 Binary files a/Music/peace/Mysteries at Severnaya Industrial 9.ogg and /dev/null differ diff --git a/Music/peace/Strange Robot.ogg b/Music/peace/Strange Robot.ogg deleted file mode 100644 index a81bfe198..000000000 Binary files a/Music/peace/Strange Robot.ogg and /dev/null differ diff --git a/Music/peace/The URC Extraction.ogg b/Music/peace/The URC Extraction.ogg deleted file mode 100644 index ee16d450b..000000000 Binary files a/Music/peace/The URC Extraction.ogg and /dev/null differ diff --git a/Music/peace/This World is Imploding.ogg b/Music/peace/This World is Imploding.ogg deleted file mode 100644 index 1f5e18c21..000000000 Binary files a/Music/peace/This World is Imploding.ogg and /dev/null differ diff --git a/Music/victory/450042_01___Resting_Place.ogg b/Music/victory/450042_01___Resting_Place.ogg deleted file mode 100644 index 9d1e6d1ad..000000000 Binary files a/Music/victory/450042_01___Resting_Place.ogg and /dev/null differ diff --git a/Music/war/02 Recycle - Things That I Saw.ogg b/Music/war/02 Recycle - Things That I Saw.ogg deleted file mode 100644 index dd37e7db1..000000000 Binary files a/Music/war/02 Recycle - Things That I Saw.ogg and /dev/null differ diff --git a/Music/war/03 Recycle - Marble And Coal.ogg b/Music/war/03 Recycle - Marble And Coal.ogg deleted file mode 100644 index 1368ef8ec..000000000 Binary files a/Music/war/03 Recycle - Marble And Coal.ogg and /dev/null differ diff --git a/Music/war/187452_Heavy.ogg b/Music/war/187452_Heavy.ogg deleted file mode 100644 index 12fecdc36..000000000 Binary files a/Music/war/187452_Heavy.ogg and /dev/null differ diff --git a/Music/war/192884_new.ogg b/Music/war/192884_new.ogg deleted file mode 100644 index d34a48a64..000000000 Binary files a/Music/war/192884_new.ogg and /dev/null differ diff --git a/Music/war/256720_Better_than_Nothing.ogg b/Music/war/256720_Better_than_Nothing.ogg deleted file mode 100644 index 5d9adc706..000000000 Binary files a/Music/war/256720_Better_than_Nothing.ogg and /dev/null differ diff --git a/Music/war/291507_Left_to_Rot.ogg b/Music/war/291507_Left_to_Rot.ogg deleted file mode 100644 index 8e64b8c25..000000000 Binary files a/Music/war/291507_Left_to_Rot.ogg and /dev/null differ diff --git a/Music/war/297894_Fists_of_Stone.ogg b/Music/war/297894_Fists_of_Stone.ogg deleted file mode 100644 index a22b8d14b..000000000 Binary files a/Music/war/297894_Fists_of_Stone.ogg and /dev/null differ diff --git a/Music/war/334346_Distant_Lands.ogg b/Music/war/334346_Distant_Lands.ogg deleted file mode 100644 index 28a493551..000000000 Binary files a/Music/war/334346_Distant_Lands.ogg and /dev/null differ diff --git a/Music/war/381879_dknew2.ogg b/Music/war/381879_dknew2.ogg deleted file mode 100644 index 0852ca188..000000000 Binary files a/Music/war/381879_dknew2.ogg and /dev/null differ diff --git a/Music/war/383176_Sacrifice___deathkllr84.ogg b/Music/war/383176_Sacrifice___deathkllr84.ogg deleted file mode 100644 index 3fa7b5192..000000000 Binary files a/Music/war/383176_Sacrifice___deathkllr84.ogg and /dev/null differ diff --git a/Music/war/392305_deathkllr84___metalriffs.ogg b/Music/war/392305_deathkllr84___metalriffs.ogg deleted file mode 100644 index b3765e235..000000000 Binary files a/Music/war/392305_deathkllr84___metalriffs.ogg and /dev/null differ diff --git a/Music/war/393018_deathkllr84___Anasasis_int.ogg b/Music/war/393018_deathkllr84___Anasasis_int.ogg deleted file mode 100644 index af1a7828a..000000000 Binary files a/Music/war/393018_deathkllr84___Anasasis_int.ogg and /dev/null differ diff --git a/Music/war/393567_deathkllr84___breakdown.ogg b/Music/war/393567_deathkllr84___breakdown.ogg deleted file mode 100644 index be4ecf081..000000000 Binary files a/Music/war/393567_deathkllr84___breakdown.ogg and /dev/null differ diff --git a/Music/war/493567_Torture-Arena.ogg b/Music/war/493567_Torture-Arena.ogg deleted file mode 100644 index 545460896..000000000 Binary files a/Music/war/493567_Torture-Arena.ogg and /dev/null differ diff --git a/Music/war/514888_Sweet-Cold-Revenge-.ogg b/Music/war/514888_Sweet-Cold-Revenge-.ogg deleted file mode 100644 index 77b49eaaf..000000000 Binary files a/Music/war/514888_Sweet-Cold-Revenge-.ogg and /dev/null differ diff --git a/Music/war/518212_No-more-sun.ogg b/Music/war/518212_No-more-sun.ogg deleted file mode 100644 index d537ff3d2..000000000 Binary files a/Music/war/518212_No-more-sun.ogg and /dev/null differ diff --git a/Music/war/551136_Knightfall.ogg b/Music/war/551136_Knightfall.ogg deleted file mode 100644 index 2a245241f..000000000 Binary files a/Music/war/551136_Knightfall.ogg and /dev/null differ diff --git a/Music/war/551169_Execution.ogg b/Music/war/551169_Execution.ogg deleted file mode 100644 index cedb6c1cf..000000000 Binary files a/Music/war/551169_Execution.ogg and /dev/null differ diff --git a/Music/war/551170_Active-Power.ogg b/Music/war/551170_Active-Power.ogg deleted file mode 100644 index 5e36ebdcb..000000000 Binary files a/Music/war/551170_Active-Power.ogg and /dev/null differ diff --git a/Music/war/552938_Recovery.ogg b/Music/war/552938_Recovery.ogg deleted file mode 100644 index ea169f773..000000000 Binary files a/Music/war/552938_Recovery.ogg and /dev/null differ diff --git a/Music/war/555389_Reboot.ogg b/Music/war/555389_Reboot.ogg deleted file mode 100644 index 5f5031195..000000000 Binary files a/Music/war/555389_Reboot.ogg and /dev/null differ diff --git a/Music/war/556245_Defiance-1.ogg b/Music/war/556245_Defiance-1.ogg deleted file mode 100644 index c629d8023..000000000 Binary files a/Music/war/556245_Defiance-1.ogg and /dev/null differ diff --git a/Music/war/556245_Defiance-2.ogg b/Music/war/556245_Defiance-2.ogg deleted file mode 100644 index 47376b8b6..000000000 Binary files a/Music/war/556245_Defiance-2.ogg and /dev/null differ diff --git a/Music/war/556245_Defiance-3.ogg b/Music/war/556245_Defiance-3.ogg deleted file mode 100644 index cd66cd488..000000000 Binary files a/Music/war/556245_Defiance-3.ogg and /dev/null differ diff --git a/Music/war/556245_Defiance-4.ogg b/Music/war/556245_Defiance-4.ogg deleted file mode 100644 index e04e227b7..000000000 Binary files a/Music/war/556245_Defiance-4.ogg and /dev/null differ diff --git a/Music/war/556245_Defiance-5.ogg b/Music/war/556245_Defiance-5.ogg deleted file mode 100644 index 9c54ad362..000000000 Binary files a/Music/war/556245_Defiance-5.ogg and /dev/null differ diff --git a/Music/war/559522_Aftershock.ogg b/Music/war/559522_Aftershock.ogg deleted file mode 100644 index 2ce0d41ae..000000000 Binary files a/Music/war/559522_Aftershock.ogg and /dev/null differ diff --git a/Music/war/566692_Scars-of-Hate.ogg b/Music/war/566692_Scars-of-Hate.ogg deleted file mode 100644 index bc949c022..000000000 Binary files a/Music/war/566692_Scars-of-Hate.ogg and /dev/null differ diff --git a/Music/war/578554_Traitor.ogg b/Music/war/578554_Traitor.ogg deleted file mode 100644 index 84ec0eafb..000000000 Binary files a/Music/war/578554_Traitor.ogg and /dev/null differ diff --git a/Music/war/582016_This-Means-Death.ogg b/Music/war/582016_This-Means-Death.ogg deleted file mode 100644 index 4b4292778..000000000 Binary files a/Music/war/582016_This-Means-Death.ogg and /dev/null differ diff --git a/Music/war/585171_Quasar.ogg b/Music/war/585171_Quasar.ogg deleted file mode 100644 index e118e70dc..000000000 Binary files a/Music/war/585171_Quasar.ogg and /dev/null differ diff --git a/Objects3D/ChickenDefenseModels/agamautoburst.s3o b/Objects3D/ChickenDefenseModels/agamautoburst.s3o new file mode 100644 index 000000000..f2732cfc5 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/agamautoburst.s3o differ diff --git a/Objects3D/ChickenDefenseModels/big_chicken_dodo.s3o b/Objects3D/ChickenDefenseModels/big_chicken_dodo.s3o new file mode 100644 index 000000000..51508c22e Binary files /dev/null and b/Objects3D/ChickenDefenseModels/big_chicken_dodo.s3o differ diff --git a/Objects3D/ChickenDefenseModels/brain_bug.s3o b/Objects3D/ChickenDefenseModels/brain_bug.s3o new file mode 100644 index 000000000..72f5f1c68 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/brain_bug.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken.s3o b/Objects3D/ChickenDefenseModels/chicken.s3o new file mode 100644 index 000000000..ec3c39d1c Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1b.s3o b/Objects3D/ChickenDefenseModels/chicken1b.s3o new file mode 100644 index 000000000..8dea48273 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1c.s3o b/Objects3D/ChickenDefenseModels/chicken1c.s3o new file mode 100644 index 000000000..4a9522072 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1c.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1d.s3o b/Objects3D/ChickenDefenseModels/chicken1d.s3o new file mode 100644 index 000000000..a3ddc82ed Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1d.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1x.s3o b/Objects3D/ChickenDefenseModels/chicken1x.s3o new file mode 100644 index 000000000..3c1b7eea4 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1x.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1y.s3o b/Objects3D/ChickenDefenseModels/chicken1y.s3o new file mode 100644 index 000000000..b573b1f81 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1y.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken1z.s3o b/Objects3D/ChickenDefenseModels/chicken1z.s3o new file mode 100644 index 000000000..de12d782c Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken1z.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken2.s3o b/Objects3D/ChickenDefenseModels/chicken2.s3o new file mode 100644 index 000000000..52cb7a696 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken2.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken2b.s3o b/Objects3D/ChickenDefenseModels/chicken2b.s3o new file mode 100644 index 000000000..c55ba71d4 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken2b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_colonizer.s3o b/Objects3D/ChickenDefenseModels/chicken_colonizer.s3o new file mode 100644 index 000000000..9f915f853 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_colonizer.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_crow.s3o b/Objects3D/ChickenDefenseModels/chicken_crow.s3o new file mode 100644 index 000000000..4917e18c2 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_crow.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_digger.s3o b/Objects3D/ChickenDefenseModels/chicken_digger.s3o new file mode 100644 index 000000000..929bb39f3 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_digger.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_digger_b.s3o b/Objects3D/ChickenDefenseModels/chicken_digger_b.s3o new file mode 100644 index 000000000..885434693 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_digger_b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_dodo.s3o b/Objects3D/ChickenDefenseModels/chicken_dodo.s3o new file mode 100644 index 000000000..afd405883 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_dodo.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_drone.s3o b/Objects3D/ChickenDefenseModels/chicken_drone.s3o new file mode 100644 index 000000000..cad816d21 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_drone.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_droneb.s3o b/Objects3D/ChickenDefenseModels/chicken_droneb.s3o new file mode 100644 index 000000000..e8b6dffbd Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_droneb.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_listener.s3o b/Objects3D/ChickenDefenseModels/chicken_listener.s3o new file mode 100644 index 000000000..ab80a57fc Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_listener.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_listener_b.s3o b/Objects3D/ChickenDefenseModels/chicken_listener_b.s3o new file mode 100644 index 000000000..1ce22abaa Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_listener_b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_pidgeon.s3o b/Objects3D/ChickenDefenseModels/chicken_pidgeon.s3o new file mode 100644 index 000000000..71fc8f022 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_pidgeon.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_pidgeonb.s3o b/Objects3D/ChickenDefenseModels/chicken_pidgeonb.s3o new file mode 100644 index 000000000..7662a4576 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_pidgeonb.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_pidgeonc.s3o b/Objects3D/ChickenDefenseModels/chicken_pidgeonc.s3o new file mode 100644 index 000000000..1bd1a72f4 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_pidgeonc.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_pidgeond.s3o b/Objects3D/ChickenDefenseModels/chicken_pidgeond.s3o new file mode 100644 index 000000000..1833dcb24 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_pidgeond.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chicken_spidermonkey.s3o b/Objects3D/ChickenDefenseModels/chicken_spidermonkey.s3o new file mode 100644 index 000000000..d6d9ab5b7 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chicken_spidermonkey.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickena.s3o b/Objects3D/ChickenDefenseModels/chickena.s3o new file mode 100644 index 000000000..913ba4844 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickena.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickena2.s3o b/Objects3D/ChickenDefenseModels/chickena2.s3o new file mode 100644 index 000000000..544bcad90 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickena2.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickena2b.s3o b/Objects3D/ChickenDefenseModels/chickena2b.s3o new file mode 100644 index 000000000..650d85f87 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickena2b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenab.s3o b/Objects3D/ChickenDefenseModels/chickenab.s3o new file mode 100644 index 000000000..b336ef30b Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenab.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenac.s3o b/Objects3D/ChickenDefenseModels/chickenac.s3o new file mode 100644 index 000000000..e2612fde2 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenac.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenc.s3o b/Objects3D/ChickenDefenseModels/chickenc.s3o new file mode 100644 index 000000000..ac2e4ecf3 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenc.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenc2.s3o b/Objects3D/ChickenDefenseModels/chickenc2.s3o new file mode 100644 index 000000000..36d440072 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenc2.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenc3.s3o b/Objects3D/ChickenDefenseModels/chickenc3.s3o new file mode 100644 index 000000000..3df866fae Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenc3.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenc3b.s3o b/Objects3D/ChickenDefenseModels/chickenc3b.s3o new file mode 100644 index 000000000..f81366cfd Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenc3b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenc3c.s3o b/Objects3D/ChickenDefenseModels/chickenc3c.s3o new file mode 100644 index 000000000..91e977a71 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenc3c.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenegg.s3o b/Objects3D/ChickenDefenseModels/chickenegg.s3o new file mode 100644 index 000000000..5721755dd Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenegg.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickeneggb.s3o b/Objects3D/ChickenDefenseModels/chickeneggb.s3o new file mode 100644 index 000000000..c69bc1399 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickeneggb.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickeneggc.s3o b/Objects3D/ChickenDefenseModels/chickeneggc.s3o new file mode 100644 index 000000000..911c2f225 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickeneggc.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickeneggd.s3o b/Objects3D/ChickenDefenseModels/chickeneggd.s3o new file mode 100644 index 000000000..0da75b49c Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickeneggd.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickeneggred.s3o b/Objects3D/ChickenDefenseModels/chickeneggred.s3o new file mode 100644 index 000000000..6ec84557a Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickeneggred.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickeneggyellow.s3o b/Objects3D/ChickenDefenseModels/chickeneggyellow.s3o new file mode 100644 index 000000000..0954420e7 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickeneggyellow.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenf.s3o b/Objects3D/ChickenDefenseModels/chickenf.s3o new file mode 100644 index 000000000..907524ba6 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenf.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenf1.s3o b/Objects3D/ChickenDefenseModels/chickenf1.s3o new file mode 100644 index 000000000..e54db305e Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenf1.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenf1b.s3o b/Objects3D/ChickenDefenseModels/chickenf1b.s3o new file mode 100644 index 000000000..1750a8721 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenf1b.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenq.s3o b/Objects3D/ChickenDefenseModels/chickenq.s3o new file mode 100644 index 000000000..235facbd3 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenq.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickenr.s3o b/Objects3D/ChickenDefenseModels/chickenr.s3o new file mode 100644 index 000000000..05725cf32 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickenr.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickens.s3o b/Objects3D/ChickenDefenseModels/chickens.s3o new file mode 100644 index 000000000..05a82fb14 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickens.s3o differ diff --git a/Objects3D/ChickenDefenseModels/chickens2.s3o b/Objects3D/ChickenDefenseModels/chickens2.s3o new file mode 100644 index 000000000..6a6a35a92 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/chickens2.s3o differ diff --git a/Objects3D/ChickenDefenseModels/e_chickenq.s3o b/Objects3D/ChickenDefenseModels/e_chickenq.s3o new file mode 100644 index 000000000..4ac232b5d Binary files /dev/null and b/Objects3D/ChickenDefenseModels/e_chickenq.s3o differ diff --git a/Objects3D/ChickenDefenseModels/epic_chickenq.s3o b/Objects3D/ChickenDefenseModels/epic_chickenq.s3o new file mode 100644 index 000000000..9f00b9302 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/epic_chickenq.s3o differ diff --git a/Objects3D/ChickenDefenseModels/greyrock2.s3o b/Objects3D/ChickenDefenseModels/greyrock2.s3o new file mode 100644 index 000000000..57f9d995b Binary files /dev/null and b/Objects3D/ChickenDefenseModels/greyrock2.s3o differ diff --git a/Objects3D/ChickenDefenseModels/h_chickenq.s3o b/Objects3D/ChickenDefenseModels/h_chickenq.s3o new file mode 100644 index 000000000..7b3aa5d51 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/h_chickenq.s3o differ diff --git a/Objects3D/ChickenDefenseModels/roost.s3o b/Objects3D/ChickenDefenseModels/roost.s3o new file mode 100644 index 000000000..5e59350b4 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/roost.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chicken_white.s3o b/Objects3D/ChickenDefenseModels/s_chicken_white.s3o new file mode 100644 index 000000000..59da3e495 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chicken_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickena_white.s3o b/Objects3D/ChickenDefenseModels/s_chickena_white.s3o new file mode 100644 index 000000000..6cdfd6571 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickena_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickenboss2_white.s3o b/Objects3D/ChickenDefenseModels/s_chickenboss2_white.s3o new file mode 100644 index 000000000..8c9e75ffd Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickenboss2_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickenboss_white.s3o b/Objects3D/ChickenDefenseModels/s_chickenboss_white.s3o new file mode 100644 index 000000000..6c9ecf38c Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickenboss_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickenq_spawner.s3o b/Objects3D/ChickenDefenseModels/s_chickenq_spawner.s3o new file mode 100644 index 000000000..b58930301 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickenq_spawner.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickens_white.s3o b/Objects3D/ChickenDefenseModels/s_chickens_white.s3o new file mode 100644 index 000000000..2c865c38c Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickens_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/s_chickenw_white.s3o b/Objects3D/ChickenDefenseModels/s_chickenw_white.s3o new file mode 100644 index 000000000..86d090f4a Binary files /dev/null and b/Objects3D/ChickenDefenseModels/s_chickenw_white.s3o differ diff --git a/Objects3D/ChickenDefenseModels/sgreyrock1.s3o b/Objects3D/ChickenDefenseModels/sgreyrock1.s3o new file mode 100644 index 000000000..bbd8a92b6 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/sgreyrock1.s3o differ diff --git a/Objects3D/ChickenDefenseModels/spike.s3o b/Objects3D/ChickenDefenseModels/spike.s3o new file mode 100644 index 000000000..ba74e8949 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/spike.s3o differ diff --git a/Objects3D/ChickenDefenseModels/spiker_gunship.s3o b/Objects3D/ChickenDefenseModels/spiker_gunship.s3o new file mode 100644 index 000000000..1430d767f Binary files /dev/null and b/Objects3D/ChickenDefenseModels/spiker_gunship.s3o differ diff --git a/Objects3D/ChickenDefenseModels/tube.s3o b/Objects3D/ChickenDefenseModels/tube.s3o new file mode 100644 index 000000000..49c6e0ccc Binary files /dev/null and b/Objects3D/ChickenDefenseModels/tube.s3o differ diff --git a/Objects3D/ChickenDefenseModels/ve_chickenq.s3o b/Objects3D/ChickenDefenseModels/ve_chickenq.s3o new file mode 100644 index 000000000..ce297d478 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/ve_chickenq.s3o differ diff --git a/Objects3D/ChickenDefenseModels/vh_chickenq.s3o b/Objects3D/ChickenDefenseModels/vh_chickenq.s3o new file mode 100644 index 000000000..efc363ac7 Binary files /dev/null and b/Objects3D/ChickenDefenseModels/vh_chickenq.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/eairplant2.s3o b/Objects3D/eairplant2.s3o deleted file mode 100644 index 5558c8a4e..000000000 Binary files a/Objects3D/eairplant2.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/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 new file mode 100644 index 000000000..b7d2b97cb Binary files /dev/null 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 new file mode 100644 index 000000000..4dc8eae9c Binary files /dev/null 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 new file mode 100644 index 000000000..cf5817de3 Binary files /dev/null and b/Objects3D/ecommander4-battle.s3o differ diff --git a/Objects3D/ecommander4.s3o b/Objects3D/ecommander4.s3o index b54f8298d..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 8858698df..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/efighter3.s3o b/Objects3D/efighter3.s3o new file mode 100644 index 000000000..6892eaa5b Binary files /dev/null and b/Objects3D/efighter3.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/ehbot_turretbase.s3o b/Objects3D/ehbot_turretbase.s3o new file mode 100644 index 000000000..c2078277c Binary files /dev/null and b/Objects3D/ehbot_turretbase.s3o differ diff --git a/Objects3D/ehbotbackpack.s3o b/Objects3D/ehbotbackpack.s3o new file mode 100644 index 000000000..e67d84a38 Binary files /dev/null and b/Objects3D/ehbotbackpack.s3o differ diff --git a/Objects3D/ehbotengineer.s3o b/Objects3D/ehbotengineer.s3o deleted file mode 100644 index 578f3d340..000000000 Binary files a/Objects3D/ehbotengineer.s3o and /dev/null differ diff --git a/Objects3D/ehbotengineer2.s3o b/Objects3D/ehbotengineer2.s3o new file mode 100644 index 000000000..5b7919075 Binary files /dev/null and b/Objects3D/ehbotengineer2.s3o differ diff --git a/Objects3D/ehbotengineer_turret.s3o b/Objects3D/ehbotengineer_turret.s3o new file mode 100644 index 000000000..db3dd40e4 Binary files /dev/null and b/Objects3D/ehbotengineer_turret.s3o differ diff --git a/Objects3D/ehbotfac.s3o b/Objects3D/ehbotfac.s3o new file mode 100644 index 000000000..3ebad5882 Binary files /dev/null and b/Objects3D/ehbotfac.s3o differ diff --git a/Objects3D/ehbotkarganneth.s3o b/Objects3D/ehbotkarganneth.s3o new file mode 100644 index 000000000..6a058200c Binary files /dev/null and b/Objects3D/ehbotkarganneth.s3o differ diff --git a/Objects3D/ehbotkarganneth_turret.s3o b/Objects3D/ehbotkarganneth_turret.s3o new file mode 100644 index 000000000..157cbdc4a Binary files /dev/null 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 010e904ec..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 new file mode 100644 index 000000000..5b74c6f1f Binary files /dev/null and b/Objects3D/ehbotpeewee_turret.s3o differ diff --git a/Objects3D/ehbotpyro.s3o b/Objects3D/ehbotpyro.s3o deleted file mode 100644 index b0869f6a7..000000000 Binary files a/Objects3D/ehbotpyro.s3o and /dev/null differ diff --git a/Objects3D/ehbotrocko.s3o b/Objects3D/ehbotrocko.s3o index 2365effa1..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 new file mode 100644 index 000000000..f9a834a00 Binary files /dev/null and b/Objects3D/ehbotrocko_turret.s3o differ diff --git a/Objects3D/ehbotsniper.s3o b/Objects3D/ehbotsniper.s3o new file mode 100644 index 000000000..523f0f1e6 Binary files /dev/null and b/Objects3D/ehbotsniper.s3o differ diff --git a/Objects3D/ehbotsniper_turret.s3o b/Objects3D/ehbotsniper_turret.s3o new file mode 100644 index 000000000..86f09fdec Binary files /dev/null and b/Objects3D/ehbotsniper_turret.s3o differ diff --git a/Objects3D/ehbotthud.s3o b/Objects3D/ehbotthud.s3o index 8feb8e5bf..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 new file mode 100644 index 000000000..52a1a6004 Binary files /dev/null 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/eheavytank4.s3o b/Objects3D/eheavytank4.s3o index e100e1584..8f356fa49 100644 Binary files a/Objects3D/eheavytank4.s3o and b/Objects3D/eheavytank4.s3o 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 new file mode 100644 index 000000000..657b7d027 Binary files /dev/null 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 613fe730b..9da20287a 100644 Binary files a/Objects3D/elighttank4.s3o and b/Objects3D/elighttank4.s3o 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 5d0c447d1..000000000 Binary files a/Objects3D/eorb3.s3o and /dev/null differ diff --git a/Objects3D/eorb4.s3o b/Objects3D/eorb4.s3o new file mode 100644 index 000000000..5223c0adc Binary files /dev/null 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 new file mode 100644 index 000000000..82f0219b2 Binary files /dev/null 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/eraider.s3o b/Objects3D/eraider.s3o new file mode 100644 index 000000000..4cb12301b Binary files /dev/null and b/Objects3D/eraider.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/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/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/missilesmalllauncher.s3o b/Objects3D/missilesmalllauncher.s3o index 43d3135bb..6c20e7b82 100644 Binary files a/Objects3D/missilesmalllauncher.s3o and b/Objects3D/missilesmalllauncher.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/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/xmasball.s3o b/Objects3D/xmasball.s3o new file mode 100644 index 000000000..4b14c90ec Binary files /dev/null and b/Objects3D/xmasball.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 03b14207f..de03ae6be 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,3 @@ -

Evolution RTS

+Join our Discord community at: https://discord.gg/WUbAs2f -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 foilage 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! \ No newline at end of file +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/ChickenDefenseScripts/chicken1.bos b/Scripts/ChickenDefenseScripts/chicken1.bos new file mode 100644 index 000000000..843457c28 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chicken1.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 <250>; + turn head to x-axis 0 -pitch speed <200>; + + 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 | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/ChickenDefenseScripts/chicken1.cob b/Scripts/ChickenDefenseScripts/chicken1.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1b.cob b/Scripts/ChickenDefenseScripts/chicken1b.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1c.cob b/Scripts/ChickenDefenseScripts/chicken1c.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1c.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1d.cob b/Scripts/ChickenDefenseScripts/chicken1d.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1d.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1x.cob b/Scripts/ChickenDefenseScripts/chicken1x.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1x.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1y.cob b/Scripts/ChickenDefenseScripts/chicken1y.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1y.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken1z.cob b/Scripts/ChickenDefenseScripts/chicken1z.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken1z.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken2.bos b/Scripts/ChickenDefenseScripts/chicken2.bos new file mode 100644 index 000000000..363eb11be --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chicken2.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 <250.000000>; + turn head to x-axis <0.000000> - pitch speed <200.000000>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + return (1); +} + +Shot1() +{ + turn lforearm to y-axis <-140.000000> speed <600.000000>; + turn rforearm to y-axis <140.000000> speed <600.000000>; + turn lblade to y-axis <140.000000> speed <600.000000>; + turn rblade to y-axis <-140.000000> speed <600.000000>; + wait-for-turn rblade around y-axis; + turn lforearm to y-axis <0.000000> speed <250.000000>; + turn rforearm to y-axis <0.000000> speed <250.000000>; + turn lblade to y-axis <0.000000> speed <250.000000>; + turn rblade to y-axis <0.000000> speed <250.000000>; +} + +Killed(severity, corpsetype) +{ + corpsetype = 1; + emit-sfx 1025 from body; +} diff --git a/Scripts/ChickenDefenseScripts/chicken2.cob b/Scripts/ChickenDefenseScripts/chicken2.cob new file mode 100644 index 000000000..339b102f8 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken2b.bos b/Scripts/ChickenDefenseScripts/chicken2b.bos new file mode 100644 index 000000000..f34f62392 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chicken2b.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 <250.000000>; + turn head to x-axis <0.000000> - pitch speed <200.000000>; + 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/ChickenDefenseScripts/chicken2b.cob b/Scripts/ChickenDefenseScripts/chicken2b.cob new file mode 100644 index 000000000..6ff60ca6b Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken2b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken_dodo1.bos b/Scripts/ChickenDefenseScripts/chicken_dodo1.bos new file mode 100644 index 000000000..d7aa0e0b0 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chicken_dodo1.bos @@ -0,0 +1,203 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lblade,rblade; +//piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack,rblade,lblade,mblade,spike1,spike2,spike3; + +static-var Static_Var_3, aMoving, bMoving, lasthit, counter; + +// 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( Static_Var_3 <= 2 ) + { + emit-sfx 5 from lfoot; + emit-sfx 5 from rfoot; + emit-sfx 3 from lfoot; + emit-sfx 3 from rfoot; + } + 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( Static_Var_3 <= 2 ) + { + emit-sfx 5 from lfoot; + emit-sfx 5 from rfoot; + emit-sfx 3 from lfoot; + emit-sfx 3 from rfoot; + } + 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( Static_Var_3 <= 2 ) + { + emit-sfx 5 from lfoot; + emit-sfx 5 from rfoot; + emit-sfx 3 from lfoot; + emit-sfx 3 from rfoot; + } + 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( Static_Var_3 <= 2 ) + { + emit-sfx 5 from lfoot; + emit-sfx 5 from rfoot; + emit-sfx 3 from lfoot; + emit-sfx 3 from rfoot; + } + 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; + } + if( Static_Var_3 <= 2 ) + { + emit-sfx 5 from lfoot; + emit-sfx 5 from rfoot; + emit-sfx 3 from lfoot; + emit-sfx 3 from rfoot; + } + } + 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; } + + +RestoreAfterDelay() + { + sleep 1000; + } + + + +HitByWeaponId() + { + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + explode body type FALL | FIRE | BITMAP1 | NOHEATCLOUD; + explode tail type FALL | FIRE | BITMAP1 | NOHEATCLOUD; + explode head type FALL | FIRE | BITMAP1 | NOHEATCLOUD; + explode lblade type FALL | FIRE | BITMAP2 | NOHEATCLOUD; + //explode rblade type FALL | FIRE | BITMAP2 | NOHEATCLOUD; + //explode lblade type FALL | NOHEATCLOUD; + //explode rblade type FALL | NOHEATCLOUD; + //explode lblade type FALL | NOHEATCLOUD; + //explode rblade type FALL | NOHEATCLOUD; + //explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + //explode rfoot type FALL | NOHEATCLOUD; + explode lfoot type FALL | NOHEATCLOUD; + + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/ChickenDefenseScripts/chicken_dodo1.cob b/Scripts/ChickenDefenseScripts/chicken_dodo1.cob new file mode 100644 index 000000000..a077b6d97 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken_dodo1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chicken_dodo2.bos b/Scripts/ChickenDefenseScripts/chicken_dodo2.bos new file mode 100644 index 000000000..fa20d8173 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chicken_dodo2.bos @@ -0,0 +1,173 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lblade,rblade; +//piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack,rblade,lblade,mblade,spike1,spike2,spike3; + +static-var Static_Var_3, aMoving, bMoving, lasthit, counter; + +// 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>; + emit-sfx 1024 from body; + 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>; + emit-sfx 1024 from body; + 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>; + emit-sfx 1024 from body; + 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>; + emit-sfx 1024 from body; + 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; } + + +RestoreAfterDelay() + { + sleep 1000; + } + + + +HitByWeaponId() + { + emit-sfx 1024 from body; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + explode body type FALL | SMOKE | FIRE | BITMAP1 | NOHEATCLOUD; + explode tail type FALL | SMOKE | FIRE | BITMAP1 | NOHEATCLOUD; + explode head type FALL | SMOKE | FIRE | BITMAP1 | NOHEATCLOUD; + explode lblade type FALL | SMOKE | FIRE | BITMAP1 | NOHEATCLOUD; + explode rblade type FALL | SMOKE | FIRE | BITMAP2 | NOHEATCLOUD; + //explode lblade type FALL | SMOKE | FIRE | BITMAP2 | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + //explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + //explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + //explode rfoot type FALL | NOHEATCLOUD; + explode lfoot type FALL | NOHEATCLOUD; + + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/ChickenDefenseScripts/chicken_dodo2.cob b/Scripts/ChickenDefenseScripts/chicken_dodo2.cob new file mode 100644 index 000000000..27a7e204f Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chicken_dodo2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickena1.bos b/Scripts/ChickenDefenseScripts/chickena1.bos new file mode 100644 index 000000000..b1f518a96 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickena1.bos @@ -0,0 +1,251 @@ +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, aaheading, aapitch; + +// 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() +{ + 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 <250>; + turn head to x-axis 0 -pitch speed <200>; + 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/ChickenDefenseScripts/chickena1.cob b/Scripts/ChickenDefenseScripts/chickena1.cob new file mode 100644 index 000000000..560e79c42 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickena1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickena1b.cob b/Scripts/ChickenDefenseScripts/chickena1b.cob new file mode 100644 index 000000000..560e79c42 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickena1b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickena1c.cob b/Scripts/ChickenDefenseScripts/chickena1c.cob new file mode 100644 index 000000000..560e79c42 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickena1c.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickena2.bos b/Scripts/ChickenDefenseScripts/chickena2.bos new file mode 100644 index 000000000..730980a57 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickena2.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 <250>; + turn head to x-axis 0 -pitch speed <200>; + 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/ChickenDefenseScripts/chickena2.cob b/Scripts/ChickenDefenseScripts/chickena2.cob new file mode 100644 index 000000000..21fca000b Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickena2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickena2b.cob b/Scripts/ChickenDefenseScripts/chickena2b.cob new file mode 100644 index 000000000..21fca000b Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickena2b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenc1.bos b/Scripts/ChickenDefenseScripts/chickenc1.bos new file mode 100644 index 000000000..d5be24b87 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenc1.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 <250>; + turn head to x-axis 0 -pitch speed <200>; + + 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/ChickenDefenseScripts/chickenc1.cob b/Scripts/ChickenDefenseScripts/chickenc1.cob new file mode 100644 index 000000000..de99a0753 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenc1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenc2.cob b/Scripts/ChickenDefenseScripts/chickenc2.cob new file mode 100644 index 000000000..de99a0753 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenc2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenc3.bos b/Scripts/ChickenDefenseScripts/chickenc3.bos new file mode 100644 index 000000000..cd7a1d6bb --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenc3.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<190>; + turn lshinf to x-axis <20> speed<190>; + turn lfootf to x-axis <-50> speed<410>; + + turn rthighf to x-axis <-20> speed<410>; + turn rkneef to x-axis <-60> speed<410>; + turn rshinf to x-axis <50> speed<410>; + turn rfootf to x-axis <30> speed<410>; + + turn lthighb to x-axis <70> speed<115>; + turn lkneeb to x-axis <-40> speed<190>; + turn lshinb to x-axis <20> speed<190>; + turn lfootb to x-axis <-50> speed<410>; + + turn rthighb to x-axis <-20> speed<410>; + turn rkneeb to x-axis <-60> speed<410>; + turn rshinb to x-axis <50> speed<410>; + turn rfootb to x-axis <30> speed<410>; + + 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<190>; + turn lshinf to x-axis <-60> speed<250>; + turn lfootf to x-axis <30> speed<190>; + + turn rthighf to x-axis <40> speed<190>; + turn rkneef to x-axis <-35> speed<190>; + turn rshinf to x-axis <-40> speed<190>; + turn rfootf to x-axis <35> speed<190>; + + turn lthighb to x-axis <-10> speed<160>; + turn lkneeb to x-axis <15> speed<190>; + turn lshinb to x-axis <-60> speed<250>; + turn lfootb to x-axis <30> speed<190>; + + turn rthighb to x-axis <40> speed<190>; + turn rkneeb to x-axis <-35> speed<190>; + turn rshinb to x-axis <-40> speed<190>; + turn rfootb to x-axis <35> speed<190>; + + 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<190>; + turn rshinf to x-axis <20> speed<190>; + turn rfootf to x-axis <-50> speed<410>; + + turn lthighf to x-axis <-20> speed<410>; + turn lkneef to x-axis <-60> speed<410>; + turn lshinf to x-axis <50> speed<410>; + turn lfootf to x-axis <30> speed<410>; + + turn rthighb to x-axis <70> speed<115>; + turn rkneeb to x-axis <-40> speed<190>; + turn rshinb to x-axis <20> speed<190>; + turn rfootb to x-axis <-50> speed<410>; + + turn lthighb to x-axis <-20> speed<410>; + turn lkneeb to x-axis <-60> speed<410>; + turn lshinb to x-axis <50> speed<410>; + turn lfootb to x-axis <30> speed<410>; + + 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<190>; + turn rshinf to x-axis <-60> speed<250>; + turn rfootf to x-axis <30> speed<190>; + + turn lthighf to x-axis <40> speed<190>; + turn lkneef to x-axis <-35> speed<190>; + turn lshinf to x-axis <-40> speed<190>; + turn lfootf to x-axis <35> speed<190>; + + turn rthighb to x-axis <-10> speed<160>; + turn rkneeb to x-axis <15> speed<190>; + turn rshinb to x-axis <-60> speed<250>; + turn rfootb to x-axis <30> speed<190>; + + turn lthighb to x-axis <40> speed<190>; + turn lkneeb to x-axis <-35> speed<190>; + turn lshinb to x-axis <-40> speed<190>; + turn lfootb to x-axis <35> speed<190>; + + 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 <250>; + turn head to x-axis 0 -pitch speed <200>; + + 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/ChickenDefenseScripts/chickenc3.cob b/Scripts/ChickenDefenseScripts/chickenc3.cob new file mode 100644 index 000000000..63bef320c Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenc3.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenc3b.cob b/Scripts/ChickenDefenseScripts/chickenc3b.cob new file mode 100644 index 000000000..63bef320c Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenc3b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenc3c.cob b/Scripts/ChickenDefenseScripts/chickenc3c.cob new file mode 100644 index 000000000..63bef320c Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenc3c.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickend1.bos b/Scripts/ChickenDefenseScripts/chickend1.bos new file mode 100644 index 000000000..b4aaad2ce --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickend1.bos @@ -0,0 +1,66 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece body, firepoint; + +// Signal definitions +#define SIG_AIM 2 + +Create() +{ + turn body to y-axis Rand(0, 65534) now; + emit-sfx 1024+2 from body; + move body to y-axis [-20] now; + move body to y-axis [0] speed [8]; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + sleep 30; + return (TRUE); +} + +AimFromPrimary(piecenum) +{ + piecenum = firepoint; +} + +QueryPrimary(piecenum) +{ + piecenum = firepoint; +} + +SweetSpot(piecenum) +{ + piecenum = body; +} + +HitByWeaponId() +{ + emit-sfx 1024 from body; + return 100; +} + +Killed( severity, corpsetype ) +{ + corpsetype = 1; + emit-sfx 1025 from body; + return( 0 ); +} + +StartBuilding(Func_Var_1, Func_Var_2) +{ +} + +StopBuilding() +{ +} + +QueryNanoPiece(piecenum) +{ + piecenum = firepoint; +} diff --git a/Scripts/ChickenDefenseScripts/chickend1.cob b/Scripts/ChickenDefenseScripts/chickend1.cob new file mode 100644 index 000000000..afba783f0 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickend1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenf1.bos b/Scripts/ChickenDefenseScripts/chickenf1.bos new file mode 100644 index 000000000..f8a8cde77 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenf1.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/ChickenDefenseScripts/chickenf1.cob b/Scripts/ChickenDefenseScripts/chickenf1.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenf1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenf1b.cob b/Scripts/ChickenDefenseScripts/chickenf1b.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenf1b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenf2.cob b/Scripts/ChickenDefenseScripts/chickenf2.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenf2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh1.bos b/Scripts/ChickenDefenseScripts/chickenh1.bos new file mode 100644 index 000000000..65888cca6 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenh1.bos @@ -0,0 +1,187 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lforearm,lupperarm,lblade,rforearm,rupperarm,rblade; + +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<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(); +} + +Create() +{ + hide rblade; + hide lblade; + emit-sfx 1024+2 from body; +} + +StartBuilding() +{ + set INBUILDSTANCE to 1; +} + +StopBuilding() +{ + set INBUILDSTANCE to 0; +} + +QueryNanoPiece(piecenum) +{ + piecenum = head; +} + + +SweetSpot(piecenum) + { piecenum=body; } + + +RestoreAfterDelay() + { + sleep 1000; + } + + +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>; + } + + +HitByWeaponId() + { + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + explode head type FALL | NOHEATCLOUD; + explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/ChickenDefenseScripts/chickenh1.cob b/Scripts/ChickenDefenseScripts/chickenh1.cob new file mode 100644 index 000000000..c5b26ccee Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh1b.cob b/Scripts/ChickenDefenseScripts/chickenh1b.cob new file mode 100644 index 000000000..c5b26ccee Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh1b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh2.cob b/Scripts/ChickenDefenseScripts/chickenh2.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh3.cob b/Scripts/ChickenDefenseScripts/chickenh3.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh3.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh4.cob b/Scripts/ChickenDefenseScripts/chickenh4.cob new file mode 100644 index 000000000..4170b1fea Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh4.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenh5.bos b/Scripts/ChickenDefenseScripts/chickenh5.bos new file mode 100644 index 000000000..03a29c197 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenh5.bos @@ -0,0 +1,256 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,lforearm,lupperarm,lblade,rforearm,rupperarm,rblade,head_emit; + +static-var aMoving, bMoving, lasthit; + +// 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" + + +FxEmit() +{ + while( get BUILD_PERCENT_LEFT ) + { + sleep 400; + } + while( TRUE ) + { + emit-sfx 1024+3 from head_emit; + sleep 600; + } +} + +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; + start-script FxEmit(); +} + +SweetSpot(piecenum) + { piecenum=body; } + +AimFromPrimary(piecenum) + { piecenum=head; } + +QueryPrimary(piecenum) + { piecenum=head; } + +RestoreAfterDelay() + { + sleep 1000; + turn head to y-axis 0 speed <250>; + turn head to x-axis 0 speed <200>; + } + +AimPrimary(heading,pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <250>; + turn head to x-axis 0 -pitch speed <200>; + + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + + return(TRUE); +} + +AimSecondary(heading,pitch) +{ + signal SIG_AIM_2; + set-signal-mask SIG_AIM_2; + turn head to y-axis heading speed <250>; + turn head to x-axis 0 -pitch speed <200>; + + 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>; + } + +Shot2() + { + turn lforearm to y-axis <-450> speed <600>; + turn rforearm to y-axis <45> speed <600>; + turn lblade to y-axis <45> speed <600>; + turn rblade to y-axis <-45> 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>; + set CHANGE_TARGET to 2; + } + +QuerySecondary(piecenum) + { piecenum=head; } + + AimFromSecondary(piecenum) + { piecenum=head; } + + +StartBuilding(heading, pitch) +{ + turn head to y-axis heading speed <250.000000>; + set INBUILDSTANCE to 1; +} + +StopBuilding() +{ + set INBUILDSTANCE to 0; +} + +QueryNanoPiece(piecenum) +{ + piecenum = head_emit; +} + + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 from body; + explode head type FALL | NOHEATCLOUD; + explode tail type FALL | NOHEATCLOUD; + explode lblade type FALL | NOHEATCLOUD; + explode rblade type FALL | NOHEATCLOUD; + return( 0 ); + } \ No newline at end of file diff --git a/Scripts/ChickenDefenseScripts/chickenh5.cob b/Scripts/ChickenDefenseScripts/chickenh5.cob new file mode 100644 index 000000000..7beef661e Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenh5.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenp1.bos b/Scripts/ChickenDefenseScripts/chickenp1.bos new file mode 100644 index 000000000..ff2f72985 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenp1.bos @@ -0,0 +1,234 @@ +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 <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 from head; + return 100; + } + +Killed( severity, corpsetype ) + { + corpsetype = 1; + emit-sfx 1025 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/ChickenDefenseScripts/chickenp1.cob b/Scripts/ChickenDefenseScripts/chickenp1.cob new file mode 100644 index 000000000..d462be4a1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenp1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenr1.bos b/Scripts/ChickenDefenseScripts/chickenr1.bos new file mode 100644 index 000000000..a7e5dc6bf --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenr1.bos @@ -0,0 +1,189 @@ +piece body,head,tail,lthigh,lknee,lshin,lfoot,rthigh,rknee,rshin,rfoot,rsack,lsack; + +static-var aMoving, bMoving; + +// 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 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; } + +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 <250>; + 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 <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; + set CHANGE_TARGET to 1; + 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]; + } + + +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/ChickenDefenseScripts/chickenr1.cob b/Scripts/ChickenDefenseScripts/chickenr1.cob new file mode 100644 index 000000000..4fc8ab168 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenr1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenr2.bos b/Scripts/ChickenDefenseScripts/chickenr2.bos new file mode 100644 index 000000000..7da71aa81 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenr2.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/ChickenDefenseScripts/chickenr2.cob b/Scripts/ChickenDefenseScripts/chickenr2.cob new file mode 100644 index 000000000..6adf136bf Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenr2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenr3.bos b/Scripts/ChickenDefenseScripts/chickenr3.bos new file mode 100644 index 000000000..19d73f328 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenr3.bos @@ -0,0 +1,198 @@ +#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, rsack, lsack; + +static-var bMoving, Static_Var_2; + +// Signal definitions +#define SIG_AIM 2 +#define CHANGE_TARGET 98 + +walk() +{ + while( bMoving ) + { + Static_Var_2 = 1; + if( bMoving ) + { + turn lthigh to x-axis <70.000000> speed <115.000000>; + turn lknee to x-axis <-40.000000> speed <145.000000>; + turn lshin to x-axis <20.000000> speed <145.000000>; + turn lfoot to x-axis <-50.000000> speed <210.000000>; + turn rthigh to x-axis <-20.000000> speed <210.000000>; + turn rknee to x-axis <-60.000000> speed <210.000000>; + turn rshin to x-axis <50.000000> speed <210.000000>; + turn rfoot to x-axis <30.000000> speed <210.000000>; + turn body to z-axis <5.000000> speed <20.000000>; + turn lthigh to z-axis <-5.000000> speed <20.000000>; + turn rthigh to z-axis <-5.000000> speed <20.000000>; + move body to y-axis [0.700000] speed [4.443359]; + turn tail to y-axis <10.000000> speed <40.000000>; + turn head to x-axis <-10.000000> speed <20.000000>; + turn tail to x-axis <10.000000> speed <20.000000>; + wait-for-turn lthigh around x-axis; + } + if( bMoving ) + { + turn lthigh to x-axis <-10.000000> speed <160.000000>; + turn lknee to x-axis <15.000000> speed <145.000000>; + turn lshin to x-axis <-60.000000> speed <250.000000>; + turn lfoot to x-axis <30.000000> speed <145.000000>; + turn rthigh to x-axis <40.000000> speed <145.000000>; + turn rknee to x-axis <-35.000000> speed <145.000000>; + turn rshin to x-axis <-40.000000> speed <145.000000>; + turn rfoot to x-axis <35.000000> speed <145.000000>; + move body to y-axis [0.000000] speed [4.443359]; + turn head to x-axis <10.000000> speed <20.000000>; + turn tail to x-axis <-10.000000> speed <20.000000>; + wait-for-turn lshin around x-axis; + } + if( bMoving ) + { + turn rthigh to x-axis <70.000000> speed <115.000000>; + turn rknee to x-axis <-40.000000> speed <145.000000>; + turn rshin to x-axis <20.000000> speed <145.000000>; + turn rfoot to x-axis <-50.000000> speed <210.000000>; + turn lthigh to x-axis <-20.000000> speed <210.000000>; + turn lknee to x-axis <-60.000000> speed <210.000000>; + turn lshin to x-axis <50.000000> speed <210.000000>; + turn lfoot to x-axis <30.000000> speed <210.000000>; + turn tail to y-axis <-10.000000> speed <40.000000>; + turn body to z-axis <-5.000000> speed <20.000000>; + turn lthigh to z-axis <5.000000> speed <20.000000>; + turn rthigh to z-axis <5.000000> speed <20.000000>; + move body to y-axis [0.700000] speed [4.443359]; + turn head to x-axis <-10.000000> speed <20.000000>; + turn tail to x-axis <10.000000> speed <20.000000>; + wait-for-turn rthigh around x-axis; + } + if( bMoving ) + { + turn rthigh to x-axis <-10.000000> speed <160.000000>; + turn rknee to x-axis <15.000000> speed <145.000000>; + turn rshin to x-axis <-60.000000> speed <250.000000>; + turn rfoot to x-axis <30.000000> speed <145.000000>; + turn lthigh to x-axis <40.000000> speed <145.000000>; + turn lknee to x-axis <-35.000000> speed <145.000000>; + turn lshin to x-axis <-40.000000> speed <145.000000>; + turn lfoot to x-axis <35.000000> speed <145.000000>; + move body to y-axis [0.000000] speed [4.443359]; + turn head to x-axis <10.000000> speed <20.000000>; + turn tail to x-axis <-10.000000> speed <20.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(); +} + +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 <250.000000>; + turn head to x-axis <0.000000> - pitch speed <200.000000>; + wait-for-turn head around y-axis; + start-script RestoreAfterDelay(); + return (1); +} + +Shot1() +{ + turn lsack to y-axis <30.000000> speed <200.000000>; + turn rsack to y-axis <-30.000000> speed <200.000000>; + move rsack to x-axis [-1.000000] speed [9.000000]; + move lsack to x-axis [1.000000] speed [9.000000]; + wait-for-turn lsack around y-axis; + set CHANGE_TARGET to 1; + turn lsack to y-axis <0.000000> speed <20.000000>; + turn rsack to y-axis <0.000000> speed <20.000000>; + move rsack to x-axis [0.000000] speed [0.300000]; + move lsack to x-axis [0.000000] speed [0.300000]; +} + +HitByWeaponId() +{ + emit-sfx 1024 from body; + return (100); +} + + +Killed(severity, corpsetype) +{ + corpsetype = 1; + emit-sfx 1025 from body; + emit-sfx 1025 from head; + emit-sfx 1025 from tail; + emit-sfx 1025 from lsack; + explode body type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode head type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode tail type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lthigh type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lknee type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lshin type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rthigh type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rknee type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rshin type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode rsack type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; + explode lsack type FALL | EXPLODE_ON_HIT | NOHEATCLOUD; +} diff --git a/Scripts/ChickenDefenseScripts/chickenr3.cob b/Scripts/ChickenDefenseScripts/chickenr3.cob new file mode 100644 index 000000000..3661264f2 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenr3.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickens1.bos b/Scripts/ChickenDefenseScripts/chickens1.bos new file mode 100644 index 000000000..636ed0c8a --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickens1.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 <250>; + turn head to x-axis 0 -pitch speed <200>; + + 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 <250>; + 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]; + } + +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/ChickenDefenseScripts/chickens1.cob b/Scripts/ChickenDefenseScripts/chickens1.cob new file mode 100644 index 000000000..a6e7a4439 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickens1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickens2.bos b/Scripts/ChickenDefenseScripts/chickens2.bos new file mode 100644 index 000000000..af3a93e9b --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickens2.bos @@ -0,0 +1,224 @@ +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<310>; + + turn rthigh to x-axis <-20> speed<310>; + turn rknee to x-axis <-60> speed<310>; + turn rshin to x-axis <50> speed<310>; + turn rfoot to x-axis <30> speed<310>; + + 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<225>; + turn lshin to x-axis <-60> speed<250>; + turn lfoot to x-axis <30> speed<225>; + + turn rthigh to x-axis <40> speed<225>; + turn rknee to x-axis <-35> speed<225>; + turn rshin to x-axis <-40> speed<225>; + turn rfoot to x-axis <35> speed<225>; + + 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<225>; + turn rshin to x-axis <20> speed<225>; + turn rfoot to x-axis <-50> speed<310>; + + turn lthigh to x-axis <-20> speed<310>; + turn lknee to x-axis <-60> speed<310>; + turn lshin to x-axis <50> speed<310>; + turn lfoot to x-axis <30> speed<310>; + + 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<225>; + turn rshin to x-axis <-60> speed<250>; + turn rfoot to x-axis <30> speed<225>; + + turn lthigh to x-axis <40> speed<225>; + turn lknee to x-axis <-35> speed<225>; + turn lshin to x-axis <-40> speed<225>; + turn lfoot to x-axis <35> speed<225>; + + + 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 <250>; + turn head to x-axis 0 -pitch speed <200>; + + wait-for-turn head around y-axis; + sleep 300; + 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 <250>; + 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]; + } + +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/ChickenDefenseScripts/chickens2.cob b/Scripts/ChickenDefenseScripts/chickens2.cob new file mode 100644 index 000000000..d22783cb6 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickens2.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickens3.cob b/Scripts/ChickenDefenseScripts/chickens3.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickens3.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenw1.bos b/Scripts/ChickenDefenseScripts/chickenw1.bos new file mode 100644 index 000000000..1e8802701 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/chickenw1.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/ChickenDefenseScripts/chickenw1.cob b/Scripts/ChickenDefenseScripts/chickenw1.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenw1.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenw1b.cob b/Scripts/ChickenDefenseScripts/chickenw1b.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenw1b.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenw1c.cob b/Scripts/ChickenDefenseScripts/chickenw1c.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenw1c.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenw1d.cob b/Scripts/ChickenDefenseScripts/chickenw1d.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenw1d.cob differ diff --git a/Scripts/ChickenDefenseScripts/chickenw2.cob b/Scripts/ChickenDefenseScripts/chickenw2.cob new file mode 100644 index 000000000..0b61548c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/chickenw2.cob differ diff --git a/Scripts/ChickenDefenseScripts/e_chickenq.cob b/Scripts/ChickenDefenseScripts/e_chickenq.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/e_chickenq.cob differ diff --git a/Scripts/ChickenDefenseScripts/epic_chickenq.bos b/Scripts/ChickenDefenseScripts/epic_chickenq.bos new file mode 100644 index 000000000..6846e62e4 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/epic_chickenq.bos @@ -0,0 +1,425 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +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 bMoving, Static_Var_2, Static_Var_3, Static_Var_4, Static_Var_5; + +// Signal definitions +#define SIG_AIM 2 + + +walk() +{ + while( bMoving ) + { + Static_Var_2 = 1; + if( bMoving ) + { + turn lthighf to x-axis <70.000000> speed <115.000000>; + turn lkneef to x-axis <-40.000000> speed <145.000000>; + turn lshinf to x-axis <20.000000> speed <145.000000>; + turn lfootf to x-axis <-50.000000> speed <210.000000>; + turn rthighf to x-axis <-20.000000> speed <210.000000>; + turn rkneef to x-axis <-60.000000> speed <210.000000>; + turn rshinf to x-axis <50.000000> speed <210.000000>; + turn rfootf to x-axis <30.000000> speed <210.000000>; + turn rthighb to x-axis <70.000000> speed <115.000000>; + turn rkneeb to x-axis <-40.000000> speed <145.000000>; + turn rshinb to x-axis <20.000000> speed <145.000000>; + turn rfootb to x-axis <-50.000000> speed <210.000000>; + turn lthighb to x-axis <-20.000000> speed <210.000000>; + turn lkneeb to x-axis <-60.000000> speed <210.000000>; + turn lshinb to x-axis <50.000000> speed <210.000000>; + turn lfootb to x-axis <30.000000> speed <210.000000>; + turn body to z-axis <5.000000> speed <20.000000>; + turn lthighf to z-axis <-5.000000> speed <20.000000>; + turn rthighf to z-axis <-5.000000> speed <20.000000>; + turn lthighb to z-axis <-5.000000> speed <20.000000>; + turn rthighb to z-axis <-5.000000> speed <20.000000>; + move body to y-axis [0.700000] speed [4.443359]; + turn tail to y-axis <10.000000> speed <40.000000>; + turn head to x-axis <-10.000000> speed <20.000000>; + turn tail to x-axis <10.000000> speed <20.000000>; + wait-for-turn lthighf around x-axis; + emit-sfx 1024+3 from lthighf; + emit-sfx 1024+3 from spike1; + } + if( bMoving ) + { + turn lthighf to x-axis <-10.000000> speed <160.000000>; + turn lkneef to x-axis <15.000000> speed <145.000000>; + turn lshinf to x-axis <-60.000000> speed <250.000000>; + turn lfootf to x-axis <30.000000> speed <145.000000>; + turn rthighf to x-axis <40.000000> speed <145.000000>; + turn rkneef to x-axis <-35.000000> speed <145.000000>; + turn rshinf to x-axis <-40.000000> speed <145.000000>; + turn rfootf to x-axis <35.000000> speed <145.000000>; + turn rthighb to x-axis <-10.000000> speed <160.000000>; + turn rkneeb to x-axis <15.000000> speed <145.000000>; + turn rshinb to x-axis <-60.000000> speed <250.000000>; + turn rfootb to x-axis <30.000000> speed <145.000000>; + turn lthighb to x-axis <40.000000> speed <145.000000>; + turn lkneeb to x-axis <-35.000000> speed <145.000000>; + turn lshinb to x-axis <-40.000000> speed <145.000000>; + turn lfootb to x-axis <35.000000> speed <145.000000>; + move body to y-axis [0.000000] speed [4.443359]; + turn head to x-axis <10.000000> speed <20.000000>; + turn tail to x-axis <-10.000000> speed <20.000000>; + wait-for-turn lshinf around x-axis; + emit-sfx 1024+3 from lshinf; + emit-sfx 1024+3 from spike2; + } + if( bMoving ) + { + turn rthighf to x-axis <70.000000> speed <115.000000>; + turn rkneef to x-axis <-40.000000> speed <145.000000>; + turn rshinf to x-axis <20.000000> speed <145.000000>; + turn rfootf to x-axis <-50.000000> speed <210.000000>; + turn lthighf to x-axis <-20.000000> speed <210.000000>; + turn lkneef to x-axis <-60.000000> speed <210.000000>; + turn lshinf to x-axis <50.000000> speed <210.000000>; + turn lfootf to x-axis <30.000000> speed <210.000000>; + turn lthighb to x-axis <70.000000> speed <115.000000>; + turn lkneeb to x-axis <-40.000000> speed <145.000000>; + turn lshinb to x-axis <20.000000> speed <145.000000>; + turn lfootb to x-axis <-50.000000> speed <210.000000>; + turn rthighb to x-axis <-20.000000> speed <210.000000>; + turn rkneeb to x-axis <-60.000000> speed <210.000000>; + turn rshinb to x-axis <50.000000> speed <210.000000>; + turn rfootb to x-axis <30.000000> speed <210.000000>; + turn tail to y-axis <-10.000000> speed <40.000000>; + turn body to z-axis <-5.000000> speed <20.000000>; + turn lthighf to z-axis <5.000000> speed <20.000000>; + turn rthighf to z-axis <5.000000> speed <20.000000>; + turn lthighb to z-axis <5.000000> speed <20.000000>; + turn rthighb to z-axis <5.000000> speed <20.000000>; + move body to y-axis [0.700000] speed [4.443359]; + turn head to x-axis <-10.000000> speed <20.000000>; + turn tail to x-axis <10.000000> speed <20.000000>; + wait-for-turn rthighf around x-axis; + emit-sfx 1024+3 from rthighf; + emit-sfx 1024+3 from spike3; + } + if( bMoving ) + { + turn rthighf to x-axis <-10.000000> speed <160.000000>; + turn rkneef to x-axis <15.000000> speed <145.000000>; + turn rshinf to x-axis <-60.000000> speed <250.000000>; + turn rfootf to x-axis <30.000000> speed <145.000000>; + turn lthighf to x-axis <40.000000> speed <145.000000>; + turn lkneef to x-axis <-35.000000> speed <145.000000>; + turn lshinf to x-axis <-40.000000> speed <145.000000>; + turn lfootf to x-axis <35.000000> speed <145.000000>; + turn lthighb to x-axis <-10.000000> speed <160.000000>; + turn lkneeb to x-axis <15.000000> speed <145.000000>; + turn lshinb to x-axis <-60.000000> speed <250.000000>; + turn lfootb to x-axis <30.000000> speed <145.000000>; + turn rthighb to x-axis <40.000000> speed <145.000000>; + turn rkneeb to x-axis <-35.000000> speed <145.000000>; + turn rshinb to x-axis <-40.000000> speed <145.000000>; + turn rfootb to x-axis <35.000000> speed <145.000000>; + move body to y-axis [0.000000] speed [4.443359]; + turn head to x-axis <10.000000> speed <20.000000>; + turn tail to x-axis <-10.000000> speed <20.000000>; + wait-for-turn rshinf around x-axis; + emit-sfx 1024+3 from rshinf; + emit-sfx 1024+3 from head; + } + } +} + +Halt() +{ + sleep 150; + if( !bMoving ) + { + Static_Var_2 = 0; + turn lfootf to x-axis <0.000000> speed <200.000000>; + turn rfootf to x-axis <0.000000> speed <200.000000>; + turn rthighf to x-axis <0.000000> speed <200.000000>; + turn lthighf to x-axis <0.000000> speed <200.000000>; + turn lshinf to x-axis <0.000000> speed <200.000000>; + turn rshinf to x-axis <0.000000> speed <200.000000>; + turn lkneef to x-axis <0.000000> speed <200.000000>; + turn rkneef to x-axis <0.000000> speed <200.000000>; + turn lfootb to x-axis <0.000000> speed <200.000000>; + turn rfootb to x-axis <0.000000> speed <200.000000>; + turn rthighb to x-axis <0.000000> speed <200.000000>; + turn lthighb to x-axis <0.000000> speed <200.000000>; + turn lshinb to x-axis <0.000000> speed <200.000000>; + turn rshinb to x-axis <0.000000> speed <200.000000>; + turn lkneeb to x-axis <0.000000> speed <200.000000>; + turn rkneeb to x-axis <0.000000> speed <200.000000>; + } +} + +StartMoving() +{ + bMoving = TRUE; + if( !Static_Var_2 ) + { + start-script walk(); + } +} + +StopMoving() +{ + bMoving = 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(Func_Var_1) +{ + Func_Var_1 = 27; +} + +QueryWeapon2(Func_Var_1) +{ + Func_Var_1 = 27; +} + +AimFromWeapon3(Func_Var_1) +{ + Func_Var_1 = 28; +} + +QueryWeapon3(Func_Var_1) +{ + Func_Var_1 = 28; +} + +AimFromWeapon4(Func_Var_1) +{ + Func_Var_1 = 29; +} + +QueryWeapon4(Func_Var_1) +{ + Func_Var_1 = 29; +} + +AimFromWeapon5(Func_Var_1) +{ + Func_Var_1 = 30; +} + +QueryWeapon5(Func_Var_1) +{ + Func_Var_1 = 30; +} + +AimPrimary(heading, pitch) +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn head to y-axis heading speed <350.000000>; + turn head to x-axis <0.000000> - pitch speed <300.000000>; + wait-for-turn head around y-axis; + return (1); +} + +AimWeapon2() +{ + return (1); +} + +AimWeapon3() +{ + return (1); +} + +AimWeapon4() +{ + return (1); +} + +AimWeapon5(Func_Var_1, Func_Var_2) +{ + Static_Var_4 = Func_Var_2; + Static_Var_5 = Func_Var_1; + return (1); +} + +Shot1() +{ + ++Static_Var_3; + if( Static_Var_3 > 4 ) + { + Static_Var_3 = 1; + } + if( Static_Var_3 == 1 ) + { + turn lforearmu to y-axis <-140.000000> speed <600.000000>; + turn lbladeu to y-axis <140.000000> speed <600.000000>; + wait-for-turn lbladeu around y-axis; + turn lforearmu to y-axis <0.000000> speed <120.000000>; + turn lbladeu to y-axis <0.000000> speed <120.000000>; + } + if( Static_Var_3 == 2 ) + { + turn lforearml to y-axis <-140.000000> speed <600.000000>; + turn lbladel to y-axis <140.000000> speed <600.000000>; + wait-for-turn lbladel around y-axis; + turn lforearml to y-axis <0.000000> speed <120.000000>; + turn lbladel to y-axis <0.000000> speed <120.000000>; + } + if( Static_Var_3 == 3 ) + { + turn rforearmu to y-axis <140.000000> speed <600.000000>; + turn rbladeu to y-axis <-140.000000> speed <600.000000>; + wait-for-turn rbladeu around y-axis; + turn rforearmu to y-axis <0.000000> speed <120.000000>; + turn rbladeu to y-axis <0.000000> speed <120.000000>; + } + if( Static_Var_3 == 4 ) + { + turn rforearml to y-axis <140.000000> speed <600.000000>; + turn rbladel to y-axis <-140.000000> speed <600.000000>; + wait-for-turn rbladel around y-axis; + turn rforearml to y-axis <0.000000> speed <120.000000>; + turn rbladel to y-axis <0.000000> speed <120.000000>; + } +} + +Shot2() +{ + set UNKNOWN_UNIT_VALUE(98) to 2; +} + +Shot3() +{ + set UNKNOWN_UNIT_VALUE(98) to 3; +} + +Shot4() +{ + set UNKNOWN_UNIT_VALUE(98) to 4; +} + +Shot5() +{ + turn head to x-axis <0.000000> - Static_Var_4 speed <400.000000>; + turn head to y-axis Static_Var_5 speed <300.000000>; + wait-for-turn head around x-axis; + turn lforearmu to y-axis <-140.000000> speed <600.000000>; + turn lbladeu to y-axis <140.000000> speed <600.000000>; + turn lforearml to y-axis <-140.000000> speed <600.000000>; + turn lbladel to y-axis <140.000000> speed <600.000000>; + turn rforearmu to y-axis <140.000000> speed <600.000000>; + turn rbladeu to y-axis <-140.000000> speed <600.000000>; + turn rforearml to y-axis <140.000000> speed <600.000000>; + turn rbladel to y-axis <-140.000000> speed <600.000000>; + 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.000000> speed <120.000000>; + turn lbladeu to y-axis <0.000000> speed <120.000000>; + turn lforearml to y-axis <0.000000> speed <120.000000>; + turn lbladel to y-axis <0.000000> speed <120.000000>; + turn rforearmu to y-axis <0.000000> speed <120.000000>; + turn rbladeu to y-axis <0.000000> speed <120.000000>; + turn rforearml to y-axis <0.000000> speed <120.000000>; + turn rbladel to y-axis <0.000000> speed <120.000000>; +} + +HitByWeaponId(Func_Var_1, Func_Var_2, Func_Var_3, Func_Var_4) +{ + if( Func_Var_3 == 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; +} diff --git a/Scripts/ChickenDefenseScripts/epic_chickenq.cob b/Scripts/ChickenDefenseScripts/epic_chickenq.cob new file mode 100644 index 000000000..f4a39cf49 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/epic_chickenq.cob differ diff --git a/Scripts/ChickenDefenseScripts/h_chickenq.cob b/Scripts/ChickenDefenseScripts/h_chickenq.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/h_chickenq.cob differ diff --git a/Scripts/ChickenDefenseScripts/n_chickenq.bos b/Scripts/ChickenDefenseScripts/n_chickenq.bos new file mode 100644 index 000000000..37008dfcb --- /dev/null +++ b/Scripts/ChickenDefenseScripts/n_chickenq.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/ChickenDefenseScripts/n_chickenq.cob b/Scripts/ChickenDefenseScripts/n_chickenq.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/n_chickenq.cob differ diff --git a/Scripts/ChickenDefenseScripts/roost.bos b/Scripts/ChickenDefenseScripts/roost.bos new file mode 100644 index 000000000..94796f953 --- /dev/null +++ b/Scripts/ChickenDefenseScripts/roost.bos @@ -0,0 +1,55 @@ +#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; + dont-shade base; + dont-cache base; + set ARMORED to 0; + move launcher to y-axis [3000.000000] speed [10000.000000]; + move launcher to x-axis [0.000000] speed [10000.000000]; + move launcher to z-axis [0.000000] speed [10000.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/ChickenDefenseScripts/roost.cob b/Scripts/ChickenDefenseScripts/roost.cob new file mode 100644 index 000000000..5eedd9a0d Binary files /dev/null and b/Scripts/ChickenDefenseScripts/roost.cob differ diff --git a/Scripts/ChickenDefenseScripts/ve_chickenq.cob b/Scripts/ChickenDefenseScripts/ve_chickenq.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/ve_chickenq.cob differ diff --git a/Scripts/ChickenDefenseScripts/vh_chickenq.cob b/Scripts/ChickenDefenseScripts/vh_chickenq.cob new file mode 100644 index 000000000..e630ee1c1 Binary files /dev/null and b/Scripts/ChickenDefenseScripts/vh_chickenq.cob differ 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/eairplant2.bos b/Scripts/eairplant2.bos deleted file mode 100644 index f7ae82491..000000000 --- a/Scripts/eairplant2.bos +++ /dev/null @@ -1,245 +0,0 @@ -#define TA // This is a TA script - -#include "sfxtype.h" -#include "exptype.h" - -piece base, base1, base2, base3, base4, spinner1, spinner2, spinner3, spinner4, nanopoint1, nano1, nano2, nano3, nano4, sfxpoint1, sfxpoint2; - -static-var spray, unitviewer, statechg_DesiredState, statechg_StateChanging, building; - -// 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() -{ - spin spinner1 around y-axis speed <50.005495>; - spin spinner2 around y-axis speed <50.005495>; - spin spinner3 around y-axis speed <50.005495>; - spin spinner4 around y-axis speed <50.005495>; - 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 spinner1 around z-axis decelerate <15.000000>; - stop-spin spinner2 around z-axis decelerate <15.000000>; - stop-spin spinner3 around z-axis decelerate <15.000000>; - stop-spin spinner4 around z-axis decelerate <15.000000>; - 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 base1 type EXPLODE_ON_HIT; - explode base2 type EXPLODE_ON_HIT; - explode base3 type EXPLODE_ON_HIT; - explode base4 type EXPLODE_ON_HIT; - explode spinner1 type EXPLODE_ON_HIT; - explode spinner2 type EXPLODE_ON_HIT; - explode spinner3 type EXPLODE_ON_HIT; - explode spinner4 type EXPLODE_ON_HIT; -} diff --git a/Scripts/eairplant2.cob b/Scripts/eairplant2.cob deleted file mode 100644 index e85e3c19d..000000000 Binary files a/Scripts/eairplant2.cob and /dev/null differ diff --git a/Scripts/eairplant3.bos b/Scripts/eairplant3.bos index 6194e769a..c102aeec6 100644 --- a/Scripts/eairplant3.bos +++ b/Scripts/eairplant3.bos @@ -172,7 +172,7 @@ Create() start-script Buildingfx(); // start-script Buildingfx2(); start-script fx(); - start-script Thrust(); +// start-script Thrust(); turn engine1 to x-axis <90> now; turn engine2 to x-axis <90> now; turn engine3 to x-axis <90> now; diff --git a/Scripts/eairplant3.cob b/Scripts/eairplant3.cob index 74bf6b3de..465135ca4 100644 Binary files a/Scripts/eairplant3.cob and b/Scripts/eairplant3.cob 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/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/eamphibbuggy_lus.lua b/Scripts/eamphibbuggy_lus.lua index 46a3a02d6..c4059b984 100644 --- a/Scripts/eamphibbuggy_lus.lua +++ b/Scripts/eamphibbuggy_lus.lua @@ -11,10 +11,6 @@ end common = include("headers/common_includes_lus.lua") -function script.setSFXoccupy(setSFXoccupy_argument) - common.setSFXoccupy(setSFXoccupy_argument) -end - function script.StartMoving() isMoving = true StartThread(thrust) @@ -53,7 +49,7 @@ function script.AimWeapon(weaponID, heading, pitch) Signal(SIG_AIM) SetSignalMask(SIG_AIM) Turn(turret, y_axis, heading, 100) - Turn(barrel1, x_axis, pitch, 100) + Turn(barrel1, x_axis, -pitch, 100) WaitForTurn(turret, y_axis) WaitForTurn(barrel1, x_axis) StartThread(RestoreAfterDelay) 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/eamphibmedtank_lus.lua b/Scripts/eamphibmedtank_lus.lua index 38f5dd4c0..9127f2c1c 100644 --- a/Scripts/eamphibmedtank_lus.lua +++ b/Scripts/eamphibmedtank_lus.lua @@ -11,10 +11,6 @@ end common = include("headers/common_includes_lus.lua") -function script.setSFXoccupy(setSFXoccupy_argument) - common.setSFXoccupy(setSFXoccupy_argument) -end - function script.StartMoving() isMoving = true StartThread(thrust) @@ -55,7 +51,7 @@ function script.AimWeapon(weaponID, heading, pitch) Signal(SIG_AIM) SetSignalMask(SIG_AIM) Turn(turret, y_axis, heading, 100) - Turn(barrel1, x_axis, pitch, 100) + Turn(barrel1, x_axis, -pitch, 100) WaitForTurn(turret, y_axis) WaitForTurn(barrel1, x_axis) StartThread(RestoreAfterDelay) 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/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/ebox.bos b/Scripts/ebox.bos new file mode 100644 index 000000000..c65d84329 --- /dev/null +++ b/Scripts/ebox.bos @@ -0,0 +1,138 @@ +#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; + +// 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 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(); +} + +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 = forwarddome; +} + +QueryWeapon1(piecenum) // where the shot is called from +{ +piecenum = forwarddome; +} + +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/ebox.cob b/Scripts/ebox.cob new file mode 100644 index 000000000..83ffc0673 Binary files /dev/null and b/Scripts/ebox.cob differ diff --git a/Scripts/ebox_lus.lua b/Scripts/ebox_lus.lua new file mode 100644 index 000000000..e9467f91a --- /dev/null +++ b/Scripts/ebox_lus.lua @@ -0,0 +1,41 @@ +base, forwarddome, reardome, rearleftwing, frontleftwing, frontrightwing, rearrightwing, dirt = piece('base', 'forwarddome', 'reardome', 'rearleftwing', 'frontleftwing', 'frontrightwing', 'rearrightwing', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + building = false + Move(base, y_axis, 5, 200) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + +function script.Killed() + Explode(forwarddome, SFX.EXPLODE_ON_HIT) + Explode(reardome, SFX.EXPLODE_ON_HIT) + Explode(rearleftwing, SFX.EXPLODE_ON_HIT) + Explode(frontleftwing, SFX.EXPLODE_ON_HIT) + Explode(frontrightwing, SFX.EXPLODE_ON_HIT) + Explode(rearrightwing, 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/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/ecommander3.bos b/Scripts/ecommander3.bos index 873307dff..17794c591 100644 --- a/Scripts/ecommander3.bos +++ b/Scripts/ecommander3.bos @@ -307,7 +307,7 @@ buildflame() Create() { - move firepoint1 to y-axis [1000] now; + //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; diff --git a/Scripts/ecommander3.cob b/Scripts/ecommander3.cob index d87b4230c..3275f5134 100644 Binary files a/Scripts/ecommander3.cob and b/Scripts/ecommander3.cob differ diff --git a/Scripts/ecommander3shield.bos b/Scripts/ecommander3shield.bos new file mode 100644 index 000000000..78c52e1a1 --- /dev/null +++ b/Scripts/ecommander3shield.bos @@ -0,0 +1,389 @@ + +// 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; + +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 [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=base; +} + +AimPrimary(heading,pitch) +{ + signal SIG_AIM1; + set-signal-mask SIG_AIM1; + return(1); +} + +QueryPrimary(firefrom) +{ + firefrom=base; +} + +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; +} \ No newline at end of file diff --git a/Scripts/ecommander3shield.cob b/Scripts/ecommander3shield.cob new file mode 100644 index 000000000..bf516d09e Binary files /dev/null and b/Scripts/ecommander3shield.cob differ diff --git a/Scripts/ecommander4-battle.bos b/Scripts/ecommander4-battle.bos new file mode 100644 index 000000000..4385cb4e5 --- /dev/null +++ b/Scripts/ecommander4-battle.bos @@ -0,0 +1,400 @@ + +// 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, firepoint2, turret2, barrel2; + +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 [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(); +} + +RestoreAfterDelay() // restore function to turn the turret and so forth back to start +{ +sleep 3000; +turn turret2 to y-axis <0> speed <60>; +turn barrel2 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 turret2 to y-axis heading speed <5000>; +turn barrel2 to x-axis <0> - pitch speed <5000>; +wait-for-turn turret2 around y-axis; +wait-for-turn barrel2 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 firepoint2; +} + +AimFromPrimary(piecenum) // where it aims the weapon from +{ +piecenum = barrel2; +} + +QueryPrimary(piecenum) // where the shot is called from +{ +piecenum = firepoint2; +} + + +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; +} \ No newline at end of file diff --git a/Scripts/ecommander4-battle.cob b/Scripts/ecommander4-battle.cob new file mode 100644 index 000000000..234808d4a Binary files /dev/null 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/edrone2.bos b/Scripts/edrone2.bos index 4bcba00bc..bfb666c45 100644 --- a/Scripts/edrone2.bos +++ b/Scripts/edrone2.bos @@ -3,7 +3,7 @@ #include "sfxtype.h" #include "exptype.h" -piece base, firepoint1, frontengines, fengine1, fengine2, rearengines, rengine1, rengine2; +piece base, firepoint1, frontengines, fengine1, fengine2, rearengines, rengine1, rengine2, turret, barrel1; static-var moving, flames; @@ -84,25 +84,38 @@ MoveRate2() turn rearengines to x-axis <0.000000> speed <150.000000>; } +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; -return (1); +{ + signal SIG_AIM; + set-signal-mask SIG_AIM; + turn turret to y-axis heading speed <500>; + turn barrel1 to x-axis <0> - pitch speed <500>; + 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 = base; + piecenum = turret; } QueryWeapon1(piecenum) // where the shot is called from { -piecenum = firepoint1; + piecenum = firepoint1; } Create() diff --git a/Scripts/edrone2.cob b/Scripts/edrone2.cob index 67d5a8683..ec15c222b 100644 Binary files a/Scripts/edrone2.cob and b/Scripts/edrone2.cob 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/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/ehbotengineer_lus.lua b/Scripts/ehbotengineer_lus.lua new file mode 100644 index 000000000..1b9377fb1 --- /dev/null +++ b/Scripts/ehbotengineer_lus.lua @@ -0,0 +1,77 @@ +base, turret, nanos, nanopoint1, nanopoint2, dirt, backpack, exhaust1, exhaust2 = piece('base', 'turret', 'nanos', 'nanopoint1', 'nanopoint2', 'dirt', 'backpack', 'exhaust1', 'exhaust2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(doYouEvenLift) + 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 doYouEvenLift() + common.HbotLift() +end + +function thrust() + common.DirtTrail() +end + +function BuildFX() + while(building == true) do + EmitSfx (nanopoint1, 1024) + EmitSfx (nanopoint2, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(base, y_axis, 0, 5) + end +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("nanopoint" .. i) +end +Spring.SetUnitNanoPieces(unitID, nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + Turn(base, 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(nanos, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, 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/ehbotengineer_turret_lus.lua b/Scripts/ehbotengineer_turret_lus.lua new file mode 100644 index 000000000..c161686ea --- /dev/null +++ b/Scripts/ehbotengineer_turret_lus.lua @@ -0,0 +1,72 @@ +base, turret, nanos, nanopoint1, nanopoint2, dirt = piece('base', 'turret', 'nanos', 'nanopoint1', 'nanopoint2', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(BuildFX) + building = false + Move(base, y_axis, -1, 50) +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 (nanopoint1, 1024) + EmitSfx (nanopoint2, 1024) + Sleep(550) + end +end + +function RestoreAfterDelay() + if building == false then + Sleep(2000) + Turn(turret, y_axis, 0, 5) + end +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("nanopoint" .. i) +end +Spring.SetUnitNanoPieces(unitID, nanoPoints) + +function script.StartBuilding(heading, pitch) + -- TODO: This is where you would add your unpack / point towards animation + Turn(turret, 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(nanos, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/ehbotfac.bos b/Scripts/ehbotfac.bos new file mode 100644 index 000000000..87158a730 --- /dev/null +++ b/Scripts/ehbotfac.bos @@ -0,0 +1,267 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, base1, base2, base3, base4, spinner1, spinner2, spinner3, spinner4, nanopoint1, nano1, nano2, nano3, nano4, sfxpoint1, sfxpoint2, lilypad; + +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; + } +} + +setSFXoccupy(setSFXoccupy_argument) +{ +terraintype = setSFXoccupy_argument; + + if(terraintype == 2) + { + move base to y-axis [-3] speed [50]; + } + else + { + move base to y-axis [-3] speed [50]; + } + if(terraintype == 4) + { + move base to y-axis [-3] speed [50]; + } + else + { + move base to y-axis [-3] speed [50]; + } +} + +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() +{ + spin spinner1 around y-axis speed <50.005495>; + spin spinner2 around y-axis speed <50.005495>; + spin spinner3 around y-axis speed <50.005495>; + spin spinner4 around y-axis speed <50.005495>; + 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 spinner1 around z-axis decelerate <15.000000>; + stop-spin spinner2 around z-axis decelerate <15.000000>; + stop-spin spinner3 around z-axis decelerate <15.000000>; + stop-spin spinner4 around z-axis decelerate <15.000000>; + 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 base1 type EXPLODE_ON_HIT; + explode base2 type EXPLODE_ON_HIT; + explode base3 type EXPLODE_ON_HIT; + explode base4 type EXPLODE_ON_HIT; + explode spinner1 type EXPLODE_ON_HIT; + explode spinner2 type EXPLODE_ON_HIT; + explode spinner3 type EXPLODE_ON_HIT; + explode spinner4 type EXPLODE_ON_HIT; +} diff --git a/Scripts/ehbotfac.cob b/Scripts/ehbotfac.cob new file mode 100644 index 000000000..81aa2c585 Binary files /dev/null and b/Scripts/ehbotfac.cob differ diff --git a/Scripts/ehbotkarganneth_lus.lua b/Scripts/ehbotkarganneth_lus.lua new file mode 100644 index 000000000..2fc2b8ea0 --- /dev/null +++ b/Scripts/ehbotkarganneth_lus.lua @@ -0,0 +1,79 @@ +base, turret, barrel1, firepoint1, firepoint2, dirt, backpack, exhaust1, exhaust2, gat1, gat2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt', 'backpack', 'exhaust1', 'exhaust2', 'gat1', 'gat2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(doYouEvenLift) +end + +common = include("headers/common_includes_lus.lua") + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function doYouEvenLift() + common.HbotLift() +end + +function thrust() + common.DirtTrail() +end + +local function RestoreAfterDelay() + Sleep(2000) + Turn(base, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) + Spring.UnitScript.StopSpin( gat1, z_axis, 0.01) + Spring.UnitScript.StopSpin( gat2, z_axis, 0.01) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1, firepoint2} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + currentFirepoint = 3 - currentFirepoint + Spring.UnitScript.Spin( gat1, z_axis, 5 ) + Spring.UnitScript.Spin( gat2, z_axis, -5 ) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(base, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(base, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, SFX.EXPLODE_ON_HIT) + Explode(gat1, SFX.EXPLODE_ON_HIT) + Explode(gat2, 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/ehbotkarganneth_turret_lus.lua b/Scripts/ehbotkarganneth_turret_lus.lua new file mode 100644 index 000000000..18c7f55ad --- /dev/null +++ b/Scripts/ehbotkarganneth_turret_lus.lua @@ -0,0 +1,74 @@ +base, turret, barrel1, firepoint1, firepoint2, dirt, gat1, gat2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt', 'gat1', 'gat2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + Move(base, y_axis, -2, 50) +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 + +local function RestoreAfterDelay() + Sleep(2000) + Turn(base, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) + Spring.UnitScript.StopSpin( gat1, z_axis, 0.01) + Spring.UnitScript.StopSpin( gat2, z_axis, 0.01) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1, firepoint2} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + currentFirepoint = 3 - currentFirepoint + Spring.UnitScript.Spin( gat1, z_axis, 5 ) + Spring.UnitScript.Spin( gat2, z_axis, -5 ) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(base, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(gat1, SFX.EXPLODE_ON_HIT) + Explode(gat2, 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/ehbotpeewee_lus.lua b/Scripts/ehbotpeewee_lus.lua index 8cd060cb7..a4f8d67f3 100644 --- a/Scripts/ehbotpeewee_lus.lua +++ b/Scripts/ehbotpeewee_lus.lua @@ -1,4 +1,4 @@ -base, turret, barrel1, firepoint1, firepoint2, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt') +base, turret, barrel1, firepoint1, firepoint2, dirt, backpack, exhaust1, exhaust2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt', 'backpack', 'exhaust1', 'exhaust2') local SIG_AIM = {} -- state variables @@ -31,7 +31,7 @@ end local function RestoreAfterDelay() Sleep(2000) - Turn(turret, y_axis, 0, 5) + Turn(base, y_axis, 0, 5) Turn(barrel1, x_axis, 0, 5) end @@ -48,16 +48,16 @@ function script.QueryWeapon(weaponID) end function script.FireWeapon(weaponID) - EmitSfx (firepoints[currentFirepoint], 1024) currentFirepoint = 3 - currentFirepoint + EmitSfx (firepoints[currentFirepoint], 1024) end function script.AimWeapon(weaponID, heading, pitch) Signal(SIG_AIM) SetSignalMask(SIG_AIM) - Turn(turret, y_axis, heading, 100) + Turn(base, y_axis, heading, 100) Turn(barrel1, x_axis, -pitch, 100) - WaitForTurn(turret, y_axis) + WaitForTurn(base, y_axis) WaitForTurn(barrel1, x_axis) StartThread(RestoreAfterDelay) --Spring.Echo("AimWeapon: FireWeapon") @@ -68,5 +68,6 @@ function script.Killed() Explode(barrel1, SFX.EXPLODE_ON_HIT) Explode(turret, SFX.EXPLODE_ON_HIT) Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, 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/ehbotpeewee_turret_lus.lua b/Scripts/ehbotpeewee_turret_lus.lua new file mode 100644 index 000000000..daa343cbe --- /dev/null +++ b/Scripts/ehbotpeewee_turret_lus.lua @@ -0,0 +1,68 @@ +base, turret, barrel1, firepoint1, firepoint2, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + Move(base, y_axis, -1, 50) +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 + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1, firepoint2} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + currentFirepoint = 3 - currentFirepoint + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/ehbotrocko_lus.lua b/Scripts/ehbotrocko_lus.lua new file mode 100644 index 000000000..1f4644738 --- /dev/null +++ b/Scripts/ehbotrocko_lus.lua @@ -0,0 +1,72 @@ +base, turret, barrel1, firepoint1, dirt, backpack, exhaust1, exhaust2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 'backpack', 'exhaust1', 'exhaust2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(doYouEvenLift) +end + +common = include("headers/common_includes_lus.lua") + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function doYouEvenLift() + common.HbotLift() +end + +function thrust() + common.DirtTrail() +end + +local function RestoreAfterDelay() + Sleep(2000) + Turn(base, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(base, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(base, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, 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/ehbotrocko_turret_lus.lua b/Scripts/ehbotrocko_turret_lus.lua new file mode 100644 index 000000000..712666a19 --- /dev/null +++ b/Scripts/ehbotrocko_turret_lus.lua @@ -0,0 +1,67 @@ +base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + Move(base, y_axis, -1, 50) +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 + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/ehbotsniper_lus.lua b/Scripts/ehbotsniper_lus.lua new file mode 100644 index 000000000..1f4644738 --- /dev/null +++ b/Scripts/ehbotsniper_lus.lua @@ -0,0 +1,72 @@ +base, turret, barrel1, firepoint1, dirt, backpack, exhaust1, exhaust2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 'backpack', 'exhaust1', 'exhaust2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(doYouEvenLift) +end + +common = include("headers/common_includes_lus.lua") + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function doYouEvenLift() + common.HbotLift() +end + +function thrust() + common.DirtTrail() +end + +local function RestoreAfterDelay() + Sleep(2000) + Turn(base, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(base, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(base, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, 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/ehbotsniper_turret_lus.lua b/Scripts/ehbotsniper_turret_lus.lua new file mode 100644 index 000000000..712666a19 --- /dev/null +++ b/Scripts/ehbotsniper_turret_lus.lua @@ -0,0 +1,67 @@ +base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + Move(base, y_axis, -1, 50) +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 + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/ehbotthud_lus.lua b/Scripts/ehbotthud_lus.lua new file mode 100644 index 000000000..a4f8d67f3 --- /dev/null +++ b/Scripts/ehbotthud_lus.lua @@ -0,0 +1,73 @@ +base, turret, barrel1, firepoint1, firepoint2, dirt, backpack, exhaust1, exhaust2 = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt', 'backpack', 'exhaust1', 'exhaust2') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + StartThread(doYouEvenLift) +end + +common = include("headers/common_includes_lus.lua") + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function doYouEvenLift() + common.HbotLift() +end + +function thrust() + common.DirtTrail() +end + +local function RestoreAfterDelay() + Sleep(2000) + Turn(base, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1, firepoint2} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + currentFirepoint = 3 - currentFirepoint + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(base, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(base, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(base, SFX.EXPLODE_ON_HIT) + Explode(backpack, 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/ehbotthud_turret_lus.lua b/Scripts/ehbotthud_turret_lus.lua new file mode 100644 index 000000000..daa343cbe --- /dev/null +++ b/Scripts/ehbotthud_turret_lus.lua @@ -0,0 +1,68 @@ +base, turret, barrel1, firepoint1, firepoint2, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'firepoint2', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) + Move(base, y_axis, -1, 50) +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 + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeapon(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +local firepoints = {firepoint1, firepoint2} +local currentFirepoint = 1 + +function script.QueryWeapon(weaponID) + return firepoints[currentFirepoint] +end + +function script.FireWeapon(weaponID) + currentFirepoint = 3 - currentFirepoint + EmitSfx (firepoints[currentFirepoint], 1024) +end + +function script.AimWeapon(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/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/eheavytank4_up2_lus.lua b/Scripts/eheavytank4_up2_lus.lua new file mode 100644 index 000000000..26a4b1eef --- /dev/null +++ b/Scripts/eheavytank4_up2_lus.lua @@ -0,0 +1,123 @@ +base, turret, barrel1, firepoint1, pd1, pd2, pd3, pd4, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'pd1', 'pd2', 'pd3', 'pd4', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon2() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon2() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd1 +end + +function script.AimWeapon2(heading, pitch) + Signal(SIG_AIM_2) + SetSignalMask(SIG_AIM_2) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon2() +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon3() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon3() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd2 +end + +function script.AimWeapon3(heading, pitch) + Signal(SIG_AIM_3) + SetSignalMask(SIG_AIM_3) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon3() +end + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/eheavytank4_up3_lus.lua b/Scripts/eheavytank4_up3_lus.lua new file mode 100644 index 000000000..15d142a13 --- /dev/null +++ b/Scripts/eheavytank4_up3_lus.lua @@ -0,0 +1,171 @@ +base, turret, barrel1, firepoint1, pd1, pd2, pd3, pd4, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'pd1', 'pd2', 'pd3', 'pd4', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon2() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon2() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd1 +end + +function script.AimWeapon2(heading, pitch) + Signal(SIG_AIM_2) + SetSignalMask(SIG_AIM_2) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon2() +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon3() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon3() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd2 +end + +function script.AimWeapon3(heading, pitch) + Signal(SIG_AIM_3) + SetSignalMask(SIG_AIM_3) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon3() +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon4() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon4() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd3 +end + +function script.AimWeapon4(heading, pitch) + Signal(SIG_AIM_4) + SetSignalMask(SIG_AIM_4) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon4() +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon5() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon5() + --Spring.Echo("QueryWeapon: FireWeapon") + return pd4 +end + +function script.AimWeapon5(heading, pitch) + Signal(SIG_AIM_5) + SetSignalMask(SIG_AIM_5) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon5() +end + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/eheavytank_t3.lua b/Scripts/eheavytank_t3.lua new file mode 100644 index 000000000..481e2fc15 --- /dev/null +++ b/Scripts/eheavytank_t3.lua @@ -0,0 +1,100 @@ +base, turret, barrel1, firepoint1, dirt, t3turret, t3barrel1, t3firepoint = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 't3turret', 't3barrel1', 't3firepoint') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +function script.AimFromWeaponPrimary(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeaponPrimary(weaponID) + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeaponPrimary(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeaponPrimary(weaponID) + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + + +function script.AimFromWeaponSecondary(weaponID) + --Spring.Echo("AimFromWeapon: FireWeapon") + return t3turret +end + +function script.QueryWeaponSecondary(weaponID) + --Spring.Echo("QueryWeapon: FireWeapon") + return t3firepoint1 +end + +function script.AimWeaponSecondary(weaponID, heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(t3turret, y_axis) + WaitForTurn(t3barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeaponSecondary(weaponID) + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (t3firepoint1, 1024) +end + + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(t3barrel1, SFX.EXPLODE_ON_HIT) + Explode(t3turret, 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/eheavytank_t3_lus.lua b/Scripts/eheavytank_t3_lus.lua new file mode 100644 index 000000000..9fe59044c --- /dev/null +++ b/Scripts/eheavytank_t3_lus.lua @@ -0,0 +1,109 @@ +base, turret, barrel1, firepoint1, dirt, t3turret, t3barrel1, t3firepoint1 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 't3turret', 't3barrel1', 't3firepoint1') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(20000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) + Turn(t3turret, y_axis, 0, 5) + Turn(t3barrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon2() + --Spring.Echo("AimFromWeapon: FireWeapon") + return t3turret +end + +function script.QueryWeapon2() + --Spring.Echo("QueryWeapon: FireWeapon") + return t3firepoint1 +end + +function script.AimWeapon2(heading, pitch) + Signal(SIG_AIM_2) + SetSignalMask(SIG_AIM_2) + Turn(t3turret, y_axis, heading, 100) + Turn(t3barrel1, x_axis, -pitch, 100) + WaitForTurn(t3turret, y_axis) + WaitForTurn(t3barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon2() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (t3firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(t3barrel1, SFX.EXPLODE_ON_HIT) + Explode(t3turret, 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/eheavytank_upgraded_lus.lua b/Scripts/eheavytank_upgraded_lus.lua new file mode 100644 index 000000000..b235932e6 --- /dev/null +++ b/Scripts/eheavytank_upgraded_lus.lua @@ -0,0 +1,109 @@ +base, turret, barrel1, firepoint1, dirt, pdturret, pdbarrel1, pdfirepoint1 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 'pdturret', 'pdbarrel1', 'pdfirepoint1') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) + Turn(pdturret, y_axis, 0, 5) + Turn(pdbarrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon2() + --Spring.Echo("AimFromWeapon: FireWeapon") + return pdturret +end + +function script.QueryWeapon2() + --Spring.Echo("QueryWeapon: FireWeapon") + return pdfirepoint1 +end + +function script.AimWeapon2(heading, pitch) + Signal(SIG_AIM_2) + SetSignalMask(SIG_AIM_2) + Turn(pdturret, y_axis, heading, 100) + Turn(pdbarrel1, x_axis, -pitch, 100) + WaitForTurn(pdturret, y_axis) + WaitForTurn(pdbarrel1, x_axis) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon2() + --Spring.Echo("FireWeapon: FireWeapon") + common.CustomEmitter(pdfirepoint1, "factorysparks") -- Second argument is the piece name, third argument needs to be a string because it will be the name of the CEG effect used +end + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(pdbarrel1, SFX.EXPLODE_ON_HIT) + Explode(pdturret, 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/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/ekrow.bos b/Scripts/ekrow.bos new file mode 100644 index 000000000..62e5e0654 --- /dev/null +++ b/Scripts/ekrow.bos @@ -0,0 +1,107 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, turret, barrel1, firepoint1, engine1, engine2, engine3, engine4, engine5, engine6, engine7, engine8; + +static-var moving, flames, shooting_num; + +// 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) + { + spin base around y-axis speed <50.005495>; + } + sleep 5; + } +} + +StartMoving() +{ + moving=1; +} + +StopMoving() +{ + moving=0; +} + +Create() + { + 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 <500>; + 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 base type EXPLODE_ON_HIT; + explode turret type EXPLODE_ON_HIT; + explode barrel1 type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/ekrow.cob b/Scripts/ekrow.cob new file mode 100644 index 000000000..fb4b69d47 Binary files /dev/null and b/Scripts/ekrow.cob 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/elighttank3_lus.lua b/Scripts/elighttank3_lus.lua new file mode 100644 index 000000000..04db32dd8 --- /dev/null +++ b/Scripts/elighttank3_lus.lua @@ -0,0 +1,76 @@ +base, turret, barrel1, firepoint1, dirt = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, 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/elighttank3_upgraded_lus.lua b/Scripts/elighttank3_upgraded_lus.lua new file mode 100644 index 000000000..b235932e6 --- /dev/null +++ b/Scripts/elighttank3_upgraded_lus.lua @@ -0,0 +1,109 @@ +base, turret, barrel1, firepoint1, dirt, pdturret, pdbarrel1, pdfirepoint1 = piece('base', 'turret', 'barrel1', 'firepoint1', 'dirt', 'pdturret', 'pdbarrel1', 'pdfirepoint1') +local SIG_AIM = {} + +-- state variables +isMoving = "isMoving" +terrainType = "terrainType" + +function script.Create() + StartThread(common.SmokeUnit, {base, turret, barrel1}) +end + +common = include("headers/common_includes_lus.lua") + +function script.setSFXoccupy(setSFXoccupy_argument) + common.setSFXoccupy(setSFXoccupy_argument) +end + +function script.StartMoving() + isMoving = true + StartThread(thrust) +end + +function script.StopMoving() + isMoving = false +end + +function thrust() + common.DirtTrail() +end + + +local function RestoreAfterDelay() + Sleep(2000) + Turn(turret, y_axis, 0, 5) + Turn(barrel1, x_axis, 0, 5) + Turn(pdturret, y_axis, 0, 5) + Turn(pdbarrel1, x_axis, 0, 5) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon1() + --Spring.Echo("AimFromWeapon: FireWeapon") + return turret +end + +function script.QueryWeapon1() + --Spring.Echo("QueryWeapon: FireWeapon") + return firepoint1 +end + +function script.AimWeapon1(heading, pitch) + Signal(SIG_AIM) + SetSignalMask(SIG_AIM) + Turn(turret, y_axis, heading, 100) + Turn(barrel1, x_axis, -pitch, 100) + WaitForTurn(turret, y_axis) + WaitForTurn(barrel1, x_axis) + StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon1() + --Spring.Echo("FireWeapon: FireWeapon") + EmitSfx (firepoint1, 1024) +end + +------------------------------------------- +------------------------------------------- + +function script.AimFromWeapon2() + --Spring.Echo("AimFromWeapon: FireWeapon") + return pdturret +end + +function script.QueryWeapon2() + --Spring.Echo("QueryWeapon: FireWeapon") + return pdfirepoint1 +end + +function script.AimWeapon2(heading, pitch) + Signal(SIG_AIM_2) + SetSignalMask(SIG_AIM_2) + Turn(pdturret, y_axis, heading, 100) + Turn(pdbarrel1, x_axis, -pitch, 100) + WaitForTurn(pdturret, y_axis) + WaitForTurn(pdbarrel1, x_axis) + --StartThread(RestoreAfterDelay) + --Spring.Echo("AimWeapon: FireWeapon") + return true +end + +function script.FireWeapon2() + --Spring.Echo("FireWeapon: FireWeapon") + common.CustomEmitter(pdfirepoint1, "factorysparks") -- Second argument is the piece name, third argument needs to be a string because it will be the name of the CEG effect used +end + +------------------------------------------- +------------------------------------------- + +function script.Killed() + Explode(barrel1, SFX.EXPLODE_ON_HIT) + Explode(turret, SFX.EXPLODE_ON_HIT) + Explode(pdbarrel1, SFX.EXPLODE_ON_HIT) + Explode(pdturret, 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/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/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/energycore.lua b/Scripts/energycore.lua new file mode 100644 index 000000000..2c28b43f3 --- /dev/null +++ b/Scripts/energycore.lua @@ -0,0 +1,23 @@ +local base = piece "base" +local f = 0 +local x = ((math.floor((math.random()*180)/90))*90)* math.pi / 180 +local z = ((math.floor((math.random()*180)/90))*90)* math.pi / 180 +local y = ((math.floor((math.random()*180)/90))*90)* math.pi / 180 + +function script.Create() + Turn (base, x_axis, x, x/1.25) + Turn (base, z_axis, z, z/1.25) + Turn (base, y_axis, y, y/1.25) +end + +function Sink() + StartThread(MoveDown) +end + +function MoveDown() + while f > -900 do + Move(base, 2, f) + f = f - 0.05 + Sleep(1) + end +end \ No newline at end of file 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/eorb3.bos b/Scripts/eorb3.bos index aba2c66aa..4ca7e3629 100644 --- a/Scripts/eorb3.bos +++ b/Scripts/eorb3.bos @@ -134,6 +134,7 @@ Thrust() Create() { + move base to y-axis [8] now; Static_Var_3 = 0; Static_Var_1 = 0; call-script InitState(); diff --git a/Scripts/eorb3.cob b/Scripts/eorb3.cob index 00d5360c0..2fa5144c3 100644 Binary files a/Scripts/eorb3.cob and b/Scripts/eorb3.cob 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/eraider.bos b/Scripts/eraider.bos new file mode 100644 index 000000000..66da246b2 --- /dev/null +++ b/Scripts/eraider.bos @@ -0,0 +1,134 @@ +#define TA // This is a TA script + +#include "sfxtype.h" +#include "exptype.h" + +piece base, frontengines, fengine1, fengine2, rearengines, rengine1, rengine2, turret, barrel1, 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; + 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 <500>; + 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 base type EXPLODE_ON_HIT; + explode frontengines type EXPLODE_ON_HIT; + explode rearengines type EXPLODE_ON_HIT; +} \ No newline at end of file diff --git a/Scripts/eraider.cob b/Scripts/eraider.cob new file mode 100644 index 000000000..4baf099d4 Binary files /dev/null and b/Scripts/eraider.cob 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/headers/common_includes_lus.lua b/Scripts/headers/common_includes_lus.lua index fcf68e02c..0a08119d0 100644 --- a/Scripts/headers/common_includes_lus.lua +++ b/Scripts/headers/common_includes_lus.lua @@ -9,7 +9,7 @@ common = { HbotLift = function () Move(base, y_axis, 20, 200) - Spring.Echo("Bruh I lift") + --Spring.Echo("Bruh I lift") end, setSFXoccupy = function (setSFXoccupy_argument) 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/xmasball.lua b/Scripts/xmasball.lua new file mode 100644 index 000000000..648ccfd51 --- /dev/null +++ b/Scripts/xmasball.lua @@ -0,0 +1,20 @@ +local base = piece "base" +local f = 0 + +function script.Create() + Turn (base, x_axis, math.random()*360, 90) + Turn (base, y_axis, math.random()*360, 90) + Turn (base, z_axis, math.random()*360, 90) +end + +function Sink() + StartThread(MoveDown) +end + +function MoveDown() + while f > -900 do + Move(base, 2, f) + f = f - 0.03 + Sleep(1) + end +end \ No newline at end of file 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/UnitPic Tools/!Add Constripes.exe b/UnitPic Tools/!Add Constripes.exe new file mode 100644 index 000000000..4bb4cef89 Binary files /dev/null and b/UnitPic Tools/!Add Constripes.exe differ diff --git a/UnitPic Tools/!Photoshop Actionset for buildpics - Buildpics.atn b/UnitPic Tools/!Photoshop Actionset for buildpics - Buildpics.atn new file mode 100644 index 000000000..9f2f3e245 Binary files /dev/null and b/UnitPic Tools/!Photoshop Actionset for buildpics - Buildpics.atn differ diff --git a/UnitPic Tools/!Resize buildpics.exe b/UnitPic Tools/!Resize buildpics.exe new file mode 100644 index 000000000..b62dab08b Binary files /dev/null and b/UnitPic Tools/!Resize buildpics.exe differ diff --git a/UnitPic Tools/!buildpic background image.png b/UnitPic Tools/!buildpic background image.png new file mode 100644 index 000000000..21c1c8a43 Binary files /dev/null and b/UnitPic Tools/!buildpic background image.png differ 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/ammobox2.png b/UnitTextures/ammobox2.png index adbe4f203..93fffa315 100644 Binary files a/UnitTextures/ammobox2.png and b/UnitTextures/ammobox2.png differ diff --git a/UnitTextures/ammobox2glowy.png b/UnitTextures/ammobox2glowy.png index 4cab32f04..200a72c50 100644 Binary files a/UnitTextures/ammobox2glowy.png and b/UnitTextures/ammobox2glowy.png differ diff --git a/UnitTextures/apexchicken.dds b/UnitTextures/apexchicken.dds new file mode 100644 index 000000000..6132c28ee Binary files /dev/null and b/UnitTextures/apexchicken.dds differ diff --git a/UnitTextures/aquachicken.dds b/UnitTextures/aquachicken.dds new file mode 100644 index 000000000..beef4e324 Binary files /dev/null and b/UnitTextures/aquachicken.dds 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/blackchicken.dds b/UnitTextures/blackchicken.dds new file mode 100644 index 000000000..41d544235 Binary files /dev/null and b/UnitTextures/blackchicken.dds differ diff --git a/UnitTextures/bluechicken.dds b/UnitTextures/bluechicken.dds new file mode 100644 index 000000000..a5912f457 Binary files /dev/null and b/UnitTextures/bluechicken.dds differ diff --git a/UnitTextures/brownchicken.dds b/UnitTextures/brownchicken.dds new file mode 100644 index 000000000..ffa8aee0b Binary files /dev/null and b/UnitTextures/brownchicken.dds differ diff --git a/UnitTextures/chicken1.dds b/UnitTextures/chicken1.dds new file mode 100644 index 000000000..affbd4fda Binary files /dev/null and b/UnitTextures/chicken1.dds differ diff --git a/UnitTextures/chicken1b.dds b/UnitTextures/chicken1b.dds new file mode 100644 index 000000000..a0ae30690 Binary files /dev/null and b/UnitTextures/chicken1b.dds differ diff --git a/UnitTextures/chicken1c.dds b/UnitTextures/chicken1c.dds new file mode 100644 index 000000000..120f4733b Binary files /dev/null and b/UnitTextures/chicken1c.dds differ diff --git a/UnitTextures/chicken1d.dds b/UnitTextures/chicken1d.dds new file mode 100644 index 000000000..dfca57d7b Binary files /dev/null and b/UnitTextures/chicken1d.dds differ diff --git a/UnitTextures/chicken1x.dds b/UnitTextures/chicken1x.dds new file mode 100644 index 000000000..0ae7dbc26 Binary files /dev/null and b/UnitTextures/chicken1x.dds differ diff --git a/UnitTextures/chicken1y.dds b/UnitTextures/chicken1y.dds new file mode 100644 index 000000000..16f5190c6 Binary files /dev/null and b/UnitTextures/chicken1y.dds differ diff --git a/UnitTextures/chicken1z.dds b/UnitTextures/chicken1z.dds new file mode 100644 index 000000000..8fe3a6771 Binary files /dev/null and b/UnitTextures/chicken1z.dds differ diff --git a/UnitTextures/chicken2.dds b/UnitTextures/chicken2.dds new file mode 100644 index 000000000..d42dec432 Binary files /dev/null and b/UnitTextures/chicken2.dds differ diff --git a/UnitTextures/chicken2b.dds b/UnitTextures/chicken2b.dds new file mode 100644 index 000000000..298a76a7a Binary files /dev/null and b/UnitTextures/chicken2b.dds differ diff --git a/UnitTextures/chickenc3.dds b/UnitTextures/chickenc3.dds new file mode 100644 index 000000000..ce72da910 Binary files /dev/null and b/UnitTextures/chickenc3.dds differ diff --git a/UnitTextures/chickenc3b.dds b/UnitTextures/chickenc3b.dds new file mode 100644 index 000000000..839d60419 Binary files /dev/null and b/UnitTextures/chickenc3b.dds differ diff --git a/UnitTextures/chickenc3c.dds b/UnitTextures/chickenc3c.dds new file mode 100644 index 000000000..014701dbb Binary files /dev/null and b/UnitTextures/chickenc3c.dds differ diff --git a/UnitTextures/chickenegg.dds b/UnitTextures/chickenegg.dds new file mode 100644 index 000000000..1627a9eda Binary files /dev/null and b/UnitTextures/chickenegg.dds differ diff --git a/UnitTextures/chickeneggb.dds b/UnitTextures/chickeneggb.dds new file mode 100644 index 000000000..13ef45259 Binary files /dev/null and b/UnitTextures/chickeneggb.dds differ diff --git a/UnitTextures/chickeneggc.dds b/UnitTextures/chickeneggc.dds new file mode 100644 index 000000000..8d3234ffc Binary files /dev/null and b/UnitTextures/chickeneggc.dds differ diff --git a/UnitTextures/chickeneggd.dds b/UnitTextures/chickeneggd.dds new file mode 100644 index 000000000..03309fd2d Binary files /dev/null and b/UnitTextures/chickeneggd.dds differ diff --git a/UnitTextures/chickeneggred.dds b/UnitTextures/chickeneggred.dds new file mode 100644 index 000000000..45066de3e Binary files /dev/null and b/UnitTextures/chickeneggred.dds differ diff --git a/UnitTextures/chickeneggyellow.dds b/UnitTextures/chickeneggyellow.dds new file mode 100644 index 000000000..ad628cf4a Binary files /dev/null and b/UnitTextures/chickeneggyellow.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/crimsonchicken.dds b/UnitTextures/crimsonchicken.dds new file mode 100644 index 000000000..144945089 Binary files /dev/null and b/UnitTextures/crimsonchicken.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.dds b/UnitTextures/greenchicken.dds new file mode 100644 index 000000000..3abfeb888 Binary files /dev/null and b/UnitTextures/greenchicken.dds 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/greyrock2.tga b/UnitTextures/greyrock2.tga new file mode 100644 index 000000000..20c10b452 Binary files /dev/null and b/UnitTextures/greyrock2.tga differ diff --git a/UnitTextures/groundplate.dds b/UnitTextures/groundplate.dds new file mode 100644 index 000000000..1d032875e Binary files /dev/null and b/UnitTextures/groundplate.dds differ diff --git a/UnitTextures/lego2skin_explorer - 2048.dds b/UnitTextures/lego2skin_explorer - 2048.dds deleted file mode 100644 index ea19ab1b6..000000000 Binary files a/UnitTextures/lego2skin_explorer - 2048.dds and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer - backup.png b/UnitTextures/lego2skin_explorer - backup.png deleted file mode 100644 index e485b4854..000000000 Binary files a/UnitTextures/lego2skin_explorer - backup.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer - backup2.png b/UnitTextures/lego2skin_explorer - backup2.png deleted file mode 100644 index 174a1178b..000000000 Binary files a/UnitTextures/lego2skin_explorer - backup2.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer-alt.dds b/UnitTextures/lego2skin_explorer-alt.dds deleted file mode 100644 index 4ac0baee0..000000000 Binary files a/UnitTextures/lego2skin_explorer-alt.dds and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer-original.dds b/UnitTextures/lego2skin_explorer-original.dds deleted file mode 100644 index b9d45c32d..000000000 Binary files a/UnitTextures/lego2skin_explorer-original.dds and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer-simple.psd b/UnitTextures/lego2skin_explorer-simple.psd deleted file mode 100644 index 9cef31472..000000000 Binary files a/UnitTextures/lego2skin_explorer-simple.psd and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer.dds b/UnitTextures/lego2skin_explorer.dds index 6bcc42551..cd3a069cf 100644 Binary files a/UnitTextures/lego2skin_explorer.dds and b/UnitTextures/lego2skin_explorer.dds differ diff --git a/UnitTextures/lego2skin_explorer.png b/UnitTextures/lego2skin_explorer.png deleted file mode 100644 index 447dc9250..000000000 Binary files a/UnitTextures/lego2skin_explorer.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorer512.png b/UnitTextures/lego2skin_explorer512.png deleted file mode 100644 index 1fbcaf99a..000000000 Binary files a/UnitTextures/lego2skin_explorer512.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorerbumpmap.png b/UnitTextures/lego2skin_explorerbumpmap.png deleted file mode 100644 index 150d02a4f..000000000 Binary files a/UnitTextures/lego2skin_explorerbumpmap.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorerglowy - backup.png b/UnitTextures/lego2skin_explorerglowy - backup.png deleted file mode 100644 index ed09b3068..000000000 Binary files a/UnitTextures/lego2skin_explorerglowy - backup.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorerglowy-alt.dds b/UnitTextures/lego2skin_explorerglowy-alt.dds deleted file mode 100644 index a717936e0..000000000 Binary files a/UnitTextures/lego2skin_explorerglowy-alt.dds and /dev/null differ diff --git a/UnitTextures/lego2skin_explorerglowy.dds b/UnitTextures/lego2skin_explorerglowy.dds index aaa349eae..af8644b20 100644 Binary files a/UnitTextures/lego2skin_explorerglowy.dds and b/UnitTextures/lego2skin_explorerglowy.dds differ diff --git a/UnitTextures/lego2skin_explorerglowy.png b/UnitTextures/lego2skin_explorerglowy.png deleted file mode 100644 index b7913deb4..000000000 Binary files a/UnitTextures/lego2skin_explorerglowy.png and /dev/null differ diff --git a/UnitTextures/lego2skin_explorernormal-alt.dds b/UnitTextures/lego2skin_explorernormal-alt.dds deleted file mode 100644 index b0d9aae1a..000000000 Binary files a/UnitTextures/lego2skin_explorernormal-alt.dds and /dev/null differ diff --git a/UnitTextures/lego2skin_explorernormal.png b/UnitTextures/lego2skin_explorernormal.png deleted file mode 100644 index 4b57b80f3..000000000 Binary files a/UnitTextures/lego2skin_explorernormal.png and /dev/null differ diff --git a/UnitTextures/meat.dds b/UnitTextures/meat.dds new file mode 100644 index 000000000..d3dff5def Binary files /dev/null and b/UnitTextures/meat.dds differ diff --git a/UnitTextures/multichicken.dds b/UnitTextures/multichicken.dds new file mode 100644 index 000000000..c477c9f6e Binary files /dev/null and b/UnitTextures/multichicken.dds differ diff --git a/UnitTextures/pinkchicken.dds b/UnitTextures/pinkchicken.dds new file mode 100644 index 000000000..d1e16dc30 Binary files /dev/null and b/UnitTextures/pinkchicken.dds differ diff --git a/UnitTextures/redchicken.dds b/UnitTextures/redchicken.dds new file mode 100644 index 000000000..f32bce8ac Binary files /dev/null and b/UnitTextures/redchicken.dds differ diff --git a/UnitTextures/redchickenb.dds b/UnitTextures/redchickenb.dds new file mode 100644 index 000000000..4ac6b5b2d Binary files /dev/null and b/UnitTextures/redchickenb.dds differ diff --git a/UnitTextures/redchickenc.dds b/UnitTextures/redchickenc.dds new file mode 100644 index 000000000..fcfe40071 Binary files /dev/null and b/UnitTextures/redchickenc.dds differ diff --git a/UnitTextures/redhead4.dds b/UnitTextures/redhead4.dds new file mode 100644 index 000000000..1c8f317c7 Binary files /dev/null and b/UnitTextures/redhead4.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/sgreyrock1.tga b/UnitTextures/sgreyrock1.tga new file mode 100644 index 000000000..883ffbb17 Binary files /dev/null and b/UnitTextures/sgreyrock1.tga 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/vcrimsonchicken.dds b/UnitTextures/vcrimsonchicken.dds new file mode 100644 index 000000000..ec62328ca Binary files /dev/null and b/UnitTextures/vcrimsonchicken.dds differ diff --git a/UnitTextures/whitechicken.dds b/UnitTextures/whitechicken.dds new file mode 100644 index 000000000..4ebbca8b2 Binary files /dev/null and b/UnitTextures/whitechicken.dds differ diff --git a/UnitTextures/whitechickenhc.dds b/UnitTextures/whitechickenhc.dds new file mode 100644 index 000000000..97ef348a2 Binary files /dev/null and b/UnitTextures/whitechickenhc.dds differ diff --git a/UnitTextures/xmasball.dds b/UnitTextures/xmasball.dds new file mode 100644 index 000000000..4f6afd347 Binary files /dev/null and b/UnitTextures/xmasball.dds differ diff --git a/UnitTextures/xmasball2.dds b/UnitTextures/xmasball2.dds new file mode 100644 index 000000000..bf3b4b66a Binary files /dev/null and b/UnitTextures/xmasball2.dds differ diff --git a/UnitTextures/yellowchicken.dds b/UnitTextures/yellowchicken.dds new file mode 100644 index 000000000..8e450f7c5 Binary files /dev/null and b/UnitTextures/yellowchicken.dds differ diff --git a/UnitTextures/yellowchickenb.dds b/UnitTextures/yellowchickenb.dds new file mode 100644 index 000000000..f8ff3b286 Binary files /dev/null and b/UnitTextures/yellowchickenb.dds 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 new file mode 100644 index 000000000..41a49c78e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua @@ -0,0 +1,93 @@ +unitDef = { + activatewhenbuilt = true, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 2.5, + buildpic = "eairplant.png", + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canstop = true, + category = "BUILDING NOTAIR VTOL", + description = [[Build a Tech Facility to unlock units. Build Supply Depots to increase your army size.]], + energyStorage = 0, + energyUse = 0, + energyMake = 0, + explodeAs = "hugeBuildingExplosionGenericRed", + floater = true, + footprintX = 9, + footprintZ = 9, + iconType = "factory", + idleAutoHeal = .5, + idleTime = 2200, + levelground = false, + maxDamage = maxDamage, + maxSlope = 90, + maxWaterDepth = 999999, + metalStorage = 0, + metalMake = 0, + mobilestandorders = "1", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeBuildingExplosionGenericRed", + showNanoSpray = true, + sightDistance = 388, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + unitnumber = "83", + workerTime = 1, + yardMap = "oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo", + -- usePieceCollisionVolumes = true, + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:nano", + "custom:blacksmoke", + "custom:fusionreactionbasic", + "custom:airfactoryhtrail", + }, + }, + zbuffer = "1", + + buildoptions = airPlantBuildList, + + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdfactoryselect", + }, + }, + customParams = { + unittype = "factory", + death_sounds = "generic", + armortype = "building", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + -- ProvideTech = "1 Powergrid", + -- ProvideTechRange = "1500", + -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", + -- groundtexselectxsize = 1500, -- optional + -- groundtexselectzsize = 1500, -- optional + }, + -- useGroundDecal = true, + -- BuildingGroundDecalType = "factorygroundplate.dds", + -- BuildingGroundDecalSizeX = 20, + -- BuildingGroundDecalSizeY = 20, + -- BuildingGroundDecalDecaySpeed = 0.9, +} diff --git a/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua b/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua new file mode 100644 index 000000000..c5b0c6d5f --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua @@ -0,0 +1,200 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 60, + builder = false, + buildTime = 2.5, + buildpic = "ebomber.png", + canAttack = true, + canFly = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRARMORED VTOL", + collide = true, + cruiseAlt = 400, + description = [[Bomber]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGeneric", + footprintX = 2, + footprintZ = 2, + floater = true, + hoverAttack = false, + iconType = "air_bomb", + idleAutoHeal = .5, + idleTime = 2200, + loopbackattack = true, + maxacc = 1, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxDamage = 670, + maxSlope = 90, + maxVelocity = 13, + verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + repairable = false, + selfDestructAs = "largeExplosionGeneric", + side = "CORE", + sightDistance = 400, + smoothAnim = true, + stealth = false, + transportbyenemy = false; + turnRate = 5000, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:jethtrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "bomb", + onlyTargetCategory = "BUILDING", + noChaseCategory = "VTOL LIGHT ARMORED", + }, + }, + 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 = { + + missile = { + AreaOfEffect = 300, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "bombertrail-optimized", + explosionGenerator = "custom:genericshellexplosion-large-red", + energypershot = 0, + edgeEffectiveness = 0.1, + fireStarter = 70, + + id = 136, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + metalpershot = 0, + model = "missile.s3o", + name = "Rockets", + range = 800, + reloadtime = 6, + weaponType = "MissileLauncher", + + smokeTrail = false, + soundHit = "other/18402_inferno_xplo.wav", + soundHitWet = "explosions/subhitbomb.wav", + soundHitVolume = 10, + soundStart = "weapons/bomberlaunch.wav", + soundStartVolume = 10, + + startVelocity = 200, + tolerance = 8000, + turnRate = 15000, + tracks = false, + turret = false, + weaponAcceleration = 50, + waterweapon = true, + flightTime = 10, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "antibuilding", + nofriendlyfire = 1, + }, + damage = { + 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 new file mode 100644 index 000000000..abdf4aa3a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/edrone_basedef.lua @@ -0,0 +1,159 @@ +unitDef = { + acceleration = 0.5, + airStrafe = true, + bankscale = "1", + brakeRate = 0.7, + buildCostEnergy = 0, + buildCostMetal = 33, + 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 = [[Harassment Specialist 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 = 560, + maxSlope = 90, + maxVelocity = 11, + --verticalSpeed = 15, + maxWaterDepth = 0, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericPurple", + side = "CORE", + sightDistance = 500, + SonarDistance = 500, + 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 = 0, + }, +} + + +-------------------------------------------------------------------------------- + +weaponDefs = { + droneweapon = { + --accuracy = 500, + AreaOfEffect = 25, + 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", + duration = 0.6, + edgeeffectiveness = 1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-small-sparks-burn", + fallOffRate = 0.1, + fireStarter = 50, + impulseFactor = 0, + fallOffRate = 0, + interceptedByShieldType = 4, + minintensity = 1, + name = unitName .. "Weapon", + range = 300, + reloadtime = 0.5, + WeaponType = "BeamLaser", + waterweapon = true, + rgbColor = "0.1 0.5 0.2", + rgbColor2 = "0 1 0", + soundTrigger = true, + soundstart = "weapons/18389_inferno_medlas.wav", + --soundHit = "explosions/artyhit.wav", + texture1 = "lightning", + texture2 = "laserend", + thickness = 5, + tolerance = 10000, + turret = true, + weaponVelocity = 750, + customparams = { + damagetype = "light", + isupgraded = isUpgraded, + }, + damage = { + default = 15, + }, + }, +} +unitDef.weaponDefs = weaponDefs + + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua b/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua new file mode 100644 index 000000000..88769940e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/efighter_basedef.lua @@ -0,0 +1,145 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 53, + buildTime = 2.5, + buildpic = "efighter.png", + canAttack = true, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRLIGHT VTOL", + collide = true, + cruiseAlt = 140, + description = [[Light Gunship]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericWhite", + floater = true, + footprintX = 2, + footprintZ = 2, + hoverAttack = false, + iconType = "air_lit", + idleAutoHeal = .5, + idleTime = 2200, + maxacc = 1, + maxDamage = 812, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxSlope = 90, + maxVelocity = 12, + maxWaterDepth = 255, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericWhite", + side = "ARM", + sightDistance = 1000, + smoothAnim = true, + sonarDistance = 0, + transportbyenemy = false; + turnRate = 5000, + turnradius = 250, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:jethtrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "aircannon", + badTargetCategory = "ARMORED BUILDING VTOL", + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + isupgraded = isUpgraded, + 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", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + aircannon = { + AreaOfEffect = 100, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.5, + burnblow = true, + --cegTag = "railgun", + duration = 0.05, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + fallOffRate = 1, + fireStarter = 50, + impulseFactor = 0, + 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 = "light", + isupgraded = isUpgraded, + }, + damage = { + default = 25, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua b/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua new file mode 100644 index 000000000..59bdf7340 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua @@ -0,0 +1,150 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 76, + buildTime = 2.5, + buildpic = "egunship2.png", + canAttack = true, + canFly = true, + canGuard = true, + canLoopbackAttack = true, + canMove = true, + canPatrol = true, + canstop = true, + category = "AIRARMORED VTOL", + collide = true, + cruiseAlt = 125, + description = [[Anti-Armor Gunship]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericRed", + floater = true, + footprintX = 2, + footprintZ = 2, + hoverAttack = false, + iconType = "air_arm", + idleAutoHeal = .5, + idleTime = 2200, + maxacc = 1, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + maxDamage = 940, + maxSlope = 90, + maxVelocity = 15, + maxWaterDepth = 0, + metalStorage = 0, + moverate1 = "8", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericRed", + side = "CORE", + sightDistance = 1400, + smoothAnim = true, + sonarDistance = 0, + transportbyenemy = false; + turnRate = 5000, + turnradius = 250, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:jethtrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "gunshipweapon", + BadTargetCategory = "BUILDING WALL", + mainDir = "0 0 1", + maxAngleDif = 90, + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + isupgraded = isUpgraded, + canareaattack ="1", + 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", + retreatRangeDAI = 0, + }, +} + +weaponDefs = { + + gunshipweapon = { + AreaOfEffect = 1, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "gunshiptrail-optimized", + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + edgeEffectiveness = 0.1, + fireStarter = 70, + tracks = true, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "missilesmalllauncher.s3o", + name = "Rockets", + range = 700, + reloadtime = 1, + weaponType = "MissileLauncher", + waterweapon = true, + smokeTrail = false, + soundHit = "explosions/bombhit.wav", + soundHitWet = "weapons/subhit.wav", + soundHitVolume = 10, + soundStart = "weapons/18395_inferno_rltx.wav", + soundStartVolume = 10, + startVelocity = 50, + tolerance = 5000, + turnRate = 20000, + turret = false, + weaponAcceleration = 100, + flightTime = 2.5, + weaponVelocity = 700, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..c97a1b0b1 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua @@ -0,0 +1,154 @@ +unitDef = { + --acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + BadTargetCategory = "VTOL", + --brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 875, + 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/air/eraider_basedef.lua b/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua new file mode 100644 index 000000000..a9d96035c --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/eraider_basedef.lua @@ -0,0 +1,186 @@ +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 = 800, + 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, + maxDamage = 320, + 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, + 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 = 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 = "light", + }, + damage = { + default = 15, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua b/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua new file mode 100644 index 000000000..2ca663e36 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/escout_basedef.lua @@ -0,0 +1,94 @@ +unitDef = { + acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 40, + builder = false, + buildTime = 2.5, + buildpic = "escout.png", + canFly = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "AIRLIGHT VTOL", + collide = false, + cruiseAlt = 135, + description = [[Air Scout/Radar Plane]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericBlue", + 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, + 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 = 750, + smoothAnim = true, + transportbyenemy = false; + turnRate = 5000, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:jethtrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + 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 = 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 new file mode 100644 index 000000000..663be4c6d --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/air/etransport_basedef.lua @@ -0,0 +1,94 @@ +unitDef = { + acceleration = 0.5, + airStrafe = false, + airHoverFactor = 0, + brakeRate = 2, + buildCostEnergy = 0, + buildCostMetal = 60, + builder = false, + buildTime = 2.5, + buildpic = "etransport.png", + canAttack = false, + canFly = true, + canGuard = false, + canMove = true, + canload = true, + canPatrol = false, + canstop = "1", + category = "AIRARMORED VTOL", + collide = true, + cruiseAlt = 110, + description = [[Fast Armored Transport]], + energyMake = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericPurple", + fallSpeed = 1000, + footprintX = 2, + footprintZ = 2, + hoverAttack = true, + holdSteady = true, + -- hoverAttack = true, + icontype = "etransport", + maxDamage = 500, + maxSlope = 90, + maxVelocity = 7, + + maxAileron = 0.01, + maxElevator = 0.01, + maxRudder = 0.01, + maxBank = 0.01, + + verticalSpeed = 30, + name = humanName, + objectName = objectName, + script = script, + releaseHeld = true, + repairable = false, + selfDestructAs = "mediumExplosionGenericPurple", + side = "GD", + sightDistance = 500, + smoothAnim = true, + transportbyenemy = false; + transportCapacity = 32, + transportMass = 10000, + transportSize = 8, + transportUnloadMethod = 0, + fallSpeed = 10, + loadingRadius = 220, --float + turnRate = 5000, + unitname = unitName, + upright = true, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:jethtrail", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + unittype = "mobile", + -- needed_cover = 2, + 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", + }, +} diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua new file mode 100644 index 000000000..9e25942b9 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterranarchid_basedef.lua @@ -0,0 +1,199 @@ +unitDef = { + + acceleration = 0.18, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 875, + builder = false, + buildTime = 5, + buildpic = "eallterranarchid.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + cantBeTransported = true, + category = "ARMORED NOTAIR SKIRMISHER", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 150, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Endbringer Class Obliteration Strider]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericRed", + firestandorders = "1", + footprintX = 6, + footprintZ = 6, + iconType = "anarchid", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 20000, + maxVelocity = 2.5, + maxReverseVelocity = 1, + maxWaterDepth = 80, + metalStorage = 0, + movementClass = "ALLTERRTANK6", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + pushResistant = true, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericRed", + shootme = "1", + sightDistance = 1000, + smoothAnim = true, + stealth = true, + seismicSignature = 4, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + unitnumber = "110", + upright = false, + -- usePieceCollisionVolumes = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:flamethrowerrange750", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "heavybeamweapon", + }, + [2] = { + def = "flamethrower", + }, + [3] = { + def = "flamethrower", + }, + }, + customParams = { + unittype = "mobile", + isupgraded = isUpgraded, + death_sounds = "nuke", + RequireTech = tech, + armortype = armortype, + --supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + decloakradiushalved = true, + }, +} + +weaponDefs = { + heavybeamweapon = { + AreaOfEffect = 10, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 1, + cameraShake = 1, + coreThickness = 0.2, + -- 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 = 1000, + reloadtime = 1, + WeaponType = "BeamLaser", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/krabprimary.wav", + -- soundHit = "explosions/mediumcannonhit.wav", + -- sweepfire = true, + texture1 = "shot", + texture2 = "empty", + thickness = 6, + tolerance = 1000, + turret = true, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + damagetype = "antibuilding", + }, + damage = { + default = 440, + }, + }, + + flamethrower = { + + accuracy = 0, + AreaOfEffect = 10, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + explosionGenerator = "custom:burnblack", + coreThickness = 0, + duration = 1, + energypershot = 0, + fallOffRate = 1, + fireStarter = 50, + interceptedByShieldType = 4, + soundstart = "weapons/flamethrower1.wav", + + minintensity = 1, + impulseFactor = 0, + name = "Something with Flames", + range = 750, + reloadtime = 0.1, + WeaponType = [[LaserCannon]], + rgbColor = "0 0 0", + rgbColor2 = "0 0 0", + thickness = 0, + tolerance = 1000, + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..fe084ec16 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua @@ -0,0 +1,153 @@ +unitDef = { + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 60, + builder = false, + buildTime = 5, + buildpic = "eallterrassault.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SKIRMISHER", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 70, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Self-Propelled Precision Artillery]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "hugeExplosionGeneric", + firestandorders = "1", + footprintX = 3, + footprintZ = 3, + iconType = "arty_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 475, + maxVelocity = 2.4, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ALLTERRTANK3", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeExplosionGeneric", + shootme = "1", + sightDistance = 400, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + unitnumber = "110", + 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 = "assaulttankcannon", + badTargetCategory = "VTOL LIGHT ARMORED BIO", + }, + }, + customParams = { + unittype = "mobile", + isupgraded = isUpgraded, + canbetransported = "true", + needed_cover = 4, + 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 = { + assaulttankcannon = { + AreaOfEffect = 1, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.3, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-large-purple", + fallOffRate = 0, + fireStarter = 100, + impulseFactor = 0, + interceptedByShieldType = 4, + minintensity = "1", + name = "Laser", + range = 1200, + reloadtime = 3, + WeaponType = "LaserCannon", + rgbColor = "0.5 0 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/allterrassaultshot.wav", + soundHit = "explosions/assaultshothit.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..149b8a60a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua @@ -0,0 +1,157 @@ +unitDef = { + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 64, + builder = false, + buildTime = 5, + buildpic = "eallterrheavy.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SKIRMISHER", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 70, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Main Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericGreen", + firestandorders = "1", + footprintX = 2, + footprintZ = 2, + iconType = "td_arm_all", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 545, + maxVelocity = 2.8, + turninplacespeedlimit = 2.8, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ALLTERRTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericGreen", + shootme = "1", + sightDistance = 700, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + unitnumber = "110", + 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 = "heavytankweapon", + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + unittype = "mobile", + isupgraded = isUpgraded, + canbetransported = "true", + 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", + decloakradiushalved = true, + }, +} + +weaponDefs = { + heavytankweapon = { + + AreaOfEffect = 1, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + + coreThickness = 0.5, + -- cegTag = "mediumcannonweapon3", + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-green", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 700, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "0 1 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/allterrheavyshot.wav", + soundHit = "explosions/mediumcannonhit.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 1500, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..7b732e5d2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua @@ -0,0 +1,150 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 22, + builder = false, + buildTime = 5, + buildpic = "eallterrlight.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 70, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Raider]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGeneric", + firestandorders = "1", + footprintX = 2, + footprintZ = 2, + iconType = "raider", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 245, + maxVelocity = 5.5, + maxReverseVelocity = 2, + turninplacespeedlimit = 5.5, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ALLTERRTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGeneric", + sightDistance = 650, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:factorysparks", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "lighttankweapon", + badTargetCategory = "BUILDING ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + decloakradiushalved = true, + }, +} + + weaponDefs = { + lighttankweapon = { + + 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 = 350, + reloadtime = 0.5, + WeaponType = "LaserCannon", + rgbColor = "0.5 0.8 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/heavycannonGD.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 6, + tolerance = 1000, + turret = true, + weaponVelocity = 2000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..c3210ac0c --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua @@ -0,0 +1,156 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 44, + builder = false, + buildTime = 5, + buildpic = "eallterrmed.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SKIRMISHER", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 70, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Heavy Anti-Armor Tank Destroyer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericPurple", + footprintX = 2, + footprintZ = 2, + iconType = "td_arm_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 250, + maxSlope = 180, + maxVelocity = 3.5, + maxReverseVelocity = 1, + turninplacespeedlimit = 4, + maxWaterDepth = 10, + metalStorage = 0, + mobilestandorders = "1", + movementClass = "ALLTERRTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericPurple", + sightDistance = 600, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = "eallterrmed", + 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 = "mediumtankcannon", + badTargetCategory = "BUILDING LIGHT WALL", + }, + }, + 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 = { + mediumtankcannon = { + + AreaOfEffect = 1, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + + coreThickness = 0.5, + -- cegTag = "mediumcannonweapon3", + duration = 0.1, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion", + fallOffRate = 0, + fireStarter = 50, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 600, + reloadtime = 1, + WeaponType = "LaserCannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/medallterrweapon.wav", + soundHit = "explosions/mediumcannonhit.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "antiarmored", + }, + damage = { + default = 150, + }, + }, + +} diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua new file mode 100644 index 000000000..c5ad79489 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua @@ -0,0 +1,196 @@ +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 = [[EMP/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", + }, + -- [2] = { + -- 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 = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "bruisercannon", + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + --projectiles = 10, + range = 500, + reloadtime = 5, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/bruisercannon.wav", + --sprayangle = 2000, + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..eff573e2c --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua @@ -0,0 +1,158 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 28, + builder = false, + buildTime = 5, + buildpic = "eallterrshield.png", + canAttack = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + cloakCostMoving = 0, + minCloakDistance = 150, + decloakOnFire = false, + decloakSpherical = true, + initCloaked = true, + -- 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]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "hugeExplosionGenericPurple", + fireState = "0", + footprintX = 2, + footprintZ = 2, + iconType = "shield_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 500, + maxVelocity = 3.5, + maxReverseVelocity = 2, + turninplacespeedlimit = 4, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "ALLTERRTANK2", + moveState = "0", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeExplosionGenericPurple", + sightDistance = 800, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = "eallterrshield", + 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 = "allterrshield", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 3, + death_sounds = "generic", + RequireTech = tech, + armortype = armortype, + nofriendlyfire = "1", + supply_cost = supply, + shield_power = 500, + shield_radius = 300, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + 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? + area_cloak_radius = 150, -- 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? + }, +} + + +-------------------------------------------------------------------------------- + +weaponDefs = { + allterrshield = { + + Smartshield = true, + Exteriorshield = true, + Visibleshield = false, + Visibleshieldrepulse = false, + ShieldStartingPower = 0, + Shieldenergyuse = 0, + Shieldradius = 300, + Shieldpower = 500, + Shieldpowerregen = 25, + Shieldpowerregenenergy = 25, + Shieldintercepttype = 4, + Shieldgoodcolor = "0.0 0.2 1.0", + Shieldbadcolor = "1.0 0 0", + Shieldalpha = 0.2, + + texture1 = "shield4", + + visibleShieldHitFrames = 0, + weaponType = [[Shield]], + + customparams = { + isshieldupgraded = isUpgraded, + }, + + damage = { + default = 0, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua b/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua new file mode 100644 index 000000000..c3f4b816e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/allterrain/eminifac_basedef.lua @@ -0,0 +1,105 @@ +-- ALL TERRAIN FACTORY : DEFFOS FOR INHERITING + +unitDef = { + activatewhenbuilt = false, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 5, + buildpic = "eminifac.png", + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canstop = true, + category = "BUILDING NOTAIR", + + collisionVolumeOffsets = "0 60 0", + collisionVolumeScales = "298 142 168", + collisionVolumeTest = 1, + collisionVolumeType = "box", + + -- Cloaking + + cancloak = true, + cloakCost = 0, + minCloakDistance = 250, + decloakOnFire = true, + decloakSpherical = true, + initCloaked = false, + + -- End Cloaking + + description = [[Build a Tech Facility to unlock units. Build Supply Depots to increase your army size.]], + energyStorage = 0, + energyUse = 0, + energyMake = 0, + explodeAs = "largeExplosionGenericGreen", + footprintX = 11, + footprintZ = 11, + iconType = "factory", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 90, + maxWaterDepth = 0, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericGreen", + showNanoSpray = true, + sightDistance = 388, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + workerTime = 1, + yardMap = "ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ccccccccccc ", + -- usePieceCollisionVolumes = true, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:nano", + "custom:blacksmoke", + "custom:fusionreactionbasic", + }, + }, + buildoptions = AllTerrainFactoryBuildList, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdfactoryselect", + }, + }, + customParams = { + unittype = "factory", + death_sounds = "generic", + armortype = "building", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + decloakradiushalved = true, + -- ProvideTech = "1 Powergrid", + -- ProvideTechRange = "1500", + -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", + -- groundtexselectxsize = 1500, -- optional + -- groundtexselectzsize = 1500, -- optional + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 27, + BuildingGroundDecalSizeY = 27, + BuildingGroundDecalDecaySpeed = 0.9, +} diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua new file mode 100644 index 000000000..6122e2db2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibarty_basedef.lua @@ -0,0 +1,141 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = 36, + builder = false, + buildTime = 5, + buildpic = "eamphibarty.png", + canAttack = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB SUPPORT", + description = [[Self-Propelled Laser Artillery]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericBlue", + footprintX = 2, + footprintZ = 2, + iconType = "arty_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 28, + maxVelocity = 3.5, + maxReverseVelocity = 1, + minWaterDepth = 10, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericBlue", + sightDistance = 365, + SonarDistance = 365, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 3.0, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 300, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:factorysparks", + "custom:emptydirt", + "custom:blacksmoke", + }, +}, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "assimilatorbeamweapon", + badTargetCategory = "VTOL LIGHT ARMORED BIO", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + 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 = { + assimilatorbeamweapon = { + + AreaOfEffect = 0, + avoidFeature = false, + avoidFriendly = false, + beamTime = 1.8, + collideFeature = false, + collideFriendly = false, + rgbColor = "0 0 0.5", + rgbColor2 = "0.5 0.5 0.5", + coreThickness = 0.5, + duration = 0.4, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + fallOffRate = 0.1, + fireStarter = 50, + interceptedByShieldType = 4, + largeBeamLaser = true, + laserflaresize = 5, + leadlimit = 20, + minintensity = 1, + name = "Laser", + range = 1100, + reloadtime = 2, + WeaponType = "BeamLaser", + --soundHit = "explosions/amphibartyshothit.wav", + soundStart = "weapons/laserbeam02.wav", + soundTrigger = true, + texture1 = "lightning", + texture2 = "laserend", + thickness = 20, + tolerance = 500, + turret = true, + weaponVelocity = 1500, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..d34e194bd --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibbuggy_basedef.lua @@ -0,0 +1,146 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 18, + builder = false, + buildTime = 5, + buildpic = "eamphibbuggy.png", + canAttack = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB RAID", + description = [[Raider]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericRed", + footprintX = 2, + footprintZ = 2, + iconType = "raider", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 120, + maxSlope = 28, + maxVelocity = 6.5, + maxReverseVelocity = 2, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericRed", + sightDistance = 650, + sonarDistance = 650, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 6.0, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + workerTime = 0, + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:factorysparks", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "lightbeamlaser", + badTargetCategory = "ARMORED BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + needed_cover = 1, + death_sounds = "generic", + RequireTech = tech, + armortype = "light", + nofriendlyfire = "1", + supply_cost = 1, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + lightbeamlaser = { + TargetMoveError = 0.3, + AreaOfEffect = 0, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.2, + duration = 0.1, + explosionGenerator = "custom:genericshellexplosion-small-sparks-burn", + energypershot = 0, + fallOffRate = 1, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0.1, + laserflaresize = 5, + largebeamlaser = true, + leadlimit = 10, + minintensity = 1, + name = "Laser", + range = 300, + reloadtime = 0.1, + WeaponType = "BeamLaser", + rgbColor = "0.5 0 0", + rgbColor2 = "0.8 0.8 0.8", + soundTrigger = true, + soundstart = "weapons/amphibbuggytankshothit.wav", + -- soundHit = "weapons/amphibbuggytankshothit.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", + thickness = 5, + tolerance = 3000, + turret = true, + weaponVelocity = 1000, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..cea468d3a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibfac_basedef.lua @@ -0,0 +1,93 @@ +unitDef = { + + activatewhenbuilt = false, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 5, + buildpic = "eamphibfac.png", + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canstop = true, + category = "BUILDING NOTAIR AMPHIB", + -- collisionVolumeOffsets = "0 20 0", + -- collisionVolumeScales = "238 92 128", + -- collisionVolumeTest = 1, + -- collisionVolumeType = "box", + description = [[Build a Tech Facility to unlock units. Build Supply Depots to increase your army size.]], + energyStorage = 0, + energyUse = 0, + energyMake = 0, + explodeAs = "hugeBuildingExplosionGenericBlue", + footprintX = 8, + footprintZ = 8, + iconType = "factory", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 25, + maxWaterDepth = 5000, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeBuildingExplosionGenericBlue", + showNanoSpray = true, + side = "CORE", + sightDistance = 388, +-- SonarDistance = 175, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + workerTime = 1, + yardMap = "cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc ", + -- usePieceCollisionVolumes = true, + + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 18, + BuildingGroundDecalSizeY = 18, + BuildingGroundDecalDecaySpeed = 0.9, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:nano", + "custom:blacksmoke", + "custom:fusionreactionbasic", + }, + }, + buildoptions = amphibFactoryBuildList, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdfactoryselect", + }, + }, + customParams = { + unittype = "factory", + death_sounds = "generic", + armortype = "building", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + -- ProvideTech = "1 Powergrid", + -- ProvideTechRange = "1500", + -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", + -- groundtexselectxsize = 1500, -- optional + -- groundtexselectzsize = 1500, -- optional + }, +} diff --git a/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua b/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua new file mode 100644 index 000000000..7ab5284d5 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibleveler_basedef.lua @@ -0,0 +1,172 @@ +unitDef = { + acceleration = 0.18, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 875, + builder = false, + buildTime = 5, + buildpic = "eamphibleveler.png", + canAttack = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED AMPHIB SKIRMISHER", + description = [[Endbringer Class Mobile Target Evaporator]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericBlue", + footprintX = 6, + footprintZ = 6, + iconType = "leveller", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 20000, + maxSlope = 28, + maxVelocity = 4.5, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK6", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericBlue", + side = "CORE", + sightDistance = 750, + sonarDistance = 750, + smoothAnim = true, + stealth = true, + seismicSignature = 4, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/UnitsUnderattack1.wav", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "tankkillerlaser", + }, + [2] = { + def = "machinegun", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + death_sounds = "nuke", + RequireTech = tech, + armortype = armortype, + --supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + tankkillerlaser = { + AreaOfEffect = 8, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + coreThickness = 0.5, + duration = 0.2, + energypershot = energycosttofire, + explosionGenerator = "custom:genericshellexplosion-large-purple", + fallOffRate = 0, + fireStarter = 100, + interceptedByShieldType = 4, + impulseFactor = 0.1, + minintensity = "1", + name = "Anti-Tank Laser", + range = 750, + reloadtime = 0.5, + WeaponType = "LaserCannon", + rgbColor = "0.2 0 0.5", + rgbColor2 = "0.8 0.8 0.8", + soundTrigger = true, + soundstart = "weapons/tankdestroyermaingunfire.wav", + texture1 = "pulseshot2", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "antiarmored", + }, + damage = { + default = 250, + }, + }, + + machinegun = { + accuracy = 300, + AreaOfEffect = 8, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + coreThickness = 0.5, + duration = 0.1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = energycosttofire2, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + minintensity = "1", + name = "Machine Gun", + range = 750, + reloadtime = 0.1, + WeaponType = "LaserCannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/tankdestroyerfire.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 5, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..efacc9bbf --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibmedtank_basedef.lua @@ -0,0 +1,148 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 53, + builder = false, + buildTime = 5, + buildpic = "eamphibmedtank.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB SKIRMISHER", + description = [[Light Main Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericGreen", + footprintX = 2, + footprintZ = 2, + iconType = "td_lit_all", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 360, + maxSlope = 28, + maxVelocity = 5, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericGreen", + side = "CORE", + sightDistance = 550, + sonarDistance = 550, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 4.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 430, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:factorysparks", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "medtankbeamlaser", + badTargetCategory = "BUILDING WALL", + }, + }, + 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", + }, +} + +weaponDefs = { + medtankbeamlaser = { + + TargetMoveError = 0.3, + AreaOfEffect = 0, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + collideFeature = false, + collideFriendly = 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 = 5, + leadlimit = 15, + minintensity = 1, + name = "Laser", + range = 550, + reloadtime = 0.1, + WeaponType = "BeamLaser", + rgbColor = "0 0.5 0", + rgbColor2 = "0.8 0.8 0.8", + soundTrigger = true, + soundstart = "weapons/amphibmedtankshothit.wav", + -- soundHit = "weapons/amphibmedtankshothit.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", + thickness = 4, + tolerance = 3000, + turret = true, + weaponVelocity = 1000, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + damagetype = "light", + }, + damage = { + 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 new file mode 100644 index 000000000..7694a919f --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibneedle_basedef.lua @@ -0,0 +1,146 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 42, + builder = false, + buildTime = 5, + buildpic = "eamphibneedle.png", + canAttack = true, + + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB RAID", + description = [[Light Tank Destroyer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericPurple", + footprintX = 2, + footprintZ = 2, + iconType = "td_lit_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 340, + maxSlope = 28, + maxVelocity = 6, + maxReverseVelocity = 2, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericPurple", + sightDistance = 400, + sonarDistance = 400, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 6.0, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitNeedle, + workerTime = 0, + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "medtankbeamlaser", + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + + medtankbeamlaser = { + AreaOfEffect = 0, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.2, + duration = 0.1, + energypershot = 0, + 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 = 400, + 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 = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..620955d9e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibriot_basedef.lua @@ -0,0 +1,183 @@ +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 = [[EMP/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", + }, + -- [2] = { + -- 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 = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "bruisercannon", + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + --projectiles = 10, + range = 500, + reloadtime = 5, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/bruisercannon.wav", + --sprayangle = 2000, + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..af788216e --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/amphib/eamphibrock_basedef.lua @@ -0,0 +1,181 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 59, + builder = false, + buildTime = 5, + buildpic = "eamphibrock.png", + canAttack = true, + canGuard = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT AMPHIB SUPPORT", + description = [[Anti-Armor Missile Support Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGeneric", + footprintX = 2, + footprintZ = 2, + iconType = "mtd_lit_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 320, + maxSlope = 28, + maxVelocity = 4, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "TANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGeneric", + side = "CORE", + sightDistance = 650, + sonarDistance = 650, + stealth = true, + seismicSignature = 2, + sonarStealth = false, + smoothAnim = true, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 3.4, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 430, + unitname = unitName, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:emptydirt", + "custom:blacksmoke", + "custom:jethtrail", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "antiarmorrockets", + badTargetCategory = "BUILDING LIGHT WALL", + }, + -- [2] = { + -- def = "antiarmorrocketssalvo", + -- badTargetCategory = "BUILDING LIGHT WALL", + -- }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + canareaattack ="1", + 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", + }, +} + +weaponDefs = { + + antiarmorrockets = { + AreaOfEffect = 0, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "amphibrocktrail-optimized", + explosionGenerator = "custom:genericshellexplosion-medium-red", + energypershot = 0, + fireStarter = 70, + tracks = true, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "missilesmalllauncher.s3o", + name = "Rockets", + range = 700, + reloadtime = 1, + weaponType = "MissileLauncher", + smokeTrail = false, + soundStart = "weapons/rocket1.wav", + soundHit = "explosions/explode5.wav", + startVelocity = 250, + tolerance = 8000, + turnrate = 30000, + turret = true, + weaponAcceleration = 400, + flightTime = 5, + weaponVelocity = 3000, + customparams = { + isupgraded = isUpgraded, + damagetype = "antiarmoredair", + }, + damage = { + default = 200, + }, + }, + + antiarmorrocketssalvo = { + AreaOfEffect = 0, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + burst = 5, + burstrate = 0.1, + cegTag = "missiletrailsmall", + explosionGenerator = "custom:genericshellexplosion-medium-red", + energypershot = energycosttofire2, + fireStarter = 70, + tracks = true, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "missilesmalllauncher.s3o", + name = "Rockets", + range = 700, + reloadtime = 5, + weaponType = "MissileLauncher", + smokeTrail = false, + soundStart = "weapons/rocket1.wav", + soundHit = "explosions/explode5.wav", + startVelocity = 250, + tolerance = 8000, + turnrate = 30000, + turret = true, + weaponAcceleration = 400, + flightTime = 5, + weaponVelocity = 3000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..662ff9aa7 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/eartyturret_basedef.lua @@ -0,0 +1,120 @@ +unitDef = { + buildCostEnergy = 0, + buildCostMetal = 500, + builder = false, + buildTime = 5, + buildpic = "eartyturret.png", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + description = [[Long Range Artillery Turret]], + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumBuildingExplosionGeneric", + floater = true, + footprintX = 8, + footprintZ = 8, + icontype = "turret_arty", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = 6250, + maxSlope = 60, + maxWaterDepth = 99999999999, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + noAutoFire = false, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumBuildingExplosionGeneric", + sightDistance = 500, + smoothAnim = true, + unitname = unitName, + 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 BIO", + }, + }, + customParams = { + RequireTech = tech, + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, + }, +} + +weaponDefs = { + artyweapon = { + AreaOfEffect = AreaOfEffect, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "artyshot2", + avoidNeutral = false, + explosionGenerator = "custom:NUKEDATBEWMSMALL", + energypershot = 0, + edgeEffectiveness = 0.1, + + impulseFactor = 0, + interceptedByShieldType = 4, + + minIntensity = 1, + + name = "Plasma Cannon", + range = 8000, + reloadtime = 30, + size = 16, + weaponType = "Cannon", + soundHit = "explosions/artyhit.wav", + soundStart = "weapons/arty2.wav", + + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "antibuilding", + isupgraded = isUpgraded, + --effectedByunitHealthModifier = true, + }, + damage = { + default = 1000, + }, + }, + +} \ No newline at end of file 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 new file mode 100644 index 000000000..a1fdcf179 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/eheavyturret2_basedef.lua @@ -0,0 +1,134 @@ +unitDef = { + buildAngle = 8192, + buildCostEnergy = 0, + buildCostMetal = 60, + builder = false, + buildTime = 5, + buildpic = "eheavyturret2.png", + collisionVolumeOffsets = "0 0 0", + collisionVolumeScales = "80 115 80", + collisionVolumeTest = 1, + collisionVolumeType = "box", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + description = [[Heavy Plasma Battery (Anti-Armor)]], + energyStorage = 0, + energyUse = 0, + explodeAs = "largeBuildingExplosionGenericRed", + footprintX = 3, + footprintZ = 3, + floater = true, + idleAutoHeal = .5, + idleTime = 2200, + iconType = "turret_arm", + maxDamage = 1200, + maxSlope = 60, + maxWaterDepth = 999999, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + onlytargetcategory3 = "NOTAIR", + onlytargetcategory4 = "NOTAIR", + onlytargetcategory5 = "NOTAIR", + onlytargetcategory6 = "NOTAIR", + radarDistance = 0, + repairable = false, + selfDestructAs = "largeBuildingExplosionGenericRed", + side = "CORE", + sightDistance = 750, + smoothAnim = true, + unitname = unitName, + workerTime = 0, + yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:needspower", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/turretselect", + }, + }, + weapons = { + [1] = { + def = "eheavyturretweapon2", + badTargetCategory = "LIGHT VTOL BUILDING", + onlyTargetCategory = "BIO ARMORED LIGHT", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "turret", + needed_cover = 5, + --supply_cost = supply, + RequireTech = tech, + 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 = { + eheavyturretweapon2 = { + + AreaOfEffect = 250, + avoidFeature = false, + avoidFriendly = false, + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + duration = 0.25, + energypershot = 0, + edgeeffectiveness = 0, + explosionGenerator = "custom:genericshellexplosion-medium", + fallOffRate = 0, + fireStarter = 100, + impulseFactor = 0, + interceptedByShieldType = 4, + minintensity = "1", + name = "Laser", + range = 750, + reloadtime = 2, + WeaponType = "LaserCannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/heavyturretshot.wav", + soundHit = "explosions/explode5.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 3000, + waterweapon = true, + customparams = { + isupgraded = isUpgraded, + damagetype = "turretantilightarmored", + effectedByunitHealthModifier = true, + }, + damage = { + 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 new file mode 100644 index 000000000..efa83eeb5 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/elightturret2_basedef.lua @@ -0,0 +1,132 @@ +unitDef = { + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = 27, + builder = false, + buildTime = 5, + buildpic = "elightturret2.png", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + collisionVolumeTest = "1", + description = [[Anti-Raid Defense Platform (Anti-Light)]], + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumBuildingExplosionGeneric", + footprintX = 2, + footprintZ = 2, + 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 = 650, + 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 = "lighteweapon", + badTargetCategory = "VTOL ARMORED BUILDING", + onlyTargetCategory = "BIO LIGHT VTOL ARMORED", + }, + }, + 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 = 6, + BuildingGroundDecalSizeY = 6, + BuildingGroundDecalDecaySpeed = 0.9, +} + +weaponDefs = { + lighteweapon = { + 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, + + 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 = "turretantilight", + unittype = "turret", + effectedByunitHealthModifier = true, + }, + damage = { + default = 100, + }, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua b/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua new file mode 100644 index 000000000..bb415c0eb --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/emetalextractor_basedef.lua @@ -0,0 +1,81 @@ +unitDef = { + + activateWhenBuilt = true, + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + buildingMask = 0, + builder = false, + buildTime = 5, + buildPic = "emetalextractor.png", + canAttack = false, + category = "BUILDING NOTAIR ECO", + description = [[Generates Metal from Resource Nodes]], + energyStorage = 0, + energyUse = energyUse, + explodeAs = "largeBuildingExplosionGenericRed", + makesMetal = 0, + footprintX = 9, + footprintZ = 9, + iconType = "eco", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = buildCostMetal * 12.5, + maxSlope = 90, + maxWaterDepth = 5000, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + onoffable = true, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeBuildingExplosionGenericRed", + selfDestructCountdown = 15, + side = "CORE", + sightDistance = 200, + smoothAnim = true, + unitName = unitName, + workerTime = 0, + yardMap = "yyyyyyyyy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yoooooooy yyyyyyyyy", + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:blacksmoke", + primaryCEG, + "custom:skyhatelaser", + }, + }, + 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 = "ateran", + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 9, + BuildingGroundDecalSizeY = 9, + BuildingGroundDecalDecaySpeed = 0.9, +} \ No newline at end of file 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 new file mode 100644 index 000000000..db1d837dd --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/buildings/euwturret_basedef.lua @@ -0,0 +1,127 @@ +unitDef = { + + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = 40, + builder = false, + buildTime = 5, + buildpic = "euwturret.png", + canAttack = true, + canstop = "1", + category = "BUILDING NOTAIR", + collisionVolumeTest = "1", + description = [[Anti-Amphibious Defense Platform • Uses +]] .. supply .. [[ Supply]], + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumBuildingExplosionGenericGreen", + floater = true, + footprintX = 4, + footprintZ = 4, + idleAutoHeal = .5, + idleTime = 2200, + iconType = "turret_lit", + maxDamage = 500, + maxSlope = 60, + minWaterDepth = 20, + metalStorage = 0, + name = humanName, + objectName = objectName, + script = script, + onlytargetcategory2 = "NOTAIR", + onlytargetcategory3 = "NOTAIR", + onlytargetcategory4 = "NOTAIR", + onlytargetcategory5 = "NOTAIR", + onlytargetcategory6 = "NOTAIR", + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumBuildingExplosionGenericGreen", + side = "CORE", + sightDistance = 250, +-- SonarDistance = 600, + 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 = "euwturretmissile", + onlyTargetCategory = "LIGHT ARMORED", + -- MainDir = [[0 -1 0]], + -- MaxAngleDif = 180, + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "turret", + RequireTech = tech, + needed_cover = 2, + supply_cost = supply, + death_sounds = "generic", + -- twokhotkey = 't', + armortype = armortype, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + euwturretmissile = { + AreaOfEffect = 10, + avoidFriendly = false, + avoidFeature = false, + cegTag = "torpedotrailuwturret", + collideFriendly = false, + collideFeature = false, + explosionGenerator = "custom:torpedoexplosion", + energypershot = 0, + fireStarter = 80, + impulseFactor = 0.1, + interceptedByShieldType = 4, + model = "missilesmall.s3o", + name = "Underwater Torpedo", + range = 600, + reloadtime = 1, + weaponType = "TorpedoLauncher", + soundHit = "weapons/torpedolaunch.wav", + soundStart = "weapons/subhit.wav", + tolerance = 3000, + turret = true, + startVelocity = 200, + acceleration = 2000, + weaponVelocity = 10000, + tracks = true, + turnrate = 100000, + flighttime = 8, + sprayangle = 5000, + waterweapon = true, + + customparams = { + isupgraded = isUpgraded, + damagetype = "euwturret", + }, + damage = { + default = 120, + }, + }, +} \ No newline at end of file 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 new file mode 100644 index 000000000..dc6434014 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/eorb_basedef.lua @@ -0,0 +1,120 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + + acceleration = 1, + brakeRate = 0.24, + buildCostEnergy = 0, + buildCostMetal = 30, + buildDistance = buildDistance, + builder = true, + buildTime = 5, + buildPic = "eorb.png", + CanAttack = false, + CanAssist = true, + CanBeAssisted = true, + CanCapture = false, + CanRepair = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canreclaim = true, + canstop = true, + category = "LIGHT NOTAIR SUPPORT", + description = [[Field Medic / Construction Assistant]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericGreen", + footprintX = 2, + footprintZ = 2, + fireState = "0", + iconType = "orb", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 600, + maxSlope = 90, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "HOVERHBOT2", + moveState = "2", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + --radarDistanceJam = 20, + repairable = false, + selfDestructAs = "mediumExplosionGenericGreen", + showNanoSpray = true, + side = "ARM", + sightDistance = 500, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 3, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 1020, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = workerTime, + capturespeed = 0, + TerraformSpeed = 2147000, + ReclaimSpeed = 0, + repairspeed = 0.3125, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + buildoptions = buildlist, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + isupgraded = isUpgraded, + RequireTech = tech, + unittype = "mobile", + canbetransported = "true", + needed_cover = 2, + death_sounds = "generic", + energycorecollect = true, + armortype = armortype, + noenergycost = true, + area_mex_def = "emetalextractor", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + retreatRangeDAI = buildDistance*2, + + -- groundtexselectimg = ":nc:bitmaps/icons/repairzone.png", + -- groundtexselectxsize = 1000, + -- groundtexselectzsize = 1000, + }, +} \ No newline at end of file diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua new file mode 100644 index 000000000..8db03603a --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua @@ -0,0 +1,88 @@ +unitDef = { + + activatewhenbuilt = false, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 5, + buildpic = [[ehbotfac.png]], + canAttack = false, + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canstop = true, + category = "BUILDING NOTAIR", + description = [[Build a Tech Facility to unlock units. Build Supply Depots to increase your army size.]], + energyStorage = 0, + energyUse = 0, + energyMake = 0, + explodeAs = "hugeBuildingExplosionGeneric", + footprintX = 10, + footprintZ = 10, + floater = true, + iconType = "factory", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 25, + maxWaterDepth = 99999999999, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeBuildingExplosionGeneric", + showNanoSpray = true, + side = "CORE", + sightDistance = 388, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + workerTime = 1, + yardMap = "cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc ", + -- usePieceCollisionVolumes = true, + -- modelCenterOffset = {108, 10, 0}, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:nano", + "custom:blacksmoke", + "custom:fusionreactionbasic", + }, + }, + buildoptions = hbotFactoryBuildList, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdfactoryselect", + }, + }, + weapons = { + }, + customParams = { + unittype = "factory", + death_sounds = "generic", + armortype = "building", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + helptext = [[]], + corpse = "energycore", + }, + useGroundDecal = true, + BuildingGroundDecalType = "factorygroundplate.dds", + BuildingGroundDecalSizeX = 20, + BuildingGroundDecalSizeY = 20, + BuildingGroundDecalDecaySpeed = 0.9, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua new file mode 100644 index 000000000..d7868b392 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotkarganneth_basedef.lua @@ -0,0 +1,152 @@ +unitDef = { + + --mobileunit + transportbyenemy = false, + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 750, + builder = false, + buildTime = 5, + buildpic = [[ehbotkarganneth.png]], + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Endbringer Class Freedom Dispenser]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "hugeExplosionGenericPurple", + footprintX = 8, + footprintZ = 8, + iconType = "leveller", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 17500, + maxSlope = 90, + maxVelocity = 1.75, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERHBOT8", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeExplosionGenericPurple", + side = "CORE", + sightDistance = 1000, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "machinegun", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + badTargetCategory = "WALL BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + machinegun = { + accuracy = 500, + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + minintensity = "1", + name = "Gatling Laser Cannon", + largebeamlaser = true, + laserflaresize = 5, + range = 1000, + reloadtime = 0.1, + WeaponType = "BeamLaser", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/plasma2.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", + thickness = 8, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..459209ae2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua @@ -0,0 +1,149 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 22, + builder = false, + buildTime = 5, + buildpic = [[ehbotpeewee.png]], + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + description = [[Raider]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericBlue", + footprintX = 2, + footprintZ = 2, + iconType = "raider", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 90, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERHBOT2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericBlue", + side = "CORE", + sightDistance = 650, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "flashweapon", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + badTargetCategory = "VTOL ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + flashweapon = { + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "railgun", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", + edgeEffectiveness = 1, + energypershot = 0, + fallOffRate = 0, + duration = 0.25, + impulseFactor = 0, + interceptedByShieldType = 4, + name = "E.M.G.", + range = 650, + reloadtime = 0.5, + --projectiles = 5, + weaponType = "LaserCannon", + soundStart = "weapons/plasma3c.wav", + texture1 = "shot", + texture2 = "empty", + coreThickness = 0.6, + thickness = 6, + tolerance = 10000, + turret = true, + weaponTimer = 1, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + single_hit = true, + isupgraded = isUpgraded, + }, + damage = { + default = 45, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua new file mode 100644 index 000000000..fe4928009 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua @@ -0,0 +1,148 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 40, + builder = false, + buildTime = 5, + buildpic = [[ehbotrocko.png]], + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + description = [[Long-Range Light Main Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericRed", + footprintX = 2, + footprintZ = 2, + --highTrajectory = 2, + iconType = "mtd_lit_all", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 350, + maxSlope = 90, + maxVelocity = 2, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERHBOT2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericRed", + side = "CORE", + sightDistance = 300, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "rockets", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + badTargetCategory = "BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + rockets = { + accuracy = 1000, + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "ehbotrocko-optimized", + explosionGenerator = "custom:genericshellexplosion-large-red", + energypershot = 0, + fireStarter = 70, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "missilesmalllauncher.s3o", + name = "Rockets", + range = 850, + reloadtime = 2.5, + weaponType = "MissileLauncher", + smokeTrail = false, + soundStart = "weapons/emediumtankfire2.wav", + soundHit = "explosions/explode5.wav", + startVelocity = 250, + tolerance = 8000, + turnrate = 30000, + turret = true, + tracks = true, + weaponAcceleration = 400, + flightTime = 5, + weaponVelocity = 3000, + customparams = { + damagetype = "antilightarmored", + isupgraded = isUpgraded, + }, + damage = { + default = 100, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua new file mode 100644 index 000000000..7b88bb421 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua @@ -0,0 +1,153 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 35, + builder = false, + buildTime = 5, + buildpic = [[ehbotsniper.png]], + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + description = [[Light Anti-Armor Tank Destroyer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericPurple", + footprintX = 2, + footprintZ = 2, + --highTrajectory = 2, + iconType = "td_lit_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 26, + maxVelocity = 2.25, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERHBOT2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericPurple", + side = "CORE", + sightDistance = 300, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "sniper", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + badTargetCategory = "LIGHT VTOL BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + sniper = { + AreaOfEffect = 10, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.5, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-purple", + fallOffRate = 0, + fireStarter = 100, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 900, + reloadtime = 7.5, + WeaponType = "LaserCannon", + rgbColor = "0 0.5 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/snipershot.wav", + soundHit = "explosions/explode5.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 3000, + customparams = { + damagetype = "antilightarmored", + isupgraded = isUpgraded, + }, + damage = { + default = 500, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua new file mode 100644 index 000000000..1737d887d --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua @@ -0,0 +1,150 @@ +unitDef = { + + --mobileunit + transportbyenemy = false; + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 27, + builder = false, + buildTime = 5, + buildpic = [[ehbotthud.png]], + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + description = [[Light Tank Destroyer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGeneric", + footprintX = 2, + footprintZ = 2, + highTrajectory = 2, + iconType = "td_lit_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 325, + maxSlope = 90, + maxVelocity = 2.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERHBOT2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGeneric", + side = "CORE", + sightDistance = 800, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + upright = true, + --usePieceCollisionVolumes = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "plasmacannon", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + badTargetCategory = "VTOL ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + plasmacannon = { + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "thudshot", + --burst = burst, + --burstrate = 0.1, + edgeEffectiveness = 1, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + --duration = 0.25, + highTrajectory = 2, + impulseFactor = 0, + interceptedByShieldType = 4, + name = "Plasma Cannon", + --noExplode = true, + range = 800, + reloadtime = 2, + size = 8, + --projectiles = projectiles, + weaponType = "Cannon", + soundStart = "weapons/bruisercannon.wav", + soundHit = "explosions/mediumcannonhit.wav", + soundTrigger = true, + --sprayAngle = 1000, + tolerance = 10000, + turret = true, + weaponTimer = 1, + weaponVelocity = 600, + customparams = { + damagetype = "antilight", + isupgraded = isUpgraded, + }, + damage = { + default = 150, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua new file mode 100644 index 000000000..0ba9b754f --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua @@ -0,0 +1,153 @@ +unitDef = { + + --mobileunit + transportbyenemy = false, + --cantBeTransported = true, + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + 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 Dispensation Turret]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "hugeExplosionGenericPurple", + footprintX = 8, + footprintZ = 8, + iconType = "leveller", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 17500, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "HOVERHBOT8", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeExplosionGenericPurple", + side = "CORE", + sightDistance = 1000, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "machinegun", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + --onlyTargetCategory = "LIGHT ARMORED BIO", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + machinegun = { + accuracy = 500, + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = 0, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + minintensity = "1", + name = "Gatling Laser Cannon", + largebeamlaser = true, + laserflaresize = 5, + range = 1000, + reloadtime = 0.1, + WeaponType = "BeamLaser", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/plasma2.wav", + scrollspeed = 5, + texture1 = "lightning", + texture2 = "laserend", + thickness = 8, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + damagetype = "antiarmored", + }, + damage = { + 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 new file mode 100644 index 000000000..295f6a95f --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua @@ -0,0 +1,147 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 72, + builder = false, + buildTime = 5, + canAttack = true, + cantBeTransported = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Anti-Raider Turret]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericBlue", + floater = true, + footprintX = 2, + footprintZ = 2, + iconType = "turret_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "HOVERHBOT5", + pushResistant = true, + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericBlue", + side = "CORE", + sightDistance = 650, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "flashweapon", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "VTOL ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + flashweapon = { + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "railgun", + rgbColor = "1 0 0", + rgbColor2 = "1 1 1", + explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", + edgeEffectiveness = 1, + energypershot = 0, + fallOffRate = 0, + duration = 0.25, + impulseFactor = 0, + interceptedByShieldType = 4, + name = "E.M.G.", + range = 650, + reloadtime = 0.5, + --projectiles = 5, + weaponType = "LaserCannon", + soundStart = "weapons/plasma3c.wav", + texture1 = "shot", + texture2 = "empty", + coreThickness = 0.6, + thickness = 6, + tolerance = 10000, + turret = true, + weaponTimer = 1, + weaponVelocity = 1500, + customparams = { + damagetype = "light", + single_hit = true, + isupgraded = isUpgraded, + }, + damage = { + 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 new file mode 100644 index 000000000..9d86b69c4 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua @@ -0,0 +1,146 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 110, + builder = false, + buildTime = 5, + canAttack = true, + cantBeTransported = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Long-Range Light Main Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericRed", + floater = true, + footprintX = 2, + footprintZ = 2, + --highTrajectory = 2, + iconType = "turret_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 350, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "HOVERHBOT3", + pushResistant = true, + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericRed", + side = "CORE", + sightDistance = 300, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "rockets", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + --onlyTargetCategory = "LIGHT ARMORED BIO", + --badTargetCategory = "BUILDING", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + rockets = { + accuracy = 1000, + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "ehbotrocko-optimized", + explosionGenerator = "custom:genericshellexplosion-large-red", + energypershot = 0, + fireStarter = 70, + impulseFactor = 0, + interceptedByShieldType = 4, + model = "missilesmalllauncher.s3o", + name = "Rockets", + range = 850, + reloadtime = 2.5, + weaponType = "MissileLauncher", + smokeTrail = false, + soundStart = "weapons/emediumtankfire2.wav", + soundHit = "explosions/explode5.wav", + startVelocity = 250, + tolerance = 8000, + turnrate = 1500, + turret = true, + tracks = true, + weaponAcceleration = 100, + flightTime = 3, + weaponVelocity = 1500, + customparams = { + damagetype = "antilightarmored", + isupgraded = isUpgraded, + }, + damage = { + 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 new file mode 100644 index 000000000..b48c996e6 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua @@ -0,0 +1,192 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 100, + builder = false, + buildTime = 5, + canAttack = true, + cantBeTransported = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Tank Sniper Turret]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGenericPurple", + floater = true, + footprintX = 2, + footprintZ = 2, + --highTrajectory = 2, + iconType = "turret_arm", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 300, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "HOVERHBOT3", + pushResistant = true, + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGenericPurple", + side = "CORE", + sightDistance = 300, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 475, + unitname = unitName, + --usePieceCollisionVolumes = true, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "sniper", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "LIGHT", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + sniper = { + + AreaOfEffect = 10, + avoidFeature = false, + avoidFriendly = false, + beamTime = 0.1, + + collideFeature = false, + collideFriendly = false, + coreThickness = 0.6, + -- cegTag = "mediumcannonweapon3", + duration = 0.5, + energypershot = 0, + explosionGenerator = "custom:genericshellexplosion-medium-purple", + fallOffRate = 0, + fireStarter = 100, + impulseFactor = 0, + interceptedByShieldType = 4, + + minintensity = "1", + name = "Laser", + range = 900, + reloadtime = 7.5, + WeaponType = "LaserCannon", + rgbColor = "0 0.5 1", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/snipershot.wav", + soundHit = "explosions/explode5.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 9, + tolerance = 1000, + turret = true, + weaponVelocity = 3000, + customparams = { + damagetype = "antilightarmored", + isupgraded = isUpgraded, + }, + damage = { + default = 500*1.33, + }, + }, + + -- flamethrower = { + + -- accuracy = 0, + -- AreaOfEffect = weapon1AOE, + -- avoidFeature = false, + -- avoidFriendly = false, + -- collideFeature = false, + -- collideFriendly = false, + -- edgeEffectiveness = 1, + -- explosionGenerator = "custom:burnblack", + -- coreThickness = 0, + -- duration = 1, + -- energypershot = energycosttofire, + -- fallOffRate = 1, + -- fireStarter = 50, + -- interceptedByShieldType = 4, + -- impulseFactor = 0, + -- soundstart = "weapons/flamethrower1.wav", + -- noexplode = true, + -- 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 = "ehbotpyro", + -- single_hit = true, + -- }, + -- damage = { + -- default = weapon1Damage, + -- }, + -- }, +} diff --git a/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua new file mode 100644 index 000000000..2f948ddfc --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua @@ -0,0 +1,148 @@ +unitDef = { + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 77, + builder = false, + buildTime = 5, + canAttack = true, + cantBeTransported = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR", + description = [[Tank Destroyer Turret]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "mediumExplosionGeneric", + floater = true, + footprintX = 2, + footprintZ = 2, + highTrajectory = 2, + iconType = "turret_lit", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 325, + maxSlope = 26, + maxVelocity = 0.001, + maxReverseVelocity = 0.001, + maxWaterDepth = 5000, + metalStorage = 0, + movementClass = "HOVERHBOT3", + pushResistant = true, + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "mediumExplosionGeneric", + side = "CORE", + sightDistance = 800, + smoothAnim = true, + stealth = false, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 0.001, + -- turnrate = 475, + unitname = unitName, + upright = true, + --usePieceCollisionVolumes = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + "custom:airfactoryhtrail", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "plasmacannon", +-- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! +-- maxAngleDif = 70, + --onlyTargetCategory = "LIGHT ARMORED BIO", + badTargetCategory = "VTOL ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + plasmacannon = { + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "thudshot", + --burst = burst, + --burstrate = 0.1, + edgeEffectiveness = 1, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + --duration = 0.25, + highTrajectory = 2, + impulseFactor = 0, + interceptedByShieldType = 4, + name = "Plasma Cannon", + --noExplode = true, + range = 800, + reloadtime = 2, + size = 8, + --projectiles = projectiles, + weaponType = "Cannon", + soundStart = "weapons/bruisercannon.wav", + soundHit = "explosions/mediumcannonhit.wav", + soundTrigger = true, + --sprayAngle = 1000, + tolerance = 10000, + turret = true, + weaponTimer = 1, + weaponVelocity = 600, + customparams = { + damagetype = "antilight", + isupgraded = isUpgraded, + }, + damage = { + default = 150*1.33, + }, + }, +} diff --git a/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua new file mode 100644 index 000000000..5166c2ad5 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/eartytank_basedef.lua @@ -0,0 +1,178 @@ +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 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 = "Artilleryweapon", + 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 = { + Artilleryweapon = { + + accuracy = 500, + AreaOfEffect = 50, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "artyshot2", + avoidNeutral = false, + explosionGenerator = "custom:genericshellexplosion-small", + energypershot = 0, + + impulseFactor = 0, + interceptedByShieldType = 4, + highTrajectory = 0, + name = "Plasma Cannon", + range = 1300, + reloadtime = 5, + size = 16, + weaponType = "Cannon", + soundHit = "explosions/artyhit.wav", + soundStart = "weapons/arty2.wav", + + turret = true, + weaponVelocity = 500, + customparams = { + isupgraded = isUpgraded, + damagetype = "antibuildingarty", + }, + damage = { + default = 200, + }, + }, + + SaturationArtilleryweapon = { + + accuracy = 750, + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "artyshot2", + avoidNeutral = false, + explosionGenerator = "custom:genericshellexplosion-large", + energypershot = 0, + edgeEffectiveness = 1, + + impulseFactor = 0, + interceptedByShieldType = 4, + highTrajectory = 1, + size = 16, + name = "Plasma Cannon", + range = 1300, + reloadtime = 0.5, + weaponType = "Cannon", + soundHit = "explosions/artyhit.wav", + soundStart = "weapons/arty2.wav", + + turret = true, + weaponVelocity = 500, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..967c8bbc2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/ebasefactory_basedef.lua @@ -0,0 +1,83 @@ +unitDef = { + + activatewhenbuilt = false, + buildAngle = 1024, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = true, + buildTime = 5, + buildpic = "ebasefactory.png", + canAttack = false, + canBeAssisted = true, + canGuard = true, + canMove = true, + canPatrol = true, + canReclaim = false, + canstop = true, + category = "BUILDING NOTAIR", + description = [[Build a Tech Facility to unlock units. Build Supply Depots to increase your army size.]], + energyStorage = 0, + energyUse = 0, + energyMake = 0, + explodeAs = "hugeBuildingExplosionGeneric", + footprintX = 10, + footprintZ = 10, + floater = true, + iconType = "factory", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 25, + maxWaterDepth = 99999999999, + metalStorage = 0, + metalMake = 0, + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "hugeBuildingExplosionGeneric", + showNanoSpray = true, + side = "CORE", + sightDistance = 388, + smoothAnim = true, + TEDClass = "PLANT", + unitname = unitName, + -- unitRestricted = 1, + workerTime = 1, + yardMap = "cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc cccccccccc ", + -- usePieceCollisionVolumes = true, + -- modelCenterOffset = {108, 10, 0}, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:nanoorb", + "custom:nano", + "custom:blacksmoke", + "custom:fusionreactionbasic", + }, + }, + buildoptions = hoverFactoryBuildList, + sounds = { + underattack = "other/unitsunderattack1", + select = { + "other/gdfactoryselect", + }, + }, + weapons = { + }, + customParams = { + unittype = "factory", + death_sounds = "generic", + armortype = "building", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, + useGroundDecal = true, +} diff --git a/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua b/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua new file mode 100644 index 000000000..0b1e3ca52 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/eheavytank3_basedef.lua @@ -0,0 +1,130 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = 59, + builder = false, + buildTime = 5, + buildpic = "eheavytank3.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SKIRMISHER", + description = [[Main Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericRed", + footprintX = 2, + footprintZ = 2, + iconType = "td_arm_all", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 375, + maxSlope = 26, + maxVelocity = 3.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericRed", + side = "CORE", + sightDistance = 650, + 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 = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:gdhcannon", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "heavytankweapon", + onlyTargetCategory = "BIO LIGHT ARMORED BUILDING", + badTargetCategory = "BUILDING WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + canbetransported = "true", + 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 = { + heavytankweapon = { + AreaOfEffect = 0, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "antiassualtshot2", + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + name = unitName .. "Weapon", + range = 650, + reloadtime = 1, + size = 16, + weaponType = "Cannon", + soundHit = "explosions/42024_digifishmusic_Missile_Strike.wav", + soundStart = "weapons/triotfire.wav", + tolerance = 2000, + turret = true, + weaponVelocity = 1000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..6381e3383 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/elacerator_basedef.lua @@ -0,0 +1,128 @@ +unitDef = { + acceleration = 0.18, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = 875, + builder = false, + buildTime = 5, + buildpic = "elacerator.png", + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR SUPPORT", + description = [[Endbringer Class Nuclear Battle Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericPurple", + footprintX = 6, + footprintZ = 6, + --highTrajectory = 1, + iconType = "lacerator", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 20000, + maxVelocity = 2.3, + maxReverseVelocity = 1, + maxWaterDepth = 20, + metalStorage = 0, + movementClass = "HOVERTANK6", + noChaseCategory = "VTOL", + name = humanName, + objectName = objectName, + script = script, + pushResistant = true, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGenericPurple", + side = "CORE", + sightDistance = 1200, + smoothAnim = true, + stealth = true, + seismicSignature = 4, + transportbyenemy = false; + turnInPlace = true, + turnRate = 5000, + 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 = "nukeartyweapon", + }, + }, + customParams = { + isupgraded = isUpgraded, + unittype = "mobile", + death_sounds = "nuke", + RequireTech = tech, + armortype = armortype, + --supply_cost = supply, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + corpse = "energycore", + }, +} + +weaponDefs = { + nukeartyweapon = { + accuracy = 500, + AreaOfEffect = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "nukeartyshot", + explosionGenerator = "custom:genericshellexplosion-large-red", + edgeEffectiveness = 0.1, + energypershot = 0, + id = 172, + impulseFactor = 0, + interceptedByShieldType = 4, + name = "Light Cannon", + range = 1200, + reloadtime = 1, + size = 16, + weaponType = "Cannon", + soundHit = "explosions/42024_digifishmusic_Missile_Strike.wav", + soundStart = "weapons/nukeartyshot.wav", + + tolerance = 2000, + turret = true, + weaponVelocity = 800, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..7466baccc --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/elighttank3_basedef.lua @@ -0,0 +1,143 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.1, + buildCostEnergy = 0, + buildCostMetal = 27, + builder = false, + buildTime = 5, + buildpic = "elighttank3.png", + canAttack = true, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR RAID", + description = [[Raider]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "smallExplosionGenericBlue", + footprintX = 2, + footprintZ = 2, + iconType = "raider", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 245, + maxSlope = 26, + maxVelocity = 4.5, + maxReverseVelocity = 2, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, + noChaseCategory = "VTOL", + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "smallExplosionGenericBlue", + side = "CORE", + sightDistance = 650, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 5.5, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 475, + unitname = unitName, + upright = true, + workerTime = 0, + + sfxtypes = { + explosiongenerators = { + "custom:electricity", + "custom:emptydirt", + "custom:blacksmoke", + }, + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "lighttankweapon", + badTargetCategory = "VTOL ARMORED WALL", + }, + }, + customParams = { + isupgraded = isUpgraded, + 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 = "ateran", + corpse = "energycore", + }, +} + + +-------------------------------------------------------------------------------- +-- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) + +weaponDefs = { + lighttankweapon = { + + AreaOfEffect = 25, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + craterBoost = 0, + craterMult = 0, + beamTTL = 10, + explosionGenerator = "custom:genericshellexplosion-small-lightning", + energypershot = 0, + edgeeffectiveness = 1, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + name = "elighttank3weapon", + noSelfDamage = true, + range = 550, + reloadtime = 1, + WeaponType = "LightningCannon", + rgbColor = "0.1 0.2 0.5", + rgbColor2 = "0 0 1", + soundStart = "weapons/lightningstrike.wav", + + texture1 = "lightning", + thickness = 5, + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..daf2fcce2 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/emissiletank_basedef.lua @@ -0,0 +1,149 @@ +unitDef = { + acceleration = 1, + brakeRate = 0.2, + buildCostEnergy = 0, + buildCostMetal = 62, + builder = false, + buildTime = 5, + buildpic = "emissiletank.png", + canAttack = true, + + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "LIGHT NOTAIR SUPPORT", + description = [[Missile Support Tank]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGeneric", + footprintX = 2, + footprintZ = 2, + iconType = "mtd_lit_all", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 320, + maxSlope = 26, + maxVelocity = 2.5, + maxReverseVelocity = 1, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = humanName, + objectName = objectName, + script = script, + radarDistance = 0, + repairable = false, + selfDestructAs = "largeExplosionGeneric", + side = "ARM", + sightDistance = 850, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + transportbyenemy = false; + -- turnInPlace = false, + -- turnInPlaceSpeedLimit = 2.6, + turnInPlace = true, + turnRate = 5000, + -- turnrate = 300, + unitname = unitName, + upright = true, + workerTime = 0, + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + + explosiongenerators = { + "custom:factorysparks", + "custom:emptydirt", + "custom:blacksmoke", + }, + }, + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + [1] = { + def = "missletankweapon", + badTargetCategory = "BUILDING LIGHT", + }, + }, + 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", + }, +} + + +-------------------------------------------------------------------------------- +-- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) + +weaponDefs = { + missletankweapon = { + + AreaOfEffect = 100, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + cegTag = "emissiletanktrail-optimized", + craterBoost = 0, + craterMult = 0, + explosionGenerator = "custom:genericshellexplosion-medium-red", + energypershot = 0, + fireStarter = 100, + flightTime = 5, + impulseBoost = 0, + impulseFactor = 0, + interceptedByShieldType = 4, + + model = "missilesmallvlaunch.s3o", + name = "Rocket", + range = 850, + reloadtime = 3, + weaponType = "MissileLauncher", + + + smokeTrail = false, + soundHit = "explosions/explode_large.wav", + soundStart = "weapons/missile_launch1.wav", + + tracks = true, + turnrate = 30000, + + weaponAcceleration = 400, + weaponTimer = 1, + weaponType = "StarburstLauncher", + weaponVelocity = 3000, + customparams = { + isupgraded = isUpgraded, + 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 new file mode 100644 index 000000000..6ede05de5 --- /dev/null +++ b/Units-Configs-Basedefs/basedefs/hover/eriottank2_basedef.lua @@ -0,0 +1,186 @@ +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 = [[EMP/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", + }, + -- [2] = { + -- 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 = 250, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + + cegTag = "bruisercannon", + explosionGenerator = "custom:genericshellexplosion-medium", + energypershot = 0, + interceptedByShieldType = 4, + impulseFactor = 0, + name = "Shotgun", + --projectiles = 10, + range = 500, + reloadtime = 5, + weaponType = "Cannon", + soundHit = "explosions/mediumcannonhit.wav", + soundStart = "weapons/bruisercannon.wav", + --sprayangle = 2000, + + turret = true, + weaponVelocity = 400, + customparams = { + isupgraded = isUpgraded, + 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/AIUnits/ecommanderai.lua b/Units/AIUnits/ecommanderai.lua deleted file mode 100644 index 2a7d9e9cc..000000000 --- a/Units/AIUnits/ecommanderai.lua +++ /dev/null @@ -1,253 +0,0 @@ --- UNITDEF -- ECOMMANDERAI -- --------------------------------------------------------------------------------- - -local unitName = "ecommanderai" - --------------------------------------------------------------------------------- - -local armortype = [[light]] -local supplyGiven = [[200]] -local powerprovided = [[50 power]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - acceleration = 0.2, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 150, - buildDistance = 1000, - builder = true, - buildTime = 2.5, - capturable = false, - CanAttack = true, - CanAssist = true, - canBeAssisted = true, - CanCapture = true, - CanRepair = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "NOTAIR SUPPORT LIGHT", - description = [[Unit Type: Command Unit -Armortype: ]] ..armortype.. [[ - -1000 EMP Damage vs Light/Armored/Building - -Gives ]] ..supplyGiven.. [[ Supply - -There can only be one!]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "commnuke", - fireState = "1", - footprintX = 4, - footprintZ = 4, - hideDamage = true, - iconType = "commander", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 5000, - maxSlope = 180, - maxVelocity = 3, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalmake = 0, - metalStorage = 0, - movementClass = "COMMANDERTANK4", - moveState = "0", - name = "The Overseer (AI)", - noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", - objectName = "ecommander4.s3o", - script = "ecommander3.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "commnuke", - showPlayerName = true, - showNanoSpray = false, - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "ecommanderai", - unitRestricted = 1, - upright = false, - workerTime = 1, - capturespeed = 0.25, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - -- 0.03125 = 1 hp per second - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - buildoptions = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", --new - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "emp", - }, - }, - customParams = { - canbetransported = "true", - iscommander = true, - needed_cover = 2, - supply_granted = supplyGiven, - ProvideTech = powerprovided, - death_sounds = "generic", - cancollect = "1", - armortype = armortype, - nofriendlyfire = "1", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - --------------------------------------------------------------------------------- - -local weaponDefs = { - emp = { - AreaOfEffect = 500, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - explosionGenerator = "custom:genericshellexplosion-large", - tolerance = 1000, - energypershot = 0, - explosionScar = false, - impulseFactor = 0, - name = "Emp Blast Weapon", - --paralyzer = true, - paralyzetime = 5, - range = 500, - reloadtime = 10, - weaponType = "Cannon", - soundhit = "emp.wav", - size = 0, - turret = true, - weaponVelocity = 10000, - customparams = { - damagetype = "default", - nofriendlyfire = 1, - - --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 = "explosion_enormous.wav", - soundStart = "nukelaunch.wav", - --- stockpile = true, --- stockpileTime = stockpiletime, - startVelocity = 10, - tracks = true, - turnRate = 3000, - targetable = 1, - - weaponAcceleration = 30, - weaponTimer = 15, - weaponType = "StarburstLauncher", - weaponVelocity = 1000, - customparams = { - damagetype = "default", - death_sounds = "nuke", - }, - damage = { - default = 500, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- 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/ecommanderbattleai.lua b/Units/aiunits/ecommanderbattleai.lua new file mode 100644 index 000000000..17be64ed9 --- /dev/null +++ b/Units/aiunits/ecommanderbattleai.lua @@ -0,0 +1,326 @@ +-- UNITDEF -- ECOMMANDERBATTLEAI -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderbattleai" + +-------------------------------------------------------------------------------- +local armortype = [[armored]] +local supplyGiven = [[0]] +local techprovided = [[tech0, tech1, tech2, tech3, 1 tech0ai]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 200 +local weapon1AOE = 250 +local energycosttofire = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + +local weapon2Damage = 25 +local weapon2AOE = 10 +local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false, + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 500, + buildDistance = 1000, + builder = true, + buildTime = 25, + capturable = false, + CanAttack = true, + CanAssist = true, + canBeAssisted = true, + CanCapture = true, + CanRepair = true, + canRestore = false, + + canGuard = true, + canMove = true, + canPatrol = true, + canreclaim = false, + canstop = true, + category = "NOTAIR SUPPORT ARMORED", + description = [[AI Overseer • Builds Units • Provides support in battles]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + hideDamage = true, + iconType = "commander", + idleAutoHeal = .5, + idleTime = 2200, + levelground = true, + maxDamage = 5000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 9500, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Battle Overseer (AI)", + noChaseCategories = "NOTAIR SUPPORT VTOL AMPHIB", + objectName = "ecommander4-battle.s3o", + script = "ecommander4-battle.cob", + radarDistance = 1000, + repairable = false, + selfDestructAs = "commnuke", + showPlayerName = true, + showNanoSpray = true, + sightDistance = 1000, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = false, + workerTime = 1, + capturespeed = 0.25, + TerraformSpeed = 100000, + ReclaimSpeed = 0, + -- 0.03125 = 1 hp per second + repairspeed = 100, + 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 = { + + 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, + }, + 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 = 20, + weaponType = "Cannon", + soundhit = "explosions/emp.wav", + size = 0, + turret = true, + weaponVelocity = 10000, + waterweapon = true, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + nocosttofire = true, + }, + 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, + waterweapon = true, + customparams = { + damagetype = "light", + death_sounds = "nuke", + nocosttofire = true, + }, + damage = { + default = 1000, + }, + }, + machinegun = { + accuracy = 300, + AreaOfEffect = weapon2AOE, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + + coreThickness = 0.5, + duration = 0.1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = energycosttofire2, + fallOffRate = 1, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Machine Gun", + range = 800, + reloadtime = 0.05, + WeaponType = "LaserCannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/tankdestroyerfire.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 5, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + waterweapon = true, + customparams = { + damagetype = "light", + nocosttofire = true, + }, + damage = { + default = weapon2Damage, + }, + }, +} +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- 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 689b83dc0..000000000 --- a/Units/arm/armflash.lua +++ /dev/null @@ -1,149 +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, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR", - copyright = "Copyright 1997 Humongous Entertainment. All rights reserved.", - corpse = "ammobox", - 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 = "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", - }, -} - --------------------------------------------------------------------------------- - -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 = "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 7f737dcde..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", - corpse = "ammobox", - 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 = "unitsunderattack1", - select = { - "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", - }, - 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 8b586d16b..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, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - cantBeTransported = true, - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavybeamweapon", - onlyTargetCategory = "BUILDING", - }, - [2] = { - def = "concussioncannon", - onlyTargetCategory = "LIGHT ARMORED", - }, - [3] = { - def = "concussioncannon", - onlyTargetCategory = "LIGHT ARMORED", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = "40 Power", - armortype = "armored", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- - -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 = "krabprimary.wav", - sweepfire = true, - -- soundHit = "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 = "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 = "explosion_enormous.wav", - soundStart = "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 12eb6102f..000000000 --- a/Units/eair/eairengineer.lua +++ /dev/null @@ -1,152 +0,0 @@ --- UNITDEF -- EAIRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eairengineer" - --------------------------------------------------------------------------------- - -local armortype = [[light]] -local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.5, - airStrafe = true, - brakeRate = 0.5, - buildCostEnergy = 0, - buildCostMetal = 80, - buildTime = 2.5, - builder = true, - buildDistance = 600, - canAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - canDropFlare = true, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT VTOL", - collide = true, - corpse = "ammobox", - cruiseAlt = 300, - description = [[Unit Type: Engineer -Armortype: ]] .. armortype .. [[ - -Uses +]] .. supply .. [[ Supply]], - 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 = 450, - 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 = false, - sightDistance = 600, - smoothAnim = true, - turnRate = 5000, - unitname = "eairengineer", - 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 = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - "ecommander", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - -- needed_cover = 2, - death_sounds = "generic", - -- airdronespawner = "1", - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/eairplant.lua b/Units/eair/eairplant.lua index 11cf9a907..e8ccc02c2 100644 --- a/Units/eair/eairplant.lua +++ b/Units/eair/eairplant.lua @@ -1,115 +1,24 @@ -- UNITDEF -- EAIRPLANT -- -------------------------------------------------------------------------------- -local unitName = "eairplant" +unitName = "eairplant" -------------------------------------------------------------------------------- -local armortype = [[building]] +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 -local unitDef = { +humanName = [[VTOL Factory]] - activatewhenbuilt = true, - buildCostEnergy = 0, - buildCostMetal = 60, - builder = true, - buildTime = 2.5, - canBeAssisted = true, - canGuard = true, - canMove = true, - canPatrol = true, - canReclaim = false, - canstop = true, - category = "BUILDING NOTAIR VTOL", - corpse = "ammobox", - description = [[Place generators near this factory to unlock higher tier units -Armortype: ]] .. armortype, - energyStorage = 0, - energyUse = 0, - energyMake = 0, - explodeAs = "MEXPOP2", - floater = true, - footprintX = 18, - footprintZ = 18, - iconType = "factory", - idleAutoHeal = .5, - idleTime = 2200, - levelground = false, - maxDamage = 1500, - maxSlope = 90, - maxWaterDepth = 999999, - metalStorage = 0, - metalMake = 0, - mobilestandorders = "1", - name = "Aircraft Plant", - objectName = "eairplant3.s3o", - script = "eairplant3.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - showNanoSpray = "0", - sightDistance = 388, - smoothAnim = true, - TEDClass = "PLANT", - unitname = "eairplant", - -- unitRestricted = 1, - unitnumber = "83", - workerTime = 1, - yardMap = "oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo oooooooooooooooooo", - -- usePieceCollisionVolumes = true, +objectName = "eairplant3.s3o" +script = "eairplant3.cob" - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:nano", - "custom:blacksmoke", - "custom:fusionreactionbasic", - "custom:airfactoryhtrail", - }, - }, - zbuffer = "1", - buildoptions = { - "eairengineer", - "escout", --new - "egunship2", --new - "efighter", --new - "ebomber", --new - "etransport", --new - - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdfactoryselect", - }, - }, - customParams = { - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - -- ProvideTech = "1 Powergrid", - -- ProvideTechRange = "1500", - -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", - -- groundtexselectxsize = 1500, -- optional - -- groundtexselectzsize = 1500, -- optional - }, - -- useGroundDecal = true, - -- BuildingGroundDecalType = "factorygroundplate.dds", - -- BuildingGroundDecalSizeX = 20, - -- BuildingGroundDecalSizeY = 20, - -- BuildingGroundDecalDecaySpeed = 0.9, -} +airPlantBuildList = Shared.buildListAirPlant +VFS.Include("Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua") -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eair/eairplant_up1.lua b/Units/eair/eairplant_up1.lua new file mode 100644 index 000000000..2891fa7dc --- /dev/null +++ b/Units/eair/eairplant_up1.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAIRPLANT -- +-------------------------------------------------------------------------------- + +unitName = "eairplant_up1" + +-------------------------------------------------------------------------------- + +buildCostMetal = 270 +maxDamage = buildCostMetal * 12.5 + +humanName = [[VTOL Factory Mark II]] + +objectName = "eairplant3.s3o" +script = "eairplant3.cob" + +airPlantBuildList = Shared.buildListAirPlant_up1 + +VFS.Include("Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairplant_up2.lua b/Units/eair/eairplant_up2.lua new file mode 100644 index 000000000..a61c92f8f --- /dev/null +++ b/Units/eair/eairplant_up2.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAIRPLANT -- +-------------------------------------------------------------------------------- + +unitName = "eairplant_up2" + +-------------------------------------------------------------------------------- + +buildCostMetal = 510 +maxDamage = buildCostMetal * 12.5 + +humanName = [[VTOL Factory Mark III]] + +objectName = "eairplant3.s3o" +script = "eairplant3.cob" + +airPlantBuildList = Shared.buildListAirPlant_up2 + +VFS.Include("Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/eairplant_up3.lua b/Units/eair/eairplant_up3.lua new file mode 100644 index 000000000..e0d22b518 --- /dev/null +++ b/Units/eair/eairplant_up3.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAIRPLANT -- +-------------------------------------------------------------------------------- + +unitName = "eairplant_up3" + +-------------------------------------------------------------------------------- + +buildCostMetal = 750 +maxDamage = buildCostMetal * 12.5 + +humanName = [[VTOL Factory Mark IV]] + +objectName = "eairplant3.s3o" +script = "eairplant3.cob" + +airPlantBuildList = Shared.buildListAirPlant_up3 + +VFS.Include("Units-Configs-Basedefs/basedefs/air/eairplant_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ebomber.lua b/Units/eair/ebomber.lua index edc2b2c27..a0abd0dff 100644 --- a/Units/eair/ebomber.lua +++ b/Units/eair/ebomber.lua @@ -1,191 +1,28 @@ -- UNITDEF -- EBOMBER -- -------------------------------------------------------------------------------- -local unitName = "ebomber" +unitName = "ebomber" -------------------------------------------------------------------------------- -local power = [[18 power]] -local armortype = [[light]] -local supply = [[5]] -local weapon1Damage = 200 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +isUpgraded = [[0]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +humanName = [[Kamper]] -local unitDef = { +objectName = "ebomber2-small.s3o" +script = "ebomber2.cob" - --mobileunit - transportbyenemy = false; - --** +tech = [[tech2]] +armortype = [[air]] +supply = [[5]] +VFS.Include("Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua") - acceleration = 0.5, - airStrafe = false, - BadTargetCategory = "VTOL", - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 55, - builder = false, - buildTime = 2.5, - canAttack = true, - canFly = true, - canGuard = true, - canMove = true, - canPatrol = true, - canstop = true, - category = "ARMORED VTOL", - collide = true, - corpse = "ammobox", - cruiseAlt = 140, - description = [[Unit Type: Bomber -Armortype: ]] ..armortype.. [[ - -200 Damage vs Buildings -150 Damage vs Light/Armored - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "hugeExplosionGeneric", - footprintX = 7, - footprintZ = 7, - floater = true, - hoverAttack = true, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - loopbackattack = false, - maxDamage = 270, - maxSlope = 90, - maxVelocity = 11, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - name = "Kamper", - noChaseCategory = "VTOL", - objectName = "ebomber2.s3o", - script = "ebomber2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeExplosionGeneric", - side = "CORE", - sightDistance = 900, - smoothAnim = true, - stealth = false, - turnRate = 5000, - unitname = "ebomber", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "SBOMB", - noChaseCategory = "VTOL", - badTargetCategory = "VTOL", - }, - }, - customParams = { - -- needed_cover = 2, - death_sounds = "generic", - nofriendlyfire = "1", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - SBOMB = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cegTag = "missiletrailgunship", - explosionGenerator = "custom:genericshellexplosion-large-red", - energypershot = energycosttofire, - edgeEffectiveness = 0.1, - fireStarter = 70, - - id = 136, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - metalpershot = 0, - model = "missile.s3o", - name = "Rockets", - range = 750, - reloadtime = 3, - weaponType = "MissileLauncher", -- This causes the missile trail to go off kilter - -- rendertype = 1, - - - smokeTrail = false, - soundHit = "unitexplodebig.wav", - soundHitWet = "subhitbomb.wav", - soundHitVolume = 10, - soundStart = "bomberlaunch.wav", - soundStartVolume = 10, - - startVelocity = 500, - tolerance = 8000, - turnRate = 10000, - tracks = false, - turret = false, - weaponAcceleration = 10, - waterweapon = true, - flightTime = 10, - weaponVelocity = 800, - customparams = { - damagetype = "ebomber", - nofriendlyfire = 1, - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eair/ebomber2_up1.lua b/Units/eair/ebomber2_up1.lua new file mode 100644 index 000000000..3c9eb0e88 --- /dev/null +++ b/Units/eair/ebomber2_up1.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EBOMBER -- +-------------------------------------------------------------------------------- + +unitName = "ebomber_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Kamper Mark II]] + +objectName = "ebomber2-small.s3o" +script = "ebomber2.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ebomber2_up2.lua b/Units/eair/ebomber2_up2.lua new file mode 100644 index 000000000..d4693989f --- /dev/null +++ b/Units/eair/ebomber2_up2.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EBOMBER -- +-------------------------------------------------------------------------------- + +unitName = "ebomber_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Kamper Mark III]] + +objectName = "ebomber2-small.s3o" +script = "ebomber2.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ebomber2_up3.lua b/Units/eair/ebomber2_up3.lua new file mode 100644 index 000000000..7ededa36d --- /dev/null +++ b/Units/eair/ebomber2_up3.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EBOMBER -- +-------------------------------------------------------------------------------- + +unitName = "ebomber_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Kamper Mark IV]] + +objectName = "ebomber2-small.s3o" +script = "ebomber2.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ebomber_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/edrone.lua b/Units/eair/edrone.lua deleted file mode 100644 index 634b1ebcf..000000000 --- a/Units/eair/edrone.lua +++ /dev/null @@ -1,175 +0,0 @@ --- UNITDEF -- EDRONE -- --------------------------------------------------------------------------------- - -local unitName = "edrone" - --------------------------------------------------------------------------------- - -local armortype = [[light]] - -local weapon1Damage = 5 -local energycosttofire = weapon1Damage / 20 - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.5, - airStrafe = false, - bankscale = "1", - brakeRate = 1, - buildCostEnergy = 1, - buildCostMetal = 5, - buildTime = 2.5, - canAttack = true, - canDropFlare = false, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT VTOL DRONE", - collide = false, - -- corpse = "ammobox", - cruiseAlt = 100, - description = [[Gunship Drone -Armortype: ]] .. armortype ..[[ - -]] .. weapon1Damage .. [[ Damage vs Light/Armored/Building]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGenericPurple", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, - footprintX = 3, - footprintZ = 3, - hoverAttack = true, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 55, - maxSlope = 90, - maxVelocity = 30, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - moverate1 = "8", - name = "MidKnight", - objectName = "edrone2.s3o", - script = "edrone2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGenericPurple", - side = "CORE", - sightDistance = 300, - smoothAnim = true, - stealth = true, - turnRate = 5000, - unitname = "edrone", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jetstrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "droneweapon", - mainDir = "0 0 1", - maxAngleDif = 45, - badTargetCategory = "WALL", - }, - }, - customParams = { - -- needed_cover = 1, - armortype = armortype, - death_sounds = "generic", - nofriendlyfire = "1", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - droneweapon = { - accuracy = 500, - AreaOfEffect = 1, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.2, - - coreThickness = 0.5, - craterBoost = 0, - craterMult = 0, - duration = 0.05, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-small-sparks-burn", - fallOffRate = 0.1, - impulseFactor = 0, - interceptedByShieldType = 4, - largeBeamLaser = true, - - name = "Light Laser", - noSelfDamage = true, - range = 800, - reloadtime = 1, - WeaponType = "LaserCannon", - rgbColor = "0.1 0.5 0.2", - rgbColor2 = "0 1 0", - - soundHit = "18393_inferno_reject.wav", - soundStart = "18389_inferno_medlas.wav", - soundTrigger = true, - startVelocity = 1000, - targetMoveError = 0, - texture1 = "plasmaball", - texture2 = "empty", - texture3 = "empty", - texture4 = "empty", - thickness = 5, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "edrone", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eair/efighter.lua b/Units/eair/efighter.lua index 0729947e6..9e325db28 100644 --- a/Units/eair/efighter.lua +++ b/Units/eair/efighter.lua @@ -1,183 +1,28 @@ -- UNITDEF -- EFIGHTER -- -------------------------------------------------------------------------------- -local unitName = "efighter" +unitName = "efighter" -------------------------------------------------------------------------------- -local power = [[8 power]] -local armortype = [[light]] -local supply = [[2]] +isUpgraded = [[0]] -local weapon1Damage = 25 -local weapon1AOE = 100 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Koyote]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "efighter2-small.s3o" +script = "efighter2.cob" -local unitDef = { - --mobileunit - transportbyenemy = false; +tech = [[tech2]] +armortype = [[air]] +supply = [[2]] - --** - - - acceleration = 0.5, - airStrafe = false, - bankscale = "1", - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 45, - buildTime = 2.5, - canAttack = true, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT VTOL", - collide = true, - corpse = "ammobox", - cruiseAlt = 200, - description = [[Unit Type: Paralysis Gunship -Armortype: ]] ..armortype.. [[ - -250 Damage vs Light/Armored/s -62.5 Damage vs Building/s - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericWhite", - footprintX = 5, - footprintZ = 5, - hoverAttack = true, - floater = true, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - maxAcc = 0.25, - maxBank = 5, - maxDamage = 225, - maxSlope = 90, - maxVelocity = 16, - verticalSpeed = 15, - maxWaterDepth = 255, - metalStorage = 0, - moverate1 = "8", - name = "Koyote", - objectName = "efighter2.s3o", - script = "efighter2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericWhite", - side = "ARM", - sightDistance = 550, - smoothAnim = true, - sonarDistance = 0, - turnRate = 5000, - unitname = "efighter", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "aircannon", - badTargetCategory = "BUILDING VTOL", - }, - }, - customParams = { - -- needed_cover = 2, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - aircannon = { - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.5, - burnblow = true, - --cegTag = "railgun", - duration = 0.05, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - - minintensity = "1", - name = "Laser", - paralyzer = true, - paralyzetime = 2.5, - range = 550, - reloadtime = 0.1, - WeaponType = "LaserCannon", - rgbColor = "0 0 1", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "tmediumtankfire.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 15, - tolerance = 10000, - turret = false, - weaponVelocity = 5000, - customparams = { - damagetype = "efighter", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +VFS.Include("units-configs-basedefs/basedefs/air/efighter_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eair/efighter_up1.lua b/Units/eair/efighter_up1.lua new file mode 100644 index 000000000..93c0aca1a --- /dev/null +++ b/Units/eair/efighter_up1.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EFIGHTER -- +-------------------------------------------------------------------------------- + +unitName = "efighter_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Koyote Mark II]] + +objectName = "efighter2-small.s3o" +script = "efighter2.cob" + + +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/efighter_up2.lua b/Units/eair/efighter_up2.lua new file mode 100644 index 000000000..e8e8686e5 --- /dev/null +++ b/Units/eair/efighter_up2.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EFIGHTER -- +-------------------------------------------------------------------------------- + +unitName = "efighter_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Koyote Mark III]] + +objectName = "efighter2-small.s3o" +script = "efighter2.cob" + + +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/efighter_up3.lua b/Units/eair/efighter_up3.lua new file mode 100644 index 000000000..f575c5e22 --- /dev/null +++ b/Units/eair/efighter_up3.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EFIGHTER -- +-------------------------------------------------------------------------------- + +unitName = "efighter_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Koyote Mark IV]] + +objectName = "efighter2-small.s3o" +script = "efighter2.cob" + + +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 f11f99b90..5acab7c7e 100644 --- a/Units/eair/egunship2.lua +++ b/Units/eair/egunship2.lua @@ -1,188 +1,28 @@ --- UNITDEF -- EGUNSHIP2 -- +-- UNITDEF -- EGUNSHIP -- -------------------------------------------------------------------------------- -local unitName = "egunship2" +unitName = "egunship2" -------------------------------------------------------------------------------- -local power = [[12 power]] -local armortype = [[light]] -local supply = [[4]] +isUpgraded = [[0]] -local weapon1Damage = 150 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Wildkat]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "egunship3-small.s3o" +script = "egunship3.cob" -local unitDef = { - --mobileunit - transportbyenemy = false; +tech = [[tech2]] +armortype = [[air]] +supply = [[4]] - --** - - - acceleration = 0.5, - airStrafe = false, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 50, - buildTime = 2.5, - canAttack = true, - canDropFlare = false, - canFly = true, - canGuard = true, - canLoopbackAttack = true, - canMove = true, - canPatrol = true, - canstop = true, - category = "LIGHT VTOL", - collide = true, - corpse = "ammobox", - cruiseAlt = 120, - description = [[Unit Type: Gunship Tank Destroyer -Armortype: ]] ..armortype.. [[ - -150 Damage vs Light/Armored -75 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericRed", - flareDelay = 0.1, - flareDropVector = "0 0 -1", - flareefficieny = "0.3", - flareReload = 3, - floater = true, - footprintX = 4, - footprintZ = 4, - hoverAttack = true, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 300, - maxSlope = 90, - maxVelocity = 14, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - moverate1 = "8", - name = "Wildcat", - objectName = "egunship3.s3o", - script = "egunship3.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericRed", - side = "CORE", - sightDistance = 800, - smoothAnim = true, - turnRate = 5000, - unitname = "egunship2", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "gunshipweapon", - mainDir = "0 0 1", - maxAngleDif = 180, - OnlyTargetCategory = "LIGHT ARMORED BUILDING", - BadTargetCategory = "BUILDING WALL", - noChaseCategory = "VTOL", - }, - }, - customParams = { - -- needed_cover = 2, - canareaattack ="1", - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - - gunshipweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cegTag = "missiletrailgunshiplesssmokey", - explosionGenerator = "custom:genericshellexplosion-medium", - energypershot = energycosttofire, - edgeEffectiveness = 0.1, - fireStarter = 70, - tracks = true, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - model = "missilesmalllauncher.s3o", - name = "Rockets", - range = 420, - reloadtime = 1, - weaponType = "MissileLauncher", - waterweapon = true, - smokeTrail = false, - soundHit = "bombhit.wav", - soundHitWet = "subhit.wav", - soundHitVolume = 10, - soundStart = "18395_inferno_rltx.wav", - soundStartVolume = 10, - startVelocity = 500, - tolerance = 8000, - turnRate = 20000, - turret = true, - weaponAcceleration = 500, - flightTime = 5, - weaponVelocity = 2000, - customparams = { - damagetype = "egunship2", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +VFS.Include("Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eair/egunship2_up1.lua b/Units/eair/egunship2_up1.lua new file mode 100644 index 000000000..5fa577ca3 --- /dev/null +++ b/Units/eair/egunship2_up1.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EGUNSHIP -- +-------------------------------------------------------------------------------- + +unitName = "egunship2_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Wildkat Mark II]] + +objectName = "egunship3-small.s3o" +script = "egunship3.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/egunship2_up2.lua b/Units/eair/egunship2_up2.lua new file mode 100644 index 000000000..4ca8f6209 --- /dev/null +++ b/Units/eair/egunship2_up2.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EGUNSHIP -- +-------------------------------------------------------------------------------- + +unitName = "egunship2_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Wildkat Mark III]] + +objectName = "egunship3-small.s3o" +script = "egunship3.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/egunship2_up3.lua b/Units/eair/egunship2_up3.lua new file mode 100644 index 000000000..545b7828f --- /dev/null +++ b/Units/eair/egunship2_up3.lua @@ -0,0 +1,28 @@ +-- UNITDEF -- EGUNSHIP -- +-------------------------------------------------------------------------------- + +unitName = "egunship2_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Wildkat Mark IV]] + +objectName = "egunship3-small.s3o" +script = "egunship3.cob" + + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/egunship2_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ekrow.lua b/Units/eair/ekrow.lua new file mode 100644 index 000000000..5da3bde41 --- /dev/null +++ b/Units/eair/ekrow.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- EKROW -- +-------------------------------------------------------------------------------- + +unitName = "ekrow" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Krow]] + +objectName = "ekrow.s3o" +script = "ekrow.cob" + + +tech = [[tech3]] +armortype = [[air]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ekrow_up1.lua b/Units/eair/ekrow_up1.lua new file mode 100644 index 000000000..c157dc3c4 --- /dev/null +++ b/Units/eair/ekrow_up1.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- EKROW_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ekrow_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Krow MK II]] + +objectName = "ekrow.s3o" +script = "ekrow.cob" + + +tech = [[tech3]] +armortype = [[light]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ekrow_up2.lua b/Units/eair/ekrow_up2.lua new file mode 100644 index 000000000..4dde44435 --- /dev/null +++ b/Units/eair/ekrow_up2.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- EKROW_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ekrow_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Krow MK III]] + +objectName = "ekrow.s3o" +script = "ekrow.cob" + + +tech = [[tech3]] +armortype = [[light]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_basedef.lua") + +unitDef.weaponDefs = weaponDefs + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/ekrow_up3.lua b/Units/eair/ekrow_up3.lua new file mode 100644 index 000000000..aeaee9656 --- /dev/null +++ b/Units/eair/ekrow_up3.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- EKROW_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ekrow_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Krow MK IV]] + +objectName = "ekrow.s3o" +script = "ekrow.cob" + + +tech = [[tech3]] +armortype = [[light]] + +VFS.Include("Units-Configs-Basedefs/basedefs/air/ekrow_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 080908986..000000000 --- a/Units/eair/escout.lua +++ /dev/null @@ -1,107 +0,0 @@ --- UNITDEF -- ESCOUT -- --------------------------------------------------------------------------------- - -local unitName = "escout" - --------------------------------------------------------------------------------- - -local power = [[2 power]] -local armortype = [[light]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.5, - airStrafe = false, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 40, - builder = false, - buildTime = 2.5, - canFly = true, - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT VTOL", - collide = false, - corpse = "ammobox", - cruiseAlt = 180, - description = [[Unit Type: Air Scout -Armortype: ]] ..armortype.. [[ - -Requires +]] .. power, - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericBlue", - footprintX = 4, - footprintZ = 4, - hoverAttack = true, - floater = true, - iconType = "air", - idleAutoHeal = .5, - idleTime = 2200, - isTargetingUpgrade = false, - maxDamage = 160, - maxSlope = 90, - maxVelocity = 20, - verticalSpeed = 15, - maxWaterDepth = 0, - metalStorage = 0, - name = "AirScout", - objectName = "escout2.s3o", - script = "escout2.cob", - radarDistance = 1500, - SonarDistance = 1500, - SeismicDistance = 1500, - repairable = false, - selfDestructAs = "mediumExplosionGenericBlue", - side = "ARM", - sightDistance = 750, - smoothAnim = true, - turnRate = 5000, - unitname = "escout", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - -- needed_cover = 1, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- - -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 06fdf83d4..000000000 --- a/Units/eair/esubplane.lua +++ /dev/null @@ -1,165 +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 - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "esubplanetorpedo", - OnlyTargetCategory = "BUILDING AMPHIB", - noChaseCategory = "VTOL", - }, - }, - - customParams = { - -- needed_cover = 2, - death_sounds = "generic", - twokhotkey = 't', - nofriendlyfire = "1", - RequireTech = "10 Power", - armortype = "armored", - normaltex = "unittextures/esubplanenormal.png", - }, -} - - --------------------------------------------------------------------------------- - -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 = "torpedolaunch.wav", - soundStart = "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/etransport.lua b/Units/eair/etransport.lua index 6f09ac32e..192777b27 100644 --- a/Units/eair/etransport.lua +++ b/Units/eair/etransport.lua @@ -1,112 +1,27 @@ -- UNITDEF -- ETRANSPORT -- -------------------------------------------------------------------------------- -local unitName = "etransport" +unitName = "etransport" -------------------------------------------------------------------------------- -local power = [[0 power]] -local armortype = [[armored]] -local supply = [[0]] +isUpgraded = [[0]] -local unitDef = { +humanName = [[Kharter]] - --mobileunit - transportbyenemy = false; +objectName = "etransport2-small.s3o" +script = "etransport2.cob" - --** +--tech = [[tech1]] +armortype = [[armored]] +supply = [[0]] - acceleration = 0.5, - airStrafe = false, - airHoverFactor = 0, - brakeRate = 2, - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 2.5, - canAttack = false, - canFly = true, - canGuard = false, - canMove = true, - canload = true, - canPatrol = false, - canstop = "1", - category = "ARMORED VTOL", - collide = true, - corpse = "ammobox", - cruiseAlt = 150, - description = [[Unit Type: Fast Armored Transport -Armortype: ]] ..armortype.. -[[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyUse = 0, - explodeAs = "hugeExplosionGenericRed", - fallSpeed = 1000, - footprintX = 3, - footprintZ = 3, - hoverAttack = true, - holdSteady = true, - -- hoverAttack = true, - icontype = "etransport", - maxDamage = 200, - maxSlope = 90, - maxVelocity = 18, - verticalSpeed = 30, - name = "Charter", - objectName = "etransport2-small.s3o", - script = "etransport2.cob", - releaseHeld = false, - repairable = false, - selfDestructAs = "hugeExplosionGenericRed", - side = "GD", - sightDistance = 500, - smoothAnim = true, - transportCapacity = 2, - transportMass = 10000, - transportSize = 6, - transportUnloadMethod = 0, - turnRate = 5000, - unitname = "etransport", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:jethtrail", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - -- needed_cover = 2, - transportcapa = "6", - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - +VFS.Include("units-configs-basedefs/basedefs/air/etransport_basedef.lua") +-- unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eair/etransport_up1.lua b/Units/eair/etransport_up1.lua new file mode 100644 index 000000000..5c233a5eb --- /dev/null +++ b/Units/eair/etransport_up1.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ETRANSPORT -- +-------------------------------------------------------------------------------- + +unitName = "etransport_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Kharter Mark II]] + +objectName = "etransport2-small.s3o" +script = "etransport2.cob" + + +--tech = [[tech1]] +armortype = [[armored]] +supply = [[0]] + +VFS.Include("units-configs-basedefs/basedefs/air/etransport_basedef.lua") + +-- unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/etransport_up2.lua b/Units/eair/etransport_up2.lua new file mode 100644 index 000000000..36b45af74 --- /dev/null +++ b/Units/eair/etransport_up2.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ETRANSPORT -- +-------------------------------------------------------------------------------- + +unitName = "etransport_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Kharter Mark III]] + +objectName = "etransport2-small.s3o" +script = "etransport2.cob" + + +--tech = [[tech1]] +armortype = [[armored]] +supply = [[0]] + +VFS.Include("units-configs-basedefs/basedefs/air/etransport_basedef.lua") + +-- unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eair/etransport_up3.lua b/Units/eair/etransport_up3.lua new file mode 100644 index 000000000..b2ec29ab3 --- /dev/null +++ b/Units/eair/etransport_up3.lua @@ -0,0 +1,27 @@ +-- UNITDEF -- ETRANSPORT -- +-------------------------------------------------------------------------------- + +unitName = "etransport_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Kharter Mark IV]] + +objectName = "etransport2-small.s3o" +script = "etransport2.cob" + + +--tech = [[tech1]] +armortype = [[armored]] +supply = [[0]] + +VFS.Include("units-configs-basedefs/basedefs/air/etransport_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 6ab04fb15..000000000 --- a/Units/eallterrain/eallterraa.lua +++ /dev/null @@ -1,185 +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, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description =[[Armored Dedicated Anti-Air - Armored - 200 Damage vs Armored - 132 Damage vs Light/Building - - Requires +3 Power - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavytankweapon", - onlyTargetCategory = "VTOL", - }, - }, - customParams = { - 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", - }, -} - - --------------------------------------------------------------------------------- --- 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 = "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 14099ef80..bf8179cf8 100644 --- a/Units/eallterrain/eallterranarchid.lua +++ b/Units/eallterrain/eallterranarchid.lua @@ -1,276 +1,26 @@ --- UNITDEF -- eallterranarchid -- +-- UNITDEF -- eallterranarchid -- Anarchid -- -------------------------------------------------------------------------------- -local unitName = "eallterranarchid" +unitName = "eallterranarchid" -------------------------------------------------------------------------------- -local power = [[28 power]] -local armortype = [[armored]] -local supply = [[12]] +isUpgraded = [[0]] -local weapon1Damage = 300 -local weapon1AOE = 10 -local weapon2Damage = 25 -local weapon2AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) +humanName = [[Anarchid]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterranarchid.s3o" +script = "eallterranarchid.cob" -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 225, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - cantBeTransported = true, - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - description =[[Unit Type: Endbringer Class Base Assault Walker -Armortype: ]] ..armortype.. [[ - -Primary Laser: -300 Damage/s vs Building -30 Damage/s vs Light/Armored - -Secondary Cannons: -25 Damage vs Building -12.5 Damage vs Light/Armored - -This unit can only attack buildings! - -Energy cost to fire Primary Laser: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Secondary Cannons: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "krabblast", - firestandorders = "1", - footprintX = 6, - footprintZ = 6, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 1500, - maxVelocity = 2.5, - maxReverseVelocity = 1, - maxWaterDepth = 80, - metalStorage = 0, - movementClass = "ALLTERRTANK6", - name = "Anarchid", - noChaseCategory = "VTOL", - objectName = "eallterranarchid.s3o", - pushResistant = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "krabblast", - shootme = "1", - sightDistance = 1000, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterranarchid", - unitnumber = "110", - upright = false, - -- usePieceCollisionVolumes = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:flamethrowerrange500", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavybeamweapon", - onlyTargetCategory = "BUILDING", - }, - [2] = { - def = "flamethrower", - }, - [3] = { - def = "flamethrower", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - heavybeamweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 1, - cameraShake = 1, - coreThickness = 0.2, - -- cegTag = "mediumcannonweapon3", - -- duration = 0.2, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - minintensity = "1", - name = "Laser", - range = 1000, - reloadtime = 1, - WeaponType = "BeamLaser", - rgbColor = "1 0 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "krabprimary.wav", - -- soundHit = "mediumcannonhit.wav", - -- sweepfire = true, - texture1 = "shot", - texture2 = "empty", - thickness = 6, - tolerance = 1000, - turret = true, - weaponVelocity = 800, - customparams = { - damagetype = "eallterranarchid", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - concussioncannon = { - accuracy = 1, - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cylinderTargeting = true, - burnblow = true, - explosionGenerator = "custom:genericshellexplosion-medium", - energypershot = energycosttofire2, - fireStarter = 80, - id = 1, - impulseFactor = 0.1, - interceptedByShieldType = 4, - name = "Concussion Cannon", - range = 1000, - reloadtime = 1, - weaponType = "Cannon", - soundHit = "explode2", - soundStart = "krabsecondary.wav", - tolerance = 500, - turret = true, - weaponVelocity = 5000, - customparams = { - damagetype = "eallterranarchid", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, - flamethrower = { - - accuracy = 0, - AreaOfEffect = weapon2AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - explosionGenerator = "custom:burnblack", - coreThickness = 0, - duration = 1, - energypershot = energycosttofire2, - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - soundstart = "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 = "eallterranarchidflame", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +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/eallterrain/eallterranarchid_up1.lua b/Units/eallterrain/eallterranarchid_up1.lua new file mode 100644 index 000000000..2f87a19b9 --- /dev/null +++ b/Units/eallterrain/eallterranarchid_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterranarchid -- Anarchid -- +-------------------------------------------------------------------------------- + +unitName = "eallterranarchid_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Anarchid Mark II]] + +objectName = "eallterranarchid.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 }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterranarchid_up2.lua b/Units/eallterrain/eallterranarchid_up2.lua new file mode 100644 index 000000000..d16b804bc --- /dev/null +++ b/Units/eallterrain/eallterranarchid_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterranarchid -- Anarchid -- +-------------------------------------------------------------------------------- + +unitName = "eallterranarchid_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Anarchid Mark III]] + +objectName = "eallterranarchid.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 }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterranarchid_up3.lua b/Units/eallterrain/eallterranarchid_up3.lua new file mode 100644 index 000000000..3d6e463e5 --- /dev/null +++ b/Units/eallterrain/eallterranarchid_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterranarchid -- Anarchid -- +-------------------------------------------------------------------------------- + +unitName = "eallterranarchid_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Anarchid Mark IV]] + +objectName = "eallterranarchid.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/eallterrain/eallterrassault.lua b/Units/eallterrain/eallterrassault.lua index 15f3c9313..00a53a3e5 100644 --- a/Units/eallterrain/eallterrassault.lua +++ b/Units/eallterrain/eallterrassault.lua @@ -1,197 +1,26 @@ --- UNITDEF -- EALLTERRASSAULT -- +-- UNITDEF -- eallterrassault -- Anvil -- -------------------------------------------------------------------------------- -local unitName = "eallterrassault" +unitName = "eallterrassault" -------------------------------------------------------------------------------- -local power = [[12 power]] -local armortype = [[armored]] -local supply = [[8]] +isUpgraded = [[0]] -local weapon1Damage = 150 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Anvil]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterrassault.s3o" +script = "eallterrassault.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 60, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description =[[Unit Type: Anti-Base Long Range Siege Tank -Armortype: ]] ..armortype.. [[ - -150 Damage vs Buildings -75 Damage vs Light/Armored - -This unit can only fire at buildings! - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "hugeExplosionGeneric", - firestandorders = "1", - footprintX = 6, - footprintZ = 6, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 400, - maxVelocity = 2.4, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK6", - name = "Anvil", - noChaseCategory = "VTOL", - objectName = "eallterrassault.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeExplosionGeneric", - shootme = "1", - sightDistance = 1000, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrassault", - unitnumber = "110", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "assaulttankcannon", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 4, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - assaulttankcannon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.2, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 100, - impulseFactor = 0, - interceptedByShieldType = 4, - minintensity = "1", - name = "Laser", - range = 1100, - reloadtime = 3, - WeaponType = "LaserCannon", - rgbColor = "0.5 0 1", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "allterrassaultshot.wav", - soundHit = "assaultshothit.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 2000, - customparams = { - damagetype = "eallterrassault", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[armored]] +supply = [[8]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- - +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrassault_up1.lua b/Units/eallterrain/eallterrassault_up1.lua new file mode 100644 index 000000000..60004af75 --- /dev/null +++ b/Units/eallterrain/eallterrassault_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrassault -- Anvil -- +-------------------------------------------------------------------------------- + +unitName = "eallterrassault_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Anvil Mark II]] + +objectName = "eallterrassault.s3o" +script = "eallterrassault.cob" + +tech = [[tech1]] +armortype = [[armored]] +supply = [[8]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrassault_up2.lua b/Units/eallterrain/eallterrassault_up2.lua new file mode 100644 index 000000000..002e3ef1b --- /dev/null +++ b/Units/eallterrain/eallterrassault_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrassault -- Anvil -- +-------------------------------------------------------------------------------- + +unitName = "eallterrassault_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Anvil Mark III]] + +objectName = "eallterrassault.s3o" +script = "eallterrassault.cob" + +tech = [[tech1]] +armortype = [[armored]] +supply = [[8]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrassault_up3.lua b/Units/eallterrain/eallterrassault_up3.lua new file mode 100644 index 000000000..6730e15ca --- /dev/null +++ b/Units/eallterrain/eallterrassault_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrassault -- Anvil -- +-------------------------------------------------------------------------------- + +unitName = "eallterrassault_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Anvil Mark IV]] + +objectName = "eallterrassault.s3o" +script = "eallterrassault.cob" + +tech = [[tech1]] +armortype = [[armored]] +supply = [[8]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrassault_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrengineer.lua b/Units/eallterrain/eallterrengineer.lua deleted file mode 100644 index 1d1a4e22b..000000000 --- a/Units/eallterrain/eallterrengineer.lua +++ /dev/null @@ -1,158 +0,0 @@ --- UNITDEF -- EALLTERRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eallterrengineer" - --------------------------------------------------------------------------------- - -local armortype = [[light]] -local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 45, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Unit Type: Engineer -Armortype: ]] .. armortype .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 3, - footprintZ = 3, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 600, - maxSlope = 180, - maxVelocity = 3, - maxReverseVelocity = 1, - turninplacespeedlimit = 3, - maxWaterDepth = 10, - metalmake = 0, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "ALLTERRTANK3", - moveState = "2", - name = "The Architect", - objectName = "eallterrengineer.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = "0", - 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 = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - "ecommander", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - dronespawner = "1", - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/con_legonormal.png", - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrheavy.lua b/Units/eallterrain/eallterrheavy.lua index b3a691678..b0a8b1876 100644 --- a/Units/eallterrain/eallterrheavy.lua +++ b/Units/eallterrain/eallterrheavy.lua @@ -1,201 +1,26 @@ --- UNITDEF -- EALLTERRHEAVY -- +-- UNITDEF -- eallterrheavy -- Sledge -- -------------------------------------------------------------------------------- -local unitName = "eallterrheavy" +unitName = "eallterrheavy" -------------------------------------------------------------------------------- -local power = [[18 power]] -local armortype = [[armored]] -local supply = [[6]] +isUpgraded = [[0]] -local weapon1Damage = 100 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Sledge]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterrheavy2.s3o" +script = "eallterrheavy.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 64, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description =[[Unit Type: Armored Tank Destroyer -Armortype: ]] ..armortype.. [[ - -100 Damage vs Light/Armored -50 Damage vs Buildings - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericGreen", - firestandorders = "1", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 545, - maxVelocity = 2.8, - turninplacespeedlimit = 2.8, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK4", - name = "Sledge", - noChaseCategory = "VTOL", - objectName = "eallterrheavy2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericGreen", - shootme = "1", - sightDistance = 650, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrheavy", - unitnumber = "110", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavytankweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - heavytankweapon = { - - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - -- cegTag = "mediumcannonweapon3", - duration = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium-green", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 700, - reloadtime = 1, - WeaponType = "LaserCannon", - rgbColor = "0 1 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "allterrheavyshot.wav", - soundHit = "mediumcannonhit.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eallterrheavy", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech2]] +armortype = [[armored]] +supply = [[6]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- - +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrheavy_up1.lua b/Units/eallterrain/eallterrheavy_up1.lua new file mode 100644 index 000000000..4ac9e5464 --- /dev/null +++ b/Units/eallterrain/eallterrheavy_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrheavy -- Sledge -- +-------------------------------------------------------------------------------- + +unitName = "eallterrheavy_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Sledge Mark II]] + +objectName = "eallterrheavy2.s3o" +script = "eallterrheavy.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrheavy_up2.lua b/Units/eallterrain/eallterrheavy_up2.lua new file mode 100644 index 000000000..8a471eb28 --- /dev/null +++ b/Units/eallterrain/eallterrheavy_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrheavy -- Sledge -- +-------------------------------------------------------------------------------- + +unitName = "eallterrheavy_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Sledge Mark III]] + +objectName = "eallterrheavy2.s3o" +script = "eallterrheavy.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrheavy_up3.lua b/Units/eallterrain/eallterrheavy_up3.lua new file mode 100644 index 000000000..3e10421f5 --- /dev/null +++ b/Units/eallterrain/eallterrheavy_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrheavy -- Sledge -- +-------------------------------------------------------------------------------- + +unitName = "eallterrheavy_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Sledge Mark IV]] + +objectName = "eallterrheavy2.s3o" +script = "eallterrheavy.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrheavy_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrlight.lua b/Units/eallterrain/eallterrlight.lua index eb765590b..f7ec6a305 100644 --- a/Units/eallterrain/eallterrlight.lua +++ b/Units/eallterrain/eallterrlight.lua @@ -1,193 +1,26 @@ --- UNITDEF -- EALLTERRLIGHT -- +-- UNITDEF -- eallterrlight -- Recluse -- -------------------------------------------------------------------------------- -local unitName = "eallterrlight" +unitName = "eallterrlight" -------------------------------------------------------------------------------- -local power = [[4 power]] -local armortype = [[light]] -local supply = [[2]] +isUpgraded = [[0]] -local weapon1Damage = 50 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Recluse]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterrlight2.s3o" +script = "eallterrlight.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 22, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Unit Type: Raider -Armortype: ]] ..armortype.. [[ - -50 Damage vs Light -25 Damage vs Armored/Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGeneric", - firestandorders = "1", - footprintX = 4, - footprintZ = 4, - iconType = "allterrraider", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 245, - maxVelocity = 5.5, - maxReverseVelocity = 2, - turninplacespeedlimit = 5.5, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK4", - name = "Recluse", - noChaseCategory = "VTOL", - objectName = "eallterrlight2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGeneric", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrlight", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:factorysparks", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "lighttankweapon", - badTargetCategory = "BUILDING ARMORED WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - lighttankweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.3, - duration = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-small-blue", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 350, - reloadtime = 0.5, - WeaponType = "LaserCannon", - rgbColor = "0.5 0.8 1", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "heavycannonGD.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 6, - tolerance = 1000, - turret = true, - weaponVelocity = 2000, - customparams = { - damagetype = "eallterrlight", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[2]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrlight_up1.lua b/Units/eallterrain/eallterrlight_up1.lua new file mode 100644 index 000000000..1df1aefc4 --- /dev/null +++ b/Units/eallterrain/eallterrlight_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrlight -- Recluse -- +-------------------------------------------------------------------------------- + +unitName = "eallterrlight_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Recluse Mark II]] + +objectName = "eallterrlight2.s3o" +script = "eallterrlight.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrlight_up2.lua b/Units/eallterrain/eallterrlight_up2.lua new file mode 100644 index 000000000..d07e6e2cd --- /dev/null +++ b/Units/eallterrain/eallterrlight_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrlight -- Recluse -- +-------------------------------------------------------------------------------- + +unitName = "eallterrlight_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Recluse Mark III]] + +objectName = "eallterrlight2.s3o" +script = "eallterrlight.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrlight_up3.lua b/Units/eallterrain/eallterrlight_up3.lua new file mode 100644 index 000000000..3db5ad6a1 --- /dev/null +++ b/Units/eallterrain/eallterrlight_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrlight -- Recluse -- +-------------------------------------------------------------------------------- + +unitName = "eallterrlight_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Recluse Mark IV]] + +objectName = "eallterrlight2.s3o" +script = "eallterrlight.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[2]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrlight_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrmed.lua b/Units/eallterrain/eallterrmed.lua index ff0a3e04d..fd50fc005 100644 --- a/Units/eallterrain/eallterrmed.lua +++ b/Units/eallterrain/eallterrmed.lua @@ -1,200 +1,26 @@ --- UNITDEF -- EALLTERRMED -- +-- UNITDEF -- eallterrmed -- Basher -- -------------------------------------------------------------------------------- -local unitName = "eallterrmed" +unitName = "eallterrmed" -------------------------------------------------------------------------------- -local power = [[16 power]] -local armortype = [[light]] -local supply = [[4]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Basher]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterrmed2.s3o" +script = "eallterrmed.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 44, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SKIRMISHER", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Unit Type: Light Tank Destroyer -Armortype: ]] ..armortype.. [[ - -200 Damage vs Armored -80 Damage vs Light/Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 500, - maxSlope = 180, - maxVelocity = 3.5, - maxReverseVelocity = 1, - turninplacespeedlimit = 4, - maxWaterDepth = 10, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "ALLTERRTANK4", - name = "Basher", - noChaseCategory = "VTOL", - objectName = "eallterrmed2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericPurple", - sightDistance = 600, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrmed", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "mediumtankcannon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING LIGHT WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - mediumtankcannon = { - - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - -- cegTag = "mediumcannonweapon3", - duration = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 600, - reloadtime = 1, - WeaponType = "LaserCannon", - rgbColor = "1 0.5 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "medallterrweapon.wav", - soundHit = "mediumcannonhit.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eallterrmed", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - -} -unitDef.weaponDefs = weaponDefs +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrmed_up1.lua b/Units/eallterrain/eallterrmed_up1.lua new file mode 100644 index 000000000..4e79640c1 --- /dev/null +++ b/Units/eallterrain/eallterrmed_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrmed -- Basher -- +-------------------------------------------------------------------------------- + +unitName = "eallterrmed_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Basher Mark II]] + +objectName = "eallterrmed2.s3o" +script = "eallterrmed.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrmed_up2.lua b/Units/eallterrain/eallterrmed_up2.lua new file mode 100644 index 000000000..9aba14501 --- /dev/null +++ b/Units/eallterrain/eallterrmed_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrmed -- Basher -- +-------------------------------------------------------------------------------- + +unitName = "eallterrmed_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Basher Mark III]] + +objectName = "eallterrmed2.s3o" +script = "eallterrmed.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrmed_up3.lua b/Units/eallterrain/eallterrmed_up3.lua new file mode 100644 index 000000000..d2830e8b0 --- /dev/null +++ b/Units/eallterrain/eallterrmed_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrmed -- Basher -- +-------------------------------------------------------------------------------- + +unitName = "eallterrmed_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Basher Mark IV]] + +objectName = "eallterrmed2.s3o" +script = "eallterrmed.cob" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrmed_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrriot.lua b/Units/eallterrain/eallterrriot.lua index 29e6d2556..d1781e159 100644 --- a/Units/eallterrain/eallterrriot.lua +++ b/Units/eallterrain/eallterrriot.lua @@ -1,251 +1,26 @@ --- UNITDEF -- EALLTERRRIOT -- +-- UNITDEF -- eallterrriot -- Mossberg -- -------------------------------------------------------------------------------- -local unitName = "eallterrriot" +unitName = "eallterrriot" -------------------------------------------------------------------------------- -local power = [[6 power]] -local armortype = [[light]] -local supply = [[3]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local weapon2Damage = 75 -local weapon2AOE = 100 -local weapon2Projectiles = 10 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) * weapon2Projectiles +humanName = [[Mossberg]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 27, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - -- canDgun = true, - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR RIOT", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Unit Type: Anti-Swarm EMP/Riot Tank -Armortype: ]] ..armortype.. [[ - -200 Paralysis Damage vs Light -100 Paralysis Damage vs Armored/Building - - • Paralyzes enemy units - • Projectile can hit multiple units - -Alternate fire mode fires 10 projectiles in a shotgun spread with a small area of effect. Reduced damage vs buildings when in shotgun mode. - -Energy cost to fire EMP: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Shotgun: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericRed", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 400, - maxSlope = 180, - maxVelocity = 3.5, - maxReverseVelocity = 1, - turninplacespeedlimit = 3.3, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK4", - name = "Mossberg", - noChaseCategory = "VTOL", - objectName = "eallterrriot2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericRed", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrriot", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "riottankempweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL", - }, - [2] = { - def = "riottankshotgun", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL BUILDING", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - riottankempweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.05, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - 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 = "fnubeamfire.wav", - soundHit = "phasegun1hit.wav", - texture1 = "wave", - texture2 = "empty", - thickness = 40, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eallterrriot", - nofriendlyfire = 1, - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - riottankshotgun = { - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "bruisercannon", - explosionGenerator = "custom:genericshellexplosion-small", - energypershot = energycosttofire2, - interceptedByShieldType = 4, - impulseFactor = 0, - name = "Light Cannon", - projectiles = weapon2Projectiles, - range = 450, - reloadtime = 5, - weaponType = "Cannon", - soundHit = "mediumcannonhit.wav", - soundStart = "bruisercannon.wav", - sprayangle = 2000, - - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "eallterrriotshotgun", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file 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/eallterrriot_up1.lua b/Units/eallterrain/eallterrriot_up1.lua new file mode 100644 index 000000000..0ca78d512 --- /dev/null +++ b/Units/eallterrain/eallterrriot_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Mossberg Mark II]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrriot_up2.lua b/Units/eallterrain/eallterrriot_up2.lua new file mode 100644 index 000000000..4c126c90c --- /dev/null +++ b/Units/eallterrain/eallterrriot_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Mossberg Mark III]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrriot_up3.lua b/Units/eallterrain/eallterrriot_up3.lua new file mode 100644 index 000000000..3ab790167 --- /dev/null +++ b/Units/eallterrain/eallterrriot_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrriot -- Mossberg -- +-------------------------------------------------------------------------------- + +unitName = "eallterrriot_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Mossberg Mark IV]] + +objectName = "eallterrriot2.s3o" +script = "eallterrriot.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrriot_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrshield.lua b/Units/eallterrain/eallterrshield.lua index d4d474f21..a278643a6 100644 --- a/Units/eallterrain/eallterrshield.lua +++ b/Units/eallterrain/eallterrshield.lua @@ -1,174 +1,26 @@ --- UNITDEF -- EALLTERRSHIELD -- +-- UNITDEF -- eallterrshield -- Widow -- -------------------------------------------------------------------------------- -local unitName = "eallterrshield" +unitName = "eallterrshield" -------------------------------------------------------------------------------- -local power = [[10 power]] -local armortype = [[light]] -local supply = [[5]] +isUpgraded = [[0]] -local shield1Power = 1500 -local shield1PowerRegen = 15 -local shield1PowerRegenEnergy = shield1PowerRegen / 10 +humanName = [[Widow]] +objectName = "eallterrshield.s3o" +script = "eallterrshield.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 1, - buildCostEnergy = 0, - buildCostMetal = 28, - builder = false, - buildTime = 5, - canAttack = false, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - cloakCostMoving = 2, - minCloakDistance = 150, - decloakOnFire = false, - decloakSpherical = true, - initCloaked = true, - -- Starting out cloaked will dramatically increase the initial cost, however, it is much more convenient from a micromanagement standpoint. - -- End Cloaking - - description = [[Unit Type: Shield Emitter -Armortype: ]] ..armortype.. [[ - -Shield recharges at a rate of ]] .. shield1PowerRegen .. [[hp/s -Energy cost for regeneration: ]] .. shield1PowerRegenEnergy .. [[/s -Maximum shield power is ]] .. shield1Power ..[[hp -Shield can link with other shield units to increase charging and capacity -Generates a Cloaking Field - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "hugeExplosionGenericPurple", - fireState = "0", - footprintX = 5, - footprintZ = 5, - iconType = "support", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 500, - maxVelocity = 3.5, - maxReverseVelocity = 2, - turninplacespeedlimit = 4, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "ALLTERRTANK5", - moveState = "0", - name = "Widow", - noChaseCategory = "VTOL", - objectName = "eallterrshield.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "hugeExplosionGenericPurple", - sightDistance = 800, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - turnInPlace = true, - turnRate = 5000, - unitname = "eallterrshield", - upright = false, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "allterrshield", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - allterrshield = { - - Smartshield = true, - Exteriorshield = true, - Visibleshield = true, - Visibleshieldrepulse = true, - ShieldStartingPower = 0, - Shieldenergyuse = 0, - Shieldradius = 300, - Shieldpower = shield1Power, - Shieldpowerregen = shield1PowerRegen, - Shieldpowerregenenergy = shield1PowerRegenEnergy, - Shieldintercepttype = 4, - Shieldgoodcolor = "0.0 0.2 1.0", - Shieldbadcolor = "1.0 0 0", - Shieldalpha = 0.3, - - texture1 = "shield4", - - visibleShieldHitFrames = 50, - weaponType = [[Shield]], - damage = { - default = 1, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[5]] +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/eallterrshield_up2.lua b/Units/eallterrain/eallterrshield_up2.lua new file mode 100644 index 000000000..41bce9040 --- /dev/null +++ b/Units/eallterrain/eallterrshield_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrshield -- Widow -- +-------------------------------------------------------------------------------- + +unitName = "eallterrshield_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Widow Mark III]] + +objectName = "eallterrshield.s3o" +script = "eallterrshield.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eallterrshield_up3.lua b/Units/eallterrain/eallterrshield_up3.lua new file mode 100644 index 000000000..e12c85c7c --- /dev/null +++ b/Units/eallterrain/eallterrshield_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrshield -- Widow -- +-------------------------------------------------------------------------------- + +unitName = "eallterrshield_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Widow Mark IV]] + +objectName = "eallterrshield.s3o" +script = "eallterrshield.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eallterrain/ealltershield_up1.lua b/Units/eallterrain/ealltershield_up1.lua new file mode 100644 index 000000000..3d6b3f8f5 --- /dev/null +++ b/Units/eallterrain/ealltershield_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eallterrshield -- Widow -- +-------------------------------------------------------------------------------- + +unitName = "eallterrshield_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Widow Mark II]] + +objectName = "eallterrshield.s3o" +script = "eallterrshield.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("Units-Configs-Basedefs/basedefs/allterrain/eallterrshield_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eminifac.lua b/Units/eallterrain/eminifac.lua index 2ae00a1e0..a5fa7397e 100644 --- a/Units/eallterrain/eminifac.lua +++ b/Units/eallterrain/eminifac.lua @@ -1,126 +1,21 @@ -- UNITDEF -- EMINIFAC -- -------------------------------------------------------------------------------- -local unitName = "eminifac" +unitName = "eminifac" -------------------------------------------------------------------------------- -local armortype = [[building]] +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 -local unitDef = { +humanName = [[All-Terrain Strider Factory]] - activatewhenbuilt = false, - buildAngle = 1024, - buildCostEnergy = 0, - buildCostMetal = 60, - builder = true, - buildTime = 5, - canBeAssisted = true, - canGuard = true, - canMove = true, - canPatrol = true, - canReclaim = false, - canstop = true, - category = "BUILDING NOTAIR", +objectName = "eallterrfac2.s3o" +script = "eallterrfac2.cob" - collisionVolumeOffsets = "0 60 0", - collisionVolumeScales = "298 142 168", - collisionVolumeTest = 1, - collisionVolumeType = "box", - - corpse = "ammobox", - - -- Cloaking - - cancloak = true, - cloakCost = 1, - minCloakDistance = 250, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = false, - - -- End Cloaking - - description = [[Place generators near this factory to unlock higher tier units -Armortype: ]] ..armortype, - energyStorage = 0, - energyUse = 0, - energyMake = 0, - explodeAs = "MEXPOP2", - footprintX = 22, - footprintZ = 22, - iconType = "factory", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 1500, - maxSlope = 90, - maxWaterDepth = 0, - metalStorage = 0, - metalMake = 0, - name = "All-Terrain Factory", - objectName = "eallterrfac2.s3o", - script = "eallterrfac2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - showNanoSpray = "0", - sightDistance = 388, - smoothAnim = true, - TEDClass = "PLANT", - unitname = "eminifac", - -- unitRestricted = 1, - workerTime = 1, - yardMap = "oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo oooooooccccccccooooooo", - -- usePieceCollisionVolumes = true, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:nano", - "custom:blacksmoke", - "custom:fusionreactionbasic", - }, - }, - buildoptions = { - "eallterrengineer", --new - "eallterrlight", - "eallterrriot", --- "eallterraa", - "eallterrmed", - "eallterrheavy", - "eallterrassault", - "eallterranarchid", - "eallterrshield", - "ecommander", - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdfactoryselect", - }, - }, - customParams = { - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - -- ProvideTech = "1 Powergrid", - -- ProvideTechRange = "1500", - -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", - -- groundtexselectxsize = 1500, -- optional - -- groundtexselectzsize = 1500, -- optional - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 27, - BuildingGroundDecalSizeY = 27, - BuildingGroundDecalDecaySpeed = 0.9, -} +AllTerrainFactoryBuildList = Shared.buildListAllTerrainFactory +VFS.Include("units-configs-basedefs/basedefs/allterrain/eminifac_basedef.lua") -------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eminifac_up1.lua b/Units/eallterrain/eminifac_up1.lua new file mode 100644 index 000000000..cd7d9a60b --- /dev/null +++ b/Units/eallterrain/eminifac_up1.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EMINIFAC -- +-------------------------------------------------------------------------------- + +unitName = "eminifac_up1" + +-------------------------------------------------------------------------------- + +buildCostMetal = 270 +maxDamage = buildCostMetal * 12.5 + +humanName = [[All-Terrain Strider Factory Mark II]] + +objectName = "eallterrfac2.s3o" +script = "eallterrfac2.cob" + +AllTerrainFactoryBuildList = Shared.buildListAllTerrainFactory_up1 + +VFS.Include("units-configs-basedefs/basedefs/allterrain/eminifac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eminifac_up2.lua b/Units/eallterrain/eminifac_up2.lua new file mode 100644 index 000000000..79d25b5b8 --- /dev/null +++ b/Units/eallterrain/eminifac_up2.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EMINIFAC -- +-------------------------------------------------------------------------------- + +unitName = "eminifac_up2" + +-------------------------------------------------------------------------------- + +buildCostMetal = 510 +maxDamage = buildCostMetal * 12.5 + +humanName = [[All-Terrain Strider Factory Mk III]] + +objectName = "eallterrfac2.s3o" +script = "eallterrfac2.cob" + +AllTerrainFactoryBuildList = Shared.buildListAllTerrainFactory_up2 + +VFS.Include("units-configs-basedefs/basedefs/allterrain/eminifac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eallterrain/eminifac_up3.lua b/Units/eallterrain/eminifac_up3.lua new file mode 100644 index 000000000..541ad0a58 --- /dev/null +++ b/Units/eallterrain/eminifac_up3.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EMINIFAC -- +-------------------------------------------------------------------------------- + +unitName = "eminifac_up3" + +-------------------------------------------------------------------------------- + +buildCostMetal = 750 +maxDamage = buildCostMetal * 12.5 + +humanName = [[All-Terrain Strider Factory Mark IV]] + +objectName = "eallterrfac2.s3o" +script = "eallterrfac2.cob" + +AllTerrainFactoryBuildList = Shared.buildListAllTerrainFactory_up3 + +VFS.Include("units-configs-basedefs/basedefs/allterrain/eminifac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibaa.lua b/Units/eamphib/eamphibaa.lua deleted file mode 100644 index 341718b2e..000000000 --- a/Units/eamphib/eamphibaa.lua +++ /dev/null @@ -1,241 +0,0 @@ --- UNITDEF -- eamphibaa -- --------------------------------------------------------------------------------- - -local unitName = "eamphibaa" - --------------------------------------------------------------------------------- - -local power = [[4 power]] -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, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB RAID", - corpse = "ammobox", - 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 +]] .. power .. [[ -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 = "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 = power, - armortype = "light", - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- 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 = "plasma2.wav", - -- soundHit = "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 = "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 05fa754da..ab453151a 100644 --- a/Units/eamphib/eamphibarty.lua +++ b/Units/eamphib/eamphibarty.lua @@ -1,192 +1,24 @@ -- UNITDEF -- EAMPHIBARTY -- -------------------------------------------------------------------------------- -local unitName = "eamphibarty" +unitName = "eamphibarty" -------------------------------------------------------------------------------- -local power = [[10 power]] -local armortype = [[light]] -local supply = [[5]] +isUpgraded = [[0]] -local weapon1Damage = 100 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Assimilator]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibarty2.s3o" +script = "eamphibarty2.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 36, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB SUPPORT", - corpse = "ammobox", - description = [["Unit Type: Laser Support Artillery -Armortype: ]] ..armortype.. [[ - -100 Damage vs Buildings -50 Damage vs Light/Armored - -Can fire while underwater - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericBlue", - footprintX = 4, - footprintZ = 4, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 300, - maxSlope = 28, - maxVelocity = 3, - maxReverseVelocity = 1, - minWaterDepth = 10, - metalStorage = 0, - movementClass = "TANK4", - name = "Assimilator", - objectName = "eamphibarty2.s3o", - script = "eamphibarty2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericBlue", - sightDistance = 950, - --SonarDistance = 950, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 3.0, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 300, - unitname = "eamphibarty", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:factorysparks", - "custom:dirt", - "custom:blacksmoke", - }, -}, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "assimilatorbeamweapon", - }, - --[[ - [2] = { - def = "TORP", - }, - ]]-- - }, - customParams = { - canbetransported = "true", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { -assimilatorbeamweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - beamTime = 1.8, - collideFeature = false, - collideFriendly = false, - rgbColor = "0 0 0.5", - rgbColor2 = "0.5 0.5 0.5", - coreThickness = 0.5, - duration = 0.4, - explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", - energypershot = energycosttofire, - fallOffRate = 0.1, - fireStarter = 50, - interceptedByShieldType = 4, - largeBeamLaser = true, - laserflaresize = 5, - - leadlimit = 20, - minintensity = 1, - name = "Laser", - range = 950, - reloadtime = 2, - WeaponType = "BeamLaser", - soundHit = "amphibartyshothit.wav", - soundStart = "laserbeam02.wav", - soundTrigger = true, - texture1 = "lightning", - texture2 = "laserend", - thickness = 20, - tolerance = 500, - turret = true, - weaponVelocity = 1500, - waterweapon = true, - customparams = { - damagetype = "eamphibarty", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, -}, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[5]] +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibarty_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/eamphib/eamphibarty_up1.lua b/Units/eamphib/eamphibarty_up1.lua new file mode 100644 index 000000000..8ee73cc6f --- /dev/null +++ b/Units/eamphib/eamphibarty_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBARTY_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibarty_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Assimilator Mark II]] + +objectName = "eamphibarty2.s3o" +script = "eamphibarty2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibarty_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibarty_up2.lua b/Units/eamphib/eamphibarty_up2.lua new file mode 100644 index 000000000..4aea4dae7 --- /dev/null +++ b/Units/eamphib/eamphibarty_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBARTY_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibarty_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Assimilator Mark III]] + +objectName = "eamphibarty2.s3o" +script = "eamphibarty2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibarty_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibarty_up3.lua b/Units/eamphib/eamphibarty_up3.lua new file mode 100644 index 000000000..2bf6e47d2 --- /dev/null +++ b/Units/eamphib/eamphibarty_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBARTY_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibarty_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Assimilator Mark IV]] + +objectName = "eamphibarty2.s3o" +script = "eamphibarty2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibarty_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibbuggy.lua b/Units/eamphib/eamphibbuggy.lua index 59bc7b1dd..b8d94a86d 100644 --- a/Units/eamphib/eamphibbuggy.lua +++ b/Units/eamphib/eamphibbuggy.lua @@ -1,197 +1,24 @@ -- UNITDEF -- EAMPHIBBUGGY -- -------------------------------------------------------------------------------- -local unitName = "eamphibbuggy" +unitName = "eamphibbuggy" -------------------------------------------------------------------------------- -local power = [[2 power]] -local armortype = [[light]] -local supply = [[1]] +isUpgraded = [[0]] -local weapon1Damage = 13.5 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Snake]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibbuggy2.s3o" +script = "eamphibbuggy_lus.lua" -local unitDef = { +tech = [[tech1]] +armortype = [[light]] +supply = [[1]] - --mobileunit - transportbyenemy = false; +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibbuggy_basedef.lua") - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 18, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB RAID", - corpse = "ammobox", - description = [[Unit Type: Raider -Armortype: ]] ..armortype.. [[ - -135 Damage/s vs Light/Building -80 Damages/s vs Armored - -Can fire while underwater - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire * 10) .. [[/s - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGenericRed", - footprintX = 2, - footprintZ = 2, - iconType = "raider", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 120, - maxSlope = 28, - maxVelocity = 6.0, - maxReverseVelocity = 2, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK2", - name = "Snake", - noChaseCategory = "VTOL", - objectName = "eamphibbuggy2.s3o", - script = "eamphibbuggy_lus.lua", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGenericRed", - sightDistance = 500, --- SonarDistance = 500, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 6.0, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 475, - unitname = "eamphibbuggy", - workerTime = 0, - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:factorysparks", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "lightbeamlaser", - badTargetCategory = "ARMORED BUILDING WALL", - }, - --[[ - [2] = { - def = "TORP", - }, - ]]-- - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = "1 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 1, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - lightbeamlaser = { - - TargetMoveError = 0.3, - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - coreThickness = 0.2, - duration = 0.1, - explosionGenerator = "custom:genericshellexplosion-small-sparks-burn", - energypershot = energycosttofire, - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - impulsefactor = 0.1, - - laserflaresize = 5, - largebeamlaser = true, - leadlimit = 10, - minintensity = 1, - name = "Laser", - range = 300, - reloadtime = 0.1, - WeaponType = "BeamLaser", - rgbColor = "0.5 0 0", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "amphibbuggytankshothit.wav", - -- soundHit = "amphibbuggytankshothit.wav", - scrollspeed = 5, - texture1 = "lightning", - texture2 = "laserend", - thickness = 5, - tolerance = 3000, - turret = true, - weaponVelocity = 1000, - waterweapon = true, - customparams = { - damagetype = "eamphibbuggy", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, -- multiply * 1.2 for correct dps output - }, - }, -} -unitDef.weaponDefs = weaponDefs +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/eamphib/eamphibbuggy_up1.lua b/Units/eamphib/eamphibbuggy_up1.lua new file mode 100644 index 000000000..38fdaf8e6 --- /dev/null +++ b/Units/eamphib/eamphibbuggy_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBBUGGY_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibbuggy_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Snake Mark II]] + +objectName = "eamphibbuggy2.s3o" +script = "eamphibbuggy_lus.lua" + +tech = [[tech0]] +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/eamphib/eamphibbuggy_up2.lua b/Units/eamphib/eamphibbuggy_up2.lua new file mode 100644 index 000000000..889f74b14 --- /dev/null +++ b/Units/eamphib/eamphibbuggy_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBBUGGY_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibbuggy_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Snake Mark III]] + +objectName = "eamphibbuggy2.s3o" +script = "eamphibbuggy_lus.lua" + +tech = [[tech0]] +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/eamphib/eamphibbuggy_up3.lua b/Units/eamphib/eamphibbuggy_up3.lua new file mode 100644 index 000000000..f238b1dac --- /dev/null +++ b/Units/eamphib/eamphibbuggy_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBBUGGY_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibbuggy_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Snake Mark IV]] + +objectName = "eamphibbuggy2.s3o" +script = "eamphibbuggy_lus.lua" + +tech = [[tech0]] +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/eamphib/eamphibengineer.lua b/Units/eamphib/eamphibengineer.lua deleted file mode 100644 index 23db07dbd..000000000 --- a/Units/eamphib/eamphibengineer.lua +++ /dev/null @@ -1,150 +0,0 @@ --- UNITDEF -- EAMPHIBENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "eamphibengineer" - --------------------------------------------------------------------------------- - -local armortype = [[light]] -local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = 35, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT AMPHIB SUPPORT", - description = [[Unit Type: Engineer -Armortype: ]] .. armortype .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 4, - footprintZ = 4, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 600, - 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 = "0", - side = "ARM", - sightDistance = 500, --- SonarDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 4, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 1020, - unitname = "eamphibengineer", - workerTime = 1, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.15625, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - buildoptions = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - "ecommander", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - dronespawner = "1", - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibfac.lua b/Units/eamphib/eamphibfac.lua index 4f98eb27e..99d0a99ee 100644 --- a/Units/eamphib/eamphibfac.lua +++ b/Units/eamphib/eamphibfac.lua @@ -1,114 +1,21 @@ -- UNITDEF -- EAMPHIBFAC -- -------------------------------------------------------------------------------- -local unitName = "eamphibfac" +unitName = "eamphibfac" -------------------------------------------------------------------------------- -local armortype = [[building]] +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 -local unitDef = { +humanName = [[Amphibious Tank Factory]] - activatewhenbuilt = false, - buildAngle = 1024, - buildCostEnergy = 0, - buildCostMetal = 60, - builder = true, - buildTime = 5, - canBeAssisted = true, - canGuard = true, - canMove = true, - canPatrol = true, - canReclaim = false, - canstop = true, - category = "BUILDING NOTAIR AMPHIB", - -- collisionVolumeOffsets = "0 20 0", - -- collisionVolumeScales = "238 92 128", - -- collisionVolumeTest = 1, - -- collisionVolumeType = "box", - corpse = "ammobox", - description = [[Place generators near this factory to unlock higher tier units -Armortype: ]] ..armortype, - energyStorage = 0, - energyUse = 0, - energyMake = 0, - explodeAs = "MEXPOP2", - footprintX = 16, - footprintZ = 16, - iconType = "factory", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 1500, - maxSlope = 25, - maxWaterDepth = 5000, - metalStorage = 0, - metalMake = 0, - name = "Amphibious Tank Factory", - objectName = "eamphibfac2.s3o", - script = "eamphibfac2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - showNanoSpray = "0", - side = "CORE", - sightDistance = 388, --- SonarDistance = 175, - smoothAnim = true, - TEDClass = "PLANT", - unitname = "eamphibfac", - -- unitRestricted = 1, - workerTime = 1, - yardMap = "ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo ccccccccoooooooo", - -- usePieceCollisionVolumes = true, +objectName = "eamphibfac2.s3o" +script = "eamphibfac2.cob" - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 18, - BuildingGroundDecalSizeY = 18, - BuildingGroundDecalDecaySpeed = 0.9, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:nano", - "custom:blacksmoke", - "custom:fusionreactionbasic", - }, - }, - buildoptions = { - "eamphibengineer", --new - "eamphibbuggy", --new - "eamphibriot", --new - "eamphibneedle", - "eamphibmedtank", --new - "eamphibrock", --new - "eamphibarty", --new - "eamphibleveler", --new - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdfactoryselect", - }, - }, - customParams = { - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - -- ProvideTech = "1 Powergrid", - -- ProvideTechRange = "1500", - -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", - -- groundtexselectxsize = 1500, -- optional - -- groundtexselectzsize = 1500, -- optional - }, -} +amphibFactoryBuildList = Shared.buildListAmphibFactory +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibfac_basedef.lua") -------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibfac_up1.lua b/Units/eamphib/eamphibfac_up1.lua new file mode 100644 index 000000000..571998876 --- /dev/null +++ b/Units/eamphib/eamphibfac_up1.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAMPHIBFAC_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibfac_up1" + +-------------------------------------------------------------------------------- + +buildCostMetal = 270 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Amphibious Tank Factory Mark II]] + +objectName = "eamphibfac2.s3o" +script = "eamphibfac2.cob" + +amphibFactoryBuildList = Shared.buildListAmphibFactory_up1 + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibfac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibfac_up2.lua b/Units/eamphib/eamphibfac_up2.lua new file mode 100644 index 000000000..0605b4331 --- /dev/null +++ b/Units/eamphib/eamphibfac_up2.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAMPHIBFAC_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibfac_up2" + +-------------------------------------------------------------------------------- + +buildCostMetal = 510 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Amphibious Tank Factory Mark III]] + +objectName = "eamphibfac2.s3o" +script = "eamphibfac2.cob" + +amphibFactoryBuildList = Shared.buildListAmphibFactory_up2 + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibfac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibfac_up3.lua b/Units/eamphib/eamphibfac_up3.lua new file mode 100644 index 000000000..a265a94eb --- /dev/null +++ b/Units/eamphib/eamphibfac_up3.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EAMPHIBFAC_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibfac_up3" + +-------------------------------------------------------------------------------- + +buildCostMetal = 750 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Amphibious Tank Factory Mark IV]] + +objectName = "eamphibfac2.s3o" +script = "eamphibfac2.cob" + +amphibFactoryBuildList = Shared.buildListAmphibFactory_up3 + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibfac_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibleveler.lua b/Units/eamphib/eamphibleveler.lua index f7dd4a177..b8659d237 100644 --- a/Units/eamphib/eamphibleveler.lua +++ b/Units/eamphib/eamphibleveler.lua @@ -1,236 +1,24 @@ -- UNITDEF -- eamphibleveler -- -------------------------------------------------------------------------------- -local unitName = "eamphibleveler" +unitName = "eamphibleveler" -------------------------------------------------------------------------------- -local power = [[31 power]] -local armortype = [[armored]] -local supply = [[10]] +isUpgraded = [[0]] -local weapon1Damage = 250 -local weapon1AOE = 8 -local weapon2Damage = 6 -local weapon2AOE = 8 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) +humanName = [[Leveler]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibleveler.s3o" +script = "eamphibleveler.cob" -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 250, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED AMPHIB SKIRMISHER", - corpse = "ammobox", - description = [[Unit Type: Endbringer Class Tank Destroyer -Armortype: ]] ..armortype.. [[ - -Main Cannon: -250 Damage vs Light/Armored -25 Damage vs Building - -Secondary Machinegun: -60 Damage/s vs Light/Armored -6 Damage/s vs Building - -This unit can only attack other mobile units! - -Energy cost to fire Main Cannon: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Secondary Machinegun: ]] .. roundToFirstDecimal(energycosttofire2 * 10) .. [[/s - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "krabblast", - footprintX = 6, - footprintZ = 6, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 1250, - maxSlope = 28, - maxVelocity = 4, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK6", - name = "Leveler", - noChaseCategory = "VTOL", - objectName = "eamphibleveler.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "krabblast", - side = "CORE", - sightDistance = 750, - stealth = false, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "eamphibleveler", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "tankkillerlaser", - onlyTargetCategory = "LIGHT ARMORED", - }, - [2] = { - def = "machinegun", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - tankkillerlaser = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - duration = 0.2, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 100, - interceptedByShieldType = 4, - impulseFactor = 0.1, - - minintensity = "1", - name = "Anti-Tank Laser", - range = 750, - reloadtime = 0.5, - WeaponType = "LaserCannon", - rgbColor = "0.2 0 0.5", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "tankdestroyermaingunfire.wav", - texture1 = "pulseshot2", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eamphibleveler", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - machinegun = { - accuracy = 300, - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - duration = 0.1, - energypershot = 0.6, - explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", - energypershot = energycosttofire2, - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Machine Gun", - range = 750, - reloadtime = 0.1, - WeaponType = "LaserCannon", - rgbColor = "1 0.5 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "tankdestroyerfire.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 5, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eamphibleveler", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +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/eamphib/eamphibleveler_up1.lua b/Units/eamphib/eamphibleveler_up1.lua new file mode 100644 index 000000000..108f54712 --- /dev/null +++ b/Units/eamphib/eamphibleveler_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibleveler_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibleveler_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Leveler Mark II]] + +objectName = "eamphibleveler.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/eamphib/eamphibleveler_up2.lua b/Units/eamphib/eamphibleveler_up2.lua new file mode 100644 index 000000000..4a37333c3 --- /dev/null +++ b/Units/eamphib/eamphibleveler_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibleveler_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibleveler_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Leveler Mark III]] + +objectName = "eamphibleveler.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/eamphib/eamphibleveler_up3.lua b/Units/eamphib/eamphibleveler_up3.lua new file mode 100644 index 000000000..ea71e1947 --- /dev/null +++ b/Units/eamphib/eamphibleveler_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibleveler_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibleveler_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Leveler Mark IV]] + +objectName = "eamphibleveler.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/eamphib/eamphibmedtank.lua b/Units/eamphib/eamphibmedtank.lua index a36963783..b37ffb6cd 100644 --- a/Units/eamphib/eamphibmedtank.lua +++ b/Units/eamphib/eamphibmedtank.lua @@ -1,198 +1,24 @@ -- UNITDEF -- EAMPHIBMEDTANK -- -------------------------------------------------------------------------------- -local unitName = "eamphibmedtank" +unitName = "eamphibmedtank" -------------------------------------------------------------------------------- -local power = [[14 power]] -local armortype = [[light]] -local supply = [[4]] +isUpgraded = [[0]] -local weapon1Damage = 12.5 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Razor]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibmedtank2.s3o" +script = "eamphibmedtank_lus.lua" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 53, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB SKIRMISHER", - corpse = "ammobox", - description = [[Unit Type: Tank Destroyer -Armortype: ]] ..armortype.. [[ - -125 Damage vs Light/Armored -70 Damage vs Building - -Can fire while underwater - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire * 10) .. [[/s - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 3, - footprintZ = 3, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 360, - maxSlope = 28, - maxVelocity = 4.5, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK3", - name = "Razor", - noChaseCategory = "VTOL", - objectName = "eamphibmedtank2.s3o", - script = "eamphibmedtank_lus.lua", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - side = "CORE", - sightDistance = 550, --- SonarDistance = 550, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 4.5, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - unitname = "eamphibmedtank", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:factorysparks", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "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 = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - medtankbeamlaser = { - - TargetMoveError = 0.3, - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.5, - duration = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - impulsefactor = 0.1, - - largebeamlaser = true, - laserflaresize = 5, - leadlimit = 15, - minintensity = 1, - name = "Laser", - range = 550, - reloadtime = 0.1, - WeaponType = "BeamLaser", - rgbColor = "0 0.5 0", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "amphibmedtankshothit.wav", - -- soundHit = "amphibmedtankshothit.wav", - scrollspeed = 5, - texture1 = "lightning", - texture2 = "laserend", - thickness = 4, - tolerance = 3000, - turret = true, - weaponVelocity = 1000, - waterweapon = true, - customparams = { - damagetype = "eamphibmedtank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, -- multiply * 1.2 for correct dps output - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibmedtank_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/eamphib/eamphibmedtank_up1.lua b/Units/eamphib/eamphibmedtank_up1.lua new file mode 100644 index 000000000..64d3dbfe7 --- /dev/null +++ b/Units/eamphib/eamphibmedtank_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBMEDTANK_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibmedtank_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Razor Mark II]] + +objectName = "eamphibmedtank2.s3o" +script = "eamphibmedtank_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibmedtank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibmedtank_up2.lua b/Units/eamphib/eamphibmedtank_up2.lua new file mode 100644 index 000000000..8e1887fc7 --- /dev/null +++ b/Units/eamphib/eamphibmedtank_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBMEDTANK_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibmedtank_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Razor Mark III]] + +objectName = "eamphibmedtank2.s3o" +script = "eamphibmedtank_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibmedtank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibmedtank_up3.lua b/Units/eamphib/eamphibmedtank_up3.lua new file mode 100644 index 000000000..dc5e11999 --- /dev/null +++ b/Units/eamphib/eamphibmedtank_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBMEDTANK_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibmedtank_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Razor Mark IV]] + +objectName = "eamphibmedtank2.s3o" +script = "eamphibmedtank_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibmedtank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibneedle.lua b/Units/eamphib/eamphibneedle.lua index 8395e316a..ed5ba5af0 100644 --- a/Units/eamphib/eamphibneedle.lua +++ b/Units/eamphib/eamphibneedle.lua @@ -1,237 +1,24 @@ -- UNITDEF -- eamphibneedle -- -------------------------------------------------------------------------------- -local unitName = "eamphibneedle" +unitName = "eamphibneedle" -------------------------------------------------------------------------------- -local power = [[8 power]] -local armortype = [[light]] -local supply = [[3]] +isUpgraded = [[0]] -local weapon1Damage = 20 -local weapon1AOE = 0 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Ikinz]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibaa.s3o" +script = "eamphibaa.cob" -local unitDef = { +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] - --mobileunit - transportbyenemy = false; +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibneedle_basedef.lua") - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 42, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB RAID", - corpse = "ammobox", - description = [[Unit Type: Tank Destroyer -Armortype: ]] ..armortype.. [[ - -200 Damage/s vs Light -100 Damages/s vs Armored/Building - -Can fire while underwater - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire * 10) .. [[/s - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericPurple", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 340, - maxSlope = 28, - maxVelocity = 4.9, - maxReverseVelocity = 2, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK4", - name = "Ikinz", - objectName = "eamphibaa.s3o", - script = "eamphibaa.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericPurple", - sightDistance = 400, --- SonarDistance = 400, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 6.0, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 475, - unitname = "eamphibneedle", - workerTime = 0, - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "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 = power, - armortype = "light", - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- 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 = 400, - reloadtime = 0.1, - WeaponType = "BeamLaser", - rgbColor = "0.25 0 0.6", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "plasma2.wav", - -- soundHit = "amphibmedtankshothit.wav", - scrollspeed = 5, - texture1 = "lightning", - texture2 = "laserend", - thickness = 10, - tolerance = 3000, - turret = true, - weaponVelocity = 1000, - waterweapon = true, - customparams = { - damagetype = "eamphibneedle", - - --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 = "tmediumtankfire.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 6, - tolerance = 1000, - turret = true, - weaponVelocity = 2500, - customparams = { - damagetype = "eamphibneedle", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/eamphib/eamphibneedle_up1.lua b/Units/eamphib/eamphibneedle_up1.lua new file mode 100644 index 000000000..480e99510 --- /dev/null +++ b/Units/eamphib/eamphibneedle_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibneedle_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibneedle_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Ikinz Mark II]] + +objectName = "eamphibaa.s3o" +script = "eamphibaa.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibneedle_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibneedle_up2.lua b/Units/eamphib/eamphibneedle_up2.lua new file mode 100644 index 000000000..5dd38201f --- /dev/null +++ b/Units/eamphib/eamphibneedle_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibneedle_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibneedle_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Ikinz Mark III]] + +objectName = "eamphibaa.s3o" +script = "eamphibaa.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibneedle_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibneedle_up3.lua b/Units/eamphib/eamphibneedle_up3.lua new file mode 100644 index 000000000..8cc4ec732 --- /dev/null +++ b/Units/eamphib/eamphibneedle_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- eamphibneedle_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibneedle_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Ikinz Mark IV]] + +objectName = "eamphibaa.s3o" +script = "eamphibaa.cob" + +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibneedle_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot.lua b/Units/eamphib/eamphibriot.lua index 91a14d2f4..de23002fb 100644 --- a/Units/eamphib/eamphibriot.lua +++ b/Units/eamphib/eamphibriot.lua @@ -1,240 +1,24 @@ -- UNITDEF -- EAMPHIBRIOT-- -------------------------------------------------------------------------------- -local unitName = "eamphibriot" +unitName = "eamphibriot" -------------------------------------------------------------------------------- -local power = [[6 power]] -local armortype = [[light]] -local supply = [[3]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local weapon2Damage = 75 -local weapon2AOE = 100 -local weapon2Projectiles = 10 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) * weapon2Projectiles +humanName = [[Dicer]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibriot2.s3o" +script = "eamphibriot.cob" -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 23, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - -- canDgun = true, - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB RIOT", - corpse = "ammobox", - description = [[Unit Type: Anti-Swarm EMP/Riot Tank -Armortype: ]] ..armortype.. [[ - -200 Paralysis Damage vs Light -100 Paralysis Damage vs Armored/Building - - • Paralyzes enemy units - • Projectile can hit multiple units - -Alternate fire mode fires 10 projectiles in a shotgun spread with a small area of effect. Reduced damage vs buildings when in shotgun mode. - -Energy cost to fire EMP: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Shotgun: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericWhite", - footprintX = 3, - footprintZ = 3, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 340, - maxSlope = 28, - maxVelocity = 4.4, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK3", - name = "Dicer", - noChaseCategory = "VTOL", - objectName = "eamphibriot2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericWhite", - side = "CORE", - sightDistance = 500, --- SonarDistance = 500, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 3.7, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - unitname = "eamphibriot", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "riottankempweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL", - }, - [2] = { - def = "riottankshotgun", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL BUILDING", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = "3 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 3, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - riottankempweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.05, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - 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 = "fnubeamfire.wav", - soundHit = "phasegun1hit.wav", - texture1 = "wave", - texture2 = "empty", - thickness = 40, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eamphibriot", - nofriendlyfire = 1, - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - riottankshotgun = { - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "bruisercannon", - explosionGenerator = "custom:genericshellexplosion-small", - energypershot = energycosttofire2, - interceptedByShieldType = 4, - impulseFactor = 0, - name = "Light Cannon", - projectiles = weapon2Projectiles, - range = 400, - reloadtime = 5, - weaponType = "Cannon", - soundHit = "mediumcannonhit.wav", - soundStart = "bruisercannon.wav", - sprayangle = 2000, - - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "eallterrriotshotgun", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibriot_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) 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/eamphibriot_up1.lua b/Units/eamphib/eamphibriot_up1.lua new file mode 100644 index 000000000..e1dab0d1e --- /dev/null +++ b/Units/eamphib/eamphibriot_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_up1-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot_up2.lua b/Units/eamphib/eamphibriot_up2.lua new file mode 100644 index 000000000..2b0b80021 --- /dev/null +++ b/Units/eamphib/eamphibriot_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_up2-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibriot_up3.lua b/Units/eamphib/eamphibriot_up3.lua new file mode 100644 index 000000000..3c969b198 --- /dev/null +++ b/Units/eamphib/eamphibriot_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBRIOT_up3-- +-------------------------------------------------------------------------------- + +unitName = "eamphibriot_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibrock.lua b/Units/eamphib/eamphibrock.lua index 544f9088a..59f06e86f 100644 --- a/Units/eamphib/eamphibrock.lua +++ b/Units/eamphib/eamphibrock.lua @@ -1,246 +1,26 @@ -- UNITDEF -- EAMPHIBROCK -- -------------------------------------------------------------------------------- -local unitName = "eamphibrock" +unitName = "eamphibrock" -------------------------------------------------------------------------------- -local power = [[12 power]] -local armortype = [[light]] -local supply = [[5]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 1 -local weapon2Damage = 200 -local weapon2AOE = 1 -local weapon2Burst = 5 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) * weapon2Burst +humanName = [[Spitter]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eamphibrock4.s3o" +script = "eamphibrock4.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 59, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT AMPHIB SUPPORT", - corpse = "ammobox", - description = [[Unit Type: Missile support tank -Armortype: ]] ..armortype.. [[ - -200 Damage vs Armored -100 Damage vs Light/Building - -Energy cost to fire Single Shot: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Salvo: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGeneric", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 320, - maxSlope = 28, - maxVelocity = 3.4, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "TANK4", - name = "Spitter", - noChaseCategory = "VTOL", - objectName = "eamphibrock4.s3o", - script = "eamphibrock4.cob", - onlytargetcategory2 = "VTOL", - onlytargetcategory3 = "VTOL", - onlytargetcategory4 = "VTOL", - onlytargetcategory5 = "VTOL", - onlytargetcategory6 = "VTOL", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGeneric", - side = "CORE", - sightDistance = 650, --- SonarDistance = 650, - stealth = true, - seismicSignature = 2, - sonarStealth = false, - smoothAnim = true, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 3.4, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - unitname = "eamphibrock", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:dirt", - "custom:blacksmoke", - "custom:jethtrail", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "antiarmorrockets", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING LIGHT WALL", - }, - [2] = { - def = "antiarmorrocketssalvo", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING LIGHT WALL", - }, - }, - customParams = { - canbetransported = "true", - canareaattack ="1", - needed_cover = 2, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - - antiarmorrockets = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cegTag = "missiletrailsmall", - explosionGenerator = "custom:genericshellexplosion-medium-red", - energypershot = energycosttofire, - fireStarter = 70, - tracks = true, - impulseFactor = 0, - interceptedByShieldType = 4, - model = "missilesmalllauncher.s3o", - name = "Rockets", - range = 700, - reloadtime = 1, - weaponType = "MissileLauncher", - smokeTrail = false, - soundStart = "rocket1.wav", - soundHit = "explode5.wav", - startVelocity = 250, - tolerance = 8000, - turnrate = 5000, - predictBoost = 0.5, - turret = true, - weaponAcceleration = 50, - flightTime = 5, - trajectoryHeight = 1.5, - weaponVelocity = 500, - customparams = { - damagetype = "eamphibrock", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - antiarmorrocketssalvo = { - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - burst = weapon2Burst, - burstrate = 0.1, - cegTag = "missiletrailsmall", - explosionGenerator = "custom:genericshellexplosion-medium-red", - energypershot = energycosttofire2, - fireStarter = 70, - tracks = true, - impulseFactor = 0, - interceptedByShieldType = 4, - model = "missilesmalllauncher.s3o", - name = "Rockets", - range = 700, - reloadtime = 5, - weaponType = "MissileLauncher", - smokeTrail = false, - soundStart = "rocket1.wav", - soundHit = "explode5.wav", - startVelocity = 250, - tolerance = 8000, - turnrate = 10000, - predictBoost = 0.5, - turret = true, - weaponAcceleration = 50, - flightTime = 5, - trajectoryHeight = 1.5, - sprayangle = 10000, - weaponVelocity = 500, - customparams = { - damagetype = "eamphibrock", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibrock_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- -return lowerkeys({ [unitName] = unitDef }) +return lowerkeys({ [unitName] = unitDef }) -------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibrock_up1.lua b/Units/eamphib/eamphibrock_up1.lua new file mode 100644 index 000000000..c388b3b8f --- /dev/null +++ b/Units/eamphib/eamphibrock_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBROCK_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibrock_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Spitter Mark II]] + +objectName = "eamphibrock4.s3o" +script = "eamphibrock4.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibrock_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibrock_up2.lua b/Units/eamphib/eamphibrock_up2.lua new file mode 100644 index 000000000..262af3edb --- /dev/null +++ b/Units/eamphib/eamphibrock_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBROCK_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibrock_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Spitter Mark III]] + +objectName = "eamphibrock4.s3o" +script = "eamphibrock4.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibrock_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/eamphibrock_up3.lua b/Units/eamphib/eamphibrock_up3.lua new file mode 100644 index 000000000..dd7f57b31 --- /dev/null +++ b/Units/eamphib/eamphibrock_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EAMPHIBROCK_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eamphibrock_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Spitter Mark IV]] + +objectName = "eamphibrock4.s3o" +script = "eamphibrock4.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[5]] + +VFS.Include("units-configs-basedefs/basedefs/amphib/eamphibrock_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/eamphib/esubmarine.lua b/Units/eamphib/esubmarine.lua deleted file mode 100644 index be384ecf5..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, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT SUB", - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "TORP", - OnlyTargetCategory = "AMPHIB SUB", - BadTargetCategory = "VTOL", - noChaseCategory = "VTOL", - }, - }, - - customParams = { - canbetransported = "true", - death_sounds = "generic", - armortype = "light", - normaltex = "unittextures/esubplanenormal.png", - }, - -} - - --------------------------------------------------------------------------------- - -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 = "subhit.wav", - soundStart = "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 new file mode 100644 index 000000000..03c3d4822 --- /dev/null +++ b/Units/ebox.lua @@ -0,0 +1,113 @@ +-- UNITDEF -- EBOX -- +-------------------------------------------------------------------------------- + +local unitName = "ebox" + +-------------------------------------------------------------------------------- + +local armortype = [[armored]] + +local techrequired = [[tech1]] + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 1, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 15, + buildDistance = 400, + builder = false, + buildTime = 5, + canAttack = false, + canCapture = false, + canGuard = true, + canHover = true, + canMove = true, + canPatrol = true, + canstop = "1", + category = "ARMORED NOTAIR", + description = [[Long Range Radar and Seismic Detection]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "largeExplosionGenericWhite", + footprintX = 2, + footprintZ = 2, + iconType = "box", + idleAutoHeal = .5, + idleTime = 2200, + leaveTracks = false, + maxDamage = 400, + maxSlope = 26, + maxVelocity = 4, + maxReverseVelocity = 4, + maxWaterDepth = 10, + metalStorage = 0, + movementClass = "HOVERTANK2", + name = "B.O.X.", + noChaseCategory = "VTOL", + objectName = "ebox_small.s3o", + script = "ebox_lus.lua", + radarDistance = 1250, + repairable = false, + selfDestructAs = "largeExplosionGenericWhite", + side = "CORE", + sightDistance = 750, + smoothAnim = true, + stealth = true, + seismicSignature = 2, + seismicDistance = 1250, + turnInPlace = true, + turnRate = 5000, + unitname = unitName, + upright = true, + workerTime = 2, + + sfxtypes = { + pieceExplosionGenerators = { + "deathceg3", + "deathceg4", + }, + explosiongenerators = { + "custom:emptydirt", + }, + }, + + sounds = { + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + customParams = { + RequireTech = techrequired, + unittype = "mobile", + canbetransported = "true", + armortype = armortype, + energycoredronespawner = true, + needed_cover = 1, + death_sounds = "generic", + nofriendlyfire = "1", + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + helptext = [[]], + retreatRangeDAI = 1250, + }, +} + +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ebuilding/eaaturret.lua b/Units/ebuilding/eaaturret.lua deleted file mode 100644 index 3377e5439..000000000 --- a/Units/ebuilding/eaaturret.lua +++ /dev/null @@ -1,148 +0,0 @@ --- UNITDEF -- EAATURRET -- --------------------------------------------------------------------------------- - -local unitName = "eaaturret" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local supply = [[2]] - -local weapon1Damage = 112.5 -local weapon1AOE = 300 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Anti-Air Flak Turret -Armortype: ]] ..armortype.. [[ - -112.5 Damage vs Armored -75 Damage vs Light/Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumBuildingExplosionGeneric", - floater = true, - footprintX = 5, - footprintZ = 5, - icontype = "defense", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 800, - maxSlope = 60, - maxWaterDepth = 99999999999, - metalStorage = 0, - name = "Copperhead", - noAutoFire = false, - objectName = "eaaturret2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumBuildingExplosionGeneric", - sightDistance = 1500, - smoothAnim = true, - unitname = "eaaturret", - yardMap = "ooooo ooooo ooooo ooooo ooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "antiairgunflak", - onlytargetcategory = "VTOL", - }, - }, - customParams = { - 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", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 7, - BuildingGroundDecalSizeY = 7, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - antiairgunflak = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cylinderTargeting = true, - burnblow = true, - explosionGenerator = "custom:xamelImpact", - energypershot = energycosttofire, - fireStarter = 80, - id = 1, - impulseFactor = 0, - interceptedByShieldType = 4, - name = "AA Cannon", - range = 1500, - reloadtime = 1, - weaponType = "Cannon", - soundHit = "flakhit", - soundStart = "flakgun_shoot.wav", - tolerance = 500, - turret = true, - canAttackGround = false, - weaponVelocity = 5000, - customparams = { - damagetype = "eaaturret", - nofriendlyfire = 1, - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/eartyturret.lua b/Units/ebuilding/eartyturret.lua index ea59c25a7..e79acafa2 100644 --- a/Units/ebuilding/eartyturret.lua +++ b/Units/ebuilding/eartyturret.lua @@ -1,152 +1,24 @@ -- UNITDEF -- EARTYTURRET -- -------------------------------------------------------------------------------- -local unitName = "eartyturret" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local supply = [[2]] - -local weapon1Damage = 200 -local weapon1AOE = 50 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Medium Range Artillery Turret -Armortype: ]] ..armortype.. [[ +unitName = [[eartyturret]] -200 Damage vs Buildings -50 Damage vs Light/Armored +isUpgraded = [[0]] -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ +humanName = [[Lobster]] +objectName = [[eartyturret.s3o]] +script = [[eartyturret.cob]] -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumBuildingExplosionGeneric", - floater = true, - footprintX = 5, - footprintZ = 5, - icontype = "defense", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 600, - maxSlope = 60, - maxWaterDepth = 99999999999, - metalStorage = 0, - name = "Lobber", - noAutoFire = false, - objectName = "eaaturret2.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumBuildingExplosionGeneric", - sightDistance = 800, - smoothAnim = true, - unitname = "eartyturret", - yardMap = "ooooo ooooo ooooo ooooo ooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, +tech = [[tech3]] +armortype = [[building]] - explosiongenerators = { - "custom:gdhcannon", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "artyweapon", - onlytargetcategory = "BUILDING", - }, - }, - customParams = { - 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", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 7, - BuildingGroundDecalSizeY = 7, - BuildingGroundDecalDecaySpeed = 0.9, -} +AreaOfEffect = 500 +VFS.Include("units-configs-basedefs/basedefs/buildings/eartyturret_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) -local weaponDefs = { - artyweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "artyshot2", - avoidNeutral = false, - explosionGenerator = "custom:genericshellexplosion-large", - energypershot = energycosttofire, - edgeEffectiveness = 1, - - impulseFactor = 0, - interceptedByShieldType = 4, - highTrajectory = 1, - name = "Plasma Cannon", - range = 800, - reloadtime = 4, - weaponType = "Cannon", - soundHit = "artyhit.wav", - soundStart = "arty2.wav", - - turret = true, - weaponVelocity = 500, - customparams = { - damagetype = "eartytank", +return lowerkeys({ [unitName] = unitDef }) - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eartyturret_up1.lua b/Units/ebuilding/eartyturret_up1.lua new file mode 100644 index 000000000..b44b819b8 --- /dev/null +++ b/Units/ebuilding/eartyturret_up1.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EARTYTURRET_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[eartyturret_up1]] + +isUpgraded = [[1]] + +humanName = [[Lobster MK II]] +objectName = [[eartyturret.s3o]] +script = [[eartyturret.cob]] + +tech = [[tech3]] +armortype = [[building]] + +AreaOfEffect = 200 + +VFS.Include("units-configs-basedefs/basedefs/buildings/eartyturret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eartyturret_up2.lua b/Units/ebuilding/eartyturret_up2.lua new file mode 100644 index 000000000..1ac8029c8 --- /dev/null +++ b/Units/ebuilding/eartyturret_up2.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EARTYTURRET_up2 -- +-------------------------------------------------------------------------------- + +unitName = [[eartyturret_up2]] + +isUpgraded = [[2]] + +humanName = [[Lobster MK III]] +objectName = [[eartyturret.s3o]] +script = [[eartyturret.cob]] + +tech = [[tech3]] +armortype = [[building]] + +AreaOfEffect = 400 + +VFS.Include("units-configs-basedefs/basedefs/buildings/eartyturret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/eartyturret_up3.lua b/Units/ebuilding/eartyturret_up3.lua new file mode 100644 index 000000000..ab5044e34 --- /dev/null +++ b/Units/ebuilding/eartyturret_up3.lua @@ -0,0 +1,24 @@ +-- UNITDEF -- EARTYTURRET_up3 -- +-------------------------------------------------------------------------------- + +unitName = [[eartyturret_up3]] + +isUpgraded = [[3]] + +humanName = [[Lobster MK IV]] +objectName = [[eartyturret.s3o]] +script = [[eartyturret.cob]] + +tech = [[tech3]] +armortype = [[building]] + +AreaOfEffect = 600 + +VFS.Include("units-configs-basedefs/basedefs/buildings/eartyturret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/ebarricade.lua b/Units/ebuilding/ebarricade.lua deleted file mode 100644 index f45569df8..000000000 --- a/Units/ebuilding/ebarricade.lua +++ /dev/null @@ -1,89 +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 = "unitsunderattack1", - select = { - "turretselect", - }, - }, - customParams = { - 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 15582d89a..000000000 --- a/Units/ebuilding/ecruisesilo.lua +++ /dev/null @@ -1,166 +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", - - corpse = "ammobox", - 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 = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "cruisemissile", - }, - }, - customParams = { - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - helptext = [[]], - }, - 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 = "explode4.wav", - soundStart = "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 c0071535b..9652d7e8d 100644 --- a/Units/ebuilding/efusion2.lua +++ b/Units/ebuilding/efusion2.lua @@ -6,40 +6,36 @@ local unitName = "efusion2" -------------------------------------------------------------------------------- local armortype = [[building]] -local energyproduced = [[10]] -local powerprovided = [[10 power]] -local powerradius = [[800]] ---local supplygranted = [[50]] +local techrequired = [[tech3]] +local energyproduced = [[50]] + +local buildCostMetal = 400 +local maxDamage = buildCostMetal * 12.5 local unitDef = { activateWhenBuilt = true, buildAngle = 2500, buildCostEnergy = 0, - buildCostMetal = 170, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, canAttack = false, category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = [[Armortype: ]] ..armortype.. [[ - -Produces +]] .. energyproduced .. [[ Energy - -Provides +]] .. powerprovided, + description = [[Produces +]] .. energyproduced .. [[ Energy]], energyStorage = 0, energyMake = energyproduced, explodeAs = "hugeBuildingExplosionGenericBlueEMP", - footprintX = 8, - footprintZ = 8, - iconType = "energy", + footprintX = 12, + footprintZ = 12, + iconType = "generator", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 2400, + maxDamage = maxDamage, maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Advanced Generator", - objectName = "efusion2.s3o", + name = "Cold Fusion Energy Generator", + objectName = "efusion2-huge.s3o", onoffable = false, radarDistance = 0, repairable = false, @@ -48,8 +44,7 @@ Provides +]] .. powerprovided, sightDistance = 367, smoothAnim = true, unitname = "efusion2", - workerTime = 0, - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", + yardMap = "oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo", sfxtypes = { pieceExplosionGenerators = { @@ -59,30 +54,31 @@ Provides +]] .. powerprovided, explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionnuclear", + "custom:fusionreactionnuclear-huge-4color", "custom:skyhatelaser", }, }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdenergy", + "other/gdenergy.wav", }, }, weapons = { }, customParams = { + unittype = "building", iseco = 1, needed_cover = 5, death_sounds = "generic", - ProvideTech = powerprovided, --- ProvideTechRange = powerradius, - -- RequireTech = "1 Powergrid", + 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", -- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", @@ -96,8 +92,8 @@ Provides +]] .. powerprovided, }, 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 1e401e588..883985992 100644 --- a/Units/ebuilding/egeothermal.lua +++ b/Units/ebuilding/egeothermal.lua @@ -6,40 +6,38 @@ local unitName = "egeothermal" -------------------------------------------------------------------------------- local armortype = [[building]] -local energyproduced = [[7]] -local powerprovided = [[7 power]] -local powerradius = [[600]] ---local supplygranted = [[35]] +local techrequired = [[tech2]] +local energyproduced = [[30]] + +local buildCostMetal = 280 +local maxDamage = buildCostMetal * 12.5 local unitDef = { activateWhenBuilt = true, buildAngle = 2048, buildCostEnergy = 0, - buildCostMetal = 100, + buildCostMetal = buildCostMetal, + buildingMask = 0, builder = false, buildTime = 5, canAttack = false, category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = [[Armortype: ]] ..armortype.. [[ - -Produces +]] .. energyproduced .. [[ Energy - -Provides +]] .. powerprovided, + description = [[Produces +]] .. energyproduced .. [[ Energy]], energyMake = energyproduced, energyStorage = 0, explodeAs = "largeBuildingExplosionGenericBlueEMP", footprintX = 4, footprintZ = 4, - iconType = "energy", + iconType = "generator", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 2000, + maxDamage = maxDamage, maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Geothermal Generator", + name = "Fusion Energy Generator", objectName = "egeothermal2.s3o", + script = "egeothermal.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -49,7 +47,7 @@ Provides +]] .. powerprovided, smoothAnim = true, unitname = "egeothermal", workerTime = 0, - yardMap = "oooo oGGo oGGo oooo", + yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", sfxtypes = { pieceExplosionGenerators = { @@ -58,30 +56,34 @@ Provides +]] .. powerprovided, }, explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactiongeo", + "custom:fusionreactionnuclear-2color", "custom:skyhatelaser", }, }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdenergy", + "other/gdenergy", }, }, weapons = { }, customParams = { + unittype = "building", iseco = 1, needed_cover = 2, death_sounds = "generic", - ProvideTech = powerprovided, + 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", -- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", @@ -95,8 +97,8 @@ Provides +]] .. powerprovided, }, 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 0d7bfb572..f3f9a6cda 100644 --- a/Units/ebuilding/eheavyturret2.lua +++ b/Units/ebuilding/eheavyturret2.lua @@ -1,170 +1,26 @@ -- UNITDEF -- EHEAVYTURRET2 -- -------------------------------------------------------------------------------- -local unitName = "eheavyturret2" +unitName = [[eheavyturret2]] -------------------------------------------------------------------------------- -local armortype = [[building]] -local supply = [[5]] +isUpgraded = [[0]] -local weapon1Damage = 300 -local weapon1AOE = 50 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Immolator]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = [[eheavyturret3.s3o]] +script = [[eheavyturret2.cob]] -local unitDef = { - - buildAngle = 8192, - buildCostEnergy = 0, - buildCostMetal = 90, - builder = false, - buildTime = 5, - collisionVolumeOffsets = "0 0 0", - collisionVolumeScales = "80 115 80", - collisionVolumeTest = 1, - collisionVolumeType = "box", - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Heavy Plasma Battery (Anti-Armor) -Armortype: ]] ..armortype.. [[ - -300 Damage vs Armored -150 Damage vs Light -30 Damage vs Buildings - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "largeBuildingExplosionGenericRed", - footprintX = 6, - footprintZ = 6, - floater = true, - idleAutoHeal = .5, - idleTime = 2200, - iconType = "defense", - maxDamage = 1250, - maxSlope = 60, - maxWaterDepth = 999999, - metalStorage = 0, - name = "Immolator", - objectName = "eheavyturret3.s3o", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeBuildingExplosionGenericRed", - side = "CORE", - sightDistance = 1000, - smoothAnim = true, - unitname = "eheavyturret2", - workerTime = 0, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "eheavyturretweapon2", - badTargetCategory = "LIGHT VTOL", - onlyTargetCategory = "ARMORED LIGHT", - }, - }, - customParams = { - needed_cover = 5, - supply_cost = supply, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} +tech = [[tech2]] +armortype = [[building]] +--supply = [[5]] +VFS.Include("units-configs-basedefs/basedefs/buildings/eheavyturret2_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) -local weaponDefs = { - eheavyturretweapon2 = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.25, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium", - fallOffRate = 1, - fireStarter = 100, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 1000, - reloadtime = 1, - WeaponType = "LaserCannon", - rgbColor = "1 0.5 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "heavyturretshot.wav", - soundHit = "explode5.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 1500, - customparams = { - damagetype = "eheavyturret2", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/ejammer2.lua b/Units/ebuilding/ejammer2.lua index cf442003f..525b8433d 100644 --- a/Units/ebuilding/ejammer2.lua +++ b/Units/ebuilding/ejammer2.lua @@ -7,30 +7,30 @@ local unitName = "ejammer2" local armortype = [[building]] +local techrequired = [[tech2]] + +local buildCostMetal = 20 +local maxDamage = buildCostMetal * 12.5 + local unitDef = { activateWhenBuilt = true, buildAngle = 16384, buildCostEnergy = 0, - buildCostMetal = 20, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Radar Jamming Tower -Armortype: ]] ..armortype.. [[ - -Generates a Cloaking Field -Drains -5 Energy while emitting 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, - maxDamage = 280, + maxDamage = maxDamage, maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, @@ -60,18 +60,32 @@ Drains -5 Energy while emitting cloaking field]], }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdradar", + "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", + 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? + 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", diff --git a/Units/ebuilding/ekmar.lua b/Units/ebuilding/ekmar.lua index 032577ddb..5b756a7ad 100644 --- a/Units/ebuilding/ekmar.lua +++ b/Units/ebuilding/ekmar.lua @@ -7,38 +7,36 @@ local unitName = "ekmar" local armortype = [[building]] -local shield1Power = 2000 -local shield1PowerRegen = 30 -local shield1PowerRegenEnergy = shield1PowerRegen / 10 +local techrequired = [[tech2]] + +local shield1Power = 2500 +local shield1PowerRegen = 25 +local shield1PowerRegenEnergy = 25 +local buildCostMetal = 50 +local maxDamage = buildCostMetal * 12.5 local unitDef = { activateWhenBuilt = true, buildAngle = 4096, buildCostEnergy = 0, - buildCostMetal = 20, + buildCostMetal = buildCostMetal, builder = false, buildTime = 1, canAttack = false, canstop = "1", category = "BUILDING NOTAIR WALL", damageModifier = 0.2, - description = [[Protective Shield -Armortype: ]] ..armortype.. [[ - -Shield recharges at a rate of ]] .. shield1PowerRegen .. [[hp/s -Energy cost for regeneration: ]] .. shield1PowerRegenEnergy .. [[/s -Maximum shield power is ]] .. shield1Power ..[[hp -Shield can link with other shield units to increase charging and capacity]], + description = [[Protective Shield • Shield can link with other shield units to increase charging and capacity]], energyStorage = 0, energyUse = 0, explodeAs = "mediumBuildingExplosionGenericBlue", - footprintX = 3, - footprintZ = 3, + footprintX = 2, + footprintZ = 2, floater = true, - iconType = "barricade", + iconType = "baseshield", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 250, + maxDamage = maxDamage, maxSlope = 60, maxWaterDepth = 999999, mass = 1000, @@ -69,9 +67,9 @@ Shield can link with other shield units to increase charging and capacity]], }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "turretselect", + "other/turretselect", }, }, @@ -82,13 +80,16 @@ Shield can link with other shield units to increase charging and capacity]], }, customParams = { + RequireTech = techrequired, + unittype = "shield", needed_cover = 1, death_sounds = "generic", armortype = armortype, + shield_power = shield1Power, + shield_radius = 1000, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -105,22 +106,22 @@ local weaponDefs = { Smartshield = true, Exteriorshield = true, - Visibleshield = true, - Visibleshieldrepulse = true, + Visibleshield = false, + Visibleshieldrepulse = false, ShieldStartingPower = 0, Shieldenergyuse = 0, - Shieldradius = 200, + Shieldradius = 750, Shieldpower = shield1Power, Shieldpowerregen = shield1PowerRegen, Shieldpowerregenenergy = shield1PowerRegenEnergy, Shieldintercepttype = 4, Shieldgoodcolor = "0.0 0.2 1.0", Shieldbadcolor = "1.0 0 0", - Shieldalpha = 0.3, + Shieldalpha = 0.2, texture1 = "shield4", - visibleShieldHitFrames = 50, + visibleShieldHitFrames = 1, weaponType = [[Shield]], damage = { default = 1, 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 29ea2b19d..8482c0007 100644 --- a/Units/ebuilding/elightturret2.lua +++ b/Units/ebuilding/elightturret2.lua @@ -1,158 +1,26 @@ -- UNITDEF -- ELIGHTTURRET2 -- -------------------------------------------------------------------------------- -local unitName = "elightturret2" +unitName = [[elightturret2]] -------------------------------------------------------------------------------- -local armortype = [[building]] -local supply = [[2]] +isUpgraded = [[0]] -local weapon1Damage = 125 -local weapon1AOE = 25 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Pincushion]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = [[elightturret3.s3o]] +script = [[elightturret2.cob]] -local unitDef = { - - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = 40, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - collisionVolumeTest = "1", - corpse = "ammobox", - description = [[Anti-Raid Defense Platform (Anti-Light) -Armortype: ]] ..armortype.. [[ - -125 Damage vs Light -31.25 Damage vs Armored -12.5 Damage vs Buildings - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumBuildingExplosionGeneric", - footprintX = 4, - footprintZ = 4, - floater = true, - idleAutoHeal = .5, - idleTime = 2200, - iconType = "defense", - maxDamage = 750, - maxSlope = 60, - maxWaterDepth = 999999, - metalStorage = 0, - name = "Lightning Rod", - objectName = "elightturret3.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - -- script = "elightturret2-script.lua", - selfDestructAs = "mediumBuildingExplosionGeneric", - side = "CORE", - sightDistance = 600, - smoothAnim = true, - unitname = "elightturret2", - workerTime = 0, - yardMap = "oooo oooo oooo oooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:electricity", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "lighteweapon", - badTargetCategory = "VTOL ARMORED", - onlyTargetCategory = "LIGHT VTOL ARMORED", - }, - }, - customParams = { - needed_cover = 2, - supply_cost = supply, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 6, - BuildingGroundDecalSizeY = 6, - BuildingGroundDecalDecaySpeed = 0.9, -} +tech = [[tech0]] +armortype = [[building]] +--supply = [[3]] +VFS.Include("units-configs-basedefs/basedefs/buildings/elightturret2_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) -local weaponDefs = { - lighteweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - collideFriendly = false, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:genericshellexplosion-medium-lightning", - energypershot = energycosttofire, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - noSelfDamage = true, - range = 600, - reloadtime = 1, - WeaponType = "LightningCannon", - rgbColor = "0.1 0.2 0.5", - rgbColor2 = "0 0 1", - soundStart = "jacobs.wav", - - texture1 = "lightning", - thickness = 10, - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "elightturret2", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ebuilding/elrpc.lua b/Units/ebuilding/elrpc.lua deleted file mode 100644 index fdb01c79a..000000000 --- a/Units/ebuilding/elrpc.lua +++ /dev/null @@ -1,150 +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", - - corpse = "ammobox", - 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 = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "lrpcweapon", - onlyTargetCategory = "NOTAIR AMPHIB", - badTargetCategory = "LIGHT ARMORED WALL", - }, - }, - customParams = { - canareaattack ="1", - death_sounds = "generic", - RequireTech = "0 Power", - armortype = "building", - normaltex = "unittextures/elrpcnormal.png", - helptext = [[]], - }, - 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 = "lrpchit.wav", - soundStart = "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 a0c10ce34..000000000 --- a/Units/ebuilding/emaker.lua +++ /dev/null @@ -1,98 +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", - corpse = "ammobox", - 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 = "unitsunderattack1", - select = { - "gdmex", - }, - }, - weapons = { - }, - customParams = { - 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 = [[]], - }, - 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 db225da99..2ce9ab364 100644 --- a/Units/ebuilding/emediumgen.lua +++ b/Units/ebuilding/emediumgen.lua @@ -20,7 +20,6 @@ local unitDef = { buildTime = 5, canAttack = false, category = "BUILDING NOTAIR ECO", - corpse = "ammobox", damageModifier = 0.33333, description = [[Armortype: ]] ..armortype.. [[ @@ -30,9 +29,9 @@ Provides +]] .. powerprovided, energyStorage = 0, energyMake = energyproduced, explodeAs = "largeBuildingExplosionGenericBlueEMP", - footprintX = 6, - footprintZ = 6, - icontype = "energy", + footprintX = 3, + footprintZ = 3, + icontype = "generator", idleAutoHeal = .5, idleTime = 2200, maxDamage = 1400, @@ -66,14 +65,15 @@ Provides +]] .. powerprovided, }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdenergy", + "other/gdenergy", }, }, weapons = { }, customParams = { + unittype = "building", iseco = 1, needed_cover = 4, death_sounds = "generic", @@ -84,7 +84,8 @@ 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", -- groundtexselectimg2 = ":nc:bitmaps/power/power2.png", diff --git a/Units/ebuilding/emetalextractor.lua b/Units/ebuilding/emetalextractor.lua index 0e28634de..9d8e6221d 100644 --- a/Units/ebuilding/emetalextractor.lua +++ b/Units/ebuilding/emetalextractor.lua @@ -1,99 +1,32 @@ -- UNITDEF -- EMETALEXTRACTOR -- -------------------------------------------------------------------------------- -local unitName = "emetalextractor" +unitName = [[emetalextractor]] -------------------------------------------------------------------------------- -local armortype = [[building]] -local metal = [[0.5]] --The actual amount is set in resourcegifts gadget -local supply = [[2]] +ateranMexCost = Spring.GetModOptions().metalextractorcostateran or 50 -local unitDef = { +metalMultiplier = 1 - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - canAttack = false, - category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = [[Armortype: ]] ..armortype.. [[ +buildCostMetal = ateranMexCost +energyUse = 0 -Generates +]] .. metal .. [[ metal per second - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "largeBuildingExplosionGenericRed", - extractsMetal = 0.0000001, - makesMetal = 0, - footprintX = 7, - footprintZ = 7, - iconType = "eco", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 500, - maxSlope = 60, - maxWaterDepth = 5000, - metalStorage = 0, - metalMake = 0, - name = "Metal Extractor", - objectName = "emetalextractor2.s3o", - onoffable = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "largeBuildingExplosionGenericRed", - selfDestructCountdown = 1, - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = "emetalextractor", - workerTime = 0, - yardMap = "ooooooo ooooooo ooooooo ooooooo ooooooo ooooooo ooooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, +primaryCEG = "custom:fusionreactionnuclear-1color" - explosiongenerators = { - "custom:blacksmoke", - "custom:fusionreactionmex", - "custom:skyhatelaser", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdmex", - }, - }, - weapons = { - }, - customParams = { - iseco = 1, - needed_cover = 3, - supply_cost = supply, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 9, - BuildingGroundDecalSizeY = 9, - BuildingGroundDecalDecaySpeed = 0.9, -} +humanName = [[Metal Extractor]] +objectName = [[emetalextractor2_small.s3o]] +script = [[emetalextractor.cob]] --------------------------------------------------------------------------------- +tech = [[tech0]] +armortype = [[building]] -return lowerkeys({ [unitName] = unitDef }) +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_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 9108b5a3c..120e22ed7 100644 --- a/Units/ebuilding/emine.lua +++ b/Units/ebuilding/emine.lua @@ -6,11 +6,10 @@ local unitName = "emine" -------------------------------------------------------------------------------- local armortype = [[building]] -local supply = [[1]] +--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 @@ -18,13 +17,13 @@ end local unitDef = { activateWhenBuilt = true, - blocking = true, + blocking = false, buildAngle = 1024, buildCostEnergy = 0, - buildCostMetal = 20, + buildCostMetal = 5, builder = false, - buildTime = 20, - category = "BUILDING NOTAIR", + buildTime = 5, + category = "LIGHT NOTAIR", -- Cloaking @@ -32,18 +31,13 @@ local unitDef = { cloakCost = 0, cloakCostMoving = 0, minCloakDistance = 0, - decloakOnFire = false, + decloakOnFire = true, decloakSpherical = true, initCloaked = true, -- End Cloaking - description = [[Anti-Tank Land Mine -Armortype: ]] ..armortype.. [[ - -Fires a projectile dealing ]] .. weapon1Damage .. [[ damage - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), + description = [[Air/Land Mine]], energyMake = 0, energyStorage = 0, energyUse = 0, @@ -54,7 +48,7 @@ Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), idleAutoHeal = .5, idleTime = 2200, levelground = false, - maxDamage = 10, + maxDamage = 100, maxSlope = 60, maxWaterDepth = 0, metalStorage = 0, @@ -88,32 +82,33 @@ Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "turretselect", + "other/turretselect", }, }, weapons = { [1] = { def = "emineboom", - onlyTargetCategory = "LIGHT ARMORED", + onlyTargetCategory = "BIO LIGHT ARMORED", badTargetCategory = "DRONE VTOL", }, }, customParams = { + unittype = "landmine", + decloakradiusmodifier = 10, needed_cover = 1, death_sounds = "generic", nofriendlyfire = "1", armortype = armortype, - supply_cost = supply, + --supply_cost = supply, normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], + factionname = "ateran", }, - useGroundDecal = true, + useGroundDecal = false, BuildingGroundDecalType = "factorygroundplate.dds", BuildingGroundDecalSizeX = 3, BuildingGroundDecalSizeY = 3, @@ -132,7 +127,7 @@ local weaponDefs = { collideFeature = false, canAttackGround = false, cegTag = "missiletrail", - flightTime = 5, + flightTime = 2.5, tolerance = 1000, turret = true, @@ -140,7 +135,7 @@ local weaponDefs = { model = "missilesmallvlaunch.s3o", edgeeffectiveness = 1, - energypershot = energycosttofire, + energypershot = 0, range =400, reloadtime =8, weaponvelocity =2500, @@ -154,12 +149,13 @@ local weaponDefs = { weaponTimer = 0.5, weaponType = "StarburstLauncher", weaponVelocity = 2500, - soundHit ="minedetonation.wav", - soundStart = "minewhir.wav", - explosiongenerator ="custom:genericshellexplosion-large-white", + soundHit ="explosions/minedetonation.wav", + soundStart = "weapons/minewhir.wav", + 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 12d240ca2..1ee47c0ba 100644 --- a/Units/ebuilding/eradar2.lua +++ b/Units/ebuilding/eradar2.lua @@ -1,90 +1,28 @@ --- UNITDEF -- ERADAR2 -- +-- UNITDEF -- eradar2 -- -------------------------------------------------------------------------------- -local unitName = "eradar2" +unitName = [[eradar2]] --------------------------------------------------------------------------------- +buildCostMetal = 5 + +humanName = [[Radar Tower]] +objectName = [[eradar3_small.s3o]] -local armortype = [[building]] +radarDistance = 1000 +radarEmitHeight = 64 -local unitDef = { - activateWhenBuilt = true, - buildAngle = 16384, - buildCostEnergy = 0, - buildCostMetal = 30, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Radar Dome/Sensor Tower -Armortype: ]] ..armortype, - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeBuildingExplosionGenericWhite", - footprintX = 6, - footprintZ = 6, - floater = true, - iconType = "radar", - idleAutoHeal = .5, - idleTime = 2200, - isTargetingUpgrade = false, - maxDamage = 750, - 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", +sightDistance = 750 +sonarDistance = 750 +seismicDistance = 750 - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:blacksmoke", - }, - }, +tech = [[tech0]] +armortype = [[building]] - sounds = { - underattack = "unitsunderattack1", - select = { - "gdradar", - }, - }, - customParams = { - needed_cover = 2, - death_sounds = "generic", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - 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 234a532ef..5014ec1bd 100644 --- a/Units/ebuilding/eshieldgen.lua +++ b/Units/ebuilding/eshieldgen.lua @@ -6,52 +6,43 @@ local unitName = "eshieldgen" -------------------------------------------------------------------------------- local armortype = [[building]] +--local supply = [[20]] +--local techprovided = [[-baseshield]] +local techrequired = [[tech2]] -local weapon1Damage = 2001 +local weapon1Damage = 3001 local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) --local stockpiletime = 60 -local shield1Power = 2000 -local shield1PowerRegen = 15 -local shield1PowerRegenEnergy = shield1PowerRegen / 10 - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +local buildCostMetal = 450 +local maxDamage = buildCostMetal * 12.5 local unitDef = { buildAngle = 8192, buildCostEnergy = 0, - buildCostMetal = 200, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, canAttack = false, canstop = "1", category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Anti-Nuke \ Anti-Artillery Base Shield Facility -Armortype: ]] ..armortype.. [[ - -Shield recharges at a rate of ]] .. shield1PowerRegen .. [[hp/s -Energy cost for regeneration: ]] .. shield1PowerRegenEnergy .. [[/s -Maximum shield power is ]] .. shield1Power ..[[hp -Shield can link with other shield units to increase charging and capacity]], + description = [[Anti-Nuke Defense Facility]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "hugeBuildingExplosionGenericGreen", footprintX = 5, footprintZ = 5, - iconType = "defense", + iconType = "nukeshield", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 1800, + maxDamage = maxDamage, 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", @@ -64,7 +55,7 @@ Shield can link with other shield units to increase charging and capacity]], sightDistance = 600, smoothAnim = true, unitlimit = "2", - unitname = "eshieldgen", + unitname = unitName, workerTime = 0, yardMap = "ooooo ooooo ooooo ooooo ooooo", @@ -80,27 +71,28 @@ Shield can link with other shield units to increase charging and capacity]], }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "turretselect", + "other/turretselect", }, }, weapons = { --- Make sure to change the weapon numbers if the nuke interceptor weapon is ever reinstated --- [1] = { --- def = "nukeinterceptor", --- }, [1] = { - def = "shield", + def = "nukeinterceptor", }, }, customParams = { + --ProvideTech = techprovided, + RequireTech = techrequired, + unittype = "building", + --supply_cost = supply, needed_cover = 5, death_sounds = "generic", - ProvideTechRange = "300", + --ProvideTechRange = "300", armortype = armortype, - normaltex = "unittextures/eshieldgennormal.png", - helptext = [[Anti-Nuke Platform / Anti-Artillery base shield Facility]], + normaltex = "unittextures/lego2skin_explorernormal.dds", + corpse = "energycore", + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -121,13 +113,13 @@ local weaponDefs = { beamTime = 5, collideFeature = false, collideFriendly = false, - coverage = 2500, - rgbColor = "0 0 0.5", + coverage = 2000, + rgbColor = "0.5 0.5 0", rgbColor2 = "0.5 0.5 0.5", coreThickness = 0.5, duration = 0.4, explosionGenerator = "custom:genericshellexplosion-large-blue", - energypershot = energycosttofire, + energypershot = 0, fallOffRate = 0.1, fireStarter = 50, interceptor = 1, @@ -137,13 +129,13 @@ local weaponDefs = { minintensity = 1, name = "Laser", - range = 2500, - reloadtime = 5, + range = 2000, + reloadtime = 170, WeaponType = "BeamLaser", - soundStart = "antinukelaser.wav", + soundStart = "weapons/antinukelaser.wav", soundTrigger = true, - stockpile = true, - stockpiletime = stockpiletime, + --stockpile = true, + --stockpiletime = stockpiletime, texture1 = "lightning", texture2 = "laserend", thickness = 20, @@ -151,34 +143,12 @@ local weaponDefs = { turret = true, weaponVelocity = 1500, waterweapon = true, - damage = { - default = weapon1Damage, + customparams = { + nofriendlyfire = 1, + nocosttofire = true, }, - }, - - shield = { - - Smartshield = true, - Exteriorshield = true, - Visibleshield = true, - Visibleshieldrepulse = true, - ShieldStartingPower = 0, - Shieldenergyuse = 0, - Shieldradius = 1500, - Shieldpower = shield1Power, - Shieldpowerregen = shield1PowerRegen, - Shieldpowerregenenergy = shield1PowerRegenEnergy, - Shieldintercepttype = 4, - Shieldgoodcolor = "0.0 0.2 1.0", - Shieldbadcolor = "1.0 0 0", - Shieldalpha = 0.3, - - texture1 = "shield4", - - visibleShieldHitFrames = 50, - weaponType = [[Shield]], damage = { - default = 1, + default = weapon1Damage, }, }, } diff --git a/Units/ebuilding/esilo.lua b/Units/ebuilding/esilo.lua index 901938f46..e8a48b31b 100644 --- a/Units/ebuilding/esilo.lua +++ b/Units/ebuilding/esilo.lua @@ -6,9 +6,12 @@ local unitName = "esilo" -------------------------------------------------------------------------------- local armortype = [[building]] +--local supply = [[50]] +--local techprovided = [[-nukesilo]] +local techrequired = [[tech3]] -local weapon1Damage = 1400 -local weapon1AOE = 500 +local weapon1Damage = 3000 +local weapon1AOE = 1500 local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) --local stockpiletime = 60 @@ -16,44 +19,37 @@ 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 = 450, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, canAttack = true, canstop = "1", category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Nuclear Missile Silo -Armortype: ]] ..armortype.. [[ - -]] .. weapon1Damage .. [[ Damage vs Light/Armored/Buildings - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), + description = [[ ]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "nukemissile", floater = true, + fireState = 0, footprintX = 16, footprintZ = 16, iconType = "esilo", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 4000, + maxDamage = maxDamage, maxSlope = 30, maxWaterDepth = 5000, metalStorage = 0, - name = "Eradicator", + 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", @@ -64,7 +60,7 @@ Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), unitlimit = "2", unitname = "esilo", workerTime = 0, - yardMap = "oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo", + yardMap = "oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo oooooooooooooooo", sfxtypes = { pieceExplosionGenerators = { @@ -80,24 +76,29 @@ Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire), }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "turretselect", + "other/turretselect", }, }, weapons = { [1] = { def = "nukemissile", - onlyTargetCategory = "NOTAIR", + badTargetCategory = "LIGHT ARMORED", }, }, 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", - helptext = [[]], + buckettex = "unittextures/lego2skin_explorerbucket.dds", + corpse = "energycore", + factionname = "ateran", }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", @@ -118,31 +119,31 @@ local weaponDefs = { cegTag = "NUKETRAIL", collideFriendly = false, collideFeature = false, - commandfire = true, + commandFire = true, craterBoost = 0, craterMult = 0, edgeeffectiveness = 1, energypershot = energycosttofire, - explosionGenerator = "custom:NUKEDATBEWMSMALL", + explosionGenerator = "custom:nukedatbewm", fireStarter = 100, flightTime = 400, id = 124, impulseBoost = 0, impulseFactor = 0, - interceptedByShieldType = 4, + --interceptedByShieldType = 4, metalpershot = 0, model = "enuke.s3o", name = "Nuke", range = 32000, - reloadtime = 60, + reloadtime = 200, weaponType = "MissileLauncher", smokeTrail = false, - soundHit = "explosion_enormous.wav", - soundStart = "nukelaunch.wav", + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", -- stockpile = true, -- stockpileTime = stockpiletime, @@ -156,8 +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 abb88654a..51cfe9ce3 100644 --- a/Units/ebuilding/esolar2.lua +++ b/Units/ebuilding/esolar2.lua @@ -6,42 +6,36 @@ local unitName = "esolar2" -------------------------------------------------------------------------------- local armortype = [[building]] -local energyproduced = [[1]] -local powerprovided = [[1 power]] -local powerradius = [[400]] --- local supplygranted = [[5]] +local energyproduced = [[5]] + +local buildCostMetal = 50 +local maxDamage = buildCostMetal * 12.5 local unitDef = { activateWhenBuilt = true, buildAngle = 2048, buildCostEnergy = 0, - buildCostMetal = 20, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, canAttack = false, category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - damageModifier = 0.33333, - description = [[Armortype: ]] ..armortype.. [[ - -Produces +]] .. energyproduced .. [[ Energy - -Provides +]] .. powerprovided .. [[ -Power Radius: ]] .. powerradius, + description = [[Produces +]] .. energyproduced .. [[ Energy]], energyStorage = 0, energyMake = energyproduced, explodeAs = "mediumBuildingExplosionGenericBlueEMP", - footprintX = 4, - footprintZ = 4, - icontype = "energy", + footprintX = 2, + footprintZ = 2, + icontype = "generator", idleAutoHeal = .5, idleTime = 2200, - maxDamage = 800, + maxDamage = maxDamage, maxSlope = 60, maxWaterDepth = 5000, metalStorage = 0, - name = "Basic Generator", - objectName = "epowerplant.s3o", + name = "Fission Energy Generator", + objectName = "epowerplant3x3.s3o", + script = "esolar2.cob", onoffable = false, radarDistance = 0, repairable = false, @@ -50,7 +44,7 @@ Power Radius: ]] .. powerradius, sightDistance = 367, smoothAnim = true, unitname = "esolar2", - yardMap = "oooo oooo oooo oooo", + yardMap = "ooo ooo ooo", sfxtypes = { pieceExplosionGenerators = { @@ -60,32 +54,34 @@ Power Radius: ]] .. powerradius, explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionbasic", + "custom:fusionreactionnuclear-small-2color", "custom:skyhatelaser", }, }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdenergy", + "other/gdenergy", }, }, weapons = { }, customParams = { + unittype = "building", iseco = 1, needed_cover = 2, death_sounds = "generic", - ProvideTech = powerprovided, +-- 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", --- groundtexselectimg = ":nc:bitmaps/power/power.png", + factionname = "ateran", + 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", @@ -98,8 +94,8 @@ Power Radius: ]] .. powerradius, }, useGroundDecal = true, BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 6, - BuildingGroundDecalSizeY = 6, + BuildingGroundDecalSizeX = 5, + BuildingGroundDecalSizeY = 5, BuildingGroundDecalDecaySpeed = 0.9, } -------------------------------------------------------------------------------- diff --git a/Units/ebuilding/estorage.lua b/Units/ebuilding/estorage.lua index d26910fd4..dce2a5938 100644 --- a/Units/ebuilding/estorage.lua +++ b/Units/ebuilding/estorage.lua @@ -6,14 +6,17 @@ local unitName = "estorage" -------------------------------------------------------------------------------- local armortype = [[building]] -local storage = 25 -local supplygranted = 10 +local storage = 50 +local supplygranted = 25 + +local buildCostMetal = 15 +local maxDamage = buildCostMetal * 12.5 local unitDef = { activateWhenBuilt = true, buildAngle = 8196, buildCostEnergy = 0, - buildCostMetal = 25, + buildCostMetal = buildCostMetal, builder = false, buildTime = 5, canAttack = false, @@ -24,34 +27,32 @@ local unitDef = { collisionVolumeTest = 1, collisionVolumeType = "box", - corpse = "ammobox", - description = [[Armortype: ]] ..armortype.. [[ - -Provides +]] .. supplygranted .. [[ Supply]], + description = [[Provides +]] .. supplygranted .. [[ Supply • Provides +]] .. storage .. [[ Metal/Energy Storage]], energyStorage = storage, + metalStorage = storage, energyUse = 0, - explodeAs = "hugeBuildingExplosionGenericPurple", - footprintX = 4, - footprintZ = 8, + explodeAs = "smallBuildingExplosionGenericPurple", + footprintX = 2, + footprintZ = 4, idleAutoHeal = .5, idleTime = 2200, icontype = "storage", - maxDamage = 500, + maxDamage = maxDamage, maxSlope = 50, maxWaterDepth = 5000, - metalStorage = storage, - name = "Storage and Supply Depot", - objectName = "estorage2.s3o", + --metalStorage = storage, + name = "Supply/Storage Depot", + objectName = "estorage2_small.s3o", script = "estorage2.cob", radarDistance = 0, repairable = false, - selfDestructAs = "hugeBuildingExplosionGenericPurple", + selfDestructAs = "smallBuildingExplosionGenericPurple", side = "CORE", sightDistance = 367, 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 = { @@ -61,34 +62,38 @@ Provides +]] .. supplygranted .. [[ Supply]], explosiongenerators = { "custom:blacksmoke", - "custom:fusionreactionstoragenew", + "custom:fusionreactionstoragenew-small", + "custom:fusionreactionstoragenew-blue-small", "custom:skyhatelaser", }, }, sounds = { - underattack = "unitsunderattack1", + underattack = "other/unitsunderattack1", select = { - "gdenergy", + "other/gdenergy", }, }, weapons = { }, customParams = { + unittype = "building", iseco = 1, needed_cover = 2, 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 new file mode 100644 index 000000000..8dc5459bc --- /dev/null +++ b/Units/ebuilding/etech1.lua @@ -0,0 +1,110 @@ +-- UNITDEF -- ETECH1 -- +-------------------------------------------------------------------------------- + +local unitName = "etech1" + +-------------------------------------------------------------------------------- + +local armortype = [[building]] +local energyproduced = [[0]] +local techprovided = [[tech0, tech1]] +--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, + buildpic = "emaker.png", + canAttack = false, + category = "BUILDING NOTAIR ECO", + damageModifier = 0.33333, + description = "Unlocks Tech 1 - Can be evolved to unlock Tech 2", + energyStorage = 0, + energyMake = energyproduced, + explodeAs = "hugeBuildingExplosionGenericBlue", + footprintX = 4, + footprintZ = 4, + icontype = "energy", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 60, + maxWaterDepth = 5000, + metalStorage = 0, + name = "Tech Facility", + objectName = "emaker3.s3o", + script = "emaker3.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:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", + "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 = "1 Powergrid", + armortype = armortype, +-- supply_granted = supplygranted, + normaltex = "unittextures/lego2skin_explorernormal.dds", + buckettex = "unittextures/lego2skin_explorerbucket.dds", + factionname = "ateran", + 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 = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, +} +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ebuilding/etech2.lua b/Units/ebuilding/etech2.lua new file mode 100644 index 000000000..6235a5f05 --- /dev/null +++ b/Units/ebuilding/etech2.lua @@ -0,0 +1,113 @@ +-- UNITDEF -- ETECH2 -- +-------------------------------------------------------------------------------- + +local unitName = "etech2" + +-------------------------------------------------------------------------------- + +local armortype = [[building]] +local energyproduced = [[0]] +local techprovided = [[tech0, tech1, tech2, 1 baseshield]] + +local tech = [[tech1]] +--local supplygranted = [[25]] + +local buildCostMetal = 700 +local maxDamage = buildCostMetal * 12.5 + +local unitDef = { + activateWhenBuilt = true, + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = false, + buildTime = 5, + buildpic = "emaker.png", + canAttack = false, + category = "BUILDING NOTAIR ECO", + damageModifier = 0.33333, + description = "Unlocks Tech 2 - Can be evolved to unlock Tech 3", + energyStorage = 0, + energyMake = energyproduced, + explodeAs = "hugeBuildingExplosionGenericPurple", + footprintX = 4, + footprintZ = 4, + icontype = "energy", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 60, + maxWaterDepth = 5000, + metalStorage = 0, + name = "Tech Level 2 Facility", + objectName = "emaker3.s3o", + script = "emaker3.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:fusionreactionmaker-orange", + "custom:fusionreactionmaker-purple", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-purple", + "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 = "ateran", + 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 = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, +} +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ebuilding/etech3.lua b/Units/ebuilding/etech3.lua new file mode 100644 index 000000000..23947c5e5 --- /dev/null +++ b/Units/ebuilding/etech3.lua @@ -0,0 +1,113 @@ +-- UNITDEF -- ETECH3 -- +-------------------------------------------------------------------------------- + +local unitName = "etech3" + +-------------------------------------------------------------------------------- + +local armortype = [[building]] +local energyproduced = [[0]] +local techprovided = [[tech0, tech1, tech2, tech3]] + +local tech = [[tech1, tech2]] +--local supplygranted = [[25]] + +local buildCostMetal = 2100 +local maxDamage = buildCostMetal * 12.5 + +local unitDef = { + activateWhenBuilt = true, + buildAngle = 2048, + buildCostEnergy = 0, + buildCostMetal = buildCostMetal, + builder = false, + buildTime = 5, + buildpic = "emaker.png", + canAttack = false, + category = "BUILDING NOTAIR ECO", + damageModifier = 0.33333, + description = "Unlocks Tech 3", + energyStorage = 0, + energyMake = energyproduced, + explodeAs = "hugeBuildingExplosionGenericGreen", + footprintX = 4, + footprintZ = 4, + icontype = "energy", + idleAutoHeal = .5, + idleTime = 2200, + maxDamage = maxDamage, + maxSlope = 60, + maxWaterDepth = 5000, + metalStorage = 0, + name = "Tech Level 3 Facility", + objectName = "emaker3.s3o", + script = "emaker3.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:fusionreactionmaker-orange", + "custom:fusionreactionmaker-blue", + "custom:fusionreactionmaker-purple", + "custom:fusionreactionmaker-green", + "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 = "ateran", + 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 = 10, + BuildingGroundDecalSizeY = 10, + BuildingGroundDecalDecaySpeed = 0.9, +} +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ebuilding/water/euwfusion2.lua b/Units/ebuilding/water/euwfusion2.lua deleted file mode 100644 index e932f37e2..000000000 --- a/Units/ebuilding/water/euwfusion2.lua +++ /dev/null @@ -1,144 +0,0 @@ --- UNITDEF -- EUWFUSION2 -- --------------------------------------------------------------------------------- - -local unitName = "euwfusion2" - --------------------------------------------------------------------------------- - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2500, - buildCostEnergy = 0, - buildCostMetal = 180, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = [[Produces +10 Energy - Provides +10 Power - Provides +10 Supply]], - energyMake = 10, - energyStorage = 0, - energyUse = 0, - explodeAs = "FUSIONPOP", - footprintX = 8, - footprintZ = 8, - iconType = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 3200, - maxSlope = 60, - minWaterDepth = 50, - maxWaterDepth = 10000, - metalStorage = 0, - name = "Underwater Advanced Generator", - objectName = "efusion.s3o", - onoffable = false, - radarDistance = 0, - repairable = false, - selfDestructAs = "FUSIONPOP", - sightDistance = 367, - smoothAnim = true, - unitname = "euwfusion2", - workerTime = 0, - yardMap = "oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo", - -- useBuildingGroundDecal = true, - -- BuildingGroundDecalType = "powergrounddecal.png", - -- BuildingGroundDecalSizeX = 50, - -- BuildingGroundDecalSizeY = 50, - -- BuildingGroundDecalDecaySpeed = 0.9, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:bubbles", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdenergy", - }, - }, - weapons = { - [1] = { - def = "fusionfx", - }, - }, - customParams = { - iseco = 1, - death_sounds = "generic", - ProvideTech = "10 Power", - ProvideTechRange = "800", - armortype = "BUILDING", - supply_granted = 30, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - 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 = 800, -- optional - groundtexselectzsize = 800, -- optional - }, - useBuildingGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 10, - BuildingGroundDecalSizeY = 10, - BuildingGroundDecalDecaySpeed = 0.9, -} - --------------------------------------------------------------------------------- - -local weaponDefs = { - fusionfx = { - - AreaOfEffect = 5, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - rgbColor = "0 0 1", - rgbColor2 = "0.5 0.5 0.5", - coreThickness = 0.1, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:bubbles", - fallOffRate = 0.5, - minintensity = 1, - impulseFactor = 0, - largeBeamLaser = true, - - name = "fake", - noSelfDamage = true, - range = 650, - reloadtime = 0.1, - WeaponType = "BeamLaser", - - soundTrigger = true, - startVelocity = 1500, - targetMoveError = 0.3, - thickness = 1, - turret = true, - weaponVelocity = 1500, - damage = { - default = 1E-06, - }, - }, -} -unitDef.weaponDefs = weaponDefs - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/water/euwmetalextractor.lua b/Units/ebuilding/water/euwmetalextractor.lua deleted file mode 100644 index 440246184..000000000 --- a/Units/ebuilding/water/euwmetalextractor.lua +++ /dev/null @@ -1,129 +0,0 @@ --- UNITDEF -- EUWMETALEXTRACTOR -- --------------------------------------------------------------------------------- - -local unitName = "euwmetalextractor" - --------------------------------------------------------------------------------- - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = "Extracts Metal", - energyStorage = 0, - energyUse = 0, - explodeAs = "SMALL_BUILDING", - extractsMetal = 0.0000001, - makesMetal = 0, - footprintX = 6, - footprintZ = 6, - iconType = "eco", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 1000, - maxSlope = 60, - minWaterDepth = 20, - maxWaterDepth = 10000, - metalStorage = 0, - metalMake = 0, - name = "Underwater Metal Extractor", - objectName = "euwmetalextractor.s3o", - onoffable = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "SMALL_BUILDING", - selfDestructCountdown = 1, - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = "euwmetalextractor", - workerTime = 0, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:bubbles", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdmex", - }, - }, - weapons = { - [1] = { - def = "fusionfx", - }, - }, - customParams = { - iseco = 1, - death_sounds = "generic", - armortype = "BUILDING", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, - useBuildingGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - fusionfx = { - - AreaOfEffect = 5, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - rgbColor = "0 0 1", - rgbColor2 = "0.5 0.5 0.5", - coreThickness = 0.3, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:bubbles", - fallOffRate = 0.5, - minintensity = 1, - impulseFactor = 0, - largeBeamLaser = true, - - name = "fake", - noSelfDamage = true, - range = 650, - reloadtime = 0.1, - WeaponType = "BeamLaser", - - soundTrigger = true, - startVelocity = 1500, - targetMoveError = 0.3, - thickness = 1, - turret = true, - weaponVelocity = 1500, - damage = { - default = 1E-06, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/water/euwsolar2.lua b/Units/ebuilding/water/euwsolar2.lua deleted file mode 100644 index 2401ca97f..000000000 --- a/Units/ebuilding/water/euwsolar2.lua +++ /dev/null @@ -1,143 +0,0 @@ --- UNITDEF -- EUWSOLAR2 -- --------------------------------------------------------------------------------- - -local unitName = "euwsolar2" - --------------------------------------------------------------------------------- - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - damageModifier = 0.33333, - description = [[Produces +1 Energy - Provides +1 Energy - Provides +5 Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = -1, - explodeAs = "SMALL_BUILDING", - footprintX = 4, - footprintZ = 4, - icontype = "energy", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 800, - maxSlope = 60, - minWaterDepth = 20, - maxWaterDepth = 10000, - metalStorage = 0, - name = "Underwater Basic Generator", - objectName = "esolar2.s3o", - onoffable = false, - radarDistance = 0, - repairable = false, - selfDestructAs = "SMALL_BUILDING", - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = "euwsolar2", - yardMap = "oooo oooo oooo oooo", - -- useBuildingGroundDecal = true, - -- BuildingGroundDecalType = "powergrounddecal.png", - -- BuildingGroundDecalSizeX = 40, - -- BuildingGroundDecalSizeY = 40, - -- BuildingGroundDecalDecaySpeed = 0.9, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:bubbles", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdenergy", - }, - }, - weapons = { - [1] = { - def = "fusionfx", - }, - }, - customParams = { - iseco = 1, - death_sounds = "generic", - ProvideTech = "1 Power", - ProvideTechRange = "400", - armortype = "BUILDING", - supply_granted = 5, - normaltex = "unittextures/esolar2normal.png", - 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 = 400, -- optional - groundtexselectzsize = 400, -- optional - }, - useBuildingGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 6, - BuildingGroundDecalSizeY = 6, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - fusionfx = { - - AreaOfEffect = 5, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - rgbColor = "0 0 1", - rgbColor2 = "0.5 0.5 0.5", - coreThickness = 0.1, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:bubbles", - fallOffRate = 0.5, - minintensity = 1, - impulseFactor = 0, - largeBeamLaser = true, - - name = "fake", - noSelfDamage = true, - range = 650, - reloadtime = 0.1, - WeaponType = "BeamLaser", - - soundTrigger = true, - startVelocity = 1500, - targetMoveError = 0.3, - thickness = 1, - turret = true, - weaponVelocity = 1500, - damage = { - default = 1E-06, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/water/euwstorage.lua b/Units/ebuilding/water/euwstorage.lua deleted file mode 100644 index 941cbe3cf..000000000 --- a/Units/ebuilding/water/euwstorage.lua +++ /dev/null @@ -1,121 +0,0 @@ --- UNITDEF -- EUWSTORAGE -- --------------------------------------------------------------------------------- - -local unitName = "euwstorage" - --------------------------------------------------------------------------------- - -local unitDef = { - activateWhenBuilt = true, - buildAngle = 8196, - buildCostEnergy = 0, - buildCostMetal = 20, - builder = false, - buildTime = 5, - category = "BUILDING NOTAIR ECO", - corpse = "ammobox", - description = "Resource Storage - Stores 50m/50e", - energyStorage = 50, - energyUse = 0, - explodeAs = "ESTOR_BUILDING", - footprintX = 6, - footprintZ = 6, - idleAutoHeal = .5, - idleTime = 2200, - icontype = "eco", - maxDamage = 1200, - maxSlope = 60, - minWaterDepth = 40, - maxWaterDepth = 10000, - metalStorage = 50, - name = "Underwater Storage", - objectName = "estorage.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "ESTOR_BUILDING", - side = "CORE", - sightDistance = 367, - smoothAnim = true, - unitname = "euwstorage", - workerTime = 0, - yardMap = "oooooo oooooo oooooo oooooo oooooo oooooo", - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - explosiongenerators = { - "custom:bubbles", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdenergy", - }, - }, - weapons = { - [1] = { - def = "fusionfx", - }, - }, - customParams = { - iseco = 1, - death_sounds = "generic", - armortype = "BUILDING", - normaltex = "unittextures/estoragenormal.png", - }, - useBuildingGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 8, - BuildingGroundDecalSizeY = 8, - BuildingGroundDecalDecaySpeed = 0.9, -} - - --------------------------------------------------------------------------------- - -local weaponDefs = { - fusionfx = { - - AreaOfEffect = 5, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - rgbColor = "0 0 1", - rgbColor2 = "0.5 0.5 0.5", - coreThickness = 0.1, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:bubbles", - fallOffRate = 0.5, - minintensity = 1, - impulseFactor = 0, - largeBeamLaser = true, - - name = "fake", - noSelfDamage = true, - range = 650, - reloadtime = 0.1, - WeaponType = "BeamLaser", - - soundTrigger = true, - startVelocity = 1500, - targetMoveError = 0.3, - thickness = 1, - turret = true, - weaponVelocity = 1500, - damage = { - default = 1E-06, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ebuilding/water/euwturret.lua b/Units/ebuilding/water/euwturret.lua deleted file mode 100644 index 4245073d6..000000000 --- a/Units/ebuilding/water/euwturret.lua +++ /dev/null @@ -1,165 +0,0 @@ --- UNITDEF -- EUWTURRET -- --------------------------------------------------------------------------------- - -local unitName = "euwturret" - --------------------------------------------------------------------------------- - -local armortype = [[building]] -local supply = [[4]] - -local weapon1Damage = 120 -local weapon1AOE = 10 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - buildAngle = 2048, - buildCostEnergy = 0, - buildCostMetal = 40, - builder = false, - buildTime = 5, - canAttack = true, - canstop = "1", - category = "BUILDING NOTAIR", - collisionVolumeTest = "1", - corpse = "ammobox", - description = [[Anti-Amphibious Defense Platform -Armortype: ]] ..armortype.. [[ - -120 Damage vs Light/Armored -12 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumBuildingExplosionGenericGreen", - floater = true, - footprintX = 4, - footprintZ = 4, - idleAutoHeal = .5, - idleTime = 2200, - iconType = "defense", - maxDamage = 750, - maxSlope = 60, - minWaterDepth = 20, - metalStorage = 0, - name = "Rooter", - objectName = "euwturret.s3o", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumBuildingExplosionGenericGreen", - side = "CORE", - sightDistance = 250, --- SonarDistance = 600, - smoothAnim = true, - unitname = "euwturret", - workerTime = 0, - yardMap = "oooo oooo oooo oooo", - - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:electricity", - "custom:needspower", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "turretselect", - }, - }, - weapons = { - [1] = { - def = "euwturretmissile", - onlyTargetCategory = "LIGHT ARMORED", - -- MainDir = [[0 -1 0]], - -- MaxAngleDif = 180, - }, - }, - customParams = { - needed_cover = 2, - supply_cost = supply, - death_sounds = "generic", - -- twokhotkey = 't', - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, - buildingGroundDecalDecaySpeed =30, - buildingGroundDecalSizeX =6, - buildingGroundDecalSizeY =6, - useBuildingGroundDecal = false, - buildingGroundDecalType =[[elightturret2_aoplane.dds]], -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - euwturretmissile = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - cegTag = "torpedotrailuwturret", - collideFriendly = false, - collideFeature = false, - explosionGenerator = "custom:torpedoexplosion", - energypershot = energycosttofire, - fireStarter = 80, - impulseFactor = 0.1, - interceptedByShieldType = 4, - model = "missilesmall.s3o", - name = "Underwater Torpedo", - range = 600, - reloadtime = 1, - weaponType = "TorpedoLauncher", - soundHit = "torpedolaunch.wav", - soundStart = "subhit.wav", - tolerance = 3000, - turret = true, - startVelocity = 200, - acceleration = 2000, - weaponVelocity = 10000, - tracks = true, - turnrate = 100000, - flighttime = 8, - sprayangle = 5000, - waterweapon = true, - - customparams = { - damagetype = "euwturret", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ecommander.lua b/Units/ecommander.lua index d00421f78..8c75f03e6 100644 --- a/Units/ecommander.lua +++ b/Units/ecommander.lua @@ -6,7 +6,11 @@ local unitName = "ecommander" -------------------------------------------------------------------------------- local armortype = [[light]] -local supplyGiven = [[10]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + + local unitDef = { @@ -18,44 +22,38 @@ local unitDef = { acceleration = 0.2, brakeRate = 1, buildCostEnergy = 0, - buildCostMetal = 500, - buildDistance = 1000, + buildCostMetal = 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, - cancollect = "1", + canRestore = false, + canGuard = true, canMove = true, canPatrol = true, - canreclaim = false, + canreclaim = true, canstop = true, category = "NOTAIR SUPPORT LIGHT", - description = [[Unit Type: Command Unit -Armortype: ]] ..armortype.. [[ - -1000 EMP Damage vs Light/Armored/Building - -Gives ]] ..supplyGiven.. [[ Supply - -There can only be one!]], + description = [[Builds Units]], energyMake = 0, energyStorage = 0, energyUse = 0, explodeAs = "commnuke", - fireState = "1", footprintX = 4, footprintZ = 4, - hideDamage = true, + iconType = "commander", idleAutoHeal = .5, idleTime = 2200, levelground = true, - maxDamage = 5000, + maxDamage = 2000, maxSlope = 180, maxVelocity = 3, maxReverseVelocity = 1, @@ -66,13 +64,13 @@ There can only be one!]], moveState = "0", 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", showPlayerName = true, - showNanoSpray = false, + showNanoSpray = true, sightDistance = 500, smoothAnim = true, stealth = true, @@ -80,14 +78,12 @@ There can only be one!]], turnInPlace = true, turnRate = 5000, unitname = unitName, - unitRestricted = 1, 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", @@ -96,37 +92,15 @@ There can only be one!]], explosiongenerators = { "custom:nanoorb", - "custom:dirt", + "custom:emptydirt", "custom:blacksmoke", + "custom:gdhcannon", }, }, - buildoptions = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", --new - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - }, + buildoptions = Shared.buildList, sounds = { - underattack = "unitsunderattack1", + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", ok = { "ack", }, @@ -136,61 +110,72 @@ There can only be one!]], }, weapons = { [1] = { - def = "emp", + 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", - cancollect = "1", + armortype = armortype, nofriendlyfire = "1", normaltex = "unittextures/lego2skin_explorernormal.dds", buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], + factionname = "ateran", }, } -------------------------------------------------------------------------------- local weaponDefs = { - emp = { - AreaOfEffect = 500, + + machinegun = { + AreaOfEffect = 50, avoidFriendly = false, avoidFeature = false, collideFriendly = false, collideFeature = false, - explosionGenerator = "custom:genericshellexplosion-large-blue-emp", - tolerance = 1000, + + coreThickness = 0.5, + duration = 0.2, + explosionGenerator = "custom:genericshellexplosion-small", energypershot = 0, - explosionScar = false, - impulseFactor = 0, - name = "Emp Blast Weapon", - noSelfDamage = true, - paralyzer = true, - paralyzetime = 5, - range = 500, - reloadtime = 10, - weaponType = "Cannon", - soundhit = "emp.wav", - size = 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 = 10000, + weaponVelocity = 1500, customparams = { - damagetype = "default", - nofriendlyfire = 1, - - --Upgrades-- - upgradeClass = "groundweapons", - }, + damagetype = "light", + nocosttofire = true, + }, damage = { - default = 1000, + default = 200, }, }, + commnuke = { AreaOfEffect = 500, avoidFriendly = false, @@ -221,8 +206,8 @@ local weaponDefs = { smokeTrail = false, - soundHit = "explosion_enormous.wav", - soundStart = "nukelaunch.wav", + soundHit = "explosions/explosion_enormous.wav", + soundStart = "weapons/nukelaunch.wav", -- stockpile = true, -- stockpileTime = stockpiletime, @@ -236,8 +221,9 @@ local weaponDefs = { weaponType = "StarburstLauncher", weaponVelocity = 1000, customparams = { - damagetype = "default", + damagetype = "light", death_sounds = "nuke", + nocosttofire = true, }, damage = { default = 1000, diff --git a/Units/ecommanderbattle.lua b/Units/ecommanderbattle.lua new file mode 100644 index 000000000..c920721fe --- /dev/null +++ b/Units/ecommanderbattle.lua @@ -0,0 +1,423 @@ +-- UNITDEF -- ECOMMANDERBATTLE -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderbattle" + +-------------------------------------------------------------------------------- + +local armortype = [[armored]] +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 weapon2Damage = 75 +local weapon2AOE = 25 +local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) + + +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 ARMORED", + description = [[Experimental Assault Overseer]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + + iconType = "commander", + autoHeal = 0.5, + idleAutoHeal = 50, + idleTime = 300, + levelground = true, + maxDamage = 15000, + maxSlope = 180, + maxVelocity = 3, + maxReverseVelocity = 1, + maxWaterDepth = 5000, + metalmake = 0, + metalStorage = 0, + movementClass = "COMMANDERTANK4", + moveState = "0", + name = "The Battle 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 = 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", + "custom:electricity", + }, + }, + --buildoptions = Shared.buildList, + sounds = { + build = "miscfx/buildstart.wav", + underattack = "other/unitsunderattack1", + ok = { + "ack", + }, + select = { + "unitselect", + }, + }, + weapons = { + -- [1] = { + -- def = "riottankempweapon", + -- }, + [1] = { + def = "heavybeamweapon", + badTargetCategory = "BUILDING WALL", + }, + }, + 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 = 2, + 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 = 20, + 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, + }, + }, + machinegun = { + accuracy = 300, + AreaOfEffect = weapon2AOE, + avoidFriendly = false, + avoidFeature = false, + collideFriendly = false, + collideFeature = false, + beamTime = 0.1, + + coreThickness = 0.5, + duration = 0.1, + explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", + energypershot = energycosttofire2, + fallOffRate = 0, + fireStarter = 50, + interceptedByShieldType = 4, + impulsefactor = 0, + + minintensity = "1", + name = "Machine Gun", + range = 650, + reloadtime = 0.1, + WeaponType = "LaserCannon", + rgbColor = "1 0.5 0", + rgbColor2 = "1 1 1", + soundTrigger = true, + soundstart = "weapons/tankdestroyerfire.wav", + texture1 = "shot", + texture2 = "empty", + thickness = 5, + tolerance = 1000, + turret = true, + weaponVelocity = 1000, + customparams = { + damagetype = "antiarmored", + + nocosttofire = true, + }, + damage = { + 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 +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ecommanderbuild.lua b/Units/ecommanderbuild.lua new file mode 100644 index 000000000..533e94fc3 --- /dev/null +++ b/Units/ecommanderbuild.lua @@ -0,0 +1,332 @@ +-- UNITDEF -- ECOMMANDERBUILD -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderbuild" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 600, + 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 = [[Builds Units x8 as fast]], + 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 Builder 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 = 8, + 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", + "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", + helptext = [[Armortype: ]] ..armortype.. [[ +x3 Buildpower + +1000 EMP Damage vs Light/Armored/Building + +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, + 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/ecommandercloak.lua b/Units/ecommandercloak.lua new file mode 100644 index 000000000..8ebf3556e --- /dev/null +++ b/Units/ecommandercloak.lua @@ -0,0 +1,297 @@ +-- UNITDEF -- ECOMMANDERCLOAK -- +-------------------------------------------------------------------------------- + +local unitName = "ecommandercloak" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[0]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +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 Massive Cloak Field]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + + 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 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/ecommanderfactory.lua b/Units/ecommanderfactory.lua new file mode 100644 index 000000000..394559e95 --- /dev/null +++ b/Units/ecommanderfactory.lua @@ -0,0 +1,326 @@ +-- UNITDEF -- ECOMMANDERFACTORY -- +-------------------------------------------------------------------------------- + +local unitName = "ecommanderfactory" + +-------------------------------------------------------------------------------- + +local armortype = [[light]] +local supplyGiven = [[15]] +local techprovided = [[tech0, -overseer]] +local techrequired = [[0 overseer]] + +local weapon1Damage = 15 +local weapon1AOE = 25 +local energycosttofire1 = 0 --weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) + + +local unitDef = { + + --mobileunit + transportbyenemy = false; + + --** + + acceleration = 0.2, + brakeRate = 1, + buildCostEnergy = 0, + buildCostMetal = 1000, + buildDistance = 250, + 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 = [[Creates buildings and mobile units • Gives ]] ..supplyGiven.. [[ Supply]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + + 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 Factory 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 = 8, + 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", + "custom:gdhcannon", + }, + }, + buildoptions = Shared.buildListeCommanderFactory, + 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, + }, + }, + + 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/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 new file mode 100644 index 000000000..48dee7a5c --- /dev/null +++ b/Units/ecommandershield.lua @@ -0,0 +1,325 @@ +-- UNITDEF -- ECOMMANDERSHIELD -- +-------------------------------------------------------------------------------- + +local unitName = "ecommandershield" + +-------------------------------------------------------------------------------- + +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 = 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 large shielding • Self-Heals out of combat 40hp/s when idle]], + energyMake = 0, + energyStorage = 0, + energyUse = 0, + explodeAs = "commnuke", + footprintX = 4, + footprintZ = 4, + + iconType = "commander", + idleAutoHeal = 40, + idleTime = 5, + levelground = true, + maxDamage = 8000, + 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/eexperimental/eexkrabgroth.lua b/Units/eexperimental/eexkrabgroth.lua deleted file mode 100644 index 1b16e491d..000000000 --- a/Units/eexperimental/eexkrabgroth.lua +++ /dev/null @@ -1,247 +0,0 @@ --- UNITDEF -- EEXKRABGOTH -- --------------------------------------------------------------------------------- - -local unitName = "eexkrabgroth" - --------------------------------------------------------------------------------- - -local power = [[25 power]] -local armortype = [[armored]] -local supply = [[25]] - -local weapon1Damage = 600 -local weapon1AOE = 10 -local weapon2Damage = 600 -local weapon2AOE = 10 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 450, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - cantBeTransported = true, - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - description =[[Unit Type: Endbringer Class Base Assault Walker -Armortype: ]] ..armortype.. [[ - -Primary Laser: -600 Damage/s vs Building -60 Damage/s vs Light/Armored - -Secondary Cannons: -80 Damage vs Building -8 Damage vs Light/Armored - -This unit can only attack buildings! - -Energy cost to fire Primary Laser: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Secondary Cannons: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "krabblast", - firestandorders = "1", - footprintX = 12, - footprintZ = 12, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 15000, - maxVelocity = 2.5, - maxReverseVelocity = 1, - maxWaterDepth = 80, - metalStorage = 0, - movementClass = "EXPERIMENTALTANK12", - name = "Anarchid", - noChaseCategory = "VTOL", - objectName = "ekrabgroth.s3o", - pushResistant = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "krabblast", - shootme = "1", - sightDistance = 1000, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "eexkrabgroth", - unitnumber = "110", - upright = false, - -- usePieceCollisionVolumes = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirtsmall", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavybeamweapon", - onlyTargetCategory = "BUILDING", - }, - [2] = { - def = "concussioncannon", - onlyTargetCategory = "BUILDING", - }, - [3] = { - def = "concussioncannon", - onlyTargetCategory = "BUILDING", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - heavybeamweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 1, - - cameraShake = 1, - coreThickness = 0.5, - -- cegTag = "mediumcannonweapon3", - -- duration = 0.2, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 50, - impulseFactor = 0, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Laser", - range = 1000, - reloadtime = 1, - WeaponType = "BeamLaser", - rgbColor = "1 0 1", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "krabprimary.wav", - -- soundHit = "mediumcannonhit.wav", - -- sweepfire = true, - texture1 = "shot", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 800, - customparams = { - damagetype = "eexkrabgroth", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - concussioncannon = { - accuracy = 1, - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - - collideFriendly = false, - collideFeature = false, - cylinderTargeting = true, - burnblow = true, - - explosionGenerator = "custom:genericshellexplosion-medium", - energypershot = energycosttofire2, - fireStarter = 80, - id = 1, - impulseFactor = 0.1, - interceptedByShieldType = 4, - name = "Concussion Cannon", - - range = 1000, - reloadtime = 1, - weaponType = "Cannon", - soundHit = "explode2", - soundStart = "krabsecondary.wav", - - tolerance = 500, - turret = true, - weaponVelocity = 5000, - customparams = { - damagetype = "eexkrabgroth", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- - diff --git a/Units/eexperimental/eexnukearty.lua b/Units/eexperimental/eexnukearty.lua deleted file mode 100644 index 015efae5e..000000000 --- a/Units/eexperimental/eexnukearty.lua +++ /dev/null @@ -1,174 +0,0 @@ --- UNITDEF -- EEXNUKEARTY -- --------------------------------------------------------------------------------- - -local unitName = "eexnukearty" - --------------------------------------------------------------------------------- - -local power = [[40 power]] -local armortype = [[armored]] -local supply = [[40]] - -local weapon1Damage = 500 -local weapon1AOE = 500 -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 = 0.18, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 750, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SUPPORT", - corpse = "ammobox", - description = [[Unit Type: Endbringer Class Low Yeild Nuclear Saturation Artillery -Armortype: ]] ..armortype.. [[ - -500 Damage vs Building -250 Damage vs Light/Armored - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "BIG_UNIT", - footprintX = 9, - footprintZ = 9, - fireState = 0, - highTrajectory = 1, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 10000, - maxVelocity = 2.3, - maxReverseVelocity = 1, - maxWaterDepth = 20, - metalStorage = 0, - movementClass = "HOVERTANKEXPERIMENTAL9", - name = "Lacerator", - noChaseCategory = "VTOL", - objectName = "eexnukearty.s3o", - pushResistant = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "BIG_UNIT", - side = "CORE", - sightDistance = 500, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "eexnukearty", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "nukeartyweapon", - onlyTargetCategory = "NOTAIR AMPHIB", - badTargetCategory = "LIGHT ARMORED WALL", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - nukeartyweapon = { - - accuracy = 1000, - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "nukeartyshot", - explosionGenerator = "custom:nukeartyexpl", - edgeEffectiveness = 0.1, - energypershot = energycosttofire, - id = 172, - impulseFactor = 0, - interceptedByShieldType = 4, - name = "Light Cannon", - range = 3000, - reloadtime = 0.5, - weaponType = "Cannon", - soundHit = "nukeartyhit.wav", - soundStart = "nukeartyshot.wav", - - tolerance = 2000, - turret = true, - weaponVelocity = 800, - customparams = { - damagetype = "eexnukearty", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eexperimental/eexperimentalfac.lua b/Units/eexperimental/eexperimentalfac.lua deleted file mode 100644 index 1793fc123..000000000 --- a/Units/eexperimental/eexperimentalfac.lua +++ /dev/null @@ -1,105 +0,0 @@ --- UNITDEF -- EEXPERIMENTALFAC -- --------------------------------------------------------------------------------- - -local unitName = "eexperimentalfac" - --------------------------------------------------------------------------------- - -local armortype = [[building]] - -local unitDef = { - - activatewhenbuilt = false, - buildAngle = 1024, - buildCostEnergy = 0, - buildCostMetal = 250, - builder = true, - buildTime = 2.5, - canBeAssisted = true, - canGuard = true, - canMove = true, - canPatrol = true, - canReclaim = false, - canstop = true, - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Place generators near this factory to unlock higher tier units -Armortype: ]] ..armortype, - energyStorage = 0, - energyUse = 0, - energyMake = 0, - explodeAs = "MEXPOP2", - footprintX = 34, - footprintZ = 34, - iconType = "factory", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 5000, - maxSlope = 25, - maxWaterDepth = 0, - metalStorage = 0, - metalMake = 0, - name = "Endbringer Class Factory", - objectName = "eexperimentalfac.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - showNanoSpray = "0", - side = "CORE", - sightDistance = 388, - smoothAnim = true, - TEDClass = "PLANT", - unitname = "eexperimentalfac", - unitrestricted = 1, - workerTime = 1, - yardMap = "ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo ooooooooooccccccccccccccoooooooooo", - -- usePieceCollisionVolumes = true, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 36, - BuildingGroundDecalSizeY = 36, - BuildingGroundDecalDecaySpeed = 0.9, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanohuge", - "custom:blacksmoke", - }, - }, - buildoptions = { - "eextankdestroyer", --new - "eexkrabgroth", --new - "eexnukearty" --new - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdfactoryselect", - }, - }, - customParams = { - death_sounds = "nuke", - armortype = armortype, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - -- ProvideTech = "1 Powergrid", - -- ProvideTechRange = "1500", - -- groundtexselectimg = ":nc:bitmaps/power/powergrid.png", - -- groundtexselectxsize = 1500, -- optional - -- groundtexselectzsize = 1500, -- optional - }, -} - - - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/eexperimental/eextankdestroyer.lua b/Units/eexperimental/eextankdestroyer.lua deleted file mode 100644 index 79a499c01..000000000 --- a/Units/eexperimental/eextankdestroyer.lua +++ /dev/null @@ -1,239 +0,0 @@ --- UNITDEF -- EEXTANKDESTROYER -- --------------------------------------------------------------------------------- - -local unitName = "eextankdestroyer" - --------------------------------------------------------------------------------- - -local power = [[30 power]] -local armortype = [[armored]] -local supply = [[30]] - -local weapon1Damage = 500 -local weapon1AOE = 8 -local weapon2Damage = 12 -local weapon2AOE = 8 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 500, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED AMPHIB SKIRMISHER", - corpse = "ammobox", - description = [[Unit Type: Endbringer Class Tank Destroyer -Armortype: ]] ..armortype.. [[ - -Main Cannon: -500 Damage vs Light/Armored -50 Damage vs Building - -Secondary Machinegun: -120 Damage/s vs Light/Armored -12 Damage/s vs Building - -This unit can only attack other mobile units! - -Energy cost to fire Main Cannon: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Secondary Machinegun: ]] .. roundToFirstDecimal(energycosttofire2 * 10) .. [[/s - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "krabblast", - footprintX = 12, - footprintZ = 12, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 12500, - maxSlope = 28, - maxVelocity = 2.8, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalStorage = 0, - movementClass = "EXPERIMENTALTANK10", - name = "Leveler", - noChaseCategory = "VTOL", - objectName = "extankdestroyer.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "krabblast", - side = "CORE", - sightDistance = 750, - stealth = false, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "eextankdestroyer", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "tankkillerlaser", - onlyTargetCategory = "LIGHT ARMORED", - }, - [2] = { - def = "machinegun", - onlyTargetCategory = "LIGHT ARMORED", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = "30 Power", - armortype = "armored", - supply_cost = 30, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - tankkillerlaser = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - duration = 0.2, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-large-purple", - fallOffRate = 1, - fireStarter = 100, - interceptedByShieldType = 4, - impulseFactor = 0.1, - - minintensity = "1", - name = "Anti-Tank Laser", - range = 750, - reloadtime = 0.5, - WeaponType = "LaserCannon", - rgbColor = "0.2 0 0.5", - rgbColor2 = "0.8 0.8 0.8", - soundTrigger = true, - soundstart = "tankdestroyermaingunfire.wav", - texture1 = "pulseshot2", - texture2 = "empty", - thickness = 9, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eextankdestroyer", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - machinegun = { - accuracy = 300, - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - beamTime = 0.1, - - coreThickness = 0.5, - duration = 0.1, - energypershot = 0.6, - explosionGenerator = "custom:genericshellexplosion-large-sparks-burn", - energypershot = energycosttofire2, - fallOffRate = 1, - fireStarter = 50, - interceptedByShieldType = 4, - - minintensity = "1", - name = "Machine Gun", - range = 750, - reloadtime = 0.1, - WeaponType = "LaserCannon", - rgbColor = "1 0.5 0", - rgbColor2 = "1 1 1", - soundTrigger = true, - soundstart = "tankdestroyerfire.wav", - texture1 = "shot", - texture2 = "empty", - thickness = 5, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eextankdestroyer", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehbot/ehbotpeewee.lua b/Units/ehbot/ehbotpeewee.lua deleted file mode 100644 index 583e06fb7..000000000 --- a/Units/ehbot/ehbotpeewee.lua +++ /dev/null @@ -1,170 +0,0 @@ --- UNITDEF -- ehbotpeewee -- --------------------------------------------------------------------------------- - -local unitName = "ehbotpeewee" - --------------------------------------------------------------------------------- - -local power = [[6 power]] -local armortype = [[light]] -local supply = [[3]] - -local weapon1Damage = 5 -local weapon1AOE = 1 -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 = 27, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - corpse = "ammobox", - description = [[Unit Type: Raider -Armortype: ]] ..armortype.. [[ - -45 Damage vs Light/Armored -60 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGenericBlue", - footprintX = 3, - footprintZ = 3, - iconType = "raider", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 200, - maxSlope = 26, - maxVelocity = 10, - maxReverseVelocity = 2, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERHBOT3", - name = "PeeWee", - noChaseCategory = "VTOL", - objectName = "ehbotpeewee2.s3o", - script = "ehbotpeewee_lus.lua", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGenericBlue", - side = "CORE", - sightDistance = 600, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 5.5, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 475, - unitname = "ehbotpeewee", - upright = true, - workerTime = 0, - - sfxtypes = { - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - "custom:airfactoryhtrail", - }, - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - }, - - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "flashweapon", --- mainDir = "0 0 1", -- x:0 y:0 z:1 => that's forward! --- maxAngleDif = 70, - badTargetCategory = "VTOL ARMORED WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - flashweapon = { - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - collideFriendly = false, - rgbColor = "0.8 0.5 0", - rgbColor2 = "0.5 0.5 0.5", - explosionGenerator = "custom:genericshellexplosion-medium-sparks-burn", - energypershot = energycosttofire, - name = "E.M.G.", - range = 600, - reloadtime = 0.1, - weaponType = "Cannon", - soundStart = "tgunshipfire.wav", - soundTrigger = true, - sprayAngle = 0, - tolerance = 1000, - turret = true, - weaponTimer = 1, - weaponVelocity = 1200, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehbot/mobile/ehbotfac.lua b/Units/ehbot/mobile/ehbotfac.lua new file mode 100644 index 000000000..535de8b8e --- /dev/null +++ b/Units/ehbot/mobile/ehbotfac.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- EHBOTFAC -- +-------------------------------------------------------------------------------- + +unitName = "ehbotfac" + +-------------------------------------------------------------------------------- + +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 + +humanName = [[H-Bot Factory]] + +objectName = "ehbotfac.s3o" +script = "ehbotfac.cob" + +hbotFactoryBuildList = Shared.buildListHbotFactory + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotfac_up1.lua b/Units/ehbot/mobile/ehbotfac_up1.lua new file mode 100644 index 000000000..ae47d6e66 --- /dev/null +++ b/Units/ehbot/mobile/ehbotfac_up1.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- EHBOTFAC_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotfac_up1" + +-------------------------------------------------------------------------------- + +buildCostMetal = 270 +maxDamage = buildCostMetal * 12.5 + +humanName = [[H-Bot Factory MK II]] + +objectName = "ehbotfac.s3o" +script = "ehbotfac.cob" + +hbotFactoryBuildList = Shared.buildListHbotFactory_up1 + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotfac_up2.lua b/Units/ehbot/mobile/ehbotfac_up2.lua new file mode 100644 index 000000000..7b1c1cc9b --- /dev/null +++ b/Units/ehbot/mobile/ehbotfac_up2.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- EHBOTFAC_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotfac_up2" + +-------------------------------------------------------------------------------- + +buildCostMetal = 510 +maxDamage = buildCostMetal * 12.5 + +humanName = [[H-Bot Factory MK III]] + +objectName = "ehbotfac.s3o" +script = "ehbotfac.cob" + +hbotFactoryBuildList = Shared.buildListHbotFactory_up2 + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotfac_up3.lua b/Units/ehbot/mobile/ehbotfac_up3.lua new file mode 100644 index 000000000..102f37c90 --- /dev/null +++ b/Units/ehbot/mobile/ehbotfac_up3.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- EHBOTFAC_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotfac_up3" + +-------------------------------------------------------------------------------- + +buildCostMetal = 750 +maxDamage = buildCostMetal * 12.5 + +humanName = [[H-Bot Factory MK IV]] + +objectName = "ehbotfac.s3o" +script = "ehbotfac.cob" + +hbotFactoryBuildList = Shared.buildListHbotFactory_up3 + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotfac_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotkarganneth.lua b/Units/ehbot/mobile/ehbotkarganneth.lua new file mode 100644 index 000000000..28d49450b --- /dev/null +++ b/Units/ehbot/mobile/ehbotkarganneth.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth -- +-------------------------------------------------------------------------------- + +unitName = "ehbotkarganneth" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Karganneth]] + +objectName = "ehbotkarganneth.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/ehbot/mobile/ehbotkarganneth_up1.lua b/Units/ehbot/mobile/ehbotkarganneth_up1.lua new file mode 100644 index 000000000..c38a6e3fa --- /dev/null +++ b/Units/ehbot/mobile/ehbotkarganneth_up1.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotkarganneth_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Karganneth MK II]] + +objectName = "ehbotkarganneth.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/ehbot/mobile/ehbotkarganneth_up2.lua b/Units/ehbot/mobile/ehbotkarganneth_up2.lua new file mode 100644 index 000000000..364948b8c --- /dev/null +++ b/Units/ehbot/mobile/ehbotkarganneth_up2.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotkarganneth_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Karganneth MK III]] + +objectName = "ehbotkarganneth.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/ehbot/mobile/ehbotkarganneth_up3.lua b/Units/ehbot/mobile/ehbotkarganneth_up3.lua new file mode 100644 index 000000000..2b2a2a54b --- /dev/null +++ b/Units/ehbot/mobile/ehbotkarganneth_up3.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotkarganneth_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Karganneth MK IV]] + +objectName = "ehbotkarganneth.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/ehbot/mobile/ehbotpeewee.lua b/Units/ehbot/mobile/ehbotpeewee.lua new file mode 100644 index 000000000..98df1b864 --- /dev/null +++ b/Units/ehbot/mobile/ehbotpeewee.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee -- +-------------------------------------------------------------------------------- + +unitName = "ehbotpeewee" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[A.K.]] + +objectName = "ehbotpeewee2.s3o" +script = "ehbotpeewee_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotpeewee_up1.lua b/Units/ehbot/mobile/ehbotpeewee_up1.lua new file mode 100644 index 000000000..ce06e4129 --- /dev/null +++ b/Units/ehbot/mobile/ehbotpeewee_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotpeewee_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[A.K. MK II]] + +objectName = "ehbotpeewee2.s3o" +script = "ehbotpeewee_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotpeewee_up2.lua b/Units/ehbot/mobile/ehbotpeewee_up2.lua new file mode 100644 index 000000000..22bad81a7 --- /dev/null +++ b/Units/ehbot/mobile/ehbotpeewee_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotpeewee_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[A.K. MK III]] + +objectName = "ehbotpeewee2.s3o" +script = "ehbotpeewee_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotpeewee_up3.lua b/Units/ehbot/mobile/ehbotpeewee_up3.lua new file mode 100644 index 000000000..f0c448a01 --- /dev/null +++ b/Units/ehbot/mobile/ehbotpeewee_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotpeewee_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[A.K. MK IV]] + +objectName = "ehbotpeewee2.s3o" +script = "ehbotpeewee_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotpeewee_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotrocko.lua b/Units/ehbot/mobile/ehbotrocko.lua new file mode 100644 index 000000000..04a144bb6 --- /dev/null +++ b/Units/ehbot/mobile/ehbotrocko.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud -- +-------------------------------------------------------------------------------- + +unitName = "ehbotrocko" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Rocko]] + +objectName = "ehbotrocko.s3o" +script = "ehbotrocko_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotrocko_up1.lua b/Units/ehbot/mobile/ehbotrocko_up1.lua new file mode 100644 index 000000000..6a113a322 --- /dev/null +++ b/Units/ehbot/mobile/ehbotrocko_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotrocko_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Rocko MKII]] + +objectName = "ehbotrocko.s3o" +script = "ehbotrocko_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotrocko_up2.lua b/Units/ehbot/mobile/ehbotrocko_up2.lua new file mode 100644 index 000000000..ac4994129 --- /dev/null +++ b/Units/ehbot/mobile/ehbotrocko_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotrocko_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Rocko MKIII]] + +objectName = "ehbotrocko.s3o" +script = "ehbotrocko_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotrocko_up3.lua b/Units/ehbot/mobile/ehbotrocko_up3.lua new file mode 100644 index 000000000..04b4ad076 --- /dev/null +++ b/Units/ehbot/mobile/ehbotrocko_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotrocko_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Rocko MK IV]] + +objectName = "ehbotrocko.s3o" +script = "ehbotrocko_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotrocko_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotsniper.lua b/Units/ehbot/mobile/ehbotsniper.lua new file mode 100644 index 000000000..5c7be5ba6 --- /dev/null +++ b/Units/ehbot/mobile/ehbotsniper.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper -- +-------------------------------------------------------------------------------- + +unitName = "ehbotsniper" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Sniper]] + +objectName = "ehbotsniper.s3o" +script = "ehbotsniper_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotsniper_u2.lua b/Units/ehbot/mobile/ehbotsniper_u2.lua new file mode 100644 index 000000000..fb970de2a --- /dev/null +++ b/Units/ehbot/mobile/ehbotsniper_u2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotsniper_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Sniper MK III]] + +objectName = "ehbotsniper.s3o" +script = "ehbotsniper_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotsniper_up1.lua b/Units/ehbot/mobile/ehbotsniper_up1.lua new file mode 100644 index 000000000..236ff6041 --- /dev/null +++ b/Units/ehbot/mobile/ehbotsniper_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotsniper_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Sniper MK II]] + +objectName = "ehbotsniper.s3o" +script = "ehbotsniper_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotsniper_up3.lua b/Units/ehbot/mobile/ehbotsniper_up3.lua new file mode 100644 index 000000000..d43c9f529 --- /dev/null +++ b/Units/ehbot/mobile/ehbotsniper_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotsniper_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Sniper MK IV]] + +objectName = "ehbotsniper.s3o" +script = "ehbotsniper_lus.lua" + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotsniper_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotthud.lua b/Units/ehbot/mobile/ehbotthud.lua new file mode 100644 index 000000000..5aea9389b --- /dev/null +++ b/Units/ehbot/mobile/ehbotthud.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud -- +-------------------------------------------------------------------------------- + +unitName = "ehbotthud" + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Thud]] + +objectName = "ehbotthud.s3o" +script = "ehbotthud_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotthud_up1.lua b/Units/ehbot/mobile/ehbotthud_up1.lua new file mode 100644 index 000000000..74baf8bf7 --- /dev/null +++ b/Units/ehbot/mobile/ehbotthud_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotthud_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Thud MK II]] + +objectName = "ehbotthud.s3o" +script = "ehbotthud_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotthud_up2.lua b/Units/ehbot/mobile/ehbotthud_up2.lua new file mode 100644 index 000000000..e7127fd42 --- /dev/null +++ b/Units/ehbot/mobile/ehbotthud_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotthud_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Thud MK III]] + +objectName = "ehbotthud.s3o" +script = "ehbotthud_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/mobile/ehbotthud_up3.lua b/Units/ehbot/mobile/ehbotthud_up3.lua new file mode 100644 index 000000000..500aa6c68 --- /dev/null +++ b/Units/ehbot/mobile/ehbotthud_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ehbotthud_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Thud MK IV]] + +objectName = "ehbotthud.s3o" +script = "ehbotthud_lus.lua" + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("units-configs-basedefs/basedefs/hbot/mobile/ehbotthud_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotkarganneth_turret.lua b/Units/ehbot/turret/ehbotkarganneth_turret.lua new file mode 100644 index 000000000..e2215360b --- /dev/null +++ b/Units/ehbot/turret/ehbotkarganneth_turret.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotkarganneth_turret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Karganneth (Deployed)]] + +objectName = [[ehbotkarganneth_turret.s3o]] +script = [[ehbotkarganneth_turret_lus.lua]] + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotkarganneth_turret_up1.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up1.lua new file mode 100644 index 000000000..7932345ad --- /dev/null +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up1.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_turret_up1 -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotkarganneth_turret_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Karganneth (Deployed) MK II]] + +objectName = [[ehbotkarganneth_turret.s3o]] +script = [[ehbotkarganneth_turret_lus.lua]] + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotkarganneth_turret_up2.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up2.lua new file mode 100644 index 000000000..9e88bb5c7 --- /dev/null +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up2.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_turret_up2 -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotkarganneth_turret_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Karganneth (Deployed) MK III]] + +objectName = [[ehbotkarganneth_turret.s3o]] +script = [[ehbotkarganneth_turret_lus.lua]] + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotkarganneth_turret_up3.lua b/Units/ehbot/turret/ehbotkarganneth_turret_up3.lua new file mode 100644 index 000000000..413109f39 --- /dev/null +++ b/Units/ehbot/turret/ehbotkarganneth_turret_up3.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- ehbotkarganneth_turret_up3 -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotkarganneth_turret_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Karganneth (Deployed) MK IV]] + +objectName = [[ehbotkarganneth_turret.s3o]] +script = [[ehbotkarganneth_turret_lus.lua]] + +tech = [[tech3]] +armortype = [[armored]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotkarganneth_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotpeewee_turret.lua b/Units/ehbot/turret/ehbotpeewee_turret.lua new file mode 100644 index 000000000..6c1b33433 --- /dev/null +++ b/Units/ehbot/turret/ehbotpeewee_turret.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotpeewee_turret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[A.K. (Deployed)]] + +objectName = [[ehbotpeewee_turret.s3o]] +script = [[ehbotpeewee_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotpeewee_turret_up1.lua b/Units/ehbot/turret/ehbotpeewee_turret_up1.lua new file mode 100644 index 000000000..aad9e5048 --- /dev/null +++ b/Units/ehbot/turret/ehbotpeewee_turret_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotpeewee_turret_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[A.K. Mk II (Deployed)]] + +objectName = [[ehbotpeewee_turret.s3o]] +script = [[ehbotpeewee_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotpeewee_turret_up2.lua b/Units/ehbot/turret/ehbotpeewee_turret_up2.lua new file mode 100644 index 000000000..3a61f66f7 --- /dev/null +++ b/Units/ehbot/turret/ehbotpeewee_turret_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotpeewee_turret_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[A.K. Mk III (Deployed)]] + +objectName = [[ehbotpeewee_turret.s3o]] +script = [[ehbotpeewee_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotpeewee_turret_up3.lua b/Units/ehbot/turret/ehbotpeewee_turret_up3.lua new file mode 100644 index 000000000..246f019fa --- /dev/null +++ b/Units/ehbot/turret/ehbotpeewee_turret_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotpeewee_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotpeewee_turret_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[A.K. Mk IV (Deployed)]] + +objectName = [[ehbotpeewee_turret.s3o]] +script = [[ehbotpeewee_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[6]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotpeewee_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotrocko_turret.lua b/Units/ehbot/turret/ehbotrocko_turret.lua new file mode 100644 index 000000000..b4480dad9 --- /dev/null +++ b/Units/ehbot/turret/ehbotrocko_turret.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotrocko_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotrocko_turret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Rocko (Deployed)]] + +objectName = [[ehbotrocko_turret.s3o]] +script = [[ehbotrocko_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotrocko_turret_up1.lua b/Units/ehbot/turret/ehbotrocko_turret_up1.lua new file mode 100644 index 000000000..394fd42f4 --- /dev/null +++ b/Units/ehbot/turret/ehbotrocko_turret_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotrocko_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotrocko_turret_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Rocko Mk II (Deployed)]] + +objectName = [[ehbotrocko_turret.s3o]] +script = [[ehbotrocko_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotrocko_turret_up2.lua b/Units/ehbot/turret/ehbotrocko_turret_up2.lua new file mode 100644 index 000000000..84c371c7a --- /dev/null +++ b/Units/ehbot/turret/ehbotrocko_turret_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotrocko_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotrocko_turret_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Rocko Mk III (Deployed)]] + +objectName = [[ehbotrocko_turret.s3o]] +script = [[ehbotrocko_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotrocko_turret_up3.lua b/Units/ehbot/turret/ehbotrocko_turret_up3.lua new file mode 100644 index 000000000..30aba9e33 --- /dev/null +++ b/Units/ehbot/turret/ehbotrocko_turret_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotrocko_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotrocko_turret_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Rocko Mk IV (Deployed)]] + +objectName = [[ehbotrocko_turret.s3o]] +script = [[ehbotrocko_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[15]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotrocko_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotsniper_turret.lua b/Units/ehbot/turret/ehbotsniper_turret.lua new file mode 100644 index 000000000..e4b45bc14 --- /dev/null +++ b/Units/ehbot/turret/ehbotsniper_turret.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotsniper_turret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Sniper (Deployed)]] + +objectName = [[ehbotsniper_turret.s3o]] +script = [[ehbotsniper_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotsniper_turret_up1.lua b/Units/ehbot/turret/ehbotsniper_turret_up1.lua new file mode 100644 index 000000000..4daf75d48 --- /dev/null +++ b/Units/ehbot/turret/ehbotsniper_turret_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotsniper_turret_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Sniper Mk II (Deployed)]] + +objectName = [[ehbotsniper_turret.s3o]] +script = [[ehbotsniper_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotsniper_turret_up2.lua b/Units/ehbot/turret/ehbotsniper_turret_up2.lua new file mode 100644 index 000000000..5fb323d85 --- /dev/null +++ b/Units/ehbot/turret/ehbotsniper_turret_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotsniper_turret_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Sniper Mk III (Deployed)]] + +objectName = [[ehbotsniper_turret.s3o]] +script = [[ehbotsniper_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotsniper_turret_up3.lua b/Units/ehbot/turret/ehbotsniper_turret_up3.lua new file mode 100644 index 000000000..ddae46628 --- /dev/null +++ b/Units/ehbot/turret/ehbotsniper_turret_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotsniper_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotsniper_turret_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Sniper Mk IV (Deployed)]] + +objectName = [[ehbotsniper_turret.s3o]] +script = [[ehbotsniper_turret_lus.lua]] + +tech = [[tech2]] +armortype = [[light]] +supply = [[9]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotsniper_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotthud_turret.lua b/Units/ehbot/turret/ehbotthud_turret.lua new file mode 100644 index 000000000..6274895b2 --- /dev/null +++ b/Units/ehbot/turret/ehbotthud_turret.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotthud_turret]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[0]] + +humanName = [[Thud (Deployed)]] + +objectName = [[ehbotthud_turret.s3o]] +script = [[ehbotthud_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotthud_turret_up1.lua b/Units/ehbot/turret/ehbotthud_turret_up1.lua new file mode 100644 index 000000000..ee6207a0c --- /dev/null +++ b/Units/ehbot/turret/ehbotthud_turret_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotthud_turret_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Thud Mk II (Deployed)]] + +objectName = [[ehbotthud_turret.s3o]] +script = [[ehbotthud_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotthud_turret_up2.lua b/Units/ehbot/turret/ehbotthud_turret_up2.lua new file mode 100644 index 000000000..c9068b1a2 --- /dev/null +++ b/Units/ehbot/turret/ehbotthud_turret_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotthud_turret_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Thud Mk III (Deployed)]] + +objectName = [[ehbotthud_turret.s3o]] +script = [[ehbotthud_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbot/turret/ehbotthud_turret_up3.lua b/Units/ehbot/turret/ehbotthud_turret_up3.lua new file mode 100644 index 000000000..a0ff7abba --- /dev/null +++ b/Units/ehbot/turret/ehbotthud_turret_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ehbotthud_turret -- +-------------------------------------------------------------------------------- + +unitName = [[ehbotthud_turret_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Thud Mk IV (Deployed)]] + +objectName = [[ehbotthud_turret.s3o]] +script = [[ehbotthud_turret_lus.lua]] + +tech = [[tech1]] +armortype = [[light]] +supply = [[7]] + +VFS.Include("Units-Configs-Basedefs/basedefs/hbot/turret/ehbotthud_turret_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/ehbotengineer.lua b/Units/ehbotengineer.lua new file mode 100644 index 000000000..1fabe17d4 --- /dev/null +++ b/Units/ehbotengineer.lua @@ -0,0 +1,130 @@ +-- UNITDEF -- EHBOTENGINEER -- +-------------------------------------------------------------------------------- + +local unitName = "ehbotengineer" + +-------------------------------------------------------------------------------- + +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, + 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.buildList, + 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/ehbotengineer_turret.lua b/Units/ehbotengineer_turret.lua new file mode 100644 index 000000000..cbff6d4e9 --- /dev/null +++ b/Units/ehbotengineer_turret.lua @@ -0,0 +1,128 @@ +-- UNITDEF -- EHBOTENGINEER_turret -- +-------------------------------------------------------------------------------- + +local unitName = "ehbotengineer_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, + 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/ehover/eaatank.lua b/Units/ehover/eaatank.lua deleted file mode 100644 index 82267dbb7..000000000 --- a/Units/ehover/eaatank.lua +++ /dev/null @@ -1,196 +0,0 @@ --- UNITDEF -- EAATANK -- --------------------------------------------------------------------------------- - -local unitName = "eaatank" - --------------------------------------------------------------------------------- - -local power = [[5 power]] -local armortype = [[light]] -local supply = [[5]] - -local weapon1Damage = 105 -local weapon1AOE = 50 -local burstProjectiles = 4 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) * burstProjectiles - -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - bmcode = "1", - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 28, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SUPPORT", - corpse = "ammobox", - 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 +]] .. power .. [[ -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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "eaatankantiairmissile", - onlytargetcategory = "VTOL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], -}, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local 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 = "mediumcannonhit.wav", - soundStart = "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/eartytank.lua b/Units/ehover/eartytank.lua index 73e872632..6f312f6e3 100644 --- a/Units/ehover/eartytank.lua +++ b/Units/ehover/eartytank.lua @@ -1,228 +1,24 @@ -- UNITDEF -- EARTYTANK -- -------------------------------------------------------------------------------- -local unitName = "eartytank" +unitName = "eartytank" -------------------------------------------------------------------------------- -local power = [[10 power]] -local armortype = [[light]] -local supply = [[8]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 50 -local weapon2Damage = 20 -local weapon2AOE = 250 +humanName = "ShadowFury" -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +objectName = "eartytank2.s3o" +script = "eartytank2.cob" -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 36, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SUPPORT", - corpse = "ammobox", - description = [[Unit Type: Artillery Support Tank -Armortype: ]] ..armortype.. [[ - -200 Damage vs Buildings -100 Damage vs Light/Armored - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGeneric", - footprintX = 3, - footprintZ = 3, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 300, - maxVelocity = 2.3, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK3", - name = "ShadowFury", --Because he was the first one to get the "Lobster" pun - noChaseCategory = "VTOL", - objectName = "eartytank2.s3o", - script = "eartytank2.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGeneric", - side = "CORE", - sightDistance = 1000, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 2.3, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 250, - unitname = "eartytank", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "Artilleryweapon", - badTargetCategory = "VTOL", - }, - [2] = { - def = "SaturationArtilleryweapon", - badTargetCategory = "VTOL", - }, - }, - customParams = { - canbetransported = "true", - canareaattack ="1", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) -local weapon1Damage = 200 -local weapon1AOE = 50 -local weapon2Damage = 20 -local weapon2AOE = 250 - -local weaponDefs = { - Artilleryweapon = { - - accuracy = 500, - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "artyshot2", - avoidNeutral = false, - explosionGenerator = "custom:genericshellexplosion-medium", - energypershot = energycosttofire, - - impulseFactor = 0, - interceptedByShieldType = 4, - highTrajectory = 0, - name = "Plasma Cannon", - range = 1300, - reloadtime = 5, - weaponType = "Cannon", - soundHit = "artyhit.wav", - soundStart = "arty2.wav", - - turret = true, - weaponVelocity = 500, - customparams = { - damagetype = "eartytank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - SaturationArtilleryweapon = { - - accuracy = 750, - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "artyshot2", - avoidNeutral = false, - explosionGenerator = "custom:genericshellexplosion-large", - energypershot = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1), - edgeEffectiveness = 1, - - impulseFactor = 0, - interceptedByShieldType = 4, - highTrajectory = 1, - name = "Plasma Cannon", - range = 1000, - reloadtime = 0.5, - weaponType = "Cannon", - soundHit = "artyhit.wav", - soundStart = "arty2.wav", - - turret = true, - weaponVelocity = 500, - customparams = { - damagetype = "eartytank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon2Damage, - }, - }, - -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[8]] +VFS.Include("units-configs-basedefs/basedefs/hover/eartytank_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) 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/eartytank_up1.lua b/Units/ehover/eartytank_up1.lua new file mode 100644 index 000000000..dcb249d54 --- /dev/null +++ b/Units/ehover/eartytank_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[ShadowFury Mark II]] + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eartytank_up2.lua b/Units/ehover/eartytank_up2.lua new file mode 100644 index 000000000..7afe4d0aa --- /dev/null +++ b/Units/ehover/eartytank_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[ShadowFury Mark III]] + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eartytank_up3.lua b/Units/ehover/eartytank_up3.lua new file mode 100644 index 000000000..948c49a25 --- /dev/null +++ b/Units/ehover/eartytank_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EARTYTANK_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eartytank_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[ShadowFury Mark IV]] + +objectName = "eartytank2.s3o" +script = "eartytank2.cob" + +tech = [[tech0]] +armortype = [[light]] +supply = [[8]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eartytank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/ebasefactory.lua b/Units/ehover/ebasefactory.lua index ce0929317..13b4d3f97 100644 --- a/Units/ehover/ebasefactory.lua +++ b/Units/ehover/ebasefactory.lua @@ -1,109 +1,20 @@ -- UNITDEF -- EBASEFACTORY -- -------------------------------------------------------------------------------- -local unitName = "ebasefactory" +unitName = "ebasefactory" -------------------------------------------------------------------------------- -local unitDef = { +buildCostMetal = 60 +maxDamage = buildCostMetal * 12.5 - activatewhenbuilt = false, - buildAngle = 1024, - buildCostEnergy = 0, - buildCostMetal = 60, - builder = true, - buildTime = 5, - canAttack = false, - canBeAssisted = true, - canGuard = true, - canMove = true, - canPatrol = true, - canReclaim = false, - canstop = true, - category = "BUILDING NOTAIR", - corpse = "ammobox", - description = [[Place generators near this factory to unlock higher tier units]], - energyStorage = 0, - energyUse = 0, - energyMake = 0, - explodeAs = "MEXPOP2", - footprintX = 20, - footprintZ = 20, - floater = true, - iconType = "factory", - idleAutoHeal = .5, - idleTime = 2200, - maxDamage = 1500, - maxSlope = 25, - maxWaterDepth = 99999999999, - metalStorage = 0, - metalMake = 0, - name = "Hovertank Factory", - objectName = "ehoverfactory.s3o", - script = "ehoverfac.cob", - radarDistance = 0, - repairable = false, - selfDestructAs = "LARGE_BUILDING", - showNanoSpray = "0", - side = "CORE", - sightDistance = 388, - smoothAnim = true, - TEDClass = "PLANT", - unitname = "ebasefactory", - -- unitRestricted = 1, - workerTime = 1, - yardMap = "ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo ooooooccccccccoooooo", - -- usePieceCollisionVolumes = true, - -- modelCenterOffset = {108, 10, 0}, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, +humanName = "Hover Factory" +objectName = "ehoverfactory.s3o" +script = "ehoverfac.cob" - explosiongenerators = { - "custom:nanoorb", - "custom:nano", - "custom:blacksmoke", - "custom:fusionreactionbasic", - }, - }, - buildoptions = { - "eengineer5", --new - "elighttank3", --new - -- "eflametank", --new - "eriottank2", --new - -- "emediumtank3", --new - "eheavytank3", --new - "emissiletank", --new --- "eaatank", - -- "efatso2", --new - "eartytank", --new - -- "ebomb", - "elacerator", --new - }, - sounds = { - underattack = "unitsunderattack1", - select = { - "gdfactoryselect", - }, - }, - weapons = { - }, - customParams = { - death_sounds = "generic", - armortype = "building", - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[The hovertank factory is the most robust of all the technology avenues in Evolution RTS. Unlike their amphibious and all-terrain counterparts, the Hover Factory does not possess any innate traits, but the larger selection of units makes up for the lack of innate abilities.]], - }, - useGroundDecal = true, - BuildingGroundDecalType = "factorygroundplate.dds", - BuildingGroundDecalSizeX = 26, - BuildingGroundDecalSizeY = 26, - BuildingGroundDecalDecaySpeed = 0.9, -} +hoverFactoryBuildList = Shared.buildListHoverFactory + +VFS.Include("units-configs-basedefs/basedefs/hover/ebasefactory_basedef.lua") -------------------------------------------------------------------------------- diff --git a/Units/ehover/ebasefactory_up1.lua b/Units/ehover/ebasefactory_up1.lua new file mode 100644 index 000000000..ba5092df2 --- /dev/null +++ b/Units/ehover/ebasefactory_up1.lua @@ -0,0 +1,23 @@ +-- UNITDEF -- EBASEFACTORY_up1 -- +-------------------------------------------------------------------------------- + +unitName = "ebasefactory_up1" + +-------------------------------------------------------------------------------- + +buildCostMetal = 270 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Hover Factory Mark II]] +objectName = "ehoverfactory.s3o" +script = "ehoverfac.cob" + +hoverFactoryBuildList = Shared.buildListHoverFactory_up1 + +VFS.Include("units-configs-basedefs/basedefs/hover/ebasefactory_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/ebasefactory_up2.lua b/Units/ehover/ebasefactory_up2.lua new file mode 100644 index 000000000..7c3a68109 --- /dev/null +++ b/Units/ehover/ebasefactory_up2.lua @@ -0,0 +1,23 @@ +-- UNITDEF -- EBASEFACTORY_up2 -- +-------------------------------------------------------------------------------- + +unitName = "ebasefactory_up2" + +-------------------------------------------------------------------------------- + +buildCostMetal = 510 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Hover Factory Mark III]] +objectName = "ehoverfactory.s3o" +script = "ehoverfac.cob" + +hoverFactoryBuildList = Shared.buildListHoverFactory_up2 + +VFS.Include("units-configs-basedefs/basedefs/hover/ebasefactory_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/ebasefactory_up3.lua b/Units/ehover/ebasefactory_up3.lua new file mode 100644 index 000000000..35ebef3f8 --- /dev/null +++ b/Units/ehover/ebasefactory_up3.lua @@ -0,0 +1,23 @@ +-- UNITDEF -- EBASEFACTORY_up3 -- +-------------------------------------------------------------------------------- + +unitName = "ebasefactory_up3" + +-------------------------------------------------------------------------------- + +buildCostMetal = 750 +maxDamage = buildCostMetal * 12.5 + +humanName = [[Hover Factory Mark IV]] +objectName = "ehoverfactory.s3o" +script = "ehoverfac.cob" + +hoverFactoryBuildList = Shared.buildListHoverFactory_up3 + +VFS.Include("units-configs-basedefs/basedefs/hover/ebasefactory_basedef.lua") + +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/ebomb.lua b/Units/ehover/ebomb.lua deleted file mode 100644 index c0e39e967..000000000 --- a/Units/ehover/ebomb.lua +++ /dev/null @@ -1,162 +0,0 @@ --- UNITDEF -- EBOMB -- --------------------------------------------------------------------------------- - -local unitName = "ebomb" - --------------------------------------------------------------------------------- - -local 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "ebombboom", - onlyTargetCategoy = "BUILDING", - badTargetCategory = "WALL", - }, - }, - customParams = { - 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 = [[]], - }, -} - --------------------------------------------------------------------------------- - -local 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 ="unitexplodemedium.wav", - soundhit ="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/eengineer5.lua b/Units/ehover/eengineer5.lua deleted file mode 100644 index c227f19b7..000000000 --- a/Units/ehover/eengineer5.lua +++ /dev/null @@ -1,150 +0,0 @@ --- UNITDEF -- EENGINEER5 -- --------------------------------------------------------------------------------- - -local unitName = "eengineer5" - --------------------------------------------------------------------------------- - -local armortype = [[light]] -local supply = [[2]] - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = 40, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - canBeAssisted = true, - CanCapture = false, - CanRepair = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - description = [[Unit Type: Engineer -Armortype: ]] .. armortype .. [[ - -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 4, - footprintZ = 4, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 600, - 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 = "0", - 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 = { - "eminifac", --new - "ebasefactory", --new - "eamphibfac", - "eairplant", --- "eexperimentalfac", --- "emetalextractor", --new --- "emaker", --new - "esolar2", --new - "emediumgen", - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ekmar", - "elightturret2", --new - "eheavyturret2", --new - "eartyturret", - "euwturret", - "eshieldgen", - "esilo", - "emine", - "eorb", - "ecommander", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - dronespawner = "1", - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[The Erector can build new structures, reclaim features, turn energy cores into gunship drones, and capture enemy units. Upon it's death, it emits a wave of nanoparticles that will repair 100 hitpoints to any units in proximity]], -}, -} - --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- diff --git a/Units/ehover/efatso2.lua b/Units/ehover/efatso2.lua deleted file mode 100644 index 7da38d1eb..000000000 --- a/Units/ehover/efatso2.lua +++ /dev/null @@ -1,169 +0,0 @@ --- UNITDEF -- EFATSO2 -- --------------------------------------------------------------------------------- - -local unitName = "efatso2" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 24, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR ASSAULT", - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "eheavyturretweapon", - onlyTargetCategory = "BUILDING", - }, - [2] = { - def = "eheavyturretweapon", - onlyTargetCategory = "BUILDING", - slaveTo = 1, - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 5, - death_sounds = "generic", - RequireTech = "5 Power", - armortype = "armored", - nofriendlyfire = "1", - supply_cost = 5, - normaltex = "unittextures/efatso2normal.png", - 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.]], -}, -} - - --------------------------------------------------------------------------------- -local weapon1Damage = 350 - -local 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 = "eturrethit.wav", - soundStart = "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/eflametank.lua b/Units/ehover/eflametank.lua deleted file mode 100644 index 6a4d13dc2..000000000 --- a/Units/ehover/eflametank.lua +++ /dev/null @@ -1,171 +0,0 @@ --- UNITDEF -- EFLAMETANK -- --------------------------------------------------------------------------------- - -local unitName = "eflametank" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 25, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "lightlaser", - onlyTargetCategory = "NOTAIR AMPHIB", - badTargetCategory = "ARMORED LIGHT WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = "3 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 3, - normaltex = "unittextures/eflametanknormal.png", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- -local weapon1Damage = 25 - -local 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 = "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/eheavytank3.lua b/Units/ehover/eheavytank3.lua index 4a8f4cbd0..6f9c0d8d9 100644 --- a/Units/ehover/eheavytank3.lua +++ b/Units/ehover/eheavytank3.lua @@ -1,179 +1,24 @@ -- UNITDEF -- EHEAVYTANK3 -- -------------------------------------------------------------------------------- -local unitName = "eheavytank3" +unitName = "eheavytank3" -------------------------------------------------------------------------------- -local power = [[16 power]] -local armortype = [[armored]] -local supply = [[4]] +isUpgraded = [[0]] -local weapon1Damage = 150 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = "Crusher" -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eheavytank4.s3o" +script = "eheavytank4_lus.lua" -local unitDef = { +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 59, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SKIRMISHER", - corpse = "ammobox", - description = [[Unit Type: Armored Tank Destroyer -Armortype: ]] ..armortype.. [[ +VFS.Include("units-configs-basedefs/basedefs/hover/eheavytank3_basedef.lua") -150 Damage vs Light/Armored -75 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGenericRed", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 375, - maxSlope = 26, - maxVelocity = 3.5, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK4", - name = "Crusher", - noChaseCategory = "VTOL", - objectName = "eheavytank4.s3o", - script = "eheavytank4_lus.lua", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGenericRed", - side = "CORE", - sightDistance = 650, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 2.8, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 350, - unitname = "eheavytank3", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "heavytankweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - heavytankweapon = { - - accuracy = 200, - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "antiassualtshot2", - explosionGenerator = "custom:genericshellexplosion-medium", - energypershot = energycosttofire, - id = 172, - impulseFactor = 0, - interceptedByShieldType = 4, - name = "Light Cannon", - range = 650, - reloadtime = 1, - weaponType = "Cannon", - soundHit = "42024_digifishmusic_Missile_Strike.wav", - soundStart = "triotfire.wav", - - tolerance = 2000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eheavytank3", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs - - +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/ehover/eheavytank3_up1.lua b/Units/ehover/eheavytank3_up1.lua new file mode 100644 index 000000000..f98ffc8d6 --- /dev/null +++ b/Units/ehover/eheavytank3_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EHEAVYTANK3_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eheavytank3_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Crusher Mark II]] + +objectName = "eheavytank4.s3o" +script = "eheavytank4_lus.lua" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eheavytank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eheavytank3_up2.lua b/Units/ehover/eheavytank3_up2.lua new file mode 100644 index 000000000..2c0f5d0b1 --- /dev/null +++ b/Units/ehover/eheavytank3_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EHEAVYTANK3_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eheavytank3_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Crusher Mark III]] + +objectName = "eheavytank4.s3o" +script = "eheavytank4_lus.lua" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eheavytank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eheavytank3_up3.lua b/Units/ehover/eheavytank3_up3.lua new file mode 100644 index 000000000..16e85e625 --- /dev/null +++ b/Units/ehover/eheavytank3_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EHEAVYTANK3_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eheavytank3_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Crusher Mark IV]] + +objectName = "eheavytank4.s3o" +script = "eheavytank4_lus.lua" + +tech = [[tech2]] +armortype = [[armored]] +supply = [[4]] + +VFS.Include("units-configs-basedefs/basedefs/hover/eheavytank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/elacerator.lua b/Units/ehover/elacerator.lua index 1ae8f3cdb..2253f2383 100644 --- a/Units/ehover/elacerator.lua +++ b/Units/ehover/elacerator.lua @@ -1,169 +1,24 @@ -- UNITDEF -- elacerator -- -------------------------------------------------------------------------------- -local unitName = "elacerator" +unitName = "elacerator" -------------------------------------------------------------------------------- -local power = [[26 power]] -local armortype = [[armored]] -local supply = [[8]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 500 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = "Lacerator" -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "elacerator.s3o" +script = "elacerator.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 0.18, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 200, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR SUPPORT", - corpse = "ammobox", - description = [[Unit Type: Endbringer Class Low Yeild Nuclear Saturation Artillery -Armortype: ]] ..armortype.. [[ - -500 Damage vs Building -250 Damage vs Light/Armored - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "BIG_UNIT", - footprintX = 6, - footprintZ = 6, - fireState = 0, - highTrajectory = 1, - iconType = "assault", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 1000, - maxVelocity = 2.3, - maxReverseVelocity = 1, - maxWaterDepth = 20, - metalStorage = 0, - movementClass = "HOVERTANK6", - name = "Lacerator", - noChaseCategory = "VTOL", - objectName = "elacerator.s3o", - pushResistant = true, - radarDistance = 0, - repairable = false, - selfDestructAs = "BIG_UNIT", - side = "CORE", - sightDistance = 500, - smoothAnim = true, - turnInPlace = true, - turnRate = 5000, - unitname = "elacerator", - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "nukeartyweapon", - }, - }, - customParams = { - death_sounds = "nuke", - RequireTech = power, - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - nukeartyweapon = { - accuracy = 500, - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "nukeartyshot", - explosionGenerator = "custom:nukeartyexpl", - edgeEffectiveness = 0.1, - energypershot = energycosttofire, - id = 172, - impulseFactor = 0, - interceptedByShieldType = 4, - name = "Light Cannon", - range = 1500, - reloadtime = 0.5, - weaponType = "Cannon", - soundHit = "nukeartyhit.wav", - soundStart = "nukeartyshot.wav", - - tolerance = 2000, - turret = true, - weaponVelocity = 800, - customparams = { - damagetype = "elacerator", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +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/ehover/elacerator_up1.lua b/Units/ehover/elacerator_up1.lua new file mode 100644 index 000000000..767964bc9 --- /dev/null +++ b/Units/ehover/elacerator_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- elacerator_up1 -- +-------------------------------------------------------------------------------- + +unitName = "elacerator_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Lacerator Mark II]] + +objectName = "elacerator.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/ehover/elacerator_up2.lua b/Units/ehover/elacerator_up2.lua new file mode 100644 index 000000000..0d8183d22 --- /dev/null +++ b/Units/ehover/elacerator_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- elacerator_up2 -- +-------------------------------------------------------------------------------- + +unitName = "elacerator_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Lacerator Mark III]] + +objectName = "elacerator.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/ehover/elacerator_up3.lua b/Units/ehover/elacerator_up3.lua new file mode 100644 index 000000000..c4602eb27 --- /dev/null +++ b/Units/ehover/elacerator_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- elacerator_up3 -- +-------------------------------------------------------------------------------- + +unitName = "elacerator_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Lacerator Mark IV]] + +objectName = "elacerator.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/ehover/elighttank3.lua b/Units/ehover/elighttank3.lua index adcce12f6..6acd89a19 100644 --- a/Units/ehover/elighttank3.lua +++ b/Units/ehover/elighttank3.lua @@ -1,179 +1,24 @@ -- UNITDEF -- ELIGHTTANK3 -- -------------------------------------------------------------------------------- -local unitName = "elighttank3" +unitName = [[elighttank3]] -------------------------------------------------------------------------------- -local power = [[6 power]] -local armortype = [[light]] -local supply = [[3]] +isUpgraded = [[0]] -local weapon1Damage = 60 -local weapon1AOE = 1 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = [[Kite]] -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = [[elighttank4.s3o]] +script = [[elighttank3_lus.lua]] -local unitDef = { - - --mobileunit - transportbyenemy = false; - --** - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 27, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR RAID", - corpse = "ammobox", - description = [[Unit Type: Raider -Armortype: ]] ..armortype.. [[ - -45 Damage vs Light/Armored -60 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "smallExplosionGenericBlue", - footprintX = 2, - footprintZ = 2, - iconType = "raider", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 245, - maxSlope = 26, - maxVelocity = 5, - maxReverseVelocity = 2, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK2", - name = "Kite", - noChaseCategory = "VTOL", - objectName = "elighttank4.s3o", - radarDistance = 0, - repairable = false, - selfDestructAs = "smallExplosionGenericBlue", - side = "CORE", - sightDistance = 550, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 5.5, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 475, - unitname = "elighttank3", - upright = true, - workerTime = 0, - - sfxtypes = { - explosiongenerators = { - "custom:electricity", - "custom:dirt", - "custom:blacksmoke", - }, - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - }, - - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "lighttankweapon", - badTargetCategory = "VTOL ARMORED WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 1, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - lighttankweapon = { - - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:genericshellexplosion-medium-lightning", - energypershot = energycosttofire, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - name = "elighttank3weapon", - noSelfDamage = true, - range = 550, - reloadtime = 1, - WeaponType = "LightningCannon", - rgbColor = "0.1 0.2 0.5", - rgbColor2 = "0 0 1", - soundStart = "jacobs.wav", - - texture1 = "lightning", - thickness = 5, - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "elighttank3", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] +VFS.Include("units-configs-basedefs/basedefs/hover/elighttank3_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) diff --git a/Units/ehover/elighttank3_up1.lua b/Units/ehover/elighttank3_up1.lua new file mode 100644 index 000000000..00dbf97a6 --- /dev/null +++ b/Units/ehover/elighttank3_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ELIGHTTANK3_up1 -- +-------------------------------------------------------------------------------- + +unitName = "elighttank3_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Kite Mark II]] + +objectName = "elighttank4.s3o" +script = "elighttank3_lus.lua" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/hover/elighttank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/elighttank3_up2.lua b/Units/ehover/elighttank3_up2.lua new file mode 100644 index 000000000..71de025da --- /dev/null +++ b/Units/ehover/elighttank3_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ELIGHTTANK3_up2 -- +-------------------------------------------------------------------------------- + +unitName = "elighttank3_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Kite Mark III]] + +objectName = "elighttank4.s3o" +script = "elighttank3_lus.lua" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/hover/elighttank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/elighttank3_up3.lua b/Units/ehover/elighttank3_up3.lua new file mode 100644 index 000000000..48e1906c5 --- /dev/null +++ b/Units/ehover/elighttank3_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ELIGHTTANK3_up3 -- +-------------------------------------------------------------------------------- + +unitName = "elighttank3_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Kite Mark IV]] + +objectName = "elighttank4.s3o" +script = "elighttank3_lus.lua" + +tech = [[tech0]] +armortype = [[light]] +supply = [[3]] + +VFS.Include("units-configs-basedefs/basedefs/hover/elighttank3_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/emediumtank3.lua b/Units/ehover/emediumtank3.lua deleted file mode 100644 index f3ee1b34b..000000000 --- a/Units/ehover/emediumtank3.lua +++ /dev/null @@ -1,161 +0,0 @@ --- UNITDEF -- EMEDIUMTANK3 -- --------------------------------------------------------------------------------- - -local unitName = "emediumtank3" - --------------------------------------------------------------------------------- - -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 27, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SKIRMISHER", - corpse = "ammobox", - 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 = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "mediumtankcannon", - onlyTargetCategory = "NOTAIR AMPHIB", - badTargetCategory = "BUILDING LIGHT WALL", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = "4 Power", - armortype = "light", - nofriendlyfire = "1", - supply_cost = 4, - normaltex = "unittextures/emediumtank3normal.png", - 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.]], -}, -} - - --------------------------------------------------------------------------------- -local weapon1Damage = 200 - -local 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 = "mediumcannonhit.wav", - soundStart = "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/ehover/emissiletank.lua b/Units/ehover/emissiletank.lua index 31afa6a30..7b29f2ae3 100644 --- a/Units/ehover/emissiletank.lua +++ b/Units/ehover/emissiletank.lua @@ -1,196 +1,26 @@ -- UNITDEF -- EMISSILETANK -- -------------------------------------------------------------------------------- -local unitName = "emissiletank" +unitName = "emissiletank" -------------------------------------------------------------------------------- -local power = [[14 power]] -local armortype = [[light]] -local supply = [[14]] +isUpgraded = [[0]] -local weapon1Damage = 150 -local weapon1AOE = 100 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) +humanName = "Droplet" -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "emissiletank2.s3o" +script = "emissiletank2.cob" -local unitDef = { - - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.2, - buildCostEnergy = 0, - buildCostMetal = 62, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "LIGHT NOTAIR SUPPORT", - corpse = "ammobox", - description = [[Unit Type: Missile Support Tank -Armortype: ]] ..armortype.. [[ - -150 Damage vs Light/Armored -75 Damage vs Building - -Energy cost to fire: ]] .. roundToFirstDecimal(energycosttofire) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "largeExplosionGeneric", - footprintX = 4, - footprintZ = 4, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 320, - maxSlope = 26, - maxVelocity = 2.5, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK4", - name = "Droplet", - objectName = "emissiletank2.s3o", - script = "emissiletank2.cob", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "largeExplosionGeneric", - side = "ARM", - sightDistance = 850, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 2.6, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 300, - unitname = "emissiletank", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:factorysparks", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "missletankweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "BUILDING LIGHT", - }, - }, - customParams = { - canbetransported = "true", - canareaattack ="1", - needed_cover = 3, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - missletankweapon = { - - AreaOfEffect = weapon1AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - cegTag = "missiletrail", - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:genericshellexplosion-medium-red", - energypershot = energycosttofire, - fireStarter = 100, - flightTime = 5, - impulseBoost = 0, - impulseFactor = 0, - interceptedByShieldType = 4, - - model = "missilesmallvlaunch.s3o", - name = "Rocket", - range = 850, - reloadtime = 3, - weaponType = "MissileLauncher", - - - smokeTrail = false, - soundHit = "explode_large.wav", - soundStart = "missile_launch1.wav", - - tracks = true, - turnrate = 17500, - - weaponAcceleration = 400, - weaponTimer = 1, - weaponType = "StarburstLauncher", - weaponVelocity = 1000, - customparams = { - damagetype = "emissiletank", - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, -} -unitDef.weaponDefs = weaponDefs +tech = [[tech2]] +armortype = [[light]] +supply = [[14]] +VFS.Include("units-configs-basedefs/basedefs/hover/emissiletank_basedef.lua") +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- \ No newline at end of file +-------------------------------------------------------------------------------- diff --git a/Units/ehover/emissiletank_up1.lua b/Units/ehover/emissiletank_up1.lua new file mode 100644 index 000000000..0c917c889 --- /dev/null +++ b/Units/ehover/emissiletank_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EMISSILETANK_up1 -- +-------------------------------------------------------------------------------- + +unitName = "emissiletank_up1" + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[Droplet Mark II]] + +objectName = "emissiletank2.s3o" +script = "emissiletank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[14]] + +VFS.Include("units-configs-basedefs/basedefs/hover/emissiletank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/emissiletank_up2.lua b/Units/ehover/emissiletank_up2.lua new file mode 100644 index 000000000..0f676546e --- /dev/null +++ b/Units/ehover/emissiletank_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- EMISSILETANK_up2 -- +-------------------------------------------------------------------------------- + +unitName = "emissiletank_up2" + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[Droplet Mark III]] + +objectName = "emissiletank2.s3o" +script = "emissiletank2.cob" + +tech = [[tech2]] +armortype = [[light]] +supply = [[14]] + +VFS.Include("units-configs-basedefs/basedefs/hover/emissiletank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/emissiletank_up3.lua b/Units/ehover/emissiletank_up3.lua new file mode 100644 index 000000000..fa95c4953 --- /dev/null +++ b/Units/ehover/emissiletank_up3.lua @@ -0,0 +1,25 @@ +-- UNITDEF -- EMISSILETANK_up3 -- +-------------------------------------------------------------------------------- + +unitName = "emissiletank_up3" + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[Droplet Mark IV]] + +objectName = "emissiletank2.s3o" +script = "emissiletank2.cob" +tech = [[tech2]] +armortype = [[light]] +supply = [[14]] + +VFS.Include("units-configs-basedefs/basedefs/hover/emissiletank_basedef.lua") + +unitDef.weaponDefs = weaponDefs +-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2.lua b/Units/ehover/eriottank2.lua index b9d76506f..9ef4647b4 100644 --- a/Units/ehover/eriottank2.lua +++ b/Units/ehover/eriottank2.lua @@ -1,250 +1,25 @@ -- UNITDEF -- ERIOTTANK2 -- -------------------------------------------------------------------------------- -local unitName = "eriottank2" +unitName = "eriottank2" -------------------------------------------------------------------------------- -local power = [[6 power]] -local armortype = [[light]] -local supply = [[3]] +isUpgraded = [[0]] -local weapon1Damage = 200 -local weapon1AOE = 250 -local weapon2Damage = 75 -local weapon2AOE = 100 -local weapon2Projectiles = 10 -local energycosttofire = weapon1Damage / 10 * ((weapon1AOE / 1000) + 1) -local energycosttofire2 = weapon2Damage / 10 * ((weapon2AOE / 1000) + 1) * weapon2Projectiles +humanName = "Spas" -local function roundToFirstDecimal(energycosttofire) - return math.floor(energycosttofire*10 + 0.5)*0.1 -end +objectName = "eriottank3.s3o" +script = "eriottank3.cob" -local function roundToFirstDecimal(energycosttofire2) - return math.floor(energycosttofire2*10 + 0.5)*0.1 -end +tech = [[tech1]] +armortype = [[light]] +supply = [[3]] -local unitDef = { +VFS.Include("units-configs-basedefs/basedefs/hover/eriottank2_basedef.lua") - --mobileunit - transportbyenemy = false; - - --** - - - acceleration = 1, - brakeRate = 0.1, - buildCostEnergy = 0, - buildCostMetal = 25, - builder = false, - buildTime = 5, - canAttack = true, - cancollect = "1", - -- canDgun = true, - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canstop = "1", - category = "ARMORED NOTAIR RIOT", - corpse = "ammobox", - description = [[Unit Type: Anti-Swarm EMP/Riot Tank -Armortype: ]] ..armortype.. [[ - -200 Paralysis Damage vs Light -100 Paralysis Damage vs Armored/Building - - • Paralyzes enemy units - • Projectile can hit multiple units - -Alternate fire mode fires 10 projectiles in a shotgun spread with a small area of effect. Reduced damage vs buildings when in shotgun mode. - -Energy cost to fire EMP: ]] .. roundToFirstDecimal(energycosttofire) .. [[ -Energy cost to fire Shotgun: ]] .. roundToFirstDecimal(energycosttofire2) .. [[ - -Requires +]] .. power .. [[ -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericBlue", - footprintX = 3, - footprintZ = 3, - iconType = "tankdestroyer", - idleAutoHeal = .5, - idleTime = 2200, - leaveTracks = false, - maxDamage = 300, - maxSlope = 26, - maxVelocity = 4, - maxReverseVelocity = 1, - maxWaterDepth = 10, - metalStorage = 0, - movementClass = "HOVERTANK3", - name = "Spas", - noChaseCategory = "VTOL", - objectName = "eriottank3.s3o", - script = "eriottank3.cob", - onlytargetcategory2 = "NOTAIR", - onlytargetcategory3 = "NOTAIR", - onlytargetcategory4 = "NOTAIR", - onlytargetcategory5 = "NOTAIR", - onlytargetcategory6 = "NOTAIR", - radarDistance = 0, - repairable = false, - selfDestructAs = "mediumExplosionGenericBlue", - side = "CORE", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 3.3, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 430, - unitname = "eriottank2", - upright = true, - workerTime = 0, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:gdhcannon", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "riottankempweapon", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL", - }, - [2] = { - def = "riottankshotgun", - onlyTargetCategory = "LIGHT ARMORED BUILDING", - badTargetCategory = "WALL BUILDING", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - RequireTech = power, - armortype = armortype, - nofriendlyfire = "1", - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[]], - }, -} - - --------------------------------------------------------------------------------- --- Energy Per Shot Calculation is: dmg / 20 * ((aoe / 1000) + 1) - -local weaponDefs = { - riottankempweapon = { - - AreaOfEffect = weapon1AOE, - avoidFeature = false, - avoidFriendly = false, - collideFeature = false, - collideFriendly = false, - coreThickness = 0.6, - -- cegTag = "mediumcannonweapon3", - duration = 0.05, - edgeeffectiveness = 0.1, - energypershot = energycosttofire, - explosionGenerator = "custom:genericshellexplosion-medium-blue", - fallOffRate = 1, - fireStarter = 100, - impulseFactor = 0, - - minintensity = 1, - name = "Laser", - 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 = "fnubeamfire.wav", - soundHit = "phasegun1hit.wav", - texture1 = "wave", - texture2 = "empty", - thickness = 40, - tolerance = 1000, - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "eriottank2", - nofriendlyfire = 1, - - --Upgrades-- - upgradeClass = "groundweapons", - }, - damage = { - default = weapon1Damage, - }, - }, - - riottankshotgun = { - AreaOfEffect = weapon2AOE, - avoidFriendly = false, - avoidFeature = false, - collideFriendly = false, - collideFeature = false, - - cegTag = "bruisercannon", - explosionGenerator = "custom:genericshellexplosion-small", - energypershot = energycosttofire2, - interceptedByShieldType = 4, - impulseFactor = 0, - name = "Light Cannon", - projectiles = weapon2Projectiles, - range = 500, - reloadtime = 5, - weaponType = "Cannon", - soundHit = "mediumcannonhit.wav", - soundStart = "bruisercannon.wav", - sprayangle = 2000, - - turret = true, - weaponVelocity = 400, - customparams = { - damagetype = "eriottank2shotgun", - }, - damage = { - default = weapon2Damage, - }, - }, - -} -unitDef.weaponDefs = weaponDefs - - --------------------------------------------------------------------------------- +unitDef.weaponDefs = weaponDefs-------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) 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/eriottank2_up1.lua b/Units/ehover/eriottank2_up1.lua new file mode 100644 index 000000000..1988a4342 --- /dev/null +++ b/Units/ehover/eriottank2_up1.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ERIOTTANK2_up1 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2_up2.lua b/Units/ehover/eriottank2_up2.lua new file mode 100644 index 000000000..acf2f6163 --- /dev/null +++ b/Units/ehover/eriottank2_up2.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ERIOTTANK2_up2 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/ehover/eriottank2_up3.lua b/Units/ehover/eriottank2_up3.lua new file mode 100644 index 000000000..49cdbc63b --- /dev/null +++ b/Units/ehover/eriottank2_up3.lua @@ -0,0 +1,26 @@ +-- UNITDEF -- ERIOTTANK2_up3 -- +-------------------------------------------------------------------------------- + +unitName = "eriottank2_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_basedef.lua") + +unitDef.weaponDefs = weaponDefs-------------------------------------------------------------------------------- + +return lowerkeys({ [unitName] = unitDef }) + +-------------------------------------------------------------------------------- diff --git a/Units/energycore.lua b/Units/energycore.lua new file mode 100644 index 000000000..1712b2c5e --- /dev/null +++ b/Units/energycore.lua @@ -0,0 +1,53 @@ +local unitname = "energycore" +local unitDef = { + name = "energycore", + category = "LIGHT NOTAIR", + buildCostEnergy = 0, + 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 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' + collisionvolumeoffsets = "0 6 0", + collisionvolumescales = "12 12 12", + collisionvolumetype = "Box", + footprintx = 1, + footprintz = 1, + height = 5, + blocking = true, + hitdensity = 0, + metal = 5, + energy = 5, + damage = 10000, + canattack = false, + canrepeat = false, + hidedamage = true, + reclaimable = false, + repairable = false, + autoreclaimable = false, + indestructible = true, + smokeTime = 0, + sightdistance = 0, + seismicsignature = 0, + stealth = true, + sonarStealth = true, + capturable = false, + canmove = true, + maxvelocity = 1, + movementclass = "ALLTERRTANK4", + usebuildinggrounddecal = false, +-- nodrawundergray = "1.0", + + customParams = { + provide_cover = 0, + nohealthbars = true, + needed_cover = 99999999, + cannotcloak = true, + }, + +} +return lowerkeys({[unitname] = unitDef}) \ No newline at end of file diff --git a/Units/eorb.lua b/Units/eorb.lua index b3b1259ee..5f332034d 100644 --- a/Units/eorb.lua +++ b/Units/eorb.lua @@ -1,167 +1,27 @@ --- UNITDEF -- EORB -- -------------------------------------------------------------------------------- -local unitName = "eorb" +unitName = [[eorb]] -------------------------------------------------------------------------------- -local armortype = [[light]] -local supply = [[1]] +isUpgraded = [[0]] -local unitDef = { +humanName = [[O.R.B.]] - --mobileunit - transportbyenemy = false; +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] - --** +workerTime = 1 +buildDistance = 350 +tech = [[tech0]] +armortype = [[light]] - acceleration = 1, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = 30, - buildDistance = 800, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - CanBeAssisted = true, - CanCapture = false, - CanRepair = true, - cancollect = "1", - canGuard = true, - canHover = true, - canMove = true, - canPatrol = true, - canreclaim = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - description = [[Unit Type: Field Medic / Construction Assistant -Armortype: ]] ..armortype.. [[ - -• Automatically repairs mobile units in the area - -Uses +]] .. supply .. [[ Supply]], - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "mediumExplosionGenericGreen", - footprintX = 6, - footprintZ = 6, - fireState = "0", - iconType = "orb", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 600, - maxSlope = 26, - maxVelocity = 3, - maxReverseVelocity = 1, - maxWaterDepth = 5000, - metalmake = 0, - metalStorage = 0, - movementClass = "HOVERTANK6", - moveState = "2", - name = "ORB", - objectName = "eorb3.s3o", - script = "eorb3.cob", - radarDistance = 0, - --radarDistanceJam = 20, - repairable = false, - selfDestructAs = "mediumExplosionGenericGreen", - showNanoSpray = "0", - side = "ARM", - sightDistance = 500, - smoothAnim = true, - stealth = true, - seismicSignature = 2, - -- turnInPlace = false, - -- turnInPlaceSpeedLimit = 3, - turnInPlace = true, - turnRate = 5000, - -- turnrate = 1020, - unitname = "eorb", - upright = true, - workerTime = 1, - capturespeed = 0, - TerraformSpeed = 100000, - ReclaimSpeed = 0, - repairspeed = 0.3125, - sfxtypes = { - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - - explosiongenerators = { - "custom:nanoorb", - "custom:dirt", - "custom:blacksmoke", - }, - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - customParams = { - canbetransported = "true", - needed_cover = 2, - death_sounds = "generic", - cancollect = "1", - armortype = armortype, - supply_cost = supply, - normaltex = "unittextures/lego2skin_explorernormal.dds", - buckettex = "unittextures/lego2skin_explorerbucket.dds", - factionname = "outer_colonies", - helptext = [[The ORB is a field medic designed to quickly repair damaged units. It has an Area Repair ability that will repair 10 hitpoints every second to any damaged unit (including allied units) in range. Unit must be out of combat for 5 seconds before repairs can take place. - - The ORB will also automatically reclaim and energy cores it gets close to. This means that if you include them in your unit groups, not only do you get excellent repair, you can also turn a profit from even a bad engagement.]], - - -- groundtexselectimg = ":nc:bitmaps/icons/repairzone.png", - -- groundtexselectxsize = 1000, - -- groundtexselectzsize = 1000, - }, -} +VFS.Include("units-configs-basedefs/basedefs/eorb_basedef.lua") --------------------------------------------------------------------------------- - -local weaponDefs = { - - aoeheal = { - AreaOfEffect = 1000, - avoidFriendly = false, - - collideFriendly = false, - commandfire = true, - explosionGenerator = "custom:AREAHEALING", - energypershot = 50, - edgeEffectiveness = 1, - impulseFactor = 0, - name = "Area Healing Device", - range = 50, - reloadtime = 10, - weaponType = "Cannon", - soundStart = "areaheal.wav", - - turret = true, - weaponVelocity = 1000, - customparams = { - damagetype = "default", - noenemyfire = "1", - }, - damage = { - default = -250, - }, - }, -} -unitDef.weaponDefs = weaponDefs +unitDef.weaponDefs = weaponDefs -------------------------------------------------------------------------------- return lowerkeys({ [unitName] = unitDef }) --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Units/eorb_up1.lua b/Units/eorb_up1.lua new file mode 100644 index 000000000..4be7a1e61 --- /dev/null +++ b/Units/eorb_up1.lua @@ -0,0 +1,27 @@ +-------------------------------------------------------------------------------- + +unitName = [[eorb_up1]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[1]] + +humanName = [[O.R.B. MK II]] + +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] + +workerTime = 1.33 +buildDistance = 800 + +tech = [[tech0]] +armortype = [[light]] + +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/eorb_up2.lua b/Units/eorb_up2.lua new file mode 100644 index 000000000..b0c24e410 --- /dev/null +++ b/Units/eorb_up2.lua @@ -0,0 +1,27 @@ +-------------------------------------------------------------------------------- + +unitName = [[eorb_up2]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[2]] + +humanName = [[O.R.B. MK III]] + +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] + +workerTime = 1.66 +buildDistance = 800 + +tech = [[tech0]] +armortype = [[light]] + +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/eorb_up3.lua b/Units/eorb_up3.lua new file mode 100644 index 000000000..5b795108b --- /dev/null +++ b/Units/eorb_up3.lua @@ -0,0 +1,27 @@ +-------------------------------------------------------------------------------- + +unitName = [[eorb_up3]] + +-------------------------------------------------------------------------------- + +isUpgraded = [[3]] + +humanName = [[O.R.B. MK IV]] + +objectName = [[eorb4.s3o]] +script = [[eorb3.cob]] + +workerTime = 2 +buildDistance = 800 + +tech = [[tech0]] +armortype = [[light]] + +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/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/mission/engineermarbuk.lua b/Units/mission/engineermarbuk.lua deleted file mode 100644 index 3681cdbe9..000000000 --- a/Units/mission/engineermarbuk.lua +++ /dev/null @@ -1,170 +0,0 @@ --- UNITDEF -- EALLTERRENGINEER -- --------------------------------------------------------------------------------- - -local unitName = "engineermarbuk" - --------------------------------------------------------------------------------- - -local unitDef = { - acceleration = 0.2, - brakeRate = 0.24, - buildCostEnergy = 0, - buildCostMetal = 5, - buildDistance = 400, - builder = true, - buildTime = 5, - CanAttack = false, - CanAssist = true, - CanCapture = false, - cancollect = true, - canGuard = true, - canMove = true, - canPatrol = true, - canreclamate = false, - canstop = true, - category = "LIGHT NOTAIR SUPPORT", - corpse = "ammobox", - collisionVolumeTest = 1, - -- Cloaking - - cancloak = true, - cloakCost = 2, - cloakCostMoving = 2, - minCloakDistance = 70, - decloakOnFire = true, - decloakSpherical = true, - initCloaked = true, - - -- End Cloaking - - description = "Engineer :: Armortype: Light", - energyMake = 0, - energyStorage = 0, - energyUse = 0, - explodeAs = "CONSTRUCTOR", - footprintX = 3, - footprintZ = 3, - iconType = "engineer", - idleAutoHeal = .5, - idleTime = 2200, - levelground = true, - maxDamage = 500, - maxSlope = 180, - maxVelocity = 3, - maxReverseVelocity = 1, - turninplacespeedlimit = 3, - maxWaterDepth = 10, - metalmake = 0, - metalStorage = 0, - mobilestandorders = "1", - movementClass = "ALLTERRTANK3", - name = "Engineer Marbuk", - objectName = "eallterrengineer.s3o", - radarDistance = 0, - selfDestructAs = "CONSTRUCTOR", - showNanoSpray = "0", - sightDistance = 1000, - -- SonarDistance = 500; - smoothAnim = true, - stealth = true, - seismicSignature = 3, - turnInPlace = true, - turnRate = 1020, - unitname = "engineermarbuk", - workerTime = 2, - capturespeed = 1, - TerraformSpeed = 100000, - ReclaimSpeed = 1000, - repairspeed = 0.25, - sfxtypes = { - explosiongenerators = { - "custom:nanoorb", - "custom:dirtsmall", - }, - pieceExplosionGenerators = { - "deathceg3", - "deathceg4", - }, - }, - buildoptions = { - "esolar2", --new - "egeothermal", --new - "efusion2", --new - "estorage", --new - "eradar2", --new - "ejammer2", --new - "ebarricade", - "elightturret2", --new - "eheavyturret2", --new - "eaaturret", - }, - sounds = { - underattack = "unitsunderattack1", - ok = { - "ack", - }, - select = { - "unitselect", - }, - }, - weapons = { - [1] = { - def = "fusionfx", - }, - }, - customParams = { - needed_cover = 1, - death_sounds = "generic", - twokhotkey = 'e', - dronespawner = "1", - armortype = "light", - normaltex = "unittextures/con_legonormal.png", - }, -} - --------------------------------------------------------------------------------- - -local weaponDefs = { - fusionfx = { - - AreaOfEffect = 5, - avoidFeature = false, - avoidFriendly = false, - beamTime = 0.1, - - collideFeature = false, - collideFriendly = false, - coreThickness = 0.1, - craterBoost = 0, - craterMult = 0, - explosionGenerator = "custom:empty", - fallOffRate = 0.5, - minintensity = 1, - impulseFactor = 0, - largeBeamLaser = true, - - name = "Light Laser", - noSelfDamage = true, - range = 400, - reloadtime = 0.1, - WeaponType = "BeamLaser", - rgbColor = "0 0 0.5", - rgbColor2 = "0.2 0.2 0.2", - - soundTrigger = true, - startVelocity = 1500, - targetMoveError = 0.3, - thickness = 1, - turret = true, - weaponVelocity = 1500, - damage = { - default = 0, - }, - }, -} -unitDef.weaponDefs = weaponDefs --------------------------------------------------------------------------------- - -return lowerkeys({ [unitName] = unitDef }) - --------------------------------------------------------------------------------- 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/bitmaps/detailtextures/TREE.png b/UnusedBitmaps/detailtextures/TREE.png similarity index 100% rename from bitmaps/detailtextures/TREE.png rename to UnusedBitmaps/detailtextures/TREE.png diff --git a/bitmaps/detailtextures/alien1.png b/UnusedBitmaps/detailtextures/alien1.png similarity index 100% rename from bitmaps/detailtextures/alien1.png rename to UnusedBitmaps/detailtextures/alien1.png diff --git a/bitmaps/detailtextures/alien2.png b/UnusedBitmaps/detailtextures/alien2.png similarity index 100% rename from bitmaps/detailtextures/alien2.png rename to UnusedBitmaps/detailtextures/alien2.png diff --git a/bitmaps/detailtextures/blueblobs.png b/UnusedBitmaps/detailtextures/blueblobs.png similarity index 100% rename from bitmaps/detailtextures/blueblobs.png rename to UnusedBitmaps/detailtextures/blueblobs.png diff --git a/bitmaps/detailtextures/camo1.png b/UnusedBitmaps/detailtextures/camo1.png similarity index 100% rename from bitmaps/detailtextures/camo1.png rename to UnusedBitmaps/detailtextures/camo1.png diff --git a/bitmaps/detailtextures/camo2.png b/UnusedBitmaps/detailtextures/camo2.png similarity index 100% rename from bitmaps/detailtextures/camo2.png rename to UnusedBitmaps/detailtextures/camo2.png diff --git a/bitmaps/detailtextures/camo3.png b/UnusedBitmaps/detailtextures/camo3.png similarity index 100% rename from bitmaps/detailtextures/camo3.png rename to UnusedBitmaps/detailtextures/camo3.png diff --git a/bitmaps/detailtextures/camo4.png b/UnusedBitmaps/detailtextures/camo4.png similarity index 100% rename from bitmaps/detailtextures/camo4.png rename to UnusedBitmaps/detailtextures/camo4.png diff --git a/bitmaps/detailtextures/caution1.png b/UnusedBitmaps/detailtextures/caution1.png similarity index 100% rename from bitmaps/detailtextures/caution1.png rename to UnusedBitmaps/detailtextures/caution1.png diff --git a/bitmaps/detailtextures/caution2.png b/UnusedBitmaps/detailtextures/caution2.png similarity index 100% rename from bitmaps/detailtextures/caution2.png rename to UnusedBitmaps/detailtextures/caution2.png diff --git a/bitmaps/detailtextures/circuits1.png b/UnusedBitmaps/detailtextures/circuits1.png similarity index 100% rename from bitmaps/detailtextures/circuits1.png rename to UnusedBitmaps/detailtextures/circuits1.png diff --git a/bitmaps/detailtextures/circuits2.png b/UnusedBitmaps/detailtextures/circuits2.png similarity index 100% rename from bitmaps/detailtextures/circuits2.png rename to UnusedBitmaps/detailtextures/circuits2.png diff --git a/bitmaps/detailtextures/darkembroidery1.png b/UnusedBitmaps/detailtextures/darkembroidery1.png similarity index 100% rename from bitmaps/detailtextures/darkembroidery1.png rename to UnusedBitmaps/detailtextures/darkembroidery1.png diff --git a/bitmaps/detailtextures/darkembroidery2.png b/UnusedBitmaps/detailtextures/darkembroidery2.png similarity index 100% rename from bitmaps/detailtextures/darkembroidery2.png rename to UnusedBitmaps/detailtextures/darkembroidery2.png diff --git a/bitmaps/detailtextures/fade1.png b/UnusedBitmaps/detailtextures/fade1.png similarity index 100% rename from bitmaps/detailtextures/fade1.png rename to UnusedBitmaps/detailtextures/fade1.png diff --git a/bitmaps/detailtextures/hex1.png b/UnusedBitmaps/detailtextures/hex1.png similarity index 100% rename from bitmaps/detailtextures/hex1.png rename to UnusedBitmaps/detailtextures/hex1.png diff --git a/bitmaps/detailtextures/hex2.png b/UnusedBitmaps/detailtextures/hex2.png similarity index 100% rename from bitmaps/detailtextures/hex2.png rename to UnusedBitmaps/detailtextures/hex2.png diff --git a/bitmaps/detailtextures/hex3.png b/UnusedBitmaps/detailtextures/hex3.png similarity index 100% rename from bitmaps/detailtextures/hex3.png rename to UnusedBitmaps/detailtextures/hex3.png diff --git a/bitmaps/detailtextures/hex4.png b/UnusedBitmaps/detailtextures/hex4.png similarity index 100% rename from bitmaps/detailtextures/hex4.png rename to UnusedBitmaps/detailtextures/hex4.png diff --git a/bitmaps/detailtextures/ladiesdress1.png b/UnusedBitmaps/detailtextures/ladiesdress1.png similarity index 100% rename from bitmaps/detailtextures/ladiesdress1.png rename to UnusedBitmaps/detailtextures/ladiesdress1.png diff --git a/bitmaps/detailtextures/metal.png b/UnusedBitmaps/detailtextures/metal.png similarity index 100% rename from bitmaps/detailtextures/metal.png rename to UnusedBitmaps/detailtextures/metal.png diff --git a/bitmaps/detailtextures/plasma1.png b/UnusedBitmaps/detailtextures/plasma1.png similarity index 100% rename from bitmaps/detailtextures/plasma1.png rename to UnusedBitmaps/detailtextures/plasma1.png diff --git a/bitmaps/detailtextures/plasma2.png b/UnusedBitmaps/detailtextures/plasma2.png similarity index 100% rename from bitmaps/detailtextures/plasma2.png rename to UnusedBitmaps/detailtextures/plasma2.png diff --git a/bitmaps/detailtextures/plating1.png b/UnusedBitmaps/detailtextures/plating1.png similarity index 100% rename from bitmaps/detailtextures/plating1.png rename to UnusedBitmaps/detailtextures/plating1.png diff --git a/bitmaps/detailtextures/qbert.png b/UnusedBitmaps/detailtextures/qbert.png similarity index 100% rename from bitmaps/detailtextures/qbert.png rename to UnusedBitmaps/detailtextures/qbert.png diff --git a/bitmaps/detailtextures/racingstripe1.png b/UnusedBitmaps/detailtextures/racingstripe1.png similarity index 100% rename from bitmaps/detailtextures/racingstripe1.png rename to UnusedBitmaps/detailtextures/racingstripe1.png diff --git a/bitmaps/detailtextures/racingstripe2.png b/UnusedBitmaps/detailtextures/racingstripe2.png similarity index 100% rename from bitmaps/detailtextures/racingstripe2.png rename to UnusedBitmaps/detailtextures/racingstripe2.png diff --git a/bitmaps/detailtextures/stripe1.png b/UnusedBitmaps/detailtextures/stripe1.png similarity index 100% rename from bitmaps/detailtextures/stripe1.png rename to UnusedBitmaps/detailtextures/stripe1.png diff --git a/bitmaps/detailtextures/techpanels1.png b/UnusedBitmaps/detailtextures/techpanels1.png similarity index 100% rename from bitmaps/detailtextures/techpanels1.png rename to UnusedBitmaps/detailtextures/techpanels1.png diff --git a/bitmaps/detailtextures/thedude1.png b/UnusedBitmaps/detailtextures/thedude1.png similarity index 100% rename from bitmaps/detailtextures/thedude1.png rename to UnusedBitmaps/detailtextures/thedude1.png diff --git a/bitmaps/detailtextures/tigerstripe1.png b/UnusedBitmaps/detailtextures/tigerstripe1.png similarity index 100% rename from bitmaps/detailtextures/tigerstripe1.png rename to UnusedBitmaps/detailtextures/tigerstripe1.png diff --git a/bitmaps/detailtextures/tigerstripe2.png b/UnusedBitmaps/detailtextures/tigerstripe2.png similarity index 100% rename from bitmaps/detailtextures/tigerstripe2.png rename to UnusedBitmaps/detailtextures/tigerstripe2.png diff --git a/bitmaps/detailtextures/water1.png b/UnusedBitmaps/detailtextures/water1.png similarity index 100% rename from bitmaps/detailtextures/water1.png rename to UnusedBitmaps/detailtextures/water1.png diff --git a/bitmaps/detailtextures/water2.png b/UnusedBitmaps/detailtextures/water2.png similarity index 100% rename from bitmaps/detailtextures/water2.png rename to UnusedBitmaps/detailtextures/water2.png diff --git a/bitmaps/icons/frames.psp b/UnusedBitmaps/icons/frames.psp similarity index 100% rename from bitmaps/icons/frames.psp rename to UnusedBitmaps/icons/frames.psp diff --git a/bitmaps/icons/repairzone.png b/UnusedBitmaps/icons/repairzone.png similarity index 100% rename from bitmaps/icons/repairzone.png rename to UnusedBitmaps/icons/repairzone.png diff --git a/bitmaps/icons/repairzone.psd b/UnusedBitmaps/icons/repairzone.psd similarity index 100% rename from bitmaps/icons/repairzone.psd rename to UnusedBitmaps/icons/repairzone.psd diff --git a/bitmaps/power/power.psd b/UnusedBitmaps/power/power.psd similarity index 100% rename from bitmaps/power/power.psd rename to UnusedBitmaps/power/power.psd diff --git a/bitmaps/power/powergrid.png b/UnusedBitmaps/power/powergrid.png similarity index 100% rename from bitmaps/power/powergrid.png rename to UnusedBitmaps/power/powergrid.png diff --git a/bitmaps/projectiletextures/plus5plus5psd.psd b/UnusedBitmaps/projectiletextures/plus5plus5psd.psd similarity index 100% rename from bitmaps/projectiletextures/plus5plus5psd.psd rename to UnusedBitmaps/projectiletextures/plus5plus5psd.psd diff --git a/UnusedBitmaps/projectiletextures/shield4-large.png b/UnusedBitmaps/projectiletextures/shield4-large.png new file mode 100644 index 000000000..7b5d1add2 Binary files /dev/null and b/UnusedBitmaps/projectiletextures/shield4-large.png differ diff --git a/bitmaps/spbackground.png b/UnusedBitmaps/spbackground.png similarity index 100% rename from bitmaps/spbackground.png rename to UnusedBitmaps/spbackground.png diff --git a/bitmaps/ui/background.jpg b/UnusedBitmaps/ui/background.jpg similarity index 100% rename from bitmaps/ui/background.jpg rename to UnusedBitmaps/ui/background.jpg diff --git a/bitmaps/ui/buckets/finish.png b/UnusedBitmaps/ui/buckets/finish.png similarity index 100% rename from bitmaps/ui/buckets/finish.png rename to UnusedBitmaps/ui/buckets/finish.png diff --git a/bitmaps/ui/buckets/finish2.png b/UnusedBitmaps/ui/buckets/finish2.png similarity index 100% rename from bitmaps/ui/buckets/finish2.png rename to UnusedBitmaps/ui/buckets/finish2.png diff --git a/bitmaps/ui/buckets/label.png b/UnusedBitmaps/ui/buckets/label.png similarity index 100% rename from bitmaps/ui/buckets/label.png rename to UnusedBitmaps/ui/buckets/label.png diff --git a/bitmaps/ui/buckets/metal.png b/UnusedBitmaps/ui/buckets/metal.png similarity index 100% rename from bitmaps/ui/buckets/metal.png rename to UnusedBitmaps/ui/buckets/metal.png diff --git a/bitmaps/ui/buckets/notexture.gif b/UnusedBitmaps/ui/buckets/notexture.gif similarity index 100% rename from bitmaps/ui/buckets/notexture.gif rename to UnusedBitmaps/ui/buckets/notexture.gif diff --git a/bitmaps/ui/buckets/paint.png b/UnusedBitmaps/ui/buckets/paint.png similarity index 100% rename from bitmaps/ui/buckets/paint.png rename to UnusedBitmaps/ui/buckets/paint.png diff --git a/bitmaps/ui/buckets/teamcolorsverticalstrip.png b/UnusedBitmaps/ui/buckets/teamcolorsverticalstrip.png similarity index 100% rename from bitmaps/ui/buckets/teamcolorsverticalstrip.png rename to UnusedBitmaps/ui/buckets/teamcolorsverticalstrip.png diff --git a/bitmaps/ui/buttons/bulb_off.png b/UnusedBitmaps/ui/buttons/bulb_off.png similarity index 100% rename from bitmaps/ui/buttons/bulb_off.png rename to UnusedBitmaps/ui/buttons/bulb_off.png diff --git a/bitmaps/ui/buttons/bulb_on.png b/UnusedBitmaps/ui/buttons/bulb_on.png similarity index 100% rename from bitmaps/ui/buttons/bulb_on.png rename to UnusedBitmaps/ui/buttons/bulb_on.png diff --git a/bitmaps/ui/buttons/buttons.psd b/UnusedBitmaps/ui/buttons/buttons.psd similarity index 100% rename from bitmaps/ui/buttons/buttons.psd rename to UnusedBitmaps/ui/buttons/buttons.psd diff --git a/bitmaps/ui/buttons/cmd_area_mex.png b/UnusedBitmaps/ui/buttons/cmd_area_mex.png similarity index 100% rename from bitmaps/ui/buttons/cmd_area_mex.png rename to UnusedBitmaps/ui/buttons/cmd_area_mex.png diff --git a/bitmaps/ui/buttons/cmd_areaattack.png b/UnusedBitmaps/ui/buttons/cmd_areaattack.png similarity index 100% rename from bitmaps/ui/buttons/cmd_areaattack.png rename to UnusedBitmaps/ui/buttons/cmd_areaattack.png diff --git a/bitmaps/ui/buttons/cmd_attack.png b/UnusedBitmaps/ui/buttons/cmd_attack.png similarity index 100% rename from bitmaps/ui/buttons/cmd_attack.png rename to UnusedBitmaps/ui/buttons/cmd_attack.png diff --git a/bitmaps/ui/buttons/cmd_autorepairlevel.png b/UnusedBitmaps/ui/buttons/cmd_autorepairlevel.png similarity index 100% rename from bitmaps/ui/buttons/cmd_autorepairlevel.png rename to UnusedBitmaps/ui/buttons/cmd_autorepairlevel.png diff --git a/bitmaps/ui/buttons/cmd_capture.png b/UnusedBitmaps/ui/buttons/cmd_capture.png similarity index 100% rename from bitmaps/ui/buttons/cmd_capture.png rename to UnusedBitmaps/ui/buttons/cmd_capture.png diff --git a/bitmaps/ui/buttons/cmd_cloakstate.png b/UnusedBitmaps/ui/buttons/cmd_cloakstate.png similarity index 100% rename from bitmaps/ui/buttons/cmd_cloakstate.png rename to UnusedBitmaps/ui/buttons/cmd_cloakstate.png diff --git a/bitmaps/ui/buttons/cmd_cloakstateoff.png b/UnusedBitmaps/ui/buttons/cmd_cloakstateoff.png similarity index 100% rename from bitmaps/ui/buttons/cmd_cloakstateoff.png rename to UnusedBitmaps/ui/buttons/cmd_cloakstateoff.png diff --git a/bitmaps/ui/buttons/cmd_cloakstateon.png b/UnusedBitmaps/ui/buttons/cmd_cloakstateon.png similarity index 100% rename from bitmaps/ui/buttons/cmd_cloakstateon.png rename to UnusedBitmaps/ui/buttons/cmd_cloakstateon.png diff --git a/bitmaps/ui/buttons/cmd_dgun.png b/UnusedBitmaps/ui/buttons/cmd_dgun.png similarity index 100% rename from bitmaps/ui/buttons/cmd_dgun.png rename to UnusedBitmaps/ui/buttons/cmd_dgun.png diff --git a/bitmaps/ui/buttons/cmd_fight.png b/UnusedBitmaps/ui/buttons/cmd_fight.png similarity index 100% rename from bitmaps/ui/buttons/cmd_fight.png rename to UnusedBitmaps/ui/buttons/cmd_fight.png diff --git a/bitmaps/ui/buttons/cmd_firestate.png b/UnusedBitmaps/ui/buttons/cmd_firestate.png similarity index 100% rename from bitmaps/ui/buttons/cmd_firestate.png rename to UnusedBitmaps/ui/buttons/cmd_firestate.png diff --git a/bitmaps/ui/buttons/cmd_firestatefireatwill.png b/UnusedBitmaps/ui/buttons/cmd_firestatefireatwill.png similarity index 100% rename from bitmaps/ui/buttons/cmd_firestatefireatwill.png rename to UnusedBitmaps/ui/buttons/cmd_firestatefireatwill.png diff --git a/bitmaps/ui/buttons/cmd_firestateholdfire.png b/UnusedBitmaps/ui/buttons/cmd_firestateholdfire.png similarity index 100% rename from bitmaps/ui/buttons/cmd_firestateholdfire.png rename to UnusedBitmaps/ui/buttons/cmd_firestateholdfire.png diff --git a/bitmaps/ui/buttons/cmd_firestatereturnfire.png b/UnusedBitmaps/ui/buttons/cmd_firestatereturnfire.png similarity index 100% rename from bitmaps/ui/buttons/cmd_firestatereturnfire.png rename to UnusedBitmaps/ui/buttons/cmd_firestatereturnfire.png diff --git a/bitmaps/ui/buttons/cmd_guard.png b/UnusedBitmaps/ui/buttons/cmd_guard.png similarity index 100% rename from bitmaps/ui/buttons/cmd_guard.png rename to UnusedBitmaps/ui/buttons/cmd_guard.png diff --git a/bitmaps/ui/buttons/cmd_land.png b/UnusedBitmaps/ui/buttons/cmd_land.png similarity index 100% rename from bitmaps/ui/buttons/cmd_land.png rename to UnusedBitmaps/ui/buttons/cmd_land.png diff --git a/bitmaps/ui/buttons/cmd_load.png b/UnusedBitmaps/ui/buttons/cmd_load.png similarity index 100% rename from bitmaps/ui/buttons/cmd_load.png rename to UnusedBitmaps/ui/buttons/cmd_load.png diff --git a/bitmaps/ui/buttons/cmd_loopbackattack.png b/UnusedBitmaps/ui/buttons/cmd_loopbackattack.png similarity index 100% rename from bitmaps/ui/buttons/cmd_loopbackattack.png rename to UnusedBitmaps/ui/buttons/cmd_loopbackattack.png diff --git a/bitmaps/ui/buttons/cmd_move.png b/UnusedBitmaps/ui/buttons/cmd_move.png similarity index 100% rename from bitmaps/ui/buttons/cmd_move.png rename to UnusedBitmaps/ui/buttons/cmd_move.png diff --git a/bitmaps/ui/buttons/cmd_movestate.png b/UnusedBitmaps/ui/buttons/cmd_movestate.png similarity index 100% rename from bitmaps/ui/buttons/cmd_movestate.png rename to UnusedBitmaps/ui/buttons/cmd_movestate.png diff --git a/bitmaps/ui/buttons/cmd_movestateholdposition.png b/UnusedBitmaps/ui/buttons/cmd_movestateholdposition.png similarity index 100% rename from bitmaps/ui/buttons/cmd_movestateholdposition.png rename to UnusedBitmaps/ui/buttons/cmd_movestateholdposition.png diff --git a/bitmaps/ui/buttons/cmd_movestatemaneuver.png b/UnusedBitmaps/ui/buttons/cmd_movestatemaneuver.png similarity index 100% rename from bitmaps/ui/buttons/cmd_movestatemaneuver.png rename to UnusedBitmaps/ui/buttons/cmd_movestatemaneuver.png diff --git a/bitmaps/ui/buttons/cmd_movestateroam.png b/UnusedBitmaps/ui/buttons/cmd_movestateroam.png similarity index 100% rename from bitmaps/ui/buttons/cmd_movestateroam.png rename to UnusedBitmaps/ui/buttons/cmd_movestateroam.png diff --git a/bitmaps/ui/buttons/cmd_off.png b/UnusedBitmaps/ui/buttons/cmd_off.png similarity index 100% rename from bitmaps/ui/buttons/cmd_off.png rename to UnusedBitmaps/ui/buttons/cmd_off.png diff --git a/bitmaps/ui/buttons/cmd_on.png b/UnusedBitmaps/ui/buttons/cmd_on.png similarity index 100% rename from bitmaps/ui/buttons/cmd_on.png rename to UnusedBitmaps/ui/buttons/cmd_on.png diff --git a/bitmaps/ui/buttons/cmd_patrol.png b/UnusedBitmaps/ui/buttons/cmd_patrol.png similarity index 100% rename from bitmaps/ui/buttons/cmd_patrol.png rename to UnusedBitmaps/ui/buttons/cmd_patrol.png diff --git a/bitmaps/ui/buttons/cmd_priority.png b/UnusedBitmaps/ui/buttons/cmd_priority.png similarity index 100% rename from bitmaps/ui/buttons/cmd_priority.png rename to UnusedBitmaps/ui/buttons/cmd_priority.png diff --git a/bitmaps/ui/buttons/cmd_priorityhigh.png b/UnusedBitmaps/ui/buttons/cmd_priorityhigh.png similarity index 100% rename from bitmaps/ui/buttons/cmd_priorityhigh.png rename to UnusedBitmaps/ui/buttons/cmd_priorityhigh.png diff --git a/bitmaps/ui/buttons/cmd_prioritylow.png b/UnusedBitmaps/ui/buttons/cmd_prioritylow.png similarity index 100% rename from bitmaps/ui/buttons/cmd_prioritylow.png rename to UnusedBitmaps/ui/buttons/cmd_prioritylow.png diff --git a/bitmaps/ui/buttons/cmd_prioritymed.png b/UnusedBitmaps/ui/buttons/cmd_prioritymed.png similarity index 100% rename from bitmaps/ui/buttons/cmd_prioritymed.png rename to UnusedBitmaps/ui/buttons/cmd_prioritymed.png diff --git a/bitmaps/ui/buttons/cmd_reclaim.png b/UnusedBitmaps/ui/buttons/cmd_reclaim.png similarity index 100% rename from bitmaps/ui/buttons/cmd_reclaim.png rename to UnusedBitmaps/ui/buttons/cmd_reclaim.png diff --git a/bitmaps/ui/buttons/cmd_repair.png b/UnusedBitmaps/ui/buttons/cmd_repair.png similarity index 100% rename from bitmaps/ui/buttons/cmd_repair.png rename to UnusedBitmaps/ui/buttons/cmd_repair.png diff --git a/bitmaps/ui/buttons/cmd_repeat.png b/UnusedBitmaps/ui/buttons/cmd_repeat.png similarity index 100% rename from bitmaps/ui/buttons/cmd_repeat.png rename to UnusedBitmaps/ui/buttons/cmd_repeat.png diff --git a/bitmaps/ui/buttons/cmd_repeatoff.png b/UnusedBitmaps/ui/buttons/cmd_repeatoff.png similarity index 100% rename from bitmaps/ui/buttons/cmd_repeatoff.png rename to UnusedBitmaps/ui/buttons/cmd_repeatoff.png diff --git a/bitmaps/ui/buttons/cmd_repeaton.png b/UnusedBitmaps/ui/buttons/cmd_repeaton.png similarity index 100% rename from bitmaps/ui/buttons/cmd_repeaton.png rename to UnusedBitmaps/ui/buttons/cmd_repeaton.png diff --git a/bitmaps/ui/buttons/cmd_restore.png b/UnusedBitmaps/ui/buttons/cmd_restore.png similarity index 100% rename from bitmaps/ui/buttons/cmd_restore.png rename to UnusedBitmaps/ui/buttons/cmd_restore.png diff --git a/bitmaps/ui/buttons/cmd_sell.png b/UnusedBitmaps/ui/buttons/cmd_sell.png similarity index 100% rename from bitmaps/ui/buttons/cmd_sell.png rename to UnusedBitmaps/ui/buttons/cmd_sell.png diff --git a/bitmaps/ui/buttons/cmd_stop.png b/UnusedBitmaps/ui/buttons/cmd_stop.png similarity index 100% rename from bitmaps/ui/buttons/cmd_stop.png rename to UnusedBitmaps/ui/buttons/cmd_stop.png diff --git a/bitmaps/ui/buttons/cmd_trajectory.png b/UnusedBitmaps/ui/buttons/cmd_trajectory.png similarity index 100% rename from bitmaps/ui/buttons/cmd_trajectory.png rename to UnusedBitmaps/ui/buttons/cmd_trajectory.png diff --git a/bitmaps/ui/buttons/cmd_unload.png b/UnusedBitmaps/ui/buttons/cmd_unload.png similarity index 100% rename from bitmaps/ui/buttons/cmd_unload.png rename to UnusedBitmaps/ui/buttons/cmd_unload.png diff --git a/bitmaps/ui/buttons/cmd_wait.png b/UnusedBitmaps/ui/buttons/cmd_wait.png similarity index 100% rename from bitmaps/ui/buttons/cmd_wait.png rename to UnusedBitmaps/ui/buttons/cmd_wait.png diff --git a/bitmaps/ui/buttons/retreat_30.png b/UnusedBitmaps/ui/buttons/retreat_30.png similarity index 100% rename from bitmaps/ui/buttons/retreat_30.png rename to UnusedBitmaps/ui/buttons/retreat_30.png diff --git a/bitmaps/ui/buttons/retreat_60.png b/UnusedBitmaps/ui/buttons/retreat_60.png similarity index 100% rename from bitmaps/ui/buttons/retreat_60.png rename to UnusedBitmaps/ui/buttons/retreat_60.png diff --git a/bitmaps/ui/buttons/retreat_90.png b/UnusedBitmaps/ui/buttons/retreat_90.png similarity index 100% rename from bitmaps/ui/buttons/retreat_90.png rename to UnusedBitmaps/ui/buttons/retreat_90.png diff --git a/bitmaps/ui/buttons/retreat_off.png b/UnusedBitmaps/ui/buttons/retreat_off.png similarity index 100% rename from bitmaps/ui/buttons/retreat_off.png rename to UnusedBitmaps/ui/buttons/retreat_off.png diff --git a/bitmaps/ui/loadingscreen/5units.png b/UnusedBitmaps/ui/loadingscreen/5units.png similarity index 100% rename from bitmaps/ui/loadingscreen/5units.png rename to UnusedBitmaps/ui/loadingscreen/5units.png diff --git a/bitmaps/ui/loadingscreen/awesome.png b/UnusedBitmaps/ui/loadingscreen/awesome.png similarity index 100% rename from bitmaps/ui/loadingscreen/awesome.png rename to UnusedBitmaps/ui/loadingscreen/awesome.png diff --git a/bitmaps/ui/loadingscreen/background1.png b/UnusedBitmaps/ui/loadingscreen/background1.png similarity index 100% rename from bitmaps/ui/loadingscreen/background1.png rename to UnusedBitmaps/ui/loadingscreen/background1.png diff --git a/bitmaps/ui/loadingscreen/background2.png b/UnusedBitmaps/ui/loadingscreen/background2.png similarity index 100% rename from bitmaps/ui/loadingscreen/background2.png rename to UnusedBitmaps/ui/loadingscreen/background2.png diff --git a/bitmaps/ui/loadingscreen/background3.png b/UnusedBitmaps/ui/loadingscreen/background3.png similarity index 100% rename from bitmaps/ui/loadingscreen/background3.png rename to UnusedBitmaps/ui/loadingscreen/background3.png diff --git a/bitmaps/ui/loadingscreen/background4.png b/UnusedBitmaps/ui/loadingscreen/background4.png similarity index 100% rename from bitmaps/ui/loadingscreen/background4.png rename to UnusedBitmaps/ui/loadingscreen/background4.png diff --git a/bitmaps/ui/loadingscreen/background5.png b/UnusedBitmaps/ui/loadingscreen/background5.png similarity index 100% rename from bitmaps/ui/loadingscreen/background5.png rename to UnusedBitmaps/ui/loadingscreen/background5.png diff --git a/bitmaps/ui/loadingscreen/background6.png b/UnusedBitmaps/ui/loadingscreen/background6.png similarity index 100% rename from bitmaps/ui/loadingscreen/background6.png rename to UnusedBitmaps/ui/loadingscreen/background6.png diff --git a/bitmaps/ui/loadingscreen/background7.png b/UnusedBitmaps/ui/loadingscreen/background7.png similarity index 100% rename from bitmaps/ui/loadingscreen/background7.png rename to UnusedBitmaps/ui/loadingscreen/background7.png diff --git a/bitmaps/ui/loadingscreen/background8.png b/UnusedBitmaps/ui/loadingscreen/background8.png similarity index 100% rename from bitmaps/ui/loadingscreen/background8.png rename to UnusedBitmaps/ui/loadingscreen/background8.png diff --git a/bitmaps/ui/loadingscreen/background9.png b/UnusedBitmaps/ui/loadingscreen/background9.png similarity index 100% rename from bitmaps/ui/loadingscreen/background9.png rename to UnusedBitmaps/ui/loadingscreen/background9.png diff --git a/bitmaps/ui/loadingscreen/ebombtip.png b/UnusedBitmaps/ui/loadingscreen/ebombtip.png similarity index 100% rename from bitmaps/ui/loadingscreen/ebombtip.png rename to UnusedBitmaps/ui/loadingscreen/ebombtip.png diff --git a/bitmaps/ui/loadingscreen/edronetip.png b/UnusedBitmaps/ui/loadingscreen/edronetip.png similarity index 100% rename from bitmaps/ui/loadingscreen/edronetip.png rename to UnusedBitmaps/ui/loadingscreen/edronetip.png diff --git a/bitmaps/ui/loadingscreen/eextankdestroyertip.png b/UnusedBitmaps/ui/loadingscreen/eextankdestroyertip.png similarity index 100% rename from bitmaps/ui/loadingscreen/eextankdestroyertip.png rename to UnusedBitmaps/ui/loadingscreen/eextankdestroyertip.png diff --git a/bitmaps/ui/loadingscreen/efusion2tip.png b/UnusedBitmaps/ui/loadingscreen/efusion2tip.png similarity index 100% rename from bitmaps/ui/loadingscreen/efusion2tip.png rename to UnusedBitmaps/ui/loadingscreen/efusion2tip.png diff --git a/bitmaps/ui/loadingscreen/ekmartip.png b/UnusedBitmaps/ui/loadingscreen/ekmartip.png similarity index 100% rename from bitmaps/ui/loadingscreen/ekmartip.png rename to UnusedBitmaps/ui/loadingscreen/ekmartip.png diff --git a/bitmaps/ui/loadingscreen/emetalextractortip.png b/UnusedBitmaps/ui/loadingscreen/emetalextractortip.png similarity index 100% rename from bitmaps/ui/loadingscreen/emetalextractortip.png rename to UnusedBitmaps/ui/loadingscreen/emetalextractortip.png diff --git a/bitmaps/ui/loadingscreen/megusta.png b/UnusedBitmaps/ui/loadingscreen/megusta.png similarity index 100% rename from bitmaps/ui/loadingscreen/megusta.png rename to UnusedBitmaps/ui/loadingscreen/megusta.png diff --git a/bitmaps/ui/loadingscreen/orbtip.png b/UnusedBitmaps/ui/loadingscreen/orbtip.png similarity index 100% rename from bitmaps/ui/loadingscreen/orbtip.png rename to UnusedBitmaps/ui/loadingscreen/orbtip.png diff --git a/bitmaps/ui/loadingscreen/panels.png b/UnusedBitmaps/ui/loadingscreen/panels.png similarity index 100% rename from bitmaps/ui/loadingscreen/panels.png rename to UnusedBitmaps/ui/loadingscreen/panels.png diff --git a/bitmaps/ui/loadingscreen/rainbows.png b/UnusedBitmaps/ui/loadingscreen/rainbows.png similarity index 100% rename from bitmaps/ui/loadingscreen/rainbows.png rename to UnusedBitmaps/ui/loadingscreen/rainbows.png diff --git a/bitmaps/ui/loadingscreen/repeattip.png b/UnusedBitmaps/ui/loadingscreen/repeattip.png similarity index 100% rename from bitmaps/ui/loadingscreen/repeattip.png rename to UnusedBitmaps/ui/loadingscreen/repeattip.png diff --git a/bitmaps/ui/loadingscreen/tiptemplate.psd b/UnusedBitmaps/ui/loadingscreen/tiptemplate.psd similarity index 100% rename from bitmaps/ui/loadingscreen/tiptemplate.psd rename to UnusedBitmaps/ui/loadingscreen/tiptemplate.psd diff --git a/bitmaps/ui/manual/1x1trans.png b/UnusedBitmaps/ui/manual/1x1trans.png similarity index 100% rename from bitmaps/ui/manual/1x1trans.png rename to UnusedBitmaps/ui/manual/1x1trans.png 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/UnusedUnittextures/lego2skin_explorer - 2048.dds b/UnusedUnittextures/lego2skin_explorer - 2048.dds new file mode 100644 index 000000000..cd3a069cf Binary files /dev/null and b/UnusedUnittextures/lego2skin_explorer - 2048.dds differ 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/bigbug_death.lua b/Weapons/ChickenDefenseWeapons/bigbug_death.lua new file mode 100644 index 000000000..06c013885 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/bigbug_death.lua @@ -0,0 +1,19 @@ +return { + bigbug_death = { + areaofeffect = "16", + craterboost = "0", + cratermult = "0", + explosiongenerator = "custom:chickenunitexplosion-large-red", + impulseboost = "0", + impulsefactor = "0.4", + name = "bigbug_death", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/bigbugdie", + turret = "1", + weaponvelocity = "250", + damage = { + default = "0.001", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/bug_death.lua b/Weapons/ChickenDefenseWeapons/bug_death.lua new file mode 100644 index 000000000..924ea5be2 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/bug_death.lua @@ -0,0 +1,86 @@ +return { + 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 = 100, + reloadtime = 0, + --soundhit = "ChickenDefenseSounds/bugdie", + turret = 1, + weaponvelocity = 250, + customparams = { + damagetype = "light", + nofriendlyfire = 1, + }, + damage = { + default = 100, + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/burrow_spew.lua b/Weapons/ChickenDefenseWeapons/burrow_spew.lua new file mode 100644 index 000000000..90fb05766 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/burrow_spew.lua @@ -0,0 +1,19 @@ +return { + burrow_spew = { + areaofeffect = 50, + craterboost = 0, + cratermult = 0, + edgeeffectiveness = 0, + explosiongenerator = "custom:blood_explode", + impulseboost = 1, + impulsefactor = 1, + name = "burrow_spew", + range = 60, + reloadtime = 3.6, + turret = 1, + weaponvelocity = 70, + damage = { + default = 450, + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/dodo_death1.lua b/Weapons/ChickenDefenseWeapons/dodo_death1.lua new file mode 100644 index 000000000..dfb32dbdb --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/dodo_death1.lua @@ -0,0 +1,23 @@ +return { + dodo_death1 = { + areaofeffect = "300", + camerashake = "0", + craterboost = "0", + cratermult = "0", + edgeeffectiveness = "0.075", + explosiongenerator = "custom:chickenunitexplosion-medium-red", + impulseboost = "0.2", + impulsefactor = "0.2", + interceptedbyshieldtype = "1", + name = "CrawlingBomb", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/chicken_nuke", + soundstart = "ChickenDefenseSounds/smallchickendead", + turret = "1", + weaponvelocity = "250", + damage = { + default = "650", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/dodo_death2.lua b/Weapons/ChickenDefenseWeapons/dodo_death2.lua new file mode 100644 index 000000000..f3ce3942f --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/dodo_death2.lua @@ -0,0 +1,22 @@ +return { + dodo_death2 = { + areaofeffect = "350", + craterboost = "0", + cratermult = "0", + edgeeffectiveness = "0.1", + explosiongenerator = "custom:chickenunitexplosion-large-red", + impulseboost = "0.5", + impulsefactor = "0.5", + interceptedbyshieldtype = "1", + name = "CrawlingBomb", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/chicken_nuke", + soundstart = "ChickenDefenseSounds/smallchickendead", + turret = "1", + weaponvelocity = "250", + damage = { + default = "4000", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/flamebug_death.lua b/Weapons/ChickenDefenseWeapons/flamebug_death.lua new file mode 100644 index 000000000..ee712a3e1 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/flamebug_death.lua @@ -0,0 +1,24 @@ +return { + flamebug_death = { + areaofeffect = "120", + craterboost = "0", + cratermult = "0", + edgeeffectiveness = "0.7", + explosiongenerator = "custom:gundam_MISSILE_EXPLOSION", + impulseboost = "0", + impulsefactor = "0.4", + interceptedbyshieldtype = "1", + name = "flamebug_death", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/chicken_nuke", + soundstart = "ChickenDefenseSounds/bigbugdie", + turret = "1", + weaponvelocity = "250", + damage = { + chicken = "100", + default = "300", + tinychicken = "25", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/lobber_morph.lua b/Weapons/ChickenDefenseWeapons/lobber_morph.lua new file mode 100644 index 000000000..0ac91690b --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/lobber_morph.lua @@ -0,0 +1,19 @@ +return { + lobber_morph = { + areaofeffect = "8", + craterboost = "0", + cratermult = "0", + explosiongenerator = "custom:ELECTRIC_EXPLOSION", + impulseboost = "0", + impulsefactor = "0", + name = "lobberMorph", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/bigbugdie", + turret = "1", + weaponvelocity = "250", + damage = { + default = "0.001", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/queen_death.lua b/Weapons/ChickenDefenseWeapons/queen_death.lua new file mode 100644 index 000000000..74ec23c20 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/queen_death.lua @@ -0,0 +1,19 @@ +return { + queen_death = { + areaofeffect = "16", + craterboost = "0", + cratermult = "0", + impulseboost = "0", + impulsefactor = "0.4", + explosiongenerator = "custom:nukedatbewm-roost", + name = "queen_death", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/bigchickendead", + turret = "1", + weaponvelocity = "250", + damage = { + default = "0.001", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/roost_death.lua b/Weapons/ChickenDefenseWeapons/roost_death.lua new file mode 100644 index 000000000..56e92ae5c --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/roost_death.lua @@ -0,0 +1,19 @@ +return { + roost_death = { + areaofeffect = "16", + craterboost = "0", + cratermult = "0", + impulseboost = "0", + impulsefactor = "0.4", + explosiongenerator = "custom:chickenunitexplosion-large-red", + name = "roost_death", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/roostdie", + turret = "1", + weaponvelocity = "250", + damage = { + default = "0.001", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/talon_death.lua b/Weapons/ChickenDefenseWeapons/talon_death.lua new file mode 100644 index 000000000..d2529a5f0 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/talon_death.lua @@ -0,0 +1,19 @@ +return { + talon_death = { + areaofeffect = "16", + craterboost = "0", + cratermult = "0", + impulseboost = "0", + impulsefactor = "0.4", + explosiongenerator = "custom:chickenunitexplosion-small-red", + name = "talon_death", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/talondie", + turret = "1", + weaponvelocity = "250", + damage = { + default = "0.001", + }, + }, +} diff --git a/Weapons/ChickenDefenseWeapons/weaver_death.lua b/Weapons/ChickenDefenseWeapons/weaver_death.lua new file mode 100644 index 000000000..a02ffc208 --- /dev/null +++ b/Weapons/ChickenDefenseWeapons/weaver_death.lua @@ -0,0 +1,24 @@ +return { + weaver_death = { + areaofeffect = "128", + craterboost = "0", + cratermult = "0", + edgeeffectiveness = "0.5", + explosiongenerator = "custom:ELECTRIC_EXPLOSION", + impulseboost = "0", + impulsefactor = "0", + interceptedbyshieldtype = "1", + name = "WeaverEMPBomb", + range = "450", + reloadtime = "3.6", + soundhit = "ChickenDefenseSounds/junohit2edit", + soundstart = "ChickenDefenseSounds/smallchickendead", + turret = "1", + weaponvelocity = "250", + damage = { + chicken = "0.001", + default = "240", + tinychicken = "0.001", + }, + }, +} 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/Unit_Explosions.lua b/Weapons/Unit_Explosions.lua index 8b20af81a..63ccd1822 100644 --- a/Weapons/Unit_Explosions.lua +++ b/Weapons/Unit_Explosions.lua @@ -615,377 +615,6 @@ unitDeaths = { default = 0, }, }, - - - --- Old and busted -SMALL_BUILDING = { - name = "Small building", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode2.wav", - soundhit="explode2.wav", - explosiongenerator="custom:FACTORY_EXPLOSION_SMALL", - cameraShake=200, - damage = { - default = 0, - }, - }, - -MEDIUM_BUILDING = { - name="Medium building", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode4.wav", - soundhit="explode4.wav", - explosiongenerator="custom:FACTORY_EXPLOSION_MEDIUM", - cameraShake=400, - damage = { - default = 0, - }, - }, - -LARGE_BUILDING = { - - name="Large building", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode1.wav", - soundhit="explode1.wav", - explosiongenerator="custom:FACTORY_EXPLOSION", - cameraShake=600, - damage = { - default = 0, - }, - }, - -ESTOR_BUILDING = { - name="Small building", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode4.wav", - soundhit="explode4.wav", - explosiongenerator="custom:FACTORY_EXPLOSION_SMALL", - cameraShake=100, - damage = { - default = 0, - }, - }, - -SMALL_UNIT = { - - name="Small tank", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode2.wav", - soundhit="explode2.wav", - cameraShake=100, - - explosiongenerator="custom:SMALL_UNIT_Expl", - damage = { - default = 0, - }, - }, - - -MEDIUM_UNIT = { - - name="Medium Unit", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode4.wav", - soundhit="explode4.wav", - explosiongenerator="custom:MED_UNIT_Expl", - cameraShake=200, - damage = { - default = 0, - }, - }, - - - -BIG_UNIT = { - - name="Big Kbot", - weaponType = "Cannon", - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode3.wav", - soundhit="explode3.wav", - explosiongenerator="custom:BIG_UNIT_Expl", - cameraShake=300, - damage = { - default = 0, - }, - }, - -CONSTRUCTOR = { - - name="con", - weaponType = "Cannon", - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=500, - soundstart="explode5.wav", - soundhit="explode5.wav", - cameraShake=100, - - explosiongenerator="custom:greencannonimpact", - damage = { - default = -100, - }, - }, - -ebombblast = { - - name="hoverbomb", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=556, - soundstart="unitexplodemedium.wav", - soundhit="unitexplodemedium.wav", - explosiongenerator="custom:CRAWL_SUICIDE_Expl", - customparams = { - damagetype = "default", - nofriendlyfire = "1", - }, - - damage = { - default = 1000, - }, - }, - -krabblast = { - - name="krabblast", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="unitexplodemedium.wav", - soundhit="unitexplodemedium.wav", - explosiongenerator="custom:KRABDEATH", - cameraShake=500, - customparams = { - damagetype = "default", - }, - - damage = { - default = 0, - }, - }, - - -MEXPOP2 = { - name="Atomic Blast Weapon", - weaponType = "Cannon", - - turret=1, - range=500, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode5.wav", - soundhit="explode5.wav", - - impulsefactor=0, - explosiongenerator="custom:NUKE", - - - damage = { - default = 0, - }, - }, - -PYRO_BLAST = { - - name="Pyro Blast", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="unitexplodesmall.wav", - soundhit="unitexplodesmall.wav", - explosiongenerator="custom:PYRO_UNIT_Expl", - cameraShake=100, - - damage = { - default = 0, - }, - }, - -FUSIONPOP = { - - name="Atomic Blast Weapon", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode3.wav", - soundhit="explode3.wav", - cameraShake=400, - - explosiongenerator="custom:POWERPLANT_EXPLOSION_BIG", - customparams = { - damagetype = "default", - }, - - damage = { - default = 0, - }, - }, -POWERPLANTPOP = { - - name="Atomic Blast Weapon", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=600, - AreaOfEffect=0, - soundstart="explode3.wav", - soundhit="explode3.wav", - cameraShake=200, - - explosiongenerator="custom:POWERPLANT_EXPLOSION", - customparams = { - damagetype = "default", - }, - - damage = { - default = 0, - }, - }, - -GEOPOP = { - - name="Atomic Blast Weapon", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=480, - reloadtime=3.6, - weaponvelocity=500, - AreaOfEffect=0, - soundstart="explode3.wav", - soundhit="explode3.wav", - cameraShake=300, - - explosiongenerator="custom:POWERPLANT_EXPLOSION_MEDIUM", - customparams = { - damagetype = "default", - }, - - damage = { - default = 0, - }, - }, - -HUGE_UNITEX = { - - name="Big Kbot", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=550, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode1.wav", - soundhit="explode1.wav", - explosiongenerator="custom:HUGE_UNIT_Expl", - cameraShake=500, - - damage = { - default = 0, - }, - }, - - -HUGE_UNIT = { - - name="Big Kbot", - weaponType = "Cannon", - - turret=1, - impulseFactor = 0, - range=550, - reloadtime=3.6, - weaponvelocity=250, - AreaOfEffect=0, - soundstart="explode1.wav", - soundhit="explode1.wav", - explosiongenerator="custom:HUGE_UNIT_Expl", - cameraShake=500, - - damage = { - default = 0, - }, - }, } return lowerkeys(unitDeaths) 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/GPL/sporetrail.tga b/bitmaps/GPL/sporetrail.tga new file mode 100644 index 000000000..7dc3cb0ce Binary files /dev/null and b/bitmaps/GPL/sporetrail.tga differ diff --git a/bitmaps/PD/bloodblast.tga b/bitmaps/PD/bloodblast.tga new file mode 100644 index 000000000..3ab2e9d94 Binary files /dev/null and b/bitmaps/PD/bloodblast.tga differ diff --git a/bitmaps/PD/bloodblastwhite.tga b/bitmaps/PD/bloodblastwhite.tga new file mode 100644 index 000000000..1f662955a Binary files /dev/null and b/bitmaps/PD/bloodblastwhite.tga differ diff --git a/bitmaps/PD/blooddrop.tga b/bitmaps/PD/blooddrop.tga new file mode 100644 index 000000000..92a952830 Binary files /dev/null and b/bitmaps/PD/blooddrop.tga differ diff --git a/bitmaps/PD/blooddropwhite.tga b/bitmaps/PD/blooddropwhite.tga new file mode 100644 index 000000000..962493f73 Binary files /dev/null and b/bitmaps/PD/blooddropwhite.tga differ diff --git a/bitmaps/PD/bloodsplat.tga b/bitmaps/PD/bloodsplat.tga new file mode 100644 index 000000000..baa162786 Binary files /dev/null and b/bitmaps/PD/bloodsplat.tga differ diff --git a/bitmaps/PD/null.tga b/bitmaps/PD/null.tga new file mode 100644 index 000000000..66fcd6809 Binary files /dev/null and b/bitmaps/PD/null.tga differ diff --git a/bitmaps/cc/dirt.png b/bitmaps/cc/dirt.png new file mode 100644 index 000000000..2dd9dab95 Binary files /dev/null and b/bitmaps/cc/dirt.png differ diff --git a/bitmaps/cc/purpleexplo.tga b/bitmaps/cc/purpleexplo.tga new file mode 100644 index 000000000..da092a79f Binary files /dev/null and b/bitmaps/cc/purpleexplo.tga differ diff --git a/bitmaps/cc/uglynovaexplo.tga b/bitmaps/cc/uglynovaexplo.tga new file mode 100644 index 000000000..aab3b7ecd Binary files /dev/null and b/bitmaps/cc/uglynovaexplo.tga differ diff --git a/bitmaps/default/circularthingy.tga b/bitmaps/default/circularthingy.tga index f0b505e4f..321215c4a 100644 Binary files a/bitmaps/default/circularthingy.tga and b/bitmaps/default/circularthingy.tga differ 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/evologo.bmp b/bitmaps/evologo.bmp index 63491e561..f9f50e34b 100644 Binary files a/bitmaps/evologo.bmp and b/bitmaps/evologo.bmp differ diff --git a/bitmaps/evologo.png b/bitmaps/evologo.png index 49d1643e9..1c665a88d 100644 Binary files a/bitmaps/evologo.png and b/bitmaps/evologo.png differ diff --git a/bitmaps/fireball.tga b/bitmaps/fireball.tga new file mode 100644 index 000000000..77b43c996 Binary files /dev/null and b/bitmaps/fireball.tga differ diff --git a/bitmaps/graysmoke.tga b/bitmaps/graysmoke.tga new file mode 100644 index 000000000..d802a8724 Binary files /dev/null and b/bitmaps/graysmoke.tga differ diff --git a/bitmaps/loadpictures/start1.jpg b/bitmaps/loadpictures/start1.jpg index 9dff3641d..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 new file mode 100644 index 000000000..05f4d336b Binary files /dev/null and b/bitmaps/loadpictures/start10.jpg differ diff --git a/bitmaps/loadpictures/start11.jpg b/bitmaps/loadpictures/start11.jpg new file mode 100644 index 000000000..13dfe5790 Binary files /dev/null and b/bitmaps/loadpictures/start11.jpg differ diff --git a/bitmaps/loadpictures/start12.jpg b/bitmaps/loadpictures/start12.jpg new file mode 100644 index 000000000..5da54c557 Binary files /dev/null and b/bitmaps/loadpictures/start12.jpg differ diff --git a/bitmaps/loadpictures/start13.jpg b/bitmaps/loadpictures/start13.jpg new file mode 100644 index 000000000..01e69f324 Binary files /dev/null and b/bitmaps/loadpictures/start13.jpg differ diff --git a/bitmaps/loadpictures/start14.jpg b/bitmaps/loadpictures/start14.jpg new file mode 100644 index 000000000..d8205c2db Binary files /dev/null and b/bitmaps/loadpictures/start14.jpg differ diff --git a/bitmaps/loadpictures/start15.jpg b/bitmaps/loadpictures/start15.jpg new file mode 100644 index 000000000..91c78e088 Binary files /dev/null and b/bitmaps/loadpictures/start15.jpg differ diff --git a/bitmaps/loadpictures/start16.jpg b/bitmaps/loadpictures/start16.jpg new file mode 100644 index 000000000..9204d0c39 Binary files /dev/null and b/bitmaps/loadpictures/start16.jpg differ diff --git a/bitmaps/loadpictures/start17.jpg b/bitmaps/loadpictures/start17.jpg new file mode 100644 index 000000000..ddfac663a Binary files /dev/null and b/bitmaps/loadpictures/start17.jpg differ diff --git a/bitmaps/loadpictures/start18.jpg b/bitmaps/loadpictures/start18.jpg new file mode 100644 index 000000000..fdfc034c4 Binary files /dev/null and b/bitmaps/loadpictures/start18.jpg differ diff --git a/bitmaps/loadpictures/start19.jpg b/bitmaps/loadpictures/start19.jpg new file mode 100644 index 000000000..6f0bd7cd1 Binary files /dev/null and b/bitmaps/loadpictures/start19.jpg differ diff --git a/bitmaps/loadpictures/start2.jpg b/bitmaps/loadpictures/start2.jpg index 70717f203..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 new file mode 100644 index 000000000..4459250af Binary files /dev/null and b/bitmaps/loadpictures/start20.jpg differ diff --git a/bitmaps/loadpictures/start21.jpg b/bitmaps/loadpictures/start21.jpg new file mode 100644 index 000000000..52226a460 Binary files /dev/null and b/bitmaps/loadpictures/start21.jpg differ diff --git a/bitmaps/loadpictures/start22.jpg b/bitmaps/loadpictures/start22.jpg new file mode 100644 index 000000000..0c4f709de Binary files /dev/null and b/bitmaps/loadpictures/start22.jpg differ diff --git a/bitmaps/loadpictures/start23.jpg b/bitmaps/loadpictures/start23.jpg new file mode 100644 index 000000000..51b444d6e Binary files /dev/null and b/bitmaps/loadpictures/start23.jpg differ diff --git a/bitmaps/loadpictures/start24.jpg b/bitmaps/loadpictures/start24.jpg new file mode 100644 index 000000000..4625e0c9f Binary files /dev/null and b/bitmaps/loadpictures/start24.jpg differ diff --git a/bitmaps/loadpictures/start25.jpg b/bitmaps/loadpictures/start25.jpg new file mode 100644 index 000000000..e2585b70b Binary files /dev/null and b/bitmaps/loadpictures/start25.jpg differ diff --git a/bitmaps/loadpictures/start26.jpg b/bitmaps/loadpictures/start26.jpg new file mode 100644 index 000000000..6cea7fbe0 Binary files /dev/null and b/bitmaps/loadpictures/start26.jpg differ diff --git a/bitmaps/loadpictures/start27.jpg b/bitmaps/loadpictures/start27.jpg new file mode 100644 index 000000000..8acb0da91 Binary files /dev/null and b/bitmaps/loadpictures/start27.jpg differ diff --git a/bitmaps/loadpictures/start28.jpg b/bitmaps/loadpictures/start28.jpg new file mode 100644 index 000000000..3c9d887d1 Binary files /dev/null and b/bitmaps/loadpictures/start28.jpg differ diff --git a/bitmaps/loadpictures/start3.jpg b/bitmaps/loadpictures/start3.jpg index a33a5383c..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 019275c6c..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 c09ce3255..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 b8a88aba9..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 9d8a2c0c1..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 4109d818f..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 faa1b1369..92f1cb88e 100644 Binary files a/bitmaps/loadpictures/start9.jpg and b/bitmaps/loadpictures/start9.jpg differ diff --git a/bitmaps/projectiletextures/bigexplosmoke-chickens.tga b/bitmaps/projectiletextures/bigexplosmoke-chickens.tga new file mode 100644 index 000000000..97ba1cd90 Binary files /dev/null and b/bitmaps/projectiletextures/bigexplosmoke-chickens.tga 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/circularthingy.tga b/bitmaps/projectiletextures/circularthingy.tga index f0b505e4f..321215c4a 100644 Binary files a/bitmaps/projectiletextures/circularthingy.tga and b/bitmaps/projectiletextures/circularthingy.tga differ diff --git a/bitmaps/projectiletextures/electnovaexplo.png b/bitmaps/projectiletextures/electnovaexplo.png deleted file mode 100644 index 7bc7ba8e1..000000000 Binary files a/bitmaps/projectiletextures/electnovaexplo.png and /dev/null differ diff --git a/bitmaps/projectiletextures/electricalarc.png b/bitmaps/projectiletextures/electricalarc.png index 5fe48d411..d0fff2f74 100644 Binary files a/bitmaps/projectiletextures/electricalarc.png and b/bitmaps/projectiletextures/electricalarc.png differ diff --git a/bitmaps/projectiletextures/explowave.tga b/bitmaps/projectiletextures/explowave.tga deleted file mode 100644 index 9458bb5c3..000000000 Binary files a/bitmaps/projectiletextures/explowave.tga and /dev/null differ diff --git a/bitmaps/projectiletextures/flare-chickens.tga b/bitmaps/projectiletextures/flare-chickens.tga new file mode 100644 index 000000000..75934213f Binary files /dev/null and b/bitmaps/projectiletextures/flare-chickens.tga 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-chickens.tga b/bitmaps/projectiletextures/flashside2-chickens.tga new file mode 100644 index 000000000..2d6ae04e4 Binary files /dev/null and b/bitmaps/projectiletextures/flashside2-chickens.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/gunshot-chickens.tga b/bitmaps/projectiletextures/gunshot-chickens.tga new file mode 100644 index 000000000..c056dada7 Binary files /dev/null and b/bitmaps/projectiletextures/gunshot-chickens.tga differ diff --git a/bitmaps/projectiletextures/heal.png b/bitmaps/projectiletextures/heal.png index 1242186a4..0a67c906b 100644 Binary files a/bitmaps/projectiletextures/heal.png and b/bitmaps/projectiletextures/heal.png differ diff --git a/bitmaps/projectiletextures/lightb3-transparent.png b/bitmaps/projectiletextures/lightb3-transparent.png index 644f9a979..f7267c53e 100644 Binary files a/bitmaps/projectiletextures/lightb3-transparent.png and b/bitmaps/projectiletextures/lightb3-transparent.png differ diff --git a/bitmaps/projectiletextures/lightb4-bw.tga b/bitmaps/projectiletextures/lightb4-bw.tga new file mode 100644 index 000000000..1fbb8cb16 Binary files /dev/null and b/bitmaps/projectiletextures/lightb4-bw.tga differ diff --git a/bitmaps/projectiletextures/longshot.png b/bitmaps/projectiletextures/longshot.png index c4bdbbff5..0cbf02ba8 100644 Binary files a/bitmaps/projectiletextures/longshot.png and b/bitmaps/projectiletextures/longshot.png differ diff --git a/bitmaps/projectiletextures/moarpower.png b/bitmaps/projectiletextures/moarpower.png index 27cba7af0..ff18ab016 100644 Binary files a/bitmaps/projectiletextures/moarpower.png and b/bitmaps/projectiletextures/moarpower.png differ diff --git a/bitmaps/projectiletextures/randomdots-chickens.tga b/bitmaps/projectiletextures/randomdots-chickens.tga new file mode 100644 index 000000000..f0b505e4f Binary files /dev/null and b/bitmaps/projectiletextures/randomdots-chickens.tga differ diff --git a/bitmaps/projectiletextures/shield4.png b/bitmaps/projectiletextures/shield4.png index 7b5d1add2..d11e9cf04 100644 Binary files a/bitmaps/projectiletextures/shield4.png and b/bitmaps/projectiletextures/shield4.png differ diff --git a/bitmaps/projectiletextures/smoke-chickens.tga b/bitmaps/projectiletextures/smoke-chickens.tga new file mode 100644 index 000000000..fd86903ab Binary files /dev/null and b/bitmaps/projectiletextures/smoke-chickens.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/bitmaps/projectiletextures/wake-chickens.tga b/bitmaps/projectiletextures/wake-chickens.tga new file mode 100644 index 000000000..a8ac6b226 Binary files /dev/null and b/bitmaps/projectiletextures/wake-chickens.tga differ diff --git a/bitmaps/smoke/smoke0000.bmp b/bitmaps/smoke/smoke0000.bmp deleted file mode 100644 index 8a0dcd351..000000000 Binary files a/bitmaps/smoke/smoke0000.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0001.bmp b/bitmaps/smoke/smoke0001.bmp deleted file mode 100644 index f99b37734..000000000 Binary files a/bitmaps/smoke/smoke0001.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0002.bmp b/bitmaps/smoke/smoke0002.bmp deleted file mode 100644 index 8fee157ae..000000000 Binary files a/bitmaps/smoke/smoke0002.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0003.bmp b/bitmaps/smoke/smoke0003.bmp deleted file mode 100644 index e3ced2857..000000000 Binary files a/bitmaps/smoke/smoke0003.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0004.bmp b/bitmaps/smoke/smoke0004.bmp deleted file mode 100644 index d0f7ce1c5..000000000 Binary files a/bitmaps/smoke/smoke0004.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0005.bmp b/bitmaps/smoke/smoke0005.bmp deleted file mode 100644 index 8cdd8e342..000000000 Binary files a/bitmaps/smoke/smoke0005.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0006.bmp b/bitmaps/smoke/smoke0006.bmp deleted file mode 100644 index 6a25e91c5..000000000 Binary files a/bitmaps/smoke/smoke0006.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0007.bmp b/bitmaps/smoke/smoke0007.bmp deleted file mode 100644 index fc43b7dc8..000000000 Binary files a/bitmaps/smoke/smoke0007.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0008.bmp b/bitmaps/smoke/smoke0008.bmp deleted file mode 100644 index e5f06a7b0..000000000 Binary files a/bitmaps/smoke/smoke0008.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0009.bmp b/bitmaps/smoke/smoke0009.bmp deleted file mode 100644 index ee2906b01..000000000 Binary files a/bitmaps/smoke/smoke0009.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0010.bmp b/bitmaps/smoke/smoke0010.bmp deleted file mode 100644 index d154e4381..000000000 Binary files a/bitmaps/smoke/smoke0010.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0011.bmp b/bitmaps/smoke/smoke0011.bmp deleted file mode 100644 index ba8ead838..000000000 Binary files a/bitmaps/smoke/smoke0011.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke0012.bmp b/bitmaps/smoke/smoke0012.bmp deleted file mode 100644 index 306b53269..000000000 Binary files a/bitmaps/smoke/smoke0012.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0000.bmp b/bitmaps/smoke/smoke_Alpha0000.bmp deleted file mode 100644 index 90c49e769..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0000.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0001.bmp b/bitmaps/smoke/smoke_Alpha0001.bmp deleted file mode 100644 index 7221ed40e..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0001.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0002.bmp b/bitmaps/smoke/smoke_Alpha0002.bmp deleted file mode 100644 index 3482ace1e..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0002.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0003.bmp b/bitmaps/smoke/smoke_Alpha0003.bmp deleted file mode 100644 index 8e029ef7f..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0003.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0004.bmp b/bitmaps/smoke/smoke_Alpha0004.bmp deleted file mode 100644 index 40eda3308..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0004.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0005.bmp b/bitmaps/smoke/smoke_Alpha0005.bmp deleted file mode 100644 index 80320aebe..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0005.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0006.bmp b/bitmaps/smoke/smoke_Alpha0006.bmp deleted file mode 100644 index 704eb7328..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0006.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0007.bmp b/bitmaps/smoke/smoke_Alpha0007.bmp deleted file mode 100644 index be188c58d..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0007.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0008.bmp b/bitmaps/smoke/smoke_Alpha0008.bmp deleted file mode 100644 index 270524ce0..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0008.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0009.bmp b/bitmaps/smoke/smoke_Alpha0009.bmp deleted file mode 100644 index 72e357af1..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0009.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0010.bmp b/bitmaps/smoke/smoke_Alpha0010.bmp deleted file mode 100644 index 4a2973d6a..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0010.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0011.bmp b/bitmaps/smoke/smoke_Alpha0011.bmp deleted file mode 100644 index f13d5b95f..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0011.bmp and /dev/null differ diff --git a/bitmaps/smoke/smoke_Alpha0012.bmp b/bitmaps/smoke/smoke_Alpha0012.bmp deleted file mode 100644 index 12a977f02..000000000 Binary files a/bitmaps/smoke/smoke_Alpha0012.bmp and /dev/null differ diff --git a/bitmaps/tracks/chickentrack.bmp b/bitmaps/tracks/chickentrack.bmp new file mode 100644 index 000000000..fe52a8c79 Binary files /dev/null and b/bitmaps/tracks/chickentrack.bmp differ diff --git a/bitmaps/tracks/chickentrackpointy.bmp b/bitmaps/tracks/chickentrackpointy.bmp new file mode 100644 index 000000000..657069835 Binary files /dev/null and b/bitmaps/tracks/chickentrackpointy.bmp differ diff --git a/commandlist.txt b/commandlist.txt new file mode 100644 index 000000000..1bbc39b11 --- /dev/null +++ b/commandlist.txt @@ -0,0 +1,187 @@ +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 +/Destroy (synced) Destroys one or multiple units by unit-ID, instantly +/DevLua (synced) Enables/Disables Lua dev-mode (can cause desyncs if enabled) +/EditDefs (synced) Allows/Disallows editing of unit-, feature- and weapon-defs through Lua +/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 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 +/NoSpectatorChat (synced) Enables/Disables spectators to use the chat +/ReloadCEGs (synced) Reloads CEG scripts +/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 +/AIKill (unsynced) Kills the Skirmish AI controlling a specified team +/AIList (unsynced) Prints a list of all currently active Skirmish AIs +/AIReload (unsynced) Reloads the Skirmish AI controlling a specified team +/AirMesh (unsynced) Show/Hide the smooth air-mesh map overlay +/AllMapMarks (unsynced) Show/Hide all map marks drawn so far +/Ally (unsynced) Starts/Ends alliance of the local players ally-team with another ally-team +/ATM (unsynced) Redirects command /ATM to its synced processor +/BufferText (unsynced) Write the argument string(s) directly to the console history, but not anywhere else. This is useful for fast manual issuing of the command, later on +/Chat (unsynced) Starts waiting for intput to be sent to +/ChatAll (unsynced) Starts waiting for intput to be sent to All +/ChatAlly (unsynced) Starts waiting for intput to be sent to Ally +/ChatSpec (unsynced) Starts waiting for intput to be sent to Spec +/ClearMapMarks (unsynced) Remove all map marks drawn so far +/Clock (unsynced) Shows a small digital clock indicating the local time +/CmdColors (unsynced) Reloads cmdcolors.txt +/CommandHelp (unsynced) Prints info about a specific chat command (so far only synced/unsynced and the description) +/CommandList (unsynced) Prints all the available chat commands with description (if available) to the console +/Console (unsynced) Enables/Disables the in-game console +/ControlUnit (unsynced) Start to first-person-control a unit +/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 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 +/DecGUIOpacity (unsynced) Decreases the the opacity(see-through-ness) of GUI elements +/DecreaseViewRadius (unsynced) Decrease the view radius (higher performance, uglier view) +/Deselect (unsynced) Deselects all currently selected units +/Destroy (unsynced) Destroys one or multiple units by unit-ID, instantly +/DistDraw (unsynced) Set the distance between units and camera, at which they turn into far-textures (flat/texture-only representation) (Graphic setting) +/DistIcon (unsynced) Set the distance between units and camera, at which they turn into icons (Graphic setting) +/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 engine-tree rendering +/DumpState (unsynced) dump game-state to file +/DynamicSky (unsynced) Enable/Disable dynamic-sky 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 +/Font (unsynced) Reloads the fonts +/FPS (unsynced) Shows/Hides the frames-per-second indicator +/FPSHud (unsynced) Enables/Disables HUD (GUI interface) shown in first-person-control mode +/Fullscreen (unsynced) Switches fullscreen mode +/GameInfo (unsynced) Enables/Disables game-info panel rendering +/GatherMode (unsynced) Enter/Leave gather-wait command mode +/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 +/Group2 (unsynced) Allows modifying the members of group 2 +/Group3 (unsynced) Allows modifying the members of group 3 +/Group4 (unsynced) Allows modifying the members of group 4 +/Group5 (unsynced) Allows modifying the members of group 5 +/Group6 (unsynced) Allows modifying the members of group 6 +/Group7 (unsynced) Allows modifying the members of group 7 +/Group8 (unsynced) Allows modifying the members of group 8 +/Group9 (unsynced) Allows modifying the members of group 9 +/HardwareCursor (unsynced) Enables/Disables hardware mouse-cursor support +/HideInterface (unsynced) Hide/Show the GUI controlls +/IncGUIOpacity (unsynced) Increases the the opacity(see-through-ness) of GUI elements +/IncreaseViewRadius (unsynced) Increase the view radius (lower performance, nicer view) +/Info (unsynced) Shows/Hides the player roster +/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 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 +/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 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 +/Mouse4 (unsynced) Simulates a mouse button press of button 4 +/Mouse5 (unsynced) Simulates a mouse button press of button 5 +/MoveBack (unsynced) Moves the camera Back a bit +/MoveDown (unsynced) Moves the camera Down a bit +/MoveFast (unsynced) Moves the camera Fast a bit +/MoveForward (unsynced) Moves the camera Forward a bit +/MoveLeft (unsynced) Moves the camera Left a bit +/MoveRight (unsynced) Moves the camera Right a bit +/MoveSlow (unsynced) Moves the camera Slow a bit +/MoveUp (unsynced) Moves the camera Up a bit +/MuteSound (unsynced) Mute/Unmute the current sound system +/NoLuaDraw (unsynced) Allow/Disallow Lua to draw on the map +/PasteText (unsynced) Paste either the argument string(s) or if none given, the content of the clip-board to chat input +/Pause (unsynced) Pause/Unpause the game +/QuitForce (unsynced) Exits game to system +/QuitMenu (unsynced) Opens the quit-menu, if it is not already open +/QuitMessage (unsynced) Deprecated, see /Quit instead (was used to quite the game immediately) +/ReloadForce (unsynced) Exits game to menu +/ReloadGame (unsynced) Restarts the game with the initially provided start-script +/ReloadShaders (unsynced) Reloads all engine shaders +/ResBar (unsynced) Shows/Hides team resource storage indicator bar +/Resync (unsynced) Redirects command /Resync to its synced processor +/SafeGL (unsynced) Enables/Disables OpenGL safe-mode +/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 +/Select (unsynced) +/SelectCycle (unsynced) +/SelectUnits (unsynced) +/Send (unsynced) Send a string as raw network message to the game host (for debugging only) +/Set (unsynced) Set a config key=value pair +/Shadows (unsynced) Disables/Enables shadows rendering: -1=disabled, 0=off, 1=full shadows, 2=skip terrain shadows +/ShareDialog (unsynced) Opens the share dialog, which allows you to send units and resources to other players +/ShowElevation (unsynced) Enable rendering of the auxiliary height-map overlay +/ShowMetalMap (unsynced) Enable rendering of the auxiliary metal-map overlay +/ShowPathCost (unsynced) Enable rendering of the path cost-map overlay +/ShowPathFlow (unsynced) Enable/Disable rendering of the path flow-map overlay +/ShowPathHeat (unsynced) Enable/Disable rendering of the path heat-map overlay +/ShowPathTraversability (unsynced) Enable rendering of the path traversability-map overlay +/ShowPathType (unsynced) Shows path traversability for a given MoveDefName, MoveDefID or UnitDefName +/ShowStandard (unsynced) Disable rendering of all auxiliary map overlays +/SlowDown (unsynced) Decreases the simulation speed. The engine will try to simulate less frames per second +/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 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, +/SpeedUp (unsynced) Increases the simulation speed. The engine will try to simulate more frames per second +/Take (unsynced) Redirects command /Take to its synced processor +/Team (unsynced) Lets the local user change to another team +/TeamHighlight (unsynced) Enables/Disables uncontrolled team blinking +/ToggleInfo (unsynced) Toggles current info texture view +/ToggleLOS (unsynced) Enable rendering of the auxiliary LOS-map overlay +/ToolTip (unsynced) Enables/Disables the general tool-tips, displayed when hovering over units. features or the map +/Track (unsynced) Start following the selected unit(s) with the camera +/TrackMode (unsynced) Shift through different ways of following selected unit(s) +/TrackOff (unsynced) Stop following the selected unit(s) with the camera +/TSet (unsynced) Set a config key=value pair in the overlay, meaning it will not be persisted for future games +/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 +/WByNum (unsynced) Say something in private to a specific player, by player-ID +/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/credits.txt b/credits/credits.txt similarity index 91% rename from credits.txt rename to credits/credits.txt index 38921264e..94ea4f3bc 100644 --- a/credits.txt +++ b/credits/credits.txt @@ -8,7 +8,22 @@ KaiserJ (Lead 3d Artist (Models, Textures)) Jay Sound (Sound Design http://www.impactgameaudio.com) -Music: +Floris +-UI Sex +-ControlVictory UI + +CommonPlayer +-Many fixes and enhancements +-Proper resource bars +-Addition of hotkeys and costs on build menu + +Dmdr +-Unit Icons + +Music: (Current Soundtrack) +The Enigma TNG http://theenigmatng.bandcamp.com/ + +Music: (Original Soundtrack) Wasp - Michael J. Powell Deathkillr84 http://deathkllr84.newgrounds.com/ FreddyFog http://freddyfog.newgrounds.com/ diff --git a/credits/dmdr_license_for_unit_icons.txt b/credits/dmdr_license_for_unit_icons.txt new file mode 100644 index 000000000..6f1e7e73f --- /dev/null +++ b/credits/dmdr_license_for_unit_icons.txt @@ -0,0 +1,24 @@ +All dmdr_* icons were modified from the original images by me, dmdr, except for the lightning bolts in dmdr_riot_alt/lit.png and dmdr_energy.png which were created from scratch (wow so talented). +They were originally created for use in Forboding_Angel's open source real time strategy game 'Evolution RTS'. + +https://github.com/EvolutionRTS/Evolution-RTS + +Source files used: + +https://openclipart.org/detail/29029/bullet-silhouettes +https://openclipart.org/detail/253954/radioactive-transparent-icon +https://openclipart.org/detail/96985/hazard-warning-sign-explosion +https://openclipart.org/detail/239289/cartoon-cheese +https://openclipart.org/detail/127483/triangle-equilateral +https://openclipart.org/detail/264375/rocket-9 +https://openclipart.org/detail/180065/abomb-by-rones +https://openclipart.org/detail/149047/pacman-hexagons +https://openclipart.org/detail/220693/medieval-shields +https://openclipart.org/detail/15971/adjustable-spanner-silhouette +https://openclipart.org/detail/27178/peace-symbol +http://www.clker.com/clipart-85755.html +https://openclipart.org/detail/29242/rubiks-cube + +Because these are all public domain images, so far as I'm concerned all of my icons so created from them are also PD. Please include the links to the source files if you do reuse these icons in a different context, however, because that's the polite thing to do. + +Please note, however, that any icons found in the Evolution RTS data files that are NOT prefaced with dmdr_ were created by Forboding_Angel and others and as such are NOT subject to these licensing terms! Please consult the Evolution RTS license.txt, available at the GitHub link above, for further information. diff --git a/dummyfile.txt b/dummyfile.txt index e5c979cb5..b868c9703 100644 --- a/dummyfile.txt +++ b/dummyfile.txt @@ -1,4 +1 @@ -test -test 2 -test 3 -test4 \ 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/howtoplay.txt b/howtoplay.txt new file mode 100644 index 000000000..fc7481bda --- /dev/null +++ b/howtoplay.txt @@ -0,0 +1,61 @@ +/Control_Points Section 1 + +Control Points are spread throughout the map. The points can be captured by simply moving units into the circle. It’s very similar to how Dawn of War or Battlefield control points works. Probably more similar to Battlefield. You and your opponent(s) start with a maximum score (by default right now it is 2750). For each Control Point that your opponent controls, you will lose that many points from your score every second. There are 7 points on each map that can be captured. This causes you to need to move out as quickly as possible, and you will find that you constantly are fighting over control points. When a player reaches a score of 0, that player’s units will explode. This makes for some very intense and exciting games. + +Because of this, capturing and holding control points is more important than directly attacking your enemy's base. It doesn't help to nearly destroy your enemy if you lose because he was holding all of the capture points. + +Additionally, there are 3 Control Victory modes: + +/Countdown Section 1.a +/Tug_of_War Section 1.b +/Domination Section 1.c + +Countdown is the game mode previously described. Both player’s score counts down until someone hits 0. + +Tug of war causes the points to be transferred from one player to another but with a small catch… Point values are doubled, meaning that if you own 7 points, you will receive 14 score points from your opponent every second. + +Domination requires that you own all of the Control Points for 30 seconds. If you accomplish this then you score 1000 points, at which point all of the Control Points capture status is reset (in other words all points go neutral after a score). First player to 3500 points wins! + +All of the parameters are highly configurable from the lobby, and you can change nearly everything about the gameplay with these configuration options. + + +/Metal Section 2 + +Metal is used solely for construction projects, whether you are trying to build a turret, factory, generator, tank, aircraft, etc, Metal is what is used for that construction project. More metal income means that you can build more things simultaneously, faster. Metal income is predetermined by how far the game has progressed. You start with +3 metal income which increases by +3 every 2.5 minutes until it caps at +15 total. + +If your available metal is equal to your maximum metal storage amount, metal income will be ignored, wasting potential resources. However, if you have allies a percentage is spilled over to them, providing that they aren't maxed out as well. Metal storage can be increased by building Supply Depots. + +You can supplement your metal and energy income by reclaiming Energy Cores. + + +/Energy Section 3 + +Energy is used specifically for utilitarian purposes. Those purposes include, Units firing, Recharging shields, Cloaking, etc. + +Energy is extremely important. The same buildings that provide energy also provide you with Power. The most basic reasons of why energy is so important is the fact that your units require it in order to fire their weapons. As a result, if you get in the middle of a battle and run out of energy, your units will no longer be able to fire, and that might not only cost you the battle, it might also cost you the game! + +Energy income is determined by how many of these generators are built. If your energy on hand is the same amount as your maximum energy storage, the energy from the energy income is wasted. However, if you have allies a percentage is spilled over to them, providing that they aren't maxed out as well, similar to the metal storage mechanic. + +Energy storage can be supplemented with Supply Depots. Energy storage is arguably as important or even more important than energy generation because energy is generally consumed in large bursts during battles or nuke launches as opposed to in a slow, gradual but consistent fashion like metal consumption, meaning that in peace time a high energy income is not useful. + +Energy can be obtained via the following buildings: + +Basic Generator Medium Generator Geothermal Generator Advanced Generator + + +/Generators Section 4 + +Generators is used by factories to unlock attack units, it is provided by the same buildings that produce Energy. They are the Basic/Medium/Geothermal/Advanced Generators. Generators give Power to factories anywhere on the map and thusly can be placed anywhere. + +/Note Section 4.a + +Geothermal Generators can only be placed on spots that have smoke coming out of it, you can find these spots easier if you click on a Geothermal Generator in the build menu. Geothermal spots will be highlighted on the minimap with a yellow X and on the map itself with a very tall yellow column. If you can place a Geothermal Generator near your start position, it is a good idea to build it rather than Basic Generators as you get to start with most units unlocked. + + +/Supply Section 5 + +Supply is similar to population seen in other RTS games. Attack units use Supply, and thus you cannot build any more of them once you reached the Supply limit. Supply Depots also increase Metal and Energy maximum reserves by +25/+25 per Depot. + +In addition to increasing your army supply limit, Supply Depots are excellent tools to help buffer your Metal and Energy reserves. When your Metal and Energy reserves are full, any excess is wasted (if in a 1v1 game, otherwise it spills over to your allies in team games), so it makes a lot of sense to have a large buffer zone for your resources. It can also help with Metal stalling with large construction projects, and more importantly, it can allow you to have much greater staying power in a large battles where your units are using tons of energy in order to keep fighting. + +Increased supply and resource storage can be obtained via the Supply Depot building. \ No newline at end of file diff --git a/icons/assault.png b/icons/assault.png index 68e0781b5..9f03ff40f 100644 Binary files a/icons/assault.png and b/icons/assault.png differ diff --git a/icons/commander.png b/icons/commander.png index babaaea12..c6191034f 100644 Binary files a/icons/commander.png and b/icons/commander.png differ diff --git a/icons/commander_old.png b/icons/commander_old.png new file mode 100644 index 000000000..babaaea12 Binary files /dev/null and b/icons/commander_old.png differ diff --git a/icons/default.png b/icons/default.png index 807b5291b..c282e68e3 100644 Binary files a/icons/default.png and b/icons/default.png differ diff --git a/icons/default_old.png b/icons/default_old.png new file mode 100644 index 000000000..807b5291b Binary files /dev/null and b/icons/default_old.png differ diff --git a/icons/defense.png b/icons/defense.png index 084b676b3..9349fe488 100644 Binary files a/icons/defense.png and b/icons/defense.png differ diff --git a/icons/defense_old.png b/icons/defense_old.png new file mode 100644 index 000000000..084b676b3 Binary files /dev/null and b/icons/defense_old.png differ diff --git a/icons/dmdr_air_all.png b/icons/dmdr_air_all.png new file mode 100644 index 000000000..f6079442c Binary files /dev/null and b/icons/dmdr_air_all.png differ diff --git a/icons/dmdr_air_arm.png b/icons/dmdr_air_arm.png new file mode 100644 index 000000000..8fd1a6b2b Binary files /dev/null and b/icons/dmdr_air_arm.png differ diff --git a/icons/dmdr_air_arm_old.png b/icons/dmdr_air_arm_old.png new file mode 100644 index 000000000..c692317ff Binary files /dev/null and b/icons/dmdr_air_arm_old.png differ diff --git a/icons/dmdr_air_bmb.png b/icons/dmdr_air_bmb.png new file mode 100644 index 000000000..c9bb81acf Binary files /dev/null and b/icons/dmdr_air_bmb.png differ diff --git a/icons/dmdr_air_bmb_old.png b/icons/dmdr_air_bmb_old.png new file mode 100644 index 000000000..d3cb5fc62 Binary files /dev/null and b/icons/dmdr_air_bmb_old.png differ diff --git a/icons/dmdr_air_lit.png b/icons/dmdr_air_lit.png new file mode 100644 index 000000000..663b26c07 Binary files /dev/null and b/icons/dmdr_air_lit.png differ diff --git a/icons/dmdr_air_lit_old.png b/icons/dmdr_air_lit_old.png new file mode 100644 index 000000000..76ba4a9f3 Binary files /dev/null and b/icons/dmdr_air_lit_old.png differ diff --git a/icons/dmdr_air_sct.png b/icons/dmdr_air_sct.png new file mode 100644 index 000000000..b68f122f3 Binary files /dev/null and b/icons/dmdr_air_sct.png differ diff --git a/icons/dmdr_arty_arm.png b/icons/dmdr_arty_arm.png new file mode 100644 index 000000000..b86699757 Binary files /dev/null and b/icons/dmdr_arty_arm.png differ diff --git a/icons/dmdr_arty_lit.png b/icons/dmdr_arty_lit.png new file mode 100644 index 000000000..4bc6a7c64 Binary files /dev/null and b/icons/dmdr_arty_lit.png differ diff --git a/icons/dmdr_box.png b/icons/dmdr_box.png new file mode 100644 index 000000000..e034b1849 Binary files /dev/null and b/icons/dmdr_box.png differ diff --git a/icons/dmdr_buckler.png b/icons/dmdr_buckler.png new file mode 100644 index 000000000..b23208571 Binary files /dev/null and b/icons/dmdr_buckler.png differ diff --git a/icons/dmdr_end_krow.png b/icons/dmdr_end_krow.png new file mode 100644 index 000000000..e6836acda Binary files /dev/null and b/icons/dmdr_end_krow.png differ diff --git a/icons/dmdr_end_lacr.png b/icons/dmdr_end_lacr.png new file mode 100644 index 000000000..819a45af1 Binary files /dev/null and b/icons/dmdr_end_lacr.png differ diff --git a/icons/dmdr_end_lvlr.png b/icons/dmdr_end_lvlr.png new file mode 100644 index 000000000..80b9fc68c Binary files /dev/null and b/icons/dmdr_end_lvlr.png differ diff --git a/icons/dmdr_end_nrkd.png b/icons/dmdr_end_nrkd.png new file mode 100644 index 000000000..73dd4540e Binary files /dev/null and b/icons/dmdr_end_nrkd.png differ diff --git a/icons/dmdr_end_nrkd2.png b/icons/dmdr_end_nrkd2.png new file mode 100644 index 000000000..177aac4b8 Binary files /dev/null and b/icons/dmdr_end_nrkd2.png differ diff --git a/icons/dmdr_energy.png b/icons/dmdr_energy.png new file mode 100644 index 000000000..fd52f9da7 Binary files /dev/null and b/icons/dmdr_energy.png differ diff --git a/icons/dmdr_engi.png b/icons/dmdr_engi.png new file mode 100644 index 000000000..8ffe79d22 Binary files /dev/null and b/icons/dmdr_engi.png differ diff --git a/icons/dmdr_mtd_aa.png b/icons/dmdr_mtd_aa.png new file mode 100644 index 000000000..6ab0a2a6f Binary files /dev/null and b/icons/dmdr_mtd_aa.png differ diff --git a/icons/dmdr_mtd_la.png b/icons/dmdr_mtd_la.png new file mode 100644 index 000000000..ef8139c07 Binary files /dev/null and b/icons/dmdr_mtd_la.png differ diff --git a/icons/dmdr_mtd_lb.png b/icons/dmdr_mtd_lb.png new file mode 100644 index 000000000..cc56a0c31 Binary files /dev/null and b/icons/dmdr_mtd_lb.png differ diff --git a/icons/dmdr_nuke.png b/icons/dmdr_nuke.png new file mode 100644 index 000000000..ef6bcb787 Binary files /dev/null and b/icons/dmdr_nuke.png differ diff --git a/icons/dmdr_orb.png b/icons/dmdr_orb.png new file mode 100644 index 000000000..b5c741582 Binary files /dev/null and b/icons/dmdr_orb.png differ diff --git a/icons/dmdr_raider.png b/icons/dmdr_raider.png new file mode 100644 index 000000000..cbbbcfc18 Binary files /dev/null and b/icons/dmdr_raider.png differ diff --git a/icons/dmdr_raider_old.png b/icons/dmdr_raider_old.png new file mode 100644 index 000000000..4a4abc9fc Binary files /dev/null and b/icons/dmdr_raider_old.png differ diff --git a/icons/dmdr_riot_arm.png b/icons/dmdr_riot_arm.png new file mode 100644 index 000000000..37ccbb4ff Binary files /dev/null and b/icons/dmdr_riot_arm.png differ diff --git a/icons/dmdr_riot_lit.png b/icons/dmdr_riot_lit.png new file mode 100644 index 000000000..dbda618c2 Binary files /dev/null and b/icons/dmdr_riot_lit.png differ diff --git a/icons/dmdr_shield.png b/icons/dmdr_shield.png new file mode 100644 index 000000000..71897a81f Binary files /dev/null and b/icons/dmdr_shield.png differ diff --git a/icons/dmdr_shield_base.png b/icons/dmdr_shield_base.png new file mode 100644 index 000000000..51044577f Binary files /dev/null and b/icons/dmdr_shield_base.png differ diff --git a/icons/dmdr_shield_mobile.png b/icons/dmdr_shield_mobile.png new file mode 100644 index 000000000..71897a81f Binary files /dev/null and b/icons/dmdr_shield_mobile.png differ diff --git a/icons/dmdr_shield_nuke.png b/icons/dmdr_shield_nuke.png new file mode 100644 index 000000000..0a36c3bc7 Binary files /dev/null and b/icons/dmdr_shield_nuke.png differ diff --git a/icons/dmdr_td_aa.png b/icons/dmdr_td_aa.png new file mode 100644 index 000000000..8499ec3ab Binary files /dev/null and b/icons/dmdr_td_aa.png differ diff --git a/icons/dmdr_td_ab.png b/icons/dmdr_td_ab.png new file mode 100644 index 000000000..d1991fc8e Binary files /dev/null and b/icons/dmdr_td_ab.png differ diff --git a/icons/dmdr_td_al.png b/icons/dmdr_td_al.png new file mode 100644 index 000000000..a9e204dcb Binary files /dev/null and b/icons/dmdr_td_al.png differ diff --git a/icons/dmdr_td_la.png b/icons/dmdr_td_la.png new file mode 100644 index 000000000..97a8141f4 Binary files /dev/null and b/icons/dmdr_td_la.png differ diff --git a/icons/dmdr_td_lb.png b/icons/dmdr_td_lb.png new file mode 100644 index 000000000..18af9140a Binary files /dev/null and b/icons/dmdr_td_lb.png differ diff --git a/icons/dmdr_td_ll.png b/icons/dmdr_td_ll.png new file mode 100644 index 000000000..340eb7375 Binary files /dev/null and b/icons/dmdr_td_ll.png differ diff --git a/icons/dmdr_tech.png b/icons/dmdr_tech.png new file mode 100644 index 000000000..96382ba38 Binary files /dev/null and b/icons/dmdr_tech.png differ diff --git a/icons/dmdr_tport.png b/icons/dmdr_tport.png new file mode 100644 index 000000000..edfbeb387 Binary files /dev/null and b/icons/dmdr_tport.png differ diff --git a/icons/engineer.png b/icons/engineer.png index 54249d6ef..6c96827a8 100644 Binary files a/icons/engineer.png and b/icons/engineer.png differ diff --git a/icons/factories.png b/icons/factories.png index 022064842..858dcfa69 100644 Binary files a/icons/factories.png and b/icons/factories.png differ diff --git a/icons/factories_old.png b/icons/factories_old.png new file mode 100644 index 000000000..022064842 Binary files /dev/null and b/icons/factories_old.png differ diff --git a/icons/factory.png b/icons/factory.png index 022064842..858dcfa69 100644 Binary files a/icons/factory.png and b/icons/factory.png differ diff --git a/icons/factory_old.png b/icons/factory_old.png new file mode 100644 index 000000000..022064842 Binary files /dev/null and b/icons/factory_old.png differ diff --git a/icons/orb.png b/icons/orb.png index 5346488ee..6c96827a8 100644 Binary files a/icons/orb.png and b/icons/orb.png differ diff --git a/icons/radar.png b/icons/radar.png index 14fad73a8..2dda62b99 100644 Binary files a/icons/radar.png and b/icons/radar.png differ diff --git a/icons/radar_old.png b/icons/radar_old.png new file mode 100644 index 000000000..14fad73a8 Binary files /dev/null and b/icons/radar_old.png differ diff --git a/icons/radarjam.png b/icons/radarjam.png index 40eeb8f5c..f085bde46 100644 Binary files a/icons/radarjam.png and b/icons/radarjam.png differ diff --git a/icons/radarjam_old.png b/icons/radarjam_old.png new file mode 100644 index 000000000..40eeb8f5c Binary files /dev/null and b/icons/radarjam_old.png differ diff --git a/icons/special.png b/icons/special.png new file mode 100644 index 000000000..e0255c36f Binary files /dev/null and b/icons/special.png differ diff --git a/icons/support.png b/icons/support.png index f0d99ac0c..5070274b6 100644 Binary files a/icons/support.png and b/icons/support.png differ diff --git a/icons/support_old.png b/icons/support_old.png new file mode 100644 index 000000000..f0d99ac0c Binary files /dev/null and b/icons/support_old.png differ diff --git a/icons/support_old_new.png b/icons/support_old_new.png new file mode 100644 index 000000000..0a0f1d2f3 Binary files /dev/null and b/icons/support_old_new.png differ diff --git a/icons/trt_all.png b/icons/trt_all.png new file mode 100644 index 000000000..78981a6c7 Binary files /dev/null and b/icons/trt_all.png differ diff --git a/icons/trt_arm.png b/icons/trt_arm.png new file mode 100644 index 000000000..8d10cfd50 Binary files /dev/null and b/icons/trt_arm.png differ diff --git a/icons/trt_art.png b/icons/trt_art.png new file mode 100644 index 000000000..c7b84e318 Binary files /dev/null and b/icons/trt_art.png differ diff --git a/icons/trt_lit.png b/icons/trt_lit.png new file mode 100644 index 000000000..bb7d79915 Binary files /dev/null and b/icons/trt_lit.png 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/luaui.lua b/luaui.lua index db491f602..67987c907 100644 --- a/luaui.lua +++ b/luaui.lua @@ -18,7 +18,7 @@ LUAUI_DIRNAME = 'LuaUI/' VFS.DEF_MODE = VFS.RAW_FIRST -local STARTUP_FILENAME = LUAUI_DIRNAME .. 'camain.lua' +local STARTUP_FILENAME = LUAUI_DIRNAME .. 'main_evo.lua' -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -26,10 +26,10 @@ local STARTUP_FILENAME = LUAUI_DIRNAME .. 'camain.lua' do -- use a versionned directory name if it exists local sansslash = string.sub(LUAUI_DIRNAME, 1, -2) - local versiondir = sansslash .. '-' .. Game.version .. '/' - if (VFS.FileExists(versiondir .. 'camain.lua', VFS.RAW_ONLY)) then + local versiondir = sansslash .. '-' .. ((Game and Game.version) or (Engine and Engine.version) or "Engine version error") .. '/' + if (VFS.FileExists(versiondir .. 'main_evo.lua', VFS.RAW_ONLY)) then LUAUI_DIRNAME = versiondir - STARTUP_FILENAME = LUAUI_DIRNAME .. 'camain.lua' + STARTUP_FILENAME = LUAUI_DIRNAME .. 'main_evo.lua' end end @@ -56,5 +56,5 @@ do end --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/lups/headers/general.lua b/lups/headers/general.lua index 1795029af..0fef94a43 100644 --- a/lups/headers/general.lua +++ b/lups/headers/general.lua @@ -31,6 +31,40 @@ function GetColor(colormap,life) col1[3]*ia + col2[3]*aa, col1[4]*ia + col2[4]*aa end +local function MergeShieldColor(col, frac) + return { + frac*col[1][1] + (1 - frac)*col[2][1], + frac*col[1][2] + (1 - frac)*col[2][2], + frac*col[1][3] + (1 - frac)*col[2][3], + frac*col[1][4] + (1 - frac)*col[2][4], + } +end + +local hitOpacityMult = {1.2, 1.5, 1.5} +local HIT_DURATION = 2 +function GetShieldColor(unitID, self) + local _, charge = Spring.GetUnitShieldState(unitID) + if charge ~= nil then + local frac = math.max(0, math.min(1, charge/(self.shieldCapacity or 10000))) + + local col1 = MergeShieldColor(self.colormap1, frac) + local col2 = self.colormap2 and MergeShieldColor(self.colormap2, frac) + + if self.hitResposeMult ~= 0 then + local hitTime = Spring.GetUnitRulesParam(unitID, "shieldHitFrame") + local frame = Spring.GetGameFrame() + if hitTime and (hitTime + HIT_DURATION > frame) then + col1[4] = col1[4]*hitOpacityMult[frame - hitTime + 1]*(self.hitResposeMult or 1) + if col2 then + col2[4] = col2[4]*hitOpacityMult[frame - hitTime + 1]*(self.hitResposeMult or 1) + end + end + end + + return col1, col2 + end +end + local type = type local pairs = pairs function CopyTable(outtable,intable) diff --git a/lups/lups.lua b/lups/lups.lua index 5cf595ff1..cfd5cc3c8 100644 --- a/lups/lups.lua +++ b/lups/lups.lua @@ -28,6 +28,10 @@ local function GetInfo() end +--// FIXME +-- 1. add los handling (inRadar,alwaysVisible, etc.) + + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -51,43 +55,6 @@ function print(priority,...) end end - --------------------------------------------------------------------------------- --------------------------------------------------------------------------------- - -if not Script.IsEngineMinVersion(101, 1, 1) then - local origGetUnitLosState = Spring.GetUnitLosState - local origGetPositionLosState = Spring.GetPositionLosState - local origIsPosInLos = Spring.IsPosInLos - local origIsPosInRadar = Spring.IsPosInRadar - local origIsPosInAirLos = Spring.IsPosInAirLos - - local function CreateUnitWrapper(origFunc) - return function(unitID,allyTeam,raw) - if ((allyTeam or 0) < 0) then - if (raw) then - return 0xFFFFFF - else - return { los = true, radar = true, typed = true } - end - end - return origFunc(unitID,allyTeam,raw) - end - end - local function CreatePosWrapper(origFunc) - return function(x,y,z,allyTeam) - if ((allyTeam or 0) < 0) then return true, true, true, true end - return origFunc(x,y,z) - end - end - - Spring.GetUnitLosState = CreateUnitWrapper(origGetUnitLosState); - Spring.GetPositionLosState = CreatePosWrapper(origGetPositionLosState); - Spring.IsPosInLos = CreatePosWrapper(origIsPosInLos); - Spring.IsPosInRadar = CreatePosWrapper(origIsPosInRadar); - Spring.IsPosInAirLos = CreatePosWrapper(origIsPosInAirLos); -end - -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -109,6 +76,7 @@ local spGetUnitViewPosition = Spring.GetUnitViewPosition local spGetUnitDirection = Spring.GetUnitDirection local spGetHeadingFromVector = Spring.GetHeadingFromVector local spGetUnitIsActive = Spring.GetUnitIsActive +local spGetUnitRulesParam = Spring.GetUnitRulesParam local spGetGameFrame = Spring.GetGameFrame local spGetFrameTimeOffset = Spring.GetFrameTimeOffset local spGetUnitPieceList = Spring.GetUnitPieceList @@ -117,6 +85,7 @@ local spGetLocalAllyTeamID = Spring.GetLocalAllyTeamID local scGetReadAllyTeam = Script.GetReadAllyTeam local spGetUnitPieceMap = Spring.GetUnitPieceMap local spValidUnitID = Spring.ValidUnitID +local spGetUnitIsStunned = Spring.GetUnitIsStunned local spGetProjectilePosition = Spring.GetProjectilePosition local glUnitPieceMatrix = gl.UnitPieceMatrix @@ -214,16 +183,13 @@ thisGameFrame = 0 frameOffset = 0 LupsConfig = {} -local spActivateMaterial = (Spring.UnitRendering and Spring.UnitRendering.ActivateMaterial) or function() end -local spDeactivateMaterial = (Spring.UnitRendering and Spring.UnitRendering.DeactivateMaterial) or function() end - local noDrawUnits = {} function SetUnitLuaDraw(unitID,nodraw) if (nodraw) then noDrawUnits[unitID] = (noDrawUnits[unitID] or 0) + 1 if (noDrawUnits[unitID]==1) then - --if (Game.version=="0.76b1") then - spActivateMaterial(unitID,1) + --if (Spring.Utilities.GetEngineVersion()=="0.76b1") then + Spring.UnitRendering.ActivateMaterial(unitID,1) --Spring.UnitRendering.SetLODLength(unitID,1,-1000) for pieceID in ipairs(Spring.GetUnitPieceList(unitID) or {}) do Spring.UnitRendering.SetPieceList(unitID,1,pieceID,nilDispList) @@ -235,8 +201,8 @@ function SetUnitLuaDraw(unitID,nodraw) else noDrawUnits[unitID] = (noDrawUnits[unitID] or 0) - 1 if (noDrawUnits[unitID]==0) then - --if (Game.version=="0.76b1") then - spDeactivateMaterial(unitID,1) + --if (Spring.Utilities.GetEngineVersion()=="0.76b1") then + Spring.UnitRendering.DeactivateMaterial(unitID,1) --else -- Spring.UnitRendering.SetUnitLuaDraw(unitID,false) --end @@ -524,6 +490,31 @@ end local anyFXVisible = false local anyDistortionsVisible = false +local function IsUnitPositionKnown(unitID) + if LocalAllyTeamID < 0 then + return true + end + local targetVisiblityState = Spring.GetUnitLosState(unitID, LocalAllyTeamID, true) + local inLos = (targetVisiblityState == 15) + if inLos then + return true + end + local identified = (targetVisiblityState > 2) + + if not identified then + return false + end + local unitDefID = Spring.GetUnitDefID(unitID) + if not (unitDefID and UnitDefs[unitDefID]) then + return false + end + return not Spring.Utilities.getMovetype(UnitDefs[unitDefID]) +end + +local function RadarDotCheck(unitID) + return true +end + local function Draw(extension,layer) local FxLayer = RenderSequence[layer]; if (not FxLayer) then return end @@ -553,7 +544,14 @@ local function Draw(extension,layer) -- render in unit/piece space ------------------------------------------------------ ------------------------------------------------------------------------------------ glPushMatrix() - glUnitMultMatrix(unitID) + if gadget and not IsUnitPositionKnown(unitID) then + local x, y, z = Spring.GetUnitPosition(unitID) + local a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44 = Spring.GetUnitTransformMatrix(unitID) + gl.MultMatrix(a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, x, y, z , a44) + else + glUnitMultMatrix(unitID) + end + --// render effects for i=1,#UnitEffects do @@ -685,6 +683,27 @@ local function DrawParticlesWater() end +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +-- Unit activity +local activeUnit = {} +local activeUnitCheckTime = {} +local ACTIVE_CHECK_PERIOD = 10 + +local function GetUnitIsActive(unitID) + if activeUnitCheckTime[unitID] and activeUnitCheckTime[unitID] > thisGameFrame then + return activeUnit[unitID] + end + + activeUnitCheckTime[unitID] = thisGameFrame + ACTIVE_CHECK_PERIOD + activeUnit[unitID] = (spGetUnitIsActive(unitID) or spGetUnitRulesParam(unitID, "unitActiveOverride") == 1) + and (spGetUnitRulesParam(unitID, "disarmed") ~= 1) + and (spGetUnitRulesParam(unitID, "morphDisable") ~= 1) + and not spGetUnitIsStunned(unitID) + + return activeUnit[unitID] +end + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -696,37 +715,59 @@ local DrawWorldShadowVisibleFx local DrawScreenEffectsVisibleFx local DrawInMiniMapVisibleFx +local function UpdateAllyTeamStatus() + local spec, specFullView = spGetSpectatingState() + if (specFullView) then + LocalAllyTeamID = scGetReadAllyTeam() or 0 + else + LocalAllyTeamID = spGetLocalAllyTeamID() or 0 + end +end + function IsPosInLos(x,y,z) - return Spring.IsPosInLos(x,y,z, LocalAllyTeamID) + if LocalAllyTeamID == 0 then + UpdateAllyTeamStatus() + end + return LocalAllyTeamID == Script.ALL_ACCESS_TEAM or (LocalAllyTeamID ~= Script.NO_ACCESS_TEAM and Spring.IsPosInLos(x,y,z, LocalAllyTeamID)) end function IsPosInRadar(x,y,z) - return Spring.IsPosInRadar(x,y,z, LocalAllyTeamID) + if LocalAllyTeamID == 0 then + UpdateAllyTeamStatus() + end + return LocalAllyTeamID == Script.ALL_ACCESS_TEAM or (LocalAllyTeamID ~= Script.NO_ACCESS_TEAM and Spring.IsPosInRadar(x,y,z, LocalAllyTeamID)) end function IsPosInAirLos(x,y,z) - return Spring.IsPosInAirLos(x,y,z, LocalAllyTeamID) + if LocalAllyTeamID == 0 then + UpdateAllyTeamStatus() + end + return LocalAllyTeamID == Script.ALL_ACCESS_TEAM or (LocalAllyTeamID ~= Script.NO_ACCESS_TEAM and Spring.IsPosInAirLos(x,y,z, LocalAllyTeamID)) +end + +function GetUnitLosState(unitID) + if LocalAllyTeamID == 0 then + UpdateAllyTeamStatus() + end + return LocalAllyTeamID == Script.ALL_ACCESS_TEAM or (LocalAllyTeamID ~= Script.NO_ACCESS_TEAM and (Spring.GetUnitLosState(unitID, LocalAllyTeamID) or {}).los) or false end local function IsUnitFXVisible(fx) local unitActive = true - local unitID = fx.unit + local unitID = fx.unit if fx.onActive then - unitActive = spGetUnitIsActive(unitID) - if (unitActive == nil) then - unitActive = true - end + unitActive = GetUnitIsActive(unitID) end - - if (not fx.onActive)or(unitActive) then + --Spring.Utilities.UnitEcho(unitID, "w") + if (not fx.onActive) or (unitActive) then if fx.alwaysVisible then return true elseif (fx.Visible) then return fx:Visible() else - local unitRadius = (spGetUnitRadius(unitID) + 40) + local unitRadius = (spGetUnitRadius(unitID) or 0) + 40 local r = fx.radius or 0 - return Spring.IsUnitVisible(unitID, unitRadius + r) + return Spring.IsUnitVisible(unitID, unitRadius + r, fx.noIconDraw) end else return fx.alwaysVisible @@ -850,14 +891,7 @@ local function GameFrame(_,n) if ((not next(particles)) and (not effectsInDelay[1])) then return end - --// update team/player status - local spec, specFullView = spGetSpectatingState() - if (specFullView) then - LocalAllyTeamID = scGetReadAllyTeam() - else - LocalAllyTeamID = spGetLocalAllyTeamID() - end - + UpdateAllyTeamStatus() --// create delayed FXs if (effectsInDelay[1]) then local remaingFXs,cnt={},1 @@ -1081,4 +1115,4 @@ this.Update = Update if gadget then this.DrawUnit = DrawUnit --this.GameFrame = GameFrame; // doesn't work for unsynced parts >yet< -end +end \ No newline at end of file diff --git a/lups/particleclasses/RingParticles.lua b/lups/particleclasses/RingParticles.lua new file mode 100644 index 000000000..079951a45 --- /dev/null +++ b/lups/particleclasses/RingParticles.lua @@ -0,0 +1,309 @@ +-- $Id: RingParticles.lua 3171 2008-11-06 09:06:29Z det $ +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +local RingParticles = {} +RingParticles.__index = RingParticles + +local billShader = 0 +local uPartSize = 0 + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + + +function RingParticles.GetInfo() + return { + name = "RingParticles", + backup = "", --// backup class, if this class doesn't work (old cards,ati's,etc.) + desc = "", + + layer = 0, --// extreme simply z-ordering :x + + --// gfx requirement + fbo = false, + shader = true, + rtt = false, + ctt = true, + atiseries = 1, + } +end + +RingParticles.Default = { + lists = {}, + + emitVector = {0,0,0}, -- todo + pos = {0,0,0}, -- start pos + layer = 0, + + grav = 0, + airdrag = 1, + speed = 0, + speedSpread= 0, + life = 0, + lifeSpread = 0, + rotSpeed = 0, + rotSpread = 0, + rotairdrag = 1, + emitRot = 90, + emitRotSpread = 0, + size = 0, + sizeSpread = 0, + sizeGrowth = 0, + colormap = { {0, 0, 0, 0} }, + srcBlend = GL.ONE, + dstBlend = GL.ONE_MINUS_SRC_ALPHA, + texture = '', + count = 0, + repeatEffect = false, +} + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function RingParticles:InitializePartList(partList) + partList.speed = partList.cspeed or self.speed + partList.vspeed = self.grav + partList.rotate = self.rotSpeed + partList.rotspeed = self.rotSpeed + partList.size = partList.csize or self.size + partList.radius = 0 + partList.altitude = 0 + partList.life = 0 + local r,g,b,a = GetColor(self.colormap,partList.life) + partList.color = {r,g,b,a} + partList.start_pos= self.pos + + -- spread values + if (self.speedSpread>0) then partList.speed = partList.speed + math.random(self.speedSpread*100)/100 end + if (self.sizeSpread>0) then partList.size = partList.size + math.random(self.sizeSpread*100)/100 end + if (self.rotSpread>0) then partList.rotspeed= partList.rotspeed + math.random(self.rotSpread*100)/100 end + local rand = 0 + if (self.lifeSpread>0) then rand = math.random(self.lifeSpread) end + partList.life_incr = 1/(self.life+rand) +end + +function RingParticles:UpdatePartList(partList,n) + partList.speed = partList.speed * (self.airdrag^n) + --partList.vspeed = (partList.vspeed + self.grav) * self.airdrag + --partList.rotate = (partList.rotate + partList.rotspeed) * self.rotairdrag + + local gravBoost,rotBoost = 0,0 + for i=1,n do + gravBoost = gravBoost + self.grav*(self.airdrag^i); + rotBoost = rotBoost + partList.rotspeed*(self.rotairdrag^i); + end + partList.vspeed = (partList.vspeed * (self.airdrag^n)) + gravBoost + partList.rotate = (partList.rotate * (self.rotairdrag^n)) + rotBoost + + partList.radius = partList.radius + n*partList.speed + partList.altitude = partList.altitude + n*partList.vspeed + partList.size = partList.size + n*self.sizeGrowth + partList.life = partList.life + n*partList.life_incr + local r,g,b,a = GetColor(self.colormap,partList.life) + partList.color = {r,g,b,a} +end + +function DrawParticle(size,beta) + local one = 1+(size or 0) + gl.BeginEnd(GL.QUADS, function() + gl.MultiTexCoord(0,0,0) + gl.MultiTexCoord(1,0,beta, -one,-one) + gl.Vertex(0,0) + + gl.MultiTexCoord(0,1,0) + gl.MultiTexCoord(1,0,beta, one,-one) + gl.Vertex(0,0) + + gl.MultiTexCoord(0,1,1) + gl.MultiTexCoord(1,0,beta, one,one) + gl.Vertex(0,0) + + gl.MultiTexCoord(0,0,1) + gl.MultiTexCoord(1,0,beta, -one,one) + gl.Vertex(0,0) + end) +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function RingParticles:BeginDraw() + gl.UseShader(billShader) +end + +function RingParticles:EndDraw() + gl.Texture(false) + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.UseShader(0) +end + +function RingParticles:BeginShadow() + gl.DepthMask(true) + gl.UseShader(shadowShader) + local xmid, ymid, p17, p18 = gl.GetShadowMapParams() + gl.Uniform(gl.GetUniformLocation(shadowShader, 'xmid'), xmid) + gl.Uniform(gl.GetUniformLocation(shadowShader, 'ymid'), ymid) + gl.Uniform(gl.GetUniformLocation(shadowShader, 'p17'), p17) + gl.Uniform(gl.GetUniformLocation(shadowShader, 'p18'), p18) +end + +function RingParticles:EndShadow() + gl.Texture(false) + gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) + gl.UseShader(0) + gl.DepthMask(false) +end + +function RingParticles:Draw() + --if self.genmipmap then + -- gl.GenerateMipmap(self.texture) + -- self.genmipmap = false + --end + + gl.Texture(self.texture) + gl.Blending(self.srcBlend,self.dstBlend) + + gl.PushMatrix() + gl.Translate(self.pos[1],self.pos[2],self.pos[3]) + gl.Rotate(self.emitRot,self.emitVector[1],self.emitVector[2],self.emitVector[3]) + + for _,partList in ipairs(self.lists) do + if (partList.life < 1)and + Spring.IsSphereInView(partList.start_pos[1],partList.start_pos[2],partList.start_pos[3],partList.radius+partList.size) + then + gl.Uniform(uPartSize, partList.size) + + gl.Color(partList.color) + + gl.PushMatrix() + gl.Translate(0,partList.altitude,0) + gl.Rotate(partList.rotate,0,1,0) + gl.Scale(partList.radius,1,partList.radius) + gl.CallList(partList.dlist) + gl.PopMatrix() + end + end + + gl.PopMatrix() +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function RingParticles:Initialize() + billShader = gl.CreateShader({ + vertex = [[ + uniform float size; + + varying vec2 texCoord; + + void main() + { + gl_Position = gl_ModelViewMatrix * gl_Vertex; + gl_Position.xy += gl_MultiTexCoord1.zw * size; + gl_Position = gl_ProjectionMatrix * gl_Position; + + texCoord = gl_MultiTexCoord0.st; + gl_FrontColor = gl_Color; + } + ]], + fragment = [[ + uniform sampler2D tex0; + + varying vec2 texCoord; + + void main(void) + { + gl_FragColor = texture2D(tex0, texCoord)*gl_Color; + //gl_FragDepth = gl_FragCoord.z - (gl_FragColor.a/500); + } + ]], + uniformInt = { + tex0 = 0, + }, + uniform = { + size = 10, + }, + }) + + if (billShader==nil) then + print(PRIO_MAJOR,"LUPS: RingParticles: Critical Shader Error: " ..gl.GetShaderLog()) + return false + end + + -- get uniform pointers + uPartSize = gl.GetUniformLocation(billShader, 'size') +end + +function RingParticles:Finalize() + gl.DeleteShader(billShader) +end +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function RingParticles:Update(n) + for _,partList in ipairs(self.lists) do + if (partList.life<1) then + self:UpdatePartList(partList,n) + end + end +end + +-- used if repeatEffect=true; +function RingParticles:ReInitialize() + for _,partList in ipairs(self.lists) do + self:InitializePartList(partList) + end + self.dieGameFrame = self.dieGameFrame + self.life + self.lifeSpread +end + +function RingParticles:CreateParticle() + local listsCount = self.lifeSpread/5 + for i=0,listsCount do + local newPartList = {} + + self:InitializePartList(newPartList) + + --needed for repeat mode + newPartList.csize = newPartList.size + newPartList.cspeed = newPartList.speed + + newPartList.dlist = gl.CreateList(function(count) + for y = 0, count do + --gl.Rotate(360/count,0,1,0) + local beta = math.random(360) + gl.Rotate(beta,0,1,0) + gl.Translate(0,0,1) + DrawParticle(math.random(self.sizeSpread*100)/100,beta) + gl.Translate(0,0,-1) + end + end, self.count/listsCount) + + table.insert(self.lists,newPartList) + end + + self.firstGameFrame = Spring.GetGameFrame() + self.dieGameFrame = self.firstGameFrame + self.life + self.lifeSpread +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function RingParticles.Create(Options) + local newObject = MergeTable(Options, RingParticles.Default) + setmetatable(newObject,RingParticles) -- make handle lookup + return newObject +end + +function RingParticles:Destroy() + for _,partList in ipairs(self.lists) do + gl.DeleteList(partList.dlist) + end + gl.DeleteTexture(self.texture) +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +return RingParticles \ No newline at end of file diff --git a/lups/particleclasses/ShieldSphereColor.lua b/lups/particleclasses/ShieldSphereColor.lua new file mode 100644 index 000000000..4e4e0062c --- /dev/null +++ b/lups/particleclasses/ShieldSphereColor.lua @@ -0,0 +1,189 @@ +-- $Id: ShieldSphereColor.lua 3171 2008-11-06 09:06:29Z det $ +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +local ShieldSphereColorParticle = {} +ShieldSphereColorParticle.__index = ShieldSphereColorParticle + +local sphereList = {} +local shieldShader + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorParticle.GetInfo() + return { + name = "ShieldSphereColor", + backup = "ShieldSphereColorFallback", --// backup class, if this class doesn't work (old cards,ati's,etc.) + desc = "", + + layer = -23, --// extreme simply z-ordering :x + + --// gfx requirement + fbo = false, + shader = true, + rtt = false, + ctt = false, + } +end + +ShieldSphereColorParticle.Default = { + pos = {0,0,0}, -- start pos + layer = -23, + + life = math.huge, + + size = 10, + margin = 1, + + colormap1 = { {0, 0, 0, 0} }, + colormap2 = { {0, 0, 0, 0} }, + + repeatEffect = false, + shieldSize = "large", +} + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +local glMultiTexCoord = gl.MultiTexCoord +local glCallList = gl.CallList + +function ShieldSphereColorParticle:Visible() + return self.visibleToMyAllyTeam +end + +function ShieldSphereColorParticle:BeginDraw() + gl.DepthMask(false) + gl.UseShader(shieldShader) + gl.Culling(GL.FRONT) +end + +function ShieldSphereColorParticle:EndDraw() + gl.DepthMask(false) + gl.UseShader(0) + + gl.Culling(GL.BACK) + gl.Culling(false) + + glMultiTexCoord(1, 1,1,1,1) + glMultiTexCoord(2, 1,1,1,1) + glMultiTexCoord(3, 1,1,1,1) + glMultiTexCoord(4, 1,1,1,1) +end + +function ShieldSphereColorParticle:Draw() + local col1, col2 = GetShieldColor(self.unit, self) + glMultiTexCoord(1, col1[1],col1[2],col1[3],col1[4] or 1) + glMultiTexCoord(2, col2[1],col2[2],col2[3],col2[4] or 1) + local pos = self.pos + glMultiTexCoord(3, pos[1], pos[2], pos[3], 0) + glMultiTexCoord(4, self.margin, self.size, 1, 1) + + glCallList(sphereList[self.shieldSize]) + if self.drawBack then + gl.Scale(1,1,-1) + if pos[3] ~= 0 then + glMultiTexCoord(3, pos[1], pos[2], -pos[3], 0) + end + glMultiTexCoord(1, col1[1],col1[2],col1[3],(col1[4] or 1)*self.drawBack) + glMultiTexCoord(2, col2[1],col2[2],col2[3],(col2[4] or 1)*self.drawBack) + if self.drawBackMargin then + glMultiTexCoord(4, self.drawBackMargin, self.size, 1, 1) + end + glCallList(sphereList[self.shieldSize]) + end +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorParticle:Initialize() + shieldShader = gl.CreateShader({ + vertex = [[ + #define pos gl_MultiTexCoord3 + #define margin gl_MultiTexCoord4.x + #define size vec4(gl_MultiTexCoord4.yyy,1.0) + + varying float opac; + varying vec4 color1; + varying vec4 color2; + + void main() + { + gl_Position = gl_ModelViewProjectionMatrix * (gl_Vertex * size + pos); + vec3 normal = gl_NormalMatrix * gl_Normal; + vec3 vertex = vec3(gl_ModelViewMatrix * gl_Vertex); + float angle = dot(normal,vertex)*inversesqrt( dot(normal,normal)*dot(vertex,vertex) ); //dot(norm(n),norm(v)) + opac = pow( abs( angle ) , margin); + + color1 = gl_MultiTexCoord1; + color2 = gl_MultiTexCoord2; + } + ]], + fragment = [[ + varying float opac; + varying vec4 color1; + varying vec4 color2; + + void main(void) + { + gl_FragColor = mix(color1,color2,opac); + } + + ]], + uniform = { + margin = 1, + } + }) + + if (shieldShader == nil) then + print(PRIO_MAJOR,"LUPS->Shield: critical shader error: "..gl.GetShaderLog()) + return false + end + + sphereList = { + large = gl.CreateList(DrawSphere,0,0,0,1, 38,false), + small = gl.CreateList(DrawSphere,0,0,0,1, 24,false), + } +end + +function ShieldSphereColorParticle:Finalize() + gl.DeleteShader(shieldShader) + for _, list in pairs(sphereList) do + gl.DeleteList(list) + end +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorParticle:CreateParticle() + self.dieGameFrame = Spring.GetGameFrame() + self.life +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorParticle:Update() +end + +-- used if repeatEffect=true; +function ShieldSphereColorParticle:ReInitialize() + self.dieGameFrame = self.dieGameFrame + self.life +end + +function ShieldSphereColorParticle.Create(Options) + local newObject = MergeTable(Options, ShieldSphereColorParticle.Default) + setmetatable(newObject,ShieldSphereColorParticle) -- make handle lookup + newObject:CreateParticle() + return newObject +end + +function ShieldSphereColorParticle:Destroy() +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +return ShieldSphereColorParticle \ No newline at end of file diff --git a/lups/particleclasses/ShieldSphereColorFallback.lua b/lups/particleclasses/ShieldSphereColorFallback.lua new file mode 100644 index 000000000..c31d1d2dc --- /dev/null +++ b/lups/particleclasses/ShieldSphereColorFallback.lua @@ -0,0 +1,131 @@ +-- $Id: gimmick1.lua 3171 2008-11-06 09:06:29Z det $ +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +local ShieldSphereColorFallback = {} +ShieldSphereColorFallback.__index = ShieldSphereColorFallback + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorFallback.GetInfo() + return { + name = "ShieldSphereColorFallback", + backup = "", --// backup class, if this class doesn't work (old cards,ati's,etc.) + desc = "", + + layer = -24, --// extreme simply z-ordering :x + + --// gfx requirement + fbo = false, + shader = false, + rtt = false, + ctt = false, + } +end + +ShieldSphereColorFallback.Default = { + pos = {0,0,0}, + layer = -24, + life = math.huge, + repeatEffect = true, + shieldSize = "large", +} + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorFallback:Visible() + return self.visibleToMyAllyTeam +end + +function ShieldSphereColorFallback:BeginDraw() + gl.DepthMask(false) + gl.Lighting(true) + gl.Light(0, true ) + gl.Light(0, GL.POSITION, gl.GetSun() ) + gl.Light(0, GL.AMBIENT, gl.GetSun("ambient","unit") ) + gl.Light(0, GL.DIFFUSE, gl.GetSun("diffuse","unit") ) + gl.Light(0, GL.SPECULAR, gl.GetSun("specular") ) + --gl.Culling(GL.BACK) +end + +function ShieldSphereColorFallback:EndDraw() + gl.DepthMask(false) + gl.Lighting(false) + gl.Light(0, false) +end + +function ShieldSphereColorFallback:Draw() + local pos = self.pos + gl.Translate(pos[1],pos[2],pos[3]) + + local col = GetShieldColor(self.unit, self) + col[4] = col[4]*0.26 + + gl.Color(1, 1, 1, 1) + gl.Material({ + ambient = {col[1], col[2], col[3], col[4]}, + diffuse = {1,1,1,col[4]}, + specular = {1,1,1,col[4]}, + shininess = 120, + }) + + gl.Scale(self.size, self.size, self.size) + if self.texture then + gl.Texture(self.texture) + end + gl.CallList(self.SphereList[self.shieldSize]) + if self.texture then + gl.Texture(false) + end +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorFallback:Initialize() + ShieldSphereColorFallback.SphereList = { + large = gl.CreateList(DrawSphere,0,0,0,1, 32), + small = gl.CreateList(DrawSphere,0,0,0,1, 20), + } +end + +function ShieldSphereColorFallback:Finalize() + for _, list in pairs(ShieldSphereColorFallback.SphereList) do + gl.DeleteList(list) + end +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorFallback:CreateParticle() + self.dieGameFrame = Spring.GetGameFrame() + self.life +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +function ShieldSphereColorFallback:Update() +end + +-- used if repeatEffect=true; +function ShieldSphereColorFallback:ReInitialize() + self.dieGameFrame = self.dieGameFrame + self.life +end + +function ShieldSphereColorFallback.Create(Options) + local newObject = MergeTable(Options, ShieldSphereColorFallback.Default) + setmetatable(newObject,ShieldSphereColorFallback) -- make handle lookup + newObject:CreateParticle() + return newObject +end + +function ShieldSphereColorFallback:Destroy() +end + +----------------------------------------------------------------------------------------------------------------- +----------------------------------------------------------------------------------------------------------------- + +return ShieldSphereColorFallback \ No newline at end of file diff --git a/lups/ParticleClasses/UnitPieceLight.lua b/lups/particleclasses/UnitPieceLight.lua similarity index 99% rename from lups/ParticleClasses/UnitPieceLight.lua rename to lups/particleclasses/UnitPieceLight.lua index 123442875..9abe786c7 100644 --- a/lups/ParticleClasses/UnitPieceLight.lua +++ b/lups/particleclasses/UnitPieceLight.lua @@ -222,7 +222,9 @@ function UnitPieceLight.Initialize() ]], uniformInt = { tex0 = 0, - pixelsize = 1.0/math.ceil(vsx*0.5), + uniform = { + pixelsize = 1.0/math.ceil(vsx*0.5), + } }, }) @@ -354,4 +356,4 @@ end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- -return UnitPieceLight +return UnitPieceLight \ No newline at end of file diff --git a/lups/particleclasses/airjet.lua b/lups/particleclasses/airjet.lua index f91a88562..29ead82e0 100644 --- a/lups/particleclasses/airjet.lua +++ b/lups/particleclasses/airjet.lua @@ -358,20 +358,22 @@ function AirJet:Visible() local posX,posY,posZ = self.pos[1],self.pos[2],self.pos[3] local losState if (self.unit and not self.worldspace) then - losState = (spGetUnitLosState(self.unit, LocalAllyTeamID) or {}).los or false + losState = GetUnitLosState(self.unit) local ux,uy,uz = spGetUnitViewPosition(self.unit) - posX,posY,posZ = posX+ux,posY+uy,posZ+uz - radius = radius + spGetUnitRadius(self.unit) + if ux then + posX,posY,posZ = posX+ux,posY+uy,posZ+uz + radius = radius + (spGetUnitRadius(self.unit) or 30) + end end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/jitterparticles.lua b/lups/particleclasses/jitterparticles.lua index b08c162f7..04136737c 100644 --- a/lups/particleclasses/jitterparticles.lua +++ b/lups/particleclasses/jitterparticles.lua @@ -228,8 +228,10 @@ function JitterParticles:Initialize() gl_FragColor = vec4(noiseVec,0.0,gl_FragCoord.z); } ]], - uniform = { + uniformInt = { noiseMap = 0, + }, + uniform = { size = 0, frame = 0, movCoeff = 0, @@ -334,20 +336,20 @@ function JitterParticles:Visible() local ux,uy,uz = spGetUnitViewPosition(self.unit) posX,posY,posZ = posX+ux,posY+uy,posZ+uz radius = radius + spGetUnitRadius(self.unit) - losState = spGetUnitLosState(self.unit, LocalAllyTeamID) + losState = GetUnitLosState(self.unit) elseif (self.projectile and not self.worldspace) then local px,py,pz = spGetProjectilePosition(self.projectile) posX,posY,posZ = posX+px,posY+py,posZ+pz end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/jitterparticles2.lua b/lups/particleclasses/jitterparticles2.lua index 5cc9b19dc..746f099f7 100644 --- a/lups/particleclasses/jitterparticles2.lua +++ b/lups/particleclasses/jitterparticles2.lua @@ -291,7 +291,7 @@ function JitterParticles2:Initialize() gl_FragColor = vec4(noiseVec,length(noiseVec)*heat,gl_FragCoord.z); } ]], - uniform = { + uniformInt = { noiseMap = 0, }, }) @@ -395,20 +395,20 @@ function JitterParticles2:Visible() local ux,uy,uz = spGetUnitViewPosition(self.unit) posX,posY,posZ = posX+ux,posY+uy,posZ+uz radius = radius + spGetUnitRadius(self.unit) - losState = spGetUnitLosState(self.unit, LocalAllyTeamID) + losState = GetUnitLosState(self.unit) elseif (self.projectile and not self.worldspace) then local px,py,pz = spGetProjectilePosition(self.projectile) posX,posY,posZ = posX+px,posY+py,posZ+pz end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/nanolasers.lua b/lups/particleclasses/nanolasers.lua index ff19c1ac9..bc7de468a 100644 --- a/lups/particleclasses/nanolasers.lua +++ b/lups/particleclasses/nanolasers.lua @@ -169,7 +169,7 @@ function NanoLasers:ReInitialize() end function NanoLasers:Visible() - if (self.allyID ~= LocalAllyTeamID)and(self.visibility == 0) then + if (self.allyID ~= LocalAllyTeamID) and (LocalAllyTeamID >= 0) and(self.visibility == 0) then return false end diff --git a/lups/particleclasses/nanoparticles.lua b/lups/particleclasses/nanoparticles.lua index fddbe883c..f98a80760 100644 --- a/lups/particleclasses/nanoparticles.lua +++ b/lups/particleclasses/nanoparticles.lua @@ -191,7 +191,7 @@ function NanoParticles:Draw() local endPosNew = self.targetpos local endPosOld = self.targetposStart - if (not self.pos) or (not self.targetpos) or (not self.targetposStart) or (self.life == 0) then + if (not self.pos) or (not self.targetpos) or (not self.targetposStart) then self._dead = true return end diff --git a/lups/particleclasses/ribbons.lua b/lups/particleclasses/ribbons.lua index 475ebd4c2..44510a7f0 100644 --- a/lups/particleclasses/ribbons.lua +++ b/lups/particleclasses/ribbons.lua @@ -15,9 +15,8 @@ Ribbon.__index = Ribbon local RibbonShader local widthLoc, quadsLoc -local lastTexture1 - local oldPosUniform = {} +local lastTexture local DLists = {} @@ -44,17 +43,20 @@ Ribbon.Default = { layer = 1, life = math.huge, - projectile = 0, - unit = 0, + unit = nil, + projectile=nil, piece = 0, width = 1, - size = 24, --//max 32 + size = 24, --//max 256 color = {0.9,0.9,1,1}, - texture1 = ":c:bitmaps/GPL/Lups/jet.bmp", - + texture = "bitmaps/GPL/Lups/jet.bmp", + decayRate = 0.01, + worldspace = true, repeatEffect = true, dieGameFrame = math.huge, + + isvalid = true, } ----------------------------------------------------------------------------------------------------------------- @@ -69,6 +71,8 @@ local spGetUnitPiecePosition = Spring.GetUnitPiecePosition local spGetUnitViewPosition = Spring.GetUnitViewPosition local spGetUnitPiecePosDir = Spring.GetUnitPiecePosDir local spGetUnitVectors = Spring.GetUnitVectors +local spGetProjectilePosition = Spring.GetProjectilePosition +local spGetProjectileVelocity = Spring.GetProjectileVelocity local glUniform = gl.Uniform local glUniformInt = gl.UniformInt local glUseShader = gl.UseShader @@ -102,18 +106,18 @@ function Ribbon:EndDraw() glUseShader(0) glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glTexture(0,false) + lastTexture = nil glColor(1,1,1,1) - lastTexture1 = "" end function Ribbon:Draw() - if (lastTexture1~=self.texture1) then - glTexture(0,self.texture1) - lastTexture1=self.texture1 - end + local quads0 = self.quads0 - + if self.texture ~= lastTexture then + glTexture(0,":c:"..self.texture) + lastTexture = self.texture + end glUniform(widthLoc, self.width ) glUniformInt(quadsLoc, quads0 ) @@ -129,33 +133,27 @@ function Ribbon:Draw() if (self.isvalid) then --local x,y,z = GetPiecePos(self.unit,self.piecenum) local x,y,z - if self.unit ~= 0 then - x,y,z = spGetUnitPiecePosDir(self.unit,self.piecenum) - elseif self.projectile then - x,y,z = Spring.GetProjectilePosition(self.projectile) - end - if x and y and z then - glUniform( oldPosUniform[quads0+1] , x,y,z ) - - if (self.blendfactor<1) then - local clr = self.color - glColor(clr[1],clr[2],clr[3],clr[4]*self.blendfactor) - else - glColor(self.color) - end - - glCallList(DLists[quads0]) - else - --local dir = self.oldPos[j] - --glUniform( oldPosUniform[quads0+1] , dir[1], dir[2], dir[3] ) - end + if self.unit then + x,y,z = spGetUnitPiecePosDir(self.unit,self.piecenum) + elseif self.projectile then + x,y,z = spGetProjectilePosition(self.projectile) + end + if x and y and z then + glUniform( oldPosUniform[quads0+1] , x,y,z ) + end else - --local dir = self.oldPos[j] - --glUniform( oldPosUniform[quads0+1] , dir[1], dir[2], dir[3] ) + local dir = self.oldPos[j] + glUniform( oldPosUniform[quads0+1] , dir[1], dir[2], dir[3] ) end --// define color and add speed blending (don't show ribbon for slow/landing units!) - + if (self.blendfactor<1) then + local clr = self.color + glColor(clr[1],clr[2],clr[3],clr[4]*self.blendfactor) + else + glColor(self.color) + end + glCallList(DLists[quads0]) end ----------------------------------------------------------------------------------------------------------------- @@ -166,7 +164,7 @@ function Ribbon.Initialize() vertex = [[ uniform float width; uniform int quads; - uniform vec3 oldPos[32]; + uniform vec3 oldPos[256]; varying vec2 texCoord; @@ -219,7 +217,7 @@ function Ribbon.Initialize() widthLoc = gl.GetUniformLocation(RibbonShader, 'width') quadsLoc = gl.GetUniformLocation(RibbonShader, 'quads') - for i=1,32 do + for i=1,256 do oldPosUniform[i] = gl.GetUniformLocation(RibbonShader,"oldPos["..(i-1).."]") end end @@ -241,37 +239,40 @@ end ----------------------------------------------------------------------------------------------------------------- function Ribbon:Update(n) - self.isvalid = (self.unit ~= 0 and not spGetUnitIsDead(self.unit)) or (self.projectile and Spring.GetProjectileDefID(self.projectile)) - + self.isvalid = (self.unit and spGetUnitIsDead(self.unit) == false) or (self.projectile and Spring.GetProjectileDefID(self.projectile)) if (self.isvalid) then local x,y,z - if self.unit ~= 0 then - x,y,z = spGetUnitPiecePosDir(self.unit,self.piecenum) - elseif self.projectile then - x,y,z = Spring.GetProjectilePosition(self.projectile) - end + if self.unit then + x, y, z = spGetUnitPiecePosDir(self.unit,self.piecenum) + elseif self.projectile then + x,y,z = spGetProjectilePosition(self.projectile) + end if x and y and z then self.posIdx = (self.posIdx % self.size)+1 self.oldPos[self.posIdx] = {x,y,z} local vx,vy,vz - if self.unit ~= 0 then - vx,vy,vz = spGetUnitVelocity(self.unit) - elseif self.projectile then - vx,vy,vz = Spring.GetProjectileVelocity(self.projectile) - end - if vx and vy and vz then - self.blendfactor = (vx*vx+vz*vz+vy*vy)/30 - end + if self.unit then + vx, vy, vz = spGetUnitVelocity(self.unit) + elseif self.projectile then + vx, vy, vz = spGetProjectileVelocity(self.projectile) + end + if vx and vy and vz then + self.blendfactor = (vx*vx+vy*vy+vz*vz)/30 + end end else - self.blendfactor = self.blendfactor - n * 0.01 + local lastIndex = self.posIdx + self.posIdx = (self.posIdx % self.size)+1 + self.oldPos[self.posIdx] = self.oldPos[lastIndex] + + self.blendfactor = self.blendfactor - n * self.decayRate end end function Ribbon:Visible() - self.isvalid = (self.unit ~= 0 and not spGetUnitIsDead(self.unit)) or (self.projectile and Spring.GetProjectileDefID(self.projectile)) + self.isvalid = (self.unit and spGetUnitIsDead(self.unit) == false) or (self.projectile and Spring.GetProjectileDefID(self.projectile)) local pos = self.oldPos[self.posIdx] return (self.blendfactor>0) and (spIsSphereInView(pos[1],pos[2],pos[3], self.radius)) end @@ -308,7 +309,7 @@ end function Ribbon:CreateParticle() - if (self.size>32) then self.size=32 + if (self.size>256) then self.size=256 elseif (self.size<2) then self.size=2 end self.posIdx = 1 @@ -316,10 +317,10 @@ function Ribbon:CreateParticle() self.blendfactor = 1 local x,y,z - if self.unit ~= 0 then + if self.unit then x,y,z = spGetUnitPiecePosDir(self.unit,self.piecenum) elseif self.projectile then - x,y,z = Spring.GetProjectilePosition(self.projectile) + x,y,z = spGetProjectilePosition(self.projectile) end local curpos = {x,y,z} @@ -328,12 +329,10 @@ function Ribbon:CreateParticle() self.oldPos[i] = curpos end - if self.unit ~= 0 then - local udid = spGetUnitDefID(self.unit) - self.radius = (UnitDefs[udid].speed/30.0)*self.size - else - self.radius = 10 -- TODO - end + local udid = self.unit and spGetUnitDefID(self.unit) + local weapon = self.weapon + local speed = self.speed or (UnitDefs[udid] and UnitDefs[udid].speed) or (weapon and WeaponDefs[weapon] and WeaponDefs[weapon].projectilespeed*30) or 100 + self.radius = (speed/30.0)*self.size if (not DLists[self.quads0]) then DLists[self.quads0] = gl.CreateList(gl.BeginEnd,GL.QUADS,CreateDList,self.quads0) diff --git a/lups/particleclasses/shieldjitter.lua b/lups/particleclasses/shieldjitter.lua index c647869cc..5cfb23730 100644 --- a/lups/particleclasses/shieldjitter.lua +++ b/lups/particleclasses/shieldjitter.lua @@ -8,6 +8,7 @@ ShieldJitter.__index = ShieldJitter local warpShader local timerUniform,strengthUniform local sphereList +local checkStunned = true ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- @@ -65,6 +66,12 @@ function ShieldJitter:EndDrawDistortion() end function ShieldJitter:DrawDistortion() + if checkStunned then + self.stunned = Spring.GetUnitIsStunned(self.unit) + end + if self.stunned then + return + end local pos = self.pos local size = self.size gl.Uniform(strengthUniform, self.strength ) @@ -147,7 +154,15 @@ end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- -function ShieldJitter:Update() +local time = 0 +function ShieldJitter:Update(dt) + time = time + dt + if time > 45 then + checkStunned = true + time = 0 + else + checkStunned = false + end end -- used if repeatEffect=true; diff --git a/lups/particleclasses/shieldsphere.lua b/lups/particleclasses/shieldsphere.lua index ef6cef39d..f23966f24 100644 --- a/lups/particleclasses/shieldsphere.lua +++ b/lups/particleclasses/shieldsphere.lua @@ -7,6 +7,7 @@ ShieldSphereParticle.__index = ShieldSphereParticle local sphereList local shieldShader +local checkStunned = true ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- @@ -51,7 +52,7 @@ local glMultiTexCoord = gl.MultiTexCoord local glCallList = gl.CallList function ShieldSphereParticle:BeginDraw() - gl.DepthMask(true) + gl.DepthMask(false) gl.UseShader(shieldShader) gl.Culling(GL.FRONT) end @@ -70,6 +71,12 @@ function ShieldSphereParticle:EndDraw() end function ShieldSphereParticle:Draw() + if checkStunned then + self.stunned = Spring.GetUnitIsStunned(self.unit) + end + if self.stunned then + return + end local color = self.color1 glMultiTexCoord(1, color[1],color[2],color[3],color[4] or 1) color = self.color2 @@ -157,7 +164,15 @@ end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- +local time = 0 function ShieldSphereParticle:Update(n) + time = time + n + if time > 45 then + checkStunned = true + time = 0 + else + checkStunned = false + end if (self.life<1) then self.life = self.life + n*self.life_incr self.size = self.size + n*self.sizeGrowth diff --git a/lups/particleclasses/simpleparticles.lua b/lups/particleclasses/simpleparticles.lua index 61bd36e3d..32c1c5b7b 100644 --- a/lups/particleclasses/simpleparticles.lua +++ b/lups/particleclasses/simpleparticles.lua @@ -386,7 +386,7 @@ function SimpleParticles:Visible() local posX,posY,posZ = self.pos[1],self.pos[2],self.pos[3] local losState if (self.unit and not self.worldspace) then - losState = (spGetUnitLosState(self.unit, LocalAllyTeamID) or {}).los or false + losState = GetUnitLosState(self.unit) local ux,uy,uz = spGetUnitViewPosition(self.unit) posX,posY,posZ = posX+ux,posY+uy,posZ+uz radius = radius + spGetUnitRadius(self.unit) @@ -396,13 +396,13 @@ function SimpleParticles:Visible() end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/simpleparticles2.lua b/lups/particleclasses/simpleparticles2.lua index 916c8201c..1f0ee9a1c 100644 --- a/lups/particleclasses/simpleparticles2.lua +++ b/lups/particleclasses/simpleparticles2.lua @@ -386,7 +386,7 @@ function SimpleParticles2:Visible() local posX,posY,posZ = self.pos[1],self.pos[2],self.pos[3] local losState if (self.unit and not self.worldspace) then - losState = (spGetUnitLosState(self.unit, LocalAllyTeamID) or {}).los or false + losState = GetUnitLosState(self.unit) local ux,uy,uz = spGetUnitViewPosition(self.unit) posX,posY,posZ = posX+ux,posY+uy,posZ+uz radius = radius + spGetUnitRadius(self.unit) @@ -396,13 +396,13 @@ function SimpleParticles2:Visible() end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/staticparticles.lua b/lups/particleclasses/staticparticles.lua index 528519605..2092815b0 100644 --- a/lups/particleclasses/staticparticles.lua +++ b/lups/particleclasses/staticparticles.lua @@ -302,23 +302,26 @@ function StaticParticles:Visible() local posX,posY,posZ = self.pos[1],self.pos[2],self.pos[3] local losState if (self.unit and not self.worldspace) then - losState = (spGetUnitLosState(self.unit, LocalAllyTeamID) or {}).los or false + losState = GetUnitLosState(self.unit) local ux,uy,uz = spGetUnitViewPosition(self.unit) + if not ux then + return false + end posX,posY,posZ = posX+ux,posY+uy,posZ+uz - radius = radius + spGetUnitRadius(self.unit) + radius = radius + (spGetUnitRadius(self.unit) or 0) elseif (self.projectile and not self.worldspace) then local px,py,pz = spGetProjectilePosition(self.projectile) posX,posY,posZ = posX+px,posY+py,posZ+pz end if (losState==nil) then if (self.radar) then - losState = IsPosInRadar(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInRadar(posX,posY,posZ) end if ((not losState) and self.airLos) then - losState = IsPosInAirLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInAirLos(posX,posY,posZ) end if ((not losState) and self.los) then - losState = IsPosInLos(posX,posY,posZ, LocalAllyTeamID) + losState = IsPosInLos(posX,posY,posZ) end end return (losState)and(spIsSphereInView(posX,posY,posZ,radius)) diff --git a/lups/particleclasses/unitcloaker.lua b/lups/particleclasses/unitcloaker.lua index 5a6d36464..443daa2f6 100644 --- a/lups/particleclasses/unitcloaker.lua +++ b/lups/particleclasses/unitcloaker.lua @@ -258,15 +258,15 @@ function UnitCloaker:ReInitialize() end function UnitCloaker:CreateParticle() - local name = UnitDefs[self.unitDefID].model.name - self.isS3o = ((name:lower():find("s3o") or name:lower():find("obj")) and true) + local name = (UnitDefs[self.unitDefID].model and UnitDefs[self.unitDefID].model.name) or UnitDefs[self.unitDefID].modelname + self.isS3o = ((name:lower():find("s3o") or name:lower():find("obj") or name:lower():find("dae")) and true) self.firstGameFrame = thisGameFrame self.dieGameFrame = self.firstGameFrame + self.life end function UnitCloaker:Visible() if self.allyTeam == LocalAllyTeamID then - return Spring.IsUnitVisible(self.unit) + return Spring.IsUnitVisible(self.unit, 0, true) -- Don't draw for icons end local _, specFullView = Spring.GetSpectatingState() @@ -292,4 +292,4 @@ end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- -return UnitCloaker +return UnitCloaker \ No newline at end of file diff --git a/lups/particleclasses/unitjitter.lua b/lups/particleclasses/unitjitter.lua index 91dd632e9..d27a2397b 100644 --- a/lups/particleclasses/unitjitter.lua +++ b/lups/particleclasses/unitjitter.lua @@ -253,16 +253,17 @@ function UnitJitter:ReInitialize() end function UnitJitter:CreateParticle() - local name = UnitDefs[self.unitDefID].model.name - self.isS3o = ((name:lower():find("s3o") or name:lower():find("obj")) and true) + local name = (UnitDefs[self.unitDefID].model and UnitDefs[self.unitDefID].model.name) or UnitDefs[self.unitDefID].modelname + self.isS3o = ((name:lower():find("s3o") or name:lower():find("obj") or name:lower():find("dae")) and true) self.teamColor = {spGetTeamColor(self.team)} self.firstGameFrame = thisGameFrame self.dieGameFrame = self.firstGameFrame + self.life end function UnitJitter:Visible() - if self.allyTeam == LocalAllyTeamID then - return Spring.IsUnitVisible(self.unit) + if LocalAllyTeamID == -2 -- spec full view + or LocalAllyTeamID == self.allyTeam then + return Spring.IsUnitVisible(self.unit, 0, true) -- Don't draw for icons end local inLos = true @@ -274,7 +275,7 @@ function UnitJitter:Visible() local losState = Spring.GetUnitLosState(self.unit, LocalAllyTeamID) or {} inLos = (inLos)and(not losState.los) end - return (inLos)and(Spring.IsUnitVisible(self.unit)) + return (inLos)and(Spring.IsUnitVisible(self.unit, 0, true)) -- Don't draw for icons end ----------------------------------------------------------------------------------------------------------------- @@ -296,4 +297,4 @@ end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- -return UnitJitter +return UnitJitter \ No newline at end of file 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/ChickenDefenseSounds/bigbugdie.wav b/sounds/ChickenDefenseSounds/bigbugdie.wav new file mode 100644 index 000000000..7a0183bd2 Binary files /dev/null and b/sounds/ChickenDefenseSounds/bigbugdie.wav differ diff --git a/sounds/ChickenDefenseSounds/bigchickenbreath.wav b/sounds/ChickenDefenseSounds/bigchickenbreath.wav new file mode 100644 index 000000000..613abe56e Binary files /dev/null and b/sounds/ChickenDefenseSounds/bigchickenbreath.wav differ diff --git a/sounds/ChickenDefenseSounds/bigchickendead.wav b/sounds/ChickenDefenseSounds/bigchickendead.wav new file mode 100644 index 000000000..724074698 Binary files /dev/null and b/sounds/ChickenDefenseSounds/bigchickendead.wav differ diff --git a/sounds/ChickenDefenseSounds/bigchickenroar.wav b/sounds/ChickenDefenseSounds/bigchickenroar.wav new file mode 100644 index 000000000..4e081c9ee Binary files /dev/null and b/sounds/ChickenDefenseSounds/bigchickenroar.wav differ diff --git a/sounds/ChickenDefenseSounds/bugdie.wav b/sounds/ChickenDefenseSounds/bugdie.wav new file mode 100644 index 000000000..f7695c1e3 Binary files /dev/null and b/sounds/ChickenDefenseSounds/bugdie.wav differ diff --git a/sounds/ChickenDefenseSounds/chicken_nuke.wav b/sounds/ChickenDefenseSounds/chicken_nuke.wav new file mode 100644 index 000000000..1b0aaddd9 Binary files /dev/null and b/sounds/ChickenDefenseSounds/chicken_nuke.wav differ diff --git a/sounds/ChickenDefenseSounds/e16.wav b/sounds/ChickenDefenseSounds/e16.wav new file mode 100644 index 000000000..10690cd32 Binary files /dev/null and b/sounds/ChickenDefenseSounds/e16.wav differ diff --git a/sounds/ChickenDefenseSounds/e25.wav b/sounds/ChickenDefenseSounds/e25.wav new file mode 100644 index 000000000..f6c471db9 Binary files /dev/null and b/sounds/ChickenDefenseSounds/e25.wav differ diff --git a/sounds/ChickenDefenseSounds/flamhvy1.wav b/sounds/ChickenDefenseSounds/flamhvy1.wav new file mode 100644 index 000000000..ec8dcb8a8 Binary files /dev/null and b/sounds/ChickenDefenseSounds/flamhvy1.wav differ diff --git a/sounds/ChickenDefenseSounds/junohit2edit.wav b/sounds/ChickenDefenseSounds/junohit2edit.wav new file mode 100644 index 000000000..4eb0f1d50 Binary files /dev/null and b/sounds/ChickenDefenseSounds/junohit2edit.wav differ diff --git a/sounds/ChickenDefenseSounds/nuke4.wav b/sounds/ChickenDefenseSounds/nuke4.wav new file mode 100644 index 000000000..1b0aaddd9 Binary files /dev/null and b/sounds/ChickenDefenseSounds/nuke4.wav differ diff --git a/sounds/ChickenDefenseSounds/rangechickenhit.wav b/sounds/ChickenDefenseSounds/rangechickenhit.wav new file mode 100644 index 000000000..79bb2b20d Binary files /dev/null and b/sounds/ChickenDefenseSounds/rangechickenhit.wav differ diff --git a/sounds/ChickenDefenseSounds/rangechickenroar.wav b/sounds/ChickenDefenseSounds/rangechickenroar.wav new file mode 100644 index 000000000..c016f6d83 Binary files /dev/null and b/sounds/ChickenDefenseSounds/rangechickenroar.wav differ diff --git a/sounds/ChickenDefenseSounds/roostdie.wav b/sounds/ChickenDefenseSounds/roostdie.wav new file mode 100644 index 000000000..77957b057 Binary files /dev/null and b/sounds/ChickenDefenseSounds/roostdie.wav differ diff --git a/sounds/ChickenDefenseSounds/smallchickenattack.wav b/sounds/ChickenDefenseSounds/smallchickenattack.wav new file mode 100644 index 000000000..7a3086cff Binary files /dev/null and b/sounds/ChickenDefenseSounds/smallchickenattack.wav differ diff --git a/sounds/ChickenDefenseSounds/smallchickendead.wav b/sounds/ChickenDefenseSounds/smallchickendead.wav new file mode 100644 index 000000000..f4172de59 Binary files /dev/null and b/sounds/ChickenDefenseSounds/smallchickendead.wav differ diff --git a/sounds/ChickenDefenseSounds/talonattack.wav b/sounds/ChickenDefenseSounds/talonattack.wav new file mode 100644 index 000000000..1037e6dc1 Binary files /dev/null and b/sounds/ChickenDefenseSounds/talonattack.wav differ diff --git a/sounds/ChickenDefenseSounds/talondie.wav b/sounds/ChickenDefenseSounds/talondie.wav new file mode 100644 index 000000000..80e927474 Binary files /dev/null and b/sounds/ChickenDefenseSounds/talondie.wav differ 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/e13.wav b/sounds/deathsounds/generic/e13.wav index a4471b81f..0e6470a17 100644 Binary files a/sounds/deathsounds/generic/e13.wav and b/sounds/deathsounds/generic/e13.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/42024_digifishmusic_Missile_Strike.wav b/sounds/explosions/42024_digifishmusic_Missile_Strike.wav similarity index 100% rename from sounds/42024_digifishmusic_Missile_Strike.wav rename to sounds/explosions/42024_digifishmusic_Missile_Strike.wav diff --git a/sounds/amphibartyshothit.wav b/sounds/explosions/amphibartyshothit.wav similarity index 100% rename from sounds/amphibartyshothit.wav rename to sounds/explosions/amphibartyshothit.wav diff --git a/sounds/artyhit.wav b/sounds/explosions/artyhit.wav similarity index 100% rename from sounds/artyhit.wav rename to sounds/explosions/artyhit.wav diff --git a/sounds/assaultshothit.wav b/sounds/explosions/assaultshothit.wav similarity index 100% rename from sounds/assaultshothit.wav rename to sounds/explosions/assaultshothit.wav diff --git a/sounds/bombhit.wav b/sounds/explosions/bombhit.wav similarity index 100% rename from sounds/bombhit.wav rename to sounds/explosions/bombhit.wav diff --git a/sounds/emp.wav b/sounds/explosions/emp.wav similarity index 100% rename from sounds/emp.wav rename to sounds/explosions/emp.wav diff --git a/sounds/eturrethit.wav b/sounds/explosions/eturrethit.wav similarity index 100% rename from sounds/eturrethit.wav rename to sounds/explosions/eturrethit.wav diff --git a/sounds/explode1.wav b/sounds/explosions/explode1.wav similarity index 100% rename from sounds/explode1.wav rename to sounds/explosions/explode1.wav diff --git a/sounds/explode2.wav b/sounds/explosions/explode2.wav similarity index 100% rename from sounds/explode2.wav rename to sounds/explosions/explode2.wav diff --git a/sounds/explode3.wav b/sounds/explosions/explode3.wav similarity index 100% rename from sounds/explode3.wav rename to sounds/explosions/explode3.wav diff --git a/sounds/explode4.wav b/sounds/explosions/explode4.wav similarity index 100% rename from sounds/explode4.wav rename to sounds/explosions/explode4.wav diff --git a/sounds/explode5.wav b/sounds/explosions/explode5.wav similarity index 100% rename from sounds/explode5.wav rename to sounds/explosions/explode5.wav diff --git a/sounds/explode_large.wav b/sounds/explosions/explode_large.wav similarity index 100% rename from sounds/explode_large.wav rename to sounds/explosions/explode_large.wav diff --git a/sounds/explosion_enormous.wav b/sounds/explosions/explosion_enormous.wav similarity index 100% rename from sounds/explosion_enormous.wav rename to sounds/explosions/explosion_enormous.wav diff --git a/sounds/lrpchit.wav b/sounds/explosions/lrpchit.wav similarity index 100% rename from sounds/lrpchit.wav rename to sounds/explosions/lrpchit.wav diff --git a/sounds/mediumcannonhit.wav b/sounds/explosions/mediumcannonhit.wav similarity index 100% rename from sounds/mediumcannonhit.wav rename to sounds/explosions/mediumcannonhit.wav diff --git a/sounds/minedetonation.wav b/sounds/explosions/minedetonation.wav similarity index 100% rename from sounds/minedetonation.wav rename to sounds/explosions/minedetonation.wav diff --git a/sounds/nukeartyhit.wav b/sounds/explosions/nukeartyhit.wav similarity index 100% rename from sounds/nukeartyhit.wav rename to sounds/explosions/nukeartyhit.wav diff --git a/sounds/phasegun1hit.wav b/sounds/explosions/phasegun1hit.wav similarity index 100% rename from sounds/phasegun1hit.wav rename to sounds/explosions/phasegun1hit.wav diff --git a/sounds/subhitbomb.wav b/sounds/explosions/subhitbomb.wav similarity index 100% rename from sounds/subhitbomb.wav rename to sounds/explosions/subhitbomb.wav diff --git a/sounds/unitexplodebig.wav b/sounds/explosions/unitexplodebig.wav similarity index 100% rename from sounds/unitexplodebig.wav rename to sounds/explosions/unitexplodebig.wav diff --git a/sounds/unitexplodemedium.WAV b/sounds/explosions/unitexplodemedium.WAV similarity index 100% rename from sounds/unitexplodemedium.WAV rename to sounds/explosions/unitexplodemedium.WAV diff --git a/sounds/unitexplodesmall.WAV b/sounds/explosions/unitexplodesmall.WAV similarity index 100% rename from sounds/unitexplodesmall.WAV rename to sounds/explosions/unitexplodesmall.WAV diff --git a/sounds/laserbeam02.wav b/sounds/laserbeam02.wav deleted file mode 100644 index 6fa66302e..000000000 Binary files a/sounds/laserbeam02.wav and /dev/null differ diff --git a/sounds/GDEnergy.wav b/sounds/miscfx/GDEnergy.wav similarity index 100% rename from sounds/GDEnergy.wav rename to sounds/miscfx/GDEnergy.wav diff --git a/sounds/GDFactoryselect.wav b/sounds/miscfx/GDFactoryselect.wav similarity index 100% rename from sounds/GDFactoryselect.wav rename to sounds/miscfx/GDFactoryselect.wav diff --git a/sounds/GDmex.wav b/sounds/miscfx/GDmex.wav similarity index 100% rename from sounds/GDmex.wav rename to sounds/miscfx/GDmex.wav diff --git a/sounds/areaheal.wav b/sounds/miscfx/areaheal.wav similarity index 100% rename from sounds/areaheal.wav rename to sounds/miscfx/areaheal.wav diff --git a/sounds/boxcollection.wav b/sounds/miscfx/boxcollection.wav similarity index 100% rename from sounds/boxcollection.wav rename to sounds/miscfx/boxcollection.wav 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/miscfx/buildstart.wav b/sounds/miscfx/buildstart.wav new file mode 100644 index 000000000..33a486f71 Binary files /dev/null and b/sounds/miscfx/buildstart.wav differ diff --git a/sounds/chaching.wav b/sounds/miscfx/chaching.wav similarity index 100% rename from sounds/chaching.wav rename to sounds/miscfx/chaching.wav diff --git a/sounds/cloak.wav b/sounds/miscfx/cloak.wav similarity index 100% rename from sounds/cloak.wav rename to sounds/miscfx/cloak.wav diff --git a/sounds/dronespawner.wav b/sounds/miscfx/energycoredronespawner.wav similarity index 100% rename from sounds/dronespawner.wav rename to sounds/miscfx/energycoredronespawner.wav diff --git a/sounds/heal.wav b/sounds/miscfx/heal.wav similarity index 100% rename from sounds/heal.wav rename to sounds/miscfx/heal.wav diff --git a/sounds/miscfx/nightvision_activated.wav b/sounds/miscfx/nightvision_activated.wav new file mode 100644 index 000000000..b472eb7f8 Binary files /dev/null and b/sounds/miscfx/nightvision_activated.wav differ diff --git a/sounds/miscfx/nightvision_deactivated.wav b/sounds/miscfx/nightvision_deactivated.wav new file mode 100644 index 000000000..731ffc90b Binary files /dev/null and b/sounds/miscfx/nightvision_deactivated.wav differ diff --git a/sounds/reclaimed.wav b/sounds/miscfx/reclaimed.wav similarity index 100% rename from sounds/reclaimed.wav rename to sounds/miscfx/reclaimed.wav diff --git a/sounds/turretselect.wav b/sounds/miscfx/turretselect.wav similarity index 100% rename from sounds/turretselect.wav rename to sounds/miscfx/turretselect.wav diff --git a/sounds/miscfx/unitexplodemedium.WAV b/sounds/miscfx/unitexplodemedium.WAV new file mode 100644 index 000000000..68017c179 Binary files /dev/null and b/sounds/miscfx/unitexplodemedium.WAV differ diff --git a/sounds/miscfx/unitexplodesmall.WAV b/sounds/miscfx/unitexplodesmall.WAV new file mode 100644 index 000000000..f13e9fa77 Binary files /dev/null and b/sounds/miscfx/unitexplodesmall.WAV differ diff --git a/sounds/unitselect.wav b/sounds/miscfx/unitselect.wav similarity index 100% rename from sounds/unitselect.wav rename to sounds/miscfx/unitselect.wav diff --git a/sounds/warning1.wav b/sounds/miscfx/warning1.wav similarity index 100% rename from sounds/warning1.wav rename to sounds/miscfx/warning1.wav diff --git a/sounds/warning2.wav b/sounds/miscfx/warning2.wav similarity index 100% rename from sounds/warning2.wav rename to sounds/miscfx/warning2.wav diff --git a/sounds/18377_inferno_aarl.wav b/sounds/other/18377_inferno_aarl.wav similarity index 100% rename from sounds/18377_inferno_aarl.wav rename to sounds/other/18377_inferno_aarl.wav diff --git a/sounds/18378_inferno_ftlas.wav b/sounds/other/18378_inferno_ftlas.wav similarity index 100% rename from sounds/18378_inferno_ftlas.wav rename to sounds/other/18378_inferno_ftlas.wav diff --git a/sounds/18380_inferno_hvrl.wav b/sounds/other/18380_inferno_hvrl.wav similarity index 100% rename from sounds/18380_inferno_hvrl.wav rename to sounds/other/18380_inferno_hvrl.wav diff --git a/sounds/18381_inferno_hvyelec.wav b/sounds/other/18381_inferno_hvyelec.wav similarity index 100% rename from sounds/18381_inferno_hvyelec.wav rename to sounds/other/18381_inferno_hvyelec.wav diff --git a/sounds/18382_inferno_hvylas.wav b/sounds/other/18382_inferno_hvylas.wav similarity index 100% rename from sounds/18382_inferno_hvylas.wav rename to sounds/other/18382_inferno_hvylas.wav diff --git a/sounds/18383_inferno_knokart.wav b/sounds/other/18383_inferno_knokart.wav similarity index 100% rename from sounds/18383_inferno_knokart.wav rename to sounds/other/18383_inferno_knokart.wav diff --git a/sounds/18384_inferno_largex.wav b/sounds/other/18384_inferno_largex.wav similarity index 100% rename from sounds/18384_inferno_largex.wav rename to sounds/other/18384_inferno_largex.wav diff --git a/sounds/18385_inferno_laserbeam.wav b/sounds/other/18385_inferno_laserbeam.wav similarity index 100% rename from sounds/18385_inferno_laserbeam.wav rename to sounds/other/18385_inferno_laserbeam.wav diff --git a/sounds/18386_inferno_lightrl.wav b/sounds/other/18386_inferno_lightrl.wav similarity index 100% rename from sounds/18386_inferno_lightrl.wav rename to sounds/other/18386_inferno_lightrl.wav diff --git a/sounds/18387_inferno_lsax.wav b/sounds/other/18387_inferno_lsax.wav similarity index 100% rename from sounds/18387_inferno_lsax.wav rename to sounds/other/18387_inferno_lsax.wav diff --git a/sounds/18388_inferno_mecann.wav b/sounds/other/18388_inferno_mecann.wav similarity index 100% rename from sounds/18388_inferno_mecann.wav rename to sounds/other/18388_inferno_mecann.wav diff --git a/sounds/18390_inferno_plascanh.wav b/sounds/other/18390_inferno_plascanh.wav similarity index 100% rename from sounds/18390_inferno_plascanh.wav rename to sounds/other/18390_inferno_plascanh.wav diff --git a/sounds/18391_inferno_plcan.wav b/sounds/other/18391_inferno_plcan.wav similarity index 100% rename from sounds/18391_inferno_plcan.wav rename to sounds/other/18391_inferno_plcan.wav diff --git a/sounds/18392_inferno_rapidgun.wav b/sounds/other/18392_inferno_rapidgun.wav similarity index 100% rename from sounds/18392_inferno_rapidgun.wav rename to sounds/other/18392_inferno_rapidgun.wav diff --git a/sounds/18394_inferno_rlhvyx.wav b/sounds/other/18394_inferno_rlhvyx.wav similarity index 100% rename from sounds/18394_inferno_rlhvyx.wav rename to sounds/other/18394_inferno_rlhvyx.wav diff --git a/sounds/18396_inferno_slighlas.wav b/sounds/other/18396_inferno_slighlas.wav similarity index 100% rename from sounds/18396_inferno_slighlas.wav rename to sounds/other/18396_inferno_slighlas.wav diff --git a/sounds/18397_inferno_smalllas.wav b/sounds/other/18397_inferno_smalllas.wav similarity index 100% rename from sounds/18397_inferno_smalllas.wav rename to sounds/other/18397_inferno_smalllas.wav diff --git a/sounds/18398_inferno_snplaz.wav b/sounds/other/18398_inferno_snplaz.wav similarity index 100% rename from sounds/18398_inferno_snplaz.wav rename to sounds/other/18398_inferno_snplaz.wav diff --git a/sounds/18399_inferno_stormplas.wav b/sounds/other/18399_inferno_stormplas.wav similarity index 100% rename from sounds/18399_inferno_stormplas.wav rename to sounds/other/18399_inferno_stormplas.wav diff --git a/sounds/18400_inferno_waterxplo.wav b/sounds/other/18400_inferno_waterxplo.wav similarity index 100% rename from sounds/18400_inferno_waterxplo.wav rename to sounds/other/18400_inferno_waterxplo.wav diff --git a/sounds/18401_inferno_xlaz.wav b/sounds/other/18401_inferno_xlaz.wav similarity index 100% rename from sounds/18401_inferno_xlaz.wav rename to sounds/other/18401_inferno_xlaz.wav diff --git a/sounds/18402_inferno_xplo.wav b/sounds/other/18402_inferno_xplo.wav similarity index 100% rename from sounds/18402_inferno_xplo.wav rename to sounds/other/18402_inferno_xplo.wav diff --git a/sounds/18403_inferno_xplosm.wav b/sounds/other/18403_inferno_xplosm.wav similarity index 100% rename from sounds/18403_inferno_xplosm.wav rename to sounds/other/18403_inferno_xplosm.wav diff --git a/sounds/18403_inferno_xplosm2.wav b/sounds/other/18403_inferno_xplosm2.wav similarity index 100% rename from sounds/18403_inferno_xplosm2.wav rename to sounds/other/18403_inferno_xplosm2.wav diff --git a/sounds/36846_EcoDTR_LaserRocket.wav b/sounds/other/36846_EcoDTR_LaserRocket.wav similarity index 100% rename from sounds/36846_EcoDTR_LaserRocket.wav rename to sounds/other/36846_EcoDTR_LaserRocket.wav diff --git a/sounds/other/GDEnergy.wav b/sounds/other/GDEnergy.wav new file mode 100644 index 000000000..b1a6699dd Binary files /dev/null and b/sounds/other/GDEnergy.wav differ diff --git a/sounds/other/GDFactoryselect.wav b/sounds/other/GDFactoryselect.wav new file mode 100644 index 000000000..f6f154721 Binary files /dev/null and b/sounds/other/GDFactoryselect.wav differ diff --git a/sounds/GDRadar.wav b/sounds/other/GDRadar.wav similarity index 100% rename from sounds/GDRadar.wav rename to sounds/other/GDRadar.wav diff --git a/sounds/other/GDmex.wav b/sounds/other/GDmex.wav new file mode 100644 index 000000000..f47a2fbc4 Binary files /dev/null and b/sounds/other/GDmex.wav differ diff --git a/sounds/UnitsUnderattack1.wav b/sounds/other/UnitsUnderattack1.wav similarity index 100% rename from sounds/UnitsUnderattack1.wav rename to sounds/other/UnitsUnderattack1.wav diff --git a/sounds/aatankshot.wav b/sounds/other/aatankshot.wav similarity index 100% rename from sounds/aatankshot.wav rename to sounds/other/aatankshot.wav diff --git a/sounds/aircraft_missile_01.wav b/sounds/other/aircraft_missile_01.wav similarity index 100% rename from sounds/aircraft_missile_01.wav rename to sounds/other/aircraft_missile_01.wav diff --git a/sounds/allterrriotweapon.wav b/sounds/other/allterrriotweapon.wav similarity index 100% rename from sounds/allterrriotweapon.wav rename to sounds/other/allterrriotweapon.wav diff --git a/sounds/allterrsupaweapon.wav b/sounds/other/allterrsupaweapon.wav similarity index 100% rename from sounds/allterrsupaweapon.wav rename to sounds/other/allterrsupaweapon.wav diff --git a/sounds/amphibbuggytankshot.wav b/sounds/other/amphibbuggytankshot.wav similarity index 100% rename from sounds/amphibbuggytankshot.wav rename to sounds/other/amphibbuggytankshot.wav diff --git a/sounds/amphibmedtankshot.wav b/sounds/other/amphibmedtankshot.wav similarity index 100% rename from sounds/amphibmedtankshot.wav rename to sounds/other/amphibmedtankshot.wav diff --git a/sounds/artytankshot.wav b/sounds/other/artytankshot.wav similarity index 100% rename from sounds/artytankshot.wav rename to sounds/other/artytankshot.wav diff --git a/sounds/buildmodeclick1.wav b/sounds/other/buildmodeclick1.wav similarity index 100% rename from sounds/buildmodeclick1.wav rename to sounds/other/buildmodeclick1.wav diff --git a/sounds/buildmodeclick2.wav b/sounds/other/buildmodeclick2.wav similarity index 100% rename from sounds/buildmodeclick2.wav rename to sounds/other/buildmodeclick2.wav diff --git a/sounds/buildmodeclickselect.wav b/sounds/other/buildmodeclickselect.wav similarity index 100% rename from sounds/buildmodeclickselect.wav rename to sounds/other/buildmodeclickselect.wav diff --git a/sounds/cpweaponfire.wav b/sounds/other/cpweaponfire.wav similarity index 100% rename from sounds/cpweaponfire.wav rename to sounds/other/cpweaponfire.wav diff --git a/sounds/cpweaponfiresingle.wav b/sounds/other/cpweaponfiresingle.wav similarity index 100% rename from sounds/cpweaponfiresingle.wav rename to sounds/other/cpweaponfiresingle.wav diff --git a/sounds/cruisemissilehit.wav b/sounds/other/cruisemissilehit.wav similarity index 100% rename from sounds/cruisemissilehit.wav rename to sounds/other/cruisemissilehit.wav diff --git a/sounds/doomlaser2.wav b/sounds/other/doomlaser2.wav similarity index 100% rename from sounds/doomlaser2.wav rename to sounds/other/doomlaser2.wav diff --git a/sounds/other/dronespawner.wav b/sounds/other/dronespawner.wav new file mode 100644 index 000000000..408671d30 Binary files /dev/null and b/sounds/other/dronespawner.wav differ diff --git a/sounds/eallterrassaultbeam.wav b/sounds/other/eallterrassaultbeam.wav similarity index 100% rename from sounds/eallterrassaultbeam.wav rename to sounds/other/eallterrassaultbeam.wav diff --git a/sounds/eartillery.wav b/sounds/other/eartillery.wav similarity index 100% rename from sounds/eartillery.wav rename to sounds/other/eartillery.wav diff --git a/sounds/ejerikfire.wav b/sounds/other/ejerikfire.wav similarity index 100% rename from sounds/ejerikfire.wav rename to sounds/other/ejerikfire.wav diff --git a/sounds/ejerikfiresingle.wav b/sounds/other/ejerikfiresingle.wav similarity index 100% rename from sounds/ejerikfiresingle.wav rename to sounds/other/ejerikfiresingle.wav diff --git a/sounds/emediumtankfire.wav b/sounds/other/emediumtankfire.wav similarity index 100% rename from sounds/emediumtankfire.wav rename to sounds/other/emediumtankfire.wav diff --git a/sounds/flakhit.wav b/sounds/other/flakhit.wav similarity index 100% rename from sounds/flakhit.wav rename to sounds/other/flakhit.wav diff --git a/sounds/flamethrower.wav b/sounds/other/flamethrower.wav similarity index 100% rename from sounds/flamethrower.wav rename to sounds/other/flamethrower.wav diff --git a/sounds/heavylasershot.wav b/sounds/other/heavylasershot.wav similarity index 100% rename from sounds/heavylasershot.wav rename to sounds/other/heavylasershot.wav diff --git a/sounds/heavyplasmashot.wav b/sounds/other/heavyplasmashot.wav similarity index 100% rename from sounds/heavyplasmashot.wav rename to sounds/other/heavyplasmashot.wav diff --git a/sounds/heavyshot.wav b/sounds/other/heavyshot.wav similarity index 100% rename from sounds/heavyshot.wav rename to sounds/other/heavyshot.wav diff --git a/sounds/heavyshothit.wav b/sounds/other/heavyshothit.wav similarity index 100% rename from sounds/heavyshothit.wav rename to sounds/other/heavyshothit.wav diff --git a/sounds/interceptorgun.wav b/sounds/other/interceptorgun.wav similarity index 100% rename from sounds/interceptorgun.wav rename to sounds/other/interceptorgun.wav diff --git a/sounds/kloak1.wav b/sounds/other/kloak1.wav similarity index 100% rename from sounds/kloak1.wav rename to sounds/other/kloak1.wav diff --git a/sounds/kloak1un.wav b/sounds/other/kloak1un.wav similarity index 100% rename from sounds/kloak1un.wav rename to sounds/other/kloak1un.wav diff --git a/sounds/kloak2.wav b/sounds/other/kloak2.wav similarity index 100% rename from sounds/kloak2.wav rename to sounds/other/kloak2.wav diff --git a/sounds/kloak2un.wav b/sounds/other/kloak2un.wav similarity index 100% rename from sounds/kloak2un.wav rename to sounds/other/kloak2un.wav diff --git a/sounds/largerocketlaunch.wav b/sounds/other/largerocketlaunch.wav similarity index 100% rename from sounds/largerocketlaunch.wav rename to sounds/other/largerocketlaunch.wav diff --git a/sounds/lazor.wav b/sounds/other/lazor.wav similarity index 100% rename from sounds/lazor.wav rename to sounds/other/lazor.wav diff --git a/sounds/lightinterceptorfire.wav b/sounds/other/lightinterceptorfire.wav similarity index 100% rename from sounds/lightinterceptorfire.wav rename to sounds/other/lightinterceptorfire.wav diff --git a/sounds/lrpcshot.wav b/sounds/other/lrpcshot.wav similarity index 100% rename from sounds/lrpcshot.wav rename to sounds/other/lrpcshot.wav diff --git a/sounds/medassualt_blast.wav b/sounds/other/medassualt_blast.wav similarity index 100% rename from sounds/medassualt_blast.wav rename to sounds/other/medassualt_blast.wav diff --git a/sounds/minewhir2.wav b/sounds/other/minewhir2.wav similarity index 100% rename from sounds/minewhir2.wav rename to sounds/other/minewhir2.wav diff --git a/sounds/phasegun1.wav b/sounds/other/phasegun1.wav similarity index 100% rename from sounds/phasegun1.wav rename to sounds/other/phasegun1.wav diff --git a/sounds/phasegun1start.wav b/sounds/other/phasegun1start.wav similarity index 100% rename from sounds/phasegun1start.wav rename to sounds/other/phasegun1start.wav diff --git a/sounds/plasma.wav b/sounds/other/plasma.wav similarity index 100% rename from sounds/plasma.wav rename to sounds/other/plasma.wav diff --git a/sounds/riottankshot.wav b/sounds/other/riottankshot.wav similarity index 100% rename from sounds/riottankshot.wav rename to sounds/other/riottankshot.wav diff --git a/sounds/rocket_launcher.wav b/sounds/other/rocket_launcher.wav similarity index 100% rename from sounds/rocket_launcher.wav rename to sounds/other/rocket_launcher.wav diff --git a/sounds/rocket_launcher2.wav b/sounds/other/rocket_launcher2.wav similarity index 100% rename from sounds/rocket_launcher2.wav rename to sounds/other/rocket_launcher2.wav diff --git a/sounds/smallemp.wav b/sounds/other/smallemp.wav similarity index 100% rename from sounds/smallemp.wav rename to sounds/other/smallemp.wav diff --git a/sounds/softblam.wav b/sounds/other/softblam.wav similarity index 100% rename from sounds/softblam.wav rename to sounds/other/softblam.wav diff --git a/sounds/softblam2.wav b/sounds/other/softblam2.wav similarity index 100% rename from sounds/softblam2.wav rename to sounds/other/softblam2.wav diff --git a/sounds/softblam3.wav b/sounds/other/softblam3.wav similarity index 100% rename from sounds/softblam3.wav rename to sounds/other/softblam3.wav diff --git a/sounds/softblat.wav b/sounds/other/softblat.wav similarity index 100% rename from sounds/softblat.wav rename to sounds/other/softblat.wav diff --git a/sounds/talk.wav b/sounds/other/talk.wav similarity index 100% rename from sounds/talk.wav rename to sounds/other/talk.wav diff --git a/sounds/tmissiletankfire.wav b/sounds/other/tmissiletankfire.wav similarity index 100% rename from sounds/tmissiletankfire.wav rename to sounds/other/tmissiletankfire.wav diff --git a/sounds/tomahawk_missile.wav b/sounds/other/tomahawk_missile.wav similarity index 100% rename from sounds/tomahawk_missile.wav rename to sounds/other/tomahawk_missile.wav diff --git a/sounds/other/turretselect.wav b/sounds/other/turretselect.wav new file mode 100644 index 000000000..6642ce0c4 Binary files /dev/null and b/sounds/other/turretselect.wav differ diff --git a/sounds/count1.wav b/sounds/selfdcountdown/count1.wav similarity index 100% rename from sounds/count1.wav rename to sounds/selfdcountdown/count1.wav diff --git a/sounds/count2.wav b/sounds/selfdcountdown/count2.wav similarity index 100% rename from sounds/count2.wav rename to sounds/selfdcountdown/count2.wav diff --git a/sounds/count3.wav b/sounds/selfdcountdown/count3.wav similarity index 100% rename from sounds/count3.wav rename to sounds/selfdcountdown/count3.wav diff --git a/sounds/count4.wav b/sounds/selfdcountdown/count4.wav similarity index 100% rename from sounds/count4.wav rename to sounds/selfdcountdown/count4.wav diff --git a/sounds/count5.wav b/sounds/selfdcountdown/count5.wav similarity index 100% rename from sounds/count5.wav rename to sounds/selfdcountdown/count5.wav diff --git a/sounds/count6.wav b/sounds/selfdcountdown/count6.wav similarity index 100% rename from sounds/count6.wav rename to sounds/selfdcountdown/count6.wav diff --git a/sounds/ack.wav b/sounds/ui/ack.wav similarity index 100% rename from sounds/ack.wav rename to sounds/ui/ack.wav diff --git a/sounds/ui/additionalgenerators.wav b/sounds/ui/additionalgenerators.wav new file mode 100644 index 000000000..244277814 Binary files /dev/null and b/sounds/ui/additionalgenerators.wav differ diff --git a/sounds/beep4.wav b/sounds/ui/beep4.wav similarity index 100% rename from sounds/beep4.wav rename to sounds/ui/beep4.wav diff --git a/sounds/beep6.wav b/sounds/ui/beep6.wav similarity index 100% rename from sounds/beep6.wav rename to sounds/ui/beep6.wav diff --git a/sounds/button9.wav b/sounds/ui/button9.wav similarity index 100% rename from sounds/button9.wav rename to sounds/ui/button9.wav diff --git a/sounds/cancel2.wav b/sounds/ui/cancel2.wav similarity index 100% rename from sounds/cancel2.wav rename to sounds/ui/cancel2.wav diff --git a/sounds/cantdo4.wav b/sounds/ui/cantdo4.wav similarity index 100% rename from sounds/cantdo4.wav rename to sounds/ui/cantdo4.wav diff --git a/sounds/ui/constructadditionalpylons.wav b/sounds/ui/constructadditionalpylons.wav new file mode 100644 index 000000000..9e7953000 Binary files /dev/null and b/sounds/ui/constructadditionalpylons.wav differ diff --git a/sounds/ui/controlpointscanbecaptured.wav b/sounds/ui/controlpointscanbecaptured.wav new file mode 100644 index 000000000..d52628f4d Binary files /dev/null and b/sounds/ui/controlpointscanbecaptured.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/metalincomeincrease.wav b/sounds/ui/metalincomeincrease.wav new file mode 100644 index 000000000..baf560960 Binary files /dev/null and b/sounds/ui/metalincomeincrease.wav differ diff --git a/sounds/moarpower.wav b/sounds/ui/moarpower.wav similarity index 100% rename from sounds/moarpower.wav rename to sounds/ui/moarpower.wav diff --git a/sounds/ui/useyourmetal.wav b/sounds/ui/useyourmetal.wav new file mode 100644 index 000000000..8062fd0ac Binary files /dev/null and b/sounds/ui/useyourmetal.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/18379_inferno_hilas.wav b/sounds/weapons/18379_inferno_hilas.wav similarity index 100% rename from sounds/18379_inferno_hilas.wav rename to sounds/weapons/18379_inferno_hilas.wav diff --git a/sounds/18389_inferno_medlas.wav b/sounds/weapons/18389_inferno_medlas.wav similarity index 100% rename from sounds/18389_inferno_medlas.wav rename to sounds/weapons/18389_inferno_medlas.wav diff --git a/sounds/18393_inferno_reject.wav b/sounds/weapons/18393_inferno_reject.wav similarity index 100% rename from sounds/18393_inferno_reject.wav rename to sounds/weapons/18393_inferno_reject.wav diff --git a/sounds/18395_inferno_rltx.wav b/sounds/weapons/18395_inferno_rltx.wav similarity index 100% rename from sounds/18395_inferno_rltx.wav rename to sounds/weapons/18395_inferno_rltx.wav 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/allterrassaultshot.wav b/sounds/weapons/allterrassaultshot.wav similarity index 100% rename from sounds/allterrassaultshot.wav rename to sounds/weapons/allterrassaultshot.wav diff --git a/sounds/allterrheavyshot.wav b/sounds/weapons/allterrheavyshot.wav similarity index 100% rename from sounds/allterrheavyshot.wav rename to sounds/weapons/allterrheavyshot.wav diff --git a/sounds/amphibbuggytankshothit.wav b/sounds/weapons/amphibbuggytankshothit.wav similarity index 100% rename from sounds/amphibbuggytankshothit.wav rename to sounds/weapons/amphibbuggytankshothit.wav diff --git a/sounds/amphibmedtankshothit.wav b/sounds/weapons/amphibmedtankshothit.wav similarity index 100% rename from sounds/amphibmedtankshothit.wav rename to sounds/weapons/amphibmedtankshothit.wav diff --git a/sounds/antinukelaser.wav b/sounds/weapons/antinukelaser.wav similarity index 100% rename from sounds/antinukelaser.wav rename to sounds/weapons/antinukelaser.wav diff --git a/sounds/arty2.wav b/sounds/weapons/arty2.wav similarity index 100% rename from sounds/arty2.wav rename to sounds/weapons/arty2.wav 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/bomberlaunch.wav b/sounds/weapons/bomberlaunch.wav similarity index 100% rename from sounds/bomberlaunch.wav rename to sounds/weapons/bomberlaunch.wav diff --git a/sounds/bruisercannon.wav b/sounds/weapons/bruisercannon.wav similarity index 100% rename from sounds/bruisercannon.wav rename to sounds/weapons/bruisercannon.wav diff --git a/sounds/cruisemissilelaunch.wav b/sounds/weapons/cruisemissilelaunch.wav similarity index 100% rename from sounds/cruisemissilelaunch.wav rename to sounds/weapons/cruisemissilelaunch.wav 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/electricboom.wav b/sounds/weapons/electricboom.wav new file mode 100644 index 000000000..d04275d2c Binary files /dev/null and b/sounds/weapons/electricboom.wav differ diff --git a/sounds/emediumtankfire2.wav b/sounds/weapons/emediumtankfire2.wav similarity index 100% rename from sounds/emediumtankfire2.wav rename to sounds/weapons/emediumtankfire2.wav diff --git a/sounds/eturretfire.wav b/sounds/weapons/eturretfire.wav similarity index 100% rename from sounds/eturretfire.wav rename to sounds/weapons/eturretfire.wav diff --git a/sounds/flakgun_shoot.wav b/sounds/weapons/flakgun_shoot.wav similarity index 100% rename from sounds/flakgun_shoot.wav rename to sounds/weapons/flakgun_shoot.wav diff --git a/sounds/flamethrower1.wav b/sounds/weapons/flamethrower1.wav similarity index 100% rename from sounds/flamethrower1.wav rename to sounds/weapons/flamethrower1.wav diff --git a/sounds/fnubeamfire.wav b/sounds/weapons/fnubeamfire.wav similarity index 100% rename from sounds/fnubeamfire.wav rename to sounds/weapons/fnubeamfire.wav diff --git a/sounds/heavycannonGD.wav b/sounds/weapons/heavycannonGD.wav similarity index 100% rename from sounds/heavycannonGD.wav rename to sounds/weapons/heavycannonGD.wav diff --git a/sounds/heavyturretshot.wav b/sounds/weapons/heavyturretshot.wav similarity index 100% rename from sounds/heavyturretshot.wav rename to sounds/weapons/heavyturretshot.wav diff --git a/sounds/jacobs.wav b/sounds/weapons/jacobs.wav similarity index 100% rename from sounds/jacobs.wav rename to sounds/weapons/jacobs.wav diff --git a/sounds/krabprimary.wav b/sounds/weapons/krabprimary.wav similarity index 100% rename from sounds/krabprimary.wav rename to sounds/weapons/krabprimary.wav diff --git a/sounds/krabsecondary.wav b/sounds/weapons/krabsecondary.wav similarity index 100% rename from sounds/krabsecondary.wav rename to sounds/weapons/krabsecondary.wav diff --git a/sounds/weapons/laserbeam02-short.wav b/sounds/weapons/laserbeam02-short.wav new file mode 100644 index 000000000..878bfd7e8 Binary files /dev/null and b/sounds/weapons/laserbeam02-short.wav differ diff --git a/sounds/weapons/laserbeam02.wav b/sounds/weapons/laserbeam02.wav new file mode 100644 index 000000000..8ca70b4f7 Binary files /dev/null and b/sounds/weapons/laserbeam02.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/lrpcshot2.wav b/sounds/weapons/lrpcshot2.wav similarity index 100% rename from sounds/lrpcshot2.wav rename to sounds/weapons/lrpcshot2.wav diff --git a/sounds/medallterrweapon.wav b/sounds/weapons/medallterrweapon.wav similarity index 100% rename from sounds/medallterrweapon.wav rename to sounds/weapons/medallterrweapon.wav 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/minewhir.wav b/sounds/weapons/minewhir.wav similarity index 100% rename from sounds/minewhir.wav rename to sounds/weapons/minewhir.wav diff --git a/sounds/missile_launch1.wav b/sounds/weapons/missile_launch1.wav similarity index 100% rename from sounds/missile_launch1.wav rename to sounds/weapons/missile_launch1.wav diff --git a/sounds/missilefiring.wav b/sounds/weapons/missilefiring.wav similarity index 100% rename from sounds/missilefiring.wav rename to sounds/weapons/missilefiring.wav diff --git a/sounds/nukeartyshot.wav b/sounds/weapons/nukeartyshot.wav similarity index 100% rename from sounds/nukeartyshot.wav rename to sounds/weapons/nukeartyshot.wav diff --git a/sounds/nukelaunch.wav b/sounds/weapons/nukelaunch.wav similarity index 100% rename from sounds/nukelaunch.wav rename to sounds/weapons/nukelaunch.wav diff --git a/sounds/plasma2.wav b/sounds/weapons/plasma2.wav similarity index 100% rename from sounds/plasma2.wav rename to sounds/weapons/plasma2.wav 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/pointdefensefire.wav b/sounds/weapons/pointdefensefire.wav new file mode 100644 index 000000000..2a508e76a Binary files /dev/null and b/sounds/weapons/pointdefensefire.wav differ diff --git a/sounds/railgun.wav b/sounds/weapons/railgun.wav similarity index 100% rename from sounds/railgun.wav rename to sounds/weapons/railgun.wav diff --git a/sounds/rocket1.wav b/sounds/weapons/rocket1.wav similarity index 100% rename from sounds/rocket1.wav rename to sounds/weapons/rocket1.wav diff --git a/sounds/weapons/shotgun-reload.wav b/sounds/weapons/shotgun-reload.wav new file mode 100644 index 000000000..26d27a9ec Binary files /dev/null and b/sounds/weapons/shotgun-reload.wav differ diff --git a/sounds/weapons/snipershot.wav b/sounds/weapons/snipershot.wav new file mode 100644 index 000000000..829b61543 Binary files /dev/null and b/sounds/weapons/snipershot.wav differ diff --git a/sounds/subhit.wav b/sounds/weapons/subhit.wav similarity index 100% rename from sounds/subhit.wav rename to sounds/weapons/subhit.wav diff --git a/sounds/tankdestroyerfire.wav b/sounds/weapons/tankdestroyerfire.wav similarity index 100% rename from sounds/tankdestroyerfire.wav rename to sounds/weapons/tankdestroyerfire.wav diff --git a/sounds/tankdestroyermaingunfire.wav b/sounds/weapons/tankdestroyermaingunfire.wav similarity index 100% rename from sounds/tankdestroyermaingunfire.wav rename to sounds/weapons/tankdestroyermaingunfire.wav diff --git a/sounds/tgunshipfire.wav b/sounds/weapons/tgunshipfire.wav similarity index 100% rename from sounds/tgunshipfire.wav rename to sounds/weapons/tgunshipfire.wav diff --git a/sounds/tmediumtankfire.wav b/sounds/weapons/tmediumtankfire.wav similarity index 100% rename from sounds/tmediumtankfire.wav rename to sounds/weapons/tmediumtankfire.wav diff --git a/sounds/torpedolaunch.wav b/sounds/weapons/torpedolaunch.wav similarity index 100% rename from sounds/torpedolaunch.wav rename to sounds/weapons/torpedolaunch.wav diff --git a/sounds/triotfire.wav b/sounds/weapons/triotfire.wav similarity index 100% rename from sounds/triotfire.wav rename to sounds/weapons/triotfire.wav 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 04aaf501d..0318ea62a 100644 --- a/springignore.txt +++ b/springignore.txt @@ -2,5 +2,24 @@ # This should allow to play multiplayer directly using a clone of the repo. # +.git /.git /.svn +/*/.svn +/*/*/.svn +/*/*/*/.svn +/*/*/*/*/.svn +/*/*/*/*/*/.svn +/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn +/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/.svn \ No newline at end of file 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/armflash.png b/unitpics/armflash.png deleted file mode 100644 index 6ac059d94..000000000 Binary files a/unitpics/armflash.png and /dev/null differ diff --git a/unitpics/burrow.png b/unitpics/burrow.png index cc9979e84..6be986b11 100644 Binary files a/unitpics/burrow.png and b/unitpics/burrow.png differ diff --git a/unitpics/eaatank.png b/unitpics/eaatank.png index f024d69f0..f529d3351 100644 Binary files a/unitpics/eaatank.png and b/unitpics/eaatank.png differ diff --git a/unitpics/eaaturret.png b/unitpics/eaaturret.png index 36853a3cb..9a27fee42 100644 Binary files a/unitpics/eaaturret.png and b/unitpics/eaaturret.png differ diff --git a/unitpics/eairengineer.png b/unitpics/eairengineer.png index eee83ea42..02a1f3d70 100644 Binary files a/unitpics/eairengineer.png and b/unitpics/eairengineer.png differ diff --git a/unitpics/eairengineer_t2.png b/unitpics/eairengineer_t2.png new file mode 100644 index 000000000..02a1f3d70 Binary files /dev/null and b/unitpics/eairengineer_t2.png differ diff --git a/unitpics/eairengineerai.png b/unitpics/eairengineerai.png deleted file mode 100644 index 924d2641b..000000000 Binary files a/unitpics/eairengineerai.png and /dev/null differ diff --git a/unitpics/eairplant.png b/unitpics/eairplant.png index 7db3c723f..f093e7b50 100644 Binary files a/unitpics/eairplant.png and b/unitpics/eairplant.png differ diff --git a/unitpics/eairplant_t2.png b/unitpics/eairplant_t2.png new file mode 100644 index 000000000..f093e7b50 Binary files /dev/null and b/unitpics/eairplant_t2.png differ diff --git a/unitpics/eairplantai.png b/unitpics/eairplantai.png deleted file mode 100644 index 2baf5fc88..000000000 Binary files a/unitpics/eairplantai.png and /dev/null differ diff --git a/unitpics/eallterraa.png b/unitpics/eallterraa.png index 4a357b8f2..c7a32a760 100644 Binary files a/unitpics/eallterraa.png and b/unitpics/eallterraa.png differ diff --git a/unitpics/eallterranarchid.png b/unitpics/eallterranarchid.png index 299bb433d..b663b4530 100644 Binary files a/unitpics/eallterranarchid.png and b/unitpics/eallterranarchid.png differ diff --git a/unitpics/eallterranarchid_t2.png b/unitpics/eallterranarchid_t2.png new file mode 100644 index 000000000..b663b4530 Binary files /dev/null and b/unitpics/eallterranarchid_t2.png differ diff --git a/unitpics/eallterrassault.png b/unitpics/eallterrassault.png index a1be9d746..a93ee2248 100644 Binary files a/unitpics/eallterrassault.png and b/unitpics/eallterrassault.png differ diff --git a/unitpics/eallterrassault_t2.png b/unitpics/eallterrassault_t2.png new file mode 100644 index 000000000..a93ee2248 Binary files /dev/null and b/unitpics/eallterrassault_t2.png differ diff --git a/unitpics/eallterrengineer.png b/unitpics/eallterrengineer.png index 875149b02..9f3abd355 100644 Binary files a/unitpics/eallterrengineer.png and b/unitpics/eallterrengineer.png differ diff --git a/unitpics/eallterrengineer_t2.png b/unitpics/eallterrengineer_t2.png new file mode 100644 index 000000000..9f3abd355 Binary files /dev/null and b/unitpics/eallterrengineer_t2.png differ diff --git a/unitpics/eallterrengineerai.png b/unitpics/eallterrengineerai.png deleted file mode 100644 index 875149b02..000000000 Binary files a/unitpics/eallterrengineerai.png and /dev/null differ diff --git a/unitpics/eallterrheavy.png b/unitpics/eallterrheavy.png index 965b25e75..c292b1af2 100644 Binary files a/unitpics/eallterrheavy.png and b/unitpics/eallterrheavy.png differ diff --git a/unitpics/eallterrheavy_t2.png b/unitpics/eallterrheavy_t2.png new file mode 100644 index 000000000..c292b1af2 Binary files /dev/null and b/unitpics/eallterrheavy_t2.png differ diff --git a/unitpics/eallterrlight.png b/unitpics/eallterrlight.png index 143b297f8..993fddef4 100644 Binary files a/unitpics/eallterrlight.png and b/unitpics/eallterrlight.png differ diff --git a/unitpics/eallterrlight_t2.png b/unitpics/eallterrlight_t2.png new file mode 100644 index 000000000..993fddef4 Binary files /dev/null and b/unitpics/eallterrlight_t2.png differ diff --git a/unitpics/eallterrmed.png b/unitpics/eallterrmed.png index 93a4b51b8..5d09548bd 100644 Binary files a/unitpics/eallterrmed.png and b/unitpics/eallterrmed.png differ diff --git a/unitpics/eallterrmed_t2.png b/unitpics/eallterrmed_t2.png new file mode 100644 index 000000000..5d09548bd Binary files /dev/null and b/unitpics/eallterrmed_t2.png differ diff --git a/unitpics/eallterrriot.png b/unitpics/eallterrriot.png index 13b156997..e6ce71ac4 100644 Binary files a/unitpics/eallterrriot.png and b/unitpics/eallterrriot.png differ diff --git a/unitpics/eallterrriot_t2.png b/unitpics/eallterrriot_t2.png new file mode 100644 index 000000000..e6ce71ac4 Binary files /dev/null and b/unitpics/eallterrriot_t2.png differ diff --git a/unitpics/eallterrshield.png b/unitpics/eallterrshield.png index 3b8f590fd..78f3749c8 100644 Binary files a/unitpics/eallterrshield.png and b/unitpics/eallterrshield.png differ diff --git a/unitpics/eallterrshield_t2.png b/unitpics/eallterrshield_t2.png new file mode 100644 index 000000000..78f3749c8 Binary files /dev/null and b/unitpics/eallterrshield_t2.png differ diff --git a/unitpics/eamphibaa.png b/unitpics/eamphibaa.png index 5e242e81e..2eb77ba43 100644 Binary files a/unitpics/eamphibaa.png and b/unitpics/eamphibaa.png differ diff --git a/unitpics/eamphibarty.png b/unitpics/eamphibarty.png index d215213fd..167174f51 100644 Binary files a/unitpics/eamphibarty.png and b/unitpics/eamphibarty.png differ diff --git a/unitpics/eamphibarty_t2.png b/unitpics/eamphibarty_t2.png new file mode 100644 index 000000000..167174f51 Binary files /dev/null and b/unitpics/eamphibarty_t2.png differ diff --git a/unitpics/eamphibbuggy.png b/unitpics/eamphibbuggy.png index fb2be2a58..8d0e86716 100644 Binary files a/unitpics/eamphibbuggy.png and b/unitpics/eamphibbuggy.png differ diff --git a/unitpics/eamphibbuggy_t2.png b/unitpics/eamphibbuggy_t2.png new file mode 100644 index 000000000..8d0e86716 Binary files /dev/null and b/unitpics/eamphibbuggy_t2.png differ diff --git a/unitpics/eamphibdrone.png b/unitpics/eamphibdrone.png deleted file mode 100644 index c0f68f3ea..000000000 Binary files a/unitpics/eamphibdrone.png and /dev/null differ diff --git a/unitpics/eamphibengineer.png b/unitpics/eamphibengineer.png index b3e1db44f..f30702607 100644 Binary files a/unitpics/eamphibengineer.png and b/unitpics/eamphibengineer.png differ diff --git a/unitpics/eamphibengineer_t2.png b/unitpics/eamphibengineer_t2.png new file mode 100644 index 000000000..f30702607 Binary files /dev/null and b/unitpics/eamphibengineer_t2.png differ diff --git a/unitpics/eamphibengineerai.png b/unitpics/eamphibengineerai.png deleted file mode 100644 index b3e1db44f..000000000 Binary files a/unitpics/eamphibengineerai.png and /dev/null differ diff --git a/unitpics/eamphibfac.png b/unitpics/eamphibfac.png index 29f229d2e..942a18567 100644 Binary files a/unitpics/eamphibfac.png and b/unitpics/eamphibfac.png differ diff --git a/unitpics/eamphibfac_t2.png b/unitpics/eamphibfac_t2.png new file mode 100644 index 000000000..942a18567 Binary files /dev/null and b/unitpics/eamphibfac_t2.png differ diff --git a/unitpics/eamphibfacai.png b/unitpics/eamphibfacai.png deleted file mode 100644 index 29f229d2e..000000000 Binary files a/unitpics/eamphibfacai.png and /dev/null differ diff --git a/unitpics/eamphibleveler.png b/unitpics/eamphibleveler.png index 7e8724658..ef94aabe3 100644 Binary files a/unitpics/eamphibleveler.png and b/unitpics/eamphibleveler.png differ diff --git a/unitpics/eamphibleveler_t2.png b/unitpics/eamphibleveler_t2.png new file mode 100644 index 000000000..ef94aabe3 Binary files /dev/null and b/unitpics/eamphibleveler_t2.png differ diff --git a/unitpics/eamphibmedtank.png b/unitpics/eamphibmedtank.png index b3845669f..797a922b0 100644 Binary files a/unitpics/eamphibmedtank.png and b/unitpics/eamphibmedtank.png differ diff --git a/unitpics/eamphibmedtank_t2.png b/unitpics/eamphibmedtank_t2.png new file mode 100644 index 000000000..797a922b0 Binary files /dev/null and b/unitpics/eamphibmedtank_t2.png differ diff --git a/unitpics/eamphibneedle.png b/unitpics/eamphibneedle.png index 5e242e81e..2eb77ba43 100644 Binary files a/unitpics/eamphibneedle.png and b/unitpics/eamphibneedle.png differ diff --git a/unitpics/eamphibneedle_t2.png b/unitpics/eamphibneedle_t2.png new file mode 100644 index 000000000..2eb77ba43 Binary files /dev/null and b/unitpics/eamphibneedle_t2.png differ diff --git a/unitpics/eamphibriot.png b/unitpics/eamphibriot.png index 48938af90..d696b7d95 100644 Binary files a/unitpics/eamphibriot.png and b/unitpics/eamphibriot.png differ diff --git a/unitpics/eamphibriot_t2.png b/unitpics/eamphibriot_t2.png new file mode 100644 index 000000000..d696b7d95 Binary files /dev/null and b/unitpics/eamphibriot_t2.png differ diff --git a/unitpics/eamphibrock.png b/unitpics/eamphibrock.png index 5b13aca2d..4013b44f3 100644 Binary files a/unitpics/eamphibrock.png and b/unitpics/eamphibrock.png differ diff --git a/unitpics/eamphibrock_t2.png b/unitpics/eamphibrock_t2.png new file mode 100644 index 000000000..4013b44f3 Binary files /dev/null and b/unitpics/eamphibrock_t2.png differ diff --git a/unitpics/eartytank.png b/unitpics/eartytank.png index 022737399..b06a53b02 100644 Binary files a/unitpics/eartytank.png and b/unitpics/eartytank.png differ diff --git a/unitpics/eartytank_t2.png b/unitpics/eartytank_t2.png new file mode 100644 index 000000000..b06a53b02 Binary files /dev/null and b/unitpics/eartytank_t2.png differ diff --git a/unitpics/eartyturret.png b/unitpics/eartyturret.png index 36853a3cb..bc321b6bb 100644 Binary files a/unitpics/eartyturret.png and b/unitpics/eartyturret.png differ diff --git a/unitpics/ebarricade.png b/unitpics/ebarricade.png index 0653c5c0c..6601b62aa 100644 Binary files a/unitpics/ebarricade.png and b/unitpics/ebarricade.png differ diff --git a/unitpics/ebarricade2.png b/unitpics/ebarricade2.png deleted file mode 100644 index 6139ae240..000000000 Binary files a/unitpics/ebarricade2.png and /dev/null differ diff --git a/unitpics/ebasefactory.png b/unitpics/ebasefactory.png index 3e223925c..cc02dc1c0 100644 Binary files a/unitpics/ebasefactory.png and b/unitpics/ebasefactory.png differ diff --git a/unitpics/ebasefactory_t2.png b/unitpics/ebasefactory_t2.png new file mode 100644 index 000000000..cc02dc1c0 Binary files /dev/null and b/unitpics/ebasefactory_t2.png differ diff --git a/unitpics/ebasefactoryai.png b/unitpics/ebasefactoryai.png deleted file mode 100644 index 3e223925c..000000000 Binary files a/unitpics/ebasefactoryai.png and /dev/null differ diff --git a/unitpics/ebomb.png b/unitpics/ebomb.png index 8b709f737..f995a19eb 100644 Binary files a/unitpics/ebomb.png and b/unitpics/ebomb.png differ diff --git a/unitpics/ebomber.png b/unitpics/ebomber.png index 62810992d..f00e6b7f4 100644 Binary files a/unitpics/ebomber.png and b/unitpics/ebomber.png differ diff --git a/unitpics/ebomber_t2.png b/unitpics/ebomber_t2.png new file mode 100644 index 000000000..f00e6b7f4 Binary files /dev/null and b/unitpics/ebomber_t2.png differ diff --git a/unitpics/ebox.png b/unitpics/ebox.png new file mode 100644 index 000000000..bb5c881c1 Binary files /dev/null and b/unitpics/ebox.png differ diff --git a/unitpics/ecommander.png b/unitpics/ecommander.png index 60b33454c..be64a841d 100644 Binary files a/unitpics/ecommander.png and b/unitpics/ecommander.png differ diff --git a/unitpics/ecommanderai.png b/unitpics/ecommanderai.png index 60b33454c..be64a841d 100644 Binary files a/unitpics/ecommanderai.png and b/unitpics/ecommanderai.png differ diff --git a/unitpics/ecommanderbattle.png b/unitpics/ecommanderbattle.png new file mode 100644 index 000000000..d32e8adcc Binary files /dev/null and b/unitpics/ecommanderbattle.png differ diff --git a/unitpics/ecommanderbuild.png b/unitpics/ecommanderbuild.png new file mode 100644 index 000000000..be64a841d Binary files /dev/null and b/unitpics/ecommanderbuild.png differ diff --git a/unitpics/ecommandercloak.png b/unitpics/ecommandercloak.png new file mode 100644 index 000000000..be64a841d Binary files /dev/null and b/unitpics/ecommandercloak.png differ diff --git a/unitpics/ecommanderfactory.png b/unitpics/ecommanderfactory.png new file mode 100644 index 000000000..be64a841d Binary files /dev/null and b/unitpics/ecommanderfactory.png differ diff --git a/unitpics/ecommandershield.png b/unitpics/ecommandershield.png new file mode 100644 index 000000000..be64a841d Binary files /dev/null and b/unitpics/ecommandershield.png differ diff --git a/unitpics/ecommandfactory.png b/unitpics/ecommandfactory.png deleted file mode 100644 index 58344f20c..000000000 Binary files a/unitpics/ecommandfactory.png and /dev/null differ diff --git a/unitpics/ecruisesilo.png b/unitpics/ecruisesilo.png index f3a33f841..0d162dd4d 100644 Binary files a/unitpics/ecruisesilo.png and b/unitpics/ecruisesilo.png differ diff --git a/unitpics/ecruisesiloai.png b/unitpics/ecruisesiloai.png deleted file mode 100644 index f3a33f841..000000000 Binary files a/unitpics/ecruisesiloai.png and /dev/null differ diff --git a/unitpics/edrone.png b/unitpics/edrone.png index 25e0951e5..314253b9c 100644 Binary files a/unitpics/edrone.png and b/unitpics/edrone.png differ diff --git a/unitpics/eengineer4.png b/unitpics/eengineer4.png deleted file mode 100644 index f35e8af74..000000000 Binary files a/unitpics/eengineer4.png and /dev/null differ diff --git a/unitpics/eengineer5.png b/unitpics/eengineer5.png index a987ca2cf..3767c97ac 100644 Binary files a/unitpics/eengineer5.png and b/unitpics/eengineer5.png differ diff --git a/unitpics/eengineer5_t2.png b/unitpics/eengineer5_t2.png new file mode 100644 index 000000000..3767c97ac Binary files /dev/null and b/unitpics/eengineer5_t2.png differ diff --git a/unitpics/eengineer5ai.png b/unitpics/eengineer5ai.png deleted file mode 100644 index a987ca2cf..000000000 Binary files a/unitpics/eengineer5ai.png and /dev/null differ diff --git a/unitpics/eexkrabgroth.png b/unitpics/eexkrabgroth.png index 299bb433d..b663b4530 100644 Binary files a/unitpics/eexkrabgroth.png and b/unitpics/eexkrabgroth.png differ diff --git a/unitpics/eexnukearty.png b/unitpics/eexnukearty.png index d02f8c6c9..0527ba6bc 100644 Binary files a/unitpics/eexnukearty.png and b/unitpics/eexnukearty.png differ diff --git a/unitpics/eexperimentalfac.png b/unitpics/eexperimentalfac.png index 9fd7ccd5e..769539517 100644 Binary files a/unitpics/eexperimentalfac.png and b/unitpics/eexperimentalfac.png differ diff --git a/unitpics/eextankdestroyer.png b/unitpics/eextankdestroyer.png index 4fc01f39f..2d37b2a40 100644 Binary files a/unitpics/eextankdestroyer.png and b/unitpics/eextankdestroyer.png differ diff --git a/unitpics/efatso2.png b/unitpics/efatso2.png index 134f4278d..838082d41 100644 Binary files a/unitpics/efatso2.png and b/unitpics/efatso2.png differ diff --git a/unitpics/efighter.png b/unitpics/efighter.png index df6cf6299..2db90aa1b 100644 Binary files a/unitpics/efighter.png and b/unitpics/efighter.png differ diff --git a/unitpics/efighter_t2.png b/unitpics/efighter_t2.png new file mode 100644 index 000000000..2db90aa1b Binary files /dev/null and b/unitpics/efighter_t2.png differ diff --git a/unitpics/eflametank.png b/unitpics/eflametank.png index e2e7f5738..ca062548b 100644 Binary files a/unitpics/eflametank.png and b/unitpics/eflametank.png differ diff --git a/unitpics/efusion2.png b/unitpics/efusion2.png index cc9979e84..6be986b11 100644 Binary files a/unitpics/efusion2.png and b/unitpics/efusion2.png differ diff --git a/unitpics/efusion2ai.png b/unitpics/efusion2ai.png deleted file mode 100644 index cc9979e84..000000000 Binary files a/unitpics/efusion2ai.png and /dev/null differ diff --git a/unitpics/egeothermal.png b/unitpics/egeothermal.png index 9cb80ec99..a4e9808bf 100644 Binary files a/unitpics/egeothermal.png and b/unitpics/egeothermal.png differ diff --git a/unitpics/egunship2.png b/unitpics/egunship2.png index a90c9cbee..66c62108e 100644 Binary files a/unitpics/egunship2.png and b/unitpics/egunship2.png differ diff --git a/unitpics/egunship2_t2.png b/unitpics/egunship2_t2.png new file mode 100644 index 000000000..66c62108e Binary files /dev/null and b/unitpics/egunship2_t2.png differ diff --git a/unitpics/ehbotengineer.png b/unitpics/ehbotengineer.png new file mode 100644 index 000000000..1742ba712 Binary files /dev/null and b/unitpics/ehbotengineer.png differ diff --git a/unitpics/ehbotengineer_turret.png b/unitpics/ehbotengineer_turret.png new file mode 100644 index 000000000..c11c72a2e Binary files /dev/null and b/unitpics/ehbotengineer_turret.png differ diff --git a/unitpics/ehbotfac.png b/unitpics/ehbotfac.png new file mode 100644 index 000000000..8c99a02d0 Binary files /dev/null and b/unitpics/ehbotfac.png differ diff --git a/unitpics/ehbotkarganneth.png b/unitpics/ehbotkarganneth.png new file mode 100644 index 000000000..2388a900c Binary files /dev/null and b/unitpics/ehbotkarganneth.png differ diff --git a/unitpics/ehbotkarganneth_turret.png b/unitpics/ehbotkarganneth_turret.png new file mode 100644 index 000000000..c4ba09bca Binary files /dev/null and b/unitpics/ehbotkarganneth_turret.png differ diff --git a/unitpics/ehbotpeewee.png b/unitpics/ehbotpeewee.png index 93733f0db..8750f8c46 100644 Binary files a/unitpics/ehbotpeewee.png and b/unitpics/ehbotpeewee.png differ diff --git a/unitpics/ehbotpeewee_turret.png b/unitpics/ehbotpeewee_turret.png new file mode 100644 index 000000000..4a023c482 Binary files /dev/null and b/unitpics/ehbotpeewee_turret.png differ diff --git a/unitpics/ehbotrocko.png b/unitpics/ehbotrocko.png new file mode 100644 index 000000000..e4e471519 Binary files /dev/null and b/unitpics/ehbotrocko.png differ diff --git a/unitpics/ehbotrocko_turret.png b/unitpics/ehbotrocko_turret.png new file mode 100644 index 000000000..23d9fbe79 Binary files /dev/null and b/unitpics/ehbotrocko_turret.png differ diff --git a/unitpics/ehbotsniper.png b/unitpics/ehbotsniper.png new file mode 100644 index 000000000..1ce0dc863 Binary files /dev/null and b/unitpics/ehbotsniper.png differ diff --git a/unitpics/ehbotsniper_turret.png b/unitpics/ehbotsniper_turret.png new file mode 100644 index 000000000..289ccd01b Binary files /dev/null and b/unitpics/ehbotsniper_turret.png differ diff --git a/unitpics/ehbotthud.png b/unitpics/ehbotthud.png new file mode 100644 index 000000000..a746f80c4 Binary files /dev/null and b/unitpics/ehbotthud.png differ diff --git a/unitpics/ehbotthud_turret.png b/unitpics/ehbotthud_turret.png new file mode 100644 index 000000000..116186c2b Binary files /dev/null and b/unitpics/ehbotthud_turret.png differ diff --git a/unitpics/eheavytank3.png b/unitpics/eheavytank3.png index fb954c03f..de4a8b62c 100644 Binary files a/unitpics/eheavytank3.png and b/unitpics/eheavytank3.png differ diff --git a/unitpics/eheavytank3_t2.png b/unitpics/eheavytank3_t2.png new file mode 100644 index 000000000..de4a8b62c Binary files /dev/null and b/unitpics/eheavytank3_t2.png differ diff --git a/unitpics/eheavytank3_upgraded.png b/unitpics/eheavytank3_upgraded.png new file mode 100644 index 000000000..87e8b62fa Binary files /dev/null and b/unitpics/eheavytank3_upgraded.png differ diff --git a/unitpics/eheavytank_t3.png b/unitpics/eheavytank_t3.png new file mode 100644 index 000000000..02ae829ee Binary files /dev/null and b/unitpics/eheavytank_t3.png differ diff --git a/unitpics/eheavyturret2.png b/unitpics/eheavyturret2.png index 85d131ec5..37712ea7b 100644 Binary files a/unitpics/eheavyturret2.png and b/unitpics/eheavyturret2.png differ diff --git a/unitpics/eheavyturret2ai.png b/unitpics/eheavyturret2ai.png deleted file mode 100644 index 85d131ec5..000000000 Binary files a/unitpics/eheavyturret2ai.png and /dev/null differ diff --git a/unitpics/ejammer2.png b/unitpics/ejammer2.png index 324e56e9c..1222ebf30 100644 Binary files a/unitpics/ejammer2.png and b/unitpics/ejammer2.png differ diff --git a/unitpics/ekmar.png b/unitpics/ekmar.png index da7e5c5d9..d46130c4f 100644 Binary files a/unitpics/ekmar.png and b/unitpics/ekmar.png differ diff --git a/unitpics/ekrow.png b/unitpics/ekrow.png new file mode 100644 index 000000000..dd499bb37 Binary files /dev/null and b/unitpics/ekrow.png differ diff --git a/unitpics/elacerator.png b/unitpics/elacerator.png index 205ef0b2c..d8169411c 100644 Binary files a/unitpics/elacerator.png and b/unitpics/elacerator.png differ diff --git a/unitpics/elacerator_t2.png b/unitpics/elacerator_t2.png new file mode 100644 index 000000000..d8169411c Binary files /dev/null and b/unitpics/elacerator_t2.png 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/elighttank3.png b/unitpics/elighttank3.png index 1cf465be8..8ed489688 100644 Binary files a/unitpics/elighttank3.png and b/unitpics/elighttank3.png differ diff --git a/unitpics/elighttank3_t2.png b/unitpics/elighttank3_t2.png new file mode 100644 index 000000000..8ed489688 Binary files /dev/null and b/unitpics/elighttank3_t2.png differ diff --git a/unitpics/elighttank3_upgraded.png b/unitpics/elighttank3_upgraded.png new file mode 100644 index 000000000..e1fc6ce24 Binary files /dev/null and b/unitpics/elighttank3_upgraded.png differ diff --git a/unitpics/elightturret2.png b/unitpics/elightturret2.png index f64d0a7b9..cb3c1ffa0 100644 Binary files a/unitpics/elightturret2.png and b/unitpics/elightturret2.png differ diff --git a/unitpics/elightturret2ai.png b/unitpics/elightturret2ai.png deleted file mode 100644 index f64d0a7b9..000000000 Binary files a/unitpics/elightturret2ai.png and /dev/null differ diff --git a/unitpics/elrpc.png b/unitpics/elrpc.png index 45b479233..ce0d661f2 100644 Binary files a/unitpics/elrpc.png and b/unitpics/elrpc.png differ diff --git a/unitpics/emaker.png b/unitpics/emaker.png index a7dda1925..15b014760 100644 Binary files a/unitpics/emaker.png and b/unitpics/emaker.png differ diff --git a/unitpics/emediumgen.png b/unitpics/emediumgen.png index a48546f5c..32824ab0c 100644 Binary files a/unitpics/emediumgen.png and b/unitpics/emediumgen.png differ diff --git a/unitpics/emediumgenai.png b/unitpics/emediumgenai.png deleted file mode 100644 index a48546f5c..000000000 Binary files a/unitpics/emediumgenai.png and /dev/null differ diff --git a/unitpics/emediumtank3.png b/unitpics/emediumtank3.png index ede26c673..7fdf11d99 100644 Binary files a/unitpics/emediumtank3.png and b/unitpics/emediumtank3.png differ diff --git a/unitpics/emetalextractor.png b/unitpics/emetalextractor.png index c58160c89..fbf3a896f 100644 Binary files a/unitpics/emetalextractor.png and b/unitpics/emetalextractor.png differ diff --git a/unitpics/emetalextractorai.png b/unitpics/emetalextractorai.png deleted file mode 100644 index c58160c89..000000000 Binary files a/unitpics/emetalextractorai.png and /dev/null differ diff --git a/unitpics/emine.png b/unitpics/emine.png index 423ef97a2..49230de33 100644 Binary files a/unitpics/emine.png and b/unitpics/emine.png differ diff --git a/unitpics/emineai.png b/unitpics/emineai.png deleted file mode 100644 index 423ef97a2..000000000 Binary files a/unitpics/emineai.png and /dev/null differ diff --git a/unitpics/eminifac.png b/unitpics/eminifac.png index b201fbad8..726c5c9f3 100644 Binary files a/unitpics/eminifac.png and b/unitpics/eminifac.png differ diff --git a/unitpics/eminifac_t2.png b/unitpics/eminifac_t2.png new file mode 100644 index 000000000..726c5c9f3 Binary files /dev/null and b/unitpics/eminifac_t2.png differ diff --git a/unitpics/eminifacai.png b/unitpics/eminifacai.png deleted file mode 100644 index b201fbad8..000000000 Binary files a/unitpics/eminifacai.png and /dev/null differ diff --git a/unitpics/emissiletank.png b/unitpics/emissiletank.png index 983ff3b16..771036215 100644 Binary files a/unitpics/emissiletank.png and b/unitpics/emissiletank.png differ diff --git a/unitpics/emissiletank_t2.png b/unitpics/emissiletank_t2.png new file mode 100644 index 000000000..771036215 Binary files /dev/null and b/unitpics/emissiletank_t2.png differ diff --git a/unitpics/engineermarbuk.png b/unitpics/engineermarbuk.png index 875149b02..4946288de 100644 Binary files a/unitpics/engineermarbuk.png and b/unitpics/engineermarbuk.png differ diff --git a/unitpics/eorb.png b/unitpics/eorb.png index 173dcb287..0b7484000 100644 Binary files a/unitpics/eorb.png and b/unitpics/eorb.png differ diff --git a/unitpics/eorbai.png b/unitpics/eorbai.png deleted file mode 100644 index 173dcb287..000000000 Binary files a/unitpics/eorbai.png and /dev/null differ diff --git a/unitpics/eradar2.png b/unitpics/eradar2.png index 5bfc6823a..57b09a790 100644 Binary files a/unitpics/eradar2.png and b/unitpics/eradar2.png differ diff --git a/unitpics/eriottank2.png b/unitpics/eriottank2.png index 8d75bf5c7..63074bd89 100644 Binary files a/unitpics/eriottank2.png and b/unitpics/eriottank2.png differ diff --git a/unitpics/eriottank2_t2.png b/unitpics/eriottank2_t2.png new file mode 100644 index 000000000..63074bd89 Binary files /dev/null and b/unitpics/eriottank2_t2.png differ diff --git a/unitpics/escout.png b/unitpics/escout.png index f52775abc..bc564f3bf 100644 Binary files a/unitpics/escout.png and b/unitpics/escout.png differ diff --git a/unitpics/escout_t2.png b/unitpics/escout_t2.png new file mode 100644 index 000000000..bc564f3bf Binary files /dev/null and b/unitpics/escout_t2.png differ diff --git a/unitpics/eshieldgen.png b/unitpics/eshieldgen.png index 56c94e053..fb74c7522 100644 Binary files a/unitpics/eshieldgen.png and b/unitpics/eshieldgen.png differ diff --git a/unitpics/esilo.png b/unitpics/esilo.png index cc7bc284e..6c51bbea2 100644 Binary files a/unitpics/esilo.png and b/unitpics/esilo.png differ diff --git a/unitpics/esolar2.png b/unitpics/esolar2.png index 8f99a8b58..585f2e3cb 100644 Binary files a/unitpics/esolar2.png and b/unitpics/esolar2.png differ diff --git a/unitpics/estorage.png b/unitpics/estorage.png index c60210363..a74854931 100644 Binary files a/unitpics/estorage.png and b/unitpics/estorage.png differ diff --git a/unitpics/estorageai.png b/unitpics/estorageai.png deleted file mode 100644 index c60210363..000000000 Binary files a/unitpics/estorageai.png and /dev/null differ diff --git a/unitpics/esubmarine.png b/unitpics/esubmarine.png index fe54281f8..9fa071a98 100644 Binary files a/unitpics/esubmarine.png and b/unitpics/esubmarine.png differ diff --git a/unitpics/esubplane.png b/unitpics/esubplane.png deleted file mode 100644 index 3a7b7a0aa..000000000 Binary files a/unitpics/esubplane.png and /dev/null differ diff --git a/unitpics/etech1.png b/unitpics/etech1.png new file mode 100644 index 000000000..32824ab0c Binary files /dev/null and b/unitpics/etech1.png differ diff --git a/unitpics/etech2.png b/unitpics/etech2.png new file mode 100644 index 000000000..32824ab0c Binary files /dev/null and b/unitpics/etech2.png differ diff --git a/unitpics/etech3.png b/unitpics/etech3.png new file mode 100644 index 000000000..32824ab0c Binary files /dev/null and b/unitpics/etech3.png differ diff --git a/unitpics/etransport.png b/unitpics/etransport.png index 0637d8842..2088e08a5 100644 Binary files a/unitpics/etransport.png and b/unitpics/etransport.png differ diff --git a/unitpics/etransport_t2.png b/unitpics/etransport_t2.png new file mode 100644 index 000000000..2088e08a5 Binary files /dev/null and b/unitpics/etransport_t2.png differ diff --git a/unitpics/euwfusion2.png b/unitpics/euwfusion2.png index 7527a2a91..20d61f402 100644 Binary files a/unitpics/euwfusion2.png and b/unitpics/euwfusion2.png differ diff --git a/unitpics/euwmetalextractor.png b/unitpics/euwmetalextractor.png index 0008a3cfc..653ea353c 100644 Binary files a/unitpics/euwmetalextractor.png and b/unitpics/euwmetalextractor.png differ diff --git a/unitpics/euwsolar2.png b/unitpics/euwsolar2.png index 18c461204..cf149516f 100644 Binary files a/unitpics/euwsolar2.png and b/unitpics/euwsolar2.png differ diff --git a/unitpics/euwstorage.png b/unitpics/euwstorage.png index 65c1f427a..9818d0ba8 100644 Binary files a/unitpics/euwstorage.png and b/unitpics/euwstorage.png differ diff --git a/unitpics/euwturret.png b/unitpics/euwturret.png index 76c234414..cbb5d19b4 100644 Binary files a/unitpics/euwturret.png and b/unitpics/euwturret.png differ diff --git a/unitpics/glsl_test.png b/unitpics/glsl_test.png index e31b27fb8..a0bde7e36 100644 Binary files a/unitpics/glsl_test.png and b/unitpics/glsl_test.png differ diff --git a/unitpics/goldtree.png b/unitpics/goldtree.png index ba9121f37..60a242df0 100644 Binary files a/unitpics/goldtree.png and b/unitpics/goldtree.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/queen.png b/unitpics/queen.png index 299bb433d..b663b4530 100644 Binary files a/unitpics/queen.png and b/unitpics/queen.png differ diff --git a/unitpics/rand0adbush.png b/unitpics/rand0adbush.png index bc2a5123e..8998e9f90 100644 Binary files a/unitpics/rand0adbush.png and b/unitpics/rand0adbush.png differ diff --git a/unitpics/rand0adsnowtree.png b/unitpics/rand0adsnowtree.png index fac299f16..ad4ff5d04 100644 Binary files a/unitpics/rand0adsnowtree.png and b/unitpics/rand0adsnowtree.png differ diff --git a/unitpics/randagorm.png b/unitpics/randagorm.png index 235cb751a..50a9ebb85 100644 Binary files a/unitpics/randagorm.png and b/unitpics/randagorm.png differ diff --git a/unitpics/randartturilo.png b/unitpics/randartturilo.png index bc3c2cbfc..753ebe282 100644 Binary files a/unitpics/randartturilo.png and b/unitpics/randartturilo.png differ diff --git a/unitpics/randartturiwinterlo.png b/unitpics/randartturiwinterlo.png index c635fc6f9..964c6cd02 100644 Binary files a/unitpics/randartturiwinterlo.png and b/unitpics/randartturiwinterlo.png differ diff --git a/unitpics/randbehartlo.png b/unitpics/randbehartlo.png index e2857665d..5ef1870ca 100644 Binary files a/unitpics/randbehartlo.png and b/unitpics/randbehartlo.png differ diff --git a/unitpics/randbehetree.png b/unitpics/randbehetree.png index c00030f6e..ab2f3793e 100644 Binary files a/unitpics/randbehetree.png and b/unitpics/randbehetree.png differ diff --git a/unitpics/randcactus.png b/unitpics/randcactus.png index 4775c5d53..e95bd911b 100644 Binary files a/unitpics/randcactus.png and b/unitpics/randcactus.png differ diff --git a/unitpics/randespire.png b/unitpics/randespire.png index 986c965e4..6b17e4ea3 100644 Binary files a/unitpics/randespire.png and b/unitpics/randespire.png differ diff --git a/unitpics/randrock.png b/unitpics/randrock.png index f76bc1851..9eab237e5 100644 Binary files a/unitpics/randrock.png and b/unitpics/randrock.png differ diff --git a/unitpics/randsnowtree.png b/unitpics/randsnowtree.png index 05a3bcb39..e59cb8a33 100644 Binary files a/unitpics/randsnowtree.png and b/unitpics/randsnowtree.png differ diff --git a/unitpics/randtree.png b/unitpics/randtree.png index f3dbeecc0..3a1387709 100644 Binary files a/unitpics/randtree.png and b/unitpics/randtree.png 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 diff --git a/validmaps.lua b/validmaps.lua deleted file mode 100644 index 099068825..000000000 --- a/validmaps.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - -} \ No newline at end of file