1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-06-28 06:30:18 +02:00

add particle effect global function, arrow lifetime, api.txt update

This commit is contained in:
tenplus1
2020-06-20 10:07:32 +01:00
parent 245128f9e6
commit ec122aa6de
2 changed files with 41 additions and 6 deletions

25
api.txt
View File

@ -293,7 +293,8 @@ enhance mob functionality and have them do many interesting things:
'custom_attack' when set this function is called instead of the normal mob
melee attack, parameters are (self, to_attack) and if true
is returned normal attack function continued.
'on_die' a function that is called when mob is killed (self, pos)
'on_die' a function that is called when mob is killed (self, pos), also
has access to self.cause_of_death table.
'do_custom' a custom function that is called every tick while mob is
active and which has access to all of the self.* variables
e.g. (self.health for health or self.standing_in for node
@ -387,6 +388,24 @@ true the mob will not spawn.
'name' is the name of the animal/monster
Particle Effects
----------------
mobs:effect(pos, amount, texture, min_size, max_size, radius, gravity, glow, fall)
This function provides a quick way to spawn particles as an effect.
'pos' center position of particle effect.
'amount' how many particles.
'texture' texture filename to use for effect.
'min_size' smallest particle size.
'max_size' largest particle size.
'radius' how far particles spread outward from center.
'gravity' gravity applied to particles once they spawn.
'glow' number between 1 and 15 for glowing particles.
'fall' when true particles fall, false has them rising, nil has them scatter.
Making Arrows
-------------
@ -422,7 +441,9 @@ This function registers a arrow for mobs with the attack type shoot.
'on_step' is a custom function when arrow is active, nil for
default.
'on_punch' is a custom function when arrow is punched, nil by default
'collisionbox' is hitbox table for arrow, {0,0,0,0,0,0} by default.
'collisionbox' is hitbox table for arrow, {-.1,-.1,-.1,.1,.1,.1} by default.
'lifetime' contains float value for how many seconds arrow exists in
world before being removed (default is 4.5 seconds).
Spawn Eggs