From 012bb6afe242a1a85fc3e7e09b12f23640864dae Mon Sep 17 00:00:00 2001 From: cale Date: Sat, 12 Mar 2016 11:45:04 +0100 Subject: [PATCH] added paraglider --- mods/paraglider/LICENSE.txt | 16 +++++++ mods/paraglider/init.lua | 46 +++++++++++++++++++ mods/paraglider/textures/paraglider_item.png | Bin 0 -> 250 bytes 3 files changed, 62 insertions(+) create mode 100644 mods/paraglider/LICENSE.txt create mode 100644 mods/paraglider/init.lua create mode 100644 mods/paraglider/textures/paraglider_item.png diff --git a/mods/paraglider/LICENSE.txt b/mods/paraglider/LICENSE.txt new file mode 100644 index 0000000..6f6a256 --- /dev/null +++ b/mods/paraglider/LICENSE.txt @@ -0,0 +1,16 @@ +License for Code +---------------- + +Copyright (C) 2016 cd2 (cdqwertz) + +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) diff --git a/mods/paraglider/init.lua b/mods/paraglider/init.lua new file mode 100644 index 0000000..08fb9bf --- /dev/null +++ b/mods/paraglider/init.lua @@ -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 + diff --git a/mods/paraglider/textures/paraglider_item.png b/mods/paraglider/textures/paraglider_item.png new file mode 100644 index 0000000000000000000000000000000000000000..bca3c1f0f9d24f5aa236843f706e1487fff19720 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPNGY_XK-}RbJsz4#h64!_l=ltB<)VvY~=c3falGGH1 z^30M91$R&1fbd2>aiF3kPZ!4!i_^&o5*Y_N^a>sw>HPo0BqAch;E_qggtVBp1E#{s z47;qTsDie{uKbLh*2~7ZZ7*pQ> literal 0 HcmV?d00001