forked from mtcontrib/mobs_redo
add custom on_punch for mob arrows
This commit is contained in:
parent
2106a081b9
commit
82411330fc
7
api.lua
7
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
||||
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20180908",
|
||||
version = "20180909",
|
||||
intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||
}
|
||||
@ -3309,7 +3309,7 @@ function mobs:register_arrow(name, def)
|
||||
hit_node = def.hit_node,
|
||||
hit_mob = def.hit_mob,
|
||||
drop = def.drop or false, -- drops arrow as registered item when true
|
||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
||||
timer = 0,
|
||||
switch = 0,
|
||||
owner_id = def.owner_id,
|
||||
@ -3319,6 +3319,9 @@ function mobs:register_arrow(name, def)
|
||||
|
||||
on_activate = def.on_activate,
|
||||
|
||||
on_punch = def.on_punch or function(self, hitter, tflp, tool_capabilities, dir)
|
||||
end,
|
||||
|
||||
on_step = def.on_step or function(self, dtime)
|
||||
|
||||
self.timer = self.timer + 1
|
||||
|
2
api.txt
2
api.txt
@ -396,6 +396,8 @@ This function registers a arrow for mobs with the attack type shoot.
|
||||
'rotate' integer value in degrees to rotate arrow
|
||||
'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.
|
||||
|
||||
|
||||
Spawn Eggs
|
||||
|
Loading…
Reference in New Issue
Block a user