mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 02:00:21 +01:00
arrow entity check, glow and expire added to arrows
This commit is contained in:
parent
6eb6e458af
commit
52a2355954
30
api.lua
30
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (19th January 2017)
|
-- Mobs Api (20th January 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -1893,6 +1893,7 @@ local do_states = function(self, dtime)
|
|||||||
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
|
||||||
|
|
||||||
local obj = minetest.add_entity(p, self.arrow)
|
local obj = minetest.add_entity(p, self.arrow)
|
||||||
|
if obj then
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
|
||||||
local v = ent.velocity or 1 -- or set to default
|
local v = ent.velocity or 1 -- or set to default
|
||||||
@ -1909,6 +1910,7 @@ local do_states = function(self, dtime)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -2886,25 +2888,15 @@ function mobs:register_arrow(name, def)
|
|||||||
and def.tail == 1
|
and def.tail == 1
|
||||||
and def.tail_texture then
|
and def.tail_texture then
|
||||||
|
|
||||||
-- effect(pos, 1, def.tail_texture,
|
minetest.add_particle({
|
||||||
-- def.tail_size or 5,
|
pos = pos,
|
||||||
-- def.tail_size or 10,
|
velocity = {x = 0, y = 0, z = 0},
|
||||||
-- 0, 0) -- 0 radius and 0 gravity to just hover
|
acceleration = {x = 0, y = 0, z = 0},
|
||||||
|
expirationtime = def.expire or 0.25,
|
||||||
minetest.add_particlespawner({
|
collisiondetection = false,
|
||||||
amount = 1,
|
|
||||||
time = 0.25,
|
|
||||||
minpos = pos,
|
|
||||||
maxpos = pos,
|
|
||||||
minvel = {x = 0, y = 0, z = 0},
|
|
||||||
maxvel = {x = 0, y = 0, z = 0},
|
|
||||||
minacc = {x = 0, y = 0, z = 0},
|
|
||||||
maxacc = {x = 0, y = 0, z = 0},
|
|
||||||
minexptime = 0.1,
|
|
||||||
maxexptime = 1,
|
|
||||||
minsize = def.tail_size or 5,
|
|
||||||
maxsize = def.tail_size or 10,
|
|
||||||
texture = def.tail_texture,
|
texture = def.tail_texture,
|
||||||
|
size = def.tail_size or 5,
|
||||||
|
glow = def.glow or 0,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
3265
api.lua_new
3265
api.lua_new
File diff suppressed because it is too large
Load Diff
2
api.txt
2
api.txt
@ -194,6 +194,8 @@ This function registers a arrow for mobs with the attack type shoot.
|
|||||||
'tail' when set to 1 adds a trail or tail to mob arrows
|
'tail' when set to 1 adds a trail or tail to mob arrows
|
||||||
'tail_texture' texture string used for above effect
|
'tail_texture' texture string used for above effect
|
||||||
'tail_size' has size for above texture (defaults to between 5 and 10)
|
'tail_size' has size for above texture (defaults to between 5 and 10)
|
||||||
|
'expire' contains float value for how long tail appears for (defaults to 0.25)
|
||||||
|
'glow' has value for how brightly tail glows 1 to 10 (default is 0, no glow)
|
||||||
'on_step' is a custom function when arrow is active, nil for default.
|
'on_step' is a custom function when arrow is active, nil for default.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user