mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-28 05:21:05 +01:00
Add pitch and yaw offset support to vl_projectile
This commit is contained in:
parent
74ce69e3f0
commit
27f0f8b52b
1 changed files with 4 additions and 3 deletions
|
@ -53,8 +53,8 @@ function mod.projectile_physics(obj, entity_def, v, a)
|
||||||
|
|
||||||
-- Update projectile yaw to match velocity direction
|
-- Update projectile yaw to match velocity direction
|
||||||
if v and le and not le._stuck then
|
if v and le and not le._stuck then
|
||||||
local yaw = minetest.dir_to_yaw(v) + YAW_OFFSET
|
local yaw = minetest.dir_to_yaw(v) + YAW_OFFSET + (entity_def._vl_projectile.yaw_offset or 0)
|
||||||
local pitch = math.asin(vector.normalize(v).y)
|
local pitch = math.asin(vector.normalize(v).y) + (entity_def._vl_projectile.pitch_offset or 0)
|
||||||
obj:set_rotation(vector.new(0,yaw,pitch))
|
obj:set_rotation(vector.new(0,yaw,pitch))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -301,7 +301,8 @@ local function stuck_on_step(self, dtime, entity_def, projectile_def)
|
||||||
obj = objects[i]
|
obj = objects[i]
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
if self._collectable and not minetest.is_creative_enabled(obj:get_player_name()) then
|
if self._collectable and not minetest.is_creative_enabled(obj:get_player_name()) then
|
||||||
local arrow_item = self._arrow_item
|
local arrow_item = self._itemstring or self._arrow_item
|
||||||
|
minetest.log("Trying to pick up "..tostring(arrow_item))
|
||||||
if arrow_item and minetest.registered_items[arrow_item] and obj:get_inventory():room_for_item("main", arrow_item) then
|
if arrow_item and minetest.registered_items[arrow_item] and obj:get_inventory():room_for_item("main", arrow_item) then
|
||||||
obj:get_inventory():add_item("main", arrow_item)
|
obj:get_inventory():add_item("main", arrow_item)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue