diff --git a/.cdb.json b/.cdb.json new file mode 100644 index 0000000..6875fd8 --- /dev/null +++ b/.cdb.json @@ -0,0 +1,15 @@ +{ + "type": "MOD", + "title": "Spawners", + "name": "spawners", + "short_description": "Adds multiple spawner blocks. There ara no ABM's used and this modpack is developed with focus on the best multiplayer online server performace.", + "dev_state": "MAINTENANCE_ONLY", + "tags": [ + "decorative", + "survival" + ], + "license": "LGPL-2.1-or-later", + "media_license": "CC-BY-SA-4.0", + "repo": "https://bitbucket.org/minetest_gamers/spawners/src/master/", + "issue_tracker": "https://bitbucket.org/minetest_gamers/spawners/issues?status=new&status=open" +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bb53136 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f67a22f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Creating an archive + +.* export-ignore +assets export-ignore +scripts export-ignore +bin export-ignore +docs export-ignore +types export-ignore +*.zip export-ignore +bitbucket-pipelines.yml export-ignore +package.json export-ignore +package-lock.json export-ignore +screenshot*.png export-ignore +i18n.py export-ignore +config.ld export-ignore +schematic_tables.txt export-ignore diff --git a/.gitignore b/.gitignore index 90328e0..2585589 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ docs/build *.old node_modules *.log -logs *.mtl +logs diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..1a2b1be --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,82 @@ +unused_args = false +allow_defined_top = true +max_line_length = false + +exclude_files = { + './scripts', + './bin', + './logs', + './node_modules', + './sounds', + './textures', + './models', + './docs', + './locale', + './types', +} + +globals = { + 'XBows', + 'XBowsQuiver', + 'XBowsEntityDefBase', + 'XBowsEntityDefCustom' +} + +read_globals = { + "DIR_DELIM", "INIT", + + "minetest", "core", + "dump", "dump2", + + "Raycast", + "Settings", + "PseudoRandom", + "PerlinNoise", + "VoxelManip", + "SecureRandom", + "VoxelArea", + "PerlinNoiseMap", + "PcgRandom", + "ItemStack", + "AreaStore", + "unpack", + + "vector", + + table = { + fields = { + "copy", + "indexof", + "insert_all", + "key_value_swap", + "shuffle", + } + }, + + string = { + fields = { + "split", + "trim", + } + }, + + math = { + fields = { + "hypot", + "sign", + "factorial", + "round", + } + }, + + "player_monoids", + "playerphysics", + "hb", + "mesecon", + "armor", + "default", + "spawners_ores", + "spawners_env", + "spawners_mobs", + "mobs" +} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..53a4221 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.13.2 diff --git a/README.md b/README.md index 2bf6a07..3436d9c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Spawners Modpack # -This MOD for Minetest adds multiple spawner blocks. There ara no ABM's used and this modpack is developed with focus on the best multiplayer online server performace. +Adds multiple spawner blocks. There ara no ABM's used and this modpack is developed with focus on the best multiplayer online server performace. Easy to implement new mob mods just look in to config.lua. -New features can be enabled/disabled in settings.txt file. Currently it works with [Mobs Redo](https://forum.minetest.net/viewtopic.php?f=11&t=9917) and [Creatures](https://forum.minetest.net/viewtopic.php?f=11&t=8638) but other mob mods can be easily added to config.lua @@ -10,121 +9,20 @@ Currently it works with [Mobs Redo](https://forum.minetest.net/viewtopic.php?f=1 ![Spawners Ores](spawners_ores/screenshot.png) -This MOD for Minetest let the player craft ore Spawners. Ores are spawning randomly in a short intervals and you get 10% more ores from inputed ingots. Ores are spawning only in default:stone so make sure there is one around. This MOD is giving the option of creating lumps back from ingots. - -### Mod dependencies ### -* default +Let the player craft ore Spawners. Ores are spawning randomly in a short intervals and you get 10% more ores from inputed ingots. Ores are spawning only in default:stone so make sure there is one around. This MOD is giving the option of creating lumps back from ingots. ## Spawners Mobs ## -This MOD for Minetest let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals. This MOD is giving the option of creating mob farms and grinders. +Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals. This MOD is giving the option of creating mob farms and grinders. ![Spawners Mobs](spawners_mobs/screenshot.png) -### Mod dependencies ### -* default -* fire? -* xpanes? -* mobs? -* creatures? -* bones? - -fake_fire, xpanes for recipes - -bones are for mob drops only - ## Spawners Environmental ## -This MOD for Minetest adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). +Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). ![Spawners Mobs](spawners_env/screenshot.png) -### Mod dependencies ### -* default - -## Links ## -[[Mod]Minetest Forum Page](https://forum.minetest.net/viewtopic.php?f=11&t=13857) - -[[Server]Minetest Forum Page](https://forum.minetest.net/viewtopic.php?f=10&t=13727) - try this MOD on this server - -[G+ Collection](https://plus.google.com/collection/06fEx) - -[G+ Community](https://plus.google.com/communities/105201070842404099845) - ## License ## -![WTFPL](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-1.png) -## Changelog ## - -### 1.0 ### -* refactored Spawners Ores - best multiplayer performance usable on online servers -* refactored Spawners Mobs - best multiplayer performance usable on online servers -* refactored Spawners Env - best multiplayer performance usable on online servers - -### 0.6 ### -* inherited BlockMen Pyramid mod, so now Spawners can spawn Pyramids in desert (mapgen v6) -* spawning Pyramids work independently from BlockMen Pyramids mod (can be removed) but works also besides BlockMen Pyramid mod -* added more various loot (default) in pyramids chests and higher up the chance of spawning more loot -* added new environmental spawners -* added generation of environmental spawners for default mapgen v6 temples and dungeons -* addend new config parameter 'disable' for night_only attribute in config file -* added new attribute 'env' in config file for defining environmental spawners -* added settings.txt file for enable/disable new features (pyramids, mapgen spawners..) -* fixed abm catch_up (disabled), now it works - -### 0.5.1 ### -* added mobs redo stone monster spawner (re-done from BlockMen Pyramids) - -### 0.5 ### -* new mobs redo sheep textures -* added mobs redo spider spawner -* added oerrki spawner for creatures mod -* added screenshot and description for MODs in-game tab -* added pyramids mod to optional dependencies - -### 0.4 ### -* NEW added ore spawners - iron, gold and copper -* ore spawners have chance to spawn 2 ores from 1 ingot -* ore spawners have formspec -* new sounds for ore spawners -* added particle effect for ore spawners -* re-done all textures from scratch (mob and ore spawners) -* adjusted mob spawners ABM -* added maximum stacked items for spawners to max 1 -* mob spawners fixed name conflicts in config file warthog vs. pumba - -### 0.3 ### -* new folder and file structure -* more convenient disable/enable, add/remove new MODs in config.lua file - added property for custom sounds -* added sound for bunny -* fixed sound for pyramids:mummy -* added footsteps and dug sounds for the spawners -* shorter and more effective code, easier to read, fixed variable namings -* ABM tweak - longer delay to trigger but bigger chance for spawn entity -* disabled ABM catch_up -* added normal map texture for default spawner - -### 0.2 ### -* support pyramids mod - mummy -* support creatures mod -* shorten the code - more effecient - -### 0.1 ### -* Initial Release -* detects only 6 nodes for 'air' around the spawner [top, bottom, left, right, front, back] afterwards it will check the node above and below the found 'air' node - so there is enough space to spawn someone -* always picks random side from where the mob will spawn -* detects for light and time of day - spawn mobs only at night if 'only_night' set to true -* status 'waiting' - blue sparkles, for not enough light (day spawners) or too much light for night spawners -* status 'default/inactive' i.e. if the spawner is closed from each side or there is no space to spawn mob -* status 'active' when spawner is active and is spawning mobs -* status 'overheat' when there is too much 'max_objects_per_block' (prevents from server errors), max value is taken from minetest.conf -* easy to configure, add and remove MODs for mobs -* only [Mobs Redo](https://github.com/tenplus1/mobs) from tenplus1 is added for now -* added recipes for all spawners, it's expensive so it will not get overcrowded on the server only with spawners -* almost everything is done dynamically -* spawners emit small amount of light -* active and overheated spawner can cause fire to flammable nodes around it -* spawners are active only if player is in radius (21) -* spawners are diggable only with steel pickaxe and above, so no noob griefers can raid your base too easy -* mobs play sound when spawned -* animated textures \ No newline at end of file +See included license files. diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml new file mode 100644 index 0000000..369b282 --- /dev/null +++ b/bitbucket-pipelines.yml @@ -0,0 +1,77 @@ +image: atlassian/default-image:3 + +pipelines: + pull-requests: + "**": + - step: + name: Install Node Dependencies + caches: + - node-modules + - npm + - nvm + script: + - nvm install v17.2.0 + - npm i -g npm@8 + - npm ci + # - parallel: + - step: + name: Lua Check + script: + - apt-get update + - apt-get -y install lua5.1 + - apt-get -y install luarocks + - luarocks install luacheck + - luacheck . + # - step: + # name: Lua Diagnostics + # caches: + # - node-modules + # - npm + # - nvm + # script: + # - nvm use v17.2.0 + # - npm run lua-diagnostics + tags: + "*": + - step: + name: Install Node Dependencies + caches: + - node-modules + - npm + - nvm + script: + - nvm install v17.2.0 + - npm i -g npm@8 + - npm ci + # - parallel: + - step: + name: Lua Check + script: + - apt-get update + - apt-get -y install lua5.1 + - apt-get -y install luarocks + - luarocks install luacheck + - luacheck . + # - step: + # name: Lua Diagnostics + # caches: + # - node-modules + # - npm + # - nvm + # script: + # - nvm use v17.2.0 + # - npm run lua-diagnostics + - step: + name: Deploy to ContentDB + caches: + - node-modules + - npm + - nvm + script: + - nvm use v17.2.0 + - npm run push:ci -- --token=$CONTENT_DB_SPAWNERS_TOKEN --title=$BITBUCKET_TAG +definitions: + caches: + node-modules: ./node_modules + npm: ~/.npm + nvm: ~/.nvm diff --git a/license.txt b/license.txt index 5c93f45..d58ee8f 100644 --- a/license.txt +++ b/license.txt @@ -1,13 +1,1181 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 - Copyright (C) 2004 Sam Hocevar + Copyright (C) 2023 SaKeL + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. You just DO WHAT THE FUCK YOU WANT TO. + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. 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 not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the 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 +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### Code + +GNU Lesser General Public License v2.1 or later (see included LICENSE file) + +### Textures + +**CC-BY-SA-4.0, by SaKeL** + +- x_farming_carrot_seed.png +- x_farming_potato_seed.png +- x_farming_coffee.png +- x_farming_coffee_seed.png +- x_farming_corn_popcorn.png +- x_farming_obsidian_soil.png +- x_farming_obsidian_soil_wet.png +- x_farming_obsidian_wart_seed.png +- x_farming_corn_1.png +- x_farming_corn_2.png +- x_farming_corn_3.png +- x_farming_corn_4.png +- x_farming_corn_5.png +- x_farming_corn_6.png +- x_farming_corn_7.png +- x_farming_corn_8.png +- x_farming_corn_9.png +- x_farming_corn_10.png +- x_farming_corn_pop.png +- x_farming_corn_seed.png +- x_farming_kiwi.png +- x_farming_kiwi_fruit.png +- x_farming_kiwi_sapling.png +- x_farming_cactus_fruit_bottom.png +- x_farming_cactus_fruit_sides.png +- x_farming_cactus_fruit_top.png +- x_farming_cactus_fruit_item.png +- x_farming_large_cactus_with_fruit_seedling.png +- x_farming_large_cactus_with_fruit_seedling +- x_farming_strawberry_seed.png +- x_farming_strawberry.png +- x_farming_jungleleaves.png +- x_farming_jungle_tree.png +- x_farming_jungle_tree_top.png +- x_farming_jungle_wood.png +- x_farming_pine_nut.png +- x_farming_pine_nut_roasted.png +- x_farming_coffee_cup_hot.png +- x_farming_bottle_coffee.png +- x_farming_bottle_water.png +- x_farming_bottle_soymilk_raw.png +- x_farming_bottle_soymilk.png +- x_farming_donut.png +- x_farming_donut_chocolate.png +- x_farming_soybean.png +- x_farming_soybean_1.png +- x_farming_soybean_2.png +- x_farming_soybean_3.png +- x_farming_soybean_4.png +- x_farming_soybean_5.png +- x_farming_soybean_6.png +- x_farming_soybean_7.png +- x_farming_soybean_seed.png +- x_farming_stevia.png +- x_farming_stevia_1.png +- x_farming_stevia_2.png +- x_farming_stevia_3.png +- x_farming_stevia_4.png +- x_farming_stevia_5.png +- x_farming_stevia_6.png +- x_farming_stevia_7.png +- x_farming_stevia_8.png +- x_farming_stevia_seed.png +- x_farming_x_bonemeal_bonemeal.png +- x_farming_salt_1_side.png +- x_farming_salt_1_top.png +- x_farming_salt_2_side.png +- x_farming_salt_2_top.png +- x_farming_salt_3_side.png +- x_farming_salt_3_top.png +- x_farming_salt_4_side.png +- x_farming_salt_4_top.png +- x_farming_salt_water.png +- x_farming_drilled_ice.png +- x_farming_ice_auger.png +- x_farming_icefishing_back_0.png +- x_farming_icefishing_back_1.png +- x_farming_icefishing_back_2.png +- x_farming_icefishing_back_3.png +- x_farming_icefishing_back_4.png +- x_farming_icefishing_back_5.png +- x_farming_icefishing_back_6.png +- x_farming_icefishing_back_7.png +- x_farming_icefishing_back_8.png +- x_farming_icefishing_back_9.png +- x_farming_icefishing_bottom.png +- x_farming_icefishing_front_0.png +- x_farming_icefishing_front_1.png +- x_farming_icefishing_front_2.png +- x_farming_icefishing_front_3.png +- x_farming_icefishing_front_4.png +- x_farming_icefishing_front_5.png +- x_farming_icefishing_front_6.png +- x_farming_icefishing_front_7.png +- x_farming_icefishing_front_8.png +- x_farming_icefishing_front_9.png +- x_farming_icefishing_inv.png +- x_farming_icefishing_left.png +- x_farming_icefishing_right.png +- x_farming_icefishing_top_1.png +- x_farming_icefishing_top_2.png +- x_farming_icefishing_top_3.png +- x_farming_icefishing_top_4.png +- x_farming_icefishing_top_5.png +- x_farming_icefishing_top_6.png +- x_farming_icefishing_top_7.png +- x_farming_icefishing_top_8.png +- x_farming_icefishing_top_9.png +- x_farming_icefishing_top_animated.png +- x_farming_icefishing_top_animated_9.png +- x_farming_hog_stew_mesh.png +- x_farming_beetroot_soup_mesh.png +- x_farming_pumpkin_pie_mesh.png +- x_farming_kiwi_fruit_mesh.png +- x_farming_corn_popcorn_mesh.png +- x_farming_fries_mesh.png +- x_farming_coffee_cup_hot_mesh.png +- x_farming_donut_mesh.png +- x_farming_donut_chocolate_mesh.png +- x_farming_bag_salt.png +- x_farming_crate_beetroot_3.png +- x_farming_crate_cactus_fruit_item_3.png +- x_farming_crate_carrot_3.png +- x_farming_crate_cocoa_bean_3.png +- x_farming_crate_coffee_3.png +- x_farming_crate_corn_3.png +- x_farming_crate_cotton_3.png +- x_farming_crate_fish_3.png +- x_farming_crate_kiwi_fruit_3.png +- x_farming_crate_melon_3.png +- x_farming_crate_obsidian_wart_3.png +- x_farming_crate_pine_nut_3.png +- x_farming_crate_potato_3.png +- x_farming_crate_pumpkin_block_3.png +- x_farming_crate_soybean_3.png +- x_farming_crate_stevia_3.png +- x_farming_crate_strawberry_3.png +- x_farming_crate_wheat_3.png +- x_farming_fly.png +- x_farming_composter_1.png +- x_farming_composter_4.png +- x_farming_composter_5.png +- x_farming_composter_2.png +- x_farming_composter_3.png +- x_farming_coffee_1.png +- x_farming_coffee_2.png +- x_farming_coffee_3.png +- x_farming_coffee_4.png +- x_farming_coffee_5.png +- x_farming_pumpkin_1.png +- x_farming_pumpkin_2.png +- x_farming_pumpkin_3.png +- x_farming_pumpkin_4.png +- x_farming_pumpkin_5.png +- x_farming_pumpkin_6.png +- x_farming_pumpkin_7.png +- x_farming_pumpkin_8.png +- x_farming_corn.png +- x_farming_chocolate.png +- x_farming_fries.png +- x_farming_bag_empty.png -- Derived from Farmer's Delight by vectorwing (MIT) +- x_farming_crate_empty.png -- Derived from Farmer's Delight by vectorwing (MIT) +- x_farming_melon_1.png +- x_farming_melon_2.png +- x_farming_melon_3.png +- x_farming_melon_4.png +- x_farming_melon_5.png +- x_farming_melon_6.png +- x_farming_melon_7.png +- x_farming_melon_8.png +- x_farming_strawberry_1.png +- x_farming_strawberry_2.png +- x_farming_strawberry_3.png +- x_farming_strawberry_4.png +- x_farming_pine_nut_leaves.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0) +- x_farming_x_bonemeal_particles.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0) +- x_farming_salt.png +- x_farming_kiwi_leaves.png -- Derived from texture by paramat (CC BY-SA 3.0) +- x_farming_junglesapling.png -- Derived from texture by PilzAdam (CC BY-SA 3.0) +- x_farming_pine_nut_sapling.png -- Derived from texture by Splizard (CC BY-SA 3.0) +- x_farming_salt_1_bottom.png -- Derived from a texture by random-geek (CC BY-SA 3.0) -- Derived from texture by Neuromancer (CC BY-SA 3.0) +- x_farming_fish_woodskip.png +- x_farming_fish_wolffish.png +- x_farming_fish_whitefish.png +- x_farming_fish_purple_seashroom.png +- x_farming_fish_black_seashroom.png +- x_farming_fish_blue_seashroom.png +- x_farming_fish_brown_seashroom.png +- x_farming_fish_cyan_seashroom.png +- x_farming_fish_gray_seashroom.png +- x_farming_fish_green_seashroom.png +- x_farming_fish_light_gray_seashroom.png +- x_farming_fish_lime_seashroom.png +- x_farming_fish_magenta_seashroom.png +- x_farming_fish_orange_seashroom.png +- x_farming_fish_pink_seashroom.png +- x_farming_fish_red_seashroom.png +- x_farming_fish_white_seashroom.png +- x_farming_fish_yellow_seashroom.png +- x_farming_fish_white_bullhead.png +- x_farming_fish_cold_ocean_hermit_crab.png +- x_farming_fish_frozen_ocean_hermit_crab.png +- x_farming_fish_lukewarm_ocean_hermit_crab.png +- x_farming_fish_ocean_hermit_crab.png +- x_farming_fish_warm_ocean_hermit_crab.png +- x_farming_fish_walleye.png +- x_farming_fish_vampire_squid.png +- x_farming_fish_true_goldfish.png +- x_farming_fish_totemfish.png +- x_farming_fish_tilapia.png +- x_farming_fish_tench.png +- x_farming_fish_tancho_koi.png +- x_farming_fish_mother_moon.png +- x_farming_fish_swordfish.png +- x_farming_fish_desert_frog.png +- x_farming_fish_jungle_frog.png +- x_farming_fish_swamp_frog.png +- x_farming_fish_swamp_darter.png +- x_farming_fish_sunfish.png +- x_farming_fish_sturgeon.png +- x_farming_fish_stingray.png +- x_farming_fish_sterlet.png +- x_farming_fish_smallmouth_bass.png +- x_farming_fish_largemouth_bass.png +- x_farming_fish_slimefish.png +- x_farming_fish_skykoi.png +- x_farming_fish_skullfin.png +- x_farming_fish_rusty_skullfin.png +- x_farming_fish_skate.png +- x_farming_fish_shrimp.png +- x_farming_fish_sea_cucumber.png +- x_farming_fish_sawfish.png +- x_farming_fish_sardine.png +- x_farming_fish_sablefish.png +- x_farming_fish_rosefish.png +- x_farming_fish_rohu.png +- x_farming_fish_rockfish.png +- x_farming_fish_redbreast_sunfish.png +- x_farming_fish_red_snapper.png +- x_farming_fish_red_mullet.png +- x_farming_fish_rainbowfish.png +- x_farming_fish_rainbow_trout.png +- x_farming_fish_pumpkinseed.png +- x_farming_fish_prismfish.png +- x_farming_fish_piranha.png +- x_farming_fish_pike.png +- x_farming_fish_piglish.png +- x_farming_fish_perch.png +- x_farming_fish_pearlwog.png +- x_farming_fish_pearl_isopod.png +- x_farming_fish_paddlefish.png +- x_farming_fish_oscar.png +- x_farming_fish_octopus.png +- x_farming_fish_obster.png +- x_farming_fish_lobster.png +- x_farming_fish_neon_tetra.png +- x_farming_fish_mud_flounder.png +- x_farming_fish_minnow.png +- x_farming_fish_manta_ray.png +- x_farming_fish_magma_slimefish.png +- x_farming_fish_lingcod.png +- x_farming_fish_leerfish.png +- x_farming_fish_leech.png +- x_farming_fish_lava_eel.png +- x_farming_fish_albacore.png +- x_farming_fish_anchovy.png +- x_farming_fish_angelfish.png +- x_farming_fish_angler.png +- x_farming_fish_armored_catfish.png +- x_farming_fish_arrow_squid.png +- x_farming_fish_barracuda.png +- x_farming_fish_blobfish.png +- x_farming_fish_bream.png +- x_farming_fish_burbot.png +- x_farming_fish_carp.png +- x_farming_fish_catfish.png +- x_farming_fish_catla.png +- x_farming_fish_chorus_snail.png +- x_farming_fish_chub.png +- x_farming_fish_clam.png +- x_farming_fish_conger.png +- x_farming_fish_congo_tiger_fish.png +- x_farming_fish_convict_cichlid.png +- x_farming_fish_crab.png +- x_farming_fish_crayfish.png +- x_farming_fish_damselfish.png +- x_farming_fish_danios.png +- x_farming_fish_desert_sunfish.png +- x_farming_fish_diamond_angler.png +- x_farming_fish_dwarf_caiman.png +- x_farming_fish_eel.png +- x_farming_fish_electric_eel.png +- x_farming_fish_endray.png +- x_farming_fish_father_sun.png +- x_farming_fish_flier.png +- x_farming_fish_floral_faefish.png +- x_farming_fish_flounder.png +- x_farming_fish_fourhorn_sculpin.png +- x_farming_fish_frozen_boneminnow.png +- x_farming_fish_gar.png +- x_farming_fish_giant_moray.png +- x_farming_fish_goldeye.png +- x_farming_fish_goldfish.png +- x_farming_fish_grass_pickerel.png +- x_farming_fish_guppy.png +- x_farming_fish_hagfish.png +- x_farming_fish_halibut.png +- x_farming_fish_herring.png +- x_farming_fish_illager_ghostfish.png +- x_farming_fish_ironfish.png +- x_farming_fish_koi.png +- x_farming_fish_lamprey.png +- x_farming_cactus_brick.png -- Derived from a texture by Calinou (CC BY-SA 3.0) +- x_farming_cooked_mask.png +- x_farming_scarecrow_1_item.png +- x_farming_scarecrow_1.png +- x_farming_christmas_tree_leaves_animated.png -- Derived from texture by Splizard (CC BY-SA 3.0) +- x_farming_christmas_tree_leaves_decorated.png -- Derived from texture by Splizard (CC BY-SA 3.0) +- x_farming_christmas_tree_sapling.png +- x_farming_christmas_tree_star.png +- x_farming_scarecrow_2.png +- x_farming_barley.png +- x_farming_barley_1.png +- x_farming_barley_2.png +- x_farming_barley_3.png +- x_farming_barley_4.png +- x_farming_barley_5.png +- x_farming_barley_6.png +- x_farming_barley_7.png +- x_farming_barley_8.png +- x_farming_barley_seed.png +- x_farming_barley_stack_side.png +- x_farming_barley_stack_top.png +- x_farming_bread.png +- x_farming_cotton.png +- x_farming_cotton_1.png +- x_farming_cotton_2.png +- x_farming_cotton_3.png +- x_farming_cotton_4.png +- x_farming_cotton_5.png +- x_farming_cotton_6.png +- x_farming_cotton_7.png +- x_farming_cotton_8.png +- x_farming_cotton_seed.png +- x_farming_crate_barley_3.png +- x_farming_crate_cotton2_3.png +- x_farming_flour.png +- x_farming_string.png +- x_farming_tool_steelhoe.png +- x_farming_tool_stonehoe.png +- x_farming_tool_woodhoe.png +- x_farming_pine_nut_tree.png +- x_farming_pine_nut_tree_top.png +- x_farming_pine_nut_wood.png +- x_farming_kiwi_tree.png +- x_farming_kiwi_tree_top.png +- x_farming_kiwi_tree_wood.png +- x_farming_beetroot_1.png +- x_farming_beetroot_2.png +- x_farming_beetroot_3.png +- x_farming_beetroot_4.png +- x_farming_beetroot_5.png +- x_farming_beetroot_6.png +- x_farming_beetroot_7.png +- x_farming_beetroot_8.png +- x_farming_beetroot.png +- x_farming_beetroot_seed.png +- x_farming_beetroot_soup.png +- x_farming_bowl.png +- x_farming_carrot_1.png +- x_farming_carrot_2.png +- x_farming_carrot_3.png +- x_farming_carrot_4.png +- x_farming_carrot_5.png +- x_farming_carrot_6.png +- x_farming_carrot_7.png +- x_farming_carrot_8.png +- x_farming_carrot_golden.png +- x_farming_carrot.png +- x_farming_fish_stew.png +- x_farming_potato_1.png +- x_farming_potato_2.png +- x_farming_potato_3.png +- x_farming_potato_4.png +- x_farming_potato_5.png +- x_farming_potato_6.png +- x_farming_potato_7.png +- x_farming_potato_8.png +- x_farming_potato_baked.png +- x_farming_potato.png +- x_farming_potato_poisonous.png +- x_farming_obsidian_wart_1.png +- x_farming_obsidian_wart_2.png +- x_farming_obsidian_wart_3.png +- x_farming_obsidian_wart_4.png +- x_farming_obsidian_wart_5.png +- x_farming_obsidian_wart_6.png +- x_farming_obsidian_wart.png +- x_farming_wart_block.png +- x_farming_wart_brick_block.png +- x_farming_wart_brick.png +- x_farming_wartrack.png +- x_farming_wart_red_brick_block.png +- x_farming_cookie.png +- x_farming_sugar.png +- x_farming_cocoa_top_1.png +- x_farming_cocoa_right_1.png +- x_farming_cocoa_left_1.png +- x_farming_cocoa_front_1.png +- x_farming_cocoa_bottom_1.png +- x_farming_cocoa_left_2.png +- x_farming_cocoa_top_2.png +- x_farming_cocoa_bottom_2.png +- x_farming_cocoa_front_2.png +- x_farming_cocoa_right_2.png +- x_farming_cocoa_right_3.png +- x_farming_cocoa_front_3.png +- x_farming_cocoa_top_3.png +- x_farming_cocoa_bottom_3.png +- x_farming_cocoa_left_3.png +- x_farming_cocoa_bean +- x_farming_melon_seed.png +- x_farming_melon_fruit_side.png +- x_farming_melon_fruit_top.png +- x_farming_melon_fruit_bottom.png +- x_farming_melon.png +- x_farming_golden_melon.png +- x_farming_pumpkin_fruit_side_off.png +- x_farming_pumpkin_fruit_side_on.png +- x_farming_pumpkin_fruit_side.png +- x_farming_pumpkin_fruit_top.png +- x_farming_pumpkin_fruit_bottom.png +- x_farming_pumpkin_pie.png +- x_farming_pumpkin_seed.png +- x_farming_bee_hive_bottom.png +- x_farming_bee_hive_front.png +- x_farming_bee_hive_saturated_overlay.png +- x_farming_bee_hive_side.png +- x_farming_bee_hive_top.png +- x_farming_bee_mesh_animated.png +- x_farming_bottle_honey.png +- x_farming_default_particle.png +- x_farming_honey_block_mesh.png +- x_farming_honeycomb.png +- x_farming_honeycomb_block.png +- x_farming_honeycomb_saw.png +- x_farming_jar_empty.png +- x_farming_jar_with_bee.png +- x_farming_candle_flame_animated.png +- x_farming_candle_item.png +- x_farming_candle_mesh.png +- x_farming_candle_no_flame.png +- x_farming_rope.png +- x_farming_rope_item.png +- x_farming_rope_fence.png +- x_farming_rope_fence_item.png +- x_farming_safety_net.png +- x_farming_safety_net_side.png + +**CC-BY-SA-3.0, modified by Thomas-S** + +- x_farming_vessels_glass_bottle.png + +**CC-BY-SA-3.0, BlockMen** + +- x_farming_gui_hb_bg.png + +### Sound + +**CC-BY-3.0, by MaxDemianAGL**, https://freesound.org + +- x_farming_x_bonemeal_grow.ogg + +**CC-BY-3.0, by Angel_Perez_Grandi**, https://freesound.org + +- x_farming_ice_dug.ogg + +**CC0-1.0, by felix.blume**, https://freesound.org/people/felix.blume/sounds/583040/ + +- x_farming_bee.1.ogg +- x_farming_bee.2.ogg +- x_farming_bee.3.ogg +- x_farming_bee.4.ogg +- x_farming_bee.5.ogg +- x_farming_bee.6.ogg +- x_farming_bee.7.ogg + +**CC0-1.0, by niittymaa**, https://freesound.org/people/niittymaa/sounds/666969/ + +- x_farming_slime_footstep.1.ogg +- x_farming_slime_footstep.2.ogg +- x_farming_slime_footstep.3.ogg +- x_farming_slime_footstep.4.ogg + +**CC0-1.0, by EminYILDIRIM**, https://freesound.org/people/EminYILDIRIM/sounds/544636/ + +- x_farming_slime_dug.1.ogg +- x_farming_slime_dug.2.ogg +- x_farming_slime_dug.3.ogg + +**CC0-1.0, by jtap97**, https://freesound.org/people/jtap97/sounds/448885/ + +- x_farming_slime_dig.1.ogg +- x_farming_slime_dig.2.ogg +- x_farming_slime_dig.3.ogg + +**CC0-1.0, by kyles**, https://freesound.org + +- x_farming_dirt_hit.1.ogg +- x_farming_dirt_hit.2.ogg +- x_farming_dirt_hit.3.ogg + +**CC-BY-4.0, by RICHERlandTV**, https://freesound.org + +- x_farming_wood_place.1.ogg +- x_farming_wood_place.2.ogg +- x_farming_wood_place.3.ogg + +**CC0-1.0, by igroglaz**, https://freesound.org + +- x_farming_wood_hit.1.ogg +- x_farming_wood_hit.2.ogg +- x_farming_wood_hit.3.ogg +- x_farming_wood_hit.4.ogg +- x_farming_wood_hit.5.ogg +- x_farming_wood_hit.6.ogg + +**CC0-1.0, by Fission9**, https://freesound.org + +- x_farming_dirt_footstep.1.ogg +- x_farming_dirt_footstep.2.ogg +- x_farming_dirt_footstep.3.ogg +- x_farming_dirt_footstep.4.ogg +- x_farming_wood_footstep.1.ogg +- x_farming_wood_footstep.2.ogg +- x_farming_wood_footstep.3.ogg +- x_farming_wood_footstep.4.ogg +- x_farming_wood_footstep.5.ogg +- x_farming_wood_footstep.6.ogg + +**CC-BY-4.0, by HerbertBoland**, https://freesound.org/people/AtevonHes/sounds/454783/ + +- x_farming_tool_breaks.1.ogg +- x_farming_tool_breaks.2.ogg +- x_farming_tool_breaks.3.ogg + +**CC-BY-3.0, by Mito551**, https://freesound.org + +- x_farming_thin_glass_footstep.ogg + +**CC-BY-4.0, by F.M.Audio**, https://freesound.org + +- x_farming_stone_place.1.ogg +- x_farming_stone_place.2.ogg +- x_farming_stone_place.3.ogg +- x_farming_stone_place.4.ogg + + +**CC0-1.0, by lolamadeus**, https://freesound.org + +- x_farming_stone_hit.1.ogg +- x_farming_stone_hit.2.ogg +- x_farming_stone_hit.3.ogg + +**CC0-1.0, by Nox_Sound**, https://freesound.org + +- x_farming_stone_dug.1.ogg +- x_farming_stone_dug.2.ogg +- x_farming_stone_dug.3.ogg +- x_farming_stone_footstep.1.ogg +- x_farming_stone_footstep.2.ogg +- x_farming_stone_footstep.3.ogg +- x_farming_stone_footstep.4.ogg +- x_farming_stone_footstep.5.ogg + +**CC-BY-3.0, by Coral_Island_Studios**, https://freesound.org + +- x_farming_sand_place.1.ogg +- x_farming_sand_place.2.ogg +- x_farming_sand_place.3.ogg +- x_farming_sand_place.4.ogg +- x_farming_sand_place.5.ogg + +**CC0-1.0, by Lukeo135**, https://freesound.org + +- x_farming_sand_hit.1.ogg +- x_farming_sand_hit.2.ogg +- x_farming_sand_hit.3.ogg + +**CC0-1.0, by pan14**, https://freesound.org + +- x_farming_sand_footstep.1.ogg +- x_farming_sand_footstep.2.ogg +- x_farming_sand_footstep.3.ogg + +**CC0-1.0, by schneidi67**, https://freesound.org + +- x_farming_sand_dug.1.ogg +- x_farming_sand_dug.2.ogg +- x_farming_sand_dug.3.ogg + +**CC0-1.0, by vgraham1**, https://freesound.org + +- x_farming_leaves_place.1.ogg +- x_farming_leaves_place.2.ogg + +**CC-BY-4.0, by Abacagi**, https://freesound.org + +- x_farming_leaves_hit.1.ogg +- x_farming_leaves_hit.2.ogg + +**CC-BY-4.0, by elektroproleter**, https://freesound.org + +- x_farming_leaves_footstep.1.ogg +- x_farming_leaves_footstep.2.ogg +- x_farming_leaves_footstep.3.ogg +- x_farming_leaves_footstep.4.ogg + +**CC-BY-4.0, by JanKoehl**, https://freesound.org + +- x_farming_leaves_dug.1.ogg +- x_farming_leaves_dug.2.ogg + +**CC-BY-4.0, by EminYILDIRIM**, https://freesound.org + +- x_farming_ice_hit.1.ogg +- x_farming_ice_hit.2.ogg +- x_farming_ice_hit.3.ogg +- x_farming_ice_hit.4.ogg + +**CC-BY-4.0, by InspectorJ**, https://freesound.org + +- x_farming_ice_footstep.1.ogg +- x_farming_ice_footstep.2.ogg +- x_farming_ice_footstep.3.ogg +- x_farming_ice_footstep.4.ogg + +**CC0-1.0, by Nox_Sound**, https://freesound.org + +- x_farming_grass_hit.1.ogg +- x_farming_grass_hit.3.ogg +- x_farming_grass_hit.2.ogg + +**CC0-1.0, by Yuval**, https://freesound.org + +- x_farming_grass_footstep.1.ogg +- x_farming_grass_footstep.2.ogg +- x_farming_grass_footstep.3.ogg + +**CC0-1.0, by Robson220pl**, https://freesound.org + +- x_farming_glass_place.1.ogg +- x_farming_glass_place.2.ogg +- x_farming_glass_place.3.ogg + +**CC-BY-3.0, by cmusounddesign**, http://www.freesound.org/people/cmusounddesign/sounds/71947/ + +- x_farming_break_thin_glass.1.ogg + +**CC-BY-3.0, by Tomlija**, http://www.freesound.org/people/Tomlija/sounds/97669/ + +- x_farming_break_thin_glass.2.ogg + +**CC-BY-3.0, by lsprice**, http://www.freesound.org/people/lsprice/sounds/88808/ + +- x_farming_break_thin_glass.3.ogg + +**CC0-1.0, by 16FThumaF**, https://freesound.org/people/16FThumaF/sounds/499020/ + +- x_farming_extinguish_candle.ogg + +**CC0-1.0, by bahaish**, https://freesound.org/people/bahaish/sounds/145786/ + +- x_farming_rope_footstep.1.ogg +- x_farming_rope_footstep.2.ogg +- x_farming_rope_footstep.3.ogg +- x_farming_rope_footstep.4.ogg + +**CC0-1.0, by dansotak**, https://freesound.org/people/dansotak/sounds/137711/ + +- x_farming_rope_hit.1.ogg +- x_farming_rope_hit.2.ogg +- x_farming_rope_hit.3.ogg +- x_farming_rope_hit.4.ogg + +**CC-BY-4.0, by Benboncan**, +https://freesound.org/people/Benboncan/sounds/78248/ +https://freesound.org/people/Benboncan/sounds/78249/ +https://freesound.org/people/Benboncan/sounds/78250/ + +- x_farming_rope_dug.1.ogg +- x_farming_rope_dug.2.ogg +- x_farming_rope_dug.3.ogg + + +### Models + +**CC-BY-SA-4.0, by SaKeL** + +- x_farming_hog_stew.obj +- x_farming_beetroot_soup.obj +- x_farming_pumpkin_pie.obj +- x_farming_kiwi_fruit.obj +- x_farming_corn_popcorn.obj +- x_farming_fries.obj +- x_farming_coffee_cup_hot.obj +- x_farming_donut.obj +- x_farming_crate.obj +- x_farming_bag.obj +- x_farming_scarecrow.obj +- x_farming_scarecrow_2.obj +- x_farming_bee.obj +- x_farming_honey.obj +- x_farming_candle_1.obj +- x_farming_candle_2.obj +- x_farming_candle_3.obj +- x_farming_candle_4.obj diff --git a/modpack.conf b/modpack.conf new file mode 100644 index 0000000..47ebd6d --- /dev/null +++ b/modpack.conf @@ -0,0 +1,6 @@ +name = spawners +description = Adds multiple spawner blocks. There ara no ABMs used and this modpack is developed with focus on the best multiplayer online server performace. +depends = +optional_depends = +supported_games = +min_minetest_version = diff --git a/modpack.txt b/modpack.txt deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json new file mode 100644 index 0000000..0390a96 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "spawners", + "version": "1.0.0", + "description": "Adds bow and arrows to Minetest.", + "main": "index.js", + "type": "module", + "directories": { + "doc": "docs" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "push:ci": "node ./scripts/deploy", + "lua-diagnostics": "node ./scripts/lls-check" + }, + "repository": { + "type": "git", + "url": "git+https://juraj_vajda@bitbucket.org/minetest_gamers/spawners.git" + }, + "author": "SaKeL", + "license": "LGPL-2.1-or-later", + "bugs": { + "url": "https://bitbucket.org/minetest_gamers/spawners/issues" + }, + "homepage": "https://bitbucket.org/minetest_gamers/spawners#readme", + "devDependencies": { + "jaguar": "^6.0.1", + "node-fetch": "^3.2.10", + "yargs": "^17.6.1" + } +} diff --git a/spawners_env/LICENSE.txt b/spawners_env/LICENSE.txt new file mode 100644 index 0000000..a1b8416 --- /dev/null +++ b/spawners_env/LICENSE.txt @@ -0,0 +1,568 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 2016 - 2023 SaKeL + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. 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 not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the 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 +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### Code + +GNU Lesser General Public License v2.1 or later (see included LICENSE file) + +### Textures + +**CC-BY-SA-4.0, by SaKeL** + +- spawners_mobs_balrog.png +- spawners_mobs_black_skull.png +- spawners_mobs_evil_bunny_egg.png +- spawners_mobs_evil_bunny.png +- spawners_mobs_firebolt.png +- spawners_mobs_flame_particle_2.png +- spawners_mobs_flame_particle.png +- spawners_mobs_galvornsword.png +- spawners_mobs_mummy.png +- spawners_mobs_sandstone_carved_bird.png +- spawners_mobs_sandstone_carved_eye.png +- spawners_mobs_sandstone_carved_men.png +- spawners_mobs_sandstone_carved_sun.png +- spawners_mobs_smoke_particle_2.png +- spawners_mobs_smoke_particle.png +- spawners_mobs_spawner_16.png +- spawners_mobs_spawner_animated.png +- spawners_mobs_spawner_rusty.png +- spawners_mobs_spawner_waiting_animated_16.png +- spawners_mobs_spawner_waiting_animated.png +- spawners_mobs_spawner.png +- spawners_mobs_trans.png +- spawners_mobs_uruk_hai_1.png +- spawners_mobs_uruk_hai_2.png +- spawners_mobs_uruk_hai_3.png +- spawners_mobs_uruk_hai_egg.png +- spawners_mobs_uruk_hai.png + +### Sounds + +**CC-BY-SA-4.0, by SaKeL** + +- spawners_mobs_balrog_neutral.ogg +- spawners_mobs_balrog_attack.1.ogg +- spawners_mobs_balrog_attack.2.ogg +- spawners_mobs_balrog_attack.3.ogg +- spawners_mobs_balrog_attack.4.ogg +- spawners_mobs_balrog_attack.5.ogg +- spawners_mobs_balrog_attack.ogg +- spawners_mobs_balrog_death.ogg +- spawners_mobs_balrog_fireball.ogg +- spawners_mobs_balrog_hit.1.ogg +- spawners_mobs_balrog_hit.2.ogg +- spawners_mobs_balrog_hit.3.ogg +- spawners_mobs_balrog_hit.4.ogg +- spawners_mobs_balrog_hit.5.ogg +- spawners_mobs_balrog_hit.ogg +- spawners_mobs_balrog_neutral.1.ogg +- spawners_mobs_balrog_neutral.2.ogg +- spawners_mobs_bunny.ogg +- spawners_mobs_mummy_attack.1.ogg +- spawners_mobs_mummy_attack.2.ogg +- spawners_mobs_mummy_attack.3.ogg +- spawners_mobs_mummy_attack.4.ogg +- spawners_mobs_mummy_attack.5.ogg +- spawners_mobs_mummy_attack.ogg +- spawners_mobs_mummy_death.1.ogg +- spawners_mobs_mummy_death.2.ogg +- spawners_mobs_mummy_death.3.ogg +- spawners_mobs_mummy_death.ogg +- spawners_mobs_mummy_hit.1.ogg +- spawners_mobs_mummy_hit.2.ogg +- spawners_mobs_mummy_hit.3.ogg +- spawners_mobs_mummy_hit.4.ogg +- spawners_mobs_mummy_hit.ogg +- spawners_mobs_mummy_neutral.1.ogg +- spawners_mobs_mummy_neutral.2.ogg +- spawners_mobs_mummy_neutral.ogg +- spawners_mobs_mummy_spell.1.ogg +- spawners_mobs_mummy_spell.2.ogg +- spawners_mobs_mummy_spell.3.ogg +- spawners_mobs_mummy_spell.4.ogg +- spawners_mobs_mummy_spell.ogg +- spawners_mobs_teleport.ogg +- spawners_mobs_uruk_hai_attack.1.ogg +- spawners_mobs_uruk_hai_attack.2.ogg +- spawners_mobs_uruk_hai_attack.3.ogg +- spawners_mobs_uruk_hai_attack.4.ogg +- spawners_mobs_uruk_hai_attack.ogg +- spawners_mobs_uruk_hai_death.1.ogg +- spawners_mobs_uruk_hai_death.2.ogg +- spawners_mobs_uruk_hai_death.3.ogg +- spawners_mobs_uruk_hai_death.4.ogg +- spawners_mobs_uruk_hai_death.ogg +- spawners_mobs_uruk_hai_hit.1.ogg +- spawners_mobs_uruk_hai_hit.2.ogg +- spawners_mobs_uruk_hai_hit.3.ogg +- spawners_mobs_uruk_hai_hit.4.ogg +- spawners_mobs_uruk_hai_hit.5.ogg +- spawners_mobs_uruk_hai_hit.ogg +- spawners_mobs_uruk_hai_neutral.1.ogg +- spawners_mobs_uruk_hai_neutral.2.ogg +- spawners_mobs_uruk_hai_neutral.3.ogg +- spawners_mobs_uruk_hai_neutral.4.ogg +- spawners_mobs_uruk_hai_neutral.ogg + +### Models + +**CC-BY-SA-4.0, by SaKeL** + +- spawners_mobs_balrog.b3d +- spawners_mobs_character.b3d +- spawners_mobs_evil_bunny.b3d +- spawners_mobs_mummy.b3d diff --git a/spawners_env/api.lua b/spawners_env/api.lua index 541aeb3..b17d5e6 100644 --- a/spawners_env/api.lua +++ b/spawners_env/api.lua @@ -1,250 +1,203 @@ +--[[ + Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- main tables -spawners_env = {} +spawners_env = { + ENABLED_MODS = {}, + MOBS_PROPS = {} +} + spawners_env.mob_tables = {} --- check if mods exists and build tables -for k, mob_mod in ipairs(ENABLED_MODS) do - local modpath = minetest.get_modpath(mob_mod) - -- list of mobs and their info - if (modpath) then - for j, mob in ipairs(MOBS_PROPS[mob_mod]) do - local mob_egg = nil - -- create only environmental spawners - if mob.env then - table.insert(spawners_env.mob_tables, {name=mob.name, mod_prefix=mob_mod, egg_name_custom=mob.egg_name_custom, dummy_size=mob.dummy_size, dummy_offset=mob.dummy_offset, dummy_mesh=mob.dummy_mesh, dummy_texture=mob.dummy_texture, night_only=mob.night_only, sound_custom=mob.sound_custom, env=mob.env, boss=mob.boss}) - -- use custom egg or create a default egg - if mob.egg_name_custom ~= "" then - mob_egg = mob.egg_name_custom - else - mob_egg = mob_mod..":"..mob.name - end - end +function spawners_env.register_spawners() + -- check if mods exists and build tables + for k, mob_mod in ipairs(spawners_env.ENABLED_MODS) do + local modpath = minetest.get_modpath(mob_mod) + -- list of mobs and their info + if (modpath) then + for j, mob in ipairs(spawners_env.MOBS_PROPS[mob_mod]) do + -- local mob_egg = nil - end - else - -- print something ? - end + -- create only environmental spawners + if mob.env then + table.insert(spawners_env.mob_tables, { name = mob.name, mod_prefix = mob_mod, egg_name_custom = mob.egg_name_custom, dummy_size = mob.dummy_size, dummy_offset = mob.dummy_offset, dummy_mesh = mob.dummy_mesh, dummy_texture = mob.dummy_texture, night_only = mob.night_only, sound_custom = mob.sound_custom, env = mob.env, boss = mob.boss }) + + -- use custom egg or create a default egg + -- if mob.egg_name_custom ~= '' then + -- mob_egg = mob.egg_name_custom + -- else + -- mob_egg = mob_mod .. ':' .. mob.name + -- end + end + + end + end + end end -- start spawning mobs function spawners_env.start_spawning(pos, how_many, mob_name, mod_prefix, sound_custom) - - if not (pos or mob_name) then - return - end - -- remove 'spawners_env:' from the string - local mob_name = string.sub(mob_name,14) - local sound_name - -- use custom sounds - if sound_custom ~= "" then - sound_name = sound_custom - else - sound_name = mod_prefix.."_"..mob_name - end + if not (pos or mob_name) then + return + end - if how_many == nil then - how_many = math.random(1,2) - end + -- remove 'spawners_env:' from the string + local _mob_name = string.sub(mob_name, 14) + local sound_name + -- use custom sounds + if sound_custom ~= '' then + sound_name = sound_custom + else + sound_name = mod_prefix .. '_' .. _mob_name + end - for i=1,how_many do - pos.y = pos.y+1 - local obj = minetest.add_entity(pos, mod_prefix..":"..mob_name) + if how_many == nil then + how_many = math.random(1, 2) + end - if obj then - if sound_name then - minetest.sound_play(sound_name, { - pos = pos, - max_hear_distance = 100, - gain = 5, - }) - end - end - end + for i = 1, how_many do + pos.y = pos.y + 1 + local obj = minetest.add_entity(pos, mod_prefix .. ':' .. _mob_name) + + if obj then + if sound_name then + minetest.sound_play(sound_name, { + pos = pos, + max_hear_distance = 100, + gain = 5, + }) + end + end + end end function spawners_env.check_around_radius(pos) - local player_near = false - local radius = 21 - local node_ore_pos = nil + local player_near = false + local radius = 21 - for _,obj in ipairs(minetest.get_objects_inside_radius(pos, radius)) do - if obj:is_player() then - player_near = true - end - end + for _,obj in ipairs(minetest.get_objects_inside_radius(pos, radius)) do + if obj:is_player() then + player_near = true + end + end - return player_near + return player_near end function spawners_env.check_node_status(pos, mob, night_only, boss) - local player_near = spawners_env.check_around_radius(pos) + local player_near = spawners_env.check_around_radius(pos) - if player_near or boss then - local random_pos = false - local min_node_light = 10 - local tod = minetest.get_timeofday() * 24000 - local node_light = minetest.get_node_light(pos) + if player_near or boss then + local random_pos + local min_node_light = 10 + local tod = minetest.get_timeofday() * 24000 + local node_light = minetest.get_node_light(pos) - if not node_light then - return false - end + if not node_light then + return false + end - local spawn_positions = {} - local right = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z}) - local front = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) - local left = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z}) - local back = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) - local top = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) - local bottom = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + local spawn_positions = {} + local right = minetest.get_node({ x = pos.x + 1, y = pos.y, z = pos.z }) + local front = minetest.get_node({ x = pos.x, y = pos.y, z = pos.z + 1 }) + local left = minetest.get_node({ x = pos.x - 1, y = pos.y, z = pos.z }) + local back = minetest.get_node({ x = pos.x, y = pos.y, z = pos.z - 1 }) + local top = minetest.get_node({ x = pos.x, y = pos.y + 1, z = pos.z }) + local bottom = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }) - -- make sure that at least one side of the spawner is open - if right.name == "air" then - table.insert(spawn_positions, {x=pos.x+1.5, y=pos.y, z=pos.z}) - end - if front.name == "air" then - table.insert(spawn_positions, {x=pos.x, y=pos.y, z=pos.z+1.5}) - end - if left.name == "air" then - table.insert(spawn_positions, {x=pos.x-1.5, y=pos.y, z=pos.z}) - end - if back.name == "air" then - table.insert(spawn_positions, {x=pos.x, y=pos.y, z=pos.z-1.5}) - end - if top.name == "air" then - table.insert(spawn_positions, {x=pos.x, y=pos.y+1.5, z=pos.z}) - end - if bottom.name == "air" then - table.insert(spawn_positions, {x=pos.x, y=pos.y-1.5, z=pos.z}) - end + -- make sure that at least one side of the spawner is open + if right.name == 'air' then + table.insert(spawn_positions, { x = pos.x + 1.5, y = pos.y, z = pos.z }) + end + if front.name == 'air' then + table.insert(spawn_positions, { x = pos.x, y = pos.y, z = pos.z + 1.5 }) + end + if left.name == 'air' then + table.insert(spawn_positions, { x = pos.x - 1.5, y = pos.y, z = pos.z }) + end + if back.name == 'air' then + table.insert(spawn_positions, { x = pos.x, y = pos.y, z = pos.z - 1.5 }) + end + if top.name == 'air' then + table.insert(spawn_positions, { x = pos.x, y = pos.y + 1.5, z = pos.z }) + end + if bottom.name == 'air' then + table.insert(spawn_positions, { x = pos.x, y = pos.y - 1.5, z = pos.z }) + end - -- spawner is closed from all sides - if #spawn_positions < 1 then - return false - - -- find random position in all posible places - else - local possible_spawn_pos = {} - local pick_random_key + -- spawner is closed from all sides + if #spawn_positions < 1 then + return false - -- get a position value from the picked/random key - for k, v in pairs (spawn_positions) do - local node_above = minetest.get_node({x=v.x, y=v.y+1, z=v.z}).name - local node_below = minetest.get_node({x=v.x, y=v.y-1, z=v.z}).name + else + -- find random position in all posible places + local possible_spawn_pos = {} + local pick_random_key - -- make super sure there is enough place to spawn mob and collect all possible spawn points - if node_above == "air" or node_below == "air" then - table.insert(possible_spawn_pos, v) - -- print("possible pos: "..minetest.pos_to_string(v)) - end - end + -- get a position value from the picked/random key + for k, v in pairs(spawn_positions) do + local node_above = minetest.get_node({ x = v.x, y = v.y + 1, z = v.z }).name + local node_below = minetest.get_node({ x = v.x, y = v.y - 1, z = v.z }).name - -- no possible spawn points found - not enough place around the spawner - if #possible_spawn_pos < 1 then - return false + -- make super sure there is enough place to spawn mob and collect all possible spawn points + if node_above == 'air' or node_below == 'air' then + table.insert(possible_spawn_pos, v) + -- print('possible pos: ' .. minetest.pos_to_string(v)) + end + end - -- only one possible position ? - elseif #possible_spawn_pos == 1 then - pick_random_key = #possible_spawn_pos + -- no possible spawn points found - not enough place around the spawner + if #possible_spawn_pos < 1 then + return false - -- pick random from the possible open sides - else - pick_random_key = math.random(1,#possible_spawn_pos) - end + elseif #possible_spawn_pos == 1 then + -- only one possible position ? + pick_random_key = #possible_spawn_pos - random_pos = possible_spawn_pos[pick_random_key] - -- print(minetest.pos_to_string(random_pos)) - end + else + -- pick random from the possible open sides + pick_random_key = math.random(1, #possible_spawn_pos) + end - if night_only ~= "disable" then - -- spawn only at day - if not night_only and node_light < min_node_light then - return false, true - end + random_pos = possible_spawn_pos[pick_random_key] + -- print(minetest.pos_to_string(random_pos)) + end - -- spawn only at night - if night_only then - if not (19359 > tod and tod > 5200) or node_light < min_node_light then - return random_pos - else - return false, true - end - end - end - -- random_pos, waiting - return random_pos, false - else - -- random_pos, waiting - return false, true - end + if night_only ~= 'disable' then + -- spawn only at day + if not night_only and node_light < min_node_light then + return false, true + end + + -- spawn only at night + if night_only then + if not (19359 > tod and tod > 5200) or node_light < min_node_light then + return random_pos + else + return false, true + end + end + end + -- random_pos, waiting + return random_pos, false + else + -- random_pos, waiting + return false, true + end end - -local chest_stuff = { - {name="default:apple", max = 3}, - {name="default:torch", max = 10}, - {name="default:aspen_sapling", max = 5}, - {name="farming:bread", max = 3}, - {name="default:steel_ingot", max = 2}, - {name="default:gold_ingot", max = 2}, - {name="default:bronze_ingot", max = 2}, - {name="default:copper_ingot", max = 2}, - {name="default:diamond", max = 1}, - {name="default:pick_steel", max = 1}, - {name="default:pick_diamond", max = 1}, - {name="default:pick_bronze", max = 1}, - {name="default:pick_mese", max = 1}, - {name="default:pick_stone", max = 1}, - {name="default:pick_wood", max = 1}, - {name="default:sword_bronze", max = 1}, - {name="default:sword_diamond", max = 1}, - {name="default:sword_mese", max = 1}, - {name="default:sword_steel", max = 1}, - {name="default:sword_stone", max = 1}, - {name="default:sword_wood", max = 1}, - {name="default:shovel_bronze", max = 1}, - {name="default:shovel_diamond", max = 1}, - {name="default:shovel_mese", max = 1}, - {name="default:shovel_steel", max = 1}, - {name="default:shovel_stone", max = 1}, - {name="default:shovel_wood", max = 1}, - {name="default:axe_bronze", max = 1}, - {name="default:axe_diamond", max = 1}, - {name="default:axe_mese", max = 1}, - {name="default:axe_steel", max = 1}, - {name="default:axe_stone", max = 1}, - {name="default:axe_wood", max = 1}, - {name="obsidianmese:mese_apple", max = 1}, -} - -function spawners_env.fill_chest(pos) - minetest.after(2, function() - local n = minetest.get_node(pos) - - if n and n.name and n.name == "default:chest" then - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - - inv:set_size("main", 8*4) - - -- if math.random(1,10) < 5 then return end - - for i=0,2,1 do - local stuff = chest_stuff[math.random(1,#chest_stuff)] - - if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then - stuff = chest_stuff[1] - end - - if stuff.name == "obsidianmese:mese_apple" and not minetest.get_modpath("obsidianmese") then - stuff = chest_stuff[1] - end - - local stack = {name=stuff.name, count = math.random(1,stuff.max)} - - if not inv:contains_item("main", stack) then - inv:set_stack("main", math.random(1,32), stack) - end - end - end - end) -end \ No newline at end of file diff --git a/spawners_env/config.lua b/spawners_env/config.lua index 1a2ba44..d103642 100644 --- a/spawners_env/config.lua +++ b/spawners_env/config.lua @@ -1,3 +1,21 @@ +--[[ + Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- * [name : string] - Name of the mob used in the mod. -- [egg_name_custom : string] - Custom name for the egg item. If empty default name will be used i.e. 'mobs:chicken'. @@ -10,230 +28,231 @@ -- * [dummy_texture : table] - Textures used for the mob. --- * [night_only : boolean : string] - If true mobs will spawn "only" during the night or in dark areas, default:true. Writing "disable" will disable light check and it will spawn in both states (night and day) +-- * [night_only : boolean : string] - If true mobs will spawn 'only' during the night or in dark areas, default:true. Writing 'disable' will disable light check and it will spawn in both states (night and day) -- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'. -- [*] -> MANDATORY - has to be filled in! -- mods what should be enabled and loded, remove/add the one you want to load -ENABLED_MODS = {"mobs", "creatures"} +spawners_env.ENABLED_MODS = { 'mobs', 'creatures' } -- mobs properties - setup all you mobs here -MOBS_PROPS = { +spawners_env.MOBS_PROPS = { - ["mobs"] = { -- MOBS REDO CONFIG - { - name = "sheep_white", - egg_name_custom = "", - dummy_size = {x = 0.52, y = 0.52}, - dummy_offset = 0.2, - dummy_mesh = "mobs_sheep.b3d", - dummy_texture = {"mobs_sheep_wool.png^mobs_sheep_base.png"}, - night_only = false, - sound_custom = "mobs_sheep" - }, - { - name = "cow", - egg_name_custom = "", - dummy_size = {x = 0.3, y = 0.3}, - dummy_offset = -0.3, - dummy_mesh = "mobs_cow.x", - dummy_texture = {"mobs_cow.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "chicken", - egg_name_custom = "", - dummy_size = {x = 0.9, y = 0.9}, - dummy_offset = 0.2, - dummy_mesh = "mobs_chicken.x", - dummy_texture = {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "pumba", - egg_name_custom = "", - dummy_size = {x = 0.62, y = 0.62}, - dummy_offset = -0.3, - dummy_mesh = "mobs_pumba.x", - dummy_texture = {"mobs_pumba.png"}, - night_only = false, - sound_custom = "mobs_pig" - }, - -- { - -- name = "bunny", - -- egg_name_custom = "", - -- dummy_size = {x = 1, y = 1}, - -- dummy_offset = 0.2, - -- dummy_mesh = "mobs_bunny.b3d", - -- dummy_texture = {"mobs_bunny_brown.png"}, - -- night_only = false, - -- sound_custom = "spawners_mobs_bunny" - -- }, - -- { - -- name = "kitten", - -- egg_name_custom = "", - -- dummy_size = {x = 0.32, y = 0.32}, - -- dummy_offset = 0, - -- dummy_mesh = "mobs_kitten.b3d", - -- dummy_texture = {"mobs_kitten_ginger.png"}, - -- night_only = false, - -- sound_custom = "" - -- }, - { - name = "spider", - egg_name_custom = "", - dummy_size = {x = 2, y = 2}, - dummy_offset = -0.2, - dummy_mesh = "mobs_spider.x", - dummy_texture = {"mobs_spider.png"}, - night_only = true, - sound_custom = "", - env = true, - sound_custom = "mobs_spider_neutral" - }, - { - name = "stone_monster", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0.05, - dummy_mesh = "mobs_stone_monster.b3d", - dummy_texture = {"mobs_stone_monster.png"}, - night_only = true, - sound_custom = "mobs_stonemonster_neutral" - }, - { - name = "oerkki", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0.05, - dummy_mesh = "mobs_oerkki.b3d", - dummy_texture = {"mobs_oerkki.png"}, - night_only = true, - sound_custom = "" - }, - { - name = "tree_monster", - egg_name_custom = "", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = 0.05, - dummy_mesh = "mobs_tree_monster.b3d", - dummy_texture = {"mobs_tree_monster.png"}, - night_only = true, - sound_custom = "mobs_treemonster_neutral" - } - }, + ['mobs'] = { -- MOBS REDO CONFIG + { + name = 'sheep_white', + egg_name_custom = '', + dummy_size = { x = 0.52, y = 0.52 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_sheep.b3d', + dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' }, + night_only = false, + sound_custom = 'mobs_sheep' + }, + { + name = 'cow', + egg_name_custom = '', + dummy_size = { x = 0.3, y = 0.3 }, + dummy_offset = -0.3, + dummy_mesh = 'mobs_cow.x', + dummy_texture = { 'mobs_cow.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'chicken', + egg_name_custom = '', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_chicken.x', + dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'pumba', + egg_name_custom = '', + dummy_size = { x = 0.62, y = 0.62 }, + dummy_offset = -0.3, + dummy_mesh = 'mobs_pumba.x', + dummy_texture = { 'mobs_pumba.png' }, + night_only = false, + sound_custom = 'mobs_pig' + }, + -- { + -- name = 'bunny', + -- egg_name_custom = '', + -- dummy_size = { x = 1, y = 1}, + -- dummy_offset = 0.2, + -- dummy_mesh = 'mobs_bunny.b3d', + -- dummy_texture = { 'mobs_bunny_brown.png' }, + -- night_only = false, + -- sound_custom = 'spawners_mobs_bunny' + -- }, + -- { + -- name = 'kitten', + -- egg_name_custom = '', + -- dummy_size = { x = 0.32, y = 0.32}, + -- dummy_offset = 0, + -- dummy_mesh = 'mobs_kitten.b3d', + -- dummy_texture = { 'mobs_kitten_ginger.png' }, + -- night_only = false, + -- sound_custom = '' + -- }, + { + name = 'spider', + egg_name_custom = '', + dummy_size = { x = 2, y = 2 }, + dummy_offset = -0.2, + dummy_mesh = 'mobs_spider.x', + dummy_texture = { 'mobs_spider.png' }, + night_only = true, + env = true, + sound_custom = 'mobs_spider_neutral' + }, + { + name = 'stone_monster', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_stone_monster.b3d', + dummy_texture = { 'mobs_stone_monster.png' }, + night_only = true, + sound_custom = 'mobs_stonemonster_neutral' + }, + { + name = 'oerkki', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_oerkki.b3d', + dummy_texture = { 'mobs_oerkki.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'tree_monster', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_tree_monster.b3d', + dummy_texture = { 'mobs_tree_monster.png' }, + night_only = true, + sound_custom = 'mobs_treemonster_neutral' + } + }, - ["creatures"] = { -- CREATURES MOD CONFIG - { - name = "chicken", - egg_name_custom = "creatures:chicken_spawn_egg", - dummy_size = {x = 0.9, y = 0.9}, - dummy_offset = -0.3, - dummy_mesh = "creatures_chicken.b3d", - dummy_texture = {"creatures_chicken.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "ghost", - egg_name_custom = "creatures:ghost_spawn_egg", - dummy_size = {x = 0.7, y = 0.7}, - dummy_offset = -0.5, - dummy_mesh = "creatures_ghost.b3d", - dummy_texture = {"creatures_ghost.png"}, - night_only = true, - sound_custom = "" - }, - { - name = "sheep", - egg_name_custom = "creatures:sheep_spawn_egg", - dummy_size = {x = 0.6, y = 0.6}, - dummy_offset = -0.3, - dummy_mesh = "creatures_sheep.b3d", - dummy_texture = {"creatures_sheep.png^creatures_sheep_white.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "zombie", - egg_name_custom = "creatures:zombie_spawn_egg", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = -0.5, - dummy_mesh = "creatures_zombie.b3d", - dummy_texture = {"creatures_zombie.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "oerrki", - egg_name_custom = "creatures:oerrki_spawn_egg", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = -0.5, - dummy_mesh = "creatures_oerrki.b3d", - dummy_texture = {"creatures_oerrki.png"}, - night_only = false, - sound_custom = "creatures_oerrki_idle" - } - } + ['creatures'] = { -- CREATURES MOD CONFIG + { + name = 'chicken', + egg_name_custom = 'creatures:chicken_spawn_egg', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_chicken.b3d', + dummy_texture = { 'creatures_chicken.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'ghost', + egg_name_custom = 'creatures:ghost_spawn_egg', + dummy_size = { x = 0.7, y = 0.7 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_ghost.b3d', + dummy_texture = { 'creatures_ghost.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'sheep', + egg_name_custom = 'creatures:sheep_spawn_egg', + dummy_size = { x = 0.6, y = 0.6 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_sheep.b3d', + dummy_texture = { 'creatures_sheep.png^creatures_sheep_white.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'zombie', + egg_name_custom = 'creatures:zombie_spawn_egg', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_zombie.b3d', + dummy_texture = { 'creatures_zombie.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'oerrki', + egg_name_custom = 'creatures:oerrki_spawn_egg', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_oerrki.b3d', + dummy_texture = { 'creatures_oerrki.png' }, + night_only = false, + sound_custom = 'creatures_oerrki_idle' + } + } } --- +-- -- check for 3rd party dependencies --- +-- -- include mummy mobs redo addon (spawner) -if minetest.get_modpath("mobs") ~= nil then - -- enable spawner - table.insert(ENABLED_MODS, "spawners_mobs") +if minetest.get_modpath('mobs') ~= nil then + -- enable spawner + table.insert(spawners_env.ENABLED_MODS, 'spawners_mobs') - -- configure spawner - MOBS_PROPS["spawners_mobs"] = { - { - name = "mummy", - egg_name_custom = "", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_mummy.b3d", - dummy_texture = {"spawners_mobs_mummy.png"}, - night_only = true, - sound_custom = "spawners_mobs_mummy_neutral" - }, - { - name = "bunny_evil", - egg_name_custom = "", - dummy_size = {x = 1, y = 1}, - dummy_offset = 0.2, - dummy_mesh = "spawners_mobs_evil_bunny.b3d", - dummy_texture = {"spawners_mobs_evil_bunny.png"}, - night_only = true, - sound_custom = "spawners_mobs_bunny" - }, - { - name = "uruk_hai", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_character.b3d", - dummy_texture = {"spawners_mobs_uruk_hai.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - night_only = true, - sound_custom = "spawners_mobs_uruk_hai_neutral", - env = true - }, - { - name = "balrog", - egg_name_custom = "", - dummy_size = {x = 0.2, y = 0.2}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_balrog.b3d", - dummy_texture = {"spawners_mobs_balrog.png"}, - night_only = "disable", - sound_custom = "spawners_mobs_balrog_neutral", - env = true, - boss = true - } - } -end \ No newline at end of file + -- configure spawner + spawners_env.MOBS_PROPS['spawners_mobs'] = { + { + name = 'mummy', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_mummy.b3d', + dummy_texture = { 'spawners_mobs_mummy.png' }, + night_only = true, + sound_custom = 'spawners_mobs_mummy_neutral' + }, + { + name = 'bunny_evil', + egg_name_custom = '', + dummy_size = { x = 1, y = 1 }, + dummy_offset = 0.2, + dummy_mesh = 'spawners_mobs_evil_bunny.b3d', + dummy_texture = { 'spawners_mobs_evil_bunny.png' }, + night_only = true, + sound_custom = 'spawners_mobs_bunny' + }, + { + name = 'uruk_hai', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_character.b3d', + dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png', 'spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + night_only = true, + sound_custom = 'spawners_mobs_uruk_hai_neutral', + env = true + }, + { + name = 'balrog', + egg_name_custom = '', + dummy_size = { x = 0.2, y = 0.2 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_balrog.b3d', + dummy_texture = { 'spawners_mobs_balrog.png' }, + night_only = 'disable', + sound_custom = 'spawners_mobs_balrog_neutral', + env = true, + boss = true + } + } +end + +spawners_env.register_spawners() diff --git a/spawners_env/depends.txt b/spawners_env/depends.txt deleted file mode 100644 index 4ad96d5..0000000 --- a/spawners_env/depends.txt +++ /dev/null @@ -1 +0,0 @@ -default diff --git a/spawners_env/init.lua b/spawners_env/init.lua index ba238c5..0d5b969 100644 --- a/spawners_env/init.lua +++ b/spawners_env/init.lua @@ -1,13 +1,34 @@ -MOD_NAME = minetest.get_current_modname() +--[[ + Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). + Copyright (C) 2016 - 2023 SaKeL --- Spawners configurations -dofile(minetest.get_modpath(MOD_NAME).."/config.lua") + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + +local mod_start_time = minetest.get_us_time() +local path = minetest.get_modpath('spawners_env') -- API -dofile(minetest.get_modpath(MOD_NAME).."/api.lua") +dofile(path .. '/api.lua') + +-- Spawners configurations +dofile(path .. '/config.lua') -- Spawners for mobs -dofile(minetest.get_modpath(MOD_NAME).."/spawners_env.lua") -dofile(minetest.get_modpath(MOD_NAME).."/spawners_gen.lua") +dofile(path .. '/spawners_env.lua') +dofile(path .. '/spawners_gen.lua') -print ("[Mod] Spawners Environmental Loaded.") \ No newline at end of file +local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000 + +print('[Mod] Spawners Environmental Loaded. [' .. mod_end_time .. 's]') diff --git a/spawners_env/mod.conf b/spawners_env/mod.conf new file mode 100644 index 0000000..ff3dba6 --- /dev/null +++ b/spawners_env/mod.conf @@ -0,0 +1,6 @@ +name = spawners_env +description = Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). +depends = default, mobs +optional_depends = creatures +supported_games = +min_minetest_version = 5.4 diff --git a/spawners_env/settings.txt b/spawners_env/settings.txt deleted file mode 100644 index ee136cf..0000000 --- a/spawners_env/settings.txt +++ /dev/null @@ -1,3 +0,0 @@ -SPAWN_PYRAMIDS = false -SPAWNERS_GENERATE = true -CHESTS_GENERATE = false diff --git a/spawners_env/spawners_env.lua b/spawners_env/spawners_env.lua index 9943a58..893aaf3 100644 --- a/spawners_env/spawners_env.lua +++ b/spawners_env/spawners_env.lua @@ -1,170 +1,204 @@ +--[[ + Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- -- * CREATE ALL SPAWNERS NODES * -- function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom, env, boss) - -- - -- DUMMY INSIDE THE SPAWNER - -- + -- + -- DUMMY INSIDE THE SPAWNER + -- - local dummy_definition = { - hp_max = 1, - physical = true, - collisionbox = {0,0,0,0,0,0}, - visual = "mesh", - visual_size = size, - mesh = mesh, - textures = texture, - makes_footstep_sound = false, - timer = 0, - automatic_rotate = math.pi * -3, - m_name = "dummy" - } + local dummy_definition = { + hp_max = 1, + physical = true, + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = 'mesh', + visual_size = size, + mesh = mesh, + textures = texture, + makes_footstep_sound = false, + timer = 0, + automatic_rotate = math.pi * -3, + m_name = 'dummy' + } - dummy_definition.on_activate = function(self) - self.object:set_velocity({x=0, y=0, z=0}) - self.object:set_acceleration({x=0, y=0, z=0}) - self.object:set_armor_groups({immortal=1}) - end + dummy_definition.on_activate = function(self) + self.object:set_velocity({ x = 0, y = 0, z = 0 }) + self.object:set_acceleration({ x = 0, y = 0, z = 0 }) + self.object:set_armor_groups({ immortal = 1 }) + end - -- remove dummy after dug up the spawner - dummy_definition.on_step = function(self, dtime) - self.timer = self.timer + dtime - local n = minetest.get_node_or_nil(self.object:get_pos()) - if self.timer > 2 then - if n and n.name and n.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active" then - self.object:remove() - end - end - end + -- remove dummy after dug up the spawner + dummy_definition.on_step = function(self, dtime) + self.timer = self.timer + dtime + local n = minetest.get_node_or_nil(self.object:get_pos()) + if self.timer > 2 then + if n and n.name and n.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active' then + self.object:remove() + end + end + end - minetest.register_entity("spawners_env:dummy_"..mod_prefix.."_"..mob_name, dummy_definition) + minetest.register_entity('spawners_env:dummy_' .. mod_prefix .. '_' .. mob_name, dummy_definition) - -- - -- ACTIVE SPAWNER ENV - -- + -- + -- ACTIVE SPAWNER ENV + -- - minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active", { - description = mod_prefix.."_"..mob_name.." spawner active env", - paramtype = "light", - light_source = 4, - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - damage_per_second = 4, - sunlight_propagates = true, - tiles = { - { - name = "spawners_env_spawner_animated_16.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 2.0 - }, - } - }, - is_ground_content = true, - groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1}, - on_timer = function(pos, elapsed) - spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) - return false - end, - drop = { - max_items = 1, - items = { - {items = {"spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20} - } - }, - on_construct = function(pos) - pos.y = pos.y + offset - minetest.add_entity(pos,"spawners_env:dummy_"..mod_prefix.."_"..mob_name) - end, - }) + minetest.register_node('spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active', { + description = mod_prefix .. '_' .. mob_name .. ' spawner active env', + paramtype = 'light', + light_source = 4, + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + damage_per_second = 4, + sunlight_propagates = true, + tiles = { + { + name = 'spawners_env_spawner_animated_16.png', + animation = { + type = 'vertical_frames', + aspect_w = 16, + aspect_h = 16, + length = 2.0 + }, + } + }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2, + igniter = 1, + not_in_creative_inventory = 1 + }, + on_timer = function(pos, elapsed) + spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) + return false + end, + drop = { + max_items = 1, + items = { + { items = { 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner' }, rarity = 20 } + } + }, + on_construct = function(pos) + pos.y = pos.y + offset + minetest.add_entity(pos, 'spawners_env:dummy_' .. mod_prefix .. '_' .. mob_name) + end, + }) - -- - -- WAITING SPAWNER ENV - -- + -- + -- WAITING SPAWNER ENV + -- - -- waiting for light - everything is ok but too much light or not enough light - minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting", { - description = mod_prefix.."_"..mob_name.." spawner waiting env", - paramtype = "light", - light_source = 2, - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - sunlight_propagates = true, - tiles = { - { - name = "spawners_env_spawner_waiting_animated_16.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 2.0 - }, - } - }, - is_ground_content = true, - groups = {cracky=1,level=2,not_in_creative_inventory=1}, - on_timer = function(pos, elapsed) - spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) - return false - end, - drop = { - max_items = 1, - items = { - {items = {"spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20} - } - }, - }) + -- waiting for light - everything is ok but too much light or not enough light + minetest.register_node('spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting', { + description = mod_prefix .. '_' .. mob_name .. ' spawner waiting env', + paramtype = 'light', + light_source = 2, + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + sunlight_propagates = true, + tiles = { + { + name = 'spawners_env_spawner_waiting_animated_16.png', + animation = { + type = 'vertical_frames', + aspect_w = 16, + aspect_h = 16, + length = 2.0 + }, + } + }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2, + not_in_creative_inventory = 1 + }, + on_timer = function(pos, elapsed) + spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) + return false + end, + drop = { + max_items = 1, + items = { + { items = { 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner' }, rarity = 20 } + } + }, + }) - -- - -- INACTIVE SPAWNER (DEFAULT) ENV - -- + -- + -- INACTIVE SPAWNER (DEFAULT) ENV + -- - minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner", { - description = mod_prefix.."_"..mob_name.." spawner env", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - sunlight_propagates = true, - tiles = {"spawners_env_spawner_16.png"}, - is_ground_content = true, - groups = {cracky=1,level=2,not_in_creative_inventory=0}, - stack_max = 1, - drop = { - max_items = 1, - items = { - {items = {"spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20} - } - }, - on_construct = function(pos) - spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) - end, - }) + minetest.register_node('spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner', { + description = mod_prefix .. '_' .. mob_name .. ' spawner env', + paramtype = 'light', + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + sunlight_propagates = true, + tiles = { 'spawners_env_spawner_16.png' }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2, + not_in_creative_inventory = 0 + }, + stack_max = 1, + drop = { + max_items = 1, + items = { + { items = { 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner' }, rarity = 20 } + } + }, + on_construct = function(pos) + spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) + end, + }) - -- - -- * LBM * - -- + -- + -- * LBM * + -- - minetest.register_lbm({ - name = "spawners_env:check_for_spawning_timer", - nodenames = { - "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner", - "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active", - "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting" - }, - action = function(pos) - spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) - end - }) + minetest.register_lbm({ + name = 'spawners_env:check_for_spawning_timer', + nodenames = { + 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner', + 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active', + 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' + }, + action = function(pos) + spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) + end + }) end -- @@ -172,84 +206,84 @@ end -- function spawners_env.check_for_spawning_timer(pos, mob_name, night_only, mod_prefix, sound_custom, env, boss) - local random_pos, waiting = spawners_env.check_node_status(pos, mob_name, night_only, boss) + local random_pos = spawners_env.check_node_status(pos, mob_name, night_only, boss) - local node = minetest.get_node_or_nil(pos) + local node = minetest.get_node_or_nil(pos) - -- minetest.log("action", "[Mod][Spawners] checking for: "..mob_name.." at "..minetest.pos_to_string(pos)) + -- minetest.log('action', '[Mod][Spawners] checking for: ' .. mob_name .. ' at ' .. minetest.pos_to_string(pos)) - if random_pos then - -- print('try to spawn another mob at: '..minetest.pos_to_string(random_pos)) + if random_pos then + -- print('try to spawn another mob at: ' .. minetest.pos_to_string(random_pos)) - local mobs_counter_table = {} - local mobs_check_radius - local mobs_max - mobs_counter_table[mob_name] = 0 + local mobs_counter_table = {} + local mobs_check_radius + local mobs_max + mobs_counter_table[mob_name] = 0 - if boss then - mobs_max = 1 - mobs_check_radius = 35 - else - mobs_max = 3 - mobs_check_radius = 10 - end + if boss then + mobs_max = 1 + mobs_check_radius = 35 + else + mobs_max = 3 + mobs_check_radius = 10 + end - -- collect all spawned mobs around area - for _,obj in ipairs(minetest.get_objects_inside_radius(pos, mobs_check_radius)) do + -- collect all spawned mobs around area + for _, obj in ipairs(minetest.get_objects_inside_radius(pos, mobs_check_radius)) do - if obj:get_luaentity() ~= nil then + if obj:get_luaentity() ~= nil then - -- get entity name - local name_split = string.split(obj:get_luaentity().name, ":") + -- get entity name + local name_split = string.split(obj:get_luaentity().name, ':') - if name_split[2] == mob_name then + if name_split[2] == mob_name then - mobs_counter_table[mob_name]=mobs_counter_table[mob_name]+1 + mobs_counter_table[mob_name] = mobs_counter_table[mob_name] + 1 - end + end - end + end - end + end - -- print(mob_name.." : "..mobs_counter_table[mob_name]) + -- print(mob_name .. ' : ' .. mobs_counter_table[mob_name]) - -- enough place to spawn more mobs - if mobs_counter_table[mob_name] < mobs_max then - -- make sure the right node status is shown - if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active" then - minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active"}) - end + -- enough place to spawn more mobs + if mobs_counter_table[mob_name] < mobs_max then + -- make sure the right node status is shown + if node.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active' then + minetest.set_node(pos, { name = 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active' }) + end - if boss then - -- color: deep orange - minetest.chat_send_all(minetest.colorize("#FF5722", "Balrog has spawned to this World!")) - end + if boss then + -- color: deep orange + minetest.chat_send_all(minetest.colorize('#FF5722', 'Balrog has spawned to this World!')) + end - spawners_env.start_spawning(random_pos, 1, "spawners_env:"..mob_name, mod_prefix, sound_custom) - else - -- print("too many mobs: waiting") - -- waiting status - if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting" then - minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting"}) - end - end + spawners_env.start_spawning(random_pos, 1, 'spawners_env:' .. mob_name, mod_prefix, sound_custom) + else + -- print('too many mobs: waiting') + -- waiting status + if node.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' then + minetest.set_node(pos, { name = 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' }) + end + end - else - -- print("no random_pos found: waiting") - -- waiting status - if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting" then - minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting"}) - end - end - -- 6 hours = 21600 seconds - -- 4 hours = 14400 seconds - -- 1 hour = 3600 seconds - if boss then - minetest.get_node_timer(pos):start(3600) - else - minetest.get_node_timer(pos):start(math.random(5, 15)) - end + else + -- print('no random_pos found: waiting') + -- waiting status + if node.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' then + minetest.set_node(pos, { name = 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' }) + end + end + -- 6 hours = 21600 seconds + -- 4 hours = 14400 seconds + -- 1 hour = 3600 seconds + if boss then + minetest.get_node_timer(pos):start(3600) + else + minetest.get_node_timer(pos):start(math.random(5, 15)) + end end -- @@ -257,8 +291,8 @@ end -- for i, mob_table in ipairs(spawners_env.mob_tables) do - if mob_table then + if mob_table then - spawners_env.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom, mob_table.env, mob_table.boss) - end -end \ No newline at end of file + spawners_env.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom, mob_table.env, mob_table.boss) + end +end diff --git a/spawners_env/spawners_gen.lua b/spawners_env/spawners_gen.lua index e9a47c5..d232e74 100644 --- a/spawners_env/spawners_gen.lua +++ b/spawners_env/spawners_gen.lua @@ -1,83 +1,70 @@ --- Place chests in dungeons and temples -local function place_chest(param) - local skip = math.random(0,1) +--[[ + Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons (Uruk Hai) and Temples (Spider). They are dropping a real mob spawner by change (very small chance). + Copyright (C) 2016 - 2023 SaKeL - -- skip chest - if skip == 1 then - return - end + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - local tab = param + This library 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 + Lesser General Public License for more details. - local pos = tab[math.random(1, (#tab or 4))] - pos.y = pos.y - 1 - - local n = minetest.get_node_or_nil(pos) - - if n and n.name ~= "air" then - pos.y = pos.y + 1 - - minetest.log("action", "[Mod][Spawners] Chest placed at: "..minetest.pos_to_string(pos)) - - minetest.set_node(pos, {name = "default:chest"}) - - spawners_env.fill_chest(pos) - end -end + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] -- Place spawners in dungeons local function place_spawner(param) - local skip = math.random(0,1) - - -- skip spawner - if skip == 1 then - return - end + local skip = math.random(0, 1) - local tab = param[1] - local gen_obj = param[2] + -- skip spawner + if skip == 1 then + return + end - local pos = tab[math.random(1, (#tab or 4))] - pos.y = pos.y - 1 - - local n = minetest.get_node_or_nil(pos) - local n2 = minetest.get_node_or_nil({x=pos.x, y=pos.y+1, z=pos.z}) + local tab = param[1] + local gen_obj = param[2] - if n and n.name ~= "air" then - pos.y = pos.y + 1 + local pos = tab[math.random(1, (#tab or 4))] + pos.y = pos.y - 1 - -- pos the same as chest, putting spawner above the chest - if n2 and n2.name == "default:chest" then - -- print("pos the same as chest, putting spawner above the chest") - pos.y = pos.y + 1 - end + local n = minetest.get_node_or_nil(pos) + local n2 = minetest.get_node_or_nil({ x = pos.x, y = pos.y + 1, z = pos.z }) - if gen_obj == "dungeon" then - minetest.log("action", "[Mod][Spawners] dungeon spawner placed at: "..minetest.pos_to_string(pos)) - - minetest.set_node(pos, {name = "spawners_env:spawners_mobs_uruk_hai_spawner"}) - else - minetest.log("action", "[Mod][Spawners] temple spawner placed at: "..minetest.pos_to_string(pos)) - - minetest.set_node(pos, {name = "spawners_env:mobs_spider_spawner"}) - end + if n and n.name ~= 'air' then + pos.y = pos.y + 1 - end + -- pos the same as chest, putting spawner above the chest + if n2 and n2.name == 'default:chest' then + -- print('pos the same as chest, putting spawner above the chest') + pos.y = pos.y + 1 + end + + if gen_obj == 'dungeon' then + minetest.set_node(pos, { name = 'spawners_env:spawners_mobs_uruk_hai_spawner' }) + minetest.log('action', '[Spawners] dungeon spawner placed at: ' .. minetest.pos_to_string(pos)) + else + minetest.set_node(pos, { name = 'spawners_env:spawners_mobs_uruk_hai_spawner' }) + minetest.log('action', '[Spawners] temple spawner placed at: ' .. minetest.pos_to_string(pos)) + end + + end end -minetest.set_gen_notify("dungeon") -minetest.set_gen_notify("temple") +minetest.set_gen_notify('dungeon') +minetest.set_gen_notify('temple') minetest.register_on_generated(function(minp, maxp, blockseed) - local notify = minetest.get_mapgen_object("gennotify") - - if notify and notify.dungeon then - minetest.after(2, place_chest, table.copy(notify.dungeon)) - minetest.after(3, place_spawner, {table.copy(notify.dungeon), "dungeon"}) - end + local notify = minetest.get_mapgen_object('gennotify') - if notify and notify.temple then - minetest.after(2, place_chest, table.copy(notify.temple)) - minetest.after(3, place_spawner, {table.copy(notify.temple), "temple"}) - end -end) \ No newline at end of file + if notify and notify.dungeon then + minetest.after(3, place_spawner, { table.copy(notify.dungeon), 'dungeon' }) + end + + if notify and notify.temple then + minetest.after(3, place_spawner, { table.copy(notify.temple), 'temple' }) + end +end) diff --git a/spawners_env/textures/spawners_env_spawner.png b/spawners_env/textures/spawners_env_spawner.png index 331b2ba..098d349 100644 Binary files a/spawners_env/textures/spawners_env_spawner.png and b/spawners_env/textures/spawners_env_spawner.png differ diff --git a/spawners_env/textures/spawners_env_spawner_16.png b/spawners_env/textures/spawners_env_spawner_16.png index 020c500..6b4aec4 100644 Binary files a/spawners_env/textures/spawners_env_spawner_16.png and b/spawners_env/textures/spawners_env_spawner_16.png differ diff --git a/spawners_env/textures/spawners_env_spawner_animated.png b/spawners_env/textures/spawners_env_spawner_animated.png index fc3adad..542b81d 100644 Binary files a/spawners_env/textures/spawners_env_spawner_animated.png and b/spawners_env/textures/spawners_env_spawner_animated.png differ diff --git a/spawners_env/textures/spawners_env_spawner_animated_16.png b/spawners_env/textures/spawners_env_spawner_animated_16.png index d948d69..c9dffb8 100644 Binary files a/spawners_env/textures/spawners_env_spawner_animated_16.png and b/spawners_env/textures/spawners_env_spawner_animated_16.png differ diff --git a/spawners_env/textures/spawners_env_spawner_waiting_animated.png b/spawners_env/textures/spawners_env_spawner_waiting_animated.png index 1297b3d..ae3b2ab 100644 Binary files a/spawners_env/textures/spawners_env_spawner_waiting_animated.png and b/spawners_env/textures/spawners_env_spawner_waiting_animated.png differ diff --git a/spawners_env/textures/spawners_env_spawner_waiting_animated_16.png b/spawners_env/textures/spawners_env_spawner_waiting_animated_16.png index 7f90818..fb3eeac 100644 Binary files a/spawners_env/textures/spawners_env_spawner_waiting_animated_16.png and b/spawners_env/textures/spawners_env_spawner_waiting_animated_16.png differ diff --git a/spawners_mobs/LICENSE.txt b/spawners_mobs/LICENSE.txt new file mode 100644 index 0000000..cd27df2 --- /dev/null +++ b/spawners_mobs/LICENSE.txt @@ -0,0 +1,567 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 2016 - 2023 SaKeL + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. 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 not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the 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 +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### Code + +GNU Lesser General Public License v2.1 or later (see included LICENSE file) + +### Textures + +**CC-BY-SA-4.0, by SaKeL** + +- spawners_mobs_black_skull.png +- spawners_mobs_evil_bunny_egg.png +- spawners_mobs_galvornsword.png +- spawners_mobs_spawner_16.png +- spawners_mobs_spawner_animated.png +- spawners_mobs_spawner_rusty.png +- spawners_mobs_spawner_waiting_animated_16.png +- spawners_mobs_spawner_waiting_animated.png +- spawners_mobs_spawner.png +- spawners_mobs_trans.png + +**CC-BY-SA-4.0, Pixel Perfection by XSSheep**, https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated + +- spawners_mobs_firebolt.png +- spawners_mobs_flame_particle_2.png +- spawners_mobs_flame_particle.png +- spawners_mobs_smoke_particle_2.png +- spawners_mobs_smoke_particle.png + +**WTFPL, by BlockMen** + +- spawners_mobs_sandstone_carved_bird.png +- spawners_mobs_mummy.png + +**CC-BY-SA-3.0, by bas080** + +- spawners_mobs_sandstone_carved_eye.png +- spawners_mobs_sandstone_carved_men.png +- spawners_mobs_sandstone_carved_sun.png + +**CC-BY-SA-3.0, by STHGOM** + +- spawners_mobs_balrog.png + +**CC-BY-SA-4.0, by fishyWET** + +- spawners_mobs_uruk_hai_1.png +- spawners_mobs_uruk_hai_2.png +- spawners_mobs_uruk_hai_3.png +- spawners_mobs_uruk_hai_egg.png +- spawners_mobs_uruk_hai.png + +**CC0-1.0, by ExeterDad** + +- spawners_mobs_evil_bunny.png + +### Sounds + +**CC-BY-4.0, by efectirijillo**, https://freesound.org/people/efectirijillo/sounds/241979/ + +- spawners_mobs_mummy_hit.1.ogg +- spawners_mobs_mummy_hit.2.ogg +- spawners_mobs_mummy_hit.3.ogg + +**CC0-1.0, by SnowFightStudios**, https://freesound.org/people/SnowFightStudios/sounds/669797/ + +- spawners_mobs_mummy_spell.3.ogg +- spawners_mobs_mummy_spell.2.ogg +- spawners_mobs_mummy_spell.1.ogg + +**CC0-1.0, by SnowFightStudios**, https://freesound.org/people/SnowFightStudios/sounds/683281/ + +- spawners_mobs_mummy_neutral.3.ogg +- spawners_mobs_mummy_neutral.2.ogg +- spawners_mobs_mummy_neutral.1.ogg + +**CC0-1.0, by SnowFightStudios**, https://freesound.org/people/SnowFightStudios/sounds/643684/ + +- spawners_mobs_mummy_death.3.ogg +- spawners_mobs_mummy_death.2.ogg +- spawners_mobs_mummy_death.1.ogg +- spawners_mobs_mummy_attack.3.ogg +- spawners_mobs_mummy_attack.2.ogg +- spawners_mobs_mummy_attack.1.ogg + +**CC-BY-4.0, by EminYILDIRIM**, https://freesound.org/people/EminYILDIRIM/sounds/547565/ + +- spawners_mobs_teleport.1.ogg +- spawners_mobs_teleport.2.ogg + +**CC-BY-4.0, by dobroide**, https://freesound.org/people/dobroide/sounds/84141/ + +- spawners_mobs_bunny.ogg + +### Models + +**Original model by MirceaKitsune (CC BY-SA 3.0).** +**Various alterations and fixes by kilbith, sofar, xunto, Rogier-5, TeTpaAka, Desour,** +**stujones11, An0n3m0us (CC BY-SA 3.0):** + +- spawners_mobs_character.b3d + +**WTFPL, by BlockMen** + +- spawners_mobs_mummy.b3d + +**CC0-1.0, by ExeterDad** + +- spawners_mobs_evil_bunny.b3d + +**CC-BY-SA-3.0, by STHGOM** + +- spawners_mobs_balrog.b3d diff --git a/spawners_mobs/api.lua b/spawners_mobs/api.lua index f8ff7ed..6414a3c 100644 --- a/spawners_mobs/api.lua +++ b/spawners_mobs/api.lua @@ -1,127 +1,149 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- main tables -spawners_mobs = {} +spawners_mobs = { + ENABLED_MODS = {}, + MOBS_PROPS = {} +} spawners_mobs.mob_tables = {} -local max_obj_per_mapblock = tonumber(minetest.settings:get("max_objects_per_block")) -local enable_particles = minetest.settings:get_bool("enable_particles") -local tick_max = 40 -local tick_short_max = 40 +local max_obj_per_mapblock = tonumber(minetest.settings:get('max_objects_per_block')) +local enable_particles = minetest.settings:get_bool('enable_particles') +local tick_max = 30 +local tick_short_max = 20 -- check if mods exists and build tables -for k, mob_mod in ipairs(ENABLED_MODS) do - local modpath = minetest.get_modpath(mob_mod) - -- list of mobs and their info - if (modpath) then - for j, mob in ipairs(MOBS_PROPS[mob_mod]) do - local mob_egg = nil +for k, mob_mod in ipairs(spawners_mobs.ENABLED_MODS) do + local modpath = minetest.get_modpath(mob_mod) + -- list of mobs and their info + if (modpath) then + for j, mob in ipairs(spawners_mobs.MOBS_PROPS[mob_mod]) do + local mob_egg - -- disabled extra check for mobs redo due to incompatibility with Lua 5.1, this method is available from Lua 5.2 - -- if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end + -- disabled extra check for mobs redo due to incompatibility with Lua 5.1, this method is available from Lua 5.2 + -- if mob_mod == 'mobs' and not (mobs.mod == 'redo') then goto continue end - table.insert(spawners_mobs.mob_tables, - { - name = mob.name, - mod_prefix = mob_mod, - egg_name_custom = mob.egg_name_custom, - dummy_size = mob.dummy_size, - dummy_offset = mob.dummy_offset, - dummy_mesh = mob.dummy_mesh, - dummy_texture = mob.dummy_texture, - night_only = mob.night_only, - sound_custom = mob.sound_custom - } - ) - -- use custom egg or create a default egg - if mob.egg_name_custom ~= "" then - mob_egg = mob.egg_name_custom - else - mob_egg = mob_mod..":"..mob.name - end + table.insert(spawners_mobs.mob_tables, + { + name = mob.name, + mod_prefix = mob_mod, + egg_name_custom = mob.egg_name_custom, + dummy_size = mob.dummy_size, + dummy_offset = mob.dummy_offset, + dummy_mesh = mob.dummy_mesh, + dummy_texture = mob.dummy_texture, + night_only = mob.night_only, + sound_custom = mob.sound_custom + } + ) + -- use custom egg or create a default egg + if mob.egg_name_custom ~= '' then + mob_egg = mob.egg_name_custom + else + mob_egg = mob_mod .. ':' .. mob.name + end - -- recipes - minetest.register_craft({ - output = "spawners_mobs:"..mob_mod.."_"..mob.name.."_spawner", - recipe = { - {"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"}, - {"xpanes:bar_flat", mob_egg, "xpanes:bar_flat"}, - {"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"}, - } - }) + -- recipes + minetest.register_craft({ + output = 'spawners_mobs:' .. mob_mod .. '_' .. mob.name .. '_spawner', + recipe = { + { 'default:diamondblock', 'fire:flint_and_steel', 'default:diamondblock' }, + { 'xpanes:bar_flat', mob_egg, 'xpanes:bar_flat' }, + { 'default:diamondblock', 'xpanes:bar_flat', 'default:diamondblock' }, + } + }) - -- ::continue:: - end - end + -- Lua > 5.1 + -- ::continue:: + end + end end -- -- Particles -- function spawners_mobs.cloud_booom(pos) - if not enable_particles then return end + if not enable_particles then return end - minetest.add_particlespawner({ - amount = 5, - time = 2, - minpos = vector.subtract({x=pos.x-0.3, y=pos.y, z=pos.z-0.3}, 0.3), - maxpos = vector.add({x=pos.x+0.3, y=pos.y, z=pos.z+0.3}, 0.3), - minvel = {x=0.1, y=0.1, z=0.1}, - maxvel = {x=0.2, y=0.2, z=0.2}, - minacc = vector.new({x=-0.1, y=0.3, z=-0.1}), - maxacc = vector.new({x=0.1, y=0.6, z=0.1}), - minexptime = 2, - maxexptime = 3, - minsize = 16, - maxsize = 24, - texture = "spawners_mobs_smoke_particle_2.png", - animation = { - type = "vertical_frames", - -- Width of a frame in pixels - aspect_w = 16, - -- Height of a frame in pixels - aspect_h = 16, - -- Full loop length - length = 2.0, - }, - }) + minetest.add_particlespawner({ + amount = 5, + time = 2, + minpos = vector.subtract({ x = pos.x - 0.3, y = pos.y, z = pos.z - 0.3 }, 0.3), + maxpos = vector.add({ x= pos.x + 0.3, y = pos.y, z = pos.z + 0.3 }, 0.3), + minvel = { x = 0.1, y = 0.1, z = 0.1 }, + maxvel = { x = 0.2, y = 0.2, z = 0.2 }, + minacc = vector.new({ x = -0.1, y = 0.3, z = -0.1 }), + maxacc = vector.new({ x = 0.1, y = 0.6, z = 0.1 }), + minexptime = 2, + maxexptime = 3, + minsize = 16, + maxsize = 24, + texture = 'spawners_mobs_smoke_particle_2.png', + animation = { + type = 'vertical_frames', + -- Width of a frame in pixels + aspect_w = 16, + -- Height of a frame in pixels + aspect_h = 16, + -- Full loop length + length = 2.0, + }, + }) end function spawners_mobs.add_flame_effects(pos) - if not enable_particles then return end + if not enable_particles then return end - return minetest.add_particlespawner({ - amount = 6, - time = 0, - minpos = vector.subtract({x=pos.x-0.001, y=pos.y-0.001, z=pos.z-0.001}, 0.5), - maxpos = vector.add({x=pos.x+0.001, y=pos.y+0.001, z=pos.z+0.001}, 0.5), - minvel = {x=-0.1, y=-0.1, z=-0.1}, - maxvel = {x=0.1, y=0.1, z=0.1}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 1, - maxexptime = 5, - minsize = .5, - maxsize = 2.5, - texture = "spawners_mobs_flame_particle_2.png", - }) + return minetest.add_particlespawner({ + amount = 6, + time = 0, + minpos = vector.subtract({ x = pos.x - 0.001, y = pos.y - 0.001, z = pos.z - 0.001 }, 0.5), + maxpos = vector.add({ x = pos.x + 0.001, y = pos.y + 0.001, z = pos.z + 0.001 }, 0.5), + minvel = { x = -0.1, y = -0.1, z = -0.1 }, + maxvel = { x = 0.1, y = 0.1, z = 0.1 }, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 5, + minsize = 0.5, + maxsize = 2.5, + texture = 'spawners_mobs_flame_particle_2.png', + }) end function spawners_mobs.add_smoke_effects(pos) - if not enable_particles then return end + if not enable_particles then return end - return minetest.add_particlespawner({ - amount = 1, - time = 0, - minpos = vector.subtract({x=pos.x-0.001, y=pos.y-0.001, z=pos.z-0.001}, 0.5), - maxpos = vector.add({x=pos.x+0.001, y=pos.y+0.001, z=pos.z+0.001}, 0.5), - minvel = {x=-0.5, y=0.5, z=-0.5}, - maxvel = {x=0.5, y=1.5, z=0.5}, - minacc = vector.new({x=-0.1, y=0.1, z=-0.1}), - maxacc = vector.new({x=0.1, y=0.3, z=0.1}), - minexptime = .5, - maxexptime = 2, - minsize = .5, - maxsize = 2, - texture = "spawners_mobs_smoke_particle.png^[transform"..math.random(0,3), - }) + return minetest.add_particlespawner({ + amount = 1, + time = 0, + minpos = vector.subtract({ x = pos.x - 0.001, y = pos.y - 0.001, z = pos.z - 0.001 }, 0.5), + maxpos = vector.add({ x = pos.x + 0.001, y = pos.y + 0.001, z = pos.z + 0.001 }, 0.5), + minvel = { x = -0.5, y = 0.5, z = -0.5 }, + maxvel = { x = 0.5, y = 1.5, z = 0.5 }, + minacc = vector.new({ x = -0.1, y = 0.1, z = -0.1 }), + maxacc = vector.new({ x = 0.1, y = 0.3, z = 0.1 }), + minexptime = 0.5, + maxexptime = 2, + minsize = 0.5, + maxsize = 2, + texture = 'spawners_mobs_smoke_particle.png^[transform' .. math.random(0, 3), + }) end -- @@ -129,43 +151,44 @@ end -- -- how often node timers for spawners will tick, +/- some random value function spawners_mobs.tick(pos) - local meta = minetest.get_meta(pos) - local tick_counter = meta:get_int("tick") - local owner = meta:get_string("owner") - local privs = minetest.get_player_privs(owner); + local meta = minetest.get_meta(pos) + local tick_counter = meta:get_int('tick') + local owner = meta:get_string('owner') + local privs = minetest.get_player_privs(owner); - -- not for admin - if not privs.privs then - tick_counter = tick_counter + 1 - meta:set_int("tick", tick_counter) - end + -- not for admin + if not privs.privs then + tick_counter = tick_counter + 1 + meta:set_int('tick', tick_counter) + end - -- print("tick_counter: "..tick_counter.." at "..minetest.pos_to_string(pos)) + -- print('tick_counter: ' .. tick_counter .. ' at ' .. minetest.pos_to_string(pos)) - -- rusty spawner - if tick_counter >= tick_max then - spawners_mobs.set_status(pos, "rusty") - return - end - minetest.get_node_timer(pos):start(math.random(72, 193)) - -- minetest.get_node_timer(pos):start(math.random(20, 30)) + -- rusty spawner + if tick_counter >= tick_max then + spawners_mobs.set_status(pos, 'rusty') + return + end + + minetest.get_node_timer(pos):start(math.random(72, 193)) + -- minetest.get_node_timer(pos):start(math.random(20, 30)) end -- how often a spawn failure tick is retried (e.g. too dark) function spawners_mobs.tick_short(pos) - local meta = minetest.get_meta(pos) - local tick_short_counter = meta:get_int("tick_short") + local meta = minetest.get_meta(pos) + local tick_short_counter = meta:get_int('tick_short') - if tick_short_counter >= tick_short_max then - spawners_mobs.tick(pos) - return - else - tick_short_counter = tick_short_counter + 1 - meta:set_int("tick_short", tick_short_counter) - -- print("tick_short_counter: "..tick_short_counter.." at "..minetest.pos_to_string(pos)) - end - minetest.get_node_timer(pos):start(math.random(20, 60)) - -- minetest.get_node_timer(pos):start(math.random(10, 20)) + if tick_short_counter >= tick_short_max then + spawners_mobs.tick(pos) + return + else + tick_short_counter = tick_short_counter + 1 + meta:set_int('tick_short', tick_short_counter) + -- print('tick_short_counter: ' .. tick_short_counter .. ' at ' .. minetest.pos_to_string(pos)) + end + minetest.get_node_timer(pos):start(math.random(20, 60)) + -- minetest.get_node_timer(pos):start(math.random(10, 20)) end -- @@ -173,320 +196,322 @@ end -- -- start spawning mobs function spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefix, sound_custom) - if not (spawn_area_random_pos or how_many or mob_name) then return end + if not (spawn_area_random_pos or mob_name) then + return + end - local sound_name = mod_prefix.."_"..mob_name - -- use custom sounds - if sound_custom ~= "" then - sound_name = sound_custom - end + local sound_name = mod_prefix .. '_' .. mob_name + -- use custom sounds + if sound_custom ~= '' then + sound_name = sound_custom + end - -- use random colors for sheeps - if mob_name == "sheep_white" then - local sheep_colors = {"black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green", "grey", "magenta", "orange", "pink", "red", "violet", "white", "yellow"} - mob_name = "sheep_"..sheep_colors[math.random(#sheep_colors)] - end + -- use random colors for sheeps + if mob_name == 'sheep_white' then + local sheep_colors = { 'black', 'blue', 'brown', 'cyan', 'dark_green', 'dark_grey', 'green', 'grey', 'magenta', 'orange', 'pink', 'red', 'violet', 'white', 'yellow' } + mob_name = 'sheep_' .. sheep_colors[math.random(#sheep_colors)] + end - for i = 1, #spawn_area_random_pos do - -- spawn a bit more above the block - prevent spawning inside the block - spawn_area_random_pos[i].y = spawn_area_random_pos[i].y + 0.5 + for i = 1, #spawn_area_random_pos do + -- spawn a bit more above the block - prevent spawning inside the block + spawn_area_random_pos[i].y = spawn_area_random_pos[i].y + 0.5 - spawners_mobs.cloud_booom(spawn_area_random_pos[i]) + spawners_mobs.cloud_booom(spawn_area_random_pos[i]) - minetest.after(1, function() - -- minetest.set_node(spawn_area_random_pos[i], {name = "default:apple"}) - local obj = minetest.add_entity(spawn_area_random_pos[i], mod_prefix..":"..mob_name) - if obj then - if sound_name then - minetest.sound_play(sound_name, { - pos = spawn_area_random_pos[i], - max_hear_distance = 16, - gain = 0.5 - }) - end - end - end) - end + minetest.after(1, function() + -- minetest.set_node(spawn_area_random_pos[i], {name = 'default:apple' }) + local obj = minetest.add_entity(spawn_area_random_pos[i], mod_prefix .. ':' .. mob_name) + if obj then + if sound_name then + minetest.sound_play(sound_name, { + pos = spawn_area_random_pos[i], + max_hear_distance = 16, + gain = 0.5 + }) + end + end + end) + end end function spawners_mobs.on_timer(pos, elapsed) - local meta = minetest.get_meta(pos) - local idx = meta:get_int("idx") or nil - local mob_table = spawners_mobs.mob_tables[idx] or false + local meta = minetest.get_meta(pos) + local idx = meta:get_int('idx') or nil + local mob_table = spawners_mobs.mob_tables[idx] or false - if not mob_table then return end + if not mob_table then return end - local posmin = { x = pos.x - 3, y = pos.y - 1, z = pos.z - 3 } - local posmax = { x = pos.x + 4, y = pos.y + 1, z = pos.z + 4 } - local player_near = false - local entities_near = 0 - local entities_max = 6 - local node_light_min = 13 + local posmin = { x = pos.x - 3, y = pos.y - 1, z = pos.z - 3 } + local posmax = { x = pos.x + 4, y = pos.y + 1, z = pos.z + 4 } + local player_near = false + local entities_near = 0 + local entities_max = 6 + local node_light_min = 13 - local owner = meta:get_string("owner") or "" - local mod_prefix = mob_table.mod_prefix - local mob_name = mob_table.name - local sound_custom = mob_table.sound_custom - local night_only = mob_table.night_only - local max_objects = max_obj_per_mapblock / 4 + local owner = meta:get_string('owner') or '' + local mod_prefix = mob_table.mod_prefix + local mob_name = mob_table.name + local sound_custom = mob_table.sound_custom + local night_only = mob_table.night_only + local max_objects = max_obj_per_mapblock / 4 - -- check spawner light - local node_light = minetest.get_node_light(pos) + -- check spawner light + local node_light = minetest.get_node_light(pos) - -- dark - if (not node_light or node_light < node_light_min) and not night_only then - -- print("Too dark for mob ( "..mob_name.." ) to spawn. Waiting for day...") - spawners_mobs.set_status(pos, "waiting") + -- dark + if (not node_light or node_light < node_light_min) and not night_only then + -- print('Too dark for mob ( ' .. mob_name .. ' ) to spawn. Waiting for day .. .') + spawners_mobs.set_status(pos, 'waiting') - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nToo dark for mob to spawn. Waiting for day...") - spawners_mobs.tick_short(pos) - return + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nToo dark for mob to spawn. Waiting for day .. .') + spawners_mobs.tick_short(pos) + return - -- light - elseif node_light >= node_light_min and night_only then - -- print("Too much light for mob ( "..mob_name.." ) to spawn. Waiting for night...") - spawners_mobs.set_status(pos, "waiting") + elseif node_light >= node_light_min and night_only then + -- light + -- print('Too much light for mob ( ' .. mob_name .. ' ) to spawn. Waiting for night .. .') + spawners_mobs.set_status(pos, 'waiting') - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nToo much light for mob to spawn. Waiting for night...") - spawners_mobs.tick_short(pos) - return - end + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nToo much light for mob to spawn. Waiting for night .. .') + spawners_mobs.tick_short(pos) + return + end - -- positions where mobs can spawn - local spawn_area_pos = minetest.find_nodes_in_area(posmin, posmax, "air") + -- positions where mobs can spawn + local spawn_area_pos = minetest.find_nodes_in_area(posmin, posmax, 'air') - -- check if there is enough place to spawn mob - if #spawn_area_pos < 1 then - spawners_mobs.set_status(pos, "waiting") + -- check if there is enough place to spawn mob + if #spawn_area_pos < 1 then + spawners_mobs.set_status(pos, 'waiting') - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nNot enough place to spawn mob. Find more space!") - spawners_mobs.tick(pos) - return - end + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nNot enough place to spawn mob. Find more space!') + spawners_mobs.tick(pos) + return + end - -- spawn 2 mobs on 2 different positions by chance - local how_many = math.random(2) - local spawn_area_random_pos = {} + -- spawn 2 mobs on 2 different positions by chance + local how_many = math.random(2) + local spawn_area_random_pos = {} - -- get random spawn position from spawn area - for i = 1, how_many do - while #spawn_area_random_pos < how_many and #spawn_area_pos > 0 do + -- get random spawn position from spawn area + for i = 1, how_many do + while #spawn_area_random_pos < how_many and #spawn_area_pos > 0 do - local random_pos = spawn_area_pos[math.random(#spawn_area_pos)] - local random_pos_above = minetest.get_node({ x = random_pos.x, y = random_pos.y + 1, z = random_pos.z }).name + local random_pos = spawn_area_pos[math.random(#spawn_area_pos)] + local random_pos_above = minetest.get_node({ x = random_pos.x, y = random_pos.y + 1, z = random_pos.z }).name - if random_pos_above == "air" and not minetest.is_protected(random_pos, owner) then - table.insert(spawn_area_random_pos, random_pos) - -- print("spawn_area_random_pos: "..#spawn_area_random_pos) - else - table.remove(spawn_area_pos, i) - -- print("spawn_area_pos: "..#spawn_area_pos) - end + if random_pos_above == 'air' and not minetest.is_protected(random_pos, owner) then + table.insert(spawn_area_random_pos, random_pos) + -- print('spawn_area_random_pos: ' .. #spawn_area_random_pos) + else + table.remove(spawn_area_pos, i) + -- print('spawn_area_pos: ' .. #spawn_area_pos) + end - end - end + end + end - -- print(dump(spawn_area_random_pos)) + -- print(dump(spawn_area_random_pos)) - -- check if there is still enough place to spawn mob - if #spawn_area_random_pos < 1 then - spawners_mobs.set_status(pos, "waiting") + -- check if there is still enough place to spawn mob + if #spawn_area_random_pos < 1 then + spawners_mobs.set_status(pos, 'waiting') - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nNot enough place to spawn mob. Searching for new location...") - spawners_mobs.tick_short(pos) - return - end + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nNot enough place to spawn mob. Searching for new location .. .') + spawners_mobs.tick_short(pos) + return + end - -- area where player and entity count will be detected - local activation_area = minetest.get_objects_inside_radius(pos, 16) + -- area where player and entity count will be detected + local activation_area = minetest.get_objects_inside_radius(pos, 16) - -- prevent object clutter on the map - if #activation_area > max_objects then - spawners_mobs.set_status(pos, "waiting") + -- prevent object clutter on the map + if #activation_area > max_objects then + spawners_mobs.set_status(pos, 'waiting') - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nToo many objects in the area ("..#activation_area.."/"..max_objects.."), clean-up dropped objects first!") - spawners_mobs.tick_short(pos) - return - end + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nToo many objects in the area (' .. #activation_area .. '/' .. max_objects .. '), clean-up dropped objects first!') + spawners_mobs.tick_short(pos) + return + end - for k, object in ipairs(activation_area) do - -- find player inside activation area - if object:is_player() then - player_near = true - -- print("found player: "..object:get_player_name()) - end + for k, object in ipairs(activation_area) do + -- find player inside activation area + if object:is_player() then + player_near = true + -- print('found player: ' .. object:get_player_name()) + end - -- find entities inside activation area - if not object:is_player() and - object:get_luaentity() and - object:get_luaentity().name ~= "__builtin:item" then - local tmp_mob_name = string.split(object:get_luaentity().name, ":")[2] + -- find entities inside activation area + if not object:is_player() + and object:get_luaentity() + and object:get_luaentity().name ~= '__builtin:item' + then + local tmp_mob_name = string.split(object:get_luaentity().name, ':')[2] - if tmp_mob_name ~= nil then - -- sheeps have colors in names - if string.find(tmp_mob_name, "sheep") and string.find(mob_name, "sheep") and not string.find(tmp_mob_name, "dummy") then - -- print("found entity: "..tmp_mob_name) - entities_near = entities_near + 1 + if tmp_mob_name ~= nil then + -- sheeps have colors in names + if string.find(tmp_mob_name, 'sheep') and string.find(mob_name, 'sheep') and not string.find(tmp_mob_name, 'dummy') then + -- print('found entity: ' .. tmp_mob_name) + entities_near = entities_near + 1 - elseif tmp_mob_name == mob_name then - -- print("found entity: "..tmp_mob_name) - entities_near = entities_near + 1 - end - else - minetest.log("warning", "[spawners_mobs] tmp_mob_name was nil, luaentity name was: "..object:get_luaentity().name.." at: "..minetest.pos_to_string(object:get_pos())) - end - end + elseif tmp_mob_name == mob_name then + -- print('found entity: ' .. tmp_mob_name) + entities_near = entities_near + 1 + end + else + minetest.log('warning', '[spawners_mobs] tmp_mob_name was nil, luaentity name was: ' .. object:get_luaentity().name .. ' at: ' .. minetest.pos_to_string(object:get_pos())) + end + end - -- stop looping when met all conditions - if entities_near >= entities_max and player_near then - -- print("max entities reached "..entities_max.." and player_near found, breaking..") - break - end - end + -- stop looping when met all conditions + if entities_near >= entities_max and player_near then + -- print('max entities reached ' .. entities_max .. ' and player_near found, breaking .. ') + break + end + end - -- don't do anything and try again later when player not near or max entities reached - if entities_near >= entities_max or not player_near then - spawners_mobs.set_status(pos, "waiting") + -- don't do anything and try again later when player not near or max entities reached + if entities_near >= entities_max or not player_near then + spawners_mobs.set_status(pos, 'waiting') - -- sheeps have color in the name - local name = mob_name - if string.find(mob_name, "sheep") then - name = "sheep" - end + -- sheeps have color in the name + -- local name = mob_name + -- if string.find(mob_name, 'sheep') then + -- name = 'sheep' + -- end - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nmax mobs reached: "..entities_near.."/"..entities_max) -- or player not near - spawners_mobs.tick_short(pos) - return - end + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nmax mobs reached: ' .. entities_near .. '/' .. entities_max) -- or player not near + spawners_mobs.tick_short(pos) + return + end - -- start spawning - spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefix, sound_custom) + -- start spawning + spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefix, sound_custom) - spawners_mobs.set_status(pos, "active") - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nspawner is active reached: "..entities_near.."/"..entities_max) + spawners_mobs.set_status(pos, 'active') + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nspawner is active reached: ' .. entities_near .. '/' .. entities_max) - meta:set_int("tick", 0) - meta:set_int("tick_short", 0) + meta:set_int('tick', 0) + meta:set_int('tick_short', 0) - spawners_mobs.tick(pos) + spawners_mobs.tick(pos) end -- -- Status Manager -- function spawners_mobs.set_status(pos, set_status) - local meta = minetest.get_meta(pos) - local idx = meta:get_int("idx") - local mob_table = spawners_mobs.mob_tables[idx] or false + local meta = minetest.get_meta(pos) + local idx = meta:get_int('idx') + local mob_table = spawners_mobs.mob_tables[idx] or false - if not mob_table then return end + if not mob_table then return end - local mod_prefix = mob_table.mod_prefix - local mob_name = mob_table.name - local offset = mob_table.dummy_offset + local mod_prefix = mob_table.mod_prefix + local mob_name = mob_table.name + local offset = mob_table.dummy_offset - -- get meta - local owner = meta:get_string("owner") - local meta_status = meta:get_string("status") - local id_flame = meta:get_int("id_flame") - local id_smoke = meta:get_int("id_smoke") + -- get meta + local owner = meta:get_string('owner') + local meta_status = meta:get_string('status') + local id_flame = meta:get_int('id_flame') + local id_smoke = meta:get_int('id_smoke') - -- - -- active - -- - if set_status == "active" then - -- remove particles and add them again - keeps particles after server restart - -- delete particles - if id_flame ~= -1 and id_smoke ~= -1 then - -- print("#1 delete id_flame: "..id_flame.." at "..minetest.pos_to_string(pos)) - -- print("#1 delete id_smoke: "..id_smoke.." at "..minetest.pos_to_string(pos)) - minetest.delete_particlespawner(id_flame) - minetest.delete_particlespawner(id_smoke) - meta:set_int("id_flame", -1) - meta:set_int("id_smoke", -1) - end + -- + -- active + -- + if set_status == 'active' then + -- remove particles and add them again - keeps particles after server restart + -- delete particles + if id_flame ~= -1 and id_smoke ~= -1 then + -- print('#1 delete id_flame: ' .. id_flame .. ' at ' .. minetest.pos_to_string(pos)) + -- print('#1 delete id_smoke: ' .. id_smoke .. ' at ' .. minetest.pos_to_string(pos)) + minetest.delete_particlespawner(id_flame) + minetest.delete_particlespawner(id_smoke) + meta:set_int('id_flame', -1) + meta:set_int('id_smoke', -1) + end - -- add particles - id_flame = spawners_mobs.add_flame_effects(pos) - id_smoke = spawners_mobs.add_smoke_effects(pos) - meta:set_int("id_flame", id_flame) - meta:set_int("id_smoke", id_smoke) - -- print("#1 add id_flame: "..id_flame.." at "..minetest.pos_to_string(pos)) - -- print("#1 add id_smoke: "..id_smoke.." at "..minetest.pos_to_string(pos)) + -- add particles + id_flame = spawners_mobs.add_flame_effects(pos) + id_smoke = spawners_mobs.add_smoke_effects(pos) + meta:set_int('id_flame', id_flame) + meta:set_int('id_smoke', id_smoke) + -- print('#1 add id_flame: ' .. id_flame .. ' at ' .. minetest.pos_to_string(pos)) + -- print('#1 add id_smoke: ' .. id_smoke .. ' at ' .. minetest.pos_to_string(pos)) - if meta_status ~= set_status then - -- add dummy entity - minetest.add_entity({ x = pos.x, y = pos.y + offset, z = pos.z },"spawners_mobs:dummy_"..mod_prefix.."_"..mob_name) + if meta_status ~= set_status then + -- add dummy entity + minetest.add_entity({ x = pos.x, y = pos.y + offset, z = pos.z },'spawners_mobs:dummy_' .. mod_prefix .. '_' .. mob_name) - meta:set_string("status", "active") + meta:set_string('status', 'active') - minetest.swap_node(pos, {name="spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner"}) - end + minetest.swap_node(pos, { name = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner' }) + end + elseif set_status == 'waiting' and meta_status ~= set_status then + -- + -- waiting + -- - -- - -- waiting - -- - elseif set_status == "waiting" and meta_status ~= set_status then - -- delete particles - if id_flame ~= -1 and id_smoke ~= -1 then - -- print("#2 delete id_flame: "..id_flame.." at "..minetest.pos_to_string(pos)) - -- print("#2 delete id_smoke: "..id_smoke.." at "..minetest.pos_to_string(pos)) - minetest.delete_particlespawner(id_flame) - minetest.delete_particlespawner(id_smoke) - meta:set_int("id_flame", -1) - meta:set_int("id_smoke", -1) - end + -- delete particles + if id_flame ~= -1 and id_smoke ~= -1 then + -- print('#2 delete id_flame: ' .. id_flame .. ' at ' .. minetest.pos_to_string(pos)) + -- print('#2 delete id_smoke: ' .. id_smoke .. ' at ' .. minetest.pos_to_string(pos)) + minetest.delete_particlespawner(id_flame) + minetest.delete_particlespawner(id_smoke) + meta:set_int('id_flame', -1) + meta:set_int('id_smoke', -1) + end - -- remove dummy - local objs = minetest.get_objects_inside_radius(pos, 0.5) - if objs then - for _, obj in ipairs(objs) do - if obj and obj:get_luaentity() and obj:get_luaentity().name == "spawners_mobs:dummy_"..mod_prefix.."_"..mob_name then - obj:remove() - end - end - end + -- remove dummy + local objs = minetest.get_objects_inside_radius(pos, 0.5) + if objs then + for _, obj in ipairs(objs) do + if obj and obj:get_luaentity() and obj:get_luaentity().name == 'spawners_mobs:dummy_' .. mod_prefix .. '_' .. mob_name then + obj:remove() + end + end + end - meta:set_string("status", "waiting") + meta:set_string('status', 'waiting') - minetest.swap_node(pos, {name="spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_waiting"}) + minetest.swap_node(pos, { name = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting' }) + elseif set_status == 'rusty' and meta_status ~= set_status then + -- + -- rusty + -- - -- - -- rusty - -- - elseif set_status == "rusty" and meta_status ~= set_status then - -- delete particles - if id_flame ~= -1 and id_smoke ~= -1 then - -- print("#3 delete id_flame: "..id_flame.." at "..minetest.pos_to_string(pos)) - -- print("#3 delete id_smoke: "..id_smoke.." at "..minetest.pos_to_string(pos)) - minetest.delete_particlespawner(id_flame) - minetest.delete_particlespawner(id_smoke) - meta:set_int("id_flame", -1) - meta:set_int("id_smoke", -1) - end + -- delete particles + if id_flame ~= -1 and id_smoke ~= -1 then + -- print('#3 delete id_flame: ' .. id_flame .. ' at ' .. minetest.pos_to_string(pos)) + -- print('#3 delete id_smoke: ' .. id_smoke .. ' at ' .. minetest.pos_to_string(pos)) + minetest.delete_particlespawner(id_flame) + minetest.delete_particlespawner(id_smoke) + meta:set_int('id_flame', -1) + meta:set_int('id_smoke', -1) + end - -- remove dummy - local objs = minetest.get_objects_inside_radius(pos, 0.5) - if objs then - for _, obj in ipairs(objs) do - if obj and obj:get_luaentity() and obj:get_luaentity().name == "spawners_mobs:dummy_"..mod_prefix.."_"..mob_name then - obj:remove() - end - end - end + -- remove dummy + local objs = minetest.get_objects_inside_radius(pos, 0.5) + if objs then + for _, obj in ipairs(objs) do + if obj and obj:get_luaentity() and obj:get_luaentity().name == 'spawners_mobs:dummy_' .. mod_prefix .. '_' .. mob_name then + obj:remove() + end + end + end - meta:set_string("status", "rusty") + meta:set_string('status', 'rusty') - minetest.swap_node(pos, {name="spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_rusty"}) - - -- set infotext - meta:set_string("infotext", mob_name.." spawner\nowner: "..owner.."\nSpawner was searching for too long and got rusted! Dig up the spawner and place it again.") - return - end + minetest.swap_node(pos, { name = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_rusty' }) + -- set infotext + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. owner .. '\nSpawner was searching for too long and got rusted! Dig up the spawner and place it again.') + return + end end diff --git a/spawners_mobs/config.example.lua b/spawners_mobs/config.example.lua index 7708a60..16d9179 100644 --- a/spawners_mobs/config.example.lua +++ b/spawners_mobs/config.example.lua @@ -1,3 +1,21 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- * [name : string] - Name of the mob used in the mod. -- [egg_name_custom : string] - Custom name for the egg item. If empty default name will be used i.e. 'mobs:chicken'. @@ -10,217 +28,215 @@ -- * [dummy_texture : table] - Textures used for the mob. --- * [night_only : boolean : string] - If true mobs will spawn only during the night or in dark areas, default:true. Writing "disable" will disable light check and it will spawn in both states (night and day) +-- * [night_only : boolean : string] - If true mobs will spawn only during the night or in dark areas, default:true. Writing 'disable' will disable light check and it will spawn in both states (night and day) -- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'. -- [*] -> MANDATORY - has to be filled in! -- mods what should be enabled and loded, remove/add the one you want to load -ENABLED_MODS = {"mobs", "creatures"} +spawners_mobs.ENABLED_MODS = { 'mobs', 'creatures' } -- mobs properties - setup all you mobs here -MOBS_PROPS = { - - ["mobs"] = { -- MOBS REDO CONFIG - { - name="sheep_white", - egg_name_custom="", - dummy_size={x=0.52,y=0.52}, - dummy_offset=0.2, - dummy_mesh="mobs_sheep.b3d", - dummy_texture={"mobs_sheep_wool.png^mobs_sheep_base.png"}, - night_only=false, - sound_custom="mobs_sheep" - }, - { - name="cow", - egg_name_custom="", - dummy_size={x=0.3,y=0.3}, - dummy_offset=-0.3, - dummy_mesh="mobs_cow.x", - dummy_texture={"mobs_cow.png"}, - night_only=false, - sound_custom="" - }, - { - name="chicken", - egg_name_custom="", - dummy_size={x=0.9,y=0.9}, - dummy_offset=0.2, - dummy_mesh="mobs_chicken.x", - dummy_texture={"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, - night_only=false, - sound_custom="" - }, - { - name="pumba", - egg_name_custom="", - dummy_size={x=0.62,y=0.62}, - dummy_offset=-0.3, - dummy_mesh="mobs_pumba.x", - dummy_texture={"mobs_pumba.png"}, - night_only=false, - sound_custom="mobs_pig" - }, - { - name="bunny", - egg_name_custom="", - dummy_size={x=1,y=1}, - dummy_offset=0.2, - dummy_mesh="mobs_bunny.b3d", - dummy_texture={"mobs_bunny_brown.png"}, - night_only=false, - sound_custom="spawners_mobs_bunny" - }, - { - name="kitten", - egg_name_custom="", - dummy_size={x=0.32,y=0.32}, - dummy_offset=0, - dummy_mesh="mobs_kitten.b3d", - dummy_texture={"mobs_kitten_ginger.png"}, - night_only=false, - sound_custom="" - }, - { - name="spider", - egg_name_custom="", - dummy_size={x=2,y=2}, - dummy_offset=-0.2, - dummy_mesh="mobs_spider.x", - dummy_texture={"mobs_spider.png"}, - night_only="disable", - sound_custom="", - env=true - }, - { - name="stone_monster", - egg_name_custom="", - dummy_size={x=0.5,y=0.5}, - dummy_offset=0.05, - dummy_mesh="mobs_stone_monster.b3d", - dummy_texture={"mobs_stone_monster.png"}, - night_only=true, - sound_custom="mobs_stonemonster" - }, - { - name="oerkki", - egg_name_custom="", - dummy_size={x=0.5,y=0.5}, - dummy_offset=0.05, - dummy_mesh="mobs_oerkki.b3d", - dummy_texture={"mobs_oerkki.png"}, - night_only=true, - sound_custom="" - }, - { - name="tree_monster", - egg_name_custom="", - dummy_size={x=0.4,y=0.4}, - dummy_offset=0.05, - dummy_mesh="mobs_tree_monster.b3d", - dummy_texture={"mobs_tree_monster.png"}, - night_only=true, - sound_custom="mobs_treemonster" - } - }, - - ["creatures"] = { -- CREATURES MOD CONFIG - { - name="chicken", - egg_name_custom="creatures:chicken_spawn_egg", - dummy_size={x=0.9,y=0.9}, - dummy_offset=-0.3, - dummy_mesh="creatures_chicken.b3d", - dummy_texture={"creatures_chicken.png"}, - night_only=false, - sound_custom="" - }, - { - name="ghost", - egg_name_custom="creatures:ghost_spawn_egg", - dummy_size={x=0.7,y=0.7}, - dummy_offset=-0.5, - dummy_mesh="creatures_ghost.b3d", - dummy_texture={"creatures_ghost.png"}, - night_only=true, - sound_custom="" - }, - { - name="sheep", - egg_name_custom="creatures:sheep_spawn_egg", - dummy_size={x=0.6,y=0.6}, - dummy_offset=-0.3, - dummy_mesh="creatures_sheep.b3d", - dummy_texture={"creatures_sheep.png^creatures_sheep_white.png"}, - night_only=false, - sound_custom="" - }, - { - name="zombie", - egg_name_custom="creatures:zombie_spawn_egg", - dummy_size={x=0.5,y=0.5}, - dummy_offset=-0.5, - dummy_mesh="creatures_zombie.b3d", - dummy_texture={"creatures_zombie.png"}, - night_only=false, - sound_custom="" - }, - { - name="oerrki", - egg_name_custom="creatures:oerrki_spawn_egg", - dummy_size={x=0.4,y=0.4}, - dummy_offset=-0.5, - dummy_mesh="creatures_oerrki.b3d", - dummy_texture={"creatures_oerrki.png"}, - night_only=false, - sound_custom="creatures_oerrki_idle" - } - } +spawners_mobs.MOBS_PROPS = { + ['mobs'] = { -- MOBS REDO CONFIG + { + name = 'sheep_white', + egg_name_custom = '', + dummy_size = { x = 0.52, y = 0.52 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_sheep.b3d', + dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' }, + night_only = false, + sound_custom = 'mobs_sheep' + }, + { + name = 'cow', + egg_name_custom = '', + dummy_size = { x = 0.3, y = 0.3 }, + dummy_offset = -0.3, + dummy_mesh = 'mobs_cow.x', + dummy_texture={ 'mobs_cow.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'chicken', + egg_name_custom = '', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_chicken.x', + dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'pumba', + egg_name_custom = '', + dummy_size = { x = 0.62, y = 0.62 }, + dummy_offset = 0.3, + dummy_mesh = 'mobs_pumba.x', + dummy_texture = { 'mobs_pumba.png' }, + night_only = false, + sound_custom = 'mobs_pig' + }, + { + name = 'bunny', + egg_name_custom = '', + dummy_size = { x = 1, y = 1 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_bunny.b3d', + dummy_texture = { 'mobs_bunny_brown.png' }, + night_only = false, + sound_custom = 'spawners_mobs_bunny' + }, + { + name = 'kitten', + egg_name_custom = '', + dummy_size = { x = 0.32, y = 0.32 }, + dummy_offset = 0, + dummy_mesh = 'mobs_kitten.b3d', + dummy_texture = { 'mobs_kitten_ginger.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'spider', + egg_name_custom = '', + dummy_size = { x = 2, y = 2 }, + dummy_offset = -0.2, + dummy_mesh = 'mobs_spider.x', + dummy_texture = { 'mobs_spider.png' }, + night_only = 'disable', + sound_custom = '', + env = true + }, + { + name = 'stone_monster', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_stone_monster.b3d', + dummy_texture = { 'mobs_stone_monster.png' }, + night_only = true, + sound_custom = 'mobs_stonemonster' + }, + { + name = 'oerkki', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_oerkki.b3d', + dummy_texture = { 'mobs_oerkki.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'tree_monster', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4} , + dummy_offset = 0.05, + dummy_mesh = 'mobs_tree_monster.b3d', + dummy_texture = { 'mobs_tree_monster.png' }, + night_only = true, + sound_custom = 'mobs_treemonster' + } + }, + ['creatures'] = { -- CREATURES MOD CONFIG + { + name = 'chicken', + egg_name_custom = 'creatures:chicken_spawn_egg', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_chicken.b3d', + dummy_texture = { 'creatures_chicken.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'ghost', + egg_name_custom = 'creatures:ghost_spawn_egg', + dummy_size = { x = 0.7, y = 0.7 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_ghost.b3d', + dummy_texture = { 'creatures_ghost.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'sheep', + egg_name_custom = 'creatures:sheep_spawn_egg', + dummy_size = { x = 0.6, y = 0.6 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_sheep.b3d', + dummy_texture = { 'creatures_sheep.png^creatures_sheep_white.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'zombie', + egg_name_custom = 'creatures:zombie_spawn_egg', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_zombie.b3d', + dummy_texture = { 'creatures_zombie.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'oerrki', + egg_name_custom = 'creatures:oerrki_spawn_egg', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_oerrki.b3d', + dummy_texture = { 'creatures_oerrki.png' }, + night_only = false, + sound_custom = 'creatures_oerrki_idle' + } + } } --- +-- -- check for 3rd party dependencies --- +-- -- include mummy mobs redo addon (spawner) -if minetest.get_modpath("mobs") ~= nil then - -- enable spawner - table.insert(ENABLED_MODS, "spawners_mobs") +if minetest.get_modpath('mobs') ~= nil then + -- enable spawner + table.insert(spawners_mobs.ENABLED_MODS, 'spawners_mobs') - -- configure spawner - MOBS_PROPS["spawners_mobs"] = { - { - name="mummy", - egg_name_custom="", - dummy_size={x=0.4,y=0.4}, - dummy_offset=0, - dummy_mesh="spawners_mobs_mummy.b3d", - dummy_texture={"spawners_mobs_mummy.png"}, - night_only=true, - sound_custom="spawners_mobs_mummy" - }, - { - name="bunny_evil", - egg_name_custom="", - dummy_size={x=1,y=1}, - dummy_offset=0.2, - dummy_mesh="spawners_mobs_evil_bunny.b3d", - dummy_texture={"spawners_mobs_evil_bunny.png"}, - night_only=true, - sound_custom="spawners_mobs_bunny" - }, - { - name="uruk_hai", - egg_name_custom="", - dummy_size={x=0.5,y=0.5}, - dummy_offset=0, - dummy_mesh="spawners_mobs_character.b3d", - dummy_texture={"spawners_mobs_uruk_hai.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - night_only="disable", - sound_custom="spawners_mobs_barbarian_yell2", - env=true - } - } -end \ No newline at end of file + -- configure spawner + spawners_mobs.MOBS_PROPS['spawners_mobs'] = { + { + name = 'mummy', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_mummy.b3d', + dummy_texture = { 'spawners_mobs_mummy.png' }, + night_only = true, + sound_custom = 'spawners_mobs_mummy' + }, + { + name = 'bunny_evil', + egg_name_custom = '', + dummy_size = { x = 1, y = 1 }, + dummy_offset = 0.2, + dummy_mesh = 'spawners_mobs_evil_bunny.b3d', + dummy_texture = { 'spawners_mobs_evil_bunny.png' }, + night_only = true, + sound_custom = 'spawners_mobs_bunny' + }, + { + name = 'uruk_hai', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_character.b3d', + dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + night_only = 'disable', + sound_custom = 'spawners_mobs_barbarian_yell2', + env = true + } + } +end diff --git a/spawners_mobs/config.lua b/spawners_mobs/config.lua index 9cea403..6952fbf 100644 --- a/spawners_mobs/config.lua +++ b/spawners_mobs/config.lua @@ -1,3 +1,21 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- * [name : string] - Name of the mob used in the mod. -- [egg_name_custom : string] - Custom name for the egg item. If empty default name will be used i.e. 'mobs:chicken'. @@ -10,175 +28,174 @@ -- * [dummy_texture : table] - Textures used for the mob. --- * [night_only : boolean : string] - If true mobs will spawn "only" during the night or in dark areas, default:true. Writing "disable" will disable light check and it will spawn in both states (night and day) +-- * [night_only : boolean : string] - If true mobs will spawn 'only' during the night or in dark areas, default:true. Writing 'disable' will disable light check and it will spawn in both states (night and day) -- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'. -- [*] -> MANDATORY - has to be filled in! -- mods what should be enabled and loded, remove/add the one you want to load -ENABLED_MODS = {"mobs", "creatures"} +spawners_mobs.ENABLED_MODS = { 'mobs', 'creatures' } -- mobs properties - setup all you mobs here -MOBS_PROPS = { +spawners_mobs.MOBS_PROPS = { - ["mobs"] = { -- MOBS REDO CONFIG - { - name = "sheep_white", - egg_name_custom = "", - dummy_size = {x = 0.52, y = 0.52}, - dummy_offset = 0.2, - dummy_mesh = "mobs_sheep.b3d", - dummy_texture = {"mobs_sheep_wool.png^mobs_sheep_base.png"}, - night_only = false, - sound_custom = "mobs_sheep" - }, - { - name = "cow", - egg_name_custom = "", - dummy_size = {x = 0.3, y = 0.3}, - dummy_offset = -0.3, - dummy_mesh = "mobs_cow.x", - dummy_texture = {"mobs_cow.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "chicken", - egg_name_custom = "", - dummy_size = {x = 0.9, y = 0.9}, - dummy_offset = 0.2, - dummy_mesh = "mobs_chicken.x", - dummy_texture = {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, - night_only = false, - sound_custom = "mobs_chicken" - }, - { - name = "pumba", - egg_name_custom = "", - dummy_size = {x = 0.62, y = 0.62}, - dummy_offset = -0.3, - dummy_mesh = "mobs_pumba.x", - dummy_texture = {"mobs_pumba.png"}, - night_only = false, - sound_custom = "mobs_pig" - }, - -- { - -- name = "bunny", - -- egg_name_custom = "", - -- dummy_size = {x = 1, y = 1}, - -- dummy_offset = 0.2, - -- dummy_mesh = "mobs_bunny.b3d", - -- dummy_texture = {"mobs_bunny_brown.png"}, - -- night_only = false, - -- sound_custom = "spawners_mobs_bunny" - -- }, - -- { - -- name = "kitten", - -- egg_name_custom = "", - -- dummy_size = {x = 0.32, y = 0.32}, - -- dummy_offset = 0, - -- dummy_mesh = "mobs_kitten.b3d", - -- dummy_texture = {"mobs_kitten_ginger.png"}, - -- night_only = false, - -- sound_custom = "" - -- }, - { - name = "spider", - egg_name_custom = "", - dummy_size = {x = 2, y = 2}, - dummy_offset = -0.2, - dummy_mesh = "mobs_spider.x", - dummy_texture = {"mobs_spider.png"}, - night_only = true, - sound_custom = "", - env = true, - sound_custom = "mobs_spider_neutral" - }, - { - name = "stone_monster", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0.05, - dummy_mesh = "mobs_stone_monster.b3d", - dummy_texture = {"mobs_stone_monster.png"}, - night_only = true, - sound_custom = "mobs_stonemonster_neutral" - }, - { - name = "oerkki", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0.05, - dummy_mesh = "mobs_oerkki.b3d", - dummy_texture = {"mobs_oerkki.png"}, - night_only = true, - sound_custom = "" - }, - { - name = "tree_monster", - egg_name_custom = "", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = 0.05, - dummy_mesh = "mobs_tree_monster.b3d", - dummy_texture = {"mobs_tree_monster.png"}, - night_only = true, - sound_custom = "mobs_treemonster_neutral" - } - }, + ['mobs'] = { -- MOBS REDO CONFIG + { + name = 'sheep_white', + egg_name_custom = '', + dummy_size = { x = 0.52, y = 0.52 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_sheep.b3d', + dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' }, + night_only = false, + sound_custom = 'mobs_sheep' + }, + { + name = 'cow', + egg_name_custom = '', + dummy_size = { x = 0.3, y = 0.3 }, + dummy_offset = -0.3, + dummy_mesh = 'mobs_cow.x', + dummy_texture = { 'mobs_cow.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'chicken', + egg_name_custom = '', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = 0.2, + dummy_mesh = 'mobs_chicken.x', + dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' }, + night_only = false, + sound_custom = 'mobs_chicken' + }, + { + name = 'pumba', + egg_name_custom = '', + dummy_size = { x = 0.62, y = 0.62 }, + dummy_offset = -0.3, + dummy_mesh = 'mobs_pumba.x', + dummy_texture = { 'mobs_pumba.png' }, + night_only = false, + sound_custom = 'mobs_pig' + }, + -- { + -- name = 'bunny', + -- egg_name_custom = '', + -- dummy_size = { x = 1, y = 1}, + -- dummy_offset = 0.2, + -- dummy_mesh = 'mobs_bunny.b3d', + -- dummy_texture = { 'mobs_bunny_brown.png' }, + -- night_only = false, + -- sound_custom = 'spawners_mobs_bunny' + -- }, + -- { + -- name = 'kitten', + -- egg_name_custom = '', + -- dummy_size = { x = 0.32, y = 0.32}, + -- dummy_offset = 0, + -- dummy_mesh = 'mobs_kitten.b3d', + -- dummy_texture = { 'mobs_kitten_ginger.png' }, + -- night_only = false, + -- sound_custom = '' + -- }, + { + name = 'spider', + egg_name_custom = '', + dummy_size = { x = 2, y = 2 }, + dummy_offset = -0.2, + dummy_mesh = 'mobs_spider.x', + dummy_texture = { 'mobs_spider.png' }, + night_only = true, + env = true, + sound_custom = 'mobs_spider_neutral' + }, + { + name = 'stone_monster', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_stone_monster.b3d', + dummy_texture = { 'mobs_stone_monster.png' }, + night_only = true, + sound_custom = 'mobs_stonemonster_neutral' + }, + { + name = 'oerkki', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_oerkki.b3d', + dummy_texture = { 'mobs_oerkki.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'tree_monster', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = 0.05, + dummy_mesh = 'mobs_tree_monster.b3d', + dummy_texture = { 'mobs_tree_monster.png' }, + night_only = true, + sound_custom = 'mobs_treemonster_neutral' + } + }, - ["creatures"] = { -- CREATURES MOD CONFIG - { - name = "chicken", - egg_name_custom = "creatures:chicken_spawn_egg", - dummy_size = {x = 0.9, y = 0.9}, - dummy_offset = -0.3, - dummy_mesh = "creatures_chicken.b3d", - dummy_texture = {"creatures_chicken.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "ghost", - egg_name_custom = "creatures:ghost_spawn_egg", - dummy_size = {x = 0.7, y = 0.7}, - dummy_offset = -0.5, - dummy_mesh = "creatures_ghost.b3d", - dummy_texture = {"creatures_ghost.png"}, - night_only = true, - sound_custom = "" - }, - { - name = "sheep", - egg_name_custom = "creatures:sheep_spawn_egg", - dummy_size = {x = 0.6, y = 0.6}, - dummy_offset = -0.3, - dummy_mesh = "creatures_sheep.b3d", - dummy_texture = {"creatures_sheep.png^creatures_sheep_white.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "zombie", - egg_name_custom = "creatures:zombie_spawn_egg", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = -0.5, - dummy_mesh = "creatures_zombie.b3d", - dummy_texture = {"creatures_zombie.png"}, - night_only = false, - sound_custom = "" - }, - { - name = "oerrki", - egg_name_custom = "creatures:oerrki_spawn_egg", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = -0.5, - dummy_mesh = "creatures_oerrki.b3d", - dummy_texture = {"creatures_oerrki.png"}, - night_only = false, - sound_custom = "creatures_oerrki_idle" - } - } + ['creatures'] = { -- CREATURES MOD CONFIG + { + name = 'chicken', + egg_name_custom = 'creatures:chicken_spawn_egg', + dummy_size = { x = 0.9, y = 0.9 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_chicken.b3d', + dummy_texture = { 'creatures_chicken.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'ghost', + egg_name_custom = 'creatures:ghost_spawn_egg', + dummy_size = { x = 0.7, y = 0.7 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_ghost.b3d', + dummy_texture = { 'creatures_ghost.png' }, + night_only = true, + sound_custom = '' + }, + { + name = 'sheep', + egg_name_custom = 'creatures:sheep_spawn_egg', + dummy_size = { x = 0.6, y = 0.6 }, + dummy_offset = -0.3, + dummy_mesh = 'creatures_sheep.b3d', + dummy_texture = { 'creatures_sheep.png^creatures_sheep_white.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'zombie', + egg_name_custom = 'creatures:zombie_spawn_egg', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_zombie.b3d', + dummy_texture = { 'creatures_zombie.png' }, + night_only = false, + sound_custom = '' + }, + { + name = 'oerrki', + egg_name_custom = 'creatures:oerrki_spawn_egg', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = -0.5, + dummy_mesh = 'creatures_oerrki.b3d', + dummy_texture = { 'creatures_oerrki.png' }, + night_only = false, + sound_custom = 'creatures_oerrki_idle' + } + } } -- @@ -186,54 +203,54 @@ MOBS_PROPS = { -- -- include mummy mobs redo addon (spawner) -if minetest.get_modpath("mobs") ~= nil then - -- enable spawner - table.insert(ENABLED_MODS, "spawners_mobs") +if minetest.get_modpath('mobs') ~= nil then + -- enable spawner + table.insert(spawners_mobs.ENABLED_MODS, 'spawners_mobs') - -- configure spawner - MOBS_PROPS["spawners_mobs"] = { - { - name = "mummy", - egg_name_custom = "", - dummy_size = {x = 0.4, y = 0.4}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_mummy.b3d", - dummy_texture = {"spawners_mobs_mummy.png"}, - night_only = true, - sound_custom = "spawners_mobs_mummy_neutral" - }, - { - name = "bunny_evil", - egg_name_custom = "", - dummy_size = {x = 1, y = 1}, - dummy_offset = 0.2, - dummy_mesh = "spawners_mobs_evil_bunny.b3d", - dummy_texture = {"spawners_mobs_evil_bunny.png"}, - night_only = true, - sound_custom = "spawners_mobs_bunny" - }, - { - name = "uruk_hai", - egg_name_custom = "", - dummy_size = {x = 0.5, y = 0.5}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_character.b3d", - dummy_texture = {"spawners_mobs_uruk_hai.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - night_only = true, - sound_custom = "spawners_mobs_uruk_hai_neutral", - env = true - }, - { - name = "balrog", - egg_name_custom = "", - dummy_size = {x = 0.2, y = 0.2}, - dummy_offset = 0, - dummy_mesh = "spawners_mobs_balrog.b3d", - dummy_texture = {"spawners_mobs_balrog.png"}, - night_only = "disable", - sound_custom = "spawners_mobs_balrog_neutral", - env = true, - boss = true - } - } -end \ No newline at end of file + -- configure spawner + spawners_mobs.MOBS_PROPS['spawners_mobs'] = { + { + name = 'mummy', + egg_name_custom = '', + dummy_size = { x = 0.4, y = 0.4 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_mummy.b3d', + dummy_texture = { 'spawners_mobs_mummy.png' }, + night_only = true, + sound_custom = 'spawners_mobs_mummy_neutral' + }, + { + name = 'bunny_evil', + egg_name_custom = '', + dummy_size = { x = 1, y = 1 }, + dummy_offset = 0.2, + dummy_mesh = 'spawners_mobs_evil_bunny.b3d', + dummy_texture = { 'spawners_mobs_evil_bunny.png' }, + night_only = true, + sound_custom = 'spawners_mobs_bunny' + }, + { + name = 'uruk_hai', + egg_name_custom = '', + dummy_size = { x = 0.5, y = 0.5 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_character.b3d', + dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + night_only = true, + sound_custom = 'spawners_mobs_uruk_hai_neutral', + env = true + }, + { + name = 'balrog', + egg_name_custom = '', + dummy_size = { x = 0.2, y = 0.2 }, + dummy_offset = 0, + dummy_mesh = 'spawners_mobs_balrog.b3d', + dummy_texture = { 'spawners_mobs_balrog.png' }, + night_only = 'disable', + sound_custom = 'spawners_mobs_balrog_neutral', + env = true, + boss = true + } + } +end diff --git a/spawners_mobs/depends.txt b/spawners_mobs/depends.txt deleted file mode 100644 index 1db7139..0000000 --- a/spawners_mobs/depends.txt +++ /dev/null @@ -1,7 +0,0 @@ -default -x_default? -xpanes? -fire? -mobs? -creatures? -bones? \ No newline at end of file diff --git a/spawners_mobs/description.txt b/spawners_mobs/description.txt deleted file mode 100644 index 9d63863..0000000 --- a/spawners_mobs/description.txt +++ /dev/null @@ -1 +0,0 @@ -This MOD for Minetest let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals. This MOD is giving the option of creating mob farms and grinders. diff --git a/spawners_mobs/init.lua b/spawners_mobs/init.lua index 20cabfd..7baa220 100644 --- a/spawners_mobs/init.lua +++ b/spawners_mobs/init.lua @@ -1,21 +1,42 @@ -MOD_NAME = minetest.get_current_modname() +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL --- Spawners configurations -dofile(minetest.get_modpath(MOD_NAME).."/config.lua") + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + +local mod_start_time = minetest.get_us_time() +local path = minetest.get_modpath('spawners_mobs') -- API -dofile(minetest.get_modpath(MOD_NAME).."/api.lua") +dofile(path .. '/api.lua') + +-- Spawners configurations +dofile(path .. '/config.lua') -- Spawners for mobs -dofile(minetest.get_modpath(MOD_NAME).."/spawners_mobs.lua") +dofile(path .. '/spawners_mobs.lua') -- include mummy mobs redo addon (mob) -if minetest.get_modpath("mobs") then - dofile(minetest.get_modpath(MOD_NAME).."/mob_mummy.lua") - dofile(minetest.get_modpath(MOD_NAME).."/mob_bunny_evil.lua") - dofile(minetest.get_modpath(MOD_NAME).."/mob_uruk_hai.lua") - dofile(minetest.get_modpath(MOD_NAME).."/mob_balrog.lua") - dofile(minetest.get_modpath(MOD_NAME).."/nodes_additional.lua") +if minetest.get_modpath('mobs') then + dofile(path .. '/mob_mummy.lua') + dofile(path .. '/mob_bunny_evil.lua') + dofile(path .. '/mob_uruk_hai.lua') + dofile(path .. '/mob_balrog.lua') + dofile(path .. '/nodes_additional.lua') end -print ("[Mod] Spawners Mobs Loaded.") +local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000 + +print ('[Mod] Spawners Mobs Loaded. [' .. mod_end_time .. 's]') diff --git a/spawners_mobs/mob_balrog.lua b/spawners_mobs/mob_balrog.lua index 79e9ea3..37764f0 100644 --- a/spawners_mobs/mob_balrog.lua +++ b/spawners_mobs/mob_balrog.lua @@ -1,174 +1,191 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- modified Sand Monster by PilzAdam with Mummy by BlockMen local balrog_def = { - type = "monster", - passive = false, - rotate = 180, - hp_min = 1000, - hp_max = 1250, - pathfinding = false, - attack_type = "dogshoot", - shoot_interval = 0.6, - dogshoot_switch = 1, - dogshoot_count_max = 10, - shoot_offset = 1, - arrow = "spawners_mobs:balrog_firebolt", - reach = 5, - damage = 10, - armor = 100, - collisionbox = {-0.8, -2.1, -0.8, 0.8, 2.6, 0.8}, - visual_size = {x=2, y=2}, - visual = "mesh", - mesh = "spawners_mobs_balrog.b3d", - drawtype = "front", - textures = { - {"spawners_mobs_balrog.png"}, - }, - blood_texture = "fire_basic_flame.png", - makes_footstep_sound = true, - sounds = { - death = "spawners_mobs_balrog_death", - attack = "spawners_mobs_balrog_attack", - shoot_attack = "spawners_mobs_balrog_fireball", - damage = "spawners_mobs_balrog_hit", - random = "spawners_mobs_balrog_neutral", - distance = 15 - }, - walk_velocity = 3, - run_velocity = 4, - view_range = 20, - jump = true, - floats = 1, - drops = { - {name = "default:diamondblock", chance = 2, min = 1, max = 8}, - {name = "default:diamondblock", chance = 2, min = 1, max = 8}, - {name = "default:diamondblock", chance = 2, min = 1, max = 4}, - {name = "default:diamondblock", chance = 2, min = 1, max = 4}, - {name = "default:diamondblock", chance = 2, min = 1, max = 4}, - {name = "default:diamond", chance = 2, min = 1, max = 8}, - {name = "default:diamond", chance = 2, min = 1, max = 8}, - {name = "default:diamond", chance = 2, min = 1, max = 4}, - {name = "default:diamond", chance = 2, min = 1, max = 4}, - {name = "default:diamond", chance = 2, min = 1, max = 4}, - {name = "default:mese", chance = 2, min = 1, max = 4}, - {name = "default:mese_crystal", chance = 2, min = 1, max = 4}, - {name = "default:mese", chance = 2, min = 1, max = 4}, - {name = "default:mese_crystal", chance = 2, min = 1, max = 4}, - {name = "default:mese", chance = 2, min = 1, max = 4}, - {name = "default:mese_crystal", chance = 2, min = 1, max = 4}, - {name = "default:mese", chance = 2, min = 1, max = 4}, - {name = "default:mese_crystal", chance = 2, min = 1, max = 4}, - {name = "default:mese", chance = 2, min = 1, max = 4}, - {name = "default:mese_crystal", chance = 2, min = 1, max = 4}, - {name = "3d_armor:boots_diamond", chance = 2, min = 1, max = 4}, - {name = "3d_armor:chestplate_diamond", chance = 2, min = 1, max = 1}, - {name = "3d_armor:helmet_diamond", chance = 2, min = 1, max = 1}, - {name = "3d_armor:leggings_diamond", chance = 2, min = 1, max = 1}, - {name = "3d_armor:chestplate_bronze", chance = 2, min = 1, max = 1}, - {name = "3d_armor:helmet_bronze", chance = 2, min = 1, max = 1}, - {name = "3d_armor:leggings_bronze", chance = 2, min = 1, max = 1}, - {name = "3d_armor:chestplate_gold", chance = 2, min = 1, max = 1}, - {name = "3d_armor:helmet_gold", chance = 2, min = 1, max = 1}, - {name = "3d_armor:leggings_gold", chance = 2, min = 1, max = 1}, - {name = "3d_armor:helmet_magma", chance = 10, min = 1, max = 1}, - {name = "3d_armor:chestplate_magma", chance = 10, min = 1, max = 1}, - {name = "3d_armor:leggings_magma", chance = 10, min = 1, max = 1}, - {name = "3d_armor:boots_magma", chance = 10, min = 1, max = 1}, - {name = "obsidianmese:pick", chance = 2, min = 1, max = 1}, - {name = "obsidianmese:sword", chance = 2, min = 1, max = 1}, - {name = "default:pick_diamond", chance = 2, min = 1, max = 1}, - {name = "default:sword_diamond", chance = 2, min = 1, max = 1}, - {name = "default:shovel_diamond", chance = 2, min = 1, max = 1}, - {name = "default:axe_diamond", chance = 2, min = 1, max = 1}, - {name = "default:hoe_diamond", chance = 2, min = 1, max = 1}, - {name = "default:pick_mese", chance = 2, min = 1, max = 1}, - {name = "default:sword_mese", chance = 2, min = 1, max = 1}, - {name = "default:shovel_mese", chance = 2, min = 1, max = 1}, - {name = "default:axe_mese", chance = 2, min = 1, max = 1}, - {name = "default:hoe_mese", chance = 2, min = 1, max = 1}, - {name = "default:pick_bronze", chance = 2, min = 1, max = 1}, - {name = "default:sword_bronze", chance = 2, min = 1, max = 1}, - {name = "default:shovel_bronze", chance = 2, min = 1, max = 1}, - {name = "default:axe_bronze", chance = 2, min = 1, max = 1}, - {name = "default:hoe_bronze", chance = 2, min = 1, max = 1}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "farming:bread", chance = 2, min = 1, max = 3}, - {name = "obsidianmese:mese_apple", chance = 2, min = 1, max = 3}, - {name = "obsidianmese:mese_apple", chance = 2, min = 1, max = 3}, - {name = "obsidianmese:mese_apple", chance = 2, min = 1, max = 3}, - {name = "obsidianmese:mese_apple", chance = 2, min = 1, max = 3}, - {name = "obsidianmese:mese_apple", chance = 2, min = 1, max = 3}, - }, - water_damage = 0, - lava_damage = 0, - light_damage = 0, - fear_height = 2, - animation = { - stand_start = 0, - stand_end = 240, - walk_start = 240, - walk_end = 300, - punch_start = 300, - punch_end = 380, - speed_normal = 15, - speed_run = 15, - }, - _timer = 0, - _random_trigger = 15, - do_custom = function(self, dtime) - if not self._timer then - self._timer = 0 - end + type = 'monster', + passive = false, + rotate = 180, + hp_min = 1000, + hp_max = 1250, + pathfinding = false, + attack_type = 'dogshoot', + shoot_interval = 0.6, + dogshoot_switch = 1, + dogshoot_count_max = 10, + shoot_offset = 1, + arrow = 'spawners_mobs:balrog_firebolt', + reach = 5, + damage = 10, + armor = 100, + collisionbox = { -0.8, -2.1, -0.8, 0.8, 2.6, 0.8 }, + visual_size = { x = 2, y = 2 }, + visual = 'mesh', + mesh = 'spawners_mobs_balrog.b3d', + drawtype = 'front', + textures = { + { 'spawners_mobs_balrog.png' }, + }, + blood_texture = 'fire_basic_flame.png', + makes_footstep_sound = true, + sounds = { + death = 'spawners_mobs_balrog_death', + attack = 'spawners_mobs_balrog_attack', + shoot_attack = 'spawners_mobs_balrog_fireball', + damage = 'spawners_mobs_balrog_hit', + random = 'spawners_mobs_balrog_neutral', + distance = 15 + }, + walk_velocity = 3, + run_velocity = 4, + view_range = 20, + jump = true, + floats = 1, + drops = { + { name = 'default:diamondblock', chance = 2, min = 1, max = 8 }, + { name = 'default:diamondblock', chance = 2, min = 1, max = 8 }, + { name = 'default:diamondblock', chance = 2, min = 1, max = 4 }, + { name = 'default:diamondblock', chance = 2, min = 1, max = 4 }, + { name = 'default:diamondblock', chance = 2, min = 1, max = 4 }, + { name = 'default:diamond', chance = 2, min = 1, max = 8 }, + { name = 'default:diamond', chance = 2, min = 1, max = 8 }, + { name = 'default:diamond', chance = 2, min = 1, max = 4 }, + { name = 'default:diamond', chance = 2, min = 1, max = 4 }, + { name = 'default:diamond', chance = 2, min = 1, max = 4 }, + { name = 'default:mese', chance = 2, min = 1, max = 4 }, + { name = 'default:mese_crystal', chance = 2, min = 1, max = 4 }, + { name = 'default:mese', chance = 2, min = 1, max = 4 }, + { name = 'default:mese_crystal', chance = 2, min = 1, max = 4 }, + { name = 'default:mese', chance = 2, min = 1, max = 4 }, + { name = 'default:mese_crystal', chance = 2, min = 1, max = 4 }, + { name = 'default:mese', chance = 2, min = 1, max = 4 }, + { name = 'default:mese_crystal', chance = 2, min = 1, max = 4 }, + { name = 'default:mese', chance = 2, min = 1, max = 4 }, + { name = 'default:mese_crystal', chance = 2, min = 1, max = 4 }, + { name = '3d_armor:boots_diamond', chance = 2, min = 1, max = 4 }, + { name = '3d_armor:chestplate_diamond', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:helmet_diamond', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:leggings_diamond', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:chestplate_bronze', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:helmet_bronze', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:leggings_bronze', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:chestplate_gold', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:helmet_gold', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:leggings_gold', chance = 2, min = 1, max = 1 }, + { name = '3d_armor:helmet_magma', chance = 10, min = 1, max = 1 }, + { name = '3d_armor:chestplate_magma', chance = 10, min = 1, max = 1 }, + { name = '3d_armor:leggings_magma', chance = 10, min = 1, max = 1 }, + { name = '3d_armor:boots_magma', chance = 10, min = 1, max = 1 }, + { name = 'obsidianmese:pick', chance = 2, min = 1, max = 1 }, + { name = 'obsidianmese:sword', chance = 2, min = 1, max = 1 }, + { name = 'default:pick_diamond', chance = 2, min = 1, max = 1 }, + { name = 'default:sword_diamond', chance = 2, min = 1, max = 1 }, + { name = 'default:shovel_diamond', chance = 2, min = 1, max = 1 }, + { name = 'default:axe_diamond', chance = 2, min = 1, max = 1 }, + { name = 'default:hoe_diamond', chance = 2, min = 1, max = 1 }, + { name = 'default:pick_mese', chance = 2, min = 1, max = 1 }, + { name = 'default:sword_mese', chance = 2, min = 1, max = 1 }, + { name = 'default:shovel_mese', chance = 2, min = 1, max = 1 }, + { name = 'default:axe_mese', chance = 2, min = 1, max = 1 }, + { name = 'default:hoe_mese', chance = 2, min = 1, max = 1 }, + { name = 'default:pick_bronze', chance = 2, min = 1, max = 1 }, + { name = 'default:sword_bronze', chance = 2, min = 1, max = 1 }, + { name = 'default:shovel_bronze', chance = 2, min = 1, max = 1 }, + { name = 'default:axe_bronze', chance = 2, min = 1, max = 1 }, + { name = 'default:hoe_bronze', chance = 2, min = 1, max = 1 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'farming:bread', chance = 2, min = 1, max = 3 }, + { name = 'obsidianmese:mese_apple', chance = 2, min = 1, max = 3 }, + { name = 'obsidianmese:mese_apple', chance = 2, min = 1, max = 3 }, + { name = 'obsidianmese:mese_apple', chance = 2, min = 1, max = 3 }, + { name = 'obsidianmese:mese_apple', chance = 2, min = 1, max = 3 }, + { name = 'obsidianmese:mese_apple', chance = 2, min = 1, max = 3 }, + }, + water_damage = 0, + lava_damage = 0, + light_damage = 0, + fear_height = 2, + animation = { + stand_start = 0, + stand_end = 240, + walk_start = 240, + walk_end = 300, + punch_start = 300, + punch_end = 380, + speed_normal = 15, + speed_run = 15, + }, + _timer = 0, + _random_trigger = 15, + do_custom = function(self, dtime) + if not self._timer then + self._timer = 0 + end - if not self._random_trigger then - self._random_trigger = math.random(15, 30) - end + if not self._random_trigger then + self._random_trigger = math.random(15, 30) + end - self._timer = self._timer + dtime + self._timer = self._timer + dtime - if self._timer > self._random_trigger then - self._timer = 0 - self._random_trigger = math.random(15, 30) + if self._timer > self._random_trigger then + self._timer = 0 + self._random_trigger = math.random(15, 30) - local mob_pos = self.object:get_pos() - local activation_area = minetest.get_objects_inside_radius(mob_pos, 20) - for k, object in ipairs(activation_area) do - if object:is_player() then - local player_pos = object:get_pos() - local player_hp = object:get_hp() + local mob_pos = self.object:get_pos() + local activation_area = minetest.get_objects_inside_radius(mob_pos, 20) + for k, object in ipairs(activation_area) do + if object:is_player() then + -- local player_pos = object:get_pos() + -- local player_hp = object:get_hp() - -- is in MMO Arena & health check - if minetest.global_exists('x_default') and x_default:isInMMOArena(player_pos) and player_hp > 0 then - -- play sound - minetest.sound_play("spawners_mobs_teleport", { - object = object, - gain = 1.0, - max_hear_distance = 20 - }) + -- is in MMO Arena & health check + -- if minetest.global_exists('x_default') and x_default:isInMMOArena(player_pos) and player_hp > 0 then + minetest.sound_play('spawners_mobs_teleport', { + object = object, + gain = 1.0, + max_hear_distance = 20 + }) - -- teleport player - object:set_pos(mob_pos) - end + -- teleport player + object:set_pos(mob_pos) + -- end - end - end - end - end + end + end + end + end } -mobs:register_mob("spawners_mobs:balrog", balrog_def) +mobs:register_mob('spawners_mobs:balrog', balrog_def) -- mobs:spawn({ --- name = "spawners_mobs:balrog", --- nodes = {"default:desert_sand", "default:desert_stone", "default:sand", "default:sandstone", "default:silver_sand"}, +-- name = 'spawners_mobs:balrog', +-- nodes = { 'default:desert_sand', 'default:desert_stone', 'default:sand', 'default:sandstone', 'default:silver_sand' }, -- min_light = 0, -- max_light = 20, -- chance = 2000, @@ -176,31 +193,31 @@ mobs:register_mob("spawners_mobs:balrog", balrog_def) -- day_toggle = false, -- }) -mobs:register_egg("spawners_mobs:balrog", "balrog", "default_coal_block.png", 1, true) +mobs:register_egg('spawners_mobs:balrog', 'balrog', 'default_coal_block.png', 1, true) -- shooting -mobs:register_arrow("spawners_mobs:balrog_firebolt", { - visual = "sprite", - visual_size = {x = 1, y = 1}, - textures = {"spawners_mobs_firebolt.png"}, - velocity = 15, +mobs:register_arrow('spawners_mobs:balrog_firebolt', { + visual = 'sprite', + visual_size = {x = 1, y = 1}, + textures = { 'spawners_mobs_firebolt.png' }, + velocity = 15, - -- direct hit, no fire... just plenty of pain - hit_player = function(self, player) - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 8}, - }, nil) - end, + -- direct hit, no fire... just plenty of pain + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 8}, + }, nil) + end, - hit_mob = function(self, player) - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 8}, - }, nil) - end, + hit_mob = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 8}, + }, nil) + end, - hit_node = function(self, pos, node) - -- minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="default:lava_flowing"}) - end + hit_node = function(self, pos, node) + -- minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, { name='default:lava_flowing' }) + end }) diff --git a/spawners_mobs/mob_bunny_evil.lua b/spawners_mobs/mob_bunny_evil.lua index 367638c..2a06e61 100644 --- a/spawners_mobs/mob_bunny_evil.lua +++ b/spawners_mobs/mob_bunny_evil.lua @@ -1,69 +1,87 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- Evil Bunny by ExeterDad local bunny_evil_def = { - type = "monster", - passive = false, - attack_type = "dogfight", - group_attack = true, - pathfinding = false, - reach = 3, - damage = 3, - hp_min = 35, - hp_max = 65, - armor = 100, - collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268}, - visual = "mesh", - mesh = "spawners_mobs_evil_bunny.b3d", - rotate = 0, - textures = { - {"spawners_mobs_evil_bunny.png"}, - }, - sounds = { - random = "spawners_mobs_bunny", - }, - makes_footstep_sound = false, - walk_velocity = 1.5, - run_velocity = 4, - view_range = 10, - jump = true, - floats = 1, - drops = { - {name = "mobs:meat_raw", chance = 5, min = 1, max = 1}, - }, - water_damage = 5, - lava_damage = 10, - light_damage = 10, - fear_height = 3, - animation = { - speed_normal = 15, - stand_start = 1, - stand_end = 15, - walk_start = 16, - walk_end = 24, - punch_start = 16, - punch_end = 24, - }, - -- follow = {"mobs:lava_orb"}, - -- on_rightclick = function(self, clicker) + type = 'monster', + passive = false, + attack_type = 'dogfight', + group_attack = true, + pathfinding = false, + reach = 3, + damage = 3, + hp_min = 35, + hp_max = 65, + armor = 100, + collisionbox = { -0.268, -0.5, -0.268, 0.268, 0.167, 0.268 }, + visual = 'mesh', + mesh = 'spawners_mobs_evil_bunny.b3d', + rotate = 0, + textures = { + { 'spawners_mobs_evil_bunny.png' }, + }, + sounds = { + random = 'spawners_mobs_bunny', + }, + makes_footstep_sound = false, + walk_velocity = 1.5, + run_velocity = 4, + view_range = 10, + jump = true, + floats = 1, + drops = { + { name = 'mobs:meat_raw', chance = 5, min = 1, max = 1 }, + }, + water_damage = 5, + lava_damage = 10, + light_damage = 10, + fear_height = 3, + animation = { + speed_normal = 15, + stand_start = 1, + stand_end = 15, + walk_start = 16, + walk_end = 24, + punch_start = 16, + punch_end = 24, + }, + -- follow = {'mobs:lava_orb'}, + -- on_rightclick = function(self, clicker) - -- if mobs:feed_tame(self, clicker, 3, true, true) then - -- return - -- end + -- if mobs:feed_tame(self, clicker, 3, true, true) then + -- return + -- end - -- mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) - -- end, + -- mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) + -- end, } -mobs:register_mob("spawners_mobs:bunny_evil", bunny_evil_def) +mobs:register_mob('spawners_mobs:bunny_evil', bunny_evil_def) mobs:spawn({ - name = "spawners_mobs:bunny_evil", - nodes = {"default:snowblock", "default:dirt_with_snow", "default:ice"}, - chance = 7000, - min_light = 0, - max_light = 14, - active_object_count = 1, - day_toggle = false, + name = 'spawners_mobs:bunny_evil', + nodes = { 'default:snowblock', 'default:dirt_with_snow', 'default:ice' }, + chance = 7000, + min_light = 0, + max_light = 14, + active_object_count = 1, + day_toggle = false, }) -mobs:register_egg("spawners_mobs:bunny_evil", "Evil Bunny", "spawners_mobs_evil_bunny_egg.png", 0) +mobs:register_egg('spawners_mobs:bunny_evil', 'Evil Bunny', 'spawners_mobs_evil_bunny_egg.png', 0) diff --git a/spawners_mobs/mob_mummy.lua b/spawners_mobs/mob_mummy.lua index e15381c..b193dd3 100644 --- a/spawners_mobs/mob_mummy.lua +++ b/spawners_mobs/mob_mummy.lua @@ -1,176 +1,194 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- modified Sand Monster by PilzAdam with Mummy by BlockMen local mummy_def = { - type = "monster", - passive = false, - pathfinding = false, - attack_type = "dogshoot", - -- owner_loyal = true, - shoot_interval = 2, - dogshoot_switch = 1, - dogshoot_count_max = 10, - arrow = "spawners_mobs:black_skull", - shoot_offset = 2, - reach = 3, - damage = 5, - hp_min = 60, - hp_max = 120, - armor = 100, - collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4}, - visual = "mesh", - mesh = "spawners_mobs_mummy.b3d", - textures = { - {"spawners_mobs_mummy.png"}, - }, - makes_footstep_sound = true, - sounds = { - random = "spawners_mobs_mummy_neutral", - damage = "spawners_mobs_mummy_hit", - shoot_attack = "spawners_mobs_mummy_spell", - attack = "spawners_mobs_mummy_attack", - death = "spawners_mobs_mummy_death", - distance = 15 - }, - walk_velocity = .75, - run_velocity = 1.5, - view_range = 16, - jump = true, - floats = 1, - drops = { - {name = "default:sandstonebrick", chance = 5, min = 1, max = 2}, - {name = "spawners_mobs:deco_stone_eye", chance = 25, min = 1, max = 1}, - {name = "spawners_mobs:deco_stone_men", chance = 25, min = 1, max = 1}, - {name = "spawners_mobs:deco_stone_sun", chance = 25, min = 1, max = 1}, - {name = "spawners_mobs:deco_stone_bird", chance = 25, min = 1, max = 1}, - {name = "default:diamond", chance = 3, min = 1, max = 2}, - {name = "default:mese_crystal", chance = 3, min = 1, max = 2}, - {name = "spawners_mobs:mummy", chance = 25, min = 1, max = 1}, - }, - water_damage = 5, - lava_damage = 10, - light_damage = 10, - fear_height = 3, - animation = { - speed_normal = 15, - speed_run = 15, - stand_start = 0, - stand_end = 39, - walk_start = 41, - walk_end = 72, - run_start = 74, - run_end = 105, - punch_start = 74, - punch_end = 105, - }, - -- follow = {"spawners_mobs:deco_stone_eye","spawners_mobs:deco_stone_men","spawners_mobs:deco_stone_sun","spawners_mobs:deco_stone_bird"}, - on_die = function(self, pos) - minetest.sound_play("spawners_mobs_mummy_death", { - object = self.object, - pos = pos, - max_hear_distance = 8 - }) - end, - _timer = 0, - _random_trigger = 5, - do_custom = function(self, dtime) - if not self._timer then - self._timer = 0 - end + type = 'monster', + passive = false, + pathfinding = false, + attack_type = 'dogshoot', + -- owner_loyal = true, + shoot_interval = 2, + dogshoot_switch = 1, + dogshoot_count_max = 10, + arrow = 'spawners_mobs:black_skull', + shoot_offset = 2, + reach = 3, + damage = 5, + hp_min = 60, + hp_max = 120, + armor = 100, + collisionbox = { -0.4, -1, -0.4, 0.4, 0.8, 0.4 }, + visual = 'mesh', + mesh = 'spawners_mobs_mummy.b3d', + textures = { + { 'spawners_mobs_mummy.png' }, + }, + makes_footstep_sound = true, + sounds = { + random = 'spawners_mobs_mummy_neutral', + damage = 'spawners_mobs_mummy_hit', + shoot_attack = 'spawners_mobs_mummy_spell', + attack = 'spawners_mobs_mummy_attack', + death = 'spawners_mobs_mummy_death', + distance = 15 + }, + walk_velocity = .75, + run_velocity = 1.5, + view_range = 16, + jump = true, + floats = 1, + drops = { + {name = 'default:sandstonebrick', chance = 5, min = 1, max = 2 }, + {name = 'spawners_mobs:deco_stone_eye', chance = 25, min = 1, max = 1 }, + {name = 'spawners_mobs:deco_stone_men', chance = 25, min = 1, max = 1 }, + {name = 'spawners_mobs:deco_stone_sun', chance = 25, min = 1, max = 1 }, + {name = 'spawners_mobs:deco_stone_bird', chance = 25, min = 1, max = 1 }, + {name = 'default:diamond', chance = 3, min = 1, max = 2 }, + {name = 'default:mese_crystal', chance = 3, min = 1, max = 2 }, + {name = 'spawners_mobs:mummy', chance = 25, min = 1, max = 1 }, + }, + water_damage = 5, + lava_damage = 10, + light_damage = 10, + fear_height = 3, + animation = { + speed_normal = 15, + speed_run = 15, + stand_start = 0, + stand_end = 39, + walk_start = 41, + walk_end = 72, + run_start = 74, + run_end = 105, + punch_start = 74, + punch_end = 105, + }, + -- follow = { 'spawners_mobs:deco_stone_eye','spawners_mobs:deco_stone_men','spawners_mobs:deco_stone_sun','spawners_mobs:deco_stone_bird' }, + on_die = function(self, pos) + minetest.sound_play('spawners_mobs_mummy_death', { + object = self.object, + pos = pos, + max_hear_distance = 8 + }) + end, + _timer = 0, + _random_trigger = 5, + do_custom = function(self, dtime) + if not self._timer then + self._timer = 0 + end - if not self._random_trigger then - self._random_trigger = math.random(5, 20) - end + if not self._random_trigger then + self._random_trigger = math.random(5, 15) + end - self._timer = self._timer + dtime + self._timer = self._timer + dtime - if self._timer > self._random_trigger then - self._timer = 0 - self._random_trigger = math.random(5, 20) + if self._timer > self._random_trigger then + self._timer = 0 + self._random_trigger = math.random(5, 15) - if not self.attack then - return - end + if not self.attack then + return + end - local mob_pos = self.object:get_pos() - local player_pos = self.attack:get_pos() - local distance = vector.distance(mob_pos, player_pos) + local mob_pos = self.object:get_pos() + local player_pos = self.attack:get_pos() + local distance = vector.distance(mob_pos, player_pos) - -- don't teleport when closer than 'reach' distance in mod def - if distance <= 3 then - return - end + -- don't teleport when closer than 'reach' distance in mod def + if distance <= 3 then + return + end - if self.attack:is_player() then - -- health check - if self.attack:get_hp() > 0 then - -- play sound - minetest.sound_play("spawners_mobs_teleport", { - object = self.object, - gain = 1.0, - max_hear_distance = 20 - }) + if self.attack:is_player() then + -- health check + if self.attack:get_hp() > 0 then + -- play sound + minetest.sound_play('spawners_mobs_teleport', { + object = self.object, + gain = 1.0, + max_hear_distance = 20 + }) - local player_look_dir = self.attack:get_look_dir() - player_look_dir.y = 1 - local to_pos = vector.add(player_pos, player_look_dir) + local player_look_dir = self.attack:get_look_dir() + player_look_dir.y = 1 + local to_pos = vector.add(player_pos, player_look_dir) - -- teleport player - self.object:set_pos(to_pos) - end - end + -- teleport to player + self.object:set_pos(to_pos) + end + end - end - end, - -- on_rightclick = function(self, clicker) + end + end, + -- on_rightclick = function(self, clicker) - -- if mobs:feed_tame(self, clicker, 8, true, true) then - -- return - -- end + -- if mobs:feed_tame(self, clicker, 8, true, true) then + -- return + -- end - -- mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) - -- end, + -- mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) + -- end, } -mobs:register_mob("spawners_mobs:mummy", mummy_def) +mobs:register_mob('spawners_mobs:mummy', mummy_def) mobs:spawn({ - name = "spawners_mobs:mummy", - nodes = {"default:desert_sand", "default:sand"}, - chance = 7000, - min_light = 0, - max_light = 14, - active_object_count = 1, - day_toggle = false, + name = 'spawners_mobs:mummy', + nodes = { 'default:desert_sand', 'default:sand' }, + chance = 7000, + min_light = 0, + max_light = 14, + active_object_count = 1, + day_toggle = false, }) -mobs:register_egg("spawners_mobs:mummy", "Mummy Monster", "default_sandstone_brick.png", 1) +mobs:register_egg('spawners_mobs:mummy', 'Mummy Monster', 'default_sandstone_brick.png', 1) -- black skull shooting -mobs:register_arrow("spawners_mobs:black_skull", { - visual = "sprite", - visual_size = {x = 1, y = 1}, - textures = {"spawners_mobs_black_skull.png"}, - velocity = 7, - tail = 1, - tail_texture = "spawners_mobs_black_skull.png", - glow = 5, - -- tail_size = 10, +mobs:register_arrow('spawners_mobs:black_skull', { + visual = 'sprite', + visual_size = { x = 1, y = 1 }, + textures = { 'spawners_mobs_black_skull.png' }, + velocity = 7, + tail = 1, + tail_texture = 'spawners_mobs_black_skull.png', + glow = 5, + -- tail_size = 10, - -- direct hit, no fire... just plenty of pain - hit_player = function(self, player) - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 8}, - }, nil) - end, + -- direct hit, no fire... just plenty of pain + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = { fleshy = 8 }, + }, nil) + end, - hit_mob = function(self, player) - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 8}, - }, nil) - end, + hit_mob = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = { fleshy = 8 }, + }, nil) + end, - hit_node = function(self, pos, node) - end + hit_node = function(self, pos, node) + end }) diff --git a/spawners_mobs/mob_uruk_hai.lua b/spawners_mobs/mob_uruk_hai.lua index ae3b43f..a86b024 100644 --- a/spawners_mobs/mob_uruk_hai.lua +++ b/spawners_mobs/mob_uruk_hai.lua @@ -1,74 +1,92 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- uruk_hai local uruk_hai_def = { - type = "monster", - docile_by_day = true, - passive = false, - hp_min = 40, - hp_max = 65, - pathfinding = false, - attack_type = "dogfight", - group_attack = true, - reach = 3, - damage = 6, - armor = 100, - collisionbox = {-0.3,-1.0,-0.3, 0.3,0.8,0.3}, - visual = "mesh", - mesh = "spawners_mobs_character.b3d", - drawtype = "front", - textures = { - {"spawners_mobs_uruk_hai.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - {"spawners_mobs_uruk_hai_1.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - {"spawners_mobs_uruk_hai_2.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - {"spawners_mobs_uruk_hai_3.png", "spawners_mobs_trans.png","spawners_mobs_galvornsword.png", "spawners_mobs_trans.png"}, - }, - makes_footstep_sound = true, - sounds = { - random = "spawners_mobs_uruk_hai_neutral", - death = "spawners_mobs_uruk_hai_death", - attack = "spawners_mobs_uruk_hai_attack", - damage = "spawners_mobs_uruk_hai_hit", - distance = 15 - }, - walk_velocity = 2, - run_velocity = 4, - view_range = 10, - jump = true, - floats = 1, - drops = { - {name = "default:apple", chance = 3, min = 1, max = 2}, - {name = "default:wood", chance = 4, min = 1, max = 2}, - {name = "default:stick", chance = 2, min = 1, max = 2}, - {name = "default:torch", chance = 3, min = 1, max = 2}, - {name = "default:sword_bronze", chance = 5, min = 1, max = 1}, - {name = "default:sword_mese", chance = 6, min = 1, max = 1}, - {name = "obsidianmese:sword_engraved", chance = 20, min = 1, max = 1}, - {name = "bones:bones", chance = 5, min = 1, max = 1}, - {name = "spawners_mobs:uruk_hai", chance = 20, min = 1, max = 1}, - }, - water_damage = 5, - lava_damage = 10, - light_damage = 0, - fear_height = 3, - animation = { - speed_normal = 15, - speed_run = 15, - stand_start = 0, - stand_end = 79, - walk_start = 168, - walk_end = 187, - run_start = 168, - run_end = 187, - punch_start = 189, - punch_end = 198, - }, + type = 'monster', + docile_by_day = true, + passive = false, + hp_min = 40, + hp_max = 65, + pathfinding = false, + attack_type = 'dogfight', + group_attack = true, + reach = 3, + damage = 6, + armor = 100, + collisionbox = { -0.3, -1.0, -0.3, 0.3, 0.8, 0.3 }, + visual = 'mesh', + mesh = 'spawners_mobs_character.b3d', + drawtype = 'front', + textures = { + { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + { 'spawners_mobs_uruk_hai_1.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + { 'spawners_mobs_uruk_hai_2.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + { 'spawners_mobs_uruk_hai_3.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' }, + }, + makes_footstep_sound = true, + sounds = { + random = 'spawners_mobs_uruk_hai_neutral', + death = 'spawners_mobs_uruk_hai_death', + attack = 'spawners_mobs_uruk_hai_attack', + damage = 'spawners_mobs_uruk_hai_hit', + distance = 15 + }, + walk_velocity = 2, + run_velocity = 4, + view_range = 10, + jump = true, + floats = 1, + drops = { + {name = 'default:apple', chance = 3, min = 1, max = 2 }, + {name = 'default:wood', chance = 4, min = 1, max = 2 }, + {name = 'default:stick', chance = 2, min = 1, max = 2 }, + {name = 'default:torch', chance = 3, min = 1, max = 2 }, + {name = 'default:sword_bronze', chance = 5, min = 1, max = 1 }, + {name = 'default:sword_mese', chance = 6, min = 1, max = 1 }, + {name = 'obsidianmese:sword_engraved', chance = 20, min = 1, max = 1 }, + {name = 'bones:bones', chance = 5, min = 1, max = 1 }, + {name = 'spawners_mobs:uruk_hai', chance = 20, min = 1, max = 1 }, + }, + water_damage = 5, + lava_damage = 10, + light_damage = 0, + fear_height = 3, + animation = { + speed_normal = 15, + speed_run = 15, + stand_start = 0, + stand_end = 79, + walk_start = 168, + walk_end = 187, + run_start = 168, + run_end = 187, + punch_start = 189, + punch_end = 198, + }, } -mobs:register_mob("spawners_mobs:uruk_hai", uruk_hai_def) +mobs:register_mob('spawners_mobs:uruk_hai', uruk_hai_def) -- mobs:spawn({ --- name = "spawners_mobs:uruk_hai", --- nodes = {"default:desert_sand", "default:desert_stone", "default:sand", "default:sandstone", "default:silver_sand"}, +-- name = 'spawners_mobs:uruk_hai', +-- nodes = { 'default:desert_sand', 'default:desert_stone', 'default:sand', 'default:sandstone', 'default:silver_sand' }, -- min_light = 0, -- max_light = 20, -- chance = 2000, @@ -76,4 +94,4 @@ mobs:register_mob("spawners_mobs:uruk_hai", uruk_hai_def) -- day_toggle = false, -- }) -mobs:register_egg("spawners_mobs:uruk_hai", "uruk_hai", "spawners_mobs_uruk_hai_egg.png", 0, true) +mobs:register_egg('spawners_mobs:uruk_hai', 'uruk_hai', 'spawners_mobs_uruk_hai_egg.png', 0, true) diff --git a/spawners_mobs/mod.conf b/spawners_mobs/mod.conf index 0f986e1..1227e45 100644 --- a/spawners_mobs/mod.conf +++ b/spawners_mobs/mod.conf @@ -1 +1,6 @@ name = spawners_mobs +description = Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. +depends = default +optional_depends = mobs, creatures, xpanes, fire, bones +supported_games = +min_minetest_version = 5.4 diff --git a/spawners_mobs/nodes_additional.lua b/spawners_mobs/nodes_additional.lua index 22f1694..e27f452 100644 --- a/spawners_mobs/nodes_additional.lua +++ b/spawners_mobs/nodes_additional.lua @@ -1,15 +1,33 @@ --- +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + +-- -- Decorative Carved Sand Stones --- +-- -local img = {"eye", "men", "sun", "bird"} +local img = { 'eye', 'men', 'sun', 'bird' } -for i=1, #img do - minetest.register_node("spawners_mobs:deco_stone_"..img[i], { - description = "Sandstone with "..img[i], - tiles = {"spawners_mobs_sandstone_carved_"..img[i]..".png"}, - is_ground_content = false, - groups = {cracky = 2}, - sounds = default.node_sound_stone_defaults(), - }) +for i = 1, #img do + minetest.register_node('spawners_mobs:deco_stone_' .. img[i], { + description = 'Sandstone with ' .. img[i], + tiles = { 'spawners_mobs_sandstone_carved_' .. img[i] .. '.png' }, + is_ground_content = false, + groups = { cracky = 2 }, + sounds = default.node_sound_stone_defaults(), + }) end diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.1.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.1.ogg index 0d3b7f2..43ce114 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.1.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_attack.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.2.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.2.ogg index 8a1e30b..8f186b8 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.2.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_attack.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.3.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.3.ogg index 216c507..6f8fc5a 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.3.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_attack.3.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.4.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.4.ogg deleted file mode 100644 index dc93093..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.4.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.5.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.5.ogg deleted file mode 100644 index b2219b2..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.5.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_attack.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_attack.ogg deleted file mode 100644 index a9a1c47..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_attack.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_death.1.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_death.1.ogg index f24abcc..08212b9 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_death.1.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_death.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_death.2.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_death.2.ogg index 2a041ac..0284e3e 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_death.2.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_death.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_death.3.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_death.3.ogg index a06245a..5326de9 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_death.3.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_death.3.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_death.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_death.ogg deleted file mode 100644 index a62cf78..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_death.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_hit.1.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_hit.1.ogg index f37d9fc..7957129 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_hit.1.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_hit.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_hit.2.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_hit.2.ogg index 418645a..164162f 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_hit.2.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_hit.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_hit.3.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_hit.3.ogg index 59642ad..f867bb9 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_hit.3.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_hit.3.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_hit.4.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_hit.4.ogg deleted file mode 100644 index 4a564e7..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_hit.4.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_hit.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_hit.ogg deleted file mode 100644 index 93021d0..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_hit.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.1.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.1.ogg index 3f8bf6e..daf43b7 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.1.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.2.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.2.ogg index 169a7b2..74741a0 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.2.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.3.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.3.ogg new file mode 100644 index 0000000..2e40bbc Binary files /dev/null and b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.3.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_neutral.ogg deleted file mode 100644 index 914bf9c..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_neutral.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_spell.1.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_spell.1.ogg index 46a7095..23c2fed 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_spell.1.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_spell.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_spell.2.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_spell.2.ogg index 56e4e65..073a175 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_spell.2.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_spell.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_spell.3.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_spell.3.ogg index 14251f2..129921f 100644 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_spell.3.ogg and b/spawners_mobs/sounds/spawners_mobs_mummy_spell.3.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_spell.4.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_spell.4.ogg deleted file mode 100644 index 4443de6..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_spell.4.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_mummy_spell.ogg b/spawners_mobs/sounds/spawners_mobs_mummy_spell.ogg deleted file mode 100644 index d904b33..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_mummy_spell.ogg and /dev/null differ diff --git a/spawners_mobs/sounds/spawners_mobs_teleport.1.ogg b/spawners_mobs/sounds/spawners_mobs_teleport.1.ogg new file mode 100644 index 0000000..4231888 Binary files /dev/null and b/spawners_mobs/sounds/spawners_mobs_teleport.1.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_teleport.2.ogg b/spawners_mobs/sounds/spawners_mobs_teleport.2.ogg new file mode 100644 index 0000000..9039a08 Binary files /dev/null and b/spawners_mobs/sounds/spawners_mobs_teleport.2.ogg differ diff --git a/spawners_mobs/sounds/spawners_mobs_teleport.ogg b/spawners_mobs/sounds/spawners_mobs_teleport.ogg deleted file mode 100644 index 8fa1884..0000000 Binary files a/spawners_mobs/sounds/spawners_mobs_teleport.ogg and /dev/null differ diff --git a/spawners_mobs/spawners_mobs.lua b/spawners_mobs/spawners_mobs.lua index 9237ac5..121013a 100644 --- a/spawners_mobs/spawners_mobs.lua +++ b/spawners_mobs/spawners_mobs.lua @@ -1,145 +1,163 @@ +--[[ + Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- -- CREATE ALL SPAWNERS NODES -- function spawners_mobs.create(mob_table, idx) - local mob_name = mob_table.name - local mod_prefix = mob_table.mod_prefix - local size = mob_table.dummy_size - local mesh = mob_table.dummy_mesh - local texture = mob_table.dummy_texture + local mob_name = mob_table.name + local mod_prefix = mob_table.mod_prefix + local size = mob_table.dummy_size + local mesh = mob_table.dummy_mesh + local texture = mob_table.dummy_texture - -- - -- DUMMY INSIDE THE SPAWNER - -- - minetest.register_entity("spawners_mobs:dummy_"..mod_prefix.."_"..mob_name, { - hp_max = 1, - visual = "mesh", - visual_size = size, - collisionbox = {0,0,0,0,0,0}, - mesh = mesh, - textures = texture, - physical = false, - makes_footstep_sound = false, - automatic_rotate = math.pi * -3, - static_save = false, + -- + -- DUMMY INSIDE THE SPAWNER + -- + minetest.register_entity('spawners_mobs:dummy_' .. mod_prefix .. '_' .. mob_name, { + hp_max = 1, + visual = 'mesh', + visual_size = size, + collisionbox = { 0, 0, 0, 0, 0, 0 }, + mesh = mesh, + textures = texture, + physical = false, + makes_footstep_sound = false, + automatic_rotate = math.pi * -3, + static_save = false, - on_activate = function(self, staticdata, dtime_s) - self.object:set_velocity({x = 0, y = 0, z = 0}) - self.object:set_acceleration({x = 0, y = 0, z = 0}) - self.object:set_armor_groups({immortal = 1}) - end - }) + on_activate = function(self, staticdata, dtime_s) + self.object:set_velocity({ x = 0, y = 0, z = 0 }) + self.object:set_acceleration({ x = 0, y = 0, z = 0 }) + self.object:set_armor_groups({ immortal = 1 }) + end + }) - -- - -- DEFAULT SPAWNER - -- - minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner", { - description = mod_prefix.."_"..mob_name.." spawner", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - sunlight_propagates = true, - tiles = {"spawners_mobs_spawner_16.png"}, - is_ground_content = false, - groups = {cracky=1,level=2}, - stack_max = 1, - light_source = 6, + -- + -- DEFAULT SPAWNER + -- + minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner', { + description = mod_prefix .. '_' .. mob_name .. ' spawner', + paramtype = 'light', + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + sunlight_propagates = true, + tiles = { 'spawners_mobs_spawner_16.png' }, + is_ground_content = false, + groups = { cracky = 1, level = 2 }, + stack_max = 1, + light_source = 6, - on_timer = spawners_mobs.on_timer, + on_timer = spawners_mobs.on_timer, - on_construct = function(pos) - -- set meta - local meta = minetest.get_meta(pos) - meta:set_int("idx", idx) - meta:set_int("tick", 0) - meta:set_int("tick_short", 0) + on_construct = function(pos) + -- set meta + local meta = minetest.get_meta(pos) + meta:set_int('idx', idx) + meta:set_int('tick', 0) + meta:set_int('tick_short', 0) - spawners_mobs.set_status(pos, "active") - spawners_mobs.tick_short(pos) - end, + spawners_mobs.set_status(pos, 'active') + spawners_mobs.tick_short(pos) + end, - after_place_node = function(pos, placer, itemstack, pointed_thing) - local meta = minetest.get_meta(pos) - meta:set_string("owner", placer:get_player_name()) + after_place_node = function(pos, placer, itemstack, pointed_thing) + local meta = minetest.get_meta(pos) + meta:set_string('owner', placer:get_player_name()) - meta:set_string("infotext", mob_name.." spawner\nowner: "..placer:get_player_name().."\nspawner is active") - end, + meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. placer:get_player_name() .. '\nspawner is active') + end, - on_destruct = function(pos) - -- delete particles and remove dummy - spawners_mobs.set_status(pos, "waiting") - end - }) + on_destruct = function(pos) + -- delete particles and remove dummy + spawners_mobs.set_status(pos, 'waiting') + end + }) - -- - -- WAITING SPAWNER - -- - minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_waiting", { - description = mod_prefix.."_"..mob_name.." spawner waiting", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - sounds = default.node_sound_metal_defaults(), - walkable = true, - sunlight_propagates = true, - tiles = { - { - name = "spawners_mobs_spawner_waiting_animated_16.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 2.0 - }, - } - }, - is_ground_content = false, - groups = {cracky=1,level=2,not_in_creative_inventory=1}, - light_source = 4, - drop = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner", + -- + -- WAITING SPAWNER + -- + minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting', { + description = mod_prefix .. '_' .. mob_name .. ' spawner waiting', + paramtype = 'light', + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + sounds = default.node_sound_metal_defaults(), + walkable = true, + sunlight_propagates = true, + tiles = { + { + name = 'spawners_mobs_spawner_waiting_animated_16.png', + animation = { + type = 'vertical_frames', + aspect_w = 16, + aspect_h = 16, + length = 2.0 + }, + } + }, + is_ground_content = false, + groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 }, + light_source = 4, + drop = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner', - on_timer = spawners_mobs.on_timer - }) + on_timer = spawners_mobs.on_timer + }) - -- - -- RUSTY SPAWNER - -- - minetest.register_node("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_rusty", { - description = mod_prefix.."_"..mob_name.." spawner rusty", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - sounds = default.node_sound_metal_defaults(), - walkable = true, - sunlight_propagates = true, - tiles = {"spawners_mobs_spawner_rusty.png"}, - is_ground_content = false, - groups = {cracky=1,level=2,not_in_creative_inventory=1}, - drop = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner" - }) + -- + -- RUSTY SPAWNER + -- + minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_rusty', { + description = mod_prefix .. '_' .. mob_name .. ' spawner rusty', + paramtype = 'light', + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + sounds = default.node_sound_metal_defaults(), + walkable = true, + sunlight_propagates = true, + tiles = { 'spawners_mobs_spawner_rusty.png' }, + is_ground_content = false, + groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 }, + drop = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner' + }) - -- - -- replacement LBM for pre-nodetimer spawners - -- - minetest.register_lbm({ - name = "spawners_mobs:start_nodetimer_"..mod_prefix.."_"..mob_name.."_spawner", - nodenames = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner", - action = function(pos) - spawners_mobs.tick_short(pos) - end, - }) + -- + -- replacement LBM for pre-nodetimer spawners + -- + minetest.register_lbm({ + name = 'spawners_mobs:start_nodetimer_' .. mod_prefix .. '_' .. mob_name .. '_spawner', + nodenames = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner', + action = function(pos) + spawners_mobs.tick_short(pos) + end, + }) - -- - -- COMPATIBILITY - -- - minetest.register_alias("spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner_active", "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner") + -- + -- COMPATIBILITY + -- + minetest.register_alias('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active', 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner') end -- -- INIT 'CREATE' FOR ALL SPAWNERS -- for i, mob_table in ipairs(spawners_mobs.mob_tables) do - spawners_mobs.create(mob_table, i) + spawners_mobs.create(mob_table, i) end diff --git a/spawners_mobs/textures/spawners_mobs_balrog.png b/spawners_mobs/textures/spawners_mobs_balrog.png index a410ace..5923b07 100644 Binary files a/spawners_mobs/textures/spawners_mobs_balrog.png and b/spawners_mobs/textures/spawners_mobs_balrog.png differ diff --git a/spawners_mobs/textures/spawners_mobs_black_skull.png b/spawners_mobs/textures/spawners_mobs_black_skull.png index 65c8fa2..021f126 100644 Binary files a/spawners_mobs/textures/spawners_mobs_black_skull.png and b/spawners_mobs/textures/spawners_mobs_black_skull.png differ diff --git a/spawners_mobs/textures/spawners_mobs_evil_bunny.png b/spawners_mobs/textures/spawners_mobs_evil_bunny.png index 7b91372..484b08b 100644 Binary files a/spawners_mobs/textures/spawners_mobs_evil_bunny.png and b/spawners_mobs/textures/spawners_mobs_evil_bunny.png differ diff --git a/spawners_mobs/textures/spawners_mobs_firebolt.png b/spawners_mobs/textures/spawners_mobs_firebolt.png index ccc4704..29d2906 100644 Binary files a/spawners_mobs/textures/spawners_mobs_firebolt.png and b/spawners_mobs/textures/spawners_mobs_firebolt.png differ diff --git a/spawners_mobs/textures/spawners_mobs_flame_particle.png b/spawners_mobs/textures/spawners_mobs_flame_particle.png index c082b67..8eb130e 100644 Binary files a/spawners_mobs/textures/spawners_mobs_flame_particle.png and b/spawners_mobs/textures/spawners_mobs_flame_particle.png differ diff --git a/spawners_mobs/textures/spawners_mobs_galvornsword.png b/spawners_mobs/textures/spawners_mobs_galvornsword.png index edfaa2e..db00f8e 100644 Binary files a/spawners_mobs/textures/spawners_mobs_galvornsword.png and b/spawners_mobs/textures/spawners_mobs_galvornsword.png differ diff --git a/spawners_mobs/textures/spawners_mobs_mummy.png b/spawners_mobs/textures/spawners_mobs_mummy.png index 4c5834d..6f5ca3b 100644 Binary files a/spawners_mobs/textures/spawners_mobs_mummy.png and b/spawners_mobs/textures/spawners_mobs_mummy.png differ diff --git a/spawners_mobs/textures/spawners_mobs_sandstone_carved_bird.png b/spawners_mobs/textures/spawners_mobs_sandstone_carved_bird.png index 9d38fdb..3e38ee3 100644 Binary files a/spawners_mobs/textures/spawners_mobs_sandstone_carved_bird.png and b/spawners_mobs/textures/spawners_mobs_sandstone_carved_bird.png differ diff --git a/spawners_mobs/textures/spawners_mobs_sandstone_carved_eye.png b/spawners_mobs/textures/spawners_mobs_sandstone_carved_eye.png index 9fc44ac..6e7a27c 100644 Binary files a/spawners_mobs/textures/spawners_mobs_sandstone_carved_eye.png and b/spawners_mobs/textures/spawners_mobs_sandstone_carved_eye.png differ diff --git a/spawners_mobs/textures/spawners_mobs_sandstone_carved_men.png b/spawners_mobs/textures/spawners_mobs_sandstone_carved_men.png index f1ab423..7b2ab91 100644 Binary files a/spawners_mobs/textures/spawners_mobs_sandstone_carved_men.png and b/spawners_mobs/textures/spawners_mobs_sandstone_carved_men.png differ diff --git a/spawners_mobs/textures/spawners_mobs_sandstone_carved_sun.png b/spawners_mobs/textures/spawners_mobs_sandstone_carved_sun.png index 5a46d89..1416b15 100644 Binary files a/spawners_mobs/textures/spawners_mobs_sandstone_carved_sun.png and b/spawners_mobs/textures/spawners_mobs_sandstone_carved_sun.png differ diff --git a/spawners_mobs/textures/spawners_mobs_smoke_particle_2.png b/spawners_mobs/textures/spawners_mobs_smoke_particle_2.png index baf704d..0b1efbf 100644 Binary files a/spawners_mobs/textures/spawners_mobs_smoke_particle_2.png and b/spawners_mobs/textures/spawners_mobs_smoke_particle_2.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner.png b/spawners_mobs/textures/spawners_mobs_spawner.png index 331b2ba..6403dc6 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner.png and b/spawners_mobs/textures/spawners_mobs_spawner.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner_16.png b/spawners_mobs/textures/spawners_mobs_spawner_16.png index c6f0bbe..53ad856 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner_16.png and b/spawners_mobs/textures/spawners_mobs_spawner_16.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner_animated.png b/spawners_mobs/textures/spawners_mobs_spawner_animated.png index fc3adad..2617a36 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner_animated.png and b/spawners_mobs/textures/spawners_mobs_spawner_animated.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner_rusty.png b/spawners_mobs/textures/spawners_mobs_spawner_rusty.png index a242b99..25ba6d6 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner_rusty.png and b/spawners_mobs/textures/spawners_mobs_spawner_rusty.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated.png b/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated.png index 1297b3d..ea7669a 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated.png and b/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated.png differ diff --git a/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated_16.png b/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated_16.png index 135694a..aba8062 100644 Binary files a/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated_16.png and b/spawners_mobs/textures/spawners_mobs_spawner_waiting_animated_16.png differ diff --git a/spawners_mobs/textures/spawners_mobs_trans.png b/spawners_mobs/textures/spawners_mobs_trans.png index 849e622..d58bd90 100644 Binary files a/spawners_mobs/textures/spawners_mobs_trans.png and b/spawners_mobs/textures/spawners_mobs_trans.png differ diff --git a/spawners_mobs/textures/spawners_mobs_uruk_hai.png b/spawners_mobs/textures/spawners_mobs_uruk_hai.png index 0b1291f..e068359 100644 Binary files a/spawners_mobs/textures/spawners_mobs_uruk_hai.png and b/spawners_mobs/textures/spawners_mobs_uruk_hai.png differ diff --git a/spawners_mobs/textures/spawners_mobs_uruk_hai_1.png b/spawners_mobs/textures/spawners_mobs_uruk_hai_1.png index c882bfc..5cb822f 100644 Binary files a/spawners_mobs/textures/spawners_mobs_uruk_hai_1.png and b/spawners_mobs/textures/spawners_mobs_uruk_hai_1.png differ diff --git a/spawners_mobs/textures/spawners_mobs_uruk_hai_2.png b/spawners_mobs/textures/spawners_mobs_uruk_hai_2.png index 5a7cae0..908e2d2 100644 Binary files a/spawners_mobs/textures/spawners_mobs_uruk_hai_2.png and b/spawners_mobs/textures/spawners_mobs_uruk_hai_2.png differ diff --git a/spawners_mobs/textures/spawners_mobs_uruk_hai_3.png b/spawners_mobs/textures/spawners_mobs_uruk_hai_3.png index 219e06d..5eb6a3a 100644 Binary files a/spawners_mobs/textures/spawners_mobs_uruk_hai_3.png and b/spawners_mobs/textures/spawners_mobs_uruk_hai_3.png differ diff --git a/spawners_mobs/textures/spawners_mobs_uruk_hai_egg.png b/spawners_mobs/textures/spawners_mobs_uruk_hai_egg.png index fb56d1c..89e5f14 100644 Binary files a/spawners_mobs/textures/spawners_mobs_uruk_hai_egg.png and b/spawners_mobs/textures/spawners_mobs_uruk_hai_egg.png differ diff --git a/spawners_ores/LICENSE.txt b/spawners_ores/LICENSE.txt new file mode 100644 index 0000000..ef08d4f --- /dev/null +++ b/spawners_ores/LICENSE.txt @@ -0,0 +1,487 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 2016 - 2023 SaKeL + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. 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 not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the 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 +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### Code + +GNU Lesser General Public License v2.1 or later (see included LICENSE file) + +### Textures + +**CC-BY-SA-4.0, by SaKeL** + +- spawners_ores_stone_with_copper.png -- Derived from texture by Cisoun and Celeron55 (CC BY-SA 3.0) +- spawners_ores_stone_with_gold.png -- Derived from texture by Cisoun and Celeron55 (CC BY-SA 3.0) +- spawners_ores_stone_with_iron.png -- Derived from texture by Cisoun and Celeron55 (CC BY-SA 3.0) +- spawners_ores_stone_with_tin.png -- Derived from texture by Cisoun and Celeron55 (CC BY-SA 3.0) +- spawners_ores_ingot_slot.png +- spawners_ores_spawner_16.png +- spawners_ores_spawner_animated_16.png +- spawners_ores_spawner_animated_lava_16.png +- spawners_ores_spawner_animated_magma_16.png +- spawners_ores_spawner_animated.png +- spawners_ores_spawner_waiting_animated_16.png +- spawners_ores_spawner_waiting_animated.png +- spawners_ores_spawner.png + +**CC-BY-SA-4.0, Pixel Perfection by XSSheep**, https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated + +- spawners_ores_smoke_particle.png + +### Sound + +**CC0-1.0, JarredGibb**, https://freesound.org/people/JarredGibb/sounds/248237/ + +- spawners_ores_strike.ogg diff --git a/spawners_ores/api.lua b/spawners_ores/api.lua index 353ece6..5f10092 100644 --- a/spawners_ores/api.lua +++ b/spawners_ores/api.lua @@ -1,267 +1,282 @@ +--[[ + Ore spawners let player craft ore spawneres and get back lumps from ingots. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- main tables spawners_ores = {} local percent = 10 -- how often node timers for minerals will tick, +/- some random value function spawners_ores.tick(pos) - minetest.get_node_timer(pos):start(math.random(30, 60)) + minetest.get_node_timer(pos):start(math.random(30, 60)) end -- how often a growth failure tick is retried (e.g. not enough place to spawn minerals) function spawners_ores.tick_short(pos) - minetest.get_node_timer(pos):start(math.random(15, 20)) + minetest.get_node_timer(pos):start(math.random(15, 20)) end -- adds smoke particles function spawners_ores.add_effects(pos, radius) - minetest.add_particlespawner({ - amount = 32, - time = 2, - minpos = vector.subtract({x=pos.x, y=pos.y+1, z=pos.z}, radius / 2), - maxpos = vector.add({x=pos.x, y=pos.y+1, z=pos.z}, radius / 2), - minvel = {x=-0.5, y=3, z=-0.5}, - maxvel = {x=0.5, y=10, z=0.5}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 0.5, - maxexptime = 2, - minsize = 0.5, - maxsize = 8, - texture = "spawners_ores_smoke_particle.png^[transform"..math.random(0,3) - }) + minetest.add_particlespawner({ + amount = 32, + time = 2, + minpos = vector.subtract({ x = pos.x, y = pos.y + 1, z = pos.z }, radius / 2), + maxpos = vector.add({ x = pos.x, y = pos.y + 1, z = pos.z }, radius / 2), + minvel = { x = -0.5, y = 3, z = -0.5 }, + maxvel = { x = 0.5, y = 10, z = 0.5 }, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.5, + maxexptime = 2, + minsize = 0.5, + maxsize = 8, + texture = 'spawners_ores_smoke_particle.png^[transform' .. math.random(0, 3) + }) end -- start spawning ores function spawners_ores.start_spawning_ores(pos, ore_name, how_many) - if not pos or not ore_name then return end - local player_near = false - local how_many = how_many or 1 + if not pos or not ore_name then return end + local _how_many = how_many or 1 - for i=1, how_many do - - if i > 1 then - pos = spawners_ores.get_available_node(pos, "default:stone") + for i = 1, _how_many do - if not pos then return end + if i > 1 then + pos = spawners_ores.get_available_node(pos, 'default:stone') - minetest.sound_play("spawners_ores_strike", { - pos = pos, - max_hear_distance = 16, - gain = 10, - }) + if not pos then return end - minetest.set_node(pos, {name=ore_name}) - spawners_ores.add_effects(pos, 1) - else - minetest.sound_play("spawners_ores_strike", { - pos = pos, - max_hear_distance = 16, - gain = 10, - }) + minetest.sound_play('spawners_ores_strike', { + pos = pos, + max_hear_distance = 16, + gain = 10, + }) + + minetest.set_node(pos, { name = ore_name }) + spawners_ores.add_effects(pos, 1) + else + minetest.sound_play('spawners_ores_strike', { + pos = pos, + max_hear_distance = 16, + gain = 10, + }) + + minetest.set_node(pos, { name = ore_name }) + spawners_ores.add_effects(pos, 1) + end + end - minetest.set_node(pos, {name=ore_name}) - spawners_ores.add_effects(pos, 1) - end - end - end function spawners_ores.get_available_node(pos, check_node, radius) - if not pos then return end + if not pos then return end - local check_node = check_node or "default:stone" - local radius = radius or 2 + local _check_node = check_node or 'default:stone' + local _radius = radius or 2 - local node_ore_pos = minetest.find_node_near(pos, radius, {check_node}) - - if node_ore_pos and node_ore_pos ~= nil then - return node_ore_pos - else - return false - end + local node_ore_pos = minetest.find_node_near(pos, _radius, { _check_node }) + + if node_ore_pos and node_ore_pos ~= nil then + return node_ore_pos + else + return false + end end -- build form for spawners function spawners_ores.get_formspec(pos, table) - -- Inizialize metadata and variables - local table = table or {} - local meta = minetest.get_meta(pos) - local mineral = table.ore or meta:get_string("mineral") - local ingot = table.ore or meta:get_string("mineral") - local status = meta:get_string("status") - local inv = meta:get_inventory() - local stack = inv:get_stack("fuel", 1) + -- Inizialize metadata and variables + local _table = table or {} + local meta = minetest.get_meta(pos) + local mineral = _table.ore or meta:get_string('mineral') + local ingot = _table.ore or meta:get_string('mineral') + local status = meta:get_string('status') + local inv = meta:get_inventory() + local stack = inv:get_stack('fuel', 1) - -- fix different Ingot namings - if ingot == "iron" then - ingot = "steel" - end + -- fix different Ingot namings + if ingot == 'iron' then + ingot = 'steel' + end - -- add extra ores based on percentage - local stack_per_obj = spawners_ores.stack_per({ - stack_count = stack:get_count(), - percent = percent - }) - local stack_per = stack_per_obj.stack_per or 0 - local extra_per = stack_per_obj.extra_per or 0 + -- add extra ores based on percentage + local stack_per_obj = spawners_ores.stack_per({ + stack_count = stack:get_count(), + percent = percent + }) + local stack_per = stack_per_obj.stack_per or 0 + local extra_per = stack_per_obj.extra_per or 0 - local colorize = { - gold = "^[colorize:#ffe4008C", - tin = "^[colorize:#d0d0d08C", - iron = "^[colorize:#b66d498C", - copper = "^[colorize:#b587528C", - } + local colorize = { + gold = '^[colorize:#ffe4008C', + tin = '^[colorize:#d0d0d08C', + iron = '^[colorize:#b66d498C', + copper = '^[colorize:#b587528C', + } - local colorize_arrow = "" - local button = "" + local colorize_arrow = '' + local button = '' - if status == "active" then - colorize_arrow = colorize[mineral] - elseif status == "waiting" then - button = "button[1.8,2.5;2,1.5;restart;RE-START]" - end - - -- dynamic formspec - local formspec = "size[8,8.5]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. - "label[1.8,0.3;Input "..ingot.." Ingot]".. - "list[current_name;fuel;1.8,1;1,1;]".. - "image[1.8,1;1,1;spawners_ores_ingot_slot.png]".. - "list[current_player;main;0,4.25;8,1;]".. - "list[current_player;main;0,5.5;8,3;8]".. - "image[2.9,1;1,1;gui_furnace_arrow_bg.png^[transformR270"..colorize_arrow.."]".. - "label[1.8,2;"..stack_per.." minerals ("..extra_per.." extra)]".. - "image[4,1;1,1;spawners_ores_stone_with_"..mineral..".png]".. - button.. - "listring[current_name;fuel]".. - "listring[current_player;main]".. - default.get_hotbar_bg(0, 4.25) + if status == 'active' then + colorize_arrow = colorize[mineral] + elseif status == 'waiting' then + button = 'button[1.8,2.5;2,1.5;restart;RE-START]' + end - meta:set_string("formspec", formspec) + -- dynamic formspec + local formspec = 'size[8,8.5]' .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + 'label[1.8,0.3;Input ' .. ingot .. ' Ingot]' .. + 'list[current_name;fuel;1.8,1;1,1;]' .. + 'image[1.8,1;1,1;spawners_ores_ingot_slot.png]' .. + 'list[current_player;main;0,4.25;8,1;]' .. + 'list[current_player;main;0,5.5;8,3;8]' .. + 'image[2.9,1;1,1;gui_furnace_arrow_bg.png^[transformR270' .. colorize_arrow .. ']' .. + 'label[1.8,2;' .. stack_per .. ' minerals (' .. extra_per .. ' extra)]' .. + 'image[4,1;1,1;spawners_ores_stone_with_' .. mineral .. '.png]' .. + button .. + 'listring[current_name;fuel]' .. + 'listring[current_player;main]' .. + default.get_hotbar_bg(0, 4.25) - -- infotext - local infotext = mineral.." fuel: "..inv:get_stack("fuel", 1):get_count() + meta:set_string('formspec', formspec) - if inv:is_empty("fuel") then - infotext = mineral.." ore spawner is empty." - elseif status == "waiting" then - infotext = "Waiting - no default:stone was found near by, "..mineral.." fuel: "..inv:get_stack("fuel", 1):get_count() - end + -- infotext + local infotext = mineral .. ' fuel: ' .. inv:get_stack('fuel', 1):get_count() - meta:set_string("infotext", infotext) + if inv:is_empty('fuel') then + infotext = mineral .. ' ore spawner is empty.' + elseif status == 'waiting' then + infotext = 'Waiting - no default:stone was found near by, ' .. mineral .. ' fuel: ' .. inv:get_stack('fuel', 1):get_count() + end + + meta:set_string('infotext', infotext) end -- check if is fuel empty in the node function spawners_ores.can_dig(pos, player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("fuel") + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty('fuel') end -- add extra percentage on top of the stack function spawners_ores.stack_per(table) - local table = table or {} - local stack_count = table.stack_count or nil - local extra_per = (stack_count / 100) * percent - - extra_per = math.floor(extra_per) - - local stack_per = extra_per + stack_count - - -- print(percent.."% from stack("..stack_count..") = "..stack_per.." ("..extra_per.." extra ore(s))") - - return { - stack_per = stack_per, - extra_per = extra_per - } + local _table = table or {} + local stack_count = _table.stack_count or nil + local extra_per = (stack_count / 100) * percent + + extra_per = math.floor(extra_per) + + local stack_per = extra_per + stack_count + + -- print(percent .. '% from stack(' .. stack_count .. ') = ' .. stack_per .. ' (' .. extra_per .. ' extra ore(s))') + + return { + stack_per = stack_per, + extra_per = extra_per + } end -- set status and update formspec/infotext function spawners_ores.on_timer(pos, elapsed) - - local available_node = spawners_ores.get_available_node(pos, "default:stone") - - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack("fuel", 1) - local how_many = 1 - local ore_name = meta:get_string("ore_name") - local mineral = meta:get_string("mineral") - local status = meta:get_string("status") - local tick = meta:get_int("tick") + local available_node = spawners_ores.get_available_node(pos, 'default:stone') - -- - -- active - -- - if available_node and inv:is_empty("fuel") ~= true then - -- make sure the right node status is shown - if status ~= "active" then - meta:set_string("status", "active") - - spawners_ores.get_formspec(pos) - minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner_active"}) - end + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack('fuel', 1) + local how_many = 1 - -- start spawning only on proper 'tick' - if tick ~= 0 then - if stack:get_count() % percent == 0 then - -- TODO: should get countent based on 'percent' - how_many = 2 - end + local ore_name = meta:get_string('ore_name') + local status = meta:get_string('status') + local tick = meta:get_int('tick') - -- enough place to spawn more ores - spawners_ores.start_spawning_ores(available_node, "default:"..ore_name, how_many) - - -- take fuel - stack:take_item() - inv:set_stack("fuel", 1, stack) + -- + -- active + -- + if available_node and inv:is_empty('fuel') ~= true then + -- make sure the right node status is shown + if status ~= 'active' then + meta:set_string('status', 'active') - spawners_ores.get_formspec(pos) - end + spawners_ores.get_formspec(pos) + minetest.swap_node(pos, { name = 'spawners_ores:' .. ore_name .. '_spawner_active' }) + end - -- dont wait for proper 'tick' and change state after 1 sec. - local next_available_node = spawners_ores.get_available_node(pos, "default:stone") + -- start spawning only on proper 'tick' + if tick ~= 0 then + if stack:get_count() % percent == 0 then + -- TODO: should get countent based on 'percent' + how_many = 2 + end - if inv:is_empty("fuel") or next_available_node == false then - minetest.get_node_timer(pos):start(1.0) - return - end + -- enough place to spawn more ores + spawners_ores.start_spawning_ores(available_node, 'default:' .. ore_name, how_many) - if tick == 0 then - -- start new proper timer - meta:set_int("tick", 1) - end - - -- start new proper timer - spawners_ores.tick(pos) - -- - -- default - -- - elseif inv:is_empty("fuel") then - -- empty / no fuel -- stop timer - -- make sure that default status/node is shown - meta:set_string("status", "") - minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner"}) - - spawners_ores.get_formspec(pos) - return + -- take fuel + stack:take_item() + inv:set_stack('fuel', 1, stack) - -- - -- waiting - -- - else - -- stop timer and show "refresh" button in order to start timer again - -- make sure that waiting status/node is shown - if status ~= "waiting" then - meta:set_string("status", "waiting") - minetest.swap_node(pos, {name="spawners_ores:"..ore_name.."_spawner_waiting"}) - end + spawners_ores.get_formspec(pos) + end - spawners_ores.get_formspec(pos) - return - end + -- dont wait for proper 'tick' and change state after 1 sec. + local next_available_node = spawners_ores.get_available_node(pos, 'default:stone') + if inv:is_empty('fuel') or next_available_node == false then + minetest.get_node_timer(pos):start(1.0) + return + end + + if tick == 0 then + -- start new proper timer + meta:set_int('tick', 1) + end + + -- start new proper timer + spawners_ores.tick(pos) + -- + -- default + -- + elseif inv:is_empty('fuel') then + -- empty / no fuel -- stop timer + -- make sure that default status/node is shown + meta:set_string('status', '') + minetest.swap_node(pos, { name = 'spawners_ores:' .. ore_name .. '_spawner' }) + + spawners_ores.get_formspec(pos) + return + + -- + -- waiting + -- + else + -- stop timer and show 'refresh' button in order to start timer again + -- make sure that waiting status/node is shown + if status ~= 'waiting' then + meta:set_string('status', 'waiting') + minetest.swap_node(pos, { name = 'spawners_ores:' .. ore_name .. '_spawner_waiting' }) + end + + spawners_ores.get_formspec(pos) + return + end end diff --git a/spawners_ores/depends.txt b/spawners_ores/depends.txt deleted file mode 100644 index 8754ca5..0000000 --- a/spawners_ores/depends.txt +++ /dev/null @@ -1,3 +0,0 @@ -default -xpanes? -fire? \ No newline at end of file diff --git a/spawners_ores/description.txt b/spawners_ores/description.txt deleted file mode 100644 index 7e2f7e1..0000000 --- a/spawners_ores/description.txt +++ /dev/null @@ -1 +0,0 @@ -This MOD for Minetest let the player craft ore Spawners. Ores are spawning randomly in a short intervals and you get 10% more ores from inputed ingots. This MOD is giving the option of creating lumps back from ingots. diff --git a/spawners_ores/init.lua b/spawners_ores/init.lua index 1a976f2..c610633 100644 --- a/spawners_ores/init.lua +++ b/spawners_ores/init.lua @@ -1,9 +1,30 @@ -MOD_NAME = minetest.get_current_modname() +--[[ + Ore spawners let player craft ore spawneres and get back lumps from ingots. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + +local mod_start_time = minetest.get_us_time() +local path = minetest.get_modpath('spawners_ores') -- API -dofile(minetest.get_modpath(MOD_NAME).."/api.lua") +dofile(path .. '/api.lua') -- Spawners for ores -dofile(minetest.get_modpath(MOD_NAME).."/spawners_ores.lua") +dofile(path .. '/spawners_ores.lua') -print ("[Mod] Spawners Ores Loaded.") +local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000 + +print('[Mod] Spawners Ores Loaded. [' .. mod_end_time .. 's]') diff --git a/spawners_ores/mod.conf b/spawners_ores/mod.conf index b2a15b8..99d1020 100644 --- a/spawners_ores/mod.conf +++ b/spawners_ores/mod.conf @@ -1 +1,6 @@ name = spawners_ores +description = Let the player craft ore Spawners. Ores are spawning randomly in a short intervals and you get 10% more ores from inputed ingots. This MOD is giving the option of creating lumps back from ingots. +depends = default +optional_depends = xpanes, fire +supported_games = +min_minetest_version = 5.4 diff --git a/spawners_ores/spawners_ores.lua b/spawners_ores/spawners_ores.lua index 21e38d5..dda154f 100644 --- a/spawners_ores/spawners_ores.lua +++ b/spawners_ores/spawners_ores.lua @@ -1,12 +1,30 @@ +--[[ + Ore spawners let player craft ore spawneres and get back lumps from ingots. + Copyright (C) 2016 - 2023 SaKeL + + This library is free software; you can redistribute it and/or + modify it pos the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to juraj.vajda@gmail.com +--]] + -- -- Colorize HEX -- local colorize = { - stone_with_gold = "^[colorize:#ffe40033", - stone_with_tin = "^[colorize:#d0d0d040", - stone_with_iron = "^[colorize:#b66d4940", - stone_with_copper = "^[colorize:#b5875240", + stone_with_gold = '^[colorize:#ffe40033', + stone_with_tin = '^[colorize:#d0d0d040', + stone_with_iron = '^[colorize:#b66d4940', + stone_with_copper = '^[colorize:#b5875240', } -- @@ -15,46 +33,46 @@ local colorize = { local function allow_metadata_inventory_put(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - minetest.record_protection_violation(pos, player:get_player_name()) - return 0 - end + if minetest.is_protected(pos, player:get_player_name()) then + minetest.record_protection_violation(pos, player:get_player_name()) + return 0 + end - local meta = minetest.get_meta(pos) - local mineral = meta:get_string("mineral") + local meta = minetest.get_meta(pos) + local mineral = meta:get_string('mineral') - if mineral == "iron" then - mineral = "steel" - end + if mineral == 'iron' then + mineral = 'steel' + end - if stack:get_name() == "default:"..mineral.."_ingot" then - return stack:get_count() - else - return 0 - end + if stack:get_name() == 'default:' .. mineral .. '_ingot' then + return stack:get_count() + else + return 0 + end end local function allow_metadata_inventory_take(pos, listname, index, stack, player) - if minetest.is_protected(pos, player:get_player_name()) then - minetest.record_protection_violation(pos, player:get_player_name()) - return 0 - end + if minetest.is_protected(pos, player:get_player_name()) then + minetest.record_protection_violation(pos, player:get_player_name()) + return 0 + end - return stack:get_count() + return stack:get_count() end local function on_metadata_inventory_put(pos) - local meta = minetest.get_meta(pos) - meta:set_int("tick", 0) - spawners_ores.get_formspec(pos) - minetest.get_node_timer(pos):start(1.0) + local meta = minetest.get_meta(pos) + meta:set_int('tick', 0) + spawners_ores.get_formspec(pos) + minetest.get_node_timer(pos):start(1.0) end local function on_metadata_inventory_take(pos) - local meta = minetest.get_meta(pos) - meta:set_int("tick", 0) - spawners_ores.get_formspec(pos) - minetest.get_node_timer(pos):start(1.0) + local meta = minetest.get_meta(pos) + meta:set_int('tick', 0) + spawners_ores.get_formspec(pos) + minetest.get_node_timer(pos):start(1.0) end -- @@ -62,213 +80,225 @@ end -- function spawners_ores.create(def) + local ore_name = def.ore_name or nil + local size = def.size or { x = 0.33, y = 0.33 } + local offset = def.offset or 0 - local ore_name = def.ore_name or nil - local size = def.size or {x = 0.33, y = 0.33} - local offset = def.offset or 0 + -- these must be defined + if ore_name == nil then + return false + end - -- these must be defined - if ore_name == nil then - return false - end + -- dummy inside the spawner + local dummy_ore_definition = { + hp_max = 1, + physical = false, + collisionbox = { 0, 0, 0, 0, 0, 0 }, + visual = 'wielditem', + visual_size = size, + timer = 0, + textures = { 'default:' .. ore_name }, + makes_footstep_sound = false, + automatic_rotate = math.pi * -3, + m_name = 'dummy_ore' + } - -- dummy inside the spawner - local dummy_ore_definition = { - hp_max = 1, - physical = false, - collisionbox = {0,0,0,0,0,0}, - visual = "wielditem", - visual_size = size, - timer = 0, - textures={"default:"..ore_name}, - makes_footstep_sound = false, - automatic_rotate = math.pi * -3, - m_name = "dummy_ore" - } + local ore = string.split(ore_name, '_') - local ore = string.split(ore_name, "_") + dummy_ore_definition.on_activate = function(self) + self.object:set_velocity({ x = 0, y = 0, z = 0 }) + self.object:set_acceleration({ x = 0, y = 0, z = 0 }) + self.object:set_armor_groups({ immortal = 1 }) + end - dummy_ore_definition.on_activate = function(self) - self.object:set_velocity({x=0, y=0, z=0}) - self.object:set_acceleration({x=0, y=0, z=0}) - self.object:set_armor_groups({immortal=1}) - end + -- remove dummy after dug up the spawner + dummy_ore_definition.on_step = function(self, dtime) + self.timer = self.timer + dtime + local n = minetest.get_node_or_nil(self.object:get_pos()) - -- remove dummy after dug up the spawner - dummy_ore_definition.on_step = function(self, dtime) - self.timer = self.timer + dtime - local n = minetest.get_node_or_nil(self.object:get_pos()) - if self.timer > 2 then - if n and n.name and n.name ~= "spawners_ores:"..ore_name.."_spawner_active" and n.name ~= "spawners_ores:"..ore_name.."_spawner_waiting" and n.name ~= "spawners_ores:"..ore_name.."_spawner" then - self.object:remove() - end - end - end + if self.timer > 2 then + if n + and n.name + and n.name ~= 'spawners_ores:' .. ore_name .. '_spawner_active' + and n.name ~= 'spawners_ores:' .. ore_name .. '_spawner_waiting' + and n.name ~= 'spawners_ores:' .. ore_name .. '_spawner' + then + self.object:remove() + end + end + end - minetest.register_entity("spawners_ores:dummy_ore_"..ore_name, dummy_ore_definition) + minetest.register_entity('spawners_ores:dummy_ore_' .. ore_name, dummy_ore_definition) - -- node spawner active - minetest.register_node("spawners_ores:"..ore_name.."_spawner_active", { - description = ore_name.." spawner active", - paramtype = "light", - light_source = 4, - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - damage_per_second = 4, - sunlight_propagates = true, - tiles = { - { - name = "spawners_ores_spawner_animated_magma_16.png"..colorize[ore_name], - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 2.0 - }, - } - }, - is_ground_content = true, - groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1}, - drop = "spawners_ores:"..ore_name.."_spawner", + -- node spawner active + minetest.register_node('spawners_ores:' .. ore_name .. '_spawner_active', { + description = ore_name .. ' spawner active', + paramtype = 'light', + light_source = 4, + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + damage_per_second = 4, + sunlight_propagates = true, + tiles = { + { + name = 'spawners_ores_spawner_animated_magma_16.png' .. colorize[ore_name], + animation = { + type = 'vertical_frames', + aspect_w = 16, + aspect_h = 16, + length = 2.0 + }, + } + }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2, + igniter = 1, + not_in_creative_inventory = 1 + }, + drop = 'spawners_ores:' .. ore_name .. '_spawner', - can_dig = spawners_ores.can_dig, + can_dig = spawners_ores.can_dig, + on_timer = spawners_ores.on_timer, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, 'fuel', drops) + drops[#drops + 1] = 'spawners_ores:' .. ore_name .. '_spawner_active' + minetest.remove_node(pos) + return drops + end, + on_metadata_inventory_put = on_metadata_inventory_put, + on_metadata_inventory_take = on_metadata_inventory_take, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + }) - on_timer = spawners_ores.on_timer, + -- node spawner waiting - no stone around or no fuel + minetest.register_node('spawners_ores:' .. ore_name .. '_spawner_waiting', { + description = ore_name .. ' spawner waiting', + paramtype = 'light', + light_source = 2, + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + sunlight_propagates = true, + tiles = { + { + name = 'spawners_ores_spawner_waiting_animated_16.png' .. colorize[ore_name], + animation = { + type = 'vertical_frames', + aspect_w = 32, + aspect_h = 32, + length = 2.0 + }, + } + }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2, + not_in_creative_inventory = 1 + }, + drop = 'spawners_ores:' .. ore_name .. '_spawner_waiting', + can_dig = spawners_ores.can_dig, + on_timer = spawners_ores.on_timer, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, 'fuel', drops) + drops[#drops + 1] = 'spawners_ores:' .. ore_name .. '_spawner' + minetest.remove_node(pos) + return drops + end, - on_blast = function(pos) - local drops = {} - default.get_inventory_drops(pos, "fuel", drops) - drops[#drops+1] = "spawners_ores:"..ore_name.."_spawner_active" - minetest.remove_node(pos) - return drops - end, - on_metadata_inventory_put = on_metadata_inventory_put, - on_metadata_inventory_take = on_metadata_inventory_take, - allow_metadata_inventory_put = allow_metadata_inventory_put, - allow_metadata_inventory_take = allow_metadata_inventory_take, - }) + on_receive_fields = function(pos, formname, fields, sender) + if fields.restart then + local meta = minetest.get_meta(pos) + meta:set_int('tick', 0) + spawners_ores.get_formspec(pos) + minetest.get_node_timer(pos):start(1.0) + end + end, - -- node spawner waiting - no stone around or no fuel - minetest.register_node("spawners_ores:"..ore_name.."_spawner_waiting", { - description = ore_name.." spawner waiting", - paramtype = "light", - light_source = 2, - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - sunlight_propagates = true, - tiles = { - { - name = "spawners_ores_spawner_waiting_animated_16.png"..colorize[ore_name], - animation = { - type = "vertical_frames", - aspect_w = 32, - aspect_h = 32, - length = 2.0 - }, - } - }, - is_ground_content = true, - groups = {cracky=1,level=2,not_in_creative_inventory=1}, - drop = "spawners_ores:"..ore_name.."_spawner_waiting", + on_metadata_inventory_put = on_metadata_inventory_put, + on_metadata_inventory_take = on_metadata_inventory_take, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + }) - can_dig = spawners_ores.can_dig, + -- node spawner inactive (default) + minetest.register_node('spawners_ores:' .. ore_name .. '_spawner', { + description = ore_name .. ' spawner', + paramtype = 'light', + paramtype2 = 'glasslikeliquidlevel', + drawtype = 'glasslike_framed_optional', + walkable = true, + sounds = default.node_sound_metal_defaults(), + sunlight_propagates = true, + tiles = { 'spawners_ores_spawner_16.png' .. colorize[ore_name] }, + is_ground_content = true, + groups = { + -- MTG + cracky = 1, + level = 2 + }, + stack_max = 1, + can_dig = spawners_ores.can_dig, + on_timer = spawners_ores.on_timer, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + spawners_ores.get_formspec(pos, { ore = ore[3] }) - on_timer = spawners_ores.on_timer, + -- Inizialize inventory + local inv = meta:get_inventory() + inv:set_size('fuel', 1) - on_blast = function(pos) - local drops = {} - default.get_inventory_drops(pos, "fuel", drops) - drops[#drops+1] = "spawners_ores:"..ore_name.."_spawner" - minetest.remove_node(pos) - return drops - end, + -- custom meta + meta:set_string('mineral', ore[3]) + meta:set_string('ore_name', ore_name) + meta:set_string('status', '') + meta:set_int('tick', 0) - on_receive_fields = function(pos, formname, fields, sender) - if fields.restart then - local meta = minetest.get_meta(pos) - meta:set_int("tick", 0) - spawners_ores.get_formspec(pos) - minetest.get_node_timer(pos):start(1.0) - end - end, + -- add spinning entity inside the spawner + pos.y = pos.y + offset + minetest.add_entity(pos,'spawners_ores:dummy_ore_' .. ore_name) + end, - on_metadata_inventory_put = on_metadata_inventory_put, - on_metadata_inventory_take = on_metadata_inventory_take, - allow_metadata_inventory_put = allow_metadata_inventory_put, - allow_metadata_inventory_take = allow_metadata_inventory_take, - }) + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, 'fuel', drops) + drops[#drops + 1] = 'spawners_ores:' .. ore_name .. '_spawner' + minetest.remove_node(pos) + return drops + end, - -- node spawner inactive (default) - minetest.register_node("spawners_ores:"..ore_name.."_spawner", { - description = ore_name.." spawner", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - drawtype = "glasslike_framed_optional", - walkable = true, - sounds = default.node_sound_metal_defaults(), - sunlight_propagates = true, - tiles = {"spawners_ores_spawner_16.png"..colorize[ore_name]}, - is_ground_content = true, - groups = {cracky = 1, level = 2}, - stack_max = 1, + after_place_node = function(pos, placer, itemstack, pointed_thing) + -- TODO: show owner in infotext/formspec + local meta = minetest.get_meta(pos) + meta:set_string('owner', placer:get_player_name()) + end, - can_dig = spawners_ores.can_dig, + on_metadata_inventory_put = on_metadata_inventory_put, + on_metadata_inventory_take = on_metadata_inventory_take, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + }) - on_timer = spawners_ores.on_timer, - - on_construct = function(pos) - local meta = minetest.get_meta(pos) - spawners_ores.get_formspec(pos, {ore=ore[3]}) - - -- Inizialize inventory - local inv = meta:get_inventory() - inv:set_size('fuel', 1) - - -- custom meta - meta:set_string("mineral", ore[3]) - meta:set_string("ore_name", ore_name) - meta:set_string("status", "") - meta:set_int("tick", 0) - - -- add spinning entity inside the spawner - pos.y = pos.y + offset - minetest.add_entity(pos,"spawners_ores:dummy_ore_"..ore_name) - end, - - on_blast = function(pos) - local drops = {} - default.get_inventory_drops(pos, "fuel", drops) - drops[#drops+1] = "spawners_ores:"..ore_name.."_spawner" - minetest.remove_node(pos) - return drops - end, - - after_place_node = function(pos, placer, itemstack, pointed_thing) - -- TODO: show owner in infotext/formspec - local meta = minetest.get_meta(pos) - meta:set_string("owner", placer:get_player_name()) - end, - - on_metadata_inventory_put = on_metadata_inventory_put, - on_metadata_inventory_take = on_metadata_inventory_take, - allow_metadata_inventory_put = allow_metadata_inventory_put, - allow_metadata_inventory_take = allow_metadata_inventory_take, - }) - - -- replacement LBM for pre-nodetimer plants - minetest.register_lbm({ - name = "spawners_ores:start_nodetimer_"..ore_name, - nodenames = { - "spawners_ores:"..ore_name.."_spawner_active" - }, - action = function(pos, node) - spawners_ores.tick_short(pos) - end, - }) + -- replacement LBM for pre-nodetimer plants + minetest.register_lbm({ + name = 'spawners_ores:start_nodetimer_' .. ore_name, + nodenames = { + 'spawners_ores:' .. ore_name .. '_spawner_active' + }, + action = function(pos, node) + spawners_ores.tick_short(pos) + end, + }) end -- @@ -277,30 +307,30 @@ end -- default:stone_with_gold spawners_ores.create({ - ore_name = "stone_with_gold", - size = {x = 0.33, y = 0.33}, - offset = 0 + ore_name = 'stone_with_gold', + size = { x = 0.33, y = 0.33 }, + offset = 0 }) -- default:stone_with_iron spawners_ores.create({ - ore_name = "stone_with_iron", - size = {x = 0.33, y = 0.33}, - offset = 0 + ore_name = 'stone_with_iron', + size = { x = 0.33, y = 0.33 }, + offset = 0 }) -- default:stone_with_copper spawners_ores.create({ - ore_name = "stone_with_copper", - size = {x = 0.33, y = 0.33}, - offset = 0 + ore_name = 'stone_with_copper', + size = { x = 0.33, y = 0.33 }, + offset = 0 }) -- default:stone_with_tin spawners_ores.create({ - ore_name = "stone_with_tin", - size = {x = 0.33, y = 0.33}, - offset = 0 + ore_name = 'stone_with_tin', + size = { x = 0.33, y = 0.33 }, + offset = 0 }) -- @@ -308,37 +338,37 @@ spawners_ores.create({ -- minetest.register_craft({ - output = "spawners_ores:stone_with_gold_spawner", - recipe = { - {"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"}, - {"xpanes:bar_flat", "default:goldblock", "xpanes:bar_flat"}, - {"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"}, - } + output = 'spawners_ores:stone_with_gold_spawner', + recipe = { + { 'default:diamondblock', 'fire:flint_and_steel', 'default:diamondblock' }, + { 'xpanes:bar_flat', 'default:goldblock', 'xpanes:bar_flat' }, + { 'default:diamondblock', 'xpanes:bar_flat', 'default:diamondblock' }, + } }) minetest.register_craft({ - output = "spawners_ores:stone_with_iron_spawner", - recipe = { - {"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"}, - {"xpanes:bar_flat", "default:steelblock", "xpanes:bar_flat"}, - {"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"}, - } + output = 'spawners_ores:stone_with_iron_spawner', + recipe = { + { 'default:diamondblock', 'fire:flint_and_steel', 'default:diamondblock' }, + { 'xpanes:bar_flat', 'default:steelblock', 'xpanes:bar_flat' }, + { 'default:diamondblock', 'xpanes:bar_flat', 'default:diamondblock' }, + } }) minetest.register_craft({ - output = "spawners_ores:stone_with_copper_spawner", - recipe = { - {"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"}, - {"xpanes:bar_flat", "default:copperblock", "xpanes:bar_flat"}, - {"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"}, - } + output = 'spawners_ores:stone_with_copper_spawner', + recipe = { + { 'default:diamondblock', 'fire:flint_and_steel', 'default:diamondblock' }, + { 'xpanes:bar_flat', 'default:copperblock', 'xpanes:bar_flat' }, + { 'default:diamondblock', 'xpanes:bar_flat', 'default:diamondblock' }, + } }) minetest.register_craft({ - output = "spawners_ores:stone_with_tin_spawner", - recipe = { - {"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"}, - {"xpanes:bar_flat", "default:tinblock", "xpanes:bar_flat"}, - {"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"}, - } + output = 'spawners_ores:stone_with_tin_spawner', + recipe = { + { 'default:diamondblock', 'fire:flint_and_steel', 'default:diamondblock' }, + { 'xpanes:bar_flat', 'default:tinblock', 'xpanes:bar_flat' }, + { 'default:diamondblock', 'xpanes:bar_flat', 'default:diamondblock' }, + } }) diff --git a/spawners_ores/textures/spawners_ores_smoke_particle.png b/spawners_ores/textures/spawners_ores_smoke_particle.png index 36e8d4e..d57b6e3 100644 Binary files a/spawners_ores/textures/spawners_ores_smoke_particle.png and b/spawners_ores/textures/spawners_ores_smoke_particle.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner.png b/spawners_ores/textures/spawners_ores_spawner.png index 331b2ba..098d349 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner.png and b/spawners_ores/textures/spawners_ores_spawner.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_16.png b/spawners_ores/textures/spawners_ores_spawner_16.png index c6f0bbe..53ad856 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_16.png and b/spawners_ores/textures/spawners_ores_spawner_16.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_animated.png b/spawners_ores/textures/spawners_ores_spawner_animated.png index fc3adad..48c5638 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_animated.png and b/spawners_ores/textures/spawners_ores_spawner_animated.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_animated_16.png b/spawners_ores/textures/spawners_ores_spawner_animated_16.png index 503be10..ba6ebd3 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_animated_16.png and b/spawners_ores/textures/spawners_ores_spawner_animated_16.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_animated_lava_16.png b/spawners_ores/textures/spawners_ores_spawner_animated_lava_16.png index 29025ac..b7a0b98 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_animated_lava_16.png and b/spawners_ores/textures/spawners_ores_spawner_animated_lava_16.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_animated_magma_16.png b/spawners_ores/textures/spawners_ores_spawner_animated_magma_16.png index f1b3b72..e1c52fb 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_animated_magma_16.png and b/spawners_ores/textures/spawners_ores_spawner_animated_magma_16.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_waiting_animated.png b/spawners_ores/textures/spawners_ores_spawner_waiting_animated.png index 1297b3d..c734e58 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_waiting_animated.png and b/spawners_ores/textures/spawners_ores_spawner_waiting_animated.png differ diff --git a/spawners_ores/textures/spawners_ores_spawner_waiting_animated_16.png b/spawners_ores/textures/spawners_ores_spawner_waiting_animated_16.png index 135694a..f334637 100644 Binary files a/spawners_ores/textures/spawners_ores_spawner_waiting_animated_16.png and b/spawners_ores/textures/spawners_ores_spawner_waiting_animated_16.png differ diff --git a/spawners_ores/textures/spawners_ores_stone_with_copper.png b/spawners_ores/textures/spawners_ores_stone_with_copper.png index 0f9f221..875f4e5 100644 Binary files a/spawners_ores/textures/spawners_ores_stone_with_copper.png and b/spawners_ores/textures/spawners_ores_stone_with_copper.png differ diff --git a/spawners_ores/textures/spawners_ores_stone_with_gold.png b/spawners_ores/textures/spawners_ores_stone_with_gold.png index 8862fad..1798950 100644 Binary files a/spawners_ores/textures/spawners_ores_stone_with_gold.png and b/spawners_ores/textures/spawners_ores_stone_with_gold.png differ diff --git a/spawners_ores/textures/spawners_ores_stone_with_iron.png b/spawners_ores/textures/spawners_ores_stone_with_iron.png index 263e6f1..0296f7d 100644 Binary files a/spawners_ores/textures/spawners_ores_stone_with_iron.png and b/spawners_ores/textures/spawners_ores_stone_with_iron.png differ diff --git a/spawners_ores/textures/spawners_ores_stone_with_tin.png b/spawners_ores/textures/spawners_ores_stone_with_tin.png index 6eac212..91a4381 100644 Binary files a/spawners_ores/textures/spawners_ores_stone_with_tin.png and b/spawners_ores/textures/spawners_ores_stone_with_tin.png differ