added kits
This commit is contained in:
parent
42b7f9876a
commit
aa84007e2f
@ -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",
|
||||
})
|
||||
|
||||
|
@ -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",
|
||||
})
|
||||
|
||||
|
11
mods/kits/LICENSE.txt
Normal file
11
mods/kits/LICENSE.txt
Normal file
@ -0,0 +1,11 @@
|
||||
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
|
11
mods/kits/LICENSE.txt~
Normal file
11
mods/kits/LICENSE.txt~
Normal file
@ -0,0 +1,11 @@
|
||||
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
|
31
mods/kits/init.lua
Normal file
31
mods/kits/init.lua
Normal file
@ -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 = "<name>",
|
||||
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"})
|
31
mods/kits/init.lua~
Normal file
31
mods/kits/init.lua~
Normal file
@ -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 = "<name>",
|
||||
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"})
|
Loading…
x
Reference in New Issue
Block a user