From aa84007e2ff5ac56d57a59d2729e856e5be6793c Mon Sep 17 00:00:00 2001 From: cale Date: Sat, 16 Jan 2016 12:37:34 +0100 Subject: [PATCH] added kits --- mods/classes/init.lua | 10 ++++++++++ mods/classes/init.lua~ | 10 ++++++++++ mods/kits/LICENSE.txt | 11 +++++++++++ mods/kits/LICENSE.txt~ | 11 +++++++++++ mods/kits/init.lua | 31 +++++++++++++++++++++++++++++++ mods/kits/init.lua~ | 31 +++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+) create mode 100644 mods/kits/LICENSE.txt create mode 100644 mods/kits/LICENSE.txt~ create mode 100644 mods/kits/init.lua create mode 100644 mods/kits/init.lua~ diff --git a/mods/classes/init.lua b/mods/classes/init.lua index 067b91d..2148e80 100644 --- a/mods/classes/init.lua +++ b/mods/classes/init.lua @@ -106,6 +106,8 @@ end classes.register_class("farmer") classes.register_class("warrior") +classes.register_class("thief") +classes.register_class("healer") classes.load_selected_classes() @@ -150,3 +152,11 @@ classes.register_weapon("pitchfork",20, 30, { class = "farmer", }) +classes.register_weapon("stick",0, 30, { + description = "Stick", + inventory_image = "classes_stick.png", + wield_scale = {x = 1, y=1, z = 1}, + damage = 7, + class = "thief", +}) + diff --git a/mods/classes/init.lua~ b/mods/classes/init.lua~ index 067b91d..2148e80 100644 --- a/mods/classes/init.lua~ +++ b/mods/classes/init.lua~ @@ -106,6 +106,8 @@ end classes.register_class("farmer") classes.register_class("warrior") +classes.register_class("thief") +classes.register_class("healer") classes.load_selected_classes() @@ -150,3 +152,11 @@ classes.register_weapon("pitchfork",20, 30, { class = "farmer", }) +classes.register_weapon("stick",0, 30, { + description = "Stick", + inventory_image = "classes_stick.png", + wield_scale = {x = 1, y=1, z = 1}, + damage = 7, + class = "thief", +}) + diff --git a/mods/kits/LICENSE.txt b/mods/kits/LICENSE.txt new file mode 100644 index 0000000..dc44a2b --- /dev/null +++ b/mods/kits/LICENSE.txt @@ -0,0 +1,11 @@ +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 diff --git a/mods/kits/LICENSE.txt~ b/mods/kits/LICENSE.txt~ new file mode 100644 index 0000000..dc44a2b --- /dev/null +++ b/mods/kits/LICENSE.txt~ @@ -0,0 +1,11 @@ +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 diff --git a/mods/kits/init.lua b/mods/kits/init.lua new file mode 100644 index 0000000..fbb96d5 --- /dev/null +++ b/mods/kits/init.lua @@ -0,0 +1,31 @@ +kits = {} +kits.all_kits = {} +function kits.register_kit(name, items) + kits.all_kits[name] = items +end + +function kits.select_kit(player, name) + kit = kits.all_kits[name] + for i, item in ipairs(kit) do + player:get_inventory():add_item('main', item) + end +end + +minetest.register_chatcommand("kit", { + params = "", + description = "Select your kit.", + privs = {interact = true}, + func = function(plname , name) + local player = minetest.get_player_by_name(plname) + if kits.all_kits[name] then + kits.select_kit(player, name) + return true, "You selected ".. name + else + return true, "There is no kit named ".. name + end + end, +}) + +kits.register_kit("basic", {"default:log_3 10", "default:log_1 10"}) +kits.register_kit("customer", {"default:coin 10", "default:log_3 1", "default:log_1 1"}) +kits.register_kit("hardcore", {"default:log_3 1", "default:log_1 1"}) diff --git a/mods/kits/init.lua~ b/mods/kits/init.lua~ new file mode 100644 index 0000000..fbb96d5 --- /dev/null +++ b/mods/kits/init.lua~ @@ -0,0 +1,31 @@ +kits = {} +kits.all_kits = {} +function kits.register_kit(name, items) + kits.all_kits[name] = items +end + +function kits.select_kit(player, name) + kit = kits.all_kits[name] + for i, item in ipairs(kit) do + player:get_inventory():add_item('main', item) + end +end + +minetest.register_chatcommand("kit", { + params = "", + description = "Select your kit.", + privs = {interact = true}, + func = function(plname , name) + local player = minetest.get_player_by_name(plname) + if kits.all_kits[name] then + kits.select_kit(player, name) + return true, "You selected ".. name + else + return true, "There is no kit named ".. name + end + end, +}) + +kits.register_kit("basic", {"default:log_3 10", "default:log_1 10"}) +kits.register_kit("customer", {"default:coin 10", "default:log_3 1", "default:log_1 1"}) +kits.register_kit("hardcore", {"default:log_3 1", "default:log_1 1"})