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 driving_sound = def.driving_sound or nil
|
||||
local sound_duration = def.sound_duration or 5
|
||||
local extra_yaw = def.extra_yaw or 0
|
||||
|
||||
local moving_anim = def.moving_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})
|
||||
--boost
|
||||
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)
|
||||
if boost_effect ~= nil then
|
||||
minetest.add_particlespawner(
|
||||
@ -241,7 +242,7 @@ function object_drive(entity, dtime, def)
|
||||
end
|
||||
--rise
|
||||
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)
|
||||
--lib_mount animation
|
||||
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})
|
||||
--move forward
|
||||
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
|
||||
entity.object:setvelocity(vec_forward)
|
||||
elseif not fly then
|
||||
@ -268,7 +269,7 @@ function object_drive(entity, dtime, def)
|
||||
end
|
||||
--move backward
|
||||
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
|
||||
entity.object:setvelocity(vec_backward)
|
||||
else
|
||||
@ -281,7 +282,7 @@ function object_drive(entity, dtime, def)
|
||||
end
|
||||
--stop
|
||||
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)
|
||||
--animation
|
||||
if moving_anim ~= nil and entity.moving and not hovering then
|
||||
@ -296,7 +297,7 @@ function object_drive(entity, dtime, def)
|
||||
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 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)
|
||||
local object = obj:get_luaentity()
|
||||
object.launcher = entity.driver
|
||||
@ -319,7 +320,7 @@ function object_drive(entity, dtime, def)
|
||||
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 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)
|
||||
local object = obj:get_luaentity()
|
||||
object.launcher = entity.driver
|
||||
|
108
init.lua
108
init.lua
@ -1904,64 +1904,86 @@ minetest.register_entity("vehicles:wing_glider", {
|
||||
velocity = 15,
|
||||
acceleration = -5,
|
||||
hp_max = 2,
|
||||
physical = true,
|
||||
armor = 0,
|
||||
physical = false,
|
||||
collisionbox = {-0.5, -0.1, -0.5, 0.5, 0.1, 0.5},
|
||||
on_step = function(self, dtime)
|
||||
if self.driver then
|
||||
local dir = self.driver:get_look_dir();
|
||||
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();
|
||||
self.object:setyaw(yaw+math.pi/2)
|
||||
self.object:setvelocity(vec)
|
||||
self.driver:set_animation({x=162, y=167}, 0, 0)
|
||||
self.object:set_animation({x=25, y=45}, 0, 0)
|
||||
return false
|
||||
else
|
||||
self.object:remove()
|
||||
end
|
||||
return true
|
||||
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", {
|
||||
-- description = "Wings",
|
||||
-- inventory_image = "vehicles_backpack.png",
|
||||
-- wield_scale = {x = 1.5, y = 1.5, z = 1},
|
||||
-- tool_capabilities = {
|
||||
-- full_punch_interval = 0.7,
|
||||
-- max_drop_level=1,
|
||||
-- groupcaps={
|
||||
-- snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
||||
-- },
|
||||
-- damage_groups = {fleshy=1},
|
||||
-- },
|
||||
-- on_use = function(item, placer, pointed_thing)
|
||||
-- local dir = placer:get_look_dir();
|
||||
-- local playerpos = placer:getpos();
|
||||
-- local objs = minetest.get_objects_inside_radius({x=playerpos.x,y=playerpos.y,z=playerpos.z}, 2)
|
||||
-- for k, obj2 in pairs(objs) do
|
||||
-- if obj2:get_luaentity() ~= nil then
|
||||
-- if obj2:get_luaentity().name == "vehicles:wings" then
|
||||
-- local wings = false
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- if wings then
|
||||
-- object_detach(obj2:get_luaentity(), placer, {x=1, y=0, z=1})
|
||||
-- placer:set_properties({
|
||||
-- visual_size = {x=1, y=1},
|
||||
-- })
|
||||
-- else
|
||||
-- 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()
|
||||
-- placer:set_attach(entity.object, "", {x=0,y=-5,z=0}, {x=0,y=0,z=0})
|
||||
-- entity.driver = placer
|
||||
-- placer:set_properties({
|
||||
-- visual_size = {x=1, y=-1},
|
||||
-- })
|
||||
-- end
|
||||
-- item:add_wear(500)
|
||||
-- return item
|
||||
-- end,
|
||||
-- })
|
||||
minetest.register_tool("vehicles:wings", {
|
||||
description = "Wings",
|
||||
inventory_image = "vehicles_backpack.png",
|
||||
wield_scale = {x = 1.5, y = 1.5, z = 1},
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.7,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=1},
|
||||
},
|
||||
on_use = function(item, placer, pointed_thing)
|
||||
local wings_ready = true
|
||||
local dir = placer:get_look_dir();
|
||||
local playerpos = placer:getpos();
|
||||
local objs = minetest.get_objects_inside_radius({x=playerpos.x,y=playerpos.y,z=playerpos.z}, 2)
|
||||
for k, obj2 in pairs(objs) do
|
||||
if obj2:get_luaentity() ~= nil and obj2:get_luaentity().name == "vehicles:wing_glider" then
|
||||
local wing = obj2:get_luaentity()
|
||||
wing.driver = nil
|
||||
obj2:remove()
|
||||
object_detach(obj2:get_luaentity(), placer, {x=1, y=0, z=1})
|
||||
placer:set_properties({
|
||||
visual_size = {x=1, y=1},
|
||||
})
|
||||
wings_ready = false
|
||||
end
|
||||
end
|
||||
|
||||
if wings_ready then
|
||||
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()
|
||||
placer:set_attach(entity.object, "", {x=0,y=-5,z=0}, {x=0,y=-3,z=0})
|
||||
entity.driver = placer
|
||||
local dir = placer:get_look_dir()
|
||||
placer:set_properties({
|
||||
visual_size = {x=1, y=-1},
|
||||
})
|
||||
item:add_wear(500)
|
||||
return item
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("vehicles:rc", {
|
||||
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