Commit Graph

118 Commits

Author SHA1 Message Date
bakawun 4d90dfab0e Spawning: add a comment to clarify what the random select is doing 2024-01-10 11:22:13 +01:00
bakawun b2b63266b7 Spawning: break mob selection loop when out of bounds 2024-01-10 11:22:13 +01:00
bakawun d151e79fb9 Spawning: remove unused summary_chance 2024-01-10 11:22:13 +01:00
bakawun e419e6d63b Spawning: remove another unused perlin var 2024-01-10 11:22:13 +01:00
cora 55517154bd Mob spawning: Remove unused vars 2024-01-10 11:22:13 +01:00
bakawun 402e4e7b79 Spawning: fix random weighted choice 2024-01-10 11:22:13 +01:00
codiac 4cf865a36c Fix passive threshold in nether and end (#4030)
Fix light check for passive mobs in other dimensions. It is apparently the same in all dimensions. If a mob has it's own spawn_check function then that should be used regardless of it's type.

Fixes #4029

Reviewed-on: MineClone2/MineClone2#4030
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: codiac <codiac@inbox.lv>
Co-committed-by: codiac <codiac@inbox.lv>
2023-11-28 02:45:18 +00:00
codiac d2d7887e0f Handle bat and slime light checks 2023-09-21 14:53:32 +10:00
codiac bf4c7e1913 Allow non monsters spawns too 2023-09-20 09:24:51 +10:00
codiac 11e3674926 Use MC 1.18 light levels to control mob spawning 2023-09-19 11:18:40 +10:00
ancientmarinerdev c65f8c9e51 Improved early game spawn balance 2023-06-01 20:05:25 +00:00
ancientmarinerdev 812269264b Add in caps for underground water and axolotl 2023-06-01 20:05:25 +00:00
ancientmarinerdev afb4540408 Clean up 2023-06-01 20:05:25 +00:00
ancientmarinerdev ae32ce4a0a Split hostile and non-hostile mob caps 2023-06-01 20:05:25 +00:00
ancientmarinerdev ea4ea3f05e Standardise despawn logic and add asserts. Add persistent flag for mobs that have been interacted with. 2023-05-09 22:24:40 +00:00
ancientmarinerdev bd579314ba Remove logging and clean up 2023-03-19 02:44:35 +00:00
ancientmarinerdev e7449a65d8 Fix check_position and change spawn check to stages 2023-03-19 02:44:35 +00:00
ancientmarinerdev a25cced40e Remove comment now resolved 2023-03-04 02:18:36 +00:00
ancientmarinerdev 86a85bb487 Fix spawn egg crashes in different dimensions 2023-03-04 01:38:51 +00:00
GuyLiner cafc16c41c Fix #3484
If a mob was not found in the spawn_dictionary or the non_spawn
dictionary and you tried to use a spawn egg to spawn that mob, the game
would crash. This commit prevents that from happening by adding a check
for mobs that don't exist, and minetest.log throws an error.
2023-02-26 11:22:21 -05:00
GuyLiner cd1c8bd92e Refactored logic for getting light levels for mobs
Removed mob_light_table, simplied loop, changed return values and
fixed dimension priority error in loop. Slimes also don't have a
hardcoded exception for their light levels anymore, and instead
are apart of spawn specific.
2023-02-16 20:48:28 -05:00
GuyLiner 540319d948 Added non_spawn_dictionary and function for getting mob light levels
The non_spawn_dictionary will cover all mobs that don't spawn naturally, and holds the the minimum and maximum light values for each of them.
A function has also been created that will go through both the spawn_dictionary and the non_spawn_dictionary and determine which one
a mob exists in, with the execption of slimes which cannot spawn from a custom spawner at the moment.

Mobs who don't have light levels for the world that you are currently trying to set your custom spawner in will default to their overworld values
2023-02-16 19:43:50 -05:00
ancientmarinerdev d4c2802afb Implement review/testing feedback 2023-02-10 19:01:29 +00:00
ancientmarinerdev bf50a17f2e Limit spawning of mobs outside y axis as well 2023-02-10 19:01:29 +00:00
ancientmarinerdev b817c079ba Improve balancing for early game 2023-02-10 19:01:29 +00:00
ancientmarinerdev cfa276f722 Add settings for percentage of hostile and peaceful groups spawned 2023-02-10 19:01:29 +00:00
ancientmarinerdev 86b1d8bc3e Add world gen limits to spawning to avoid things spawning past the world gen limits 2023-02-10 19:01:29 +00:00
ancientmarinerdev 9c2f43a242 Limit peaceful spawning and add configurable option 2023-02-10 19:01:29 +00:00
ancientmarinerdev 044a91e831 Change spawn cap groups to spawn_type to give water it's own spawn cap. 2023-02-10 19:01:29 +00:00
ancientmarinerdev 106979e64a Clean up 2023-02-10 19:01:29 +00:00
ancientmarinerdev 1dc7cab6be Add logging 2023-02-10 19:01:29 +00:00
ancientmarinerdev 634379dfe9 Retry if failing to find spawn position 2023-02-10 19:01:29 +00:00
ancientmarinerdev c2ac33ac61 Mobs now can spawn in multiple positions around you per spawning cycle 2023-02-10 19:01:29 +00:00
ancientmarinerdev b5c0830060 Restructure code and tidy 2023-02-10 19:01:29 +00:00
ancientmarinerdev c43c723e08 Clean logging etc. 2023-02-10 19:01:29 +00:00
ancientmarinerdev bd3a4ff0df Clean up 2023-02-10 19:01:28 +00:00
ancientmarinerdev 0267ad2f31 Decrease change of groups spawning for peacefuls. Refresh total mobs check on spawn. 2023-02-10 19:01:28 +00:00
ancientmarinerdev a2f9ea81cc Fix mobs debug crash 2023-02-10 19:01:28 +00:00
ancientmarinerdev 7c7f4b930c Move cap check out of spawn checks and reimplement close cap check 2023-02-10 19:01:28 +00:00
ancientmarinerdev 60529d3d5d Add in constants for spawn zones 2023-02-10 19:01:28 +00:00
ancientmarinerdev 6ea4b43249 Limit group spawn to available cap space. Total mobs check once per spawn cycle. 2023-02-10 19:01:28 +00:00
Michieal e9c202ae45 Added Bamboo Biomes to spawning.lua. 2023-01-15 15:30:34 -05:00
ancientmarinerdev 4fd4425aae Improved mob debug 2023-01-11 01:07:18 +00:00
ancientmarinerdev 01c8009c6a Tidy on_step function 2023-01-11 01:07:18 +00:00
kabou 6756ee340c Mob spawning chatcommand refactoring.
* Put calculations that are only used conditionally inside the
  related `if` block.
* Make code logic more explicit.
* Take logging statement out of return value assignment.
* Remove duplicate assignment.
* Fix a typo in the function's description.
2022-12-29 02:13:57 +00:00
kabou 0c454a34c9 Use vectors in `get_next_mob_spawn_pos()` 2022-12-29 02:13:57 +00:00
cora ebf214c043 Check if spawndef exists when spawning 2022-11-27 14:53:17 +01:00
cora 2b691dea07 Fix some more global var warnings 2022-11-27 14:53:16 +01:00
cora faa38ffab8 Fix some warnings 2022-11-27 14:53:16 +01:00
cora 5e177c61f6 Move on_step despawning to separate function 2022-11-27 14:53:16 +01:00