Commit Graph

739 Commits

Author SHA1 Message Date
ancientmarinerdev 37ca0efe05 New, improved, safe clearmobs command 2023-03-14 02:45:33 +00:00
ancientmarinerdev 0f7efcf9c1 Fix error handling compatibility with Minetest bundled Lua 2023-03-12 21:52:35 +00:00
ancientmarinerdev 038d9ec014 Do not need to create new vector each time 2023-03-11 00:05:53 +00:00
ancientmarinerdev 6097dacbab Only check herd if in range 2023-03-11 00:05:53 +00:00
ancientmarinerdev 5b7132ac5e Fix duplicate call for jump check 2023-03-11 00:05:53 +00:00
ancientmarinerdev 5fc78bf6b0 Use unique name for function. Add development flag to enable crashing locally 2023-03-11 00:05:53 +00:00
ancientmarinerdev b47ef9275b Fix whoops 2023-03-11 00:05:53 +00:00
ancientmarinerdev ce6d9d561f When mob out of range, avoid processing expensive or unneccessary things 2023-03-11 00:05:53 +00:00
ancientmarinerdev 655c130956 Remove aggro for iron golem when out of range 2023-03-10 03:03:53 +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
ancientmarinerdev 48fa2608ed Merge pull request 'spawn-egg-crash-fix' (#3492) from GuyLiner/MineClone2:spawn-egg-crash-fix into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3492
2023-03-04 00:34:45 +00:00
epCode e48dabc8be Create the Jockey api and use it on Skel/Spid 2023-02-28 17:46:21 +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 3830171347 Adjusted mob_light_lvl for changed return value 2023-02-16 19:43:50 -05:00
GuyLiner 0a9be4b79c Added light level parameters to the mobs_mcl.setup_spawner() function, fixing #221
There is now a call to mcl_mobs:mob_light_lvl that returns a table for the name of the mob that you pass to it that contains
the light levels for that mob.
2023-02-16 19:43:50 -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 4d61e32021 Clean up error handling 2023-02-16 23:15:55 +00:00
ancientmarinerdev 7c602ce82c Tidy up error handling. 2023-02-16 23:15:55 +00:00
ancientmarinerdev ae92c51155 Adding error handling to the mob step function 2023-02-16 23:15:55 +00:00
Michieal f05e976d18 changed comment. 2023-02-14 01:50:05 +00:00
Michieal 5533ec7bac fix mobs losing their textures. 2023-02-14 01:50:05 +00:00
ancientmarinerdev 9445e10834 Pathfinding optimisations and villager has earlier bed time 2023-02-11 10:36:56 +00:00
ancientmarinerdev 2fd7f8c69f Fix hungry sheep and hyrdophobic passive mobs 2023-02-11 00:37:16 +00: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
ancientmarinerdev b834e790a7 Fix game crashes 2023-02-08 19:34:04 +00:00
ancientmarinerdev 39d4434df1 Reorder on_step calls 2023-02-08 19:34:04 +00:00
ancientmarinerdev 4b9482cb09 Mobs should not drop XP when dying by fire from sunlight 2023-02-08 19:34:04 +00:00
GuyLiner 4d922d9edf Added conditional based on existing fire damage conditional that will apply fire damage to a
mob standing on top of a magma node that belongs to the "fire" group. The magma node
has also been added to the fire group, making it so that standing on the node will
do damage to the mob.

In official Minecraft, magma blocks just do fire damage without the fire animation.
Source: https://minecraft.fandom.com/wiki/Magma_Block
2023-02-06 00:10:52 +00:00
ancientmarinerdev 7d46fa3362 Merge pull request 'texture-consolidation' (#3380) from texture-consolidation into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3380
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-02-04 03:23:13 +00:00
ancientmarinerdev 7daa79a3f8 Fix wither crash on certain version of Lua. 2023-02-02 02:22:21 +00:00
Michieal 06effcd786 Merge branch 'master' into texture-consolidation 2023-01-30 22:57:38 -05:00
Michieal 6265148727 Move textures all into one centralized directory. 2023-01-30 22:55:53 -05:00
ancientmarinerdev 245ce99223 Using mcl_vars 2023-01-31 02:28:04 +00:00
ancientmarinerdev 1f107ec0c7 Tidy 2023-01-31 02:28:04 +00:00
ancientmarinerdev c209537cfe Make it a bit less chatty for logging 2023-01-31 02:28:04 +00:00
ancientmarinerdev d583ccb986 Oooops, wrong number 2023-01-31 02:28:04 +00:00
ancientmarinerdev 7d803e174c Set freeze and warning when mobs too close to boundary of world 2023-01-31 02:28:04 +00:00
ancientmarinerdev e4f26a4688 Fix self object checks for check suspend 2023-01-23 20:10:28 +00:00
ancientmarinerdev af86e73280 Fix self object reference in player_in_active_range 2023-01-23 20:10:28 +00:00
ancientmarinerdev 32be8f9602 Fix more self object references in falling 2023-01-23 20:10:28 +00:00
ancientmarinerdev 15560d969c Change order of mob step 2023-01-23 20:10:28 +00:00
ancientmarinerdev 6bbf3af97b Remove log line 2023-01-23 20:10:28 +00:00
ancientmarinerdev 84317afc93 Review feedback implemented and planned changes 2023-01-23 20:10:28 +00:00
ancientmarinerdev 2cd6629ae1 Add some mob object checks to avoid crashing 2023-01-23 20:10:28 +00:00
ancientmarinerdev ce7d493890 Merge pull request 'Iron golem fixes' (#3309) from gldrk/MineClone2:master into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3309
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-01-22 00:45:53 +00:00
ancientmarinerdev 30d3b7ee23 Merge pull request 'mcl_bamboo Part 2.' (#3208) from mcl_bamboo_too into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3208
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
2023-01-16 20:22:09 +00:00
ancientmarinerdev 9b28baaad6 Give longer to breed mobs. 1.5s is not enough 2023-01-16 00:00:28 +00:00
b3nderman f9b021e4c6 Fix animals jumping way too high upon growing up 2023-01-15 22:47:05 +00:00
Michieal e9c202ae45 Added Bamboo Biomes to spawning.lua. 2023-01-15 15:30:34 -05:00
gldrk 1536338199 Allow passive mobs to have protectors 2023-01-14 01:32:42 +03:00
gldrk 3697ef8069 Fix summoning friends for mobs 2023-01-14 01:28:35 +03:00
ancientmarinerdev 4fd4425aae Improved mob debug 2023-01-11 01:07:18 +00:00
ancientmarinerdev ac4cd2c325 Improve performance for head swivel check 2023-01-11 01:07:18 +00:00
ancientmarinerdev 01c8009c6a Tidy on_step function 2023-01-11 01:07:18 +00:00
ancientmarinerdev 59694ebc7c Fix merge conflict 2023-01-06 13:52:03 +00:00
ancientmarinerdev 2527479401 Clean up on isle 5, please 2023-01-06 02:59:02 +00:00
ancientmarinerdev 325a666c62 Added pathfinder constants to make it easier to tweak 2023-01-06 02:59:02 +00:00
ancientmarinerdev e9b54e85c2 Pathfinding clean up 2023-01-06 02:59:02 +00:00
ancientmarinerdev 4324fe2489 Villager will now path from one house to another in search of available job or bed 2023-01-06 02:59:02 +00:00
ancientmarinerdev d6804bf4b7 Fix distance to target issue, and refactor pathing actions 2023-01-06 02:59:02 +00:00
ancientmarinerdev 87f04bdd9f Prevent attempting to path through 2 doors until code supports it. Clean up also. 2023-01-06 02:59:02 +00:00
ancientmarinerdev 29cd73cb84 Pathfinding through door should also check door closest to position so villager can leave current house 2023-01-06 02:59:02 +00:00
ancientmarinerdev 5c0a763b83 Optimisation - Only check for town bell if ready to path 2023-01-06 02:59:02 +00:00
ancientmarinerdev 9b1ceebf0d Villagers will now pathfind to town bell that isn't on the ground 2023-01-06 02:59:02 +00:00
ancientmarinerdev f8ae702ce4 Function name consistency 2023-01-02 00:58:23 +00:00
ancientmarinerdev 5faf060122 Fix crash and remove unused duplicate variables 2023-01-02 00:54:08 +00:00
ancientmarinerdev 8c648d1fc3 Refactor mob_step and do_states 2023-01-02 00:00:40 +00:00
ancientmarinerdev e6e898671a Merge pull request 'add japanese translation' (#3149) from SakuraRiu/MineClone2:master into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3149
Reviewed-by: Michieal <michieal@noreply.git.minetest.land>
2022-12-29 22:14:48 +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
Riu Sakura 2b61231f82 add japanese translation 2022-12-19 15:33:31 +09:00
ancientmarinerdev 254caaff37 Merge conflict fixes for release 0.81.1 2022-12-14 21:38:53 +00:00
CyberMango f7f2b97b13 Fixed #2313 - baby mobs cant jump over blocks.
Simply removed a line that specifies they shouldnt do that.
2022-12-10 19:54:44 +02:00
ancientmarinerdev e408dd45e5 Remove easter egg taking 3% of processing 2022-12-09 19:30:06 +00:00
cora 9508cd4c25 Fix creeper crash 2022-11-29 03:28:19 +01:00
cora 318da7e3c9 Fix local go_to_pos call 2022-11-28 03:26:51 +01:00
cora ebf214c043 Check if spawndef exists when spawning 2022-11-27 14:53:17 +01:00
cora 7bd0b5a9b1 Some more missing arg fixes 2022-11-27 14:53:16 +01:00
cora bc496a8682 Finally indent register_mob and make registered mobs global 2022-11-27 14:53:16 +01:00
cora a3415647d4 Fix do_jump call in combat.lua 2022-11-27 14:53:16 +01:00
cora 4909ef6ff7 Restructure on_step a bit 2022-11-27 14:53:16 +01:00
cora 3c6d79ecb3 Add entity name to debug box 2022-11-27 14:53:16 +01:00
cora 6948b77226 move debug/nametag code back to api.lua 2022-11-27 14:53:16 +01:00
cora 90321ee578 Fix leftover local do_attack call 2022-11-27 14:53:16 +01:00
cora 2b691dea07 Fix some more global var warnings 2022-11-27 14:53:16 +01:00
cora c25287e493 Some cleanup 2022-11-27 14:53:16 +01:00
epCode 762f64a4d1 Fix mob rotation glitching out near 0/360 in degrees
The problem mainly was that the set_yaw function was not allowing for negitive values.
2022-11-27 14:53:16 +01:00
cora db63f1c453 fix leftover pi shortcut 2022-11-27 14:53:16 +01:00
cora faa38ffab8 Fix some warnings 2022-11-27 14:53:16 +01:00
cora 19d6d43b39 move on_blast default to mob default def 2022-11-27 14:53:16 +01:00
cora 28b6fcf289 Move detach_child to mount.lua 2022-11-27 14:53:16 +01:00
cora 80490b4c11 Move smooth rotation to separate function 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
cora c9c2b874be move relative animation speed to separate function 2022-11-27 14:53:16 +01:00
cora 18c415f6a0 put head swivel in separate function 2022-11-27 14:53:16 +01:00
cora 49670d1d28 put water flow code in separate function 2022-11-27 14:53:16 +01:00
cora a25cd921f2 move do_states to movement.lua 2022-11-27 14:53:16 +01:00
cora 91b5b6266c move stray particle spawner func to effects 2022-11-27 14:53:16 +01:00
cora 148b30694f Fix monster_attack and some other settings issues 2022-11-27 14:53:16 +01:00
cora f4374d9efd Fix item drops 2022-11-27 14:53:16 +01:00
cora b41d6a1cae Fix mob_punch 2022-11-27 14:53:16 +01:00
cora 6548b7fe47 move stray pathfinding funcs to pathfinding file 2022-11-27 14:53:16 +01:00
cora c7681af53e Move registration functions to init.lua 2022-11-27 14:53:16 +01:00
cora cc77e109f5 Split off general movement functions 2022-11-27 14:53:16 +01:00
cora e7d9ded9ab Split off combat funcs 2022-11-27 14:53:16 +01:00
cora 96d697c5cd Split off pathfinding, use metatables 2022-11-27 14:53:16 +01:00
cora 01abfea16d Split off item management 2022-11-27 14:53:16 +01:00
cora bbba7cee41 Add compat for old "wrong" : notation 2022-11-27 14:53:16 +01:00
cora e82c318f0c Split off breeding 2022-11-27 14:53:16 +01:00
cora 70834d0f5d make register functions use the . notation 2022-11-27 14:53:16 +01:00
cora d62dbcb852 effects -> separate file + metatable 2022-11-27 14:53:16 +01:00
cora 67fd8c8b40 split off physics functions into separate file + use metatable 2022-11-27 14:53:16 +01:00
cora 90639ef99d remove unused functions 2022-11-27 14:53:16 +01:00
cora 31ef791cfd Add proper metatable to mobs 2022-11-27 14:53:16 +01:00
cora 033b051689 Fix crash when rightclicking parrot 2022-11-15 21:16:48 +01:00
ancientmarinerdev 3e1a475442 Logging improvements 2022-11-12 02:35:00 +01:00
cora c44b29925a Fix random-interval crash when not using luajit 2022-11-10 01:45:42 +01:00
cora 21f3782439 Fix lightning on_strike api + rename to on_lightning_strike 2022-11-05 01:16:27 +01:00
ancientmarinerdev 8b0c4c17ad Slightly more frequent failed pathing attempts for villagers 2022-11-03 21:34:15 +00:00
ancientmarinerdev 2d0ea5e205 Enable concurrent pathing so pathing orders aren't queued 2022-11-03 21:34:14 +00:00
ancientmarinerdev ad137304bc Fix bug where if it finds wrong door and can't plot route it hogs the pathing 2022-11-03 21:34:14 +00:00
ancientmarinerdev ea9c9e74b0 Failed check should come before last pathed check to avoid a failed check taking up a good opportunity to path 2022-11-03 21:34:14 +00:00
ancientmarinerdev 17e3e83f43 Villagers should not try and path if they have failed recently 2022-11-03 21:34:14 +00:00
cora da9f253117 Add setting for mob-movement stop range 2022-11-03 14:32:50 +01:00
ancientmarinerdev c606092066 Pathfinding fix for villagers 2022-11-02 22:09:35 +01:00
ancientmarinerdev 5d5babdb20 Tweak distance to current_target check 2022-11-02 22:09:35 +01:00
ancientmarinerdev 1d667c26b5 Villagers will open and close doors when pathing through. Any failing steps now have a threshold to abandon failed pathing. 2022-11-02 22:09:35 +01:00
ancientmarinerdev f9ec402b29 Only to door if we can get from door to target 2022-11-02 22:09:35 +01:00
ancientmarinerdev bf491c35a1 Fix bug 2022-11-02 22:09:35 +01:00
cora 646a341f52 Fix mob api can_spawn callback 2022-11-02 03:47:23 +01:00