Cleanup and licensing
15
.cdb.json
Normal file
@ -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"
|
||||
}
|
12
.editorconfig
Normal file
@ -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
|
16
.gitattributes
vendored
Normal file
@ -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
|
2
.gitignore
vendored
@ -5,5 +5,5 @@ docs/build
|
||||
*.old
|
||||
node_modules
|
||||
*.log
|
||||
logs
|
||||
*.mtl
|
||||
logs
|
||||
|
82
.luacheckrc
Normal file
@ -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"
|
||||
}
|
112
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
|
||||
See included license files.
|
||||
|
77
bitbucket-pipelines.yml
Normal file
@ -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
|
1184
license.txt
6
modpack.conf
Normal file
@ -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 =
|
34
package.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
568
spawners_env/LICENSE.txt
Normal file
@ -0,0 +1,568 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
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
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
-- 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()
|
||||
|
@ -1 +0,0 @@
|
||||
default
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
-- 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.")
|
||||
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
|
||||
|
||||
print('[Mod] Spawners Environmental Loaded. [' .. mod_end_time .. 's]')
|
||||
|
6
spawners_env/mod.conf
Normal file
@ -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
|
@ -1,3 +0,0 @@
|
||||
SPAWN_PYRAMIDS = false
|
||||
SPAWNERS_GENERATE = true
|
||||
CHESTS_GENERATE = false
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
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
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
-- 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)
|
||||
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)
|
||||
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 410 B |
567
spawners_mobs/LICENSE.txt
Normal file
@ -0,0 +1,567 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
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
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
-- 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
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
-- 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
|
||||
|
@ -1,7 +0,0 @@
|
||||
default
|
||||
x_default?
|
||||
xpanes?
|
||||
fire?
|
||||
mobs?
|
||||
creatures?
|
||||
bones?
|
@ -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.
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
-- 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]')
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
})
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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)
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
})
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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)
|
||||
|
@ -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
|
||||
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
|
BIN
spawners_mobs/sounds/spawners_mobs_mummy_neutral.3.ogg
Normal file
BIN
spawners_mobs/sounds/spawners_mobs_teleport.1.ogg
Normal file
BIN
spawners_mobs/sounds/spawners_mobs_teleport.2.ogg
Normal file
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 753 B After Width: | Height: | Size: 739 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1020 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 96 B After Width: | Height: | Size: 82 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 757 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 423 B |
487
spawners_ores/LICENSE.txt
Normal file
@ -0,0 +1,487 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
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
|
@ -1,267 +1,282 @@
|
||||
--[[
|
||||
Ore spawners let player craft ore spawneres and get back lumps from ingots.
|
||||
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
|
||||
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
|
||||
|
@ -1,3 +0,0 @@
|
||||
default
|
||||
xpanes?
|
||||
fire?
|
@ -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.
|
@ -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 <juraj.vajda@gmail.com>
|
||||
|
||||
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]')
|
||||
|
@ -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
|
||||
|
@ -1,12 +1,30 @@
|
||||
--[[
|
||||
Ore spawners let player craft ore spawneres and get back lumps from ingots.
|
||||
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
|
||||
|
||||
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' },
|
||||
}
|
||||
})
|
||||
|