diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-09-15 16:06:35 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-09-15 16:06:35 +0100 |
commit | 4785c37f18c5bdfc3945b7a0a0ab1093eaa73534 (patch) | |
tree | c864fc808c9a8c2e8e3da75a97c8d7e100f08df1 /api.txt | |
parent | 7b0a1cf233b18a17b0d00721cd03c3f4b49e1b28 (diff) |
added on_breed on_grown and do_punch custom functions
Diffstat (limited to 'api.txt')
-rw-r--r-- | api.txt | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1,5 +1,5 @@ -MOB API (1st September 2017) +MOB API (15th September 2017) The mob api is a function that can be called on by other mods to add new animals or monsters into minetest. @@ -75,9 +75,7 @@ This functions registers a new mob as a Minetest entity. 'fall_damage' will mob be hurt when falling from height 'fall_speed' maximum falling velocity of mob (default is -10 and must be below -2) 'fear_height' when mob walks near a drop then anything over this value makes it stop and turn back (default is 0 to disable) - 'on_die' a function that is called when the mob is killed the parameters are (self, pos) 'floats' 1 to float in water, 0 to sink - 'on_rightclick' its same as in minetest.register_entity() 'pathfinding' set to 1 for mobs to use pathfinder feature to locate player, set to 2 so they can build/break also (only works with dogfight attack) 'attack_type' the attack type of a monster 'dogfight' follows player in range and attacks when in reach @@ -89,13 +87,11 @@ This functions registers a new mob as a Minetest entity. 'dogshoot_count2_max' number of seconds before switching back to shoot mode. 'custom_attack' when set this function is called instead of the normal mob melee attack, parameters are (self, to_attack) 'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations - 'on_blast' is called when an explosion happens near mob when using TNT functions, parameters are (object, damage) and returns (do_damage, do_knockback, drops) 'explosion_radius' radius of explosion attack (defaults to 1) 'arrow' if the attack_type is "shoot" or "dogshoot" then the entity name of a pre-defined arrow is required, see below for arrow definition. 'shoot_interval' the minimum shoot interval 'shoot_offset' +/- value to position arrow/fireball when fired 'reach' how far a reach this mob has, default is 3 - 'on_spawn' is a custom function that runs on mob spawn with 'self' as variable, return true at end of function to run onyl once. 'sounds' this is a table with sounds of the mob 'random' random sounds during gameplay 'war_cry' sound when starting to attack player @@ -107,6 +103,18 @@ This functions registers a new mob as a Minetest entity. 'explode' sound when exploding 'distance' maximum distance sounds are heard from (default is 10) +Custom mob functions inside mob registry: + + 'on_die' a function that is called when the mob is killed the parameters are (self, pos) + 'on_rightclick' its same as in minetest.register_entity() + 'on_blast' is called when an explosion happens near mob when using TNT functions, parameters are (object, damage) and returns (do_damage, do_knockback, drops) + 'on_spawn' is a custom function that runs on mob spawn with 'self' as variable, return true at end of function to run only once. + 'on_breed' called when two similar mobs breed, paramaters are (parent1, parent2) objects, return false to stop child from being resized and owner/tamed flags and child textures being applied. + 'on_grown' is called when a child mob has grown up, only paramater is (self). + 'do_punch' called when mob is punched with paramaters (self, hitter, time_from_last_punch, tool_capabilities, direction), return false to stop punch damage and knockback from taking place. + + + Mobs can look for specific nodes as they walk and replace them to mimic eating. 'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"} |