forked from VoxeLibre/VoxeLibre
Compare commits
757 Commits
hardness_b
...
master
Author | SHA1 | Date |
---|---|---|
loveaabb | 195b193260 | |
loveaabb | 83a651d375 | |
loveaabb | 19190d92e7 | |
loveaabb | f50ef6b52a | |
loveaabb | 50fda3e844 | |
Mikita Wiśniewski | 3b1c55c234 | |
Mikita Wiśniewski | 0ef81681ba | |
the-real-herowl | efc6ab0bbf | |
Bram van den Heuvel | 69acc5074b | |
the-real-herowl | 7d999535e7 | |
teknomunk | 81ca224bb8 | |
nixnoxus | 3975449ad2 | |
teknomunk | 6756658ee9 | |
the-real-herowl | 4dde321a04 | |
Araca | cd0509c2e6 | |
the-real-herowl | cc1e01ad78 | |
the-real-herowl | b9428e3438 | |
teknomunk | 0c372f987d | |
Bakawun | 22c4daab22 | |
nixnoxus | 760fe1aa68 | |
Eliy21 | f78ad93fd3 | |
the-real-herowl | d321b166ea | |
JoseDouglas26 | 18342e44c8 | |
JoseDouglas26 | 2430953a81 | |
the-real-herowl | a25e2b8eb3 | |
the-real-herowl | ee2998e21b | |
the-real-herowl | e0aadc7996 | |
the-real-herowl | 9f65c5efb7 | |
the-real-herowl | 7ad4ca2dbe | |
JoseDouglas26 | 1161d5cd36 | |
SmokeyDope | 538c206985 | |
Doods | 31facbd902 | |
the-real-herowl | 5f70189e08 | |
the-real-herowl | 4e12c6747c | |
the-real-herowl | 1d8fc7abac | |
teknomunk | 09c595c363 | |
teknomunk | 6fbe60f1ac | |
teknomunk | 3705be24d7 | |
teknomunk | 681075df5a | |
teknomunk | 6ecb304946 | |
teknomunk | 034b0142c6 | |
teknomunk | e02d1c0e27 | |
teknomunk | bdcd89e1bf | |
teknomunk | 62ab68637a | |
teknomunk | 0839f35a12 | |
teknomunk | 84d6b593b2 | |
the-real-herowl | 3bcbb99878 | |
the-real-herowl | 9e8661ae95 | |
SOS-Games | 4f37c1600f | |
Doods | bd4337a2dc | |
MysticTempest | 57409973b9 | |
Mikita Wiśniewski | 312ad5b63b | |
Mikita Wiśniewski | 46ed6a6dda | |
the-real-herowl | 0f20e18e53 | |
the-real-herowl | 69d3fa5f85 | |
the-real-herowl | 5e673b8fee | |
Araca | 596c56d31f | |
the-real-herowl | e582c3bb97 | |
the-real-herowl | b5b8d4f336 | |
Doods | c1971b662a | |
nixnoxus | a86e8e2c8e | |
Doods | a3db7bd504 | |
ancientmarinerdev | ac4aff12ea | |
emptyshore | 003288bc80 | |
teknomunk | 13ce4f9092 | |
teknomunk | 0a294c55a1 | |
teknomunk | 44bb07507d | |
cora | 3509b85a3e | |
emptyshore | 55653fe37b | |
the-real-herowl | 0170619866 | |
ancientmarinerdev | 0b521ef92b | |
nixnoxus | 8931576c50 | |
the-real-herowl | c65176af81 | |
the-real-herowl | a71a634168 | |
the-real-herowl | 89e8cf0213 | |
nixnoxus | 08b41a3b39 | |
the-real-herowl | 26fc0cd4d8 | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | e50ad7d6de | |
the-real-herowl | 4b6d63739c | |
the-real-herowl | c6a112d200 | |
the-real-herowl | ade2a1a6a2 | |
the-real-herowl | b04493dcb6 | |
the-real-herowl | a5740f8edf | |
nixnoxus | 9809c627dc | |
syl | 21dbc25f13 | |
CyberMango | 4a22287eb6 | |
nixnoxus | 497f1dcd80 | |
nixnoxus | 01cace413f | |
Eliy21 | 7bfbaac772 | |
the-real-herowl | 8d5c9996a2 | |
the-real-herowl | 87abd0f4dc | |
the-real-herowl | 03b8ad15e3 | |
the-real-herowl | fc6fe3f1ed | |
the-real-herowl | 3fa4cf6d52 | |
the-real-herowl | 3d799266c3 | |
AFCMS | caa82c40c9 | |
the-real-herowl | 8c19d4b9b8 | |
the-real-herowl | 1476c7ae59 | |
the-real-herowl | 13825763b0 | |
the-real-herowl | c31226041f | |
the-real-herowl | b3bcd949b9 | |
the-real-herowl | a8ad631864 | |
the-real-herowl | 1478960b7f | |
the-real-herowl | f41990c1d0 | |
José Douglas da Silva Souza | 77a6ac1ef3 | |
José Douglas da Silva Souza | 9b9271e5df | |
the-real-herowl | 1175be45fb | |
the-real-herowl | f444efbb03 | |
chmodsayshello | a2a38b7b3d | |
Eliy21 | aa4f8ba6cc | |
Eliy21 | b645a2ab67 | |
Eliy21 | d41d29be58 | |
Eliy21 | 434bb33f72 | |
Eliy21 | d37840e022 | |
Eliy21 | aea5c6f7be | |
Eliy21 | 5154dce8d0 | |
Eliy21 | c0a5c63601 | |
Eliy21 | 473c85c543 | |
Eliy21 | 86c10002a6 | |
Eliy21 | b56424a0b6 | |
Eliy21 | 93dff87a5e | |
Eliy21 | be711ea727 | |
Eliy21 | 7b42779fe2 | |
Eliy21 | 11d0062255 | |
Eliy21 | 4dd04b4c91 | |
Eliy21 | 109aed75df | |
James Clarke | 184f1575ee | |
Eliy21 | 7561e1dc95 | |
Eliy21 | bee44f41b6 | |
Eliy21 | b2b2dc4090 | |
Eliy21 | a78b308a75 | |
Eliy21 | cc7a2e0b41 | |
Eliy21 | 996a5a6d47 | |
Eliy21 | 4c8efca4e6 | |
SmokeyDope | 2d2b64006b | |
emptyshore | 8e103cf615 | |
the-real-herowl | d1ac98a019 | |
codiac | d3c591915f | |
the-real-herowl | b507838e13 | |
Doods | b944a70059 | |
Doods | 9397e736a8 | |
Doods | b7ea609422 | |
Doods | 23a3d53ca6 | |
Doods | 7e31f015fe | |
Doods | f1fda9b412 | |
James Clarke | 1a2b9e5930 | |
Doods | bb29dade32 | |
James Clarke | 961ee13ba1 | |
James Clarke | efd19bd0ee | |
James Clarke | fe8612d944 | |
James Clarke | c586e480ed | |
James Clarke | 0da8428eef | |
James Clarke | ddfbd331c9 | |
James Clarke | 47b6bd5539 | |
James Clarke | 16cdc9fd12 | |
James Clarke | 2904e3119f | |
James Clarke | e04f4d3b2a | |
James Clarke | 0584fc4ebf | |
James Clarke | 1147a9715a | |
James Clarke | e05e46bc59 | |
Doods | 7793a31f0e | |
James Clarke | a6753806cc | |
Doods | a25bdfbc90 | |
James Clarke | 254fe4d98e | |
James Clarke | 6324c805eb | |
James Clarke | 3103969bdc | |
Doods | 7cb17eefa1 | |
James Clarke | 4f0ad6de6d | |
James Clarke | 59ffda6e86 | |
James Clarke | 1b7cde697a | |
James Clarke | bae95fea09 | |
James Clarke | 5f6173b999 | |
James Clarke | bd113dd902 | |
James Clarke | 557ea75c5d | |
James Clarke | 98a5f07ef8 | |
James Clarke | 29fe5e5b40 | |
James Clarke | a5573aab26 | |
James Clarke | 17da379269 | |
James Clarke | 566bc8a02b | |
Eliy21 | 44bd1c7b71 | |
the-real-herowl | ac8ff800ec | |
JoseDouglas26 | 3b60a8eb18 | |
the-real-herowl | 681175c463 | |
the-real-herowl | 3dafeb7505 | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | 4c0bad754e | |
PrWalterB | 899c45534f | |
the-real-herowl | cfd41d458a | |
the-real-herowl | 41c6773fd4 | |
the-real-herowl | 27c3760da1 | |
James Clarke | aa4d5738c7 | |
the-real-herowl | 59ad110e6b | |
James Clarke | ee24b24c68 | |
James Clarke | f94e7fc52f | |
chmodsayshello | 45c84b1f1d | |
chmodsayshello | 96dbcc45d0 | |
chmodsayshello | bfe333ef60 | |
chmodsayshello | 89eb0f9b3e | |
chmodsayshello | 146b0ade37 | |
chmodsayshello | 0f91b763e9 | |
chmodsayshello | aeccc94687 | |
the-real-herowl | d3881fc1d1 | |
chmodsayshello | b47fae0ed4 | |
chmodsayshello | 180c8fb73e | |
the-real-herowl | c70ae8e535 | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | c1115c9cef | |
pineaulo | 7af5e79afc | |
the-real-herowl | 12b3e34f88 | |
bakawun | 4d90dfab0e | |
bakawun | b2b63266b7 | |
bakawun | d151e79fb9 | |
bakawun | e419e6d63b | |
cora | 55517154bd | |
bakawun | 402e4e7b79 | |
the-real-herowl | 59c5d54cbe | |
tuxilio | 4b5afee4bb | |
the-real-herowl | 3c2247d7c8 | |
the-real-herowl | 324fd0dc4a | |
bakawun | cd033aa4ff | |
bakawun | 1f3c7913dd | |
bakawun | 49aa32d2ee | |
the-real-herowl | 18db66c431 | |
JoseDouglas26 | cc3f092185 | |
the-real-herowl | 9f64facbf9 | |
JoseDouglas26 | 6694babbde | |
SmokeyDope | fc204c8717 | |
SmokeyDope | c664216104 | |
SmokeyDope | cd3426b5ce | |
the-real-herowl | 9867c73eb3 | |
the-real-herowl | 3db02bb022 | |
SmokeyDope | 3c7597b75e | |
SmokeyDope | 7bf3fbf13c | |
SmokeyDope | fc7133f1a8 | |
SmokeyDope | 05eb3bb8aa | |
SmokeyDope | 7583caca9b | |
pineaulo | 411e3e161f | |
the-real-herowl | 882531b9fc | |
the-real-herowl | 0b5c15d05f | |
the-real-herowl | cd930365b0 | |
the-real-herowl | ce56f396b1 | |
the-real-herowl | ba297001b4 | |
the-real-herowl | 24eca01c3f | |
the-real-herowl | 4e3cf9e04b | |
the-real-herowl | d285a48fed | |
the-real-herowl | d3d1bdf8d2 | |
the-real-herowl | f306d3768e | |
the-real-herowl | 7463b97c69 | |
the-real-herowl | d11526f8e8 | |
the-real-herowl | 8021a6a723 | |
the-real-herowl | 1bad5659cf | |
the-real-herowl | befd98b83e | |
the-real-herowl | 13341df20b | |
the-real-herowl | f866b56d06 | |
José M | 4a407679c0 | |
the-real-herowl | 39f98ec6fb | |
the-real-herowl | 9e3d7ce0f4 | |
the-real-herowl | cb7878249d | |
the-real-herowl | 939905b9d8 | |
the-real-herowl | b1f7fecb59 | |
the-real-herowl | 3d58878750 | |
the-real-herowl | b6938bad90 | |
the-real-herowl | 9df4e2e95e | |
the-real-herowl | a2a4da5aed | |
the-real-herowl | e1d5899aa5 | |
the-real-herowl | dd7d56a385 | |
the-real-herowl | 4bb46d7d30 | |
the-real-herowl | 8071d0fbef | |
the-real-herowl | 60c0483c12 | |
cora | 29d40ef553 | |
JoseDouglas26 | d59a6c6a00 | |
JoseDouglas26 | c20a37486e | |
JoseDouglas26 | 85bc643442 | |
JoseDouglas26 | 907e037430 | |
JoseDouglas26 | 7b93c65c45 | |
JoseDouglas26 | 73bcb0026f | |
JoseDouglas26 | 01abafe50f | |
JoseDouglas26 | e28207f44e | |
JoseDouglas26 | a5370bc63d | |
JoseDouglas26 | f904512e61 | |
JoseDouglas26 | c1e3c69800 | |
JoseDouglas26 | d0697c70cc | |
JoseDouglas26 | bef3253d5c | |
JoseDouglas26 | ad099ed7c2 | |
JoseDouglas26 | a2b7549456 | |
JoseDouglas26 | f8ef5a15c5 | |
JoseDouglas26 | 6c4101dc12 | |
JoseDouglas26 | 8c0d9cc450 | |
JoseDouglas26 | 1f370bf1f2 | |
JoseDouglas26 | 6bffaf56d2 | |
JoseDouglas26 | 04b77db7fa | |
JoseDouglas26 | aeeb5acc25 | |
JoseDouglas26 | 9a8a6764d1 | |
JoseDouglas26 | 3047568ed4 | |
JoseDouglas26 | 2a8da574f0 | |
JoseDouglas26 | 00bf5f0331 | |
JoseDouglas26 | 2d5b57c60d | |
JoseDouglas26 | b476c703f1 | |
JoseDouglas26 | 8f3936792f | |
JoseDouglas26 | 8816e9fc61 | |
JoseDouglas26 | e291d9918e | |
JoseDouglas26 | bd19c8fe67 | |
JoseDouglas26 | 7f36116146 | |
JoseDouglas26 | 8afa57b914 | |
JoseDouglas26 | bc186560b4 | |
JoseDouglas26 | ae470f8809 | |
JoseDouglas26 | 8b1ad1c217 | |
JoseDouglas26 | 0638c67cf7 | |
JoseDouglas26 | 3f0e77b971 | |
JoseDouglas26 | 3e131a213f | |
JoseDouglas26 | d7c8c7a54a | |
JoseDouglas26 | fcd4a610e5 | |
JoseDouglas26 | cde4bc797e | |
JoseDouglas26 | cb6b4253d2 | |
JoseDouglas26 | 6480c6923a | |
JoseDouglas26 | 487f78d663 | |
JoseDouglas26 | 908c46ce34 | |
JoseDouglas26 | 90a758c002 | |
JoseDouglas26 | 3a89d367b0 | |
JoseDouglas26 | 6dac652241 | |
JoseDouglas26 | 4a3369205e | |
JoseDouglas26 | 8b02d7b0b2 | |
JoseDouglas26 | 184a098964 | |
JoseDouglas26 | d57fbb047d | |
JoseDouglas26 | 1c3003c85b | |
JoseDouglas26 | 188f1cdaa6 | |
JoseDouglas26 | e536822b4d | |
JoseDouglas26 | c6fc911c12 | |
JoseDouglas26 | cb0c67b05f | |
JoseDouglas26 | 427724ced2 | |
JoseDouglas26 | 799462c4b4 | |
JoseDouglas26 | 334ac81f58 | |
JoseDouglas26 | 840381f73f | |
JoseDouglas26 | 21a10751d1 | |
JoseDouglas26 | 09a063256b | |
JoseDouglas26 | 9701526d16 | |
JoseDouglas26 | e2746adea8 | |
JoseDouglas26 | a93ce7af1f | |
JoseDouglas26 | 3684cb8d2a | |
JoseDouglas26 | 0626c3329b | |
JoseDouglas26 | 5489bf20ea | |
JoseDouglas26 | 232740b5e6 | |
JoseDouglas26 | 6f7ac46f05 | |
JoseDouglas26 | 1524f63a6d | |
JoseDouglas26 | 60377c56cd | |
JoseDouglas26 | b0b120dd28 | |
JoseDouglas26 | 34c23bd578 | |
JoseDouglas26 | 9be815956c | |
JoseDouglas26 | 2da67765a0 | |
JoseDouglas26 | 01641b5a8c | |
JoseDouglas26 | 9371ed5c48 | |
JoseDouglas26 | 527577cbcc | |
JoseDouglas26 | 86d5e748bb | |
JoseDouglas26 | 6cbd985974 | |
JoseDouglas26 | 6f9b70a98d | |
JoseDouglas26 | 76e941cbb6 | |
JoseDouglas26 | aef093ef4e | |
JoseDouglas26 | f824f109e2 | |
JoseDouglas26 | a3ccd4d032 | |
JoseDouglas26 | 419456b835 | |
JoseDouglas26 | 72a144f0b2 | |
JoseDouglas26 | f379a06998 | |
JoseDouglas26 | 947d20ae96 | |
JoseDouglas26 | 5c06c28b0f | |
JoseDouglas26 | df02770470 | |
JoseDouglas26 | 51dc10c9ea | |
JoseDouglas26 | 2370d155c9 | |
JoseDouglas26 | ad3ec48ec9 | |
JoseDouglas26 | beb06315ac | |
the-real-herowl | 569dd69188 | |
the-real-herowl | 92ee9c0557 | |
JoseDouglas26 | f63e5d3c19 | |
JoseDouglas26 | 4d5d595310 | |
JoseDouglas26 | f9972aef01 | |
JoseDouglas26 | 85d21fa1e9 | |
JoseDouglas26 | e6a64cfc69 | |
JoseDouglas26 | dd5a9178d9 | |
JoseDouglas26 | 113f07581b | |
Eliy21 | 10dcdb7d6b | |
José M | ec8f3f5530 | |
José M | 74ab3ffeee | |
José M | 9d62c4ca5e | |
José M | c9d221976b | |
José M | 0d1a6d91e9 | |
José M | 0f82c623d5 | |
the-real-herowl | a1d390bd4d | |
José M | 325c6ab4ca | |
José M | dc4c559ad9 | |
José M | 1f52b7051a | |
José M | 5e28ff2d06 | |
José M | d5eda7352c | |
ancientmarinerdev | 5071855d00 | |
cora | 4cfd4ef6ce | |
Eliy21 | 96fa6c251e | |
Eliy21 | e19de85990 | |
Eliy21 | 76bff2b540 | |
Eliy21 | ff882707de | |
Eliy21 | d7ed37ef25 | |
Michieal | ceada2fcec | |
the-real-herowl | 99cc88ac42 | |
Michieal | 56ebb5ac09 | |
the-real-herowl | 8a5058e032 | |
the-real-herowl | e312955a14 | |
the-real-herowl | 5afd0aa255 | |
Michieal | 98b6ead591 | |
the-real-herowl | 040ce8288e | |
the-real-herowl | f9b192e68f | |
the-real-herowl | 08241f6ea3 | |
the-real-herowl | 5bf6608483 | |
the-real-herowl | 42ec62562d | |
the-real-herowl | 7f5ce4e033 | |
the-real-herowl | 3a007e3bb1 | |
the-real-herowl | a650f8b368 | |
Michieal | 580a1caa38 | |
Michieal | 2f8389d3f5 | |
Michieal | 4f3f59f4bc | |
Michieal | 36f661743e | |
Michieal | 0a17bbe731 | |
Michieal | 6cfb55e853 | |
Michieal | bf41e116a1 | |
Michieal | fc80d4fb9f | |
Michieal | 11c5d36c55 | |
Eliy21 | 44c656502f | |
Eliy21 | fe90424ee4 | |
Eliy21 | 14cec16c63 | |
bakawun | a786b66d9e | |
bakawun | cc470b9d88 | |
bakawun | ee51a500b2 | |
bakawun | 7f823f0155 | |
bakawun | f5ba0b7981 | |
bakawun | e202f20869 | |
bakawun | 692b101212 | |
the-real-herowl | 07147e9d5b | |
the-real-herowl | d44b00a20e | |
Eliy21 | 12109e7f44 | |
Eliy21 | 200f7451eb | |
Eliy21 | c39e55e2d4 | |
Eliy21 | 6d7ae8ba2d | |
Eliy21 | 8612350fa7 | |
Eliy21 | 0a8874ecad | |
Eliy21 | e8ee9c4463 | |
Eliy21 | 32e91b45ae | |
Eliy21 | 8fbd72c142 | |
Eliy21 | cfab59d68a | |
Eliy21 | 33e8337bbb | |
Eliy21 | f799596db9 | |
Eliy21 | 9b9747b3d8 | |
Eliy21 | c9692c6224 | |
Eliy21 | cd83305f07 | |
Eliy21 | d7b10d18d8 | |
Eliy21 | 8e2c5249f5 | |
Eliy21 | ca556c052f | |
Eliy21 | 60367cdbe0 | |
Eliy21 | ae169b2814 | |
bakawun | cee5bbc206 | |
Eliy21 | 6b439fd1de | |
Eliy21 | bf9e487fa9 | |
Eliy21 | 49af5d2013 | |
Eliy21 | ed507d8509 | |
Eliy21 | b2507c3640 | |
Eliy21 | 85b1f5247a | |
Eliy21 | 2b71462c1e | |
Eliy21 | b0e33793ec | |
Eliy21 | 96aaf89036 | |
Eliy21 | a8c2d4534a | |
Eliy21 | a8806fe04e | |
Wbjitscool | ebd733be82 | |
the-real-herowl | a2c8d13f04 | |
the-real-herowl | 610bcab0d6 | |
the-real-herowl | ed205190e4 | |
Wbjitscool | 07eb70e9be | |
the-real-herowl | b3da7a473d | |
bakawun | bc101314df | |
the-real-herowl | 69903aa4ec | |
bakawun | 686646b86d | |
bakawun | 789c9a9a6d | |
cora | cf51c60527 | |
cora | 55fe71d73b | |
cora | 58bb26a7ef | |
cora | f5079f1568 | |
Bakawun | b4511fb8c7 | |
Bakawun | b02a3deec7 | |
Bakawun | 26cfdf0b7c | |
Bakawun | 8d34ff2a9a | |
Bakawun | e6ddc03d3c | |
Zasco | 351e31a889 | |
Bakawun | 5f3c901f11 | |
the-real-herowl | aff4216ccf | |
the-real-herowl | 8b00fff4cb | |
the-real-herowl | cf70de0ecc | |
José M | 6dce3b4bc4 | |
José M | a60540c17e | |
José M | 19fd075a2f | |
José M | 1ac65305d6 | |
José M | 8dcb62aa56 | |
José M | 1d2a7b35d8 | |
José M | 02e7ff41d5 | |
the-real-herowl | d4797e13af | |
the-real-herowl | 3caa99a409 | |
the-real-herowl | ca71e949a8 | |
the-real-herowl | 9a7e39654c | |
the-real-herowl | 333db53e7b | |
the-real-herowl | 47f920c9df | |
the-real-herowl | bb66f81999 | |
the-real-herowl | a344755894 | |
the-real-herowl | c03366aa12 | |
José M | bb1e572287 | |
Eliy21 | 4127d120d2 | |
Eliy21 | 86dad4693e | |
José M | f39fe17895 | |
Eliy21 | 0673fcc25b | |
the-real-herowl | 589de76613 | |
the-real-herowl | 1857341b59 | |
the-real-herowl | 46d9c66000 | |
the-real-herowl | cca6645524 | |
the-real-herowl | 24ffd64cad | |
the-real-herowl | e29654a0f6 | |
José Muñoz | 027e0e8337 | |
bakawun | 2ba73f832c | |
chmodsayshello | 4b63ff1c2a | |
chmodsayshello | 43e7a952ac | |
michaljmalinowski | 9be5de980e | |
codiac | 4cf865a36c | |
Eliy21 | b57f6be81d | |
the-real-herowl | cd40861b3b | |
the-real-herowl | 19728c5a19 | |
Kostinatyn Tsiupa | 1da7bb0bdc | |
bakawun | 25fa21ddbd | |
the-real-herowl | 1044163717 | |
ThePython10110 | 570ea114ec | |
the-real-herowl | 8fd988da11 | |
the-real-herowl | f1c5f0ca1c | |
the-real-herowl | b4080b6275 | |
the-real-herowl | bb48e47488 | |
the-real-herowl | a6025b751a | |
the-real-herowl | af2f58248f | |
AFCMS | e324a1a74b | |
AFCMS | 4836418cf6 | |
AFCMS | a001f84786 | |
AFCMS | 2128dd4c15 | |
the-real-herowl | c183da7714 | |
the-real-herowl | fd17bf1a29 | |
the-real-herowl | 0c7b4d473c | |
the-real-herowl | 6ebd3ccb7d | |
the-real-herowl | d46b9071a0 | |
the-real-herowl | ead2e772c2 | |
the-real-herowl | 19cea45c17 | |
the-real-herowl | b252e577ec | |
Chris Page | 12568a6749 | |
Chris Page | 559f500322 | |
Chris Page | 40fb043de2 | |
Chris Page | 5dda3033a5 | |
Chris Page | 524c9c1bcc | |
Chris Page | a9f26fb354 | |
Chris Page | 01d43bb33a | |
Chris Page | ca37ce5744 | |
Chris Page | 5f0ad98dae | |
Chris Page | 0e60231c2e | |
Chris Page | 7fcc2e3be3 | |
Chris Page | 356045b3e3 | |
Chris Page | 07d2759ae4 | |
Chris Page | 9da07af370 | |
Chris Page | 47990eec2b | |
Chris Page | 7523727521 | |
Chris Page | 2af08c3188 | |
Chris Page | 45532ebe6d | |
3raven | 86da47b922 | |
Eliy21 | 7cbba73d50 | |
José M | 4df6f82c64 | |
chmodsayshello | 6ee2dbe70c | |
the-real-herowl | 613ab897b2 | |
the-real-herowl | e53d9ec8d7 | |
Mikita Wiśniewski | a764818e13 | |
the-real-herowl | 378b8f8f6c | |
Aliaksei Urbanski | 32ef89aca3 | |
the-real-herowl | accb8742dd | |
codiac | 71282e196e | |
codiac | 89c97690c8 | |
codiac | 06f9486e4d | |
codiac | ae5564e658 | |
the-real-herowl | fdf823fff6 | |
Araca | 52b65554d9 | |
the-real-herowl | 5a069af072 | |
the-real-herowl | 14f73a8c55 | |
the-real-herowl | dbab70ea38 | |
chmodsayshello | 952a96b57d | |
Dehydrate6684 | e5a260b563 | |
Dehydrate6684 | 9b2b8ee56e | |
seventeenthShulker | 00cfca5947 | |
seventeenthShulker | c37da143da | |
seventeenthShulker | 520fd773fb | |
seventeenthShulker | 378df76e5f | |
seventeenthShulker | 3e12b3c700 | |
seventeenthShulker | 0637182697 | |
seventeenthShulker | 0580b14310 | |
seventeenthShulker | 98cf3b7f7a | |
seventeenthShulker | e5829f719d | |
seventeenthShulker | 089e3d46f1 | |
seventeenthShulker | 5d8688dbeb | |
seventeenthShulker | 058684f17f | |
seventeenthShulker | 918b8eee38 | |
seventeenthShulker | af206ed8b3 | |
seventeenthShulker | f2eca64e42 | |
the-real-herowl | 262100be24 | |
Eliy21 | 69dc013799 | |
Michieal | a425d359f5 | |
Freedom | 83d6e2a5d2 | |
FossFanatic | ce403b9245 | |
Eliy21 | da911bd4d4 | |
the-real-herowl | 8789411ab7 | |
the-real-herowl | 5b1deedaf0 | |
SmokeyDope | fa1d8dfc47 | |
SmokeyDope | d2a4a6d042 | |
SmokeyDope | 5e194b33bd | |
Araca | 35bb569ee1 | |
chmodsayshello | 5be506830f | |
codiac | 4fcd1ae541 | |
the-real-herowl | f941817c39 | |
seventeenthShulker | bc3bde4cf8 | |
seventeenthShulker | 8099a4bd17 | |
seventeenthShulker | e2ed1ab4a6 | |
seventeenthShulker | e43a8e267d | |
seventeenthShulker | 570caf47eb | |
the-real-herowl | 59f3b53a51 | |
chmodsayshello | ec7e99019e | |
Dehydrate6684 | b320d008ca | |
Nils Dagsson Moskopp | aad231f5e4 | |
Nils Dagsson Moskopp | 10022c93ef | |
Nils Dagsson Moskopp | 01bcbbf927 | |
Nils Dagsson Moskopp | 12a33e458f | |
Nils Dagsson Moskopp | 5dcf714cd1 | |
Nils Dagsson Moskopp | 0c6d9a4d85 | |
Nils Dagsson Moskopp | ef65de54c0 | |
the-real-herowl | 3d7155c1b9 | |
chmodsayshello | e3ab94809e | |
Dark | a66be39d9b | |
ancientmarinerdev | 3564f6ebde | |
chmodsayshello | f99ae93bf6 | |
Nils Dagsson Moskopp | 4d57ba62bf | |
Nils Dagsson Moskopp | 4064333b06 | |
Nils Dagsson Moskopp | e87a8fc332 | |
Freedom | 8d440252a4 | |
the-real-herowl | d706833f21 | |
the-real-herowl | c874e01cf9 | |
the-real-herowl | 7ce82b9dcb | |
the-real-herowl | 645072507f | |
the-real-herowl | 924a6c1c47 | |
the-real-herowl | 20b0f0748d | |
the-real-herowl | d7c76e33d8 | |
the-real-herowl | 966712f4ff | |
the-real-herowl | e4102e6124 | |
the-real-herowl | 17c8f220e6 | |
the-real-herowl | df17688b7d | |
the-real-herowl | 729d8ec9e0 | |
the-real-herowl | c9dc12b081 | |
Nauta Turbidus | a1b6819756 | |
the-real-herowl | f1568483b3 | |
ThePython10110 | d7fa24ebf8 | |
Dehydrate6684 | 23468cc2dd | |
Dehydrate6684 | 0c48a46f7c | |
chmodsayshello | 712a6d6c66 | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | a620d24ec8 | |
ancientmarinerdev | 178b24886f | |
ancientmarinerdev | 8333281b4f | |
Nicu | 6d3e55ce12 | |
ancientmarinerdev | 2c2f5595f3 | |
chmodsayshello | 8936313fb3 | |
ancientmarinerdev | c51442704c | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | 2bd6678b08 | |
Codiac | e0c44244f9 | |
Codiac | 5b7352a23a | |
Michieal | e8c658658d | |
Michieal | e9d994b74d | |
Michieal | eafe6627d8 | |
chmodsayshello | 4046a68fbf | |
Blockhead | 882c3ef339 | |
Nils Dagsson Moskopp | bb68ceb38d | |
codiac | 95db118361 | |
codiac | d2d7887e0f | |
Michieal | b2ebcf5d4f | |
Michieal | f57220f784 | |
codiac | 7577d37b38 | |
codiac | bf4c7e1913 | |
codiac | 11e3674926 | |
Nils Dagsson Moskopp | 4dd3833f3b | |
Nils Dagsson Moskopp | 3029147ed7 | |
Dehydrate6684 | cc217d0089 | |
Dehydrate6684 | e6653b78ee | |
Dehydrate6684 | a960bf2e8e | |
Eliy21 | 2d9bffaa43 | |
Eliy21 | eb658a4996 | |
Julien Palard | 878480d010 | |
chmodsayshello | 49bd28e109 | |
chmodsayshello | 6c107ce990 | |
chmodsayshello | 7c43c15fda | |
chmodsayshello | 291cbaf434 | |
chmodsayshello | fb74689f3d | |
chmodsayshello | da024bb4b8 | |
chmodsayshello | 2f8bb9726b | |
chmodsayshello | 8176e7319f | |
Nils Dagsson Moskopp | 5bf0e79c6f | |
chmodsayshello | 64bc57c6a4 | |
chmodsayshello | d346aa07ee | |
chmodsayshello | 9d1840f4ca | |
chmodsayshello | 5cc9038169 | |
chmodsayshello | 460ef23b50 | |
chmodsayshello | 1e16647fe9 | |
chmodsayshello | 16415ae577 | |
chmodsayshello | 2665980007 | |
chmodsayshello | bb2ce9ef92 | |
chmodsayshello | bc29e4dd95 | |
chmodsayshello | b76ed92aba | |
chmodsayshello | 703f1f46fc | |
chmodsayshello | 0b118c170e | |
chmodsayshello | 8431ac34d0 | |
chmodsayshello | 049128972f | |
chmodsayshello | 0c65d9d11a | |
chmodsayshello | 311beeb31c | |
chmodsayshello | bc3da8dab8 | |
chmodsayshello | ed5232411b | |
chmodsayshello | 6c6a27320d | |
chmodsayshello | 82f2f4784e | |
chmodsayshello | 8476865ea7 | |
chmodsayshello | b4273af245 | |
chmodsayshello | 483285a612 | |
chmodsayshello | b154f2def1 | |
chmodsayshello | c62195662c | |
chmodsayshello | 4dc5ad3bdb | |
chmodsayshello | cc186cc588 | |
chmodsayshello | df8c9625e4 | |
Nils Dagsson Moskopp | e9862f5f24 | |
Nils Dagsson Moskopp | 685bdcb379 | |
Nils Dagsson Moskopp | 7446a275b5 | |
Nils Dagsson Moskopp | 83348bf3ac | |
Nils Dagsson Moskopp | 45e405982a | |
Nils Dagsson Moskopp | e83894fcfa | |
Nils Dagsson Moskopp | 9f9b78eed9 | |
Nils Dagsson Moskopp | ed061e68ff | |
Nils Dagsson Moskopp | 1f9c446a98 | |
Nils Dagsson Moskopp | 7b94fc026d | |
Nils Dagsson Moskopp | fa23775bf9 | |
Nils Dagsson Moskopp | 36ee45ebe3 | |
Nils Dagsson Moskopp | 2112637faf | |
Nils Dagsson Moskopp | 5b79bc6fb7 | |
Nils Dagsson Moskopp | 759b0a188f | |
Nils Dagsson Moskopp | 376b6404b2 | |
Nils Dagsson Moskopp | 9bd1702d60 | |
Nils Dagsson Moskopp | 5640e19c94 | |
Nils Dagsson Moskopp | 25b7b30945 | |
Nils Dagsson Moskopp | 9af0719df8 | |
Nils Dagsson Moskopp | 1b48c3f539 | |
Nils Dagsson Moskopp | 13552f16f2 | |
Nils Dagsson Moskopp | 4f6ea5d035 | |
Nils Dagsson Moskopp | c00b0d50c6 | |
Nils Dagsson Moskopp | adb8e45d67 | |
Nils Dagsson Moskopp | 3f60b5baa6 | |
Nils Dagsson Moskopp | 52e5c955f0 | |
Lizzy Fleckenstein | b88579b52e | |
Lizzy Fleckenstein | eaa4dc99d7 |
|
@ -4,7 +4,7 @@ root = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
[*.lua]
|
[*.lua]
|
||||||
charset = utf8
|
charset = utf-8
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
|
@ -6,3 +6,5 @@
|
||||||
/.idea/
|
/.idea/
|
||||||
*.xcf
|
*.xcf
|
||||||
.Rproj.user
|
.Rproj.user
|
||||||
|
prompt.txt
|
||||||
|
__pycache__
|
||||||
|
|
32
CREDITS.md
32
CREDITS.md
|
@ -8,30 +8,32 @@
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
* AncientMariner
|
* AncientMariner
|
||||||
* Nicu
|
* Herowl
|
||||||
|
|
||||||
## Previous Maintainers
|
## Previous Maintainers
|
||||||
* Fleckenstein
|
* Fleckenstein
|
||||||
* cora
|
* cora
|
||||||
|
* Nicu
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
* AFCMS
|
* AFCMS
|
||||||
* epCode
|
* epCode
|
||||||
* chmodsayshello
|
* chmodsayshello
|
||||||
* PrairieWind
|
|
||||||
* MrRar
|
* MrRar
|
||||||
* FossFanatic
|
* FossFanatic
|
||||||
* SmokeyDope
|
* SmokeyDope
|
||||||
|
* Faerraven / Michieal
|
||||||
|
* Codiac
|
||||||
|
|
||||||
## Past Developers
|
## Past Developers
|
||||||
* jordan4ibanez
|
* jordan4ibanez
|
||||||
* iliekprogrammar
|
* iliekprogrammar
|
||||||
* kabou
|
* kabou
|
||||||
* kay27
|
* kay27
|
||||||
* Faerraven / Michieal
|
|
||||||
* MysticTempest
|
* MysticTempest
|
||||||
* NO11
|
* NO11
|
||||||
* SumianVoice
|
* SumianVoice
|
||||||
|
* PrairieWind
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
* RandomLegoBrick
|
* RandomLegoBrick
|
||||||
|
@ -112,6 +114,21 @@
|
||||||
* Niterux
|
* Niterux
|
||||||
* appgurueu
|
* appgurueu
|
||||||
* seventeenthShulker
|
* seventeenthShulker
|
||||||
|
* DinoNuggies4665
|
||||||
|
* basxto
|
||||||
|
* Morik666
|
||||||
|
* Eliy21
|
||||||
|
* mdk
|
||||||
|
* Alessandra Lozoya
|
||||||
|
* VanicGame
|
||||||
|
* ThePython10110
|
||||||
|
* Araca
|
||||||
|
* Montandalar
|
||||||
|
* mim
|
||||||
|
* Dark
|
||||||
|
* Bakawun
|
||||||
|
* JoseDouglas26
|
||||||
|
* Zasco
|
||||||
|
|
||||||
## Music
|
## Music
|
||||||
* Jordach for the jukebox music compilation from Big Freaking Dig
|
* Jordach for the jukebox music compilation from Big Freaking Dig
|
||||||
|
@ -155,6 +172,7 @@
|
||||||
* cora
|
* cora
|
||||||
* Faerraven / Michieal
|
* Faerraven / Michieal
|
||||||
* PrairieWind
|
* PrairieWind
|
||||||
|
* ChrisPHP
|
||||||
|
|
||||||
## 3D Models
|
## 3D Models
|
||||||
* 22i
|
* 22i
|
||||||
|
@ -162,6 +180,7 @@
|
||||||
* epCode
|
* epCode
|
||||||
* Faerraven / Michieal
|
* Faerraven / Michieal
|
||||||
* SumianVoice
|
* SumianVoice
|
||||||
|
* thunder1035
|
||||||
|
|
||||||
## Textures
|
## Textures
|
||||||
* XSSheep
|
* XSSheep
|
||||||
|
@ -178,8 +197,11 @@
|
||||||
* Faerraven / Michieal
|
* Faerraven / Michieal
|
||||||
* Nicu
|
* Nicu
|
||||||
* Exhale
|
* Exhale
|
||||||
|
* Aeonix_Aeon
|
||||||
* Wbjitscool
|
* Wbjitscool
|
||||||
* SmokeyDope
|
* SmokeyDope
|
||||||
|
* thunder1035
|
||||||
|
* Herowl
|
||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
* Wuzzy
|
* Wuzzy
|
||||||
|
@ -199,6 +221,10 @@
|
||||||
* Temak
|
* Temak
|
||||||
* megustanlosfrijoles
|
* megustanlosfrijoles
|
||||||
* kbundg
|
* kbundg
|
||||||
|
* Isaac Dennis
|
||||||
|
* ADLON
|
||||||
|
* Sab Pyrope
|
||||||
|
* JoseDouglas26
|
||||||
|
|
||||||
## Funders
|
## Funders
|
||||||
* 40W
|
* 40W
|
||||||
|
|
12
GROUPS.md
12
GROUPS.md
|
@ -170,16 +170,8 @@ These groups are used mostly for informational purposes
|
||||||
* `ammo_bow=1`: Item is used as ammo for bows
|
* `ammo_bow=1`: Item is used as ammo for bows
|
||||||
* `non_combat_armor=1`: Item can be equipped as armor, but is not made for combat (e.g. zombie head, pumpkin)
|
* `non_combat_armor=1`: Item can be equipped as armor, but is not made for combat (e.g. zombie head, pumpkin)
|
||||||
* `container`: Node is a container which physically stores items within and has at least 1 inventory
|
* `container`: Node is a container which physically stores items within and has at least 1 inventory
|
||||||
* `container=2`: Has one inventory with list name `"main"`. Items can be placed and taken freely
|
* `container=1`: Container type, which does not allow hoppers to transfer items
|
||||||
* `container=3`: Same as `container=2`, but shulker boxes can not be inserted
|
* `container=2`: Items can be placed and taken freely. Can have inventory with list name `"main"` or define `_mcl_hoppers_on_try_pull`, `_mcl_hoppers_on_try_push`, `_mcl_hoppers_on_after_pull`, `_mcl_hoppers_on_after_push` to play along hoppers nicely.
|
||||||
* `container=4`: Furnace-like, has lists `"src"`, `"fuel"` and `"dst"`.
|
|
||||||
It is expected that this also reacts on `on_timer`;
|
|
||||||
the node timer must be started from other mods when they add into `"src"` or `"fuel"`
|
|
||||||
* `container=5`: Left part of a 2-part horizontal connected container. Both parts have a `"main"` inventory
|
|
||||||
list. Both inventories are considered to belong together. This is used for large chests.
|
|
||||||
* `container=6`: Same as above, but for the right part.
|
|
||||||
* `container=7`: Has inventory list "`main`", no movement allowed
|
|
||||||
* `container=1`: Other/unspecified container type
|
|
||||||
* `spawn_egg=1`: Spawn egg
|
* `spawn_egg=1`: Spawn egg
|
||||||
|
|
||||||
* `pressure_plate=1`: Pressure plate (off)
|
* `pressure_plate=1`: Pressure plate (off)
|
||||||
|
|
4
LEGAL.md
4
LEGAL.md
|
@ -42,6 +42,10 @@ The glazed terracotta textures have been created by [MysticTempest](https://gith
|
||||||
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
|
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
|
||||||
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
|
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
|
||||||
|
|
||||||
|
Armor trim models were created by Aeonix_Aeon
|
||||||
|
Source: <https://www.curseforge.com/minecraft/texture-packs/ozocraft-remix>
|
||||||
|
License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
|
||||||
|
|
||||||
The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
The main menu images are released under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
|
|
||||||
All other files, unless mentioned otherwise, fall under:
|
All other files, unless mentioned otherwise, fall under:
|
||||||
|
|
14
README.md
14
README.md
|
@ -27,7 +27,7 @@ Or you can play in “creative mode” in which you can build almost anything in
|
||||||
## How to play (quick start)
|
## How to play (quick start)
|
||||||
### Getting started
|
### Getting started
|
||||||
* **Punch a tree** trunk until it breaks and collect wood
|
* **Punch a tree** trunk until it breaks and collect wood
|
||||||
* Place the **wood into the 2×2 grid** (your “crafting grid” in your inventory menu and craft 4 wood planks
|
* Place the **wood into the 2×2 grid** (your “crafting grid” in your inventory menu) and craft 4 wood planks
|
||||||
* Place the 4 wood planks in a 2×2 shape in the crafting grid to **make a crafting table**
|
* Place the 4 wood planks in a 2×2 shape in the crafting grid to **make a crafting table**
|
||||||
* **Rightclick the crafting table** for a 3×3 crafting grid to craft more complex things
|
* **Rightclick the crafting table** for a 3×3 crafting grid to craft more complex things
|
||||||
* Use the **crafting guide** (book icon) to learn all the possible crafting recipes
|
* Use the **crafting guide** (book icon) to learn all the possible crafting recipes
|
||||||
|
@ -37,15 +37,15 @@ Or you can play in “creative mode” in which you can build almost anything in
|
||||||
|
|
||||||
### Farming
|
### Farming
|
||||||
* Find seeds
|
* Find seeds
|
||||||
* Craft hoe
|
* Craft a hoe
|
||||||
* Rightclick dirt or similar block with hoe to create farmland
|
* Rightclick dirt or a similar block with a hoe to create farmland
|
||||||
* Place seeds on farmland and watch them grow
|
* Place seeds on farmland and watch them grow
|
||||||
* Collect plant when fully grown
|
* Collect plants when fully grown
|
||||||
* If near water, farmland becomes wet and speeds up growth
|
* If near water, farmland becomes wet and speeds up growth
|
||||||
|
|
||||||
### Furnace
|
### Furnace
|
||||||
* Craft furnace
|
* Craft a furnace
|
||||||
* Furnace allows you to obtain more items
|
* The furnace allows you to obtain more items
|
||||||
* Upper slot must contain a smeltable item (example: iron ore)
|
* Upper slot must contain a smeltable item (example: iron ore)
|
||||||
* Lower slot must contain a fuel item (example: coal)
|
* Lower slot must contain a fuel item (example: coal)
|
||||||
* See tooltips in crafting guide to learn about fuels and smeltable items
|
* See tooltips in crafting guide to learn about fuels and smeltable items
|
||||||
|
@ -162,7 +162,7 @@ Bonus features (not found in Minecraft):
|
||||||
* Built-in crafting guide which shows you crafting and smelting recipes
|
* Built-in crafting guide which shows you crafting and smelting recipes
|
||||||
* In-game help system containing extensive help about gameplay basics, blocks, items and more
|
* In-game help system containing extensive help about gameplay basics, blocks, items and more
|
||||||
* Temporary crafting recipes. They only exist to make some otherwise unaccessible items available when you're not in creative mode. These recipes will be removed as development goes on an more features become available
|
* Temporary crafting recipes. They only exist to make some otherwise unaccessible items available when you're not in creative mode. These recipes will be removed as development goes on an more features become available
|
||||||
* Saplings in chests in mapgen v6
|
* Saplings in chests in [mapgen v6](https://wiki.minetest.net/Map_generator#v6)
|
||||||
* Fully moddable (thanks to Minetest's powerful Lua API)
|
* Fully moddable (thanks to Minetest's powerful Lua API)
|
||||||
* New blocks and items:
|
* New blocks and items:
|
||||||
* Lookup tool, shows you the help for whatever it touches
|
* Lookup tool, shows you the help for whatever it touches
|
||||||
|
|
|
@ -137,7 +137,7 @@ Fonctionnalités bonus (absentes de Minecraft) :
|
||||||
* Guide d'artisanat intégré au jeu qui montre les recettes d'artisanat et de cuisson
|
* Guide d'artisanat intégré au jeu qui montre les recettes d'artisanat et de cuisson
|
||||||
* Système d'aide intégré au jeu contenant des informations à propos des techniques de base, blocs, objets et plus
|
* Système d'aide intégré au jeu contenant des informations à propos des techniques de base, blocs, objets et plus
|
||||||
* Recettes d'artisanat temporaires. Elles existent uniquement pour rendre des objets accessibles qui ne le seraient pas autrement sauf en mode créatif. Elles seront retirées au cours de l'avancement du développement et de l'ajout de nouvelles fonctionnalités.
|
* Recettes d'artisanat temporaires. Elles existent uniquement pour rendre des objets accessibles qui ne le seraient pas autrement sauf en mode créatif. Elles seront retirées au cours de l'avancement du développement et de l'ajout de nouvelles fonctionnalités.
|
||||||
* Pousses dans les coffres en mapgen v6
|
* Pousses dans les coffres en [mapgen v6](https://wiki.minetest.net/Map_generator#v6)
|
||||||
* Entièrement moddable (grâce la puissante API Lua de Minetest)
|
* Entièrement moddable (grâce la puissante API Lua de Minetest)
|
||||||
* Nouveaux blocs et objets :
|
* Nouveaux blocs et objets :
|
||||||
* Outil de recherche, montre l'aide de ce qu'il touche
|
* Outil de recherche, montre l'aide de ce qu'il touche
|
||||||
|
|
|
@ -154,12 +154,12 @@ Mineclone2, то ветка master обычно относительно ста
|
||||||
* Некоторые вагонетки (с сундуком и с воронкой уже работают)
|
* Некоторые вагонетки (с сундуком и с воронкой уже работают)
|
||||||
* Пара нетривиальных блоков и предметов
|
* Пара нетривиальных блоков и предметов
|
||||||
|
|
||||||
Бонусные воронкой (нет в Minecraft-е):
|
Бонусные возможности (нет в Minecraft-е):
|
||||||
|
|
||||||
* Встроенный гайд для крафта покажет вам рецепты крафта и переплавки
|
* Встроенный гайд для крафта покажет вам рецепты крафта и переплавки
|
||||||
* Внутриигровая справка содержит всестороннюю информацию об основах игры, блоках, предметах и прочее
|
* Внутриигровая справка содержит всестороннюю информацию об основах игры, блоках, предметах и прочее
|
||||||
* Временные рецепты крафта. Они существуют, чтобы получить доступ к ранее недоступным предметам вне творческого режима. Они будут удалены как только разработка позволит им стать доступными
|
* Временные рецепты крафта. Они существуют, чтобы получить доступ к ранее недоступным предметам вне творческого режима. Они будут удалены как только разработка позволит им стать доступными
|
||||||
* Саженцы в сундуках мапгена v6
|
* Саженцы в сундуках в [mapgen v6](https://wiki.minetest.net/Map_generator#v6)
|
||||||
* Полностью модифицируема (благодаря мощному Lua API в Minetest)
|
* Полностью модифицируема (благодаря мощному Lua API в Minetest)
|
||||||
* Новые блоки и предметы:
|
* Новые блоки и предметы:
|
||||||
* Инструмент просмотра покажет справку о том чего коснется
|
* Инструмент просмотра покажет справку о том чего коснется
|
||||||
|
@ -177,7 +177,7 @@ Mineclone2, то ветка master обычно относительно ста
|
||||||
* Недостающие блоки, предметы, мобы
|
* Недостающие блоки, предметы, мобы
|
||||||
* Некоторые предметы с другими названиями, чтобы лучше их различать
|
* Некоторые предметы с другими названиями, чтобы лучше их различать
|
||||||
* Другая музыка для проигрывателей
|
* Другая музыка для проигрывателей
|
||||||
* Другие текступы (Pixel Perfection)
|
* Другие текстуры (Pixel Perfection)
|
||||||
* Другие звуки (разные источники)
|
* Другие звуки (разные источники)
|
||||||
* Другой движок (Minetest)
|
* Другой движок (Minetest)
|
||||||
* Другие пасхалки
|
* Другие пасхалки
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
title = MineClone 2
|
title = MineClone 2
|
||||||
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
|
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
|
||||||
disallowed_mapgens = v6
|
disallowed_mapgens = v6
|
||||||
version=0.85.0-SNAPSHOT
|
version=0.87.0-SNAPSHOT
|
||||||
|
|
|
@ -31,6 +31,7 @@ local known_controls = {
|
||||||
aux1 = true,
|
aux1 = true,
|
||||||
down = true,
|
down = true,
|
||||||
up = true,
|
up = true,
|
||||||
|
zoom = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_explosions
|
||||||
|
@1 was caught in an explosion.=@1 z-es mòrt dins una explosion
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_explosions
|
||||||
|
@1 was caught in an explosion.=@1 foi pego(a) em uma explosão.
|
|
@ -36,6 +36,8 @@ mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16)
|
||||||
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
||||||
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, minetest.MAX_MAP_GENERATION_LIMIT or 31000)
|
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, minetest.MAX_MAP_GENERATION_LIMIT or 31000)
|
||||||
|
|
||||||
|
-- Central chunk is offset from 0,0,0 coordinates by 32 nodes (2 blocks)
|
||||||
|
-- See more in https://git.minetest.land/MineClone2/MineClone2/wiki/World-structure%3A-positions%2C-boundaries%2C-blocks%2C-chunks%2C-dimensions%2C-barriers-and-the-void
|
||||||
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
||||||
|
|
||||||
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
||||||
|
|
|
@ -11,4 +11,4 @@ For example, Copper Blocks have the definition arguement of `_mcl_waxed_variant
|
||||||
|
|
||||||
For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node.
|
For waxed nodes, scraping is easy. Start by putting `waxed = 1` into the list of groups of the waxed node.
|
||||||
Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table.
|
Next put `_mcl_stripped_variant = item string of the unwaxed variant of the node` into the defintion table.
|
||||||
Wxaed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`.
|
Waxed Copper Blocks can be scrapped into normal Copper Blocks because of the definition `_mcl_stripped_variant = "mcl_copper:block"`.
|
||||||
|
|
|
@ -22,6 +22,30 @@ function table.update_nil(t, ...)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Works the same as `pairs`, but order returned by keys
|
||||||
|
---
|
||||||
|
---Taken from https://www.lua.org/pil/19.3.html
|
||||||
|
---@generic T: table, K, V, C
|
||||||
|
---@param t T
|
||||||
|
---@param f? fun(a: C, b: C):boolean
|
||||||
|
---@return fun():K, V
|
||||||
|
function table.pairs_by_keys(t, f)
|
||||||
|
local a = {}
|
||||||
|
for n in pairs(t) do table.insert(a, n) end
|
||||||
|
table.sort(a, f)
|
||||||
|
|
||||||
|
local i = 0 -- iterator variable
|
||||||
|
local function iter() -- iterator function
|
||||||
|
i = i + 1
|
||||||
|
if a[i] == nil then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return a[i], t[a[i]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return iter
|
||||||
|
end
|
||||||
|
|
||||||
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false)
|
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false)
|
||||||
local LOG_MODULE = "[MCL2]"
|
local LOG_MODULE = "[MCL2]"
|
||||||
function mcl_util.mcl_log(message, module, bypass_default_logger)
|
function mcl_util.mcl_log(message, module, bypass_default_logger)
|
||||||
|
@ -74,6 +98,18 @@ function mcl_util.check_dtime_timer(self, dtime, timer_name, threshold)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- While we should always favour the new minetest vector functions such as vector.new or vector.offset which validate on
|
||||||
|
-- creation. There may be cases where state gets corrupted and we may have to check the vector is valid if created the
|
||||||
|
-- old way. This allows us to do this as a tactical solution until old style vectors are completely removed.
|
||||||
|
function mcl_util.validate_vector (vect)
|
||||||
|
if vect then
|
||||||
|
if tonumber(vect.x) and tonumber(vect.y) and tonumber(vect.z) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Minetest 5.3.0 or less can only measure the light level. This came in at 5.4
|
-- Minetest 5.3.0 or less can only measure the light level. This came in at 5.4
|
||||||
-- This function has been known to fail in multiple places so the error handling is added increase safety and improve
|
-- This function has been known to fail in multiple places so the error handling is added increase safety and improve
|
||||||
-- debugging. See:
|
-- debugging. See:
|
||||||
|
@ -124,7 +160,7 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local undef = minetest.registered_nodes[unode.name]
|
local undef = minetest.registered_nodes[unode.name]
|
||||||
if undef and undef.on_rightclick then
|
if undef and undef.on_rightclick and not invert_wall then
|
||||||
undef.on_rightclick(pointed_thing.under, unode, placer,
|
undef.on_rightclick(pointed_thing.under, unode, placer,
|
||||||
itemstack, pointed_thing)
|
itemstack, pointed_thing)
|
||||||
return
|
return
|
||||||
|
@ -162,26 +198,12 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini
|
||||||
|
|
||||||
local p2
|
local p2
|
||||||
if is_y then
|
if is_y then
|
||||||
if invert_wall then
|
p2 = 0
|
||||||
if fdir == 3 or fdir == 1 then
|
|
||||||
p2 = 12
|
|
||||||
else
|
|
||||||
p2 = 6
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif is_x then
|
elseif is_x then
|
||||||
if invert_wall then
|
|
||||||
p2 = 0
|
|
||||||
else
|
|
||||||
p2 = 12
|
p2 = 12
|
||||||
end
|
|
||||||
elseif is_z then
|
elseif is_z then
|
||||||
if invert_wall then
|
|
||||||
p2 = 0
|
|
||||||
else
|
|
||||||
p2 = 6
|
p2 = 6
|
||||||
end
|
end
|
||||||
end
|
|
||||||
minetest.set_node(pos, {name = wield_name, param2 = p2})
|
minetest.set_node(pos, {name = wield_name, param2 = p2})
|
||||||
|
|
||||||
if not infinitestacks then
|
if not infinitestacks then
|
||||||
|
@ -229,34 +251,34 @@ function mcl_util.get_double_container_neighbor_pos(pos, param2, side)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Iterates through all items in the given inventory and
|
--- Selects item stack to transfer from
|
||||||
-- returns the slot of the first item which matches a condition.
|
---@param src_inventory InvRef Source innentory to pull from
|
||||||
-- Returns nil if no item was found.
|
---@param src_list string Name of source inventory list to pull from
|
||||||
--- source_inventory: Inventory to take the item from
|
---@param dst_inventory InvRef Destination inventory to push to
|
||||||
--- source_list: List name of the source inventory from which to take the item
|
---@param dst_list string Name of destination inventory list to push to
|
||||||
--- destination_inventory: Put item into this inventory
|
---@param condition? fun(stack: ItemStack) Condition which items are allowed to be transfered.
|
||||||
--- destination_list: List name of the destination inventory to which to put the item into
|
---@param count? integer Number of items to try to transfer at once
|
||||||
--- condition: Function which takes an itemstack and returns true if it matches the desired item condition.
|
---@return integer Item stack number to be transfered
|
||||||
--- If set to nil, the slot of the first item stack will be taken unconditionally.
|
function mcl_util.select_stack(src_inventory, src_list, dst_inventory, dst_list, condition, count)
|
||||||
-- dst_inventory and dst_list can also be nil if condition is nil.
|
local src_size = src_inventory:get_size(src_list)
|
||||||
function mcl_util.get_eligible_transfer_item_slot(src_inventory, src_list, dst_inventory, dst_list, condition)
|
|
||||||
local size = src_inventory:get_size(src_list)
|
|
||||||
local stack
|
local stack
|
||||||
for i = 1, size do
|
for i = 1, src_size do
|
||||||
stack = src_inventory:get_stack(src_list, i)
|
stack = src_inventory:get_stack(src_list, i)
|
||||||
if not stack:is_empty() and (condition == nil or condition(stack, src_inventory, src_list, dst_inventory, dst_list)) then
|
|
||||||
|
-- Allow for partial stack movement
|
||||||
|
if count and stack:get_count() >= count then
|
||||||
|
local new_stack = ItemStack(stack)
|
||||||
|
new_stack:set_count(count)
|
||||||
|
stack = new_stack
|
||||||
|
end
|
||||||
|
|
||||||
|
if not stack:is_empty() and dst_inventory:room_for_item(dst_list, stack) and ((condition == nil or condition(stack))) then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns true if itemstack is a shulker box
|
|
||||||
local function is_not_shulker_box(itemstack)
|
|
||||||
local g = minetest.get_item_group(itemstack:get_name(), "shulker_box")
|
|
||||||
return g == 0 or g == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Moves a single item from one inventory to another.
|
-- Moves a single item from one inventory to another.
|
||||||
--- source_inventory: Inventory to take the item from
|
--- source_inventory: Inventory to take the item from
|
||||||
--- source_list: List name of the source inventory from which to take the item
|
--- source_list: List name of the source inventory from which to take the item
|
||||||
|
@ -267,16 +289,13 @@ end
|
||||||
-- Returns true on success and false on failure
|
-- Returns true on success and false on failure
|
||||||
-- Possible failures: No item in source slot, destination inventory full
|
-- Possible failures: No item in source slot, destination inventory full
|
||||||
function mcl_util.move_item(source_inventory, source_list, source_stack_id, destination_inventory, destination_list)
|
function mcl_util.move_item(source_inventory, source_list, source_stack_id, destination_inventory, destination_list)
|
||||||
if source_stack_id == -1 then
|
-- Can't move items we don't have
|
||||||
source_stack_id = mcl_util.get_first_occupied_inventory_slot(source_inventory, source_list)
|
if source_inventory:is_empty(source_list) then return false end
|
||||||
if source_stack_id == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not source_inventory:is_empty(source_list) then
|
-- Can't move from an empty stack
|
||||||
local stack = source_inventory:get_stack(source_list, source_stack_id)
|
local stack = source_inventory:get_stack(source_list, source_stack_id)
|
||||||
if not stack:is_empty() then
|
if stack:is_empty() then return false end
|
||||||
|
|
||||||
local new_stack = ItemStack(stack)
|
local new_stack = ItemStack(stack)
|
||||||
new_stack:set_count(1)
|
new_stack:set_count(1)
|
||||||
if not destination_inventory:room_for_item(destination_list, new_stack) then
|
if not destination_inventory:room_for_item(destination_list, new_stack) then
|
||||||
|
@ -286,155 +305,75 @@ function mcl_util.move_item(source_inventory, source_list, source_stack_id, dest
|
||||||
source_inventory:set_stack(source_list, source_stack_id, stack)
|
source_inventory:set_stack(source_list, source_stack_id, stack)
|
||||||
destination_inventory:add_item(destination_list, new_stack)
|
destination_inventory:add_item(destination_list, new_stack)
|
||||||
return true
|
return true
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Moves a single item from one container node into another. Performs a variety of high-level
|
--- Try pushing item from hopper inventory to destination inventory
|
||||||
-- checks to prevent invalid transfers such as shulker boxes into shulker boxes
|
---@param pos Vector
|
||||||
--- source_pos: Position ({x,y,z}) of the node to take the item from
|
---@param dst_pos Vector
|
||||||
--- destination_pos: Position ({x,y,z}) of the node to put the item into
|
function mcl_util.hopper_push(pos, dst_pos)
|
||||||
--- source_list (optional): List name of the source inventory from which to take the item. Default is normally "main"; "dst" for furnace
|
local hop_inv = minetest.get_meta(pos):get_inventory()
|
||||||
--- source_stack_id (optional): The inventory position ID of the source inventory to take the item from (-1 for slot of the first valid item; -1 is default)
|
local hop_list = 'main'
|
||||||
--- destination_list (optional): List name of the destination inventory. Default is normally "main"; "src" for furnace
|
|
||||||
-- Returns true on success and false on failure.
|
|
||||||
function mcl_util.move_item_container(source_pos, destination_pos, source_list, source_stack_id, destination_list)
|
|
||||||
local dpos = table.copy(destination_pos)
|
|
||||||
local spos = table.copy(source_pos)
|
|
||||||
local snode = minetest.get_node(spos)
|
|
||||||
local dnode = minetest.get_node(dpos)
|
|
||||||
|
|
||||||
local dctype = minetest.get_item_group(dnode.name, "container")
|
-- Get node pos' for item transfer
|
||||||
local sctype = minetest.get_item_group(snode.name, "container")
|
local dst = minetest.get_node(dst_pos)
|
||||||
|
if not minetest.registered_nodes[dst.name] then return end
|
||||||
|
local dst_type = minetest.get_item_group(dst.name, "container")
|
||||||
|
if dst_type ~= 2 then return end
|
||||||
|
local dst_def = minetest.registered_nodes[dst.name]
|
||||||
|
|
||||||
-- Container type 7 does not allow any movement
|
local dst_list = 'main'
|
||||||
if sctype == 7 then
|
local dst_inv, stack_id
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Normalize double container by forcing to always use the left segment first
|
-- Find a inventory stack in the destination
|
||||||
local function normalize_double_container(pos, node, ctype)
|
if dst_def._mcl_hoppers_on_try_push then
|
||||||
if ctype == 6 then
|
dst_inv, dst_list, stack_id = dst_def._mcl_hoppers_on_try_push(dst_pos, pos, hop_inv, hop_list)
|
||||||
pos = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
|
||||||
if not pos then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
ctype = minetest.get_item_group(node.name, "container")
|
|
||||||
-- The left segment seems incorrect? We better bail out!
|
|
||||||
if ctype ~= 5 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return pos, node, ctype
|
|
||||||
end
|
|
||||||
|
|
||||||
spos, snode, sctype = normalize_double_container(spos, snode, sctype)
|
|
||||||
dpos, dnode, dctype = normalize_double_container(dpos, dnode, dctype)
|
|
||||||
if not spos or not dpos then return false end
|
|
||||||
|
|
||||||
local smeta = minetest.get_meta(spos)
|
|
||||||
local dmeta = minetest.get_meta(dpos)
|
|
||||||
|
|
||||||
local sinv = smeta:get_inventory()
|
|
||||||
local dinv = dmeta:get_inventory()
|
|
||||||
|
|
||||||
-- Default source lists
|
|
||||||
if not source_list then
|
|
||||||
-- Main inventory for most container types
|
|
||||||
if sctype == 2 or sctype == 3 or sctype == 5 or sctype == 6 or sctype == 7 then
|
|
||||||
source_list = "main"
|
|
||||||
-- Furnace: output
|
|
||||||
elseif sctype == 4 then
|
|
||||||
source_list = "dst"
|
|
||||||
-- Unknown source container type. Bail out
|
|
||||||
else
|
else
|
||||||
return false
|
local dst_meta = minetest.get_meta(dst_pos)
|
||||||
end
|
dst_inv = dst_meta:get_inventory()
|
||||||
|
stack_id = mcl_util.select_stack(hop_inv, hop_list, dst_inv, dst_list, nil, 1)
|
||||||
end
|
end
|
||||||
|
if not stack_id then return false end
|
||||||
|
|
||||||
-- Automatically select stack slot ID if set to automatic
|
-- Move the item
|
||||||
if not source_stack_id then
|
local ok = mcl_util.move_item(hop_inv, hop_list, stack_id, dst_inv, dst_list)
|
||||||
source_stack_id = -1
|
if dst_def._mcl_hoppers_on_after_push then
|
||||||
end
|
dst_def._mcl_hoppers_on_after_push(dst_pos)
|
||||||
if source_stack_id == -1 then
|
|
||||||
local cond = nil
|
|
||||||
-- Prevent shulker box inception
|
|
||||||
if dctype == 3 then
|
|
||||||
cond = is_not_shulker_box
|
|
||||||
end
|
|
||||||
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
|
||||||
if not source_stack_id then
|
|
||||||
-- Try again if source is a double container
|
|
||||||
if sctype == 5 then
|
|
||||||
spos = mcl_util.get_double_container_neighbor_pos(spos, snode.param2, "left")
|
|
||||||
smeta = minetest.get_meta(spos)
|
|
||||||
sinv = smeta:get_inventory()
|
|
||||||
|
|
||||||
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
|
||||||
if not source_stack_id then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Abort transfer if shulker box wants to go into shulker box
|
|
||||||
if dctype == 3 then
|
|
||||||
local stack = sinv:get_stack(source_list, source_stack_id)
|
|
||||||
if stack and minetest.get_item_group(stack:get_name(), "shulker_box") == 1 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Container type 7 does not allow any placement
|
|
||||||
if dctype == 7 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If it's a container, put it into the container
|
|
||||||
if dctype ~= 0 then
|
|
||||||
-- Automatically select a destination list if omitted
|
|
||||||
if not destination_list then
|
|
||||||
-- Main inventory for most container types
|
|
||||||
if dctype == 2 or dctype == 3 or dctype == 5 or dctype == 6 or dctype == 7 then
|
|
||||||
destination_list = "main"
|
|
||||||
-- Furnace source slot
|
|
||||||
elseif dctype == 4 then
|
|
||||||
destination_list = "src"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if destination_list then
|
|
||||||
-- Move item
|
|
||||||
local ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
|
||||||
|
|
||||||
-- Try transfer to neighbor node if transfer failed and double container
|
|
||||||
if not ok and dctype == 5 then
|
|
||||||
dpos = mcl_util.get_double_container_neighbor_pos(dpos, dnode.param2, "left")
|
|
||||||
dmeta = minetest.get_meta(dpos)
|
|
||||||
dinv = dmeta:get_inventory()
|
|
||||||
|
|
||||||
ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Update furnace
|
|
||||||
if ok and dctype == 4 then
|
|
||||||
-- Start furnace's timer function, it will sort out whether furnace can burn or not.
|
|
||||||
minetest.get_node_timer(dpos):start(1.0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the ID of the first non-empty slot in the given inventory list
|
-- Try pulling from source inventory to hopper inventory
|
||||||
-- or nil, if inventory is empty.
|
---@param pos Vector
|
||||||
function mcl_util.get_first_occupied_inventory_slot(inventory, listname)
|
---@param src_pos Vector
|
||||||
return mcl_util.get_eligible_transfer_item_slot(inventory, listname)
|
function mcl_util.hopper_pull(pos, src_pos)
|
||||||
|
local hop_inv = minetest.get_meta(pos):get_inventory()
|
||||||
|
local hop_list = 'main'
|
||||||
|
|
||||||
|
-- Get node pos' for item transfer
|
||||||
|
local src = minetest.get_node(src_pos)
|
||||||
|
if not minetest.registered_nodes[src.name] then return end
|
||||||
|
local src_type = minetest.get_item_group(src.name, "container")
|
||||||
|
if src_type ~= 2 then return end
|
||||||
|
local src_def = minetest.registered_nodes[src.name]
|
||||||
|
|
||||||
|
local src_list = 'main'
|
||||||
|
local src_inv, stack_id
|
||||||
|
|
||||||
|
if src_def._mcl_hoppers_on_try_pull then
|
||||||
|
src_inv, src_list, stack_id = src_def._mcl_hoppers_on_try_pull(src_pos, pos, hop_inv, hop_list)
|
||||||
|
else
|
||||||
|
local src_meta = minetest.get_meta(src_pos)
|
||||||
|
src_inv = src_meta:get_inventory()
|
||||||
|
stack_id = mcl_util.select_stack(src_inv, src_list, hop_inv, hop_list, nil, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if stack_id ~= nil then
|
||||||
|
local ok = mcl_util.move_item(src_inv, src_list, stack_id, hop_inv, hop_list)
|
||||||
|
if src_def._mcl_hoppers_on_after_pull then
|
||||||
|
src_def._mcl_hoppers_on_after_pull(src_pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drop_item_stack(pos, stack)
|
local function drop_item_stack(pos, stack)
|
||||||
|
@ -612,7 +551,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
elseif not target:is_player() then return end
|
||||||
|
|
||||||
local is_immortal = target:get_armor_groups().immortal or 0
|
local is_immortal = target:get_armor_groups().immortal or 0
|
||||||
if is_immortal>0 then
|
if is_immortal>0 then
|
||||||
|
@ -1101,3 +1040,62 @@ function mcl_util.get_colorwallmounted_rotation(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Move items from one inventory list to another, drop items that do not fit in provided pos and direction.
|
||||||
|
---@param src_inv mt.InvRef
|
||||||
|
---@param src_listname string
|
||||||
|
---@param out_inv mt.InvRef
|
||||||
|
---@param out_listname string
|
||||||
|
---@param pos mt.Vector Position to throw items at
|
||||||
|
---@param dir? mt.Vector Direction to throw items in
|
||||||
|
---@param insta_collect? boolean Enable instant collection, let players collect dropped items instantly. Default `false`
|
||||||
|
function mcl_util.move_list(src_inv, src_listname, out_inv, out_listname, pos, dir, insta_collect)
|
||||||
|
local src_list = src_inv:get_list(src_listname)
|
||||||
|
|
||||||
|
if not src_list then return end
|
||||||
|
for i, stack in ipairs(src_list) do
|
||||||
|
if out_inv:room_for_item(out_listname, stack) then
|
||||||
|
out_inv:add_item(out_listname, stack)
|
||||||
|
else
|
||||||
|
local p = vector.copy(pos)
|
||||||
|
p.x = p.x + (math.random(1, 3) * 0.2)
|
||||||
|
p.z = p.z + (math.random(1, 3) * 0.2)
|
||||||
|
|
||||||
|
local obj = minetest.add_item(p, stack)
|
||||||
|
if obj then
|
||||||
|
if dir then
|
||||||
|
local v = vector.copy(dir)
|
||||||
|
v.x = v.x * 4
|
||||||
|
v.y = v.y * 4 + 2
|
||||||
|
v.z = v.z * 4
|
||||||
|
obj:set_velocity(v)
|
||||||
|
mcl_util.mcl_log("item velocity calculated "..vector.to_string(v), "[mcl_util]")
|
||||||
|
end
|
||||||
|
if not insta_collect then
|
||||||
|
obj:get_luaentity()._insta_collect = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stack:clear()
|
||||||
|
src_inv:set_stack(src_listname, i, stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---Move items from a player's inventory list to its main inventory list, drop items that do not fit in front of him.
|
||||||
|
---@param player mt.PlayerObjectRef
|
||||||
|
---@param src_listname string
|
||||||
|
function mcl_util.move_player_list(player, src_listname)
|
||||||
|
mcl_util.move_list(player:get_inventory(), src_listname, player:get_inventory(), "main",
|
||||||
|
vector.offset(player:get_pos(), 0, 1.2, 0),
|
||||||
|
player:get_look_dir(), false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_util.is_it_christmas()
|
||||||
|
local date = os.date("*t")
|
||||||
|
if date.month == 12 and date.day >= 24 or date.month == 1 and date.day <= 7 then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If 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 convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
@ -1,4 +1,87 @@
|
||||||
# tga_encoder
|
# tga_encoder
|
||||||
A TGA Encoder written in Lua without the use of external Libraries.
|
A TGA Encoder written in Lua without the use of external Libraries.
|
||||||
|
|
||||||
|
Created by fleckenstein for MineClone2, then improved by erlehmann.
|
||||||
|
|
||||||
May be used as a Minetest mod.
|
May be used as a Minetest mod.
|
||||||
|
|
||||||
|
See `examples.lua` for example code and usage hints.
|
||||||
|
|
||||||
|
## Use Cases for `tga_encoder`
|
||||||
|
|
||||||
|
### Encoding Textures for Editing
|
||||||
|
|
||||||
|
TGA images of types 1/2/3 consist of header data followed by a pixel array.
|
||||||
|
|
||||||
|
This makes it trivial to parse TGA files – and even edit pixels in-place.
|
||||||
|
|
||||||
|
No checksums need to be updated on any kind of in-place texture editing.
|
||||||
|
|
||||||
|
**Tip**: When storing an editable image in item meta, use zlib compression.
|
||||||
|
|
||||||
|
### Legacy Minetest Texture Encoding
|
||||||
|
|
||||||
|
Minetest 5.4 did not include `minetest.encode_png()` (or any equvivalent).
|
||||||
|
|
||||||
|
Since `tga_encoder` is written in pure Lua, it does not need engine support.
|
||||||
|
|
||||||
|
**Tip:** Look at `examples.lua` and the Minetest mod `mcl_maps` for guidance.
|
||||||
|
|
||||||
|
### Advanced Texture Format Control
|
||||||
|
|
||||||
|
The function `minetest.encode_png()` always encodes images as 32bpp RGBA.
|
||||||
|
|
||||||
|
`tga_encoder` allows saving images as grayscale, 16bpp RGBA and 24bpp RGB.
|
||||||
|
|
||||||
|
For generating maps from terrain, color-mapped formats can be more useful.
|
||||||
|
|
||||||
|
### Encoding Very Small Textures
|
||||||
|
|
||||||
|
Images of size 8×8 or below are often smaller than an equivalent PNG file.
|
||||||
|
|
||||||
|
Note that on many filesystems files use at least 4096 bytes (i.e. 64×64).
|
||||||
|
|
||||||
|
Therefore, saving bytes on files up to a few 100 bytes is often useless.
|
||||||
|
|
||||||
|
### Encoding Reference Textures
|
||||||
|
|
||||||
|
TGA is a simple format, which makes it easy to create reference textures.
|
||||||
|
|
||||||
|
Using a hex editor, one can trivially see how all the pixels are stored.
|
||||||
|
|
||||||
|
## Supported Image Types
|
||||||
|
|
||||||
|
For all types, images are encoded in a fast single pass (i.e. append-only).
|
||||||
|
|
||||||
|
### Color-Mapped Images (Type 1)
|
||||||
|
|
||||||
|
These images contain a palette, followed by pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (8bpp RGB)
|
||||||
|
* `B8G8R8` (8bpp RGB)
|
||||||
|
* `B8G8R8A8` (8bpp RGBA)
|
||||||
|
|
||||||
|
### True-Color Images (Type 2)
|
||||||
|
|
||||||
|
These images contain uncompressed RGB(A) pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (16bpp RGBA)
|
||||||
|
* `B8G8R8` (24bpp RGB)
|
||||||
|
* `B8G8R8A8` (32bpp RGBA)
|
||||||
|
|
||||||
|
### Grayscale Images (Type 3)
|
||||||
|
|
||||||
|
* `Y8` (8bpp grayscale)
|
||||||
|
|
||||||
|
### Run-Length Encoded (RLE), True-Color Images (Type 10)
|
||||||
|
|
||||||
|
These images contain compressed RGB(A) pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (16bpp RGBA)
|
||||||
|
* `B8G8R8` (24bpp RGB)
|
||||||
|
* `B8G8R8A8` (32bpp RGBA)
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Actually support `R8G8B8A8` input for `A1R5G5B5` output
|
||||||
|
* Add both zoomable and explorable maps to `mcl_maps`.
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
dofile("init.lua")
|
||||||
|
|
||||||
|
-- This generates images necessary to colorize 16 Minetest nodes in 4096 colors.
|
||||||
|
-- It serves as a demonstration of what you can achieve using colormapped nodes.
|
||||||
|
-- It is be useful for grass or beam or glass nodes that need to blend smoothly.
|
||||||
|
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 4) - 1
|
||||||
|
local max_sample_out = math.pow(2, 8) - 1
|
||||||
|
|
||||||
|
for r = 0,15 do
|
||||||
|
local pixels = {}
|
||||||
|
for g = 0,15 do
|
||||||
|
if nil == pixels[g + 1] then
|
||||||
|
pixels[g + 1] = {}
|
||||||
|
end
|
||||||
|
for b = 0,15 do
|
||||||
|
local color = {
|
||||||
|
math.floor((r * max_sample_out / max_sample_in) + 0.5),
|
||||||
|
math.floor((g * max_sample_out / max_sample_in) + 0.5),
|
||||||
|
math.floor((b * max_sample_out / max_sample_in) + 0.5),
|
||||||
|
}
|
||||||
|
pixels[g + 1][b + 1] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local filename = "colormap_" .. tostring(r) .. ".tga"
|
||||||
|
tga_encoder.image(pixels):save(
|
||||||
|
filename,
|
||||||
|
{ color_format="A1R5G5B5" } -- waste less bits
|
||||||
|
)
|
||||||
|
end
|
|
@ -0,0 +1,105 @@
|
||||||
|
#!/usr/bin/env lua5.1
|
||||||
|
-- -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
-- 3D “donut” shape rendering using floating-point math
|
||||||
|
-- see <https://www.a1k0n.net/2011/07/20/donut-math.html>
|
||||||
|
|
||||||
|
-- cargo-culted by erle 2023-09-18
|
||||||
|
|
||||||
|
local theta_spacing = 0.01 -- 0.07
|
||||||
|
local phi_spacing = 0.002 -- 0.02
|
||||||
|
|
||||||
|
local R1 = 1
|
||||||
|
local R2 = 2
|
||||||
|
local K2 = 5
|
||||||
|
|
||||||
|
local screen_height = 256
|
||||||
|
local screen_width = 256
|
||||||
|
|
||||||
|
local K1 = screen_width * K2 * 3 / ( 8 * ( R1 + R2 ) )
|
||||||
|
|
||||||
|
local output = {}
|
||||||
|
local zbuffer = {}
|
||||||
|
|
||||||
|
local grey = { 120, 120, 120 }
|
||||||
|
local gray = { 136, 136, 136 }
|
||||||
|
|
||||||
|
for y = 1,screen_height,1 do
|
||||||
|
output[y] = {}
|
||||||
|
zbuffer[y] = {}
|
||||||
|
for x = 1,screen_width,1 do
|
||||||
|
local hori = math.floor( ( (y - 1) / 32 ) % 2 )
|
||||||
|
local vert = math.floor( ( (x - 1) / 32 ) % 2 )
|
||||||
|
output[y][x] = hori ~= vert and grey or gray
|
||||||
|
zbuffer[y][x] = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function render_frame(A, B)
|
||||||
|
-- precompute sines and cosines of A and B
|
||||||
|
local cosA = math.cos(A)
|
||||||
|
local sinA = math.sin(A)
|
||||||
|
local cosB = math.cos(B)
|
||||||
|
local sinB = math.sin(B)
|
||||||
|
|
||||||
|
-- theta goas around the cross-sectional circle of a torus
|
||||||
|
local theta = 0
|
||||||
|
while theta <= 2*math.pi do
|
||||||
|
if ( theta < 2*math.pi * 1/8 ) or ( theta > 2*math.pi * 7/8 ) then
|
||||||
|
theta = theta + (theta_spacing * 16)
|
||||||
|
else
|
||||||
|
theta = theta + theta_spacing
|
||||||
|
end
|
||||||
|
-- precompute sines and cosines of theta
|
||||||
|
local costheta = math.cos(theta)
|
||||||
|
local sintheta = math.sin(theta)
|
||||||
|
|
||||||
|
-- phi goes around the center of revolution of a torus
|
||||||
|
local phi = 0
|
||||||
|
while phi <= 2*math.pi do
|
||||||
|
if ( phi > 2*math.pi * 3/8 ) and ( phi < 2*math.pi * 5/8 ) then
|
||||||
|
phi = phi + (phi_spacing * 128)
|
||||||
|
else
|
||||||
|
phi = phi + phi_spacing
|
||||||
|
end
|
||||||
|
-- precompute sines and cosines of phi
|
||||||
|
local cosphi = math.cos(phi)
|
||||||
|
local sinphi = math.sin(phi)
|
||||||
|
|
||||||
|
-- 2D (x, y) coordinates of the circle, before revolving
|
||||||
|
local circlex = R2 + R1*costheta
|
||||||
|
local circley = R1*sintheta
|
||||||
|
|
||||||
|
-- 3D (x, y, z) coordinates after rotation
|
||||||
|
local x = circlex*(cosB*cosphi + sinA*sinB*sinphi) - circley*cosA*sinB
|
||||||
|
local y = circlex*(sinB*cosphi - sinA*cosB*sinphi) + circley*cosA*cosB
|
||||||
|
local z = K2 + cosA*circlex*sinphi + circley*sinA
|
||||||
|
|
||||||
|
local ooz = 1/z
|
||||||
|
|
||||||
|
-- x and y projection
|
||||||
|
local xp = math.floor(screen_width/2 + K1*ooz*x)
|
||||||
|
local yp = math.floor(screen_height/2 + K1*ooz*y)
|
||||||
|
|
||||||
|
-- calculate luminance
|
||||||
|
local L = cosphi*costheta*sinB - cosA*costheta*sinphi - sinA*sintheta + cosB*( cosA*sintheta - costheta*sinA*sinphi )
|
||||||
|
-- if (L > 0) then
|
||||||
|
if (true) then
|
||||||
|
if (ooz > zbuffer[yp][xp]) then
|
||||||
|
zbuffer[yp][xp] = ooz
|
||||||
|
local luminance = math.max( math.ceil( L * 180 ), 0 )
|
||||||
|
-- luminance is now in the range 0 to 255
|
||||||
|
r = math.ceil( (luminance + xp) / 2 )
|
||||||
|
g = math.ceil( (luminance + yp) / 2 )
|
||||||
|
b = math.ceil( (luminance + xp + yp) / 3 )
|
||||||
|
output[yp][xp] = { r, g, b }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile('init.lua')
|
||||||
|
|
||||||
|
render_frame(-0.7, 0.7)
|
||||||
|
tga_encoder.image(output):save("donut.tga")
|
|
@ -0,0 +1,181 @@
|
||||||
|
dofile("init.lua")
|
||||||
|
|
||||||
|
-- encode a bitmap
|
||||||
|
local _ = { 0, 0, 0 }
|
||||||
|
local R = { 255, 127, 127 }
|
||||||
|
local pixels = {
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
{ _, _, _, R, _, _, _ },
|
||||||
|
{ _, _, R, R, R, _, _ },
|
||||||
|
{ _, R, R, R, R, R, _ },
|
||||||
|
{ _, R, R, R, R, R, _ },
|
||||||
|
{ _, _, R, _, R, _, _ },
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
}
|
||||||
|
tga_encoder.image(pixels):save("bitmap_small.tga")
|
||||||
|
|
||||||
|
-- test that image can be encoded
|
||||||
|
local bitmap_small_0 = tga_encoder.image(pixels)
|
||||||
|
bitmap_small_0:encode()
|
||||||
|
assert(191 == #bitmap_small_0.data)
|
||||||
|
|
||||||
|
-- test that imbage can be encoded with parameters
|
||||||
|
local bitmap_small_1 = tga_encoder.image(pixels)
|
||||||
|
bitmap_small_1:encode(
|
||||||
|
{
|
||||||
|
colormap = {},
|
||||||
|
color_format = "B8G8R8",
|
||||||
|
compression = "RAW",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
assert(191 == #bitmap_small_1.data)
|
||||||
|
|
||||||
|
-- change a single pixel, then rescale the bitmap
|
||||||
|
local pixels_orig = pixels
|
||||||
|
pixels_orig[4][4] = { 255, 255, 255 }
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,56,1 do
|
||||||
|
local x_orig = math.ceil(x/8)
|
||||||
|
for z = 1,56,1 do
|
||||||
|
local z_orig = math.ceil(z/8)
|
||||||
|
local color = pixels_orig[z_orig][x_orig]
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("bitmap_large.tga")
|
||||||
|
|
||||||
|
-- note that the uncompressed grayscale TGA file written in this
|
||||||
|
-- example is 80 bytes – but an optimized PNG file is 81 bytes …
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,6,1 do -- left to right
|
||||||
|
for z = 1,6,1 do -- bottom to top
|
||||||
|
local color = { math.min(x * z * 4 - 1, 255) }
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("gradient_8bpp_raw.tga", {color_format="Y8", compression="RAW"})
|
||||||
|
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,16,1 do -- left to right
|
||||||
|
for z = 1,16,1 do -- bottom to top
|
||||||
|
local r = math.min(x * 32 - 1, 255)
|
||||||
|
local g = math.min(z * 32 - 1, 255)
|
||||||
|
local b = 0
|
||||||
|
-- blue rectangle in top right corner
|
||||||
|
if x > 8 and z > 8 then
|
||||||
|
r = 0
|
||||||
|
g = 0
|
||||||
|
b = math.min(z * 16 - 1, 255)
|
||||||
|
end
|
||||||
|
local color = { r, g, b }
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local gradients = tga_encoder.image(pixels)
|
||||||
|
gradients:save("gradients_8bpp_raw.tga", {color_format="Y8", compression="RAW"})
|
||||||
|
gradients:save("gradients_16bpp_raw.tga", {color_format="A1R5G5B5", compression="RAW"})
|
||||||
|
gradients:save("gradients_16bpp_rle.tga", {color_format="A1R5G5B5", compression="RLE"})
|
||||||
|
gradients:save("gradients_24bpp_raw.tga", {color_format="B8G8R8", compression="RAW"})
|
||||||
|
gradients:save("gradients_24bpp_rle.tga", {color_format="B8G8R8", compression="RLE"})
|
||||||
|
|
||||||
|
for x = 1,16,1 do -- left to right
|
||||||
|
for z = 1,16,1 do -- bottom to top
|
||||||
|
local color = pixels[z][x]
|
||||||
|
color[#color+1] = ((x * x) + (z * z)) % 256
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gradients:save("gradients_32bpp_raw.tga", {color_format="B8G8R8A8", compression="RAW"})
|
||||||
|
-- the RLE-compressed file is larger than just dumping pixels because
|
||||||
|
-- the gradients in this picture can not be compressed well using RLE
|
||||||
|
gradients:save("gradients_32bpp_rle.tga", {color_format="B8G8R8A8", compression="RLE"})
|
||||||
|
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,512,1 do -- left to right
|
||||||
|
for z = 1,512,1 do -- bottom to top
|
||||||
|
local oz = (z - 256) / 256 + 0.75
|
||||||
|
local ox = (x - 256) / 256
|
||||||
|
local px, pz, i = 0, 0, 0
|
||||||
|
while (px * px) + (pz * pz) <= 4 and i < 128 do
|
||||||
|
px = (px * px) - (pz * pz) + oz
|
||||||
|
pz = (2 * px * pz) + ox
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
local color = {
|
||||||
|
math.max(0, math.min(255, math.floor(px * 64))),
|
||||||
|
math.max(0, math.min(255, math.floor(pz * 64))),
|
||||||
|
math.max(0, math.min(255, math.floor(i))),
|
||||||
|
}
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("fractal_8bpp.tga", {color_format="Y8"})
|
||||||
|
tga_encoder.image(pixels):save("fractal_16bpp.tga", {color_format="A1R5G5B5"})
|
||||||
|
tga_encoder.image(pixels):save("fractal_24bpp.tga", {color_format="B8G8R8"})
|
||||||
|
|
||||||
|
-- encode a colormapped bitmap
|
||||||
|
local K = { 0 }
|
||||||
|
local B = { 1 }
|
||||||
|
local R = { 2 }
|
||||||
|
local G = { 3 }
|
||||||
|
local W = { 4 }
|
||||||
|
local colormap = {
|
||||||
|
{ 1, 2, 3 }, -- K
|
||||||
|
{ 0, 0, 255 }, -- B
|
||||||
|
{ 255, 0, 0 }, -- R
|
||||||
|
{ 0, 255, 0 }, -- G
|
||||||
|
{ 253, 254, 255 }, -- W
|
||||||
|
}
|
||||||
|
local pixels = {
|
||||||
|
{ W, K, W, K, W, K, W },
|
||||||
|
{ R, G, B, R, G, B, K },
|
||||||
|
{ K, W, K, W, K, W, K },
|
||||||
|
{ G, B, R, G, B, R, W },
|
||||||
|
{ W, W, W, K, K, K, W },
|
||||||
|
{ B, R, G, B, R, G, K },
|
||||||
|
{ B, R, G, B, R, G, W },
|
||||||
|
}
|
||||||
|
-- note that the uncompressed colormapped TGA file written in this
|
||||||
|
-- example is 108 bytes – but an optimized PNG file is 121 bytes …
|
||||||
|
tga_encoder.image(pixels):save("colormapped_B8G8R8.tga", {colormap=colormap})
|
||||||
|
-- encoding as A1R5G5B5 saves 1 byte per palette entry → 103 bytes
|
||||||
|
tga_encoder.image(pixels):save("colormapped_A1R5G5B5.tga", {colormap=colormap, color_format="A1R5G5B5"})
|
||||||
|
|
||||||
|
-- encode a colormapped bitmap with transparency
|
||||||
|
local _ = { 0 }
|
||||||
|
local K = { 1 }
|
||||||
|
local W = { 2 }
|
||||||
|
local colormap = {
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
|
{ 0, 0, 0, 255 },
|
||||||
|
{ 255, 255, 255, 255 },
|
||||||
|
}
|
||||||
|
local pixels = {
|
||||||
|
{ _, K, K, K, K, K, _ },
|
||||||
|
{ _, K, W, W, W, K, _ },
|
||||||
|
{ K, K, W, W, W, K, K },
|
||||||
|
{ K, W, W, W, W, W, K },
|
||||||
|
{ _, K, W, W, W, K, _ },
|
||||||
|
{ _, _, K, W, K, _, _ },
|
||||||
|
{ _, _, _, K, _, _, _ },
|
||||||
|
}
|
||||||
|
tga_encoder.image(pixels):save("colormapped_B8G8R8A8.tga", {colormap=colormap})
|
||||||
|
|
||||||
|
-- encoding a colormapped image with illegal colormap indexes should error out
|
||||||
|
local colormap = {
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
|
{ 0, 0, 0, 255 },
|
||||||
|
}
|
||||||
|
local status, message = pcall(
|
||||||
|
function ()
|
||||||
|
tga_encoder.image(pixels):encode({colormap=colormap})
|
||||||
|
end
|
||||||
|
)
|
||||||
|
assert(
|
||||||
|
false == status and
|
||||||
|
"init.lua:36: colormap index 2 not in colormap of size 2" == message
|
||||||
|
)
|
|
@ -9,60 +9,566 @@ local image = setmetatable({}, {
|
||||||
})
|
})
|
||||||
|
|
||||||
function image:constructor(pixels)
|
function image:constructor(pixels)
|
||||||
self.data = ""
|
|
||||||
self.pixels = pixels
|
self.pixels = pixels
|
||||||
self.width = #pixels[1]
|
self.width = #pixels[1]
|
||||||
self.height = #pixels
|
self.height = #pixels
|
||||||
|
|
||||||
self:encode()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function image:encode_colormap_spec()
|
local pixel_depth_by_color_format = {
|
||||||
self.data = self.data
|
["Y8"] = 8,
|
||||||
.. string.char(0, 0) -- first entry index
|
["A1R5G5B5"] = 16,
|
||||||
.. string.char(0, 0) -- number of entries
|
["B8G8R8"] = 24,
|
||||||
.. string.char(0) -- bits per pixel
|
["B8G8R8A8"] = 32,
|
||||||
end
|
}
|
||||||
|
|
||||||
function image:encode_image_spec()
|
function image:encode_colormap_spec(properties)
|
||||||
self.data = self.data
|
local colormap = properties.colormap
|
||||||
.. string.char(0, 0) -- X-origin
|
local colormap_pixel_depth = 0
|
||||||
.. string.char(0, 0) -- Y-origin
|
if 0 ~= #colormap then
|
||||||
.. string.char(self.width % 256, math.floor(self.width / 256)) -- width
|
colormap_pixel_depth = pixel_depth_by_color_format[
|
||||||
.. string.char(self.height % 256, math.floor(self.height / 256)) -- height
|
properties.color_format
|
||||||
.. string.char(24) -- pixel depth (RGB = 3 bytes = 24 bits)
|
]
|
||||||
.. string.char(0) -- image descriptor
|
-- ensure that each pixel references a legal colormap entry
|
||||||
end
|
|
||||||
|
|
||||||
function image:encode_header()
|
|
||||||
self.data = self.data
|
|
||||||
.. string.char(0) -- image id
|
|
||||||
.. string.char(0) -- color map type
|
|
||||||
.. string.char(10) -- image type (RLE RGB = 10)
|
|
||||||
self:encode_colormap_spec() -- color map specification
|
|
||||||
self:encode_image_spec() -- image specification
|
|
||||||
end
|
|
||||||
|
|
||||||
function image:encode_data()
|
|
||||||
local current_pixel = ''
|
|
||||||
local previous_pixel = ''
|
|
||||||
local count = 1
|
|
||||||
local packets = {}
|
|
||||||
local rle_packet = ''
|
|
||||||
for _, row in ipairs(self.pixels) do
|
for _, row in ipairs(self.pixels) do
|
||||||
for _, pixel in ipairs(row) do
|
for _, pixel in ipairs(row) do
|
||||||
current_pixel = string.char(pixel[3], pixel[2], pixel[1])
|
local colormap_index = pixel[1]
|
||||||
if current_pixel ~= previous_pixel or count == 128 then
|
if colormap_index >= #colormap then
|
||||||
|
error(
|
||||||
|
"colormap index " .. colormap_index ..
|
||||||
|
" not in colormap of size " .. #colormap
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local colormap_spec =
|
||||||
|
string.char(0, 0) .. -- first entry index
|
||||||
|
string.char(#colormap % 256, math.floor(#colormap / 256)) .. -- number of entries
|
||||||
|
string.char(colormap_pixel_depth) -- bits per pixel
|
||||||
|
self.data = self.data .. colormap_spec
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_image_spec(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
assert(
|
||||||
|
"Y8" == color_format or -- (8 bit grayscale = 1 byte = 8 bits)
|
||||||
|
"A1R5G5B5" == color_format or -- (A1R5G5B5 = 2 bytes = 16 bits)
|
||||||
|
"B8G8R8" == color_format or -- (B8G8R8 = 3 bytes = 24 bits)
|
||||||
|
"B8G8R8A8" == color_format -- (B8G8R8A8 = 4 bytes = 32 bits)
|
||||||
|
)
|
||||||
|
local scanline_order = properties.scanline_order
|
||||||
|
assert (
|
||||||
|
"bottom-top" == scanline_order or
|
||||||
|
"top-bottom" == scanline_order
|
||||||
|
)
|
||||||
|
local pixel_depth
|
||||||
|
if 0 ~= #properties.colormap then
|
||||||
|
pixel_depth = self.pixel_depth
|
||||||
|
else
|
||||||
|
pixel_depth = pixel_depth_by_color_format[color_format]
|
||||||
|
end
|
||||||
|
assert( nil ~= pixel_depth)
|
||||||
|
-- the origin is the bottom left corner of the image (always)
|
||||||
|
local x_origin_lo = 0
|
||||||
|
local x_origin_hi = 0
|
||||||
|
local y_origin_lo = 0
|
||||||
|
local y_origin_hi = 0
|
||||||
|
local image_descriptor = 0 -- equal to bottom-top scanline order
|
||||||
|
local width_lo = self.width % 256
|
||||||
|
local width_hi = math.floor(self.width / 256)
|
||||||
|
local height_lo = self.height % 256
|
||||||
|
local height_hi = math.floor(self.height / 256)
|
||||||
|
if "top-bottom" == scanline_order then
|
||||||
|
image_descriptor = 32
|
||||||
|
y_origin_lo = height_lo
|
||||||
|
y_origin_hi = height_hi
|
||||||
|
end
|
||||||
|
self.data = self.data .. string.char (
|
||||||
|
x_origin_lo, x_origin_hi,
|
||||||
|
y_origin_lo, y_origin_hi,
|
||||||
|
width_lo, width_hi,
|
||||||
|
height_lo, height_hi,
|
||||||
|
pixel_depth,
|
||||||
|
image_descriptor
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_colormap(properties)
|
||||||
|
local colormap = properties.colormap
|
||||||
|
if 0 == #colormap then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local color_format = properties.color_format
|
||||||
|
assert (
|
||||||
|
"A1R5G5B5" == color_format or
|
||||||
|
"B8G8R8" == color_format or
|
||||||
|
"B8G8R8A8" == color_format
|
||||||
|
)
|
||||||
|
local colors = {}
|
||||||
|
if "A1R5G5B5" == color_format then
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local colorword = 32768 +
|
||||||
|
((math.floor((color[1] * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((color[2] * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((color[3] * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
local color_bytes = string.char(
|
||||||
|
colorword % 256,
|
||||||
|
math.floor(colorword / 256)
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
elseif "B8G8R8" == color_format then
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local color_bytes = string.char(
|
||||||
|
color[3], -- B
|
||||||
|
color[2], -- G
|
||||||
|
color[1] -- R
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
elseif "B8G8R8A8" == color_format then
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local color_bytes = string.char(
|
||||||
|
color[3], -- B
|
||||||
|
color[2], -- G
|
||||||
|
color[1], -- R
|
||||||
|
color[4] -- A
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( 0 ~= #colors )
|
||||||
|
self.data = self.data .. table.concat(colors)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_header(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
local colormap = properties.colormap
|
||||||
|
local compression = properties.compression
|
||||||
|
local colormap_type
|
||||||
|
local image_type
|
||||||
|
if "Y8" == color_format and "RAW" == compression then
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 3 -- grayscale
|
||||||
|
elseif (
|
||||||
|
"A1R5G5B5" == color_format or
|
||||||
|
"B8G8R8" == color_format or
|
||||||
|
"B8G8R8A8" == color_format
|
||||||
|
) then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
colormap_type = 1
|
||||||
|
image_type = 1 -- colormapped RGB(A)
|
||||||
|
else
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 2 -- RAW RGB(A)
|
||||||
|
end
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 10 -- RLE RGB
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( nil ~= colormap_type )
|
||||||
|
assert( nil ~= image_type )
|
||||||
|
self.data = self.data
|
||||||
|
.. string.char(0) -- image id
|
||||||
|
.. string.char(colormap_type)
|
||||||
|
.. string.char(image_type)
|
||||||
|
self:encode_colormap_spec(properties) -- color map specification
|
||||||
|
self:encode_image_spec(properties) -- image specification
|
||||||
|
self:encode_colormap(properties)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
local colormap = properties.colormap
|
||||||
|
local compression = properties.compression
|
||||||
|
|
||||||
|
local data_length_before = #self.data
|
||||||
|
if "Y8" == color_format and "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
elseif 24 == self.pixel_depth then
|
||||||
|
self:encode_data_R8G8B8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
elseif "A1R5G5B5" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_A1R5G5B5_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_A1R5G5B5_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif "B8G8R8" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_B8G8R8_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_B8G8R8_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif "B8G8R8A8" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8A8_as_B8G8R8A8_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8A8_as_B8G8R8A8_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local data_length_after = #self.data
|
||||||
|
assert(
|
||||||
|
data_length_after ~= data_length_before,
|
||||||
|
"No data encoded for color format: " .. color_format
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_Y8_as_Y8_raw()
|
||||||
|
assert(8 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[1])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_Y8_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
-- the HSP RGB to brightness formula is
|
||||||
|
-- sqrt( 0.299 r² + .587 g² + .114 b² )
|
||||||
|
-- see <https://alienryderflex.com/hsp.html>
|
||||||
|
local gray = math.floor(
|
||||||
|
math.sqrt(
|
||||||
|
0.299 * pixel[1]^2 +
|
||||||
|
0.587 * pixel[2]^2 +
|
||||||
|
0.114 * pixel[3]^2
|
||||||
|
) + 0.5
|
||||||
|
)
|
||||||
|
local raw_pixel = string.char(gray)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_A1R5G5B5_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local colorword = 32768 +
|
||||||
|
((math.floor((pixel[1] * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((pixel[2] * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((pixel[3] * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
local raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_A1R5G5B5_rle()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local colorword = nil
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
colorword = 32768 +
|
||||||
|
((math.floor((previous_r * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((previous_g * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((previous_b * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, colorword % 256, math.floor(colorword / 256))
|
||||||
packets[#packets +1] = rle_packet
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
count = 1
|
count = 1
|
||||||
previous_pixel = current_pixel
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
else
|
else
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
rle_packet = string.char(128 + count - 1) .. current_pixel
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
colorword = 32768 +
|
||||||
|
((math.floor((previous_r * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((previous_g * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((previous_b * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, colorword % 256, math.floor(colorword / 256))
|
||||||
packets[#packets +1] = rle_packet
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(packets)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_B8G8R8_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[3], pixel[2], pixel[1])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_B8G8R8_rle()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count = 1
|
||||||
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
|
else
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(packets)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8A8_as_B8G8R8A8_raw()
|
||||||
|
assert(32 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[3], pixel[2], pixel[1], pixel[4])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8A8_as_B8G8R8A8_rle()
|
||||||
|
assert(32 == self.pixel_depth)
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local previous_a = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or pixel[4] ~= previous_a or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r, previous_a)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r, previous_a)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count = 1
|
||||||
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
|
previous_a = pixel[4]
|
||||||
|
else
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r, previous_a)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r, previous_a)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
self.data = self.data .. table.concat(packets)
|
self.data = self.data .. table.concat(packets)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,15 +581,45 @@ function image:encode_footer()
|
||||||
.. string.char(0)
|
.. string.char(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function image:encode()
|
function image:encode(properties)
|
||||||
self:encode_header() -- header
|
local properties = properties or {}
|
||||||
|
properties.colormap = properties.colormap or {}
|
||||||
|
properties.compression = properties.compression or "RAW"
|
||||||
|
properties.scanline_order = properties.scanline_order or "bottom-top"
|
||||||
|
|
||||||
|
self.pixel_depth = #self.pixels[1][1] * 8
|
||||||
|
|
||||||
|
local color_format_defaults_by_pixel_depth = {
|
||||||
|
[8] = "Y8",
|
||||||
|
[24] = "B8G8R8",
|
||||||
|
[32] = "B8G8R8A8",
|
||||||
|
}
|
||||||
|
if nil == properties.color_format then
|
||||||
|
if 0 ~= #properties.colormap then
|
||||||
|
properties.color_format =
|
||||||
|
color_format_defaults_by_pixel_depth[
|
||||||
|
#properties.colormap[1] * 8
|
||||||
|
]
|
||||||
|
else
|
||||||
|
properties.color_format =
|
||||||
|
color_format_defaults_by_pixel_depth[
|
||||||
|
self.pixel_depth
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( nil ~= properties.color_format )
|
||||||
|
|
||||||
|
self.data = ""
|
||||||
|
self:encode_header(properties) -- header
|
||||||
-- no color map and image id data
|
-- no color map and image id data
|
||||||
self:encode_data() -- encode data
|
self:encode_data(properties) -- encode data
|
||||||
-- no extension or developer area
|
-- no extension or developer area
|
||||||
self:encode_footer() -- footer
|
self:encode_footer() -- footer
|
||||||
end
|
end
|
||||||
|
|
||||||
function image:save(filename)
|
function image:save(filename, properties)
|
||||||
|
self:encode(properties)
|
||||||
|
|
||||||
local f = assert(io.open(filename, "wb"))
|
local f = assert(io.open(filename, "wb"))
|
||||||
f:write(self.data)
|
f:write(self.data)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
dofile("init.lua")
|
||||||
|
|
||||||
|
local colormap = {
|
||||||
|
{ 0, 0, 0 }, -- black
|
||||||
|
{ 255, 255, 255 }, -- white
|
||||||
|
{ 255, 0, 0 }, -- red
|
||||||
|
{ 0, 255, 0 }, -- green
|
||||||
|
{ 0, 0, 255 }, -- blue
|
||||||
|
}
|
||||||
|
|
||||||
|
local _ = { 0 }
|
||||||
|
local W = { 1 }
|
||||||
|
local R = { 2 }
|
||||||
|
local G = { 3 }
|
||||||
|
local B = { 4 }
|
||||||
|
|
||||||
|
local pixels_tiny = {
|
||||||
|
{ W, W, W, W, W, W, W, W, W, W, W, W, },
|
||||||
|
{ W, _, _, _, _, _, _, _, _, _, _, W, },
|
||||||
|
{ W, _, _, _, _, _, _, B, _, B, _, W, },
|
||||||
|
{ W, _, _, _, _, _, _, B, B, B, _, W, },
|
||||||
|
{ W, _, _, _, G, G, G, B, _, B, _, W, },
|
||||||
|
{ W, _, _, _, G, _, G, B, B, B, _, W, },
|
||||||
|
{ W, _, _, R, G, _, _, _, _, _, _, W, },
|
||||||
|
{ W, _, _, R, G, G, G, _, _, _, _, W, },
|
||||||
|
{ W, _, _, R, _, _, _, _, _, _, _, W, },
|
||||||
|
{ W, _, R, R, R, _, _, _, _, _, _, W, },
|
||||||
|
{ W, _, _, _, _, _, _, _, _, _, _, W, },
|
||||||
|
{ W, W, W, W, W, W, W, W, W, W, W, W, },
|
||||||
|
}
|
||||||
|
|
||||||
|
local pixels_huge = {}
|
||||||
|
|
||||||
|
local size_tiny = #pixels_tiny
|
||||||
|
local size_huge = 1200
|
||||||
|
local scale = size_huge / size_tiny
|
||||||
|
|
||||||
|
for x_huge = 1,size_huge,1 do
|
||||||
|
local x_tiny = math.ceil( x_huge / scale )
|
||||||
|
for z_huge = 1,size_huge,1 do
|
||||||
|
local z_tiny = math.ceil( z_huge / scale )
|
||||||
|
if nil == pixels_huge[z_huge] then
|
||||||
|
pixels_huge[z_huge] = {}
|
||||||
|
end
|
||||||
|
pixels_huge[z_huge][x_huge] = pixels_tiny[z_tiny][x_tiny]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tga_encoder.image(pixels_tiny):save("logo_tiny.tga", {colormap=colormap})
|
||||||
|
tga_encoder.image(pixels_huge):save("logo_huge.tga", {colormap=colormap})
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
name = tga_encoder
|
name = tga_encoder
|
||||||
author = Fleckenstein
|
|
||||||
description = A TGA Encoder written in Lua without the use of external Libraries.
|
description = A TGA Encoder written in Lua without the use of external Libraries.
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
#!/usr/bin/env lua5.1
|
||||||
|
dofile("../init.lua")
|
||||||
|
|
||||||
|
local _ = { 0 }
|
||||||
|
local R = { 1 }
|
||||||
|
local G = { 2 }
|
||||||
|
local B = { 3 }
|
||||||
|
|
||||||
|
local pixels_colormapped_bt = {
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
}
|
||||||
|
|
||||||
|
local pixels_colormapped_tb = {
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
}
|
||||||
|
|
||||||
|
image_colormapped_bt = tga_encoder.image(pixels_colormapped_bt)
|
||||||
|
image_colormapped_tb = tga_encoder.image(pixels_colormapped_tb)
|
||||||
|
|
||||||
|
colormap_32bpp = {
|
||||||
|
{ 0, 0, 0, 128 },
|
||||||
|
{ 255, 0, 0, 255 },
|
||||||
|
{ 0, 255, 0, 255 },
|
||||||
|
{ 0, 0, 255, 255 },
|
||||||
|
}
|
||||||
|
image_colormapped_bt:save(
|
||||||
|
"type1_32bpp_bt.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "B8G8R8A8", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_colormapped_tb:save(
|
||||||
|
"type1_32bpp_tb.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "B8G8R8A8", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
image_colormapped_bt:save(
|
||||||
|
"type1_16bpp_bt.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "A1R5G5B5", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_colormapped_tb:save(
|
||||||
|
"type1_16bpp_tb.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "A1R5G5B5", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
|
||||||
|
colormap_24bpp = {
|
||||||
|
{ 0, 0, 0 },
|
||||||
|
{ 255, 0, 0 },
|
||||||
|
{ 0, 255, 0 },
|
||||||
|
{ 0, 0, 255 },
|
||||||
|
}
|
||||||
|
image_colormapped_bt:save(
|
||||||
|
"type1_24bpp_bt.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "B8G8R8", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_colormapped_tb:save(
|
||||||
|
"type1_24bpp_tb.tga",
|
||||||
|
{ colormap = colormap_32bpp, color_format = "B8G8R8", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
|
||||||
|
local _ = { 0, 0, 0, 128 }
|
||||||
|
local R = { 255, 0, 0, 255 }
|
||||||
|
local G = { 0, 255, 0, 255 }
|
||||||
|
local B = { 0, 0, 255, 255 }
|
||||||
|
|
||||||
|
local pixels_rgba_bt = {
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
}
|
||||||
|
|
||||||
|
local pixels_rgba_tb = {
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
}
|
||||||
|
|
||||||
|
image_rgba_bt = tga_encoder.image(pixels_rgba_bt)
|
||||||
|
image_rgba_tb = tga_encoder.image(pixels_rgba_tb)
|
||||||
|
|
||||||
|
image_rgba_bt:save(
|
||||||
|
"type2_32bpp_bt.tga",
|
||||||
|
{ color_format="B8G8R8A8", compression="RAW", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgba_tb:save(
|
||||||
|
"type2_32bpp_tb.tga",
|
||||||
|
{ color_format="B8G8R8A8", compression="RAW", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
image_rgba_bt:save(
|
||||||
|
"type10_32bpp_bt.tga",
|
||||||
|
{ color_format="B8G8R8A8", compression="RLE", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgba_tb:save(
|
||||||
|
"type10_32bpp_tb.tga",
|
||||||
|
{ color_format="B8G8R8A8", compression="RLE", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
|
||||||
|
local _ = { 0, 0, 0 }
|
||||||
|
local R = { 255, 0, 0 }
|
||||||
|
local G = { 0, 255, 0 }
|
||||||
|
local B = { 0, 0, 255 }
|
||||||
|
|
||||||
|
local pixels_rgb_bt = {
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
}
|
||||||
|
|
||||||
|
local pixels_rgb_tb = {
|
||||||
|
{ R, R, R, _, _, _, _, _, },
|
||||||
|
{ _, R, _, _, _, _, _, _, },
|
||||||
|
{ _, R, G, G, G, _, _, _, },
|
||||||
|
{ _, R, G, _, _, _, _, _, },
|
||||||
|
{ _, _, G, _, G, B, B, B, },
|
||||||
|
{ _, _, G, G, G, B, _, B, },
|
||||||
|
{ _, _, _, _, _, B, B, B, },
|
||||||
|
{ _, _, _, _, _, B, _, B, },
|
||||||
|
}
|
||||||
|
|
||||||
|
image_rgb_bt = tga_encoder.image(pixels_rgb_bt)
|
||||||
|
image_rgb_tb = tga_encoder.image(pixels_rgb_tb)
|
||||||
|
|
||||||
|
image_rgb_bt:save(
|
||||||
|
"type2_24bpp_bt.tga",
|
||||||
|
{ color_format="B8G8R8", compression="RAW", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgb_tb:save(
|
||||||
|
"type2_24bpp_tb.tga",
|
||||||
|
{ color_format="B8G8R8", compression="RAW", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
image_rgb_bt:save(
|
||||||
|
"type10_24bpp_bt.tga",
|
||||||
|
{ color_format="B8G8R8", compression="RLE", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgb_tb:save(
|
||||||
|
"type10_24bpp_tb.tga",
|
||||||
|
{ color_format="B8G8R8", compression="RLE", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
image_rgb_bt:save(
|
||||||
|
"type2_16bpp_bt.tga",
|
||||||
|
{ color_format="A1R5G5B5", compression="RAW", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgb_tb:save(
|
||||||
|
"type2_16bpp_tb.tga",
|
||||||
|
{ color_format="A1R5G5B5", compression="RAW", scanline_order = "top-bottom" }
|
||||||
|
)
|
||||||
|
image_rgb_bt:save(
|
||||||
|
"type10_16bpp_bt.tga",
|
||||||
|
{ color_format="A1R5G5B5", compression="RLE", scanline_order = "bottom-top" }
|
||||||
|
)
|
||||||
|
image_rgb_tb:save(
|
||||||
|
"type10_16bpp_tb.tga",
|
||||||
|
{ color_format="A1R5G5B5", compression="RLE", scanline_order = "top-bottom" }
|
||||||
|
)
|
|
@ -62,8 +62,13 @@ end
|
||||||
local function set_double_attach(boat)
|
local function set_double_attach(boat)
|
||||||
boat._driver:set_attach(boat.object, "",
|
boat._driver:set_attach(boat.object, "",
|
||||||
{x = 0, y = 0.42, z = 0.8}, {x = 0, y = 0, z = 0})
|
{x = 0, y = 0.42, z = 0.8}, {x = 0, y = 0, z = 0})
|
||||||
|
if boat._passenger:is_player() then
|
||||||
boat._passenger:set_attach(boat.object, "",
|
boat._passenger:set_attach(boat.object, "",
|
||||||
{x = 0, y = 0.42, z = -2.2}, {x = 0, y = 0, z = 0})
|
{x = 0, y = 0.42, z = -6.2}, {x = 0, y = 0, z = 0})
|
||||||
|
else
|
||||||
|
boat._passenger:set_attach(boat.object, "",
|
||||||
|
{x = 0, y = 0.42, z = -4.5}, {x = 0, y = 270, z = 0})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local function set_choat_attach(boat)
|
local function set_choat_attach(boat)
|
||||||
boat._driver:set_attach(boat.object, "",
|
boat._driver:set_attach(boat.object, "",
|
||||||
|
@ -155,7 +160,7 @@ local boat = {
|
||||||
minetest.register_on_respawnplayer(detach_object)
|
minetest.register_on_respawnplayer(detach_object)
|
||||||
|
|
||||||
function boat.on_rightclick(self, clicker)
|
function boat.on_rightclick(self, clicker)
|
||||||
if self._passenger or not clicker or clicker:get_attach() then
|
if self._passenger or not clicker or clicker:get_attach() or (self.name == "mcl_boats:chest_boat" and self._driver) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
attach_object(self, clicker)
|
attach_object(self, clicker)
|
||||||
|
@ -163,7 +168,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function boat.on_activate(self, staticdata, dtime_s)
|
function boat.on_activate(self, staticdata, dtime_s)
|
||||||
self.object:set_armor_groups({fleshy = 100})
|
self.object:set_armor_groups({fleshy = 125})
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
if type(data) == "table" then
|
if type(data) == "table" then
|
||||||
self._v = data.v
|
self._v = data.v
|
||||||
|
|
|
@ -12,6 +12,7 @@ Water vehicle=Véhicule aquatique
|
||||||
Sneak to dismount=Se baisser pour descendre
|
Sneak to dismount=Se baisser pour descendre
|
||||||
Obsidian Boat=Bateau en obsidienne
|
Obsidian Boat=Bateau en obsidienne
|
||||||
Mangrove Boat=Bateau en palétuvier
|
Mangrove Boat=Bateau en palétuvier
|
||||||
|
Cherry Boat=Bateau en cerisier
|
||||||
Oak Chest Boat=Bateau en chêne avec coffre
|
Oak Chest Boat=Bateau en chêne avec coffre
|
||||||
Spruce Chest Boat=Bateau en sapin avec coffre
|
Spruce Chest Boat=Bateau en sapin avec coffre
|
||||||
Birch Chest Boat=Bateau en bouleau avec coffre
|
Birch Chest Boat=Bateau en bouleau avec coffre
|
||||||
|
@ -19,3 +20,4 @@ Jungle Chest Boat=Bateau en acajou avec coffre
|
||||||
Acacia Chest Boat=Bateau en acacia avec coffre
|
Acacia Chest Boat=Bateau en acacia avec coffre
|
||||||
Dark Oak Chest Boat=Bateau en chêne noir avec coffre
|
Dark Oak Chest Boat=Bateau en chêne noir avec coffre
|
||||||
Mangrove Chest Boat=Bateau en palétuvier avec coffre
|
Mangrove Chest Boat=Bateau en palétuvier avec coffre
|
||||||
|
Cherry Chest Boat=Bateau en cerisier avec coffre
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# textdomain: mcl_boats
|
||||||
|
Acacia Boat=Barca de Cacèir
|
||||||
|
Birch Boat=Barca de Beç
|
||||||
|
Boat=Barca
|
||||||
|
Boats are used to travel on the surface of water.=Las barcas son utilizadas per voiatja per aigas.
|
||||||
|
Dark Oak Boat=Barca de Ròure Nèir
|
||||||
|
Jungle Boat=Barca d'Acajó
|
||||||
|
Oak Boat=Barca de Ròure
|
||||||
|
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Fasetz un clic dreit sobre una sorça d'aiga per plaça la barca. Fasetz un clic dreit sobre la barca per rintrar. Utilizatz [Gaucha] e [Dreita] per menar, [Davant] per accelerar e [Darrèir] per ralentir o racuolar. Utilizatz [Sneak] per z-o quitar, tustatz la barca per z-o faire tombar coma objècte.
|
||||||
|
Spruce Boat=Barca de Sap
|
||||||
|
Water vehicle=Veïcule per aiga
|
||||||
|
Sneak to dismount=Se baissar per descendre
|
||||||
|
Obsidian Boat=Barca d'Obsidiana
|
||||||
|
Mangrove Boat=Barca de Paletuvèir
|
||||||
|
Oak Chest Boat=Barca de Ròure embei una Mala
|
||||||
|
Spruce Chest Boat=Barca de Sap embei una Mala
|
||||||
|
Birch Chest Boat=Barca de Beç embei una Mala
|
||||||
|
Jungle Chest Boat=Barca d'Acajó embei una Mala
|
||||||
|
Acacia Chest Boat=Barca de Cacèir embei una Mala
|
||||||
|
Dark Oak Chest Boat=Barca de Ròure Nèir embei una Mala
|
||||||
|
Mangrove Chest Boat=Barca de Paletuvèir embei una Mala
|
|
@ -0,0 +1,23 @@
|
||||||
|
# textdomain: mcl_boats
|
||||||
|
Acacia Boat=Barco de Acácia
|
||||||
|
Birch Boat=Barco de Bétula
|
||||||
|
Boat=Barco
|
||||||
|
Boats are used to travel on the surface of water.=Barcos são usados para viajar na superfície da água
|
||||||
|
Dark Oak Boat=Barco de Carvalho Escuro
|
||||||
|
Jungle Boat=Barco de Selva
|
||||||
|
Oak Boat=Barco de Carvalho
|
||||||
|
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Clique com o botão direito em uma fonte de água para posicionar o barco. Clique com o botão direito no barco para entrar nele. Use [Esquerda] e [Direita] para fazer curva, [Frente] para acelerar e [Trás] para frear e ir para trás. Use [Agachar] para deixar o barco, soque-o para fazê-lo dropar como um item.
|
||||||
|
Spruce Boat=Barco de Pinheiro
|
||||||
|
Water vehicle=Veículo aquático
|
||||||
|
Sneak to dismount=Agache para desmontar
|
||||||
|
Obsidian Boat=Barco de Obsidiana
|
||||||
|
Mangrove Boat=Barco de Mangue
|
||||||
|
Cherry Boat=Barco de Cerejeira
|
||||||
|
Oak Chest Boat=Barco de Carvalho com Baú
|
||||||
|
Spruce Chest Boat=Barco de Pinheiro com Baú
|
||||||
|
Birch Chest Boat=Barco de Bétula com Baú
|
||||||
|
Jungle Chest Boat=Barco de Selva com Baú
|
||||||
|
Acacia Chest Boat=Barco de Acácia com Baú
|
||||||
|
Dark Oak Chest Boat=Barco de Carvalho Escuro com Baú
|
||||||
|
Mangrove Chest Boat=Barco de Mangue com Baú
|
||||||
|
Cherry Chest Boat=Barco de Cerejeira com Baú
|
|
@ -21,7 +21,7 @@ mcl_dripping.register_drop({
|
||||||
-- The group the liquid's nodes belong to
|
-- The group the liquid's nodes belong to
|
||||||
liquid = "water",
|
liquid = "water",
|
||||||
-- The texture used (particles will take a random 2x2 area of it)
|
-- The texture used (particles will take a random 2x2 area of it)
|
||||||
texture = "default_water_source_animated.png",
|
texture = "mcl_core_water_source_animation.png",
|
||||||
-- Define particle glow, ranges from `0` to `minetest.LIGHT_MAX`
|
-- Define particle glow, ranges from `0` to `minetest.LIGHT_MAX`
|
||||||
light = 1,
|
light = 1,
|
||||||
-- The nodes (or node group) the particles will spawn under
|
-- The nodes (or node group) the particles will spawn under
|
||||||
|
|
|
@ -82,7 +82,7 @@ end
|
||||||
|
|
||||||
mcl_dripping.register_drop({
|
mcl_dripping.register_drop({
|
||||||
liquid = "water",
|
liquid = "water",
|
||||||
texture = "default_water_source_animated.png",
|
texture = "mcl_core_water_source_animation.png",
|
||||||
light = 1,
|
light = 1,
|
||||||
nodes = { "group:opaque", "group:leaves" },
|
nodes = { "group:opaque", "group:leaves" },
|
||||||
sound = "drippingwater_drip",
|
sound = "drippingwater_drip",
|
||||||
|
@ -92,7 +92,7 @@ mcl_dripping.register_drop({
|
||||||
|
|
||||||
mcl_dripping.register_drop({
|
mcl_dripping.register_drop({
|
||||||
liquid = "lava",
|
liquid = "lava",
|
||||||
texture = "default_lava_source_animated.png",
|
texture = "mcl_core_lava_source_animation.png",
|
||||||
light = math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3),
|
light = math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3),
|
||||||
nodes = { "group:opaque" },
|
nodes = { "group:opaque" },
|
||||||
sound = "drippingwater_lavadrip",
|
sound = "drippingwater_lavadrip",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: mcl_falling_nodes
|
||||||
|
@1 was smashed by a falling anvil.=@1 a estat espotit per un enclutge
|
||||||
|
@1 was smashed by a falling block.=@1 a estat espotit per un blòc
|
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: mcl_falling_nodes
|
||||||
|
@1 was smashed by a falling anvil.=@1 foi esmagado(a) por uma bigorna em queda.
|
||||||
|
@1 was smashed by a falling block.=@1 foi esmagado(a) por um bloco em queda.
|
|
@ -6,9 +6,6 @@ local pool = {}
|
||||||
|
|
||||||
local tick = false
|
local tick = false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
pool[player:get_player_name()] = 0
|
pool[player:get_player_name()] = 0
|
||||||
end)
|
end)
|
||||||
|
@ -113,6 +110,55 @@ local function disable_physics(object, luaentity, ignore_check, reset_movement)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function try_object_pickup(player, inv, object, checkpos)
|
||||||
|
if not inv then return end
|
||||||
|
|
||||||
|
local le = object:get_luaentity()
|
||||||
|
|
||||||
|
-- Check magnet timer
|
||||||
|
if not (le._magnet_timer >= 0) then return end
|
||||||
|
if not (le._magnet_timer < item_drop_settings.magnet_time) then return end
|
||||||
|
|
||||||
|
-- Don't try to collect again
|
||||||
|
if le._removed then return end
|
||||||
|
|
||||||
|
-- Ignore if itemstring is not set yet
|
||||||
|
if le.itemstring == "" then return end
|
||||||
|
|
||||||
|
-- Add what we can to the inventory
|
||||||
|
local itemstack = ItemStack(le.itemstring)
|
||||||
|
local leftovers = inv:add_item("main", itemstack )
|
||||||
|
|
||||||
|
check_pickup_achievements(object, player)
|
||||||
|
|
||||||
|
if leftovers:is_empty() then
|
||||||
|
-- Destroy entity
|
||||||
|
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
|
||||||
|
le.target = checkpos
|
||||||
|
le._removed = true
|
||||||
|
|
||||||
|
-- Stop the object
|
||||||
|
object:set_velocity(vector.zero())
|
||||||
|
object:set_acceleration(vector.zero())
|
||||||
|
object:move_to(checkpos)
|
||||||
|
|
||||||
|
-- Update sound pool
|
||||||
|
local name = player:get_player_name()
|
||||||
|
pool[name] = ( pool[name] or 0 ) + 1
|
||||||
|
|
||||||
|
-- Make sure the object gets removed
|
||||||
|
minetest.after(0.25, function()
|
||||||
|
--safety check
|
||||||
|
if object and object:get_luaentity() then
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
-- Update entity itemstring
|
||||||
|
le.itemstring = leftovers:to_string()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_globalstep(function(_)
|
minetest.register_globalstep(function(_)
|
||||||
tick = not tick
|
tick = not tick
|
||||||
|
|
||||||
|
@ -123,17 +169,17 @@ minetest.register_globalstep(function(_)
|
||||||
|
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
|
|
||||||
if tick == true and pool[name] > 0 then
|
if tick == true and (pool[name] or 0) > 0 then
|
||||||
minetest.sound_play("item_drop_pickup", {
|
minetest.sound_play("item_drop_pickup", {
|
||||||
pos = pos,
|
pos = pos,
|
||||||
gain = 0.3,
|
gain = 0.3,
|
||||||
max_hear_distance = 16,
|
max_hear_distance = 16,
|
||||||
pitch = math.random(70, 110) / 100
|
pitch = math.random(70, 110) / 100
|
||||||
})
|
})
|
||||||
if pool[name] > 6 then
|
if (pool[name] or 0) > 6 then
|
||||||
pool[name] = 6
|
pool[name] = 6
|
||||||
else
|
else
|
||||||
pool[name] = pool[name] - 1
|
pool[name] = (pool[name] or 1) - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,40 +193,7 @@ minetest.register_globalstep(function(_)
|
||||||
object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer
|
object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer
|
||||||
and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
||||||
|
|
||||||
if object:get_luaentity()._magnet_timer >= 0 and
|
try_object_pickup( player, inv, object, checkpos )
|
||||||
object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and
|
|
||||||
inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
|
||||||
|
|
||||||
-- Collection
|
|
||||||
if not object:get_luaentity()._removed then
|
|
||||||
-- Ignore if itemstring is not set yet
|
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
|
||||||
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
|
||||||
|
|
||||||
check_pickup_achievements(object, player)
|
|
||||||
|
|
||||||
-- Destroy entity
|
|
||||||
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
|
|
||||||
object:get_luaentity().target = checkpos
|
|
||||||
object:get_luaentity()._removed = true
|
|
||||||
|
|
||||||
object:set_velocity(vector.zero())
|
|
||||||
object:set_acceleration(vector.zero())
|
|
||||||
|
|
||||||
object:move_to(checkpos)
|
|
||||||
|
|
||||||
pool[name] = pool[name] + 1
|
|
||||||
|
|
||||||
minetest.after(0.25, function()
|
|
||||||
--safety check
|
|
||||||
if object and object:get_luaentity() then
|
|
||||||
object:remove()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mcl_experience:orb" then
|
elseif not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mcl_experience:orb" then
|
||||||
local entity = object:get_luaentity()
|
local entity = object:get_luaentity()
|
||||||
entity.collector = player:get_player_name()
|
entity.collector = player:get_player_name()
|
||||||
|
@ -362,6 +375,121 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- the following code is pulled from Minetest builtin without changes except for the call order being changed,
|
||||||
|
-- until a comment saying explicitly it's the end of such code
|
||||||
|
-- TODO if this gets a fix in the engine, remove the block of code
|
||||||
|
local function user_name(user)
|
||||||
|
return user and user:get_player_name() or ""
|
||||||
|
end
|
||||||
|
-- Returns a logging function. For empty names, does not log.
|
||||||
|
local function make_log(name)
|
||||||
|
return name ~= "" and minetest.log or function() end
|
||||||
|
end
|
||||||
|
function minetest.node_dig(pos, node, digger)
|
||||||
|
local diggername = user_name(digger)
|
||||||
|
local log = make_log(diggername)
|
||||||
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
-- Copy pos because the callback could modify it
|
||||||
|
if def and (not def.diggable or
|
||||||
|
(def.can_dig and not def.can_dig(vector.copy(pos), digger))) then
|
||||||
|
log("info", diggername .. " tried to dig "
|
||||||
|
.. node.name .. " which is not diggable "
|
||||||
|
.. minetest.pos_to_string(pos))
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, diggername) then
|
||||||
|
log("action", diggername
|
||||||
|
.. " tried to dig " .. node.name
|
||||||
|
.. " at protected position "
|
||||||
|
.. minetest.pos_to_string(pos))
|
||||||
|
minetest.record_protection_violation(pos, diggername)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
log('action', diggername .. " digs "
|
||||||
|
.. node.name .. " at " .. minetest.pos_to_string(pos))
|
||||||
|
|
||||||
|
local wielded = digger and digger:get_wielded_item()
|
||||||
|
local drops = minetest.get_node_drops(node, wielded and wielded:get_name())
|
||||||
|
|
||||||
|
-- Check to see if metadata should be preserved.
|
||||||
|
if def and def.preserve_metadata then
|
||||||
|
local oldmeta = minetest.get_meta(pos):to_table().fields
|
||||||
|
-- Copy pos and node because the callback can modify them.
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||||
|
local drop_stacks = {}
|
||||||
|
for k, v in pairs(drops) do
|
||||||
|
drop_stacks[k] = ItemStack(v)
|
||||||
|
end
|
||||||
|
drops = drop_stacks
|
||||||
|
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Handle drops
|
||||||
|
minetest.handle_node_drops(pos, drops, digger)
|
||||||
|
|
||||||
|
if wielded then
|
||||||
|
local wdef = wielded:get_definition()
|
||||||
|
local tp = wielded:get_tool_capabilities()
|
||||||
|
local dp = minetest.get_dig_params(def and def.groups, tp, wielded:get_wear())
|
||||||
|
if wdef and wdef.after_use then
|
||||||
|
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||||
|
else
|
||||||
|
-- Wear out tool
|
||||||
|
if not minetest.is_creative_enabled(diggername) then
|
||||||
|
wielded:add_wear(dp.wear)
|
||||||
|
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
||||||
|
minetest.sound_play(wdef.sound.breaks, {
|
||||||
|
pos = pos,
|
||||||
|
gain = 0.5
|
||||||
|
}, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
digger:set_wielded_item(wielded)
|
||||||
|
end
|
||||||
|
|
||||||
|
local oldmetadata = nil
|
||||||
|
if def and def.after_dig_node then
|
||||||
|
oldmetadata = minetest.get_meta(pos):to_table()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove node and update
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
|
||||||
|
-- Play sound if it was done by a player
|
||||||
|
if diggername ~= "" and def and def.sounds and def.sounds.dug then
|
||||||
|
minetest.sound_play(def.sounds.dug, {
|
||||||
|
pos = pos,
|
||||||
|
exclude_player = diggername,
|
||||||
|
}, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run callback
|
||||||
|
if def and def.after_dig_node then
|
||||||
|
-- Copy pos and node because callback can modify them
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||||
|
def.after_dig_node(pos_copy, node_copy, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run script hook
|
||||||
|
for _, callback in ipairs(minetest.registered_on_dignodes) do
|
||||||
|
local origin = minetest.callback_origins[callback]
|
||||||
|
minetest.set_last_run_mod(origin.mod)
|
||||||
|
|
||||||
|
-- Copy pos and node because callback can modify them
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = {name=node.name, param1=node.param1, param2=node.param2}
|
||||||
|
callback(pos_copy, node_copy, digger)
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- end of code pulled from Minetest
|
||||||
|
|
||||||
-- Drop single items by default
|
-- Drop single items by default
|
||||||
function minetest.item_drop(itemstack, dropper, pos)
|
function minetest.item_drop(itemstack, dropper, pos)
|
||||||
if dropper and dropper:is_player() then
|
if dropper and dropper:is_player() then
|
||||||
|
|
|
@ -135,3 +135,33 @@ function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
|
||||||
end
|
end
|
||||||
return {x=0, y=0, z=0}
|
return {x=0, y=0, z=0}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local plane_adjacents = {
|
||||||
|
vector.new(-1,0,0),
|
||||||
|
vector.new(1,0,0),
|
||||||
|
vector.new(0,0,-1),
|
||||||
|
vector.new(0,0,1),
|
||||||
|
}
|
||||||
|
|
||||||
|
function mcl_minecarts:get_start_direction(pos)
|
||||||
|
local dir
|
||||||
|
local i = 0
|
||||||
|
while (not dir and i < #plane_adjacents) do
|
||||||
|
i = i+1
|
||||||
|
local node = minetest.get_node_or_nil(vector.add(pos, plane_adjacents[i]))
|
||||||
|
if node ~= nil
|
||||||
|
and minetest.get_item_group(node.name, "rail") == 0
|
||||||
|
and minetest.get_item_group(node.name, "solid") == 1
|
||||||
|
and minetest.get_item_group(node.name, "opaque") == 1
|
||||||
|
then
|
||||||
|
dir = mcl_minecarts:check_front_up_down(pos, vector.multiply(plane_adjacents[i], -1), true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return dir
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_minecarts:set_velocity(obj, dir, factor)
|
||||||
|
obj._velocity = vector.multiply(dir, factor or 3)
|
||||||
|
obj._old_pos = nil
|
||||||
|
obj._punched = true
|
||||||
|
end
|
||||||
|
|
|
@ -241,9 +241,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
|
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self._velocity = vector.multiply(cart_dir, 3)
|
mcl_minecarts:set_velocity(self, cart_dir)
|
||||||
self._old_pos = nil
|
|
||||||
self._punched = true
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -300,9 +298,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
time_from_last_punch = math.min(time_from_last_punch, tool_capabilities.full_punch_interval)
|
time_from_last_punch = math.min(time_from_last_punch, tool_capabilities.full_punch_interval)
|
||||||
local f = 3 * (time_from_last_punch / tool_capabilities.full_punch_interval)
|
local f = 3 * (time_from_last_punch / tool_capabilities.full_punch_interval)
|
||||||
|
|
||||||
self._velocity = vector.multiply(cart_dir, f)
|
mcl_minecarts:set_velocity(self, cart_dir, f)
|
||||||
self._old_pos = nil
|
|
||||||
self._punched = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
cart.on_activate_by_rail = on_activate_by_rail
|
cart.on_activate_by_rail = on_activate_by_rail
|
||||||
|
@ -470,7 +466,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local dir, last_switch = nil, nil
|
local dir, last_switch, restart_pos = nil, nil, nil
|
||||||
if not pos then
|
if not pos then
|
||||||
pos = self.object:get_pos()
|
pos = self.object:get_pos()
|
||||||
end
|
end
|
||||||
|
@ -497,6 +493,9 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
minetest.swap_node(rou_pos, newnode)
|
minetest.swap_node(rou_pos, newnode)
|
||||||
mesecon.receptor_on(rou_pos)
|
mesecon.receptor_on(rou_pos)
|
||||||
end
|
end
|
||||||
|
if node.name == "mcl_minecarts:golden_rail_on" then
|
||||||
|
restart_pos = rou_pos
|
||||||
|
end
|
||||||
if node_old.name == "mcl_minecarts:detector_rail_on" then
|
if node_old.name == "mcl_minecarts:detector_rail_on" then
|
||||||
local newnode = {name="mcl_minecarts:detector_rail", param2 = node_old.param2}
|
local newnode = {name="mcl_minecarts:detector_rail", param2 = node_old.param2}
|
||||||
minetest.swap_node(rou_old, newnode)
|
minetest.swap_node(rou_old, newnode)
|
||||||
|
@ -647,6 +646,14 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
if update.pos then
|
if update.pos then
|
||||||
self.object:set_pos(pos)
|
self.object:set_pos(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- stopped on "mcl_minecarts:golden_rail_on"
|
||||||
|
if vector.equals(vel, {x=0, y=0, z=0}) and restart_pos then
|
||||||
|
local dir = mcl_minecarts:get_start_direction(restart_pos)
|
||||||
|
if dir then
|
||||||
|
mcl_minecarts:set_velocity(self, dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cart:get_staticdata()
|
function cart:get_staticdata()
|
||||||
|
@ -687,7 +694,15 @@ function mcl_minecarts.place_minecart(itemstack, pointed_thing, placer)
|
||||||
if le then
|
if le then
|
||||||
le._railtype = railtype
|
le._railtype = railtype
|
||||||
end
|
end
|
||||||
local cart_dir = mcl_minecarts:get_rail_direction(railpos, {x=1, y=0, z=0}, nil, nil, railtype)
|
local cart_dir
|
||||||
|
if node.name == "mcl_minecarts:golden_rail_on" then
|
||||||
|
cart_dir = mcl_minecarts:get_start_direction(railpos)
|
||||||
|
end
|
||||||
|
if cart_dir then
|
||||||
|
mcl_minecarts:set_velocity(le, cart_dir)
|
||||||
|
else
|
||||||
|
cart_dir = mcl_minecarts:get_rail_direction(railpos, {x=1, y=0, z=0}, nil, nil, railtype)
|
||||||
|
end
|
||||||
cart:set_yaw(minetest.dir_to_yaw(cart_dir))
|
cart:set_yaw(minetest.dir_to_yaw(cart_dir))
|
||||||
|
|
||||||
local pname = ""
|
local pname = ""
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# textdomain: mcl_minecarts
|
||||||
|
Minecart=Vagonet
|
||||||
|
Minecarts can be used for a quick transportion on rails.=Los vagonet pòdon èsser utilizats per un transpòrt rapide per ralhs.
|
||||||
|
Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type.=Los vagonets ròtlon mas per ralhs e seguisson totjorn la pista. A una joncion T embei ren davant, tòrnon a gaucha.
|
||||||
|
You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving.=Podètz plaçar le vagonet per ralhs. Fasetz un clic dreit dessobre per çai rentrar. Tustatz z-o per z-o faire bojar.
|
||||||
|
To obtain the minecart, punch it while holding down the sneak key.=Per aver le vagonet, tustatz z-o embei la tocha sneak enfonçada.
|
||||||
|
A minecart with TNT is an explosive vehicle that travels on rail.=Un vagonet embei TNT z-es un vagonet explosiu que voiatja per ralhs.
|
||||||
|
Place it on rails. Punch it to move it. The TNT is ignited with a flint and steel or when the minecart is on an powered activator rail.=Plaçatz z-o per ralhs. Tustatz z-o per z-o desplaçar. La TNT z-es atubada embei un batifuòc o quand le vagonet z-es per un ralh d'activacion atubat.
|
||||||
|
To obtain the minecart and TNT, punch them while holding down the sneak key. You can't do this if the TNT was ignited.=Per obtenèr le vagonet e la TNT, tustatz z-o embei la tocha sneak enfonçada. Podètz pas faire quo si la TNT z-es atubada.
|
||||||
|
A minecart with furnace is a vehicle that travels on rails. It can propel itself with fuel.=Un vagonet embei un fornil z-es un veïcule que voiatja per ralhs. Pòt se propulsar embei dau carburant.
|
||||||
|
Place it on rails. If you give it some coal, the furnace will start burning for a long time and the minecart will be able to move itself. Punch it to get it moving.=Plaçatz z-o per ralhs. Si li balhatz dau charbon, le fornil vai començar de borlar lòngtemps e porà rotlar. Tustatz z-o per z-o faire bojar.
|
||||||
|
To obtain the minecart and furnace, punch them while holding down the sneak key.=Per obtener le vagonet e le fornil, tustatz z-o embei la tocha sneak enfonçada.
|
||||||
|
Minecart with Chest=Vagonet embei una Mala
|
||||||
|
Minecart with Furnace=Vagonet embei un Fornil
|
||||||
|
Minecart with Command Block=Vagonet embei un Blòc de Comandas
|
||||||
|
Minecart with Hopper=Vagonet embei un Embure
|
||||||
|
Minecart with TNT=Vagonet embei de la TNT
|
||||||
|
Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed.=Plaçatz z-o per sòu per construrre vostre chamin de fèrre, los ralhs se conectaron entre ilhs e faron de las corbas, de las junccions en T, en traversadas et en pentas au besonh.
|
||||||
|
Rail=Ralh
|
||||||
|
Rails can be used to build transport tracks for minecarts. Normal rails slightly slow down minecarts due to friction.=Los ralhs pòdon èsser utilizats per construrre los chamins de transpòrt per los vagonets. Los ralhs normaus ralentissons gentament los vagonet per causa de friccion.
|
||||||
|
Powered Rail=Ralh Atubat
|
||||||
|
Rails can be used to build transport tracks for minecarts. Powered rails are able to accelerate and brake minecarts.=Los ralhs pòdon èsser utilizats per construrre los chamins de transpòrt per los vagonets. Los ralhs atubats son per faire accelerar o frenar los vagonets.
|
||||||
|
Without redstone power, the rail will brake minecarts. To make this rail accelerate minecarts, power it with redstone power.=Sens energia de pèirotge, le ralh vai frenar los vagonets. Per que le ralh accelera los vagonets, alimentatz z-o embei de l'energia de pèirotge.
|
||||||
|
Activator Rail=Ralh d'Activacion
|
||||||
|
Rails can be used to build transport tracks for minecarts. Activator rails are used to activate special minecarts.=Los ralhs pòdon èsser utilizats per construrre los chamins de transpòrt per los vagonets. Los ralhs d'activacion son utilizats per activar daus vagonets speciaus.
|
||||||
|
To make this rail activate minecarts, power it with redstone power and send a minecart over this piece of rail.=Per activar le ralh, alimentatz z-o embei de l'energia de pèirotge e fasetz rotlar un vagonet per aqueste ralh.
|
||||||
|
Detector Rail=Ralh de Deteccion
|
||||||
|
Rails can be used to build transport tracks for minecarts. A detector rail is able to detect a minecart above it and powers redstone mechanisms.=Los ralhs pòdon èsser utilizats per construirre los chamins de transpòrt per los vagonets. Los ralhs de deteccion pòdon detectar un vagonet per ilhs e atubar un mecanisme de pèirotge.
|
||||||
|
To detect a minecart and provide redstone power, connect it to redstone trails or redstone mechanisms and send any minecart over the rail.=Per detectar un vagonet e produrre de l'energia de pèirotge, conectatz le ralh a de la pèirotge e fasetz rotlar un vagonet per i-aul.
|
||||||
|
Track for minecarts=Pista per vagonets
|
||||||
|
Speed up when powered, slow down when not powered=Acceleratz quand z-es atubat, ralentissetz quand z-es pas atubat.
|
||||||
|
Activates minecarts when powered=Activa los vagonets quand pas atubat.
|
||||||
|
Emits redstone power when a minecart is detected=Emeta de l'energia de pèirotge quand un vagonet z-es detectat.
|
||||||
|
Vehicle for fast travel on rails=Veicule per voiatjar vistament per ralhs.
|
||||||
|
Can be ignited by tools or powered activator rail=Pòt èsser atubat embei daus otilhs o un ralh d'activacion
|
||||||
|
Sneak to dismount=Se baissar per descendre
|
|
@ -0,0 +1,36 @@
|
||||||
|
# textdomain: mcl_minecarts
|
||||||
|
Minecart=Carrinho
|
||||||
|
Minecarts can be used for a quick transportion on rails.=Carrinhos podem ser usados para transporte rápido em trilhos.
|
||||||
|
Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type.=Carrinhos viajam somente em trilhos e sempre seguem os traçados. Em uma junção em T sem linha reta à frente, eles viram à esquerda. A velocidade é afetada pelo tipo do trilho.
|
||||||
|
You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving.=Você pode posicionar o carrinho em trilhos. Clique com o botão direito para entrar nele. Soque-o para fazê-lo mover.
|
||||||
|
To obtain the minecart, punch it while holding down the sneak key.=Para obter o carrinho, soque-o enquanto segura pressionada a tecla de agachar.
|
||||||
|
A minecart with TNT is an explosive vehicle that travels on rail.=Um carrinho com TNT é um veículo explosivo que viaja nos trilhos.
|
||||||
|
Place it on rails. Punch it to move it. The TNT is ignited with a flint and steel or when the minecart is on an powered activator rail.=Posicione-o nos trilhos. Soque-o para movê-lo. A TNT é acesa com um isqueiro ou quando o carrinho está sobre um trilho ativador energizado.
|
||||||
|
To obtain the minecart and TNT, punch them while holding down the sneak key. You can't do this if the TNT was ignited.=Para obter o carrinho e a TNT, soque-os enquanto segura pressionada a tecla de agachar. Você não consegue fazer isso se a TNT foi acesa.
|
||||||
|
A minecart with furnace is a vehicle that travels on rails. It can propel itself with fuel.=Um carrinho com fornalha é um veículo que viaja nos trilhos. Se move por conta própria com combustível.
|
||||||
|
Place it on rails. If you give it some coal, the furnace will start burning for a long time and the minecart will be able to move itself. Punch it to get it moving.=Posicione-o nos trilhos. Se você o der um pouco de carvão, a fornalha vai começar a queimar por um longo tempo e o carrinho será capaz de se mover por conta própria. Soque-o para fazê-lo mover.
|
||||||
|
To obtain the minecart and furnace, punch them while holding down the sneak key.=Para obter o carrinho e a fornalha, soque-os enquanto segura pressionada a tecla de agachar.
|
||||||
|
Minecart with Chest=Carrinho com Baú
|
||||||
|
Minecart with Furnace=Carrinho com Fornalha
|
||||||
|
Minecart with Command Block=Carrinho com Bloco de Comandos
|
||||||
|
Minecart with Hopper=Carrinho com Funil
|
||||||
|
Minecart with TNT=Carrinho com TNT
|
||||||
|
Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed.=Posicione-os no chão para construir suas linhas férreas, os trilhos vão conectar-se automaticamente uns nos outros e vão se transformar em curvas, junções em T, cruzamentos e rampas quando necessário.
|
||||||
|
Rail=Trilho
|
||||||
|
Rails can be used to build transport tracks for minecarts. Normal rails slightly slow down minecarts due to friction.=Trilhos podem ser usados para construir traçados de transporte para carrinhos. Trilhos normais freiam carrinhos gradativamente devido ao atrito.
|
||||||
|
Powered Rail=Trilho Energizador
|
||||||
|
Rails can be used to build transport tracks for minecarts. Powered rails are able to accelerate and brake minecarts.=Trilhos podem ser usados para construir traçados de transporte para carrinhos. Trilhos energizados são capazes de acelerar e frear carrinhos.
|
||||||
|
Without redstone power, the rail will brake minecarts. To make this rail accelerate minecarts, power it with redstone power.=Sem carga de redstone, o trilho vai frear os carrinhos. Para fazer o trilho acelerar os carrinhos, energize-o com uma carga de redstone.
|
||||||
|
Activator Rail=Trilho Ativador
|
||||||
|
Rails can be used to build transport tracks for minecarts. Activator rails are used to activate special minecarts.=Trilhos podem ser usados para construir traçados de transporte para carrinhos. Trilhos ativadores são usados para ativar carrinhos especiais.
|
||||||
|
To make this rail activate minecarts, power it with redstone power and send a minecart over this piece of rail.=Para fazer esse trilho ativar os carrinhos, energize-o com uma carga de redstone e envie um carrinho sobre esse pedaço de trilho.
|
||||||
|
Detector Rail=Trilho Detector
|
||||||
|
Rails can be used to build transport tracks for minecarts. A detector rail is able to detect a minecart above it and powers redstone mechanisms.=Trilhos podem ser usados para construir traçados de transporte para carrinhos. Um trilho detector é capaz de detectar um carrinho sobre ele e energizar mecanismos de redstone.
|
||||||
|
To detect a minecart and provide redstone power, connect it to redstone trails or redstone mechanisms and send any minecart over the rail.=Para detectar um carrinho e providenciar carga de redstone, conecte-o em trilhas de redstone ou mecanismos de redstone e envie qualquer carrinho sobre esse trilho.
|
||||||
|
Track for minecarts=Traçado para carrinhos
|
||||||
|
Speed up when powered, slow down when not powered=Acelera quando energizado, desacelera quando não energizado
|
||||||
|
Activates minecarts when powered=Ativa carrinhos quando energizado
|
||||||
|
Emits redstone power when a minecart is detected=Emite carga de redstone quando um carrinho é detectado
|
||||||
|
Vehicle for fast travel on rails=Veículo para viajar rápido em trilhos
|
||||||
|
Can be ignited by tools or powered activator rail=Pode ser aceso por ferramentas ou trilho ativador energizado
|
||||||
|
Sneak to dismount=Agache para desmontar
|
|
@ -112,6 +112,22 @@ register_rail("mcl_minecarts:golden_rail_on",
|
||||||
onstate = "mcl_minecarts:golden_rail_on",
|
onstate = "mcl_minecarts:golden_rail_on",
|
||||||
rules = rail_rules_long,
|
rules = rail_rules_long,
|
||||||
},
|
},
|
||||||
|
effector = {
|
||||||
|
action_on = function(pos, node)
|
||||||
|
local dir = mcl_minecarts:get_start_direction(pos)
|
||||||
|
if not dir then return end
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||||
|
for _, o in pairs(objs) do
|
||||||
|
local l = o:get_luaentity()
|
||||||
|
local v = o:get_velocity()
|
||||||
|
if l and string.sub(l.name, 1, 14) == "mcl_minecarts:"
|
||||||
|
and v and vector.equals(v, vector.zero())
|
||||||
|
then
|
||||||
|
mcl_minecarts:set_velocity(l, dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
drop = "mcl_minecarts:golden_rail",
|
drop = "mcl_minecarts:golden_rail",
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,6 +32,9 @@ function mob_class:feed_tame(clicker, feed_count, breed, tame, notake)
|
||||||
if not self.follow then
|
if not self.follow then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
if clicker:get_wielded_item():get_definition()._mcl_not_consumable then
|
||||||
|
return false
|
||||||
|
end
|
||||||
-- can eat/tame with item in hand
|
-- can eat/tame with item in hand
|
||||||
if self.nofollow or self:follow_holding(clicker) then
|
if self.nofollow or self:follow_holding(clicker) then
|
||||||
local consume_food = false
|
local consume_food = false
|
||||||
|
@ -319,7 +322,7 @@ function mob_class:toggle_sit(clicker,p)
|
||||||
particle = "mobs_mc_wolf_icon_roam.png"
|
particle = "mobs_mc_wolf_icon_roam.png"
|
||||||
self.order = "roam"
|
self.order = "roam"
|
||||||
self.state = "stand"
|
self.state = "stand"
|
||||||
self.walk_chance = default_walk_chance
|
self.walk_chance = 50
|
||||||
self.jump = true
|
self.jump = true
|
||||||
self:set_animation("stand")
|
self:set_animation("stand")
|
||||||
-- TODO: Add sitting model
|
-- TODO: Add sitting model
|
||||||
|
|
|
@ -21,6 +21,8 @@ local function atan(x)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_mobs.effect_functions = {}
|
||||||
|
|
||||||
|
|
||||||
-- check if daytime and also if mob is docile during daylight hours
|
-- check if daytime and also if mob is docile during daylight hours
|
||||||
function mob_class:day_docile()
|
function mob_class:day_docile()
|
||||||
|
@ -33,14 +35,19 @@ function mob_class:day_docile()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- attack player/mob
|
-- get this mob to attack the object
|
||||||
function mob_class:do_attack(player)
|
function mob_class:do_attack(object)
|
||||||
|
|
||||||
if self.state == "attack" or self.state == "die" then
|
if self.state == "attack" or self.state == "die" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.attack = player
|
|
||||||
|
if object:is_player() and not minetest.settings:get_bool("enable_damage") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.attack = object
|
||||||
self.state = "attack"
|
self.state = "attack"
|
||||||
|
|
||||||
-- TODO: Implement war_cry sound without being annoying
|
-- TODO: Implement war_cry sound without being annoying
|
||||||
|
@ -382,7 +389,8 @@ function mob_class:monster_attack()
|
||||||
-- find specific mob to attack, failing that attack player/npc/animal
|
-- find specific mob to attack, failing that attack player/npc/animal
|
||||||
if specific_attack(self.specific_attack, name)
|
if specific_attack(self.specific_attack, name)
|
||||||
and (type == "player" or ( type == "npc" and self.attack_npcs )
|
and (type == "player" or ( type == "npc" and self.attack_npcs )
|
||||||
or (type == "animal" and self.attack_animals == true)) then
|
or (type == "animal" and self.attack_animals == true)
|
||||||
|
or (self.extra_hostile and not self.attack_exception(player))) then
|
||||||
p = player:get_pos()
|
p = player:get_pos()
|
||||||
sp = s
|
sp = s
|
||||||
|
|
||||||
|
@ -513,6 +521,28 @@ end
|
||||||
|
|
||||||
-- deal damage and effects when mob punched
|
-- deal damage and effects when mob punched
|
||||||
function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
|
local is_player = hitter:is_player()
|
||||||
|
local mob_pos = self.object:get_pos()
|
||||||
|
local player_pos = hitter:get_pos()
|
||||||
|
|
||||||
|
if is_player then
|
||||||
|
-- is mob out of reach?
|
||||||
|
if vector.distance(mob_pos, player_pos) > 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- is mob protected?
|
||||||
|
if self.protected and minetest.is_protected(mob_pos, hitter:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local time_now = minetest.get_us_time()
|
||||||
|
local time_diff = time_now - self.invul_timestamp
|
||||||
|
|
||||||
|
-- check for invulnerability time in microseconds (0.5 second)
|
||||||
|
if time_diff <= 500000 and time_diff >= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- custom punch function
|
-- custom punch function
|
||||||
if self.do_punch then
|
if self.do_punch then
|
||||||
|
@ -529,20 +559,15 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local is_player = hitter:is_player()
|
local time_now = minetest.get_us_time()
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
-- is mob protected?
|
|
||||||
if self.protected and minetest.is_protected(self.object:get_pos(), hitter:get_player_name()) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.is_creative_enabled(hitter:get_player_name()) then
|
if minetest.is_creative_enabled(hitter:get_player_name()) then
|
||||||
self.health = 0
|
self.health = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set/update 'drop xp' timestamp if hitted by player
|
-- set/update 'drop xp' timestamp if hitted by player
|
||||||
self.xp_timestamp = minetest.get_us_time()
|
self.xp_timestamp = time_now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -654,6 +679,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
-- do damage
|
-- do damage
|
||||||
self.health = self.health - damage
|
self.health = self.health - damage
|
||||||
|
|
||||||
|
-- give invulnerability
|
||||||
|
self.invul_timestamp = time_now
|
||||||
|
|
||||||
-- skip future functions if dead, except alerting others
|
-- skip future functions if dead, except alerting others
|
||||||
if self:check_for_death( "hit", {type = "punch", puncher = hitter}) then
|
if self:check_for_death( "hit", {type = "punch", puncher = hitter}) then
|
||||||
die = true
|
die = true
|
||||||
|
@ -669,10 +697,10 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
if not v then return end
|
if not v then return end
|
||||||
local r = 1.4 - math.min(punch_interval, 1.4)
|
local r = 1.4 - math.min(punch_interval, 1.4)
|
||||||
local kb = r * (math.abs(v.x)+math.abs(v.z))
|
local kb = r * (math.abs(v.x)+math.abs(v.z))
|
||||||
local up = 2
|
local up = 2.625
|
||||||
|
|
||||||
if die==true then
|
if die==true then
|
||||||
kb=kb*2
|
kb=kb*1.25
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if already in air then dont go up anymore when hit
|
-- if already in air then dont go up anymore when hit
|
||||||
|
@ -686,7 +714,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
if tool_capabilities.damage_groups["knockback"] then
|
if tool_capabilities.damage_groups["knockback"] then
|
||||||
kb = tool_capabilities.damage_groups["knockback"]
|
kb = tool_capabilities.damage_groups["knockback"]
|
||||||
else
|
else
|
||||||
kb = kb * 1.5
|
kb = kb * 1.25
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -696,9 +724,19 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
end
|
end
|
||||||
if hitter and is_player then
|
if hitter and is_player then
|
||||||
local wielditem = hitter:get_wielded_item()
|
local wielditem = hitter:get_wielded_item()
|
||||||
kb = kb + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||||
elseif luaentity and luaentity._knockback then
|
-- add player velocity to mob knockback
|
||||||
|
local hv = hitter:get_velocity()
|
||||||
|
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
||||||
|
local player_mag = math.sqrt((hv.x * hv.x) + (hv.z * hv.z))
|
||||||
|
local mob_mag = math.sqrt((v.x * v.x) + (v.z * v.z))
|
||||||
|
if dir_dot > 0 and mob_mag <= player_mag * 0.625 then
|
||||||
|
kb = kb + ((math.abs(hv.x) + math.abs(hv.z)) * r)
|
||||||
|
end
|
||||||
|
elseif luaentity and luaentity._knockback and die == false then
|
||||||
kb = kb + luaentity._knockback
|
kb = kb + luaentity._knockback
|
||||||
|
elseif luaentity and luaentity._knockback and die == true then
|
||||||
|
kb = kb + luaentity._knockback * 0.25
|
||||||
end
|
end
|
||||||
self._kb_turn = true
|
self._kb_turn = true
|
||||||
self._turn_to=self.object:get_yaw()-1.57
|
self._turn_to=self.object:get_yaw()-1.57
|
||||||
|
@ -1103,6 +1141,11 @@ function mob_class:do_states_attack (dtime)
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = self.damage}
|
damage_groups = {fleshy = self.damage}
|
||||||
}, nil)
|
}, nil)
|
||||||
|
if self.dealt_effect then
|
||||||
|
mcl_mobs.effect_functions[self.dealt_effect.name](
|
||||||
|
self.attack, self.dealt_effect.factor, self.dealt_effect.dur
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.custom_attack(self, p)
|
self.custom_attack(self, p)
|
||||||
|
@ -1193,6 +1236,9 @@ function mob_class:do_states_attack (dtime)
|
||||||
-- important for mcl_shields
|
-- important for mcl_shields
|
||||||
ent._shooter = self.object
|
ent._shooter = self.object
|
||||||
ent._saved_shooter_pos = self.object:get_pos()
|
ent._saved_shooter_pos = self.object:get_pos()
|
||||||
|
if ent.homing then
|
||||||
|
ent._target = self.attack
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||||
|
@ -1209,7 +1255,13 @@ function mob_class:do_states_attack (dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
|
|
||||||
|
elseif self.attack_type == "custom" and self.attack_state then
|
||||||
|
self.attack_state(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.on_attack then
|
||||||
|
self.on_attack(self, dtime)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local math, tonumber, vector, minetest, mcl_mobs = math, tonumber, vector, minetest, mcl_mobs
|
local math, tonumber, vector, minetest, mcl_mobs = math, tonumber, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
local validate_vector = mcl_util.validate_vector
|
||||||
|
|
||||||
local active_particlespawners = {}
|
local active_particlespawners = {}
|
||||||
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
|
||||||
local DEFAULT_FALL_SPEED = -9.81*1.5
|
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||||
|
@ -9,16 +11,6 @@ local PATHFINDING = "gowp"
|
||||||
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128
|
||||||
if player_transfer_distance == 0 then player_transfer_distance = math.huge end
|
if player_transfer_distance == 0 then player_transfer_distance = math.huge end
|
||||||
|
|
||||||
|
|
||||||
local function validate_vector (vect)
|
|
||||||
if vect then
|
|
||||||
if tonumber(vect.x) and tonumber(vect.y) and tonumber(vect.z) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- custom particle effects
|
-- custom particle effects
|
||||||
function mcl_mobs.effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
function mcl_mobs.effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
||||||
|
|
||||||
|
@ -418,7 +410,7 @@ function mob_class:check_head_swivel(dtime)
|
||||||
--final_rotation = vector.new(0,0,0)
|
--final_rotation = vector.new(0,0,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), final_rotation)
|
mcl_util.set_bone_position(self.object,self.head_swivel, vector.new(0,self.bone_eye_height,self.horizontal_head_height), final_rotation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
head_eye_height = def.head_eye_height or def.bone_eye_height or 0, -- how hight aproximatly the mobs head is fromm the ground to tell the mob how high to look up at the player
|
head_eye_height = def.head_eye_height or def.bone_eye_height or 0, -- how hight aproximatly the mobs head is fromm the ground to tell the mob how high to look up at the player
|
||||||
curiosity = def.curiosity or 1, -- how often mob will look at player on idle
|
curiosity = def.curiosity or 1, -- how often mob will look at player on idle
|
||||||
head_yaw = def.head_yaw or "y", -- axis to rotate head on
|
head_yaw = def.head_yaw or "y", -- axis to rotate head on
|
||||||
horrizonatal_head_height = def.horrizonatal_head_height or 0,
|
horizontal_head_height = def.horizontal_head_height or 0,
|
||||||
wears_armor = def.wears_armor, -- a number value used to index texture slot for armor
|
wears_armor = def.wears_armor, -- a number value used to index texture slot for armor
|
||||||
stepheight = def.stepheight or 0.6,
|
stepheight = def.stepheight or 0.6,
|
||||||
name = name,
|
name = name,
|
||||||
|
@ -171,6 +171,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
xp_min = def.xp_min or 0,
|
xp_min = def.xp_min or 0,
|
||||||
xp_max = def.xp_max or 0,
|
xp_max = def.xp_max or 0,
|
||||||
xp_timestamp = 0,
|
xp_timestamp = 0,
|
||||||
|
invul_timestamp = 0,
|
||||||
breath_max = def.breath_max or 15,
|
breath_max = def.breath_max or 15,
|
||||||
breathes_in_water = def.breathes_in_water or false,
|
breathes_in_water = def.breathes_in_water or false,
|
||||||
physical = true,
|
physical = true,
|
||||||
|
@ -287,6 +288,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
spawn_in_group_min = def.spawn_in_group_min,
|
spawn_in_group_min = def.spawn_in_group_min,
|
||||||
noyaw = def.noyaw or false,
|
noyaw = def.noyaw or false,
|
||||||
particlespawners = def.particlespawners,
|
particlespawners = def.particlespawners,
|
||||||
|
spawn_check = def.spawn_check,
|
||||||
-- End of MCL2 extensions
|
-- End of MCL2 extensions
|
||||||
on_spawn = def.on_spawn,
|
on_spawn = def.on_spawn,
|
||||||
on_blast = def.on_blast or function(self,damage)
|
on_blast = def.on_blast or function(self,damage)
|
||||||
|
@ -297,6 +299,7 @@ function mcl_mobs.register_mob(name, def)
|
||||||
return false, true, {}
|
return false, true, {}
|
||||||
end,
|
end,
|
||||||
do_punch = def.do_punch,
|
do_punch = def.do_punch,
|
||||||
|
deal_damage = def.deal_damage,
|
||||||
on_breed = def.on_breed,
|
on_breed = def.on_breed,
|
||||||
on_grown = def.on_grown,
|
on_grown = def.on_grown,
|
||||||
on_pick_up = def.on_pick_up,
|
on_pick_up = def.on_pick_up,
|
||||||
|
@ -311,18 +314,40 @@ function mcl_mobs.register_mob(name, def)
|
||||||
|
|
||||||
return self:mob_activate(staticdata, def, dtime)
|
return self:mob_activate(staticdata, def, dtime)
|
||||||
end,
|
end,
|
||||||
|
attack_state = def.attack_state, -- custom attack state
|
||||||
|
on_attack = def.on_attack, -- called after attack, useful with otherwise predefined attack states (not custom)
|
||||||
harmed_by_heal = def.harmed_by_heal,
|
harmed_by_heal = def.harmed_by_heal,
|
||||||
on_lightning_strike = def.on_lightning_strike
|
is_boss = def.is_boss,
|
||||||
|
dealt_effect = def.dealt_effect,
|
||||||
|
on_lightning_strike = def.on_lightning_strike,
|
||||||
|
extra_hostile = def.extra_hostile,
|
||||||
|
attack_exception = def.attack_exception or function(p) return false end,
|
||||||
|
|
||||||
|
_spawner = def._spawner,
|
||||||
}
|
}
|
||||||
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
|
||||||
|
|
||||||
if minetest.get_modpath("doc_identifier") ~= nil then
|
if minetest.get_modpath("doc_identifier") ~= nil then
|
||||||
doc.sub.identifier.register_object(name, "basics", "mobs")
|
doc.sub.identifier.register_object(name, "basics", "mobs")
|
||||||
|
|
||||||
|
if def.unused ~= true then
|
||||||
|
doc.add_entry("mobs", name, {
|
||||||
|
name = def.description or name,
|
||||||
|
data = final_def,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
|
||||||
end -- END mcl_mobs.register_mob function
|
end -- END mcl_mobs.register_mob function
|
||||||
|
|
||||||
|
|
||||||
|
function mcl_mobs.get_arrow_damage_func(damage, typ)
|
||||||
|
local typ = mcl_damage.types[typ] and typ or "arrow"
|
||||||
|
return function(projectile, object)
|
||||||
|
return mcl_util.deal_damage(object, damage, {type = typ})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- register arrow for shoot attack
|
-- register arrow for shoot attack
|
||||||
function mcl_mobs.register_arrow(name, def)
|
function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
|
@ -339,15 +364,18 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
hit_node = def.hit_node,
|
hit_node = def.hit_node,
|
||||||
hit_mob = def.hit_mob,
|
hit_mob = def.hit_mob,
|
||||||
hit_object = def.hit_object,
|
hit_object = def.hit_object,
|
||||||
|
homing = def.homing,
|
||||||
drop = def.drop or false, -- drops arrow as registered item when true
|
drop = def.drop or false, -- drops arrow as registered item when true
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||||
timer = 0,
|
timer = 0,
|
||||||
switch = 0,
|
switch = 0,
|
||||||
|
_lifetime = def._lifetime or 7,
|
||||||
owner_id = def.owner_id,
|
owner_id = def.owner_id,
|
||||||
rotate = def.rotate,
|
rotate = def.rotate,
|
||||||
on_punch = function(self)
|
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity():length()
|
||||||
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
self.object:set_velocity(dir * vel)
|
||||||
|
self._puncher = puncher
|
||||||
end,
|
end,
|
||||||
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
||||||
automatic_face_movement_dir = def.rotate
|
automatic_face_movement_dir = def.rotate
|
||||||
|
@ -357,12 +385,12 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
|
|
||||||
on_step = def.on_step or function(self, dtime)
|
on_step = def.on_step or function(self, dtime)
|
||||||
|
|
||||||
self.timer = self.timer + 1
|
self.timer = self.timer + dtime
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
if self.switch == 0
|
if self.switch == 0
|
||||||
or self.timer > 150
|
or self.timer > self._lifetime
|
||||||
or not within_limits(pos, 0) then
|
or not within_limits(pos, 0) then
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
|
@ -410,26 +438,37 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.homing and self._target then
|
||||||
|
local p = self._target:get_pos()
|
||||||
|
if p then
|
||||||
|
if minetest.line_of_sight(self.object:get_pos(), p) then
|
||||||
|
self.object:set_velocity(vector.direction(self.object:get_pos(), p) * self.velocity)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self._target = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if self.hit_player or self.hit_mob or self.hit_object then
|
if self.hit_player or self.hit_mob or self.hit_object then
|
||||||
|
|
||||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
||||||
|
|
||||||
if self.hit_player
|
if self.hit_player
|
||||||
and player:is_player() then
|
and object:is_player() then
|
||||||
|
|
||||||
self.hit_player(self, player)
|
self.hit_player(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local entity = player:get_luaentity()
|
local entity = object:get_luaentity()
|
||||||
|
|
||||||
if entity
|
if entity
|
||||||
and self.hit_mob
|
and self.hit_mob
|
||||||
and entity.is_mob == true
|
and entity.is_mob == true
|
||||||
and tostring(player) ~= self.owner_id
|
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_mob(self, player)
|
self.hit_mob(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -437,9 +476,9 @@ function mcl_mobs.register_arrow(name, def)
|
||||||
if entity
|
if entity
|
||||||
and self.hit_object
|
and self.hit_object
|
||||||
and (not entity.is_mob)
|
and (not entity.is_mob)
|
||||||
and tostring(player) ~= self.owner_id
|
and (tostring(object) ~= self.owner_id or self.timer > 2)
|
||||||
and entity.name ~= self.object:get_luaentity().name then
|
and entity.name ~= self.object:get_luaentity().name then
|
||||||
self.hit_object(self, player)
|
self.hit_object(self, object)
|
||||||
self.object:remove();
|
self.object:remove();
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,7 +87,8 @@ function mob_class:check_item_pickup()
|
||||||
end
|
end
|
||||||
if self.pick_up then
|
if self.pick_up then
|
||||||
for k,v in pairs(self.pick_up) do
|
for k,v in pairs(self.pick_up) do
|
||||||
if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then
|
local itemstack = ItemStack(l.itemstring)
|
||||||
|
if not player_near(p) and self.on_pick_up and itemstack:get_name():find(v) then
|
||||||
local r = self.on_pick_up(self,l)
|
local r = self.on_pick_up(self,l)
|
||||||
if r and r.is_empty and not r:is_empty() then
|
if r and r.is_empty and not r:is_empty() then
|
||||||
l.itemstring = r:to_string()
|
l.itemstring = r:to_string()
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# textdomain: mcl_mobs
|
||||||
|
Peaceful mode active! No monsters will spawn.=Mòde tranquile actiu! Gis de mostre vai aparèisser.
|
||||||
|
This allows you to place a single mob.=Quo permet de plaça una creatura.
|
||||||
|
Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.=Plaçatz z-o a l'endreit que volètz veire la creatura aparèisser. Las bèstias seron dejà domesticadas, defòra si laissatz la tocha se baissar enfonçada. Si z-o plaçatz sobre un generator de creaturas, chamjatz la creatura generada.
|
||||||
|
You need the “maphack” privilege to change the mob spawner.=Avètz besonh dau privilègi "maphack" per chamjar le generator de creaturas.
|
||||||
|
Name Tag=Étiquette de nom
|
||||||
|
A name tag is an item to name a mob.=Una etiqueta z-es un otilh per chamjar le nom de la creatura.
|
||||||
|
Before you use the name tag, you need to set a name at an anvil. Then you can use the name tag to name a mob. This uses up the name tag.=Davant d'utilizar l'etiqueta, vos fau li botar un nom embei una enclutge. Après, podètz utilizar l'etiqueta per nomar una creatura. L'etiqueta pòt èsser utilizada un còp.
|
||||||
|
Only peaceful mobs allowed!=Mas las creaturas pacificas son autorizadas!
|
||||||
|
Give names to mobs=Balha daus noms a las creaturas
|
||||||
|
Set name at anvil=Botar le nom embei l'enclutge
|
||||||
|
Removes specified mobs except nametagged and tamed ones. For the second parameter, use nametagged/tamed to select only nametagged/tamed mobs, or a range to specify a maximum distance from the player.=Lèva las creaturas specifiadas defòra de las que son nomadas o domesticadas. Per le paramètre segònd, utilizar nomat/domesticat per mas seleccionar las creaturas nomadas/domesticadas, o una distança per specifiar la distança maximum embei li joairi.
|
||||||
|
Default usage. Clearing hostile mobs. For more options please type: /help clearmobs=Usage par défaut. Lèva las creaturas ostilas. Per mai d'opcions, escriure : /help clearmobs
|
|
@ -0,0 +1,13 @@
|
||||||
|
# textdomain: mcl_mobs
|
||||||
|
Peaceful mode active! No monsters will spawn.=Modo pacífico ativado! Nenhum monstro será gerado.
|
||||||
|
This allows you to place a single mob.=Isso permite você posicionar um único mob.
|
||||||
|
Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.=Posicione-o onde você deseja que o mob apareça. Animais serão gerados domesticados, a menos que você segure pressionada a tecla de agachar enquanto posiciona. Se você posicionar em um gerador de mobs, você muda o mob que será gerado.
|
||||||
|
You need the “maphack” privilege to change the mob spawner.=Você precisa do privilégio "maphack" para mudar o gerador de mobs.
|
||||||
|
Name Tag=Etiqueta
|
||||||
|
A name tag is an item to name a mob.=Uma etiqueta é um item para nomear um mob.
|
||||||
|
Before you use the name tag, you need to set a name at an anvil. Then you can use the name tag to name a mob. This uses up the name tag.=Antes de você usar a etiqueta, você precisa determinar um nome em uma bigorna. Assim você pode usar a etiqueta para nomear um mob. Isso consumirá a etiqueta.
|
||||||
|
Only peaceful mobs allowed!=Apenas mobs pacíficos permitidos!
|
||||||
|
Give names to mobs=Dá nome aos mobs
|
||||||
|
Set name at anvil=Determine um nome em uma bigorna
|
||||||
|
Removes specified mobs except nametagged and tamed ones. For the second parameter, use nametagged/tamed to select only nametagged/tamed mobs, or a range to specify a maximum distance from the player.=Remove mobs especifícos exceto os mobs nomeados ou domesticados. Como segundo parâmetro, use nametagged/tamed para selecionar apenas mobs nomeados/domesticados, ou um alcançe para especificar uma distância máxima em relação ao jogador.
|
||||||
|
Default usage. Clearing hostile mobs. For more options please type: /help clearmobs=Uso padrão. Eliminando mobs hostis. Para mais opções por favor digite: /help clearmobs
|
|
@ -1,5 +1,6 @@
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
local validate_vector = mcl_util.validate_vector
|
||||||
|
|
||||||
local ENTITY_CRAMMING_MAX = 24
|
local ENTITY_CRAMMING_MAX = 24
|
||||||
local CRAMMING_DAMAGE = 3
|
local CRAMMING_DAMAGE = 3
|
||||||
|
@ -355,7 +356,7 @@ function mob_class:set_yaw(yaw, delay, dtime)
|
||||||
|
|
||||||
if math.abs(target_shortest_path_nums) > 10 then
|
if math.abs(target_shortest_path_nums) > 10 then
|
||||||
self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime)))
|
self.object:set_yaw(self.object:get_yaw()+(target_shortest_path*(3.6*ddtime)))
|
||||||
if self.acc then
|
if validate_vector(self.acc) then
|
||||||
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
self.acc=vector.rotate_around_axis(self.acc,vector.new(0,1,0), target_shortest_path*(3.6*ddtime))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -681,6 +682,9 @@ function mob_class:do_env_damage()
|
||||||
-- don't fall when on ignore, just stand still
|
-- don't fall when on ignore, just stand still
|
||||||
if self.standing_in == "ignore" then
|
if self.standing_in == "ignore" then
|
||||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||||
|
-- wither rose effect
|
||||||
|
elseif self.standing_in == "mcl_flowers:wither_rose" then
|
||||||
|
mcl_potions.withering_func(self.object, 1, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
@ -757,6 +761,61 @@ function mob_class:do_env_damage()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Cactus damage
|
||||||
|
local near = minetest.find_node_near(pos, 1, "mcl_core:cactus", true)
|
||||||
|
if not near and near ~= nil then
|
||||||
|
near = find_node_near({x=pos.x, y=pos.y-1, z=pos.z}, 1, "mcl_core:cactus", true)
|
||||||
|
end
|
||||||
|
if near then
|
||||||
|
-- is mob touching the cactus?
|
||||||
|
local dist = vector.distance(pos, near)
|
||||||
|
local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near)
|
||||||
|
local large_mob = false
|
||||||
|
local medium_mob = false
|
||||||
|
if self.name == "mobs_mc:ender_dragon" or
|
||||||
|
self.name == "mobs_mc:ghast" or
|
||||||
|
self.name == "mobs_mc:guardian_elder" or
|
||||||
|
self.name == "mobs_mc:slime_big" or
|
||||||
|
self.name == "mobs_mc:magma_cube_big" or
|
||||||
|
self.name == "mobs_mc:wither" then
|
||||||
|
|
||||||
|
large_mob = true
|
||||||
|
elseif self.name == "mobs_mc:hoglin" or
|
||||||
|
self.name == "mobs_mc:zoglin" or
|
||||||
|
self.name == "mobs_mc:horse" or
|
||||||
|
self.name == "mobs_mc:skeleton_horse" or
|
||||||
|
self.name == "mobs_mc:zombie_horse" or
|
||||||
|
self.name == "mobs_mc:donkey" or
|
||||||
|
self.name == "mobs_mc:mule" or
|
||||||
|
self.name == "mobs_mc:iron_golem" or
|
||||||
|
self.name == "mobs_mc:polar_bear" or
|
||||||
|
self.name == "mobs_mc:spider" or
|
||||||
|
self.name == "mobs_mc:cave_spider" or
|
||||||
|
self.name == "mobs_mc:strider" then
|
||||||
|
|
||||||
|
medium_mob = true
|
||||||
|
end
|
||||||
|
if (not large_mob and not medium_mob and (dist < 1.03 or dist_feet < 1.6)) or (medium_mob and (dist < 1.165 or dist_feet < 1.73)) or (large_mob and (dist < 1.25 or dist_feet < 1.9)) then
|
||||||
|
if self.health ~= 0 then
|
||||||
|
self:damage_mob("cactus", 2)
|
||||||
|
|
||||||
|
if self:check_for_death("cactus", {type = "environment",
|
||||||
|
pos = pos, node = self.standing_in}) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- is mob standing on the cactus?
|
||||||
|
if self.standing_on == "mcl_core:cactus" or self.standing_in == "mcl_core:cactus" or self.standing_under == "mcl_core:cactus" then
|
||||||
|
self:damage_mob("cactus", 2)
|
||||||
|
|
||||||
|
if self:check_for_death("cactus", {type = "environment",
|
||||||
|
pos = pos, node = self.standing_in}) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Drowning damage
|
-- Drowning damage
|
||||||
if self.breath_max ~= -1 then
|
if self.breath_max ~= -1 then
|
||||||
local drowning = false
|
local drowning = false
|
||||||
|
|
|
@ -2,14 +2,20 @@
|
||||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||||
local mob_class = mcl_mobs.mob_class
|
local mob_class = mcl_mobs.mob_class
|
||||||
|
|
||||||
|
local modern_lighting = minetest.settings:get_bool("mcl_mobs_modern_lighting", true)
|
||||||
|
local nether_threshold = tonumber(minetest.settings:get("mcl_mobs_nether_threshold")) or 11
|
||||||
|
local end_threshold = tonumber(minetest.settings:get("mcl_mobs_end_threshold")) or 0
|
||||||
|
local overworld_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_threshold")) or 0
|
||||||
|
local overworld_sky_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_sky_threshold")) or 7
|
||||||
|
local overworld_passive_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_passive_threshold")) or 7
|
||||||
|
|
||||||
local get_node = minetest.get_node
|
local get_node = minetest.get_node
|
||||||
local get_item_group = minetest.get_item_group
|
local get_item_group = minetest.get_item_group
|
||||||
local get_node_light = minetest.get_node_light
|
local get_node_light = minetest.get_node_light
|
||||||
local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
|
local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
|
||||||
local get_biome_name = minetest.get_biome_name
|
local mt_get_biome_name = minetest.get_biome_name
|
||||||
local get_objects_inside_radius = minetest.get_objects_inside_radius
|
local get_objects_inside_radius = minetest.get_objects_inside_radius
|
||||||
local get_connected_players = minetest.get_connected_players
|
local get_connected_players = minetest.get_connected_players
|
||||||
local minetest_get_perlin = minetest.get_perlin
|
|
||||||
|
|
||||||
local math_random = math.random
|
local math_random = math.random
|
||||||
local math_floor = math.floor
|
local math_floor = math.floor
|
||||||
|
@ -90,19 +96,6 @@ local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
||||||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
local logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
|
||||||
|
|
||||||
local noise_params = {
|
|
||||||
offset = 0,
|
|
||||||
scale = 3,
|
|
||||||
spread = {
|
|
||||||
x = 301,
|
|
||||||
y = 50,
|
|
||||||
z = 304,
|
|
||||||
},
|
|
||||||
seed = 100,
|
|
||||||
octaves = 3,
|
|
||||||
persistence = 0.5,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs
|
-- THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs
|
||||||
-- Also used for missing parameter
|
-- Also used for missing parameter
|
||||||
-- Please update the list when adding new biomes!
|
-- Please update the list when adding new biomes!
|
||||||
|
@ -439,7 +432,6 @@ WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua??
|
||||||
local spawn_dictionary = {}
|
local spawn_dictionary = {}
|
||||||
--this is where all of the spawning information is kept for mobs that don't naturally spawn
|
--this is where all of the spawning information is kept for mobs that don't naturally spawn
|
||||||
local non_spawn_dictionary = {}
|
local non_spawn_dictionary = {}
|
||||||
local summary_chance = 0
|
|
||||||
|
|
||||||
function mcl_mobs:spawn_setup(def)
|
function mcl_mobs:spawn_setup(def)
|
||||||
if not mobs_spawn then return end
|
if not mobs_spawn then return end
|
||||||
|
@ -501,7 +493,6 @@ function mcl_mobs:spawn_setup(def)
|
||||||
check_position = check_position,
|
check_position = check_position,
|
||||||
on_spawn = on_spawn,
|
on_spawn = on_spawn,
|
||||||
}
|
}
|
||||||
summary_chance = summary_chance + chance
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_mobs:mob_light_lvl(mob_name, dimension)
|
function mcl_mobs:mob_light_lvl(mob_name, dimension)
|
||||||
|
@ -605,10 +596,8 @@ function mcl_mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_
|
||||||
spawn_dictionary[key]["day_toggle"] = day_toggle
|
spawn_dictionary[key]["day_toggle"] = day_toggle
|
||||||
spawn_dictionary[key]["check_position"] = check_position
|
spawn_dictionary[key]["check_position"] = check_position
|
||||||
|
|
||||||
summary_chance = summary_chance + chance
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local two_pi = 2 * math.pi
|
local two_pi = 2 * math.pi
|
||||||
local function get_next_mob_spawn_pos(pos)
|
local function get_next_mob_spawn_pos(pos)
|
||||||
-- TODO We should consider spawning something a little further away sporadically.
|
-- TODO We should consider spawning something a little further away sporadically.
|
||||||
|
@ -675,7 +664,29 @@ local function has_room(self,pos)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_mobs.custom_biomecheck = nil
|
||||||
|
|
||||||
|
function mcl_mobs.register_custom_biomecheck(custom_biomecheck)
|
||||||
|
mcl_mobs.custom_biomecheck = custom_biomecheck
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function get_biome_name(pos)
|
||||||
|
if mcl_mobs.custom_biomecheck then
|
||||||
|
return mcl_mobs.custom_biomecheck (pos)
|
||||||
|
else
|
||||||
|
local gotten_biome = minetest.get_biome_data(pos)
|
||||||
|
|
||||||
|
if not gotten_biome then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
gotten_biome = mt_get_biome_name(gotten_biome.biome)
|
||||||
|
--minetest.log ("biome: " .. dump(gotten_biome))
|
||||||
|
|
||||||
|
return gotten_biome
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function spawn_check(pos, spawn_def)
|
local function spawn_check(pos, spawn_def)
|
||||||
if not spawn_def or not pos then return end
|
if not spawn_def or not pos then return end
|
||||||
|
@ -685,11 +696,10 @@ local function spawn_check(pos, spawn_def)
|
||||||
local mob_def = minetest.registered_entities[spawn_def.name]
|
local mob_def = minetest.registered_entities[spawn_def.name]
|
||||||
local mob_type = mob_def.type
|
local mob_type = mob_def.type
|
||||||
local gotten_node = get_node(pos).name
|
local gotten_node = get_node(pos).name
|
||||||
local gotten_biome = minetest.get_biome_data(pos)
|
if not gotten_node then return end
|
||||||
|
|
||||||
if not gotten_node or not gotten_biome then return end
|
local biome_name = get_biome_name(pos)
|
||||||
|
if not biome_name then return end
|
||||||
gotten_biome = get_biome_name(gotten_biome.biome) --makes it easier to work with
|
|
||||||
|
|
||||||
local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0
|
local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0
|
||||||
if not is_ground then
|
if not is_ground then
|
||||||
|
@ -707,11 +717,9 @@ local function spawn_check(pos, spawn_def)
|
||||||
if pos.y >= spawn_def.min_height
|
if pos.y >= spawn_def.min_height
|
||||||
and pos.y <= spawn_def.max_height
|
and pos.y <= spawn_def.max_height
|
||||||
and spawn_def.dimension == dimension
|
and spawn_def.dimension == dimension
|
||||||
and biome_check(spawn_def.biomes, gotten_biome) then
|
and biome_check(spawn_def.biomes, biome_name) then
|
||||||
|
|
||||||
--mcl_log("Level 1 spawn check passed")
|
|
||||||
--minetest.log("Mob: " .. mob_def.name)
|
|
||||||
|
|
||||||
|
mcl_log("Spawn level 1 check - Passed")
|
||||||
if (is_ground or spawn_def.type_of_spawning ~= "ground")
|
if (is_ground or spawn_def.type_of_spawning ~= "ground")
|
||||||
and (spawn_def.type_of_spawning ~= "ground" or not is_leaf)
|
and (spawn_def.type_of_spawning ~= "ground" or not is_leaf)
|
||||||
and (not is_farm_animal(spawn_def.name) or is_grass)
|
and (not is_farm_animal(spawn_def.name) or is_grass)
|
||||||
|
@ -721,20 +729,42 @@ local function spawn_check(pos, spawn_def)
|
||||||
and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil)
|
and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil)
|
||||||
and ( not spawn_protected or not minetest.is_protected(pos, "") ) then
|
and ( not spawn_protected or not minetest.is_protected(pos, "") ) then
|
||||||
|
|
||||||
--mcl_log("Level 2 spawn check passed")
|
mcl_log("Spawn level 2 check - Passed")
|
||||||
|
|
||||||
local gotten_light = get_node_light(pos)
|
local gotten_light = get_node_light(pos)
|
||||||
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
|
||||||
--mcl_log("Level 3 spawn check passed")
|
if modern_lighting then
|
||||||
|
local my_node = get_node(pos)
|
||||||
|
local sky_light = minetest.get_natural_light(pos)
|
||||||
|
local art_light = minetest.get_artificial_light(my_node.param1)
|
||||||
|
|
||||||
|
if mob_def.spawn_check then
|
||||||
|
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
|
||||||
|
elseif mob_type == "monster" then
|
||||||
|
if dimension == "nether" then
|
||||||
|
if art_light <= nether_threshold then
|
||||||
return true
|
return true
|
||||||
else
|
end
|
||||||
--mcl_log("Spawn check level 3 failed")
|
elseif dimension == "end" then
|
||||||
|
if art_light <= end_threshold then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
elseif dimension == "overworld" then
|
||||||
|
if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--mcl_log("Spawn check level 2 failed")
|
-- passive threshold is apparently the same in all dimensions ...
|
||||||
|
if gotten_light > overworld_passive_threshold then
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--mcl_log("Spawn check level 1 failed")
|
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -850,8 +880,6 @@ minetest.register_chatcommand("spawn_mob",{
|
||||||
|
|
||||||
if mobs_spawn then
|
if mobs_spawn then
|
||||||
|
|
||||||
local perlin_noise
|
|
||||||
|
|
||||||
-- Get pos to spawn, x and z are randomised, y is range
|
-- Get pos to spawn, x and z are randomised, y is range
|
||||||
|
|
||||||
|
|
||||||
|
@ -948,9 +976,21 @@ if mobs_spawn then
|
||||||
return spawning_position
|
return spawning_position
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cumulative_chance = nil
|
||||||
|
local mob_library_worker_table = nil
|
||||||
|
local function initialize_spawn_data()
|
||||||
|
if not mob_library_worker_table then
|
||||||
|
mob_library_worker_table = table_copy(spawn_dictionary)
|
||||||
|
end
|
||||||
|
if not cumulative_chance then
|
||||||
|
cumulative_chance = 0
|
||||||
|
for k, v in pairs(mob_library_worker_table) do
|
||||||
|
cumulative_chance = cumulative_chance + v.chance
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function spawn_a_mob(pos, cap_space_hostile, cap_space_non_hostile)
|
local function spawn_a_mob(pos, cap_space_hostile, cap_space_non_hostile)
|
||||||
--create a disconnected clone of the spawn dictionary, prevents memory leak
|
|
||||||
local mob_library_worker_table = table_copy(spawn_dictionary)
|
|
||||||
|
|
||||||
local spawning_position = find_spawning_position(pos, FIND_SPAWN_POS_RETRIES)
|
local spawning_position = find_spawning_position(pos, FIND_SPAWN_POS_RETRIES)
|
||||||
if not spawning_position then
|
if not spawning_position then
|
||||||
|
@ -963,22 +1003,25 @@ if mobs_spawn then
|
||||||
--output_mob_stats(mob_counts_wide)
|
--output_mob_stats(mob_counts_wide)
|
||||||
|
|
||||||
--grab mob that fits into the spawning location
|
--grab mob that fits into the spawning location
|
||||||
--randomly grab a mob, don't exclude any possibilities
|
--use random weighted choice with replacement to grab a mob, don't exclude any possibilities
|
||||||
perlin_noise = perlin_noise or minetest_get_perlin(noise_params)
|
--shuffle table once every loop to provide equal inclusion probability to all mobs
|
||||||
local noise = perlin_noise:get_3d(spawning_position)
|
--repeat grabbing a mob to maintain existing spawn rates
|
||||||
local current_summary_chance = summary_chance
|
local spawn_loop_counter = #mob_library_worker_table
|
||||||
|
|
||||||
|
while spawn_loop_counter > 0 do
|
||||||
table.shuffle(mob_library_worker_table)
|
table.shuffle(mob_library_worker_table)
|
||||||
|
local mob_chance_offset = math_random(1, cumulative_chance)
|
||||||
while #mob_library_worker_table > 0 do
|
|
||||||
local mob_chance_offset = (math_round(noise * current_summary_chance + 12345) % current_summary_chance) + 1
|
|
||||||
local mob_index = 1
|
local mob_index = 1
|
||||||
local mob_chance = mob_library_worker_table[mob_index].chance
|
local mob_chance = mob_library_worker_table[mob_index].chance
|
||||||
local step_chance = mob_chance
|
local step_chance = mob_chance
|
||||||
while step_chance < mob_chance_offset do
|
while step_chance < mob_chance_offset do
|
||||||
mob_index = mob_index + 1
|
mob_index = mob_index + 1
|
||||||
|
if mob_index <= #mob_library_worker_table then
|
||||||
mob_chance = mob_library_worker_table[mob_index].chance
|
mob_chance = mob_library_worker_table[mob_index].chance
|
||||||
step_chance = step_chance + mob_chance
|
step_chance = step_chance + mob_chance
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--minetest.log(mob_def.name.." "..step_chance.. " "..mob_chance)
|
--minetest.log(mob_def.name.." "..step_chance.. " "..mob_chance)
|
||||||
|
|
||||||
|
@ -1063,8 +1106,7 @@ if mobs_spawn then
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
current_summary_chance = current_summary_chance - mob_chance
|
spawn_loop_counter = spawn_loop_counter - 1
|
||||||
table_remove(mob_library_worker_table, mob_index)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1076,6 +1118,7 @@ if mobs_spawn then
|
||||||
|
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
if timer < WAIT_FOR_SPAWN_ATTEMPT then return end
|
if timer < WAIT_FOR_SPAWN_ATTEMPT then return end
|
||||||
|
initialize_spawn_data()
|
||||||
timer = 0
|
timer = 0
|
||||||
|
|
||||||
local players = get_connected_players()
|
local players = get_connected_players()
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_paintings
|
||||||
|
Painting=Quadre
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_paintings
|
||||||
|
Painting=Pintura
|
|
@ -2,6 +2,9 @@ local dim = {"x", "z"}
|
||||||
|
|
||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||||
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
|
|
||||||
local function load_schem(filename)
|
local function load_schem(filename)
|
||||||
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
||||||
local data = minetest.deserialize(file:read())
|
local data = minetest.deserialize(file:read())
|
||||||
|
@ -9,6 +12,14 @@ local function load_schem(filename)
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local wboss_overworld = 0
|
||||||
|
local wboss_nether = 0
|
||||||
|
local wboss_end = 0
|
||||||
|
|
||||||
|
local LIM_OVERWORLD = tonumber(minetest.settings:get("wither_cap_overworld")) or 3
|
||||||
|
local LIM_NETHER = tonumber(minetest.settings:get("wither_cap_nether")) or 10
|
||||||
|
local LIM_END = tonumber(minetest.settings:get("wither_cap_end")) or 5
|
||||||
|
|
||||||
local wither_spawn_schems = {}
|
local wither_spawn_schems = {}
|
||||||
|
|
||||||
for _, d in pairs(dim) do
|
for _, d in pairs(dim) do
|
||||||
|
@ -16,8 +27,13 @@ for _, d in pairs(dim) do
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_schem(pos, schem)
|
local function check_schem(pos, schem)
|
||||||
|
local cn_name
|
||||||
for _, n in pairs(schem) do
|
for _, n in pairs(schem) do
|
||||||
if minetest.get_node(vector.add(pos, n)).name ~= n.name then
|
cn_name = minetest.get_node(vector.add(pos, n)).name
|
||||||
|
if string.find(cn_name, "mcl_heads:wither_skeleton") then
|
||||||
|
cn_name = "mcl_heads:wither_skeleton"
|
||||||
|
end
|
||||||
|
if cn_name ~= n.name then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,14 +46,32 @@ local function remove_schem(pos, schem)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wither_spawn(pos)
|
local function check_limit(pos)
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
|
if dim == "overworld" and wboss_overworld >= LIM_OVERWORLD then return false
|
||||||
|
elseif dim == "end" and wboss_end >= LIM_END then return false
|
||||||
|
elseif wboss_nether >= LIM_NETHER then return false
|
||||||
|
else return true end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function wither_spawn(pos, player)
|
||||||
|
if peaceful then return end
|
||||||
for _, d in pairs(dim) do
|
for _, d in pairs(dim) do
|
||||||
for i = 0, 2 do
|
for i = 0, 2 do
|
||||||
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
||||||
local schem = wither_spawn_schems[d]
|
local schem = wither_spawn_schems[d]
|
||||||
if check_schem(p, schem) then
|
if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then
|
||||||
remove_schem(p, schem)
|
remove_schem(p, schem)
|
||||||
minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
local wither = minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
||||||
|
if not wither then return end
|
||||||
|
local wither_ent = wither:get_luaentity()
|
||||||
|
wither_ent._spawner = player:get_player_name()
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
|
if dim == "overworld" then
|
||||||
|
wboss_overworld = wboss_overworld + 1
|
||||||
|
elseif dim == "end" then
|
||||||
|
wboss_end = wboss_end + 1
|
||||||
|
else wboss_nether = wboss_nether + 1 end
|
||||||
local objects = minetest.get_objects_inside_radius(pos, 20)
|
local objects = minetest.get_objects_inside_radius(pos, 20)
|
||||||
for _, players in ipairs(objects) do
|
for _, players in ipairs(objects) do
|
||||||
if players:is_player() then
|
if players:is_player() then
|
||||||
|
@ -54,7 +88,19 @@ local old_on_place = wither_head.on_place
|
||||||
function wither_head.on_place(itemstack, placer, pointed)
|
function wither_head.on_place(itemstack, placer, pointed)
|
||||||
local n = minetest.get_node(vector.offset(pointed.above,0,-1,0))
|
local n = minetest.get_node(vector.offset(pointed.above,0,-1,0))
|
||||||
if n and n.name == "mcl_nether:soul_sand" then
|
if n and n.name == "mcl_nether:soul_sand" then
|
||||||
minetest.after(0, wither_spawn, pointed.above)
|
minetest.after(0, wither_spawn, pointed.above, placer)
|
||||||
end
|
end
|
||||||
return old_on_place(itemstack, placer, pointed)
|
return old_on_place(itemstack, placer, pointed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if anti_troll then
|
||||||
|
-- pull wither counts per dimension
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
wboss_overworld = mobs_mc.wither_count_overworld
|
||||||
|
wboss_nether = mobs_mc.wither_count_nether
|
||||||
|
wboss_end = mobs_mc.wither_count_end
|
||||||
|
mobs_mc.wither_count_overworld = 0
|
||||||
|
mobs_mc.wither_count_nether = 0
|
||||||
|
mobs_mc.wither_count_end = 0
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
|
@ -305,6 +305,9 @@ Origin of those models:
|
||||||
* `mobs_mc_rabbit_random.*.ogg` (CC0)
|
* `mobs_mc_rabbit_random.*.ogg` (CC0)
|
||||||
* Changes were made.
|
* Changes were made.
|
||||||
* Source: <https://freesound.org/people/Alshred/>
|
* Source: <https://freesound.org/people/Alshred/>
|
||||||
|
* [epCode]
|
||||||
|
* `extra_mobs_hoglin*.ogg` (LGPL 3.0)
|
||||||
|
* Source: <https://git.minetest.land/epCode/extra_mobs/src/branch/master/sounds>
|
||||||
|
|
||||||
Note: Many of these sounds have been more or less modified to fit the game.
|
Note: Many of these sounds have been more or less modified to fit the game.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
local axolotl = {
|
local axolotl = {
|
||||||
|
description = S("Axolotl"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "axolotl",
|
spawn_class = "axolotl",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -13,7 +14,7 @@ local axolotl = {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = -1,
|
bone_eye_height = -1,
|
||||||
head_eye_height = -0.5,
|
head_eye_height = -0.5,
|
||||||
horrizonatal_head_height = 0,
|
horizontal_head_height = 0,
|
||||||
curiosity = 10,
|
curiosity = 10,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
|
|
||||||
|
@ -78,7 +79,6 @@ local axolotl = {
|
||||||
attack_animals = true,
|
attack_animals = true,
|
||||||
specific_attack = {
|
specific_attack = {
|
||||||
"extra_mobs_cod",
|
"extra_mobs_cod",
|
||||||
"mobs_mc:sheep",
|
|
||||||
"extra_mobs_glow_squid",
|
"extra_mobs_glow_squid",
|
||||||
"extra_mobs_salmon",
|
"extra_mobs_salmon",
|
||||||
"extra_mobs_tropical_fish",
|
"extra_mobs_tropical_fish",
|
||||||
|
@ -172,7 +172,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
4000,
|
100,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -2,6 +2,18 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
local function spawn_check(pos, environmental_light, artificial_light, sky_light)
|
||||||
|
local date = os.date("*t")
|
||||||
|
local maxlight
|
||||||
|
if (date.month == 10 and date.day >= 20) or (date.month == 11 and date.day <= 3) then
|
||||||
|
maxlight = 6
|
||||||
|
else
|
||||||
|
maxlight = 3
|
||||||
|
end
|
||||||
|
|
||||||
|
return artificial_light <= maxlight
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:bat", {
|
mcl_mobs.register_mob("mobs_mc:bat", {
|
||||||
description = S("Bat"),
|
description = S("Bat"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
|
@ -50,6 +62,7 @@ mcl_mobs.register_mob("mobs_mc:bat", {
|
||||||
jump = false,
|
jump = false,
|
||||||
fly = true,
|
fly = true,
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
|
spawn_check = spawn_check,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +150,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
maxlight,
|
maxlight,
|
||||||
20,
|
20,
|
||||||
5000,
|
100,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mobs_mc.water_level-1)
|
mobs_mc.water_level-1)
|
||||||
|
|
|
@ -11,6 +11,9 @@ local mod_target = minetest.get_modpath("mcl_target")
|
||||||
--################### BLAZE
|
--################### BLAZE
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
local function spawn_check(pos, environmental_light, artificial_light, sky_light)
|
||||||
|
return artificial_light <= 11
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:blaze", {
|
mcl_mobs.register_mob("mobs_mc:blaze", {
|
||||||
description = S("Blaze"),
|
description = S("Blaze"),
|
||||||
|
@ -137,6 +140,7 @@ mcl_mobs.register_mob("mobs_mc:blaze", {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
spawn_check = spawn_check,
|
||||||
})
|
})
|
||||||
|
|
||||||
mcl_mobs:spawn_specific(
|
mcl_mobs:spawn_specific(
|
||||||
|
@ -147,7 +151,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
5000,
|
1000,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
|
|
@ -23,7 +23,7 @@ mcl_mobs.register_mob("mobs_mc:chicken", {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 4,
|
bone_eye_height = 4,
|
||||||
head_eye_height = 1.5,
|
head_eye_height = 1.5,
|
||||||
horrizonatal_head_height = -.3,
|
horizontal_head_height = -.3,
|
||||||
curiosity = 10,
|
curiosity = 10,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
visual_size = {x=1,y=1},
|
visual_size = {x=1,y=1},
|
||||||
|
@ -157,7 +157,7 @@ mcl_mobs:spawn_specific(
|
||||||
},
|
},
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30, 17000,
|
30, 100,
|
||||||
3,
|
3,
|
||||||
mobs_mc.water_level,
|
mobs_mc.water_level,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -30,6 +30,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local cod = {
|
local cod = {
|
||||||
|
description = S("Cod"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water_ambient",
|
spawn_class = "water_ambient",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -266,7 +267,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
4000,
|
750,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -24,7 +24,7 @@ local cow_def = {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 10,
|
bone_eye_height = 10,
|
||||||
head_eye_height = 1.1,
|
head_eye_height = 1.1,
|
||||||
horrizonatal_head_height=-1.8,
|
horizontal_head_height=-1.8,
|
||||||
curiosity = 2,
|
curiosity = 2,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
@ -207,7 +207,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
17000,
|
80,
|
||||||
10,
|
10,
|
||||||
mobs_mc.water_level,
|
mobs_mc.water_level,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -225,7 +225,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
17000,
|
80,
|
||||||
5,
|
5,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -50,7 +50,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
||||||
explosion_strength = 3,
|
explosion_strength = 3,
|
||||||
explosion_radius = 3.5,
|
explosion_radius = 3.5,
|
||||||
explosion_damage_radius = 3.5,
|
explosion_damage_radius = 3.5,
|
||||||
explosiontimer_reset_radius = 6,
|
explosiontimer_reset_radius = 3,
|
||||||
reach = 3,
|
reach = 3,
|
||||||
explosion_timer = 1.5,
|
explosion_timer = 1.5,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
|
@ -136,7 +136,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
|
||||||
})
|
})
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
description = S("Creeper"),
|
description = S("Charged Creeper"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
hp_min = 20,
|
hp_min = 20,
|
||||||
|
@ -172,7 +172,7 @@ mcl_mobs.register_mob("mobs_mc:creeper_charged", {
|
||||||
explosion_strength = 6,
|
explosion_strength = 6,
|
||||||
explosion_radius = 8,
|
explosion_radius = 8,
|
||||||
explosion_damage_radius = 8,
|
explosion_damage_radius = 8,
|
||||||
explosiontimer_reset_radius = 6,
|
explosiontimer_reset_radius = 3,
|
||||||
reach = 3,
|
reach = 3,
|
||||||
explosion_timer = 1.5,
|
explosion_timer = 1.5,
|
||||||
allow_fuse_reset = true,
|
allow_fuse_reset = true,
|
||||||
|
@ -407,7 +407,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
20,
|
20,
|
||||||
16500,
|
1000,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -30,6 +30,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local dolphin = {
|
local dolphin = {
|
||||||
|
description = S("Dolphin"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water",
|
spawn_class = "water",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -244,7 +245,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
4000,
|
70,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -136,6 +136,7 @@ mcl_mobs.register_mob("mobs_mc:enderdragon", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
|
is_boss = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
3000,
|
100,
|
||||||
12,
|
12,
|
||||||
mcl_vars.mg_end_min,
|
mcl_vars.mg_end_min,
|
||||||
mcl_vars.mg_end_max)
|
mcl_vars.mg_end_max)
|
||||||
|
@ -816,7 +816,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
19000,
|
100,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -833,7 +833,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
11,
|
11,
|
||||||
30,
|
30,
|
||||||
27500,
|
100,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -849,7 +849,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
11,
|
11,
|
||||||
30,
|
30,
|
||||||
5000,
|
100,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
|
|
@ -20,7 +20,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||||
hp_max = 10,
|
hp_max = 10,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
xp_max = 5,
|
xp_max = 5,
|
||||||
collisionbox = {-2, 5, -2, 2, 9, 2},
|
collisionbox = {-2, 0, -2, 2, 4, 2, rotate=true},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_ghast.b3d",
|
mesh = "mobs_mc_ghast.b3d",
|
||||||
spawn_in_group = 1,
|
spawn_in_group = 1,
|
||||||
|
@ -33,7 +33,7 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||||
death = "mobs_mc_zombie_death",
|
death = "mobs_mc_zombie_death",
|
||||||
attack = "mobs_fireball",
|
attack = "mobs_fireball",
|
||||||
random = "mobs_eerie",
|
random = "mobs_eerie",
|
||||||
distance = 16,
|
distance = 80,
|
||||||
-- TODO: damage
|
-- TODO: damage
|
||||||
-- TODO: better death
|
-- TODO: better death
|
||||||
},
|
},
|
||||||
|
@ -50,11 +50,11 @@ mcl_mobs.register_mob("mobs_mc:ghast", {
|
||||||
run_start = 0, run_end = 40,
|
run_start = 0, run_end = 40,
|
||||||
},
|
},
|
||||||
fall_damage = 0,
|
fall_damage = 0,
|
||||||
view_range = 100,
|
view_range = 64,
|
||||||
attack_type = "dogshoot",
|
attack_type = "dogshoot",
|
||||||
arrow = "mobs_mc:fireball",
|
arrow = "mobs_mc:fireball",
|
||||||
shoot_interval = 3.5,
|
shoot_interval = 5,
|
||||||
shoot_offset = -5,
|
shoot_offset = -0.5,
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1,
|
||||||
dogshoot_count_max =1,
|
dogshoot_count_max =1,
|
||||||
passive = false,
|
passive = false,
|
||||||
|
@ -97,7 +97,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
72000,
|
400,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -107,8 +107,9 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 1, y = 1},
|
visual_size = {x = 1, y = 1},
|
||||||
textures = {"mcl_fire_fire_charge.png"},
|
textures = {"mcl_fire_fire_charge.png"},
|
||||||
velocity = 15,
|
velocity = 5,
|
||||||
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
||||||
|
_lifetime = 10,
|
||||||
_is_fireball = true,
|
_is_fireball = true,
|
||||||
|
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
|
@ -125,11 +126,16 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
hit_mob = function(self, mob)
|
||||||
|
local name = mob:get_luaentity().name
|
||||||
mob:punch(self.object, 1.0, {
|
mob:punch(self.object, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 6},
|
damage_groups = {fleshy = 6},
|
||||||
}, nil)
|
}, nil)
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
|
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
|
||||||
|
local ent = mob:get_luaentity()
|
||||||
|
if (not ent or ent.health <= 0) and self._puncher and name == "mobs_mc:ghast" then
|
||||||
|
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
|
|
|
@ -30,6 +30,7 @@ for i=1,4 do
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:glow_squid", {
|
mcl_mobs.register_mob("mobs_mc:glow_squid", {
|
||||||
|
description = S("Glow Squid"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water_underground",
|
spawn_class = "water_underground",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -237,7 +238,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX + 1,
|
minetest.LIGHT_MAX + 1,
|
||||||
30,
|
30,
|
||||||
10000,
|
100,
|
||||||
3,
|
3,
|
||||||
water - 16,
|
water - 16,
|
||||||
water)
|
water)
|
||||||
|
|
|
@ -31,8 +31,9 @@ local hoglin = {
|
||||||
} },
|
} },
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "extra_mobs_hoglin",
|
random = "extra_mobs_hoglin.1",
|
||||||
damage = "extra_mobs_hoglin_hurt",
|
damage = "extra_mobs_hoglin_hurt",
|
||||||
|
death = "extra_mobs_hoglin_hurt",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
|
@ -92,6 +93,12 @@ local zoglin = table.copy(hoglin)
|
||||||
zoglin.description = S("Zoglin")
|
zoglin.description = S("Zoglin")
|
||||||
zoglin.fire_resistant = 1
|
zoglin.fire_resistant = 1
|
||||||
zoglin.textures = {"extra_mobs_zoglin.png"}
|
zoglin.textures = {"extra_mobs_zoglin.png"}
|
||||||
|
sounds = {
|
||||||
|
random = "extra_mobs_hoglin.2",
|
||||||
|
damage = "extra_mobs_hoglin_hurt",
|
||||||
|
death = "extra_mobs_hoglin_hurt",
|
||||||
|
distance = 16,
|
||||||
|
}
|
||||||
zoglin.do_custom = function()
|
zoglin.do_custom = function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -129,7 +136,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
6000,
|
200,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
|
|
@ -44,18 +44,6 @@ local function get_drops(self)
|
||||||
max = 2,
|
max = 2,
|
||||||
looting = "common",
|
looting = "common",
|
||||||
})
|
})
|
||||||
if self._saddle then
|
|
||||||
table.insert(self.drops,{name = "mcl_mobitems:saddle",
|
|
||||||
chance = 1,
|
|
||||||
min = 1,
|
|
||||||
max = 1,})
|
|
||||||
end
|
|
||||||
if self._chest then
|
|
||||||
table.insert(self.drops,{name = "mcl_chests:chest",
|
|
||||||
chance = 1,
|
|
||||||
min = 1,
|
|
||||||
max = 1,})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Helper functions to determine equipment rules
|
-- Helper functions to determine equipment rules
|
||||||
|
@ -134,10 +122,10 @@ local horse = {
|
||||||
stand_speed = 25,
|
stand_speed = 25,
|
||||||
stand_start = 0,
|
stand_start = 0,
|
||||||
stand_end = 0,
|
stand_end = 0,
|
||||||
walk_speed = 25,
|
walk_speed = 100,
|
||||||
walk_start = 0,
|
walk_start = 0,
|
||||||
walk_end = 40,
|
walk_end = 40,
|
||||||
run_speed = 60,
|
run_speed = 200,
|
||||||
run_start = 0,
|
run_start = 0,
|
||||||
run_end = 40,
|
run_end = 40,
|
||||||
},
|
},
|
||||||
|
@ -245,10 +233,18 @@ local horse = {
|
||||||
|
|
||||||
on_die = function(self, pos)
|
on_die = function(self, pos)
|
||||||
|
|
||||||
-- drop saddle when horse is killed while riding
|
-- drop saddle when horse is killed
|
||||||
if self._saddle then
|
if self._saddle then
|
||||||
minetest.add_item(pos, "mcl_mobitems:saddle")
|
minetest.add_item(pos, "mcl_mobitems:saddle")
|
||||||
end
|
end
|
||||||
|
-- drop chest when mule/donkey is killed
|
||||||
|
if self._chest then
|
||||||
|
minetest.add_item(pos, "mcl_chests:chest")
|
||||||
|
end
|
||||||
|
-- drop armor when horse is killed
|
||||||
|
if self._wearing_armor then
|
||||||
|
minetest.add_item(pos, self._horse_armor)
|
||||||
|
end
|
||||||
-- also detach from horse properly
|
-- also detach from horse properly
|
||||||
if self.driver then
|
if self.driver then
|
||||||
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
mcl_mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
|
@ -401,6 +397,7 @@ local horse = {
|
||||||
-- Put on armor and take armor from player's inventory
|
-- Put on armor and take armor from player's inventory
|
||||||
local armor = minetest.get_item_group(iname, "horse_armor")
|
local armor = minetest.get_item_group(iname, "horse_armor")
|
||||||
self._horse_armor = iname
|
self._horse_armor = iname
|
||||||
|
self._wearing_armor = true
|
||||||
local w = clicker:get_wielded_item()
|
local w = clicker:get_wielded_item()
|
||||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||||
w:take_item()
|
w:take_item()
|
||||||
|
@ -546,11 +543,6 @@ donkey.description = S("Donkey")
|
||||||
donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}}
|
donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}}
|
||||||
donkey.spawn_in_group = 3
|
donkey.spawn_in_group = 3
|
||||||
donkey.spawn_in_group_min = 1
|
donkey.spawn_in_group_min = 1
|
||||||
donkey.animation = {
|
|
||||||
speed_normal = 25,
|
|
||||||
stand_start = 0, stand_end = 0,
|
|
||||||
walk_start = 0, walk_end = 40,
|
|
||||||
}
|
|
||||||
donkey.sounds = {
|
donkey.sounds = {
|
||||||
random = "mobs_mc_donkey_random",
|
random = "mobs_mc_donkey_random",
|
||||||
damage = "mobs_mc_donkey_hurt",
|
damage = "mobs_mc_donkey_hurt",
|
||||||
|
@ -612,7 +604,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
40,
|
||||||
4,
|
4,
|
||||||
mobs_mc.water_level+3,
|
mobs_mc.water_level+3,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -635,7 +627,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
10,
|
||||||
4,
|
4,
|
||||||
mobs_mc.water_level+3,
|
mobs_mc.water_level+3,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
--License for code WTFPL and otherwise stated in readmes
|
--License for code WTFPL and otherwise stated in readmes
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
local allow_nav_hacks = minetest.settings:get_bool("mcl_mob_allow_nav_hacks ",false)
|
||||||
|
|
||||||
--###################
|
--###################
|
||||||
--################### IRON GOLEM
|
--################### IRON GOLEM
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local etime = 0
|
local walk_dist = 40
|
||||||
|
local tele_dist = 80
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
||||||
description = S("Iron Golem"),
|
description = S("Iron Golem"),
|
||||||
|
@ -85,11 +87,23 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
|
||||||
punch_start = 40, punch_end = 50,
|
punch_start = 40, punch_end = 50,
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
on_step = function(self,dtime)
|
do_custom = function(self, dtime)
|
||||||
etime = etime + dtime
|
self.home_timer = (self.home_timer or 0) + dtime
|
||||||
if etime > 10 then
|
|
||||||
if self._home and vector.distance(self._home,self.object:get_pos()) > 50 then
|
if self.home_timer > 10 then
|
||||||
self:gopath(self._home)
|
self.home_timer = 0
|
||||||
|
if self._home and self.state ~= "attack" then
|
||||||
|
local dist = vector.distance(self._home,self.object:get_pos())
|
||||||
|
if allow_nav_hacks and dist >= tele_dist then
|
||||||
|
self.object:set_pos(self._home)
|
||||||
|
self.state = "stand"
|
||||||
|
self.order = "follow"
|
||||||
|
elseif dist >= walk_dist then
|
||||||
|
self:gopath(self._home, function(self)
|
||||||
|
self.state = "stand"
|
||||||
|
self.order = "follow"
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -62,7 +62,7 @@ mcl_mobs.register_mob("mobs_mc:llama", {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 11,
|
bone_eye_height = 11,
|
||||||
head_eye_height = 3,
|
head_eye_height = 3,
|
||||||
horrizonatal_head_height=0,
|
horizontal_head_height=0,
|
||||||
curiosity = 60,
|
curiosity = 60,
|
||||||
head_yaw = "z",
|
head_yaw = "z",
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
50,
|
||||||
5,
|
5,
|
||||||
mobs_mc.water_level+15,
|
mobs_mc.water_level+15,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -21,6 +21,7 @@ Mule=Mule
|
||||||
Iron Golem=Golem de fer
|
Iron Golem=Golem de fer
|
||||||
Llama=Lama
|
Llama=Lama
|
||||||
Ocelot=Ocelot
|
Ocelot=Ocelot
|
||||||
|
Cat=Chat
|
||||||
Parrot=Perroquet
|
Parrot=Perroquet
|
||||||
Pig=Cochon
|
Pig=Cochon
|
||||||
Polar Bear=Ours blanc
|
Polar Bear=Ours blanc
|
||||||
|
@ -48,8 +49,15 @@ Witch=Sorcière
|
||||||
Wither=Wither
|
Wither=Wither
|
||||||
Wolf=Loup
|
Wolf=Loup
|
||||||
Husk=Zombie Momifié
|
Husk=Zombie Momifié
|
||||||
|
Baby Husk=Bébé Zombie Momifié
|
||||||
Zombie=Zombie
|
Zombie=Zombie
|
||||||
Zombie Piglin=Zombie Cochon
|
Baby Zombie=Bébé Zombie
|
||||||
|
Piglin=Piglin
|
||||||
|
Baby Piglin=Bébé Piglin
|
||||||
|
Zombie Piglin=Piglin Zombie
|
||||||
|
Baby Zombie Piglin=Bébé Piglin Zombie
|
||||||
|
Sword Piglin=Piglin avec une épée
|
||||||
|
Piglin Brute=Piglin Barbare
|
||||||
Farmer=Fermier
|
Farmer=Fermier
|
||||||
Fisherman=Pêcheur
|
Fisherman=Pêcheur
|
||||||
Fletcher=Archer
|
Fletcher=Archer
|
||||||
|
@ -69,5 +77,7 @@ Dolphin=Dauphin
|
||||||
Pillager=Pilleur
|
Pillager=Pilleur
|
||||||
Tropical fish=Poisson tropical
|
Tropical fish=Poisson tropical
|
||||||
Hoglin=Hoglin
|
Hoglin=Hoglin
|
||||||
|
Baby hoglin=Bébé Hoglin
|
||||||
|
Zoglin=Zoglin
|
||||||
Strider=Arpenteur
|
Strider=Arpenteur
|
||||||
Glow Squid=Poulpe Brillant
|
Glow Squid=Poulpe Brillant
|
|
@ -0,0 +1,73 @@
|
||||||
|
# textdomain: mobs_mc
|
||||||
|
Agent=Agent
|
||||||
|
Axolotl=Axolòtl
|
||||||
|
Bat=Ratapenada
|
||||||
|
Blaze=Flamor
|
||||||
|
Chicken=Polet
|
||||||
|
Cow=Vacha
|
||||||
|
Mooshroom=Vachairòla
|
||||||
|
Creeper=Creeper
|
||||||
|
Ender Dragon=Dragon de Finuèit
|
||||||
|
Enderman=Finuèairi
|
||||||
|
Endermite=Finuèibau
|
||||||
|
Ghast=Òrra
|
||||||
|
Elder Guardian=Ancian Gardian
|
||||||
|
Guardian=Gardian
|
||||||
|
Horse=Ega
|
||||||
|
Skeleton Horse=Ega Squeleta
|
||||||
|
Zombie Horse=Ega Zombia
|
||||||
|
Donkey=Asne
|
||||||
|
Mule=Miule
|
||||||
|
Iron Golem=Golem de Fèrre
|
||||||
|
Llama=Lamà
|
||||||
|
Ocelot=Ocelòt
|
||||||
|
Parrot=Papagai
|
||||||
|
Pig=Cochon
|
||||||
|
Polar Bear=Ors Blanc
|
||||||
|
Rabbit=Lapin
|
||||||
|
Killer Bunny=Lapin Tuaire
|
||||||
|
Sheep=Moton
|
||||||
|
Shulker=Coirafin
|
||||||
|
Silverfish=Peiçon d'Argent
|
||||||
|
Skeleton=Squeleta
|
||||||
|
Stray=Trainabiaça
|
||||||
|
Wither Skeleton=Squeleta Sechaire
|
||||||
|
Magma Cube=Cube de Magmà
|
||||||
|
Slime=Slime
|
||||||
|
Snow Golem=Golem d'Ivèrn
|
||||||
|
Spider=Aranha
|
||||||
|
Cave Spider=Aranha Venimósa
|
||||||
|
Squid=Pofre
|
||||||
|
Vex=Vex
|
||||||
|
Evoker=Invocataire
|
||||||
|
Illusioner=Fisiciaire
|
||||||
|
Villager=Vialatgés
|
||||||
|
Vindicator=Vindicataire
|
||||||
|
Zombie Villager=Vialatgés Zombia
|
||||||
|
Witch=Fachinèira
|
||||||
|
Wither=Le Sechaire
|
||||||
|
Wolf=Lop
|
||||||
|
Husk=Zombia Momificat
|
||||||
|
Zombie=Zombia
|
||||||
|
Zombie Piglin=Porcadés Zombia
|
||||||
|
Farmer=Boriaire
|
||||||
|
Fisherman=Peschaire
|
||||||
|
Fletcher=Archèir
|
||||||
|
Shepherd=Bergèir
|
||||||
|
Librarian=Bibliotecaire
|
||||||
|
Cartographer=Cartografe
|
||||||
|
Armorer=Armurèir
|
||||||
|
Leatherworker=Tanaire
|
||||||
|
Butcher=Maselèir
|
||||||
|
Weapon Smith=Farjaire d'Armas
|
||||||
|
Tool Smith=Farjaire d'Otilhs
|
||||||
|
Cleric=Clerc
|
||||||
|
Nitwit=Simple
|
||||||
|
Cod=Merluça
|
||||||
|
Salmon=Saumon
|
||||||
|
Dolphin=Daufin
|
||||||
|
Pillager=Pilhard
|
||||||
|
Tropical fish=Peiçon tropicau
|
||||||
|
Hoglin=Porcard
|
||||||
|
Strider=Trèva
|
||||||
|
Glow Squid=Pofre Lusent
|
|
@ -0,0 +1,83 @@
|
||||||
|
# textdomain: mobs_mc
|
||||||
|
Agent=Agente
|
||||||
|
Axolotl=Axolote
|
||||||
|
Bat=Morcego
|
||||||
|
Blaze=Blaze
|
||||||
|
Chicken=Galinha
|
||||||
|
Cow=Vaca
|
||||||
|
Mooshroom=Coguvaca
|
||||||
|
Creeper=Creeper
|
||||||
|
Ender Dragon=Dragão do Fim
|
||||||
|
Enderman=Enderman
|
||||||
|
Endermite=Endermite
|
||||||
|
Ghast=Ghast
|
||||||
|
Elder Guardian=Guardião Ancião
|
||||||
|
Guardian=Guardião
|
||||||
|
Horse=Cavalo
|
||||||
|
Skeleton Horse=Cavalo Esqueleto
|
||||||
|
Zombie Horse=Cavalo Zumbi
|
||||||
|
Donkey=Burro
|
||||||
|
Mule=Mula
|
||||||
|
Iron Golem=Golem de Ferro
|
||||||
|
Llama=Lhama
|
||||||
|
Ocelot=Jaguatirica
|
||||||
|
Cat=Gato
|
||||||
|
Parrot=Papagaio
|
||||||
|
Pig=Porco
|
||||||
|
Polar Bear=Urso Polar
|
||||||
|
Rabbit=Coelho
|
||||||
|
Killer Bunny=Coelho Assassino
|
||||||
|
Sheep=Ovelha
|
||||||
|
Shulker=Shulker
|
||||||
|
Silverfish=Traça
|
||||||
|
Skeleton=Esqueleto
|
||||||
|
Stray=Esqueleto Errante
|
||||||
|
Wither Skeleton=Esqueleto Wither
|
||||||
|
Magma Cube=Cubo de Magma
|
||||||
|
Slime=Slime
|
||||||
|
Snow Golem=Golem de Neve
|
||||||
|
Spider=Aranha
|
||||||
|
Cave Spider=Aranha de Caverna
|
||||||
|
Squid=Lula
|
||||||
|
Vex=Vex
|
||||||
|
Evoker=Invocador
|
||||||
|
Illusioner=Ilusionista
|
||||||
|
Villager=Aldeão
|
||||||
|
Vindicator=Vingador
|
||||||
|
Zombie Villager=Aldeão Zumbi
|
||||||
|
Witch=Bruxa
|
||||||
|
Wither=Wither
|
||||||
|
Wolf=Lobo
|
||||||
|
Husk=Zumbi-Múmia
|
||||||
|
Baby Husk=Zumbi-Múmia Bebê
|
||||||
|
Zombie=Zumbi
|
||||||
|
Baby Zombie=Zumbi Bebê
|
||||||
|
Piglin=Piglin
|
||||||
|
Baby Piglin=Piglin Bebê
|
||||||
|
Zombie Piglin=Piglin Zumbi
|
||||||
|
Baby Zombie Piglin=Piglin Zumbi Bebê
|
||||||
|
Sword Piglin=Piglin Espadachim
|
||||||
|
Piglin Brute=Piglin Barbáro
|
||||||
|
Farmer=Fazendeiro
|
||||||
|
Fisherman=Pescador
|
||||||
|
Fletcher=Flecheiro
|
||||||
|
Shepherd=Pastor
|
||||||
|
Librarian=Bibliotecário
|
||||||
|
Cartographer=Cartógrafo
|
||||||
|
Armorer=Armoreiro
|
||||||
|
Leatherworker=Coureiro
|
||||||
|
Butcher=Açougueiro
|
||||||
|
Weapon Smith=Armeiro
|
||||||
|
Tool Smith=Ferramenteiro
|
||||||
|
Cleric=Clérigo
|
||||||
|
Nitwit=Palerma
|
||||||
|
Cod=Bacalhau
|
||||||
|
Salmon=Salmão
|
||||||
|
Dolphin=Golfinho
|
||||||
|
Pillager=Saqueador
|
||||||
|
Tropical fish=Peixe Tropical
|
||||||
|
Hoglin=Hoglin
|
||||||
|
Baby hoglin=Hoglin Bebê
|
||||||
|
Zoglin=Zoglin
|
||||||
|
Strider=Lavagante
|
||||||
|
Glow Squid=Lula Brilhante
|
|
@ -2,4 +2,4 @@ name = mobs_mc
|
||||||
author = maikerumine
|
author = maikerumine
|
||||||
description = Adds Minecraft-like monsters and animals.
|
description = Adds Minecraft-like monsters and animals.
|
||||||
depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util
|
depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_core, mcl_util
|
||||||
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items
|
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, doc_items, mcl_worlds
|
||||||
|
|
Binary file not shown.
|
@ -39,7 +39,7 @@ local ocelot = {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 6.2,
|
bone_eye_height = 6.2,
|
||||||
head_eye_height = 0.4,
|
head_eye_height = 0.4,
|
||||||
horrizonatal_head_height=-0,
|
horizontal_head_height=-0,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
curiosity = 4,
|
curiosity = 4,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.69, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.69, 0.3},
|
||||||
|
@ -186,7 +186,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
300,
|
||||||
5,
|
5,
|
||||||
mobs_mc.water_level+15,
|
mobs_mc.water_level+15,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -137,7 +137,7 @@ mcl_mobs.register_mob("mobs_mc:parrot", {
|
||||||
xp_max = 3,
|
xp_max = 3,
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 1.1,
|
bone_eye_height = 1.1,
|
||||||
horrizonatal_head_height=0,
|
horizontal_head_height=0,
|
||||||
curiosity = 10,
|
curiosity = 10,
|
||||||
collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.89, 0.25},
|
collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.89, 0.25},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -235,7 +235,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
7,
|
7,
|
||||||
30000,
|
400,
|
||||||
1,
|
1,
|
||||||
mobs_mc.water_level+7,
|
mobs_mc.water_level+7,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -22,7 +22,7 @@ mcl_mobs.register_mob("mobs_mc:pig", {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 7.5,
|
bone_eye_height = 7.5,
|
||||||
head_eye_height = 0.8,
|
head_eye_height = 0.8,
|
||||||
horrizonatal_head_height=-1,
|
horizontal_head_height=-1,
|
||||||
curiosity = 3,
|
curiosity = 3,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
@ -258,7 +258,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
100,
|
||||||
8,
|
8,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -16,6 +16,13 @@ local trading_items = {
|
||||||
{ itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 },
|
{ itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 },
|
||||||
{ itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 },
|
{ itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 },
|
||||||
{ itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 },
|
{ itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 },
|
||||||
|
{ itemstring = "mcl_enchanting:book_enchanted", amount_min = 1, amount_max = 1 },
|
||||||
|
{ itemstring = "mcl_armor:boots_iron_enchanted", amount_min = 1, amount_max = 1 },
|
||||||
|
{ itemstring = "mcl_blackstone:blackstone", amount_min = 8, amount_max = 16 },
|
||||||
|
{ itemstring = "mcl_bows:arrow", amount_min = 6, amount_max = 12 },
|
||||||
|
{ itemstring = "mcl_core:crying_obsidian", amount_min = 1, amount_max = 1 },
|
||||||
|
{ itemstring = "mcl_fire:fire_charge", amount_min = 1, amount_max = 1 },
|
||||||
|
--{ itemstring = "FIXME:spectral_arrow", amount_min = 6, amount_max = 12 },
|
||||||
}
|
}
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
@ -61,8 +68,10 @@ local piglin = {
|
||||||
} },
|
} },
|
||||||
visual_size = {x=1, y=1},
|
visual_size = {x=1, y=1},
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "extra_mobs_piglin",
|
random = "mobs_mc_zombiepig_random",
|
||||||
damage = "extra_mobs_piglin_hurt",
|
war_cry = "mobs_mc_zombiepig_war_cry", death = "mobs_mc_zombiepig_death",
|
||||||
|
damage = "mobs_mc_zombiepig_hurt.2",
|
||||||
|
death = "mobs_mc_zombiepig_death.2",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
|
@ -140,14 +149,18 @@ local piglin = {
|
||||||
local c_pos = self.object:get_pos()
|
local c_pos = self.object:get_pos()
|
||||||
if c_pos then
|
if c_pos then
|
||||||
self.what_traded = trading_items[math.random(#trading_items)]
|
self.what_traded = trading_items[math.random(#trading_items)]
|
||||||
for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
|
local stack = ItemStack(self.what_traded.itemstring)
|
||||||
|
stack:set_count(math.random(self.what_traded.amount_min, self.what_traded.amount_max))
|
||||||
|
if mcl_enchanting.is_enchanted(self.what_traded.itemstring) then
|
||||||
|
local enchantment = "soul_speed"
|
||||||
|
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level))
|
||||||
|
end
|
||||||
local p = c_pos
|
local p = c_pos
|
||||||
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
|
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
|
||||||
if nn and #nn > 0 then
|
if nn and #nn > 0 then
|
||||||
p = vector.offset(nn[math.random(#nn)],0,1,0)
|
p = vector.offset(nn[math.random(#nn)],0,1,0)
|
||||||
end
|
end
|
||||||
minetest.add_item(p, self.what_traded.itemstring)
|
minetest.add_item(p, stack)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -219,6 +232,10 @@ mcl_mobs.register_mob("mobs_mc:sword_piglin", sword_piglin)
|
||||||
-- Zombified Piglin --
|
-- Zombified Piglin --
|
||||||
|
|
||||||
|
|
||||||
|
local function spawn_check(pos, environmental_light, artificial_light, sky_light)
|
||||||
|
return artificial_light <= 11
|
||||||
|
end
|
||||||
|
|
||||||
local zombified_piglin = {
|
local zombified_piglin = {
|
||||||
description = S("Zombie Piglin"),
|
description = S("Zombie Piglin"),
|
||||||
-- type="animal", passive=false: This combination is needed for a neutral mob which becomes hostile, if attacked
|
-- type="animal", passive=false: This combination is needed for a neutral mob which becomes hostile, if attacked
|
||||||
|
@ -256,6 +273,7 @@ local zombified_piglin = {
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
spawn_check = spawn_check,
|
||||||
walk_velocity = .8,
|
walk_velocity = .8,
|
||||||
run_velocity = 2.6,
|
run_velocity = 2.6,
|
||||||
pathfinding = 1,
|
pathfinding = 1,
|
||||||
|
@ -325,8 +343,13 @@ mcl_mobs.register_mob("mobs_mc:baby_zombified_piglin", baby_zombified_piglin)
|
||||||
|
|
||||||
-- Compatibility code. These were removed, and now are called zombie piglins. They don't spawn.
|
-- Compatibility code. These were removed, and now are called zombie piglins. They don't spawn.
|
||||||
-- This is only to catch old cases. Maybe could be an alias?
|
-- This is only to catch old cases. Maybe could be an alias?
|
||||||
mcl_mobs.register_mob("mobs_mc:pigman", zombified_piglin)
|
local pigman_unused = table.copy(zombified_piglin)
|
||||||
mcl_mobs.register_mob("mobs_mc:baby_pigman", baby_zombified_piglin)
|
pigman_unused.unused = true
|
||||||
|
local baby_pigman_unused = table.copy(baby_zombified_piglin)
|
||||||
|
baby_pigman_unused.unused = true
|
||||||
|
|
||||||
|
mcl_mobs.register_mob("mobs_mc:pigman", pigman_unused)
|
||||||
|
mcl_mobs.register_mob("mobs_mc:baby_pigman", baby_pigman_unused)
|
||||||
|
|
||||||
|
|
||||||
-- Piglin Brute --
|
-- Piglin Brute --
|
||||||
|
@ -392,7 +415,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
6000,
|
150,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_lava_nether_max,
|
mcl_vars.mg_lava_nether_max,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -408,7 +431,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
6000,
|
150,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_lava_nether_max,
|
mcl_vars.mg_lava_nether_max,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -424,7 +447,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
6000,
|
1000,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -441,7 +464,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
100000,
|
50,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
|
|
@ -27,7 +27,7 @@ mcl_mobs.register_mob("mobs_mc:polar_bear", {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 2.6,
|
bone_eye_height = 2.6,
|
||||||
head_eye_height = 1,
|
head_eye_height = 1,
|
||||||
horrizonatal_head_height = 0,
|
horizontal_head_height = 0,
|
||||||
curiosity = 20,
|
curiosity = 20,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
visual_size = {x=3.0, y=3.0},
|
visual_size = {x=3.0, y=3.0},
|
||||||
|
@ -86,7 +86,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
7000,
|
50,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -18,7 +18,7 @@ local rabbit = {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 2,
|
bone_eye_height = 2,
|
||||||
head_eye_height = 0.5,
|
head_eye_height = 0.5,
|
||||||
horrizonatal_head_height = -.3,
|
horizontal_head_height = -.3,
|
||||||
curiosity = 20,
|
curiosity = 20,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -148,7 +148,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
40,
|
||||||
8,
|
8,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -10,6 +10,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local salmon = {
|
local salmon = {
|
||||||
|
description = S("Salmon"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water_ambient",
|
spawn_class = "water_ambient",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -220,7 +221,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
4000,
|
260,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -67,7 +67,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 3.3,
|
bone_eye_height = 3.3,
|
||||||
head_eye_height = 1.1,
|
head_eye_height = 1.1,
|
||||||
horrizonatal_head_height=-.7,
|
horizontal_head_height=-.7,
|
||||||
curiosity = 6,
|
curiosity = 6,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -111,7 +111,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
|
||||||
run_start = 81, run_end = 121, run_speed = 60,
|
run_start = 81, run_end = 121, run_speed = 60,
|
||||||
eat_start = 121, eat_start = 161, eat_loop = false,
|
eat_start = 121, eat_start = 161, eat_loop = false,
|
||||||
},
|
},
|
||||||
follow = { "mcl_farming:wheat_item" },
|
follow = { "mcl_farming:wheat_item", "mcl_shepherd:shepherd_staff" },
|
||||||
view_range = 12,
|
view_range = 12,
|
||||||
|
|
||||||
-- Eat grass
|
-- Eat grass
|
||||||
|
@ -379,7 +379,7 @@ mcl_mobs:spawn_specific(
|
||||||
9,
|
9,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
120,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
attack_type = "shoot",
|
attack_type = "shoot",
|
||||||
shoot_interval = 0.5,
|
shoot_interval = 6,
|
||||||
arrow = "mobs_mc:shulkerbullet",
|
arrow = "mobs_mc:shulkerbullet",
|
||||||
shoot_offset = 0.5,
|
shoot_offset = 0.5,
|
||||||
passive = false,
|
passive = false,
|
||||||
|
@ -43,7 +43,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
hp_max = 30,
|
hp_max = 30,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
xp_max = 5,
|
xp_max = 5,
|
||||||
armor = 150,
|
armor = 20,
|
||||||
collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.99, 0.5},
|
collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.99, 0.5},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_shulker.b3d",
|
mesh = "mobs_mc_shulker.b3d",
|
||||||
|
@ -51,7 +51,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
-- TODO: sounds
|
-- TODO: sounds
|
||||||
-- TODO: Make shulker dye-able
|
-- TODO: Make shulker dye-able
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
walk_chance = 0,
|
walk_chance = 10,
|
||||||
knock_back = false,
|
knock_back = false,
|
||||||
jump = false,
|
jump = false,
|
||||||
can_despawn = false,
|
can_despawn = false,
|
||||||
|
@ -65,15 +65,19 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
looting_factor = 0.0625},
|
looting_factor = 0.0625},
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
stand_speed = 25, walk_speed = 0, run_speed = 50, punch_speed = 25,
|
stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25,
|
||||||
speed_normal = 25, speed_run = 50,
|
speed_normal = 25, speed_run = 50,
|
||||||
stand_start = 0, stand_end = 25,
|
stand_start = 0, stand_end = 25,
|
||||||
walk_start = 25, walk_end = 45,
|
walk_start = 45, walk_end = 65,
|
||||||
run_start = 45, run_end = 85,
|
walk_loop = false,
|
||||||
|
run_start = 65, run_end = 85,
|
||||||
|
run_loop = false,
|
||||||
punch_start = 80, punch_end = 100,
|
punch_start = 80, punch_end = 100,
|
||||||
},
|
},
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 0,
|
fear_height = 0,
|
||||||
|
walk_velocity = 0,
|
||||||
|
run_velocity = 0,
|
||||||
noyaw = true,
|
noyaw = true,
|
||||||
do_custom = function(self,dtime)
|
do_custom = function(self,dtime)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
@ -81,12 +85,13 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
self.object:set_yaw(0)
|
self.object:set_yaw(0)
|
||||||
mcl_mobs:yaw(self, 0, 0, dtime)
|
mcl_mobs:yaw(self, 0, 0, dtime)
|
||||||
end
|
end
|
||||||
if self.state == "walk" or self.state == "stand" then
|
|
||||||
self.state = "stand"
|
|
||||||
self:set_animation("stand")
|
|
||||||
end
|
|
||||||
if self.state == "attack" then
|
if self.state == "attack" then
|
||||||
self:set_animation("punch")
|
self:set_animation("run")
|
||||||
|
self.armor = 0
|
||||||
|
elseif self.state == "stand" then
|
||||||
|
self.armor = 20
|
||||||
|
elseif self.state == "walk" or self.state == "run" then
|
||||||
|
self.armor = 0
|
||||||
end
|
end
|
||||||
self.path.way = false
|
self.path.way = false
|
||||||
self.look_at_players = false
|
self.look_at_players = false
|
||||||
|
@ -149,6 +154,9 @@ mcl_mobs.register_mob("mobs_mc:shulker", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_attack = function(self, dtime)
|
||||||
|
self.shoot_interval = math.random(1, 6)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- bullet arrow (weapon)
|
-- bullet arrow (weapon)
|
||||||
|
@ -156,27 +164,12 @@ mcl_mobs.register_arrow("mobs_mc:shulkerbullet", {
|
||||||
visual = "sprite",
|
visual = "sprite",
|
||||||
visual_size = {x = 0.25, y = 0.25},
|
visual_size = {x = 0.25, y = 0.25},
|
||||||
textures = {"mobs_mc_shulkerbullet.png"},
|
textures = {"mobs_mc_shulkerbullet.png"},
|
||||||
velocity = 6,
|
velocity = 5,
|
||||||
|
homing = true,
|
||||||
hit_player = function(self, player)
|
hit_player = mcl_mobs.get_arrow_damage_func(4),
|
||||||
player:punch(self.object, 1.0, {
|
hit_mob = mcl_mobs.get_arrow_damage_func(4),
|
||||||
full_punch_interval = 1.0,
|
|
||||||
damage_groups = {fleshy = 4},
|
|
||||||
}, nil)
|
|
||||||
end,
|
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
|
||||||
mob:punch(self.object, 1.0, {
|
|
||||||
full_punch_interval = 1.0,
|
|
||||||
damage_groups = {fleshy = 4},
|
|
||||||
}, nil)
|
|
||||||
end,
|
|
||||||
|
|
||||||
hit_node = function(self, pos, node)
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
mcl_mobs.register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0)
|
mcl_mobs.register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0)
|
||||||
mcl_mobs:non_spawn_specific("mobs_mc:shulker","overworld",0,minetest.LIGHT_MAX+1)
|
mcl_mobs:non_spawn_specific("mobs_mc:shulker","overworld",0,minetest.LIGHT_MAX+1)
|
||||||
--[[
|
--[[
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
local function spawn_check(pos, environmental_light, artificial_light, sky_light)
|
||||||
|
return artificial_light <= 11
|
||||||
|
end
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:silverfish", {
|
mcl_mobs.register_mob("mobs_mc:silverfish", {
|
||||||
description = S("Silverfish"),
|
description = S("Silverfish"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
|
@ -53,6 +57,7 @@ mcl_mobs.register_mob("mobs_mc:silverfish", {
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 1,
|
damage = 1,
|
||||||
|
spawn_check = spawn_check,
|
||||||
})
|
})
|
||||||
|
|
||||||
mcl_mobs.register_egg("mobs_mc:silverfish", S("Silverfish"), "#6d6d6d", "#313131", 0)
|
mcl_mobs.register_egg("mobs_mc:silverfish", S("Silverfish"), "#6d6d6d", "#313131", 0)
|
||||||
|
|
|
@ -44,6 +44,13 @@ local skeleton = {
|
||||||
"mcl_bows_bow_0.png", -- wielded_item
|
"mcl_bows_bow_0.png", -- wielded_item
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
-- TODO: change random to new api when min minetest version is 5.8
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_mc_skeleton_random.2",
|
||||||
|
death = "mobs_mc_skeleton_death",
|
||||||
|
damage = "mobs_mc_skeleton_hurt",
|
||||||
|
distance = 16,
|
||||||
|
},
|
||||||
walk_velocity = 1.2,
|
walk_velocity = 1.2,
|
||||||
run_velocity = 2.0,
|
run_velocity = 2.0,
|
||||||
damage = 2,
|
damage = 2,
|
||||||
|
@ -299,7 +306,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
20,
|
20,
|
||||||
17000,
|
800,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -316,7 +323,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
10000,
|
800,
|
||||||
3,
|
3,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
@ -336,7 +343,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
20,
|
20,
|
||||||
19000,
|
1200,
|
||||||
2,
|
2,
|
||||||
mobs_mc.water_level,
|
mobs_mc.water_level,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -37,7 +37,7 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", {
|
||||||
visual_size = {x=1.2, y=1.2},
|
visual_size = {x=1.2, y=1.2},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
sounds = {
|
sounds = {
|
||||||
random = "mobs_mc_skeleton_random",
|
random = "mobs_mc_skeleton_random.1",
|
||||||
death = "mobs_mc_skeleton_death",
|
death = "mobs_mc_skeleton_death",
|
||||||
damage = "mobs_mc_skeleton_hurt",
|
damage = "mobs_mc_skeleton_hurt",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
|
@ -96,6 +96,11 @@ mcl_mobs.register_mob("mobs_mc:witherskeleton", {
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
|
dealt_effect = {
|
||||||
|
name = "withering",
|
||||||
|
factor = 1,
|
||||||
|
dur = 10,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
--spawn
|
--spawn
|
||||||
|
@ -111,7 +116,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
5000,
|
500,
|
||||||
5,
|
5,
|
||||||
mcl_vars.mg_nether_min,
|
mcl_vars.mg_nether_min,
|
||||||
mcl_vars.mg_nether_max)
|
mcl_vars.mg_nether_max)
|
||||||
|
|
|
@ -6,6 +6,7 @@ local MAPBLOCK_SIZE = 16
|
||||||
local seed = minetest.get_mapgen_setting("seed")
|
local seed = minetest.get_mapgen_setting("seed")
|
||||||
|
|
||||||
local slime_chunk_match
|
local slime_chunk_match
|
||||||
|
local slime_chunk_spawn_max = mcl_worlds.layer_to_y(40)
|
||||||
local x_modifier
|
local x_modifier
|
||||||
local z_modifier
|
local z_modifier
|
||||||
|
|
||||||
|
@ -161,9 +162,21 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local swamp_light_max = 7
|
||||||
|
|
||||||
|
local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light)
|
||||||
|
local maxlight = swamp_light_max
|
||||||
|
|
||||||
|
if pos.y <= slime_chunk_spawn_max and is_slime_chunk(pos) then
|
||||||
|
maxlight = minetest.LIGHT_MAX + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return math.max(artificial_light, sky_light) <= maxlight
|
||||||
|
end
|
||||||
|
|
||||||
-- Slime
|
-- Slime
|
||||||
local slime_big = {
|
local slime_big = {
|
||||||
description = S("Slime"),
|
description = S("Slime - big"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" },
|
group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" },
|
||||||
|
@ -171,7 +184,7 @@ local slime_big = {
|
||||||
hp_max = 16,
|
hp_max = 16,
|
||||||
xp_min = 4,
|
xp_min = 4,
|
||||||
xp_max = 4,
|
xp_max = 4,
|
||||||
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
|
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02, rotate = true},
|
||||||
visual_size = {x=12.5, y=12.5},
|
visual_size = {x=12.5, y=12.5},
|
||||||
textures = {{"mobs_mc_slime.png", "mobs_mc_slime.png"}},
|
textures = {{"mobs_mc_slime.png", "mobs_mc_slime.png"}},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -185,7 +198,7 @@ local slime_big = {
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
damage = 4,
|
damage = 4,
|
||||||
reach = 3,
|
reach = 2.5,
|
||||||
armor = 100,
|
armor = 100,
|
||||||
drops = {},
|
drops = {},
|
||||||
-- TODO: Fix animations
|
-- TODO: Fix animations
|
||||||
|
@ -213,19 +226,21 @@ local slime_big = {
|
||||||
spawn_small_alternative = "mobs_mc:slime_small",
|
spawn_small_alternative = "mobs_mc:slime_small",
|
||||||
on_die = spawn_children_on_die("mobs_mc:slime_small", 1.0, 1.5),
|
on_die = spawn_children_on_die("mobs_mc:slime_small", 1.0, 1.5),
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
|
spawn_check = slime_spawn_check,
|
||||||
}
|
}
|
||||||
mcl_mobs.register_mob("mobs_mc:slime_big", slime_big)
|
mcl_mobs.register_mob("mobs_mc:slime_big", slime_big)
|
||||||
|
|
||||||
local slime_small = table.copy(slime_big)
|
local slime_small = table.copy(slime_big)
|
||||||
|
slime_small.description = S("Slime - small")
|
||||||
slime_small.sounds.base_pitch = 1.15
|
slime_small.sounds.base_pitch = 1.15
|
||||||
slime_small.hp_min = 4
|
slime_small.hp_min = 4
|
||||||
slime_small.hp_max = 4
|
slime_small.hp_max = 4
|
||||||
slime_small.xp_min = 2
|
slime_small.xp_min = 2
|
||||||
slime_small.xp_max = 2
|
slime_small.xp_max = 2
|
||||||
slime_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
|
slime_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51, rotate = true}
|
||||||
slime_small.visual_size = {x=6.25, y=6.25}
|
slime_small.visual_size = {x=6.25, y=6.25}
|
||||||
slime_small.damage = 3
|
slime_small.damage = 3
|
||||||
slime_small.reach = 2.75
|
slime_small.reach = 2.25
|
||||||
slime_small.walk_velocity = 1.8
|
slime_small.walk_velocity = 1.8
|
||||||
slime_small.run_velocity = 1.8
|
slime_small.run_velocity = 1.8
|
||||||
slime_small.jump_height = 4.3
|
slime_small.jump_height = 4.3
|
||||||
|
@ -234,15 +249,16 @@ slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 0.6, 1.0)
|
||||||
mcl_mobs.register_mob("mobs_mc:slime_small", slime_small)
|
mcl_mobs.register_mob("mobs_mc:slime_small", slime_small)
|
||||||
|
|
||||||
local slime_tiny = table.copy(slime_big)
|
local slime_tiny = table.copy(slime_big)
|
||||||
|
slime_tiny.description = S("Slime - tiny")
|
||||||
slime_tiny.sounds.base_pitch = 1.3
|
slime_tiny.sounds.base_pitch = 1.3
|
||||||
slime_tiny.hp_min = 1
|
slime_tiny.hp_min = 1
|
||||||
slime_tiny.hp_max = 1
|
slime_tiny.hp_max = 1
|
||||||
slime_tiny.xp_min = 1
|
slime_tiny.xp_min = 1
|
||||||
slime_tiny.xp_max = 1
|
slime_tiny.xp_max = 1
|
||||||
slime_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}
|
slime_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505, rotate = true}
|
||||||
slime_tiny.visual_size = {x=3.125, y=3.125}
|
slime_tiny.visual_size = {x=3.125, y=3.125}
|
||||||
slime_tiny.damage = 0
|
slime_tiny.damage = 1
|
||||||
slime_tiny.reach = 2.5
|
slime_tiny.reach = 2
|
||||||
slime_tiny.drops = {
|
slime_tiny.drops = {
|
||||||
-- slimeball
|
-- slimeball
|
||||||
{name = "mcl_mobitems:slimeball",
|
{name = "mcl_mobitems:slimeball",
|
||||||
|
@ -297,7 +313,6 @@ local cave_min = mcl_vars.mg_overworld_min
|
||||||
local cave_max = water_level - 23
|
local cave_max = water_level - 23
|
||||||
|
|
||||||
local swampy_biomes = {"Swampland", "MangroveSwamp"}
|
local swampy_biomes = {"Swampland", "MangroveSwamp"}
|
||||||
local swamp_light_max = 7
|
|
||||||
local swamp_min = water_level
|
local swamp_min = water_level
|
||||||
local swamp_max = water_level + 27
|
local swamp_max = water_level + 27
|
||||||
|
|
||||||
|
@ -309,7 +324,7 @@ cave_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
12000,
|
1000,
|
||||||
4,
|
4,
|
||||||
cave_min,
|
cave_min,
|
||||||
cave_max,
|
cave_max,
|
||||||
|
@ -323,7 +338,7 @@ swampy_biomes,
|
||||||
0,
|
0,
|
||||||
swamp_light_max,
|
swamp_light_max,
|
||||||
30,
|
30,
|
||||||
12000,
|
1000,
|
||||||
4,
|
4,
|
||||||
swamp_min,
|
swamp_min,
|
||||||
swamp_max)
|
swamp_max)
|
||||||
|
@ -336,7 +351,7 @@ cave_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
8500,
|
1000,
|
||||||
4,
|
4,
|
||||||
cave_min,
|
cave_min,
|
||||||
cave_max,
|
cave_max,
|
||||||
|
@ -350,7 +365,7 @@ swampy_biomes,
|
||||||
0,
|
0,
|
||||||
swamp_light_max,
|
swamp_light_max,
|
||||||
30,
|
30,
|
||||||
8500,
|
1000,
|
||||||
4,
|
4,
|
||||||
swamp_min,
|
swamp_min,
|
||||||
swamp_max)
|
swamp_max)
|
||||||
|
@ -363,7 +378,7 @@ cave_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
10000,
|
1000,
|
||||||
4,
|
4,
|
||||||
cave_min,
|
cave_min,
|
||||||
cave_max,
|
cave_max,
|
||||||
|
@ -377,21 +392,21 @@ swampy_biomes,
|
||||||
0,
|
0,
|
||||||
swamp_light_max,
|
swamp_light_max,
|
||||||
30,
|
30,
|
||||||
10000,
|
1000,
|
||||||
4,
|
4,
|
||||||
swamp_min,
|
swamp_min,
|
||||||
swamp_max)
|
swamp_max)
|
||||||
|
|
||||||
-- Magma cube
|
-- Magma cube
|
||||||
local magma_cube_big = {
|
local magma_cube_big = {
|
||||||
description = S("Magma Cube"),
|
description = S("Magma Cube - big"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
hp_min = 16,
|
hp_min = 16,
|
||||||
hp_max = 16,
|
hp_max = 16,
|
||||||
xp_min = 4,
|
xp_min = 4,
|
||||||
xp_max = 4,
|
xp_max = 4,
|
||||||
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02},
|
collisionbox = {-1.02, -0.01, -1.02, 1.02, 2.03, 1.02, rotate = true},
|
||||||
visual_size = {x=12.5, y=12.5},
|
visual_size = {x=12.5, y=12.5},
|
||||||
textures = {{ "mobs_mc_magmacube.png", "mobs_mc_magmacube.png" }},
|
textures = {{ "mobs_mc_magmacube.png", "mobs_mc_magmacube.png" }},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -406,7 +421,7 @@ local magma_cube_big = {
|
||||||
walk_velocity = 2.5,
|
walk_velocity = 2.5,
|
||||||
run_velocity = 2.5,
|
run_velocity = 2.5,
|
||||||
damage = 6,
|
damage = 6,
|
||||||
reach = 3,
|
reach = 2.35,
|
||||||
armor = 53,
|
armor = 53,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_mobitems:magma_cream",
|
{name = "mcl_mobitems:magma_cream",
|
||||||
|
@ -445,16 +460,17 @@ local magma_cube_big = {
|
||||||
mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big)
|
mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big)
|
||||||
|
|
||||||
local magma_cube_small = table.copy(magma_cube_big)
|
local magma_cube_small = table.copy(magma_cube_big)
|
||||||
|
magma_cube_small.description = S("Magma Cube - small")
|
||||||
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
|
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
|
||||||
magma_cube_small.sounds.death = "mobs_mc_magma_cube_small"
|
magma_cube_small.sounds.death = "mobs_mc_magma_cube_small"
|
||||||
magma_cube_small.hp_min = 4
|
magma_cube_small.hp_min = 4
|
||||||
magma_cube_small.hp_max = 4
|
magma_cube_small.hp_max = 4
|
||||||
magma_cube_small.xp_min = 2
|
magma_cube_small.xp_min = 2
|
||||||
magma_cube_small.xp_max = 2
|
magma_cube_small.xp_max = 2
|
||||||
magma_cube_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51}
|
magma_cube_small.collisionbox = {-0.51, -0.01, -0.51, 0.51, 1.00, 0.51, rotate = true}
|
||||||
magma_cube_small.visual_size = {x=6.25, y=6.25}
|
magma_cube_small.visual_size = {x=6.25, y=6.25}
|
||||||
magma_cube_small.damage = 3
|
magma_cube_small.damage = 3
|
||||||
magma_cube_small.reach = 2.75
|
magma_cube_small.reach = 2.1
|
||||||
magma_cube_small.walk_velocity = .8
|
magma_cube_small.walk_velocity = .8
|
||||||
magma_cube_small.run_velocity = 2.0
|
magma_cube_small.run_velocity = 2.0
|
||||||
magma_cube_small.jump_height = 6
|
magma_cube_small.jump_height = 6
|
||||||
|
@ -466,6 +482,7 @@ magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 0.6,
|
||||||
mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small)
|
mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small)
|
||||||
|
|
||||||
local magma_cube_tiny = table.copy(magma_cube_big)
|
local magma_cube_tiny = table.copy(magma_cube_big)
|
||||||
|
magma_cube_tiny.description = S("Magma Cube - tiny")
|
||||||
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
|
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
|
||||||
magma_cube_tiny.sounds.death = "mobs_mc_magma_cube_small"
|
magma_cube_tiny.sounds.death = "mobs_mc_magma_cube_small"
|
||||||
magma_cube_tiny.sounds.base_pitch = 1.25
|
magma_cube_tiny.sounds.base_pitch = 1.25
|
||||||
|
@ -473,13 +490,13 @@ magma_cube_tiny.hp_min = 1
|
||||||
magma_cube_tiny.hp_max = 1
|
magma_cube_tiny.hp_max = 1
|
||||||
magma_cube_tiny.xp_min = 1
|
magma_cube_tiny.xp_min = 1
|
||||||
magma_cube_tiny.xp_max = 1
|
magma_cube_tiny.xp_max = 1
|
||||||
magma_cube_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505}
|
magma_cube_tiny.collisionbox = {-0.2505, -0.01, -0.2505, 0.2505, 0.50, 0.2505, rotate = true}
|
||||||
magma_cube_tiny.visual_size = {x=3.125, y=3.125}
|
magma_cube_tiny.visual_size = {x=3.125, y=3.125}
|
||||||
magma_cube_tiny.walk_velocity = 1.02
|
magma_cube_tiny.walk_velocity = 1.02
|
||||||
magma_cube_tiny.run_velocity = 1.02
|
magma_cube_tiny.run_velocity = 1.02
|
||||||
magma_cube_tiny.jump_height = 4
|
magma_cube_tiny.jump_height = 4
|
||||||
magma_cube_tiny.damage = 3
|
magma_cube_tiny.damage = 3
|
||||||
magma_cube_tiny.reach = 2.5
|
magma_cube_tiny.reach = 2
|
||||||
magma_cube_tiny.armor = 50
|
magma_cube_tiny.armor = 50
|
||||||
magma_cube_tiny.drops = {}
|
magma_cube_tiny.drops = {}
|
||||||
magma_cube_tiny.spawn_small_alternative = nil
|
magma_cube_tiny.spawn_small_alternative = nil
|
||||||
|
@ -500,7 +517,7 @@ magma_cube_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15000,
|
100,
|
||||||
4,
|
4,
|
||||||
nether_min,
|
nether_min,
|
||||||
nether_max)
|
nether_max)
|
||||||
|
@ -513,7 +530,7 @@ magma_cube_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
15500,
|
100,
|
||||||
4,
|
4,
|
||||||
nether_min,
|
nether_min,
|
||||||
nether_max)
|
nether_max)
|
||||||
|
@ -526,7 +543,7 @@ magma_cube_biomes,
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
16000,
|
100,
|
||||||
4,
|
4,
|
||||||
nether_min,
|
nether_min,
|
||||||
nether_max)
|
nether_max)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -114,9 +114,7 @@ mcl_mobs.register_mob("mobs_mc:spider", spider)
|
||||||
local cave_spider = table.copy(spider)
|
local cave_spider = table.copy(spider)
|
||||||
cave_spider.description = S("Cave Spider")
|
cave_spider.description = S("Cave Spider")
|
||||||
cave_spider.textures = { {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"} }
|
cave_spider.textures = { {"mobs_mc_cave_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"} }
|
||||||
-- TODO: Poison damage
|
cave_spider.damage = 2
|
||||||
-- TODO: Revert damage to 2
|
|
||||||
cave_spider.damage = 3 -- damage increased to undo non-existing poison
|
|
||||||
cave_spider.hp_min = 1
|
cave_spider.hp_min = 1
|
||||||
cave_spider.hp_max = 12
|
cave_spider.hp_max = 12
|
||||||
cave_spider.collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.46, 0.35}
|
cave_spider.collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.46, 0.35}
|
||||||
|
@ -138,6 +136,11 @@ cave_spider.walk_velocity = 1.3
|
||||||
cave_spider.run_velocity = 3.2
|
cave_spider.run_velocity = 3.2
|
||||||
cave_spider.sounds = table.copy(spider.sounds)
|
cave_spider.sounds = table.copy(spider.sounds)
|
||||||
cave_spider.sounds.base_pitch = 1.25
|
cave_spider.sounds.base_pitch = 1.25
|
||||||
|
cave_spider.dealt_effect = {
|
||||||
|
name = "poison",
|
||||||
|
factor = 2.5,
|
||||||
|
dur = 7,
|
||||||
|
}
|
||||||
mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
|
mcl_mobs.register_mob("mobs_mc:cave_spider", cave_spider)
|
||||||
|
|
||||||
|
|
||||||
|
@ -284,7 +287,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
17000,
|
1000,
|
||||||
2,
|
2,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -211,7 +211,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
5500,
|
80,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -11,6 +11,7 @@ local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
|
||||||
local strider = {
|
local strider = {
|
||||||
|
description = S("Strider"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
passive = true,
|
passive = true,
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
|
@ -30,6 +31,8 @@ local strider = {
|
||||||
} },
|
} },
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
sounds = {
|
sounds = {
|
||||||
|
eat = "mobs_mc_animal_eat_generic",
|
||||||
|
distance = 16,
|
||||||
},
|
},
|
||||||
jump = true,
|
jump = true,
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
@ -51,6 +54,7 @@ local strider = {
|
||||||
walk_start = 1,
|
walk_start = 1,
|
||||||
walk_end = 20,
|
walk_end = 20,
|
||||||
},
|
},
|
||||||
|
follow = { "mcl_crimson:warped_fungus" },
|
||||||
lava_damage = 0,
|
lava_damage = 0,
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
light_damage = 0,
|
light_damage = 0,
|
||||||
|
@ -67,8 +71,13 @@ local strider = {
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
|
||||||
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then
|
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then
|
||||||
|
if self.driver then
|
||||||
|
self.walk_velocity = 4
|
||||||
|
self.run_velocity = 8
|
||||||
|
else
|
||||||
self.walk_velocity = 2
|
self.walk_velocity = 2
|
||||||
self.run_velocity = 4
|
self.run_velocity = 4
|
||||||
|
end
|
||||||
self.base_texture[1] = "extra_mobs_strider.png"
|
self.base_texture[1] = "extra_mobs_strider.png"
|
||||||
self.shaking = false
|
self.shaking = false
|
||||||
else
|
else
|
||||||
|
@ -122,7 +131,7 @@ local strider = {
|
||||||
|
|
||||||
local wielditem = clicker:get_wielded_item()
|
local wielditem = clicker:get_wielded_item()
|
||||||
|
|
||||||
if wielditem:get_name() ~= "mcl_crimson:warped_fungus" then
|
if wielditem:get_name() == "mcl_crimson:warped_fungus" then
|
||||||
if self:feed_tame(clicker, 1, true, true) then return end
|
if self:feed_tame(clicker, 1, true, true) then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -197,6 +206,7 @@ mcl_mobs.register_mob("mobs_mc:strider", strider)
|
||||||
-- Baby strider.
|
-- Baby strider.
|
||||||
|
|
||||||
local baby_strider = table.copy(strider)
|
local baby_strider = table.copy(strider)
|
||||||
|
baby_strider.description = S("Baby Strider")
|
||||||
baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
|
baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
|
||||||
baby_strider.xp_min = 13
|
baby_strider.xp_min = 13
|
||||||
baby_strider.xp_max = 13
|
baby_strider.xp_max = 13
|
||||||
|
@ -206,7 +216,7 @@ textures = { {
|
||||||
} }
|
} }
|
||||||
baby_strider.walk_velocity = 1.2
|
baby_strider.walk_velocity = 1.2
|
||||||
baby_strider.run_velocity = 2.4
|
baby_strider.run_velocity = 2.4
|
||||||
baby_strider.child = 1
|
baby_strider.child = true
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider)
|
mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider)
|
||||||
|
|
||||||
|
@ -225,7 +235,7 @@ mcl_mobs:spawn_setup({
|
||||||
},
|
},
|
||||||
min_height = mcl_vars.mg_nether_min,
|
min_height = mcl_vars.mg_nether_min,
|
||||||
max_height = mcl_vars.mg_nether_max,
|
max_height = mcl_vars.mg_nether_max,
|
||||||
chance = 2000,
|
chance = 200,
|
||||||
})
|
})
|
||||||
|
|
||||||
mcl_mobs:spawn_setup({
|
mcl_mobs:spawn_setup({
|
||||||
|
@ -241,7 +251,7 @@ mcl_mobs:spawn_setup({
|
||||||
},
|
},
|
||||||
min_height = mcl_vars.mg_nether_min,
|
min_height = mcl_vars.mg_nether_min,
|
||||||
max_height = mcl_vars.mg_nether_max,
|
max_height = mcl_vars.mg_nether_max,
|
||||||
chance = 100,
|
chance = 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
|
|
|
@ -58,6 +58,7 @@ local function set_textures(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local tropical_fish = {
|
local tropical_fish = {
|
||||||
|
description = S("Tropical Fish"),
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water_ambient",
|
spawn_class = "water_ambient",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
|
@ -183,7 +184,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
4000,
|
750,
|
||||||
3,
|
3,
|
||||||
water-16,
|
water-16,
|
||||||
water+1)
|
water+1)
|
||||||
|
|
|
@ -37,6 +37,7 @@ mcl_mobs.register_mob("mobs_mc:vex", {
|
||||||
walk_velocity = 3.2,
|
walk_velocity = 3.2,
|
||||||
run_velocity = 5.9,
|
run_velocity = 5.9,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
|
attack_frequency = 2,
|
||||||
sounds = {
|
sounds = {
|
||||||
-- TODO: random
|
-- TODO: random
|
||||||
death = "mobs_mc_vex_death",
|
death = "mobs_mc_vex_death",
|
||||||
|
@ -63,10 +64,13 @@ mcl_mobs.register_mob("mobs_mc:vex", {
|
||||||
self.object:set_properties({textures=self.base_texture})
|
self.object:set_properties({textures=self.base_texture})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
if self.base_texture[2] == "mobs_mc_vex_charging.png" then
|
||||||
|
self.base_texture[2] = "mobs_mc_vex.png"
|
||||||
|
end
|
||||||
if self.base_texture[1] ~= "default_tool_steelsword.png" then
|
if self.base_texture[1] ~= "default_tool_steelsword.png" then
|
||||||
self.base_texture[1] = "default_tool_steelsword.png"
|
self.base_texture[1] = "default_tool_steelsword.png"
|
||||||
self.object:set_properties({textures=self.base_texture})
|
|
||||||
end
|
end
|
||||||
|
self.object:set_properties({textures=self.base_texture})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Take constant damage if the vex' life clock ran out
|
-- Take constant damage if the vex' life clock ran out
|
||||||
|
|
|
@ -1941,6 +1941,7 @@ local trade_inventory = {
|
||||||
if not wanted2:is_empty() then
|
if not wanted2:is_empty() then
|
||||||
inv:remove_item("input", inv:get_stack("wanted", 2))
|
inv:remove_item("input", inv:get_stack("wanted", 2))
|
||||||
end
|
end
|
||||||
|
local name = player:get_player_name()
|
||||||
local trader = player_trading_with[name]
|
local trader = player_trading_with[name]
|
||||||
minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name(),object=trader.object}, true)
|
minetest.sound_play("mobs_mc_villager_accept", {to_player = player:get_player_name(),object=trader.object}, true)
|
||||||
end
|
end
|
||||||
|
@ -1988,6 +1989,17 @@ local trade_inventory = {
|
||||||
-- Otherwise, 20% chance to unlock if used freshly reset trade
|
-- Otherwise, 20% chance to unlock if used freshly reset trade
|
||||||
unlock_stuff = true
|
unlock_stuff = true
|
||||||
end
|
end
|
||||||
|
-- calculate xp based on the price
|
||||||
|
local emeralds = 0
|
||||||
|
if wanted1:get_name() == "mcl_core:emerald" then
|
||||||
|
emeralds = wanted1:get_count()
|
||||||
|
elseif wanted2:get_name() == "mcl_core:emerald" then
|
||||||
|
emeralds = wanted2:get_count()
|
||||||
|
else
|
||||||
|
local offered = inv:get_stack("offered", 1)
|
||||||
|
emeralds = offered:get_name() == "mcl_core:emerald" and offered:get_count() or 0
|
||||||
|
end
|
||||||
|
local xp = 2 + math.ceil(emeralds / (64/4)) -- 1..64 emeralds = 3..6 xp
|
||||||
local update_formspec = false
|
local update_formspec = false
|
||||||
if unlock_stuff then
|
if unlock_stuff then
|
||||||
-- First-time trade unlock all trades and unlock next trade tier
|
-- First-time trade unlock all trades and unlock next trade tier
|
||||||
|
@ -1999,6 +2011,7 @@ local trade_inventory = {
|
||||||
set_textures(trader)
|
set_textures(trader)
|
||||||
update_max_tradenum(trader)
|
update_max_tradenum(trader)
|
||||||
update_formspec = true
|
update_formspec = true
|
||||||
|
xp = xp + 5
|
||||||
end
|
end
|
||||||
for t=1, #trades do
|
for t=1, #trades do
|
||||||
trades[t].locked = false
|
trades[t].locked = false
|
||||||
|
@ -2009,6 +2022,7 @@ local trade_inventory = {
|
||||||
-- TODO: Replace by Regeneration I
|
-- TODO: Replace by Regeneration I
|
||||||
trader.health = math.min(trader.hp_max, trader.health + 4)
|
trader.health = math.min(trader.hp_max, trader.health + 4)
|
||||||
end
|
end
|
||||||
|
mcl_experience.add_xp(player, xp)
|
||||||
trade.trade_counter = trade.trade_counter + 1
|
trade.trade_counter = trade.trade_counter + 1
|
||||||
mcl_log("Trade counter is: ".. trade.trade_counter)
|
mcl_log("Trade counter is: ".. trade.trade_counter)
|
||||||
-- Semi-randomly lock trade for repeated trade (not if there's only 1 trade)
|
-- Semi-randomly lock trade for repeated trade (not if there's only 1 trade)
|
||||||
|
@ -2046,6 +2060,7 @@ local trade_inventory = {
|
||||||
if update_formspec then
|
if update_formspec then
|
||||||
show_trade_formspec(name, trader, tradenum)
|
show_trade_formspec(name, trader, tradenum)
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.log("error", "[mobs_mc] Player took item from trader output but player_trading_with or player_tradenum is nil!")
|
minetest.log("error", "[mobs_mc] Player took item from trader output but player_trading_with or player_tradenum is nil!")
|
||||||
end
|
end
|
||||||
|
@ -2335,7 +2350,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
20,
|
2,
|
||||||
4,
|
4,
|
||||||
mobs_mc.water_level+1,
|
mobs_mc.water_level+1,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -42,6 +42,7 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
||||||
run_velocity = 1.4,
|
run_velocity = 1.4,
|
||||||
group_attack = true,
|
group_attack = true,
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
|
attack_frequency = 15,
|
||||||
-- Summon vexes
|
-- Summon vexes
|
||||||
custom_attack = function(self, to_attack)
|
custom_attack = function(self, to_attack)
|
||||||
if not spawned_vexes[self] then spawned_vexes[self] = {} end
|
if not spawned_vexes[self] then spawned_vexes[self] = {} end
|
||||||
|
@ -64,7 +65,6 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
||||||
table.insert(spawned_vexes[self],ent)
|
table.insert(spawned_vexes[self],ent)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
shoot_interval = 15,
|
|
||||||
passive = false,
|
passive = false,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_core:emerald",
|
{name = "mcl_core:emerald",
|
||||||
|
@ -86,6 +86,11 @@ mcl_mobs.register_mob("mobs_mc:evoker", {
|
||||||
},
|
},
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
|
||||||
|
on_spawn = function(self)
|
||||||
|
self.timer = 15
|
||||||
|
return true
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
|
|
|
@ -225,7 +225,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
4090,
|
50,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -70,6 +70,11 @@ mcl_mobs.register_mob("mobs_mc:witch", {
|
||||||
},
|
},
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
deal_damage = function(self, damage, mcl_reason)
|
||||||
|
local factor = 1
|
||||||
|
if mcl_reason.type == "magic" then factor = 0.15 end
|
||||||
|
self.health = self.health - factor*damage
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- potion projectile (EXPERIMENTAL)
|
-- potion projectile (EXPERIMENTAL)
|
||||||
|
|
|
@ -1,14 +1,72 @@
|
||||||
--MCmobs v0.4
|
--MCmobs v0.4
|
||||||
--maikerumine
|
--maikerumine
|
||||||
|
--updated by Herowl
|
||||||
--made for MC like Survival game
|
--made for MC like Survival game
|
||||||
--License for code WTFPL and otherwise stated in readmes
|
--License for code WTFPL and otherwise stated in readmes
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
local mobs_griefing = minetest.settings:get_bool("mobs_griefing", true)
|
||||||
|
local follow_spawner = minetest.settings:get_bool("wither_follow_spawner", false)
|
||||||
|
local w_strafes = minetest.settings:get_bool("wither_strafes", true)
|
||||||
|
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||||
|
|
||||||
|
local WITHER_INIT_BOOM = 7
|
||||||
|
local WITHER_MELEE_COOLDOWN = 3
|
||||||
|
|
||||||
|
local function atan(x)
|
||||||
|
if not x or x ~= x then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return math.atan(x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--###################
|
--###################
|
||||||
--################### WITHER
|
--################### WITHER
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
|
local function wither_unstuck(self)
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
if mobs_griefing then -- destroy blocks very nearby (basically, colliding with)
|
||||||
|
local col = self.collisionbox
|
||||||
|
local pos1 = vector.offset(pos, col[1], col[2], col[3])
|
||||||
|
local pos2 = vector.offset(pos, col[4], col[5], col[6])
|
||||||
|
for z = pos1.z, pos2.z do for y = pos1.y, pos2.y do for x = pos1.x, pos2.x do
|
||||||
|
local npos = vector.new(x,y,z)
|
||||||
|
local name = minetest.get_node(npos).name
|
||||||
|
if name ~= "air" then
|
||||||
|
local ndef = minetest.registered_nodes[name]
|
||||||
|
if ndef and ndef._mcl_hardness and ndef._mcl_hardness >= 0 then
|
||||||
|
local drops = minetest.get_node_drops(name, "")
|
||||||
|
if minetest.dig_node(npos) then
|
||||||
|
for _, item in ipairs(drops) do
|
||||||
|
if type(item) ~= "string" then
|
||||||
|
item = item:get_name() .. item:get_count()
|
||||||
|
end
|
||||||
|
minetest.add_item(npos, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end end end
|
||||||
|
end
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_dim_relative_y(pos)
|
||||||
|
if (pos.y >= mcl_vars.mg_realm_barrier_overworld_end_max) then
|
||||||
|
return pos.y
|
||||||
|
elseif (pos.y <= mcl_vars.mg_nether_max + 200) then
|
||||||
|
return (pos.y - mcl_vars.mg_nether_min - 20)
|
||||||
|
else
|
||||||
|
return (pos.y - mcl_vars.mg_end_min - 50)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs_mc.wither_count_overworld = 0
|
||||||
|
mobs_mc.wither_count_nether = 0
|
||||||
|
mobs_mc.wither_count_end = 0
|
||||||
|
|
||||||
mcl_mobs.register_mob("mobs_mc:wither", {
|
mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
description = S("Wither"),
|
description = S("Wither"),
|
||||||
type = "monster",
|
type = "monster",
|
||||||
|
@ -26,11 +84,11 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
{"mobs_mc_wither.png"},
|
{"mobs_mc_wither.png"},
|
||||||
},
|
},
|
||||||
visual_size = {x=4, y=4},
|
visual_size = {x=4, y=4},
|
||||||
makes_footstep_sound = true,
|
view_range = 50,
|
||||||
view_range = 16,
|
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
walk_velocity = 2,
|
walk_velocity = 2,
|
||||||
run_velocity = 4,
|
run_velocity = 4,
|
||||||
|
strafes = w_strafes,
|
||||||
sounds = {
|
sounds = {
|
||||||
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
shoot_attack = "mobs_mc_ender_dragon_shoot",
|
||||||
attack = "mobs_mc_ender_dragon_attack",
|
attack = "mobs_mc_ender_dragon_attack",
|
||||||
|
@ -41,9 +99,8 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
jump_height = 10,
|
jump_height = 10,
|
||||||
fly = true,
|
fly = true,
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
dogshoot_switch = 1,
|
dogshoot_switch = 1, -- unused
|
||||||
dogshoot_count_max = 1,
|
dogshoot_count_max = 1, -- unused
|
||||||
attack_animals = true,
|
|
||||||
can_despawn = false,
|
can_despawn = false,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_mobitems:nether_star",
|
{name = "mcl_mobitems:nether_star",
|
||||||
|
@ -53,13 +110,13 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
},
|
},
|
||||||
lava_damage = 0,
|
lava_damage = 0,
|
||||||
fire_damage = 0,
|
fire_damage = 0,
|
||||||
attack_type = "dogshoot",
|
attack_type = "custom",
|
||||||
explosion_strength = 8,
|
explosion_strength = 8,
|
||||||
dogshoot_stop = true,
|
dogshoot_stop = true,
|
||||||
arrow = "mobs_mc:wither_skull",
|
arrow = "mobs_mc:wither_skull",
|
||||||
reach = 5,
|
reach = 5,
|
||||||
shoot_interval = 0.5,
|
shoot_interval = 1,
|
||||||
shoot_offset = -1,
|
shoot_offset = -0.5,
|
||||||
animation = {
|
animation = {
|
||||||
walk_speed = 12, run_speed = 12, stand_speed = 12,
|
walk_speed = 12, run_speed = 12, stand_speed = 12,
|
||||||
stand_start = 0, stand_end = 20,
|
stand_start = 0, stand_end = 20,
|
||||||
|
@ -67,49 +124,322 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||||
run_start = 0, run_end = 20,
|
run_start = 0, run_end = 20,
|
||||||
},
|
},
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
do_custom = function(self)
|
is_boss = true,
|
||||||
|
extra_hostile = true,
|
||||||
|
attack_exception = function(p)
|
||||||
|
local ent = p:get_luaentity()
|
||||||
|
if p:is_player() then return false end
|
||||||
|
if not ent or not ent.is_mob or ent.harmed_by_heal or string.find(ent.name, "ghast") then return true
|
||||||
|
else return false end
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_custom = function(self, dtime)
|
||||||
|
if self._spawning then
|
||||||
|
-- "loading" bar while spawning
|
||||||
|
if not self._spw_max then self._spw_max = self._spawning end
|
||||||
|
self._spawning = self._spawning - dtime
|
||||||
|
local bardef = {
|
||||||
|
color = "dark_purple",
|
||||||
|
text = "Wither spawning",
|
||||||
|
percentage = math.floor((self._spw_max - self._spawning) / self._spw_max * 100),
|
||||||
|
}
|
||||||
|
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
local d = vector.distance(pos, player:get_pos())
|
||||||
|
if d <= 80 then
|
||||||
|
mcl_bossbars.add_bar(player, bardef, true, d)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- turn around and flash while spawning
|
||||||
|
self.object:set_yaw(self._spawning*10)
|
||||||
|
local factor = math.floor((math.sin(self._spawning*10)+1.5) * 85)
|
||||||
|
local str = minetest.colorspec_to_colorstring({r=factor, g=factor, b=factor})
|
||||||
|
self.object:set_texture_mod("^[brighten^[multiply:"..str)
|
||||||
|
|
||||||
|
-- when fully spawned, explode
|
||||||
|
if self._spawning <= 0 then
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, WITHER_INIT_BOOM, { drop_chance = 1.0 }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, WITHER_INIT_BOOM)
|
||||||
|
end
|
||||||
|
self.object:set_texture_mod("")
|
||||||
|
self._spawning = nil
|
||||||
|
self._spw_max = nil
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- passive regeneration
|
||||||
|
self._custom_timer = self._custom_timer + dtime
|
||||||
|
if self._custom_timer > 1 then
|
||||||
|
self.health = math.min(self.health + 1, self.hp_max)
|
||||||
|
self._custom_timer = self._custom_timer - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- anti-troll measures
|
||||||
|
if anti_troll then
|
||||||
|
if self._spawner then
|
||||||
|
local spawner = minetest.get_player_by_name(self._spawner)
|
||||||
|
if follow_spawner and spawner then
|
||||||
|
self._death_timer = 0
|
||||||
|
local pos = self.object:get_pos()
|
||||||
|
local spw = spawner:get_pos()
|
||||||
|
local dist = vector.distance(pos, spw)
|
||||||
|
if dist > 60 then -- teleport to the player who spawned the wither
|
||||||
|
local R = 10
|
||||||
|
pos.x = spw.x + math.random(-R, R)
|
||||||
|
pos.y = spw.y + math.random(-R, R)
|
||||||
|
pos.z = spw.z + math.random(-R, R)
|
||||||
|
self.object:set_pos(pos)
|
||||||
|
end
|
||||||
|
else -- despawn automatically after set time
|
||||||
|
-- HP changes impact timer: taking damage sets it back
|
||||||
|
self._death_timer = self._death_timer + self.health - self._health_old
|
||||||
|
if self.health == self._health_old then self._death_timer = self._death_timer + dtime end
|
||||||
|
if self._death_timer > 100 then
|
||||||
|
self.object:remove()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
self._health_old = self.health
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- count withers per dimension
|
||||||
|
local dim = mcl_worlds.pos_to_dimension(self.object:get_pos())
|
||||||
|
if dim == "overworld" then mobs_mc.wither_count_overworld = mobs_mc.wither_count_overworld + 1
|
||||||
|
elseif dim == "nether" then mobs_mc.wither_count_nether = mobs_mc.wither_count_nether + 1
|
||||||
|
elseif dim == "end" then mobs_mc.wither_count_end = mobs_mc.wither_count_end + 1 end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- update things dependent on HP
|
||||||
|
local rand_factor
|
||||||
if self.health < (self.hp_max / 2) then
|
if self.health < (self.hp_max / 2) then
|
||||||
self.base_texture = "mobs_mc_wither_half_health.png"
|
self.base_texture = "mobs_mc_wither_half_health.png"
|
||||||
self.fly = false
|
self.fly = false
|
||||||
self.object:set_properties({textures={self.base_texture}})
|
self._arrow_resistant = true
|
||||||
self.armor = {undead = 80, fleshy = 80}
|
rand_factor = 3
|
||||||
|
else
|
||||||
|
self.base_texture = "mobs_mc_wither.png"
|
||||||
|
self.fly = true
|
||||||
|
self._arrow_resistant = false
|
||||||
|
rand_factor = 10
|
||||||
end
|
end
|
||||||
|
if not self.attack then
|
||||||
|
local y = get_dim_relative_y(self.object:get_pos())
|
||||||
|
if y > 0 then
|
||||||
|
self.fly = false
|
||||||
|
else
|
||||||
|
self.fly = true
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
|
self.object:set_velocity(vector.new(vel.x, self.walk_velocity, vel.z))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.object:set_properties({textures={self.base_texture}})
|
||||||
mcl_bossbars.update_boss(self.object, "Wither", "dark_purple")
|
mcl_bossbars.update_boss(self.object, "Wither", "dark_purple")
|
||||||
|
if math.random(1, rand_factor) < 2 then
|
||||||
|
self.arrow = "mobs_mc:wither_skull_strong"
|
||||||
|
else
|
||||||
|
self.arrow = "mobs_mc:wither_skull"
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
attack_state = function(self, dtime)
|
||||||
|
local s = self.object:get_pos()
|
||||||
|
local p = self.attack:get_pos() or s
|
||||||
|
|
||||||
|
p.y = p.y - .5
|
||||||
|
s.y = s.y + .5
|
||||||
|
|
||||||
|
local dist = vector.distance(p, s)
|
||||||
|
local vec = {
|
||||||
|
x = p.x - s.x,
|
||||||
|
y = p.y - s.y,
|
||||||
|
z = p.z - s.z
|
||||||
|
}
|
||||||
|
|
||||||
|
local yaw = (atan(vec.z / vec.x) +math.pi/ 2) - self.rotate
|
||||||
|
if p.x > s.x then yaw = yaw +math.pi end
|
||||||
|
yaw = self:set_yaw( yaw, 0, dtime)
|
||||||
|
|
||||||
|
local stay_away_from_player = vector.zero()
|
||||||
|
|
||||||
|
--strafe back and fourth
|
||||||
|
|
||||||
|
--stay away from player so as to shoot them
|
||||||
|
if dist < self.avoid_distance and self.shooter_avoid_enemy then
|
||||||
|
self:set_animation( "shoot")
|
||||||
|
stay_away_from_player=vector.multiply(vector.direction(p, s), 0.33)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.fly then
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
|
local diff = s.y - p.y
|
||||||
|
local FLY_FACTOR = self.walk_velocity
|
||||||
|
if diff < 10 then
|
||||||
|
self.object:set_velocity({x=vel.x, y= FLY_FACTOR, z=vel.z})
|
||||||
|
elseif diff > 15 then
|
||||||
|
self.object:set_velocity({x=vel.x, y=-FLY_FACTOR, z=vel.z})
|
||||||
|
end
|
||||||
|
for i=1, 15 do
|
||||||
|
if minetest.get_node(vector.offset(s, 0, -i, 0)).name ~= "air" then
|
||||||
|
self.object:set_velocity({x=vel.x, y= FLY_FACTOR, z=vel.z})
|
||||||
|
break
|
||||||
|
elseif minetest.get_node(vector.offset(s, 0, i, 0)).name ~= "air" then
|
||||||
|
self.object:set_velocity({x=vel.x, y=-FLY_FACTOR/i, z=vel.z})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.strafes then
|
||||||
|
if not self.strafe_direction then
|
||||||
|
self.strafe_direction = 1.57
|
||||||
|
end
|
||||||
|
if math.random(40) == 1 then
|
||||||
|
self.strafe_direction = self.strafe_direction*-1
|
||||||
|
end
|
||||||
|
|
||||||
|
local dir = vector.rotate_around_axis(vector.direction(s, p), vector.new(0,1,0), self.strafe_direction)
|
||||||
|
local dir2 = vector.multiply(dir, 0.3 * self.walk_velocity)
|
||||||
|
|
||||||
|
if dir2 and stay_away_from_player then
|
||||||
|
self.acc = vector.add(dir2, stay_away_from_player)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:set_velocity(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if dist > 30 then self.acc = vector.add(self.acc, vector.direction(s, p)*0.01) end
|
||||||
|
|
||||||
|
local side_cor = vector.new(0.7*math.cos(yaw), 0, 0.7*math.sin(yaw))
|
||||||
|
local m = self.object:get_pos() -- position of the middle head
|
||||||
|
local sr = self.object:get_pos() + side_cor -- position of side right head
|
||||||
|
local sl = self.object:get_pos() - side_cor -- position of side left head
|
||||||
|
-- height corrections
|
||||||
|
m.y = m.y + self.collisionbox[5]
|
||||||
|
sr.y = sr.y + self.collisionbox[5] - 0.3
|
||||||
|
sl.y = sl.y + self.collisionbox[5] - 0.3
|
||||||
|
local rand_pos = math.random(1,3)
|
||||||
|
if rand_pos == 1 then m = sr
|
||||||
|
elseif rand_pos == 2 then m = sl end
|
||||||
|
|
||||||
|
-- melee attack
|
||||||
|
if not self._melee_timer then
|
||||||
|
self._melee_timer = 0
|
||||||
|
end
|
||||||
|
if self._melee_timer < WITHER_MELEE_COOLDOWN then
|
||||||
|
self._melee_timer = self._melee_timer + dtime
|
||||||
|
else
|
||||||
|
self._melee_timer = 0
|
||||||
|
local pos = table.copy(s)
|
||||||
|
pos.y = pos.y + 2
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos, self.reach)
|
||||||
|
local obj_pos, dist
|
||||||
|
local hit_some = false
|
||||||
|
for n = 1, #objs do
|
||||||
|
objs[n]:punch(objs[n], 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = 4},
|
||||||
|
}, pos)
|
||||||
|
local ent = objs[n]:get_luaentity()
|
||||||
|
if objs[n]:is_player() or (ent and ent ~= self and (not ent._shooter or ent._shooter ~= self)) then
|
||||||
|
mcl_util.deal_damage(objs[n], 8, {type = "magic"})
|
||||||
|
hit_some = true
|
||||||
|
end
|
||||||
|
mcl_mobs.effect_functions["withering"](objs[n], 0.5, 10)
|
||||||
|
end
|
||||||
|
if hit_some then
|
||||||
|
mcl_mobs.effect(pos, 32, "mcl_particles_soul_fire_flame.png", 5, 10, self.reach, 1, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if dist < self.reach then
|
||||||
|
self.shoot_interval = 3
|
||||||
|
else
|
||||||
|
self.shoot_interval = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.shoot_interval
|
||||||
|
and self.timer > self.shoot_interval
|
||||||
|
and not minetest.raycast(vector.add(m, vector.new(0,self.shoot_offset,0)), vector.add(self.attack:get_pos(), vector.new(0,1.5,0)), false, false):next()
|
||||||
|
and math.random(1, 100) <= 60 then
|
||||||
|
|
||||||
|
self.timer = 0
|
||||||
|
self:set_animation( "shoot")
|
||||||
|
|
||||||
|
-- play shoot attack sound
|
||||||
|
self:mob_sound("shoot_attack")
|
||||||
|
|
||||||
|
-- Shoot arrow
|
||||||
|
if minetest.registered_entities[self.arrow] then
|
||||||
|
|
||||||
|
local arrow, ent
|
||||||
|
local v = 1
|
||||||
|
if not self.shoot_arrow then
|
||||||
|
self.firing = true
|
||||||
|
minetest.after(1, function()
|
||||||
|
self.firing = false
|
||||||
|
end)
|
||||||
|
arrow = minetest.add_entity(m, self.arrow)
|
||||||
|
ent = arrow:get_luaentity()
|
||||||
|
if ent.velocity then
|
||||||
|
v = ent.velocity
|
||||||
|
end
|
||||||
|
ent.switch = 1
|
||||||
|
ent.owner_id = tostring(self.object) -- add unique owner id to arrow
|
||||||
|
|
||||||
|
-- important for mcl_shields
|
||||||
|
ent._shooter = self.object
|
||||||
|
ent._saved_shooter_pos = self.object:get_pos()
|
||||||
|
end
|
||||||
|
|
||||||
|
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||||
|
-- offset makes shoot aim accurate
|
||||||
|
vec.y = vec.y + self.shoot_offset
|
||||||
|
vec.x = vec.x * (v / amount)
|
||||||
|
vec.y = vec.y * (v / amount)
|
||||||
|
vec.z = vec.z * (v / amount)
|
||||||
|
if self.shoot_arrow then
|
||||||
|
vec = vector.normalize(vec)
|
||||||
|
self:shoot_arrow(m, vec)
|
||||||
|
else
|
||||||
|
arrow:set_velocity(vec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_punch = function(self, hitter, tflp, tool_capabilities, dir)
|
||||||
|
if self._spawning or hitter == self.object then return false end
|
||||||
|
local ent = hitter:get_luaentity()
|
||||||
|
if ent and self._arrow_resistant and (string.find(ent.name, "arrow") or string.find(ent.name, "rocket")) then return false end
|
||||||
|
wither_unstuck(self)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
deal_damage = function(self, damage, mcl_reason)
|
||||||
|
if self._spawning then return end
|
||||||
|
if self._arrow_resistant and mcl_reason.type == "magic" then return end
|
||||||
|
wither_unstuck(self)
|
||||||
|
self.health = self.health - damage
|
||||||
|
end,
|
||||||
|
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
|
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
|
||||||
|
self._custom_timer = 0.0
|
||||||
|
self._death_timer = 0.0
|
||||||
|
self._health_old = self.hp_max
|
||||||
|
self._spawning = 10
|
||||||
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
|
||||||
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
|
local wither_rose_soil = { "group:grass_block", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_nether:netherrack", "group:soul_block", "mcl_mud:mud", "mcl_moss:moss" }
|
||||||
|
local function spawn_wither_rose(obj)
|
||||||
mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
local n = minetest.find_node_near(obj:get_pos(),2,wither_rose_soil)
|
||||||
visual = "sprite",
|
|
||||||
visual_size = {x = 0.75, y = 0.75},
|
|
||||||
-- TODO: 3D projectile, replace tetxture
|
|
||||||
textures = {"mobs_mc_TEMP_wither_projectile.png"},
|
|
||||||
velocity = 6,
|
|
||||||
|
|
||||||
-- direct hit
|
|
||||||
hit_player = function(self, player)
|
|
||||||
player:punch(self.object, 1.0, {
|
|
||||||
full_punch_interval = 0.5,
|
|
||||||
damage_groups = {fleshy = 8},
|
|
||||||
}, nil)
|
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1)
|
|
||||||
end,
|
|
||||||
|
|
||||||
hit_mob = function(self, mob)
|
|
||||||
mob:punch(self.object, 1.0, {
|
|
||||||
full_punch_interval = 0.5,
|
|
||||||
damage_groups = {fleshy = 8},
|
|
||||||
}, nil)
|
|
||||||
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1)
|
|
||||||
local l = mob:get_luaentity()
|
|
||||||
if l and l.health - 8 <= 0 then
|
|
||||||
local n = minetest.find_node_near(mob:get_pos(),2,wither_rose_soil)
|
|
||||||
if n then
|
if n then
|
||||||
local p = vector.offset(n,0,1,0)
|
local p = vector.offset(n,0,1,0)
|
||||||
if minetest.get_node(p).name == "air" then
|
if minetest.get_node(p).name == "air" then
|
||||||
|
@ -118,6 +448,53 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
|
visual = "cube",
|
||||||
|
visual_size = {x = 0.3, y = 0.3},
|
||||||
|
textures = {
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:0", -- top
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:1", -- bottom
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:2", -- left
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:3", -- right
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:4", -- back
|
||||||
|
"mobs_mc_wither_projectile.png^[verticalframe:6:5", -- front
|
||||||
|
},
|
||||||
|
velocity = 7,
|
||||||
|
rotate = 90,
|
||||||
|
_lifetime = 15,
|
||||||
|
on_punch = function(self) end,
|
||||||
|
|
||||||
|
-- direct hit
|
||||||
|
hit_player = function(self, player)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||||
|
player:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 8},
|
||||||
|
}, nil)
|
||||||
|
mcl_mobs.mob_class.boom(self, pos, 1)
|
||||||
|
if player:get_hp() <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(player)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
hit_mob = function(self, mob)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||||
|
mob:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 8},
|
||||||
|
}, nil)
|
||||||
|
mcl_mobs.mob_class.boom(self, pos, 1)
|
||||||
|
local l = mob:get_luaentity()
|
||||||
|
if l and l.health - 8 <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(mob)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -126,10 +503,75 @@ mcl_mobs.register_arrow("mobs_mc:wither_skull", {
|
||||||
mcl_mobs.mob_class.boom(self,pos, 1)
|
mcl_mobs.mob_class.boom(self,pos, 1)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
-- TODO: Add blue wither skull
|
mcl_mobs.register_arrow("mobs_mc:wither_skull_strong", {
|
||||||
|
visual = "cube",
|
||||||
|
visual_size = {x = 0.35, y = 0.35},
|
||||||
|
textures = {
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:0", -- top
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:1", -- bottom
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:2", -- left
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:3", -- right
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:4", -- back
|
||||||
|
"mobs_mc_wither_projectile_strong.png^[verticalframe:6:5", -- front
|
||||||
|
},
|
||||||
|
velocity = 4,
|
||||||
|
rotate = 90,
|
||||||
|
_lifetime = 25,
|
||||||
|
on_punch = function(self) end,
|
||||||
|
|
||||||
|
-- direct hit
|
||||||
|
hit_player = function(self, player)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](player, 0.5, 10)
|
||||||
|
player:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 12},
|
||||||
|
}, nil)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
if player:get_hp() <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(player)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
hit_mob = function(self, mob)
|
||||||
|
local pos = vector.new(self.object:get_pos())
|
||||||
|
mcl_mobs.effect_functions["withering"](mob, 0.5, 10)
|
||||||
|
mob:punch(self.object, 1.0, {
|
||||||
|
full_punch_interval = 0.5,
|
||||||
|
damage_groups = {fleshy = 12},
|
||||||
|
}, nil)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
local l = mob:get_luaentity()
|
||||||
|
if l and l.health - 8 <= 0 then
|
||||||
|
local shooter = self._shooter:get_luaentity()
|
||||||
|
if shooter then shooter.health = shooter.health + 5 end
|
||||||
|
spawn_wither_rose(mob)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- node hit, explode
|
||||||
|
hit_node = function(self, pos, node)
|
||||||
|
if mobs_griefing and not minetest.is_protected(pos, "") then
|
||||||
|
mcl_explosions.explode(pos, 1, { drop_chance = 1.0, max_blast_resistance = 0, }, self.object)
|
||||||
|
else
|
||||||
|
mcl_mobs.mob_class.safe_boom(self, pos, 1) --need to call it this way bc self is the "arrow" object here
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
--Spawn egg
|
--Spawn egg
|
||||||
mcl_mobs.register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true)
|
mcl_mobs.register_egg("mobs_mc:wither", S("Wither"), "#4f4f4f", "#4f4f4f", 0, true)
|
||||||
|
|
||||||
mcl_wip.register_wip_item("mobs_mc:wither")
|
mcl_wip.register_wip_item("mobs_mc:wither")
|
||||||
mcl_mobs:non_spawn_specific("mobs_mc:wither","overworld",0,minetest.LIGHT_MAX+1)
|
mcl_mobs:non_spawn_specific("mobs_mc:wither","overworld",0,minetest.LIGHT_MAX+1)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ local wolf = {
|
||||||
head_swivel = "head.control",
|
head_swivel = "head.control",
|
||||||
bone_eye_height = 3.5,
|
bone_eye_height = 3.5,
|
||||||
head_eye_height = 1.1,
|
head_eye_height = 1.1,
|
||||||
horrizonatal_head_height=0,
|
horizontal_head_height=0,
|
||||||
curiosity = 3,
|
curiosity = 3,
|
||||||
head_yaw="z",
|
head_yaw="z",
|
||||||
sounds = {
|
sounds = {
|
||||||
|
@ -135,6 +135,7 @@ end
|
||||||
|
|
||||||
-- Tamed wolf (aka “dog”)
|
-- Tamed wolf (aka “dog”)
|
||||||
local dog = table.copy(wolf)
|
local dog = table.copy(wolf)
|
||||||
|
dog.description = S("Dog")
|
||||||
dog.can_despawn = false
|
dog.can_despawn = false
|
||||||
dog.passive = true
|
dog.passive = true
|
||||||
dog.hp_min = 20
|
dog.hp_min = 20
|
||||||
|
@ -224,7 +225,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
9000,
|
80,
|
||||||
7,
|
7,
|
||||||
mobs_mc.water_level+3,
|
mobs_mc.water_level+3,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
|
@ -243,7 +243,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
6000,
|
1000,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -332,7 +332,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
60000,
|
50,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -348,7 +348,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
6500,
|
2400,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
@ -362,7 +362,7 @@ mcl_mobs:spawn_specific(
|
||||||
0,
|
0,
|
||||||
7,
|
7,
|
||||||
30,
|
30,
|
||||||
65000,
|
120,
|
||||||
4,
|
4,
|
||||||
mcl_vars.mg_overworld_min,
|
mcl_vars.mg_overworld_min,
|
||||||
mcl_vars.mg_overworld_max)
|
mcl_vars.mg_overworld_max)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue