-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbombshells.lua
More file actions
29 lines (23 loc) · 840 Bytes
/
bombshells.lua
File metadata and controls
29 lines (23 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
rangedweapons = {}
function rangedweapons.launch_projectile(obj, def)
local self = obj:get_luaentity()
local pos = obj:get_pos()
local dir = minetest.facedir_to_dir(def.param2)
local targetpos = vector.add(vector.multiply(dir, def.distance), pos)
self.startpos = pos
self.timeout = def.timeout
self.radius = def.radius
local newdir = vector.multiply(vector.direction(pos, targetpos), def.speed)
local dspeed = def.speed/5
obj:set_velocity({x=newdir.x, y=def.climb*def.speed/8, z=newdir.z})
obj:setacceleration({x=(-newdir.x/dspeed)+math.random(-7, 7), y=-def.climb*def.speed/3.5, z=(-newdir.z/dspeed)+math.random(-7, 7)})
end
function rangedweapons.explode(pos, radius)
tnt.boom(pos, {
radius = radius,
damage_radius = radius+1,
explode_center = false,
ignore_protection = false,
ignore_on_blast = false
})
end