Fix: Changing mod name to minetest_mod_lib_astral_body.
parent
72c80757e8
commit
a369b610e6
42
init.lua
42
init.lua
|
@ -1,5 +1,5 @@
|
|||
minetest_mod_astral_body = {}
|
||||
minetest.register_entity("minetest_mod_astral_body:astral_body",
|
||||
minetest_mod_lib_astral_body = {}
|
||||
minetest.register_entity("minetest_mod_lib_astral_body:astral_body",
|
||||
{
|
||||
obj, -- ObjectRef from minetest.add_entity()
|
||||
player, -- ObjectRef player
|
||||
|
@ -22,24 +22,24 @@ minetest.register_entity("minetest_mod_astral_body:astral_body",
|
|||
end
|
||||
if controls.jump and not controls.sneak then
|
||||
self.velocity = vector.add(self.velocity,vector.multiply(
|
||||
minetest_mod_astral_body.calculate_direction_by_yaw_and_pitch(0,-(90*(math.pi/180))),
|
||||
minetest_mod_lib_astral_body.calculate_direction_by_yaw_and_pitch(0,-(90*(math.pi/180))),
|
||||
speed
|
||||
))
|
||||
end
|
||||
if controls.sneak and not controls.jump then
|
||||
self.velocity = vector.add(self.velocity,vector.multiply(
|
||||
minetest_mod_astral_body.calculate_direction_by_yaw_and_pitch(0,(90*(math.pi/180))),
|
||||
minetest_mod_lib_astral_body.calculate_direction_by_yaw_and_pitch(0,(90*(math.pi/180))),
|
||||
speed
|
||||
))
|
||||
end
|
||||
if controls.right and not controls.left then
|
||||
self.velocity = vector.add(self.velocity,vector.multiply(
|
||||
minetest_mod_astral_body.calculate_direction_by_yaw_and_pitch(self.player.obj:get_look_horizontal()-(90*(math.pi/180)),0),
|
||||
minetest_mod_lib_astral_body.calculate_direction_by_yaw_and_pitch(self.player.obj:get_look_horizontal()-(90*(math.pi/180)),0),
|
||||
speed
|
||||
))
|
||||
elseif controls.left and not controls.right then
|
||||
self.velocity = vector.add(self.velocity,vector.multiply(
|
||||
minetest_mod_astral_body.calculate_direction_by_yaw_and_pitch(self.player.obj:get_look_horizontal()+(90*(math.pi/180)),0),
|
||||
minetest_mod_lib_astral_body.calculate_direction_by_yaw_and_pitch(self.player.obj:get_look_horizontal()+(90*(math.pi/180)),0),
|
||||
speed
|
||||
))
|
||||
end
|
||||
|
@ -52,25 +52,25 @@ minetest.register_entity("minetest_mod_astral_body:astral_body",
|
|||
end
|
||||
end
|
||||
})
|
||||
minetest_mod_astral_body.ascend_player_into_astral_body = function(arguments)
|
||||
local astral_body = minetest.add_entity(arguments.position,"minetest_mod_astral_body:astral_body"):get_luaentity()
|
||||
minetest_mod_lib_astral_body.ascend_player_into_astral_body = function(arguments)
|
||||
local astral_body = minetest.add_entity(arguments.position,"minetest_mod_lib_astral_body:astral_body"):get_luaentity()
|
||||
astral_body.obj = astral_body.object
|
||||
astral_body.player = { obj = arguments.player_obj }
|
||||
astral_body.player.obj:set_attach(astral_body.obj,"",{x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
return astral_body
|
||||
end
|
||||
minetest_mod_astral_body.calculate_direction_by_yaw_and_pitch = function(yaw,pitch)
|
||||
minetest_mod_lib_astral_body.calculate_direction_by_yaw_and_pitch = function(yaw,pitch)
|
||||
return { x = -(math.cos(pitch) * math.sin(yaw)), y = -(math.sin(pitch)), z = math.cos(pitch) * math.cos(yaw) }
|
||||
end
|
||||
-- minetest.register_node("minetest_mod_astral_body:astral_block",
|
||||
-- {
|
||||
-- description = "Uncomment this block to test the mod.",
|
||||
-- tiles = {"^[colorize:#FFF"},
|
||||
-- on_rightclick = function(node_pos, node_obj, player_obj, player_item)
|
||||
-- minetest_mod_astral_body.ascend_player_into_astral_body(
|
||||
-- {
|
||||
-- position = {x=node_pos.x,y=node_pos.y-1.5,z=node_pos.z}, -- y=-1.5 to put view inside the block
|
||||
-- player_obj = player_obj,
|
||||
-- })
|
||||
-- end
|
||||
-- })
|
||||
minetest.register_node("minetest_mod_lib_astral_body:astral_block",
|
||||
{
|
||||
description = "Uncomment this block to test the mod.",
|
||||
tiles = {"^[colorize:#FFF"},
|
||||
on_rightclick = function(node_pos, node_obj, player_obj, player_item)
|
||||
minetest_mod_lib_astral_body.ascend_player_into_astral_body(
|
||||
{
|
||||
position = {x=node_pos.x,y=node_pos.y-1.5,z=node_pos.z}, -- y=-1.5 to put view inside the block
|
||||
player_obj = player_obj,
|
||||
})
|
||||
end
|
||||
})
|
Loading…
Reference in New Issue