added paraglider
This commit is contained in:
parent
fabcf0d703
commit
012bb6afe2
16
mods/paraglider/LICENSE.txt
Normal file
16
mods/paraglider/LICENSE.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||||
|
|
||||||
|
License for Media
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz)
|
46
mods/paraglider/init.lua
Normal file
46
mods/paraglider/init.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
paraglider = {}
|
||||||
|
paraglider.use = {}
|
||||||
|
paraglider.automatic = false
|
||||||
|
|
||||||
|
minetest.register_craftitem("paraglider:paraglider", {
|
||||||
|
description = "Paraglider",
|
||||||
|
inventory_image = "paraglider_item.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if not user then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if paraglider.use[user:get_player_name()] == true then
|
||||||
|
user:set_physics_override({
|
||||||
|
gravity = 1,
|
||||||
|
jump = 1,
|
||||||
|
})
|
||||||
|
paraglider.use[user:get_player_name()] = false
|
||||||
|
else
|
||||||
|
user:set_physics_override({
|
||||||
|
gravity = 0.02,
|
||||||
|
jump = 0,
|
||||||
|
})
|
||||||
|
paraglider.use[user:get_player_name()] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
if paraglider.automatic then
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
local name = player:get_player_name()
|
||||||
|
--local controls = player:get_player_control()
|
||||||
|
if paraglider.use[name] == true then
|
||||||
|
local pos = player:getpos()
|
||||||
|
if minetest.get_node(vector.new(pos.x, pos.y-1, pos.z)).name ~= "air" then
|
||||||
|
player:set_physics_override({
|
||||||
|
gravity = 1,
|
||||||
|
jump = 1,
|
||||||
|
})
|
||||||
|
paraglider.use[name] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
BIN
mods/paraglider/textures/paraglider_item.png
Normal file
BIN
mods/paraglider/textures/paraglider_item.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 B |
Loading…
x
Reference in New Issue
Block a user