Compare commits

..

449 Commits

Author SHA1 Message Date
Elias Fleckenstein 0c5096db13 Merge pull request 'Fixes for german locales (2021-04-14_locales_german)' (#1564) from n_to/MineClone2:2021-04-14_locales_german into master
Reviewed-on: MineClone2/MineClone2#1564
2021-04-15 16:18:51 +00:00
NO11 3fbeab7c85 Merge pull request 'Make cactus destroy items' (#1567) from NO11/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1567
2021-04-15 13:21:46 +00:00
NO11 a8760c0375 Reduce the radius in which a cactus destroys items 2021-04-15 12:23:08 +00:00
NO11 bbffda3635 Make cactus destroy items 2021-04-15 11:21:15 +00:00
Nils Dagsson Moskopp 2575e20e7e Show preview of new banner pattern when crafting it 2021-04-15 13:25:59 +04:00
epCode 5fe30d7287 Make Zmbs, Husks, Sklys, Strys, and WthrSklys support armor textures. 2021-04-14 16:51:17 -07:00
Benjamin Schötz bffd032a8b Fixes my own typo ;) 2021-04-14 22:06:03 +02:00
Benjamin Schötz e4c8ba795a Fixes typos, grammar errors, and some translation flaws in several german translation files. 2021-04-14 22:03:36 +02:00
epCode 18cdd13c06 Partialy fix #1559 2021-04-14 11:01:50 -07:00
Lizzy Fleckenstein c41bd3932c Add global smoke spawning API 2021-04-14 18:14:21 +02:00
Elias Fleckenstein 76af838f4c Merge pull request 'Credit me' (#1558) from j1233/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1558
2021-04-14 15:15:19 +00:00
j1233 46b1762872 credit me
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_fireworks/README.txt#L3
2021-04-14 14:53:33 +00:00
j1233 a069406f40 credit me
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_fireworks/README.txt#L3
2021-04-14 14:52:00 +00:00
Elias Fleckenstein 97f8c92d95 Merge pull request 'Update README files' (#1544) from beta into master
Reviewed-on: MineClone2/MineClone2#1544
2021-04-14 14:38:02 +00:00
Lizzy Fleckenstein 963adfb4e2 Move @Code-Sploit to devs section 2021-04-14 16:37:07 +02:00
Lizzy Fleckenstein 6d0abb2973 Merge branch 'master' into beta 2021-04-14 16:36:04 +02:00
Nicu 36391d8583 Updated required Minetest version
5.0.0 -> 5.3.0
2021-04-14 10:18:56 +00:00
epCode 5b93ee5e40 Improve rocket 2021-04-13 17:07:28 -07:00
epCode 8d22102c66 remove abitrary minetest.chat_send_all( 2021-04-13 16:28:38 -07:00
epCode a93562a60c Merge pull request 'Add Firework Rocket for elytra boost' (#1551) from NO11/MineClone2:elytra_rocket into master
Reviewed-on: MineClone2/MineClone2#1551
2021-04-13 23:27:23 +00:00
epCode 399ed85717 Make flying w elytra use pitch and not sneak 2021-04-13 16:14:37 -07:00
jordan4ibanez 67c1bc973a Add lua locals into mcl_dungeons for performance 2021-04-14 01:19:01 +04:00
NO11 1c50f9aed6 fix typo 2021-04-13 20:52:55 +00:00
NO11 311c4dc3fb add old overlays 2021-04-13 20:41:54 +00:00
NO11 94e7bbfb80 add old overlays 2021-04-13 20:41:25 +00:00
NO11 7a14d1d593 delete new overlay 2021-04-13 20:40:08 +00:00
NO11 bc2a79cddf delete new overlay 2021-04-13 20:39:50 +00:00
NO11 52d7ffa78f delete new overlay 2021-04-13 20:39:46 +00:00
NO11 f768972469 add rocket texture (pixel perfection) 2021-04-13 20:38:00 +00:00
NO11 9c68528b8b add german translation 2021-04-13 20:36:41 +00:00
NO11 1597e093b5 Dateien hochladen nach „mods/ITEMS/mcl_fireworks/sounds“ 2021-04-13 20:35:40 +00:00
NO11 f15a28109c add rocket for elytra boost 2021-04-13 20:33:34 +00:00
NO11 81d0ce5ea7 add elytra to overlay.1 2021-04-13 19:12:40 +00:00
epCode f498d3ae02 make elytra activate mor MC-like 2021-04-13 11:45:31 -07:00
NO11 e334a71361 new overlay, village update 2021-04-13 16:57:15 +00:00
NO11 67fff50fc4 new overlays 2021-04-13 14:13:28 +00:00
NO11 e96eb79a3f delete old overlay 2021-04-13 14:09:28 +00:00
NO11 de3f236bf2 delete old overlay 2021-04-13 14:09:22 +00:00
NO11 940621b676 delete old overlay 2021-04-13 14:09:17 +00:00
NO11 9519c8ebaa delete old overlay 2021-04-13 14:09:09 +00:00
NO11 28719264df delete old overlay 2021-04-13 14:09:03 +00:00
NO11 4ac115cf90 delete old overlay 2021-04-13 14:08:57 +00:00
NO11 1f4ac3d8e0 Merge pull request 'Fix #1548' (#1) from MineClone2/MineClone2:master into master
Reviewed-on: NO11/MineClone2#1
2021-04-13 14:07:51 +00:00
Code-Sploit cd0d2d2296 Fix #1548 2021-04-13 13:57:45 +00:00
kay27 3077498a63 Fix screwdriver/door duplication glitch, MineClone2/MineClone2#1149 2021-04-13 16:49:10 +04:00
Code-Sploit 84764389dc Fix #1538 2021-04-13 11:34:53 +00:00
Lizzy Fleckenstein 78d387e2df Rewrite mcl_torches API 2021-04-13 09:59:51 +02:00
Lizzy Fleckenstein 421ab9f660 Add timeout to static hudbars 2021-04-13 08:42:17 +02:00
Lizzy Fleckenstein 422385ad02 Remove obsolete faithful flavor 2021-04-13 08:37:23 +02:00
Lizzy Fleckenstein 20bd91a14e Restore info about bonus features 2021-04-13 08:35:09 +02:00
Lizzy Fleckenstein 5ddd1d0193 Merge branch 'master' into beta 2021-04-13 08:33:31 +02:00
Lizzy Fleckenstein 037832a177 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-04-13 08:06:28 +02:00
epCode 424685d3d3 Add elytra (sprint in air to use) 2021-04-12 14:56:33 -07:00
Lizzy Fleckenstein 5028728fbc Merge branch 'master' into faithful 2021-04-12 17:54:20 +02:00
Lizzy Fleckenstein 6f770bc962 Fix crash in mcl_bossbars.remove_bar 2021-04-12 17:54:09 +02:00
Lizzy Fleckenstein 6887948718 Add info about different flavors 2021-04-12 17:36:44 +02:00
Lizzy Fleckenstein f540bc2bb1 Merge branch 'master' into beta 2021-04-12 17:31:58 +02:00
Lizzy Fleckenstein 5fb7913355 Revert "Revert "Merge pull request 'Add #490' (#1515) from NO11/MineClone2:master into master""
This reverts commit 615b15f133.
2021-04-12 16:36:08 +02:00
Lizzy Fleckenstein d3a3253563 Revert "Revert "Make hoe dig some blocks faster""
This reverts commit db5626fcb4.
2021-04-12 16:34:40 +02:00
Lizzy Fleckenstein c3868084af Revert "Fix crash with removed hoey diggroup"
This reverts commit ed7099fefc.
2021-04-12 16:34:25 +02:00
Lizzy Fleckenstein 0d5933b95e Remove debug printin mcl_mobs 2021-04-12 15:45:00 +02:00
Lizzy Fleckenstein 615b15f133 Revert "Merge pull request 'Add #490' (#1515) from NO11/MineClone2:master into master"
This reverts commit 7a8079bb64, reversing
changes made to 849823af1f.
2021-04-12 15:25:31 +02:00
Lizzy Fleckenstein ed7099fefc Fix crash with removed hoey diggroup 2021-04-12 15:18:19 +02:00
Lizzy Fleckenstein db5626fcb4 Revert "Make hoe dig some blocks faster"
This reverts commit c1e295de5f.
2021-04-12 15:05:01 +02:00
Lizzy Fleckenstein 523a0c54d6 Localize c_x and c_y in mcl_playerplus 2021-04-12 14:54:14 +02:00
Lizzy Fleckenstein e0feba115d Remove empty line 2021-04-12 14:35:25 +02:00
Lizzy Fleckenstein b914e088cc Update README files 2021-04-12 14:03:51 +02:00
Lizzy Fleckenstein c0a31f0e9c Fix #1535 2021-04-11 17:30:32 +02:00
Lizzy Fleckenstein 24f8f9166b Fix #1528 2021-04-11 17:29:05 +02:00
Lizzy Fleckenstein af044e6a96 Bossbars: Add support for non-mob bosses 2021-04-11 11:15:09 +02:00
Lizzy Fleckenstein 2313012f60 Fix #1528 2021-04-11 10:41:11 +02:00
epCode ce49cd02ac make player collision box MUCH closer to MC 2021-04-10 15:41:50 -07:00
kay27 40c733c913 [mobs_mc] Remove `goto` from enderman.lua 2021-04-11 02:11:14 +04:00
kay27 a76fe2b487 [mcl_mobs] Replace `goto` to `repeat-break-until true` in spawning.lua 2021-04-11 02:11:06 +04:00
kay27 b14ca5a843 Revert "[mcl_mobs, mobs_mc] TEMP! Remove `goto` to run on RasbPI4, Oil_boi free to revert"
This reverts commit ea41c82834.
2021-04-11 02:10:27 +04:00
epCode 3ff214ec2d lessen the push strength for players 2021-04-10 15:06:16 -07:00
epCode f6db31eae3 add criticle and sprint hits. 2021-04-10 14:47:26 -07:00
Lizzy Fleckenstein 9ba1917209 Add end crystal beams 2021-04-10 20:58:34 +02:00
kay27 ea41c82834 [mcl_mobs, mobs_mc] TEMP! Remove `goto` to run on RasbPI4, Oil_boi free to revert 2021-04-10 20:47:55 +02:00
Lizzy Fleckenstein 2116b2b9d0 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-04-10 20:05:09 +02:00
epCode 08b7340ff5 Fix crash with player near unknown object 2021-04-10 10:20:38 -07:00
kay27 7a8079bb64 Merge pull request 'Add #490' (#1515) from NO11/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1515
2021-04-10 12:21:19 +00:00
NO11 cdd12a0c71 Charcoal made from debarked wood 2021-04-10 11:19:51 +00:00
NO11 652f8d48ed Debark wood with an axe 2021-04-09 22:16:52 +00:00
NO11 988f298375 Add stripped wood crafting 2021-04-09 22:13:50 +00:00
NO11 c73cd8b810 Add stripped spruce textures 2021-04-09 22:11:32 +00:00
NO11 ebd4380c98 Add stripped oak textures 2021-04-09 22:10:47 +00:00
NO11 3d732c2412 Add stripped jungle textures 2021-04-09 22:10:10 +00:00
NO11 03e112ef9b Add stripped dark oak textures 2021-04-09 22:09:16 +00:00
NO11 9b81a4d83e Add stripped birch textures 2021-04-09 22:08:39 +00:00
NO11 cbcaef19c6 Add stripped acacia textures 2021-04-09 22:07:44 +00:00
NO11 9e5fb7f533 Add #490 2021-04-09 22:04:42 +00:00
epCode 849823af1f Add player pushing ;) 2021-04-09 14:33:14 -07:00
kay27 d50fd06c82 Revert "Attemp to fix #1513" in favour of next commit 3375e903ce
This reverts commit f5f6e232cc.
2021-04-09 19:03:45 +04:00
kay27 3375e903ce [mesecons] Fix attempt to call upvalue in internal.lua 2021-04-09 18:52:33 +04:00
AFCMS f5f6e232cc Attemp to fix #1513 2021-04-09 16:46:41 +02:00
Lizzy Fleckenstein c6ffccfef5 Add priority to bossbars; display bossbars of closest bosses first 2021-04-09 13:35:58 +02:00
Lizzy Fleckenstein cbd2731e06 Improve mcl_bossbars performance 2021-04-09 13:22:45 +02:00
kay27 a733eb8e0c [mesecons] Localise several things in internal.lua 2021-04-09 02:08:03 +04:00
Nils Dagsson Moskopp 7c8cf6f79f Do not crash server if world border is depowered 2021-04-09 01:33:22 +04:00
kay27 f0c2eb86a2 Revert (3/3) "Fix extreme mesecons/redstone crashing at world border"
This reverts commit 0842a36aa6.
2021-04-09 01:32:58 +04:00
kay27 26ce10d25c Revert (2/3) "Add erlehmann fix to redstone world border crash"
This reverts commit b9d175e6a5.
2021-04-09 01:32:27 +04:00
kay27 6b31e85385 Revert (1/3) "Revert fixes to crash world border"
This reverts commit 18f73ba31f.
2021-04-09 01:31:21 +04:00
jordan4ibanez 6279f5eb41 test 2021-04-08 23:58:12 +04:00
jordan4ibanez 9789cf5dcd Adjust spawning to be closer and more frequent 2021-04-08 23:58:12 +04:00
jordan4ibanez 26847bbb54 Finish mob limiter 2021-04-08 23:58:12 +04:00
jordan4ibanez 4fca50dead Fix spawn timer reset debug 2021-04-08 23:58:12 +04:00
jordan4ibanez 310dcf9660 Fix forgotten biome check 2021-04-08 23:58:11 +04:00
jordan4ibanez ba9866db49 merge 2021-04-08 23:58:11 +04:00
jordan4ibanez 282ba2614a merge 2021-04-08 23:58:11 +04:00
jordan4ibanez 26ef8c2674 Fix silverfish typo 2021-04-08 23:58:11 +04:00
jordan4ibanez f5cc2bab09 Readjust mobs internal settings to not cause insane memory usage 2021-04-08 23:58:11 +04:00
jordan4ibanez 71c50042e6 Fix typo 2021-04-08 23:58:11 +04:00
jordan4ibanez ae0c235c1f Combine air and ground type spawning into ground 2021-04-08 23:58:11 +04:00
jordan4ibanez 668b67158c merge 2021-04-08 23:58:11 +04:00
jordan4ibanez c259fc2a28 Add in all biome information to mobs 2021-04-08 23:58:11 +04:00
jordan4ibanez 249a3c8891 Add bats, chicken, and blaze spawn info 2021-04-08 23:58:11 +04:00
jordan4ibanez 34b66acc9d Make reference list copy-pastable 2021-04-08 23:58:11 +04:00
jordan4ibanez 89f35c06af Ignore default or void dimensions 2021-04-08 23:58:11 +04:00
jordan4ibanez cb093b774c Add biome list 2021-04-08 23:58:10 +04:00
jordan4ibanez abc68f4dc6 Refactor spawning into it's own file 2021-04-08 23:58:10 +04:00
jordan4ibanez 38dcbcb3d4 Fix mobs colliding with other mobs/players 2021-04-08 23:58:10 +04:00
jordan4ibanez d65a5e3be0 Fix mobs colliding with objects 2021-04-08 23:58:10 +04:00
kay27 de41a4c26b merge 2021-04-08 23:58:10 +04:00
kay27 5e0bd2281c Revert "Revert "Merge pull request 'Massively overhaul spawning algorithm for mobs' (#1487) from jordan4ibanez/MineClone2-MobTweaks:master into master""
This reverts commit 6a1a634cba.
2021-04-08 23:58:10 +04:00
jordan4ibanez 346efee399 Merge pull request 'Revert fixes to crash world border' (#1510) from jordan4ibanez/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1510
2021-04-08 19:49:26 +00:00
jordan4ibanez 18f73ba31f Revert fixes to crash world border 2021-04-08 15:48:53 -04:00
jordan4ibanez 213d24cc86 Merge pull request 'Add erlehmann fix to redstone world border crash' (#1509) from jordan4ibanez/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1509
2021-04-08 19:17:24 +00:00
jordan4ibanez b9d175e6a5 Add erlehmann fix to redstone world border crash 2021-04-08 15:16:38 -04:00
jordan4ibanez fa95545252 Merge pull request 'Fix extreme mesecons/redstone crashing at world border' (#1508) from jordan4ibanez/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1508
2021-04-08 18:29:30 +00:00
jordan4ibanez 0842a36aa6 Fix extreme mesecons/redstone crashing at world border 2021-04-08 14:28:07 -04:00
iliekprogrammar 18ee1d476a Merge remote-tracking branch 'upstream/master' 2021-04-08 19:30:46 +08:00
iliekprogrammar d50665d2d5 Allow kelp stems at half height to be treated like full-sized ones.
Remove debug information
2021-04-08 19:25:19 +08:00
AFCMS e228c1d70b Merge branch 'master' of ssh://git.minetest.land:29418/MineClone2/MineClone2 2021-04-08 09:10:35 +02:00
iliekprogrammar 5ccb12586d Fix bug where incorrect number of items are dropped. 2021-04-08 13:35:49 +08:00
iliekprogrammar 2db0e176b3 Prevent param2 overflow when adding stems. Fix #1490 2021-04-08 12:46:04 +08:00
kay27 8e30bc8dbd [mcl_portals] Prevent from spawning Nether portals in Undertale when not enough air space in Nether 2021-04-08 02:54:33 +04:00
AFCMS f7ddfe2891 Revert "fix add_bar function returning nil value"
This reverts commit 11114c6847.
2021-04-07 23:54:40 +02:00
AFCMS 11114c6847 fix add_bar function returning nil value 2021-04-07 23:54:36 +02:00
Lizzy Fleckenstein d77affca91 Change max_bossbars default to 4 2021-04-07 17:39:13 +02:00
Lizzy Fleckenstein 6a1a634cba Revert "Merge pull request 'Massively overhaul spawning algorithm for mobs' (#1487) from jordan4ibanez/MineClone2-MobTweaks:master into master"
This reverts commit 4f2a6b2db0, reversing
changes made to 0970981252.
2021-04-07 17:20:56 +02:00
Lizzy Fleckenstein 6c35ff1fc5 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-04-07 17:02:46 +02:00
Lizzy Fleckenstein 567f157541 Add a bossbar limit setting 2021-04-07 17:02:03 +02:00
Lizzy Fleckenstein f282cd0c4d Allow bossbars to be grouped 2021-04-07 16:56:21 +02:00
Lizzy Fleckenstein 3449b3eb7c Improve bossbars API 2021-04-07 16:47:14 +02:00
iliekprogrammar 986ae950ec Merge remote-tracking branch 'upstream/master' 2021-04-07 22:30:44 +08:00
iliekprogrammar 61cef21cd1 Add right-to-left statbars, for hunger and air. 2021-04-07 22:26:42 +08:00
TechDudie db9e8d23d9 Update 'mods/ENTITIES/mobs_mc/creeper.lua' 2021-04-07 17:16:38 +04:00
TechDudie f664a87dac Update 'mods/ENTITIES/mobs_mc/creeper.lua' 2021-04-07 17:16:38 +04:00
Lizzy Fleckenstein 6e2a7c8a7e Make gateway enderpearl teleports easier 2021-04-07 13:47:48 +02:00
Lizzy Fleckenstein c451866a36 Fix #1426 2021-04-07 09:56:00 +02:00
Lizzy Fleckenstein 3c1a38904a Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-04-07 09:25:44 +02:00
Lizzy Fleckenstein b2c09c8ba0 Add gateway portals 2021-04-07 09:17:13 +02:00
jordan4ibanez 4f2a6b2db0 Merge pull request 'Massively overhaul spawning algorithm for mobs' (#1487) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1487
2021-04-07 06:40:21 +00:00
jordan4ibanez ec6eb51726 Massively overhaul spawning algorithm for mobs 2021-04-07 02:39:15 -04:00
jordan4ibanez 6cdf7c98c2 Rework all mobs spawning - preprototype stage 2021-04-07 00:55:57 -04:00
jordan4ibanez 0970981252 Merge pull request 'Adjust enderman projectile behavior, add snowballs to avoidance' (#1485) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1485
2021-04-07 02:22:44 +00:00
jordan4ibanez 6c4c22e3b9 Adjust enderman projectile behavior, add snowballs to avoidance 2021-04-06 22:22:05 -04:00
jordan4ibanez 9b1cc19718 Merge pull request 'Make mobs not collide with objects to stop weird glitches' (#1484) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1484
2021-04-07 02:08:39 +00:00
jordan4ibanez 7cecc71b91 Make mobs not collide with objects to stop weird glitches 2021-04-06 22:08:10 -04:00
jordan4ibanez da057ee9e8 Merge pull request 'Increase unmounting force' (#1483) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1483
2021-04-07 02:03:25 +00:00
jordan4ibanez 6aaf25bbc9 Increase unmounting force 2021-04-06 22:02:52 -04:00
jordan4ibanez 7826311175 Merge pull request 'Make unmounting a mob less of a jolt' (#1482) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1482
2021-04-07 02:00:32 +00:00
jordan4ibanez 4a1faa44de Make unmounting a mob less of a jolt 2021-04-06 21:59:51 -04:00
jordan4ibanez 8ab9de74dc Merge pull request 'Add line of sight calculations to the enderman' (#1481) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1481
2021-04-07 01:30:19 +00:00
jordan4ibanez acd2b8e691 Add line of sight calculations to the enderman 2021-04-06 21:29:52 -04:00
jordan4ibanez 21334bc49d Merge pull request 'Massive enderman sight check calculation overhaul' (#1480) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1480
2021-04-07 01:15:40 +00:00
jordan4ibanez 56f94af6ce Massively overhaul enderman sight calculations 2021-04-06 21:13:20 -04:00
jordan4ibanez 9f7899c01a Enderman use vectors to check distance between player and self 2021-04-06 20:37:48 -04:00
jordan4ibanez 4ec3fd0ba6 Merge pull request 'Fix insane enderman 64 node radius check for players' (#1479) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1479
2021-04-07 00:25:52 +00:00
jordan4ibanez 00db03320b Fix insane enderman 64 node radius check for players 2021-04-06 20:24:46 -04:00
kay27 069e089ae4 [mcl_portals, mcl_structures] Add End gateways W-I-P by Elias Fleckenstein with minor portals improvements and fixes 2021-04-07 03:34:15 +04:00
Lizzy Fleckenstein 430f958fae Move end exit portal to 0, 0; Add end gateway portals (WIP) 2021-04-06 20:08:20 +02:00
Lizzy Fleckenstein f65c40f805 Make dragon egg teleport on punching 2021-04-06 17:20:11 +02:00
jordan4ibanez 9e1b662c03 Merge pull request 'Remove 47 node object check from mobs' (#1473) from jordan4ibanez/MineClone2-MobTweaks:master into master
Reviewed-on: MineClone2/MineClone2#1473
2021-04-06 14:41:03 +00:00
jordan4ibanez 8e2493dd9a Remove 47 node object check from mobs 2021-04-06 10:40:16 -04:00
Elias Fleckenstein 89a9b16465 Merge pull request 'Add End Credits' (#1469) from credits into master
Reviewed-on: MineClone2/MineClone2#1469
2021-04-06 14:39:47 +00:00
Lizzy Fleckenstein ea08fee9ba Make the dragon stay within a 50 blocks range of the portal 2021-04-06 16:38:23 +02:00
Lizzy Fleckenstein 3c73ad3b98 Add ztianyang to credits 2021-04-06 16:06:44 +02:00
Lizzy Fleckenstein 91e2372df0 Merge branch 'master' into credits 2021-04-06 16:06:12 +02:00
Elias Fleckenstein 058c6ef9f4 Merge pull request 'Fix chest entity textures' (#1472) from Doloment/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1472
2021-04-06 14:03:30 +00:00
Lizzy Fleckenstein 38a12e59da Fix comment indentation in wieldview 2021-04-06 16:02:18 +02:00
Lizzy Fleckenstein 1d587b8895 Fix crash in wieldview 2021-04-06 15:59:59 +02:00
Lizzy Fleckenstein 83b9cf3ad2 End exit portal openng / closing on dragon death / spawn 2021-04-06 15:48:17 +02:00
Doloment 31a7a4fbb6 Merge branch 'master' into master 2021-04-06 13:42:07 +00:00
Lizzy Fleckenstein 962a13847e Fix dragons summoned using commands spawning an egg on the exit portal 2021-04-06 14:57:29 +02:00
Lizzy Fleckenstein f350fa6272 Add bossbars 2021-04-06 14:50:34 +02:00
Doloment 055c406d7a Fix chest entity textures (trapped chests were lighter) 2021-04-06 18:57:06 +07:00
Lizzy Fleckenstein a348909ba3 Enderdragon: Proper Egg and XP spawning 2021-04-06 12:50:36 +02:00
Lizzy Fleckenstein 5bdb3bc274 Add MineClone5 section to credits 2021-04-06 12:14:43 +02:00
Lizzy Fleckenstein ba15f01ca9 Add translations; Duplicate listing of people 2021-04-06 12:08:25 +02:00
Lizzy Fleckenstein c93a865098 Remove empty line from mcl_portals 2021-04-06 11:59:22 +02:00
Lizzy Fleckenstein d07e415b37 Add credits screen 2021-04-06 11:55:21 +02:00
Lizzy Fleckenstein 175cb44fb1 Merge branch 'master' into credits 2021-04-06 10:53:15 +02:00
AFCMS 91da727184 Merge branch 'master' of ssh://git.minetest.land:29418/MineClone2/MineClone2 2021-04-05 15:22:57 +02:00
AFCMS 339e3e2792 fix some tools not using right var 2021-04-05 14:32:48 +02:00
kay27 beb2484224 Merge MineClone2/MineClone2#1366 2021-04-05 13:50:26 +04:00
AFCMS 28402ca663 store tool wield scale in a global var 2021-04-05 10:16:56 +02:00
Lizzy Fleckenstein e407ad2254 Fix #1447 2021-04-05 09:25:03 +02:00
Elias Fleckenstein b1c4476a04 Merge pull request 'Add End main island generation' (#1459) from end_main_island into master
Reviewed-on: MineClone2/MineClone2#1459
2021-04-05 07:02:48 +00:00
kay27 b1f27dba6a Merge pull request 'Make horse taming more similar to minecraft (#1249)' (#1460) from slaesvuo/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1460
2021-04-05 01:00:17 +00:00
kay27 4bc93040d5 Merge pull request 'Fix large and small slimes and magma cubes not dropping xp and loot' (#1461) from ztianyang/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1461
2021-04-05 00:58:18 +00:00
kay27 5fc3bb11ef [tools] Add simple python script to entirely reset End dimension generated before and get fresh one, improved (but please stop server & backup world before) 2021-04-05 04:54:58 +04:00
ztianyang 1e1d31b57b Merge branch 'master' into master 2021-04-04 23:57:20 +00:00
epCode a6f0ad13a0 Make blaze burning better 2021-04-04 16:46:44 -07:00
epCode 93684baa86 Make Blazes have more Mc-likeness ;) 2021-04-04 16:32:58 -07:00
Tianyang Zhang 8bb8a0e3b2 Fix large and small slimes and magma cubes not dropping xp and loot 2021-04-04 15:40:10 -07:00
Saku Laesvuori c5e1734c1c Make horse taming more similar to minecraft (#1249)
In minecraft horses are tamed by trying to ride them and they can also
be fed to speed up taming. This commit implements both of those
features and disables the old and broken taming system for horses.
2021-04-04 23:24:28 +03:00
Lizzy Fleckenstein 90f312f772 Add credits overlay prototype 2021-04-04 19:13:46 +02:00
Lizzy Fleckenstein 1144006cdd Add End main island generation 2021-04-04 15:16:06 +02:00
kay27 f54f4ebcf9 Merge pull request 'Fix passive mobs despawning' (#1458) from slaesvuo/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1458
2021-04-04 10:18:36 +00:00
Lizzy Fleckenstein 598692cf8c Add nil check to prevent crashes with mcl_throwing 2021-04-04 12:10:21 +02:00
Lizzy Fleckenstein ff538d51bd Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-04-04 12:01:59 +02:00
Lizzy Fleckenstein 49446bbb7b Make enderdragon spawn upon exit portal generation 2021-04-04 12:01:45 +02:00
Saku Laesvuori 4a085c9526 Fix passive mobs despawning
According to the wiki most passive mobs do not despawn. The ones that do
have already been explicity marked as despawning.

<https://minecraft.fandom.com/wiki/Spawn#Despawning>
<https://minecraft.fandom.com/wiki/Mob#Despawning>
2021-04-04 09:15:25 +03:00
epCode ac87e0604e make ghast firing more MC-like 2021-04-03 18:39:20 -07:00
jordan4ibanez f8229def5e Merge pull request 'Fix locationless playing when picking up items' (#1457) from jordan4ibanez/MineClone2-PopSounds:master into master
Reviewed-on: MineClone2/MineClone2#1457
2021-04-04 01:10:19 +00:00
jordan4ibanez 90fd65ac66 Fix locationless playing 2021-04-03 21:09:43 -04:00
epCode 40b07e466b make ghast fireballs deflectible 2021-04-03 18:07:51 -07:00
jordan4ibanez 0b0a180343 Merge pull request 'Fix local name memory leak' (#1456) from jordan4ibanez/MineClone2-PopSounds:master into master
Reviewed-on: MineClone2/MineClone2#1456
2021-04-04 01:05:56 +00:00
jordan4ibanez 1b511936f5 Fix local name memory leak 2021-04-03 21:05:31 -04:00
jordan4ibanez 441ce5522a Merge pull request 'Adjust the volume even more to perfectly match the gameplay' (#1455) from jordan4ibanez/MineClone2-PopSounds:master into master
Reviewed-on: MineClone2/MineClone2#1455
2021-04-04 00:56:17 +00:00
jordan4ibanez a807ee6372 Adjust the volume even more to perfectly match the gameplay 2021-04-03 20:55:46 -04:00
jordan4ibanez f1863baedc Merge pull request 'Adjust volume and pitch of item collection sound' (#1454) from jordan4ibanez/MineClone2-PopSounds:master into master
Reviewed-on: MineClone2/MineClone2#1454
2021-04-04 00:54:33 +00:00
jordan4ibanez 0641f09915 Adjust volume of item collection sound 2021-04-03 20:53:34 -04:00
jordan4ibanez bb6cce06e5 Merge pull request 'Add sound buffer and different item collection sound' (#1453) from jordan4ibanez/MineClone2-PopSounds:master into master
Reviewed-on: MineClone2/MineClone2#1453
2021-04-04 00:39:52 +00:00
jordan4ibanez c572db92aa Add sound buffer and different item collection sound 2021-04-03 20:39:08 -04:00
jordan4ibanez b14bc21829 Minor update to home directory warning in minetest.conf 2021-04-03 05:26:08 +00:00
jordan4ibanez 269ed6b3eb Merge pull request 'Update tick rate to 0.05 ticks per second (20 tps)' (#1446) from jordan4ibanez/MineClone2-TickRateAdjustment:master into master
Reviewed-on: MineClone2/MineClone2#1446
2021-04-03 05:22:50 +00:00
jordan4ibanez da3d5025a8 Update tick rate to 0.05 ticks per second (20 tps) 2021-04-03 01:22:13 -04:00
jordan4ibanez 43c47bbe0f Merge pull request 'Revert to previous style of interpolated move_to with tweaks' (#1445) from jordan4ibanez/MineClone2-ManualItemPickupInterpolation:master into master
Reviewed-on: MineClone2/MineClone2#1445
2021-04-03 02:02:58 +00:00
jordan4ibanez 844db8aa7b Revert to previous style of interpolated move_to with tweaks 2021-04-02 22:02:19 -04:00
jordan4ibanez 22cbfa32de Merge pull request 'Adjust the item collection magnet even more' (#1444) from jordan4ibanez/MineClone2-ManualItemPickupInterpolation:master into master
Reviewed-on: MineClone2/MineClone2#1444
2021-04-03 01:58:08 +00:00
jordan4ibanez 0840ad98a2 Adjust the item collection magnet even more 2021-04-02 21:57:38 -04:00
jordan4ibanez ea54936d28 Merge pull request 'Smoothen out item collection to accommodate for move_to interpolation issues' (#1443) from jordan4ibanez/MineClone2-ManualItemPickupInterpolation:master into master
Reviewed-on: MineClone2/MineClone2#1443
2021-04-03 01:52:18 +00:00
jordan4ibanez 1cbd3a998d Use manual move_to to account for move_to interpolation issues 2021-04-02 21:50:47 -04:00
jordan4ibanez 61e812e40a Add in manual interpolation into the item magnet 2021-04-02 21:40:04 -04:00
jordan4ibanez b83b4c55fa Merge pull request 'More fixes to item collection on laggy servers' (#1442) from jordan4ibanez/MineClone2-FixA:master into master
Reviewed-on: MineClone2/MineClone2#1442
2021-04-03 00:43:42 +00:00
jordan4ibanez 18d7be4a4f More fixes to item collection on laggy servers 2021-04-03 00:42:20 -04:00
AFCMS b68c4b07c1 tweak hudbars 2021-04-02 17:20:19 +02:00
AFCMS ca01b3641b make endermen not teleport everytime when hitted 2021-04-02 15:04:21 +02:00
AFCMS 0db47dbf02 Merge branch 'remove-alpha-field' 2021-04-02 14:43:08 +02:00
AFCMS 59d687c579 fix API.md 2021-04-02 14:30:46 +02:00
AFCMS c457c4ce3c fix undeacleared vars in mcl_fishing 2021-04-02 14:28:43 +02:00
AFCMS ead33e3520 fix undeacleared vars in mcl_throwing 2021-04-02 14:27:35 +02:00
AFCMS e20e0fab71 remobe backward compatibility for portals 2021-04-02 14:16:14 +02:00
AFCMS 695ad9120b remove backward compatibility for water 2021-04-02 14:12:44 +02:00
AFCMS 0da8339352 Merge pull request 'Fix #1391' (#1438) from NO11/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1438
2021-04-02 11:11:45 +00:00
NO11 39aaf0f21f Fix #1391 2021-04-02 11:09:45 +00:00
AFCMS c0fcbffd70 Merge pull request 'doc-refactoring part 1' (#1437) from doc-refactoring into master
Reviewed-on: MineClone2/MineClone2#1437
2021-04-02 08:31:09 +00:00
AFCMS cbc1052f6b Merge branch 'master' into doc-refactoring 2021-04-02 10:27:22 +02:00
jordan4ibanez 5f361cde29 Merge pull request 'Remove debug info from item magnet' (#1436) from jordan4ibanez/MineClone2-whoopsies:master into master
Reviewed-on: MineClone2/MineClone2#1436
2021-04-02 05:54:33 +00:00
jordan4ibanez 1e3676c391 Remove debug info from item magnet 2021-04-02 05:38:53 +00:00
kay27 fd51910b89 Merge pull request 'Fix item drop on laggy servers' (#1435) from jordan4ibanez/MineClone2-FixItemDrop:master into master
Reviewed-on: MineClone2/MineClone2#1435
2021-04-02 05:11:06 +00:00
jordan4ibanez 2f272b3dff Fix item drop on laggy servers 2021-04-01 23:48:00 -04:00
epCode 0dbe66f3b4 make mob drops similar to MC 2021-04-01 14:12:07 -07:00
AFCMS 15803fddc2 Merge branch 'master' into doc-refactoring 2021-03-31 20:33:37 +02:00
epCode 5356e97b77 fix copy/pasted arrow texture to pixel-perfection 2021-03-31 11:23:59 -07:00
AFCMS 626990adeb Merge branch 'master' into doc-refactoring 2021-03-31 16:15:34 +02:00
iliekprogrammar c44054b51c Merge pull request 'Implement MC-like kelps in terms of growing and destroying' (#1354) from iliekprogrammar/MineClone2:kelp into master
Reviewed-on: MineClone2/MineClone2#1354
2021-03-31 11:57:59 +00:00
iliekprogrammar 9885f36c62 Fix missing age metadata and timer initialization in on_place. 2021-03-31 19:27:57 +08:00
iliekprogrammar bfff643ff4 Allow age to override during initialization. 2021-03-31 17:38:38 +08:00
iliekprogrammar ccea673dcc Fix updating age metadata. Remove kelp.lock_drop. 2021-03-31 17:31:28 +08:00
iliekprogrammar 08e280d9b4 Comment out debug stuff 2021-03-31 14:17:50 +08:00
iliekprogrammar 52c788f197 Merge branch 'master' into kelp 2021-03-31 13:59:27 +08:00
iliekprogrammar 089d6aa5c8 Add dug sounds to kelp when unsubmerged 2021-03-31 13:55:07 +08:00
iliekprogrammar 9518086b6b Kelp store age metadata by bulk on a queue, improve API, etc.
Highlights:
- Implement storing age metadata by bulk on a queue, with maximum interval and queue length.
- "Flexible" initial growth probability. Will provide helper APIs.
- Fix various bugs with unsubmerged kelp detection, submerged tip detection, age metadata.
- Various optimizations.
2021-03-31 13:41:52 +08:00
AFCMS 0740854b5d Merge branch 'master' into doc-refactoring 2021-03-30 22:28:48 +02:00
epCode 86b63c8bc4 Make player model easier to use 2021-03-30 13:26:46 -07:00
epCode 38e4e7293a fix female player anim XD 2021-03-30 10:29:46 -07:00
epCode 97424f7d0a Fix #1414 2021-03-30 10:24:39 -07:00
epCode a14959ac70 add player death animation and particles 2021-03-30 09:53:55 -07:00
AFCMS 3b8916ef65 Merge branch 'master' of ssh://git.minetest.land:29418/MineClone2/MineClone2 2021-03-30 15:48:18 +02:00
AFCMS a040355dce Revert "Revert "Revert "improve wieldview API (!)"""
This reverts commit d4e0d4d1c1.
2021-03-30 01:00:51 +02:00
AFCMS d4e0d4d1c1 Revert "Revert "improve wieldview API (!)""
This reverts commit 613779a851.
2021-03-30 01:00:17 +02:00
AFCMS c35dab1d08 try to fix crash 2021-03-30 00:59:52 +02:00
AFCMS 613779a851 Revert "improve wieldview API (!)"
This reverts commit 600e8bede2.
2021-03-30 00:59:00 +02:00
AFCMS 59c13b6df8 Revert "Revert "remove hard depend to mcl_wip in mcl_minecarts""
This reverts commit 857a0c5565.
2021-03-30 00:58:45 +02:00
AFCMS 857a0c5565 Revert "remove hard depend to mcl_wip in mcl_minecarts"
This reverts commit 369c8b9b8a.
2021-03-30 00:58:36 +02:00
AFCMS 41a8cd0e15 Revert "Revert "remove hard depend to mcl_wip in mcl_minecarts""
This reverts commit 7a5c2d617b.
2021-03-30 00:58:02 +02:00
AFCMS 7a5c2d617b Revert "remove hard depend to mcl_wip in mcl_minecarts"
This reverts commit 369c8b9b8a.
2021-03-30 00:57:46 +02:00
AFCMS 369c8b9b8a remove hard depend to mcl_wip in mcl_minecarts 2021-03-30 00:54:58 +02:00
AFCMS 7ec7012572 fix indentation 2021-03-30 00:50:58 +02:00
AFCMS c70ea7c843 fix crash :-/
I am stupid
2021-03-30 00:49:54 +02:00
AFCMS f60941003d fix the stupidiest typo ever :-/ 2021-03-30 00:49:05 +02:00
AFCMS 3a514ecdad remove duplicated code 2021-03-30 00:44:38 +02:00
AFCMS 600e8bede2 improve wieldview API (!)
to support transform registration without groups
this will make detaching screwdriver from mcl more easy
2021-03-30 00:35:29 +02:00
AFCMS 84819bf9f5 MAKE EVERY SINGLE MOD USE PROPER COLORS!!! 2021-03-30 00:01:29 +02:00
AFCMS f8a627915e use proper colors in mcl_books 2021-03-29 22:57:05 +02:00
AFCMS a2fcd28a3d use proper colors in mcl_skins 2021-03-29 22:23:00 +02:00
AFCMS f51deb0737 use propers colors in mcl_jukebox 2021-03-29 22:21:14 +02:00
epCode 5a7d128861 Add wither functions from MC 2021-03-29 11:29:39 -07:00
Elias Fleckenstein 68d49a43b2 Merge pull request 'Prevent beds from appearing and disappearing if they cannot be placed, fix #1419' (#1423) from ArTee3/MineClone2:fix-bed-placement into master
Reviewed-on: MineClone2/MineClone2#1423
2021-03-29 16:23:45 +00:00
ArTee3 1b9737b431 Prevent beds from appearing and disappearing if they cannot be placed, fix #1419 2021-03-29 18:19:46 +02:00
iliekprogrammar ecdbc30b63 Overhaul kelp interactions.
Highlights:
- Added locking system to drops. Will be removed after testing.
- Expose more variables and functions. Will be finalized soon.
- Implement MC-like age and natural growth mechanics.
- Implement correct piston interactions with kelp and its surface.
- Implement correct falling node interactions for its surface.
- ABMs are now nonfunction. Will be fixed.
- Various optimizations and fixes.
2021-03-29 14:09:09 +08:00
kay27 d1a0299b92 [mcl_dungeons] Remove empty code section, add debug info 2021-03-29 03:34:41 +04:00
kay27 80d845adb6 [mcl_mapgen_core] Fix Nether generation chain reaction 2021-03-29 03:18:17 +04:00
kay27 2e3a5efaf9 [mcl_spawn] Ignore 'ignore' nodes when checking the point, fix MineClone2/MineClone2#1230 2021-03-29 03:08:21 +04:00
kay27 b587b1f2a5 [mcl_spawn] Cleanup 2021-03-29 02:48:45 +04:00
kay27 1818fcf592 [mcl_mapgen_core] Remove water from End, fix MineClone2/MineClone2#1394 2021-03-29 02:43:08 +04:00
kay27 bbd52043f1 [mcl_portals] Make '/spawnstruct nether_portal' chat command work in obsidian nodes (immediate destruction triggered) 2021-03-29 02:17:32 +04:00
kay27 05260d03d5 [mcl_portals] Fix crash on access empty index trying to find portal after its destruction 2021-03-29 01:33:01 +04:00
kay27 cb2aae5a55 [mcl_mapgen_core] Redesign, mostly to remove water from End and restore static lvm_buffer to speed it up 2021-03-28 22:57:11 +04:00
AFCMS d07cf64d11 Merge pull request 'mcl_death_drop refactoring' (#1415) from mcl-death-drop-refactoring into master
Reviewed-on: MineClone2/MineClone2#1415
2021-03-28 18:13:57 +00:00
AFCMS 5a4355b859 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-03-28 19:44:43 +02:00
kay27 628ca226a6 [mcl_portals] Additionally index source Nether portals from 0.71 and earlier before teleporting, to make possible returning through them 2021-03-28 20:36:35 +04:00
iliekprogrammar 24da94ec3b Disable ABMs in favor of nodetimers to check if kelp is unsubmerged. 2021-03-28 20:29:29 +08:00
iliekprogrammar e76a0ba6e8 Added kelp API and additional refactorings.
WIP: register nodetimers for kelp
2021-03-28 14:51:21 +08:00
AFCMS c7389dc0a4 add basic API to mcl_item_entity 2021-03-28 08:13:24 +02:00
AFCMS 890a569b13 add API documentation to mcl_worlds 2021-03-28 07:40:36 +02:00
kay27 54e7529754 [mcl_achievements] Add mcl:stoneAge, mcl:hotStuff, mcl:obsidian 2021-03-28 04:32:57 +04:00
AFCMS cdb67d96a6 add API documentation to mcl_explosions 2021-03-28 01:00:18 +01:00
AFCMS 6f9c1856b8 add API documentation to mcl_colors (!) 2021-03-28 00:48:24 +01:00
AFCMS e56d9d2ab8 add API documentation to controls 2021-03-28 00:44:36 +01:00
AFCMS 52939ff6a4 add API documentation to flowlib (part 5) 2021-03-28 00:32:52 +01:00
AFCMS 39ac3f208d add API documentation to flowlib (part 4) 2021-03-28 00:25:54 +01:00
AFCMS 2a5dcd1634 add API documentation to flowlib (part 3) 2021-03-28 00:23:57 +01:00
AFCMS 19db2a479f add API documentation to flowlib (part 2) 2021-03-28 00:18:19 +01:00
AFCMS fb50b256ed add API documentation to flowlib (part 1) 2021-03-28 00:12:41 +01:00
AFCMS ce123d4676 add API documentation to mcl_autogroup 2021-03-28 00:02:35 +01:00
AFCMS 57ce5143b9 Clarify API documentation 2021-03-27 23:39:22 +01:00
AFCMS 3ba7a40251 Add API documentation 2021-03-27 23:07:46 +01:00
AFCMS 6a6b5970b3 fix API 2021-03-27 20:23:51 +01:00
AFCMS 30e50a64ef basic API (WIP) 2021-03-27 20:12:48 +01:00
AFCMS cb294a5cad Add documentation to mcl_wip (pretty useless...) 2021-03-27 15:27:34 +01:00
AFCMS 9bb5e748b9 Add documentation to mcl_crafting_table API 2021-03-27 15:20:01 +01:00
AFCMS 61c9d065fb Fix  #1400 2021-03-27 07:19:35 +01:00
AFCMS e2fd0823b9 Fix #1398 2021-03-27 07:10:50 +01:00
AFCMS 826d60e16e Merge pull request 'Refactor mcl_throwing API' (#1396) from api-throwing into master
Reviewed-on: MineClone2/MineClone2#1396
2021-03-27 06:00:02 +00:00
AFCMS e2adead700 use proper colors 2021-03-26 22:50:37 +01:00
AFCMS e11941c107 Add API documentation for mcl_throwing 2021-03-26 22:43:18 +01:00
AFCMS e3c99c5be2 add basic API to mcl_throwing
remove hard depends to mcl_fishing
2021-03-26 22:31:15 +01:00
AFCMS 202e30a782 Add API to mcl_tmp_message 2021-03-26 21:37:10 +01:00
AFCMS 50bdf03189 Merge pull request 'anvil damage mechanism' (#1387) from anvil-entity-damage into master
Reviewed-on: MineClone2/MineClone2#1387
2021-03-26 17:36:17 +00:00
AFCMS 8c002671c0 make helmet protect from falling anvils 2021-03-26 18:24:08 +01:00
Lizzy Fleckenstein 0372057fe3 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-03-26 17:51:16 +01:00
Lizzy Fleckenstein 6f8d0d4de0 Fix #1375 2021-03-26 17:51:13 +01:00
AFCMS 9c8ec7d4ec Merge branch 'master' into anvil-entity-damage 2021-03-26 17:40:55 +01:00
AFCMS 041300cde4 remove unuseful code 2021-03-26 17:39:25 +01:00
AFCMS 88fc515cff make mobs take damage of falling anvils 2021-03-26 17:38:25 +01:00
AFCMS 01eba30058 Fix #1234 2021-03-26 14:32:08 +01:00
AFCMS 35b2bd72f8 Merge pull request 'Add a server setting to disable command blocks usage' (#1381) from command-block-setting into master
Reviewed-on: MineClone2/MineClone2#1381
2021-03-26 10:54:53 +00:00
AFCMS 41768e95a1 fix 2021-03-26 11:50:14 +01:00
AFCMS c0308c7c08 fix weird death message (#1378) 2021-03-26 11:49:41 +01:00
AFCMS 50c35ff5e8 Merge branch 'master' into command-block-setting 2021-03-26 10:06:18 +00:00
AFCMS 53d7134437 remove unuseful spamming messages 2021-03-26 10:00:48 +01:00
AFCMS 78bad87a72 fix transation 2021-03-26 09:59:58 +01:00
AFCMS 0e5bbd6d3d fix msg to be mc like
https://www.digminecraft.com/game_commands/enable_command_blocks.php
2021-03-26 09:57:28 +01:00
kay27 25f6a9ee23 [mcl_core] Set obsidian.is_ground_content to false, see MineClone2/MineClone2#1372 2021-03-26 09:29:05 +04:00
AFCMS 8258dae1b8 setting working 2021-03-25 22:13:37 +01:00
AFCMS e4a6244fdd add basic setting 2021-03-25 22:07:38 +01:00
AFCMS b9301f12ce Update mod.conf 2021-03-25 21:59:21 +01:00
AFCMS 86a18802dc use proper colors 2021-03-25 21:57:07 +01:00
Lizzy Fleckenstein 97991d138c Revert "Do a secre thing even more secret then the secret thing of secret"
This reverts commit 630e7e8acb.
2021-03-25 17:34:03 +01:00
Code-Sploit 630e7e8acb Do a secre thing even more secret then the secret thing of secret 2021-03-25 16:20:02 +00:00
Lizzy Fleckenstein d555fce8bc Bruh. kay27 has 20 times more commits than you.
This reverts commit 322578df6a.
2021-03-25 17:29:15 +01:00
Code-Sploit 322578df6a Something even more secret! 2021-03-25 16:03:54 +00:00
epCode dbc6dd8cb3 Add villager sounds 2021-03-25 08:52:32 -07:00
Lizzy Fleckenstein 46c6328432 Something secret :P 2021-03-25 09:24:38 +01:00
Lizzy Fleckenstein 43a60e0c57 Fix #1357 2021-03-24 09:00:31 +01:00
Lizzy Fleckenstein a47eda44e9 Slimes can burn 2021-03-24 08:54:23 +01:00
Lizzy Fleckenstein fe937665f9 Fix #1336 2021-03-24 08:27:31 +01:00
kay27 6addb7db18 Merge pull request 'Move item renaming to tt to fix enchanted named items' (#1364) from BlueBlancmanche/MineClone2:anvil-fix into master
Reviewed-on: MineClone2/MineClone2#1364
2021-03-24 05:09:54 +00:00
Elias Åström 0d7c2c4988 Fix #1358 for real 2021-03-23 12:02:00 +01:00
kay27 3e58e989a1 [mcl_portals] Support Nether portals from 0.71 and earlier 2021-03-23 03:19:17 +04:00
kay27 06280e3bba [mcl_portals] Generate target map chunks on portal creation 2021-03-23 03:17:23 +04:00
Blue Blancmange 44c4999b37 Move item renaming to tt. This allows additional information such as enchantments to be displayed on named items 2021-03-22 23:02:11 +00:00
epCode 647a53c354 Merge pull request 'Fix player speed on soul sand, MineClone2/MineClone2#1356' (#1363) from ArTee3/MineClone2:fix-player-speed-on-soulsand into master
Reviewed-on: MineClone2/MineClone2#1363
2021-03-22 21:53:47 +00:00
ArTee3 910c9083e5 Fix player speed on soul sand, MineClone2/MineClone2#1356 2021-03-22 21:55:57 +01:00
kay27 66a64439c6 [mcl_weather] Fix crash on saving uninitialized data, MineClone2/MineClone2#1361 2021-03-22 17:31:24 +04:00
kay27 7fe3217cd0 [mcl_portals] Remove debug messages 2021-03-22 11:32:28 +04:00
epCode 01df02667b Make setting for swim on lava 2021-03-21 17:53:57 -07:00
kay27 03feb36558 Improve Nether Portals (#1315) (as a squash)
Remove Nether portal caches, MineClone2/MineClone2#1210

Store all exits from Nether portals in quick-access table

Implement proper Nether portal search, using the table, MineClone2/MineClone2#1055

Store Nether portal exits table in mod storage

Remove exits from table on Nether portal destruction

Align destination area to [map chunks 5x5x5](https://git.minetest.land/MineClone2/MineClone2/wiki/World-structure%3A-positions%2C-boundaries%2C-blocks%2C-chunks%2C-dimensions%2C-barriers-and-the-void) to avoid lots of ```emerge_area()``` calls

Support Nether roof, MineClone2/MineClone2#1267

Implement better suitable place search, MineClone2/MineClone2#1126

Implement object queue not to trigger the same search again

Avoid lava lakes, MineClone2/MineClone2#1126

Add ```/spawnstruct nether_portal``` chat command
Co-Authored-By: kay27 <kay27@noreply.git.minetest.land>
Co-Committed-By: kay27 <kay27@noreply.git.minetest.land>
2021-03-21 23:14:33 +00:00
kay27 1f925b6c84 Merge pull request 'Give xp if items are moved between furnace slots, unlock smelting achievements if furnace is inactive' (#1360) from ArTee3/MineClone2:furnace-fixes into master
Reviewed-on: MineClone2/MineClone2#1360
2021-03-21 22:53:59 +00:00
Lizzy Fleckenstein 9a4d26c2ae Fix all invalid usages of math.random in mcl_bows 2021-03-21 19:52:27 +01:00
Lizzy Fleckenstein 2d1ac1c7fa Properly fix arrows crashing the server 2021-03-21 19:47:13 +01:00
Lizzy Fleckenstein f0c2a0a1e9 Fix arrows crashing the server 2021-03-21 19:45:33 +01:00
ArTee3 1fa2bd3477 Give xp if items are moved between furnace slots, unlock smelting achievements if furnace is inactive 2021-03-21 17:01:28 +01:00
Elias Åström 7f56e5efa4 Add hoey digging group to hand 2021-03-21 12:43:47 +01:00
Elias Åström c1e295de5f Make hoe dig some blocks faster
- Sponges
- Hay and kelp blocks
- Nether wart
- Leaves
2021-03-21 12:39:14 +01:00
Elias Åström dac3c21628 Do not register "creative_breakable" as a diggroup 2021-03-21 12:26:34 +01:00
Elias Åström b0c7941b3a Fix #1358 2021-03-21 12:18:24 +01:00
iliekprogrammar ca635b69be Various fixes. 2021-03-21 14:06:54 +08:00
iliekprogrammar ebf9f8c918 placing kelp now creates water sources, small refactoring. 2021-03-21 12:16:56 +08:00
Elias Åström 0996a83ba0 Assert that both parts of mcl_autogroup exist 2021-03-20 19:32:04 +01:00
Elias Åström 1621c23308 Rename "tool_multiplier" to "speed" for tools 2021-03-20 19:25:47 +01:00
iliekprogrammar 23f69dfd1e Core implementation of MC-like kelp drops.
Highlights:
* Kelp should no longer be able to survive without water
(by decreasing its height)
* When kelp is destroyed, each segment now drop a single kelp similar to MC.
* Significantly refactor how kelp grows and dig. Possible optimizations might be
included.
2021-03-21 02:22:25 +08:00
Elias Åström 1873080046 Remove unnecessary code in mcl_item_entity 2021-03-20 14:21:50 +01:00
Elias Åström 46541a4adc Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-03-20 11:02:42 +01:00
Elias Åström 10154d5778 Fix #1348 2021-03-20 11:02:16 +01:00
epCode c877d6e922 Merge pull request 'Slightly lift your right arm when holding an item.' (#1345) from iliekprogrammar/MineClone2:hand into master
Reviewed-on: MineClone2/MineClone2#1345
2021-03-20 02:29:11 +00:00
iliekprogrammar 12745bd450 Remove debug information... again :/ 2021-03-20 10:13:48 +08:00
iliekprogrammar 03be45b983 Fix indentation from iliekprogrammar's previous PRs 2021-03-20 09:17:43 +08:00
iliekprogrammar 34dbddb40a Move holding code into mcl_playerplus 2021-03-20 08:42:48 +08:00
kay27 b871433c47 Merge pull request 'Fix #1346' (#1347) from kneekoo/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1347
2021-03-19 17:58:03 +00:00
Nicu a40e1c4737 Reduce the size of the pumpkin texture
2732 -> 303 bytes

* We need smaller file sizes for better game startup time, especially for multiplayer and mobile gaming.
2021-03-19 17:41:37 +00:00
Nicu df8fdda2c5 Fix #1346
Fixes crash trying to place cocoa
2021-03-19 17:25:40 +00:00
iliekprogrammar 249b5cfd1e Remove debug information 2021-03-20 00:11:12 +08:00
iliekprogrammar f5f85a2148 Slightly lift your right arm when holding an item. 2021-03-19 23:28:33 +08:00
Lizzy Fleckenstein d168bfa791 Fix pumpking breaking armor display 2021-03-19 14:47:52 +01:00
Lizzy Fleckenstein c20bd768ec Revert "Fix #1277". The commit caused each enchanted armor piece to overlay an additional violet layer over all previous armor layers. A better fix needs to be found.
This reverts commit b82da05590.
2021-03-19 14:36:48 +01:00
Lizzy Fleckenstein 67cedf1308 Fix villager visual_size (Closes #1338) 2021-03-19 14:32:02 +01:00
Lizzy Fleckenstein 9391628813 Fix wielded nodes being upside down 2021-03-19 12:41:03 +01:00
Lizzy Fleckenstein 327bb68927 Fix crystal on_place handler 2021-03-19 12:03:32 +01:00
Lizzy Fleckenstein 906aa3b434 Remove performance settings to see whether it helps 2021-03-19 11:46:35 +01:00
Lizzy Fleckenstein ecd27a4cdb Initialize burning HUD with proper texture 2021-03-19 11:41:29 +01:00
Lizzy Fleckenstein 55df2a57f4 Fix #1336 2021-03-19 11:40:46 +01:00
Lizzy Fleckenstein 4ff987ccc5 Remove burning sound for objects 2021-03-19 11:39:04 +01:00
Lizzy Fleckenstein f3c37f49b9 Only extinguish flame arrow on removal 2021-03-19 11:37:12 +01:00
Lizzy Fleckenstein f3580efced Separate Head / Body rotation (Implement #1189) 2021-03-19 11:32:17 +01:00
Lizzy Fleckenstein 4a53ba67ab Wielditem rotation tweak 2021-03-19 09:37:24 +01:00
epCode d02fc0c83d Re-Enable Skeleton horse spawn egg 2021-03-18 23:12:21 +00:00
epCode e474ce6397 Merge pull request 'Add copyright-safe skeleton horse texture' (#1337) from ZedekThePD/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1337
2021-03-18 23:09:47 +00:00
ZeDique la Ruleta b71566aad6 Updated horse texture 2021-03-18 19:08:27 -04:00
epCode 4fbb95bed3 Merge pull request 'Fix rotation for all wielded items' (#1335) from kneekoo/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1335
2021-03-18 23:05:57 +00:00
ZeDique la Ruleta 2571c6124b Added copyright-safe skeleton horse texture
- Added proper skeleton horse texture edited from the default Pixel Perfection horse, similar to MC but not the same
2021-03-18 18:51:19 -04:00
Nicu e61f1e38f2 Rotation fix for all wielded items
These were probably needed in an older version of the game/engine, but most items don't need changes for correct wielding. The only tweak was needed for the screwdriver.
2021-03-18 19:31:51 +00:00
AFCMS a482a18a67 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-03-18 18:53:06 +01:00
Elias Åström ed30fa0868 Move data from deprecated files to mod.conf
Move data from deprecated files (depends.txt and description.txt) into
fields in mod.conf for all mods.

This was done with a shell script :)
2021-03-18 17:37:12 +01:00
Elias Åström 8d473a42ca Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-03-18 14:04:02 +01:00
Elias Åström 0f2c487dca Remove _mcl_autogroup depends on mcl_autogroup
It looks like the dependency might cause problems with the mod loading
order and lead to situations were _mcl_autogroup is not loaded after all
the other mods.  Because _mcl_autogroup begins with an underscore it
should always be loaded after mcl_autogroup anyways.
2021-03-18 13:59:22 +01:00
Elias Åström dc41c594aa Move depends.txt into mod.conf for mcl_comparators
Fixes a crash in mcl_comparators caused by attempting to index global
'mesecon' (a nil value).
2021-03-18 13:45:29 +01:00
Elias Åström bfe51316ee Merge branch 'mcl_autogroups' 2021-03-18 13:43:58 +01:00
Elias Åström 13268965ee Update README.txt in _mcl_autogroup 2021-03-18 13:40:56 +01:00
Elias Åström 521f96b4ab Use mod.conf for mcl_autogroup and _mcl_autogroup 2021-03-18 13:36:25 +01:00
Elias Åström c8b543991f Automatically assign nodes to creative_breakable
If they belong to any digging group.
2021-03-18 11:35:40 +01:00
Elias Åström 8f9650abe4 Update the groupcaps of all enchanted tools
Not just those enchanted with efficiency.
2021-03-18 11:35:40 +01:00
Elias Åström 4c46eb2b4b Make tools without toolcaps do damage as hand
If the tool_capabilities defaults to {} if unspecified the tool, then
users will not be able to attack with the tool at all.  This solves that
by including the damage_group and full_punch_interval from the hand into
the tool_capabilities when it is nil.
2021-03-18 11:35:40 +01:00
Elias Åström fe770c19a5 Fix crash when tool_capabilities is nil 2021-03-18 11:35:40 +01:00
Elias Åström 0112825a9f Localize variables in _mcl_autogroup 2021-03-18 11:35:40 +01:00
Elias Åström cff0130506 Rename _mcl_autogroup_groupcaps to _mcl_diggroups 2021-03-18 11:35:40 +01:00
Elias Åström 7b93f68ed8 Fix typo 2021-03-18 11:35:40 +01:00
Elias Åström ece4c892f4 Force tools to include levels in their diggroups 2021-03-18 11:35:40 +01:00
Elias Åström bec1f786a6 Improve documentation of mcl_autogroup 2021-03-18 11:35:40 +01:00
Elias Åström 6458565bf9 Move mcl_util.hash to a local function
It is probably unlikely it will be useful at other places in Mineclone2.
2021-03-18 11:35:40 +01:00
Elias Åström 2e9b3c2259 Move efficiency code to its own file 2021-03-18 11:35:40 +01:00
Elias Åström 5193730652 Truncate groupcaps_hash to 8 Base64 digits 2021-03-18 11:35:40 +01:00
Elias Åström e77473e800 Make changes to the mcl_autogroup API
Group levels are now specified as a list of names when registering a
digging group.  Digging groups which do not have specified levels will
support tools having two levels, 0 and 1 where 0 means the tool can dig
but not harvest the node and 1 means it can also harvest the node.  If
more levels are required one has to specifiy them when registering the
digging group.
2021-03-18 11:35:40 +01:00
Elias Åström 922bdbc601 Use hashing for more efficient groupcaps updating
This adds the metadata field "groupcaps_hash" to tools enchanted with
efficiency.  This value contains a hash of the groupcaps field in
tool_capabilities.  This value gets compared to the expected hash value
to determine if the tools tool_capabilities should be updated according
to commit af31f8189e8e5c2b.

This commit makes efficiency more efficient.
2021-03-18 11:35:40 +01:00
Elias Åström 3241dbbec5 Update enchanted tools with outdated digging times
Because of the way digging times is implemented in Mineclone2, it is
possible for the digging times of efficiency enchanted tools to become
outdated.

This fixes that by automatically updating the tools tool_capabilities
after each time the tool is used.
2021-03-18 11:35:40 +01:00
Elias Åström b47733507d Fix tools not taking wear when rightclicking
Added the API function mcl_autogroup.get_wear which is used to get the
tool wear for digging a node of a group.  This is used by mcl_tools to
compute the wear of shovels and shears when rightclicking to create
grass paths and carve pumpkins.
2021-03-18 11:35:29 +01:00
Elias Åström f0528b11d7 Make mcl_enchanting use the new mcl_autogroups
The function mcl_autogroups.get_groupcaps is used by mods to get the
groupcaps for tools with efficiency enchantments.  This function is used
by mcl_enchanting when enchanting tools with efficiency.
2021-03-18 11:34:26 +01:00
Elias Åström 503b3a8149 Fix some nodes not being diggable
Previously some nodes like "mcl_flowers:double_grass_top" would be
undiggable.  This was because they did not define _mcl_hardness and it
was not defaulted to 0 in all parts of _mcl_autogroup.
2021-03-18 11:34:26 +01:00
Elias Åström 5b5a254b1a Fix tool uses not being set in _mcl_autogroups 2021-03-18 11:34:26 +01:00
Elias Åström 0c90dda04c Rename register_digtime_group to register_diggroup 2021-03-18 11:34:26 +01:00
Elias Åström fa86d4e5eb Change comments for mcl_autogroup 2021-03-18 11:34:20 +01:00
Elias Åström f8461d5e90 Remove mcl_autogroups.get_groupcaps
Requiring tool definitions to call a function in _mcl_autogroup means
that they need to be loaded after _mcl_autogroup.  This can cause
problems because _mcl_autogroup needs to be loaded after all tool and
node definitions are completed.

Because of this the API is changed so tool definitions instead put the
data used to generate groupcaps in the custom field
_mcl_autogroup_groupcaps.  _mcl_autogroup will then go through all
registered tools and update the groupcaps for every tool where this
field is present.  This means that no mod ever has to depend on
_mcl_autogroup.
2021-03-18 11:33:18 +01:00
Elias Åström fb6f5eae7a Rewrite mcl_autogroup
These changes are primarly made to make mcl_autogroup more efficient.
Previously enchanted tools required storing around 21 kB of metadata due
to the way the previous version of the mod was implemented.  This caused
a lot of lag and a huge amount of network traffic.  With the changes
enchanted tools won't require more than 1 kB of metadata.

The mod is also rewritten to use an API to register digging groups and
compute the groupcaps for tools.  This will make it easier for modders
to register custom digging groups.

The mod is now split up into two parts.  One part called "mcl_autogroup"
to implement the API for registering custom digging groups, and the
other part called "_mcl_autogroup" which contains most of the code which
has to be loaded after most mods.
2021-03-18 11:32:18 +01:00
AFCMS 558fa57cc6 Solve quartz not generating in the nether 2021-03-18 09:48:18 +01:00
428 changed files with 8999 additions and 5380 deletions

4
API.md
View File

@ -17,6 +17,10 @@ Items can have these fields:
anvil. anvil.
See `mcl_banners` for an example. See `mcl_banners` for an example.
Tools can have these fields:
* `_mcl_diggroups`: Specifies the digging groups that a tool can dig and how
efficiently. See `_mcl_autogroup` for more information.
All nodes can have these fields: All nodes can have these fields:
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0 * `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0

View File

@ -7,13 +7,11 @@ But first, some things to note:
MineClone 2's development target is to make a free software clone of Minecraft, MineClone 2's development target is to make a free software clone of Minecraft,
***version 1.12***, ***PC edition***, *** + Optifine features supported by the Minetest Engine ***. ***version 1.12***, ***PC edition***, *** + Optifine features supported by the Minetest Engine ***.
MineClone 2 is maintained by two persons. Namely, kay27 and EliasFleckenstein. You can find us MineClone 2 is maintained by three persons. Namely, kay27, EliasFleckenstein and jordan4ibanez. You can find us
in the Minetest forums (forums.minetest.net), in IRC in the #minetest in the Minetest forums (forums.minetest.net), in IRC in the #mineclone2
channel on irc.freenode.net. And finally, you can send e-mails to channel on irc.freenode.net. And finally, you can send e-mails to
<eliasfleckenstein@web.de> or <kay27@bk.ru>. <eliasfleckenstein@web.de> or <kay27@bk.ru>.
There is **no** guarantee we will accept anything from anybody.
By sending us patches or asking us to include your changes in this game, By sending us patches or asking us to include your changes in this game,
you agree that they fall under the terms of the LGPLv2.1, which basically you agree that they fall under the terms of the LGPLv2.1, which basically
means they will become part of a free software. means they will become part of a free software.
@ -26,8 +24,7 @@ For small and medium changes:
* Fork the repository * Fork the repository
* Do your change in a new branch * Do your change in a new branch
* Upload the repository somewhere where it can be accessed from the Internet and * Create a pull request to get your changes merged into master
notify us
For small changes, sending us a patch is also good. For small changes, sending us a patch is also good.
@ -41,40 +38,30 @@ reserve the right to revert everything that we don't like.
For bigger changes, we strongly recommend to use feature branches and For bigger changes, we strongly recommend to use feature branches and
discuss with me first. discuss with me first.
Contributors will be credited in `README.md`. If your code causes bugs and crashes, it is your responsibility to fix them as soon as possible.
## Quality remarks We mostly use plain merging rather than rebasing or squash merging.
Again: There is ***no*** guarantee we will accept anything from anybody.
But we will gladly take in code from others when we feel it saves us work
in the long run.
### Inclusion criteria Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue.
Depending on what you add, the chances for inclusion vary:
### High chance for inclusion Contributors will be credited in `CREDITS.md`.
* Gameplay features in Minecraft which are missing in MineClone 2
### Medium chance for inclusion (discuss first) ## Features > 1.12
* Features which don't a impact on gameplay
* GUI improvement
* Features from pocket or console edition
### Low chance for inclusion (discuss/optimize first) If you want to make a feature that was added in a Minecraft version later than 1.12, you should fork MineClone5 (mineclone5 branch in the repository) and add your changes to this.
* Overhaul of architecture / mod structure
* Mass-itemstring changes all over the place
* Added files have a unusual high file size
* Indentation looks like crazy
* Single commits which add several unrelated things
* Gameplay features which don't exist in Minecraft
### Instant rejection ## What we accept
* Proprietary **anything**
* Code contains `minetest.env` anywhere
## Coding style guide * Every MC features up to version 1.12 JE.
* Indentations should reflect the code flow * Every already finished and working good features from versions above (only when making a MineClone5 PR / Contribution).
* Use tabs, not spaces for indentation (tab size = 8) * Except features which couldn't be done easily and bugfree because of Minetest engine limitations. Eg. we CAN extend world boundaries by playing with map chunks, just teleporting player onto next layer after 31000 , but it would cost too much (time, code, bugs, performance, stability, etc).
* Never use `minetest.env` * Some features, approved by the rest of the community, I mean maybe some voting and really missing any negative feedback.
## What we reject
* Any features which cause critical bugs, sending them to rework/fix or trying to fix immediately.
* Some small portions of big entirely missing features which just definitely break gamplay balance give nothing useful
* Controversial features, which some people support while others do not should be discussed well, with publishing forum announcements, at least during the week. In case if there are still doubts - send them into the mod.
## Reporting bugs ## Reporting bugs
Report all bugs and missing Minecraft features here: Report all bugs and missing Minecraft features here:

117
CREDITS.md Normal file
View File

@ -0,0 +1,117 @@
# Credits
## Creator of MineClone
* davedevils
## Creator of MineClone2
* Wuzzy
## Maintainers
* Fleckenstein
* kay27
* oilboi
## Developers
* bzoss
* AFCMS
* epCode
* ryvnf
* iliekprogrammar
* MysticTempest
* Rootyjr
* Nicu
* aligator
* Code-Sploit
## Contributors
* Laurent Rocher
* HimbeerserverDE
* TechDudie
* Alexander Minges
* ArTee3
* ZeDique la Ruleta
* pitchum
* wuniversales
* Bu-Gee
* David McMackins II
* Nicholas Niro
* Wouters Dorian
* Blue Blancmange
* Jared Moody
* Li0n
* Midgard
* NO11
* Saku Laesvuori
* Yukitty
* ZedekThePD
* aldum
* dBeans
* nickolas360
* yutyo
* ztianyang
* j45
## MineClone5
* kay27
* Debiankaios
* epCode
* NO11
* j45
## Original Mod Authors
* Wuzzy
* Fleckenstein
* BlockMen
* TenPlus1
* PilzAdam
* ryvnf
* stujones11
* Arcelmi
* celeron55
* maikerumine
* GunshipPenguin
* Qwertymine3
* Rochambeau
* rubenwardy
* stu
* oilboi
* 4aiman
* Kahrl
* Krock
* UgnilJoZ
* lordfingle
* 22i
* bzoss
* kilbith
* xeranas
* kddekadenz
* sofar
* 4Evergreen4
* jordan4ibanez
* paramat
## 3D Models
* 22i
* tobyplowy
* epCode
## Textures
* XSSheep
* Wuzzy
* kingoscargames
* leorockway
* xMrVizzy
* yutyo
## Translations
* Wuzzy
* Rocher Laurent
* wuniversales
* kay27
* pitchum
## Special thanks
* celeron55 for creating Minetest
* Jordach for the jukebox music compilation from Big Freaking Dig
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
* Notch and Jeb for being the major forces behind Minecraft

52
LEGAL.md Normal file
View File

@ -0,0 +1,52 @@
# Legal information
This is a fan game, not developed or endorsed by Mojang AB.
Copying is an act of love. Please copy and share! <3
Here's the detailed legalese for those who need it:
## License of source code
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
is an imitation of Minecraft.
MineClone 2 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 (in the LICENSE.txt file) for more
details.
In the mods you might find in the read-me or license
text files a different license. This counts as dual-licensing.
You can choose which license applies to you: Either the
license of MineClone 2 (GNU GPLv3) or the mod's license.
MineClone 2 is a direct continuation of the discontinued MineClone
project by davedevils.
Mod credits:
See `README.txt` or `README.md` in each mod directory for information about other authors.
For mods that do not have such a file, the license is the source code license
of MineClone 2 and the author is Wuzzy.
## License of media (textures and sounds)
No non-free licenses are used anywhere.
The textures, unless otherwise noted, are based on the Pixel Perfection resource pack for Minecraft 1.11,
authored by XSSheep. Most textures are verbatim copies, while some textures have been changed or redone
from scratch.
The glazed terracotta textures have been created by (MysticTempest)[https://github.com/MysticTempest].
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
The main menu images are release under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
All other files, unless mentioned otherwise, fall under:
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
See README.txt in each mod directory for detailed information about other authors.

View File

@ -1,40 +0,0 @@
# Missing features in Minetest to recreate Minecraft features
A side goal of the MineClone 2 project is to find any shortcomings of Minetest which make it impossible to recreate a Minecraft feature exactly.
This file lists some of the missing features in Minetest which MineClone 2 would require.
## No workaround possible
For these features, no easy Lua workaround could be found.
### Lua API
#### Tools/wielded item
- “Lock” hotbar for a brief time after using an item, making it impossible to switch item or to attach/mine/build until the delay is over (For eating with delay)
- Tool charging: Holding down the mouse and releasing it, applying a “power level” (For bow and arrows, more charge = higher arrow range) ([issue 5212](https://github.com/minetest/minetest/issues/5212))
- [Dual Wielding](http://minecraft.gamepedia.com/Dual_wield)
- Eating/drinking animation ([issue 2811](https://github.com/minetest/minetest/issues/2811))
#### Nodes
- Light level 15 for nodes (not sunlight)
- Nodes makes light level drop by 2 or or more per node ([issue 5209](https://github.com/minetest/minetest/issues/5209))
## Interface
- Inventory: Hold down right mouse button while holding an item stack to drop items into the slots as you move the mouse. Makes crafting MUCH faster
- Sneak+Leftclick on crafting output crafts as many items as possible and immediately puts it into the player inventory ([issue 5211](https://github.com/minetest/minetest/issues/5211))
- Sneak+click puts items in different inventories depending on the item type (maybe group-based)? Required for sneak-clicking to armor slots
## Workaround theoretically possible
For these features, a workaround (or hack ;-)) by using Lua is theoretically possible. But engine support would be clearly better, more performant, more reliable, etc.
### Lua API
#### Nodes
- Change walking speed on block (soul sand)
- Change jumping height on block (soul sand),
- Change object movement speed *through* a block, but for non-liquids (for cobweb)
- Add `on_walk_over` event
- Set frequency in which players lose breath. 2 seconds are hardcoded in Minetest, in Minecraft it's 1 second
- Set damage frequency of `damage_per_second`. In Minecraft many things damage players every half-second rather than every second
- Possible to damage players directly when they are with the head inside. This allows to add Minecraft-like suffocation
- Sneak+click on inventory slot should be able to put items into additional “fallback inventories” if the first inventory is full. Useful for large chests
#### Nice-to-haye
- Utility function to rotate pillar-like nodes, requiring only 3 possible orientations (X, Y, Z). Basically this is `minetest.rotate_node` but with less orientations; the purpur pillar would mess up if a mirrored rotation would be possible. This is already implemented in MCL2, See `mcl_util` for more infos

194
README.md
View File

@ -2,7 +2,7 @@
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils. An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
Developed by many people. Not developed or endorsed by Mojang AB. Developed by many people. Not developed or endorsed by Mojang AB.
Version: 0.71.0 Version: 0.72.0 (in development)
### Gameplay ### Gameplay
You start in a randomly-generated world made entirely of cubes. You can explore You start in a randomly-generated world made entirely of cubes. You can explore
@ -65,16 +65,8 @@ map builders. They can not be obtained in-game or in the creative inventory.
Use the `/giveme` chat command to obtain them. See the in-game help for Use the `/giveme` chat command to obtain them. See the in-game help for
an explanation. an explanation.
#### Incomplete items
These items do not work yet, but you can get them with `/giveme` for testing:
* Minecart with Chest: `mcl_minecarts:chest_minecart`
* Minecart with Furnace: `mcl_minecarts:furnace_minecart`
* Minecart with Hopper: `mcl_minecarts:hopper_minecart`
* Minecart with Command Block: `mcl_minecarts:command_block_minecart`
## Installation ## Installation
This game requires [Minetest](http://minetest.net) to run (version 5.0.0 or This game requires [Minetest](http://minetest.net) to run (version 5.3.0 or
later). So you need to install Minetest first. Only stable versions of Minetest later). So you need to install Minetest first. Only stable versions of Minetest
are officially supported. are officially supported.
There is no support for running MineClone 2 in development versions of Minetest. There is no support for running MineClone 2 in development versions of Minetest.
@ -83,23 +75,37 @@ To install MineClone 2 (if you haven't already), move this directory into the
“games” directory of your Minetest data directory. Consult the help of “games” directory of your Minetest data directory. Consult the help of
Minetest to learn more. Minetest to learn more.
## Reporting bugs
Please report all bugs and missing Minecraft features here:
<https://git.minetest.land/MineClone2/MineClone2/issues>
## Chating with the community
Join our discord server at:
<https://discord.gg/84GKcxczG3>
## Project description ## Project description
The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software. The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software.
* **Target of development: Minecraft, PC Edition, version 1.12** (later known as “Java Edition”) * **Target of development: Minecraft, PC Edition, version 1.12** (later known as “Java Edition”)
* MineClone2 also includes Optifine features supported by the Minetest * MineClone2 also includes Optifine features supported by the Minetest
* Features of later Minecraft versions might sneak in, but they have a low priority * In general, Minecraft is aimed to be cloned as good as possible
* In general, Minecraft is aimed to be cloned as good as Minetest currently permits (no hacks)
* Cloning the gameplay has highest priority * Cloning the gameplay has highest priority
* MineClone 2 will use different graphics and sounds, but with a similar style * MineClone 2 will use different assets, but with a similar style
* Cloning the interface has no priority. It will only be roughly imitated * Limitations found in Minetest will be documented in the course of development
* Limitations found in Minetest will be written down and reported in the course of development * Features of later Minecraft versions are collected in the mineclone5 branch
## Using features from newer versions of Minecraft
For > 1.12 features, checkout MineClone5. It includes features from newer Minecraft versions.
Download it here: https://git.minetest.land/MineClone2/MineClone2/src/branch/mineclone5
## Completion status ## Completion status
This game is currently in **alpha** stage. This game is currently in **beta** stage.
It is playable, but unfinished, many bugs are to be expected. It is playable, but not yet feature-complete.
Backwards-compability is *not* guaranteed, updating your world might cause small and Backwards-compability is not entirely guaranteed, updating your world might cause small bugs.
big bugs (such as “missing node” errors or even crashes). If you want to use the git version of MineClone2 in production, consider using the production branch.
It is updated weekly and contains relatively stable code for servers.
The following main features are available: The following main features are available:
@ -128,7 +134,7 @@ The following main features are available:
* Clock * Clock
* Compass * Compass
* Sponge * Sponge
* Slime block (does not interact with redstone) * Slime block
* Small plants and saplings * Small plants and saplings
* Dyes * Dyes
* Banners * Banners
@ -140,19 +146,19 @@ The following main features are available:
* Creative inventory * Creative inventory
* Farming * Farming
* Writable books * Writable books
* A few server commands * Commands
* Villages
* The End
* And more! * And more!
The following features are incomplete: The following features are incomplete:
* Generated structures (especially villages)
* Some monsters and animals * Some monsters and animals
* Redstone-related things * Redstone-related things
* The End
* Special minecarts * Special minecarts
* A couple of non-trivial blocks and items * A couple of non-trivial blocks and items
Bonus features (not found in Minecraft 1.11): Bonus features (not found in Minecraft 1.12):
* 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
@ -177,148 +183,14 @@ Technical differences from Minecraft:
* Different textures (Pixel Perfection) * Different textures (Pixel Perfection)
* Different sounds (various sources) * Different sounds (various sources)
* Different engine (Minetest) * Different engine (Minetest)
* Different easter eggs
… and finally, MineClone 2 is free software (“free” as in “freedom”)! … and finally, MineClone 2 is free software (“free” as in “freedom”)!
## Reporting bugs
Please report all bugs and missing Minecraft features here:
<https://git.minetest.land/MineClone2/MineClone2/issues>
## Chating with the community
Join our discord server at:
<https://discord.gg/84GKcxczG3>
## Other readme files ## Other readme files
* `LICENSE.txt`: The GPLv3 license text * `LICENSE.txt`: The GPLv3 license text
* `CONTRIBUTING.md`: Information for those who want to contribute * `CONTRIBUTING.md`: Information for those who want to contribute
* `MISSING_ENGINE_FEATURES.md`: List of missing features in Minetest which MineClone 2 would need for improvement
* `API.md`: For Minetest modders who want to mod this game * `API.md`: For Minetest modders who want to mod this game
* `LEGAL.md`: Legal information
## Credits * `CREDITS.md`: List of everyone who contributed
There are so many people to list (sorry). Check out the respective mod directories for details. This section is only a rough overview of the core authors of this game.
### Coding
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082): Main programmer of most mods (retired)
* davedevils: Creator of MineClone on which MineClone 2 is based on
* [ex-bart](https://github.com/ex-bart): Redstone comparators
* [Rootyjr](https://github.com/Rootyjr): Fishing rod and bugfixes
* [aligator](https://github.com/aligator): Improvement of doors
* [ryvnf](https://github.com/ryvnf): Explosion mechanics
* MysticTempest: Bugfixes
* [bzoss](https://github.com/bzoss): Status effects, potions, brewing stand
* kay27 <kay27@bk.ru>: Experience system, bugfixes, optimizations (Current maintainer)
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03): End crystals, enchanting, burning mobs / players, animated chests, bugfixes (Current maintainer)
* epCode: Better player animations, new logo
* 2mac: Fix bug with powered rail
* Lots of other people: TO BE WRITTEN (see mod directories for details)
#### Mod credits (summary)
* `controls`: Arcelmi
* `flowlib`: Qwertymine13
* `walkover`: lordfingle
* `drippingwater`: kddekadenz
* `mobs_mc`: maikerumine, 22i and others
* `awards`: rubenwardy
* `screwdriver`: RealBadAngel, Maciej Kastakin, Minetest contributors
* `xpanes`: Minetest contributors
* `mesecons` mods: Jeija and contributors
* `wieldview`: Stuart Jones
* `mcl_meshhand`: Based on `newhand` by jordan4ibanez
* `mcl_mobs`: Based on Mobs Redo [`mobs`] by TenPlus1 and contributors
* Most other mods: Wuzzy
Detailed credits for each mod can be found in the individual mod directories.
### Graphics
* [XSSheep](http://www.minecraftforum.net/members/XSSheep): Main author; creator of the Pixel Perfection resource pack of Minecraft 1.11
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082): Main menu imagery and various edits and additions of texture pack
* [kingoscargames](https://github.com/kingoscargames): Various edits and additions of existing textures
* [leorockway](https://github.com/leorockway): Some edits of mob textures
* [xMrVizzy](https://minecraft.curseforge.com/members/xMrVizzy): Glazed terracotta (textures are subject to be replaced later)
* yutyo <tanakinci2002@gmail.com>: MineClone 2 logo
* Other authors: GUI images
### Translations
* Wuzzy: German
* Rocher Laurent <rocherl@club-internet.fr>: French
* wuniversales: Spanish
* kay27 <kay27@bk.ru>: Russian
### Models
* [22i](https://github.com/22i): Creator of all models
* [tobyplowy](https://github.com/tobyplowy): UV-mapping fixes to said models
### Sounds and music
Various sources. See the respective mod directories for details.
### Special thanks
* davedevils for starting MineClone, the original version of this game
* Wuzzy for starting and maintaining MineClone2 for several years
* celeron55 for creating Minetest
* Minetest's modding community for providing a huge selection of mods, some of which ended up in MineClone 2
* Jordach for the jukebox music compilation from Big Freaking Dig
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
* Notch and Jeb for being the major forces behind Minecraft
* XSSheep for creating the Pixel Perfection resource pack
* [22i](https://github.com/22i) for providing great models and support
* [maikerumine](http://github.com/maikerumine) for kicking off mobs and biomes
## Info for programmers
You find interesting and useful infos in `API.md`.
## Legal information
This is a fan game, not developed or endorsed by Mojang AB.
Copying is an act of love. Please copy and share! <3
Here's the detailed legalese for those who need it:
### License of source code
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
is an imitation of Minecraft.
MineClone 2 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 (in the LICENSE.txt file) for more
details.
In the mods you might find in the read-me or license
text files a different license. This counts as dual-licensing.
You can choose which license applies to you: Either the
license of MineClone 2 (GNU GPLv3) or the mod's license.
MineClone 2 is a direct continuation of the discontinued MineClone
project by davedevils.
Mod credits:
See `README.txt` or `README.md` in each mod directory for information about other authors.
For mods that do not have such a file, the license is the source code license
of MineClone 2 and the author is Wuzzy.
### License of media (textures and sounds)
No non-free licenses are used anywhere.
The textures, unless otherwise noted, are based on the Pixel Perfection resource pack for Minecraft 1.11,
authored by XSSheep. Most textures are verbatim copies, while some textures have been changed or redone
from scratch.
The glazed terracotta textures have been created by (MysticTempest)[https://github.com/MysticTempest].
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
The main menu images are release under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
All other files, unless mentioned otherwise, fall under:
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
See README.txt in each mod directory for detailed information about other authors.

View File

@ -1,5 +1,8 @@
# This is a game specific minetest.conf file, do not edit # This is a game specific minetest.conf file, do not edit
# If any of these settings are set in your minetest.conf file in ~/.minetest (Linux) or in the root directory of the game (Run in place/Windows)
# They will override these settings
# Basic game rules # Basic game rules
time_speed = 72 time_speed = 72
@ -33,10 +36,10 @@ mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_de
keepInventory = false keepInventory = false
# Performance settings # Performance settings
dedicated_server_step = 0.001 dedicated_server_step = 0.05 #tick rate
abm_interval = 0.25 # abm_interval = 0.25
max_objects_per_block = 4096 # max_objects_per_block = 4096
max_packets_per_iteration = 10096 # max_packets_per_iteration = 10096
# Clientmodding to support official client # Clientmodding to support official client
enable_client_modding = true enable_client_modding = true

View File

@ -4,6 +4,11 @@ Specifically, this mod has 2 purposes:
1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft. 1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft.
2) Generating digging time group for all nodes based on node metadata (it's complicated) 2) Generating digging time group for all nodes based on node metadata (it's complicated)
This mod also requires another mod called “mcl_autogroup” to function properly.
“mcl_autogroup” exposes the API used to register digging groups, while this mod
uses those digging groups to set the digging time groups for all the nodes and
tools.
See init.lua for more infos. See init.lua for more infos.
The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible. The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible.

View File

@ -1,169 +1,361 @@
--[[ Mining times. Yeah, mining times … Alright, this is going to be FUN! --[[
This mod implements a HACK to make 100% sure the digging times of all tools
match Minecraft's perfectly. The digging times system of Minetest is very
different, so this weird group trickery has to be used. In Minecraft, each
block has a hardness and the actual Minecraft digging time is determined by
this:
This mod does include a HACK to make 100% sure the digging times of all tools match Minecraft's perfectly.
The digging times system of Minetest is very different, so this weird group trickery has to be used.
In Minecraft, each block has a hardness and the actual Minecraft digging time is determined by this:
1) The block's hardness 1) The block's hardness
2) The tool being used 2) The tool being used (the tool speed and its efficiency level)
3) Whether the tool is considered as eligible for the block 3) Whether the tool is considered as "eligible" for the block
(e.g. only diamond pick eligible for obsidian) (e.g. only diamond pick eligible for obsidian)
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more information.
In MineClone 2, all diggable node have the hardness set in the custom field _mcl_hardness (0 by default). See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more
The nodes are also required to specify the eligible tools in groups like pickaxey, shovely, etc. information.
This mod then calculates the real digging time based on the node meta data. The real digging times
are then added into mcl_autogroup.digtimes where the table indices are group rating and the values are the
digging times in seconds. These digging times can be then added verbatim into the tool definitions.
Example: How the mod is used
mcl_autogroup.digtimes.pickaxey_dig_diamond[1] = 0.2 ===================
This means that when a node has been assigned the group pickaxey_dig_diamond=1, it can be dug by the In MineClone 2, all diggable nodes have the hardness set in the custom field
diamond pickaxe in 0.2 seconds. "_mcl_hardness" (0 by default). These values are used together with digging
groups by this mod to create the correct digging times for nodes. Digging
groups are registered using the following code:
mcl_autogroup.register_diggroup("shovely")
mcl_autogroup.register_diggroup("pickaxey", {
levels = { "wood", "gold", "stone", "iron", "diamond" }
})
The first line registers a simple digging group. The second line registers a
digging group with 5 different levels (in this case one for each material of a
pickaxes).
This strange setup with mcl_autogroup has been done to minimize the amount of required digging times Nodes indicate that they belong to a particular digging group by being member of
a single tool needs to use. If this is not being done, the loading time will increase considerably the digging group in their node definition. "mcl_core:dirt" for example has
(>10s). shovely=1 in its groups. If the digging group has multiple levels the value of
the group indicates which digging level the node requires.
"mcl_core:stone_with_gold" for example has pickaxey=4 because it requires a
pickaxe of level 4 be mined.
]] For tools to be able to dig nodes of digging groups they need to use the have
the custom field "_mcl_diggroups" function to get the groupcaps. The value of
this field is a table which defines which groups the tool can dig and how
efficiently.
local materials = { "wood", "gold", "stone", "iron", "diamond" } _mcl_diggroups = {
local basegroups = { "pickaxey", "axey", "shovely" } handy = { speed = 1, level = 1, uses = 0 },
local minigroups = { "handy", "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" } pickaxey = { speed = 1, level = 0, uses = 0 },
local divisors = { }
["wood"] = 2,
["gold"] = 12,
["stone"] = 4,
["iron"] = 6,
["diamond"] = 8,
["handy"] = 1,
["shearsy"] = 15,
["swordy"] = 1.5,
["shearsy_wool"] = 5,
["swordy_cobweb"] = 15,
}
local max_efficiency_level = 5
mcl_autogroup = {} The "uses" field indicate how many uses (0 for infinite) a tool has when used on
mcl_autogroup.digtimes = {} the specified digging group. The "speed" field is a multiplier to the dig speed
mcl_autogroup.creativetimes = {} -- Copy of digtimes, except that all values are 0. Used for creative mode on that digging group.
for m=1, #materials do The "level" field indicates which levels of the group the tool can harvest. A
for g=1, #basegroups do level of 0 means that the tool cannot harvest blocks of that node. A level of 1
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {} or above means that the tool can harvest nodes with that level or below. See
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {} "mcl_tools/init.lua" for examples on how "_mcl_diggroups" is used in practice.
for e=1, max_efficiency_level do
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {} Information about the mod
=========================
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
mcl_autogroup contains the API functions used to register custom digging groups.
_mcl_autogroup contains most of the code. The leading underscore in the name
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
as possible. Minetest loads mods in reverse alphabetical order.
This also means that it is very important that no mod adds _mcl_autogroup as a
dependency.
--]]
assert(minetest.get_modpath("mcl_autogroup"), "This mod requires the mod mcl_autogroup to function")
-- Returns a table containing the unique "_mcl_hardness" for nodes belonging to
-- each diggroup.
local function get_hardness_values_for_groups()
local maps = {}
local values = {}
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
maps[g] = {}
values[g] = {}
end
for _, ndef in pairs(minetest.registered_nodes) do
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
if ndef.groups[g] ~= nil then
maps[g][ndef._mcl_hardness or 0] = true
end
end
end
for g, map in pairs(maps) do
for k, _ in pairs(map) do
table.insert(values[g], k)
end
end
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
table.sort(values[g])
end
return values
end
-- Returns a table containing a table indexed by "_mcl_hardness_value" to get
-- its index in the list of unique hardnesses for each diggroup.
local function get_hardness_lookup_for_groups(hardness_values)
local map = {}
for g, values in pairs(hardness_values) do
map[g] = {}
for k, v in pairs(values) do
map[g][v] = k
end
end
return map
end
-- Array of unique hardness values for each group which affects dig time.
local hardness_values = get_hardness_values_for_groups()
-- Map indexed by hardness values which return the index of that value in
-- hardness_value. Used for quick lookup.
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
local function compute_creativetimes(group)
local creativetimes = {}
for index, hardness in pairs(hardness_values[group]) do
table.insert(creativetimes, 0)
end
return creativetimes
end
-- Get the list of digging times for using a specific tool on a specific
-- diggroup.
--
-- Parameters:
-- group - the group which it is digging
-- can_harvest - if the tool can harvest the block
-- speed - dig speed multiplier for tool (default 1)
-- efficiency - efficiency level for the tool if applicable
local function get_digtimes(group, can_harvest, speed, efficiency)
local speed = speed or 1
if efficiency then
speed = speed + efficiency * efficiency + 1
end
local digtimes = {}
for index, hardness in pairs(hardness_values[group]) do
local digtime = (hardness or 0) / speed
if can_harvest then
digtime = digtime * 1.5
else
digtime = digtime * 5
end
if digtime <= 0.05 then
digtime = 0
else
digtime = math.ceil(digtime * 20) / 20
end
table.insert(digtimes, digtime)
end
return digtimes
end
-- Get one groupcap field for using a specific tool on a specific group.
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
return {
times = get_digtimes(group, can_harvest, multiplier, efficiency),
uses = uses,
maxlevel = 0,
}
end
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
-- tool.
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
if not groupcaps_def then
return
end
for g, capsdef in pairs(groupcaps_def) do
local mult = capsdef.speed or 1
local uses = capsdef.uses
local def = mcl_autogroup.registered_diggroups[g]
local max_level = def.levels and #def.levels or 1
assert(capsdef.level, toolname .. ' is missing level for ' .. g)
local level = math.min(capsdef.level, max_level)
if def.levels then
groupcaps[g .. "_dig_default"] = get_groupcap(g, false, mult, efficiency, uses)
if level > 0 then
groupcaps[g .. "_dig_" .. def.levels[level]] = get_groupcap(g, true, mult, efficiency, uses)
end
else
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
end end
end end
end end
for g=1, #minigroups do
mcl_autogroup.digtimes[minigroups[g].."_dig"] = {} -- Checks if the given node would drop its useful drop if dug by a given tool.
mcl_autogroup.creativetimes[minigroups[g].."_dig"] = {} -- Returns true if it will yield its useful drop, false otherwise.
for e=1, max_efficiency_level do function mcl_autogroup.can_harvest(nodename, toolname)
mcl_autogroup.digtimes[minigroups[g].."_dig_efficiency_"..e] = {} local ndef = minetest.registered_nodes[nodename]
mcl_autogroup.creativetimes[minigroups[g].."_dig_efficiency_"..e] = {}
if minetest.get_item_group(nodename, "dig_immediate") >= 2 then
return true
end end
-- Check if it can be dug by tool
local tdef = minetest.registered_tools[toolname]
if tdef and tdef._mcl_diggroups then
for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then
if ndef.groups[g] <= gdef.level then
return true
end
end
end
end
-- Check if it can be dug by hand
local tdef = minetest.registered_tools[""]
if tdef then
for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then
if ndef.groups[g] <= gdef.level then
return true
end
end
end
end
return false
end
-- Get one groupcap field for using a specific tool on a specific group.
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
return {
times = get_digtimes(group, can_harvest, multiplier, efficiency),
uses = uses,
maxlevel = 0,
}
end
-- Returns the tool_capabilities from a tool definition or a default set of
-- tool_capabilities
local function get_tool_capabilities(tdef)
if tdef.tool_capabilities then
return tdef.tool_capabilities
end
-- If the damage group and punch interval from hand is not included,
-- then the user will not be able to attack with the tool.
local hand_toolcaps = minetest.registered_tools[""].tool_capabilities
return {
full_punch_interval = hand_toolcaps.full_punch_interval,
damage_groups = hand_toolcaps.damage_groups
}
end
-- Get the groupcaps for a tool. This function returns "groupcaps" table of
-- digging which should be put in the "tool_capabilities" of the tool definition
-- or in the metadata of an enchanted tool.
--
-- Parameters:
-- toolname - Name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
-- efficiency - The efficiency level the tool is enchanted with (default 0)
--
-- NOTE:
-- This function can only be called after mod initialization. Otherwise a mod
-- would have to add _mcl_autogroup as a dependency which would break the mod
-- loading order.
function mcl_autogroup.get_groupcaps(toolname, efficiency)
local tdef = minetest.registered_tools[toolname]
local groupcaps = table.copy(get_tool_capabilities(tdef).groupcaps or {})
add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency)
return groupcaps
end
-- Get the wear from using a tool on a digging group.
--
-- Parameters
-- toolname - Name of the tool used
-- diggroup - The name of the diggroup the tool is used on
--
-- NOTE:
-- This function can only be called after mod initialization. Otherwise a mod
-- would have to add _mcl_autogroup as a dependency which would break the mod
-- loading order.
function mcl_autogroup.get_wear(toolname, diggroup)
local tdef = minetest.registered_tools[toolname]
local uses = tdef._mcl_diggroups[diggroup].uses
return math.ceil(65535 / uses)
end end
local overwrite = function() local overwrite = function()
for nname, ndef in pairs(minetest.registered_nodes) do for nname, ndef in pairs(minetest.registered_nodes) do
local groups_changed = false
local newgroups = table.copy(ndef.groups) local newgroups = table.copy(ndef.groups)
if (nname ~= "ignore" and ndef.diggable) then if (nname ~= "ignore" and ndef.diggable) then
-- Automatically assign the “solid” group for solid nodes -- Automatically assign the "solid" group for solid nodes
if (ndef.walkable == nil or ndef.walkable == true) if (ndef.walkable == nil or ndef.walkable == true)
and (ndef.collision_box == nil or ndef.collision_box.type == "regular") and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
and (ndef.node_box == nil or ndef.node_box.type == "regular") and (ndef.node_box == nil or ndef.node_box.type == "regular")
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
newgroups.solid = 1 newgroups.solid = 1
groups_changed = true
end end
-- Automatically assign the “opaque” group for opaque nodes -- Automatically assign the "opaque" group for opaque nodes
if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and
(ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then (ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then
newgroups.opaque = 1 newgroups.opaque = 1
groups_changed = true
end end
local function calculate_group(hardness, material, diggroup, newgroups, actual_rating, expected_rating, efficiency) local creative_breakable = false
local time, validity_factor
if actual_rating >= expected_rating then
-- Valid tool
validity_factor = 1.5
else
-- Wrong tool (higher digging time)
validity_factor = 5
end
local speed_multiplier = divisors[material]
if efficiency then
speed_multiplier = speed_multiplier + efficiency * efficiency + 1
end
time = (hardness * validity_factor) / speed_multiplier
if time <= 0.05 then
time = 0
else
time = math.ceil(time * 20) / 20
end
table.insert(mcl_autogroup.digtimes[diggroup], time)
if not efficiency then
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
end
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
return newgroups
end
-- Hack in digging times -- Assign groups used for digging this node depending on
local hardness = ndef._mcl_hardness -- the registered digging groups
if not hardness then for g, gdef in pairs(mcl_autogroup.registered_diggroups) do
hardness = 0 creative_breakable = true
end local index = hardness_lookup[g][ndef._mcl_hardness or 0]
if ndef.groups[g] then
if gdef.levels then
newgroups[g .. "_dig_default"] = index
-- Handle pickaxey, axey and shovely for i = ndef.groups[g], #gdef.levels do
for _, basegroup in pairs(basegroups) do newgroups[g .. "_dig_" .. gdef.levels[i]] = index
if (hardness ~= -1 and ndef.groups[basegroup]) then
for g=1,#materials do
local diggroup = basegroup.."_dig_"..materials[g]
newgroups = calculate_group(hardness, materials[g], diggroup, newgroups, g, ndef.groups[basegroup])
for e=1,max_efficiency_level do
newgroups = calculate_group(hardness, materials[g], diggroup .. "_efficiency_" .. e, newgroups, g, ndef.groups[basegroup], e)
end end
groups_changed = true else
end newgroups[g .. "_dig"] = index
end
end
for m=1, #minigroups do
local minigroup = minigroups[m]
if hardness ~= -1 then
local diggroup = minigroup.."_dig"
-- actual rating
local ar = ndef.groups[minigroup]
if ar == nil then
ar = 0
end
if (minigroup == "handy")
or
(ndef.groups.shearsy_wool and minigroup == "shearsy_wool" and ndef.groups.wool)
or
(ndef.groups.swordy_cobweb and minigroup == "swordy_cobweb" and nname == "mcl_core:cobweb")
or
(ndef.groups[minigroup] and minigroup ~= "swordy_cobweb" and minigroup ~= "shearsy_wool") then
newgroups = calculate_group(hardness, minigroup, diggroup, newgroups, ar, 1)
for e=1,max_efficiency_level do
newgroups = calculate_group(hardness, minigroup, diggroup .. "_efficiency_" .. e, newgroups, ar, 1, e)
end
groups_changed = true
end end
end end
end end
if groups_changed then -- Automatically assign the node to the
minetest.override_item(nname, { -- creative_breakable group if it belongs to any digging
groups = newgroups -- group.
}) newgroups["creative_breakable"] = 1
end
minetest.override_item(nname, {
groups = newgroups
})
end
end
for tname, tdef in pairs(minetest.registered_tools) do
-- Assign groupcaps for digging the registered digging groups
-- depending on the _mcl_diggroups in the tool definition
if tdef._mcl_diggroups then
local toolcaps = table.copy(get_tool_capabilities(tdef))
toolcaps.groupcaps = mcl_autogroup.get_groupcaps(tname)
minetest.override_item(tname, {
tool_capabilities = toolcaps
})
end end
end end
end end

View File

@ -1,3 +1,3 @@
name = _mcl_autogroup name = _mcl_autogroup
author = Wuzzy author = ryvnf
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times. description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.

View File

@ -1,159 +0,0 @@
local Object = {}
-- Define a getter that caches the result for the next time it is called
-- This is a static method (self = the class); in this class system static methods start with __ by convention
function Object:__cache_getter(name, func)
-- cache key: prevent overriding the getter function itself
local key = "_" .. name
-- add a function to the class
self[name] = function(self)
-- check if the value is present in the cache
local value = self[key]
-- `== nil` instead of `not value` to allow caching boolean values
if value == nil then
-- call the getter function
value = func(self)
end
-- store result in cache
self[key] = value
-- return result
return value
end
end
-- Define a getter / setter
-- If no argument is specified, it will act as a getter, else as a setter
-- The specified function MUST return the new value, if it returns nil, nil will be used as new value
-- Optionally works in combination with a previously defined cache getter and only really makes sense in that context
function Object:__setter(name, func)
-- since the function is overridden, we need to store the old one in case a cache getter is defined
local cache_getter = self[name]
-- use same key as cache getter to modify getter cache if present
local key = "_" .. name
self[name] = function(self, new)
-- check whether an argument was specified
if new == nil then
if cache_getter then
-- call the cache getter if present
return cache_getter(self)
else
-- return the value else
return self[key]
end
end
-- call the setter and set the new value to the result
self[key] = func(self, new)
end
end
-- Define a comparator function
-- Acts like a setter, except that it does not set the new value but rather compares the present and specified values and returns whether they are equal or not
-- Incompatible with setter
-- The function is optional. The == operator is used else.
function Object:__comparator(name, func)
local cache_getter = self[name]
local key = "_" .. name
self[name] = function(self, expected)
-- the current value is needed everytime, no matter whether there is an argument or not
local actual
if cache_getter then
-- call the cache getter if present
actual = cache_getter(self)
else
-- use the value else
actual = self[key]
end
-- act as a getter if there is no argument
if expected == nil then
return actual
end
if func then
-- if a function as specified, call it
return func(actual, expected)
else
-- else, use the == operator to compare the expected value to the actual
return actual == expected
end
end
end
-- Override an already existing function in a way that the old function is called
-- If nil is returned, the old function is called. Else the return value is returned. (Only the first return value is taken into concern here, multiple are supported tho)
-- This works even if it is applied to the instance of a class when the function is defined by the class
-- It also works with overriding functions that are located in superclasses
function Object:__override(name, func)
-- store the old function
local old_func = self[name]
-- redefine the function with variable arguments
self[name] = function(...)
-- call the new function and store the return values in a table
local rvals = {func(...)}
-- if nil was returned, fall back to the old function
if rvals[1] == nil then
-- if present, call the return function with the values the new function returned (converted back to a tuple)
return old_func(...)
else
-- return the values from the new function else
return unpack(rvals)
end
end
end
-- Works like override except that the new function does not modify the output of the old function but rather the input
-- The new function can decide with what arguments by returing them, including the `self` reference
-- If the "self" arg is not returned the old function is not called
-- Note that this way the new function cannot change the return value of the old function
function Object:__pipe(name, func)
local old_func = self[name]
self[name] = function(self, ...)
local rvals = {func(self, ...)}
-- check if self was returned properly
if rvals[1] then
-- if present, call the return function with the values the new function returned (converted back to a tuple)
return old_func(unpack(rvals))
end
end
end
-- Make class available as table to distribute the Object table
class = setmetatable({Object = Object}, {
-- Create a new class by calling class() with an optional superclass argument
__call = function(super)
return setmetatable({}, {
-- Create a new instance of the class when the class is called
__call = function(_class, ...)
-- Check whether the first argument is an instance of the class
-- If that is the case, just return it - this is to allow "making sure something is the instance of a class" by calling the constructor
local argtbl = {...}
local first_arg = args[1]
if first_arg and type(first_arg) == "table" and inst.CLASS = _class then
return inst
end
-- set the metatable and remember which class the object belongs to
local instance = setmetatable({CLASS = _class}, {
__index = _class,
})
-- call the constructor if present
if instance.constructor then
instance:constructor(...)
end
-- return the created instance
return instance
end,
-- Object as superclass of all classes that dont have a different one
__index = super or Object,
})
end
}

View File

@ -1,3 +0,0 @@
name = class
author = Fleckenstein
description = A class system for MineClone2

23
mods/CORE/controls/API.md Normal file
View File

@ -0,0 +1,23 @@
# controls
## controls.players
Table containing player controls at runtime.
WARNING: Never use this table in writing
## controls.register_on_press(func)
Register a function that will be executed with (player, keyname) every time a player press a key.
## controls.registered_on_press
Table containing functions registered with controls.register_on_press().
## controls.register_on_release(func)
Register a function that will be executed with (player, keyname, clock_from_last_press) every time a player release a key.
## controls.registered_on_release
Table containing functions registered with controls.register_on_release().
## controls.register_on_hold(func)
Register a function that will be executed with (player, keyname, clock_from_start_hold) every time a player hold a key.
## controls.registered_on_hold
Table containing functions registered with controls.register_on_hold().

45
mods/CORE/flowlib/API.md Normal file
View File

@ -0,0 +1,45 @@
# flowlib
Simple flow functions.
## flowlib.is_touching(realpos, nodepos, radius)
Return true if a sphere of <radius> at <realpos> collide with node at <nodepos>.
* realpos: position
* nodepos: position
* radius: number
## flowlib.is_water(pos)
Return true if node at <pos> is water, false overwise.
* pos: position
## flowlib.node_is_water(node)
Return true if <node> is water, false overwise.
* node: node
## flowlib.is_lava(pos)
Return true if node at <pos> is lava, false overwise.
* pos: position
## flowlib.node_is_lava(node)
Return true if <node> is lava, false overwise.
* node: node
## flowlib.is_liquid(pos)
Return true if node at <pos> is liquid, false overwise.
* pos: position
## flowlib.node_is_liquid(node)
Return true if <node> is liquid, false overwise.
* node: node
## flowlib.quick_flow(pos, node)
Return direction where the water is flowing (to be use to push mobs, items...).
* pos: position
* node: node
## flowlib.move_centre(pos, realpos, node, radius)
Return the pos of the nearest not water block near from <pos> in a sphere of <radius> at <realpos>.
WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong.
* pos: position
* realpos: position, position of the entity
* node: node
* radius: number

View File

@ -0,0 +1,27 @@
# mcl_autogroup
This mod emulate digging times from mc.
## mcl_autogroup.can_harvest(nodename, toolname)
Return true if <nodename> can be dig with <toolname>.
* nodename: string, valid nodename
* toolname: (optional) string, valid toolname
## mcl_autogroup.get_groupcaps(toolname, efficiency)
This function is used to calculate diggroups for tools.
WARNING: This function can only be called after mod initialization.
* toolname: string, name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
* efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0)
## mcl_autogroup.get_wear(toolname, diggroup)
Return the max wear of <toolname> with <diggroup>
WARNING: This function can only be called after mod initialization.
* toolname: string, name of the tool used
* diggroup: string, the name of the diggroup the tool is used on
## mcl_autogroup.register_diggroup(group, def)
* group: string, name of the group to register as a digging group
* def: (optional) table, table with information about the diggroup (defaults to {} if unspecified)
* level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
## mcl_autogroup.registered_diggroups
List of registered diggroups, indexed by name.

View File

@ -0,0 +1,28 @@
--[[
This is one part of a mod to replicate the digging times from Minecraft. This
part only exposes a function to register digging groups. The rest of the mod is
implemented and documented in the _mcl_autogroup.
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
mcl_autogroup contains the API functions used to register custom digging groups.
_mcl_autogroup contains most of the code. The leading underscore in the name
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
as possible. Minetest loads mods in reverse alphabetical order.
--]]
mcl_autogroup = {}
mcl_autogroup.registered_diggroups = {}
assert(minetest.get_modpath("_mcl_autogroup"), "This mod requires the mod _mcl_autogroup to function")
-- Register a group as a digging group.
--
-- Parameters:
-- group - Name of the group to register as a digging group
-- def - Table with information about the diggroup (defaults to {} if unspecified)
--
-- Values in def:
-- level - If specified it is an array containing the names of the different
-- digging levels the digging group supports.
function mcl_autogroup.register_diggroup(group, def)
mcl_autogroup.registered_diggroups[group] = def or {}
end

View File

@ -0,0 +1,3 @@
name = mcl_autogroup
author = ryvnf
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.

View File

@ -0,0 +1,8 @@
# mcl_colors
Mod providing global table containing legacity minecraft colors to be used in mods.
## mcl_colors.*
Colors by upper name, in hex value.
## mcl_colors.background.*
Background colors by upper name, in hex value.

View File

@ -1,29 +0,0 @@
MCLDamageSource = class()
function MCLDamageSource:constructor(tbl)
if tbl then
for k, v in pairs(tbl) do
self[k] = v
end
end
end
function MCLDamageSource:from_mt(reason)
end
MCLDamageSource:__getter("direct_object", function(self)
local obj = self.raw_source_object
if not obj then
return
end
return mcl_object_mgr.get(obj)
end)
MCLDamageSource:__getter("source_object", function(self)
local direct = self:direct_object()
if not direct then
return
end
return direct.source_object or direct
end)

View File

@ -1,44 +0,0 @@
MCLEntity = class(MCLObject)
MCLEntity:__getter("meta", MCLMetadata)
local last_inv_id = 0
MCLEntity:__getter("inventory", function(self)
local info = self.inventory_info
if not info then
return
end
self.inventory_id = "mcl_entity:" .. last_inv_id
last_inv_id = last_inv_id + 1
local inv = minetest.create_detached_inventory(self.inventory_id, self.inventory_callbacks)
for list, size in pairs(data.sizes) do
inv:set_size(list, size)
end
for list, liststr in pairs(data.lists) do
inv:set_list(list, liststr)
end
return inv
end)
function MCLEntity:on_activate(staticdata)
local data = minetest.deserialize(staticdata)
if data then
self:meta():from_table(data)
self.inventory_info = data.inventory
end
end
function MCLEntity:get_staticdata()
local data = self:meta():to_table()
local inventory_info = self.inventory_info
if inventory_info then
data.inventory = {
sizes = inventory_info.sizes,
lists = self:inventory():get_lists()
}
end
return minetest.serialize(data)
end

View File

@ -1,103 +0,0 @@
MCLEquipment = class()
function MCLEquipment:constructor(inv, idx)
self.inv = inv
self.idx = idx
end
MCLEquipment:__cache_getter("has_main", function(self)
return self.inv and self.idx and self.inv:get_list("main") and true or false
end)
MCLEquipment:__cache_getter("has_right", function(self)
return self.inv and self.inv:get_list("right_hand") and true or false
end)
MCLEquipment:__cache_getter("has_left", function(self)
return self.inv and self.inv:get_list("left_hand") and true or false
end)
MCLEquipment:__cache_getter("has_armor", function(self)
return self.inv and self.inv:get_list("armor") and true or false
end)
function MCLEquipment:mainhand()
if self:has_main() then
return self.inv:get_stack("main", self.idx)
elseif self:has_right() then
return self.inv:get_stack("right_hand", 1)
else
return ItemStack()
end
end
MCLEquipment:__setter("mainhand", function(self, new)
if self:has_main() then
self.inv:set_stack("main", self.idx, stack)
elseif self:has_right() then
self.inv:set_stack("right_hand", 1, stack)
end
end)
function MCLEquipment:offhand()
if self:has_left() then
return self.inv:get_stack("left_hand", 1)
else
return ItemStack()
end
end
MCLEquipment:__setter("offhand", function(self, new)
if self:has_left() then
self.inv:set_stack("left_hand", 1, new)
end
end)
function MCLEquipment:__armor(idx, name)
self[name] = function(self)
if self:has_armor() then
return self.inv:get_stack("armor", idx)
else
return ItemStack()
end
end
self:__setter(name, function(self, new)
if self:has_armor() then
self.inv:set_stack("armor", idx, new)
end
end)
end
local armor_slots = {"helmet", "chestplace", "leggings", "boots"}
for i, name in ipairs(armor_slots) do
MCLEquipment:__armor(idx, name)
end
local function insert(tbl, key, stack)
if stack:get_name() ~= "" then
tbl[key] = stack
end
end
function MCLEquipment:get_armor()
local tbl = {}
if self:has_armor() then
for i, name in ipairs(armor_slots) do
insert(tbl, name, self.inv:get_stack("armor", i))
end
end
return tbl
end
function MCLEquipment:get_all()
local tbl = {}
insert(tbl, "mainhand", self:mainhand())
insert(tbl, "offhand", self:offhand())
for k, v in pairs(self:get_armor()) do
tbl[k] = v
end
return tbl
end

View File

@ -0,0 +1,15 @@
# mcl_explosions
This mod provide helper functions to create explosions.
## mcl_explosions.explode(pos, strength, info, puncher)
* pos: position, initial position of the explosion
* strenght: number, radius of the explosion
* info: table, explosion informations:
* drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength)
* max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value
* sound: bool, if true, the explosion will play a sound (default: true)
* particles: bool, if true, the explosion will create particles (default: true)
* fire: bool, if true, 1/3 nodes become fire (default: false)
* griefing: bool, if true, the explosion will destroy nodes (default: true)
* grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false)
* puncher: (optional) entity, will be used as source for damage done by the explosion

View File

@ -1,66 +0,0 @@
mcl_gamerules = {
__defaults = {},
__rules = {},
}
setmetatable(mcl_gamerules, {__index = mcl_gamerules.__rules})
local worldpath = minetest.get_worldpath()
function mcl_gamerules.__load()
local file = io.open(worldpath .. "gamerules.json", "r")
if file then
local contents = file:read("*all")
file:close()
local data = minetest.parse_json(contents)
local rules = mcl_gamerules.__rules
for rule, default in pairs(mcl_gamerules.__defaults) do
local value = data[rule]
if value == nil then
value = default
end
rules[rule] = value
end
end
end
function mcl_gamerules.__save()
local file = io.open(worldpath .. "gamerules.json", "w")
file:write(minetest.write_json(mcl_gamerules.__rules, true))
file:close()
end
function mcl_gamerules.__set(rule, value)
if not mcl_gamerules.__defaults[rule] then
return false
end
mcl_gamerules.__rules[rule] = value
mcl_gamerules.__save()
return true
end
function mcl_gamerules.__register(rule, default)
mcl_gamerules.__defaults[rule] = default
end
mcl_gamerules.__register("announceAdvancements", true)
mcl_gamerules.__register("commandBlockOutput", true)
mcl_gamerules.__register("doDaylightCycle", true)
mcl_gamerules.__register("doFireTick", true)
mcl_gamerules.__register("doImmediateRespawn", false)
mcl_gamerules.__register("doMobLoot", true)
mcl_gamerules.__register("doMobSpawning", true)
mcl_gamerules.__register("doTileDrops", true)
mcl_gamerules.__register("doWeatherCycle", true)
mcl_gamerules.__register("drowningDamage", true)
mcl_gamerules.__register("fallDamage", true)
mcl_gamerules.__register("fireDamage", true)
mcl_gamerules.__register("keepInventory", false)
mcl_gamerules.__register("logAdminCommands", true)
mcl_gamerules.__register("mobGriefing", true)
mcl_gamerules.__register("naturalRegeneration", true)
mcl_gamerules.__register("pvp", true)
mcl_gamerules.__register("showDeathMessages", true)
mcl_gamerules.__register("tntExplodes", true)
minetest.register_on_mods_loaded(mcl_gamerules.__load)

View File

@ -1,32 +0,0 @@
mcl_groupcache = {
cache = {},
}
local function check_insert(item, group, cache)
if minetest.get_item_group(item, group) ~= 0 then
table.insert(cache, item)
end
end
local old_register_item = minetest.register_item
function minetest.register_item(name, def)
old_register_item(name, def)
for group, cache in pairs(mcl_groupcache.cache) do
check_insert(item, group, cache)
end
end
function mcl_groupcache.init_cache(group)
local cache = {}
for item in pairs(minetest.registered_items) do
check_insert(item, group, cache)
end
return cache
end
function mcl_groupcache.get_items_in_group(group)
local cache = mcl_groupcache.cache[group] or mcl_groupcache.init_cache(group)
mcl_groupcache.cache[group] = cache
return cache
end

View File

@ -1,3 +0,0 @@
name = mcl_groupcache
author = Fleckenstein
description = Keep track of items with certain groups

View File

@ -21,6 +21,9 @@ mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;tru
-- Legacy -- Legacy
mcl_vars.inventory_header = "" mcl_vars.inventory_header = ""
-- Tool wield size
mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 }
-- Mapgen variables -- Mapgen variables
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
local minecraft_height_limit = 256 local minecraft_height_limit = 256
@ -33,25 +36,26 @@ mcl_vars.MAP_BLOCKSIZE = math.max(1, core.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, core.MAX_MAP_GENERATION_LIMIT or 31000) mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000)
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2) local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
local chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
mcl_vars.chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
local central_chunk_max_pos = central_chunk_min_pos + chunk_size_in_nodes - 1 local central_chunk_max_pos = central_chunk_min_pos + mcl_vars.chunk_size_in_nodes - 1
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE) local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1 local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / mcl_vars.chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits. local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / mcl_vars.chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * chunk_size_in_nodes mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * mcl_vars.chunk_size_in_nodes
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * chunk_size_in_nodes mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * mcl_vars.chunk_size_in_nodes
local function coordinate_to_block(x) local function coordinate_to_block(x)
return math.floor(x / mcl_vars.MAP_BLOCKSIZE) return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
end end
local function coordinate_to_chunk(x) local function coordinate_to_chunk(x)
return math.floor((coordinate_to_block(x) + central_chunk_offset) / mcl_vars.chunksize) return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize)
end end
function mcl_vars.pos_to_block(pos) function mcl_vars.pos_to_block(pos)
@ -70,7 +74,7 @@ function mcl_vars.pos_to_chunk(pos)
} }
end end
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / chunk_size_in_nodes) local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes)
local k_positive_z = k_positive * 2 local k_positive_z = k_positive * 2
local k_positive_y = k_positive_z * k_positive_z local k_positive_y = k_positive_z * k_positive_z
@ -174,3 +178,86 @@ minetest.craftitemdef_default.stack_max = 64
-- Set random seed for all other mods (Remember to make sure no other mod calls this function) -- Set random seed for all other mods (Remember to make sure no other mod calls this function)
math.randomseed(os.time()) math.randomseed(os.time())
local chunks = {} -- intervals of chunks generated
function mcl_vars.add_chunk(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
local prev
for i, d in pairs(chunks) do
if n <= d[2] then -- we've found it
if (n == d[2]) or (n >= d[1]) then return end -- already here
if n == d[1]-1 then -- right before:
if prev and (prev[2] == n-1) then
prev[2] = d[2]
table.remove(chunks, i)
return
end
d[1] = n
return
end
if prev and (prev[2] == n-1) then --join to previous
prev[2] = n
return
end
table.insert(chunks, i, {n, n}) -- insert new interval before i
return
end
prev = d
end
chunks[#chunks+1] = {n, n}
end
function mcl_vars.is_generated(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
for i, d in pairs(chunks) do
if n <= d[2] then
return (n >= d[1])
end
end
return false
end
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does.
-- p: Position, if it's wrong, {name="error"} node will return.
-- force: optional (default: false) - Do the maximum to still read the node within us_timeout.
-- us_timeout: optional (default: 244 = 0.000244 s = 1/80/80/80), set it at least to 3000000 to let mapgen to finish its job.
--
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
function mcl_vars.get_node(p, force, us_timeout)
-- check initial circumstances
if not p or not p.x or not p.y or not p.z then return {name="error"} end
-- try common way
local node = minetest.get_node(p)
if node.name ~= "ignore" then
return node
end
-- copy table to get sure it won't changed by other threads
local pos = {x=p.x,y=p.y,z=p.z}
-- try LVM
minetest.get_voxel_manip():read_from_map(pos, pos)
node = minetest.get_node(pos)
if node.name ~= "ignore" or not force then
return node
end
-- all ways failed - need to emerge (or forceload if generated)
local us_timeout = us_timeout or 244
if mcl_vars.is_generated(pos) then
minetest.chat_send_all("IMPOSSIBLE! Please report this to MCL2 issue tracker!")
minetest.forceload_block(pos)
else
minetest.emerge_area(pos, pos)
end
local t = minetest.get_us_time()
node = minetest.get_node(pos)
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
node = minetest.get_node(pos)
end
return node
-- it still can return "ignore", LOL, even if force = true, but only after time out
end

View File

@ -1,43 +0,0 @@
MCLItemStack = class()
function MCLItemStack:constructor(stack)
self.stack = stack
end
MCLItemStack:__getter("enchantments", function(self)
return mcl_enchanting.get_enchantments(self.stack)
end)
MCLItemStack:__comparator("enchantments", mcl_types.match_enchantments)
function MCLItemStack:meta()
return self.stack:get_meta()
end
MCLItemStack:__comparator("meta", mcl_types.match_meta)
function MCLItemStack:get_enchantment(name)
return self:enchantments()[name] or 0
end
function MCLItemStack:has_enchantment(name)
return self:get_enchantment(name) > 0
end
function MCLItemStack:total_durability()
end
function MCLItemStack:durability()
local def = self.stack:get_definition()
if def then
local base_uses = def._durability
end
end
function MCLItemStack:use_durability()
end
function MCLItemStack:restore_durability()
end
function MCLItemStack:get_group()
end

View File

@ -1,25 +0,0 @@
MCLMetadata = class()
function MCLMetadata:constructor()
self.fields = {}
end
for _type, default in pairs({string = "", float = 0.0, int = 0}) do
MCLMetadata["set_" .. _type] = function(name, value) do
if value == default then
value = nil
end
self.fields[name] = value
end
MCLMetadata["get_" .. _type] = function(name) do
return self.fields[name] or default
end
end
function MCLMetadata:to_table()
return table.copy(self)
end
function MCLMetadata:from_table(tbl)
self.fields = table.copy(tbl.fields)
end

View File

@ -1,18 +0,0 @@
MCLMob = class(MCLEntity)
function MCLMob:get_hp()
self:meta():get_float("hp")
end
function MCLMob:set_hp()
self:meta():set_float("hp", hp)
end
function MCLMob:on_damage(damage, source)
MCLEntity.on_damage(self, damage, source)
local new_hp = self:get_hp()
if new_hp <= 0 and new_hp + damage > 0 then
self:on_death(source)
end
end

View File

@ -1,121 +0,0 @@
MCLObject = class()
function MCLObject:constructor(obj)
self.object = obj.object or obj
self.IS_MCL_OBJECT = true
end
function MCLObject:on_punch(hitter, time_from_last_punch, tool_capabilities, dir, damage)
local source = MCLDamageSource({is_punch = true, raw_source_object = hitter})
local knockback = {
hitter = hitter,
time_from_last_punch = time_from_last_punch,
tool_capabilities = tool_capabilities,
dir = dir,
}
self:damage(damage, source, knockback)
return true
end
function MCLObject:apply_knockback(strength, dir)
local oldvel = self.object:get_velocity()
local vel = vector.multiply(vector.normalize(vector.new(dir.x, 0, dir.z)), strength)
if self:is_on_ground() then
local old_y = oldvel.y / 2
y = math.min(0.4, old_y / 2 + strenth)
vel.y
end
vel = vector.subtract(vel, vector.divide(vector.new(oldvel.x, 0, oldvel.z), 2))
self.object:add_velocity(vel)
end
-- use this function to deal regular damage to an object (do NOT use :punch() unless toolcaps need to be handled)
function MCLObject:damage(damage, source, knockback)
damage = self:damage_modifier(damage, source) or damage
self:set_hp(self:get_hp() - damage)
if type(knockback) == "table" then
knockback = self:calculate_knockback(
knockback.hitter,
knockback.time_from_last_punch,
knockback.tool_capabilities,
knockback.dir or vector.direction(knockback.hitter:get_pos(), self.object:get_pos(),
knockback.distance or vector.distance(knockback.hitter:get_pos(), self.object:get_pos(),
damage,
source)
end
table.insert(self.damage_info, {
damage = damage,
source = source,
knockback = knockback,
})
return damage
end
function MCLObject:wield_index()
end
MCLObject:__getter("equipment", function(self)
return MCLEquipment(self:inventory(), self:wield_index())
end)
function MCLObject:get_hp()
return self.object:get_hp()
end
function MCLObject:set_hp(hp)
self.object:set_hp(hp)
end
function MCLObject:death_drop(inventory, listname, index, stack)
minetest.add_item(self.object:get_pos(), stack)
inventory:set_stack(listname, index, nil)
end
function MCLObject:on_death(source)
local inventory = self:inventory()
if inventory then
for listname, list in pairs(inventory:get_lists()) do
for index, stack in pairs(list) do
if stack:get_name() ~= "" and then
self:death_drop(inventory, listname, index, stack)
end
end
end
end
end
function MCLObject:damage_modifier(damage, source)
if self.invulnerable and not source.bypasses_invulnerability then
return 0
end
end
function MCLObject:on_damage(damage, source, knockback)
end
MCLObject.calculate_knockback = minetest.calculate_knockback
function minetest.calculate_knockback()
return 0
end
function MCLObject:on_step()
local damage_info = self.damage_info
if damage_info then
self.damage_info = nil
self:on_damage(damage_info.damage, damage_info.source)
if damage_info.knockback then
self.object:add_velocity(damage_info.knockback)
end
end
end

View File

@ -1,121 +0,0 @@
mcl_object_mgr = {
players = {}
}
-- functions
function mcl_object_mgr.get(obj)
local rval
if mcl_object_mgr.is_mcl_object(obj) then
rval = obj
elseif mcl_object_mgr.is_player(obj) then
rval = mcl_object_mgr.get_player(obj)
elseif mcl_object_mgr.is_entity(obj) then
rval = mcl_object_mgr.get_entity(obj)
end
return assert(rval, "No matching MCLObject found. This is most likely an error caused by custom mods.")
end
function mcl_object_mgr.is_mcl_object(obj)
return type(obj) == "table" and obj.IS_MCL_OBJECT
end
function mcl_object_mgr.is_player(obj)
return type(obj) == "string" or type(obj) == "userdata" and obj:is_player()
end
function mcl_object_mgr.is_is_entity(obj)
return type(obj) == "table" and obj.object or type(obj) == "userdata" and obj:get_luaentity()
end
function mcl_object_mgr.get_entity(ent)
if type(ent) == "userdata" then
ent = ent:get_luaentity()
end
return ent.mcl_entity
end
function mcl_object_mgr.get_player(name)
if type(name) == "userdata" then
name = name:get_player_name()
end
return mcl_player_mgr.players[name]
end
-- entity wrappers
local function add_entity_wrapper(def, name)
def[name] = function(luaentity, ...)
local func = self.mcl_entity[name]
if func then
return func(self.mcl_entity, ...)
end
end
end
function mcl_object_mgr.register_entity(name, initial_properties, base_class)
local def = {
initial_properties = initial_properties,
on_activate = function(self, ...)
local entity = base_class(self.object)
self.mcl_entity = entity
if entity.on_activate then
entity:on_activate(...)
end
end,
}
add_entity_wrapper(def, "on_deactivate")
add_entity_wrapper(def, "on_step")
add_entity_wrapper(def, "on_punch")
add_entity_wrapper(def, "on_death")
add_entity_wrapper(def, "on_rightclick")
add_entity_wrapper(def, "on_attach_child")
add_entity_wrapper(def, "on_detach_child")
add_entity_wrapper(def, "on_detach")
add_entity_wrapper(def, "get_staticdata")
minetest.register_entity(name, def)
end
-- player wrappers
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
mcl_player_mgr.players[name] = MCLPlayer(player)
mcl_player_mgr.players[name]:on_join()
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
mcl_player_mgr.players[name]:on_leave()
mcl_player_mgr.players[name] = nil
end)
local function add_player_wrapper(wrapper, regfunc)
minetest[regfunc or "register_" .. wrapper .. "player"](function(player, ...)
local mclplayer = mcl_player_mgr.players[player:get_player_name()]
local func = mclplayer[funcname or wrapper]
if func then
func(mclplayer, ...)
end
end)
end
add_player_wrapper("on_punch")
add_player_wrapper("on_rightclick")
add_player_wrapper("on_death", "register_on_dieplayer")
add_player_wrapper("on_respawn")
minetest.register_on_player_hpchange(function(player, hp_change, reason)
if not reason.auto then
local mclplayer = mcl_object_mgr.get(player)
local source = MCLDamageSource():from_mt(reason)
mclplayer:damage(hp_change, source)
return true
end
end, true)

View File

@ -66,3 +66,58 @@ function mcl_particles.delete_node_particlespawners(pos)
end end
return false return false
end end
-- 3 exptime variants because the animation is not tied to particle expiration time.
-- 3 colorized variants to imitate minecraft's
local smoke_pdef_cached = {}
function mcl_particles.spawn_smoke(pos, name, smoke_pdef_base)
local min = math.min
local new_minpos = vector.add(pos, smoke_pdef_base.minrelpos)
local new_maxpos = vector.add(pos, smoke_pdef_base.maxrelpos)
-- populate the cache
if smoke_pdef_cached[name] then
for i, smoke_pdef in ipairs(smoke_pdef_cached[name]) do
smoke_pdef.minpos = new_minpos
smoke_pdef.maxpos = new_maxpos
mcl_particles.add_node_particlespawner(pos, smoke_pdef, "high")
end
-- cache already populated
else
smoke_pdef_cached[name] = {}
local smoke_pdef = table.copy(smoke_pdef_base)
smoke_pdef.amount = smoke_pdef_base.amount / 9
smoke_pdef.time = 0
smoke_pdef.animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
-- length = 3 exptime variants
}
smoke_pdef.collisiondetection = true
smoke_pdef.minpos = new_minpos
smoke_pdef.maxpos = new_maxpos
-- the last frame plays for 1/8 * N seconds, so we can take advantage of it
-- to have varying exptime for each variant.
local exptimes = { 0.175, 0.375, 1.0 }
local colorizes = { "199", "209", "243" } -- round(78%, 82%, 90% of 256) - 1
for _,exptime in ipairs(exptimes) do
for _,colorize in ipairs(colorizes) do
smoke_pdef.maxexptime = exptime * smoke_pdef_base.maxexptime
smoke_pdef.animation.length = exptime + 0.1
-- minexptime must be set such that the last frame is actully rendered,
-- even if its very short. Larger exptime -> larger range
smoke_pdef.minexptime = min(exptime, (7.0/8.0 * (exptime + 0.1) + 0.1))
smoke_pdef.texture = "mcl_particles_smoke_anim.png^[colorize:#000000:" ..colorize
mcl_particles.add_node_particlespawner(pos, smoke_pdef, "high")
table.insert(smoke_pdef_cached[name], table.copy(smoke_pdef))
end
end
end
end

View File

@ -1,19 +0,0 @@
MCLPlayer = class(MCLObject)
MCLPlayer:__cache_getter("meta", function(self)
return self.object:get_meta()
end)
MCLPlayer:__cache_getter("inventory", function(self)
return self.object:get_inventory()
end)
MCLPlayer:__override_pipe("death_drop", function(self, inventory, listname, index, stack)
if not mcl_gamerules.keepInventory then
return self, inventory, listname, index, stack
end
end)
function MCLPlayer:on_damage(damage, source, knockback)
MCLObject.on_damage(self, damage, source, knockback)
end

View File

@ -410,7 +410,7 @@ function mcl_util.get_color(colorstr)
local mc_color = mcl_colors[colorstr:upper()] local mc_color = mcl_colors[colorstr:upper()]
if mc_color then if mc_color then
colorstr = mc_color colorstr = mc_color
elseif #colorstr ~= 7 or colorstr:sub(1, 1) ~= "#"then elseif #colorstr ~= 7 or colorstr:sub(1, 1) ~= "#" then
return return
end end
local hex = tonumber(colorstr:sub(2, 7), 16) local hex = tonumber(colorstr:sub(2, 7), 16)
@ -418,31 +418,3 @@ function mcl_util.get_color(colorstr)
return colorstr, hex return colorstr, hex
end end
end end
function mcl_util.registration_function(tbl, func)
return function(name, def)
if func then
local res = func(name, def)
if res == false then
return
elseif res ~= nil then
def = res
end
end
tbl[name] = def
end
end
function mcl_util.rand(pr, ...)
return pr and pr:next(...) or math.random(...)
end
function mcl_util.rand_bool(probability, pr)
if probability >= 1 then
return true
elseif probability <= 0 then
return false
else
return mcl_util.rand(pr, 0, 32767) < probability * 32768
end
end

View File

@ -0,0 +1,80 @@
# mcl_worlds
This mod provides utility functions about positions and dimensions.
## mcl_worlds.is_in_void(pos)
This function returns:
* true, true: if pos is in deep void (deadly)
* true, false: if the pos is in void (non deadly)
* false, false: owerwise
Params:
* pos: position
## mcl_worlds.y_to_layer(y)
This function is used to calculate the minetest y layer and dimension of the given <y> minecraft layer.
Mainly used for ore generation.
Takes an Y coordinate as input and returns:
* The corresponding Minecraft layer (can be nil if void)
* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if <y> is in the void
If the Y coordinate is not located in any dimension, it will return: nil, "void"
Params:
* y: int
## mcl_worlds.pos_to_dimension(pos)
This function return the Minecraft dimension of <pos> ("overworld", "nether" or "end") or "void" if <y> is in the void.
* pos: position
## mcl_worlds.layer_to_y(layer, mc_dimension)
Takes a Minecraft layer and a “dimension” name and returns the corresponding Y coordinate for MineClone 2.
mc_dimension can be "overworld", "nether", "end" (default: "overworld").
* layer: int
* mc_dimension: string
## mcl_worlds.has_weather(pos)
Returns true if <pos> can have weather, false owerwise.
Weather can be only in the overworld.
* pos: position
## mcl_worlds.has_dust(pos)
Returns true if <pos> can have nether dust, false owerwise.
Nether dust can be only in the nether.
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if compasses are working at <pos>, false owerwise.
In mc, you cant use compass in the nether and the end.
* pos: position
## mcl_worlds.compass_works(pos)
Returns true if clock are working at <pos>, false owerwise.
In mc, you cant use clock in the nether and the end.
* pos: position
## mcl_worlds.register_on_dimension_change(function(player, dimension))
Register a callback function func(player, dimension).
It will be called whenever a player changes between dimensions.
The void counts as dimension.
* player: player, the player who changed the dimension
* dimension: position, The new dimension of the player ("overworld", "nether", "end", "void").
## mcl_worlds.registered_on_dimension_change
Table containing all function registered with mcl_worlds.register_on_dimension_change()
## mcl_worlds.dimension_change(player, dimension)
Notify this mod of a dimmension change of <player> to <dimension>
* player: player, player who changed the dimension
* dimension: string, new dimension ("overworld", "nether", "end", "void")

View File

@ -6,7 +6,7 @@ mcl_worlds = {}
function mcl_worlds.is_in_void(pos) function mcl_worlds.is_in_void(pos)
local void = local void =
not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or not ((pos.y < mcl_vars.mg_overworld_max and pos.y > mcl_vars.mg_overworld_min) or
(pos.y < mcl_vars.mg_nether_max and pos.y > mcl_vars.mg_nether_min) or (pos.y < mcl_vars.mg_nether_max+128 and pos.y > mcl_vars.mg_nether_min) or
(pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min)) (pos.y < mcl_vars.mg_end_max and pos.y > mcl_vars.mg_end_min))
local void_deadly = false local void_deadly = false
@ -15,11 +15,11 @@ function mcl_worlds.is_in_void(pos)
-- Overworld → Void → End → Void → Nether → Void -- Overworld → Void → End → Void → Nether → Void
if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then if pos.y < mcl_vars.mg_overworld_min and pos.y > mcl_vars.mg_end_max then
void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance void_deadly = pos.y < mcl_vars.mg_overworld_min - deadly_tolerance
elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max then elseif pos.y < mcl_vars.mg_end_min and pos.y > mcl_vars.mg_nether_max+128 then
-- The void between End and Nether. Like usual, but here, the void -- The void between End and Nether. Like usual, but here, the void
-- *above* the Nether also has a small tolerance area, so player -- *above* the Nether also has a small tolerance area, so player
-- can fly above the Nether without getting hurt instantly. -- can fly above the Nether without getting hurt instantly.
void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max + deadly_tolerance) void_deadly = (pos.y < mcl_vars.mg_end_min - deadly_tolerance) and (pos.y > mcl_vars.mg_nether_max+128 + deadly_tolerance)
elseif pos.y < mcl_vars.mg_nether_min then elseif pos.y < mcl_vars.mg_nether_min then
void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance void_deadly = pos.y < mcl_vars.mg_nether_min - deadly_tolerance
end end
@ -35,7 +35,7 @@ end
function mcl_worlds.y_to_layer(y) function mcl_worlds.y_to_layer(y)
if y >= mcl_vars.mg_overworld_min then if y >= mcl_vars.mg_overworld_min then
return y - mcl_vars.mg_overworld_min, "overworld" return y - mcl_vars.mg_overworld_min, "overworld"
elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max then elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max+128 then
return y - mcl_vars.mg_nether_min, "nether" return y - mcl_vars.mg_nether_min, "nether"
elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then
return y - mcl_vars.mg_end_min, "end" return y - mcl_vars.mg_end_min, "end"
@ -73,7 +73,7 @@ end
-- Takes a position and returns true if this position can have Nether dust -- Takes a position and returns true if this position can have Nether dust
function mcl_worlds.has_dust(pos) function mcl_worlds.has_dust(pos)
-- Weather in the Overworld and the high part of the void below -- Weather in the Overworld and the high part of the void below
return pos.y <= mcl_vars.mg_nether_max + 64 and pos.y >= mcl_vars.mg_nether_min - 64 return pos.y <= mcl_vars.mg_nether_max + 138 and pos.y >= mcl_vars.mg_nether_min - 10
end end
-- Takes a position (pos) and returns true if compasses are working here -- Takes a position (pos) and returns true if compasses are working here

View File

@ -1,101 +0,0 @@
mcl_loottables.register_entry = mcl_util.registration_function(mcl_loottables.entries)
mcl_loottables.register_table = mcl_util.registration_function(mcl_loottables.tables, function(name, def)
local function set_parents(parent)
for _, child in ipairs(parent.children or parent.entries or parent.pools or {}) do
child.parent = parent
set_parents(child)
end
end
set_parents(def)
end)
function mcl_loottables.get_entry_type(entry)
return mcl_loottables.entries[entry.type]
end
function mcl_loottables.get_candidates(entries, data, func)
local candidates = {}
for _, entry in ipairs(entries) do
local success = mcl_predicates.do_predicates(entry.conditions, data)
if success then
local children = entry.children
if children then
table.insert_all(candidates, mcl_loottables.get_candidates(children, data, mcl_loottables.get_entry_type(entry).preprocess))
else
table.insert(candidates, entry)
end
end
if func and func(success, data) then
break
end
end
return candidates
end
function mcl_loottables.do_item_modifiers(itemstack, node, data)
if node then
mcl_item_modifiers.do_item_modifiers(itemstack, node.functions, data)
mcl_loottables.do_item_modifiers(itemstack, node.parent, data)
end
end
function mcl_loottables.do_pools(pools, functions, data)
local luck = data.luck or 0
local stacks = {}
for _, pool in ipairs(pools or {}) do
if mcl_predicates.do_predicates(pool.conditions, data) do
local rolls = mcl_numbers.get_number(pool.rolls, data) + mcl_numbers.get_number(pool.bonus_rolls, data) * luck
for i = 1, rolls do
local candidates = mcl_loottables.get_candidates(pool.entries, data)
if #candidates > 0 then
local total_weight = 0
local weights = {}
for _, candidate in ipairs(candidates)
total_weight = total_weight + math.floor((candidate.weight or 1) + (candidate.quality or 0) * luck)
table.insert(weights, total_weight)
end
local selected
local rnd = mcl_util.rand(data.pr, 0, weight - 1)
for i, w in ipairs(weights) do
if rnd < w then
selected = candidates[i]
break
end
end
local pool_stacks = mcl_loottables.get_entry_type(entry).process(selected, data)
for _, stack in ipairs(pool_stacks) do
mcl_item_modifiers.do_item_modifiers(stack, selected, data)
end
table.insert_all(stacks, pool_stacks)
end
end
end
end
return stacks
end
function mcl_loottables.get_loot(def, data)
if type(def) == "string" then
def = mcl_loottables.tables[def]
end
return mcl_loottables.do_pools(def.pools)
end
function mcl_loottables.drop_loot(def, data)
local loot = mcl_loottables.get_loot(def, data)
local old_loot = table.copy(loot)
for _, stack in ipairs(old_loot) do
local max_stack = stack:get_stack_max()
while max_stack < stack:get_count() do
table.insert(loot, stack:take_items(max_stack))
end
end
return loot
end

View File

@ -1,44 +0,0 @@
mcl_loottables.register_entry("mcl_loottables:alternatives", {
preprocess = function(success, data)
return success
end,
})
mcl_loottables.register_entry("mcl_loottables:group", {
preprocess = function(success, data)
return false
end,
})
mcl_loottables.register_entry("mcl_loottables:sequence", {
preprocess = function(success, data)
return not success
end,
})
mcl_loottables.register_entry("mcl_loottables:tag", function(entry, data)
local stacks = mcl_groupcache.get_items_in_group(entry.name)
if entry.expand then
stacks = {stacks[pr:next(1, #stacks)]}
end
return stacks
end)
mcl_loottables.register_entry("mcl_loottables:loot_table", {
process = function(entry, data)
return mcl_loottables.get_loot(entry.name, data)
end,
})
mcl_loottables.register_entry("mcl_loottables:empty", {
process = function(entry, data)
return {}
end,
})
mcl_loottables.register_entry("mcl_loottables:item", {
process = function(entry, data)
return {item = ItemStack(entry.name)}
end,
})

View File

@ -1,9 +0,0 @@
mcl_loottables = {
tables = {},
entries = {},
}
local modpath = minetest.get_modpath("mcl_loottables")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/entries.lua")

View File

@ -1,4 +0,0 @@
name = mcl_loottables
author = Fleckenstein
description = Provides Minecraft-like loot table definitions
depends = mcl_util, mcl_predicates, mcl_item_modifiers, mcl_groupcache

View File

@ -1,19 +0,0 @@
mcl_numbers.register_provider = mcl_util.registration_function(mcl_numbers.providers)
function mcl_numbers.get_number(provider, data)
if type(provider) == "number" then
return provider
else
mcl_numbers.providers[data.type](provider, data)
end
end
function mcl_numbers.match_bounds(actual, expected, data)
if type(expected) == "table" then
expected = {
min = mcl_numbers.get_number(expected.min, data),
max = mcl_numbers.get_number(expected.max, data)
}
end
return mcl_util.match_bounds(actual, expected)
end

View File

@ -1,25 +0,0 @@
mcl_numbers = {
providers = {},
}
dofile(minetest.get_modpath("mcl_numbers") .. "/api.lua")
mcl_numbers.register_provider("mcl_numbers:constant", function(provider)
return provider.value
end)
mcl_numbers.register_provider("mcl_numbers:uniform", function(provider, data)
return mcl_util.rand(data.pr, mcl_numbers.get_number(provider.min, data), mcl_numbers.get_number(provider.max, data))
end)
mcl_numbers.register_provider("mcl_numbers:binomial", function(provider, data)
local n = mcl_numbers.get_number(provider.n, data)
local num = 0
for i = 1, n do
if mcl_util.rand_bool(mcl_numbers.get_number(provider.p, data), data.pr) then
num = num + 1
end
end
return num
end)

View File

@ -1,4 +0,0 @@
name = mcl_numbers
author = Fleckenstein
description = Minecraft-like number providers
depends = mcl_util

View File

@ -1,15 +0,0 @@
mcl_predicates.register_predicate = mcl_util.registration_function(mcl_predicates.predicates)
function mcl_predicates.do_predicates(predicates, data, or_mode)
or_mode = or_mode or false
for _, func in ipairs(predicates) do
if type(func) == "string" then
func = mcl_predicates.predicates[func]
end
local failure = func and not func(def, data) or false
if or_mode ~= failure then
return or_mode
end
end
return not or_mode or #predicates == 0
end

View File

@ -1,104 +0,0 @@
mcl_predicates = {
predicates = {},
}
local modpath = minetest.get_modpath("mcl_predicates")
dofile(modpath .. "/api.lua")
mcl_predicates.register_predicate("alternative", function(predicate, data)
return mcl_predicates.do_predicates(predicate.terms, data, true)
end)
mcl_predicates.register_predicate("match_node", function(predicate, data)
return mcl_types.match_node(data.node or minetest.get_node(data.pos), predicate, data.pos, data.nodemeta)
end)
mcl_predicates.register_predicate("damage_source_properties", function(predicate, data)
-- ToDo: damage source abstraction
return nil
end)
mcl_predicates.register_predicate("entity_properties", function(predicate, data)
local entity = predicate.entity
if not entity or (entity ~= "this" and entity ~= "killer" and entity ~= "killer_player") then
return false
end
local ref = data[entity]
if not ref then
return false
end
-- ToDo: entity / player abstraction
return nil
end)
mcl_predicates.register_predicate("entity_scores", function(predicate, data)
-- ToDo: scoreboards
return nil
end)
mcl_predicates.register_predicate("inverted", function(predicate, data)
return not mcl_predicates.do_predicates({predicate.term}, data)
end)
mcl_predicates.register_predicate("killed_by_player", function(predicate, data)
return not predicate.inverse ~= not data.killer_player
end)
mcl_predicates.register_predicate("location_check", function(predicate, data)
local pos = vector.add(data.pos, vector.new(predicate.offset_x or 0, predicate.offset_y or 0, predicate.offset_z or 0))
return mcl_location(pos, data.nodemeta):match(predicate.predicate)
end)
mcl_predicates.register_predicate("match_tool", function(predicate, data)
return mcl_predicates.match_tool(data.tool, predicate.predicate)
end)
mcl_predicates.register_predicate("random_chance", function(predicate, data)
return mcl_util.rand_bool(predicate.chance, data.pr)
end)
mcl_predicates.register_predicate("random_chance_with_looting", function(predicate, data)
local chance = predicate.chance -- + (looting_level * looting_multiplier)
-- ToDo: entity / player abstraction
return mcl_util.rand_bool(chance, data.pr)
end)
mcl_predicates.register_predicate("reference", function(predicate, data)
-- ToDo: needs research
return nil
end)
mcl_predicates.register_predicate("survives_explosion", function(predicate, data)
return mcl_util.rand_bool(data.drop_chance or 1, data.pr)
end)
mcl_predicates.register_predicate("table_bonus", function(predicate, data)
-- ToDo: entity / player abstraction
return nil
end)
mcl_predicates.register_predicate("time_check", function(predicate, data)
-- ToDo: needs research
return nil
end)
mcl_predicates.register_predicate("weather_check", function(predicate, data)
local weather = mcl_weather.get_weather()
if predicate.thundering then
return weather == "thunder"
elseif predicate.raining then
return weather == "rain"
else
return true
end
end)
mcl_predicates.register_predicate("value_check", function(predicate, data)
local value = mcl_numbers.get_number(predicate.value, data)
return mcl_numbers.check_in_bounds(value, predicate.range, data)
end)

View File

@ -1,4 +0,0 @@
name = mcl_predicates
author = Fleckenstein
description = Provides MC-like predicates
depends = mcl_util, mcl_numbers

View File

@ -1,88 +0,0 @@
mcl_types = {}
function mcl_types.match_bounds(actual, expected)
if type(expected) == "table" then
return actual <= expected.max and actual >= expected.min
else
return actual == expected
end
end
function mcl_types.match_meta(actual, expected)
for k, v in pairs(expected) do
if actual:get_string(k) ~= v then
return false
end
end
return true
end
function mcl_types.match_vector(actual, expected)
for k, v in pairs(expected) do
if not mcl_types.match_bounds(actual[k], expected[k]) then
return false
end
end
return true
end
function mcl_types.match_enchantments(actual, expected)
for _, v in ipairs(expected) do
if not mcl_types.match_bounds(actual[v.enchantment] or 0, v.levels or {min = 1, max = math.huge}) then
return false
end
end
return true
end
function mcl_types.match_item(actual, expected)
actual = actual or ItemStack()
if expected.item and actual:get_name() ~= expected.item then
return false
elseif expected.group and minetest.get_item_group(actual:get_name(), expected.group) == 0 then
return false
elseif expected.count and not mcl_types.match_bounds(actual:get_count(), expected.count) then
return false
elseif expected.wear and not mcl_types.match_bounds(actual:get_wear(), expected.wear) then
return false
elseif expected.enchantments and not mcl_types.match_enchantments(mcl_enchanting.get_enchantments(actual), expected.enchantments) then
return false
elseif expected.meta and not mcl_types.match_meta(actual:get_meta(), expected.meta) then
return false
else
return true
end
end
function mcl_types.match_node(actual, expected, pos, meta)
if expected.node and actual.name ~= expected.node then
return false
elseif expected.group and minetest.get_item_group(actual.name, expected.group) == 0 then
return false
elseif expected.param1 and actual.param1 ~= compare.param1 then
return false
elseif expected.param2 and actual.param2 ~= compare.param2 then
return false
elseif expected.meta and not mcl_types.match_meta(meta or minetest.get_meta(pos), expected.meta) then
return false
else
return true
end
end
function mcl_types.match_pos(actual, expected, meta)
if expected.pos and not mcl_types.match_vector(actual, expected.pos) then
return false
elseif expected.dimension and mcl_worlds.pos_to_dimension(actual) ~= expected.dimension then
return false
elseif expected.biome and minetest.get_biome_name(minetest.get_biome_data(actual).biome) ~= expected.biome then
return false
elseif expected.node and not mcl_types.match_node(minetest.get_node(actual), expected.node, actual, meta) then
return false
elseif expected.light and not mcl_types.match_bounds(minetest.get_node_light(actual), expected.light) then
return false
else
return true
end
end

View File

@ -1,4 +0,0 @@
name = mcl_types
author = Fleckenstein
description = Offers compare functions for many types, used for MineClone2 datapacks
depends =

View File

@ -1,2 +0,0 @@
name = DATA
description = Meta-modpack containing the datapack system for MineClone 2

View File

@ -1,6 +1,6 @@
local S = minetest.get_translator("mcl_boats") local S = minetest.get_translator("mcl_boats")
local boat_visual_size = {x = 3, y = 3, z = 3} local boat_visual_size = {x = 1, y = 1, z = 1}
local paddling_speed = 22 local paddling_speed = 22
local boat_y_offset = 0.35 local boat_y_offset = 0.35
local boat_y_offset_ground = boat_y_offset + 0.6 local boat_y_offset_ground = boat_y_offset + 0.6
@ -12,9 +12,7 @@ local function is_group(pos, group)
return minetest.get_item_group(nn, group) ~= 0 return minetest.get_item_group(nn, group) ~= 0
end end
local function is_water(pos) local is_water = flowlib.is_water
return is_group(pos, "water")
end
local function is_ice(pos) local function is_ice(pos)
return is_group(pos, "ice") return is_group(pos, "ice")
@ -247,7 +245,7 @@ function boat.on_step(self, dtime, moveresult)
else else
local ctrl = self._passenger:get_player_control() local ctrl = self._passenger:get_player_control()
if ctrl and ctrl.sneak then if ctrl and ctrl.sneak then
detach_player(self._passenger, true) detach_object(self._passenger, true)
self._passenger = nil self._passenger = nil
end end
end end

View File

@ -1,7 +1,7 @@
name = mcl_boats name = mcl_boats
author = PilzAdam author = PilzAdam
description = Adds drivable boats. description = Adds drivable boats.
depends = mcl_player depends = mcl_player, flowlib
optional_depends = mcl_core, doc_identifier optional_depends = mcl_core, doc_identifier

View File

@ -117,6 +117,10 @@ function mcl_burning.damage(obj)
end end
function mcl_burning.set_on_fire(obj, burn_time, reason) function mcl_burning.set_on_fire(obj, burn_time, reason)
if obj:get_hp() < 0 then
return
end
local luaentity = obj:get_luaentity() local luaentity = obj:get_luaentity()
if luaentity and luaentity.fire_resistant then if luaentity and luaentity.fire_resistant then
return return
@ -145,7 +149,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
end end
if old_burn_time <= burn_time then if old_burn_time <= burn_time then
local sound_id = mcl_burning.get(obj, "int", "sound_id") --[[local sound_id = mcl_burning.get(obj, "int", "sound_id")
if sound_id == 0 then if sound_id == 0 then
sound_id = minetest.sound_play("fire_fire", { sound_id = minetest.sound_play("fire_fire", {
object = obj, object = obj,
@ -153,7 +157,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
max_hear_distance = 16, max_hear_distance = 16,
loop = true, loop = true,
}) + 1 }) + 1
end end]]--
local hud_id local hud_id
if obj:is_player() then if obj:is_player() then
@ -163,7 +167,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.5, y = 0.5}, position = {x = 0.5, y = 0.5},
scale = {x = -100, y = -100}, scale = {x = -100, y = -100},
text = "fire_basic_flame.png", text = "mcl_burning_entity_flame_animated.png^[opacity:180^[verticalframe:" .. mcl_burning.animation_frames .. ":" .. 1,
z_index = 1000, z_index = 1000,
}) + 1 }) + 1
end end
@ -171,7 +175,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
mcl_burning.set(obj, "float", "burn_time", burn_time) mcl_burning.set(obj, "float", "burn_time", burn_time)
mcl_burning.set(obj, "string", "reason", reason) mcl_burning.set(obj, "string", "reason", reason)
mcl_burning.set(obj, "int", "hud_id", hud_id) mcl_burning.set(obj, "int", "hud_id", hud_id)
mcl_burning.set(obj, "int", "sound_id", sound_id) --mcl_burning.set(obj, "int", "sound_id", sound_id)
local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire") local fire_entity = minetest.add_entity(obj:get_pos(), "mcl_burning:fire")
local minp, maxp = mcl_burning.get_collisionbox(obj) local minp, maxp = mcl_burning.get_collisionbox(obj)
@ -194,8 +198,8 @@ end
function mcl_burning.extinguish(obj) function mcl_burning.extinguish(obj)
if mcl_burning.is_burning(obj) then if mcl_burning.is_burning(obj) then
local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1 --local sound_id = mcl_burning.get(obj, "int", "sound_id") - 1
minetest.sound_stop(sound_id) --minetest.sound_stop(sound_id)
if obj:is_player() then if obj:is_player() then
local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1 local hud_id = mcl_burning.get(obj, "int", "hud_id") - 1
@ -206,7 +210,7 @@ function mcl_burning.extinguish(obj)
mcl_burning.set(obj, "float", "burn_time") mcl_burning.set(obj, "float", "burn_time")
mcl_burning.set(obj, "float", "damage_timer") mcl_burning.set(obj, "float", "damage_timer")
mcl_burning.set(obj, "int", "hud_id") mcl_burning.set(obj, "int", "hud_id")
mcl_burning.set(obj, "int", "sound_id") --mcl_burning.set(obj, "int", "sound_id")
end end
end end

View File

@ -1,5 +1,8 @@
local S = minetest.get_translator("mcl_falling_nodes") local S = minetest.get_translator("mcl_falling_nodes")
local dmes = minetest.get_modpath("mcl_death_messages") ~= nil local dmes = minetest.get_modpath("mcl_death_messages") ~= nil
local has_mcl_armor = minetest.get_modpath("mcl_armor")
local is_creative_enabled = minetest.is_creative_enabled
local get_falling_depth = function(self) local get_falling_depth = function(self)
if not self._startpos then if not self._startpos then
@ -13,9 +16,8 @@ local deal_falling_damage = function(self, dtime)
if minetest.get_item_group(self.node.name, "falling_node_damage") == 0 then if minetest.get_item_group(self.node.name, "falling_node_damage") == 0 then
return return
end end
-- Cause damage to any player it hits. -- Cause damage to any entity it hits.
-- Algorithm based on MC anvils. -- Algorithm based on MC anvils.
-- TODO: Support smashing other objects, too.
local pos = self.object:get_pos() local pos = self.object:get_pos()
if not self._startpos then if not self._startpos then
-- Fallback -- Fallback
@ -23,30 +25,39 @@ local deal_falling_damage = function(self, dtime)
end end
local objs = minetest.get_objects_inside_radius(pos, 1) local objs = minetest.get_objects_inside_radius(pos, 1)
for _,v in ipairs(objs) do for _,v in ipairs(objs) do
local hp = v:get_hp() if v:is_player() then
if v:is_player() and hp ~= 0 then local hp = v:get_hp()
if not self._hit_players then
self._hit_players = {}
end
local name = v:get_player_name() local name = v:get_player_name()
local hit = false if hp ~= 0 then
for _,v in ipairs(self._hit_players) do if not self._hit_players then
if name == v then self._hit_players = {}
hit = true
end end
end local hit = false
if not hit then for _,v in ipairs(self._hit_players) do
table.insert(self._hit_players, name) if name == v then
local way = self._startpos.y - pos.y hit = true
local damage = (way - 1) * 2
damage = math.min(40, math.max(0, damage))
if damage >= 1 then
hp = hp - damage
if hp < 0 then
hp = 0
end end
if v:is_player() then end
-- TODO: Reduce damage if wearing a helmet if not hit then
table.insert(self._hit_players, name)
local way = self._startpos.y - pos.y
local damage = (way - 1) * 2
damage = math.min(40, math.max(0, damage))
if damage >= 1 then
hp = hp - damage
if hp < 0 then
hp = 0
end
-- Reduce damage if wearing a helmet
local inv = v:get_inventory()
local helmet = inv:get_stack("armor", 2)
if has_mcl_armor and not helmet:is_empty() then
hp = hp/4*3
if not is_creative_enabled(name) then
helmet:add_wear(65535/helmet:get_definition().groups.mcl_armor_uses) --TODO: be sure damage is exactly like mc (informations are missing in the mc wiki)
inv:set_stack("armor", 2, helmet)
end
end
local msg local msg
if minetest.get_item_group(self.node.name, "anvil") ~= 0 then if minetest.get_item_group(self.node.name, "anvil") ~= 0 then
msg = S("@1 was smashed by a falling anvil.", v:get_player_name()) msg = S("@1 was smashed by a falling anvil.", v:get_player_name())
@ -56,8 +67,35 @@ local deal_falling_damage = function(self, dtime)
if dmes then if dmes then
mcl_death_messages.player_damage(v, msg) mcl_death_messages.player_damage(v, msg)
end end
v:set_hp(hp, { type = "punch", from = "mod" })
end
end
end
else
local hp = v:get_luaentity().health
if hp and hp ~= 0 then
if not self._hit_mobs then
self._hit_mobs = {}
end
local hit = false
for _,mob in ipairs(self._hit_mobs) do
if v == mob then
hit = true
end
end
--TODO: reduce damage for mobs then they will be able to wear armor
if not hit then
table.insert(self._hit_mobs, v)
local way = self._startpos.y - pos.y
local damage = (way - 1) * 2
damage = math.min(40, math.max(0, damage))
if damage >= 1 then
hp = hp - damage
if hp < 0 then
hp = 0
end
v:get_luaentity().health = hp
end end
v:set_hp(hp, { type = "punch", from = "mod" })
end end
end end
end end

View File

@ -1,10 +1,36 @@
--these are lua locals, used for higher performance
local minetest,math,vector,ipairs = minetest,math,vector,ipairs
--this is used for the player pool in the sound buffer
local pool = {}
local tick = false
minetest.register_on_joinplayer(function(player)
local name
name = player:get_player_name()
pool[name] = 0
end)
minetest.register_on_leaveplayer(function(player)
local name
name = player:get_player_name()
pool[name] = nil
end)
local has_awards = minetest.get_modpath("awards")
local mcl_item_entity = {}
--basic settings --basic settings
local item_drop_settings = {} --settings table local item_drop_settings = {} --settings table
item_drop_settings.dug_buffer = 0.65 -- the warm up period before a dug item can be collected
item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting
item_drop_settings.radius_magnet = 2.0 --radius of item magnet. MUST BE LARGER THAN radius_collect! item_drop_settings.radius_magnet = 2.0 --radius of item magnet. MUST BE LARGER THAN radius_collect!
item_drop_settings.xp_radius_magnet = 7.25 --radius of xp magnet. MUST BE LARGER THAN radius_collect! item_drop_settings.xp_radius_magnet = 7.25 --radius of xp magnet. MUST BE LARGER THAN radius_collect!
item_drop_settings.radius_collect = 0.2 --radius of collection item_drop_settings.radius_collect = 0.2 --radius of collection
item_drop_settings.player_collect_height = 1.0 --added to their pos y value item_drop_settings.player_collect_height = 0.8 --added to their pos y value
item_drop_settings.collection_safety = false --do this to prevent items from flying away on laggy servers item_drop_settings.collection_safety = false --do this to prevent items from flying away on laggy servers
item_drop_settings.random_item_velocity = true --this sets random item velocity if velocity is 0 item_drop_settings.random_item_velocity = true --this sets random item velocity if velocity is 0
item_drop_settings.drop_single_item = false --if true, the drop control drops 1 item instead of the entire stack, and sneak+drop drops the stack item_drop_settings.drop_single_item = false --if true, the drop control drops 1 item instead of the entire stack, and sneak+drop drops the stack
@ -16,16 +42,33 @@ local get_gravity = function()
return tonumber(minetest.settings:get("movement_gravity")) or 9.81 return tonumber(minetest.settings:get("movement_gravity")) or 9.81
end end
local registered_pickup_achievement = {}
--TODO: remove limitation of 1 award per itemname
function mcl_item_entity.register_pickup_achievement(itemname, award)
if not has_awards then
minetest.log("warning", "[mcl_item_entity] Trying to register pickup achievement ["..award.."] for ["..itemname.."] while awards missing")
elseif registered_pickup_achievement[itemname] then
minetest.log("error", "[mcl_item_entity] Trying to register already existing pickup achievement ["..award.."] for ["..itemname.."]")
else
registered_pickup_achievement[itemname] = award
end
end
mcl_item_entity.register_pickup_achievement("tree", "mcl:mineWood")
mcl_item_entity.register_pickup_achievement("mcl_mobitems:blaze_rod", "mcl:blazeRod")
mcl_item_entity.register_pickup_achievement("mcl_mobitems:leather", "mcl:killCow")
mcl_item_entity.register_pickup_achievement("mcl_core:diamond", "mcl:diamonds")
local check_pickup_achievements = function(object, player) local check_pickup_achievements = function(object, player)
local itemname = ItemStack(object:get_luaentity().itemstring):get_name() if has_awards then
if minetest.get_item_group(itemname, "tree") ~= 0 then local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
awards.unlock(player:get_player_name(), "mcl:mineWood") local playername = player:get_player_name()
elseif itemname == "mcl_mobitems:blaze_rod" then for name,award in pairs(registered_pickup_achievement) do
awards.unlock(player:get_player_name(), "mcl:blazeRod") if itemname == name or minetest.get_item_group(itemname, name) ~= 0 then
elseif itemname == "mcl_mobitems:leather" then awards.unlock(playername, award)
awards.unlock(player:get_player_name(), "mcl:killCow") end
elseif itemname == "mcl_core:diamond" then end
awards.unlock(player:get_player_name(), "mcl:diamonds")
end end
end end
@ -53,103 +96,71 @@ local disable_physics = function(object, luaentity, ignore_check, reset_movement
end end
end end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
tick = not tick
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
local name = player:get_player_name()
local pos = player:get_pos() local pos = player:get_pos()
if tick == true and pool[name] > 0 then
minetest.sound_play("item_drop_pickup", {
pos = pos,
gain = 0.7,
max_hear_distance = 16,
pitch = math.random(70,110)/100
})
if pool[name] > 6 then
pool[name] = 6
else
pool[name] = pool[name] - 1
end
end
local inv = player:get_inventory() local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z} local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
--magnet and collection --magnet and collection
for _,object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do for _,object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and 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 if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and 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
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
local collected = false
if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then if object:get_luaentity()._magnet_timer >= 0 and 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 -- Collection
if vector.distance(checkpos, object:get_pos()) <= item_drop_settings.radius_collect and not object:get_luaentity()._removed then if not object:get_luaentity()._removed then
-- Ignore if itemstring is not set yet -- Ignore if itemstring is not set yet
if object:get_luaentity().itemstring ~= "" then if object:get_luaentity().itemstring ~= "" then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
minetest.sound_play("item_drop_pickup", {
pos = pos,
max_hear_distance = 16,
gain = 1.0,
}, true)
check_pickup_achievements(object, player)
check_pickup_achievements(object, player)
-- Destroy entity -- Destroy entity
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately. -- 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:get_luaentity()._removed = true
object:remove()
collected = true object:set_velocity({x=0,y=0,z=0})
object:set_acceleration({x=0,y=0,z=0})
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
-- Magnet
else
object:get_luaentity()._magnet_active = true
object:get_luaentity()._collector_timer = 0
-- Move object to player
disable_physics(object, object:get_luaentity())
local opos = object:get_pos()
local vec = vector.subtract(checkpos, opos)
vec = vector.add(opos, vector.divide(vec, 2))
object:move_to(vec)
--fix eternally falling items
minetest.after(0, function(object)
local lua = object:get_luaentity()
if lua then
object:set_acceleration({x=0, y=0, z=0})
end
end, object)
--this is a safety to prevent items flying away on laggy servers
if item_drop_settings.collection_safety == true then
if object:get_luaentity().init ~= true then
object:get_luaentity().init = true
minetest.after(1, function(args)
local playername = args[1]
local player = minetest.get_player_by_name(playername)
local object = args[2]
local lua = object:get_luaentity()
if player == nil or not player:is_player() or object == nil or lua == nil or lua.itemstring == nil then
return
end
if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
if not object:get_luaentity()._removed then
minetest.sound_play("item_drop_pickup", {
pos = pos,
max_hear_distance = 16,
gain = 1.0,
}, true)
end
check_pickup_achievements(object, player)
object:get_luaentity()._removed = true
object:remove()
else
enable_physics(object, object:get_luaentity())
end
end, {player:get_player_name(), object})
end
end
end
end
if not collected then
if object:get_luaentity()._magnet_timer > 1 then
object:get_luaentity()._magnet_timer = -item_drop_settings.magnet_time
object:get_luaentity()._magnet_active = false
elseif object:get_luaentity()._magnet_timer < 0 then
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
end end
end end
@ -165,66 +176,6 @@ minetest.register_globalstep(function(dtime)
end end
end) end)
local minigroups = { "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
local basegroups = { "pickaxey", "axey", "shovely" }
local materials = { "wood", "gold", "stone", "iron", "diamond" }
-- Checks if the given node would drop its useful drop if dug by a tool
-- with the given tool capabilities. Returns true if it will yield its useful
-- drop, false otherwise.
local check_can_drop = function(node_name, tool_capabilities)
local handy = minetest.get_item_group(node_name, "handy")
local dig_immediate = minetest.get_item_group(node_name, "dig_immediate")
if handy == 1 or dig_immediate == 2 or dig_immediate == 3 then
return true
else
local toolgroupcaps
if tool_capabilities then
toolgroupcaps = tool_capabilities.groupcaps
else
return false
end
-- Compare node groups with tool capabilities
for m=1, #minigroups do
local minigroup = minigroups[m]
local g = minetest.get_item_group(node_name, minigroup)
if g ~= 0 then
local plus = minigroup .. "_dig"
if toolgroupcaps[plus] then
return true
end
for e=1,5 do
local effplus = plus .. "_efficiency_" .. e
if toolgroupcaps[effplus] then
return true
end
end
end
end
for b=1, #basegroups do
local basegroup = basegroups[b]
local g = minetest.get_item_group(node_name, basegroup)
if g ~= 0 then
for m=g, #materials do
local plus = basegroup .. "_dig_"..materials[m]
if toolgroupcaps[plus] then
return true
end
for e=1,5 do
local effplus = plus .. "_efficiency_" .. e
if toolgroupcaps[effplus] then
return true
end
end
end
end
end
return false
end
end
-- Stupid workaround to get drops from a drop table: -- Stupid workaround to get drops from a drop table:
-- Create a temporary table in minetest.registered_nodes that contains the proper drops, -- Create a temporary table in minetest.registered_nodes that contains the proper drops,
-- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition -- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition
@ -269,29 +220,33 @@ local function get_fortune_drops(fortune_drops, fortune_level)
return drop or {} return drop or {}
end end
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
function minetest.handle_node_drops(pos, drops, digger) function minetest.handle_node_drops(pos, drops, digger)
-- NOTE: This function override allows digger to be nil. -- NOTE: This function override allows digger to be nil.
-- This means there is no digger. This is a special case which allows this function to be called -- This means there is no digger. This is a special case which allows this function to be called
-- by hand. Creative Mode is intentionally ignored in this case. -- by hand. Creative Mode is intentionally ignored in this case.
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
if (digger and digger:is_player() and minetest.is_creative_enabled(digger:get_player_name())) or doTileDrops == false then if (digger and digger:is_player() and minetest.is_creative_enabled(digger:get_player_name())) or doTileDrops == false then
return return
end end
-- Check if node will yield its useful drop by the digger's tool -- Check if node will yield its useful drop by the digger's tool
local dug_node = minetest.get_node(pos) local dug_node = minetest.get_node(pos)
local toolcaps local tooldef
local tool local tool
if digger ~= nil then if digger ~= nil then
tool = digger:get_wielded_item() tool = digger:get_wielded_item()
toolcaps = tool:get_tool_capabilities() tooldef = minetest.registered_tools[tool:get_name()]
if not check_can_drop(dug_node.name, toolcaps) then if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name()) then
return return
end end
end end
local diggroups = tooldef and tooldef._mcl_diggroups
local shearsy_level = diggroups and diggroups.shearsy and diggroups.shearsy.level
--[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop --[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop
from the node definition. from the node definition.
Definition of _mcl_shears_drop / _mcl_silk_touch_drop: Definition of _mcl_shears_drop / _mcl_silk_touch_drop:
@ -303,7 +258,7 @@ function minetest.handle_node_drops(pos, drops, digger)
local silk_touch_drop = false local silk_touch_drop = false
local nodedef = minetest.registered_nodes[dug_node.name] local nodedef = minetest.registered_nodes[dug_node.name]
if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then
if nodedef._mcl_shears_drop == true then if nodedef._mcl_shears_drop == true then
drops = { dug_node.name } drops = { dug_node.name }
else else
@ -371,6 +326,10 @@ function minetest.handle_node_drops(pos, drops, digger)
z = -z z = -z
end end
obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z}) obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z})
obj:get_luaentity().age = item_drop_settings.dug_buffer
obj:get_luaentity()._insta_collect = false
end end
end end
end end
@ -437,6 +396,9 @@ minetest.register_entity(":__builtin:item", {
-- Number of seconds this item entity has existed so far -- Number of seconds this item entity has existed so far
age = 0, age = 0,
-- How old it has become in the collection animation
collection_age = 0,
set_item = function(self, itemstring) set_item = function(self, itemstring)
self.itemstring = itemstring self.itemstring = itemstring
if self.itemstring == "" then if self.itemstring == "" then
@ -602,6 +564,11 @@ minetest.register_entity(":__builtin:item", {
on_step = function(self, dtime) on_step = function(self, dtime)
if self._removed then if self._removed then
self.object:set_properties({
physical = false
})
self.object:set_velocity({x=0,y=0,z=0})
self.object:set_acceleration({x=0,y=0,z=0})
return return
end end
self.age = self.age + dtime self.age = self.age + dtime

View File

@ -0,0 +1 @@
Item_Drop_Pickup - https://freesound.org/people/benniknop/sounds/317848/ (License: CC0)

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_minecarts") local S = minetest.get_translator("mcl_minecarts")
local has_mcl_wip = minetest.get_modpath("mcl_wip")
mcl_minecarts = {} mcl_minecarts = {}
mcl_minecarts.modpath = minetest.get_modpath("mcl_minecarts") mcl_minecarts.modpath = minetest.get_modpath("mcl_minecarts")
mcl_minecarts.speed_max = 10 mcl_minecarts.speed_max = 10
@ -663,8 +665,6 @@ register_minecart(
{"mcl_minecarts:minecart", "mcl_chests:chest"}, {"mcl_minecarts:minecart", "mcl_chests:chest"},
nil, nil, false) nil, nil, false)
mcl_wip.register_wip_item("mcl_minecarts:chest_minecart")
-- Minecart with Furnace -- Minecart with Furnace
register_minecart( register_minecart(
"mcl_minecarts:furnace_minecart", "mcl_minecarts:furnace_minecart",
@ -719,8 +719,6 @@ register_minecart(
end, nil, false end, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart")
-- Minecart with Command Block -- Minecart with Command Block
register_minecart( register_minecart(
"mcl_minecarts:command_block_minecart", "mcl_minecarts:command_block_minecart",
@ -742,8 +740,6 @@ register_minecart(
nil, nil, false nil, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart")
-- Minecart with Hopper -- Minecart with Hopper
register_minecart( register_minecart(
"mcl_minecarts:hopper_minecart", "mcl_minecarts:hopper_minecart",
@ -762,8 +758,6 @@ register_minecart(
nil, nil, false nil, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart")
-- Minecart with TNT -- Minecart with TNT
register_minecart( register_minecart(
"mcl_minecarts:tnt_minecart", "mcl_minecarts:tnt_minecart",
@ -824,29 +818,34 @@ minetest.register_craft({
-- TODO: Re-enable crafting of special minecarts when they have been implemented -- TODO: Re-enable crafting of special minecarts when they have been implemented
if false then if false then
minetest.register_craft({
output = "mcl_minecarts:furnace_minecart",
recipe = {
{"mcl_furnaces:furnace"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_minecarts:furnace_minecart", output = "mcl_minecarts:hopper_minecart",
recipe = { recipe = {
{"mcl_furnaces:furnace"}, {"mcl_hoppers:hopper"},
{"mcl_minecarts:minecart"}, {"mcl_minecarts:minecart"},
}, },
}) })
minetest.register_craft({
output = "mcl_minecarts:hopper_minecart",
recipe = {
{"mcl_hoppers:hopper"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({
output = "mcl_minecarts:chest_minecart",
recipe = {
{"mcl_chests:chest"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({
output = "mcl_minecarts:chest_minecart",
recipe = {
{"mcl_chests:chest"},
{"mcl_minecarts:minecart"},
},
})
end
if has_mcl_wip then
mcl_wip.register_wip_item("mcl_minecarts:chest_minecart")
mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart")
mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart")
mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart")
end end

View File

@ -1,6 +1,6 @@
name = mcl_minecarts name = mcl_minecarts
author = Krock author = Krock
description = Minecarts are vehicles to move players quickly on rails. description = Minecarts are vehicles to move players quickly on rails.
depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons, mcl_wip depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons
optional_depends = doc_identifier optional_depends = doc_identifier, mcl_wip

View File

@ -61,8 +61,6 @@ end
-- Load settings -- Load settings
local damage_enabled = minetest.settings:get_bool("enable_damage") local damage_enabled = minetest.settings:get_bool("enable_damage")
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local disable_blood = minetest.settings:get_bool("mobs_disable_blood")
local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
@ -84,11 +82,6 @@ if minetest.settings:get_bool("only_peaceful_mobs", false) then
end) end)
end end
-- calculate aoc range for mob count
local aosrb = tonumber(minetest.settings:get("active_object_send_range_blocks"))
local abr = tonumber(minetest.settings:get("active_block_range"))
local aoc_range = max(aosrb, abr) * 16
-- pathfinding settings -- pathfinding settings
local enable_pathfinding = true local enable_pathfinding = true
local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching
@ -283,6 +276,33 @@ local get_velocity = function(self)
return 0 return 0
end end
local function update_roll(self)
local is_Fleckenstein = self.nametag == "Fleckenstein"
local was_Fleckenstein = false
local rot = self.object:get_rotation()
rot.z = is_Fleckenstein and pi or 0
self.object:set_rotation(rot)
local cbox = table.copy(self.collisionbox)
local acbox = self.object:get_properties().collisionbox
if math.abs(cbox[2] - acbox[2]) > 0.1 then
was_Fleckenstein = true
end
if is_Fleckenstein ~= was_Fleckenstein then
local pos = self.object:get_pos()
pos.y = pos.y + (acbox[2] + acbox[5])
self.object:set_pos(pos)
end
if is_Fleckenstein then
cbox[2], cbox[5] = -cbox[5], -cbox[2]
end
self.object:set_properties({collisionbox = cbox})
end
-- set and return valid yaw -- set and return valid yaw
local set_yaw = function(self, yaw, delay, dtime) local set_yaw = function(self, yaw, delay, dtime)
@ -298,6 +318,7 @@ local set_yaw = function(self, yaw, delay, dtime)
yaw = yaw + (math.random() * 2 - 1) * 5 * dtime yaw = yaw + (math.random() * 2 - 1) * 5 * dtime
end end
self.object:set_yaw(yaw) self.object:set_yaw(yaw)
update_roll(self)
return yaw return yaw
end end
@ -645,9 +666,9 @@ local update_tag = function(self)
nametag = tag, nametag = tag,
}) })
update_roll(self)
end end
-- drop items -- drop items
local item_drop = function(self, cooked, looting_level) local item_drop = function(self, cooked, looting_level)
@ -707,7 +728,9 @@ local item_drop = function(self, cooked, looting_level)
end end
-- add item if it exists -- add item if it exists
obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) for x = 1, num do
obj = minetest.add_item(pos, ItemStack(item .. " " .. 1))
end
if obj and obj:get_luaentity() then if obj and obj:get_luaentity() then
@ -836,10 +859,12 @@ local check_for_death = function(self, cause, cmi_cause)
remove_texture_mod(self, "^[colorize:#FF000040") remove_texture_mod(self, "^[colorize:#FF000040")
remove_texture_mod(self, "^[brighten") remove_texture_mod(self, "^[brighten")
self.passive = true self.passive = true
self.object:set_properties({ self.object:set_properties({
pointable = false, pointable = false,
collide_with_objects = false, collide_with_objects = false,
}) })
set_velocity(self, 0) set_velocity(self, 0)
local acc = self.object:get_acceleration() local acc = self.object:get_acceleration()
acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0 acc.x, acc.y, acc.z = 0, DEFAULT_FALL_SPEED, 0
@ -2789,6 +2814,10 @@ local do_states = function(self, dtime)
local arrow, ent local arrow, ent
local v = 1 local v = 1
if not self.shoot_arrow then if not self.shoot_arrow then
self.firing = true
minetest.after(1, function()
self.firing = false
end)
arrow = minetest.add_entity(p, self.arrow) arrow = minetest.add_entity(p, self.arrow)
ent = arrow:get_luaentity() ent = arrow:get_luaentity()
if ent.velocity then if ent.velocity then
@ -2826,7 +2855,7 @@ local falling = function(self, pos)
end end
if mcl_portals ~= nil then if mcl_portals ~= nil then
if mcl_portals.nether_portal_cooloff[self.object] then if mcl_portals.nether_portal_cooloff(self.object) then
return false -- mob has teleported through Nether portal - it's 99% not falling return false -- mob has teleported through Nether portal - it's 99% not falling
end end
end end
@ -2856,6 +2885,18 @@ local falling = function(self, pos)
self.object:set_acceleration({x = 0, y = 0, z = 0}) self.object:set_acceleration({x = 0, y = 0, z = 0})
end end
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
if self.floats_on_lava == 1 then
self.object:set_acceleration({
x = 0,
y = -self.fall_speed / (max(1, v.y) ^ 2),
z = 0
})
end
end
-- in water then float up -- in water then float up
if minetest.registered_nodes[node_ok(pos).name].groups.water then if minetest.registered_nodes[node_ok(pos).name].groups.water then
@ -3475,18 +3516,11 @@ local mob_step = function(self, dtime)
yaw = yaw + (math.random() * 2 - 1) * 5 * dtime yaw = yaw + (math.random() * 2 - 1) * 5 * dtime
end end
self.object:set_yaw(yaw) self.object:set_yaw(yaw)
update_roll(self)
end end
-- end rotation -- end rotation
-- knockback timer
if self.pause_timer > 0 then
self.pause_timer = self.pause_timer - dtime
return
end
-- run custom function (defined in mob lua file) -- run custom function (defined in mob lua file)
if self.do_custom then if self.do_custom then
@ -3496,6 +3530,14 @@ local mob_step = function(self, dtime)
end end
end end
-- knockback timer
if self.pause_timer > 0 then
self.pause_timer = self.pause_timer - dtime
return
end
-- attack timer -- attack timer
self.timer = self.timer + dtime self.timer = self.timer + dtime
@ -3514,7 +3556,7 @@ local mob_step = function(self, dtime)
end end
-- mob plays random sound at times -- mob plays random sound at times
if random(1, 100) == 1 then if random(1, 70) == 1 then
mob_sound(self, "random", true) mob_sound(self, "random", true)
end end
@ -3694,6 +3736,8 @@ function mobs:register_mob(name, def)
local can_despawn local can_despawn
if def.can_despawn ~= nil then if def.can_despawn ~= nil then
can_despawn = def.can_despawn can_despawn = def.can_despawn
elseif def.spawn_class == "passive" then
can_despawn = false
else else
can_despawn = true can_despawn = true
end end
@ -3773,6 +3817,7 @@ minetest.register_entity(name, {
knock_back = def.knock_back ~= false, knock_back = def.knock_back ~= false,
shoot_offset = def.shoot_offset or 0, shoot_offset = def.shoot_offset or 0,
floats = def.floats or 1, -- floats in water by default floats = def.floats or 1, -- floats in water by default
floats_on_lava = def.floats_on_lava or 0,
replace_rate = def.replace_rate, replace_rate = def.replace_rate,
replace_what = def.replace_what, replace_what = def.replace_what,
replace_with = def.replace_with, replace_with = def.replace_with,
@ -3856,6 +3901,12 @@ minetest.register_entity(name, {
on_detach_child = mob_detach_child, on_detach_child = mob_detach_child,
on_activate = function(self, staticdata, dtime) on_activate = function(self, staticdata, dtime)
--this is a temporary hack so mobs stop
--glitching and acting really weird with the
--default built in engine collision detection
self.object:set_properties({
collide_with_objects = false,
})
return mob_activate(self, staticdata, def, dtime) return mob_activate(self, staticdata, def, dtime)
end, end,
@ -3874,289 +3925,6 @@ end
end -- END mobs:register_mob function end -- END mobs:register_mob function
-- count how many mobs of one type are inside an area
local count_mobs = function(pos, mobtype)
local num = 0
local objs = minetest.get_objects_inside_radius(pos, aoc_range)
for n = 1, #objs do
local obj = objs[n]:get_luaentity()
if obj and obj.name and obj._cmi_is_mob then
-- count passive mobs only
if mobtype == "!passive" then
if obj.spawn_class == "passive" then
num = num + 1
end
-- count hostile mobs only
elseif mobtype == "!hostile" then
if obj.spawn_class == "hostile" then
num = num + 1
end
-- count ambient mobs only
elseif mobtype == "!ambient" then
if obj.spawn_class == "ambient" then
num = num + 1
end
-- count water mobs only
elseif mobtype == "!water" then
if obj.spawn_class == "water" then
num = num + 1
end
-- count mob type
elseif mobtype and obj.name == mobtype then
num = num + 1
-- count total mobs
elseif not mobtype then
num = num + 1
end
end
end
return num
end
-- global functions
function mobs:spawn_abm_check(pos, node, name)
-- global function to add additional spawn checks
-- return true to stop spawning mob
end
function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
-- Do mobs spawn at all?
if not mobs_spawn then
return
end
-- chance/spawn number override in minetest.conf for registered mob
local numbers = minetest.settings:get(name)
if numbers then
numbers = numbers:split(",")
chance = tonumber(numbers[1]) or chance
aoc = tonumber(numbers[2]) or aoc
if chance == 0 then
minetest.log("warning", string.format("[mobs] %s has spawning disabled", name))
return
end
minetest.log("action",
string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
end
local spawn_action
spawn_action = function(pos, node, active_object_count, active_object_count_wider, name)
local orig_pos = table.copy(pos)
-- is mob actually registered?
if not mobs.spawning_mobs[name]
or not minetest.registered_entities[name] then
minetest.log("warning", "Mob spawn of "..name.." failed, unknown entity or mob is not registered for spawning!")
return
end
-- additional custom checks for spawning mob
if mobs:spawn_abm_check(pos, node, name) == true then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, ABM check rejected!")
return
end
-- count nearby mobs in same spawn class
local entdef = minetest.registered_entities[name]
local spawn_class = entdef and entdef.spawn_class
if not spawn_class then
if entdef.type == "monster" then
spawn_class = "hostile"
else
spawn_class = "passive"
end
end
local in_class_cap = count_mobs(pos, "!"..spawn_class) < MOB_CAP[spawn_class]
-- do not spawn if too many of same mob in area
if active_object_count_wider >= max_per_block -- large-range mob cap
or (not in_class_cap) -- spawn class mob cap
or count_mobs(pos, name) >= aoc then -- per-mob mob cap
-- too many entities
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too crowded!")
return
end
-- if toggle set to nil then ignore day/night check
if day_toggle ~= nil then
local tod = (minetest.get_timeofday() or 0) * 24000
if tod > 4500 and tod < 19500 then
-- daylight, but mob wants night
if day_toggle == false then
-- mob needs night
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs light!")
return
end
else
-- night time but mob wants day
if day_toggle == true then
-- mob needs day
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs daylight!")
return
end
end
end
-- spawn above node
pos.y = pos.y + 1
-- only spawn away from player
local objs = minetest.get_objects_inside_radius(pos, 24)
for n = 1, #objs do
if objs[n]:is_player() then
-- player too close
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, player too close!")
return
end
end
-- mobs cannot spawn in protected areas when enabled
if not spawn_protected
and minetest.is_protected(pos, "") then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, position is protected!")
return
end
-- are we spawning within height limits?
if pos.y > max_height
or pos.y < min_height then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, out of height limit!")
return
end
-- are light levels ok?
local light = minetest.get_node_light(pos)
if not light
or light > max_light
or light < min_light then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, bad light!")
return
end
-- do we have enough space to spawn mob?
local ent = minetest.registered_entities[name]
local width_x = max(1, math.ceil(ent.collisionbox[4] - ent.collisionbox[1]))
local min_x, max_x
if width_x % 2 == 0 then
max_x = math.floor(width_x/2)
min_x = -(max_x-1)
else
max_x = math.floor(width_x/2)
min_x = -max_x
end
local width_z = max(1, math.ceil(ent.collisionbox[6] - ent.collisionbox[3]))
local min_z, max_z
if width_z % 2 == 0 then
max_z = math.floor(width_z/2)
min_z = -(max_z-1)
else
max_z = math.floor(width_z/2)
min_z = -max_z
end
local max_y = max(0, math.ceil(ent.collisionbox[5] - ent.collisionbox[2]) - 1)
for y = 0, max_y do
for x = min_x, max_x do
for z = min_z, max_z do
local pos2 = {x = pos.x+x, y = pos.y+y, z = pos.z+z}
if minetest.registered_nodes[node_ok(pos2).name].walkable == true then
-- inside block
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too little space!")
if ent.spawn_small_alternative ~= nil and (not minetest.registered_nodes[node_ok(pos).name].walkable) then
minetest.log("info", "Trying to spawn smaller alternative mob: "..ent.spawn_small_alternative)
spawn_action(orig_pos, node, active_object_count, active_object_count_wider, ent.spawn_small_alternative)
end
return
end
end
end
end
-- tweak X/Y/Z spawn pos
if width_x % 2 == 0 then
pos.x = pos.x + 0.5
end
if width_z % 2 == 0 then
pos.z = pos.z + 0.5
end
pos.y = pos.y - 0.5
local mob = minetest.add_entity(pos, name)
minetest.log("action", "Mob spawned: "..name.." at "..minetest.pos_to_string(pos))
if on_spawn then
local ent = mob:get_luaentity()
on_spawn(ent, pos)
end
end
local function spawn_abm_action(pos, node, active_object_count, active_object_count_wider)
spawn_action(pos, node, active_object_count, active_object_count_wider, name)
end
minetest.register_abm({
label = name .. " spawning",
nodenames = nodes,
neighbors = neighbors,
interval = interval,
chance = floor(max(1, chance * mobs_spawn_chance)),
catch_up = false,
action = spawn_abm_action,
})
end
-- compatibility with older mob registration
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30,
chance, active_object_count, -31000, max_height, day_toggle)
end
-- MarkBu's spawn function
function mobs:spawn(def)
local name = def.name
local nodes = def.nodes or {"group:soil", "group:stone"}
local neighbors = def.neighbors or {"air"}
local min_light = def.min_light or 0
local max_light = def.max_light or 15
local interval = def.interval or 30
local chance = def.chance or 5000
local active_object_count = def.active_object_count or 1
local min_height = def.min_height or -31000
local max_height = def.max_height or 31000
local day_toggle = def.day_toggle
local on_spawn = def.on_spawn
mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
end
-- register arrow for shoot attack -- register arrow for shoot attack
function mobs:register_arrow(name, def) function mobs:register_arrow(name, def)
@ -4179,6 +3947,11 @@ function mobs:register_arrow(name, def)
switch = 0, switch = 0,
owner_id = def.owner_id, owner_id = def.owner_id,
rotate = def.rotate, rotate = def.rotate,
on_punch = function(self)
local vel = self.object:get_velocity()
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
automatic_face_movement_dir = def.rotate automatic_face_movement_dir = def.rotate
and (def.rotate - (pi / 180)) or false, and (def.rotate - (pi / 180)) or false,
@ -4241,7 +4014,7 @@ function mobs:register_arrow(name, def)
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.0)) do for _,player 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 player:is_player() then
@ -4296,7 +4069,7 @@ end
-- make explosion with protection and tnt mod check -- make explosion with protection and tnt mod check
function mobs:boom(self, pos, strength, fire) function mobs:boom(self, pos, strength, fire)
self.object:remove()
if mod_explosions then if mod_explosions then
if mobs_griefing and not minetest.is_protected(pos, "") then if mobs_griefing and not minetest.is_protected(pos, "") then
mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object) mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object)
@ -4577,6 +4350,7 @@ function mobs:alias_mob(old_name, new_name)
end end
--[[
local timer = 0 local timer = 0
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
timer = timer + dtime timer = timer + dtime
@ -4593,3 +4367,4 @@ minetest.register_globalstep(function(dtime)
end end
timer = 0 timer = 0
end) end)
]]--

View File

@ -4,6 +4,9 @@ local path = minetest.get_modpath(minetest.get_current_modname())
-- Mob API -- Mob API
dofile(path .. "/api.lua") dofile(path .. "/api.lua")
-- Spawning Algorithm
dofile(path .. "/spawning.lua")
-- Rideable Mobs -- Rideable Mobs
dofile(path .. "/mount.lua") dofile(path .. "/mount.lua")

View File

@ -168,16 +168,20 @@ function mobs.detach(player, offset)
mcl_player.player_set_animation(player, "stand" , 30) mcl_player.player_set_animation(player, "stand" , 30)
local pos = player:get_pos() --local pos = player:get_pos()
pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z} --pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z}
player:add_velocity(vector.new(math.random(-6,6),math.random(5,8),math.random(-6,6))) --throw the rider off
--[[
minetest.after(0.1, function(name, pos) minetest.after(0.1, function(name, pos)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if player then if player then
player:set_pos(pos) player:set_pos(pos)
end end
end, player:get_player_name(), pos) end, player:get_player_name(), pos)
]]--
end end

View File

@ -0,0 +1,647 @@
--lua locals
local get_node = minetest.get_node
local get_item_group = minetest.get_item_group
local get_node_light = minetest.get_node_light
local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
local new_vector = vector.new
local math_random = math.random
local get_biome_name = minetest.get_biome_name
local max = math.max
local get_objects_inside_radius = minetest.get_objects_inside_radius
local vector_distance = vector.distance
-- range for mob count
local aoc_range = 32
--[[
THIS IS THE BIG LIST OF ALL BIOMES - used for programming/updating mobs
underground:
"FlowerForest_underground",
"JungleEdge_underground",local spawning_position = spawning_position_list[math.random(1,#spawning_position_list)]
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
ocean:
"RoofedForest_ocean",
"JungleEdgeM_ocean",
"BirchForestM_ocean",
"BirchForest_ocean",
"IcePlains_deep_ocean",
"Jungle_deep_ocean",
"Savanna_ocean",
"MesaPlateauF_ocean",
"ExtremeHillsM_deep_ocean",
"Savanna_deep_ocean",
"SunflowerPlains_ocean",
"Swampland_deep_ocean",
"Swampland_ocean",
"MegaSpruceTaiga_deep_ocean",
"ExtremeHillsM_ocean",
"JungleEdgeM_deep_ocean",
"SunflowerPlains_deep_ocean",
"BirchForest_deep_ocean",
"IcePlainsSpikes_ocean",
"Mesa_ocean",
"StoneBeach_ocean",
"Plains_deep_ocean",
"JungleEdge_deep_ocean",
"SavannaM_deep_ocean",
"Desert_deep_ocean",
"Mesa_deep_ocean",
"ColdTaiga_deep_ocean",
"Plains_ocean",
"MesaPlateauFM_ocean",
"Forest_deep_ocean",
"JungleM_deep_ocean",
"FlowerForest_deep_ocean",
"MushroomIsland_ocean",
"MegaTaiga_ocean",
"StoneBeach_deep_ocean",
"IcePlainsSpikes_deep_ocean",
"ColdTaiga_ocean",
"SavannaM_ocean",
"MesaPlateauF_deep_ocean",
"MesaBryce_deep_ocean",
"ExtremeHills+_deep_ocean",
"ExtremeHills_ocean",
"MushroomIsland_deep_ocean",
"Forest_ocean",
"MegaTaiga_deep_ocean",
"JungleEdge_ocean",
"MesaBryce_ocean",
"MegaSpruceTaiga_ocean",
"ExtremeHills+_ocean",
"Jungle_ocean",
"RoofedForest_deep_ocean",
"IcePlains_ocean",
"FlowerForest_ocean",
"ExtremeHills_deep_ocean",
"MesaPlateauFM_deep_ocean",
"Desert_ocean",
"Taiga_ocean",
"BirchForestM_deep_ocean",
"Taiga_deep_ocean",
"JungleM_ocean",
water or beach?
"MesaPlateauFM_sandlevel",
"MesaPlateauF_sandlevel",
"MesaBryce_sandlevel",
"Mesa_sandlevel",
beach:
"FlowerForest_beach",
"Forest_beach",
"StoneBeach",
"ColdTaiga_beach_water",
"Taiga_beach",
"Savanna_beach",
"Plains_beach",
"ExtremeHills_beach",
"ColdTaiga_beach",
"Swampland_shore",
"MushroomIslandShore",
"JungleM_shore",
"Jungle_shore",
dimension biome:
"Nether",
"End",
Overworld regular:
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"Desert",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
]]--
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
-- count how many mobs of one type are inside an area
local count_mobs = function(pos,mobtype)
local num = 0
local objs = get_objects_inside_radius(pos, aoc_range)
for n = 1, #objs do
local obj = objs[n]:get_luaentity()
if obj and obj.name and obj._cmi_is_mob then
-- count hostile mobs only
if mobtype == "hostile" then
if obj.spawn_class == "hostile" then
num = num + 1
end
-- count passive mobs only
else
num = num + 1
end
end
end
return num
end
-- global functions
function mobs:spawn_abm_check(pos, node, name)
-- global function to add additional spawn checks
-- return true to stop spawning mob
end
--[[
Custom elements changed:
name:
the mobs name
dimension:
"overworld"
"nether"
"end"
types of spawning:
"water"
"ground"
"lava"
biomes: tells the spawner to allow certain mobs to spawn in certain biomes
{"this", "that", "grasslands", "whatever"}
what is aoc??? objects in area
WARNING: BIOME INTEGRATION NEEDED -> How to get biome through lua??
]]--
--this is where all of the spawning information is kept
local spawn_dictionary = {}
function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
--print(dump(biomes))
-- Do mobs spawn at all?
if not mobs_spawn then
return
end
-- chance/spawn number override in minetest.conf for registered mob
local numbers = minetest.settings:get(name)
if numbers then
numbers = numbers:split(",")
chance = tonumber(numbers[1]) or chance
aoc = tonumber(numbers[2]) or aoc
if chance == 0 then
minetest.log("warning", string.format("[mobs] %s has spawning disabled", name))
return
end
minetest.log("action",
string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
end
--[[
local spawn_action
spawn_action = function(pos, node, active_object_count, active_object_count_wider, name)
local orig_pos = table.copy(pos)
-- is mob actually registered?
if not mobs.spawning_mobs[name]
or not minetest.registered_entities[name] then
minetest.log("warning", "Mob spawn of "..name.." failed, unknown entity or mob is not registered for spawning!")
return
end
-- additional custom checks for spawning mob
if mobs:spawn_abm_check(pos, node, name) == true then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, ABM check rejected!")
return
end
-- count nearby mobs in same spawn class
local entdef = minetest.registered_entities[name]
local spawn_class = entdef and entdef.spawn_class
if not spawn_class then
if entdef.type == "monster" then
spawn_class = "hostile"
else
spawn_class = "passive"
end
end
local in_class_cap = count_mobs(pos, "!"..spawn_class) < MOB_CAP[spawn_class]
-- do not spawn if too many of same mob in area
if active_object_count_wider >= max_per_block -- large-range mob cap
or (not in_class_cap) -- spawn class mob cap
or count_mobs(pos, name) >= aoc then -- per-mob mob cap
-- too many entities
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too crowded!")
return
end
-- if toggle set to nil then ignore day/night check
if day_toggle ~= nil then
local tod = (minetest.get_timeofday() or 0) * 24000
if tod > 4500 and tod < 19500 then
-- daylight, but mob wants night
if day_toggle == false then
-- mob needs night
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs light!")
return
end
else
-- night time but mob wants day
if day_toggle == true then
-- mob needs day
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, mob needs daylight!")
return
end
end
end
-- spawn above node
pos.y = pos.y + 1
-- only spawn away from player
local objs = minetest.get_objects_inside_radius(pos, 24)
for n = 1, #objs do
if objs[n]:is_player() then
-- player too close
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, player too close!")
return
end
end
-- mobs cannot spawn in protected areas when enabled
if not spawn_protected
and minetest.is_protected(pos, "") then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, position is protected!")
return
end
-- are we spawning within height limits?
if pos.y > max_height
or pos.y < min_height then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, out of height limit!")
return
end
-- are light levels ok?
local light = minetest.get_node_light(pos)
if not light
or light > max_light
or light < min_light then
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, bad light!")
return
end
-- do we have enough space to spawn mob?
local ent = minetest.registered_entities[name]
local width_x = max(1, math.ceil(ent.collisionbox[4] - ent.collisionbox[1]))
local min_x, max_x
if width_x % 2 == 0 then
max_x = math.floor(width_x/2)
min_x = -(max_x-1)
else
max_x = math.floor(width_x/2)
min_x = -max_x
end
local width_z = max(1, math.ceil(ent.collisionbox[6] - ent.collisionbox[3]))
local min_z, max_z
if width_z % 2 == 0 then
max_z = math.floor(width_z/2)
min_z = -(max_z-1)
else
max_z = math.floor(width_z/2)
min_z = -max_z
end
local max_y = max(0, math.ceil(ent.collisionbox[5] - ent.collisionbox[2]) - 1)
for y = 0, max_y do
for x = min_x, max_x do
for z = min_z, max_z do
local pos2 = {x = pos.x+x, y = pos.y+y, z = pos.z+z}
if minetest.registered_nodes[node_ok(pos2).name].walkable == true then
-- inside block
minetest.log("info", "Mob spawn of "..name.." at "..minetest.pos_to_string(pos).." failed, too little space!")
if ent.spawn_small_alternative ~= nil and (not minetest.registered_nodes[node_ok(pos).name].walkable) then
minetest.log("info", "Trying to spawn smaller alternative mob: "..ent.spawn_small_alternative)
spawn_action(orig_pos, node, active_object_count, active_object_count_wider, ent.spawn_small_alternative)
end
return
end
end
end
end
-- tweak X/Y/Z spawn pos
if width_x % 2 == 0 then
pos.x = pos.x + 0.5
end
if width_z % 2 == 0 then
pos.z = pos.z + 0.5
end
pos.y = pos.y - 0.5
local mob = minetest.add_entity(pos, name)
minetest.log("action", "Mob spawned: "..name.." at "..minetest.pos_to_string(pos))
if on_spawn then
local ent = mob:get_luaentity()
on_spawn(ent, pos)
end
end
local function spawn_abm_action(pos, node, active_object_count, active_object_count_wider)
spawn_action(pos, node, active_object_count, active_object_count_wider, name)
end
]]--
local entdef = minetest.registered_entities[name]
local spawn_class
if entdef.type == "monster" then
spawn_class = "hostile"
else
spawn_class = "passive"
end
--load information into the spawn dictionary
local key = #spawn_dictionary + 1
spawn_dictionary[key] = {}
spawn_dictionary[key]["name"] = name
spawn_dictionary[key]["dimension"] = dimension
spawn_dictionary[key]["type_of_spawning"] = type_of_spawning
spawn_dictionary[key]["biomes"] = biomes
spawn_dictionary[key]["min_light"] = min_light
spawn_dictionary[key]["max_light"] = max_light
spawn_dictionary[key]["interval"] = interval
spawn_dictionary[key]["chance"] = chance
spawn_dictionary[key]["aoc"] = aoc
spawn_dictionary[key]["min_height"] = min_height
spawn_dictionary[key]["max_height"] = max_height
spawn_dictionary[key]["day_toggle"] = day_toggle
--spawn_dictionary[key]["on_spawn"] = spawn_abm_action
spawn_dictionary[key]["spawn_class"] = spawn_class
--[[
minetest.register_abm({
label = name .. " spawning",
nodenames = nodes,
neighbors = neighbors,
interval = interval,
chance = floor(max(1, chance * mobs_spawn_chance)),
catch_up = false,
action = spawn_abm_action,
})
]]--
end
-- compatibility with older mob registration
-- we're going to forget about this for now -j4i
--[[
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30,
chance, active_object_count, -31000, max_height, day_toggle)
end
]]--
--Don't disable this yet-j4i
-- MarkBu's spawn function
function mobs:spawn(def)
--does nothing for now
--[[
local name = def.name
local nodes = def.nodes or {"group:soil", "group:stone"}
local neighbors = def.neighbors or {"air"}
local min_light = def.min_light or 0
local max_light = def.max_light or 15
local interval = def.interval or 30
local chance = def.chance or 5000
local active_object_count = def.active_object_count or 1
local min_height = def.min_height or -31000
local max_height = def.max_height or 31000
local day_toggle = def.day_toggle
local on_spawn = def.on_spawn
mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
]]--
end
local axis
--inner and outer part of square donut radius
local inner = 1
local outer = 65
local int = {-1,1}
local position_calculation = function(pos)
pos = vector.floor(pos)
--this is used to determine the axis buffer from the player
axis = math.random(0,1)
--cast towards the direction
if axis == 0 then --x
pos.x = pos.x + math.random(inner,outer)*int[math.random(1,2)]
pos.z = pos.z + math.random(-outer,outer)
else --z
pos.z = pos.z + math.random(inner,outer)*int[math.random(1,2)]
pos.x = pos.x + math.random(-outer,outer)
end
return(pos)
end
--[[
local decypher_limits_dictionary = {
["overworld"] = {mcl_vars.mg_overworld_min,mcl_vars.mg_overworld_max},
["nether"] = {mcl_vars.mg_nether_min, mcl_vars.mg_nether_max},
["end"] = {mcl_vars.mg_end_min, mcl_vars.mg_end_max}
}
]]--
local function decypher_limits(posy)
--local min_max_table = decypher_limits_dictionary[dimension]
--return min_max_table[1],min_max_table[2]
posy = math.floor(posy)
return posy - 32, posy + 32
end
--a simple helper function for mob_spawn
local function biome_check(biome_list, biome_goal)
for _,data in ipairs(biome_list) do
if data == biome_goal then
return true
end
end
return false
end
--todo mob limiting
--MAIN LOOP
if mobs_spawn then
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer >= 8 then
timer = 0
for _,player in pairs(minetest.get_connected_players()) do
for i = 1,math_random(3,8) do
repeat -- after this line each "break" means "continue"
local player_pos = player:get_pos()
local _,dimension = mcl_worlds.y_to_layer(player_pos.y)
if dimension == "void" or dimension == "default" then
break -- ignore void and unloaded area
end
local min,max = decypher_limits(player_pos.y)
local goal_pos = position_calculation(player_pos)
local spawning_position_list = find_nodes_in_area_under_air(new_vector(goal_pos.x,min,goal_pos.z), vector.new(goal_pos.x,max,goal_pos.z), {"group:solid", "group:water", "group:lava"})
--couldn't find node
if #spawning_position_list <= 0 then
break
end
local spawning_position = spawning_position_list[math_random(1,#spawning_position_list)]
--Prevent strange behavior/too close to player
if not spawning_position or vector_distance(player_pos, spawning_position) < 15 then
break
end
local gotten_node = get_node(spawning_position).name
if not gotten_node or gotten_node == "air" then --skip air nodes
break
end
local gotten_biome = minetest.get_biome_data(spawning_position)
if not gotten_biome then
break --skip if in unloaded area
end
gotten_biome = get_biome_name(gotten_biome.biome) --makes it easier to work with
--grab random mob
local mob_def = spawn_dictionary[math.random(1,#spawn_dictionary)]
if not mob_def then
break --skip if something ridiculous happens (nil mob def)
end
--skip if not correct dimension
if mob_def.dimension ~= dimension then
break
end
--skip if not in correct biome
if not biome_check(mob_def.biomes, gotten_biome) then
break
end
--add this so mobs don't spawn inside nodes
spawning_position.y = spawning_position.y + 1
if spawning_position.y < mob_def.min_height or spawning_position.y > mob_def.max_height then
break
end
--only need to poll for node light if everything else worked
local gotten_light = get_node_light(spawning_position)
--don't spawn if not in light limits
if gotten_light < mob_def.min_light or gotten_light > mob_def.max_light then
break
end
local is_water = get_item_group(gotten_node, "water") ~= 0
local is_lava = get_item_group(gotten_node, "lava") ~= 0
if mob_def.type_of_spawning == "ground" and is_water then
break
end
if mob_def.type_of_spawning == "ground" and is_lava then
break
end
--finally do the heavy check (for now) of mobs in area
if count_mobs(spawning_position, mob_def.spawn_class) >= mob_def.aoc then
break
end
--adjust the position for water and lava mobs
if mob_def.type_of_spawning == "water" or mob_def.type_of_spawning == "lava" then
spawning_position.y = spawning_position.y - 1
end
--everything is correct, spawn mob
minetest.add_entity(spawning_position, mob_def.name)
until true --this is a safety catch
end
end
end
end)
end

View File

@ -290,13 +290,13 @@ mobs_mc.spawn = {
mobs_mc.spawn_height = { mobs_mc.spawn_height = {
water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld
-- Overworld boundaries (inclusive) -- Overworld boundaries (inclusive) --I adjusted this to be more reasonable
overworld_min = -2999, overworld_min = -64,-- -2999,
overworld_max = 31000, overworld_max = 31000,
-- Nether boundaries (inclusive) -- Nether boundaries (inclusive)
nether_min = -3369, nether_min = -29067,-- -3369,
nether_max = -3000, nether_max = -28939,-- -3000,
-- End boundaries (inclusive) -- End boundaries (inclusive)
end_min = -6200, end_min = -6200,

View File

@ -521,7 +521,7 @@ if c("totem") then
-- Totem of Undying -- Totem of Undying
minetest.register_craftitem("mobs_mc:totem", { minetest.register_craftitem("mobs_mc:totem", {
description = S("Totem of Undying"), description = S("Totem of Undying"),
_tt_help = minetest.colorize("#00FF00", S("Protects you from death while wielding it")), _tt_help = minetest.colorize(mcl_colors.GREEN, S("Protects you from death while wielding it")),
_doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."), _doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."),
_doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."), _doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."),
inventory_image = "mcl_totems_totem.png", inventory_image = "mcl_totems_totem.png",

View File

@ -1,5 +1,5 @@
--################### --###################
--################### AGENT --################### AGENT - seemingly unused
--################### --###################
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")

View File

@ -64,7 +64,81 @@ else
end end
-- Spawn on solid blocks at or below Sea level and the selected light level -- Spawn on solid blocks at or below Sea level and the selected light level
mobs:spawn_specific("mobs_mc:bat", mobs_mc.spawn.solid, {"air"}, 0, maxlight, 20, 5000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-1) mobs:spawn_specific(
"mobs_mc:bat",
"overworld",
"ground",
{
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"Desert",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
},
0,
maxlight,
20,
5000,
2,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.water-1)
-- spawn eggs -- spawn eggs

View File

@ -1,6 +1,6 @@
-- daufinsyd -- daufinsyd
-- My work is under the LGPL terms -- My work is under the LGPL terms
-- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models -- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models -hi 22i ~jordan4ibanez
-- blaze.lua partial copy of mobs_mc/ghast.lua -- blaze.lua partial copy of mobs_mc/ghast.lua
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
@ -75,9 +75,71 @@ mobs:register_mob("mobs_mc:blaze", {
fear_height = 0, fear_height = 0,
glow = 14, glow = 14,
fire_resistant = true, fire_resistant = true,
do_custom = function(self)
if self.state == "attack" and vector.distance(self.object:get_pos(), self.attack:get_pos()) < 1.2 then
mcl_burning.set_on_fire(self.attack, 5)
end
local pos = self.object:get_pos()
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#2c2c2c:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#424242:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#0f0f0f:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
end,
}) })
mobs:spawn_specific("mobs_mc:blaze", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 5000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) mobs:spawn_specific(
"mobs_mc:blaze",
"nether",
"ground",
{"Nether"},
0,
minetest.LIGHT_MAX+1,
30,
5000,
3,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- Blaze fireball -- Blaze fireball
mobs:register_arrow("mobs_mc:blaze_fireball", { mobs:register_arrow("mobs_mc:blaze_fireball", {

View File

@ -100,7 +100,34 @@ mobs:register_mob("mobs_mc:chicken", {
}) })
--spawn --spawn
mobs:spawn_specific("mobs_mc:chicken", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:chicken",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
9,
minetest.LIGHT_MAX+1,
30, 17000,
3,
mobs_mc.spawn_height.water,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0) mobs:register_egg("mobs_mc:chicken", S("Chicken"), "mobs_mc_spawn_icon_chicken.png", 0)

View File

@ -145,8 +145,53 @@ mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)
-- Spawning -- Spawning
mobs:spawn_specific("mobs_mc:cow", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 10, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
mobs:spawn_specific("mobs_mc:mooshroom", mobs_mc.spawn.mushroom_island, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 17000, 5, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) "mobs_mc:cow",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
9,
minetest.LIGHT_MAX+1,
30,
17000,
10,
mobs_mc.spawn_height.water,
mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
"mobs_mc:mooshroom",
"overworld",
"ground",
{
"MushroomIslandShore",
"MushroomIsland"
},
9,
minetest.LIGHT_MAX+1,
30,
17000,
5,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn egg -- spawn egg
mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0) mobs:register_egg("mobs_mc:cow", S("Cow"), "mobs_mc_spawn_icon_cow.png", 0)

View File

@ -39,6 +39,8 @@ mobs:register_mob("mobs_mc:creeper", {
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" }, runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode", attack_type = "explode",
--hssssssssssss
explosion_strength = 3, explosion_strength = 3,
explosion_radius = 3.5, explosion_radius = 3.5,
explosion_damage_radius = 3.5, explosion_damage_radius = 3.5,
@ -76,7 +78,6 @@ mobs:register_mob("mobs_mc:creeper", {
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
if self._forced_explosion_countdown_timer <= 0 then if self._forced_explosion_countdown_timer <= 0 then
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength) mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
self.object:remove()
end end
end end
end, end,
@ -139,6 +140,9 @@ mobs:register_mob("mobs_mc:creeper_charged", {
pathfinding = 1, pathfinding = 1,
visual = "mesh", visual = "mesh",
mesh = "mobs_mc_creeper.b3d", mesh = "mobs_mc_creeper.b3d",
--BOOM
textures = { textures = {
{"mobs_mc_creeper.png", {"mobs_mc_creeper.png",
"mobs_mc_creeper_charge.png"}, "mobs_mc_creeper_charge.png"},
@ -195,7 +199,6 @@ mobs:register_mob("mobs_mc:creeper_charged", {
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
if self._forced_explosion_countdown_timer <= 0 then if self._forced_explosion_countdown_timer <= 0 then
mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength) mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
self.object:remove()
end end
end end
end, end,
@ -250,7 +253,158 @@ mobs:register_mob("mobs_mc:creeper_charged", {
glow = 3, glow = 3,
}) })
mobs:spawn_specific("mobs_mc:creeper", mobs_mc.spawn.solid, {"air"}, 0, 7, 20, 16500, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:creeper",
"overworld",
"ground",
{
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"Desert",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
"FlowerForest_beach",
"Forest_beach",
"StoneBeach",
"ColdTaiga_beach_water",
"Taiga_beach",
"Savanna_beach",
"Plains_beach",
"ExtremeHills_beach",
"ColdTaiga_beach",
"Swampland_shore",
"MushroomIslandShore",
"JungleM_shore",
"Jungle_shore",
"MesaPlateauFM_sandlevel",
"MesaPlateauF_sandlevel",
"MesaBryce_sandlevel",
"Mesa_sandlevel",
"RoofedForest_ocean",
"JungleEdgeM_ocean",
"BirchForestM_ocean",
"BirchForest_ocean",
"IcePlains_deep_ocean",
"Jungle_deep_ocean",
"Savanna_ocean",
"MesaPlateauF_ocean",
"ExtremeHillsM_deep_ocean",
"Savanna_deep_ocean",
"SunflowerPlains_ocean",
"Swampland_deep_ocean",
"Swampland_ocean",
"MegaSpruceTaiga_deep_ocean",
"ExtremeHillsM_ocean",
"JungleEdgeM_deep_ocean",
"SunflowerPlains_deep_ocean",
"BirchForest_deep_ocean",
"IcePlainsSpikes_ocean",
"Mesa_ocean",
"StoneBeach_ocean",
"Plains_deep_ocean",
"JungleEdge_deep_ocean",
"SavannaM_deep_ocean",
"Desert_deep_ocean",
"Mesa_deep_ocean",
"ColdTaiga_deep_ocean",
"Plains_ocean",
"MesaPlateauFM_ocean",
"Forest_deep_ocean",
"JungleM_deep_ocean",
"FlowerForest_deep_ocean",
"MushroomIsland_ocean",
"MegaTaiga_ocean",
"StoneBeach_deep_ocean",
"IcePlainsSpikes_deep_ocean",
"ColdTaiga_ocean",
"SavannaM_ocean",
"MesaPlateauF_deep_ocean",
"MesaBryce_deep_ocean",
"ExtremeHills+_deep_ocean",
"ExtremeHills_ocean",
"MushroomIsland_deep_ocean",
"Forest_ocean",
"MegaTaiga_deep_ocean",
"JungleEdge_ocean",
"MesaBryce_ocean",
"MegaSpruceTaiga_ocean",
"ExtremeHills+_ocean",
"Jungle_ocean",
"RoofedForest_deep_ocean",
"IcePlains_ocean",
"FlowerForest_ocean",
"ExtremeHills_deep_ocean",
"MesaPlateauFM_deep_ocean",
"Desert_ocean",
"Taiga_ocean",
"BirchForestM_deep_ocean",
"Taiga_deep_ocean",
"JungleM_ocean",
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
7,
20,
16500,
2,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0) mobs:register_egg("mobs_mc:creeper", S("Creeper"), "mobs_mc_spawn_icon_creeper.png", 0)

View File

@ -0,0 +1 @@
mcl_mobs

View File

@ -50,8 +50,8 @@ mobs:register_mob("mobs_mc:enderdragon", {
arrow = "mobs_mc:dragon_fireball", arrow = "mobs_mc:dragon_fireball",
shoot_interval = 0.5, shoot_interval = 0.5,
shoot_offset = -1.0, shoot_offset = -1.0,
xp_min = 12000, xp_min = 500,
xp_max = 12000, xp_max = 500,
animation = { animation = {
fly_speed = 8, stand_speed = 8, fly_speed = 8, stand_speed = 8,
stand_start = 0, stand_end = 20, stand_start = 0, stand_end = 20,
@ -59,15 +59,47 @@ mobs:register_mob("mobs_mc:enderdragon", {
run_start = 0, run_end = 20, run_start = 0, run_end = 20,
}, },
ignores_nametag = true, ignores_nametag = true,
on_die = function(self, own_pos) do_custom = function(self)
if self._egg_spawn_pos then mcl_bossbars.update_boss(self.object, "Ender Dragon", "light_purple")
local pos = minetest.string_to_pos(self._egg_spawn_pos) for _, obj in ipairs(minetest.get_objects_inside_radius(self.object:get_pos(), 80)) do
--if minetest.get_node(pos).buildable_to then local luaentity = obj:get_luaentity()
minetest.set_node(pos, {name = mobs_mc.items.dragon_egg}) if luaentity and luaentity.name == "mcl_end:crystal" then
return if luaentity.beam then
--end if luaentity.beam == self.beam then
break
end
else
if self.beam then
self.beam:remove()
end
minetest.add_entity(self.object:get_pos(), "mcl_end:crystal_beam"):get_luaentity():init(self.object, obj)
break
end
end
end
if self._portal_pos then
-- migrate old format
if type(self._portal_pos) == "string" then
self._portal_pos = minetest.string_to_pos(self._portal_pos)
end
local portal_center = vector.add(self._portal_pos, vector.new(3, 11, 3))
local pos = self.object:get_pos()
if vector.distance(pos, portal_center) > 50 then
self.object:set_pos(self._last_good_pos or portal_center)
else
self._last_good_pos = pos
end
end
end,
on_die = function(self, pos)
if self._portal_pos then
mcl_portals.spawn_gateway_portal()
mcl_structures.call_struct(self._portal_pos, "end_exit_portal_open")
if self._initial then
mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000
minetest.set_node(vector.add(self._portal_pos, vector.new(3, 5, 3)), {name = mobs_mc.items.dragon_egg})
end
end end
minetest.add_item(own_pos, mobs_mc.items.dragon_egg)
end, end,
fire_resistant = true, fire_resistant = true,
}) })

View File

@ -295,7 +295,8 @@ mobs:register_mob("mobs_mc:enderman", {
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE. -- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
-- Check for arrows and people nearby. -- Check for arrows and people nearby.
local enderpos = self.object:get_pos() local enderpos = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(enderpos, 4) enderpos.y = enderpos.y + 1.5
local objs = minetest.get_objects_inside_radius(enderpos, 2)
for n = 1, #objs do for n = 1, #objs do
local obj = objs[n] local obj = objs[n]
if obj then if obj then
@ -307,7 +308,7 @@ mobs:register_mob("mobs_mc:enderman", {
else else
local lua = obj:get_luaentity() local lua = obj:get_luaentity()
if lua then if lua then
if lua.name == "mcl_bows:arrow_entity" then if lua.name == "mcl_bows:arrow_entity" or lua.name == "mcl_throwing:snowball_entity" then
self:teleport(nil) self:teleport(nil)
end end
end end
@ -322,41 +323,50 @@ mobs:register_mob("mobs_mc:enderman", {
-- self:teleport(nil) -- self:teleport(nil)
-- self.state = "" -- self.state = ""
--else --else
if self.attack ~= nil then if self.attack ~= nil and not minetest.settings:get_bool("creative_mode") then
self.state = 'attack' self.state = 'attack'
end end
--end --end
end end
-- Check to see if people are near by enough to look at us. -- Check to see if people are near by enough to look at us.
local objs = minetest.get_objects_inside_radius(enderpos, 64) for _,obj in pairs(minetest.get_connected_players()) do
local obj
for n = 1, #objs do --check if they are within radius
obj = objs[n] local player_pos = obj:get_pos()
if obj then if player_pos then -- prevent crashing in 1 in a million scenario
if minetest.is_player(obj) then
local ender_distance = vector.distance(enderpos, player_pos)
if ender_distance <= 64 then
-- Check if they are looking at us. -- Check if they are looking at us.
local player_pos = obj:get_pos()
local look_dir_not_normalized = obj:get_look_dir() local look_dir_not_normalized = obj:get_look_dir()
local look_dir = vector.normalize(look_dir_not_normalized) local look_dir = vector.normalize(look_dir_not_normalized)
local look_pos = vector.new({x = look_dir.x+player_pos.x, y = look_dir.y+player_pos.y + 1.5, z = look_dir.z+player_pos.z}) -- Arbitrary value (1.5) is head level according to player info mod. local player_eye_height = obj:get_properties().eye_height
-- Cast up to 64 to see if player is looking at enderman.
for n = 1,64,.25 do --skip player if they have no data - log it
local node = minetest.get_node(look_pos) if not player_eye_height then
if node.name ~= "air" then minetest.log("error", "Enderman at location: ".. dump(enderpos).." has indexed a null player!")
break else
end
if look_pos.x-1<enderpos.x and look_pos.x+1>enderpos.x and look_pos.y-2.89<enderpos.y and look_pos.y-2>enderpos.y and look_pos.z-1<enderpos.z and look_pos.z+1>enderpos.z then --calculate very quickly the exact location the player is looking
--within the distance between the two "heads" (player and enderman)
local look_pos = vector.new(player_pos.x, player_pos.y + player_eye_height, player_pos.z)
local look_pos_base = look_pos
local ender_eye_pos = vector.new(enderpos.x, enderpos.y + 2.75, enderpos.z)
local eye_distance_from_player = vector.distance(ender_eye_pos, look_pos)
look_pos = vector.add(look_pos, vector.multiply(look_dir, eye_distance_from_player))
--if looking in general head position, turn hostile
if minetest.line_of_sight(ender_eye_pos, look_pos_base) and vector.distance(look_pos, ender_eye_pos) <= 0.4 then
self.provoked = "staring" self.provoked = "staring"
self.attack = minetest.get_player_by_name(obj:get_player_name()) self.attack = minetest.get_player_by_name(obj:get_player_name())
break break
else else -- I'm not sure what this part does, but I don't want to break anything - jordan4ibanez
if self.provoked == "staring" then if self.provoked == "staring" then
self.provoked = "broke_contact" self.provoked = "broke_contact"
end end
end end
look_pos.x = look_pos.x + (.25 * look_dir.x)
look_pos.y = look_pos.y + (.25 * look_dir.y)
look_pos.z = look_pos.z + (.25 * look_dir.z)
end end
end end
end end
@ -534,9 +544,11 @@ mobs:register_mob("mobs_mc:enderman", {
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then --if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
-- self:teleport(nil) -- self:teleport(nil)
--else --else
if pr:next(1, 8) == 8 then --FIXME: real mc rate
self:teleport(hitter) self:teleport(hitter)
self.attack=hitter end
self.state="attack" self.attack=hitter
self.state="attack"
--end --end
end end
end, end,
@ -549,11 +561,189 @@ mobs:register_mob("mobs_mc:enderman", {
-- End spawn -- End spawn
mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 3000, 12, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) mobs:spawn_specific(
"mobs_mc:enderman",
"end",
"ground",
{
"End"
},
0,
minetest.LIGHT_MAX+1,
30,
3000,
12,
mobs_mc.spawn_height.end_min,
mobs_mc.spawn_height.end_max)
-- Overworld spawn -- Overworld spawn
mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 19000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:enderman",
"overworld",
"ground",
{
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"Desert",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
"FlowerForest_beach",
"Forest_beach",
"StoneBeach",
"ColdTaiga_beach_water",
"Taiga_beach",
"Savanna_beach",
"Plains_beach",
"ExtremeHills_beach",
"ColdTaiga_beach",
"Swampland_shore",
"MushroomIslandShore",
"JungleM_shore",
"Jungle_shore",
"MesaPlateauFM_sandlevel",
"MesaPlateauF_sandlevel",
"MesaBryce_sandlevel",
"Mesa_sandlevel",
"RoofedForest_ocean",
"JungleEdgeM_ocean",
"BirchForestM_ocean",
"BirchForest_ocean",
"IcePlains_deep_ocean",
"Jungle_deep_ocean",
"Savanna_ocean",
"MesaPlateauF_ocean",
"ExtremeHillsM_deep_ocean",
"Savanna_deep_ocean",
"SunflowerPlains_ocean",
"Swampland_deep_ocean",
"Swampland_ocean",
"MegaSpruceTaiga_deep_ocean",
"ExtremeHillsM_ocean",
"JungleEdgeM_deep_ocean",
"SunflowerPlains_deep_ocean",
"BirchForest_deep_ocean",
"IcePlainsSpikes_ocean",
"Mesa_ocean",
"StoneBeach_ocean",
"Plains_deep_ocean",
"JungleEdge_deep_ocean",
"SavannaM_deep_ocean",
"Desert_deep_ocean",
"Mesa_deep_ocean",
"ColdTaiga_deep_ocean",
"Plains_ocean",
"MesaPlateauFM_ocean",
"Forest_deep_ocean",
"JungleM_deep_ocean",
"FlowerForest_deep_ocean",
"MushroomIsland_ocean",
"MegaTaiga_ocean",
"StoneBeach_deep_ocean",
"IcePlainsSpikes_deep_ocean",
"ColdTaiga_ocean",
"SavannaM_ocean",
"MesaPlateauF_deep_ocean",
"MesaBryce_deep_ocean",
"ExtremeHills+_deep_ocean",
"ExtremeHills_ocean",
"MushroomIsland_deep_ocean",
"Forest_ocean",
"MegaTaiga_deep_ocean",
"JungleEdge_ocean",
"MesaBryce_ocean",
"MegaSpruceTaiga_ocean",
"ExtremeHills+_ocean",
"Jungle_ocean",
"RoofedForest_deep_ocean",
"IcePlains_ocean",
"FlowerForest_ocean",
"ExtremeHills_deep_ocean",
"MesaPlateauFM_deep_ocean",
"Desert_ocean",
"Taiga_ocean",
"BirchForestM_deep_ocean",
"Taiga_deep_ocean",
"JungleM_ocean",
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
7,
30,
19000,
2,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- Nether spawn (rare) -- Nether spawn (rare)
mobs:spawn_specific("mobs_mc:enderman", mobs_mc.spawn.solid, {"air"}, 0, 7, 30, 27500, 4, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) mobs:spawn_specific(
"mobs_mc:enderman",
"nether",
"ground",
{
"Nether"
},
0,
7,
30,
27500,
4,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0) mobs:register_egg("mobs_mc:enderman", S("Enderman"), "mobs_mc_spawn_icon_enderman.png", 0)

View File

@ -63,10 +63,32 @@ mobs:register_mob("mobs_mc:ghast", {
makes_footstep_sound = false, makes_footstep_sound = false,
instant_death = true, instant_death = true,
fire_resistant = true, fire_resistant = true,
do_custom = function(self)
if self.firing == true then
self.base_texture = {"mobs_mc_ghast_firing.png"}
self.object:set_properties({textures=self.base_texture})
else
self.base_texture = {"mobs_mc_ghast.png"}
self.object:set_properties({textures=self.base_texture})
end
end,
}) })
mobs:spawn_specific("mobs_mc:ghast", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 18000, 2, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) mobs:spawn_specific(
"mobs_mc:ghast",
"nether",
"ground",
{
"Nether"
},
0,
minetest.LIGHT_MAX+1,
30,
18000,
2,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- fireball (projectile) -- fireball (projectile)
mobs:register_arrow("mobs_mc:fireball", { mobs:register_arrow("mobs_mc:fireball", {
@ -74,6 +96,7 @@ mobs:register_arrow("mobs_mc:fireball", {
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 = 15,
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
hit_player = function(self, player) hit_player = function(self, player)
if rawget(_G, "armor") and armor.last_damage_types then if rawget(_G, "armor") and armor.last_damage_types then

View File

@ -106,7 +106,7 @@ mobs:register_mob("mobs_mc:guardian_elder", {
view_range = 16, view_range = 16,
}) })
-- Spawning disabled due to size issues -- Spawning disabled due to size issues <- what do you mean? -j4i
-- TODO: Re-enable spawning -- TODO: Re-enable spawning
-- mobs:spawn_specific("mobs_mc:guardian_elder", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-18) -- mobs:spawn_specific("mobs_mc:guardian_elder", mobs_mc.spawn.water, mobs_mc.spawn_water, 0, minetest.LIGHT_MAX+1, 30, 40000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.water-18)

View File

@ -157,8 +157,29 @@ local horse = {
self._regentimer = 0 self._regentimer = 0
end end
-- if driver present allow control of horse -- Some weird human is riding. Buck them off?
if self.driver then if self.driver and not self.tamed and self.buck_off_time <= 0 then
if math.random() < 0.2 then
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
-- TODO bucking animation
else
-- Nah, can't be bothered. Think about it again in one second
self.buck_off_time = 20
end
end
-- Tick the timer for trying to buck the player off
if self.buck_off_time then
if self.driver then
self.buck_off_time = self.buck_off_time - 1
else
-- Player isn't riding anymore so no need to count
self.buck_off_time = nil
end
end
-- if driver present and horse has a saddle allow control of horse
if self.driver and self._saddle then
mobs.drive(self, "walk", "stand", false, dtime) mobs.drive(self, "walk", "stand", false, dtime)
@ -191,6 +212,49 @@ local horse = {
local item = clicker:get_wielded_item() local item = clicker:get_wielded_item()
local iname = item:get_name() local iname = item:get_name()
local heal = 0 local heal = 0
-- Taming
self.temper = self.temper or (math.random(1,100))
if not self.tamed then
local temper_increase = 0
-- Feeding, intentionally not using mobs:feed_tame because horse taming is
-- different and more complicated
if (iname == mobs_mc.items.sugar) then
temper_increase = 3
elseif (iname == mobs_mc.items.wheat) then
temper_increase = 3
elseif (iname == mobs_mc.items.apple) then
temper_increase = 3
elseif (iname == mobs_mc.items.golden_carrot) then
temper_increase = 5
elseif (iname == mobs_mc.items.golden_apple) then
temper_increase = 10
-- Trying to ride
elseif not self.driver then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
if self.temper > 100 then
self.tamed = true -- NOTE taming can only be finished by riding the horse
if not self.owner or self.owner == "" then
self.owner = clicker:get_player_name()
end
end
temper_increase = 5
-- Clicking on the horse while riding ==> unmount
elseif self.driver and self.driver == clicker then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
end
-- If nothing happened temper_increase = 0 and addition does nothing
self.temper = self.temper + temper_increase
return
end
if can_breed(self.name) then if can_breed(self.name) then
-- Breed horse with golden apple or golden carrot -- Breed horse with golden apple or golden carrot
if (iname == mobs_mc.items.golden_apple) then if (iname == mobs_mc.items.golden_apple) then
@ -202,7 +266,8 @@ local horse = {
return return
end end
end end
-- Feed/tame with anything else -- Feed with anything else
-- TODO heal amounts don't work
if (iname == mobs_mc.items.sugar) then if (iname == mobs_mc.items.sugar) then
heal = 1 heal = 1
elseif (iname == mobs_mc.items.wheat) then elseif (iname == mobs_mc.items.wheat) then
@ -212,7 +277,7 @@ local horse = {
elseif (iname == mobs_mc.items.hay_bale) then elseif (iname == mobs_mc.items.hay_bale) then
heal = 20 heal = 20
end end
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, true) then if heal > 0 and mobs:feed_tame(self, clicker, heal, false, false) then
return return
end end
@ -445,12 +510,60 @@ mobs:register_mob("mobs_mc:mule", mule)
--=========================== --===========================
--Spawn Function --Spawn Function
mobs:spawn_specific("mobs_mc:horse", mobs_mc.spawn.grassland_savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
mobs:spawn_specific("mobs_mc:donkey", mobs_mc.spawn.grassland_savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mobs_mc.spawn_height.water+3, mobs_mc.spawn_height.overworld_max) "mobs_mc:horse",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
4,
mobs_mc.spawn_height.water+3,
mobs_mc.spawn_height.overworld_max)
mobs:spawn_specific(
"mobs_mc:donkey",
"overworld",
"ground",
{
"Mesa",
"MesaPlateauFM_grasstop",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
4,
mobs_mc.spawn_height.water+3,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0) mobs:register_egg("mobs_mc:horse", S("Horse"), "mobs_mc_spawn_icon_horse.png", 0)
--mobs:register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "mobs_mc_spawn_icon_horse_skeleton.png", 0) mobs:register_egg("mobs_mc:skeleton_horse", S("Skeleton Horse"), "mobs_mc_spawn_icon_horse_skeleton.png", 0)
--mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "mobs_mc_spawn_icon_horse_zombie.png", 0) --mobs:register_egg("mobs_mc:zombie_horse", S("Zombie Horse"), "mobs_mc_spawn_icon_horse_zombie.png", 0)
mobs:register_egg("mobs_mc:donkey", S("Donkey"), "mobs_mc_spawn_icon_donkey.png", 0) mobs:register_egg("mobs_mc:donkey", S("Donkey"), "mobs_mc_spawn_icon_donkey.png", 0)
mobs:register_egg("mobs_mc:mule", S("Mule"), "mobs_mc_spawn_icon_mule.png", 0) mobs:register_egg("mobs_mc:mule", S("Mule"), "mobs_mc_spawn_icon_mule.png", 0)

View File

@ -217,7 +217,25 @@ mobs:register_mob("mobs_mc:llama", {
}) })
--spawn --spawn
mobs:spawn_specific("mobs_mc:llama", mobs_mc.spawn.savanna, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 5, mobs_mc.spawn_height.water+15, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:llama",
"overworld",
"ground",
{
"Mesa",
"MesaPlateauFM_grasstop",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
5,
mobs_mc.spawn_height.water+15,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0) mobs:register_egg("mobs_mc:llama", S("Llama"), "mobs_mc_spawn_icon_llama.png", 0)

View File

@ -1,6 +1,6 @@
name = mobs_mc 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 depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_colors
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items

View File

@ -152,6 +152,25 @@ mobs:register_mob("mobs_mc:cat", cat)
local base_spawn_chance = 5000 local base_spawn_chance = 5000
-- Spawn ocelot -- Spawn ocelot
--they get the same as the llama because I'm trying to rework so much of this code right now -j4i
mobs:spawn_specific(
"mobs_mc:ocelot",
"overworld",
"ground",
{
"Jungle",
"JungleEdgeM",
"JungleM",
"JungleEdge",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
5,
mobs_mc.spawn_height.water+15,
mobs_mc.spawn_height.overworld_max)
--[[
mobs:spawn({ mobs:spawn({
name = "mobs_mc:ocelot", name = "mobs_mc:ocelot",
nodes = mobs_mc.spawn.jungle, nodes = mobs_mc.spawn.jungle,
@ -163,8 +182,8 @@ mobs:spawn({
min_height = mobs_mc.spawn_height.water+1, -- Right above ocean level min_height = mobs_mc.spawn_height.water+1, -- Right above ocean level
max_height = mobs_mc.spawn_height.overworld_max, max_height = mobs_mc.spawn_height.overworld_max,
on_spawn = function(self, pos) on_spawn = function(self, pos)
--[[ Note: Minecraft has a 1/3 spawn failure rate. Note: Minecraft has a 1/3 spawn failure rate.
In this mod it is emulated by reducing the spawn rate accordingly (see above). ]] In this mod it is emulated by reducing the spawn rate accordingly (see above).
-- 1/7 chance to spawn 2 ocelot kittens -- 1/7 chance to spawn 2 ocelot kittens
if pr:next(1,7) == 1 then if pr:next(1,7) == 1 then
@ -207,6 +226,7 @@ mobs:spawn({
end end
end, end,
}) })
]]--
-- spawn eggs -- spawn eggs
-- FIXME: The spawn icon shows a cat texture, not an ocelot texture -- FIXME: The spawn icon shows a cat texture, not an ocelot texture

View File

@ -90,8 +90,24 @@ mobs:register_mob("mobs_mc:parrot", {
}) })
-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* -- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i
mobs:spawn_specific("mobs_mc:parrot", {"mcl_core:jungletree", "mcl_core:jungleleaves"}, {"air"}, 0, minetest.LIGHT_MAX+1, 7, 30000, 1, mobs_mc.spawn_height.water+7, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:parrot",
"overworld",
"ground",
{
"Jungle",
"JungleEdgeM",
"JungleM",
"JungleEdge",
},
0,
minetest.LIGHT_MAX+1,
7,
30000,
1,
mobs_mc.spawn_height.water+7,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0) mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)

View File

@ -182,7 +182,35 @@ mobs:register_mob("mobs_mc:pig", {
end, end,
}) })
mobs:spawn_specific("mobs_mc:pig", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 30, 15000, 8, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:pig",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
9,
minetest.LIGHT_MAX+1,
30,
15000,
8,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0) mobs:register_egg("mobs_mc:pig", S("Pig"), "mobs_mc_spawn_icon_pig.png", 0)

View File

@ -67,7 +67,23 @@ mobs:register_mob("mobs_mc:polar_bear", {
}) })
mobs:spawn_specific("mobs_mc:polar_bear", mobs_mc.spawn.snow, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 7000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:polar_bear",
"overworld",
"ground",
{
"ColdTaiga",
"IcePlainsSpikes",
"IcePlains",
"ExtremeHills+_snowtop",
},
0,
minetest.LIGHT_MAX+1,
30,
7000,
3,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn egg -- spawn egg
mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0) mobs:register_egg("mobs_mc:polar_bear", S("Polar Bear"), "mobs_mc_spawn_icon_polarbear.png", 0)

View File

@ -107,8 +107,39 @@ end
mobs:register_mob("mobs_mc:killer_bunny", killer_bunny) mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
-- Mob spawning rules. -- Mob spawning rules.
-- Different skins depending on spawn location -- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out
mobs:spawn_specific(
"mobs_mc:rabbit",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
9,
minetest.LIGHT_MAX+1,
30,
15000,
8,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
--[[
local spawn = { local spawn = {
name = "mobs_mc:rabbit", name = "mobs_mc:rabbit",
neighbors = {"air"}, neighbors = {"air"},
@ -165,6 +196,7 @@ spawn_grass.on_spawn = function(self, pos)
self.object:set_properties({textures = self.base_texture}) self.object:set_properties({textures = self.base_texture})
end end
mobs:spawn(spawn_grass) mobs:spawn(spawn_grass)
]]--
-- Spawn egg -- Spawn egg
mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0) mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0)

View File

@ -25,6 +25,19 @@ local colors = {
unicolor_black = { mobs_mc.items.wool_black, "#000000D0" }, unicolor_black = { mobs_mc.items.wool_black, "#000000D0" },
} }
local rainbow_colors = {
"unicolor_light_red",
"unicolor_red",
"unicolor_orange",
"unicolor_yellow",
"unicolor_green",
"unicolor_dark_green",
"unicolor_light_blue",
"unicolor_blue",
"unicolor_violet",
"unicolor_red_violet"
}
if minetest.get_modpath("mcl_wool") ~= nil then if minetest.get_modpath("mcl_wool") ~= nil then
colors["unicolor_light_blue"] = { mobs_mc.items.wool_light_blue, "#5050FFD0" } colors["unicolor_light_blue"] = { mobs_mc.items.wool_light_blue, "#5050FFD0" }
end end
@ -112,7 +125,7 @@ mobs:register_mob("mobs_mc:sheep", {
end, end,
-- Set random color on spawn -- Set random color on spawn
do_custom = function(self) do_custom = function(self, dtime)
if not self.initial_color_set then if not self.initial_color_set then
local r = math.random(0,100000) local r = math.random(0,100000)
local textures local textures
@ -149,6 +162,33 @@ mobs:register_mob("mobs_mc:sheep", {
} }
self.initial_color_set = true self.initial_color_set = true
end end
local is_kay27 = self.nametag == "kay27"
if self.color_change_timer then
local old_color = self.color
if is_kay27 then
self.color_change_timer = self.color_change_timer - dtime
if self.color_change_timer < 0 then
self.color_change_timer = 0.5
self.color_index = (self.color_index + 1) % #rainbow_colors
self.color = rainbow_colors[self.color_index + 1]
end
else
self.color_change_timer = nil
self.color_index = nil
self.color = self.initial_color
end
if old_color ~= self.color then
self.base_texture = sheep_texture(self.color)
self.object:set_properties({textures = self.base_texture})
end
elseif is_kay27 then
self.initial_color = self.color
self.color_change_timer = 0
self.color_index = -1
end
end, end,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
@ -263,7 +303,35 @@ mobs:register_mob("mobs_mc:sheep", {
end end
end, end,
}) })
mobs:spawn_specific("mobs_mc:sheep", mobs_mc.spawn.grassland, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 3, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:sheep",
"overworld",
"ground",
{
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"SunflowerPlains",
"RoofedForest",
"MesaPlateauFM_grasstop",
"ExtremeHillsM",
"BirchForestM",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
3,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0) mobs:register_egg("mobs_mc:sheep", S("Sheep"), "mobs_mc_spawn_icon_sheep.png", 0)

View File

@ -81,4 +81,17 @@ mobs:register_arrow("mobs_mc:shulkerbullet", {
mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0) mobs:register_egg("mobs_mc:shulker", S("Shulker"), "mobs_mc_spawn_icon_shulker.png", 0)
mobs:spawn_specific("mobs_mc:shulker", mobs_mc.spawn.end_city, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 5000, 2, mobs_mc.spawn_height.end_min, mobs_mc.spawn_height.end_max) mobs:spawn_specific(
"mobs_mc:shulker",
"end",
"ground",
{
"End"
},
0,
minetest.LIGHT_MAX+1,
30,
5000,
2,
mobs_mc.spawn_height.end_min,
mobs_mc.spawn_height.end_max)

View File

@ -30,13 +30,14 @@ local skeleton = {
"mcl_bows_bow_0.png", -- bow "mcl_bows_bow_0.png", -- bow
"mobs_mc_skeleton.png", -- skeleton "mobs_mc_skeleton.png", -- skeleton
} }, } },
visual_size = {x=3, y=3}, visual_size = {x=1, y=1},
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { textures = {
random = "mobs_mc_skeleton_random", {
death = "mobs_mc_skeleton_death", "mobs_mc_empty.png", -- armor
damage = "mobs_mc_skeleton_hurt", "mobs_mc_skeleton.png", -- texture
distance = 16, "mcl_bows_bow_0.png", -- wielded_item
}
}, },
walk_velocity = 1.2, walk_velocity = 1.2,
run_velocity = 2.4, run_velocity = 2.4,
@ -111,9 +112,9 @@ local stray = table.copy(skeleton)
stray.mesh = "mobs_mc_stray.b3d" stray.mesh = "mobs_mc_stray.b3d"
stray.textures = { stray.textures = {
{ {
"mcl_bows_bow_0.png",
"mobs_mc_stray.png",
"mobs_mc_stray_overlay.png", "mobs_mc_stray_overlay.png",
"mobs_mc_stray.png",
"mcl_bows_bow_0.png",
}, },
} }
-- TODO: different sound (w/ echo) -- TODO: different sound (w/ echo)
@ -139,13 +140,195 @@ table.insert(stray.drops, {
mobs:register_mob("mobs_mc:stray", stray) mobs:register_mob("mobs_mc:stray", stray)
-- Overworld spawn -- Overworld spawn
mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.solid, {"air"}, 0, 7, 20, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:skeleton",
"overworld",
"ground",
{
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"Desert",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
"FlowerForest_beach",
"Forest_beach",
"StoneBeach",
"ColdTaiga_beach_water",
"Taiga_beach",
"Savanna_beach",
"Plains_beach",
"ExtremeHills_beach",
"ColdTaiga_beach",
"Swampland_shore",
"MushroomIslandShore",
"JungleM_shore",
"Jungle_shore",
"MesaPlateauFM_sandlevel",
"MesaPlateauF_sandlevel",
"MesaBryce_sandlevel",
"Mesa_sandlevel",
"RoofedForest_ocean",
"JungleEdgeM_ocean",
"BirchForestM_ocean",
"BirchForest_ocean",
"IcePlains_deep_ocean",
"Jungle_deep_ocean",
"Savanna_ocean",
"MesaPlateauF_ocean",
"ExtremeHillsM_deep_ocean",
"Savanna_deep_ocean",
"SunflowerPlains_ocean",
"Swampland_deep_ocean",
"Swampland_ocean",
"MegaSpruceTaiga_deep_ocean",
"ExtremeHillsM_ocean",
"JungleEdgeM_deep_ocean",
"SunflowerPlains_deep_ocean",
"BirchForest_deep_ocean",
"IcePlainsSpikes_ocean",
"Mesa_ocean",
"StoneBeach_ocean",
"Plains_deep_ocean",
"JungleEdge_deep_ocean",
"SavannaM_deep_ocean",
"Desert_deep_ocean",
"Mesa_deep_ocean",
"ColdTaiga_deep_ocean",
"Plains_ocean",
"MesaPlateauFM_ocean",
"Forest_deep_ocean",
"JungleM_deep_ocean",
"FlowerForest_deep_ocean",
"MushroomIsland_ocean",
"MegaTaiga_ocean",
"StoneBeach_deep_ocean",
"IcePlainsSpikes_deep_ocean",
"ColdTaiga_ocean",
"SavannaM_ocean",
"MesaPlateauF_deep_ocean",
"MesaBryce_deep_ocean",
"ExtremeHills+_deep_ocean",
"ExtremeHills_ocean",
"MushroomIsland_deep_ocean",
"Forest_ocean",
"MegaTaiga_deep_ocean",
"JungleEdge_ocean",
"MesaBryce_ocean",
"MegaSpruceTaiga_ocean",
"ExtremeHills+_ocean",
"Jungle_ocean",
"RoofedForest_deep_ocean",
"IcePlains_ocean",
"FlowerForest_ocean",
"ExtremeHills_deep_ocean",
"MesaPlateauFM_deep_ocean",
"Desert_ocean",
"Taiga_ocean",
"BirchForestM_deep_ocean",
"Taiga_deep_ocean",
"JungleM_ocean",
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
7,
20,
17000,
2,
mobs_mc.spawn_height.overworld_min,
mobs_mc.spawn_height.overworld_max)
-- Nether spawn -- Nether spawn
mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.nether_fortress, {"air"}, 0, 7, 30, 10000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) mobs:spawn_specific(
"mobs_mc:skeleton",
"nether",
"ground",
{
"Nether"
},
0,
7,
30,
10000,
3,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- Stray spawn -- Stray spawn
-- TODO: Spawn directly under the sky -- TODO: Spawn directly under the sky
mobs:spawn_specific("mobs_mc:stray", mobs_mc.spawn.snow, {"air"}, 0, 7, 20, 19000, 2, mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max) mobs:spawn_specific(
"mobs_mc:stray",
"overworld",
"ground",
{
"ColdTaiga",
"IcePlainsSpikes",
"IcePlains",
"ExtremeHills+_snowtop",
},
0,
7,
20,
19000,
2,
mobs_mc.spawn_height.water,
mobs_mc.spawn_height.overworld_max)
-- spawn eggs -- spawn eggs

View File

@ -25,11 +25,12 @@ mobs:register_mob("mobs_mc:witherskeleton", {
mesh = "mobs_mc_witherskeleton.b3d", mesh = "mobs_mc_witherskeleton.b3d",
textures = { textures = {
{ {
"default_tool_stonesword.png", -- sword "mobs_mc_empty.png", -- armor
"mobs_mc_wither_skeleton.png", -- wither skeleton "mobs_mc_wither_skeleton.png", -- wither skeleton
"default_tool_stonesword.png", -- sword
} }
}, },
visual_size = {x=3.6, y=3.6}, 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",
@ -94,7 +95,20 @@ mobs:register_mob("mobs_mc:witherskeleton", {
}) })
--spawn --spawn
mobs:spawn_specific("mobs_mc:witherskeleton", mobs_mc.spawn.nether_fortress, {"air"}, 0, 7, 30, 5000, 5, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max) mobs:spawn_specific(
"mobs_mc:witherskeleton",
"nether",
"ground",
{
"Nether"
},
0,
7,
30,
5000,
5,
mobs_mc.spawn_height.nether_min,
mobs_mc.spawn_height.nether_max)
-- spawn eggs -- spawn eggs
mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0) mobs:register_egg("mobs_mc:witherskeleton", S("Wither Skeleton"), "mobs_mc_spawn_icon_witherskeleton.png", 0)

View File

@ -51,7 +51,6 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
end end
end, children, self.attack) end, children, self.attack)
end end
return true
end end
end end
@ -109,7 +108,6 @@ local slime_big = {
fear_height = 0, fear_height = 0,
spawn_small_alternative = "mobs_mc:slime_small", spawn_small_alternative = "mobs_mc:slime_small",
on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5), on_die = spawn_children_on_die("mobs_mc:slime_small", 4, 1.0, 1.5),
fire_resistant = true,
use_texture_alpha = true, use_texture_alpha = true,
} }
mobs:register_mob("mobs_mc:slime_big", slime_big) mobs:register_mob("mobs_mc:slime_big", slime_big)
@ -159,9 +157,137 @@ mobs:register_mob("mobs_mc:slime_tiny", slime_tiny)
local smin = mobs_mc.spawn_height.overworld_min local smin = mobs_mc.spawn_height.overworld_min
local smax = mobs_mc.spawn_height.water - 23 local smax = mobs_mc.spawn_height.water - 23
mobs:spawn_specific("mobs_mc:slime_tiny", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 12000, 4, smin, smax) mobs:spawn_specific(
mobs:spawn_specific("mobs_mc:slime_small", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 8500, 4, smin, smax) "mobs_mc:slime_tiny",
mobs:spawn_specific("mobs_mc:slime_big", mobs_mc.spawn.solid, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 10000, 4, smin, smax) "overworld",
"ground",
{
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
minetest.LIGHT_MAX+1,
30,
12000,
4,
smin,
smax)
mobs:spawn_specific(
"mobs_mc:slime_small",
"overworld",
"ground",
{
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
minetest.LIGHT_MAX+1,
30,
8500,
4,
smin,
smax)
mobs:spawn_specific(
"mobs_mc:slime_big",
"overworld",
"ground",
{
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
},
0,
minetest.LIGHT_MAX+1,
30,
10000,
4,
smin,
smax)
-- Magma cube -- Magma cube
local magma_cube_big = { local magma_cube_big = {
@ -274,13 +400,55 @@ mobs:register_mob("mobs_mc:magma_cube_tiny", magma_cube_tiny)
local mmin = mobs_mc.spawn_height.nether_min local mmin = mobs_mc.spawn_height.nether_min
local mmax = mobs_mc.spawn_height.nether_max local mmax = mobs_mc.spawn_height.nether_max
mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15000, 4, mmin, mmax) mobs:spawn_specific(
mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 15500, 4, mmin, mmax) "mobs_mc:magma_cube_tiny",
mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 16000, 4, mmin, mmax) "nether",
"ground",
{
"Nether"
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
4,
mmin,
mmax)
mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax)
mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax) mobs:spawn_specific(
mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax) "mobs_mc:magma_cube_small",
"nether",
"ground",
{
"Nether"
},
0,
minetest.LIGHT_MAX+1,
30,
15500,
4,
mmin,
mmax)
mobs:spawn_specific(
"mobs_mc:magma_cube_big",
"nether",
"ground",
{
"Nether"
},
0,
minetest.LIGHT_MAX+1,
30,
16000,
4,
mmin,
mmax)
--mobs:spawn_specific("mobs_mc:magma_cube_tiny", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11000, 4, mmin, mmax)
--mobs:spawn_specific("mobs_mc:magma_cube_small", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11100, 4, mmin, mmax)
--mobs:spawn_specific("mobs_mc:magma_cube_big", mobs_mc.spawn.nether_fortress, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 11200, 4, mmin, mmax)
-- spawn eggs -- spawn eggs

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More