extra yaw setting added, wings changes
>models can be rotated with entra_yaw >wing model and texture changed >attempts made to make wings work.
This commit is contained in:
parent
a27acf2fc2
commit
f0e32688ae
15
api.lua
15
api.lua
@ -134,6 +134,7 @@ function object_drive(entity, dtime, def)
|
|||||||
local swims = def.swims or false
|
local swims = def.swims or false
|
||||||
local driving_sound = def.driving_sound or nil
|
local driving_sound = def.driving_sound or nil
|
||||||
local sound_duration = def.sound_duration or 5
|
local sound_duration = def.sound_duration or 5
|
||||||
|
local extra_yaw = def.extra_yaw or 0
|
||||||
|
|
||||||
local moving_anim = def.moving_anim
|
local moving_anim = def.moving_anim
|
||||||
local stand_anim = def.stand_anim
|
local stand_anim = def.stand_anim
|
||||||
@ -211,7 +212,7 @@ function object_drive(entity, dtime, def)
|
|||||||
entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9})
|
entity.object:setvelocity({x=velo.x*0.9, y=-1, z=velo.z*0.9})
|
||||||
--boost
|
--boost
|
||||||
elseif ctrl.up and not shoots2 and ctrl.aux1 and entity.boost then
|
elseif ctrl.up and not shoots2 and ctrl.aux1 and entity.boost then
|
||||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw)
|
||||||
entity.object:setvelocity(vec_boost)
|
entity.object:setvelocity(vec_boost)
|
||||||
if boost_effect ~= nil then
|
if boost_effect ~= nil then
|
||||||
minetest.add_particlespawner(
|
minetest.add_particlespawner(
|
||||||
@ -241,7 +242,7 @@ function object_drive(entity, dtime, def)
|
|||||||
end
|
end
|
||||||
--rise
|
--rise
|
||||||
elseif ctrl.jump and fly and fly_mode == "rise" then
|
elseif ctrl.jump and fly and fly_mode == "rise" then
|
||||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw)
|
||||||
entity.object:setvelocity(vec_rise)
|
entity.object:setvelocity(vec_rise)
|
||||||
--lib_mount animation
|
--lib_mount animation
|
||||||
if moving_anim ~= nil and not entity.moving then
|
if moving_anim ~= nil and not entity.moving then
|
||||||
@ -253,7 +254,7 @@ function object_drive(entity, dtime, def)
|
|||||||
entity.object:setvelocity({x=dir.x*speed, y=0, z=dir.z*speed})
|
entity.object:setvelocity({x=dir.x*speed, y=0, z=dir.z*speed})
|
||||||
--move forward
|
--move forward
|
||||||
elseif ctrl.up and not fixed then
|
elseif ctrl.up and not fixed then
|
||||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw)
|
||||||
if not fly and not is_watercraft then
|
if not fly and not is_watercraft then
|
||||||
entity.object:setvelocity(vec_forward)
|
entity.object:setvelocity(vec_forward)
|
||||||
elseif not fly then
|
elseif not fly then
|
||||||
@ -268,7 +269,7 @@ function object_drive(entity, dtime, def)
|
|||||||
end
|
end
|
||||||
--move backward
|
--move backward
|
||||||
elseif ctrl.down and not fixed then
|
elseif ctrl.down and not fixed then
|
||||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw)
|
||||||
if not is_watercraft then
|
if not is_watercraft then
|
||||||
entity.object:setvelocity(vec_backward)
|
entity.object:setvelocity(vec_backward)
|
||||||
else
|
else
|
||||||
@ -281,7 +282,7 @@ function object_drive(entity, dtime, def)
|
|||||||
end
|
end
|
||||||
--stop
|
--stop
|
||||||
elseif not ctrl.down or ctrl.up then
|
elseif not ctrl.down or ctrl.up then
|
||||||
entity.object:setyaw(yaw+math.pi+math.pi/2)
|
entity.object:setyaw(yaw+math.pi+math.pi/2+extra_yaw)
|
||||||
entity.object:setvelocity(vec_stop)
|
entity.object:setvelocity(vec_stop)
|
||||||
--animation
|
--animation
|
||||||
if moving_anim ~= nil and entity.moving and not hovering then
|
if moving_anim ~= nil and entity.moving and not hovering then
|
||||||
@ -296,7 +297,7 @@ function object_drive(entity, dtime, def)
|
|||||||
entity.loaded = false
|
entity.loaded = false
|
||||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+shoot_y+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+shoot_y+dir.y,z=pos.z+0+dir.z*2}, arrow)
|
||||||
local vec = {x=dir.x*14,y=dir.y*14+shoot_angle,z=dir.z*14}
|
local vec = {x=dir.x*14,y=dir.y*14+shoot_angle,z=dir.z*14}
|
||||||
obj:setyaw(yaw+math.pi/2)
|
obj:setyaw(yaw+math.pi/2+extra_yaw)
|
||||||
obj:setvelocity(vec)
|
obj:setvelocity(vec)
|
||||||
local object = obj:get_luaentity()
|
local object = obj:get_luaentity()
|
||||||
object.launcher = entity.driver
|
object.launcher = entity.driver
|
||||||
@ -319,7 +320,7 @@ function object_drive(entity, dtime, def)
|
|||||||
entity.loaded2 = false
|
entity.loaded2 = false
|
||||||
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+shoot_y2+dir.y,z=pos.z+0+dir.z*2}, arrow2)
|
local obj = minetest.env:add_entity({x=pos.x+0+dir.x*2,y=pos.y+shoot_y2+dir.y,z=pos.z+0+dir.z*2}, arrow2)
|
||||||
local vec = {x=dir.x*14,y=dir.y*14+shoot_angle,z=dir.z*14}
|
local vec = {x=dir.x*14,y=dir.y*14+shoot_angle,z=dir.z*14}
|
||||||
obj:setyaw(yaw+math.pi/2)
|
obj:setyaw(yaw+math.pi/2+extra_yaw)
|
||||||
obj:setvelocity(vec)
|
obj:setvelocity(vec)
|
||||||
local object = obj:get_luaentity()
|
local object = obj:get_luaentity()
|
||||||
object.launcher = entity.driver
|
object.launcher = entity.driver
|
||||||
|
108
init.lua
108
init.lua
@ -1904,64 +1904,86 @@ minetest.register_entity("vehicles:wing_glider", {
|
|||||||
velocity = 15,
|
velocity = 15,
|
||||||
acceleration = -5,
|
acceleration = -5,
|
||||||
hp_max = 2,
|
hp_max = 2,
|
||||||
physical = true,
|
armor = 0,
|
||||||
|
physical = false,
|
||||||
collisionbox = {-0.5, -0.1, -0.5, 0.5, 0.1, 0.5},
|
collisionbox = {-0.5, -0.1, -0.5, 0.5, 0.1, 0.5},
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
if self.driver then
|
if self.driver then
|
||||||
local dir = self.driver:get_look_dir();
|
local dir = self.driver:get_look_dir();
|
||||||
local velo = self.object:getvelocity();
|
local velo = self.object:getvelocity();
|
||||||
local vec = {x=dir.x*5,y=(-dir.y*2*velo.y/4-2.5)+dir.y*3,z=dir.z*5}
|
local speed = math.sqrt(math.pow(velo.x, 2)+math.pow(velo.z, 2))
|
||||||
|
local vec = {x=dir.x*16,y=dir.y*16+1,z=dir.z*16}
|
||||||
local yaw = self.driver:get_look_yaw();
|
local yaw = self.driver:get_look_yaw();
|
||||||
self.object:setyaw(yaw+math.pi/2)
|
self.object:setyaw(yaw+math.pi/2)
|
||||||
self.object:setvelocity(vec)
|
self.object:setvelocity(vec)
|
||||||
self.driver:set_animation({x=162, y=167}, 0, 0)
|
self.driver:set_animation({x=162, y=167}, 0, 0)
|
||||||
|
self.object:set_animation({x=25, y=45}, 0, 0)
|
||||||
return false
|
return false
|
||||||
|
else
|
||||||
|
self.object:remove()
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
on_punch = function(self, puncher)
|
||||||
|
if not self.driver then
|
||||||
|
local name = self.object:get_luaentity().name
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
minetest.env:add_item(pos, name.."_spawner")
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
if self.object:get_hp() == 0 then
|
||||||
|
if self.driver then
|
||||||
|
object_detach(self, self.driver, {x=1, y=0, z=1})
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- minetest.register_tool("vehicles:wings", {
|
minetest.register_tool("vehicles:wings", {
|
||||||
-- description = "Wings",
|
description = "Wings",
|
||||||
-- inventory_image = "vehicles_backpack.png",
|
inventory_image = "vehicles_backpack.png",
|
||||||
-- wield_scale = {x = 1.5, y = 1.5, z = 1},
|
wield_scale = {x = 1.5, y = 1.5, z = 1},
|
||||||
-- tool_capabilities = {
|
tool_capabilities = {
|
||||||
-- full_punch_interval = 0.7,
|
full_punch_interval = 0.7,
|
||||||
-- max_drop_level=1,
|
max_drop_level=1,
|
||||||
-- groupcaps={
|
groupcaps={
|
||||||
-- snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
||||||
-- },
|
},
|
||||||
-- damage_groups = {fleshy=1},
|
damage_groups = {fleshy=1},
|
||||||
-- },
|
},
|
||||||
-- on_use = function(item, placer, pointed_thing)
|
on_use = function(item, placer, pointed_thing)
|
||||||
-- local dir = placer:get_look_dir();
|
local wings_ready = true
|
||||||
-- local playerpos = placer:getpos();
|
local dir = placer:get_look_dir();
|
||||||
-- local objs = minetest.get_objects_inside_radius({x=playerpos.x,y=playerpos.y,z=playerpos.z}, 2)
|
local playerpos = placer:getpos();
|
||||||
-- for k, obj2 in pairs(objs) do
|
local objs = minetest.get_objects_inside_radius({x=playerpos.x,y=playerpos.y,z=playerpos.z}, 2)
|
||||||
-- if obj2:get_luaentity() ~= nil then
|
for k, obj2 in pairs(objs) do
|
||||||
-- if obj2:get_luaentity().name == "vehicles:wings" then
|
if obj2:get_luaentity() ~= nil and obj2:get_luaentity().name == "vehicles:wing_glider" then
|
||||||
-- local wings = false
|
local wing = obj2:get_luaentity()
|
||||||
-- end
|
wing.driver = nil
|
||||||
-- end
|
obj2:remove()
|
||||||
-- end
|
object_detach(obj2:get_luaentity(), placer, {x=1, y=0, z=1})
|
||||||
-- if wings then
|
placer:set_properties({
|
||||||
-- object_detach(obj2:get_luaentity(), placer, {x=1, y=0, z=1})
|
visual_size = {x=1, y=1},
|
||||||
-- placer:set_properties({
|
})
|
||||||
-- visual_size = {x=1, y=1},
|
wings_ready = false
|
||||||
-- })
|
end
|
||||||
-- else
|
end
|
||||||
-- local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1+dir.y,z=playerpos.z+0+dir.z}, "vehicles:wing_glider")
|
|
||||||
-- local entity = obj:get_luaentity()
|
if wings_ready then
|
||||||
-- placer:set_attach(entity.object, "", {x=0,y=-5,z=0}, {x=0,y=0,z=0})
|
local obj = minetest.env:add_entity({x=playerpos.x+0+dir.x,y=playerpos.y+1+dir.y,z=playerpos.z+0+dir.z}, "vehicles:wing_glider")
|
||||||
-- entity.driver = placer
|
local entity = obj:get_luaentity()
|
||||||
-- placer:set_properties({
|
placer:set_attach(entity.object, "", {x=0,y=-5,z=0}, {x=0,y=-3,z=0})
|
||||||
-- visual_size = {x=1, y=-1},
|
entity.driver = placer
|
||||||
-- })
|
local dir = placer:get_look_dir()
|
||||||
-- end
|
placer:set_properties({
|
||||||
-- item:add_wear(500)
|
visual_size = {x=1, y=-1},
|
||||||
-- return item
|
})
|
||||||
-- end,
|
item:add_wear(500)
|
||||||
-- })
|
return item
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_tool("vehicles:rc", {
|
minetest.register_tool("vehicles:rc", {
|
||||||
description = "Rc (use with missiles)",
|
description = "Rc (use with missiles)",
|
||||||
|
BIN
models/wings.b3d
BIN
models/wings.b3d
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 297 B |
Loading…
x
Reference in New Issue
Block a user